HP OpenVMS Systems Documentation |
Upgrading Privileged-Code Applications on OpenVMS Alpha and OpenVMS I64 Systems
4.6.1 Example: Declaring 64-Bit FunctionsOriginal:
64-Bit Version:
4.6.2 Example: Declaring 64-Bit Buffered I/O PacketOriginal:
64-Bit Version:
4.6.3 Example: Changes to LR$WRITEOriginal:
64-Bit Version:
4.6.4 Example: Changes to LR$SETMODEOriginal:
64-Bit Version:
4.6.5 Example: Changes to LR$STARTIOOriginal:
64-Bit Version:
Chapter 5
|
Component | Symbol | Description |
---|---|---|
User-supplied rundown routine for executive mode services | PLV$PS_EXEC_RUNDOWN_HANDLER | May contain the address of a user-supplied rundown routine that performs image-specific cleanup and resource deallocation. When the image linked against the user-written system service is run down by the system, this run-time routine is invoked. Unlike exit handlers, the routine is always called when a process or image exits. (Image rundown code calls this routine with a JSB instruction; it returns with an RSB instruction called in executive mode at IPL 0.) |
Kernel Routine Flags Vector | PLV$PS_KERNEL_ROUTINE_FLAGS | Contains either the address of an array of longwords which contain the defined flags associated with each kernel system service, or a zero. Table 5-2 contains a description of the available flags. |
Executive Routine Flags Vector | PLV$PS_EXEC_ROUTINE_FLAGS | Contains either the address of an array of longwords which contain the defined flags associated with each executive mode system service, or a zero. Table 5-2 contains a description of the available flags. |
Flag | Description |
---|---|
PLV$M_WAIT_CALLERS_MODE | Informs the system service dispatcher that the service can return the status SS$_WAIT_CALLERS_MODE. This flag can only be specified for kernel mode services. |
PLV$M_WAIT_CALLERS_NO_REEXEC | Informs the system service dispatcher that the service can return the status SS$_WAIT_CALLERS_MODE but should not reexecute the service. This flag can only be specified for kernel mode services. |
PLV$M_CLRREG | Informs the system service dispatcher to clear the scratch integer registers before returning to the system service requestor. A security-related service may set this flag to ensure that sensitive information is not left in scratch registers. This flag can be specified for both kernel and executive mode system services. |
PLV$M_RETURN_ANY | Flags the system service dispatcher that the service can return arbitrary values in R0. This flag can only be specified for kernel mode system services. |
PLV$M_WCM_NO_SAVE | Informs the system service dispatcher that the service has taken steps to save the contents of the scratch integer registers. In this case, the dispatcher will not take the extra steps to save and restore these registers. This flag can only be specified for kernel mode system services. |
PLV$M_STACK_ARGS | Use of this flag is reserved to Compaq. |
PLV$M_THREAD_SAFE | Informs the system service dispatcher that the service requires no explicit synchronization. It is assumed by the dispatcher that the service provides its own internal data synchronization and that muliple kernel threads can safely execute other inner mode code in parallel. This flag can be specified for both kernel and executive mode system services. |
PLV$M_64_BIT_ARGS | Informs the system service dispatcher that the service can accept 64-bit virtual addresses. When set, the dispatcher will not perform the sign-extension check on the service arguments. The sign-extension check is the method used to guarantee that only 32-bit, sign-extended virtual addreses are passed to system services. This check is enabled by default. This flag can be specified for both kernel and executive mode system services. |
PLV$M_CHECK_UPCALL | Use of this flag is reserved to Compaq. |
Example 5-1 Creating a Privileged Library Vector (PLV) for C on Alpha Systems |
---|
/* "Forward routine" declarations */ int first_service(), second_service(), third_service(), fourth_service(); int rundown_handler(); /* Kernel and exec routine lists: */ int (*(kernel_table[]))() = { first_service, second_service, fourth_service}; int (*(exec_table[]))() = { third_service}; /* ** Kernel and exec flags. The flag settings below enable second_service ** and fourth_service to be 64-bit capable. First_service and third_service ** cannot accept a 64-bit pointer. Attempts to pass 64-bit pointers to ** these services will result in a return status of SS$_ARG_GTR_32_BITS. ** The PLV$M_64_BIT_ARGS flag instructs the system service dispatcher to ** bypass sign-extension checking of the service arguments for a particular ** service. */ int kernel_flags [] = { 0, PLV$M_64_BIT_ARGS, 0}, exec_flags [] = { PLV$M_64_BIT_ARGS}; /* ** The next two defines allow the kernel and executive routine counts ** to be filled in automatically after lists have been declared for ** kernel and exec mode. They must be placed before the PLV ** declaration and initialization, and for this module will be ** functionally equivalent to: ** ** #define KERNEL_ROUTINE_COUNT 3 ** #define EXEC_ROUTINE_COUNT 1 ** */ #define EXEC_ROUTINE_COUNT sizeof(exec_table)/sizeof(int *) #define KERNEL_ROUTINE_COUNT sizeof(kernel_table)/sizeof(int *) /* ** Now build and initialize the PLV structure. Since the PLV must have ** the VEC psect attribute, and must be the first thing in that psect, ** we use the strict external ref-def model which allows us to put the ** PLV structure in its own psect. This is like the globaldef ** extension in VAX C, where you can specify in what psect a global ** symbol may be found; unlike globaldef, it allows the declaration ** itself to be ANSI-compliant. Note that the initialization here ** relies on the change-mode-specific portion (plv$r_cmod_data) of the ** PLV being declared before the portions of the PLV which are specific ** to message vector PLVs (plv$r_msg_data) and system service intercept ** PLVs (plv$r_ssi_data). ** */ #ifdef __ALPHA #pragma extern_model save #pragma extern_model strict_refdef "USER_SERVICES" #endif extern const PLV user_services = { PLV$C_TYP_CMOD, /* type */ 0, /* version */ { {KERNEL_ROUTINE_COUNT, /* # of kernel routines */ EXEC_ROUTINE_COUNT, /* # of exec routines */ kernel_table, /* kernel routine list */ exec_table, /* exec routine list */ rundown_handler, /* kernel rundown handler */ rundown_handler, /* exec rundown handler */ 0, /* no RMS dispatcher */ kernel_flags, /* kernel routine flags */ exec_flags} /* exec routine flags */ } }; #ifdef __ALPHA #pragma extern_model restore #endif |
Previous | Next | Contents | Index |