DLionInputOutput.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Gobbel on: January 23, 1981 1:33 PM
Willie-Sue, January 31, 1985 2:54:57 pm PST
Russ Atkinson (RRA) February 19, 1985 3:28:29 pm PST
Doug Wyatt, February 22, 1985 4:52:09 pm PST
DIRECTORY
PrincOps USING [aGETF, aINPUT, aOUTPUT, InterimPageState, PageCount, PageNumber, RealPageNumber, wordsPerPage, zMISC],
PrincOpsUtils USING [AddressForPageNumber, PageNumberForAddress];
DLionInputOutput: DEFINITIONS
IMPORTS PrincOpsUtils
= BEGIN
Support for Dandelion heads (device face implementations)
IOPage: READONLY LONG POINTER;
I/O page. The general layout (beginning of each of the csb's) should also be defined here.
RegNum: TYPE = CARDINAL; -- used to index the I/O registers
Input: PROC[RegNum] RETURNS[WORD] = MACHINE CODE {
Read one word from specified controller register.
PrincOps.zMISC, PrincOps.aINPUT;
};
Output: PROC[datum: WORD, register: RegNum] = MACHINE CODE {
Write one word to specified controller register.
PrincOps.zMISC, PrincOps.aOUTPUT;
};
GetRealPage: PROC[page: PrincOps.PageNumber] RETURNS[PrincOps.RealPageNumber] = INLINE {
Return real page number currently mapped to given virtual page. Undefined if virtual page is not mapped. The following code could (should) be replaced by GetFlags when it is implemented. It depends on the fact that on Dandelion only the emulator updates map flags.
GetPageValue: PROC [virtual: CARDINAL]
RETURNS
[state: PrincOps.InterimPageState] = MACHINE CODE {
PrincOps.zMISC, PrincOps.aGETF;
};
RETURN[GetPageValue[page].realPage]
};
GetRealAddress: PROC[p: LONG POINTER] RETURNS[rp: LONG POINTER] = INLINE {
longPtr: TYPE = MACHINE DEPENDENT RECORD [lo, hi: CARDINAL];
RETURN[
LOOPHOLE[p, longPtr].lo MOD PrincOps.wordsPerPage +
PrincOpsUtils.AddressForPageNumber[
GetRealPage[PrincOpsUtils.PageNumberForAddress[p]]]];
this could take advantage of the fact that the add never carries
};
Memory description and support:
firstReservedPage: PrincOps.RealPageNumber = 0; -- special display/raven memory
reservedPageCount: PrincOps.PageCount = 256;
= [0..377B) = [0..100x) = [0..256D)
firstMapPage: PrincOps.RealPageNumber = 256; -- real memory reserved for map
mapPagesCount: PrincOps.PageCount = 64;
= [0..500B) = [0..140x) = [0..320D)
ioPageNumber: PrincOps.RealPageNumber = 320; -- = 140x = 500B
ioPageRealAddr: LONG POINTER = LOOPHOLE[240000B];
= 240000B = 14000x = 81920D
ioPageRealAddrLow: WORD = 40000B; -- low half of ioPageRealAddr
numberVirtualPages: PrincOps.PageCount = 40000B; -- = 16384D = 4000x
ReservedMemoryUse: TYPE = {notBusy, Raven, Display};
used to resolve contention for special memory
SetReservedMemoryUse: PROC[use: ReservedMemoryUse,
pagesNeeded: PrincOps.PageCount ← 0];
DonateReservedMemory: PROC[pagesToKeep: PrincOps.PageCount];
DonateReservedMemory is intended to be called from appropriately named modules, i.e. FreeAllReservedMemory, FreeReservedMemoryFor8KRaven, FreeReservedMemoryFor12KRaven, etc.
END.
LOG
Time: June 10, 1980 1:51 PM   By: Davies
Action: Create from D0InputOutput of May 15, 1980 10:54 AM.
Time: June 17, 1980 11:53 AM  By: McJones
Action: Add GetRealPage
Time: June 19, 1980 1:22 PM  By: Forrest
Action: reformat.
Time: June 23, 1980 12:09 PM  By: Forrest
Action: Page<=>LongPointer, GetRealAddress.
Time: July 28, 1980 11:27 AM  By: Forrest
Action: Upgrade to 5.0c build.
Time: July 31, 1980 11:16 PM  By: Forrest
Action: Fix GetRealAddress.
Time: November 10, 1980 2:23 PM By: Forrest
Action: Add memory configuration code AND DonateReservedMemory.
Time: January 22, 1981 11:25 AM By: Gobbel
Action: Move DonateReservedMemory to RealMemoryImplDLion.
Time: January 20, 1984 2:37 pm By: Andrew Birrell
Action: Convert to Cedar 5.1.