.extern pullMachineTimerCompareRegister\r
.extern pullNextTime\r
.extern ulTimerIncrementsForOneTick\r
-\r
+.extern xISRStackTop\r
\r
/*-----------------------------------------------------------*/\r
\r
\r
csrr a0, mcause\r
csrr a1, mepc\r
- mv a2, sp\r
\r
test_if_environment_call:\r
li t0, 11 /* 11 == environment call when using qemu. */\r
bne a0, t0, test_if_timer\r
addi a1, a1, 4 /* Synchronous so return to the instruction after the environment call. */\r
sw a1, 0( sp ) /* Save updated exception return address. */\r
-/*_RB_ Does stack need aligning here? */\r
+ lw sp, xISRStackTop /* Switch to ISR stack before function call. */\r
jal vTaskSwitchContext\r
j processed_source\r
\r
add t6, t3, t5 /* Add overflow to high word of ullNextTime. */\r
sw t4, 0(t1) /* Store new low word of ullNextTime. */\r
sw t6, 4(t1) /* Store new high word of ullNextTime. */\r
+ lw sp, xISRStackTop /* Switch to ISR stack before function call. */\r
jal xTaskIncrementTick\r
beqz a0, processed_source /* Don't switch context if incrementing tick didn't unblock a task. */\r
jal vTaskSwitchContext\r
j processed_source\r
\r
as_yet_unhandled:\r
- j as_yet_unhandled /* External interrupt? */\r
+// ebreak /* External interrupt? */\r
+ j as_yet_unhandled\r
\r
processed_source:\r
lw sp, pxCurrentTCB /* Load pxCurrentTCB. */\r