next up previous contents index
Next: 13.7.3 base_gdt_load: load the Up: (X86) Base Environment: Segmentation Previous: 13.7.1 base_gdt: default global

13.7.2 base_gdt_init: initialize the base GDT to default values

   

SYNOPSIS

#include <oskit/x86/base_gdt.h>

void base_gdt_init(void); void i16_base_gdt_init(void);

DESCRIPTION

This function initializes the standard descriptors in the base GDT as described in Section 13.7.1.

For all of the standard descriptors except LINEAR_CS and LINEAR_DS, the kvtolin macro is used to compute the linear address to plug into the offset field of the descriptor: for BASE_TSS, this is kvtolin(&base_tss); for the kernel code and data segments, it is kvtolin(0) (i.e., the linear address corresponding to the beginning of kernel virtual address space). LINEAR_CS and LINEAR_DS are always given an offset of 0.

A 16-bit version of this function, i16_base_gdt_init, is also provided so that the GDT can be initialized properly before the processor has been switched to protected mode. (Switching to protected mode on the x86 according to Intel's recommended procedure requires a functional GDT to be already initialized and activated.)

DEPENDENCIES

fill_descriptor
13.3.8
kvtolin
13.6.2
base_gdt
13.7.1
base_tss
13.7.6



Utah Flux Research Group