PrincOps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Levin on September 20, 1983 10:54 am
Russ Atkinson (RRA) February 27, 1985 7:15:04 pm PST
Doug Wyatt, February 26, 1985 2:49:13 pm PST
This interface consists exclusively of type definitions for the architectural data structures of the Mesa processor. A companion interface, PrincOpsUtils, provides convenient operations (usually inline) for manipulating many of these structures.
Note to the casual reader: Most of the definitions in this interface are intended for use by wizards. Only the first section "Basic Types and Associated Values" is likely to be useful to general clients.
PrincOps: DEFINITIONS
= BEGIN
Basic Types and Associated Values
wordsPerPage: NAT = 256;
bytesPerWord: NAT = 2; -- officially, in Basics
bytesPerPage: NAT = wordsPerPage*bytesPerWord;
bitsPerWord: NAT = 16; -- officially, in Basics
logWordsPerPage: NAT = --LogBase2[wordsPerPage]--8;
logBytesPerWord: NAT = --LogBase2[bytesPerWord]--1; -- officially, in Basics
logBytesPerPage: NAT = logBytesPerWord + logWordsPerPage;
PageCount: TYPE = INT; -- actually, [0..maxPagesInVM]; intended for use by VM
PageNumber: TYPE = INT; -- actually, [0..2^24); intended for use by VM
BYTE: TYPE = CARDINAL [0..377B]; -- Compiler should supply; officially, in Basics
CARD: TYPE = LONG CARDINAL;
ShortPointer: TYPE = ORDERED POINTER [0..CARDINAL.LAST];
maxPagesInVM: PageCount = 65536; -- 2^16 pages = 24-bit address space
shortPointerSpan: PageCount = (ShortPointer.LAST-ShortPointer.FIRST).LONG.SUCC/wordsPerPage;
RawWords: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF WORD];
RawCards: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF CARDINAL];
RawBytes: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF BYTE];
RawChars: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF CHAR];
Instruction Set (wizards only)
Instructions
op: TYPE = [0..400B);
zNOOP: op = 0B; zME: op = 1B; zMRE: op = 2B; zMXW: op = 3B;
zMXD: op = 4B; zNOTIFY: op = 5B; zBCAST: op = 6B; zREQUEUE: op = 7B;
zLL0: op = 10B; zLL1: op = 11B; zLL2: op = 12B; zLL3: op = 13B;
zLL4: op = 14B; zLL5: op = 15B; zLL6: op = 16B; zLL7: op = 17B;
zLLB: op = 20B; zLLDB: op = 21B; zSL0: op = 22B; zSL1: op = 23B;
zSL2: op = 24B; zSL3: op = 25B; zSL4: op = 26B; zSL5: op = 27B;
zSL6: op = 30B; zSL7: op = 31B; zSLB: op = 32B; zPL0: op = 33B;
zPL1: op = 34B; zPL2: op = 35B; zPL3: op = 36B; zLG0: op = 37B;
zLG1: op = 40B; zLG2: op = 41B; zLG3: op = 42B; zLG4: op = 43B;
zLG5: op = 44B; zLG6: op = 45B; zLG7: op = 46B; zLGB: op = 47B;
zLGDB: op = 50B; zSG0: op = 51B; zSG1: op = 52B; zSG2: op = 53B;
zSG3: op = 54B; zSGB: op = 55B; zLI0: op = 56B; zLI1: op = 57B;
zLI2: op = 60B; zLI3: op = 61B; zLI4: op = 62B; zLI5: op = 63B;
zLI6: op = 64B; zLIN1: op = 65B; zLINI: op = 66B; zLIB: op = 67B;
zLIW: op = 70B; zLINB: op = 71B; zLADRB: op = 72B; zGADRB: op = 73B;
zLCO: op = 74B; zWCDBL: op = 76B; zICDBL: op = 77B;
zR0: op = 100B; zR1: op = 101B; zR2: op = 102B; zR3: op = 103B;
zR4: op = 104B; zRB: op = 105B; zW0: op = 106B; zW1: op = 107B;
zW2: op = 110B; zWB: op = 111B; zRF: op = 112B; zWF: op = 113B;
zRDB: op = 114B; zRD0: op = 115B; zWDB: op = 116B; zWD0: op = 117B;
zRSTR: op = 120B; zWSTR: op = 121B; zRXLP: op = 122B; zWXLP: op = 123B;
zRILP: op = 124B; zRIGP: op = 125B; zWILP: op = 126B; zRIL0: op = 127B;
zWS0: op = 130B; zWSB: op = 131B; zWSF: op = 132B; zWSDB: op = 133B;
zRFC: op = 134B; zRFS: op = 135B; zWFS: op = 136B; zRBL: op = 137B;
zWBL: op = 140B; zRDBL: op = 141B; zWDBL: op = 142B; zRXLPL: op = 143B;
zWXLPL: op = 144B; zRXGPL: op = 145B; zWXGPL: op = 146B; zRILPL: op = 147B;
zWILPL: op = 150B; zRIGPL: op = 151B; zWIGPL: op = 152B; zRSTRL: op = 153B;
zWSTRL: op = 154B; zRFL: op = 155B; zWFL: op = 156B; zRFSL: op = 157B;
zWFSL: op = 160B; zLP: op = 161B; zSLDB: op = 162B; zSGDB: op = 163B;
zPUSH: op = 164B; zPOP: op = 165B; zEXCH: op = 166B; zLINKB: op = 167B;
zDUP: op = 170B; zNILCK: op = 171B; zNILCKL: op = 172B; zBNDCK: op = 173B;
zJ2: op = 200B; zJ3: op = 201B; zJ4: op = 202B; zJ5: op = 203B;
zJ6: op = 204B; zJ7: op = 205B; zJ8: op = 206B; zJ9: op = 207B;
zJB: op = 210B; zJW: op = 211B; zJEQ2: op = 212B; zJEQ3: op = 213B;
zJEQ4: op = 214B; zJEQ5: op = 215B; zJEQ6: op = 216B; zJEQ7: op = 217B;
zJEQ8: op = 220B; zJEQ9: op = 221B; zJEQB: op = 222B; zJNE2: op = 223B;
zJNE3: op = 224B; zJNE4: op = 225B; zJNE5: op = 226B; zJNE6: op = 227B;
zJNE7: op = 230B; zJNE8: op = 231B; zJNE9: op = 232B; zJNEB: op = 233B;
zJLB: op = 234B; zJGEB: op = 235B; zJGB: op = 236B; zJLEB: op = 237B;
zJULB: op = 240B; zJUGEB: op = 241B; zJUGB: op = 242B; zJULEB: op = 243B;
zJZEQB: op = 244B; zJZNEB: op = 245B; zJIB: op = 246B; zJIW: op = 247B;
zADD: op = 250B; zSUB: op = 251B; zMUL: op = 252B; zDBL: op = 253B;
zDIV: op = 254B; zLDIV: op = 255B; zNEG: op = 256B; zINC: op = 257B;
zAND: op = 260B; zOR: op = 261B; zXOR: op = 262B; zSHIFT: op = 263B;
zDADD: op = 264B; zDSUB: op = 265B; zDCOMP: op = 266B; zDUCOMP: op = 267B;
zADD01: op = 270B;
zEFC0: op = 300B; zEFC1: op = 301B; zEFC2: op = 302B; zEFC3: op = 303B;
zEFC4: op = 304B; zEFC5: op = 305B; zEFC6: op = 306B; zEFC7: op = 307B;
zEFC8: op = 310B; zEFC9: op = 311B; zEFC10: op = 312B; zEFC11: op = 313B;
zEFC12: op = 314B; zEFC13: op = 315B; zEFC14: op = 316B; zEFC15: op = 317B;
zEFCB: op = 320B; zLFC1: op = 321B; zLFC2: op = 322B; zLFC3: op = 323B;
zLFC4: op = 324B; zLFC5: op = 325B; zLFC6: op = 326B; zLFC7: op = 327B;
zLFC8: op = 330B; zLFC9: op = 331B; zLFC10: op = 332B; zLFC11: op = 333B;
zLFC12: op = 334B; zLFC13: op = 335B; zLFC14: op = 336B; zLFC15: op = 337B;
zLFC16: op = 340B; zLFCB: op = 341B; zSFC: op = 342B; zRET: op = 343B;
zLLKB: op = 344B; zPORTO: op = 345B; zPORTI: op = 346B; zKFCB: op = 347B;
zDESCB: op = 350B; zDESCBS: op = 351B; zBLT: op = 352B; zBLTL: op = 353B;
zBLTC: op = 354B; zBLTCL: op = 355B; zALLOC: op = 356B; zFREE: op = 357B;
zIWDC: op = 360B; zDWDC: op = 361B; zSTOP: op = 362B; zCATCH: op = 363B;
zMISC: op = 364B; zBITBLT: op = 365B; zSTARTIO: op = 366B; zJRAM: op = 367B;
zDST: op = 370B; zLST: op = 371B; zLSTF: op = 372B;
zWR: op = 374B; zRR: op = 375B; zBRK: op = 376B;
Alpha byte values
alpha: TYPE = [0..400B);
aASSOC: alpha = 0B;
aSETF: alpha = 1B;
aREADRAM: alpha = 2B;
aLOADRAMJ: alpha = 3B;
a4: alpha = 4B; -- unused
aINPUT: alpha = 5B;
aOUTPUT: alpha = 6B;
aCHKSUM: alpha = 7B;
aSETMP: alpha = 10B;
aRCLK: alpha = 11B;
aRPRINTER: alpha = 12B;
aWPRINTER: alpha = 13B;
aBANDBLT: alpha = 14B;
aTEXTBLT: alpha = 15B;
aGETF: alpha = 16B;
a17: alpha = 17B; -- unused
Floating Point (20B-57B are reserved)
aFADD: alpha = 20B;
aFSUB: alpha = 21B;
aFMUL: alpha = 22B;
aFDIV: alpha = 23B;
aFCOMP: alpha = 24B;
aFIX: alpha = 25B;
aFLOAT: alpha = 26B;
aFIXI: alpha = 27B;
aFIXC: alpha = 30B;
aFSTICKY: alpha = 31B;
aFREM: alpha = 32B;
aROUND: alpha = 33B;
aROUNDI: alpha = 34B;
aROUNDC: alpha = 35B;
aFSQRT: alpha = 36B;
aFSC: alpha = 37B;
aZERO: alpha = 102B;
aVERSION: alpha = 104B;
Data Types For Xfer (wizards only)
Control links
ControlLinkTag: TYPE = {frame, procedure, indirect, rep};
ControlLink: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID ControlLinkTag FROM
frame => [frame: FrameHandle],
procedure => [gfi: GFTIndex, ep: EPIndex, tag: BOOL],
indirect => [
SELECT OVERLAID * FROM
port => [port: PortHandle],
link => [link: POINTER TO ControlLink],
ENDCASE
],
rep => [fill: [0..37777B], indirect: BOOL, proc: BOOL],
ENDCASE
];
ProcDesc, SignalDesc: TYPE = procedure ControlLink;
TrapLink, NullLink: ControlLink = ControlLink[frame[NullFrame]];
UnboundLink: ControlLink = ControlLink[procedure[gfi: 0, ep: 0, tag: TRUE]];
PortHandle: TYPE = POINTER TO Port;
Port: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
representation => [in, out: WORD],
links => [frame: FrameHandle, dest: ControlLink],
ENDCASE
];
Frames
MaxFrameSize: CARDINAL = 4096 - 4;
MaxSmallFrameIndex: CARDINAL = 17;
FrameVec: ARRAY FrameSizeIndex OF [0..MaxFrameSize] = [
7, 11, 15, 19, 23, 27, 31, 39, 47, 55, 67, 79, 95, 111, 127, 147, 171, 203,
252, 508, 764, 1020, 1276, 1532, 1788, 2044, 2554, 3068, 3580, 4092];
FrameClass: TYPE = {global, local, signal, catch, dying};
Local frame format
Frame: TYPE = MACHINE DEPENDENT RECORD [
accesslink: GlobalFrameHandle,
pc: BytePC,
returnlink: ControlLink,
extensions: SELECT OVERLAID FrameClass FROM
local => [unused: WORD, local: SEQUENCE COMPUTED CARDINAL OF WORD],
signal => [mark: BOOL, unused: [0..77777B]],
catch => [unused: WORD, staticlink: FrameHandle, messageval: WORD],
dying => [state: {dead, alive}, unused: [0..77777B]],
ENDCASE
];
FrameHandle: TYPE = POINTER TO Frame;
NullFrame: FrameHandle = NIL;
accessOffset: CARDINAL = 0; -- OFFSET[Frame.accesslink]
pcOffset: CARDINAL = 1; -- OFFSET[Frame.pc]
returnOffset: CARDINAL = 2; -- OFFSET[Frame.returnlink]
markOffset: CARDINAL = 3; -- OFFSET[Frame.mark]
localbase: CARDINAL = SIZE[local Frame];
framelink: CARDINAL = localbase;
Global frame format
GlobalFrame: TYPE = MACHINE DEPENDENT RECORD [
gfi: GFTIndex,
copied, alloced, shared, started: BOOL,
trapxfers, codelinks: BOOL,
code: FrameCodeBase,
global: SEQUENCE COMPUTED CARDINAL OF WORD
];
FrameCodeBase: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
long => [longbase: LONG POINTER],
cseg => [cseg: PrefixHandle],
either => [fill: [0..77777B], out: BOOL, highByte, otherByte: BYTE],
ENDCASE
];
GlobalFrameHandle: TYPE = POINTER TO GlobalFrame;
NullGlobalFrame: GlobalFrameHandle = NIL;
NullProgram: PROGRAM = NIL;
gfiOffset: CARDINAL = 0; -- OFFSET[GlobalFrame.gfi]
codebaseOffset: CARDINAL = 1; -- OFFSET[GlobalFrame.code]
globalbase: CARDINAL = SIZE[GlobalFrame];
Code segment format
BytePC: TYPE = RECORD [CARDINAL];
InstWord: TYPE = MACHINE DEPENDENT RECORD [evenbyte, oddbyte: BYTE];
FieldDescriptor: TYPE = MACHINE DEPENDENT RECORD [
offset: BYTE, posn: [0..bitsPerWord), size: [1..bitsPerWord]
];
EPRange: CARDINAL = 32;
EPIndex: TYPE = [0..EPRange);
CSegPrefix: TYPE = MACHINE DEPENDENT RECORD [
header: PrefixHeader,
entry: SEQUENCE COMPUTED CARDINAL OF EntryVectorItem
];
Note: the global frame size (in words) is in the word preceding the body of procedure 0.
PrefixHandle: TYPE = LONG POINTER TO CSegPrefix;
PrefixHeader: TYPE = MACHINE DEPENDENT RECORD [
swapinfo: WORD, info: PrefixInfo];
PrefixInfo: TYPE = MACHINE DEPENDENT RECORD [
stops: BOOL,
altoCode: BOOL, -- obsolete
fill: [0..17B],
ngfi: [1..MaxNGfi],
nlinks: [0..MaxNLinks]
];
EntryVectorItem: TYPE = MACHINE DEPENDENT RECORD [
initialpc: BytePC, -- (currently implemented as WordPC)
info: EntryInfo
];
EntryInfo: TYPE = MACHINE DEPENDENT RECORD [
defaults: BOOL, nparams: [0..177B], framesize: [0..377B]
];
MaxNLinks: CARDINAL = 255;
MainBodyIndex: CARDINAL = 0;
Global Frame Table format
GFTIndex: TYPE = [0..1777B];
GFTNull: GFTIndex = 0;
GFTHandle: TYPE = POINTER TO GFTable;
GFTable: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF GFTItem];
GFT: GFTHandle = LOOPHOLE[1400B];
GFTItem: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
frame => [framePtr: GlobalFrameHandle],
ep => [data: [0..37777B], epbias: EPBias],
ENDCASE
];
MaxNGfi: CARDINAL = 4;
MaxGFTSize: CARDINAL = (LAST[GFTIndex] + 1)*SIZE[GFTItem];
EPBias: TYPE = [0..MaxNGfi);
EmptyGFTItem: GFTItem = [ep[data: 0, epbias: EPBias.FIRST]];
FreedGFTItem: GFTItem = [ep[data: 0, epbias: EPBias.LAST]];
Allocation Vector format
AllocTag: TYPE = {frame, empty, indirect, enable};
AVItem: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
data => [fsi: [0..37777B], tag: AllocTag],
link => [link: POINTER TO AVItem],
frame => [frame: FrameHandle],
ENDCASE
];
AllocationVectorSize: CARDINAL = 40B;
LastAVSlot: CARDINAL = AllocationVectorSize - 3;
FrameSizeIndex: TYPE = [0..LastAVSlot];
AllocationVector: TYPE = ARRAY [0..AllocationVectorSize) OF AVItem;
AVHandle: TYPE = POINTER TO AllocationVector;
AV: AVHandle = LOOPHOLE[1000B];
The following frame sizes are not generated by the Compiler
LargeReturnSlot: CARDINAL = AllocationVectorSize - 2;
SpecialReturnSlot: CARDINAL = AllocationVectorSize - 1;
Control Module format
ControlModule: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
frame => [frame: GlobalFrameHandle],
list => [list: POINTER TO FrameList],
tag => [fill: [0..77777B], multiple: BOOL],
ENDCASE
];
FrameList: TYPE = MACHINE DEPENDENT RECORD [
nModules: CARDINAL,
frames: SEQUENCE COMPUTED CARDINAL OF GlobalFrameHandle
];
NullControl: ControlModule = [frame[NullGlobalFrame]];
System Dispatch Vector format
SD: POINTER TO RawWords = LOOPHOLE[1100B];
[0..37B] are known by microcode, the rest are assigned by software convention
sBreak: CARDINAL = 0;
sStackError: CARDINAL = 2;
sWakeupError: CARDINAL = 3;
sXferTrap: CARDINAL = 4;
sUnimplemented: CARDINAL = 5;
sAllocTrap: CARDINAL = 6;
sControlFault: CARDINAL = 7;
sSwapTrap: CARDINAL = 10B;
sPageFault: CARDINAL = 11B;
sWriteProtect: CARDINAL = 12B;
sUnbound: CARDINAL = 13B;
sZeroDivisor: CARDINAL = 14B;
sDivideCheck: CARDINAL = 15B;
sHardwareError: CARDINAL = 16B;
sProcessTrap: CARDINAL = 17B;
sBoundsFault: CARDINAL = 20B;
sPointerFault: CARDINAL = 21B;
Signals
sSignalList: CARDINAL = 40B;
sSignal: CARDINAL = 41B;
sErrorList: CARDINAL = 42B;
sError: CARDINAL = 43B;
sReturnErrorList: CARDINAL = 44B;
sReturnError: CARDINAL = 45B;
sUnnamedError: CARDINAL = 46B;
sUncaughtSignal: CARDINAL = 47B;
Instructions (to be removed in Trinity and implemented by opcode trapping)
sBLTE: CARDINAL = 52B;
sBYTBLTE: CARDINAL = 53B;
sBLTEC: CARDINAL = 54B;
sBYTBLTEC: CARDINAL = 55B;
sBLTEL: CARDINAL = 56B;
sBYTBLTEL: CARDINAL = 57B;
sBLTECL: CARDINAL = 60B;
sBYTBLTECL: CARDINAL = 61B;
sStringInit: CARDINAL = 62B;
sSignedDiv: CARDINAL = 63B;
sLongMul: CARDINAL = 64B;
sLongDivMod: CARDINAL = 65B;
sLongDiv: CARDINAL = 66B;
sLongMod: CARDINAL = 67B;
sULongDivMod: CARDINAL = 70B;
sULongDiv: CARDINAL = 71B;
sULongMod: CARDINAL = 72B;
sLongStringCheck: CARDINAL = 73B;
Frames
sCopy: CARDINAL = 75B; -- implements NEW <PROGRAM>
sStart: CARDINAL = 77B; -- implements START <PROGRAM>
sRestart: CARDINAL = 100B; -- implements RESTART <PROGRAM>
sGFTLength: CARDINAL = 101B;
Debugger (should be moved elsewhere, e.g., the debugger Nub)
sAlternateBreak: CARDINAL = 103B;
sIOResetBits: CARDINAL = 113B;
sBreakBlock: CARDINAL = 114B;
sBreakBlockSize: CARDINAL = 115B;
sPerfMonitor: CARDINAL = 116B;
sLogging: CARDINAL = 117B;
sXferTrapMonitor: CARDINAL = 120B;
sCrossMDSLow: CARDINAL = 121B;
sCrossMDSHigh: CARDINAL = 122B;
Processes
sFork: CARDINAL = 124B; -- implements FORK <proc>
sJoin: CARDINAL = 125B; -- implements JOIN <PROCESS>
Floating Point (to be removed in Trinity and implemented by opcode trapping)
sFADD: CARDINAL = 130B;
sFSUB: CARDINAL = 131B;
sFMUL: CARDINAL = 132B;
sFDIV: CARDINAL = 133B;
sFCOMP: CARDINAL = 134B;
sFIX: CARDINAL = 135B;
sFLOAT: CARDINAL = 136B;
Miscellaneous
sBootSwitches: CARDINAL = 142B;
sFirstCedar: CARDINAL = 150B;
sLastCedar: CARDINAL = 277B;
sLastSD: CARDINAL = 277B;
Xfer traps
XferTrapStatus: TYPE = MACHINE DEPENDENT {
off(0), on(1), skip1(2), skip2(4), skip3(8), skip4(16), (65535)};
Data Types for Process machinery (wizards only)
State vector format
SVPointer: TYPE = POINTER TO StateVector;
stackDepth: CARDINAL = 14;
sd1: CARDINAL = stackDepth+1;
sd2: CARDINAL = stackDepth+2;
StateVector: TYPE = MACHINE DEPENDENT RECORD [
stk(0): ARRAY [0..stackDepth) OF WORD,
instbyte(stackDepth:0..7): BYTE,
stkptr(stackDepth:8..15): BYTE, -- 0 => empty stack
data(sd1): SELECT OVERLAID * FROM
dst => NULL,
lst => [dest(sd1), source(sd2): ControlLink],
fault => [
frame(sd1): POINTER TO local Frame,
faultData(sd2): SELECT OVERLAID * FROM
allocFault => [fsi(sd2): FrameSizeIndex],
memFault => [memPointer(sd2): LONG POINTER],
otherFault => [data0(sd2): WORD, data1(sd2+1): WORD],
If other words are needed then they go after this, one has to use pointer arithmetic. We would like this variant to be SEQUENCE COMPUTED CARDINAL OF WORD, but the compiler is not obliging.
ENDCASE
],
ENDCASE
];
MaxParamsInStack: CARDINAL = stackDepth - 3;
Process Data Area format
PDABase: TYPE = LONG BASE POINTER TO ProcessDataArea;
PDA: PDABase = LOOPHOLE[200000B];
ProcessDataArea: TYPE = MACHINE DEPENDENT RECORD [
vp(0): SELECT OVERLAID * FROM
header => [
ready(0): Queue,
count(1): CARDINAL,
number of PSB's (excludes global info overlaid on PDABase.PSB[0..StartPsb) ).
timeout(2): PDABase RELATIVE POINTER TO TimeoutVector,
available(3): ARRAY [0..5) OF WORDALL[0],
state(10B): StateAllocationTable,
interrupt(20B): InterruptVector,
fault(60B): FaultVector
],
blocks => [block(0): SEQUENCE COMPUTED CARDINAL OF ProcessStateBlock],
ENDCASE
];
PsbIndex: TYPE = CARDINAL [0..1024);
PsbNull: PsbIndex = 0;
StartPsb: PsbIndex = -- first actual Psb follows header.
(SIZE[ProcessDataArea] + SIZE[ProcessStateBlock] - 1)/SIZE[ProcessStateBlock];
PsbHandle: TYPE = PDABase RELATIVE POINTER TO ProcessStateBlock;
NullPsbHandle: PsbHandle = LOOPHOLE[0];
ProcessStateBlock: TYPE = MACHINE DEPENDENT RECORD [
link(0): PsbLink,
flags(1): PsbFlags,
context(2): Context,
mds(3): CARDINAL -- temporarily used for timeout until moved to timeoutVector.
];
Context: TYPE = MACHINE DEPENDENT RECORD [
context(0): SELECT OVERLAID * FROM
frame => [frame(0): PrincOps.FrameHandle], -- (in the psb's mds.)
state => [state(0): StateVectorHandle],
ENDCASE
];
Priority: TYPE = [0..7];
PsbLink: TYPE = MACHINE DEPENDENT RECORD [
failed(0:0..0): BOOL,
priority(0:1..3): Priority,
next(0:4..13): PsbIndex,
reserved(0:14..14): [0..1] ← 0,
vector(0:15..15): BOOL
];
PsbFlags: TYPE = MACHINE DEPENDENT RECORD [
processState(0:0..2): ProcessState ← NULL, -- used by software only
reserved(0:3..3): [0..1] ← 0,
cleanup(0:4..13): PsbIndex,
waiting(0:14..14): BOOL,
abort(0:15..15): BOOL
];
ProcessState: TYPE = MACHINE DEPENDENT RECORD [
state(0:0..1): {
frameReady(0), -- child process ready to be Joined (or Detached).
frameTaken(1), -- parent process has recorded child's frameHandle.
dead(2), -- child process has finished all cleanup, and is dead.
alive(3)}, -- normal state of running process.
detached(0:2..2): BOOL
];
Monitor and Condition Variable format
Monitor: TYPE = MACHINE DEPENDENT RECORD [
reserved(0:0..3): [0..17B] ← 0,
tail(0:4..13): PsbIndex,
available(0:14..14): [0..1] ← 0,
locked(0:15..15): BOOL
];
LockedEmpty: Monitor = [tail: PsbNull, locked: TRUE];
UnlockedEmpty: Monitor = [tail: PsbNull, locked: FALSE];
Condition: TYPE = MACHINE DEPENDENT RECORD [
reserved(0:0..3): [0..17B] ← 0,
tail(0:4..13): PsbIndex,
abortable(0:14..14): BOOL,
wakeup(0:15..15): BOOL
];
ConditionVariable: TYPE = MACHINE DEPENDENT RECORD [
condition(0): Condition,
timeout(1): Ticks
];
Queue format
QueueHandle: TYPE = LONG POINTER TO Queue;
Queue: TYPE = MACHINE DEPENDENT RECORD [
(Note: format matches that of condition variables and monitor locks.)
reserved1(0:0..3): [0..17B] ← 0,
tail(0:4..13): PsbIndex,
reserved2(0:14..15): [0..3] ← 0
];
QueueEmpty: Queue = [tail: PsbNull];
StateAllocationTable: TYPE = ARRAY Priority OF StateVectorHandle;
StateVectorHandle: TYPE = PDABase RELATIVE POINTER TO PrincOps.StateVector;
NullStateVectorHandle: StateVectorHandle = LOOPHOLE[0];
Faults
FaultVector: TYPE = ARRAY FaultIndex OF FaultQueue;
FaultIndex: TYPE = [0..8);
qFrameFault: FaultIndex = 0;
qPageFault: FaultIndex = 1;
qWriteProtectFault: FaultIndex = 2;
FaultQueue: TYPE = MACHINE DEPENDENT RECORD [
queue(0): Queue, condition(1): Condition
];
Interrupts
InterruptVector: TYPE = ARRAY InterruptLevel OF InterruptItem;
InterruptLevel: TYPE = [0..bitsPerWord);
InterruptItem: TYPE = MACHINE DEPENDENT RECORD [
condition(0): Condition,
available(1): WORD -- temp used for timeout till timeoutVector.
];
Timeouts
TimeoutVector: TYPE = -- (must be 16-word aligned.)
ARRAY PsbIndex OF Ticks; -- (only PDA.count are actually used.)
Ticks: TYPE = CARDINAL;
NoTimeout: Ticks = 0;
Data Structures for Virtual Memory Map (wizards only)
RealPageNumber: TYPE = CARDINAL;
There is an implcit limitation to 24 bits of real address here.
PageState: TYPE = MACHINE DEPENDENT RECORD [
processorDependent(0:0..12): ProcessorDependent ← NULL,
flags(0:13..15): PageFlags
];
PageFlags: TYPE = MACHINE DEPENDENT RECORD [
readonly(0:0..0): BOOL, -- (0 for FALSE, 1 for TRUE.)
dirty(0:1..1): BOOL,
referenced(0:2..2): BOOL
];
InterimPageState: TYPE = MACHINE DEPENDENT RECORD [ -- until Klamath arch. rework
logSingleError(0:0..0): BOOL, flags(0:1..3): PageFlags,
realPage(0:4..15): [0..7777B]
];
This definition is for Rubicon PrincOps. It is somewhat misnamed InterimPageState. Using this definition limits one to 1 megaword of physical memory (a distinct loss). We only use the map ops for Rubicon in Cedar when running on machines that can not have more than 1 megaword (Dorados and most DandeLions).
PageValue: TYPE = MACHINE DEPENDENT RECORD [
state: PageState,
real: RealPageNumber
];
This definition is for Klamath (& Trinity & higher) PrincOps. We only use the map ops for Trinity in Cedar when running on machines that can have more than 1 megaword (Dorados and maybe DandeTigers).
ProcessorDependent: TYPE = MACHINE DEPENDENT RECORD [bits(0:0..12): CARDINAL [0..17777B]];
flagsClean, flagsNone: PageFlags = [readonly: FALSE, dirty: FALSE, referenced: FALSE];
flagsDirty: PageFlags = [readonly: FALSE, dirty: TRUE, referenced: FALSE];
flagsDirtyReferenced: PageFlags = [readonly: FALSE, dirty: TRUE, referenced: TRUE];
flagsReadOnly: PageFlags = [readonly: TRUE, dirty: FALSE, referenced: FALSE];
flagsReadOnlyReferenced: PageFlags = [readonly: TRUE, dirty: FALSE, referenced: TRUE];
flagsVacant: PageFlags = [readonly: TRUE, dirty: TRUE, referenced: FALSE];
flagsReadOnlyDirtyReferenced: PageFlags = [readonly: TRUE, dirty: TRUE, referenced: TRUE];
B0: BOOL = FALSE;
B1: BOOL = TRUE;
maskNone: PageFlags = [readonly: B0, dirty: B0, referenced: B0];
maskReferenced: PageFlags = [readonly: B0, dirty: B0, referenced: B1];
maskDirty: PageFlags = [readonly: B0, dirty: B1, referenced: B0];
maskDirtyReferenced: PageFlags = [readonly: B0, dirty: B1, referenced: B1];
maskReadOnly: PageFlags = [readonly: B1, dirty: B0, referenced: B0];
maskReadOnlyReferenced: PageFlags = [readonly: B1, dirty: B0, referenced: B1];
maskReadOnlyDirty: PageFlags = [readonly: B1, dirty: B1, referenced: B0];
maskAll: PageFlags = [readonly: B1, dirty: B1, referenced: B1];
Data Structures for ByteBlt (wizards only)
ByteBltBlock: TYPE = MACHINE DEPENDENT RECORD [
blockPointer: LONG POINTER,
startIndex, stopIndexPlusOne: CARDINAL
];
nullByteBltBlock: ByteBltBlock = [NIL, 0, 0];
Data Structures for BitBlt (wizards only)
BitAddress: TYPE = MACHINE DEPENDENT RECORD [
word: LONG POINTER,
reserved: [0..LAST[WORD]/bitsPerWord) ← 0,
bit: [0..bitsPerWord)
];
BitBltFlags: TYPE = MACHINE DEPENDENT RECORD [
determines the BitBlt function
direction: Direction ← forward,
disjoint: BOOLFALSE,
disjointItems: BOOLFALSE,
gray: BOOLFALSE,
srcFunc: SrcFunc ← null,
dstFunc: DstFunc ← null,
reserved: [0..511] ← 0
];
Direction: TYPE = {forward, backward};
DstFunc: TYPE = {null, and, or, xor};
GrayParm: TYPE = MACHINE DEPENDENT RECORD [
used with Src to describe gray brick
reserved: [0..15] ← 0,
yOffset: [0..15],
widthMinusOne: [0..15],
restricted to 0 for initial microcode implementations
heightMinusOne: [0..15]
];
SrcDesc: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
gray => [gray: GrayParm],
srcBpl => [srcBpl: INTEGER],
ENDCASE
];
SrcFunc: TYPE = {null, complement};
BBptr, BitBltTablePtr: TYPE = POINTER TO BBTable;
BBTable, BitBltTable: TYPE = MACHINE DEPENDENT RECORD [
dst: BitAddress,
dstBpl: INTEGER,
src: BitAddress,
srcDesc: SrcDesc,
width: CARDINAL,
height: CARDINAL,
flags: BitBltFlags,
reserved: WORD ← 0
];
BBTableAlignment: CARDINAL = 16;
BBTableSpace: TYPE = ARRAY [1..SIZE[BBTable] + BBTableAlignment) OF WORD;
Data Structures for TextBlt (wizards only)
TextBltFunction: TYPE = {display, format, resolve};
TextBltArg: TYPE = MACHINE DEPENDENT RECORD [
reserved: [0..37777B] ← 0,
function: TextBltFunction, -- display, format or resolve
last: CARDINAL, -- index of last character to process
text: LONG POINTER TO RawChars,
font: TextBltFontHandle, -- Long Pointer to font information
dst: LONG POINTER, -- destination bitmap (display only)
dstBpl: CARDINAL, -- Bits per line (display only)
margin: CARDINAL, -- mica value of right margin (format only)
space: INTEGER, -- width adjustment to pad characters (display, resolve)
coord: POINTER TO RawCards -- widths array for resolve
];
TextBltArgAlignment: CARDINAL = 16;
TextBltArgSpace: TYPE = ARRAY [1..SIZE[TextBltArg] + TextBltArgAlignment) OF WORD;
TextBltFontHandle: TYPE = LONG POINTER TO TextBltFont;
TextBltFont: TYPE = MACHINE DEPENDENT RECORD [
Quad-word aligned
font(0): LONG POINTER TO TextBltFontBody,
rgflags(2): Rgflags,
height(4): CARDINAL
];
Rgflags: TYPE = LONG POINTER TO PACKED ARRAY CHAR OF CharFlags;
CharFlags: TYPE = MACHINE DEPENDENT RECORD [pad: BOOL, stop: BOOL];
TextBltFontBody: TYPE = MACHINE DEPENDENT RECORD [
char: ARRAY CHAR OF CharEntry, -- 512 words
widths: PACKED ARRAY CHAR OF BYTE, -- 128 words
bits: SEQUENCE COMPUTED CARDINAL OF WORD
];
CharEntry: TYPE = MACHINE DEPENDENT RECORD [
leftKern: BOOL, -- If true, character has one bit hanging out past left edge
rightKern: BOOL, -- If true, character has one bit hanging out past right edge
offset: CARDINAL [0..37777B], -- 14 bit offset to first word for this character
Note that this offset is measured from the bits origin, not TextBltFontBody. This is a word offset to the first scan line of the character. As a temporary implementation restriction, each scan line of the character starts on a word boundary.
mica: CARDINAL -- Mica width for this characer
];
TextBltResult: TYPE = {normal, margin, stop};
Miscellaneous (wizards only)
Control registers known by the microcode
PSBreg: CARDINAL = 0; -- current process
WDCreg: CARDINAL = 1; -- wakeup disable counter
XTSreg: CARDINAL = 2; -- xfer trap status
MDSreg: CARDINAL = 3; -- main data space
Note: 4, 5, and 6 are unused.
PDAreg: CARDINAL = 7; -- process data area
PTCreg: CARDINAL = 8; -- process tick count
Microcode and machine version information
MachineType: TYPE = MACHINE DEPENDENT {
altoI (1), altoII (2), altoIIXM (3),
dolphin (4), dorado (5), dandelion (6), dicentra (7),
(17B)
};
VersionResult: TYPE = MACHINE DEPENDENT RECORD [
machineType (0: 0..3): MachineType,
majorVersion (0: 4..7): [0..17B], -- incremented by incompatible changes
unused (0: 8..13): [0..77B],
floatingPoint (0: 14..14): BOOL,
cedar (0: 15..15): BOOL,
releaseDate (1): CARDINAL -- days since January 1, 1901
];
END.