<<< VAXAXP::NOTES$:[NOTES$ARCHIVE]ALPHANOTES_V1.NOTE;1 >>> -< Alpha Support conference >- ================================================================================ Note 1371.1 Special Kernel mode ASTs 1 of 22 VAXWRK::SWARD "Common sense is not that common" 94 lines 4-JAN-1993 14:20 -< There is still hope.. >- -------------------------------------------------------------------------------- Your old method will not work on VMS for AXP. You could still copy your code to a piece of nonpaged pool BUT you would also to have to create a linkage section AND fill it in correctly for your target process to use it and this becomes slightly nontrivial. However if you only want to access the other process address space/registers there is a very neat readymade solution for you. EXE$READ_PROCESS( IPID, !Target process internal PID BUFFER_SIZE, !Number of bytes to transfer TARGET_ADDRESS, !Address in target process LOCAL_ADDRESS, !Address for data in local process TARGET_ADDRESS_TYPE, !Either virtual memory or register AST_COUNTER_ADDRESS !Address of a counter to identify ! the different reads/writes ) This routine is used to read data from the address space of another process into a buffer in the address space of the "current" process (or process making the call to this routine). The IPID designates the target process. The TARGET_ADDRESS is in the address space of the target process while LOCAL_ADDRESS is in the address space of the calling process. The return status will either indicate success or the type of failure encountered (such as SS$_ACCVIO, failures to queue an AST, nonexistent process, etc.). This routine will not return to its caller until the read is complete or an error is encountered. So it may take considerable time to complete. This routine allocates an ACB large enough to accommodate the ACB fields (which includes the target process IPID), some flags, the local and target addresses, the buffer size, the source process IPID, the process image count (PHD$L_IMGCNT), and the data buffer. The exec support routine EXE$READ_PROCESS_AST is setup to be delivered as a special kernel mode AST to the target process and then is queued to the target process. EXE$READ_PROCESS also does such things as probing write access to the local buffer, placing the process into an ASTWAIT state, waiting for read completion, etc. The parameter TARGET_ADDRESS_TYPE should have a constant indicating whether the TARGET_ADDRESS is a memory location or a register. If it's a register, then TARGET_ADDRESS contains a register number. The definitions needed are in PROC_READ_WRITE.SDL which is part of LIB. The BUFFER_SIZE parameter is still a byte length when TARGET_ADDRESS_TYPE is register. If it's 8, only one register is read/written, otherwise more than one register may be read/written. (If it's not a multiple of 8, a partial register is read/written) However, BUFFER_SIZE may not extend beyond the number of valid registers. AST_COUNTER_ADDRESS is the address of a longword (initially set to 0) which is incremented by EXE$READ_PROCESS and EXE$WRITE_PROCESS and saved on the stack. This is used to detect errors. The address should be the same one for every call to these routines! The register symbols you can use are EACB$K_R0 through EACB$K_R29, EACB$K_PC, EACB$K_PS for the TARGET_ADDRESS. The data will be put in the buffer in that order if you specify a BUFFER_SIZE longer than one register. For the TARGET_ADDRESS_TYPE the symbols are EACB$K_GENERAL_REGISTER, EACB$K_MEMORY. EXE$WRITE_PROCESS( IPID, !Target process internal PID BUFFER_SIZE, !Number of bytes to transfer LOCAL_ADDRESS, !Address of data in local process TARGET_ADDRESS, !Address in target process TARGET_ADDRESS_TYPE, !Either virtual address or register AST_COUNTER_ADDRESS !Address of a counter to identify ! the different reads/writes ) This routine is used to write data from the address space of the current process into the address space of the target process. The IPID designates the target process. The TARGET_ADDRESS is in the address space of the target process while LOCAL_ADDRESS is in the address space of the calling process. The return status will either indicate success or the type of failure encountered (such as SS$_ACCVIO, failures to queue an AST, nonexistent process, etc.). This routine will not return to its caller until the write is complete or an error is encountered. This is to insure that the caller knows that the write has completed. So it may take some time to complete. This routine allocates an ACB large enough to accommodate the ACB fields (which includes the target process IPID), some flags, the target address, the buffer size, the source process IPID, and the data buffer. The exec support routine EXE$WRITE_PROCESS_AST is setup to be delivered as a special kernel mode AST to the target process and then is queued to the target process. EXE$WRITE_PROCESS also does such things as probing read access to the local buffer, copying the data from the LOCAL_ADDRESS into the ACB data buffer, placing the process into an ASTWAIT state, waiting for write completion, etc.