diff options
author | Marvin Borner | 2020-01-25 23:39:17 +0100 |
---|---|---|
committer | Marvin Borner | 2020-01-25 23:39:17 +0100 |
commit | b8630d78a15a69f50dac747e41e84b143dd99b08 (patch) | |
tree | 6e6485cd5e2d362f7ea420731c38d4eb67f787d5 | |
parent | 3fa449276364389137a7154a9971594816d86362 (diff) |
Hehe fixed video bug :)
Took around 5 days.
-rw-r--r-- | src/kernel/graphics/vesa.c | 11 | ||||
-rw-r--r-- | src/kernel/memory/paging.c | 6 | ||||
-rw-r--r-- | src/kernel/memory/paging.h | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c index 15d953a..e2b0036 100644 --- a/src/kernel/graphics/vesa.c +++ b/src/kernel/graphics/vesa.c @@ -183,8 +183,15 @@ void set_optimal_resolution() uint32_t fb_size = vbe_width * vbe_height * vbe_bpl; cursor_buffer = (unsigned char *) kmalloc(fb_size); - for (uint32_t z = 0; z < fb_size; z += 0x1000) { - paging_alloc_frame(paging_get_page((uint32_t) fb + z, 1, current_directory), 0, 1); + uint32_t j = (uint32_t) fb; + while ((unsigned char *) j < fb + (vbe_width * vbe_height * 4)) { + 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; } serial_printf("0x%x", fb); diff --git a/src/kernel/memory/paging.c b/src/kernel/memory/paging.c index ad19091..861cdcb 100644 --- a/src/kernel/memory/paging.c +++ b/src/kernel/memory/paging.c @@ -20,7 +20,7 @@ extern void copy_page_physical(); #define INDEX_FROM_BIT(a) (a/(8*4)) #define OFFSET_FROM_BIT(a) (a%(8*4)) -static void paging_set_frame(uint32_t frame_addr) +void paging_set_frame(uint32_t frame_addr) { uint32_t frame = frame_addr / 0x1000; uint32_t idx = INDEX_FROM_BIT(frame); @@ -28,7 +28,7 @@ static void paging_set_frame(uint32_t frame_addr) frames[idx] |= (0x1 << off); } -static void paging_clear_frame(uint32_t frame_addr) +void paging_clear_frame(uint32_t frame_addr) { uint32_t frame = frame_addr / 0x1000; uint32_t idx = INDEX_FROM_BIT(frame); @@ -36,7 +36,7 @@ static void paging_clear_frame(uint32_t frame_addr) frames[idx] &= ~(0x1 << off); } -static uint32_t paging_first_frame() +uint32_t paging_first_frame() { uint32_t i, j; for (i = 0; i < INDEX_FROM_BIT(nframes); i++) { diff --git a/src/kernel/memory/paging.h b/src/kernel/memory/paging.h index bb6ee4f..77258b7 100644 --- a/src/kernel/memory/paging.h +++ b/src/kernel/memory/paging.h @@ -26,6 +26,8 @@ typedef struct page_directory { int paging_enabled; +void paging_set_frame(uint32_t frame_addr); + void paging_alloc_frame(page_t *page, int is_kernel, int is_writeable); void paging_free_frame(page_t *page); |