ins k1, k0, 10, 6\r
ins k1, zero, 1, 4\r
\r
- /* Load, incrmement, then save the interrupt nesting count. */\r
+ /* s5 is used as the frame pointer. */\r
+ add s5, zero, sp\r
+\r
+ /* Check the nesting count value. */\r
la k0, uxInterruptNesting\r
lw s6, (k0)\r
- addiu s6, s6, 1\r
- sw s6, 0(k0)\r
\r
- /* If it was zero, switch to the system stack. If it was not zero then\r
- we are already using the system stack. s5 holds the old stack value -\r
- this might be used to determine the cause of a general exception. */\r
- add s5, zero, sp\r
- addiu s6, s6, -1\r
- bne zero, s6, .+20\r
+ /* If the nesting count is 0 then swap to the the system stack, otherwise\r
+ the system stack is already being used. */\r
+ bne s6, zero, .+16\r
nop\r
- la s6, xISRStackTop\r
- lw sp, (s6)\r
+\r
+ /* Swap to the system stack. */\r
+ la sp, xISRStackTop\r
+ lw sp, (sp)\r
+\r
+ /* Increment and save the nesting count. */\r
+ addiu s6, s6, 1\r
+ sw s6, 0(k0)\r
\r
/* s6 holds the EPC value, we may want this during the context switch. */\r
mfc0 s6, _CP0_EPC\r
sw v0, 52(s5)\r
sw s7, 48(s5)\r
sw s6, portEPC_STACK_LOCATION(s5)\r
- /* s5 has already been saved. */\r
+ /* s5 and s6 has already been saved. */\r
sw s4, 36(s5)\r
sw s3, 32(s5)\r
sw s2, 28(s5)\r