|
9 | 9 | **************************************************************************/ |
10 | 10 |
|
11 | 11 | #include "csr.h" |
12 | | -#include "tx_port.h" |
13 | 12 |
|
14 | 13 | .section .text |
15 | 14 | .align 4 |
|
67 | 66 | .extern _tx_thread_context_restore |
68 | 67 | trap_entry: |
69 | 68 | #if defined(__riscv_float_abi_single) || defined(__riscv_float_abi_double) |
70 | | - addi sp, sp, -65*REGBYTES // Allocate space for all registers - with floating point enabled |
| 69 | + addi sp, sp, -520 // Allocate space for all registers - with floating point enabled (65*8) |
71 | 70 | #else |
72 | | - addi sp, sp, -32*REGBYTES // Allocate space for all registers - without floating point enabled |
| 71 | + addi sp, sp, -256 // Allocate space for all registers - without floating point enabled (32*8) |
73 | 72 | #endif |
74 | 73 |
|
75 | | - STORE x1, 28*REGBYTES(sp) // Store RA, 28*REGBYTES(because call will override ra [ra is a calle register in riscv]) |
| 74 | + sd x1, 224(sp) // Store RA (28*8 = 224, because call will override ra [ra is a callee register in riscv]) |
76 | 75 |
|
77 | 76 | call _tx_thread_context_save |
78 | 77 |
|
@@ -138,19 +137,21 @@ _err: |
138 | 137 | .extern _end |
139 | 138 | .extern board_init |
140 | 139 | _tx_initialize_low_level: |
141 | | - sd sp, _tx_thread_system_stack_ptr, t0 // Save system stack pointer |
| 140 | + la t0, _tx_thread_system_stack_ptr |
| 141 | + sd sp, 0(t0) // Save system stack pointer |
142 | 142 |
|
143 | | - la t0, _end // Pickup first free address |
144 | | - sd t0, _tx_initialize_unused_memory, t1 // Save unused memory address |
| 143 | + la t0, _end // Pickup first free address |
| 144 | + la t1, _tx_initialize_unused_memory |
| 145 | + sd t0, 0(t1) // Save unused memory address |
145 | 146 | li t0, MSTATUS_MIE |
146 | | - csrrc zero, mstatus, t0 // clear MSTATUS_MIE bit |
| 147 | + csrrc zero, mstatus, t0 // clear MSTATUS_MIE bit |
147 | 148 | li t0, (MSTATUS_MPP_M | MSTATUS_MPIE ) |
148 | | - csrrs zero, mstatus, t0 // set MSTATUS_MPP, MPIE bit |
| 149 | + csrrs zero, mstatus, t0 // set MSTATUS_MPP, MPIE bit |
149 | 150 | li t0, (MIE_MTIE | MIE_MSIE | MIE_MEIE) |
150 | | - csrrs zero, mie, t0 // set mie |
| 151 | + csrrs zero, mie, t0 // set mie |
151 | 152 | #ifdef __riscv_flen |
152 | 153 | li t0, MSTATUS_FS |
153 | | - csrrs zero, mstatus, t0 // set MSTATUS_FS bit to open f/d isa in riscv |
| 154 | + csrrs zero, mstatus, t0 // set MSTATUS_FS bit to open f/d isa in riscv |
154 | 155 | fscsr x0 |
155 | 156 | #endif |
156 | 157 | addi sp, sp, -8 |
|
0 commit comments