From 7199e74aa22e592a3b77bdd81f735edca5470596 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 20 Jan 2024 17:59:40 -0500 Subject: update --- kernel/framebuffer.cpp | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) (limited to 'kernel/framebuffer.cpp') diff --git a/kernel/framebuffer.cpp b/kernel/framebuffer.cpp index dbd735f..08d0e16 100644 --- a/kernel/framebuffer.cpp +++ b/kernel/framebuffer.cpp @@ -1,44 +1,13 @@ #include #include -#include namespace hilbert::kernel::framebuffer { - static uint64_t paddr; + uint64_t paddr; static uint32_t *vaddr; int width; int height; - static int dword_pitch; - - void encode_color_syscall( - uint64_t &rax, uint64_t &rdi, uint64_t &rsi, uint64_t &rdx - ) { - rax = (uint64_t)encode_color( - rdi & 0xff, (rdi >> 8) & 0xff, (rdi >> 16) & 0xff); - rdi = 0; - rsi = 0; - rdx = 0; - } - - void get_framebuffer_syscall( - uint64_t &rax, uint64_t &rdi, uint64_t &rsi, uint64_t &rdx - ) { - - auto *app = application::running_app; - if (app->framebuffer_vaddr == 0) { - uint64_t pages_needed = (dword_pitch * height * 4 - 1) / 4096 + 1; - uint64_t vaddr = app->get_free_vaddr_pages(pages_needed); - for (uint64_t i = 0; i < pages_needed; ++i) - app->map_page(vaddr + i * 4096, paddr + i * 4096, true, false, false); - app->framebuffer_vaddr = vaddr; - } - - rax = app->framebuffer_vaddr; - rdi = (uint64_t)(uint32_t)width | ((uint64_t)(uint32_t)height << 32); - rsi = (uint32_t)dword_pitch; - rdx = 0; - - } + int dword_pitch; void init_framebuffer(uint64_t paddr, uint64_t vaddr, uint64_t width, uint64_t height, uint64_t pitch @@ -52,9 +21,6 @@ namespace hilbert::kernel::framebuffer { framebuffer::height = height; dword_pitch = pitch / 4; - syscall::add_syscall(0, &encode_color_syscall); - syscall::add_syscall(1, &get_framebuffer_syscall); - } color encode_color(uint8_t r, uint8_t g, uint8_t b) { -- cgit v1.2.3