From 315db9ebda8dfeec80d8770dd2383bec626d24bd Mon Sep 17 00:00:00 2001 From: richardbarry Date: Tue, 30 Jun 2009 19:24:32 +0000 Subject: [PATCH] Add support for double precision floating point. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@790 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Source/portable/GCC/PPC405_Xilinx/port.c | 14 +++- Source/portable/GCC/PPC405_Xilinx/portasm.S | 90 +++++++++++++++++++++ 2 files changed, 102 insertions(+), 2 deletions(-) diff --git a/Source/portable/GCC/PPC405_Xilinx/port.c b/Source/portable/GCC/PPC405_Xilinx/port.c index 623543c83..882bb8b0e 100644 --- a/Source/portable/GCC/PPC405_Xilinx/port.c +++ b/Source/portable/GCC/PPC405_Xilinx/port.c @@ -80,6 +80,10 @@ #define portINITIAL_MSR ( portCRITICAL_INTERRUPT_ENABLE | portEXTERNAL_INTERRUPT_ENABLE | portMACHINE_CHECK_ENABLE | portAPU_PRESENT | portFCM_FPU_PRESENT ) + +extern const unsigned _SDA_BASE_; +extern const unsigned _SDA2_BASE_; + /*-----------------------------------------------------------*/ /* @@ -123,12 +127,18 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack--; /* EABI stack frame. */ - pxTopOfStack -= 30; /* Previous backchain and LR, R31 to R4 inclusive. */ + pxTopOfStack -= 20; /* Previous backchain and LR, R31 to R4 inclusive. */ + + /* Parameters in R13. */ + *pxTopOfStack = ( portSTACK_TYPE ) &_SDA_BASE_; /* address of the first small data area */ + pxTopOfStack -= 10; /* Parameters in R3. */ *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; pxTopOfStack--; - *pxTopOfStack = 0x02020202UL; /* R2. */ + + /* Parameters in R2. */ + *pxTopOfStack = ( portSTACK_TYPE ) &_SDA2_BASE_; /* address of the second small data area */ pxTopOfStack--; /* R1 is the stack pointer so is omitted. */ diff --git a/Source/portable/GCC/PPC405_Xilinx/portasm.S b/Source/portable/GCC/PPC405_Xilinx/portasm.S index 252af6bb9..54cdd10a5 100644 --- a/Source/portable/GCC/PPC405_Xilinx/portasm.S +++ b/Source/portable/GCC/PPC405_Xilinx/portasm.S @@ -212,6 +212,49 @@ vPortSaveFPURegisters: or r0, r0, r30 mtmsr r0 +#ifdef USE_DP_FPU + + /* Buffer address is in r3. Save each flop register into an offset from + this buffer address. */ + stfd f0, 0(r3) + stfd f1, 8(r3) + stfd f2, 16(r3) + stfd f3, 24(r3) + stfd f4, 32(r3) + stfd f5, 40(r3) + stfd f6, 48(r3) + stfd f7, 56(r3) + stfd f8, 64(r3) + stfd f9, 72(r3) + stfd f10, 80(r3) + stfd f11, 88(r3) + stfd f12, 96(r3) + stfd f13, 104(r3) + stfd f14, 112(r3) + stfd f15, 120(r3) + stfd f16, 128(r3) + stfd f17, 136(r3) + stfd f18, 144(r3) + stfd f19, 152(r3) + stfd f20, 160(r3) + stfd f21, 168(r3) + stfd f22, 176(r3) + stfd f23, 184(r3) + stfd f24, 192(r3) + stfd f25, 200(r3) + stfd f26, 208(r3) + stfd f27, 216(r3) + stfd f28, 224(r3) + stfd f29, 232(r3) + stfd f30, 240(r3) + stfd f31, 248(r3) + + /* Also save the FPSCR. */ + mffs f31 + stfs f31, 256(r3) + +#else + /* Buffer address is in r3. Save each flop register into an offset from this buffer address. */ stfs f0, 0(r3) @@ -250,6 +293,8 @@ vPortSaveFPURegisters: /* Also save the FPSCR. */ mffs f31 stfs f31, 128(r3) + +#endif blr @@ -268,6 +313,49 @@ vPortRestoreFPURegisters: or r0, r0, r30 mtmsr r0 +#ifdef USE_DP_FPU + + /* Buffer address is in r3. Restore each flop register from an offset + into this buffer. + + First the FPSCR. */ + lfs f31, 256(r3) + mtfsf f31, 7 + + lfd f0, 0(r3) + lfd f1, 8(r3) + lfd f2, 16(r3) + lfd f3, 24(r3) + lfd f4, 32(r3) + lfd f5, 40(r3) + lfd f6, 48(r3) + lfd f7, 56(r3) + lfd f8, 64(r3) + lfd f9, 72(r3) + lfd f10, 80(r3) + lfd f11, 88(r3) + lfd f12, 96(r3) + lfd f13, 104(r3) + lfd f14, 112(r3) + lfd f15, 120(r3) + lfd f16, 128(r3) + lfd f17, 136(r3) + lfd f18, 144(r3) + lfd f19, 152(r3) + lfd f20, 160(r3) + lfd f21, 168(r3) + lfd f22, 176(r3) + lfd f23, 184(r3) + lfd f24, 192(r3) + lfd f25, 200(r3) + lfd f26, 208(r3) + lfd f27, 216(r3) + lfd f28, 224(r3) + lfd f29, 232(r3) + lfd f30, 240(r3) + lfd f31, 248(r3) + +#else /* Buffer address is in r3. Restore each flop register from an offset into this buffer. @@ -309,6 +397,8 @@ vPortRestoreFPURegisters: lfs f30, 120(r3) lfs f31, 124(r3) +#endif + blr #endif /* configUSE_FPU. */ -- 2.39.5