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 theGetPhysicalfunction.
FUNCTION GetPhysical (VAR addresses: LogicalToPhysicalTable; VAR physicalEntryCount: LongInt): OSErr;
addresses- A translation table. On entry, set the
logicalfield of this record to the block of memory to translate. On exit, thephysicalfield 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
GetPhysicalto return the number of table entries needed to translate the entire logical address range.DESCRIPTION
TheGetPhysicalfunction translates a logical address range into its corresponding physical address ranges. Thelogicalfield of theaddressestranslation table specifies the logical address range to be translated.GetPhysicaltranslates up to the size of the physical table or until it completes the translation, whichever occurs first.If you call
GetPhysicalwith thephysicalEntryCountparameter set to 0, it returns inphysicalEntryCountthe number of table entries needed to translate the entire address range. In this case, the translation table specified by theaddressesparameter is unchanged.If you call
GetPhysicalwith thephysicalEntryCountparameter set to a number greater than 0, it returns in thephysicalfield of theaddressestranslation table an array specifying the physical blocks that correspond to the logical address specified in thelogicalfield. In thephysicalEntryCountparameter,GetPhysicalreturns the number of entries in that array (which may be fewer than were asked for). If thephysicalfield of the translation table was not large enough to contain all the physical blocks corresponding to the logical block,GetPhysicalupdates the fields of thelogicalmemory block to reflect the remaining number of bytes in the logical range
left to translate (countfield) and the next address in the logical address range to translate (startfield).
- Note
- The logical address range must be locked to ensure validity of the translation data.
![]()
SPECIAL CONSIDERATIONS
TheGetPhysicalfunction as currently implemented under virtual memory supports only logical RAM. You cannot useGetPhysicalto 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.GetPhysicalreturns the result codeparamErrif 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 physicalEntryCountin table
Registers on exit A0 physicalEntryCounttranslatedD0 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 callingGetPhysicalto translate addresses to be sent to a NuBus master card.