mac-rom/OS/MemoryMgr/MemoryMgrPriv.a

188 lines
7.3 KiB
Plaintext
Raw Normal View History

;
; File: MemoryMgrPriv.a
;
; Contains: Definitions for Macintosh Assembly Language Memory Manager
;
; Supports multiple heap zones with mixed relocatable and non-relocatable
; storage blocks.
;
; Reorganized from code designed and written by Bud Tribble, 27-Nov-81,
; and maintained and modified by Angeline Lo, Larry Kenyon,
; and Andy Hertzfeld.
;
; Written by: Bud Tribble
;
; Copyright: <09> 1983-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <2> 3/4/92 kc Add pVMGlobals equate.
; <1> 10/2/91 JSM first checked in
; <0> 10/1/91 JSM Created from HeapDefs.a.
;
; Modification history from HeapDefs.a below:
;
; <3> 9/30/91 JSM Don<6F>t use is32BitClean conditional, all future ROMs will be.
; <2> 9/16/91 JSM Add header.
; <1.4> 7/15/89 CSL Added equ NRBbit.
; <1.3> 3/22/89 CSL moved EQUS MMPRAMloc, MMFlags, and bit settings for MMFlags to
; Private.a.
; <1.2> 2/28/89 CSL Added Jump vector offsets for 24/32 bit memory manager
; <1.1> 11/10/88 CCH Fixed Header.
; <1.0> 11/9/88 CCH Adding to EASE.
; <1.0> 2/10/88 BBM Adding file for the first time into EASE<53>
; <C102> 8/2/86 WRL Changed the default System Zone size to 6k (same as default
; Application Zone size) so that we can allow it to grow
; dynamically during system startup to accommodate an arbitrary
; number of device drivers.
; 4/18/85 JTC Added flag SmartSetSize to control new strategy. <18Apr85>
; 4/14/85 JTC Added flag GrowDown to flag application zone growth downwards.
; <14Apr85>
; 3/11/85 JTC Cut sys heap back to 14.5K, a la, SysHeapSize
; 1/29/85 JTC Added FNGZResrv=3, FGZAlways=2 flag bits, even though shouldn't
; be here UUUGGGGHHHHHHHHHHH
; 1/25/85 LAK Removed equates which were moved to SysEqu.Text.
; 8/12/83 LAK Added ClearBit equate.
; 7/30/83 LAK Added equates for PurgePtr and AllocPtr. Also added equates for
; Flags byte: FNSelCompct,FNoRvrAlloc,FNSelPurge,FRelAtEnd.
; 7/18/83 LAK Removed FreeList stuff completely; removed TLock, TPurge;
; removed Trap macro and check hook offsets.
; 6/21/83 MPH Put FreeList code under assembly switch: FList.
; 6/17/83 MPH Removed moveRelProc from Heap object, inserted spare.
; 6/10/83 MPH Removed Definition of Nil, use Nil from GrafTypes.
; 3/29/83 MPH added purgeProc and moverelProc entries to zone object.
; 3/20/83 MPH changed memory size constants to support 512 K byte machine;
; added PtrMask and HandleMask to allow garbage in high byte of
; ptrs or handles passed to memory manager; removed "checking"
; conditional from ChkZone macro.
; 2/17/83 LAK added dfltStackSize for defltApplLimit.
;
BLANKS ON
STRING ASIS
FNGZResrv EQU 3
FGZAlways EQU 2
; These constants control conditional assembly.
RAMTest EQU 0 ;special RAM nonsense <10May85>
GrowDown EQU 0 ;permit ApplZone downward growth <14Apr85>
SmartSetSize EQU 1 ;try smarter stratey <18Apr85>
;Checking .Equ 0 ;check arguments and data structures
;Statistics .Equ 0 ;gather statistics on usage
;Robust .Equ 0 ;enables super-robust internal checks
;CountMPs .Equ 0 ;enables counting of master pointers
;DfltFlags .Equ 0 ;Checking is on when zone is init'd
MinZone EQU HeapData+(4*MinFree)+(8*dfltMasters)
;Minimum size for Applic. Zone
;
; Heap Zone Default Sizes
;
SysZoneSize EQU $1800 ; default System Zone size <C102>
AppZoneSize EQU $1800 ; default Application Zone size <C102>
;----------------------------------------------------------------------
; Macros
;
MACRO ;Get theZone into a register
GetZ
MOVE.L theZone,&Syslst[1]
ENDM
MACRO ;Set theZone with a register's value
SetZ
MOVE.L &Syslst[1],theZone
ENDM
MACRO
Equal
IF Checking THEN
Move.L &Syslst[1],-(SP)
Move.L &Syslst[2],-(SP)
JSR EqualCheck
ENDIF
ENDM
MACRO
Even
IF Checking THEN
MOVE.L &Syslst[1],-(SP)
JSR EvenCheck
ENDIF
ENDM
MACRO
Range
IF Checking THEN
MOVE.L &Syslst[1],-(SP)
MOVE.L &Syslst[2],-(SP)
MOVE.L &Syslst[3],-(SP)
JSR RangeCheck
ENDIF
ENDM
pVMGlobals EQU $B78 ; VM Globals
NRBbit EQU $06 ; non-rel. block bit in first byte block header <v1.4>
Zone32Flag EQU $1E ; flag to indicate if zone is 32 bit or 24 bit <v1.2>
Is32Zone EQU $01 ; value for Zone32Flag to indicate 32 bit
Is24Zone EQU $00 ; value for Zone32Flag to indicate 24 bit
ZoneJumpV EQU $20 ; offset to jump vector in zone header <v1.2>
JSetApplBase EQU 0 ; ( 0) jump vector offset <v1.2>
JInitApplZone EQU JSetApplBase+4 ; ( 4) jump vector offset <v1.2>
JInitZone EQU JInitApplZone+4 ; ( 8) jump vector offset <v1.2>
JGetZone EQU JInitZone+4 ; ( C) jump vector offset <v1.2>
JSetZone EQU JGetZone+4 ; (10) jump vector offset <v1.2>
JMaxBlock EQU JSetZone+4 ; (14) jump vector offset <v1.2>
JPurgeSpace EQU JMaxBlock+4 ; (18) jump vector offset <v1.2>
JCompactMem EQU JPurgeSpace+4 ; (1C) jump vector offset <v1.2>
JPurgeMem EQU JCompactMem+4 ; (20) jump vector offset <v1.2>
JFreeMem EQU JPurgeMem+4 ; (24) jump vector offset <v1.2>
JResrvMem EQU JFreeMem+4 ; (28) jump vector offset <v1.2>
JMaxMem EQU JResrvMem+4 ; (2C) jump vector offset <v1.2>
JSetGrowZone EQU JMaxMem+4 ; (30) jump vector offset <v1.2>
JSetApplLimit EQU JSetGrowZone+4 ; (34) jump vector offset <v1.2>
JStackSpace EQU JSetApplLimit+4 ; (38) jump vector offset <v1.2>
JMaxApplZone EQU JStackSpace+4 ; (3C) jump vector offset <v1.2>
JNewPtr EQU JMaxApplZone+4 ; (40) jump vector offset <v1.2>
JDisposePtr EQU JNewPtr+4 ; (44) jump vector offset <v1.2>
JGetPtrSize EQU JDisposePtr+4 ; (48) jump vector offset <v1.2>
JSetPtrSize EQU JGetPtrSize+4 ; (4C) jump vector offset <v1.2>
JPtrZone EQU JSetPtrSize+4 ; (50) jump vector offset <v1.2>
JNwHandle EQU JPtrZone+4 ; (54) jump vector offset <v1.2>
JNewEmptyHandle EQU JNwHandle+4 ; (58) jump vector offset <v1.2>
JDsposeHandle EQU JNewEmptyHandle+4 ; (5C) jump vector offset <v1.2>
JGetHandleSize EQU JDsposeHandle+4 ; (60) jump vector offset <v1.2>
JSetHandleSize EQU JGetHandleSize+4 ; (64) jump vector offset <v1.2>
JHandleZone EQU JSetHandleSize+4 ; (68) jump vector offset <v1.2>
JRecoverHandle EQU JHandleZone+4 ; (6C) jump vector offset <v1.2>
JEmptyHandle EQU JRecoverHandle+4 ; (70) jump vector offset <v1.2>
JReAllocHandle EQU JEmptyHandle+4 ; (74) jump vector offset <v1.2>
JHlock EQU JReAllocHandle+4 ; (78) jump vector offset <v1.2>
JHUnlock EQU JHlock+4 ; (7C) jump vector offset <v1.2>
JHPurge EQU JHUnlock+4 ; (80) jump vector offset <v1.2>
JHNoPurge EQU JHPurge+4 ; (84) jump vector offset <v1.2>
JHRSRC EQU JHNoPurge+4 ; (88) jump vector offset <v1.2>
JHNoRSRC EQU JHRSRC+4 ; (8C) jump vector offset <v1.2>
JHGetFlags EQU JHNoRSRC+4 ; (90) jump vector offset <v1.2>
JHSetFlags EQU JHGetFlags+4 ; (94) jump vector offset <v1.2>
JMoreMasters EQU JHSetFlags+4 ; (98) jump vector offset <v1.2>
JMoveHHi EQU JMoreMasters+4 ; (9C) jump vector offset <v1.2>