kernel: add support for running without any framebuffer

This commit is contained in:
RaphProductions 2025-05-08 22:12:56 +02:00
parent 17e6219f24
commit 2d4031eacc
3 changed files with 27 additions and 35 deletions

View file

@ -87,35 +87,27 @@ void kmain(void) {
}*/ }*/
// Ensure we got a framebuffer. // Ensure we got a framebuffer.
if (framebuffer_request.response == NULL if (framebuffer_request.response != NULL) {
|| framebuffer_request.response->framebuffer_count < 1) {
hcf();
}
// Fetch the first framebuffer. // Fetch the first framebuffer.
struct limine_framebuffer *framebuffer = framebuffer_request.response->framebuffers[0]; struct limine_framebuffer *framebuffer = framebuffer_request.response->framebuffers[0];
fb = framebuffer; fb = framebuffer;
((uint32_t*)fb->address)[0] = 0xFFFFFF;
ft_ctx = flanterm_fb_init( ft_ctx = flanterm_fb_init(
NULL, NULL,
NULL, NULL,
framebuffer->address, framebuffer->width, framebuffer->height, framebuffer->pitch, framebuffer->address, framebuffer->width, framebuffer->height, framebuffer->pitch,
framebuffer->red_mask_size, framebuffer->red_mask_shift, framebuffer->red_mask_size, framebuffer->red_mask_shift,
framebuffer->green_mask_size, framebuffer->green_mask_shift, framebuffer->green_mask_size, framebuffer->green_mask_shift,
framebuffer->blue_mask_size, framebuffer->blue_mask_shift, framebuffer->blue_mask_size, framebuffer->blue_mask_shift,
NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, &fg, NULL, &fg,
NULL, NULL, NULL, NULL,
VGA8, 8, 16, 0, VGA8, 8, 16, 0,
0, 0, 0, 0,
0 0
); );
if (!ft_ctx) {
asm("cli");
asm("hlt");
} }
printf("\n Soaplin 1.0-sild is booting up your computer...\n\n"); printf("\n Soaplin 1.0-sild is booting up your computer...\n\n");
@ -127,10 +119,6 @@ void kmain(void) {
sse_init(); sse_init();
float hi = 0.1;
hi = hi + 1.1;
log("fp: %2.6f\n", hi);
pmm_init(); pmm_init();
vmm_init(); vmm_init();
kernel_vma_context = vma_create_context(vmm_kernel_pm); kernel_vma_context = vma_create_context(vmm_kernel_pm);

View file

@ -9,7 +9,8 @@ void log(char *format, ...) {
// TODO: replace this call with a call to printf() when the RTC is implemented. // TODO: replace this call with a call to printf() when the RTC is implemented.
char *date = "1970-01-01 00:00:00 | "; char *date = "1970-01-01 00:00:00 | ";
int i2 = 0; for (i2; date[i2] != 0; i2++);; int i2 = 0; for (i2; date[i2] != 0; i2++);;
flanterm_write(ft_ctx, date, i2); if (ft_ctx)
flanterm_write(ft_ctx, date, i2);
char buf[2048]; char buf[2048];
va_list l; va_list l;
@ -18,7 +19,8 @@ void log(char *format, ...) {
va_end(l); va_end(l);
int i = 0; for (i; buf[i] != 0; i++);; int i = 0; for (i; buf[i] != 0; i++);;
flanterm_write(ft_ctx, buf, i); if (ft_ctx)
flanterm_write(ft_ctx, buf, i);
for (int i=0;;i++) { for (int i=0;;i++) {
if (date[i] == '\0') if (date[i] == '\0')

View file

@ -26,5 +26,7 @@ void printf(char *format, ...) {
//rt_print(buf); //rt_print(buf);
int i = 0; for (i; buf[i] != 0; i++);; int i = 0; for (i; buf[i] != 0; i++);;
flanterm_write(ft_ctx, buf, i);
if (ft_ctx)
flanterm_write(ft_ctx, buf, i);
} }