KernOS
INIT Namespace Reference

contains all kernel initialization routines More...

Functions

void SSE ()
 initialize Streaming Single Instruction Multiple Data (SIMD) Extensions, (SSE) More...
 
void gdt ()
 creates global descriptor table and loads it into CPU More...
 
void ctors ()
 calls constructors on all global objects More...
 
void idt ()
 Creates interrupt descriptor table and loads to CPU. More...
 
void pagetables ()
 
void KMALLOC ()
 Provides memory allocator with range of reserved memory address to manage. More...
 
void PIT ()
 Initializes programmable interval timer. More...
 
void VGA ()
 Clear VGA display, and print kernel banner. More...
 
void PAGE ()
 set up page directory, page table, and turn on paging More...
 

Detailed Description

contains all kernel initialization routines

Function Documentation

◆ ctors()

void INIT::ctors ( )

calls constructors on all global objects

as kernel is linked with -nostdlib, __do_global_ctors_aux are not called thus we have to call global constructors ourselves

See also
crtstuff.c

Definition at line 29 of file global.cpp.

◆ gdt()

void INIT::gdt ( )

creates global descriptor table and loads it into CPU

See also
GDT::Install_gdt

Definition at line 172 of file gdt.cpp.

◆ idt()

void INIT::idt ( )

Creates interrupt descriptor table and loads to CPU.

1) Remaps Programmable interrupt controller's interrupt number
2) Assigns exceptions and interrupt handlers

See also
PIC::Remap
INTRP::Install_idt

Definition at line 126 of file interrupt.cpp.

◆ KMALLOC()

void INIT::KMALLOC ( )

Provides memory allocator with range of reserved memory address to manage.

Todo:
don't hardcode heap size

Definition at line 114 of file memoryallocator.cpp.

◆ PAGE()

void INIT::PAGE ( )

set up page directory, page table, and turn on paging

Todo:
only setting up page table 0 for now, i.e. 0 - 4 MiB

Definition at line 76 of file virtualmemory.cpp.

◆ pagetables()

void INIT::pagetables ( )

◆ PIT()

void INIT::PIT ( )

Initializes programmable interval timer.

1) Initializes 8254 Programmable Interrupt Timer
2) Installs timer interrupt handler

See also
TIMER::PIT_825x

Definition at line 91 of file pit.cpp.

◆ SSE()

void INIT::SSE ( )

initialize Streaming Single Instruction Multiple Data (SIMD) Extensions, (SSE)

See also
Streaming SIMD Extensions
IA-32 Intel Architecture Software Developer's Manual Volume 3: System Programming Guide - Section 12.1.4 Initialization of the SSE/SSE2/SSE3 Extensions
cr0
cr4
CPU control register 0
| bit | val | description                           |
|   1 |  MP | required for IA-32 support of SSE     |
|   2 |  EM | clear to disable emulation of x87 FPU |

CPU control register 4
| bit |        val | description                                                                          |
|   9 |     OSFXSR | set when OS provides facilities for saving/restoring SSE states using FXSAVE/FXRSTOR |
|  10 | OSXMMEXCPT | set when OS provides SIMD floating point exception, #XF handler                      |

Definition at line 30 of file cpu.cpp.

◆ VGA()

void INIT::VGA ( )

Clear VGA display, and print kernel banner.

Definition at line 67 of file vga.cpp.