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