Friday, 25 September 2015

What Is A Loader?

LOADER


Definition of Loader:

  1. Loader is a system program which is responsible for preparing the object file to start the execution.
  2. 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.
3. Relocation
  • 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.
4. Loading
  • Placing the object program into its assign memory location.
  • In both the cases this is done by the Loader.
General Loading Scheme:
general loading scheme

  1. In this, source program is translated into object program using assembler.
  2. Then it is loaded into main memory along with source code of loader.
  3. Size of loader is smaller than assembler code  therefore , more  space is available for the object program.
Disadvantage
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
  1. Machine instruction with memory address
  2. Starting of execution point
 It requires 2 types of  records
i ) Text Card
It contains binary image of assembly program
ii) Transfer Card
It contains starting point execution.
 
1)TXT Card:
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.

 
Algorithm

algorithm transefer card  
 
Bootstrap Loader
  1. Program residing in EPROM,ROM or other non-volatile memory
  2. Automatically executed by the processor
  3. Reads the hard disk drives boot sector to continue the process of loading the computer OS
Function of Bootstrap Loader: 
  1. Enable the user to select the OS to start
  2. Loading the OS file from the boot partition
  3. Controlling the OS selection process and hardware detection prior to kernel initialization.
 DLL : Direct Linking Loader
  1.  It is Relocatable type of loader.
  2. It has advantage of allowing programmer with multiple procedure segments and giving them complete freedom of referring data contained in some other segment.
  3. Input to the loader is set of object programs to be linked together
  4. This provides flexible Intersegment Referencing, for doing all this, DLL required following modules.
    1.  ESD-External Symbol Directory
    2. TXT-Actual assembled program
    3. RLD-Relocation and Linkage directory module
    4. 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
  1. Segment Definition (SD):-It is name of the program which return prior to start keyword.
  2. Local Definition (LD):-This are the symbols which are define in the program.External
  3. Reference(ER):- This are symbols which are referred in the program but are defining somewhere else.
ID: - Giving unique no. to all segment definition and external reference.
Relative Address:- It is address at which those symbols are define.
Length: - Size of the symbol.

2. TXT Card
TXT card
Text portion of object module contains the relocatable machine language instruction and data that were produced during translation.

RLD (Relocation and Linkage Directory 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:
  1. The address of each operand that needs to be changed due to relocation
  2. By what it has to changed
  3. The operation to be performed
End Card



It specifies that start of execute of the of the object program and end of object module.


Design of DLL (Direct Linking Loader) :
  • 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
In pass-I global external symbol table is prepared which has external symbol and corresponding absolute address value.

Two Pass Loader scheme 

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

Entc Engg. Powered by Blogger.