13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Relocation TablesA relocation table is a sequence of records that contain informationnecessary to relocate any relocatable addresses used by code within theprocedure. Relocatable addresses are relocated whenever the segmentcontaining the procedure is loaded into memory. Only native codeprocedures use relocatable addresses; procedures that contain P-code arecompletely position-independent, and no relocation list is needed.The format of all four relocation tables is the same: the highest word of eachtable specifies the number of entries (possibly 0) that follow (at lower diskaddresses) in the table. The remainder of each table comprises that numberof one-word self-relative pointers to locations in the procedure code thatmust be "fixed." The locations are "fixed" when the segment is loaded bythe addition of the appropriate relative relocation constant, which is knownto the Interpreter.Addresses pointed to by a base-relative relocation table are relocatedrelative to the address contained in the P-machine's BASE pseudoregisterif the RELOCSEG NUMBER field of the procedure's attribute table is 0. TheBASE register is a pointer to the activation record of the most recentlyinvoked base procedure (lexical level 0 or - 1). Global (lexical level 0)variables are accessed by indexing from the value of the BASE register. Ifthe RELOCSEG NUMBER field is not 0, the relocations will be relative to thelowest address of the segment whose segment number is contained in theRELOCSEG NUMBER field. Base-relative relocation is used by assemblyprocedures that are linked with Intrinsic Units to access the Intrinsic Unit'sdata segment .. PUBLIC and .PRIVATE are the Assembler directives thatgenerate base-relative relocation fields.Addresses pointed to by a segment-relative relocation table arerelocated relative to the lowest address of the segment. The value of theaddress of the lowest byte in the segment is added to each of the addressespointed to in the relocation table .. REF and .DEF are the Assemblerdirectives that generate segment-relative relocation fields.Addresses pointed to by a proced1J1re-relative relocation table arerelocated relative to the lowest address of the procedure. The value of theaddress of the lowest byte in the procedure is added to each of theaddresses pointed to in the relocation table.The Interpreter-relative relocation fields point to relocatable addresses thataccess Pascal Interpreter procedures or variables. Addresses pointed to byan Interpreter-relative relocation table are relocated relative to a tablein the Interpreter. See the explanation of the .INTERP directive in Part II,Chapter 6.Code PartsIV-37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!