Specifications

System Macros Invoked by Drivers
FIND_CPU_DATA
FIND_CPU_DATA
Locates the start of the per-CPU database area (CPU) for the current process.
Format
FIND_CPU_DATA reg [,amod=G^] [,istack=NO]
Parameters
reg
Register to receive the base virtual address of the current processors per-CPU
database structure (CPU)).
[amod=G^]
Addressing mode.
[istack=NO]
Mechanism to calculate the base address of the per-CPU database structure.
Use istack=YES only when it is certain that the processor is executing on the
interrupt stack. The mechanism used when istack=NO is somewhat slower, but
works whether the processor is executing on the interrupt stack or kernel stack.
Description
The FIND_CPU_DATA macro loads the starting virtual address of the current
processor’s per-CPU database (CPU) into the specified register. A driver generally
invokes the FIND_CPU_DATA macro in the process of determining the current
process of the current CPU when executing in system context.
Such a driver must adhere to the following rules:
It must invoke the FIND_CPU_DATA macro in kernel mode at or above
IPL$_RESCHED.
It must ensure that it will not be rescheduled after issuing the macro while it
is using the information returned by FIND_CPU_DATA. It typically does this
by remaining at IPL$_RESCHED or greater.
Example
FIND_CPU_DATA R0
MOVL CPU$L_CURPCB(R0),R1
The FIND_CPU_DATA macro returns the starting virtual address of the current
processor’s per-CPU database in R0. The subsequent MOVL instruction obtains
the address of the process currently active on that processor and places it in R1.
2–32