arm/armv[7|8]-m: skip the fpu save/restore if stack frame is integer-only

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-04-07 13:48:04 +08:00 committed by Masayuki Ishikawa
parent 8cb008c3c7
commit 8d66dbc068
2 changed files with 22 additions and 4 deletions

View file

@ -174,8 +174,12 @@ exception_common:
* where to put the registers. * where to put the registers.
*/ */
vstmdb sp!, {s16-s31} /* Save the non-volatile FP context */ /* Switched-out task including volatile FP registers ? */
tst r14, #EXC_RETURN_STD_CONTEXT
ite eq
vstmdbeq sp!, {s16-s31} /* Save the non-volatile FP context */
subne sp, #(4*SW_FPU_REGS)
#endif #endif
stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP/PRIMASK values */ stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP/PRIMASK values */
@ -225,7 +229,12 @@ exception_common:
ldmia r0!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r0!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#ifdef CONFIG_ARCH_FPU #ifdef CONFIG_ARCH_FPU
vldmia r0!, {s16-s31} /* Recover S16-S31 */ /* Switched-in task including volatile FP registers ? */
tst r14, #EXC_RETURN_STD_CONTEXT
ite eq
vldmiaeq r0!, {s16-s31} /* Recover S16-S31 */
addne r0, #(4*SW_FPU_REGS)
#endif #endif
/* The EXC_RETURN value tells us whether we are returning on the MSP or PSP /* The EXC_RETURN value tells us whether we are returning on the MSP or PSP

View file

@ -190,8 +190,12 @@ exception_common:
* where to put the registers. * where to put the registers.
*/ */
vstmdb sp!, {s16-s31} /* Save the non-volatile FP context */ /* Switched-out task including volatile FP registers ? */
tst r14, #EXC_RETURN_STD_CONTEXT
ite eq
vstmdbeq sp!, {s16-s31} /* Save the non-volatile FP context */
subne sp, #(4*SW_FPU_REGS)
#endif #endif
stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP/PRIMASK values */ stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP/PRIMASK values */
@ -241,7 +245,12 @@ exception_common:
ldmia r0!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r0!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#ifdef CONFIG_ARCH_FPU #ifdef CONFIG_ARCH_FPU
vldmia r0!, {s16-s31} /* Recover S16-S31 */ /* Switched-in task including volatile FP registers ? */
tst r14, #EXC_RETURN_STD_CONTEXT
ite eq
vldmiaeq r0!, {s16-s31} /* Recover S16-S31 */
addne r0, #(4*SW_FPU_REGS)
#endif #endif
#ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE #ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE