next up previous
Next: Protected Mode Support Up: Boot-strap Loader Previous: Second Stage -

Third Stage - Run-time System Initialization

At this point the kernel is at its target location and the CPU is running in protected mode. The third stage begins with a call to start() at the end of kick_start. Before control can be transferred to the main() function of Nachos/486 the semantics of the C and C++ run-time systems must be guaranteed. The third stage begins by initializing the global/uninitialized data area, the bss segment. This accounts for the C run-time expectations; Unfortunately The C++ run-time initialization is more complicated, because constructors for global objects must be called. Since nearly all objects in Nachos are referenced via pointers and constructed at run-time, there was only one global object to construct, the KernelMemoryManager. This class is discussed below in section 2.4.

In addition to constructing global objects, we also pause to allow the console operator to specify some run-time debug options. This allowed us to enable messages from particular subsystems as well as force the system to pause after each printf() so that execution could be traced seamlessly. After reading in the flags, an argument list is made for the main() function. Then lastly, main() is called and nachos486 is given total control of the CPU.

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