DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

os_register_msops(D3psm)


os_register_msops -- register MSOP entry points

Synopsis

   ms_bool_t os_register_msops(ms_opt_funct_t *msops)

Description

os_register_msops is called from pfxinitpsm to register MSOP entry points.

MSOP entry points are numbered, but are typically referenced using a standard mnemonic, for example, MSOP_INTR_ATTACH(D2psm). Zero is reserved and is not a legal MSOP number.

The exact mechanism by which the core kernel invokes MSOPs is operating-system specific, and is not visible to the PSM. In general, a call to an MSOP will result in an indirect call to the appropriate PSM entry point. An example might use a global structure containing the MSOP function pointers and macros similar to the following:

   #define MS_INTR_ATTACH(arg) (*msops.msop_intr_attach)(arg)
As an alternative, the kernel might use function stubs to avoid direct references to the msops structure. On IA-32 systems, this would be similar to:
   ENTRY(msop_intr_attach)
   jmp *msops+MSOP_INTR_ATTACH_OFFSET
MSOPs can be called only from the core kernel. They cannot be called from the PSM. The PSM may, however, call its own functions directly, provided that it manages the appropriate entry and exit conditions.

The PSM registers the functions that it supports by calling os_register_msops in the core kernel with a pointer to an array of msop_funct_t entries, terminated by msop_op == 0. The msop_func_t structure is:

   typedef struct {
      msop_t msop_op;
      void *msop_func;
   } msop_funct_t;
msop_func is void * because each function may have different argument types and return values.

The msops vector may initially be populated with default generic routines. os_register_msops replaces only the values for the MSOPs passed in.

os_register_msops may only be called from the initpsm(D2psm) function. The registered MSOPs may be called from any CPU. If a MSOP needs to perform some CPU-specific action, it can test or index using the value of os_this_cpu.

os_register_msops fails and returns MS_FALSE if an attempt is made to register an MSOP which is not defined as part of the version of the PSM interface version that the PSM is using. In this case, the only reasonable recovery for the PSM is itself to return MS_FALSE from its pfxinitpsm function, so that the core kernel may look for a more suitable PSM. This is considered a software error in the PSM itself, but since a runtime check for it is simple, it is acceptable, and encouraged as a technique.

Arguments


msops
MSOP entry point

Return values

os_register_msops( ) returns the following values:

MS_FALSE
PSM registration failed; initpsm must return MS_FALSE

MS_TRUE
PSM registration was successful

Usage

Hardware applicability

All.

Version applicability

psm: 2

References

initpsm(D2psm), MSOP_INTR_ATTACH(D2psm)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - 19 June 2005