Skip to content

Commit 11ff2e3

Browse files
ChristosZosipaulbartell
authored andcommitted
Enable access to FPU registers only if FPU is enabled
1 parent ed1f4e6 commit 11ff2e3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

portable/GCC/ARM_CR5/portASM.S

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
LDR R1, [R2]
6565
PUSH {R1}
6666

67+
#ifdef __ARM_FP
6768
/* Does the task have a floating point context that needs saving? If
6869
ulPortTaskHasFPUContext is 0 then no. */
6970
LDR R2, ulPortTaskHasFPUContextConst
@@ -78,6 +79,7 @@
7879

7980
/* Save ulPortTaskHasFPUContext itself. */
8081
PUSH {R3}
82+
#endif /* __ARM_FP */
8183

8284
/* Save the stack pointer in the TCB. */
8385
LDR R0, pxCurrentTCBConst
@@ -95,6 +97,7 @@
9597
LDR R1, [R0]
9698
LDR SP, [R1]
9799

100+
#ifdef __ARM_FP
98101
/* Is there a floating point context to restore? If the restored
99102
ulPortTaskHasFPUContext is zero then no. */
100103
LDR R0, ulPortTaskHasFPUContextConst
@@ -107,6 +110,7 @@
107110
/*VPOPNE {D16-D31}*/
108111
VPOPNE {D0-D15}
109112
VMSRNE FPSCR, R0
113+
#endif /* __ARM_FP */
110114

111115
/* Restore the critical section nesting depth. */
112116
LDR R0, ulCriticalNestingConst
@@ -279,22 +283,27 @@ switch_before_exit:
279283
* FPU registers to be saved on interrupt entry their IRQ handler must be
280284
* called vApplicationIRQHandler().
281285
*****************************************************************************/
282-
283286
.align 4
284287
.weak vApplicationIRQHandler
285288
.type vApplicationIRQHandler, %function
286289
vApplicationIRQHandler:
290+
287291
PUSH {LR}
292+
293+
#ifdef __ARM_FP
288294
FMRX R1, FPSCR
289295
VPUSH {D0-D15}
290296
PUSH {R1}
297+
#endif /* __ARM_FP */
291298

292299
LDR r1, vApplicationFPUSafeIRQHandlerConst
293300
BLX r1
294301

302+
#ifdef __ARM_FP
295303
POP {R0}
296304
VPOP {D0-D15}
297305
VMSR FPSCR, R0
306+
#endif /* __ARM_FP */
298307

299308
POP {PC}
300309

0 commit comments

Comments
 (0)