Skip to content

Commit

Permalink
riscv/kstack: Remove riscv_current_ksp as obsolete
Browse files Browse the repository at this point in the history
Unwinding the kernel stack did not work previously due to the way the task
startup logic works via nxtask_start and the up_task_start() system call.

After modifying the logic behind those, the kernel stack is in fact fully
unwound when return_from_exception is executed, so calling the original
hack "riscv_current_ksp" is not necessary anymore.
  • Loading branch information
pussuw committed Oct 3, 2024
1 parent c6cca9c commit b72d053
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 42 deletions.
2 changes: 1 addition & 1 deletion arch/risc-v/src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if(CONFIG_ARCH_USE_MMU)
endif()

if(CONFIG_ARCH_KERNEL_STACK)
list(APPEND SRCS riscv_addrenv_kstack.c riscv_ksp.c)
list(APPEND SRCS riscv_addrenv_kstack.c)
endif()

if(CONFIG_ARCH_ADDRENV)
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/common/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ CMN_CSRCS += riscv_mmu.c
endif

ifeq ($(CONFIG_ARCH_KERNEL_STACK),y)
CMN_CSRCS += riscv_addrenv_kstack.c riscv_ksp.c
CMN_CSRCS += riscv_addrenv_kstack.c
endif

ifeq ($(CONFIG_ARCH_ADDRENV),y)
Expand Down
4 changes: 2 additions & 2 deletions arch/risc-v/src/common/riscv_exception_common.S
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ return_from_exception:
and s0, s0, s1
bnez s0, 1f

/* Set the next task's kernel stack to the scratch area */
/* Set the unwound kernel stack to the scratch area */

jal x1, riscv_current_ksp
addi a0, sp, XCPTCONTEXT_SIZE
csrr s0, CSR_SCRATCH
REGSTORE a0, RISCV_PERCPU_KSP(s0)

Expand Down
38 changes: 0 additions & 38 deletions arch/risc-v/src/common/riscv_ksp.c

This file was deleted.

0 comments on commit b72d053

Please sign in to comment.