From c0a0de97ce99c58a64fcfc968d816bf7eb4cd17f Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Tue, 25 Jan 2022 17:22:17 +0800 Subject: [PATCH] Revert "libc: Call pthread_exit in user-space by up_pthread_exit" This reverts commit f4a0b7aedd01ac3f39a88d62dbafaf367ae399f2. Signed-off-by: Huang Qi --- arch/arm/src/a1x/Make.defs | 1 - arch/arm/src/am335x/Make.defs | 1 - arch/arm/src/armv6-m/arm_svcall.c | 43 ++---------- arch/arm/src/armv6-m/svcall.h | 6 +- arch/arm/src/armv7-a/arm_syscall.c | 43 ++++-------- arch/arm/src/armv7-a/svcall.h | 11 +--- arch/arm/src/armv7-m/arm_svcall.c | 41 ++---------- arch/arm/src/armv7-m/svcall.h | 13 +--- arch/arm/src/armv7-r/arm_syscall.c | 47 +++++-------- arch/arm/src/armv8-m/arm_svcall.c | 43 ++---------- arch/arm/src/common/arm_pthread_exit.c | 66 ------------------- arch/arm/src/cxd56xx/Make.defs | 1 - arch/arm/src/efm32/Make.defs | 1 - arch/arm/src/eoss3/Make.defs | 1 - arch/arm/src/imx6/Make.defs | 1 - arch/arm/src/imxrt/Make.defs | 1 - arch/arm/src/kinetis/Make.defs | 1 - arch/arm/src/kl/Make.defs | 1 - arch/arm/src/lc823450/Make.defs | 1 - arch/arm/src/lpc17xx_40xx/Make.defs | 1 - arch/arm/src/lpc43xx/Make.defs | 1 - arch/arm/src/lpc54xx/Make.defs | 1 - arch/arm/src/max326xx/Make.defs | 1 - arch/arm/src/nrf52/Make.defs | 1 - arch/arm/src/nuc1xx/Make.defs | 1 - arch/arm/src/rp2040/Make.defs | 1 - arch/arm/src/s32k1xx/Make.defs | 1 - arch/arm/src/sam34/Make.defs | 1 - arch/arm/src/sama5/Make.defs | 1 - arch/arm/src/samd2l2/Make.defs | 1 - arch/arm/src/samd5e5/Make.defs | 1 - arch/arm/src/samv7/Make.defs | 1 - arch/arm/src/stm32/Make.defs | 2 +- arch/arm/src/stm32f0l0g0/Make.defs | 1 - arch/arm/src/stm32f7/Make.defs | 1 - arch/arm/src/stm32h7/Make.defs | 1 - arch/arm/src/stm32l4/Make.defs | 1 - arch/arm/src/stm32l5/Make.defs | 1 - arch/arm/src/tiva/Make.defs | 1 - arch/arm/src/tms570/Make.defs | 1 - arch/arm/src/xmc4/Make.defs | 1 - arch/or1k/src/common/up_pthread_start.c | 2 +- arch/risc-v/src/c906/Make.defs | 1 - arch/risc-v/src/common/riscv_pthread_exit.c | 64 ------------------ arch/risc-v/src/common/riscv_swint.c | 45 ++----------- arch/risc-v/src/common/svcall.h | 15 ++--- arch/risc-v/src/k210/Make.defs | 3 +- .../imxrt1050-evk/configs/knsh/defconfig | 2 +- .../imxrt1060-evk/configs/knsh/defconfig | 2 +- .../imxrt1064-evk/configs/knsh/defconfig | 2 +- .../lc823450-xgevk/configs/knsh/defconfig | 2 +- .../lc823450-xgevk/configs/kostest/defconfig | 2 +- .../lc823450-xgevk/configs/krndis/defconfig | 2 +- .../lpc4088-devkit/configs/knsh/defconfig | 2 +- .../lpc4088-quickstart/configs/knsh/defconfig | 2 +- .../open1788/configs/knsh/defconfig | 2 +- .../open1788/configs/knxterm/defconfig | 2 +- .../pnev5180b/configs/knsh/defconfig | 2 +- .../bambino-200e/configs/knsh/defconfig | 2 +- .../arm/sam34/sam3u-ek/configs/knsh/defconfig | 2 +- .../sama5/sama5d4-ek/configs/knsh/defconfig | 2 +- .../samv7/samv71-xult/configs/knsh/defconfig | 4 +- .../clicker2-stm32/configs/knsh/defconfig | 2 +- .../mikroe-stm32f4/configs/kostest/defconfig | 2 +- .../olimex-stm32-p407/configs/kelf/defconfig | 2 +- .../configs/kmodule/defconfig | 2 +- .../olimex-stm32-p407/configs/knsh/defconfig | 2 +- .../stm3240g-eval/configs/knxwm/defconfig | 2 +- .../configs/kostest/defconfig | 2 +- .../stm32l476vg-disco/configs/knsh/defconfig | 2 +- .../stm32l4r9ai-disco/configs/knsh/defconfig | 2 +- .../configs/qemu-protected/defconfig | 2 +- .../c906/smartl-c906/configs/knsh/defconfig | 2 +- .../k210/maix-bit/configs/knsh/defconfig | 2 +- .../k210/maix-bit/configs/knsh_smp/defconfig | 2 +- .../k210/maix-bit/configs/kostest/defconfig | 2 +- include/nuttx/arch.h | 23 +------ include/nuttx/pthread.h | 4 +- include/nuttx/sched.h | 4 +- include/pthread.h | 2 - include/sys/syscall_lookup.h | 2 +- libs/libc/pthread/pthread_create.c | 2 +- sched/pthread/pthread_cancel.c | 10 --- sched/pthread/pthread_create.c | 19 ++---- sched/signal/sig_default.c | 10 +-- sched/task/task_cancelpt.c | 17 ----- sched/task/task_setcancelstate.c | 8 --- sched/task/task_setcanceltype.c | 10 +-- syscall/syscall.csv | 2 +- 89 files changed, 112 insertions(+), 537 deletions(-) delete mode 100644 arch/arm/src/common/arm_pthread_exit.c delete mode 100644 arch/risc-v/src/common/riscv_pthread_exit.c diff --git a/arch/arm/src/a1x/Make.defs b/arch/arm/src/a1x/Make.defs index 924c970a43..ab1b1b5a27 100644 --- a/arch/arm/src/a1x/Make.defs +++ b/arch/arm/src/a1x/Make.defs @@ -78,7 +78,6 @@ endif ifeq ($(CONFIG_BUILD_KERNEL),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c arm_signal_dispatch.c -CMN_CSRCS += arm_pthread_exit.c endif ifeq ($(CONFIG_ARCH_ADDRENV),y) diff --git a/arch/arm/src/am335x/Make.defs b/arch/arm/src/am335x/Make.defs index 3d7662390b..e1f46199d3 100644 --- a/arch/arm/src/am335x/Make.defs +++ b/arch/arm/src/am335x/Make.defs @@ -74,7 +74,6 @@ endif ifeq ($(CONFIG_BUILD_KERNEL),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c arm_signal_dispatch.c -CMN_CSRCS += arm_pthread_exit.c endif ifeq ($(CONFIG_ARCH_ADDRENV),y) diff --git a/arch/arm/src/armv6-m/arm_svcall.c b/arch/arm/src/armv6-m/arm_svcall.c index 6517b4c0f1..0339cccd13 100644 --- a/arch/arm/src/armv6-m/arm_svcall.c +++ b/arch/arm/src/armv6-m/arm_svcall.c @@ -298,28 +298,26 @@ int arm_svcall(int irq, FAR void *context, FAR void *arg) break; #endif -#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) - /* R0=SYS_pthread_start: This a user pthread start * - * void up_pthread_start(pthread_trampoline_t startup, - * pthread_startroutine_t entrypt, pthread_addr_t arg) + * void up_pthread_start(pthread_startroutine_t entrypt, + * pthread_addr_t arg) noreturn_function; * * At this point, the following values are saved in context: * * R0 = SYS_pthread_start - * R1 = startup - * R2 = entrypt - * R3 = arg + * R1 = entrypt + * R2 = arg */ +#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* Set up to return to the user-space pthread start-up function in * unprivileged mode. */ - regs[REG_PC] = (uint32_t)regs[REG_R1] & ~1; /* startup */ + regs[REG_PC] = (uint32_t)regs[REG_R1]; /* startup */ regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; /* Change the parameter ordering to match the expectation of the @@ -330,35 +328,6 @@ int arm_svcall(int irq, FAR void *context, FAR void *arg) regs[REG_R1] = regs[REG_R3]; /* arg */ } break; - - /* R0=SYS_pthread_exit: This pthread_exit call in user-space - * - * void up_pthread_exit(pthread_exitroutine_t exit, - * FAR void *exit_value) - * - * At this point, the following values are saved in context: - * - * R0 = SYS_pthread_exit - * R1 = pthread_exit trampoline routine - * R2 = exit_value - */ - - case SYS_pthread_exit: - { - /* Set up to return to the user-space pthread start-up function in - * unprivileged mode. - */ - - regs[REG_PC] = (uint32_t)regs[REG_R1] & ~1; /* startup */ - regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; - - /* Change the parameter ordering to match the expectation of the - * user space pthread_startup: - */ - - regs[REG_R0] = regs[REG_R2]; /* exit_value */ - } - break; #endif /* R0=SYS_signal_handler: This a user signal handler callback diff --git a/arch/arm/src/armv6-m/svcall.h b/arch/arm/src/armv6-m/svcall.h index 0b0f8d7cd8..a790f58d4d 100644 --- a/arch/arm/src/armv6-m/svcall.h +++ b/arch/arm/src/armv6-m/svcall.h @@ -45,9 +45,9 @@ #ifdef CONFIG_LIB_SYSCALL # ifdef CONFIG_BUILD_PROTECTED # ifndef CONFIG_SYS_RESERVED -# error "CONFIG_SYS_RESERVED must be defined to have the value 9" -# elif CONFIG_SYS_RESERVED != 9 -# error "CONFIG_SYS_RESERVED must have the value 9" +# error "CONFIG_SYS_RESERVED must be defined to have the value 8" +# elif CONFIG_SYS_RESERVED != 8 +# error "CONFIG_SYS_RESERVED must have the value 8" # endif # else # ifndef CONFIG_SYS_RESERVED diff --git a/arch/arm/src/armv7-a/arm_syscall.c b/arch/arm/src/armv7-a/arm_syscall.c index d38a8e794a..5e61aa456b 100644 --- a/arch/arm/src/armv7-a/arm_syscall.c +++ b/arch/arm/src/armv7-a/arm_syscall.c @@ -278,23 +278,30 @@ uint32_t *arm_syscall(uint32_t *regs) break; #endif -#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) - /* R0=SYS_pthread_start: This a user pthread start * - * void up_pthread_start(pthread_trampoline_t startup, - * pthread_startroutine_t entrypt, pthread_addr_t arg) + * void up_pthread_start(pthread_startroutine_t entrypt, + * pthread_addr_t arg) noreturn_function; * * At this point, the following values are saved in context: * * R0 = SYS_pthread_start - * R1 = startup - * R2 = entrypt - * R3 = arg + * R1 = entrypt + * R2 = arg */ +#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { + /* Set up to enter the user-space pthread start-up function in + * unprivileged mode. We need: + * + * R0 = entrypt + * R1 = arg + * PC = startup + * CSPR = user mode + */ + regs[REG_PC] = regs[REG_R0]; regs[REG_R0] = regs[REG_R1]; regs[REG_R1] = regs[REG_R2]; @@ -303,28 +310,6 @@ uint32_t *arm_syscall(uint32_t *regs) regs[REG_CPSR] = cpsr | PSR_MODE_USR; } break; - - /* R0=SYS_pthread_exit: This pthread_exit call in user-space - * - * void up_pthread_exit(pthread_exitroutine_t exit, - * FAR void *exit_value) - * - * At this point, the following values are saved in context: - * - * R0 = SYS_pthread_exit - * R1 = pthread_exit trampoline routine - * R2 = exit_value - */ - - case SYS_pthread_exit: - { - regs[REG_PC] = regs[REG_R0]; - regs[REG_R0] = regs[REG_R1]; - - cpsr = regs[REG_CPSR] & ~PSR_MODE_MASK; - regs[REG_CPSR] = cpsr | PSR_MODE_USR; - } - break; #endif #ifdef CONFIG_BUILD_KERNEL diff --git a/arch/arm/src/armv7-a/svcall.h b/arch/arm/src/armv7-a/svcall.h index d22fde1c87..27dc875510 100644 --- a/arch/arm/src/armv7-a/svcall.h +++ b/arch/arm/src/armv7-a/svcall.h @@ -44,8 +44,8 @@ #ifdef CONFIG_BUILD_KERNEL # ifndef CONFIG_SYS_RESERVED -# error "CONFIG_SYS_RESERVED must be defined to have the value 7" -# elif CONFIG_SYS_RESERVED != 7 +# error "CONFIG_SYS_RESERVED must be defined to have the value 6" +# elif CONFIG_SYS_RESERVED != 6 # error "CONFIG_SYS_RESERVED must have the value 6" # endif #else @@ -109,13 +109,6 @@ #define SYS_pthread_start (3) -/* SYS call 8: - * - * void up_pthread_exit(pthread_exitroutine_t exit, FAR void *exit_value) - */ - -#define SYS_pthread_exit (6) - #endif /* CONFIG_BUILD_KERNEL */ /**************************************************************************** diff --git a/arch/arm/src/armv7-m/arm_svcall.c b/arch/arm/src/armv7-m/arm_svcall.c index ca38d1b60a..6119ee6297 100644 --- a/arch/arm/src/armv7-m/arm_svcall.c +++ b/arch/arm/src/armv7-m/arm_svcall.c @@ -312,21 +312,19 @@ int arm_svcall(int irq, FAR void *context, FAR void *arg) break; #endif -#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) - /* R0=SYS_pthread_start: This a user pthread start * - * void up_pthread_start(pthread_trampoline_t startup, - * pthread_startroutine_t entrypt, pthread_addr_t arg) + * void up_pthread_start(pthread_startroutine_t entrypt, + * pthread_addr_t arg) noreturn_function; * * At this point, the following values are saved in context: * * R0 = SYS_pthread_start - * R1 = startup - * R2 = entrypt - * R3 = arg + * R1 = entrypt + * R2 = arg */ +#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* Set up to return to the user-space pthread start-up function in @@ -344,35 +342,6 @@ int arm_svcall(int irq, FAR void *context, FAR void *arg) regs[REG_R1] = regs[REG_R3]; /* arg */ } break; - - /* R0=SYS_pthread_exit: This pthread_exit call in user-space - * - * void up_pthread_exit(pthread_exitroutine_t exit, - * FAR void *exit_value) - * - * At this point, the following values are saved in context: - * - * R0 = SYS_pthread_exit - * R1 = pthread_exit trampoline routine - * R2 = exit_value - */ - - case SYS_pthread_exit: - { - /* Set up to return to the user-space pthread start-up function in - * unprivileged mode. - */ - - regs[REG_PC] = (uint32_t)regs[REG_R1] & ~1; /* startup */ - regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; - - /* Change the parameter ordering to match the expectation of the - * user space pthread_startup: - */ - - regs[REG_R0] = regs[REG_R2]; /* exit_value */ - } - break; #endif /* R0=SYS_signal_handler: This a user signal handler callback diff --git a/arch/arm/src/armv7-m/svcall.h b/arch/arm/src/armv7-m/svcall.h index 1fd56ea4c4..98a574e870 100644 --- a/arch/arm/src/armv7-m/svcall.h +++ b/arch/arm/src/armv7-m/svcall.h @@ -45,9 +45,9 @@ #ifdef CONFIG_LIB_SYSCALL # ifdef CONFIG_BUILD_PROTECTED # ifndef CONFIG_SYS_RESERVED -# error "CONFIG_SYS_RESERVED must be defined to have the value 9" -# elif CONFIG_SYS_RESERVED != 9 -# error "CONFIG_SYS_RESERVED must have the value 9" +# error "CONFIG_SYS_RESERVED must be defined to have the value 8" +# elif CONFIG_SYS_RESERVED != 8 +# error "CONFIG_SYS_RESERVED must have the value 8" # endif # else # ifndef CONFIG_SYS_RESERVED @@ -126,13 +126,6 @@ #define SYS_pthread_start (5) -/* SYS call 8: - * - * void up_pthread_exit(pthread_exitroutine_t exit, FAR void *exit_value) - */ - -#define SYS_pthread_exit (8) - #endif /* !CONFIG_BUILD_FLAT */ #endif /* CONFIG_LIB_SYSCALL */ diff --git a/arch/arm/src/armv7-r/arm_syscall.c b/arch/arm/src/armv7-r/arm_syscall.c index dde0ac415b..32b48b25c8 100644 --- a/arch/arm/src/armv7-r/arm_syscall.c +++ b/arch/arm/src/armv7-r/arm_syscall.c @@ -273,48 +273,33 @@ uint32_t *arm_syscall(uint32_t *regs) break; #endif -#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) - /* R0=SYS_pthread_start: This a user pthread start * - * void up_pthread_start(pthread_trampoline_t startup, - * pthread_startroutine_t entrypt, pthread_addr_t arg) + * void up_pthread_start(pthread_startroutine_t entrypt, + * pthread_addr_t arg) noreturn_function; * * At this point, the following values are saved in context: * * R0 = SYS_pthread_start - * R1 = startup - * R2 = entrypt - * R3 = arg + * R1 = entrypt + * R2 = arg */ +#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { - regs[REG_PC] = regs[REG_R0]; - regs[REG_R0] = regs[REG_R1]; - regs[REG_R1] = regs[REG_R2]; + /* Set up to enter the user-space pthread start-up function in + * unprivileged mode. We need: + * + * R0 = startup + * R1 = arg + * PC = entrypt + * CSPR = user mode + */ - cpsr = regs[REG_CPSR] & ~PSR_MODE_MASK; - regs[REG_CPSR] = cpsr | PSR_MODE_USR; - } - break; - - /* R0=SYS_pthread_exit: This pthread_exit call in user-space - * - * void up_pthread_exit(pthread_exitroutine_t exit, - * FAR void *exit_value) - * - * At this point, the following values are saved in context: - * - * R0 = SYS_pthread_exit - * R1 = pthread_exit trampoline routine - * R2 = exit_value - */ - - case SYS_pthread_exit: - { - regs[REG_PC] = regs[REG_R0]; - regs[REG_R0] = regs[REG_R1]; + regs[REG_PC] = regs[REG_R1]; + regs[REG_R0] = regs[REG_R2]; + regs[REG_R1] = regs[REG_R3]; cpsr = regs[REG_CPSR] & ~PSR_MODE_MASK; regs[REG_CPSR] = cpsr | PSR_MODE_USR; diff --git a/arch/arm/src/armv8-m/arm_svcall.c b/arch/arm/src/armv8-m/arm_svcall.c index 4f57fb3027..f0757c7712 100644 --- a/arch/arm/src/armv8-m/arm_svcall.c +++ b/arch/arm/src/armv8-m/arm_svcall.c @@ -311,21 +311,19 @@ int arm_svcall(int irq, FAR void *context, FAR void *arg) break; #endif -#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) - /* R0=SYS_pthread_start: This a user pthread start * - * void up_pthread_start(pthread_trampoline_t startup, - * pthread_startroutine_t entrypt, pthread_addr_t arg) + * void up_pthread_start(pthread_startroutine_t entrypt, + * pthread_addr_t arg) noreturn_function; * * At this point, the following values are saved in context: * * R0 = SYS_pthread_start - * R1 = startup - * R2 = entrypt - * R3 = arg + * R1 = entrypt + * R2 = arg */ +#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* Set up to return to the user-space pthread start-up function in @@ -340,36 +338,7 @@ int arm_svcall(int irq, FAR void *context, FAR void *arg) */ regs[REG_R0] = regs[REG_R2]; /* pthread entry */ - regs[REG_R1] = regs[REG_R3]; /* arg */ - } - break; - - /* R0=SYS_pthread_exit: This pthread_exit call in user-space - * - * void up_pthread_exit(pthread_exitroutine_t exit, - * FAR void *exit_value) - * - * At this point, the following values are saved in context: - * - * R0 = SYS_pthread_exit - * R1 = pthread_exit trampoline routine - * R2 = exit_value - */ - - case SYS_pthread_exit: - { - /* Set up to return to the user-space pthread start-up function in - * unprivileged mode. - */ - - regs[REG_PC] = (uint32_t)regs[REG_R1] & ~1; /* startup */ - regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; - - /* Change the parameter ordering to match the expectation of the - * user space pthread_startup: - */ - - regs[REG_R0] = regs[REG_R2]; /* exit_value */ + regs[REG_R1] = regs[REG_R2]; /* arg */ } break; #endif diff --git a/arch/arm/src/common/arm_pthread_exit.c b/arch/arm/src/common/arm_pthread_exit.c deleted file mode 100644 index 22e2fbdf25..0000000000 --- a/arch/arm/src/common/arm_pthread_exit.c +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** - * arch/arm/src/common/arm_pthread_exit.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 -#include -#include - -#include "svcall.h" -#include "arm_internal.h" - -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \ - !defined(CONFIG_DISABLE_PTHREAD) - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_pthread_exit - * - * Description: - * In this kernel mode build, this function will be called to execute a - * pthread in user-space. This kernel-mode stub will then be called - * transfer control to the user-mode pthread_exit. - * - * Input Parameters: - * exit - The user-space pthread_exit function - * exit_value - The pointer of the pthread exit parameter - * - * Returned Value: - * None - ****************************************************************************/ - -void up_pthread_exit(pthread_exitroutine_t exit, FAR void *exit_value) -{ - /* Let sys_call2() do all of the work */ - - sys_call2(SYS_pthread_exit, (uintptr_t)exit, (uintptr_t)exit_value); - - /* Suppress "'noreturn' function does return" warning */ - - while (1); -} - -#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ && !CONFIG_DISABLE_PTHREAD */ diff --git a/arch/arm/src/cxd56xx/Make.defs b/arch/arm/src/cxd56xx/Make.defs index 351477cdd3..097f18939f 100644 --- a/arch/arm/src/cxd56xx/Make.defs +++ b/arch/arm/src/cxd56xx/Make.defs @@ -51,7 +51,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_mpu.c arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/efm32/Make.defs b/arch/arm/src/efm32/Make.defs index 55e6d6ed35..987e2a472d 100644 --- a/arch/arm/src/efm32/Make.defs +++ b/arch/arm/src/efm32/Make.defs @@ -44,7 +44,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_mpu.c arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/eoss3/Make.defs b/arch/arm/src/eoss3/Make.defs index d17309d51b..b183722d96 100644 --- a/arch/arm/src/eoss3/Make.defs +++ b/arch/arm/src/eoss3/Make.defs @@ -44,7 +44,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/imx6/Make.defs b/arch/arm/src/imx6/Make.defs index 207fcb93c5..e0062a21f7 100644 --- a/arch/arm/src/imx6/Make.defs +++ b/arch/arm/src/imx6/Make.defs @@ -94,7 +94,6 @@ endif ifeq ($(CONFIG_BUILD_KERNEL),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c arm_signal_dispatch.c -CMN_CSRCS += arm_pthread_exit.c endif ifeq ($(CONFIG_ARCH_ADDRENV),y) diff --git a/arch/arm/src/imxrt/Make.defs b/arch/arm/src/imxrt/Make.defs index 70c1bc2a97..398ba1a313 100644 --- a/arch/arm/src/imxrt/Make.defs +++ b/arch/arm/src/imxrt/Make.defs @@ -56,7 +56,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/kinetis/Make.defs b/arch/arm/src/kinetis/Make.defs index e799856c7b..5336b84356 100644 --- a/arch/arm/src/kinetis/Make.defs +++ b/arch/arm/src/kinetis/Make.defs @@ -51,7 +51,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/kl/Make.defs b/arch/arm/src/kl/Make.defs index 9a88724b36..c99f902fb1 100644 --- a/arch/arm/src/kl/Make.defs +++ b/arch/arm/src/kl/Make.defs @@ -33,7 +33,6 @@ CMN_CSRCS += arm_switchcontext.c ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/lc823450/Make.defs b/arch/arm/src/lc823450/Make.defs index f0ba8bda40..962d7119cd 100644 --- a/arch/arm/src/lc823450/Make.defs +++ b/arch/arm/src/lc823450/Make.defs @@ -43,7 +43,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/lpc17xx_40xx/Make.defs b/arch/arm/src/lpc17xx_40xx/Make.defs index 41236ba664..deabc2fa04 100644 --- a/arch/arm/src/lpc17xx_40xx/Make.defs +++ b/arch/arm/src/lpc17xx_40xx/Make.defs @@ -54,7 +54,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/lpc43xx/Make.defs b/arch/arm/src/lpc43xx/Make.defs index 8db0e728ad..73d0c74bd9 100644 --- a/arch/arm/src/lpc43xx/Make.defs +++ b/arch/arm/src/lpc43xx/Make.defs @@ -47,7 +47,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/lpc54xx/Make.defs b/arch/arm/src/lpc54xx/Make.defs index 154243f2de..e901d21b15 100644 --- a/arch/arm/src/lpc54xx/Make.defs +++ b/arch/arm/src/lpc54xx/Make.defs @@ -47,7 +47,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/max326xx/Make.defs b/arch/arm/src/max326xx/Make.defs index 1b3545a764..dc0e238acd 100644 --- a/arch/arm/src/max326xx/Make.defs +++ b/arch/arm/src/max326xx/Make.defs @@ -46,7 +46,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_mpu.c arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/nrf52/Make.defs b/arch/arm/src/nrf52/Make.defs index 603819d220..de4bdbcb81 100644 --- a/arch/arm/src/nrf52/Make.defs +++ b/arch/arm/src/nrf52/Make.defs @@ -52,7 +52,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_mpu.c arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/nuc1xx/Make.defs b/arch/arm/src/nuc1xx/Make.defs index ab53a2ec80..f8492ac84c 100644 --- a/arch/arm/src/nuc1xx/Make.defs +++ b/arch/arm/src/nuc1xx/Make.defs @@ -33,7 +33,6 @@ CMN_CSRCS += arm_switchcontext.c arm_puts.c ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/rp2040/Make.defs b/arch/arm/src/rp2040/Make.defs index 9ad3929709..9fe6bf3410 100644 --- a/arch/arm/src/rp2040/Make.defs +++ b/arch/arm/src/rp2040/Make.defs @@ -37,7 +37,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/s32k1xx/Make.defs b/arch/arm/src/s32k1xx/Make.defs index 06e3fa112e..47ab3981e5 100644 --- a/arch/arm/src/s32k1xx/Make.defs +++ b/arch/arm/src/s32k1xx/Make.defs @@ -31,7 +31,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c endif # Source files common to all S32K1xx chip families. diff --git a/arch/arm/src/sam34/Make.defs b/arch/arm/src/sam34/Make.defs index 55c8012a30..2628a45e96 100644 --- a/arch/arm/src/sam34/Make.defs +++ b/arch/arm/src/sam34/Make.defs @@ -59,7 +59,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/sama5/Make.defs b/arch/arm/src/sama5/Make.defs index 74c5704ae4..2bbc835de0 100644 --- a/arch/arm/src/sama5/Make.defs +++ b/arch/arm/src/sama5/Make.defs @@ -80,7 +80,6 @@ endif ifeq ($(CONFIG_BUILD_KERNEL),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c arm_signal_dispatch.c -CMN_CSRCS += arm_pthread_exit.c endif ifeq ($(CONFIG_ARCH_ADDRENV),y) diff --git a/arch/arm/src/samd2l2/Make.defs b/arch/arm/src/samd2l2/Make.defs index 0d5558f0a2..8695218c14 100644 --- a/arch/arm/src/samd2l2/Make.defs +++ b/arch/arm/src/samd2l2/Make.defs @@ -33,7 +33,6 @@ CMN_CSRCS += arm_switchcontext.c arm_puts.c ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/samd5e5/Make.defs b/arch/arm/src/samd5e5/Make.defs index f55e157dff..27f7ae84e1 100644 --- a/arch/arm/src/samd5e5/Make.defs +++ b/arch/arm/src/samd5e5/Make.defs @@ -49,7 +49,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_mpu.c arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/samv7/Make.defs b/arch/arm/src/samv7/Make.defs index eb0831bd31..f549a48719 100644 --- a/arch/arm/src/samv7/Make.defs +++ b/arch/arm/src/samv7/Make.defs @@ -67,7 +67,6 @@ ifeq ($(CONFIG_ARM_MPU),y) CMN_CSRCS += arm_mpu.c ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/stm32/Make.defs b/arch/arm/src/stm32/Make.defs index e48453696c..468b2bfa71 100644 --- a/arch/arm/src/stm32/Make.defs +++ b/arch/arm/src/stm32/Make.defs @@ -54,7 +54,7 @@ CMN_CSRCS += arm_mpu.c endif ifeq ($(CONFIG_BUILD_PROTECTED),y) -CMN_CSRCS += arm_task_start.c arm_pthread_start.c arm_pthread_exit.c +CMN_CSRCS += arm_task_start.c arm_pthread_start.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/stm32f0l0g0/Make.defs b/arch/arm/src/stm32f0l0g0/Make.defs index 04da3dce8a..07efcf61e8 100644 --- a/arch/arm/src/stm32f0l0g0/Make.defs +++ b/arch/arm/src/stm32f0l0g0/Make.defs @@ -33,7 +33,6 @@ CMN_CSRCS += arm_switchcontext.c ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/stm32f7/Make.defs b/arch/arm/src/stm32f7/Make.defs index 5ed5c2ff2f..72122f1c98 100644 --- a/arch/arm/src/stm32f7/Make.defs +++ b/arch/arm/src/stm32f7/Make.defs @@ -73,7 +73,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/stm32h7/Make.defs b/arch/arm/src/stm32h7/Make.defs index b10ff694db..4c12448f9a 100644 --- a/arch/arm/src/stm32h7/Make.defs +++ b/arch/arm/src/stm32h7/Make.defs @@ -72,7 +72,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/stm32l4/Make.defs b/arch/arm/src/stm32l4/Make.defs index 42c3a74e71..88c50cafde 100644 --- a/arch/arm/src/stm32l4/Make.defs +++ b/arch/arm/src/stm32l4/Make.defs @@ -64,7 +64,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/stm32l5/Make.defs b/arch/arm/src/stm32l5/Make.defs index a87fd6db07..452f643d9b 100644 --- a/arch/arm/src/stm32l5/Make.defs +++ b/arch/arm/src/stm32l5/Make.defs @@ -65,7 +65,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_mpu.c arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/tiva/Make.defs b/arch/arm/src/tiva/Make.defs index 3ae3f77cdf..cc1d931fbd 100644 --- a/arch/arm/src/tiva/Make.defs +++ b/arch/arm/src/tiva/Make.defs @@ -65,7 +65,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c - CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S else diff --git a/arch/arm/src/tms570/Make.defs b/arch/arm/src/tms570/Make.defs index b587b7c129..b289b86f26 100644 --- a/arch/arm/src/tms570/Make.defs +++ b/arch/arm/src/tms570/Make.defs @@ -60,7 +60,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_mpu.c arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/arm/src/xmc4/Make.defs b/arch/arm/src/xmc4/Make.defs index bf02e9e99c..ca64e24192 100644 --- a/arch/arm/src/xmc4/Make.defs +++ b/arch/arm/src/xmc4/Make.defs @@ -51,7 +51,6 @@ endif ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += arm_task_start.c arm_pthread_start.c -CMN_CSRCS += arm_pthread_exit.c CMN_CSRCS += arm_signal_dispatch.c CMN_UASRCS += arm_signal_handler.S endif diff --git a/arch/or1k/src/common/up_pthread_start.c b/arch/or1k/src/common/up_pthread_start.c index 31a8541740..77481ec14b 100644 --- a/arch/or1k/src/common/up_pthread_start.c +++ b/arch/or1k/src/common/up_pthread_start.c @@ -64,7 +64,7 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) { - /* Let sys_call3() do all of the work */ + /* Let sys_call2() do all of the work */ sinfo("entry %p arg %p\n", entrypt, arg); diff --git a/arch/risc-v/src/c906/Make.defs b/arch/risc-v/src/c906/Make.defs index 3b47ac3954..f2a982e447 100644 --- a/arch/risc-v/src/c906/Make.defs +++ b/arch/risc-v/src/c906/Make.defs @@ -59,7 +59,6 @@ CHIP_CSRCS += c906_start.c c906_timerisr.c ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += riscv_task_start.c riscv_pthread_start.c -CMN_CSRCS += riscv_pthread_exit.c CMN_CSRCS += riscv_signal_dispatch.c riscv_pmp.c CMN_UASRCS += riscv_signal_handler.S diff --git a/arch/risc-v/src/common/riscv_pthread_exit.c b/arch/risc-v/src/common/riscv_pthread_exit.c deleted file mode 100644 index 11348d991d..0000000000 --- a/arch/risc-v/src/common/riscv_pthread_exit.c +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** - * arch/risc-v/src/common/riscv_pthread_exit.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 -#include -#include - -#include "svcall.h" -#include "riscv_internal.h" - -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \ - !defined(CONFIG_DISABLE_PTHREAD) - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_pthread_exit - * - * Description: - * In this kernel mode build, this function will be called to execute a - * pthread in user-space. This kernel-mode stub will then be called - * transfer control to the user-mode pthread_exit. - * - * Input Parameters: - * exit - The user-space pthread_exit function - * exit_value - The pointer of the pthread exit parameter - * - * Returned Value: - * None - ****************************************************************************/ - -void up_pthread_exit(pthread_exitroutine_t exit, void *exit_value) -{ - sys_call2(SYS_pthread_exit, (uintptr_t)exit, (uintptr_t)exit_value); - - /* Suppress "'noreturn' function does return" warning */ - - while (1); -} - -#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ && !CONFIG_DISABLE_PTHREAD */ diff --git a/arch/risc-v/src/common/riscv_swint.c b/arch/risc-v/src/common/riscv_swint.c index 7d507e1674..de174f6a67 100644 --- a/arch/risc-v/src/common/riscv_swint.c +++ b/arch/risc-v/src/common/riscv_swint.c @@ -311,21 +311,19 @@ int riscv_swint(int irq, void *context, void *arg) break; #endif -#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) - - /* A0=SYS_pthread_start: This a user pthread start + /* R0=SYS_pthread_start: This a user pthread start * - * void up_pthread_start(pthread_trampoline_t startup, - * pthread_startroutine_t entrypt, pthread_addr_t arg) + * void up_pthread_start(pthread_startroutine_t entrypt, + * pthread_addr_t arg) noreturn_function; * * At this point, the following values are saved in context: * - * A0 = SYS_pthread_start - * A1 = startup - * A2 = entrypt - * A3 = arg + * R0 = SYS_pthread_start + * R1 = entrypt + * R2 = arg */ +#if !defined(CONFIG_BUILD_FLAT) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* Set up to return to the user-space pthread start-up function in @@ -343,35 +341,6 @@ int riscv_swint(int irq, void *context, void *arg) regs[REG_INT_CTX] &= ~MSTATUS_MPPM; /* User mode */ } break; - - /* R0=SYS_pthread_exit: This pthread_exit call in user-space - * - * void up_pthread_exit(pthread_exitroutine_t exit, - * void *exit_value) - * - * At this point, the following values are saved in context: - * - * R0 = SYS_pthread_exit - * R1 = pthread_exit trampoline routine - * R2 = exit_value - */ - - case SYS_pthread_exit: - { - /* Set up to enter the user-space pthread exit function in - * unprivileged mode. - */ - - regs[REG_EPC] = (uintptr_t)regs[REG_A1] & ~1; /* exit */ - - /* Change the parameter ordering to match the expectation of the - * user space pthread_exit: - */ - - regs[REG_A0] = regs[REG_A2]; /* exit_value */ - regs[REG_INT_CTX] &= ~MSTATUS_MPPM; /* User mode */ - } - break; #endif /* R0=SYS_signal_handler: This a user signal handler callback diff --git a/arch/risc-v/src/common/svcall.h b/arch/risc-v/src/common/svcall.h index 95629999ba..06d4ab9dec 100644 --- a/arch/risc-v/src/common/svcall.h +++ b/arch/risc-v/src/common/svcall.h @@ -46,9 +46,9 @@ #ifdef CONFIG_LIB_SYSCALL # ifdef CONFIG_BUILD_PROTECTED # ifndef CONFIG_SYS_RESERVED -# error "CONFIG_SYS_RESERVED must be defined to have the value 9" -# elif CONFIG_SYS_RESERVED != 9 -# error "CONFIG_SYS_RESERVED must have the value 9" +# error "CONFIG_SYS_RESERVED must be defined to have the value 8" +# elif CONFIG_SYS_RESERVED != 8 +# error "CONFIG_SYS_RESERVED must have the value 8" # endif # else # ifndef CONFIG_SYS_RESERVED @@ -118,20 +118,13 @@ /* SYS call 5: * - * void up_pthread_start(pthread_trampoline_t startup, + * void up_pthread_start(pthread_startroutine_t startup, * pthread_startroutine_t entrypt, pthread_addr_t arg) * noreturn_function */ #define SYS_pthread_start (5) -/* SYS call 8: - * - * void up_pthread_exit(pthread_exitroutine_t exit, void *exit_value) - */ - -#define SYS_pthread_exit (8) - #endif /* !CONFIG_BUILD_FLAT */ #endif /* CONFIG_LIB_SYSCALL */ diff --git a/arch/risc-v/src/k210/Make.defs b/arch/risc-v/src/k210/Make.defs index 2ac5eff374..05ff58006f 100644 --- a/arch/risc-v/src/k210/Make.defs +++ b/arch/risc-v/src/k210/Make.defs @@ -62,8 +62,7 @@ CHIP_CSRCS += k210_cpuidlestack.c endif ifeq ($(CONFIG_BUILD_PROTECTED),y) -CMN_CSRCS += riscv_task_start.c -CMN_CSRCS += riscv_pthread_start.c riscv_pthread_exit.c +CMN_CSRCS += riscv_task_start.c riscv_pthread_start.c CMN_CSRCS += riscv_signal_dispatch.c CMN_UASRCS += riscv_signal_handler.S diff --git a/boards/arm/imxrt/imxrt1050-evk/configs/knsh/defconfig b/boards/arm/imxrt/imxrt1050-evk/configs/knsh/defconfig index 67f4565c3c..458240283e 100644 --- a/boards/arm/imxrt/imxrt1050-evk/configs/knsh/defconfig +++ b/boards/arm/imxrt/imxrt1050-evk/configs/knsh/defconfig @@ -40,4 +40,4 @@ CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=8 CONFIG_START_MONTH=6 CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 diff --git a/boards/arm/imxrt/imxrt1060-evk/configs/knsh/defconfig b/boards/arm/imxrt/imxrt1060-evk/configs/knsh/defconfig index 3b8a7ea718..fde23c33d0 100644 --- a/boards/arm/imxrt/imxrt1060-evk/configs/knsh/defconfig +++ b/boards/arm/imxrt/imxrt1060-evk/configs/knsh/defconfig @@ -40,4 +40,4 @@ CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=8 CONFIG_START_MONTH=6 CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 diff --git a/boards/arm/imxrt/imxrt1064-evk/configs/knsh/defconfig b/boards/arm/imxrt/imxrt1064-evk/configs/knsh/defconfig index 48269bf4ee..d9568cb8d8 100644 --- a/boards/arm/imxrt/imxrt1064-evk/configs/knsh/defconfig +++ b/boards/arm/imxrt/imxrt1064-evk/configs/knsh/defconfig @@ -40,4 +40,4 @@ CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=8 CONFIG_START_MONTH=6 CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/knsh/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/knsh/defconfig index 5b0ae715ba..edcde6d508 100644 --- a/boards/arm/lc823450/lc823450-xgevk/configs/knsh/defconfig +++ b/boards/arm/lc823450/lc823450-xgevk/configs/knsh/defconfig @@ -110,7 +110,7 @@ CONFIG_START_YEAR=2013 CONFIG_SYSTEM_I2CTOOL=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_TIME64=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=24 CONFIG_UART0_RXBUFSIZE=512 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/kostest/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/kostest/defconfig index 1eac99b161..6175b52f73 100644 --- a/boards/arm/lc823450/lc823450-xgevk/configs/kostest/defconfig +++ b/boards/arm/lc823450/lc823450-xgevk/configs/kostest/defconfig @@ -40,7 +40,7 @@ CONFIG_START_MONTH=10 CONFIG_START_YEAR=2013 CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_SYSTEM_TIME64=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TESTING_OSTEST=y CONFIG_TESTING_OSTEST_NBARRIER_THREADS=3 CONFIG_TESTING_OSTEST_STACKSIZE=2048 diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/krndis/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/krndis/defconfig index d4028563e6..7e6c85e7f3 100644 --- a/boards/arm/lc823450/lc823450-xgevk/configs/krndis/defconfig +++ b/boards/arm/lc823450/lc823450-xgevk/configs/krndis/defconfig @@ -174,7 +174,7 @@ CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME="g_nsymbols" CONFIG_SYSTEM_NXPLAYER=y CONFIG_SYSTEM_PING=y CONFIG_SYSTEM_TIME64=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=24 CONFIG_TELNET_CHARACTER_MODE=y CONFIG_TESTING_OSTEST=y diff --git a/boards/arm/lpc17xx_40xx/lpc4088-devkit/configs/knsh/defconfig b/boards/arm/lpc17xx_40xx/lpc4088-devkit/configs/knsh/defconfig index 95b2555ea2..d45340e0b0 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-devkit/configs/knsh/defconfig +++ b/boards/arm/lpc17xx_40xx/lpc4088-devkit/configs/knsh/defconfig @@ -56,6 +56,6 @@ CONFIG_START_MONTH=3 CONFIG_START_YEAR=2013 CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=0 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/configs/knsh/defconfig b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/configs/knsh/defconfig index ac0eef8d40..e068060810 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/configs/knsh/defconfig +++ b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/configs/knsh/defconfig @@ -52,6 +52,6 @@ CONFIG_START_MONTH=3 CONFIG_START_YEAR=2013 CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=0 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/arm/lpc17xx_40xx/open1788/configs/knsh/defconfig b/boards/arm/lpc17xx_40xx/open1788/configs/knsh/defconfig index 325fc37760..4f47d2efc4 100644 --- a/boards/arm/lpc17xx_40xx/open1788/configs/knsh/defconfig +++ b/boards/arm/lpc17xx_40xx/open1788/configs/knsh/defconfig @@ -56,6 +56,6 @@ CONFIG_START_MONTH=3 CONFIG_START_YEAR=2013 CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=0 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/arm/lpc17xx_40xx/open1788/configs/knxterm/defconfig b/boards/arm/lpc17xx_40xx/open1788/configs/knxterm/defconfig index d7eb83c052..b8719cc1fd 100644 --- a/boards/arm/lpc17xx_40xx/open1788/configs/knxterm/defconfig +++ b/boards/arm/lpc17xx_40xx/open1788/configs/knxterm/defconfig @@ -67,6 +67,6 @@ CONFIG_START_MONTH=3 CONFIG_START_YEAR=2019 CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_SYSTEM_CLE=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=0 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/arm/lpc17xx_40xx/pnev5180b/configs/knsh/defconfig b/boards/arm/lpc17xx_40xx/pnev5180b/configs/knsh/defconfig index a16f6f7f34..e9229c5d6d 100644 --- a/boards/arm/lpc17xx_40xx/pnev5180b/configs/knsh/defconfig +++ b/boards/arm/lpc17xx_40xx/pnev5180b/configs/knsh/defconfig @@ -22,5 +22,5 @@ CONFIG_PASS1_BUILDIR="boards/arm/lpc17xx_40xx/pnev5180b/kernel" CONFIG_RAM_SIZE=32768 CONFIG_RAM_START=0x10000000 CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/arm/lpc43xx/bambino-200e/configs/knsh/defconfig b/boards/arm/lpc43xx/bambino-200e/configs/knsh/defconfig index 65bf1d2ac8..0204a7385c 100644 --- a/boards/arm/lpc43xx/bambino-200e/configs/knsh/defconfig +++ b/boards/arm/lpc43xx/bambino-200e/configs/knsh/defconfig @@ -48,7 +48,7 @@ CONFIG_START_MONTH=7 CONFIG_START_YEAR=2012 CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=0 CONFIG_TIMER=y CONFIG_UART1_SERIAL_CONSOLE=y diff --git a/boards/arm/sam34/sam3u-ek/configs/knsh/defconfig b/boards/arm/sam34/sam3u-ek/configs/knsh/defconfig index 4efbe41927..fdf13ff654 100644 --- a/boards/arm/sam34/sam3u-ek/configs/knsh/defconfig +++ b/boards/arm/sam34/sam3u-ek/configs/knsh/defconfig @@ -47,6 +47,6 @@ CONFIG_START_DAY=10 CONFIG_START_MONTH=3 CONFIG_START_YEAR=2013 CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=0 CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig b/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig index 0efc437cb6..2685ee3bbf 100644 --- a/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig +++ b/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig @@ -84,5 +84,5 @@ CONFIG_SCHED_WAITPID=y CONFIG_SDIO_BLOCKSETUP=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_NSH_PROGNAME="init" -CONFIG_SYS_RESERVED=7 +CONFIG_SYS_RESERVED=6 CONFIG_USART3_SERIAL_CONSOLE=y diff --git a/boards/arm/samv7/samv71-xult/configs/knsh/defconfig b/boards/arm/samv7/samv71-xult/configs/knsh/defconfig index b15bf04814..09ff632b83 100644 --- a/boards/arm/samv7/samv71-xult/configs/knsh/defconfig +++ b/boards/arm/samv7/samv71-xult/configs/knsh/defconfig @@ -81,5 +81,5 @@ CONFIG_START_YEAR=2015 CONFIG_SYSTEM_I2CTOOL=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_RAMTEST=y -CONFIG_SYS_RESERVED=9 -CONFIG_USART1_SERIAL_CONSOLE=y +CONFIG_SYS_RESERVED=8 +CONFIG_UART3_SERIAL_CONSOLE=y diff --git a/boards/arm/stm32/clicker2-stm32/configs/knsh/defconfig b/boards/arm/stm32/clicker2-stm32/configs/knsh/defconfig index a04402ef7c..fc3af2eb95 100644 --- a/boards/arm/stm32/clicker2-stm32/configs/knsh/defconfig +++ b/boards/arm/stm32/clicker2-stm32/configs/knsh/defconfig @@ -51,6 +51,6 @@ CONFIG_STM32_JTAG_SW_ENABLE=y CONFIG_STM32_PWR=y CONFIG_STM32_USART3=y CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=32 CONFIG_USART3_SERIAL_CONSOLE=y diff --git a/boards/arm/stm32/mikroe-stm32f4/configs/kostest/defconfig b/boards/arm/stm32/mikroe-stm32f4/configs/kostest/defconfig index 01552494e8..2b1f349f76 100644 --- a/boards/arm/stm32/mikroe-stm32f4/configs/kostest/defconfig +++ b/boards/arm/stm32/mikroe-stm32f4/configs/kostest/defconfig @@ -81,7 +81,7 @@ CONFIG_STM32_USART2=y CONFIG_SYSLOG_CHAR=y CONFIG_SYSLOG_DEVPATH="/dev/ttyS0" CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=11 CONFIG_TESTING_OSTEST=y CONFIG_USBDEV=y diff --git a/boards/arm/stm32/olimex-stm32-p407/configs/kelf/defconfig b/boards/arm/stm32/olimex-stm32-p407/configs/kelf/defconfig index 68bb28bd6f..e09191cc69 100644 --- a/boards/arm/stm32/olimex-stm32-p407/configs/kelf/defconfig +++ b/boards/arm/stm32/olimex-stm32-p407/configs/kelf/defconfig @@ -56,7 +56,7 @@ CONFIG_STM32_SDIO=y CONFIG_STM32_USART3=y CONFIG_STM32_USBHOST=y CONFIG_SYMTAB_ORDEREDBYNAME=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_USART3_SERIAL_CONSOLE=y CONFIG_USBHOST_ISOC_DISABLE=y CONFIG_USBHOST_MSC=y diff --git a/boards/arm/stm32/olimex-stm32-p407/configs/kmodule/defconfig b/boards/arm/stm32/olimex-stm32-p407/configs/kmodule/defconfig index d362c68e2b..df9462b56f 100644 --- a/boards/arm/stm32/olimex-stm32-p407/configs/kmodule/defconfig +++ b/boards/arm/stm32/olimex-stm32-p407/configs/kmodule/defconfig @@ -51,7 +51,7 @@ CONFIG_STM32_PWR=y CONFIG_STM32_USART3=y CONFIG_STM32_USBHOST=y CONFIG_SYMTAB_ORDEREDBYNAME=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_USART3_SERIAL_CONSOLE=y CONFIG_USBHOST_ISOC_DISABLE=y CONFIG_USBHOST_MSC=y diff --git a/boards/arm/stm32/olimex-stm32-p407/configs/knsh/defconfig b/boards/arm/stm32/olimex-stm32-p407/configs/knsh/defconfig index 99fb79808b..f6247e91d3 100644 --- a/boards/arm/stm32/olimex-stm32-p407/configs/knsh/defconfig +++ b/boards/arm/stm32/olimex-stm32-p407/configs/knsh/defconfig @@ -51,6 +51,6 @@ CONFIG_STM32_JTAG_SW_ENABLE=y CONFIG_STM32_PWR=y CONFIG_STM32_USART3=y CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=32 CONFIG_USART3_SERIAL_CONSOLE=y diff --git a/boards/arm/stm32/stm3240g-eval/configs/knxwm/defconfig b/boards/arm/stm32/stm3240g-eval/configs/knxwm/defconfig index 1237e555a1..facd581a51 100644 --- a/boards/arm/stm32/stm3240g-eval/configs/knxwm/defconfig +++ b/boards/arm/stm32/stm3240g-eval/configs/knxwm/defconfig @@ -92,7 +92,7 @@ CONFIG_STMPE811_THRESHX=39 CONFIG_STMPE811_THRESHY=51 CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_SYSTEM_READLINE=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=0 CONFIG_USART3_RXBUFSIZE=128 CONFIG_USART3_SERIAL_CONSOLE=y diff --git a/boards/arm/stm32/stm32f4discovery/configs/kostest/defconfig b/boards/arm/stm32/stm32f4discovery/configs/kostest/defconfig index a05b9a225c..96d06bab3b 100644 --- a/boards/arm/stm32/stm32f4discovery/configs/kostest/defconfig +++ b/boards/arm/stm32/stm32f4discovery/configs/kostest/defconfig @@ -38,7 +38,7 @@ CONFIG_START_YEAR=2013 CONFIG_STM32_JTAG_SW_ENABLE=y CONFIG_STM32_USART2=y CONFIG_SYMTAB_ORDEREDBYNAME=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TESTING_OSTEST=y CONFIG_TESTING_OSTEST_NBARRIER_THREADS=3 CONFIG_TESTING_OSTEST_STACKSIZE=2048 diff --git a/boards/arm/stm32l4/stm32l476vg-disco/configs/knsh/defconfig b/boards/arm/stm32l4/stm32l476vg-disco/configs/knsh/defconfig index 9522a42e95..4f4334af3e 100644 --- a/boards/arm/stm32l4/stm32l476vg-disco/configs/knsh/defconfig +++ b/boards/arm/stm32l4/stm32l476vg-disco/configs/knsh/defconfig @@ -68,6 +68,6 @@ CONFIG_STM32L4_RTC=y CONFIG_STM32L4_SAI1PLL=y CONFIG_STM32L4_USART2=y CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=0 CONFIG_USART2_SERIAL_CONSOLE=y diff --git a/boards/arm/stm32l4/stm32l4r9ai-disco/configs/knsh/defconfig b/boards/arm/stm32l4/stm32l4r9ai-disco/configs/knsh/defconfig index c9a8f26358..79b2acdbb6 100644 --- a/boards/arm/stm32l4/stm32l4r9ai-disco/configs/knsh/defconfig +++ b/boards/arm/stm32l4/stm32l4r9ai-disco/configs/knsh/defconfig @@ -73,7 +73,7 @@ CONFIG_STM32L4_SRAM2_HEAP=y CONFIG_STM32L4_UART4=y CONFIG_STM32L4_USART2=y CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=0 CONFIG_UART4_BAUD=2000000 CONFIG_UART4_RXBUFSIZE=512 diff --git a/boards/arm/tiva/lm3s6965-ek/configs/qemu-protected/defconfig b/boards/arm/tiva/lm3s6965-ek/configs/qemu-protected/defconfig index 97d6addb39..d13c05be98 100644 --- a/boards/arm/tiva/lm3s6965-ek/configs/qemu-protected/defconfig +++ b/boards/arm/tiva/lm3s6965-ek/configs/qemu-protected/defconfig @@ -98,7 +98,7 @@ CONFIG_SYSTEM_NETDB=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_NTPC=y CONFIG_SYSTEM_PING=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=24 CONFIG_TESTING_OSTEST=y CONFIG_TIVA_ETHERNET=y diff --git a/boards/risc-v/c906/smartl-c906/configs/knsh/defconfig b/boards/risc-v/c906/smartl-c906/configs/knsh/defconfig index 16810fe3e5..bc710cb93a 100644 --- a/boards/risc-v/c906/smartl-c906/configs/knsh/defconfig +++ b/boards/risc-v/c906/smartl-c906/configs/knsh/defconfig @@ -58,7 +58,7 @@ CONFIG_START_DAY=7 CONFIG_START_MONTH=3 CONFIG_START_YEAR=2021 CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=20 CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y diff --git a/boards/risc-v/k210/maix-bit/configs/knsh/defconfig b/boards/risc-v/k210/maix-bit/configs/knsh/defconfig index 56e8cae72e..b3b2b3ecb9 100644 --- a/boards/risc-v/k210/maix-bit/configs/knsh/defconfig +++ b/boards/risc-v/k210/maix-bit/configs/knsh/defconfig @@ -47,7 +47,7 @@ CONFIG_START_DAY=12 CONFIG_START_MONTH=5 CONFIG_START_YEAR=2020 CONFIG_SYSTEM_NSH=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=20 CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y diff --git a/boards/risc-v/k210/maix-bit/configs/knsh_smp/defconfig b/boards/risc-v/k210/maix-bit/configs/knsh_smp/defconfig index 796fe7e349..bdd088b2d8 100644 --- a/boards/risc-v/k210/maix-bit/configs/knsh_smp/defconfig +++ b/boards/risc-v/k210/maix-bit/configs/knsh_smp/defconfig @@ -52,7 +52,7 @@ CONFIG_START_YEAR=2021 CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_SYSTEM=y CONFIG_SYSTEM_TASKSET=y -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=20 CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y diff --git a/boards/risc-v/k210/maix-bit/configs/kostest/defconfig b/boards/risc-v/k210/maix-bit/configs/kostest/defconfig index e440989e01..bc86471754 100644 --- a/boards/risc-v/k210/maix-bit/configs/kostest/defconfig +++ b/boards/risc-v/k210/maix-bit/configs/kostest/defconfig @@ -43,7 +43,7 @@ CONFIG_STACK_COLORATION=y CONFIG_START_DAY=14 CONFIG_START_MONTH=2 CONFIG_START_YEAR=2020 -CONFIG_SYS_RESERVED=9 +CONFIG_SYS_RESERVED=8 CONFIG_TASK_NAME_SIZE=20 CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 8728cfa743..5b22d5bbaa 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -589,8 +589,6 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[]) noreturn_function; #endif -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \ - !defined(CONFIG_DISABLE_PTHREAD) /**************************************************************************** * Name: up_pthread_start * @@ -616,28 +614,11 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[]) * ****************************************************************************/ +#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \ + !defined(CONFIG_DISABLE_PTHREAD) void up_pthread_start(pthread_trampoline_t startup, pthread_startroutine_t entrypt, pthread_addr_t arg) noreturn_function; - -/**************************************************************************** - * Name: up_pthread_exit - * - * Description: - * In this kernel mode build, this function will be called to execute a - * pthread in user-space. This kernel-mode stub will then be called - * transfer control to the user-mode pthread_exit. - * - * Input Parameters: - * exit - The user-space pthread_exit function - * exit_value - The pointer of the pthread exit parameter - * - * Returned Value: - * None - ****************************************************************************/ - -void up_pthread_exit(pthread_exitroutine_t exit, FAR void *exit_value) - noreturn_function; #endif /**************************************************************************** diff --git a/include/nuttx/pthread.h b/include/nuttx/pthread.h index 7c4b8ceba2..3170586aa9 100644 --- a/include/nuttx/pthread.h +++ b/include/nuttx/pthread.h @@ -140,7 +140,6 @@ EXTERN const pthread_attr_t g_default_pthread_attr; * for the new thread * entry - The new thread starts execution by invoking entry * arg - It is passed as the sole argument of entry - * exit - The user-space pthread exit function * * Returned Value: * OK (0) on success; a (non-negated) errno value on failure. The errno @@ -150,8 +149,7 @@ EXTERN const pthread_attr_t g_default_pthread_attr; int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread, FAR const pthread_attr_t *attr, - pthread_startroutine_t entry, pthread_addr_t arg, - pthread_exitroutine_t exit); + pthread_startroutine_t entry, pthread_addr_t arg); /**************************************************************************** * Name: nx_pthread_exit diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 710c2ef6cf..eff21d6d1f 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -96,8 +96,7 @@ #define TCB_FLAG_NONCANCELABLE (1 << 2) /* Bit 2: Pthread is non-cancelable */ #define TCB_FLAG_CANCEL_DEFERRED (1 << 3) /* Bit 3: Deferred (vs asynch) cancellation type */ #define TCB_FLAG_CANCEL_PENDING (1 << 4) /* Bit 4: Pthread cancel is pending */ -#define TCB_FLAG_CANCEL_DOING (1 << 5) /* Bit 4: Pthread cancel/exit is doing */ -#define TCB_FLAG_POLICY_SHIFT (6) /* Bit 5-6: Scheduling policy */ +#define TCB_FLAG_POLICY_SHIFT (5) /* Bit 5-6: Scheduling policy */ #define TCB_FLAG_POLICY_MASK (3 << TCB_FLAG_POLICY_SHIFT) # define TCB_FLAG_SCHED_FIFO (0 << TCB_FLAG_POLICY_SHIFT) /* FIFO scheding policy */ # define TCB_FLAG_SCHED_RR (1 << TCB_FLAG_POLICY_SHIFT) /* Round robin scheding policy */ @@ -754,7 +753,6 @@ struct pthread_tcb_s pthread_trampoline_t trampoline; /* User-space pthread startup function */ pthread_addr_t arg; /* Startup argument */ - pthread_exitroutine_t exit; /* User-space pthread exit function */ FAR void *joininfo; /* Detach-able info to support join */ }; #endif /* !CONFIG_DISABLE_PTHREAD */ diff --git a/include/pthread.h b/include/pthread.h index c679e5cb2b..a6871534b0 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -210,8 +210,6 @@ typedef FAR void *pthread_addr_t; typedef CODE pthread_addr_t (*pthread_startroutine_t)(pthread_addr_t); typedef pthread_startroutine_t pthread_func_t; -typedef void (*pthread_exitroutine_t)(pthread_addr_t); - typedef void (*pthread_trampoline_t)(pthread_startroutine_t, pthread_addr_t); struct pthread_attr_s diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h index 7da3fe8e19..5316efbdf1 100644 --- a/include/sys/syscall_lookup.h +++ b/include/sys/syscall_lookup.h @@ -307,7 +307,7 @@ SYSCALL_LOOKUP(futimens, 2) SYSCALL_LOOKUP(pthread_cond_broadcast, 1) SYSCALL_LOOKUP(pthread_cond_signal, 1) SYSCALL_LOOKUP(pthread_cond_wait, 2) - SYSCALL_LOOKUP(nx_pthread_create, 6) + SYSCALL_LOOKUP(nx_pthread_create, 5) SYSCALL_LOOKUP(pthread_detach, 1) SYSCALL_LOOKUP(nx_pthread_exit, 1) SYSCALL_LOOKUP(pthread_getschedparam, 3) diff --git a/libs/libc/pthread/pthread_create.c b/libs/libc/pthread/pthread_create.c index c46e36fc60..b9e8d692c4 100644 --- a/libs/libc/pthread/pthread_create.c +++ b/libs/libc/pthread/pthread_create.c @@ -87,5 +87,5 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr, pthread_startroutine_t pthread_entry, pthread_addr_t arg) { return nx_pthread_create(pthread_startup, thread, attr, pthread_entry, - arg, pthread_exit); + arg); } diff --git a/sched/pthread/pthread_cancel.c b/sched/pthread/pthread_cancel.c index 7b66b7c789..1a4ef237e0 100644 --- a/sched/pthread/pthread_cancel.c +++ b/sched/pthread/pthread_cancel.c @@ -24,8 +24,6 @@ #include -#include - #include #include #include @@ -85,15 +83,7 @@ int pthread_cancel(pthread_t thread) if (tcb == this_task()) { -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) - tcb->flags &= ~TCB_FLAG_CANCEL_PENDING; - tcb->flags |= TCB_FLAG_CANCEL_DOING; - - up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit, - PTHREAD_CANCELED); -#else pthread_exit(PTHREAD_CANCELED); -#endif } /* Complete pending join operations */ diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index e58c91facb..95b7bf4bab 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -79,7 +79,6 @@ const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER; * tcb - Address of the new task's TCB * trampoline - User space pthread startup function * arg - The argument to provide to the pthread on startup. - * exit - The user-space pthread exit function * * Returned Value: * None @@ -88,8 +87,7 @@ const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER; static inline void pthread_tcb_setup(FAR struct pthread_tcb_s *ptcb, pthread_trampoline_t trampoline, - pthread_addr_t arg, - pthread_exitroutine_t exit) + pthread_addr_t arg) { #if CONFIG_TASK_NAME_SIZE > 0 /* Copy the pthread name into the TCB */ @@ -104,7 +102,6 @@ static inline void pthread_tcb_setup(FAR struct pthread_tcb_s *ptcb, ptcb->trampoline = trampoline; ptcb->arg = arg; - ptcb->exit = exit; } /**************************************************************************** @@ -196,12 +193,7 @@ static void pthread_start(void) /* The thread has returned (should never happen) */ DEBUGPANIC(); -#ifndef CONFIG_BUILD_FLAT - ptcb->cmn.flags &= ~TCB_FLAG_CANCEL_PENDING; - ptcb->cmn.flags |= TCB_FLAG_CANCEL_DOING; - - up_pthread_exit(ptcb->exit, NULL); -#endif + pthread_exit(NULL); } /**************************************************************************** @@ -223,7 +215,6 @@ static void pthread_start(void) * for the new thread * entry - The new thread starts execution by invoking entry * arg - It is passed as the sole argument of entry - * exit - The user-space pthread exit function * * Returned Value: * OK (0) on success; a (non-negated) errno value on failure. The errno @@ -233,8 +224,7 @@ static void pthread_start(void) int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread, FAR const pthread_attr_t *attr, - pthread_startroutine_t entry, pthread_addr_t arg, - pthread_exitroutine_t exit) + pthread_startroutine_t entry, pthread_addr_t arg) { FAR struct pthread_tcb_s *ptcb; FAR struct tls_info_s *info; @@ -247,7 +237,6 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread, bool group_joined = false; DEBUGASSERT(trampoline != NULL); - DEBUGASSERT(exit != NULL); /* If attributes were not supplied, use the default attributes */ @@ -467,7 +456,7 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread, * passed by value */ - pthread_tcb_setup(ptcb, trampoline, arg, exit); + pthread_tcb_setup(ptcb, trampoline, arg); /* Join the parent's task group */ diff --git a/sched/signal/sig_default.c b/sched/signal/sig_default.c index 4110ae47d5..2f9063ae2a 100644 --- a/sched/signal/sig_default.c +++ b/sched/signal/sig_default.c @@ -217,15 +217,7 @@ static void nxsig_abnormal_termination(int signo) * REVISIT: This will not work if HAVE_GROUP_MEMBERS is not set. */ -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) - rtcb->flags &= ~TCB_FLAG_CANCEL_PENDING; - rtcb->flags |= TCB_FLAG_CANCEL_DOING; - - up_pthread_exit(((FAR struct pthread_tcb_s *)rtcb)->exit, - PTHREAD_CANCELED); -#else - pthread_exit(PTHREAD_CANCELED); -#endif + pthread_exit(NULL); } else #endif diff --git a/sched/task/task_cancelpt.c b/sched/task/task_cancelpt.c index 4955ab04a0..ddc94d44c1 100644 --- a/sched/task/task_cancelpt.c +++ b/sched/task/task_cancelpt.c @@ -58,7 +58,6 @@ #include #include -#include #include "sched/sched.h" #include "semaphore/semaphore.h" @@ -141,15 +140,7 @@ bool enter_cancellation_point(void) if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD) { -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) - tcb->flags &= ~TCB_FLAG_CANCEL_PENDING; - tcb->flags |= TCB_FLAG_CANCEL_DOING; - - up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit, - PTHREAD_CANCELED); -#else pthread_exit(PTHREAD_CANCELED); -#endif } else #endif @@ -236,15 +227,7 @@ void leave_cancellation_point(void) if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD) { -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) - tcb->flags &= ~TCB_FLAG_CANCEL_PENDING; - tcb->flags |= TCB_FLAG_CANCEL_DOING; - - up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit, - PTHREAD_CANCELED); -#else pthread_exit(PTHREAD_CANCELED); -#endif } else #endif diff --git a/sched/task/task_setcancelstate.c b/sched/task/task_setcancelstate.c index 6b61632e99..bb08b542c3 100644 --- a/sched/task/task_setcancelstate.c +++ b/sched/task/task_setcancelstate.c @@ -112,15 +112,7 @@ int task_setcancelstate(int state, FAR int *oldstate) if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD) { -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) - tcb->flags &= ~TCB_FLAG_CANCEL_PENDING; - tcb->flags |= TCB_FLAG_CANCEL_DOING; - - up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit, - PTHREAD_CANCELED); -#else pthread_exit(PTHREAD_CANCELED); -#endif } else #endif diff --git a/sched/task/task_setcanceltype.c b/sched/task/task_setcanceltype.c index d57cc6408a..b14fec53e0 100644 --- a/sched/task/task_setcanceltype.c +++ b/sched/task/task_setcanceltype.c @@ -100,15 +100,7 @@ int task_setcanceltype(int type, FAR int *oldtype) #ifndef CONFIG_DISABLE_PTHREAD if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD) { -#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) - tcb->flags &= ~TCB_FLAG_CANCEL_PENDING; - tcb->flags |= TCB_FLAG_CANCEL_DOING; - - up_pthread_exit(((FAR struct pthread_tcb_s *)tcb)->exit, - PTHREAD_CANCELED); -#else - pthread_exit(PTHREAD_CANCELED); -#endif + pthread_exit(PTHREAD_CANCELED); } else #endif diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 46e467d96a..12785b7e0b 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -72,7 +72,7 @@ "munmap","sys/mman.h","defined(CONFIG_FS_RAMMAP)","int","FAR void *","size_t" "nx_mkfifo","nuttx/fs/fs.h","defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0","int","FAR const char *","mode_t","size_t" "nx_pipe","nuttx/fs/fs.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","size_t","int" -"nx_pthread_create","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_trampoline_t","FAR pthread_t *","FAR const pthread_attr_t *","pthread_startroutine_t","pthread_addr_t","pthread_exitroutine_t" +"nx_pthread_create","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_trampoline_t","FAR pthread_t *","FAR const pthread_attr_t *","pthread_startroutine_t","pthread_addr_t" "nx_pthread_exit","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","noreturn","pthread_addr_t" "nx_vsyslog","nuttx/syslog/syslog.h","","int","int","FAR const IPTR char *","FAR va_list *" "nxsched_get_stackinfo","nuttx/sched.h","","int","pid_t","FAR struct stackinfo_s *"