boucane/src/boucane.cc
2021-04-28 10:46:36 +02:00

49 lines
No EOL
1.3 KiB
C++

#include "boucane.hpp"
#include "core/idt.hpp"
#include "boot/multiboot2.hpp"
#include "core/paging.hpp"
#include "core/apic.hpp"
#include "drivers/acpi.hpp"
#include "drivers/psf.hpp"
#include "drivers/framebuffer.hpp"
#include "libs/stdio.hpp"
#include "core/asm.hpp"
u64 kernel_vma,stack_pma,userspace_pma;
extern "C" void boucane(u64 mb_info){
// Init linker variables
asm volatile ("movq $__kernel_vma, %0":"=m"(kernel_vma));
asm volatile ("movq $__userspace_pma, %0":"=m"(userspace_pma));
asm volatile ("movq $__stack_pma, %0":"=m"(stack_pma));
asm volatile ("call load_gdt");
// Init data structures
paging_enable();
idt_enable_interrupt();
// Looking for framebuffer
vga_t_init();
vga_t_clear();
FRAMEBUFFER fb_info;
if(mb2_find_framebuffer((u32*)mb_info, &fb_info)){
if(fb_info.bpp>16){
FB_CFG conf;
conf.depth=fb_info.bpp;
conf.location=fb_info.addr;
conf.pitch=fb_info.pitch;
conf.width=fb_info.width;
conf.height=fb_info.height;
framebuffer_init(conf);
psf_init((void*)&res_binary_res_terminus_psf_start);
__putchar=psf_putchar;
}
}
// Booting!
printk("Booting Boucane v%d.%d.%d\n",VERSION_MAJOR,VERSION_MINOR, VERSION_PATH);
while(1);
}