diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2007-11-22 12:32:01 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 09:41:28 -0500 |
commit | c98929c07a01c9ec2e1e5253456acc7168da8b66 (patch) | |
tree | 7d0014de51fe530b95bce7f74d9122229067f850 /arch/arm/vfp/vfphw.S | |
parent | 9b73e76f3cf63379dcf45fcd4f112f5812418d0a (diff) |
[ARM] 4582/2: Add support for the common VFP subarchitecture
This patch allows the VFP support code to run correctly on CPUs
compatible with the common VFP subarchitecture specification (Appendix
B in the ARM ARM v7-A and v7-R edition). It implements support for VFP
subarchitecture 2 while being backwards compatible with
subarchitecture 1.
On VFP subarchitecture 1, the arithmetic exceptions are asynchronous
(or imprecise as described in the old ARM ARM) unless the FPSCR.IXE
bit is 1. The exceptional instructions can be read from FPINST and
FPINST2 registers. With VFP subarchitecture 2, the arithmetic
exceptions can also be synchronous and marked by the FPEXC.DEX bit
(the FPEXC.EX bit is cleared). CPUs implementing the synchronous
arithmetic exceptions don't have the FPINST and FPINST2 registers and
accessing them would trigger and undefined exception.
Note that FPEXC.EX bit has an additional meaning on subarchitecture 1
- if it isn't set, there is no additional information in FPINST and
FPINST2 that needs to be saved at context switch or when lazy-loading
the VFP state of a different thread.
The patch also removes the clearing of the cumulative exception flags in
FPSCR when additional exceptions were raised. It is up to the user
application to clear these bits.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/vfp/vfphw.S')
-rw-r--r-- | arch/arm/vfp/vfphw.S | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S index 0ac022f800a1..53d9f8e8fac3 100644 --- a/arch/arm/vfp/vfphw.S +++ b/arch/arm/vfp/vfphw.S | |||
@@ -100,10 +100,10 @@ vfp_support_entry: | |||
100 | cmp r4, #0 | 100 | cmp r4, #0 |
101 | beq no_old_VFP_process | 101 | beq no_old_VFP_process |
102 | VFPFMRX r5, FPSCR @ current status | 102 | VFPFMRX r5, FPSCR @ current status |
103 | VFPFMRX r6, FPINST @ FPINST (always there, rev0 onwards) | 103 | tst r1, #FPEXC_EX @ is there additional state to save? |
104 | tst r1, #FPEXC_FPV2 @ is there an FPINST2 to read? | 104 | VFPFMRX r6, FPINST, NE @ FPINST (only if FPEXC.EX is set) |
105 | VFPFMRX r8, FPINST2, NE @ FPINST2 if needed - avoids reading | 105 | tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read? |
106 | @ nonexistant reg on rev0 | 106 | VFPFMRX r8, FPINST2, NE @ FPINST2 if needed (and present) |
107 | VFPFSTMIA r4 @ save the working registers | 107 | VFPFSTMIA r4 @ save the working registers |
108 | stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2 | 108 | stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2 |
109 | @ and point r4 at the word at the | 109 | @ and point r4 at the word at the |
@@ -117,10 +117,10 @@ no_old_VFP_process: | |||
117 | VFPFLDMIA r10 @ reload the working registers while | 117 | VFPFLDMIA r10 @ reload the working registers while |
118 | @ FPEXC is in a safe state | 118 | @ FPEXC is in a safe state |
119 | ldmia r10, {r1, r5, r6, r8} @ load FPEXC, FPSCR, FPINST, FPINST2 | 119 | ldmia r10, {r1, r5, r6, r8} @ load FPEXC, FPSCR, FPINST, FPINST2 |
120 | tst r1, #FPEXC_FPV2 @ is there an FPINST2 to write? | 120 | tst r1, #FPEXC_EX @ is there additional state to restore? |
121 | VFPFMXR FPINST2, r8, NE @ FPINST2 if needed - avoids writing | 121 | VFPFMXR FPINST, r6, NE @ restore FPINST (only if FPEXC.EX is set) |
122 | @ nonexistant reg on rev0 | 122 | tstne r1, #FPEXC_FP2V @ is there an FPINST2 to write? |
123 | VFPFMXR FPINST, r6 | 123 | VFPFMXR FPINST2, r8, NE @ FPINST2 if needed (and present) |
124 | VFPFMXR FPSCR, r5 @ restore status | 124 | VFPFMXR FPSCR, r5 @ restore status |
125 | 125 | ||
126 | check_for_exception: | 126 | check_for_exception: |
@@ -136,10 +136,14 @@ check_for_exception: | |||
136 | 136 | ||
137 | 137 | ||
138 | look_for_VFP_exceptions: | 138 | look_for_VFP_exceptions: |
139 | tst r1, #FPEXC_EX | 139 | @ Check for synchronous or asynchronous exception |
140 | tst r1, #FPEXC_EX | FPEXC_DEX | ||
140 | bne process_exception | 141 | bne process_exception |
142 | @ On some implementations of the VFP subarch 1, setting FPSCR.IXE | ||
143 | @ causes all the CDP instructions to be bounced synchronously without | ||
144 | @ setting the FPEXC.EX bit | ||
141 | VFPFMRX r5, FPSCR | 145 | VFPFMRX r5, FPSCR |
142 | tst r5, #FPSCR_IXE @ IXE doesn't set FPEXC_EX ! | 146 | tst r5, #FPSCR_IXE |
143 | bne process_exception | 147 | bne process_exception |
144 | 148 | ||
145 | @ Fall into hand on to next handler - appropriate coproc instr | 149 | @ Fall into hand on to next handler - appropriate coproc instr |
@@ -150,10 +154,6 @@ look_for_VFP_exceptions: | |||
150 | 154 | ||
151 | process_exception: | 155 | process_exception: |
152 | DBGSTR "bounce" | 156 | DBGSTR "bounce" |
153 | sub r2, r2, #4 | ||
154 | str r2, [sp, #S_PC] @ retry the instruction on exit from | ||
155 | @ the imprecise exception handling in | ||
156 | @ the support code | ||
157 | mov r2, sp @ nothing stacked - regdump is at TOS | 157 | mov r2, sp @ nothing stacked - regdump is at TOS |
158 | mov lr, r9 @ setup for a return to the user code. | 158 | mov lr, r9 @ setup for a return to the user code. |
159 | 159 | ||
@@ -161,7 +161,7 @@ process_exception: | |||
161 | @ r0 holds the trigger instruction | 161 | @ r0 holds the trigger instruction |
162 | @ r1 holds the FPEXC value | 162 | @ r1 holds the FPEXC value |
163 | @ r2 pointer to register dump | 163 | @ r2 pointer to register dump |
164 | b VFP9_bounce @ we have handled this - the support | 164 | b VFP_bounce @ we have handled this - the support |
165 | @ code will raise an exception if | 165 | @ code will raise an exception if |
166 | @ required. If not, the user code will | 166 | @ required. If not, the user code will |
167 | @ retry the faulted instruction | 167 | @ retry the faulted instruction |
@@ -175,10 +175,10 @@ vfp_save_state: | |||
175 | @ r1 - FPEXC | 175 | @ r1 - FPEXC |
176 | DBGSTR1 "save VFP state %p", r0 | 176 | DBGSTR1 "save VFP state %p", r0 |
177 | VFPFMRX r2, FPSCR @ current status | 177 | VFPFMRX r2, FPSCR @ current status |
178 | VFPFMRX r3, FPINST @ FPINST (always there, rev0 onwards) | 178 | tst r1, #FPEXC_EX @ is there additional state to save? |
179 | tst r1, #FPEXC_FPV2 @ is there an FPINST2 to read? | 179 | VFPFMRX r3, FPINST, NE @ FPINST (only if FPEXC.EX is set) |
180 | VFPFMRX r12, FPINST2, NE @ FPINST2 if needed - avoids reading | 180 | tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read? |
181 | @ nonexistant reg on rev0 | 181 | VFPFMRX r12, FPINST2, NE @ FPINST2 if needed (and present) |
182 | VFPFSTMIA r0 @ save the working registers | 182 | VFPFSTMIA r0 @ save the working registers |
183 | stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2 | 183 | stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2 |
184 | mov pc, lr | 184 | mov pc, lr |