Page 143 - DCAP507_SYSTEM_SOFTWARE
P. 143
Unit 9: Design of an Absolute Loader
SD-type ESD The LENGTH of the segment is momentarily saved in the variable SLENGTH. The Notes
suitable entry in the local external symbol array, LESA(ID), is set to the current value of the
Program Load Address.
LD type ESD The LD-type ESD does not require any processing during pass 2.
ER type ESD The Global External Symbol Table (GEST) is searched for match with the ER
symbol. If it is not found, the corresponding segment or entry must be missing - this is a
mistake. If the symbol is found in the GEST, its value is extracted and the corresponding Local
External Symbol Array entry, LESA(ID), is set equal to it. TXT record. When a TXT record is read,
the text is copied from the record to the suitable relocated core location (PLA + ADDR).
RLD Record
The value to be utilized for relocation and linking is extracted from the load external symbol
array as specified).
Based upon the flag setting (plus or minus) the value is either added to or subtracted from the
address constant. The definite relocated address of the address constant is computed as the sum
of the PLA and the ADDR field stated on the RLD record.
END Record
If an execution start address is stated on the END record, it is saved in the variable EXADDR after
being relocated by the PLA. The Program Load Address is augmented by the length of the
segment and saved in SLENGTH, turning out to be the PLA for the next segment.
Example: Write a C program to execute pass 2 of direct linking loader.
Algorithm
STEP 1: Start the program execution.
STEP 2: Find the control section length from the header record.
STEP 3: In the text record, character form is converted to machine representation.
STEP 4: Move the object code from record to memory location.
STEP 5: In the modification record, search for symbol to be modified from external table.
Found symbol address is added or subtracted with corresponding symbol address
and value at starting location.
STEP 6: Stop the program execution.
Program
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct ext_table
{ char csect[10];
LOVELY PROFESSIONAL UNIVERSITY 137