2016-10-12 21:11:05 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* arch/xtensa/include/syscall.h
|
|
|
|
*
|
2021-03-28 17:44:37 +02:00
|
|
|
* 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
|
2016-10-12 21:11:05 +02:00
|
|
|
*
|
2021-03-28 17:44:37 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2016-10-12 21:11:05 +02:00
|
|
|
*
|
2021-03-28 17:44:37 +02:00
|
|
|
* 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.
|
2016-10-12 21:11:05 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-04-05 23:00:04 +02:00
|
|
|
/* This file should never be included directly but, rather, only indirectly
|
2016-10-12 21:11:05 +02:00
|
|
|
* through include/syscall.h or include/sys/sycall.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ARCH_XTENSA_INCLUDE_SYSCALL_H
|
|
|
|
#define __ARCH_XTENSA_INCLUDE_SYSCALL_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-02-15 07:27:26 +01:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <arch/irq.h>
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
# include <debug.h>
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_LIB_SYSCALL
|
|
|
|
# include <syscall.h>
|
|
|
|
#endif
|
|
|
|
|
2016-10-12 21:11:05 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-02-15 07:27:26 +01:00
|
|
|
/* Configuration ************************************************************/
|
2016-10-12 21:11:05 +02:00
|
|
|
|
2022-02-15 07:27:26 +01:00
|
|
|
/* 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.
|
|
|
|
*/
|
2016-10-12 21:11:05 +02:00
|
|
|
|
2022-02-15 07:27:26 +01:00
|
|
|
#ifdef CONFIG_LIB_SYSCALL
|
|
|
|
# ifdef CONFIG_BUILD_PROTECTED
|
|
|
|
# ifndef CONFIG_SYS_RESERVED
|
|
|
|
# error "CONFIG_SYS_RESERVED must be defined to have the value 9"
|
|
|
|
# elif CONFIG_SYS_RESERVED != 9
|
|
|
|
# error "CONFIG_SYS_RESERVED must have the value 9"
|
|
|
|
# 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
|
|
|
|
|
|
|
|
/* Xtensa system calls ******************************************************/
|
|
|
|
|
|
|
|
/* SYS call 0:
|
|
|
|
*
|
|
|
|
* int xtensa_saveusercontext(uint32_t *saveregs);
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SYS_save_context (0)
|
|
|
|
|
|
|
|
/* SYS call 1:
|
|
|
|
*
|
|
|
|
* void xtensa_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SYS_restore_context (1)
|
|
|
|
|
|
|
|
/* SYS call 2:
|
|
|
|
*
|
|
|
|
* void xtensa_switchcontext(uint32_t *saveregs, uint32_t *restoreregs);
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SYS_switch_context (2)
|
|
|
|
|
|
|
|
#ifndef CONFIG_BUILD_FLAT
|
|
|
|
#ifdef CONFIG_LIB_SYSCALL
|
|
|
|
/* SYS call 3:
|
|
|
|
*
|
|
|
|
* void xtensa_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_trampoline_t startup,
|
|
|
|
* pthread_startroutine_t entrypt, pthread_addr_t arg)
|
|
|
|
* noreturn_function
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SYS_pthread_start (5)
|
|
|
|
|
|
|
|
/* SYS call 8:
|
|
|
|
*
|
|
|
|
* void up_pthread_exit(pthread_exitroutine_t exit, void *exit_value)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SYS_pthread_exit (8)
|
|
|
|
|
|
|
|
#endif /* !CONFIG_BUILD_FLAT */
|
|
|
|
#endif /* CONFIG_LIB_SYSCALL */
|
2016-10-12 21:11:05 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ARCH_XTENSA_INCLUDE_SYSCALL_H */
|