vbos/init/main.c
Michael Shaw a252a3f8e9 kv2: initialize memory manager, early pci devices
Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
2026-05-12 03:00:45 -04:00

76 lines
1.5 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <kernel/common.h>
#include <kernel/buddy.h>
#include <kernel/mem.h>
#include <kernel/device.h>
#include <kernel/requests.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 kmain()
{
/* data types */
rbt_init();
list_init();
kalloc_init();
vfs_init();
device_layer_init();
tty_layer_init();
void *serial_port = arch_serial_init();
tty_printf = tty_create("ttyS0", serial_port);
int rows;
int cols;
tty_get_size(tty_printf, &rows, &cols);
tty_setlf(tty_printf);
tty_set_cursor_pos(tty_printf, 0, 0);
/* start the kernel */
arch_init();
page_init();
pci_init();
krdy("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.
*/
arch_early_init();
requests_init();
mem_init();
buddy_init();
void *bsp_stack = buddy_alloc(buddy_order(P_STACK_SIZE));
arch_stack_init(bsp_stack, P_STACK_SIZE);
/* end previous note */
kmain();
}