PrincOps.mesa
last edited by Levin on August 8, 1983 10:29 am
PrincOps: DEFINITIONS =
BEGIN
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.
Basic Types and Associated Values
wordsPerPage: NAT = 256;
bytesPerWord: PRIVATE NAT = 2; -- officially, in Basics
bytesPerPage: NAT = wordsPerPage*bytesPerWord;
bitsPerWord: PRIVATE NAT = 16; -- officially, in Basics
logWordsPerPage: NAT = --LogBase2[wordsPerPage]--8;
logBytesPerWord: PRIVATE 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: PRIVATE TYPE = [0..377B]; -- Compiler should supply; officially, in Basics
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;
Instruction Set (wizards only)
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 bytes 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: BOOLEAN],
indirect => [
SELECT
OVERLAID *
FROM
port => [port: PortHandle],
link => [link: POINTER TO ControlLink],
ENDCASE],
rep => [fill: [0..37777B], indirect: BOOLEAN, proc: BOOLEAN],
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: UNSPECIFIED],
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: UNSPECIFIED, local: ARRAY [0..0) OF UNSPECIFIED],
signal => [mark: BOOLEAN, unused: [0..77777B]],
catch => [
unused: UNSPECIFIED, staticlink: FrameHandle, messageval: UNSPECIFIED],
dying => [state: {dead, alive}, unused: [0..77777B]],
ENDCASE];
FrameHandle: TYPE = POINTER TO Frame;
NullFrame: FrameHandle = LOOPHOLE[0];
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: BOOLEAN,
trapxfers, codelinks: BOOLEAN,
code: FrameCodeBase,
global: ARRAY [0..0) OF UNSPECIFIED];
FrameCodeBase:
TYPE =
MACHINE
DEPENDENT
RECORD [
SELECT
OVERLAID *
FROM
long => [longbase: LONG POINTER],
short => [shortbase: POINTER, handle: POINTER],
offset => [offset: CARDINAL, highHalf: UNSPECIFIED],
either => [fill: [0..77777B], out: BOOLEAN, highByte, otherByte: BYTE],
ENDCASE];
GlobalFrameHandle: TYPE = POINTER TO GlobalFrame;
NullGlobalFrame: GlobalFrameHandle = LOOPHOLE[0];
NullProgram: PROGRAM = LOOPHOLE[0];
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: ARRAY [0..0) OF EntryVectorItem];
Note: the global frame size (in words) is in the word preceding the body of procedure 0.
PrefixHandle: TYPE = POINTER TO CSegPrefix;
PrefixHeader:
TYPE =
MACHINE
DEPENDENT
RECORD [
swapinfo: WORD, info: PrefixInfo];
PrefixInfo:
TYPE =
MACHINE
DEPENDENT
RECORD [
stops: BOOLEAN,
altoCode: BOOLEAN,
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: BOOLEAN, 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 ARRAY [0..0) 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: BOOLEAN],
ENDCASE];
FrameList:
TYPE =
MACHINE
DEPENDENT
RECORD [
nModules: CARDINAL, frames: ARRAY [0..0) OF GlobalFrameHandle];
NullControl: ControlModule = [frame[NullGlobalFrame]];
System Dispatch Vector format
SD: POINTER TO ARRAY [0..0) OF UNSPECIFIED = 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;
StateVector:
TYPE =
MACHINE
DEPENDENT
RECORD [
stk(0): ARRAY [0..stackDepth) OF UNSPECIFIED,
instbyte(stackDepth:0..7): BYTE,
stkptr(stackDepth:8..15): BYTE, -- 0 => empty stack
data(stackDepth+1):
SELECT
OVERLAID *
FROM
dst => NULL,
lst => [dest(stackDepth+1), source(stackDepth+2): ControlLink],
fault => [
frame(stackDepth+1): POINTER TO local Frame,
faultData(stackDepth+2):
SELECT
OVERLAID *
FROM
allocFault => [fsi(stackDepth+2): FrameSizeIndex],
memFault => [memPointer(stackDepth+2): LONG POINTER],
otherFault => [dataArray(stackDepth+2): ARRAY [0..0) OF UNSPECIFIED],
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 UNSPECIFIED ← ALL[0],
state(10B): StateAllocationTable,
interrupt(20B): InterruptVector,
fault(60B): FaultVector],
blocks => [
block(0): ARRAY [0.. --StartPsb+PDA.count--0) 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): BOOLEAN,
priority(0:1..3): Priority,
next(0:4..13): PsbIndex,
reserved(0:14..14): [0..1] ← 0,
vector(0:15..15): BOOLEAN];
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): BOOLEAN,
abort(0:15..15): BOOLEAN];
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): BOOLEAN];
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): BOOLEAN,
wakeup(0:15..15): BOOLEAN];
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): UNSPECIFIED]; -- 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;
PageState:
TYPE =
MACHINE
DEPENDENT
RECORD [
processorDependent(0:0..12): ProcessorDependent ← NULL,
flags(0:13..15): PageFlags
];
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]
];
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
];
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];
maskNone: PageFlags = [readonly: LOOPHOLE[0], dirty: LOOPHOLE[0], referenced: LOOPHOLE[0]];
maskReferenced: PageFlags = [readonly: LOOPHOLE[0], dirty: LOOPHOLE[0], referenced: LOOPHOLE[1]];
maskDirty: PageFlags = [readonly: LOOPHOLE[0], dirty: LOOPHOLE[1], referenced: LOOPHOLE[0]];
maskDirtyReferenced: PageFlags = [readonly: LOOPHOLE[0], dirty: LOOPHOLE[1], referenced: LOOPHOLE[1]];
maskReadOnly: PageFlags = [readonly: LOOPHOLE[1], dirty: LOOPHOLE[0], referenced: LOOPHOLE[0]];
maskReadOnlyReferenced: PageFlags = [readonly: LOOPHOLE[1], dirty: LOOPHOLE[0], referenced: LOOPHOLE[1]];
maskReadOnlyDirty: PageFlags = [readonly: LOOPHOLE[1], dirty: LOOPHOLE[1], referenced: LOOPHOLE[0]];
maskAll: PageFlags = [readonly: LOOPHOLE[1], dirty: LOOPHOLE[1], referenced: LOOPHOLE[1]];
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: BOOLEAN ← FALSE,
disjointItems: BOOLEAN ← FALSE,
gray: BOOLEAN ← FALSE,
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: UNSPECIFIED ← 0];
BBTableAlignment: CARDINAL = 16;
BBTableSpace: TYPE = ARRAY [1..SIZE[BBTable] + BBTableAlignment) OF UNSPECIFIED;
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 PACKED ARRAY CARDINAL OF CHARACTER,
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 ARRAY CARDINAL [0..0) OF CARDINAL -- widths array for resolve
];
TextBltArgAlignment: CARDINAL = 16;
TextBltArgSpace:
TYPE =
ARRAY [1..
SIZE[TextBltArg] + TextBltArgAlignment)
OF
UNSPECIFIED;
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 CHARACTER OF CharFlags;
CharFlags: TYPE = MACHINE DEPENDENT RECORD [pad: BOOLEAN, stop: BOOL];
TextBltFontBody:
TYPE =
MACHINE
DEPENDENT
RECORD [
char: ARRAY CHARACTER OF CharEntry, -- 512 words
widths: PACKED ARRAY CHARACTER OF CARDINAL [0..377B], -- 128 words
bits: ARRAY [0..0) OF UNSPECIFIED
];
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.