Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libcpu] discard rt_current_thread #8976

Merged
merged 2 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions components/lwp/arch/risc-v/rv64/lwp_gcc.S
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ arch_start_umode:
// load kstack for user process
csrw sscratch, a3
li t0, SSTATUS_SPP | SSTATUS_SIE // set as user mode, close interrupt
csrc sstatus, t0
csrc sstatus, t0
li t0, SSTATUS_SPIE // enable interrupt when return to user mode
csrs sstatus, t0

Expand Down Expand Up @@ -112,7 +112,7 @@ arch_signal_quit:
mv sp, a0

/* restore user sp before enter trap */
addi a0, sp, CTX_REG_NR * REGBYTES
addi a0, sp, CTX_REG_NR * REGBYTES
csrw sscratch, a0


Expand Down Expand Up @@ -234,8 +234,7 @@ __restore_sp_from_sscratch: // from kernel
j __move_stack_context

__restore_sp_from_tcb: // from user
la a0, rt_current_thread
LOAD a0, 0(a0)
jal rt_thread_self
jal get_thread_kernel_stack_top
mv t0, a0

Expand Down Expand Up @@ -272,7 +271,7 @@ copy_context_loop:
call syscall_handler
j arch_syscall_exit
START_POINT_END(syscall_entry)

.global arch_syscall_exit
arch_syscall_exit:
CLOSE_INTERRUPT
Expand Down
3 changes: 1 addition & 2 deletions libcpu/arm/cortex-m33/context_gcc.S
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ contex_ns_load:

#if defined (RT_USING_MEM_PROTECTION)
PUSH {r0-r3, r12, lr}
LDR r1, =rt_current_thread
LDR r0, [r1]
BL rt_thread_self
BL rt_hw_mpu_table_switch
POP {r0-r3, r12, lr}
#endif
Expand Down
3 changes: 1 addition & 2 deletions libcpu/arm/cortex-m7/context_gcc.S
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ switch_to_thread:

#if defined (RT_USING_MEM_PROTECTION)
PUSH {r0-r3, r12, lr}
LDR r1, =rt_current_thread
LDR r0, [r1]
BL rt_thread_self
BL rt_hw_mpu_table_switch
POP {r0-r3, r12, lr}
#endif
Expand Down
10 changes: 4 additions & 6 deletions libcpu/risc-v/t-head/c906/context_gcc.S
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
rt_hw_context_switch_to:
LOAD sp, (a0)

la s0, rt_current_thread
LOAD s1, (s0)
jal rt_thread_self
mv s1, a0

#ifdef RT_USING_SMART
mv a0, s1
jal lwp_aspace_switch
#endif

Expand Down Expand Up @@ -50,11 +49,10 @@ rt_hw_context_switch:
//restore to thread context
LOAD sp, (a1)

la s0, rt_current_thread
LOAD s1, (s0)
jal rt_thread_self
mv s1, a0

#ifdef RT_USING_SMART
mv a0, s1
jal lwp_aspace_switch
#endif

Expand Down
10 changes: 4 additions & 6 deletions libcpu/risc-v/virt64/context_gcc.S
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@
rt_hw_context_switch_to:
LOAD sp, (a0)

la s0, rt_current_thread
LOAD s1, (s0)
jal rt_thread_self
mv s1, a0

#ifdef RT_USING_SMART
mv a0, s1
jal lwp_aspace_switch
#endif

Expand All @@ -103,11 +102,10 @@ rt_hw_context_switch:
LOAD sp, (a1)

// restore Address Space
la s0, rt_current_thread
LOAD s1, (s0)
jal rt_thread_self
mv s1, a0

#ifdef RT_USING_SMART
mv a0, s1
jal lwp_aspace_switch
#endif

Expand Down