pxTopOfStack--;\r
*pxTopOfStack = portINITIAL_MSR;/* SRR1. */\r
pxTopOfStack--;\r
- *pxTopOfStack = 0x00000000UL;/* Next LR. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) vStartFirstTask;/* Next LR. */\r
pxTopOfStack--;\r
- *pxTopOfStack = portINITIAL_MSR;/* Backchain. */\r
+ *pxTopOfStack = 0x00000000UL;;/* Backchain. */\r
// pxTopOfStack--;\r
\r
return pxTopOfStack;\r
.set portGPR_OFFSET, 32\r
.set portCR_OFFSET, 28\r
.set portXER_OFFSET, 24\r
-.set portLR_OFFSET, 20\r
+.set portLR_OFFSET, 16\r
.set portCTR_OFFSET, 16\r
.set portUSPRG0_OFFSET, 12\r
.set portSRR0_OFFSET, 8\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 portEXIT_SWITCHING_ISR\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
# Get the task stack pointer from the TCB.\r
lwz SP, 0( SP )\r
\r
- # Load up the LR for the correct return.\r
- lwz R0,LRField(R1)\r
- mtlr R0\r
-\r
-\r
.endm\r
\r
\r
\r
/* Task utilities. */\r
void vPortYield( void );\r
-#define portYIELD() asm volatile ( "SC" )\r
+#define portYIELD() asm volatile ( "SC \n\t NOP" )\r
#define portYIELD_FROM_ISR()\r
/*-----------------------------------------------------------*/\r
\r