Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

12

n20
n10

n30
4. Run full boostrap 2. Run this program
Tiny bootstrap loader program Firmware
(initial program)
Loaded
Full Boostrap Loader
3. Load full boostrap
Program

1. Power on

RAM 5. Load OS
Loaded Full bootstrap loader
OS object code Boot block

OS object code
6. Run OS

Disk
Disk

header
1.
.exe
1. Reads the executable file header to determine size of the text and data segments

2. Creates a (virtual) address space large enough for the text and data

2. 3. instruction,
3. Copies the instructions and data from the executable file into memory. 4. parameter(argements) data

4. Copies the parameters (if any) to the main program onto the stack

5. Initializes the processor registers and sets the stack pointer to the first free location.

Load steps 6. Branches to ( program counter points to ) a start-up routine that


a. copies the parameters into the argument registers and
b. calls the main routine of the program.
When the main routine returns,
the start-up routine terminates the program with an exit system call.

5. Initialize registers and set sp Virtual address space(in memory)


CPU
x0

⋮ _start_up:
lw x10, offset($sp) // load argument
f31
jal x1, main // call main routine
exit // exit after return from main
stack pointer(sp)
6.
program counter
A

B
1 3 C
2
4 D
span(S)

L S

x si s1

!
S H

span(S)

L=S

You might also like