LOADER
Definition of Loader:
- Loader is a system program which is responsible for preparing the object file to start the execution.
- Once the assembler produces an object program,that program must be placed into memory and executed. It is the purpose of the loaders is to assure that object programs are placed into an executable form.
Functions of Loader:
1. Allocation
- Allocates space in memory for the program.
- In case of Absolute ALP allocation is done by programmer.
- In case of Relocatable ALP allocation is done by loader.
2. Linking
- Resolve symbolic references between objects.
- In case of Absolute ALP linking is done by programmer since,
- programmer is aware of runtime address of all symbols.
- In case of Re locatable ALP allocation is done by loader and hence assembler must provide the location at which linking is to be done.
- Adjust all address dependant locations,such as address constant to correspond to the allocated space.
- In case of Absolute ALP this is done by assembler. In case of Relocatable ALP this is done by loader.
- Placing the object program into its assign memory location.
- In both the cases this is done by the Loader.
General Loading Scheme:
- In this, source program is translated into object program using assembler.
- Then it is loaded into main memory along with source code of loader.
- Size of loader is smaller than assembler code therefore , more space is available for the object program.
We have to store source code of loader.
Absolute Loader:
- The absolute loader reads the object program line by line and moves the text of the program into memory.
- Object program has
- Machine instruction with memory address
- Starting of execution point
i ) Text Card
It contains binary image of assembly program
It contains binary image of assembly program
ii) Transfer Card
It contains starting point execution.
1)TXT Card:
Card Type: It indicate which type of card
0 for Text card.
1 for Transfer card.
2.Count: It indicates amount of information which is to be loaded.
3.Address: It indicates location at which information is to be loaded.
4 Content: It indicates binary information which is to be loaded.
Transfer Card:
Transfer Card: It is used to indicate where to be load the program
Card type is 1.
Count is always 0.
Address: It indicate location from where execution of object program should begin.
Content: It always kept blank.
Card type is 1.
Count is always 0.
Address: It indicate location from where execution of object program should begin.
Content: It always kept blank.
Algorithm
Bootstrap Loader
- Program residing in EPROM,ROM or other non-volatile memory
- Automatically executed by the processor
- Reads the hard disk drives boot sector to continue the process of loading the computer OS
- Enable the user to select the OS to start
- Loading the OS file from the boot partition
- Controlling the OS selection process and hardware detection prior to kernel initialization.
- It is Relocatable type of loader.
- It has advantage of allowing programmer with multiple procedure segments and giving them complete freedom of referring data contained in some other segment.
- Input to the loader is set of object programs to be linked together
- This provides flexible Intersegment Referencing, for doing all this, DLL required following modules.
- ESD-External Symbol Directory
- TXT-Actual assembled program
- RLD-Relocation and Linkage directory module
- END-End module
1:ESD-External Symbol Directory
ESD card contains information about all symbols that are define in a program that may be referred somewhere else and vice versa.
There are 3 types of symbols
There are 3 types of symbols
- Segment Definition (SD):-It is name of the program which return prior to start keyword.
- Local Definition (LD):-This are the symbols which are define in the program.External
- Reference(ER):- This are symbols which are referred in the program but are defining somewhere else.
Relative Address:- It is address at which those symbols are define.
Length: - Size of the symbol.
2. TXT Card
RLD (Relocation and Linkage Directory card)
It contains information about those location of the program whose contains depend on address at which the program is placed.
It contains following information:
- The address of each operand that needs to be changed due to relocation
- By what it has to changed
- The operation to be performed
It specifies that start of execute of the of the object program and end of object module.
Design of DLL (Direct Linking Loader) :
In pass-I global external symbol table is prepared which has external symbol and corresponding absolute address value.
- Direct linking loader requires two passes to complete the linking process
- Pass-I assigns address to all external symbol
- Pass-II performs actual loading ,relocation and linking
Two Pass Loader scheme
Pass1 Database
1. Object card: - This card contain object program in four cards.
i. ESD
ii. TXT
iii. RLD
iv. END
IPLA (Initial program Local Address):-It is the address obtained by loader from operating system.
GEST (Global External Symbol Table):- It is used to keep track of addresses that are assign to the symbol.
Copy file:- it is preferred by pass1 to be used by pass2.
Load Map:- It is printed listing of GEST table.
Pass2 Database
Copy file:- it is preferred by pass1 to be used by pass2
IPLA (Initial program Local Address):-It is the address obtained by loader from operating system.
Execution Address (EXADDR):- It indicates the location from where the execution of object program should begin.
GEST (Global External Symbol Table):- It is used to keep track of addresses that are assigning to the symbol.
Local External Symbol Array(LESA):- It is prepared with the help of ESD And GEST.
0 comments:
Post a Comment