Mercurial > lcfOS
diff cos/kernel/handlers.c @ 20:b1fed2171e1a
Now working with 2 MB pages
author | windel |
---|---|
date | Mon, 28 Nov 2011 20:54:40 +0100 |
parents | 6129643f5c34 |
children | 66e9c332c845 |
line wrap: on
line diff
--- a/cos/kernel/handlers.c Sun Nov 27 21:38:38 2011 +0100 +++ b/cos/kernel/handlers.c Mon Nov 28 20:54:40 2011 +0100 @@ -35,7 +35,7 @@ void INT34(void); // THE interrupt descriptor table: -static IDT_entry idt[256]; +IDT_entry *idt = (IDT_entry*)0x0; volatile idtPointer idtP; void setIDTentry(int num, void (*handler)(), uint16_t selector, uint8_t flags) @@ -232,11 +232,16 @@ //uint32_t *pageTable = (uint32_t*)(pageDirectory[pageDirIndex] & 0xFFFFFC00); } -void INT14handler(unsigned int address) +void INT14handler() { - printf("INT14 called! Page fault for address 0x%x!\n", address); - if ( (address & 0xF0000000) == 0xD0000000 ) { - mappage(address & 0xFFFFF000); + uint64_t faulting_address; + + // Retrieve failed page from CR2: + asm volatile("mov %%cr2, %0" : "=r" (faulting_address)); + + printf("INT14 called! Page fault for address 0x%X!\n", faulting_address); + if ( (faulting_address & 0xF0000000) == 0xD0000000 ) { + mappage(faulting_address & 0xFFFFF000); return; }