BasicLoaderProc: Commander.CommandProc ~ {
in: IO.STREAM ← IO.RIS[cmd.commandLine];
inputFile: ROPE ← GetCmdToken[in];
m: Module ← SunADotOut.ModuleFromFile[inputFile];
sparcVMSize: CARD32 ~ 600000H - SparcSoftcardVM.pageSiz; -- 6 Meg minus one page.. the first 256 K are covered by backdoor
backdoorSize: CARD32 ~ 040000H; -- 256 K...
numberOfSparcPages: CARD16 ~ sparcVMSize / SparcSoftcardVM.pageSiz;
numberOfBackdoorPages: CARD16 ~ backdoorSize / SparcSoftcardVM.pageSiz;
numberOfUserPages: CARD16 ~ 02000H;
numberOfSuperPages: CARD16 ~ 02000H;
startAddress: CARD32 ~ 0200000H; --Uses real mem starting at 2 meg
loadText, loadData, loadBss: CARD32;
symbol: SunADotOutPrivate.Symbol;
firstModuleLoaded: ROPE ~ "initializesparc.o"; -- Name of the init module
Reset the Sparc and the cache
SparcSoftcardOps.SparcReset[];
SparcSoftcardOps.SparcCacheDisable[];
SparcSoftcardOps.SparcCacheFlushAndEnable[];
=== For christian tests ===
Set all the Sparc map entries to point outside any used area (the last page of the memory)
PresetSparcVM[userData, numberOfUserPages, sparcVMSize];
PresetSparcVM[userDataAlt, numberOfUserPages, sparcVMSize];
PresetSparcVM[userText, numberOfUserPages, sparcVMSize];
PresetSparcVM[userTextAlt, numberOfUserPages, sparcVMSize];
PresetSparcVM[superData, numberOfSuperPages, sparcVMSize];
PresetSparcVM[superText, numberOfSuperPages, sparcVMSize];
Set the map entries
SetSparcVM[userData, numberOfSparcPages, startAddress];
SetSparcVM[userText, numberOfSparcPages, startAddress];
SetSparcVM[superData, numberOfSparcPages, startAddress];
SetSparcVM[superText, numberOfSparcPages, startAddress];
SetBackdoorVM[numberOfBackdoorPages, startAddress];
Computes load address for text
IF RedBlackTree.LookupNode[m.symbolTable, firstModuleLoaded] =
NIL
THEN
ERROR;
The first module to be linked has to be called "firstModuleLoaded"
symbol ←
NARROW[RedBlackTree.LookupNode[m.symbolTable, firstModuleLoaded].data];
The loading address is the address of the first module
loadText ← symbol.value;
Loads text
LoadSegment[m.programText, loadText];
Computes load address for data
loadData ← Basics.
BITAND[(loadText + m.programText.block.count + SparcSoftcardVM.pageSiz - 1), Basics.
BITNOT[SparcSoftcardVM.pageSiz - 1]];
Round to the beginning of the page following the end of the text
Loads data
LoadSegment[m.programData, loadData];
Computes address for bss
loadBss ← loadData + m.programData.block.count;
Bss will be zeroed after the end of the data segment
Zero bss
ZeroSegment[loadBss, m.header.bss];
Clean up: Insert the reset pointer and the vmSize pointer
InsertResetPointer[m.header.entryPoint];
IndicateVMSize[sparcVMSize];
Put in a wellknown address the VM Size so the init program can load the Stack with it
Start the sparc
SparcSoftcardOps.SparcResetAndStart[];