forked from xamidev/pepperOS
Init struct + freeing a bit of kmain()
This commit is contained in:
35
src/kmain.c
35
src/kmain.c
@@ -30,8 +30,6 @@
|
||||
__attribute__((used, section(".limine_requests")))
|
||||
volatile LIMINE_BASE_REVISION(3);
|
||||
|
||||
struct flanterm_context *ft_ctx;
|
||||
|
||||
// Halt and catch fire (makes machine stall)
|
||||
void hcf()
|
||||
{
|
||||
@@ -41,9 +39,9 @@ void hcf()
|
||||
// Doing nothing (can be interrupted)
|
||||
void idle() {SET_INTERRUPTS; for(;;)asm("hlt");}
|
||||
|
||||
// uint8_t kernel_stack[KERNEL_STACK_SIZE] __attribute__((aligned(16)));
|
||||
|
||||
struct flanterm_context *ft_ctx;
|
||||
struct boot_context boot_ctx;
|
||||
struct init_status init = {0};
|
||||
|
||||
extern volatile struct limine_framebuffer_request framebuffer_request;
|
||||
extern volatile struct limine_memmap_request memmap_request;
|
||||
@@ -64,12 +62,6 @@ void idle_main(void* arg)
|
||||
for(;;)asm("hlt");
|
||||
}
|
||||
|
||||
void flanterm_free_wrapper(void* ptr, size_t size)
|
||||
{
|
||||
(void)size;
|
||||
kfree(ptr);
|
||||
}
|
||||
|
||||
extern uintptr_t kheap_start;
|
||||
|
||||
// This is our entry point
|
||||
@@ -79,6 +71,7 @@ void kmain()
|
||||
if (!LIMINE_BASE_REVISION_SUPPORTED) hcf();
|
||||
|
||||
serial_init();
|
||||
timer_init();
|
||||
|
||||
// Populate boot context
|
||||
boot_ctx.fb = framebuffer_request.response ? framebuffer_request.response->framebuffers[0] : NULL;
|
||||
@@ -95,29 +88,10 @@ void kmain()
|
||||
|
||||
keyboard_init(FR);
|
||||
|
||||
uint32_t bgColor = 0x252525;
|
||||
ft_ctx = flanterm_fb_init(
|
||||
kmalloc,
|
||||
flanterm_free_wrapper,
|
||||
boot_ctx.fb->address, boot_ctx.fb->width, boot_ctx.fb->height, boot_ctx.fb->pitch,
|
||||
boot_ctx.fb->red_mask_size, boot_ctx.fb->red_mask_shift,
|
||||
boot_ctx.fb->green_mask_size, boot_ctx.fb->green_mask_shift,
|
||||
boot_ctx.fb->blue_mask_size, boot_ctx.fb->blue_mask_shift,
|
||||
NULL,
|
||||
NULL, NULL,
|
||||
&bgColor, NULL, // &bgColor
|
||||
NULL, NULL,
|
||||
NULL, 0, 0, 1,
|
||||
0, 0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
term_init();
|
||||
|
||||
gdt_init();
|
||||
idt_init();
|
||||
|
||||
timer_init();
|
||||
vmm_init();
|
||||
|
||||
process_init();
|
||||
struct process_t* idle_proc = process_create("idle", (void*)idle_main, 0);
|
||||
@@ -131,5 +105,6 @@ void kmain()
|
||||
current_process->status = RUNNING;
|
||||
|
||||
kputs(PEPPEROS_SPLASH);
|
||||
//panic(NULL, "Test panic");
|
||||
idle();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user