File tree Expand file tree Collapse file tree
components/lwp/arch/risc-v/rv64 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ arch_start_umode:
3535 // load kstack for user process
3636 csrw sscratch, a3
3737 li t0, SSTATUS_SPP | SSTATUS_SIE // set as user mode, close interrupt
38- csrc sstatus, t0
38+ csrc sstatus, t0
3939 li t0, SSTATUS_SPIE // enable interrupt when return to user mode
4040 csrs sstatus, t0
4141
@@ -112,7 +112,7 @@ arch_signal_quit:
112112 mv sp, a0
113113
114114 /* restore user sp before enter trap */
115- addi a0, sp, CTX_REG_NR * REGBYTES
115+ addi a0, sp, CTX_REG_NR * REGBYTES
116116 csrw sscratch, a0
117117
118118
@@ -234,8 +234,7 @@ __restore_sp_from_sscratch: // from kernel
234234 j __move_stack_context
235235
236236__restore_sp_from_tcb: // from user
237- la a0, rt_current_thread
238- LOAD a0, 0 (a0)
237+ jal rt_thread_self
239238 jal get_thread_kernel_stack_top
240239 mv t0, a0
241240
@@ -272,7 +271,7 @@ copy_context_loop:
272271 call syscall_handler
273272 j arch_syscall_exit
274273START_POINT_END(syscall_entry)
275-
274+
276275.global arch_syscall_exit
277276arch_syscall_exit:
278277 CLOSE_INTERRUPT
Original file line number Diff line number Diff line change @@ -196,8 +196,7 @@ contex_ns_load:
196196
197197#if defined (RT_USING_MEM_PROTECTION)
198198 PUSH {r0 - r3 , r12 , lr}
199- LDR r1 , =rt_current_thread
200- LDR r0 , [ r1 ]
199+ BL rt_thread_self
201200 BL rt_hw_mpu_table_switch
202201 POP {r0 - r3 , r12 , lr}
203202#endif
Original file line number Diff line number Diff line change @@ -156,8 +156,7 @@ switch_to_thread:
156156
157157#if defined (RT_USING_MEM_PROTECTION)
158158 PUSH {r0 - r3 , r12 , lr}
159- LDR r1 , =rt_current_thread
160- LDR r0 , [ r1 ]
159+ BL rt_thread_self
161160 BL rt_hw_mpu_table_switch
162161 POP {r0 - r3 , r12 , lr}
163162#endif
Original file line number Diff line number Diff line change 1717rt_hw_context_switch_to:
1818 LOAD sp, (a0)
1919
20- la s0, rt_current_thread
21- LOAD s1, (s0)
20+ jal rt_thread_self
21+ mv s1, a0
2222
2323 #ifdef RT_USING_SMART
24- mv a0, s1
2524 jal lwp_aspace_switch
2625 #endif
2726
@@ -50,11 +49,10 @@ rt_hw_context_switch:
5049 //restore to thread context
5150 LOAD sp, (a1)
5251
53- la s0, rt_current_thread
54- LOAD s1, (s0)
52+ jal rt_thread_self
53+ mv s1, a0
5554
5655 #ifdef RT_USING_SMART
57- mv a0, s1
5856 jal lwp_aspace_switch
5957 #endif
6058
Original file line number Diff line number Diff line change 7575rt_hw_context_switch_to:
7676 LOAD sp, (a0)
7777
78- la s0, rt_current_thread
79- LOAD s1, (s0)
78+ jal rt_thread_self
79+ mv s1, a0
8080
8181 #ifdef RT_USING_SMART
82- mv a0, s1
8382 jal lwp_aspace_switch
8483 #endif
8584
@@ -103,11 +102,10 @@ rt_hw_context_switch:
103102 LOAD sp, (a1)
104103
105104 // restore Address Space
106- la s0, rt_current_thread
107- LOAD s1, (s0)
105+ jal rt_thread_self
106+ mv s1, a0
108107
109108 #ifdef RT_USING_SMART
110- mv a0, s1
111109 jal lwp_aspace_switch
112110 #endif
113111
You can’t perform that action at this time.
0 commit comments