Commit 6532990d by triazo

Minor fix to paging (not working)

parent b69ec898
Showing with 7 additions and 6 deletions
...@@ -62,12 +62,12 @@ void kernel_main(multiboot_info* mbt, uint32_t magic) ...@@ -62,12 +62,12 @@ void kernel_main(multiboot_info* mbt, uint32_t magic)
int o=0; int o=0;
int j=5/o; int j=5/o;
serial_hexword(j); serial_hexword(j);
//test_mem();
serial_writechar('\n'); serial_writechar('\n');
// PCI // PCI
checkAllBuses(); checkAllBuses();
void* ahciAddr = pciFindAHCI(); void* ahciAddr = pciFindAHCI();
mem_map_directory_entry(ahciAddr, kern_page_dir);
serial_hexstring(ahciAddr, 0x1100); serial_hexstring(ahciAddr, 0x1100);
test_idt(); test_idt();
......
...@@ -133,10 +133,11 @@ page_directory_entry* initiate_directory() ...@@ -133,10 +133,11 @@ page_directory_entry* initiate_directory()
} }
// Expect addr to be page aligned // Expect addr to be page aligned
void map_directory_entry(void* addr, page_directory_entry* page_dir) { void mem_map_directory_entry(void* addr, page_directory_entry* page_dir) {
page_table_entry* new_page_table = (page_table_entry*) (malloc(2048)+1024)&0xfffffc00; page_table_entry* new_page_table = (page_table_entry*) (((uint32_t)malloc(2048)+1024)&0xfffffc00);
populate_page_table(new_page_table, addr & 0xffc00000, 1024, 0); populate_page_table(new_page_table, (uint32_t)addr & 0xffc00000, 1024, 0);
page_dir[addr >> 22] = new_page_table; page_dir[(uint32_t)addr >> 22] = (uint32_t) new_page_table;
page_dir[(uint32_t)addr >> 22] |= PAGE_WRITABLE | PAGE_PRESENT;
} }
void* malloc(uint32_t bytes) void* malloc(uint32_t bytes)
......
...@@ -32,7 +32,7 @@ page_directory_entry* initiate_directory(); ...@@ -32,7 +32,7 @@ page_directory_entry* initiate_directory();
page_directory_entry* mem_init_kern_tables(multiboot_memory_map* mmap, multiboot_memory_map* mmap_end); page_directory_entry* mem_init_kern_tables(multiboot_memory_map* mmap, multiboot_memory_map* mmap_end);
// map_directory_entry maps the real address given to a page directory at the same memory // map_directory_entry maps the real address given to a page directory at the same memory
void map_directory_entry(void*); void mem_map_directory_entry(void* addr, page_directory_entry* page_dir);
// memory mark stores a counter of bytes for the most recently used // memory mark stores a counter of bytes for the most recently used
// memory. Everything before it is used and all valid memory after it // memory. Everything before it is used and all valid memory after it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment