|
57 | 57 | * specific version of freertos_risc_v_chip_specific_extensions.h. See the |
58 | 58 | * notes at the top of portASM.S file. */ |
59 | 59 | #ifdef __riscv_32e |
60 | | - #define portCONTEXT_SIZE ( 15 * portWORD_SIZE ) |
| 60 | + #define portCONTEXT_SIZE ( 16 * portWORD_SIZE ) |
61 | 61 | #define portCRITICAL_NESTING_OFFSET 14 |
| 62 | + #define portINTERRUPT_NESTING_OFFSET 15 |
62 | 63 | #else |
63 | | - #define portCONTEXT_SIZE ( 31 * portWORD_SIZE ) |
| 64 | + #define portCONTEXT_SIZE ( 32 * portWORD_SIZE ) |
64 | 65 | #define portCRITICAL_NESTING_OFFSET 30 |
| 66 | + #define portINTERRUPT_NESTING_OFFSET 31 |
65 | 67 | #endif |
66 | 68 |
|
67 | 69 | #if ( configENABLE_FPU == 1 ) |
|
122 | 124 | .extern xISRStackTop |
123 | 125 | .extern xCriticalNesting |
124 | 126 | .extern pxCriticalNesting |
| 127 | +.extern xInterruptNesting |
| 128 | +.extern pxInterruptNesting |
125 | 129 | /*-----------------------------------------------------------*/ |
126 | 130 |
|
127 | 131 | .macro portcontexSAVE_FPU_CONTEXT |
@@ -306,6 +310,12 @@ store_x x15, 13 * portWORD_SIZE( sp ) |
306 | 310 | load_x t0, xCriticalNesting /* Load the value of xCriticalNesting into t0. */ |
307 | 311 | store_x t0, portCRITICAL_NESTING_OFFSET * portWORD_SIZE( sp ) /* Store the critical nesting value to the stack. */ |
308 | 312 |
|
| 313 | +load_x t0, xInterruptNesting /* Load the value of xInterruptNesting into t0. */ |
| 314 | +store_x t0, portINTERRUPT_NESTING_OFFSET * portWORD_SIZE( sp ) /* Store the interrupt nesting value to the stack. */ |
| 315 | +addi t0, t0, 1 |
| 316 | +load_x t1, pxInterruptNesting /* Load the address of xInterruptNesting into t1. */ |
| 317 | +store_x t0, 0( t1 ) /* Increment xInterruptNesting by 1 */ |
| 318 | + |
309 | 319 | #if( configENABLE_FPU == 1 ) |
310 | 320 | csrr t0, mstatus |
311 | 321 | srl t1, t0, MSTATUS_FS_OFFSET |
@@ -425,6 +435,10 @@ csrw mstatus, t3 |
425 | 435 | 6: |
426 | 436 | #endif /* ifdef portasmSTORE_FPU_CONTEXT */ |
427 | 437 |
|
| 438 | +load_x t0, portINTERRUPT_NESTING_OFFSET * portWORD_SIZE( sp ) /* Obtain saved xInterruptNesting value from task's stack. */ |
| 439 | +load_x t1, pxInterruptNesting /* Load the address of xInterruptNesting into t1. */ |
| 440 | +store_x t0, 0 ( t1 ) /* Restore the interrupt nesting value. */ |
| 441 | + |
428 | 442 | load_x t0, portCRITICAL_NESTING_OFFSET * portWORD_SIZE( sp ) /* Obtain xCriticalNesting value for this task from task's stack. */ |
429 | 443 | load_x t1, pxCriticalNesting /* Load the address of xCriticalNesting into t1. */ |
430 | 444 | store_x t0, 0 ( t1 ) /* Restore the critical nesting value for this task. */ |
|
0 commit comments