aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/graphics/vesa.c
diff options
context:
space:
mode:
authorMarvin Borner2020-02-16 17:29:19 +0100
committerMarvin Borner2020-02-16 17:29:50 +0100
commit45184af20936cb889b658e69e00a0bb3d522757f (patch)
tree4b6c3408e526fe733ccfa960726c37e70dc6f989 /src/kernel/graphics/vesa.c
parentf5b995586e28f7db426f4707a4348dc067df41c0 (diff)
Revert to good ol' paging
Diffstat (limited to 'src/kernel/graphics/vesa.c')
-rw-r--r--src/kernel/graphics/vesa.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c
index eaca94a..2e14705 100644
--- a/src/kernel/graphics/vesa.c
+++ b/src/kernel/graphics/vesa.c
@@ -1,14 +1,11 @@
#include <kernel/graphics/vesa.h>
#include <kernel/fs/load.h>
-#include <kernel/lib/lib.h>
#include <kernel/system.h>
#include <kernel/lib/stdlib.h>
#include <kernel/lib/stdio.h>
-#include <kernel/memory/kheap.h>
+#include <kernel/memory/alloc.h>
#include <kernel/memory/paging.h>
-extern page_directory_t *current_directory;
-
void switch_to_vga()
{
serial_printf("Force switch to VGA!");
@@ -182,16 +179,10 @@ void set_optimal_resolution()
vbe_set_mode(highest);
uint32_t fb_size = vbe_width * vbe_height * vbe_bpl;
- cursor_buffer = (unsigned char *) kmalloc(fb_size);
- uint32_t j = (uint32_t) fb;
- while ((unsigned char *) j < fb + fb_size) {
- paging_set_frame(j);
- page_t *page = paging_get_page(j, 1, current_directory);
- page->present = 1;
- page->rw = 1;
- page->user = 1;
- page->frame = j / 0x1000;
- j += 0x1000;
+ cursor_buffer = kmalloc(fb_size);
+ for (uint32_t z = 0; z < fb_size; z += 4096) {
+ paging_map((uint32_t) fb + z, (uint32_t) fb + z, PT_PRESENT | PT_RW | PT_USED);
+ paging_map((uint32_t) cursor_buffer + z, (uint32_t) cursor_buffer + z, PT_PRESENT | PT_RW | PT_USED);
}
serial_printf("0x%x", fb);