SparcSoftcardVM.Mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Christophe Cuenod May 31, 1988 5:47:19 pm PDT
Bill Jackson (bj) July 5, 1988 1:03:38 pm PDT
SparcSoftcardVM:
CEDAR
DEFINITIONS ~ {
Utilities
pageSiz: NAT ~ 2000H; -- SparcSoftcard.softcardPageSize
PagesForBytes: PROC [ bytes: CARD32 ] RETURNS [ pages: CARD32 ] ~ INLINE
{ pages ← bytes / pageSiz };
BytesForPages:
PROC [ pages:
CARD32 ]
RETURNS [
bytes:
CARD32 ] ~
INLINE
{ bytes ← pages *
pageSiz };
AddressForPageNumber: PROC [ page: CARD32 ] RETURNS [ address: CARD32 ] ~ INLINE
{ address ← page * pageSiz };
PageNumberForAddress: PROC [ address: CARD32 ] RETURNS [ page: CARD32 ] ~ INLINE
{ page ← address / pageSiz };
VM Allocation
Interval:
TYPE ~
RECORD [
page: CARD32,
count: CARD32
];
SimpleAllocate: PROC [ count: CARD32 ] RETURNS [ interval: Interval ];
Free: PROC [ interval: Interval ];
Pin: PROC [ interval: Interval ];
Unpin: PROC [ interval: Interval ];
Map Ops and Physical Memory usage
RealInterval:
TYPE ~
RECORD [
firstPage: CARD32,
pages: CARD32
];
AllocateRealMemory: PROC [ count: CARD32 ] RETURNS [ interval: RealInterval ];
ReclaimRealMemory: PROC [ interval: RealInterval ];
Flags: TYPE ~ MACHINE DEPENDENT { clean(0), readOnly(1), referenced(2), readOnlyReferenced(3), dirty(4), vacant(5), dirtyReferenced(6), copyOnWrite(7) };
SparcPageValue:
TYPE ~
RECORD [
flags: Flags ← clean,
nonCachable: BOOL ← FALSE,
interrupt: BOOL ← FALSE,
task: BYTE ← 0,
realPage: CARD32 ← 40000H -- an illegal value!
];
SetCPPageValue: PROC [ virtualPage: CARD32, value: SparcPageValue ];
GetCPPageValue: PROC [ virtualPage: CARD32 ] RETURNS [ value: SparcPageValue ];
{ cs, cp, ct0: BOOL }
user: [cs: 0, cp: x, ct0: x]
super: [cs: 1, cp: x, ct0: 0]
iop/cp: [cs: 1, cp: 0, ct0: 1]
dma: [cs: 1, cp: 1, ct0: 1]
SegmentType: TYPE ~ MACHINE DEPENDENT { userData(0), userDataAlt(1), userText(2), userTextAlt(3), superData(4), specialIO(5), superText(6), dma(7) };
SetPageValue: PROC [ segment: SegmentType, virtualPage: CARD32, value: SparcPageValue ];
GetPageValue: PROC [ segment: SegmentType, virtualPage: CARD32 ]
RETURNS [ value: SparcPageValue ];
Backdoor
PiecesForRealPage: PROC [ realPage: CARD32 ]
RETURNS [ realPageHiHi, realPageHiLo, realPageLo: CARD16 ];
RealPageFromPieces: PROC [ realPageHiHi, realPageHiLo, realPageLo: CARD16 ]
RETURNS [ realPage: CARD32 ];
PiecesForVirtualPage: PROC [ virtualPage: CARD32 ]
RETURNS [ mapSegment: CARD16, mapWindow: CARD16, mapOffset: CARD16 ];
VirtualPageFromPieces: PROC [ mapSegment: CARD16, mapWindow: CARD16, mapOffset: CARD16 ] RETURNS [ virtualPage: CARD32 ];
SetMapWindow: PROC [ index: NAT ];
GetMapWindow: PROC RETURNS [ index: NAT ];
SetMap: PROC [ mapWindow, mapOffset: CARD16, realPageHiHi, realPageHiLo, realPageLo: CARD32, value: SparcPageValue ];
GetMap: PROC [ mapWindow, mapOffset: CARD16 ] RETURNS [ value: SparcPageValue ];
SetRawPageValue: PROC [ virtualPage: CARD32, value: SparcPageValue ];
GetRawPageValue: PROC [ virtualPage: CARD32 ] RETURNS [ value: SparcPageValue ];
RMFreeList:
TYPE ~
RECORD [
firstPage: CARD32,
runCount: CARD32,
nextRunTail: CARD32
];
FlushRMFreeList: PROC [ rm: RMFreeList ];
ChaseRMFreeList: PROC [ runTail: CARD32 ] RETURNS [ rm: RMFreeList ];
InitSparcRM: PROC;
}.