kv2: initialize memory manager, early pci devices

Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
Michael Shaw 2026-05-12 02:59:37 -04:00
commit a252a3f8e9
58 changed files with 1270 additions and 505 deletions

View file

@ -4,35 +4,39 @@
#include <kernel/mem.h>
#include <kernel/device.h>
#include <kernel/requests.h>
#include <arch/init.h>
#include <kernel/page.h>
#include <kernel/slab.h>
#include <arch/init.h>
#include <drivers/tty.h>
#include <drivers/serial.h>
#include <drivers/pci.h>
#include <drivers/acpi.h>
#include <drivers/apic.h>
#include <fs/vfs.h>
#include <lib/stdio.h>
#include <lib/list.h>
#include <lib/rbtree.h>
#define P_STACK_SIZE 0x8000
struct tty *tty_printf = NULL;
static void requires_bootloader_mem()
{
acpi_init();
}
static void kmain()
{
rbt_slab_init();
/* data types */
rbt_init();
list_init();
kalloc_init();
vfs_init();
device_layer_init();
tty_layer_init();
dev_t serial_port = arch_serial_init();
void *serial_port = arch_serial_init();
tty_printf = tty_create("ttyS0", serial_port);
int rows;
@ -40,15 +44,14 @@ static void kmain()
tty_get_size(tty_printf, &rows, &cols);
tty_setlf(tty_printf);
tty_clear_screen(tty_printf);
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);
pci_init();
krdy("Welcome to vbos!\n" COL_RESET);
yield();
}
@ -61,12 +64,13 @@ void _before_stack()
* variables. only the most minimum things needed to init the stack
* here.
*/
arch_early_init();
requests_init();
mem_init();
buddy_init();
void *ap_stack = buddy_alloc(P_STACK_SIZE);
arch_stack_init(ap_stack, P_STACK_SIZE);
void *bsp_stack = buddy_alloc(buddy_order(P_STACK_SIZE));
arch_stack_init(bsp_stack, P_STACK_SIZE);
/* end previous note */
kmain();
}