Beruflich Dokumente
Kultur Dokumente
Loading which brings the object program into memory for execution. Relocation which modifies the object program so that it can be loaded at an address different from the location originally specified. Linking which combines two or more separate object programs and supplies the information needed to allow references between them.
A loader is a system program that performs the loading function. Many loaders also support relocation and linking. Some systems have a linker (or linkage editor) to perform the linking operations and a separate loader to handle relocation and loading.
3
Absolute loader
z
It is very simple.
z z
An object program is loaded at the address specified on the START directive. No relocation or linking is needed. The loader jumps to the address specified on the END directive to begin execution of the loaded program.
5
48 occupies two bytes in char form. 48 occupies one byte in binary form.
This scheme needs the programmer to specify the actual address at which it will be loaded into memory. This scheme make it difficult to use subroutine libraries efficiently.
Bootstrap loader
z
When a computer is turned on or restarted, a special type of absolute loader, called bootstrap loader, is executed.
The bootstrap loader loads the first program to be run by the computer usually an operating system, from the boot disk (e.g., a hard disk or a floppy disk)
10
11
On x86 systems, when the CPU is powered on or reset, it sets its registers to a known state and jumps to the starting address of boot ROM. The boot ROM code reads the first block of the floppy or the hard disk into memory location zero and then jumps to location zero. The program in the first block in turn loads a slightly larger operating system boot program from a known place on the disk into memory, and it jumps to that program. The just loaded program loads in the operating system and starts it.
There can be even more steps such as a boot manager that decides from which disk partition to read the operating system boot program.
12
An operating system loader cannot be stored in a small space (usually a disk block).
The first-level loader typically is only able to load a single-segment program from a file with a fixed name in the top-level directory of the boot disk.
13