Hello, world! in linear framebuffer

This commit is contained in:
2025-12-21 14:56:19 +01:00
parent 634cf699dc
commit b41b6e2369
7 changed files with 149 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <limine.h>
#include "term.h"
// Limine version used
__attribute__((used, section(".limine_requests")))
@@ -19,6 +20,8 @@ static volatile LIMINE_REQUESTS_START_MARKER;
__attribute__((used, section(".limine_requests_end")))
static volatile LIMINE_REQUESTS_END_MARKER;
struct limine_framebuffer* framebuffer;
// We won't be linked to standard library, but still need the basic mem* functions
// so everything goes allright with the compiler
@@ -103,14 +106,12 @@ void kmain()
if (framebuffer_request.response == NULL || framebuffer_request.response->framebuffer_count < 1) hcf();
// Get the first framebuffer from the response
struct limine_framebuffer* framebuffer = framebuffer_request.response->framebuffers[0];
framebuffer = framebuffer_request.response->framebuffers[0];
if (term_init()) hcf();
// Draw something
for (size_t i=0; i<100; i++)
{
volatile uint32_t* fb_ptr = framebuffer->address;
fb_ptr[i*(framebuffer->pitch/4) + i] = 0xffffff;
}
kputs("Hello, world!");
hcf();
}