next up previous
Next: Machine-Dependent Code Up: Bootstrapping the Project Previous: The Stand-alone Kernel

The Booter


Some ports ( e.g., the Macintosh) boot directly from the native operating system. In the case of the Macintosh, this takes a bit longer than booting directly at machine startup, but allows the booter to pass in information about the machine that it gets from MacOS ( e.g., the location of video memory). A booter must do several things:

  1. Given a disk and partition number, find the root directory and the kernel in it;
  2. load the kernel (text and data) into a contiguously allocated space; and
  3. copy the code of a routine after the kernel and execute the routine.

The routine should disable interrupts, copy the kernel text and data to location zero, clear enough space for the bss, and jump to the start location in the kernel. The routine should be careful not to clear itself when clearing the bss. This can be guaranteed by writing the routine sufficiently high in memory so that its location is at least the size of the kernel's code, data, and bss.

The booter is also responsible for passing information into the kernel. This can be done through registers if the amount of information is small ( e.g., debug mode, root disk) or through some more elaborate scheme ( e.g., array of text variables) if more data needs to be passed, such as date and time, video address and mode, or machine configuration information.

Lawrence Kesteloot
Fri Jan 20 16:29:52 EST 1995