Changes in kernel/arch/ia32/src/mm/page.c [f1a2c6e:7e752b2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/mm/page.c
rf1a2c6e r7e752b2 39 39 #include <mm/page.h> 40 40 #include <mm/as.h> 41 #include < arch/types.h>41 #include <typedefs.h> 42 42 #include <align.h> 43 43 #include <config.h> … … 61 61 * PA2KA(identity) mapping for all frames until last_frame. 62 62 */ 63 page_table_lock(AS_KERNEL, true); 63 64 for (cur = 0; cur < last_frame; cur += FRAME_SIZE) { 64 65 flags = PAGE_CACHEABLE | PAGE_WRITE; … … 67 68 page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags); 68 69 } 70 page_table_unlock(AS_KERNEL, true); 69 71 70 exc_register(14, "page_fault", (iroutine) page_fault);72 exc_register(14, "page_fault", true, (iroutine_t) page_fault); 71 73 write_cr3((uintptr_t) AS_KERNEL->genarch.page_table); 72 74 } else … … 80 82 { 81 83 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) 82 panic("Unable to map physical memory %p (%d bytes).", physaddr, size); 84 panic("Unable to map physical memory %p (%zu bytes).", 85 (void *) physaddr, size); 83 86 84 87 uintptr_t virtaddr = PA2KA(last_frame); 85 88 pfn_t i; 89 page_table_lock(AS_KERNEL, true); 86 90 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) { 87 91 uintptr_t addr = PFN2ADDR(i); 88 92 page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, PAGE_NOT_CACHEABLE | PAGE_WRITE); 89 93 } 94 page_table_unlock(AS_KERNEL, true); 90 95 91 96 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); … … 94 99 } 95 100 96 void page_fault( int n __attribute__((unused)), istate_t *istate)101 void page_fault(unsigned int n __attribute__((unused)), istate_t *istate) 97 102 { 98 103 uintptr_t page; … … 111 116 if (as_page_fault(page, access, istate) == AS_PF_FAULT) { 112 117 fault_if_from_uspace(istate, "Page fault: %#x.", page); 113 114 decode_istate(istate); 115 printf("page fault address: %#lx\n", page); 116 panic("Page fault."); 118 panic_memtrap(istate, access, page, NULL); 117 119 } 118 120 }
Note:
See TracChangeset
for help on using the changeset viewer.