arch: Move the content from svcall.h to syscall.h

and remove svcall.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-02-25 02:46:21 +08:00 committed by archer
parent 0c7517e579
commit 087b9e5ff3
62 changed files with 338 additions and 1147 deletions

View file

@ -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
****************************************************************************/

View file

@ -24,8 +24,8 @@
#include <nuttx/config.h>
#include <arch/irq.h>
#include <arch/syscall.h>
#include "svcall.h"
#include "arm.h"
/****************************************************************************

View file

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

View file

@ -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 */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 */

View file

@ -24,8 +24,8 @@
#include <nuttx/config.h>
#include <arch/irq.h>
#include <arch/syscall.h>
#include "svcall.h"
#include "arm.h"
/****************************************************************************

View file

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

View file

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

View file

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

View file

@ -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 */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 */

View file

@ -24,8 +24,7 @@
#include <nuttx/config.h>
#include <arch/irq.h>
#include "svcall.h"
#include <arch/syscall.h>
/****************************************************************************
* Pre-processor Definitions

View file

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

View file

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

View file

@ -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"
/****************************************************************************

View file

@ -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 */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 */

View file

@ -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__) && \

View file

@ -24,8 +24,7 @@
#include <nuttx/config.h>
#include "svcall.h"
#include "syscall.h"
#include <arch/syscall.h>
/****************************************************************************
* Public Functions

View file

@ -27,7 +27,8 @@
#include <assert.h>
#include "svcall.h"
#include <arch/syscall.h>
#include "arm_internal.h"
#ifndef CONFIG_BUILD_FLAT

View file

@ -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
****************************************************************************/

View file

@ -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 */

View file

@ -22,7 +22,8 @@
* Included Files
****************************************************************************/
#include "svcall.h"
#include <arch/syscall.h>
#include "up_internal.h"
/****************************************************************************

View file

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

View file

@ -25,7 +25,8 @@
#include <nuttx/config.h>
#include <nuttx/irq.h>
#include "svcall.h"
#include <arch/syscall.h>
#include "up_internal.h"
/****************************************************************************

View file

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

View file

@ -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"
/****************************************************************************

View file

@ -22,7 +22,8 @@
* Included Files
****************************************************************************/
#include "svcall.h"
#include <arch/syscall.h>
#include "up_internal.h"
/****************************************************************************

View file

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

View file

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

View file

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

View file

@ -25,7 +25,7 @@
#include <nuttx/config.h>
#include <nuttx/irq.h>
#include "svcall.h"
#include <arch/syscall.h>
/****************************************************************************
* Public Symbols

View file

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

View file

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

View file

@ -25,7 +25,7 @@
#include <nuttx/config.h>
#include <nuttx/irq.h>
#include "svcall.h"
#include <arch/syscall.h>
/****************************************************************************
* Pre-processor Definitions

View file

@ -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__) && \

View file

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

View file

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

View file

@ -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__) && \

View file

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

View file

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

View file

@ -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"
/****************************************************************************

View file

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

View file

@ -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 */

View file

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