author | Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com> |
Wed, 21 Apr 2010 15:14:16 +0300 | |
changeset 5 | 844b047e260d |
parent 0 | 5ad7ad99af01 |
permissions | -rw-r--r-- |
0
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
1 |
<h1>Exceptions</h1> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
2 |
<p>Exceptions are generated by internal and external sources to cause the processor to handle an event, such as |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
3 |
an externally generated interrupt or an attempt to execute an Undefined instruction. The processor state just |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
4 |
before handling the exception is normally preserved so that the original program can be resumed when the |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
5 |
exception routine has completed. More than one exception can arise at the same time.</p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
6 |
<p>The ARM architecture supports seven types of exception. When an exception occurs, execution is forced from a fixed |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
7 |
memory address corresponding to the type of exception. These fixed addresses are called the exception |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
8 |
vectors.</p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
9 |
<code>Reset</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
10 |
<p>When the Reset input is asserted on the processor, the ARM processor immediately stops execution of the |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
11 |
current instruction. When Reset is de-asserted, the following actions are performed:</p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
12 |
<code>R14_svc = UNPREDICTABLE value<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
13 |
SPSR_svc = UNPREDICTABLE value<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
14 |
CPSR[4:0] = 0b10011 /* Enter Supervisor mode */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
15 |
CPSR[5] = 0 /* Execute in ARM state */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
16 |
CPSR[6] = 1 /* Disable fast interrupts */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
17 |
CPSR[7] = 1 /* Disable normal interrupts */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
18 |
CPSR[8] = 1 /* Disable Imprecise Aborts (v6 only) */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
19 |
CPSR[9] = CP15_reg1_EEbit /* Endianness on exception entry */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
20 |
if high vectors configured then<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
21 |
PC = 0xFFFF0000<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
22 |
else<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
23 |
PC = 0x00000000</code><br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
24 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
25 |
After Reset, the ARM processor begins execution at address 0x00000000 or 0xFFFF0000 in Supervisor mode |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
26 |
with interrupts disabled.</p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
27 |
<code>Undefined Instruction exception</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
28 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
29 |
If the ARM processor executes a coprocessor instruction, it waits for any external coprocessor |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
30 |
to acknowledge that it can execute the instruction. If no coprocessor responds, an Undefined Instruction |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
31 |
exception occurs.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
32 |
If an attempt is made to execute an instruction that is UNDEFINED, an Undefined Instruction exception occurs.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
33 |
The Undefined Instruction exception can be used for software emulation of a coprocessor in a system that |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
34 |
does not have the physical coprocessor (hardware), or for general-purpose instruction set extension by |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
35 |
software emulation.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
36 |
When an Undefined Instruction exception occurs, the following actions are performed: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
37 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
38 |
R14_und = address of next instruction after the Undefined instruction<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
39 |
SPSR_und = CPSR<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
40 |
CPSR[4:0] = 0b11011 /* Enter Undefined Instruction mode */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
41 |
CPSR[5] = 0 /* Execute in ARM state */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
42 |
/* CPSR[6] is unchanged */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
43 |
CPSR[7] = 1 /* Disable normal interrupts */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
44 |
/* CPSR[8] is unchanged */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
45 |
CPSR[9] = CP15_reg1_EEbit /* Endianness on exception entry */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
46 |
if high vectors configured then<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
47 |
PC = 0xFFFF0004<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
48 |
else<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
49 |
PC = 0x00000004</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
50 |
<p>To return after emulating the Undefined instruction use:</p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
51 |
<code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
52 |
MOVS PC,R14 |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
53 |
</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
54 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
55 |
This restores the PC (from R14_und) and CPSR (from SPSR_und) and returns to the instruction following |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
56 |
the Undefined instruction.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
57 |
In some coprocessor designs, an internal exceptional condition caused by one coprocessor instruction is |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
58 |
signaled imprecisely by refusing to respond to a later coprocessor instruction. In these circumstances, the |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
59 |
Undefined Instruction handler takes whatever action is necessary to clear the exceptional condition, then |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
60 |
returns to the second coprocessor instruction. To do this use: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
61 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
62 |
SUBS PC,R14,#4 |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
63 |
</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
64 |
<code>Software Interrupt exception</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
65 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
66 |
The Software Interrupt instruction (SWI) enters Supervisor mode to request a particular supervisor (operating |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
67 |
system) function. When a SWI is executed, the following actions are performed: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
68 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
69 |
R14_svc = address of next instruction after the SWI instruction<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
70 |
SPSR_svc = CPSR<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
71 |
CPSR[4:0] = 0b10011 /* Enter Supervisor mode */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
72 |
CPSR[5] = 0 /* Execute in ARM state */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
73 |
/* CPSR[6] is unchanged */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
74 |
CPSR[7] = 1 /* Disable normal interrupts */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
75 |
/* CPSR[8] is unchanged */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
76 |
CPSR[9] = CP15_reg1_EEbit /* Endianness on exception entry */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
77 |
if high vectors configured then<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
78 |
PC = 0xFFFF0008<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
79 |
else<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
80 |
PC = 0x00000008</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
81 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
82 |
To return after performing the SWI operation, use the following instruction to restore the PC |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
83 |
(from R14_svc) and CPSR (from SPSR_svc) and return to the instruction following the SWI: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
84 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
85 |
MOVS PC,R14 |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
86 |
</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
87 |
<code>Prefetch Abort</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
88 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
89 |
A memory abort is signaled by the memory system. Activating an abort in response to an instruction fetch |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
90 |
marks the fetched instruction as invalid. A Prefetch Abort exception is generated if the processor tries to |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
91 |
execute the invalid instruction. If the instruction is not executed (for example, as a result of a branch being |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
92 |
taken while it is in the pipeline), no Prefetch Abort occurs.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
93 |
In ARMv5 and above, a Prefetch Abort exception can also be generated as the result of executing a BKPT |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
94 |
instruction.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
95 |
When an attempt is made to execute an aborted instruction, the following actions are performed: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
96 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
97 |
R14_abt = address of the aborted instruction + 4<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
98 |
SPSR_abt = CPSR<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
99 |
CPSR[4:0] = 0b10111 /* Enter Abort mode */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
100 |
CPSR[5] = 0 /* Execute in ARM state */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
101 |
/* CPSR[6] is unchanged */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
102 |
CPSR[7] = 1 /* Disable normal interrupts */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
103 |
CPSR[8] = 1 /* Disable Imprecise Data Aborts (v6 only) */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
104 |
CPSR[9] = CP15_reg1_EEbit /* Endianness on exception entry */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
105 |
if high vectors configured then<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
106 |
PC = 0xFFFF000C<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
107 |
else<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
108 |
PC = 0x0000000C</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
109 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
110 |
To return after fixing the reason for the abort, use: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
111 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
112 |
SUBS PC,R14,#4 |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
113 |
</code><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
114 |
This restores both the PC (from R14_abt) and CPSR (from SPSR_abt), and returns to the aborted |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
115 |
instruction. |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
116 |
</p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
117 |
<code>Data Abort</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
118 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
119 |
A memory abort is signaled by the memory system. Activating an abort in response to a data access (load |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
120 |
or store) marks the data as invalid. A Data Abort exception occurs before any following instructions or |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
121 |
exceptions have altered the state of the CPU. The following actions are performed: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
122 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
123 |
R14_abt = address of the aborted instruction + 8<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
124 |
SPSR_abt = CPSR<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
125 |
CPSR[4:0] = 0b10111 /* Enter Abort mode */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
126 |
CPSR[5] = 0 /* Execute in ARM state */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
127 |
/* CPSR[6] is unchanged */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
128 |
CPSR[7] = 1 /* Disable normal interrupts */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
129 |
CPSR[8] = 1 /* Disable Imprecise Data Aborts (v6 only) */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
130 |
CPSR[9] = CP15_reg1_EEbit /* Endianness on exception entry */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
131 |
if high vectors configured then<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
132 |
PC = 0xFFFF0010<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
133 |
else<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
134 |
PC = 0x00000010 |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
135 |
</code><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
136 |
To return after fixing the reason for the abort use: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
137 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
138 |
SUBS PC,R14,#8 |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
139 |
</code><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
140 |
This restores both the PC (from R14_abt) and CPSR (from SPSR_abt), and returns to re-execute the aborted |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
141 |
instruction.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
142 |
If the aborted instruction does not need to be re-executed use: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
143 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
144 |
SUBS PC,R14,#4 |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
145 |
</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
146 |
<code>IRQ</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
147 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
148 |
The IRQ exception is generated externally by asserting the IRQ input on the processor. It has a lower priority |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
149 |
than FIQ, and is masked out when an FIQ sequence is entered.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
150 |
Interrupts are disabled when the I bit in the CPSR is set. If the I bit is clear, ARM checks for an IRQ at |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
151 |
instruction boundaries.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
152 |
When an IRQ is detected, the following actions are performed: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
153 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
154 |
R14_irq = address of next instruction to be executed + 4<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
155 |
SPSR_irq = CPSR<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
156 |
CPSR[4:0] = 0b10010 /* Enter IRQ mode */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
157 |
CPSR[5] = 0 /* Execute in ARM state */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
158 |
/* CPSR[6] is unchanged */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
159 |
CPSR[7] = 1 /* Disable normal interrupts */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
160 |
CPSR[8] = 1 /* Disable Imprecise Data Aborts (v6 only) */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
161 |
CPSR[9] = CP15_reg1_EEbit /* Endianness on exception entry */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
162 |
if VE==0 then<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
163 |
if high vectors configured then<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
164 |
PC = 0xFFFF0018<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
165 |
else<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
166 |
PC = 0x00000018<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
167 |
else<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
168 |
PC = IMPLEMENTATION DEFINED |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
169 |
</code><p>To return after servicing the interrupt, use:</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
170 |
SUBS PC,R14,#4 |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
171 |
</code><p>This restores both the PC (from R14_irq) and CPSR (from SPSR_irq), and resumes execution of the |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
172 |
interrupted code.</p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
173 |
<code>FIQ</code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
174 |
<p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
175 |
The FIQ exception is generated externally by asserting the FIQ input on the processor. FIQ is designed to |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
176 |
support a data transfer or channel process, and has sufficient private registers to remove the need for register |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
177 |
saving in such applications, therefore minimizing the overhead of context switching.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
178 |
Fast interrupts are disabled when the F bit in the CPSR is set. If the F bit is clear, ARM checks for an FIQ |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
179 |
at instruction boundaries.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
180 |
When an FIQ is detected, the following actions are performed: |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
181 |
</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
182 |
R14_fiq = address of next instruction to be executed + 4<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
183 |
SPSR_fiq = CPSR<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
184 |
CPSR[4:0] = 0b10001 /* Enter FIQ mode */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
185 |
CPSR[5] = 0 /* Execute in ARM state */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
186 |
CPSR[6] = 1 /* Disable fast interrupts */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
187 |
CPSR[7] = 1 /* Disable normal interrupts */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
188 |
CPSR[8] = 1 /* Disable Imprecise Data Aborts (v6 only) */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
189 |
CPSR[9] = CP15_reg1_EEbit /* Endianness on exception entry */<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
190 |
if VE==0 then<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
191 |
if high vectors configured then<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
192 |
PC = 0xFFFF001C<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
193 |
else<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
194 |
PC = 0x0000001C<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
195 |
else<br> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
196 |
PC = IMPLEMENTATION DEFINED |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
197 |
</code><p>To return after servicing the interrupt, use:</p><code> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
198 |
SUBS PC, R14,#4 |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
199 |
</code><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
200 |
This restores both the PC (from R14_fiq) and CPSR (from SPSR_fiq), and resumes execution of the |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
201 |
interrupted code.</p><p> |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
202 |
The FIQ vector is deliberately the last vector to allow the FIQ exception-handler software to be placed |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
203 |
directly at address 0x0000001C or 0xFFFF001C, without requiring a branch instruction from the vector. |
5ad7ad99af01
Initial version of CrashAnalyser under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
204 |
</p> |