Improved kernel memory usage

Moved base linear address to 0xFF800000
Kernel only reserves the page frames it actually needs
Memory for multiboot2 headers is freed
Video memory and APIC registers are dynamically mapped into linear addresses
This commit is contained in:
2021-04-17 03:45:45 -05:00
parent b141582f40
commit 961139df9e
10 changed files with 91 additions and 57 deletions

View File

@@ -1,4 +1,6 @@
#include "stdio.h"
#include "mmgr.h"
#include "allocator.h"
#include <stddef.h>
enum vga_color_t {
@@ -28,12 +30,18 @@ struct cell_t
char bg : 4;
};
struct cell_t *screen = (struct cell_t*)0xFF8B8000;
struct cell_t *screen = (struct cell_t*)NULL;
size_t cursor = 0;
const size_t tab_width = 4;
const size_t line_width = 80;
int initialize_screen()
{
screen = allocate_from_bottom(page_size);
map_page(NULL, screen, 0x000B8000, PAGE_RW);
}
int putchar(int c)
{
switch(c)