[ivy]<Satterthwaite>CrossCompiler>tPrincOps.mesa!3

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
Satterthwaite April 16, 1986 12:47:31 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; zLL0: Op = 1b; zLL1: Op = 2b; zLL2: Op = 3b;
zLL3: Op = 4b; zLL4: Op = 5b; zLL5: Op = 6b; zLL6: Op = 7b;
zLL7: Op = 10b; zLL8: Op = 11b; zLL9: Op = 12b; zLL10: Op = 13b;
zLL11: Op = 14b; zLLB: Op = 15b; zLLD0: Op = 16b; zLLD1: Op = 17b;
zLLD2: Op = 20b; zLLD3: Op = 21b; zLLD4: Op = 22b; zLLD5: Op = 23b;
zLLD6: Op = 24b; zLLD7: Op = 25b; zLLD8: Op = 26b; zLLD10: Op = 27b;
zLLDB: Op = 30b; zSL0: Op = 31b; zSL1: Op = 32b; zSL2: Op = 33b;
zSL3: Op = 34b; zSL4: Op = 35b; zSL5: Op = 36b; zSL6: Op = 37b;
zSL7: Op = 40b; zSL8: Op = 41b; zSL9: Op = 42b; zSL10: Op = 43b;
zSLB: Op = 44b; zSLD0: Op = 45b; zSLD1: Op = 46b; zSLD2: Op = 47b;
zSLD3: Op = 50b; zSLD4: Op = 51b; zSLD5: Op = 52b; zSLD6: Op = 53b;
zSLD8: Op = 54b; zPL0: Op = 55b; zPL1: Op = 56b; zPL2: Op = 57b;
zPL3: Op = 60b; zPLB: Op = 61b; zPLD0: Op = 62b; zPLDB: Op = 63b;
zLG0: Op = 64b; zLG1: Op = 65b; zLG2: Op = 66b; zLGB: Op = 67b;
zLGD0: Op = 70b; zLGD2: Op = 71b; zLGDB: Op = 72b; zSGB: Op = 73b;
zBNDCK: Op = 74b; zBRK: Op = 75b;
zR0: Op = 100b; zR1: Op = 101b; zRB: Op = 102b; zRL0: Op = 103b;
zRLB: Op = 104b; zRD0: Op = 105b; zRDB: Op = 106b; zRDL0: Op = 107b;
zRDLB: Op = 110b; zW0: Op = 111b; zWB: Op = 112b; zPSB: Op = 113b;
zWLB: Op = 114b; zPSLB: Op = 115b; zWDB: Op = 116b; zPSD0: Op = 117b;
zPSDB: Op = 120b; zWDLB: Op = 121b; zPSDLB: Op = 122b; zRLI00: Op = 123b;
zRLI01: Op = 124b; zRLI02: Op = 125b; zRLI03: Op = 126b; zRLIP: Op = 127b;
zRLILP: Op = 130b; zRLDI00: Op = 131b; zRLDIP: Op = 132b; zRLDILP: Op = 133b;
zRGIP: Op = 134b; zRGILP: Op = 135b; zWLIP: Op = 136b; zWLILP: Op = 137b;
zWLDILP: Op = 140b; zRS: Op = 141b; zRLS: Op = 142b; zWS: Op = 143b;
zWLS: Op = 144b; zR0F: Op = 145b; zRF: Op = 146b; zRL0F: Op = 147b;
zRLF: Op = 150b; zRLFS: Op = 151b; zRLIPF: Op = 152b; zRLILPF: Op = 153b;
zW0F: Op = 154b; zWF: Op = 155b; zPSF: Op = 156b; zPS0F: Op = 157b;
zWS0F: Op = 160b; zWL0F: Op = 161b; zWLF: Op = 162b; zPSLF: Op = 163b;
zWLFS: Op = 164b; zSLDB: Op = 165b; zSGDB: Op = 166b; zLLKB: Op = 167b;
zRKIB: Op = 170b; zRKDIB: Op = 171b; zLKB: Op = 172b; zSHIFT: Op = 173b;
zSHIFTSB: Op = 174b;
zCATCH: Op = 200b; zJ2: Op = 201b; zJ3: Op = 202b; zJ4: Op = 203b;
zJ6: Op = 204b; zJ8: Op = 205b; zJB: Op = 206b; zJW: Op = 207b;
zJEP: Op = 210b; zJEB: Op = 211b; zJEBB: Op = 212b; zJNEP: Op = 213b;
zJNEB: Op = 214b; zJNEBB: Op = 215b; zJLB: Op = 216b; zJGEB: Op = 217b;
zJGB: Op = 220b; zJLEB: Op = 221b; zJULB: Op = 222b; zJUGEB: Op = 223b;
zJUGB: Op = 224b; zJULEB: Op = 225b; zJZ3: Op = 226b; zJZ4: Op = 227b;
zJZB: Op = 230b; zJNZ3: Op = 231b; zJNZ4: Op = 232b; zJNZB: Op = 233b;
zJIB: Op = 234b; zJIW: Op = 235b; zREC: Op = 236b; zREC2: Op = 237b;
zDIS: Op = 240b; zDIS2: Op = 241b; zEXCH: Op = 242b; zDEXCH: Op = 243b;
zDUP: Op = 244b; zDDUP: Op = 245b; zEXDIS: Op = 246b; zNEG: Op = 247b;
zINC: Op = 250b; zDEC: Op = 251b; zDINC: Op = 252b; zDBL: Op = 253b;
zDDBL: Op = 254b; zTRPL: Op = 255b; zAND: Op = 256b; zIOR: Op = 257b;
zADDSB: Op = 260b; zADD: Op = 261b; zSUB: Op = 262b; zDADD: Op = 263b;
zDSUB: Op = 264b; zADC: Op = 265b; zACD: Op = 266b; zAL0IB: Op = 267b;
zMUL: Op = 270b; zDCMP: Op = 271b; zUDCMP: Op = 272b; zESC: Op = 273b;
zESCL: Op = 274b; zLP: Op = 275b;
zLI0: Op = 300b; zLI1: Op = 301b; zLI2: Op = 302b; zLI3: Op = 303b;
zLI4: Op = 304b; zLI5: Op = 305b; zLI6: Op = 306b; zLI7: Op = 307b;
zLI8: Op = 310b; zLI9: Op = 311b; zLI10: Op = 312b; zLIN1: Op = 313b;
zLINI: Op = 314b; zLIB: Op = 315b; zLIW: Op = 316b; zLINB: Op = 317b;
zLIHB: Op = 320b; zLID0: Op = 321b; zLA0: Op = 322b; zLA1: Op = 323b;
zLA2: Op = 324b; zLA3: Op = 325b; zLA6: Op = 326b; zLA8: Op = 327b;
zLAB: Op = 330b; zLAW: Op = 331b; zGA0: Op = 332b; zGAB: Op = 333b;
zGAW: Op = 334b; zEFC0: Op = 335b; zEFC1: Op = 336b; zEFC2: Op = 337b;
zEFC3: Op = 340b; zEFC4: Op = 341b; zEFC5: Op = 342b; zEFC6: Op = 343b;
zEFC7: Op = 344b; zEFC8: Op = 345b; zEFC9: Op = 346b; zEFC10: Op = 347b;
zEFC11: Op = 350b; zEFC12: Op = 351b; zEFCB: Op = 352b; zLFC1: Op = 353b;
zLFC2: Op = 354b; zLFC3: Op = 355b; zLFC4: Op = 356b; zLFC5: Op = 357b;
zLFCB: Op = 360b; zSFC: Op = 361b; zRET: Op = 362b; zKFCB: Op = 363b;
zD0: Op = 364b; zDB: Op = 365b; zBLT: Op = 366b; zBLTL: Op = 367b;
zBLTC: Op = 370b; zBLTCL: Op = 371b; zWCDLB: Op = 372b; zWCIDLB: Op = 373b;
zPSCDLB: Op = 374b; zPSCIDLB: Op = 375b;
zRESRVD: Op = 377b;
Alpha byte values
alpha: TYPE = [0..400b);
aME: alpha = 0b;
aMX: alpha = 1b;
aMW: alpha = 2b;
aMR: alpha = 3b;
aNC: alpha = 4b;
aBC: alpha = 5b;
aREQ: alpha = 6b;
aSM: alpha = 7b;
aSMF: alpha = 10b;
aGMF: alpha = 11b;
aAF: alpha = 12b;
aFF: alpha = 13b;
aPI: alpha = 14b;
aPO: alpha = 15b;
aPOR: alpha = 16b;
aSPP: alpha = 17b;
aDI: alpha = 20b;
aEI: alpha = 21b;
aXOR: alpha = 22b;
aDAND: alpha = 23b;
aDIOR: alpha = 24b;
aDXOR: alpha = 25b;
aROTATE: alpha = 26b;
aDSHIFT: alpha = 27b;
aLINT: alpha = 30b;
aNILCK: alpha = 31b;-- CSL change, was aJS
aRCFS: alpha = 32b;
bRC: alpha = 33b;
bLLOB: alpha = 34b;
bROB: alpha = 35b;
bSLOB: alpha = 36b;
bWOB: alpha = 37b;
bDSK: alpha = 40b;
bLSTE: alpha = 41b;
bLSTF: alpha = 42b;
bDBS: alpha = 43b;
aUDIV: alpha = 44b;
aLUDIV: alpha = 45b;
aNILCKL: alpha = 46b;
aBLTLR: alpha = 47b;
aBLEL: alpha = 50b;
aBLECL: alpha = 51b;
aCKSUM: alpha = 52b;
aBITBLT: alpha = 53b;
aTXTBLT: alpha = 54b;
aBYTBLT: alpha = 55b;
aBYTBLTR: alpha = 56b;
aVERSION: alpha = 57b;
aDMUL: alpha = 60b;
aSDIV: alpha = 61b;
aSDDIV: alpha = 62b;
aUDDIV: alpha = 63b;
a64: alpha = 64b;
a65: alpha = 65b;
a66: alpha = 66b;
a67: alpha = 67b;
a70: alpha = 70b;
a71: alpha = 71b;
a72: alpha = 72b;
a73: alpha = 73b;
a74: alpha = 74b;
a75: alpha = 75b;
a76: alpha = 76b;
a77: alpha = 77b;
Floating Point (100b-137b are reserved)
aFADD: alpha = 100b;
aFSUB: alpha = 101b;
aFMUL: alpha = 102b;
aFDIV: alpha = 103b;
aFCOMP: alpha = 104b;
aFIX: alpha = 105b;
aFLOAT: alpha = 106b;
aFIXI: alpha = 107b;
aFIXC: alpha = 110b;
aFSTICKY: alpha = 111b;
aFREM: alpha = 112b;
aROUND: alpha = 113b;
aROUNDI: alpha = 114b;
aROUNDC: alpha = 115b;
aFSQRT: alpha = 116b;
aFSC: alpha = 117b;
Cedar collector and allocator (140b-157b are reserved)
aRECLAIMREF: alpha = 140b;
aALTERCOUNT: alpha = 141b;
aCLEARONSTACK: alpha = 142b;
aCEDARSTATE: alpha = 143b;
aREADZEROCOUNT: alpha = 144b;
aFINDRECLAIMABLEREFS: alpha = 145b;
aBLZL: alpha = 146b;
aNEWREF: alpha = 147b;
aLOCALBLZ: alpha = 150b;
aREFTYPE: alpha = 151b;
aCREFTYPE: alpha = 152b;
aALLOCQUANTIZED: alpha = 153b;
aALLOCPREFIXED: alpha = 154b;
aFREEOBJECT: alpha = 155b;
aFREEQUANTIZED: alpha = 156b;
aFREEPREFIXED: alpha = 157b;
Read / Write Registers
aWRPSB: alpha = 160b;
aWRMDS: alpha = 161b;
aWRWP: alpha = 162b;
aWRWDC: alpha = 163b;
aWRPTC: alpha = 164b;
aWRIT: alpha = 165b;
aWRXTS: alpha = 166b;
aWRMP: alpha = 167b;
aRRPSB: alpha = 170b;
aRRMDS: alpha = 171b;
aRRWP: alpha = 172b;
aRRWDC: alpha = 173b;
aRRPTC: alpha = 174b;
aRRIT: alpha = 175b;
aRRXTS: alpha = 176b;
bLSK: alpha = 177b;-- CSL addition
Processor Dependent (200b-237b are reserved)
aINPUT: alpha = 200b;
aOUTPUT: alpha = 201b;
aLOADRAMJ: alpha = 202b;
Dandelion
aBANDBLT: alpha = 203b;
Dolphin
aRPRINTER: alpha = 203b;
aWPRINTER: alpha = 204b;
aREADRAM: alpha = 205b;
aJRAM: alpha = 206b;
aCCOPR: alpha = 207b;
aFPOPR: alpha = 210b;
aSTARTIO: alpha = 211b;
aDESOPR: alpha = 212b;
aREADR: alpha = 213b;
aUSERTIMER: alpha = 214b;
aSETTIME: alpha = 216b;
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: LocalFrameHandle],
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 = ControlLink.procedure;
TrapLink, NullLink: ControlLink = ControlLink[frame[NullLocalFrame]];
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: LocalFrameHandle, 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
LocalFrameHandle: TYPE = POINTER TO LocalVariables;
LocalVariables: TYPE = ARRAY CARDINAL[0..0) OF WORD;
LocalFrameBase: TYPE = POINTER TO LocalOverhead;
LocalWord: TYPE = MACHINE DEPENDENT RECORD [
available (0:0..7): BYTE,
fsi (0:8..15): FSIndex];
LocalOverhead: TYPE = MACHINE DEPENDENT RECORD [
word (0): LocalWord,
returnlink (1): ControlLink,
globallink (2): GlobalFrameHandle,
pc (3): BytePC,
local (4): LocalVariables];
NullLocalFrame: LocalFrameHandle = NIL;
markOffset: CARDINAL = 0; -- OFFSET[Frame.word]
returnOffset: CARDINAL = 1; -- OFFSET[Frame.returnlink]
accessOffset: CARDINAL = 2; -- OFFSET[Frame.globallink]
pcOffset: CARDINAL = 3; -- OFFSET[Frame.pc]
localWordOffset: CARDINAL = 4;
localbase: CARDINAL = 0;
framelink: CARDINAL = localbase;
Global frame format
GlobalFrameHandle: TYPE = POINTER TO GlobalVariables;
GlobalVariables: TYPE = ARRAY CARDINAL[0..0) OF WORD;
GlobalFrameBase: TYPE = POINTER TO GlobalOverhead;
GlobalWord: TYPE = MACHINE DEPENDENT RECORD [
gfi (0:0..9): GFTIndex,
started (0:10..10): BOOL,
copied (0:11..11): BOOL,
alloced (0:12..12): BOOL,
shared (0:13..13): BOOL,
trapxfers (0:14..14): BOOL,
codelinks (0:15..15): BOOL];
GlobalCodebase: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
code => [codebase: PrefixHandle],
offset => [offset, highHalf: CARDINAL],
either => [fill: [0..77777B], out: BOOL, highByte, otherByte: BYTE],
ENDCASE
];
GlobalOverhead: TYPE = MACHINE DEPENDENT RECORD [
word (0): GlobalWord,
codebase (1): GlobalCodebase,
global (3): GlobalVariables];
NullGlobalFrame: GlobalFrameHandle = NIL;
NullProgram: PROGRAM = NIL;
globalWordOffset: CARDINAL = 3;
codebaseLowOffset: CARDINAL = 2;
codebaseHighOffset: CARDINAL = 1;
globalbase: CARDINAL = 0;
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]
];
BiasRange: CARDINAL = 4;
EPBias: TYPE = [0..BiasRange);
EPRange: CARDINAL = 32;
EPIndex: TYPE = [0..EPRange);
EVRange: CARDINAL = BiasRange*EPRange;
EVIndex: TYPE = [0..EVRange);
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 [
globalFsi (0:0..7): BYTE,
nEntries (0:8..15): [0..377b],
info (1): PrefixInfo];
PrefixInfo: TYPE = MACHINE DEPENDENT RECORD [
available (0:0..4): [0..37B],
stops (0:5..5): BOOL,
ngfi (0:6..7): [1..MaxNGfi],
nlinks (0:8..15): [0..MaxNLinks]
];
EntryVectorItem: TYPE = MACHINE DEPENDENT RECORD [
pc: BytePC];
EntryInfo: TYPE = MACHINE DEPENDENT RECORD [
defaults: BOOL, nparams: [0..177B], framesize: [0..377B]];
MaxNLinks: CARDINAL = 255;
MainBodyIndex: CARDINAL = 0;
Global Frame Table format
MaxNGfi: CARDINAL = 4;
GFTIndex: TYPE = [0..1777B];
GFTNull: GFTIndex = 0;
GFTHandle: TYPE = POINTER TO GFTable;
GFTable: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF GFTItem];
GFT: GFTHandle = LOOPHOLE[2000B];
GFTItem: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
frame => [framePtr: GlobalFrameHandle],
ep => [data: [0..37777B], epbias: EPBias],
ENDCASE
];
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: LocalFrameHandle],
ENDCASE
];
FSIndex: TYPE = CARDINAL[0..256);-- different from FrameSizeIndex ?
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];
AVHeapSize: CARDINAL = 40B;-- different from AllocationVectorSize ?
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(stackDepth+1): SELECT OVERLAID * FROM
dst => [],
lst => [dest(stackDepth+1), source(stackDepth+2): ControlLink],
fault => [
frame(stackDepth+1): LocalFrameHandle,
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 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 WORD ← ALL[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.
(ProcessDataArea.SIZE + (ProcessStateBlock.SIZE - 1))/ProcessStateBlock.SIZE;
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.LocalFrameHandle], -- (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 ← TRASH, -- 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 ← TRASH,
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: BOOL ← FALSE,
disjointItems: BOOL ← FALSE,
gray: BOOL ← 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: WORD ← 0
];
BBTableAlignment: CARDINAL = 16;
BBTableSpace: TYPE = ARRAY [1..BBTable.SIZE + 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..TextBltArg.SIZE + 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.