You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
load_x t0, pullMachineTimerCompareRegister /* Load address of compare register into t0. */
102
-
load_x t1, pullNextTime /* Load the address of ullNextTime into t1. */
101
+
load_x a0, pullMachineTimerCompareRegister /* Load address of compare register into a0. */
102
+
load_x a1, pullNextTime /* Load the address of ullNextTime into a1. */
103
103
104
104
#if( __riscv_xlen == 32 )
105
105
106
106
/* Update the 64-bit mtimer compare match value in two 32-bit writes. */
107
-
li t4, -1
108
-
lw t2, 0(t1) /* Load the low word of ullNextTime into t2. */
109
-
lw t3, 4(t1) /* Load the high word of ullNextTime into t3. */
110
-
sw t4, 0(t0) /* Low word no smaller than old value to start with - will be overwritten below. */
111
-
sw t3, 4(t0) /* Store high word of ullNextTime into compare register. No smaller than new value. */
112
-
sw t2, 0(t0) /* Store low word of ullNextTime into compare register. */
107
+
li a4, -1
108
+
lw a2, 0(a1) /* Load the low word of ullNextTime into a2. */
109
+
lw a3, 4(a1) /* Load the high word of ullNextTime into a3. */
110
+
sw a4, 0(a0) /* Low word no smaller than old value to start with - will be overwritten below. */
111
+
sw a3, 4(a0) /* Store high word of ullNextTime into compare register. No smaller than new value. */
112
+
sw a2, 0(a0) /* Store low word of ullNextTime into compare register. */
113
113
lw t0, uxTimerIncrementsForOneTick /* Load the value of ullTimerIncrementForOneTick into t0 (could this be optimized by storing in an array next to pullNextTime?). */
114
-
addt4, 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). */
115
-
sltu t5, t4, t2 /* See if the sum of low words overflowed (what about the zero case?). */
116
-
addt6, t3, t5 /* Add overflow to high word of ullNextTime. */
117
-
sw t4, 0(t1) /* Store new low word of ullNextTime. */
118
-
sw t6, 4(t1) /* Store new high word of ullNextTime. */
114
+
adda4, t0, a2 /* Add the low word of ullNextTime to the timer increments for one tick (assumes timer increment for one tick fits in 32-bits). */
115
+
sltu t1, a4, a2 /* See if the sum of low words overflowed (what about the zero case?). */
116
+
addt2, a3, t1 /* Add overflow to high word of ullNextTime. */
117
+
sw a4, 0(a1) /* Store new low word of ullNextTime. */
118
+
sw t2, 4(a1) /* Store new high word of ullNextTime. */
119
119
120
120
#endif /* __riscv_xlen == 32 */
121
121
122
122
#if( __riscv_xlen == 64 )
123
123
124
124
/* Update the 64-bit mtimer compare match value. */
125
-
ld t2, 0(t1) /* Load ullNextTime into t2. */
126
-
sd t2, 0(t0) /* Store ullNextTime into compare register. */
125
+
ld t2, 0(a1) /* Load ullNextTime into t2. */
126
+
sd t2, 0(a0) /* Store ullNextTime into compare register. */
127
127
ld t0, uxTimerIncrementsForOneTick /* Load the value of ullTimerIncrementForOneTick into t0 (could this be optimized by storing in an array next to pullNextTime?). */
128
128
add t4, t0, t2 /* Add ullNextTime to the timer increments for one tick. */
129
-
sd t4, 0(t1) /* Store ullNextTime. */
129
+
sd t4, 0(a1) /* Store ullNextTime. */
130
130
131
131
#endif /* __riscv_xlen == 64 */
132
132
.endm
@@ -206,7 +206,12 @@ pxPortInitialiseStack:
206
206
store_x t0, 0(a0) /* mstatus onto the stack. */
207
207
addi a0, a0, -portWORD_SIZE /* Space for critical nesting count. */
208
208
store_x x0, 0(a0) /* Critical nesting count starts at 0 for every task. */
209
+
210
+
#ifdef __riscv_32e
211
+
addi a0, a0, -(6 * portWORD_SIZE) /* Space for registers x11-x15. */
212
+
#else
209
213
addi a0, a0, -(22 * portWORD_SIZE) /* Space for registers x11-x31. */
214
+
#endif
210
215
store_x a2, 0(a0) /* Task parameters (pvParameters parameter) goes into register X10/a0 on the stack. */
211
216
addi a0, a0, -(6 * portWORD_SIZE) /* Space for registers x5-x9. */
212
217
load_x t0, xTaskReturnAddress
@@ -241,6 +246,7 @@ xPortStartFirstTask:
241
246
load_x x13, 10 * portWORD_SIZE( sp ) /* a3 */
242
247
load_x x14, 11 * portWORD_SIZE( sp ) /* a4 */
243
248
load_x x15, 12 * portWORD_SIZE( sp ) /* a5 */
249
+
#ifndef __riscv_32e
244
250
load_x x16, 13 * portWORD_SIZE( sp ) /* a6 */
245
251
load_x x17, 14 * portWORD_SIZE( sp ) /* a7 */
246
252
load_x x18, 15 * portWORD_SIZE( sp ) /* s2 */
@@ -257,12 +263,13 @@ xPortStartFirstTask:
257
263
load_x x29, 26 * portWORD_SIZE( sp ) /* t4 */
258
264
load_x x30, 27 * portWORD_SIZE( sp ) /* t5 */
259
265
load_x x31, 28 * portWORD_SIZE( sp ) /* t6 */
266
+
#endif
260
267
261
-
load_x x5, 29 * portWORD_SIZE( sp ) /* Obtain xCriticalNesting value for this task from task's stack. */
268
+
load_x x5, portCRITICAL_NESTING_OFFSET * portWORD_SIZE( sp ) /* Obtain xCriticalNesting value for this task from task's stack. */
262
269
load_x x6, pxCriticalNesting /* Load the address of xCriticalNesting into x6. */
263
270
store_x x5, 0( x6 ) /* Restore the critical nesting value for this task. */
0 commit comments