diff --git a/libcpu/arm/cortex-a/context_gcc.S b/libcpu/arm/cortex-a/context_gcc.S index da6e6507df2..087c4fe14b3 100644 --- a/libcpu/arm/cortex-a/context_gcc.S +++ b/libcpu/arm/cortex-a/context_gcc.S @@ -97,7 +97,9 @@ rt_hw_context_switch: tst r6, #(1<<30) beq 1f vstmdb sp!, {d0-d15} - vstmdb sp!, {d16-d31} +#ifdef RT_USING_VFPD32 /*there art 32 double float registers to save*/ + vstmdb sp!, {d16-d31} @ save the upper 16 registers +#endif vmrs r5, fpscr stmfd sp!, {r5} 1: @@ -237,7 +239,9 @@ rt_hw_context_switch_exit: beq 1f ldmfd sp!, {r5} vmsr fpscr, r5 - vldmia sp!, {d16-d31} +#ifdef RT_USING_VFPD32 /*there art 32 double float registers to restore*/ + vldmia sp!, {d16-d31} @ restore the upper 16 registers +#endif vldmia sp!, {d0-d15} 1: #endif diff --git a/libcpu/arm/cortex-a/start_gcc.S b/libcpu/arm/cortex-a/start_gcc.S index 606620ecfc4..1c8e833dfd0 100644 --- a/libcpu/arm/cortex-a/start_gcc.S +++ b/libcpu/arm/cortex-a/start_gcc.S @@ -458,13 +458,30 @@ vector_irq: #else stmfd sp!, {r0-r12,lr} +#ifdef RT_USING_FPU + vstmdb sp!, {d0-d15} +#ifdef RT_USING_VFPD32 /*there art 32 double float registers to save*/ + vstmdb sp!, {d16-d31} @ save the upper 16 registers +#endif + vmrs r5, fpscr + stmfd sp!, {r5} +#endif bl rt_interrupt_enter bl rt_hw_trap_irq bl rt_interrupt_leave - /* if rt_thread_switch_interrupt_flag set, jump to - * rt_hw_context_switch_interrupt_do and don't return */ +#ifdef RT_USING_FPU + ldmfd sp!, {r5} + vmsr fpscr, r5 +#ifdef RT_USING_VFPD32 /*there art 32 double float registers to restore*/ + vldmia sp!, {d16-d31} @ restore the upper 16 registers +#endif + vldmia sp!, {d0-d15} +#endif + + @ if rt_thread_switch_interrupt_flag set, jump to + @ rt_hw_context_switch_interrupt_do and don't return ldr r0, =rt_thread_switch_interrupt_flag ldr r1, [r0] cmp r1, #1