Important: The information in this document is obsolete and should not be used for new development.
LockMemoryContiguous
TheLockMemoryContiguousfunction is exactly like theLockMemoryfunction,
except that it attempts to obtain a contiguous block of physical memory associated
with the specified logical address range.
FUNCTION LockMemoryContiguous (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
TheLockMemoryContiguousfunction makes the portion of the address space beginning ataddressand having a size ofcountbytes immovable in physical memory and ineligible for paging. The function attempts to obtain a contiguous block of physical memory associated with the specified logical address range. It might not be possible to make a range physically contiguous if any of the pages contained in the range are already locked.If the
addressparameter supplied to theLockMemoryContiguousfunction 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, thecountparameter 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.
SPECIAL CONSIDERATIONS
Because a call toLockMemoryContiguousis not guaranteed to succeed,
all code that usesLockMemoryContiguousmust have an alternate method
for locking the necessary ranges of memory. In general, you should avoid usingLockMemoryContiguousif at all possible. If you must call it, do so as early as possible--preferably at system startup time--to increase the likelihood that enough contiguous memory can be found.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theLockMemoryContiguousfunction are
Trap macro Selector _MemoryDispatch $0004 The registers on entry and exit for this routine are
Registers on entry D0 Selector code A0 Starting address A1 Number of bytes to unlock
Registers on exit D0 Result code RESULT CODES