KernOS
kernel.cpp
Go to the documentation of this file.
1 #include <common.h>
2 #include <vga.h>
3 #include <cpu.h>
4 #include <interrupt.h>
5 #include <gdt.h>
6 #include <global.h>
7 #include <memoryallocator.h>
8 #include <virtualmemory.h>
9 #include <pit.h>
10 
11 #ifndef __i686__
12 #error "Failed - use i686 compiler instead"
13 #endif
14 
15 #ifndef ARCH_32
16 #error "Failed - use 32 bit architecture"
17 #endif
18 
21 
23 extern "C" void kernel_main()
24 {
25  INIT::ctors(); // initialize global constructors
26  INIT::VGA(); // display kernel banner
27  INIT::KMALLOC(); // initialize kernel malloc, i.e. kmalloc use supported after this point
28  INIT::SSE(); // enable SSE instruction set
29  INIT::gdt(); // prepare global descriptor table for x86 protected mode
30  INIT::idt(); // install exceptions, interrupts, e.g. page fault handler for paging use later
31  INIT::PAGE(); // initialize page directory, page table
32  INIT::PIT(); // initialize timer
33 
34  sti(); // enable interrupt
35 
36  kprintf("reach");
37 }
void PIT()
Initializes programmable interval timer.
Definition: pit.cpp:91
void gdt()
creates global descriptor table and loads it into CPU
Definition: gdt.cpp:172
void SSE()
initialize Streaming Single Instruction Multiple Data (SIMD) Extensions, (SSE)
Definition: cpu.cpp:30
void kernel_main()
Kernel entry function.
Definition: kernel.cpp:23
void kprintf(const char *Str)
Prints string to display.
Definition: kprintf.cpp:13
void idt()
Creates interrupt descriptor table and loads to CPU.
Definition: interrupt.cpp:126
void KMALLOC()
Provides memory allocator with range of reserved memory address to manage.
void ctors()
calls constructors on all global objects
Definition: global.cpp:29
void PAGE()
set up page directory, page table, and turn on paging
void VGA()
Clear VGA display, and print kernel banner.
Definition: vga.cpp:67