|
|
void os_claim_vectors(ms_ivec_t base_vec, ms_ivec_t nvec ms_intr_dist_t *(delivery_func)(ms_ivec_t vec))
The vector numbers are relative to the CPU interrupt table, and are not necessarily the same as the vector numbers used to attach individual interrupt sources. For a CPU without vectored interrupts, only vector number 0 is valid. os_claim_vectors may not be called from pfxinitpsm. It is typically called from MSOP_INIT_CPU(D2psm), MSOP_INTR_ATTACH(D2psm) and MSOP_INTR_DETACH(D2psm).
The specified interrupt delivery function will be called whenever an interrupt for one of the vectors in the range is delivered to the CPU, after processor registers and operating-system specific states have been saved. This function is responsible for identifying the interrupt slot for which the interrupt was delivered, either by simply looking at the CPU vector number argument or by examining some platform-specific hardware state as well. It must then return a pointer to the interrupt distribution structure that corresponds to the interrupt slot, as previously specified by MSOP_INTR_ATTACH(D2psm).
If the PSM detects that the interrupt was the result of one or more special events, it must call os_post_events(D3psm) to inform the core kernel of the events. (See also ms_event_t in Intro(D4psm) and MSOP_XPOST(D2psm) for details of special events.) Events may be derived from the device interrupts, or they may occur independently.
If the interrupt was handled internally to the PSM (for example, a spurious interrupt or a special event), and no attached handler is invoked, the delivery function should return the value of os_intr_dist_nop. If the delivery function can determine no reason for the interrupt to have occurred (nothing was attached to the interrupt slot, and it was not an internal event), the delivery function should return the value of os_intr_dist_stray.
The interrupt delivery function will be called with interrupts disabled at the CPU.
os_claim_vectors may be called multiple times, to claim discontiguous ranges or to assign different functions to different vectors. It may also be called at any time for vectors that have already been claimed, to change the function assigned to them.
os_claim_vectors affects all CPUs.