diff --git a/arch/arm/include/syscall.h b/arch/arm/include/syscall.h index 033be9179a..320455aab8 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 9c6f8e0d0f..736829278b 100644 --- a/arch/arm/src/arm/arm_fullcontextrestore.S +++ b/arch/arm/src/arm/arm_fullcontextrestore.S @@ -24,8 +24,8 @@ #include #include +#include -#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 074f333140..5d13d177d6 100644 --- a/arch/arm/src/arm/arm_syscall.c +++ b/arch/arm/src/arm/arm_syscall.c @@ -27,12 +27,12 @@ #include #include #include +#include #include #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 a6bd67ff6e..0000000000 --- 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 - -#include - -/**************************************************************************** - * 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 509a637682..5f27ea3907 100644 --- a/arch/arm/src/armv6-m/arm_fullcontextrestore.S +++ b/arch/arm/src/armv6-m/arm_fullcontextrestore.S @@ -24,9 +24,9 @@ #include #include +#include #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 311616c47e..284a3f7ecd 100644 --- a/arch/arm/src/armv6-m/arm_saveusercontext.S +++ b/arch/arm/src/armv6-m/arm_saveusercontext.S @@ -24,9 +24,9 @@ #include #include +#include #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 7b53d89cac..932a812d05 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 #include -#include "svcall.h" +#include + #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 472b184ea0..1f76daa2f7 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 9f5447c7cc..701541bcaf 100644 --- a/arch/arm/src/armv6-m/arm_svcall.c +++ b/arch/arm/src/armv6-m/arm_svcall.c @@ -29,12 +29,12 @@ #include #include #include +#include #include #include #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 a790f58d4d..0000000000 --- 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 - -#include - -/**************************************************************************** - * 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 12063b3bbf..ce0632100f 100644 --- a/arch/arm/src/armv7-a/arm_fullcontextrestore.S +++ b/arch/arm/src/armv7-a/arm_fullcontextrestore.S @@ -24,8 +24,8 @@ #include #include +#include -#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 ba7f2702be..8a94b46f75 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 #include -#include "svcall.h" +#include + #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 436a01c333..32d235b758 100644 --- a/arch/arm/src/armv7-a/arm_syscall.c +++ b/arch/arm/src/armv7-a/arm_syscall.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -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 86a266986e..71a3a71706 100644 --- a/arch/arm/src/armv7-a/crt0.c +++ b/arch/arm/src/armv7-a/crt0.c @@ -29,7 +29,7 @@ #include -#include "svcall.h" +#include #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 3999a9e2a3..0000000000 --- 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 - -#include - -/**************************************************************************** - * 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 9c1c4481e9..4b6b4720d1 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 #include -#include "svcall.h" +#include + #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 1330dc3a81..7eceeaa0af 100644 --- a/arch/arm/src/armv7-m/arm_svcall.c +++ b/arch/arm/src/armv7-m/arm_svcall.c @@ -29,13 +29,13 @@ #include #include #include +#include #include #include #include #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 697ab1e3a4..54351f2063 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 #include +#include #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 013d5f18f6..c5b12a3461 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 #include +#include #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 e0bdf7ad6d..fa83e6c605 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 61063e2726..7f0ad6502d 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 #include +#include #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 08817a849b..1806865d6a 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 #include +#include #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 98a574e870..0000000000 --- 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 - -#include - -/**************************************************************************** - * 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 9af7219282..16ccc60d4c 100644 --- a/arch/arm/src/armv7-r/arm_fullcontextrestore.S +++ b/arch/arm/src/armv7-r/arm_fullcontextrestore.S @@ -24,8 +24,7 @@ #include #include - -#include "svcall.h" +#include /**************************************************************************** * 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 0739b07417..a229d42851 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 #include -#include "svcall.h" +#include + #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 bbee3f77c4..585f362d12 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 719d270742..eebb0aeda9 100644 --- a/arch/arm/src/armv7-r/arm_syscall.c +++ b/arch/arm/src/armv7-r/arm_syscall.c @@ -28,13 +28,13 @@ #include #include #include +#include #include #include #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 b0efecd9bb..0000000000 --- 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 - -#include - -/**************************************************************************** - * 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 62e47fac93..0227bd21f6 100644 --- a/arch/arm/src/armv8-m/arm_fullcontextrestore.S +++ b/arch/arm/src/armv8-m/arm_fullcontextrestore.S @@ -24,9 +24,9 @@ #include #include +#include #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 2620abf149..0de40f3e81 100644 --- a/arch/arm/src/armv8-m/arm_saveusercontext.S +++ b/arch/arm/src/armv8-m/arm_saveusercontext.S @@ -24,9 +24,9 @@ #include #include +#include #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 ac9409b50f..62baf3cba1 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 #include -#include "svcall.h" +#include + #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 73ce9b6b12..b2bac1a090 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 50d5be51d7..ae1e80ceab 100644 --- a/arch/arm/src/armv8-m/arm_svcall.c +++ b/arch/arm/src/armv8-m/arm_svcall.c @@ -28,13 +28,13 @@ #include #include #include +#include #include #include #include #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 7213084634..0000000000 --- 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 - -#include - -/**************************************************************************** - * 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 0caf5efb79..68930b01ac 100644 --- a/arch/arm/src/common/arm_pthread_start.c +++ b/arch/arm/src/common/arm_pthread_start.c @@ -28,7 +28,8 @@ #include -#include "svcall.h" +#include + #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 a7944f2d00..3a1c5684da 100644 --- a/arch/arm/src/common/arm_switchcontext.c +++ b/arch/arm/src/common/arm_switchcontext.c @@ -24,8 +24,7 @@ #include -#include "svcall.h" -#include "syscall.h" +#include /**************************************************************************** * Public Functions diff --git a/arch/arm/src/common/arm_task_start.c b/arch/arm/src/common/arm_task_start.c index 53cfd8b46e..3c7e9ec029 100644 --- a/arch/arm/src/common/arm_task_start.c +++ b/arch/arm/src/common/arm_task_start.c @@ -27,7 +27,8 @@ #include -#include "svcall.h" +#include + #include "arm_internal.h" #ifndef CONFIG_BUILD_FLAT diff --git a/arch/ceva/include/syscall.h b/arch/ceva/include/syscall.h index 8ad41665a4..43427189ca 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 f7301d36d3..0000000000 --- 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 -#include - -/**************************************************************************** - * 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 5cf2cb33c9..8aa008dc69 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 + #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 d05c31e2d4..03194b0c3c 100644 --- a/arch/ceva/src/common/up_pthread_start.c +++ b/arch/ceva/src/common/up_pthread_start.c @@ -26,7 +26,7 @@ #include #include -#include "svcall.h" +#include #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 068592e974..0d101e872a 100644 --- a/arch/ceva/src/common/up_saveusercontext.c +++ b/arch/ceva/src/common/up_saveusercontext.c @@ -25,7 +25,8 @@ #include #include -#include "svcall.h" +#include + #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 4065f8e7d1..9f6e709b21 100644 --- a/arch/ceva/src/common/up_signal_dispatch.c +++ b/arch/ceva/src/common/up_signal_dispatch.c @@ -25,7 +25,7 @@ #include #include -#include "svcall.h" +#include #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 b7889dddc1..1635bdbac3 100644 --- a/arch/ceva/src/common/up_svcall.c +++ b/arch/ceva/src/common/up_svcall.c @@ -27,12 +27,12 @@ #include #include #include +#include #include #include #include -#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 c7e9a1cd2d..360d0890cb 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 + #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 62ac279cda..11bf102baa 100644 --- a/arch/ceva/src/common/up_task_start.c +++ b/arch/ceva/src/common/up_task_start.c @@ -25,7 +25,7 @@ #include #include -#include "svcall.h" +#include #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 8d29ba57e6..8b231b8256 100644 --- a/arch/ceva/src/xc5/up_signal_handler.S +++ b/arch/ceva/src/xc5/up_signal_handler.S @@ -24,7 +24,7 @@ #include -#include "svcall.h" +#include #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 e955c5c58e..565753f02e 100644 --- a/arch/ceva/src/xc5/up_svcall_handler.S +++ b/arch/ceva/src/xc5/up_svcall_handler.S @@ -24,7 +24,7 @@ #include -#include "svcall.h" +#include #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 7a125ab46b..348e6763f3 100644 --- a/arch/ceva/src/xc5/vfork.S +++ b/arch/ceva/src/xc5/vfork.S @@ -25,7 +25,7 @@ #include #include -#include "svcall.h" +#include /**************************************************************************** * Public Symbols diff --git a/arch/ceva/src/xm6/up_signal_handler.S b/arch/ceva/src/xm6/up_signal_handler.S index 550405c6cb..07bb3af3d6 100644 --- a/arch/ceva/src/xm6/up_signal_handler.S +++ b/arch/ceva/src/xm6/up_signal_handler.S @@ -24,7 +24,7 @@ #include -#include "svcall.h" +#include #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 9aa63d7187..d6b2603685 100644 --- a/arch/ceva/src/xm6/up_svcall_handler.S +++ b/arch/ceva/src/xm6/up_svcall_handler.S @@ -24,7 +24,7 @@ #include -#include "svcall.h" +#include #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 4982e4d9e5..9aa04a8285 100644 --- a/arch/ceva/src/xm6/vfork.S +++ b/arch/ceva/src/xm6/vfork.S @@ -25,7 +25,7 @@ #include #include -#include "svcall.h" +#include /**************************************************************************** * Pre-processor Definitions diff --git a/arch/or1k/src/common/up_pthread_start.c b/arch/or1k/src/common/up_pthread_start.c index 77481ec14b..060a7115c6 100644 --- a/arch/or1k/src/common/up_pthread_start.c +++ b/arch/or1k/src/common/up_pthread_start.c @@ -27,7 +27,8 @@ #include #include -#include "svcall.h" +#include + #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 f059611d73..6e5149decb 100644 --- a/arch/or1k/src/common/up_task_start.c +++ b/arch/or1k/src/common/up_task_start.c @@ -26,7 +26,8 @@ #include #include -#include "svcall.h" +#include + #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 b59be33cd4..3bd5189cd1 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 a625385ec7..8dd295a1b8 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 #include -#include "svcall.h" +#include + #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 35b76604c0..b322053ec8 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 #include -#include "svcall.h" +#include + #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 df3d4a7cb5..52d47042f8 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 de174f6a67..38f4cde04d 100644 --- a/arch/risc-v/src/common/riscv_swint.c +++ b/arch/risc-v/src/common/riscv_swint.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -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 417db572a5..d8cc966f8a 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 #include -#include "svcall.h" +#include + #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 6f93f60077..0000000000 --- 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 - -#ifdef CONFIG_LIB_SYSCALL -# include -#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 27150c900b..d4330d7e0b 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