mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-26 09:08:25 +00:00
[libcpu][cortex-a] Refactor FPU stack initialization for maintainability (#10919)
* Initial plan * [libcpu][cortex-a] Improve FPU stack initialization implementation Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com> * [libcpu][cortex-a] Replace FPU init loop with rt_memset Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com>
This commit is contained in:
@@ -61,7 +61,13 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
|
||||
*(--stk) = 0; /* user sp*/
|
||||
#endif
|
||||
#ifdef RT_USING_FPU
|
||||
*(--stk) = 0; /* not use fpu*/
|
||||
/* FPU context initialization matches context_gcc.S restore order:
|
||||
* Stack layout (high to low): FPEXC -> FPSCR -> D16-D31 -> D0-D15
|
||||
*/
|
||||
stk -= VFP_DATA_NR;
|
||||
rt_memset(stk, 0, VFP_DATA_NR * sizeof(rt_uint32_t)); /* Initialize D0-D31 (64 words for 32 double regs) */
|
||||
*(--stk) = 0; /* FPSCR: Floating-Point Status and Control Register */
|
||||
*(--stk) = 0x40000000; /* FPEXC: Enable FPU (bit 30 = EN) */
|
||||
#endif
|
||||
|
||||
/* return task's current stack address */
|
||||
|
||||
Reference in New Issue
Block a user