]> git.sur5r.net Git - freertos/commitdiff
Get preeprocessor working correctly.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 7 Mar 2008 16:29:15 +0000 (16:29 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 7 Mar 2008 16:29:15 +0000 (16:29 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@248 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/GCC/PPC405_Xilinx/portasm.S [new file with mode: 0644]

diff --git a/Source/portable/GCC/PPC405_Xilinx/portasm.S b/Source/portable/GCC/PPC405_Xilinx/portasm.S
new file mode 100644 (file)
index 0000000..7292313
--- /dev/null
@@ -0,0 +1,148 @@
+#include "FreeRTOSConfig.h"\r
+\r
+       .extern pxCurrentTCB\r
+       .extern vTaskSwitchContext\r
+       .extern vTaskIncrementTick\r
+       .extern vPortISRHandler\r
+\r
+       .global vPortStartFirstTask\r
+       .global vPortYield\r
+       .global vPortTickISR\r
+       .global vPortISRWrapper\r
+\r
+.set   BChainField, 0\r
+.set   NextLRField, BChainField + 4\r
+.set   MSRField,    NextLRField + 4\r
+.set   PCField,     MSRField    + 4\r
+.set   LRField,     PCField     + 4\r
+.set   CTRField,    LRField     + 4\r
+.set   XERField,    CTRField    + 4\r
+.set   CRField,     XERField    + 4\r
+.set   USPRG0Field, CRField     + 4\r
+.set   r0Field,     USPRG0Field + 4\r
+.set   r2Field,     r0Field     + 4\r
+.set   r3r31Field,  r2Field     + 4\r
+.set   IFrameSize,  r3r31Field  + ( ( 31 - 3 ) + 1 ) * 4\r
+\r
+\r
+.macro portSAVE_STACK_POINTER_AND_LR\r
+\r
+       /* Get the address of the TCB. */\r
+       xor             R0, R0, R0\r
+       addis   R2, R0, pxCurrentTCB@ha\r
+       lwz             R2,     pxCurrentTCB@l( R2 )\r
+\r
+       /* Store the stack pointer into the TCB */\r
+       stw             SP,     0( R2 )\r
+\r
+       /* Save the link register */\r
+       stwu    R1, -24( R1 )\r
+       mflr    R0\r
+       stw             R31, 20( R1 )\r
+       stw             R0, 28( R1 )\r
+       mr              R31, r1\r
+\r
+.endm\r
+\r
+.macro portRESTORE_STACK_POINTER_AND_LR\r
+\r
+       /* Restore the link register */\r
+       lwz             R11, 0( R1 )\r
+       lwz             R0, 4( R11 )\r
+       mtlr    R0\r
+       lwz             R31, -4( R11 )\r
+       mr              R1, R11\r
+\r
+       /* Get the address of the TCB. */\r
+       xor             R0, R0, R0\r
+       addis   SP, R0, pxCurrentTCB@ha\r
+       lwz             SP,     pxCurrentTCB@l( R1 )\r
+\r
+       /* Get the task stack pointer from the TCB. */\r
+       lwz             SP, 0( SP )\r
+\r
+.endm\r
+\r
+\r
+vPortStartFirstTask:\r
+\r
+       /* Get the address of the TCB. */\r
+       xor             R0, R0, R0\r
+    addis   SP, R0, pxCurrentTCB@ha\r
+    lwz                SP,     pxCurrentTCB@l( SP )\r
+\r
+       /* Get the task stack pointer from the TCB. */\r
+       lwz             SP, 0( SP )\r
+       \r
+       /* Restore MSR register to SRR1. */\r
+       lwz             R0, MSRField(R1)\r
+       mtsrr1  R0\r
+       \r
+       /* Restore current PC location to SRR0. */\r
+       lwz             R0, PCField(R1)\r
+       mtsrr0  R0\r
+\r
+       /* Save  USPRG0 register */\r
+       lwz             R0, USPRG0Field(R1)\r
+       mtspr   0x100,R0\r
+       \r
+       /* Restore Condition register */\r
+       lwz             R0, CRField(R1)\r
+       mtcr    R0\r
+       \r
+       /* Restore Fixed Point Exception register */\r
+       lwz             R0, XERField(R1)\r
+       mtxer   R0\r
+       \r
+       /* Restore Counter register */\r
+       lwz             R0, CTRField(R1)\r
+       mtctr   R0\r
+       \r
+       /* Restore Link register */\r
+       lwz             R0, LRField(R1)\r
+       mtlr    R0\r
+       \r
+       /* Restore remaining GPR registers. */\r
+       lmw     R3,r3r31Field(R1)\r
+       \r
+       /* Restore r0 and r2. */\r
+       lwz             R0, r0Field(R1)\r
+       lwz             R2, r2Field(R1)\r
+       \r
+       /* Remove frame from stack */\r
+       addi    R1,R1,IFrameSize\r
+\r
+       /* Return into the first task */\r
+       rfi\r
+\r
+\r
+\r
+vPortYield:\r
+\r
+       portSAVE_STACK_POINTER_AND_LR\r
+       bl vTaskSwitchContext\r
+       portRESTORE_STACK_POINTER_AND_LR\r
+       blr\r
+\r
+vPortTickISR:\r
+\r
+       portSAVE_STACK_POINTER_AND_LR\r
+       bl vTaskIncrementTick\r
+       \r
+       #if configUSE_PREEMPTION == 1\r
+               bl vTaskSwitchContext\r
+       #endif\r
+\r
+       /* Clear the interrupt */\r
+       lis             R0, 2048\r
+       mttsr   R0\r
+\r
+       portRESTORE_STACK_POINTER_AND_LR\r
+       blr\r
+\r
+vPortISRWrapper:\r
+\r
+       portSAVE_STACK_POINTER_AND_LR\r
+       bl vPortISRHandler\r
+       portRESTORE_STACK_POINTER_AND_LR\r
+       blr\r