okok, clear.
i'm reading R5 RM.
for undef instruction for example i could do "divide by zero" with UDIV or SDIV instructions.
- i have to set DZ bit of SCTLR equals to 1 to generate a fault undef instr by the processor, right ? Because if DZ is equal to zero the result of divide by zero operation is equal to zero, right ?
after i see this:
addr = R14_undef - 2
instr = Memory[addr,2]
if (instr >> 11) > 28 { /* 32-bit instruction */
instr = (instr << 16) | [b]Memory[/b][addr+2,2]
if ([b]emulating, so return after instruction wanted[/b]) }
R14_undef += 2 //
} //
}
After this, instr holds the instruction (in the range 0x0000-0xE7FF for a 16-bit instruction,
0xE8000000-0xFFFFFFFF for a 32-bit instruction), and the exception can be returned from
using a MOVS PC, R14 to return after it.
For R14_undef i think that i can write an assembler function that returns this value, but what would the Memory variable be if I wanted to represent it in C ? It would appear to be a matrix.
Which is the meaning of emulating, so return after instruction wanted ?
in my debug configuration i see that is set Mixed ARM thumb, but i think that i'll read the thumb bit in the Program Status Register.
Also i see this:
There are special cases for reading R15:
• reading the address of the current instruction plus, either:
— 4 in Thumb state
— 8 in ARM state.
• reading 0x00000000 (zero). --> this is the case that i found when i try to recover the system for prefetch abort ?
Thank you