File tree Expand file tree Collapse file tree 5 files changed +14
-21
lines changed
components/lwp/arch/risc-v/rv64 Expand file tree Collapse file tree 5 files changed +14
-21
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ arch_start_umode:
35
35
// load kstack for user process
36
36
csrw sscratch, a3
37
37
li t0, SSTATUS_SPP | SSTATUS_SIE // set as user mode, close interrupt
38
- csrc sstatus, t0
38
+ csrc sstatus, t0
39
39
li t0, SSTATUS_SPIE // enable interrupt when return to user mode
40
40
csrs sstatus, t0
41
41
@@ -112,7 +112,7 @@ arch_signal_quit:
112
112
mv sp, a0
113
113
114
114
/* restore user sp before enter trap */
115
- addi a0, sp, CTX_REG_NR * REGBYTES
115
+ addi a0, sp, CTX_REG_NR * REGBYTES
116
116
csrw sscratch, a0
117
117
118
118
@@ -234,8 +234,7 @@ __restore_sp_from_sscratch: // from kernel
234
234
j __move_stack_context
235
235
236
236
__restore_sp_from_tcb: // from user
237
- la a0, rt_current_thread
238
- LOAD a0, 0 (a0)
237
+ jal rt_thread_self
239
238
jal get_thread_kernel_stack_top
240
239
mv t0, a0
241
240
@@ -272,7 +271,7 @@ copy_context_loop:
272
271
call syscall_handler
273
272
j arch_syscall_exit
274
273
START_POINT_END(syscall_entry)
275
-
274
+
276
275
.global arch_syscall_exit
277
276
arch_syscall_exit:
278
277
CLOSE_INTERRUPT
Original file line number Diff line number Diff line change @@ -196,8 +196,7 @@ contex_ns_load:
196
196
197
197
#if defined (RT_USING_MEM_PROTECTION)
198
198
PUSH {r0 - r3 , r12 , lr}
199
- LDR r1 , =rt_current_thread
200
- LDR r0 , [ r1 ]
199
+ BL rt_thread_self
201
200
BL rt_hw_mpu_table_switch
202
201
POP {r0 - r3 , r12 , lr}
203
202
#endif
Original file line number Diff line number Diff line change @@ -156,8 +156,7 @@ switch_to_thread:
156
156
157
157
#if defined (RT_USING_MEM_PROTECTION)
158
158
PUSH {r0 - r3 , r12 , lr}
159
- LDR r1 , =rt_current_thread
160
- LDR r0 , [ r1 ]
159
+ BL rt_thread_self
161
160
BL rt_hw_mpu_table_switch
162
161
POP {r0 - r3 , r12 , lr}
163
162
#endif
Original file line number Diff line number Diff line change 17
17
rt_hw_context_switch_to:
18
18
LOAD sp, (a0)
19
19
20
- la s0, rt_current_thread
21
- LOAD s1, (s0)
20
+ jal rt_thread_self
21
+ mv s1, a0
22
22
23
23
#ifdef RT_USING_SMART
24
- mv a0, s1
25
24
jal lwp_aspace_switch
26
25
#endif
27
26
@@ -50,11 +49,10 @@ rt_hw_context_switch:
50
49
//restore to thread context
51
50
LOAD sp, (a1)
52
51
53
- la s0, rt_current_thread
54
- LOAD s1, (s0)
52
+ jal rt_thread_self
53
+ mv s1, a0
55
54
56
55
#ifdef RT_USING_SMART
57
- mv a0, s1
58
56
jal lwp_aspace_switch
59
57
#endif
60
58
Original file line number Diff line number Diff line change 75
75
rt_hw_context_switch_to:
76
76
LOAD sp, (a0)
77
77
78
- la s0, rt_current_thread
79
- LOAD s1, (s0)
78
+ jal rt_thread_self
79
+ mv s1, a0
80
80
81
81
#ifdef RT_USING_SMART
82
- mv a0, s1
83
82
jal lwp_aspace_switch
84
83
#endif
85
84
@@ -103,11 +102,10 @@ rt_hw_context_switch:
103
102
LOAD sp, (a1)
104
103
105
104
// restore Address Space
106
- la s0, rt_current_thread
107
- LOAD s1, (s0)
105
+ jal rt_thread_self
106
+ mv s1, a0
108
107
109
108
#ifdef RT_USING_SMART
110
- mv a0, s1
111
109
jal lwp_aspace_switch
112
110
#endif
113
111
You can’t perform that action at this time.
0 commit comments