riscv/kstack: Remove riscv_current_ksp as obsolete

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.
This commit is contained in:
Ville Juven 2024-10-03 12:28:44 +03:00 committed by Xiang Xiao
parent 190a2e306c
commit 0976258299
4 changed files with 4 additions and 42 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -1,38 +0,0 @@
/****************************************************************************
* arch/risc-v/src/common/riscv_ksp.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
/****************************************************************************
* Public Functions
****************************************************************************/
uintptr_t riscv_current_ksp(void)
{
return (uintptr_t)this_task()->xcp.kstkptr;
}