aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/vfp/vfphw.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/vfp/vfphw.S')
-rw-r--r--arch/arm/vfp/vfphw.S60
1 files changed, 37 insertions, 23 deletions
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index 0ac022f800a1..353f9e5c7919 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -99,12 +99,12 @@ vfp_support_entry:
99 DBGSTR1 "save old state %p", r4 99 DBGSTR1 "save old state %p", r4
100 cmp r4, #0 100 cmp r4, #0
101 beq no_old_VFP_process 101 beq no_old_VFP_process
102 VFPFSTMIA r4, r5 @ save the working registers
102 VFPFMRX r5, FPSCR @ current status 103 VFPFMRX r5, FPSCR @ current status
103 VFPFMRX r6, FPINST @ FPINST (always there, rev0 onwards) 104 tst r1, #FPEXC_EX @ is there additional state to save?
104 tst r1, #FPEXC_FPV2 @ is there an FPINST2 to read? 105 VFPFMRX r6, FPINST, NE @ FPINST (only if FPEXC.EX is set)
105 VFPFMRX r8, FPINST2, NE @ FPINST2 if needed - avoids reading 106 tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read?
106 @ nonexistant reg on rev0 107 VFPFMRX r8, FPINST2, NE @ FPINST2 if needed (and present)
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
110 @ start of the register dump 110 @ start of the register dump
@@ -114,13 +114,13 @@ no_old_VFP_process:
114 DBGSTR1 "load state %p", r10 114 DBGSTR1 "load state %p", r10
115 str r10, [r3, r11, lsl #2] @ update the last_VFP_context pointer 115 str r10, [r3, r11, lsl #2] @ update the last_VFP_context pointer
116 @ Load the saved state back into the VFP 116 @ Load the saved state back into the VFP
117 VFPFLDMIA r10 @ reload the working registers while 117 VFPFLDMIA r10, r5 @ 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
126check_for_exception: 126check_for_exception:
@@ -136,10 +136,14 @@ check_for_exception:
136 136
137 137
138look_for_VFP_exceptions: 138look_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
151process_exception: 155process_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
@@ -174,12 +174,12 @@ vfp_save_state:
174 @ r0 - save location 174 @ r0 - save location
175 @ r1 - FPEXC 175 @ r1 - FPEXC
176 DBGSTR1 "save VFP state %p", r0 176 DBGSTR1 "save VFP state %p", r0
177 VFPFSTMIA r0, r2 @ save the working registers
177 VFPFMRX r2, FPSCR @ current status 178 VFPFMRX r2, FPSCR @ current status
178 VFPFMRX r3, FPINST @ FPINST (always there, rev0 onwards) 179 tst r1, #FPEXC_EX @ is there additional state to save?
179 tst r1, #FPEXC_FPV2 @ is there an FPINST2 to read? 180 VFPFMRX r3, FPINST, NE @ FPINST (only if FPEXC.EX is set)
180 VFPFMRX r12, FPINST2, NE @ FPINST2 if needed - avoids reading 181 tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read?
181 @ nonexistant reg on rev0 182 VFPFMRX r12, FPINST2, NE @ FPINST2 if needed (and present)
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
185#endif 185#endif
@@ -217,8 +217,15 @@ vfp_get_double:
217 fmrrd r0, r1, d\dr 217 fmrrd r0, r1, d\dr
218 mov pc, lr 218 mov pc, lr
219 .endr 219 .endr
220#ifdef CONFIG_VFPv3
221 @ d16 - d31 registers
222 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
223 mrrc p11, 3, r0, r1, c\dr @ fmrrd r0, r1, d\dr
224 mov pc, lr
225 .endr
226#endif
220 227
221 @ virtual register 16 for compare with zero 228 @ virtual register 16 (or 32 if VFPv3) for compare with zero
222 mov r0, #0 229 mov r0, #0
223 mov r1, #0 230 mov r1, #0
224 mov pc, lr 231 mov pc, lr
@@ -231,3 +238,10 @@ vfp_put_double:
231 fmdrr d\dr, r0, r1 238 fmdrr d\dr, r0, r1
232 mov pc, lr 239 mov pc, lr
233 .endr 240 .endr
241#ifdef CONFIG_VFPv3
242 @ d16 - d31 registers
243 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
244 mcrr p11, 3, r1, r2, c\dr @ fmdrr r1, r2, d\dr
245 mov pc, lr
246 .endr
247#endif