Important: The information in this document is obsolete and should not be used for new development.
GetPhysical
To translate logical addresses into their corresponding physical addresses, use theGetPhysical
function.
FUNCTION GetPhysical (VAR addresses: LogicalToPhysicalTable; VAR physicalEntryCount: LongInt): OSErr;
addresses
- A translation table. On entry, set the
logical
field of this record to the block of memory to translate. On exit, thephysical
field of this record holds the corresponding physical address blocks.physicalEntryCount
- The number of physical entries to translate. On entry, set this field to 0 if you want
GetPhysical
to return the number of table entries needed to translate the entire logical address range.DESCRIPTION
TheGetPhysical
function translates a logical address range into its corresponding physical address ranges. Thelogical
field of theaddresses
translation table specifies the logical address range to be translated.GetPhysical
translates up to the size of the physical table or until it completes the translation, whichever occurs first.If you call
GetPhysical
with thephysicalEntryCount
parameter set to 0, it returns inphysicalEntryCount
the number of table entries needed to translate the entire address range. In this case, the translation table specified by theaddresses
parameter is unchanged.If you call
GetPhysical
with thephysicalEntryCount
parameter set to a number greater than 0, it returns in thephysical
field of theaddresses
translation table an array specifying the physical blocks that correspond to the logical address specified in thelogical
field. In thephysicalEntryCount
parameter,GetPhysical
returns the number of entries in that array (which may be fewer than were asked for). If thephysical
field of the translation table was not large enough to contain all the physical blocks corresponding to the logical block,GetPhysical
updates the fields of thelogical
memory block to reflect the remaining number of bytes in the logical range
left to translate (count
field) and the next address in the logical address range to translate (start
field).
- Note
- The logical address range must be locked to ensure validity of the translation data.
SPECIAL CONSIDERATIONS
TheGetPhysical
function as currently implemented under virtual memory supports only logical RAM. You cannot useGetPhysical
to translate addresses in the address spaces of the ROM, I/O devices, or NuBus slots. Some Macintosh computers map a portion of the physical RAM into NuBus space, to simulate the presence of a video expansion card.GetPhysical
returns the result codeparamErr
if you attempt to read that memory.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the GetPhysical function are
Trap macro Selector _MemoryDispatchA0Result $0005 The registers on entry and exit for this routine are
Registers on entry D0 Selector code A0 Pointer to a translation table A1 physicalEntryCount
in table
Registers on exit A0 physicalEntryCount
translatedD0 Result code RESULT CODES
noErr 0 No error paramErr -50 Error in parameter list notLockedErr -623 Specified range of memory is not locked interruptsMaskedErr -624 Called with interrupts masked SEE ALSO
See "Mapping Logical to Physical Addresses," beginning on page 3-16, for a method of callingGetPhysical
to translate addresses to be sent to a NuBus master card.