Important: The information in this document is obsolete and should not be used for new development.
LockMemory
To make a portion of the address space immovable in physical memory and ineligible for paging, use theLockMemory
function.
FUNCTION LockMemory (address: UNIV Ptr; count: LongInt): OSErr;
address
- The starting address of the range of memory to be locked in RAM.
count
- The size, in bytes, of the range of memory to be locked in RAM.
DESCRIPTION
TheLockMemory
function makes the portion of the address space beginning ataddress
and having a size ofcount
bytes immovable in physical memory and ineligible for paging.If the
address
parameter supplied to theLockMemory
function is not on a page boundary, it is rounded down to the nearest page boundary. Similarly, if the specified range does not end on a page boundary, thecount
parameter is rounded up so that the entire range of memory is locked.The CPU marks locked pages as noncacheable. On Macintosh computers containing the Macintosh IIci ROM, all physical RAM is marked noncacheable.
ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theLockMemory
function are
Trap macro Selector _MemoryDispatch $0002 The registers on entry and exit for this routine are
Registers on entry D0 Selector code A0 Starting address A1 Number of bytes to lock
Registers on exit D0 Result code RESULT CODES
noErr 0 No error paramErr -50 Error in parameter list notEnoughMemoryErr -620 Insufficient physical memory interruptsMaskedErr -624 Called with interrupts masked