Raj Kumar
Computer Science And Engineering

What is Program Relocation? Explain the problem associated with it and there solution

System Software and Compiler Design

Explanation

964    0

Program relocation


Ø The actual starting address of the program is not known until load time


Ø An object program that contains the information necessary to perform this kind of modification is called a relocatable program


Ø No modification is needed: operand is using program-counter relative or base relative addressing


Ø The only parts of the program that require modification at load time are those that specified direct (as opposed to relative) addresses


Ø Modification record


        o Col. 2-7 Starting location of the address field to be modified, relative to the           beginning of the program (Hex)


Col. 8-9  Length of the address field to be modified, in half-bytes (Hex)


Sometimes it is required to load and run several programs at the same time. The system must be able to load these programs wherever there is place in the memory. Therefore the exact starting is not known until the load time.





Absolute Program


In this the address is mentioned during assembling itself. This is called Absolute Assembly.


 


Consider the instruction:


55101B  LDA   THREE    00102D



· This statement says that the register A is loaded with the value stored at location 102D. Suppose it is decided to load and execute the program at location 2000 instead of location 1000.


· Then at address 102D the required value which needs to be loaded in the register A is no more available. The address also gets changed relative to the displacement


of the program. Hence we need to make some changes in the address portion of the instruction so that we can load and execute the program at location 2000.


 

· Apart from the instruction which will undergo a change in their operand address value as the program load address changes. There exist some parts in the program which will remain same regardless of where the program is being loaded.

 

· Since assembler will not know actual location where the program will get loaded, it cannot make the necessary changes in the addresses used in the program. However, the assembler identifies for the loader those parts of the program which need modification.

 

· An object program that has the information necessary to perform this kind of modification is called the relocatable program.




Share:   
   Raj Kumar
Computer Science And Engineering

More Questions from System Software and Compiler Design Module 1