16#ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_SYSCALL_H_
17#define ZEPHYR_INCLUDE_ARCH_XTENSA_SYSCALL_H_
19#ifdef CONFIG_USERSPACE
27#include <xtensa/config/core-isa.h>
33#ifdef CONFIG_XTENSA_SYSCALL_USE_HELPER
39#define SYSINL ALWAYS_INLINE
58#ifdef CONFIG_XTENSA_SYSCALL_USE_HELPER
59 return xtensa_syscall_helper(arg1, arg2, arg3, arg4, arg5, arg6, call_id);
61 register uintptr_t a2 __asm__(
"%a2") = call_id;
62 register uintptr_t a6 __asm__(
"%a6") = arg1;
63 register uintptr_t a3 __asm__(
"%a3") = arg2;
64 register uintptr_t a4 __asm__(
"%a4") = arg3;
65 register uintptr_t a5 __asm__(
"%a5") = arg4;
66 register uintptr_t a8 __asm__(
"%a8") = arg5;
67 register uintptr_t a9 __asm__(
"%a9") = arg6;
69 __asm__
volatile(
"syscall\n\t"
71 :
"r" (a2),
"r" (a6),
"r" (a3),
"r" (a4),
72 "r" (a5),
"r" (a8),
"r" (a9)
83#ifdef CONFIG_XTENSA_SYSCALL_USE_HELPER
84 return xtensa_syscall_helper(arg1, arg2, arg3, arg4, arg5, 0, call_id);
86 register uintptr_t a2 __asm__(
"%a2") = call_id;
87 register uintptr_t a6 __asm__(
"%a6") = arg1;
88 register uintptr_t a3 __asm__(
"%a3") = arg2;
89 register uintptr_t a4 __asm__(
"%a4") = arg3;
90 register uintptr_t a5 __asm__(
"%a5") = arg4;
91 register uintptr_t a8 __asm__(
"%a8") = arg5;
93 __asm__
volatile(
"syscall\n\t"
95 :
"r" (a2),
"r" (a6),
"r" (a3),
"r" (a4),
107#ifdef CONFIG_XTENSA_SYSCALL_USE_HELPER
108 return xtensa_syscall_helper(arg1, arg2, arg3, arg4, 0, 0, call_id);
110 register uintptr_t a2 __asm__(
"%a2") = call_id;
111 register uintptr_t a6 __asm__(
"%a6") = arg1;
112 register uintptr_t a3 __asm__(
"%a3") = arg2;
113 register uintptr_t a4 __asm__(
"%a4") = arg3;
114 register uintptr_t a5 __asm__(
"%a5") = arg4;
116 __asm__
volatile(
"syscall\n\t"
118 :
"r" (a2),
"r" (a6),
"r" (a3),
"r" (a4),
129#ifdef CONFIG_XTENSA_SYSCALL_USE_HELPER
130 return xtensa_syscall_helper(arg1, arg2, arg3, 0, 0, 0, call_id);
132 register uintptr_t a2 __asm__(
"%a2") = call_id;
133 register uintptr_t a6 __asm__(
"%a6") = arg1;
134 register uintptr_t a3 __asm__(
"%a3") = arg2;
135 register uintptr_t a4 __asm__(
"%a4") = arg3;
137 __asm__
volatile(
"syscall\n\t"
139 :
"r" (a2),
"r" (a6),
"r" (a3),
"r" (a4)
149#ifdef CONFIG_XTENSA_SYSCALL_USE_HELPER
150 return xtensa_syscall_helper(arg1, arg2, 0, 0, 0, 0, call_id);
152 register uintptr_t a2 __asm__(
"%a2") = call_id;
153 register uintptr_t a6 __asm__(
"%a6") = arg1;
154 register uintptr_t a3 __asm__(
"%a3") = arg2;
156 __asm__
volatile(
"syscall\n\t"
158 :
"r" (a2),
"r" (a6),
"r" (a3)
168#ifdef CONFIG_XTENSA_SYSCALL_USE_HELPER
169 return xtensa_syscall_helper(arg1, 0, 0, 0, 0, 0, call_id);
171 register uintptr_t a2 __asm__(
"%a2") = call_id;
172 register uintptr_t a6 __asm__(
"%a6") = arg1;
174 __asm__
volatile(
"syscall\n\t"
185#ifdef CONFIG_XTENSA_SYSCALL_USE_HELPER
186 return xtensa_syscall_helper(0, 0, 0, 0, 0, 0, call_id);
188 register uintptr_t a2 __asm__(
"%a2") = call_id;
190 __asm__
volatile(
"syscall\n\t"
206#if XCHAL_HAVE_THREADPTR
210 "rur.THREADPTR %0\n\t"
213#ifdef CONFIG_THREAD_LOCAL_STORAGE
214 extern __thread
uint32_t is_user_mode;
220 return is_user_mode != 0;
226 extern bool xtensa_is_user_context(
void);
228 return xtensa_is_user_context();
static uintptr_t arch_syscall_invoke4(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t call_id)
Definition syscall.h:89
static uintptr_t arch_syscall_invoke2(uintptr_t arg1, uintptr_t arg2, uintptr_t call_id)
Definition syscall.h:131
static uintptr_t arch_syscall_invoke1(uintptr_t arg1, uintptr_t call_id)
Definition syscall.h:149
static uintptr_t arch_syscall_invoke0(uintptr_t call_id)
Definition syscall.h:165
static bool arch_is_user_context(void)
Definition syscall.h:181
static uintptr_t arch_syscall_invoke5(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t call_id)
Definition syscall.h:65
static uintptr_t arch_syscall_invoke3(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t call_id)
Definition syscall.h:111
static uintptr_t arch_syscall_invoke6(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t arg6, uintptr_t call_id)
Definition syscall.h:40
#define SYSINL
Definition syscall.h:41
Definitions of various linker Sections.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105