You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ar...@apache.org on 2022/02/27 14:54:28 UTC
[incubator-nuttx] 03/04: arch: Move the content from svcall.h to syscall.h
This is an automated email from the ASF dual-hosted git repository.
archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 087b9e5ff327f7992065cfe01c4cb11b675b7eae
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Feb 25 02:46:21 2022 +0800
arch: Move the content from svcall.h to syscall.h
and remove svcall.h
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
arch/arm/include/syscall.h | 94 ++++++++++++++-
arch/arm/src/arm/arm_fullcontextrestore.S | 2 +-
arch/arm/src/arm/arm_syscall.c | 2 +-
arch/arm/src/arm/svcall.h | 127 --------------------
arch/arm/src/armv6-m/arm_fullcontextrestore.S | 2 +-
arch/arm/src/armv6-m/arm_saveusercontext.S | 2 +-
arch/arm/src/armv6-m/arm_signal_dispatch.c | 3 +-
arch/arm/src/armv6-m/arm_signal_handler.S | 2 +-
arch/arm/src/armv6-m/arm_svcall.c | 2 +-
arch/arm/src/armv6-m/svcall.h | 136 ----------------------
arch/arm/src/armv7-a/arm_fullcontextrestore.S | 2 +-
arch/arm/src/armv7-a/arm_signal_dispatch.c | 3 +-
arch/arm/src/armv7-a/arm_syscall.c | 2 +-
arch/arm/src/armv7-a/crt0.c | 4 +-
arch/arm/src/armv7-a/svcall.h | 127 --------------------
arch/arm/src/armv7-m/arm_signal_dispatch.c | 3 +-
arch/arm/src/armv7-m/arm_svcall.c | 2 +-
arch/arm/src/armv7-m/gnu/arm_fullcontextrestore.S | 2 +-
arch/arm/src/armv7-m/gnu/arm_saveusercontext.S | 2 +-
arch/arm/src/armv7-m/gnu/arm_signal_handler.S | 2 +-
arch/arm/src/armv7-m/iar/arm_fullcontextrestore.S | 2 +-
arch/arm/src/armv7-m/iar/arm_saveusercontext.S | 2 +-
arch/arm/src/armv7-m/svcall.h | 136 ----------------------
arch/arm/src/armv7-r/arm_fullcontextrestore.S | 3 +-
arch/arm/src/armv7-r/arm_signal_dispatch.c | 3 +-
arch/arm/src/armv7-r/arm_signal_handler.S | 2 +-
arch/arm/src/armv7-r/arm_syscall.c | 2 +-
arch/arm/src/armv7-r/svcall.h | 128 --------------------
arch/arm/src/armv8-m/arm_fullcontextrestore.S | 2 +-
arch/arm/src/armv8-m/arm_saveusercontext.S | 2 +-
arch/arm/src/armv8-m/arm_signal_dispatch.c | 3 +-
arch/arm/src/armv8-m/arm_signal_handler.S | 2 +-
arch/arm/src/armv8-m/arm_svcall.c | 2 +-
arch/arm/src/armv8-m/svcall.h | 135 ---------------------
arch/arm/src/common/arm_pthread_start.c | 3 +-
arch/arm/src/common/arm_switchcontext.c | 3 +-
arch/arm/src/common/arm_task_start.c | 3 +-
arch/ceva/include/syscall.h | 90 ++++++++++++++
arch/ceva/src/common/svcall.h | 130 ---------------------
arch/ceva/src/common/up_fullcontextrestore.c | 3 +-
arch/ceva/src/common/up_pthread_start.c | 2 +-
arch/ceva/src/common/up_saveusercontext.c | 3 +-
arch/ceva/src/common/up_signal_dispatch.c | 2 +-
arch/ceva/src/common/up_svcall.c | 2 +-
arch/ceva/src/common/up_switchcontext.c | 3 +-
arch/ceva/src/common/up_task_start.c | 2 +-
arch/ceva/src/xc5/up_signal_handler.S | 4 +-
arch/ceva/src/xc5/up_svcall_handler.S | 4 +-
arch/ceva/src/xc5/vfork.S | 2 +-
arch/ceva/src/xm6/up_signal_handler.S | 4 +-
arch/ceva/src/xm6/up_svcall_handler.S | 4 +-
arch/ceva/src/xm6/vfork.S | 2 +-
arch/or1k/src/common/up_pthread_start.c | 3 +-
arch/or1k/src/common/up_task_start.c | 3 +-
arch/risc-v/include/syscall.h | 97 ++++++++++++---
arch/risc-v/src/common/riscv_pthread_start.c | 3 +-
arch/risc-v/src/common/riscv_signal_dispatch.c | 3 +-
arch/risc-v/src/common/riscv_signal_handler.S | 2 +-
arch/risc-v/src/common/riscv_swint.c | 2 +-
arch/risc-v/src/common/riscv_task_start.c | 3 +-
arch/risc-v/src/common/svcall.h | 131 ---------------------
arch/xtensa/include/syscall.h | 27 ++---
62 files changed, 338 insertions(+), 1147 deletions(-)
diff --git a/arch/arm/include/syscall.h b/arch/arm/include/syscall.h
index 033be91..320455a 100644
--- a/arch/arm/include/syscall.h
+++ b/arch/arm/include/syscall.h
@@ -47,16 +47,98 @@
# define SYS_smhcall 0x123456
#endif
-/* The SYS_signal_handler_return is executed here... its value is not always
- * available in this context and so is assumed to be 7.
+/* Configuration ************************************************************/
+
+/* This logic uses three system calls {0,1,2} for context switching and one
+ * for the syscall return.
+ * So a minimum of four syscall values must be reserved.
+ * If CONFIG_BUILD_PROTECTED is defined, then four more syscall values must
+ * be reserved.
*/
-#ifndef SYS_signal_handler_return
-# define SYS_signal_handler_return (7)
-#elif SYS_signal_handler_return != 7
-# error "SYS_signal_handler_return was assumed to be 7"
+#ifdef CONFIG_LIB_SYSCALL
+# ifdef CONFIG_BUILD_PROTECTED
+# ifndef CONFIG_SYS_RESERVED
+# 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
+# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
+# elif CONFIG_SYS_RESERVED != 4
+# error "CONFIG_SYS_RESERVED must have the value 4"
+# endif
+# endif
#endif
+/* Cortex-M system calls ****************************************************/
+
+/* SYS call 0:
+ *
+ * int arm_saveusercontext(uint32_t *saveregs);
+ */
+
+#define SYS_save_context (0)
+
+/* SYS call 1:
+ *
+ * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
+ */
+
+#define SYS_restore_context (1)
+
+/* SYS call 2:
+ *
+ * void arm_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
+ */
+
+#define SYS_switch_context (2)
+
+#ifdef CONFIG_LIB_SYSCALL
+/* SYS call 3:
+ *
+ * void arm_syscall_return(void);
+ */
+
+#define SYS_syscall_return (3)
+#endif /* CONFIG_LIB_SYSCALL */
+
+#ifndef CONFIG_BUILD_FLAT
+/* SYS call 4:
+ *
+ * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
+ * noreturn_function;
+ */
+
+#define SYS_task_start (4)
+
+/* SYS call 5:
+ *
+ * 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 6:
+ *
+ * void signal_handler(_sa_sigaction_t sighand,
+ * int signo, FAR siginfo_t *info,
+ * FAR void *ucontext);
+ */
+
+#define SYS_signal_handler (6)
+
+/* SYS call 7:
+ *
+ * void signal_handler_return(void);
+ */
+
+#define SYS_signal_handler_return (7)
+#endif /* !CONFIG_BUILD_FLAT */
+
/****************************************************************************
* Public Types
****************************************************************************/
diff --git a/arch/arm/src/arm/arm_fullcontextrestore.S b/arch/arm/src/arm/arm_fullcontextrestore.S
index 9c6f8e0..7368292 100644
--- a/arch/arm/src/arm/arm_fullcontextrestore.S
+++ b/arch/arm/src/arm/arm_fullcontextrestore.S
@@ -24,8 +24,8 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
-#include "svcall.h"
#include "arm.h"
/****************************************************************************
diff --git a/arch/arm/src/arm/arm_syscall.c b/arch/arm/src/arm/arm_syscall.c
index 074f333..5d13d17 100644
--- a/arch/arm/src/arm/arm_syscall.c
+++ b/arch/arm/src/arm/arm_syscall.c
@@ -27,12 +27,12 @@
#include <stdint.h>
#include <assert.h>
#include <debug.h>
+#include <syscall.h>
#include <nuttx/arch.h>
#include "arm_arch.h"
#include "arm_internal.h"
-#include "svcall.h"
/****************************************************************************
* Public Functions
diff --git a/arch/arm/src/arm/svcall.h b/arch/arm/src/arm/svcall.h
deleted file mode 100644
index a6bd67f..0000000
--- a/arch/arm/src/arm/svcall.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
- * arch/arm/src/arm/svcall.h
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_ARM_SVCALL_H
-#define __ARCH_ARM_SRC_ARM_SVCALL_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <syscall.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* This logic uses one system call for the syscall return. So a minimum of
- * one syscall values must be reserved. If CONFIG_BUILD_KERNEL is defined,
- * then four more syscall values must be reserved.
- */
-
-#ifdef CONFIG_LIB_SYSCALL
-# 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 have the value 7"
-# endif
-# else
-# ifndef CONFIG_SYS_RESERVED
-# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
-# elif CONFIG_SYS_RESERVED != 4
-# error "CONFIG_SYS_RESERVED must have the value 4"
-# endif
-# endif
-#endif
-
-/* Cortex-A system calls ****************************************************/
-
-/* SYS call 0:
- *
- * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
- */
-
-#define SYS_restore_context (0)
-
-/* SYS call 1:
- *
- * void arm_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
- */
-
-#define SYS_switch_context (1)
-
-#ifdef CONFIG_LIB_SYSCALL
-/* SYS call 2:
- *
- * void arm_syscall_return(void);
- */
-
-#define SYS_syscall_return (2)
-
-#ifndef CONFIG_BUILD_FLAT
-#ifdef CONFIG_BUILD_KERNEL
-/* SYS call 3:
- *
- * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
- * noreturn_function;
- */
-
-#define SYS_task_start (3)
-
-/* SYS call 5:
- *
- * void signal_handler(_sa_sigaction_t sighand,
- * int signo, FAR siginfo_t *info,
- * FAR void *ucontext);
- */
-
-#define SYS_signal_handler (5)
-
-/* SYS call 6:
- *
- * void signal_handler_return(void);
- */
-
-#define SYS_signal_handler_return (6)
-
-#endif /* !CONFIG_BUILD_FLAT */
-
-/* SYS call 4:
- *
- * void up_pthread_start(pthread_startroutine_t startup,
- * pthread_startroutine_t entrypt, pthread_addr_t arg)
- * noreturn_function
- */
-
-#define SYS_pthread_start (4)
-
-#endif /* CONFIG_BUILD_KERNEL */
-#endif /* CONFIG_LIB_SYSCALL */
-
-/****************************************************************************
- * Inline Functions
- ****************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_ARM_SVCALL_H */
diff --git a/arch/arm/src/armv6-m/arm_fullcontextrestore.S b/arch/arm/src/armv6-m/arm_fullcontextrestore.S
index 509a637..5f27ea3 100644
--- a/arch/arm/src/armv6-m/arm_fullcontextrestore.S
+++ b/arch/arm/src/armv6-m/arm_fullcontextrestore.S
@@ -24,9 +24,9 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
#include "nvic.h"
-#include "svcall.h"
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/armv6-m/arm_saveusercontext.S b/arch/arm/src/armv6-m/arm_saveusercontext.S
index 311616c..284a3f7 100644
--- a/arch/arm/src/armv6-m/arm_saveusercontext.S
+++ b/arch/arm/src/armv6-m/arm_saveusercontext.S
@@ -24,9 +24,9 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
#include "nvic.h"
-#include "svcall.h"
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/armv6-m/arm_signal_dispatch.c b/arch/arm/src/armv6-m/arm_signal_dispatch.c
index 7b53d89..932a812 100644
--- a/arch/arm/src/armv6-m/arm_signal_dispatch.c
+++ b/arch/arm/src/armv6-m/arm_signal_dispatch.c
@@ -25,7 +25,8 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "arm_internal.h"
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
diff --git a/arch/arm/src/armv6-m/arm_signal_handler.S b/arch/arm/src/armv6-m/arm_signal_handler.S
index 472b184..1f76daa 100644
--- a/arch/arm/src/armv6-m/arm_signal_handler.S
+++ b/arch/arm/src/armv6-m/arm_signal_handler.S
@@ -61,7 +61,7 @@
*
* Returned Value:
* None. This function does not return in the normal sense. It returns
- * via the SYS_signal_handler_return (see svcall.h)
+ * via the SYS_signal_handler_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/arm/src/armv6-m/arm_svcall.c b/arch/arm/src/armv6-m/arm_svcall.c
index 9f5447c..701541b 100644
--- a/arch/arm/src/armv6-m/arm_svcall.c
+++ b/arch/arm/src/armv6-m/arm_svcall.c
@@ -29,12 +29,12 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
+#include <syscall.h>
#include <arch/irq.h>
#include <nuttx/sched.h>
#include "signal/signal.h"
-#include "svcall.h"
#include "exc_return.h"
#include "arm_internal.h"
diff --git a/arch/arm/src/armv6-m/svcall.h b/arch/arm/src/armv6-m/svcall.h
deleted file mode 100644
index a790f58..0000000
--- a/arch/arm/src/armv6-m/svcall.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
- * arch/arm/src/armv6-m/svcall.h
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_ARMV6_M_SVCALL_H
-#define __ARCH_ARM_SRC_ARMV6_M_SVCALL_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <syscall.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* This logic uses three system calls {0,1,2} for context switching and one
- * for the syscall return.
- * So a minimum of four syscall values must be reserved.
- * If CONFIG_BUILD_PROTECTED is defined, then four more syscall values must
- * be reserved.
- */
-
-#ifdef CONFIG_LIB_SYSCALL
-# ifdef CONFIG_BUILD_PROTECTED
-# ifndef CONFIG_SYS_RESERVED
-# 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
-# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
-# elif CONFIG_SYS_RESERVED != 4
-# error "CONFIG_SYS_RESERVED must have the value 4"
-# endif
-# endif
-#endif
-
-/* Cortex M0 system calls ***************************************************/
-
-/* SYS call 0:
- *
- * int arm_saveusercontext(uint32_t *saveregs);
- */
-
-#define SYS_save_context (0)
-
-/* SYS call 1:
- *
- * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
- */
-
-#define SYS_restore_context (1)
-
-/* SYS call 2:
- *
- * void arm_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
- */
-
-#define SYS_switch_context (2)
-
-#ifdef CONFIG_LIB_SYSCALL
-/* SYS call 3:
- *
- * void arm_syscall_return(void);
- */
-
-#define SYS_syscall_return (3)
-
-#ifndef CONFIG_BUILD_FLAT
-#ifdef CONFIG_BUILD_PROTECTED
-/* SYS call 4:
- *
- * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
- * noreturn_function;
- */
-
-#define SYS_task_start (4)
-
-/* SYS call 6:
- *
- * void signal_handler(_sa_sigaction_t sighand, int signo,
- * FAR siginfo_t *info,
- * FAR void *ucontext);
- */
-
-#define SYS_signal_handler (6)
-
-/* SYS call 7:
- *
- * void signal_handler_return(void);
- */
-
-#define SYS_signal_handler_return (7)
-
-#endif /* CONFIG_BUILD_PROTECTED */
-
-/* SYS call 5:
- *
- * void up_pthread_start(pthread_startroutine_t startup,
- * pthread_startroutine_t entrypt, pthread_addr_t arg)
- * noreturn_function
- */
-
-#define SYS_pthread_start (5)
-
-#endif /* !CONFIG_BUILD_FLAT */
-#endif /* CONFIG_LIB_SYSCALL */
-
-/****************************************************************************
- * Inline Functions
- ****************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_ARMV6_M_SVCALL_H */
diff --git a/arch/arm/src/armv7-a/arm_fullcontextrestore.S b/arch/arm/src/armv7-a/arm_fullcontextrestore.S
index 12063b3..ce06321 100644
--- a/arch/arm/src/armv7-a/arm_fullcontextrestore.S
+++ b/arch/arm/src/armv7-a/arm_fullcontextrestore.S
@@ -24,8 +24,8 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
-#include "svcall.h"
#include "arm.h"
/****************************************************************************
diff --git a/arch/arm/src/armv7-a/arm_signal_dispatch.c b/arch/arm/src/armv7-a/arm_signal_dispatch.c
index ba7f270..8a94b46 100644
--- a/arch/arm/src/armv7-a/arm_signal_dispatch.c
+++ b/arch/arm/src/armv7-a/arm_signal_dispatch.c
@@ -25,7 +25,8 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "pgalloc.h"
#include "arm_internal.h"
diff --git a/arch/arm/src/armv7-a/arm_syscall.c b/arch/arm/src/armv7-a/arm_syscall.c
index 436a01c..32d235b 100644
--- a/arch/arm/src/armv7-a/arm_syscall.c
+++ b/arch/arm/src/armv7-a/arm_syscall.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
+#include <syscall.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
@@ -36,7 +37,6 @@
#include "signal/signal.h"
#include "arm.h"
-#include "svcall.h"
#include "addrenv.h"
#include "arm_internal.h"
diff --git a/arch/arm/src/armv7-a/crt0.c b/arch/arm/src/armv7-a/crt0.c
index 86a2669..71a3a71 100644
--- a/arch/arm/src/armv7-a/crt0.c
+++ b/arch/arm/src/armv7-a/crt0.c
@@ -29,7 +29,7 @@
#include <nuttx/addrenv.h>
-#include "svcall.h"
+#include <arch/syscall.h>
#ifdef CONFIG_BUILD_KERNEL
@@ -62,7 +62,7 @@ int main(int argc, char *argv[]);
*
* Returned Value:
* None. This function does not return in the normal sense. It returns
- * via the SYS_signal_handler_return (see svcall.h)
+ * via the SYS_signal_handler_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/arm/src/armv7-a/svcall.h b/arch/arm/src/armv7-a/svcall.h
deleted file mode 100644
index 3999a9e..0000000
--- a/arch/arm/src/armv7-a/svcall.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
- * arch/arm/src/armv7-a/svcall.h
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_ARMV7_A_SVCALL_H
-#define __ARCH_ARM_SRC_ARMV7_A_SVCALL_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <syscall.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* This logic uses one system call for the syscall return. So a minimum of
- * one syscall values must be reserved. If CONFIG_BUILD_KERNEL is defined,
- * then four more syscall values must be reserved.
- */
-
-#ifdef CONFIG_LIB_SYSCALL
-# 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 have the value 7"
-# endif
-# else
-# ifndef CONFIG_SYS_RESERVED
-# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
-# elif CONFIG_SYS_RESERVED != 4
-# error "CONFIG_SYS_RESERVED must have the value 4"
-# endif
-# endif
-#endif
-
-/* Cortex-A system calls ****************************************************/
-
-/* SYS call 0:
- *
- * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
- */
-
-#define SYS_restore_context (0)
-
-/* SYS call 1:
- *
- * void arm_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
- */
-
-#define SYS_switch_context (1)
-
-#ifdef CONFIG_LIB_SYSCALL
-/* SYS call 2:
- *
- * void arm_syscall_return(void);
- */
-
-#define SYS_syscall_return (2)
-
-#ifndef CONFIG_BUILD_FLAT
-#ifdef CONFIG_BUILD_KERNEL
-/* SYS call 3:
- *
- * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
- * noreturn_function;
- */
-
-#define SYS_task_start (3)
-
-/* SYS call 5:
- *
- * void signal_handler(_sa_sigaction_t sighand,
- * int signo, FAR siginfo_t *info,
- * FAR void *ucontext);
- */
-
-#define SYS_signal_handler (5)
-
-/* SYS call 6:
- *
- * void signal_handler_return(void);
- */
-
-#define SYS_signal_handler_return (6)
-
-#endif /* !CONFIG_BUILD_FLAT */
-
-/* SYS call 4:
- *
- * void up_pthread_start(pthread_startroutine_t startup,
- * pthread_startroutine_t entrypt, pthread_addr_t arg)
- * noreturn_function
- */
-
-#define SYS_pthread_start (4)
-
-#endif /* CONFIG_BUILD_KERNEL */
-#endif /* CONFIG_LIB_SYSCALL */
-
-/****************************************************************************
- * Inline Functions
- ****************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_ARMV7_A_SVCALL_H */
diff --git a/arch/arm/src/armv7-m/arm_signal_dispatch.c b/arch/arm/src/armv7-m/arm_signal_dispatch.c
index 9c1c448..4b6b472 100644
--- a/arch/arm/src/armv7-m/arm_signal_dispatch.c
+++ b/arch/arm/src/armv7-m/arm_signal_dispatch.c
@@ -25,7 +25,8 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "arm_internal.h"
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
diff --git a/arch/arm/src/armv7-m/arm_svcall.c b/arch/arm/src/armv7-m/arm_svcall.c
index 1330dc3..7eceeaa 100644
--- a/arch/arm/src/armv7-m/arm_svcall.c
+++ b/arch/arm/src/armv7-m/arm_svcall.c
@@ -29,13 +29,13 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
+#include <syscall.h>
#include <arch/irq.h>
#include <nuttx/sched.h>
#include <nuttx/userspace.h>
#include "signal/signal.h"
-#include "svcall.h"
#include "exc_return.h"
#include "arm_internal.h"
diff --git a/arch/arm/src/armv7-m/gnu/arm_fullcontextrestore.S b/arch/arm/src/armv7-m/gnu/arm_fullcontextrestore.S
index 697ab1e..54351f2 100644
--- a/arch/arm/src/armv7-m/gnu/arm_fullcontextrestore.S
+++ b/arch/arm/src/armv7-m/gnu/arm_fullcontextrestore.S
@@ -24,9 +24,9 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
#include "nvic.h"
-#include "svcall.h"
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/armv7-m/gnu/arm_saveusercontext.S b/arch/arm/src/armv7-m/gnu/arm_saveusercontext.S
index 013d5f1..c5b12a3 100644
--- a/arch/arm/src/armv7-m/gnu/arm_saveusercontext.S
+++ b/arch/arm/src/armv7-m/gnu/arm_saveusercontext.S
@@ -24,9 +24,9 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
#include "nvic.h"
-#include "svcall.h"
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/armv7-m/gnu/arm_signal_handler.S b/arch/arm/src/armv7-m/gnu/arm_signal_handler.S
index e0bdf7a..fa83e6c 100644
--- a/arch/arm/src/armv7-m/gnu/arm_signal_handler.S
+++ b/arch/arm/src/armv7-m/gnu/arm_signal_handler.S
@@ -63,7 +63,7 @@
*
* Returned Value:
* None. This function does not return in the normal sense. It returns
- * via the SYS_signal_handler_return (see svcall.h)
+ * via the SYS_signal_handler_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/arm/src/armv7-m/iar/arm_fullcontextrestore.S b/arch/arm/src/armv7-m/iar/arm_fullcontextrestore.S
index 61063e2..7f0ad65 100644
--- a/arch/arm/src/armv7-m/iar/arm_fullcontextrestore.S
+++ b/arch/arm/src/armv7-m/iar/arm_fullcontextrestore.S
@@ -24,9 +24,9 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
#include "nvic.h"
-#include "svcall.h"
MODULE arm_fullcontextrestore
SECTION .text:CODE:NOROOT(2)
diff --git a/arch/arm/src/armv7-m/iar/arm_saveusercontext.S b/arch/arm/src/armv7-m/iar/arm_saveusercontext.S
index 08817a8..1806865 100644
--- a/arch/arm/src/armv7-m/iar/arm_saveusercontext.S
+++ b/arch/arm/src/armv7-m/iar/arm_saveusercontext.S
@@ -24,9 +24,9 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
#include "nvic.h"
-#include "svcall.h"
MODULE arm_saveusercontext
SECTION .text:CODE:NOROOT(2)
diff --git a/arch/arm/src/armv7-m/svcall.h b/arch/arm/src/armv7-m/svcall.h
deleted file mode 100644
index 98a574e..0000000
--- a/arch/arm/src/armv7-m/svcall.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
- * arch/arm/src/armv7-m/svcall.h
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_ARMV7_M_SVCALL_H
-#define __ARCH_ARM_SRC_ARMV7_M_SVCALL_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <syscall.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* This logic uses three system calls {0,1,2} for context switching and one
- * for the syscall return.
- * So a minimum of four syscall values must be reserved.
- * If CONFIG_BUILD_PROTECTED is defined, then four more syscall values must
- * be reserved.
- */
-
-#ifdef CONFIG_LIB_SYSCALL
-# ifdef CONFIG_BUILD_PROTECTED
-# ifndef CONFIG_SYS_RESERVED
-# 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
-# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
-# elif CONFIG_SYS_RESERVED != 4
-# error "CONFIG_SYS_RESERVED must have the value 4"
-# endif
-# endif
-#endif
-
-/* Cortex-M system calls ****************************************************/
-
-/* SYS call 0:
- *
- * int arm_saveusercontext(uint32_t *saveregs);
- */
-
-#define SYS_save_context (0)
-
-/* SYS call 1:
- *
- * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
- */
-
-#define SYS_restore_context (1)
-
-/* SYS call 2:
- *
- * void arm_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
- */
-
-#define SYS_switch_context (2)
-
-#ifndef CONFIG_BUILD_FLAT
-#ifdef CONFIG_LIB_SYSCALL
-/* SYS call 3:
- *
- * void arm_syscall_return(void);
- */
-
-#define SYS_syscall_return (3)
-
-#ifdef CONFIG_BUILD_PROTECTED
-/* SYS call 4:
- *
- * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
- * noreturn_function;
- */
-
-#define SYS_task_start (4)
-
-/* SYS call 6:
- *
- * void signal_handler(_sa_sigaction_t sighand,
- * int signo, FAR siginfo_t *info,
- * FAR void *ucontext);
- */
-
-#define SYS_signal_handler (6)
-
-/* SYS call 7:
- *
- * void signal_handler_return(void);
- */
-
-#define SYS_signal_handler_return (7)
-
-#endif /* CONFIG_BUILD_PROTECTED */
-
-/* SYS call 5:
- *
- * void up_pthread_start((pthread_startroutine_t startup,
- * pthread_startroutine_t entrypt, pthread_addr_t arg)
- * noreturn_function
- */
-
-#define SYS_pthread_start (5)
-
-#endif /* !CONFIG_BUILD_FLAT */
-#endif /* CONFIG_LIB_SYSCALL */
-
-/****************************************************************************
- * Inline Functions
- ****************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_ARMV7_M_SVCALL_H */
diff --git a/arch/arm/src/armv7-r/arm_fullcontextrestore.S b/arch/arm/src/armv7-r/arm_fullcontextrestore.S
index 9af7219..16ccc60 100644
--- a/arch/arm/src/armv7-r/arm_fullcontextrestore.S
+++ b/arch/arm/src/armv7-r/arm_fullcontextrestore.S
@@ -24,8 +24,7 @@
#include <nuttx/config.h>
#include <arch/irq.h>
-
-#include "svcall.h"
+#include <arch/syscall.h>
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/armv7-r/arm_signal_dispatch.c b/arch/arm/src/armv7-r/arm_signal_dispatch.c
index 0739b07..a229d42 100644
--- a/arch/arm/src/armv7-r/arm_signal_dispatch.c
+++ b/arch/arm/src/armv7-r/arm_signal_dispatch.c
@@ -25,7 +25,8 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "pgalloc.h"
#include "arm_internal.h"
diff --git a/arch/arm/src/armv7-r/arm_signal_handler.S b/arch/arm/src/armv7-r/arm_signal_handler.S
index bbee3f7..585f362 100644
--- a/arch/arm/src/armv7-r/arm_signal_handler.S
+++ b/arch/arm/src/armv7-r/arm_signal_handler.S
@@ -61,7 +61,7 @@
*
* Returned Value:
* None. This function does not return in the normal sense. It returns
- * via the SYS_signal_handler_return (see svcall.h)
+ * via the SYS_signal_handler_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/arm/src/armv7-r/arm_syscall.c b/arch/arm/src/armv7-r/arm_syscall.c
index 719d270..eebb0ae 100644
--- a/arch/arm/src/armv7-r/arm_syscall.c
+++ b/arch/arm/src/armv7-r/arm_syscall.c
@@ -28,13 +28,13 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
+#include <syscall.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "signal/signal.h"
#include "arm.h"
-#include "svcall.h"
#include "arm_internal.h"
/****************************************************************************
diff --git a/arch/arm/src/armv7-r/svcall.h b/arch/arm/src/armv7-r/svcall.h
deleted file mode 100644
index b0efecd..0000000
--- a/arch/arm/src/armv7-r/svcall.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
- * arch/arm/src/armv7-r/svcall.h
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_ARMV7_R_SVCALL_H
-#define __ARCH_ARM_SRC_ARMV7_R_SVCALL_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <syscall.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* This logic uses one system call for the syscall return.
- * So a minimum of one syscall values must be reserved.
- * If CONFIG_BUILD_PROTECTED is defined, then four
- * more syscall values must be reserved.
- */
-
-#ifdef CONFIG_LIB_SYSCALL
-# 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 have the value 7"
-# endif
-# else
-# ifndef CONFIG_SYS_RESERVED
-# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
-# elif CONFIG_SYS_RESERVED != 4
-# error "CONFIG_SYS_RESERVED must have the value 4"
-# endif
-# endif
-#endif
-
-/* Cortex-R system calls ****************************************************/
-
-/* SYS call 0:
- *
- * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
- */
-
-#define SYS_restore_context (0)
-
-/* SYS call 1:
- *
- * void arm_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
- */
-
-#define SYS_switch_context (1)
-
-#ifdef CONFIG_LIB_SYSCALL
-/* SYS call 2:
- *
- * void arm_syscall_return(void);
- */
-
-#define SYS_syscall_return (2)
-
-#ifndef CONFIG_BUILD_FLAT
-#ifdef CONFIG_BUILD_KERNEL
-/* SYS call 3:
- *
- * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
- * noreturn_function;
- */
-
-#define SYS_task_start (3)
-
-/* SYS call 5:
- *
- * void signal_handler(_sa_sigaction_t sighand,
- * int signo, FAR siginfo_t *info,
- * FAR void *ucontext);
- */
-
-#define SYS_signal_handler (5)
-
-/* SYS call 6:
- *
- * void signal_handler_return(void);
- */
-
-#define SYS_signal_handler_return (6)
-
-#endif /* !CONFIG_BUILD_FLAT */
-
-/* SYS call 4:
- *
- * void up_pthread_start(pthread_startroutine_t startup,
- * pthread_startroutine_t entrypt, pthread_addr_t arg)
- * noreturn_function
- */
-
-#define SYS_pthread_start (4)
-
-#endif /* !CONFIG_BUILD_FLAT */
-#endif /* CONFIG_LIB_SYSCALL */
-
-/****************************************************************************
- * Inline Functions
- ****************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_ARMV7_R_SVCALL_H */
diff --git a/arch/arm/src/armv8-m/arm_fullcontextrestore.S b/arch/arm/src/armv8-m/arm_fullcontextrestore.S
index 62e47fa..0227bd2 100644
--- a/arch/arm/src/armv8-m/arm_fullcontextrestore.S
+++ b/arch/arm/src/armv8-m/arm_fullcontextrestore.S
@@ -24,9 +24,9 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
#include "nvic.h"
-#include "svcall.h"
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/armv8-m/arm_saveusercontext.S b/arch/arm/src/armv8-m/arm_saveusercontext.S
index 2620abf..0de40f3 100644
--- a/arch/arm/src/armv8-m/arm_saveusercontext.S
+++ b/arch/arm/src/armv8-m/arm_saveusercontext.S
@@ -24,9 +24,9 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+#include <arch/syscall.h>
#include "nvic.h"
-#include "svcall.h"
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/armv8-m/arm_signal_dispatch.c b/arch/arm/src/armv8-m/arm_signal_dispatch.c
index ac9409b..62baf3c 100644
--- a/arch/arm/src/armv8-m/arm_signal_dispatch.c
+++ b/arch/arm/src/armv8-m/arm_signal_dispatch.c
@@ -25,7 +25,8 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "arm_internal.h"
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
diff --git a/arch/arm/src/armv8-m/arm_signal_handler.S b/arch/arm/src/armv8-m/arm_signal_handler.S
index 73ce9b6..b2bac1a 100644
--- a/arch/arm/src/armv8-m/arm_signal_handler.S
+++ b/arch/arm/src/armv8-m/arm_signal_handler.S
@@ -63,7 +63,7 @@
*
* Returned Value:
* None. This function does not return in the normal sense. It returns
- * via the SYS_signal_handler_return (see svcall.h)
+ * via the SYS_signal_handler_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/arm/src/armv8-m/arm_svcall.c b/arch/arm/src/armv8-m/arm_svcall.c
index 50d5be5..ae1e80c 100644
--- a/arch/arm/src/armv8-m/arm_svcall.c
+++ b/arch/arm/src/armv8-m/arm_svcall.c
@@ -28,13 +28,13 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
+#include <syscall.h>
#include <arch/irq.h>
#include <nuttx/sched.h>
#include <nuttx/userspace.h>
#include "signal/signal.h"
-#include "svcall.h"
#include "exc_return.h"
#include "arm_internal.h"
diff --git a/arch/arm/src/armv8-m/svcall.h b/arch/arm/src/armv8-m/svcall.h
deleted file mode 100644
index 7213084..0000000
--- a/arch/arm/src/armv8-m/svcall.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
- * arch/arm/src/armv8-m/svcall.h
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_ARMV8_M_SVCALL_H
-#define __ARCH_ARM_SRC_ARMV8_M_SVCALL_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <syscall.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* This logic uses three system calls {0,1,2} for context switching and one
- * for the syscall return. So a minimum of four syscall values must be
- *reserved. If CONFIG_BUILD_PROTECTED is defined, then four more syscall
- * values must be reserved.
- */
-
-#ifdef CONFIG_LIB_SYSCALL
-# ifdef CONFIG_BUILD_PROTECTED
-# ifndef CONFIG_SYS_RESERVED
-# 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
-# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
-# elif CONFIG_SYS_RESERVED != 4
-# error "CONFIG_SYS_RESERVED must have the value 4"
-# endif
-# endif
-#endif
-
-/* Cortex-M system calls ****************************************************/
-
-/* SYS call 0:
- *
- * int arm_saveusercontext(uint32_t *saveregs);
- */
-
-#define SYS_save_context (0)
-
-/* SYS call 1:
- *
- * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
- */
-
-#define SYS_restore_context (1)
-
-/* SYS call 2:
- *
- * void arm_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
- */
-
-#define SYS_switch_context (2)
-
-#ifdef CONFIG_LIB_SYSCALL
-/* SYS call 3:
- *
- * void arm_syscall_return(void);
- */
-
-#define SYS_syscall_return (3)
-
-#ifndef CONFIG_BUILD_FLAT
-#ifdef CONFIG_BUILD_PROTECTED
-/* SYS call 4:
- *
- * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
- * noreturn_function;
- */
-
-#define SYS_task_start (4)
-
-/* SYS call 6:
- *
- * void signal_handler(_sa_sigaction_t sighand,
- * int signo, FAR siginfo_t *info,
- * FAR void *ucontext);
- */
-
-#define SYS_signal_handler (6)
-
-/* SYS call 7:
- *
- * void signal_handler_return(void);
- */
-
-#define SYS_signal_handler_return (7)
-
-#endif /* CONFIG_BUILD_PROTECTED */
-
-/* SYS call 5:
- *
- * void up_pthread_start(pthread_startroutine_t startup,
- * pthread_startroutine_t entrypt, pthread_addr_t arg)
- * noreturn_function
- */
-
-#define SYS_pthread_start (5)
-
-#endif /* !CONFIG_BUILD_FLAT */
-#endif /* CONFIG_LIB_SYSCALL */
-
-/****************************************************************************
- * Inline Functions
- ****************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_ARMV8_M_SVCALL_H */
diff --git a/arch/arm/src/common/arm_pthread_start.c b/arch/arm/src/common/arm_pthread_start.c
index 0caf5ef..68930b0 100644
--- a/arch/arm/src/common/arm_pthread_start.c
+++ b/arch/arm/src/common/arm_pthread_start.c
@@ -28,7 +28,8 @@
#include <assert.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "arm_internal.h"
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
diff --git a/arch/arm/src/common/arm_switchcontext.c b/arch/arm/src/common/arm_switchcontext.c
index a7944f2..3a1c568 100644
--- a/arch/arm/src/common/arm_switchcontext.c
+++ b/arch/arm/src/common/arm_switchcontext.c
@@ -24,8 +24,7 @@
#include <nuttx/config.h>
-#include "svcall.h"
-#include "syscall.h"
+#include <arch/syscall.h>
/****************************************************************************
* Public Functions
diff --git a/arch/arm/src/common/arm_task_start.c b/arch/arm/src/common/arm_task_start.c
index 53cfd8b..3c7e9ec 100644
--- a/arch/arm/src/common/arm_task_start.c
+++ b/arch/arm/src/common/arm_task_start.c
@@ -27,7 +27,8 @@
#include <assert.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "arm_internal.h"
#ifndef CONFIG_BUILD_FLAT
diff --git a/arch/ceva/include/syscall.h b/arch/ceva/include/syscall.h
index 8ad4166..4342718 100644
--- a/arch/ceva/include/syscall.h
+++ b/arch/ceva/include/syscall.h
@@ -39,6 +39,96 @@
* Pre-processor Definitions
****************************************************************************/
+/* Configuration ************************************************************/
+
+/* This logic uses three system calls {0,1,2} for context switching and one
+ * for the syscall return.
+ * So a minimum of four syscall values must be reserved.
+ * If CONFIG_BUILD_PROTECTED is defined, then four more syscall values
+ * must be reserved.
+ */
+
+#ifdef CONFIG_LIB_SYSCALL
+# ifdef CONFIG_BUILD_PROTECTED
+# ifndef CONFIG_SYS_RESERVED
+# 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
+# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
+# elif CONFIG_SYS_RESERVED != 4
+# error "CONFIG_SYS_RESERVED must have the value 4"
+# endif
+# endif
+#endif
+
+/* CEVA system calls ********************************************************/
+
+/* SYS call 0:
+ *
+ * int up_saveusercontext(uint32_t *saveregs);
+ */
+
+#define SYS_save_context 0x00
+
+/* SYS call 1:
+ *
+ * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
+ */
+
+#define SYS_restore_context 0x01
+
+/* SYS call 2:
+ *
+ * void up_switchcontext(uint32_t **saveregs, uint32_t *restoreregs);
+ */
+
+#define SYS_switch_context 0x02
+
+#ifdef CONFIG_LIB_SYSCALL
+/* SYS call 3:
+ *
+ * void up_syscall_return(void);
+ */
+
+#define SYS_syscall_return 0x03
+#endif /* CONFIG_LIB_SYSCALL */
+
+#ifndef CONFIG_BUILD_FLAT
+/* SYS call 4:
+ *
+ * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
+ * noreturn_function;
+ */
+
+#define SYS_task_start 0x04
+
+/* SYS call 5:
+ *
+ * void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
+ * noreturn_function
+ */
+
+#define SYS_pthread_start 0x05
+
+/* SYS call 6:
+ *
+ * void signal_handler(_sa_sigaction_t sighand, int signo,
+ * FAR siginfo_t *info, FAR void *ucontext);
+ */
+
+#define SYS_signal_handler 0x06
+
+/* SYS call 7:
+ *
+ * void signal_handler_return(void);
+ */
+
+#define SYS_signal_handler_return 0x07
+#endif /* !CONFIG_BUILD_FLAT */
+
/****************************************************************************
* Public Types
****************************************************************************/
diff --git a/arch/ceva/src/common/svcall.h b/arch/ceva/src/common/svcall.h
deleted file mode 100644
index f7301d3..0000000
--- a/arch/ceva/src/common/svcall.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
- * arch/ceva/src/common/svcall.h
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_CEVA_SRC_COMMON_SVCALL_H
-#define __ARCH_CEVA_SRC_COMMON_SVCALL_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <syscall.h>
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* This logic uses three system calls {0,1,2} for context switching and one
- * for the syscall return.
- * So a minimum of four syscall values must be reserved.
- * If CONFIG_BUILD_PROTECTED is defined, then four more syscall values
- * must be reserved.
- */
-
-#ifdef CONFIG_LIB_SYSCALL
-# ifdef CONFIG_BUILD_PROTECTED
-# ifndef CONFIG_SYS_RESERVED
-# 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
-# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
-# elif CONFIG_SYS_RESERVED != 4
-# error "CONFIG_SYS_RESERVED must have the value 4"
-# endif
-# endif
-#endif
-
-/* CEVA system calls ********************************************************/
-
-/* SYS call 0:
- *
- * int up_saveusercontext(uint32_t *saveregs);
- */
-
-#define SYS_save_context 0x00
-
-/* SYS call 1:
- *
- * void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
- */
-
-#define SYS_restore_context 0x01
-
-/* SYS call 2:
- *
- * void up_switchcontext(uint32_t **saveregs, uint32_t *restoreregs);
- */
-
-#define SYS_switch_context 0x02
-
-#ifdef CONFIG_LIB_SYSCALL
-/* SYS call 3:
- *
- * void up_syscall_return(void);
- */
-
-#define SYS_syscall_return 0x03
-
-#ifdef CONFIG_BUILD_PROTECTED
-/* SYS call 4:
- *
- * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
- * noreturn_function;
- */
-
-#define SYS_task_start 0x04
-
-/* SYS call 5:
- *
- * void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
- * noreturn_function
- */
-
-#define SYS_pthread_start 0x05
-
-/* SYS call 6:
- *
- * void signal_handler(_sa_sigaction_t sighand, int signo,
- * FAR siginfo_t *info, FAR void *ucontext);
- */
-
-#define SYS_signal_handler 0x06
-
-/* SYS call 7:
- *
- * void signal_handler_return(void);
- */
-
-#define SYS_signal_handler_return 0x07
-
-#endif /* CONFIG_BUILD_PROTECTED */
-#endif /* CONFIG_LIB_SYSCALL */
-
-/****************************************************************************
- * Inline Functions
- ****************************************************************************/
-
-#endif /* __ARCH_CEVA_SRC_COMMON_SVCALL_H */
diff --git a/arch/ceva/src/common/up_fullcontextrestore.c b/arch/ceva/src/common/up_fullcontextrestore.c
index 5cf2cb3..8aa008d 100644
--- a/arch/ceva/src/common/up_fullcontextrestore.c
+++ b/arch/ceva/src/common/up_fullcontextrestore.c
@@ -22,7 +22,8 @@
* Included Files
****************************************************************************/
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "up_internal.h"
/****************************************************************************
diff --git a/arch/ceva/src/common/up_pthread_start.c b/arch/ceva/src/common/up_pthread_start.c
index d05c31e..03194b0 100644
--- a/arch/ceva/src/common/up_pthread_start.c
+++ b/arch/ceva/src/common/up_pthread_start.c
@@ -26,7 +26,7 @@
#include <pthread.h>
#include <nuttx/arch.h>
-#include "svcall.h"
+#include <arch/syscall.h>
#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_PTHREAD)
diff --git a/arch/ceva/src/common/up_saveusercontext.c b/arch/ceva/src/common/up_saveusercontext.c
index 068592e..0d101e8 100644
--- a/arch/ceva/src/common/up_saveusercontext.c
+++ b/arch/ceva/src/common/up_saveusercontext.c
@@ -25,7 +25,8 @@
#include <nuttx/config.h>
#include <nuttx/irq.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "up_internal.h"
/****************************************************************************
diff --git a/arch/ceva/src/common/up_signal_dispatch.c b/arch/ceva/src/common/up_signal_dispatch.c
index 4065f8e..9f6e709 100644
--- a/arch/ceva/src/common/up_signal_dispatch.c
+++ b/arch/ceva/src/common/up_signal_dispatch.c
@@ -25,7 +25,7 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
-#include "svcall.h"
+#include <arch/syscall.h>
#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_SIGNALS)
diff --git a/arch/ceva/src/common/up_svcall.c b/arch/ceva/src/common/up_svcall.c
index b7889dd..1635bdb 100644
--- a/arch/ceva/src/common/up_svcall.c
+++ b/arch/ceva/src/common/up_svcall.c
@@ -27,12 +27,12 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
+#include <syscall.h>
#include <nuttx/irq.h>
#include <nuttx/sched.h>
#include <nuttx/userspace.h>
-#include "svcall.h"
#include "up_internal.h"
/****************************************************************************
diff --git a/arch/ceva/src/common/up_switchcontext.c b/arch/ceva/src/common/up_switchcontext.c
index c7e9a1c..360d089 100644
--- a/arch/ceva/src/common/up_switchcontext.c
+++ b/arch/ceva/src/common/up_switchcontext.c
@@ -22,7 +22,8 @@
* Included Files
****************************************************************************/
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "up_internal.h"
/****************************************************************************
diff --git a/arch/ceva/src/common/up_task_start.c b/arch/ceva/src/common/up_task_start.c
index 62ac279..11bf102 100644
--- a/arch/ceva/src/common/up_task_start.c
+++ b/arch/ceva/src/common/up_task_start.c
@@ -25,7 +25,7 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
-#include "svcall.h"
+#include <arch/syscall.h>
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)
diff --git a/arch/ceva/src/xc5/up_signal_handler.S b/arch/ceva/src/xc5/up_signal_handler.S
index 8d29ba5..8b231b8 100644
--- a/arch/ceva/src/xc5/up_signal_handler.S
+++ b/arch/ceva/src/xc5/up_signal_handler.S
@@ -24,7 +24,7 @@
#include <nuttx/config.h>
-#include "svcall.h"
+#include <arch/syscall.h>
#if (defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)) && \
!defined(CONFIG_DISABLE_SIGNALS)
@@ -54,7 +54,7 @@
*
* Returned Value:
* None. This function does not return in the normal sense. It returns
- * via the SYS_signal_handler_return (see svcall.h)
+ * via the SYS_signal_handler_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/ceva/src/xc5/up_svcall_handler.S b/arch/ceva/src/xc5/up_svcall_handler.S
index e955c5c..565753f 100644
--- a/arch/ceva/src/xc5/up_svcall_handler.S
+++ b/arch/ceva/src/xc5/up_svcall_handler.S
@@ -24,7 +24,7 @@
#include <nuttx/config.h>
-#include "svcall.h"
+#include <arch/syscall.h>
#ifdef CONFIG_LIB_SYSCALL
@@ -59,7 +59,7 @@
*
* Returned Value:
* None. This function does not return in the normal sense. It returns
- * via the SYS_syscall_return (see svcall.h)
+ * via the SYS_syscall_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/ceva/src/xc5/vfork.S b/arch/ceva/src/xc5/vfork.S
index 7a125ab46..348e676 100644
--- a/arch/ceva/src/xc5/vfork.S
+++ b/arch/ceva/src/xc5/vfork.S
@@ -25,7 +25,7 @@
#include <nuttx/config.h>
#include <nuttx/irq.h>
-#include "svcall.h"
+#include <arch/syscall.h>
/****************************************************************************
* Public Symbols
diff --git a/arch/ceva/src/xm6/up_signal_handler.S b/arch/ceva/src/xm6/up_signal_handler.S
index 550405c..07bb3af 100644
--- a/arch/ceva/src/xm6/up_signal_handler.S
+++ b/arch/ceva/src/xm6/up_signal_handler.S
@@ -24,7 +24,7 @@
#include <nuttx/config.h>
-#include "svcall.h"
+#include <arch/syscall.h>
#if (defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)) && \
!defined(CONFIG_DISABLE_SIGNALS)
@@ -54,7 +54,7 @@
*
* Return:
* None. This function does not return in the normal sense. It returns
- * via the SYS_signal_handler_return (see svcall.h)
+ * via the SYS_signal_handler_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/ceva/src/xm6/up_svcall_handler.S b/arch/ceva/src/xm6/up_svcall_handler.S
index 9aa63d7..d6b2603 100644
--- a/arch/ceva/src/xm6/up_svcall_handler.S
+++ b/arch/ceva/src/xm6/up_svcall_handler.S
@@ -24,7 +24,7 @@
#include <nuttx/config.h>
-#include "svcall.h"
+#include <arch/syscall.h>
#ifdef CONFIG_LIB_SYSCALL
@@ -59,7 +59,7 @@
*
* Return:
* None. This function does not return in the normal sense. It returns
- * via the SYS_syscall_return (see svcall.h)
+ * via the SYS_syscall_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/ceva/src/xm6/vfork.S b/arch/ceva/src/xm6/vfork.S
index 4982e4d..9aa04a8 100644
--- a/arch/ceva/src/xm6/vfork.S
+++ b/arch/ceva/src/xm6/vfork.S
@@ -25,7 +25,7 @@
#include <nuttx/config.h>
#include <nuttx/irq.h>
-#include "svcall.h"
+#include <arch/syscall.h>
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/or1k/src/common/up_pthread_start.c b/arch/or1k/src/common/up_pthread_start.c
index 77481ec..060a711 100644
--- a/arch/or1k/src/common/up_pthread_start.c
+++ b/arch/or1k/src/common/up_pthread_start.c
@@ -27,7 +27,8 @@
#include <nuttx/arch.h>
#include <assert.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "up_internal.h"
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
diff --git a/arch/or1k/src/common/up_task_start.c b/arch/or1k/src/common/up_task_start.c
index f059611..6e5149d 100644
--- a/arch/or1k/src/common/up_task_start.c
+++ b/arch/or1k/src/common/up_task_start.c
@@ -26,7 +26,8 @@
#include <nuttx/arch.h>
#include <assert.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "up_internal.h"
#ifndef CONFIG_BUILD_FLAT
diff --git a/arch/risc-v/include/syscall.h b/arch/risc-v/include/syscall.h
index b59be33..3bd5189 100644
--- a/arch/risc-v/include/syscall.h
+++ b/arch/risc-v/include/syscall.h
@@ -41,17 +41,31 @@
#define SYS_syscall 0x00
-/* The SYS_signal_handler_return is executed here... its value is not always
- * available in this context and so is assumed to be 7.
+/* Configuration ************************************************************/
+
+/* This logic uses three system calls {0,1,2} for context switching and one
+ * for the syscall return. So a minimum of four syscall values must be
+ * reserved. If CONFIG_BUILD_PROTECTED is defined, then four more syscall
+ * values must be reserved.
*/
-#ifndef SYS_signal_handler_return
-# define SYS_signal_handler_return (7)
-#elif SYS_signal_handler_return != 7
-# error "SYS_signal_handler_return was assumed to be 7"
+#ifdef CONFIG_LIB_SYSCALL
+# ifdef CONFIG_BUILD_PROTECTED
+# ifndef CONFIG_SYS_RESERVED
+# 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
+# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
+# elif CONFIG_SYS_RESERVED != 4
+# error "CONFIG_SYS_RESERVED must have the value 4"
+# endif
+# endif
#endif
-/* Configuration ************************************************************/
+/* RV64GC system calls ******************************************************/
/* SYS call 1 and 2 are defined for internal use by the RISC-V port (see
* arch/risc-v/include/syscall.h). In addition, SYS call 3 is the
@@ -59,13 +73,64 @@
* therefore, be reserved (0 is not used).
*/
-#ifdef CONFIG_BUILD_KERNEL
-# ifndef CONFIG_SYS_RESERVED
-# error "CONFIG_SYS_RESERVED must be defined to the value 4"
-# elif CONFIG_SYS_RESERVED != 4
-# error "CONFIG_SYS_RESERVED must have the value 4"
-# endif
-#endif
+#define SYS_save_context (0)
+
+/* SYS call 1:
+ *
+ * void riscv_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
+ */
+
+#define SYS_restore_context (1)
+
+/* SYS call 2:
+ *
+ * void riscv_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
+ */
+
+#define SYS_switch_context (2)
+
+#ifdef CONFIG_LIB_SYSCALL
+/* SYS call 3:
+ *
+ * void riscv_syscall_return(void);
+ */
+
+#define SYS_syscall_return (3)
+#endif /* CONFIG_LIB_SYSCALL */
+
+#ifndef CONFIG_BUILD_FLAT
+/* SYS call 4:
+ *
+ * void up_task_start(main_t taskentry, int argc, char *argv[])
+ * noreturn_function;
+ */
+
+#define SYS_task_start (4)
+
+/* SYS call 5:
+ *
+ * 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 6:
+ *
+ * void signal_handler(_sa_sigaction_t sighand, int signo,
+ * siginfo_t *info, void *ucontext);
+ */
+
+#define SYS_signal_handler (6)
+
+/* SYS call 7:
+ *
+ * void signal_handler_return(void);
+ */
+
+#define SYS_signal_handler_return (7)
+#endif /* !CONFIG_BUILD_FLAT */
/* sys_call macros **********************************************************/
@@ -82,7 +147,6 @@
* 1: Context Switch Return
*/
-#define SYS_save_context (0)
#define riscv_saveusercontext(saveregs) \
(int)sys_call1(SYS_save_context, (uintptr_t)saveregs)
@@ -91,7 +155,6 @@
* void riscv_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
*/
-#define SYS_restore_context (1)
#define riscv_fullcontextrestore(restoreregs) \
sys_call1(SYS_restore_context, (uintptr_t)restoreregs)
@@ -100,7 +163,6 @@
* void riscv_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
*/
-#define SYS_switch_context (2)
#define riscv_switchcontext(saveregs, restoreregs) \
sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs)
@@ -110,7 +172,6 @@
* void riscv_syscall_return(void);
*/
-#define SYS_syscall_return (3)
#define riscv_syscall_return() sys_call0(SYS_syscall_return)
#endif
diff --git a/arch/risc-v/src/common/riscv_pthread_start.c b/arch/risc-v/src/common/riscv_pthread_start.c
index a625385..8dd295a 100644
--- a/arch/risc-v/src/common/riscv_pthread_start.c
+++ b/arch/risc-v/src/common/riscv_pthread_start.c
@@ -27,7 +27,8 @@
#include <nuttx/arch.h>
#include <assert.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "riscv_internal.h"
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
diff --git a/arch/risc-v/src/common/riscv_signal_dispatch.c b/arch/risc-v/src/common/riscv_signal_dispatch.c
index 35b7660..b322053 100644
--- a/arch/risc-v/src/common/riscv_signal_dispatch.c
+++ b/arch/risc-v/src/common/riscv_signal_dispatch.c
@@ -25,7 +25,8 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "riscv_internal.h"
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
diff --git a/arch/risc-v/src/common/riscv_signal_handler.S b/arch/risc-v/src/common/riscv_signal_handler.S
index df3d4a7..52d4704 100644
--- a/arch/risc-v/src/common/riscv_signal_handler.S
+++ b/arch/risc-v/src/common/riscv_signal_handler.S
@@ -57,7 +57,7 @@
*
* Returned Value:
* None. This function does not return in the normal sense. It returns
- * via the SYS_signal_handler_return (see svcall.h)
+ * via the SYS_signal_handler_return (see syscall.h)
*
****************************************************************************/
diff --git a/arch/risc-v/src/common/riscv_swint.c b/arch/risc-v/src/common/riscv_swint.c
index de174f6..38f4cde 100644
--- a/arch/risc-v/src/common/riscv_swint.c
+++ b/arch/risc-v/src/common/riscv_swint.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <assert.h>
#include <debug.h>
+#include <syscall.h>
#include <arch/irq.h>
#include <nuttx/sched.h>
@@ -39,7 +40,6 @@
#endif
#include "signal/signal.h"
-#include "svcall.h"
#include "riscv_internal.h"
/****************************************************************************
diff --git a/arch/risc-v/src/common/riscv_task_start.c b/arch/risc-v/src/common/riscv_task_start.c
index 417db57..d8cc966 100644
--- a/arch/risc-v/src/common/riscv_task_start.c
+++ b/arch/risc-v/src/common/riscv_task_start.c
@@ -26,7 +26,8 @@
#include <nuttx/arch.h>
#include <assert.h>
-#include "svcall.h"
+#include <arch/syscall.h>
+
#include "riscv_internal.h"
#ifndef CONFIG_BUILD_FLAT
diff --git a/arch/risc-v/src/common/svcall.h b/arch/risc-v/src/common/svcall.h
deleted file mode 100644
index 6f93f60..0000000
--- a/arch/risc-v/src/common/svcall.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
- * arch/risc-v/src/common/svcall.h
- *
- * 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.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_RISCV_SRC_COMMON_SVCALL_H
-#define __ARCH_RISCV_SRC_COMMON_SVCALL_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#ifdef CONFIG_LIB_SYSCALL
-# include <syscall.h>
-#endif
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* This logic uses three system calls {0,1,2} for context switching and one
- * for the syscall return. So a minimum of four syscall values must be
- * reserved. If CONFIG_BUILD_PROTECTED is defined, then four more syscall
- * values must be reserved.
- */
-
-#ifdef CONFIG_LIB_SYSCALL
-# ifdef CONFIG_BUILD_PROTECTED
-# ifndef CONFIG_SYS_RESERVED
-# 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
-# error "CONFIG_SYS_RESERVED must be defined to have the value 4"
-# elif CONFIG_SYS_RESERVED != 4
-# error "CONFIG_SYS_RESERVED must have the value 4"
-# endif
-# endif
-#endif
-
-/* RISC-V system calls ******************************************************/
-
-/* SYS call 0:
- *
- * int riscv_saveusercontext(uint32_t *saveregs);
- */
-
-#define SYS_save_context (0)
-
-/* SYS call 1:
- *
- * void riscv_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
- */
-
-#define SYS_restore_context (1)
-
-/* SYS call 2:
- *
- * void riscv_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
- */
-
-#define SYS_switch_context (2)
-
-#ifndef CONFIG_BUILD_FLAT
-#ifdef CONFIG_LIB_SYSCALL
-/* SYS call 3:
- *
- * void riscv_syscall_return(void);
- */
-
-#define SYS_syscall_return (3)
-
-#ifdef CONFIG_BUILD_PROTECTED
-/* SYS call 4:
- *
- * void up_task_start(main_t taskentry, int argc, char *argv[])
- * noreturn_function;
- */
-
-#define SYS_task_start (4)
-/* SYS call 6:
- *
- * void signal_handler(_sa_sigaction_t sighand, int signo,
- * siginfo_t *info, void *ucontext);
- */
-
-#define SYS_signal_handler (6)
-
-/* SYS call 7:
- *
- * void signal_handler_return(void);
- */
-
-#define SYS_signal_handler_return (7)
-
-#endif /* CONFIG_BUILD_PROTECTED */
-
-/* SYS call 5:
- *
- * void up_pthread_start(pthread_startroutine_t startup,
- * pthread_startroutine_t entrypt, pthread_addr_t arg)
- * noreturn_function
- */
-
-#define SYS_pthread_start (5)
-
-#endif /* !CONFIG_BUILD_FLAT */
-#endif /* CONFIG_LIB_SYSCALL */
-
-#endif /* __ARCH_RISCV_SRC_COMMON_SVCALL_H */
diff --git a/arch/xtensa/include/syscall.h b/arch/xtensa/include/syscall.h
index 27150c9..d4330d7 100644
--- a/arch/xtensa/include/syscall.h
+++ b/arch/xtensa/include/syscall.h
@@ -100,7 +100,6 @@
#define SYS_switch_context (2)
-#ifndef CONFIG_BUILD_FLAT
#ifdef CONFIG_LIB_SYSCALL
/* SYS call 3:
@@ -109,9 +108,9 @@
*/
#define SYS_syscall_return (3)
+#endif /* CONFIG_LIB_SYSCALL */
-#ifdef CONFIG_BUILD_PROTECTED
-
+#ifndef CONFIG_BUILD_FLAT
/* SYS call 4:
*
* void up_task_start(main_t taskentry, int argc, char *argv[])
@@ -120,6 +119,15 @@
#define SYS_task_start (4)
+/* SYS call 5:
+ *
+ * void up_pthread_start(pthread_trampoline_t startup,
+ * pthread_startroutine_t entrypt, pthread_addr_t arg)
+ * noreturn_function
+ */
+
+#define SYS_pthread_start (5)
+
/* SYS call 6:
*
* void signal_handler(_sa_sigaction_t sighand, int signo,
@@ -134,20 +142,7 @@
*/
#define SYS_signal_handler_return (7)
-
-#endif /* CONFIG_BUILD_PROTECTED */
-
-/* SYS call 5:
- *
- * void up_pthread_start(pthread_trampoline_t startup,
- * pthread_startroutine_t entrypt, pthread_addr_t arg)
- * noreturn_function
- */
-
-#define SYS_pthread_start (5)
-
#endif /* !CONFIG_BUILD_FLAT */
-#endif /* CONFIG_LIB_SYSCALL */
/****************************************************************************
* Public Types