0% found this document useful (0 votes)
2K views

Program Relocation

The document discusses program relocation which is necessary to allow multiple programs to run simultaneously on a system. Absolute programs specify starting addresses at assembly time but these addresses may be invalid if the program is loaded elsewhere in memory. Relocatable programs allow addresses to be assigned relative to the program start and include modification records to update absolute addresses with the actual load location when the program runs. These records store the starting location and length of address fields that need modification by the loader.

Uploaded by

Sagar Chingali
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Program Relocation

The document discusses program relocation which is necessary to allow multiple programs to run simultaneously on a system. Absolute programs specify starting addresses at assembly time but these addresses may be invalid if the program is loaded elsewhere in memory. Relocatable programs allow addresses to be assigned relative to the program start and include modification records to update absolute addresses with the actual load location when the program runs. These records store the starting location and length of address fields that need modification by the loader.

Uploaded by

Sagar Chingali
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Program Relocation

The need for program relocation It is desirable to load and run several programs at the same time. The system must be able to load programs into memory wherever there is room. The exact starting address of the program is not known until load time. Absolute Program Program with starting address specified at assembly time The address may be invalid if the program is loaded into somewhere else. Example:

Example: Program Relocation

The only parts of the program that require modification at load time are those that specify direct addresses. The rest of the instructions need not be modified. Not a memory address (immediate addressing) PC-relative, Base-relative From the object program, it is not possible to distinguish the address and constant.

The assembler must keep some information to tell the loader. The object program that contains the modification record is called a Relocatable Program. The way to solve the relocation problem For an address label, its address is assigned relative to the start of the program(START 0) Produce a Modification record to store the starting location and the length of the Address field to be modified. The command for the loader must also be a part of the object program. Modification record One modification record for each address to be modified The length is stored in half-bytes (4 bits) The starting location is the location of the byte containing the leftmost bits of the address field to be modified. If the field contains an odd number of half-bytes, the starting location begins in the middle of the first byte.

You might also like