diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2008-11-06 08:23:08 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2008-11-06 08:23:08 -0500 |
commit | 24b647a042b988b017e6cdf60b47a0bfecd1dc41 (patch) | |
tree | 0499bc3b21be6ebe0e5809effbc4d4f09a0dc424 | |
parent | c30c2f99e10b6a810dae9a25b35c6d48796d8ffb (diff) |
ARMv7: Branch over conditional undefined instructions in vfphw.S
On ARMv7, conditional undefined instructions may generate exceptions
even if the condition is not met. The vfphw.S contains the FPINST and
FPINST2 access instructions which may not be present on processors with
synchronous VFP exceptions.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | arch/arm/vfp/vfphw.S | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S index a62dcf7098ba..3c73aafe3e01 100644 --- a/arch/arm/vfp/vfphw.S +++ b/arch/arm/vfp/vfphw.S | |||
@@ -101,9 +101,12 @@ ENTRY(vfp_support_entry) | |||
101 | VFPFSTMIA r4, r5 @ save the working registers | 101 | VFPFSTMIA r4, r5 @ save the working registers |
102 | VFPFMRX r5, FPSCR @ current status | 102 | VFPFMRX r5, FPSCR @ current status |
103 | tst r1, #FPEXC_EX @ is there additional state to save? | 103 | tst r1, #FPEXC_EX @ is there additional state to save? |
104 | VFPFMRX r6, FPINST, NE @ FPINST (only if FPEXC.EX is set) | 104 | beq 1f |
105 | tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read? | 105 | VFPFMRX r6, FPINST @ FPINST (only if FPEXC.EX is set) |
106 | VFPFMRX r8, FPINST2, NE @ FPINST2 if needed (and present) | 106 | tst r1, #FPEXC_FP2V @ is there an FPINST2 to read? |
107 | beq 1f | ||
108 | VFPFMRX r8, FPINST2 @ FPINST2 if needed (and present) | ||
109 | 1: | ||
107 | stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2 | 110 | stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2 |
108 | @ and point r4 at the word at the | 111 | @ and point r4 at the word at the |
109 | @ start of the register dump | 112 | @ start of the register dump |
@@ -117,9 +120,12 @@ no_old_VFP_process: | |||
117 | @ FPEXC is in a safe state | 120 | @ FPEXC is in a safe state |
118 | ldmia r10, {r1, r5, r6, r8} @ load FPEXC, FPSCR, FPINST, FPINST2 | 121 | ldmia r10, {r1, r5, r6, r8} @ load FPEXC, FPSCR, FPINST, FPINST2 |
119 | tst r1, #FPEXC_EX @ is there additional state to restore? | 122 | tst r1, #FPEXC_EX @ is there additional state to restore? |
120 | VFPFMXR FPINST, r6, NE @ restore FPINST (only if FPEXC.EX is set) | 123 | beq 1f |
121 | tstne r1, #FPEXC_FP2V @ is there an FPINST2 to write? | 124 | VFPFMXR FPINST, r6 @ restore FPINST (only if FPEXC.EX is set) |
122 | VFPFMXR FPINST2, r8, NE @ FPINST2 if needed (and present) | 125 | tst r1, #FPEXC_FP2V @ is there an FPINST2 to write? |
126 | beq 1f | ||
127 | VFPFMXR FPINST2, r8 @ FPINST2 if needed (and present) | ||
128 | 1: | ||
123 | VFPFMXR FPSCR, r5 @ restore status | 129 | VFPFMXR FPSCR, r5 @ restore status |
124 | 130 | ||
125 | check_for_exception: | 131 | check_for_exception: |
@@ -175,9 +181,12 @@ ENTRY(vfp_save_state) | |||
175 | VFPFSTMIA r0, r2 @ save the working registers | 181 | VFPFSTMIA r0, r2 @ save the working registers |
176 | VFPFMRX r2, FPSCR @ current status | 182 | VFPFMRX r2, FPSCR @ current status |
177 | tst r1, #FPEXC_EX @ is there additional state to save? | 183 | tst r1, #FPEXC_EX @ is there additional state to save? |
178 | VFPFMRX r3, FPINST, NE @ FPINST (only if FPEXC.EX is set) | 184 | beq 1f |
179 | tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read? | 185 | VFPFMRX r3, FPINST @ FPINST (only if FPEXC.EX is set) |
180 | VFPFMRX r12, FPINST2, NE @ FPINST2 if needed (and present) | 186 | tst r1, #FPEXC_FP2V @ is there an FPINST2 to read? |
187 | beq 1f | ||
188 | VFPFMRX r12, FPINST2 @ FPINST2 if needed (and present) | ||
189 | 1: | ||
181 | stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2 | 190 | stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2 |
182 | mov pc, lr | 191 | mov pc, lr |
183 | ENDPROC(vfp_save_state) | 192 | ENDPROC(vfp_save_state) |