Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Memory /
Chapter 4 - Memory Management Utilities


Summary of the Memory Management Utilities

Pascal Summary

Constants

CONST
   {Gestalt constants}
   gestaltAddressingModeAttr  = 'addr';   {addressing mode attributes}
   gestalt32BitAddressing     = 0;        {started in 32-bit mode}
   gestalt32BitSysZone        = 1;        {32-bit compatible sys. zone}
   gestalt32BitCapable        = 2;        {machine is 32-bit capable}

   {addressing mode constants}
   false32b                   = 0;        {24-bit addressing mode}
   true32b                    = 1;        {32-bit addressing mode}

Routines

Setting and Restoring the A5 Register

FUNCTION SetCurrentA5		: LongInt;
FUNCTION SetA5			(newA5: LongInt): LongInt;

Changing the Addressing Mode

FUNCTION GetMMUMode		:SignedByte;
PROCEDURE SwapMMUMode		(VAR mode: SignedByte);

Manipulating Memory Addresses

FUNCTION StripAddress		(address: UNIV Ptr): Ptr;
FUNCTION Translate24To32	(addr24: UNIV Ptr): Ptr;

Manipulating the Processor Caches

FUNCTION SwapInstructionCache	(cacheEnable: Boolean): Boolean;
PROCEDURE FlushInstructionCache;
FUNCTION SwapDataCache		(cacheEnable: Boolean): Boolean;
PROCEDURE FlushDataCache;
PROCEDURE FlushCodeCache;
FUNCTION FlushCodeCacheRange	(address: UNIV Ptr; count: LongInt): OSErr;

C Summary

Constants

/*Gestalt constants*/
#define gestaltAddressingModeAttr   'addr';  /*addressing mode attributes*/
#define gestalt32BitAddressing      0;       /*started in 32-bit mode*/
#define gestalt32BitSysZone         1;       /*32-bit compatible sys. zone*/
#define gestalt32BitCapable         2;       /*machine is 32-bit capable*/

/*addressing mode constants*/
enum  {false32b      =  0};                  /*24-bit addressing mode*/
enum  {true32b       =  1};                  /*32-bit addressing mode*/

Routines

Setting and Restoring the A5 Register

long SetCurrentA5		(void);
long SetA5			(long newA5);

Changing the Addressing Mode

pascal char GetMMUMode		(void);
pascal void SwapMMUMode		(char *mode);

Manipulating Memory Addresses

pascal Ptr StripAddress		(Ptr address);
pascal Ptr Translate24To32	(Ptr addr24);

Manipulating the Processor Caches

pascal Boolean SwapInstructionCache
				(Boolean cacheEnable);
pascal void FlushInstructionCache
				(void);
pascal Boolean SwapDataCache(Boolean cacheEnable);
pascal void FlushDataCache	(void);
void FlushCodeCache		(void);
OSErr FlushCodeCacheRange	(void *address, unsigned long count);

Assembly-Language Summary

Trap Macros

Trap Macros Requiring Routine Selectors

_HWPriv
SelectorRoutine
$0000SwapInstructionCache
$0001FlushInstructionCache
$0002SwapDataCache
$0003FlushDataCache
$0009FlushCodeCacheRange

Global Variables
CurrentA5longAddress of the boundary between the application global variables and the application parameters of the current application.
MMU32BitbyteTRUE if 32-bit addressing mode is in effect.

Result Codes
noErr0No error
hwParamErr-502Processor does not support flushing a range


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996