x86: add GDT and IDT

Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
Michael Shaw 2026-04-13 04:23:14 -04:00
commit e5b55a6ba5
25 changed files with 1211 additions and 13 deletions

View file

@ -10,6 +10,7 @@
#include <drivers/tty.h>
#include <drivers/serial.h>
#include <drivers/acpi.h>
#include <drivers/apic.h>
@ -20,16 +21,13 @@
struct tty *tty_printf = NULL;
void kmain()
static void requires_bootloader_mem()
{
/* init tty ASAP */
requests_init();
mem_init();
buddy_init();
void *ap_stack = buddy_alloc(P_STACK_SIZE);
arch_stack_init(ap_stack, P_STACK_SIZE);
acpi_init();
}
static void kmain()
{
rbt_slab_init();
device_layer_init();
tty_layer_init();
@ -46,8 +44,29 @@ void kmain()
tty_set_cursor_pos(tty_printf, 0, 0);
/* start the kernel */
arch_init();
requires_bootloader_mem();
page_init();
kprintf(COL_CYAN_BLACK "Welcome to vbos!\n" COL_RESET);
yield();
}
void _before_stack()
{
/* these first few functions must be called in this order
*
* after calling arch_stack_init, we will lose all of our stack
* variables. only the most minimum things needed to init the stack
* here.
*/
requests_init();
mem_init();
buddy_init();
void *ap_stack = buddy_alloc(P_STACK_SIZE);
arch_stack_init(ap_stack, P_STACK_SIZE);
/* end previous note */
kmain();
}