SunADotOutPrivate.Mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Bill Jackson (bj) June 22, 1988 4:33:06 pm PDT
DIRECTORY Basics, SunADotOut, RedBlackTree, Rope, VM;
SunADotOutPrivate: CEDAR DEFINITIONS ~ {
Module: TYPE ~ REF ModuleObject;
ModuleObject: TYPE ~ RECORD [
filename: Rope.ROPE, header: Header, -- for informational purposes
programText: Segment, textRelocation: LIST OF RelocationInfo,
programData: Segment, dataRelocation: LIST OF RelocationInfo,
programBss: Segment,
symbolTable: RedBlackTree.Table -- only *interesting* symbols
];
Segment: TYPE ~ RECORD [
interval: VM.Interval,
block: Basics.UnsafeBlock,
target: CARD32
];
Header: TYPE ~ REF HeaderObject;
HeaderObject: TYPE ~ RECORD [
dynamic: BOOL,
toolVersion: BYTE,
machineType: MachineType,
magic: Magic,
text: CARD32, -- size of text segment
data: CARD32, -- size of initialized data
bss: CARD32, -- size of un-initialized data
symbolTableSize: CARD32,
entryPoint: CARD32,
textRelocationSize: CARD32,
dataRelocationSize: CARD32,
stringTableSize: CARD32
];
MachineType: TYPE ~ MACHINE DEPENDENT {
oldSun2 (0), -- old sun-2 executable files
mc68010 (1), -- runs on either 68010 or 68020
mc68020 (2), -- runs only on 68020
sparc (3), -- runs only on SPARC
(BYTE.LAST)
};
Magic: TYPE ~ MACHINE DEPENDENT {
OMAGIC (0407B), -- old impure format
NMAGIC (0410B), -- read-only text
ZMAGIC (0413B), -- demand load format
(CARD16.LAST)
};
RelocationInfo: TYPE ~ REF RelocationInfoObject;
RelocationInfoObject: TYPE ~ RECORD [
address: CARD32, -- relocation addr (offset in segment)
symbol: Symbol ← NIL,
basedUpon: NameType ← undefined,
index: CARD32, -- segment index or symbol index
extern: BOOL, -- index is TRUE => SYM idx; FALSE => SEG#
unused: BYTE,-- <unused>
type: RelocationType, -- type of relocation to perform
addend: INT32, -- addend for relocation value
rawWord: CARD32 -- orignal content [addr-addr%4]
];
RelocationType: TYPE ~ MACHINE DEPENDENT {
simple8 (0), simple16 (1), simple32 (2), -- simplest relocations
disp8 (3), disp16 (4), disp32 (5), -- Displacment's (pc-rel)
worddisp30 (6), worddisp22 (7), -- SR word displacment's
srHi22 (8), sr22 (9), -- SR 22-bit relocations
sr13 (10), srLo10 (11), -- SR 13&10-bit relocations
sfaBase (12), sfaOff13 (13), -- SR S.F.A. relocations
base10 (14), base13 (15), base22 (16), -- base relative pic
pc10 (17), pc22 (18), -- special pc-relative pic
jumpTable (19), -- jump table relative in pic
segmentOffset16 (20), -- ShLib offset-in-segment
globalData (21), jumpSlot (22), relative (23), -- rtld relocations
(BYTE.LAST)
};
Symbol: TYPE ~ REF SymbolObject;
SymbolObject: TYPE ~ RECORD [
text: Rope.ROPE,
stringTableIndex: CARD32,
type: NameType,
permanent: BOOL,
description: SymbolDescription,
other: BYTE,
details: CARD16,
value: CARD32,
backlink: SunADotOut.Module ← NIL -- causes cycles, cut here (especially for collection)
];
NameType: TYPE ~ MACHINE DEPENDENT {
undefined (00H),
absolute (02H),
text (04H),
data (06H),
bss (08H),
common (012H),
fileNameSymbol (01eH),
(BYTE.LAST)
};
SymbolDescription: TYPE ~ MACHINE DEPENDENT {
notPermanent (0), -- not a permanent symbol table entry
GSYM (020H), -- global symbol: name,,0,type,0
FNAME (022H), -- procedure name (f77 kludge): name,,0
FUN (024H), -- procedure: name,,0,linenumber,address
STSYM (026H), -- static symbol: name,,0,type,address
LCSYM (028H), -- .lcomm symbol: name,,0,type,address
MAIN (02aH), -- name of main routine : name,,0,0,0
PC (030H), -- global pascal symbol: name,,0,subtype,line
RSYM (040H), -- register sym: name,,0,type,register
M2C (042H), -- compilation unit stab
SLINE (044H), -- src line: 0,,0,linenumber,address
SSYM (060H), -- structure elt: name,,0,type,struct←offset
SO (064H), -- source file name: name,,0,0,address
LSYM (080H), -- local sym: name,,0,type,offset
BINCL (082H), -- header file: name,,0,0,0
SOL (084H), -- #included file name: name,,0,0,address
PSYM (0a0H), -- parameter: name,,0,type,offset
EINCL (0a2H), -- end of include file
ALTENTRY (0a4H), -- alternate entry: name,linenumber,address
LBRAC (0c0H), -- left bracket: 0,,0,nesting level,address
EXCL (0c2H), -- excluded include file
SCOPE (0c4H), -- scope information
RBRAC (0e0H), -- right bracket: 0,,0,nesting level,address
BCOMM (0e2H), -- begin common: name,,
ECOMM (0e4H), -- end common: name,,
ECOML (0e8H), -- end common (local name): ,,address
LENG (0feH), -- second stab entry with length information
(BYTE.LAST)
};
NAMETYPEMASK: BYTE ~ 01eH;
SYMDESCMASK: BYTE ~ 0e0H;
pageSize: NAT ~ 8192;
segmentSize: NAT ~ 8192;
bufSiz: NAT; -- of transfer block for file reader
}.