next up previous
Next: Third Stage - Up: Boot-strap Loader Previous: First Stage -

Second Stage - CPU and Protected Mode Initializations

In other PC Unix systemsgif, the second stage boot code is more distinct from the other two stages. In our implementation, the second stage is an assembler stub labeled kick_start which is linked at the beginning of the kernel. It prepares the CPU for entering protected mode and starting the third stage of the boot-strapping process. This stage relies on being loaded to a particular address in memory by the BIOS. It then relocates itself (and the Nachos/486 kernel) to 0x4000:0 in memory. This address is very important at compile time; It is a macro defined constant which must agree between the start-up routine and the linking of the nachos486 kernel. The kernel is linked with this as its target address. This is different for a process running under a modern OS, because virtual memory address ranges typically begin with 0x0. After relocating itself, it jumps to the copy if its next instruction in the relocated code. At this point nachos486 enters protected mode. Entering protected mode is a difficult trick, and we rely on code from the Mach operating system, as modified by the FreeBSD development team.



Paco Hope
Wed Jun 21 23:54:28 EDT 1995