Init struct + freeing a bit of kmain()

This commit is contained in:
2026-03-08 13:21:19 +01:00
parent 5e9c582833
commit 42c7a55d3f
9 changed files with 71 additions and 33 deletions

View File

@@ -16,8 +16,12 @@ because this shitty implementation will be replaced one day by Flanterm
#include "term.h"
#include "config.h"
#include "flanterm.h"
#include "flanterm_backends/fb.h"
#include "mem/heap/kheap.h"
#include "limine.h"
extern struct flanterm_context* ft_ctx;
extern struct init_status init;
// Overhead that could be avoided, right? (for printf)
void _putchar(char character)
@@ -36,4 +40,35 @@ void kputs(const char* str)
i++;
}
_putchar('\r');
}
extern struct flanterm_context* ft_ctx;
extern struct boot_context boot_ctx;
void flanterm_free_wrapper(void* ptr, size_t size)
{
(void)size;
kfree(ptr);
}
void term_init()
{
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,
NULL, NULL,
NULL, 0, 0, 1,
0, 0,
0,
0
);
init.terminal = true;
}