Changeset 46c20c8 in mainline for kernel/arch/arm32/src/mm
- Timestamp:
- 2010-11-26T20:08:10Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 45df59a
- Parents:
- fb150d78 (diff), ffdd2b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/arch/arm32/src/mm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mm/frame.c
rfb150d78 r46c20c8 36 36 #include <mm/frame.h> 37 37 #include <arch/mm/frame.h> 38 #include <arch/machine_func.h> 38 39 #include <config.h> 39 40 #ifdef MACHINE_testarm 41 #include <arch/mach/testarm/testarm.h> 42 #endif 43 44 #ifdef MACHINE_integratorcp 45 #include <arch/mach/integratorcp/integratorcp.h> 46 #endif 40 #include <align.h> 47 41 48 42 /** Address of the last frame in the memory. */ … … 52 46 void frame_arch_init(void) 53 47 { 54 last_frame = machine_get_memory_size(); 48 uintptr_t mem_start, mem_size; 49 uintptr_t first_frame; 50 uintptr_t num_frames; 51 52 machine_get_memory_extents(&mem_start, &mem_size); 53 first_frame = ALIGN_UP(mem_start, FRAME_SIZE); 54 last_frame = ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE); 55 num_frames = (last_frame - first_frame) >> FRAME_WIDTH; 55 56 56 57 /* All memory as one zone */ 57 zone_create( 0, ADDR2PFN(last_frame),58 zone_create(first_frame >> FRAME_WIDTH, num_frames, 58 59 BOOT_PAGE_TABLE_START_FRAME + BOOT_PAGE_TABLE_SIZE_IN_FRAMES, 0); 59 60 -
kernel/arch/arm32/src/mm/page.c
rfb150d78 r46c20c8 27 27 */ 28 28 29 /** @addtogroup arm32mm 29 /** @addtogroup arm32mm 30 30 * @{ 31 31 */ … … 41 41 #include <arch/exception.h> 42 42 #include <typedefs.h> 43 #include <arch/types.h>44 43 #include <interrupt.h> 45 44 #include <arch/mm/frame.h> … … 54 53 int flags = PAGE_CACHEABLE; 55 54 page_mapping_operations = &pt_mapping_operations; 55 56 page_table_lock(AS_KERNEL, true); 56 57 57 58 uintptr_t cur; 58 59 /* Kernel identity mapping */ 59 for (cur = 0; cur < last_frame; cur += FRAME_SIZE)60 for (cur = PHYSMEM_START_ADDR; cur < last_frame; cur += FRAME_SIZE) 60 61 page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags); 61 62 … … 67 68 #error "Only high exception vector supported now" 68 69 #endif 70 cur = ALIGN_DOWN(0x50008010, FRAME_SIZE); 71 page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags); 72 73 page_table_unlock(AS_KERNEL, true); 69 74 70 75 as_switch(NULL, AS_KERNEL); … … 88 93 KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) { 89 94 panic("Unable to map physical memory %p (%d bytes).", 90 physaddr, size);95 (void *) physaddr, size); 91 96 } 92 97 93 98 uintptr_t virtaddr = PA2KA(last_frame); 94 99 pfn_t i; 100 101 page_table_lock(AS_KERNEL, true); 95 102 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) { 96 103 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), … … 98 105 PAGE_NOT_CACHEABLE | PAGE_READ | PAGE_WRITE | PAGE_KERNEL); 99 106 } 107 page_table_unlock(AS_KERNEL, true); 100 108 101 109 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); -
kernel/arch/arm32/src/mm/page_fault.c
rfb150d78 r46c20c8 141 141 if (instr.condition == 0xf) { 142 142 panic("page_fault - instruction does not access memory " 143 "(instr_code: %x, badvaddr:%x).", instr, badvaddr); 143 "(instr_code: %#0" PRIx32 ", badvaddr:%p).", 144 instr_union.pc, (void *) badvaddr); 144 145 return PF_ACCESS_EXEC; 145 146 } … … 160 161 161 162 panic("page_fault - instruction doesn't access memory " 162 "(instr_code: %x, badvaddr:%x).", instr, badvaddr); 163 "(instr_code: %#0" PRIx32 ", badvaddr:%p).", 164 instr_union.pc, (void *) badvaddr); 163 165 164 166 return PF_ACCESS_EXEC; … … 167 169 /** Handles "data abort" exception (load or store at invalid address). 168 170 * 169 * @param exc_no Exception number. 170 * @param istate CPU state when exception occured. 171 */ 172 void data_abort(int exc_no, istate_t *istate) 171 * @param exc_no Exception number. 172 * @param istate CPU state when exception occured. 173 * 174 */ 175 void data_abort(unsigned int exc_no, istate_t *istate) 173 176 { 174 177 fault_status_t fsr __attribute__ ((unused)) = … … 182 185 if (ret == AS_PF_FAULT) { 183 186 fault_if_from_uspace(istate, "Page fault: %#x.", badvaddr); 184 print_istate(istate); 185 printf("page fault - pc: %x, va: %x, status: %x(%x), " 186 "access:%d\n", istate->pc, badvaddr, fsr.status, fsr, 187 access); 188 189 panic("Page fault."); 187 panic_memtrap(istate, access, badvaddr, NULL); 190 188 } 191 189 } … … 193 191 /** Handles "prefetch abort" exception (instruction couldn't be executed). 194 192 * 195 * @param exc_no Exception number. 196 * @param istate CPU state when exception occured. 197 */ 198 void prefetch_abort(int exc_no, istate_t *istate) 193 * @param exc_no Exception number. 194 * @param istate CPU state when exception occured. 195 * 196 */ 197 void prefetch_abort(unsigned int exc_no, istate_t *istate) 199 198 { 200 199 int ret = as_page_fault(istate->pc, PF_ACCESS_EXEC, istate); 201 200 202 201 if (ret == AS_PF_FAULT) { 203 printf("prefetch_abort\n"); 204 print_istate(istate); 205 panic("page fault - prefetch_abort at address: %x.", 206 istate->pc); 202 fault_if_from_uspace(istate, 203 "Page fault - prefetch_abort: %#x.", istate->pc); 204 panic_memtrap(istate, PF_ACCESS_EXEC, istate->pc, NULL); 207 205 } 208 206 } -
kernel/arch/arm32/src/mm/tlb.c
rfb150d78 r46c20c8 37 37 #include <arch/mm/asid.h> 38 38 #include <arch/asm.h> 39 #include < arch/types.h>39 #include <typedefs.h> 40 40 #include <arch/mm/page.h> 41 41
Note:
See TracChangeset
for help on using the changeset viewer.
