Mercurial > lcfOS
diff cos/kernel/mm.c @ 30:0148f55bfe24
Added static asserts and fixed pages
author | windel |
---|---|
date | Thu, 29 Dec 2011 23:51:35 +0100 |
parents | 7e3bdcb391dc |
children | 3a6a9b929db0 |
line wrap: on
line diff
--- a/cos/kernel/mm.c Thu Dec 29 19:34:01 2011 +0100 +++ b/cos/kernel/mm.c Thu Dec 29 23:51:35 2011 +0100 @@ -58,6 +58,8 @@ // Memory manager functions: void init_memory(uint64_t total_mem_size) { + printf("Size of PT_t = %d\n", sizeof(PD_t)); + printf("Size of page_t = %d\n", sizeof(page_t)); // Allocate and clear bits to remember which 4kb-frames are in use: nframes = (total_mem_size / 0x1000); frames = (uint64_t*)kmalloc_int( (nframes / 64) * sizeof(uint64_t) ); @@ -80,6 +82,7 @@ page->present = 1; page->rw = 1; page->us = 1; // Make all things accessable for users for now. + //page->pwt = 1; // Is this bit required? set_frame(i / 0x1000); @@ -87,8 +90,8 @@ } // Set the created mapping as active: - // switch_mapping(kernel_map); - // TODO: debug crash after enable of new memory map + switch_mapping(kernel_map); + // TODO: set the use of placement malloc to invalid after here. } @@ -146,7 +149,6 @@ { // Create new table: pdpt = (PDPT_t*)kmalloc_aligned_int(sizeof(PDPT_t)); - printf("Creating PDPT %x\n", pdpt); memset(pdpt, 0, sizeof(PDPT_t)); // TODO: get function like virt2phys or something here @@ -166,7 +168,6 @@ } else { - printf("Creating PD\n"); // Create a new table: pd = (PD_t*)kmalloc_aligned_int(sizeof(PD_t)); memset(pd, 0, sizeof(PD_t)); @@ -189,7 +190,6 @@ } else { - printf("Creating PT\n"); // Create table: pt = (PT_t*)kmalloc_aligned_int(sizeof(PD_t)); memset(pt, 0, sizeof(PT_t));