Changeset 2ddb3c5 in mainline
- Timestamp:
- 2012-09-04T20:42:52Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bbb0a400
- Parents:
- 2d884ab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mm/page_fault.c
r2d884ab r2ddb3c5 146 146 } 147 147 148 /* See ARM Architecture reference manual ARMv7-A and ARMV7-R edition 149 * A5.3 (PDF p. 206) */ 150 static const struct { 151 uint32_t mask; 152 uint32_t value; 153 pf_access_t access; 154 } ls_inst[] = { 155 /* Store word */ 156 { 0x0e700000, 0x04000000, PF_ACCESS_WRITE }, /*STR imm x2*/ 157 { 0x0e700000, 0x04200000, PF_ACCESS_WRITE }, /*STR imm STRT*/ 158 { 0x0e700010, 0x06000000, PF_ACCESS_WRITE }, /*STR reg x2*/ 159 { 0x0e700010, 0x06200000, PF_ACCESS_WRITE }, /*STR reg STRT*/ 160 /* Store byte */ 161 { 0x0e700000, 0x04400000, PF_ACCESS_WRITE }, /*STRB imm x2*/ 162 { 0x0e700000, 0x04600000, PF_ACCESS_WRITE }, /*STRB imm STRBT*/ 163 { 0x0e700010, 0x06400000, PF_ACCESS_WRITE }, /*STRB reg x2*/ 164 { 0x0e700010, 0x06600000, PF_ACCESS_WRITE }, /*STRB reg STRBT*/ 165 /* Load word */ 166 { 0x0e700000, 0x04100000, PF_ACCESS_READ }, /*LDR imm x2*/ 167 { 0x0e700000, 0x04300000, PF_ACCESS_READ }, /*LDR imm LDRT*/ 168 { 0x0e700010, 0x06100000, PF_ACCESS_READ }, /*LDR reg x2*/ 169 { 0x0e700010, 0x06300000, PF_ACCESS_READ }, /*LDR reg LDRT*/ 170 /* Load byte */ 171 { 0x0e700000, 0x04500000, PF_ACCESS_READ }, /*LDRB imm x2*/ 172 { 0x0e700000, 0x04700000, PF_ACCESS_READ }, /*LDRB imm LDRBT*/ 173 { 0x0e700010, 0x06500000, PF_ACCESS_READ }, /*LDRB reg x2*/ 174 { 0x0e700010, 0x06700000, PF_ACCESS_READ }, /*LDRB reg LDRBT*/ 175 /* Store half-word/dual A5.2.8 */ 176 { 0x0e1000f0, 0x000000b0, PF_ACCESS_WRITE }, /*STRH imm reg*/ 177 { 0x0e1000f0, 0x000000f0, PF_ACCESS_WRITE }, /*STRD imm reg*/ 178 /* Load half-word/dual A5.2.8 */ 179 { 0x0e1000f0, 0x001000b0, PF_ACCESS_READ }, /*LDRH imm reg*/ 180 { 0x0e0000f0, 0x000000d0, PF_ACCESS_READ }, /*LDRH imm reg*/ 181 { 0x0e1000f0, 0x001000f0, PF_ACCESS_READ }, /*LDRD imm reg*/ 182 /* Block data transfer, Store */ 183 { 0x0e100000, 0x08000000, PF_ACCESS_WRITE }, /* STM variants */ 184 { 0x0e100000, 0x08100000, PF_ACCESS_READ }, /* LDM variants */ 185 }; 186 pf_access_t access = PF_ACCESS_UNKNOWN; 187 uint32_t inst = *(uint32_t*)instr_addr; 188 for (unsigned i = 0; i < sizeof(ls_inst) / sizeof(ls_inst[0]); ++i) { 189 if ((inst & ls_inst[i].mask) == ls_inst[i].value) { 190 if (access != PF_ACCESS_UNKNOWN) 191 printf("Double match: %x %u\n", inst, i); 192 access = ls_inst[i].access; 193 } 194 } 195 148 196 /* load store instructions */ 149 197 if (is_load_store_instruction(instr)) { 150 198 if (instr.access == 1) { 199 if (access != PF_ACCESS_READ) 200 printf("MISMATCH READ(%u): %x\n", access, inst); 151 201 return PF_ACCESS_READ; 152 202 } else { 203 if (access != PF_ACCESS_WRITE) 204 printf("MISMATCH WRITE(%u): %x\n", access, inst); 153 205 return PF_ACCESS_WRITE; 154 206 }
Note:
See TracChangeset
for help on using the changeset viewer.