DIRECTORY Basics USING [ LowByte ], DoveInputOutput USING [ Noop, Peek, Poke ], SparcSoftcardInit, PrincOps USING [ PageNumber, RealPageNumber, wordsPerPage ], Rope USING [ ], SparcSoftcard, SparcSoftcardOps; SparcSoftcardInitImpl: CEDAR PROGRAM IMPORTS Basics, DoveInputOutput, SparcSoftcardOps EXPORTS SparcSoftcardInit ~ { OPEN SparcSoftcard, SparcSoftcardOps; PeekPokePeekRestore: PROC [ byteAddress0: CARD32, content: CARD16, byteAddress1: CARD32 ] RETURNS [ lowByte: BYTE ] ~ { address0: CARD32 ~ byteAddress0/2; address1: CARD32 ~ byteAddress1/2; word0: CARD16 ~ DoveInputOutput.Peek[address0]; DoveInputOutput.Poke[address0, content]; { word1: CARD16 ~ DoveInputOutput.Peek[address1]; lowByte _ Basics.LowByte[word1]; }; DoveInputOutput.Poke[address0, word0]; }; 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 _ SELECT TRUE FROM ( value # magic ) => FALSE, ( valueNot # magicNot ) => FALSE, ENDCASE => TRUE; }; InitializeCPandIOPMaps: PUBLIC PROC ~ { iOPEntry, cPEntry: MapEntry; iOPEntry.vMSpace.name _ iOP; cPEntry.vMSpace.name _ cP; FOR i: INT IN [0..cedarMemoryExtensionSizeByte/softcardPageSizeByte) DO iOPEntry.virtualAddressByte _ cedarMemoryExtensionBaseByte + i * softcardPageSizeByte; iOPEntry.realAddressByte _ i * softcardPageSizeByte; WriteMapEntry[iOPEntry]; cPEntry.virtualAddressByte _ cedarMemoryExtensionBaseByte + i * softcardPageSizeByte; cPEntry.realAddressByte _ i * softcardPageSizeByte; WriteMapEntry[cPEntry]; ENDLOOP; }; InsertSoftcardPhyscialMemory: PUBLIC PROC [ reclaim: PROC [ PrincOps.RealPageNumber ] ] ~ { startingPage: NAT ~ cedarMemoryExtensionBaseByte / PrincOps.wordsPerPage; endingPage: NAT ~ ( cedarMemoryExtensionBaseByte + cedarMemoryExtensionSizeByte ) / PrincOps.wordsPerPage; 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[]; InsertSoftcardPhyscialMemory[reclaim]; DoveInputOutput.Noop[]; }; ResetSoftcard: PUBLIC PROC ~ { IF ( NOT SoftcardPresent[] ) THEN RETURN; InitializeCPandIOPMaps[]; DoveInputOutput.Noop[]; }; }. @SparcSoftcardInitImpl.Mesa Copyright Σ 1988 by Xerox Corporation. All rights reserved. Christophe Cuenod, September 12, 1988 9:35:17 am PDT Bill Jackson (bj) April 19, 1988 3:34:37 am PDT Private procs Public procs start memory at 1.5 meg in Daybreak adress space end memory at 3.5 meg in Daybreak adress space ΚV˜code•Mark outsideHeaderšœ™Kšœ<™