.extern pxCurrentTCB\r
.extern ulPortTrapHandler\r
.extern vTaskSwitchContext\r
+.extern xTaskIncrementTick\r
.extern Timer_IRQHandler\r
.extern pullMachineTimerCompareRegister\r
.extern pullNextTime\r
.extern uxTimerIncrementsForOneTick /* size_t type so 32-bit on 32-bit core and 64-bits on 64-bit core. */\r
.extern xISRStackTop\r
+.extern portasmHANDLE_INTERRUPT\r
\r
/*-----------------------------------------------------------*/\r
\r
#if( __riscv_xlen == 32 )\r
\r
/* Update the 64-bit mtimer compare match value in two 32-bit writes. */\r
+ li t4, -1\r
lw t2, 0(t1) /* Load the low word of ullNextTime into t2. */\r
lw t3, 4(t1) /* Load the high word of ullNextTime into t3. */\r
+ sw t4, 0(t0) /* Low word no smaller than old value. */\r
+ sw t3, 4(t0) /* Store high word of ullNextTime into compare register. No smaller than new value. */\r
sw t2, 0(t0) /* Store low word of ullNextTime into compare register. */\r
- sw t3, 4(t0) /* Store high word of ullNextTime into compare register. */\r
lw t0, uxTimerIncrementsForOneTick /* Load the value of ullTimerIncrementForOneTick into t0 (could this be optimized by storing in an array next to pullNextTime?). */\r
add t4, t0, t2 /* Add the low word of ullNextTime to the timer increments for one tick (assumes timer increment for one tick fits in 32-bits). */\r
sltu t5, t4, t2 /* See if the sum of low words overflowed (what about the zero case?). */\r