Specifications
System Macros Invoked by Drivers
LOCK_SYSTEM_PAGES
LOCK_SYSTEM_PAGES
Locks a paged code segment in system memory.
Format
LOCK_SYSTEM_PAGES [startva] ,endva [,ipl]
Parameters
[startva]
System virtual address in the first page to be locked. If the startva argument is
omitted, the starting virtual address defaults to the current PC.
endva
System virtual address in the last page to be locked.
[ipl]
IPL at which the locked code segment is to execute. If the ipl argument is
omitted, the locked code segment executes at the current IPL.
Description
The LOCK_SYSTEM_PAGES macro calls a memory management routine to lock
as many pages as necessary into the system working set. The macro accepts a
virtual address that indicates the first page to be locked and a virtual address
that indicates the last page to be locked. You can also supply the IPL at which
the code in the locked pages is to execute.
The LOCK_SYSTEM_PAGES macro executes under the following conditions:
• The LOCK_SYSTEM_PAGES macro should be used only on system virtual
addresses.
• All pages requested in a single LOCK_SYSTEM_PAGES macro call must be
virtually contiguous. If you must lock discontiguous memory, you must invoke
the LOCK_SYSTEM_PAGES macro once for each page or set of contiguous
pages.
• You must invoke LOCK_SYSTEM_PAGES at IPL 2 or lower to allow page
faulting to occur.
• When the locked code segment is finished, it must invoke the UNLOCK_
SYSTEM_PAGES macro to release all previously locked pages. In other
words, there must be exactly one UNLOCK_SYSTEM_PAGES macro call per
LOCK_SYSTEM_PAGES macro call.
• When it invokes the UNLOCK_SYSTEM_PAGES macro, the code must
ensure that the stack is exactly as it was when the LOCK_SYSTEM_PAGES
macro was invoked. That is, if the code has pushed anything on the stack, it
must remove it before invoking UNLOCK_SYSTEM_PAGES.
• If the ipl argument is supplied to the LOCK_SYSTEM_PAGES
macro, the locked code segment must invoke the appropriate system
synchronization macros (LOCK, FORKLOCK, or DEVICELOCK and
UNLOCK, FORKUNLOCK or DEVICEUNLOCK) to obtain and release
any spinlocks required to protect the resources accessed at the elevated IPL.
2–48