extern "C" void kernel_start(uintptr_t magic, uintptr_t addr) { // enable SSE extensions bitmask in CR4 register enableSSE(); // Initialize system calls _init_syscalls(); // Initialize stack-unwinder, call global constructors etc. _init_c_runtime(); // Initialize OS including devices OS::start(magic, addr); }
void kernel_start(uintptr_t magic, uintptr_t addr) { // Initialize default serial port __init_serial1(); // generate checksums of read-only areas etc. __init_sanity_checks(); // Determine where free memory starts extern char _end; uintptr_t free_mem_begin = reinterpret_cast<uintptr_t>(&_end); if (magic == MULTIBOOT_BOOTLOADER_MAGIC) { free_mem_begin = _multiboot_free_begin(addr); } // Preserve symbols from the ELF binary free_mem_begin += _move_symbols(free_mem_begin); // Initialize zero-initialized vars _init_bss(); // Initialize heap _init_heap(free_mem_begin); // Initialize stack-unwinder, call global constructors etc. _init_c_runtime(); // Initialize system calls _init_syscalls(); // Initialize early OS, platform and devices OS::start(magic, addr); // Initialize common subsystems and call Service::start OS::post_start(); // verify certain read-only sections in memory kernel_sanity_checks(); // Starting event loop from here allows us to profile OS::start OS::event_loop(); }