SoftcardPresent:
PUBLIC
PROC
RETURNS [ present:
BOOL ] ~ {
magic: BYTE ~ 05Ah; -- Arbitrary constant
magicNot: BYTE ~ 0A5h; -- Another arbitrary constant
value: BYTE ~ PeekPokePeekRestore[tRegisterByte, magic, tRegisterAlternateByte];
valueNot: BYTE ~ PeekPokePeekRestore[tRegisterAlternateByte, magicNot, tRegisterByte];
present ← (value=magic) AND (valueNot=magicNot);
};
InitializeCPandIOPMaps:
PUBLIC
PROC ~ {
iOPEntry, cPEntry: SparcSoftcardMap.MapEntry;
iOPEntry.vMSpace.name ← iOP;
cPEntry.vMSpace.name ← cP;
iOPEntry.virtualAddressByte ← cedarMemoryExtensionBaseByte;
iOPEntry.realAddressByte ← 0;
cPEntry.virtualAddressByte ← cedarMemoryExtensionBaseByte;
cPEntry.realAddressByte ← 0;
FOR i:
INT
IN [0..cedarMemoryExtensionSizeByte/softcardPageSizeByte)
DO
SparcSoftcardMap.WriteMapEntry[iOPEntry];
iOPEntry.virtualAddressByte ← iOPEntry.virtualAddressByte + softcardPageSizeByte;
iOPEntry.realAddressByte ← iOPEntry.realAddressByte+softcardPageSizeByte;
SparcSoftcardMap.WriteMapEntry[cPEntry];
cPEntry.virtualAddressByte ← cPEntry.virtualAddressByte+softcardPageSizeByte;
cPEntry.realAddressByte ← cPEntry.realAddressByte+softcardPageSizeByte;
ENDLOOP;
};
InsertSoftcardPhysicalMemory:
PUBLIC
PROC [
reclaim:
PROC [ PrincOps.RealPageNumber ] ] ~ {
startingPage:
NAT ~ cedarMemoryExtensionBaseByte / (2*PrincOps.wordsPerPage);
start memory at 1.5 meg in Daybreak adress space
endingPage:
NAT ~ (cedarMemoryExtensionBaseByte+cedarMemoryExtensionSizeByte) / (2*PrincOps.wordsPerPage);
end memory at 3.5 meg in Daybreak adress space
FOR p: PrincOps.PageNumber
IN [startingPage..endingPage)
DO
reclaim[p];
ENDLOOP;
};
InitializeSoftcard:
PUBLIC
PROC [ reclaim:
PROC [ real: PrincOps.RealPageNumber ] ] ~ {
IF ( NOT SoftcardPresent[] ) THEN RETURN;
InitializeCPandIOPMaps[];
InsertSoftcardPhysicalMemory[reclaim];
DoveInputOutput.Noop[];
};
}.