A4 Renaissance The startup32 Functions

There are two different startup_32( ) functions; the one we refer to here is coded in the arch/i386/boot/compressed/head.S file. After setup( ) terminates, the function has been moved either to physical address 0x00100000 or to physical address 0x00001000, depending on whether the kernel image was loaded high or low in RAM.

This function performs the following operations:

1. Initializes the segmentation registers and a provisional stack.

2. Fills the area of uninitialized data of the kernel identified by the _edata and _end symbols with zeros (see Section 2.5.3).

3. Invokes the decompress_kernel( ) function to decompress the kernel image. The "Uncompressing Linux . . . " message is displayed first. After the kernel image is decompressed, the "O K, booting the kernel." message is shown. If the kernel image was loaded low, the decompressed kernel is placed at physical address 0x00100000.

Otherwise, if the kernel image was loaded high, the decompressed kernel is placed in a temporary buffer located after the compressed image. The decompressed image is then moved into its final position, which starts at physical address 0x00100000.

4. Jumps to physical address 0x00100000.

The decompressed kernel image begins with another startup_32( ) function included in the arch/i386/kernel/head.S file. Using the same name for both the functions does not create any problems (besides confusing our readers), since both functions are executed by jumping to their initial physical addresses.

The second startup_32( ) function sets up the execution environment for the first Linux process (process 0). The function performs the following operations:

1. Initializes the segmentation registers with their final values.

2. Sets up the Kernel Mode stack for process 0 (see Section 3.4.2).

3. Initializes the provisional kernel Page Tables contained in swapper_pg_dir and pg0

to identically map the linear addresses to the same physical addresses, as explained in Section 2.5.5.

4. Stores the address of the Page Global Directory in the cr3 register, and enables paging by setting the PG bit in the cr0 register.

5. Fills the bss segment of the kernel (see Section 20.1.4) with zeros.

Invokes setup_idt( ) to fill the IDT with null interrupt handlers (see Section

7. Puts the system parameters obtained from the BIOS and the parameters passed to the operating system into the first page frame (see Section 2.5.3).

8. Identifies the model of the processor.

9. Loads the gdtr and idtr registers with the addresses of the GDT and IDT tables.

10. Jumps to the start kernel( ) function.

I [email protected] RuBoard

Was this article helpful?

0 0

Post a comment