Changes in kernel/arch/arm32/src/mm/page_fault.c [ecd1a0a:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mm/page_fault.c
recd1a0a r9d58539 42 42 #include <print.h> 43 43 44 /** Returns value stored in comnbined/datafault status register.44 /** Returns value stored in fault status register. 45 45 * 46 46 * @return Value stored in CP15 fault status register (FSR). 47 * 48 * "VMSAv6 added a fifth fault status bit (bit[10]) to both the IFSR and DFSR. 49 * It is IMPLEMENTATION DEFINED how this bit is encoded in earlier versions of 50 * the architecture. A write flag (bit[11] of the DFSR) has also been 51 * introduced." 52 * ARM Architecture Reference Manual version i ch. B4.6 (PDF p. 719) 53 * 54 * See ch. B4.9.6 for location of data/instruction FSR. 55 * 56 */ 57 static inline fault_status_t read_data_fault_status_register(void) 58 { 59 fault_status_t fsu; 60 61 /* Combined/Data fault status is stored in CP15 register 5, c0. */ 47 */ 48 static inline fault_status_t read_fault_status_register(void) 49 { 50 fault_status_union_t fsu; 51 52 /* fault status is stored in CP15 register 5 */ 62 53 asm volatile ( 63 54 "mrc p15, 0, %[dummy], c5, c0, 0" 64 : [dummy] "=r" (fsu. raw)55 : [dummy] "=r" (fsu.dummy) 65 56 ); 66 57 67 return fsu; 68 } 69 70 /** Returns DFAR (fault address register) content. 71 * 72 * This register is equivalent to FAR on pre armv6 machines. 73 * 74 * @return DFAR (fault address register) content (address that caused a page 58 return fsu.fs; 59 } 60 61 /** Returns FAR (fault address register) content. 62 * 63 * @return FAR (fault address register) content (address that caused a page 75 64 * fault) 76 65 */ 77 static inline uintptr_t read_ data_fault_address_register(void)66 static inline uintptr_t read_fault_address_register(void) 78 67 { 79 68 uintptr_t ret; … … 133 122 } 134 123 135 #if defined(PROCESSOR_armv4) | defined(PROCESSOR_armv5)136 124 /** Decides whether read or write into memory is requested. 137 125 * … … 154 142 panic("page_fault - instruction does not access memory " 155 143 "(instr_code: %#0" PRIx32 ", badvaddr:%p).", 156 *(uint32_t*)instr_union.instr, (void *) badvaddr);144 instr_union.pc, (void *) badvaddr); 157 145 return PF_ACCESS_EXEC; 158 146 } … … 174 162 panic("page_fault - instruction doesn't access memory " 175 163 "(instr_code: %#0" PRIx32 ", badvaddr:%p).", 176 *(uint32_t*)instr_union.instr, (void *) badvaddr);164 instr_union.pc, (void *) badvaddr); 177 165 178 166 return PF_ACCESS_EXEC; 179 167 } 180 #endif181 168 182 169 /** Handles "data abort" exception (load or store at invalid address). … … 188 175 void data_abort(unsigned int exc_no, istate_t *istate) 189 176 { 190 uintptr_t badvaddr = read_data_fault_address_register(); 191 192 #if defined(PROCESSOR_armv6) | defined(PROCESSOR_armv7_a) 193 fault_status_t fsr = read_data_fault_status_register(); 194 const pf_access_t access = 195 fsr.data.wr ? PF_ACCESS_WRITE : PF_ACCESS_READ; 196 #elif defined(PROCESSOR_armv4) | defined(PROCESSOR_armv5) 197 const pf_access_t access = get_memory_access_type(istate->pc, badvaddr); 198 #else 199 #error "Unsupported architecture" 200 #endif 177 fault_status_t fsr __attribute__ ((unused)) = 178 read_fault_status_register(); 179 uintptr_t badvaddr = read_fault_address_register(); 180 181 pf_access_t access = get_memory_access_type(istate->pc, badvaddr); 182 201 183 int ret = as_page_fault(badvaddr, access, istate); 202 184 … … 215 197 void prefetch_abort(unsigned int exc_no, istate_t *istate) 216 198 { 217 /* NOTE: We should use IFAR and IFSR here. */218 199 int ret = as_page_fault(istate->pc, PF_ACCESS_EXEC, istate); 219 200
Note:
See TracChangeset
for help on using the changeset viewer.