summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/main.c
blob: d688fa0302aa1618ca9d107199d6d3548fe9ef2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "jove.h"
#include "init.h"
#include "lib/printf.h"
#include "lib/virtterm.h"
#include "lib/panic.h"
#include "../../hal/obj.h"
#include "hal/msr.h"
#include "hal/serial_com.h"
#include "hal/smp.h"
#include "hal/memory.h"
#include "hal/framebuffer.h"
#include "hal/process.h"
#include "boot/initrd.h"
#include "boot/cmdline.h"
#include "uacpi/uacpi.h"

int errno = 0;

PAGEALIGN jove_objdir_t _rootdir = { 0 };

void *_rootdir_obj = &_rootdir;

static void kernel_process_entry(void);

void
kernel_entry(void)
{
    msr_enable_sse();

    obj_settype(_rootdir_obj, JOVE_OBJ_OBJDIR);
    serial_com_init();

    smp_init_bsp();

    initrd_setup();

    fb_init();
    vt_init();

    cmdline_print();

    mem_setup_untyped();

    extern void processing_setup(void*);
    processing_setup(kernel_process_entry);
    hcf();
}

static void
kernel_process_entry(void)
{
    uint8_t uacpi_buffer[1024];
    uacpi_setup_early_table_access(uacpi_buffer, 1024);

    init_setup();
    kpanic("Reached the end of kernel main!\n");
}