File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed
include/zephyr/arch/xtensa Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: Apache-2.0
2
2
3
+ zephyr_syscall_header (${ZEPHYR_BASE} /include/zephyr/arch/xtensa/arch.h )
3
4
set_property (GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-xtensa-le )
4
5
add_subdirectory (core )
Original file line number Diff line number Diff line change @@ -149,3 +149,24 @@ FUNC_NORETURN void arch_syscall_oops(void *ssf)
149
149
z_xtensa_fatal_error (K_ERR_KERNEL_OOPS , esf );
150
150
CODE_UNREACHABLE ;
151
151
}
152
+
153
+ #ifdef CONFIG_USERSPACE
154
+ void z_impl_xtensa_user_fault (unsigned int reason )
155
+ {
156
+ if ((_current -> base .user_options & K_USER ) != 0 ) {
157
+ if ((reason != K_ERR_KERNEL_OOPS ) &&
158
+ (reason != K_ERR_STACK_CHK_FAIL )) {
159
+ reason = K_ERR_KERNEL_OOPS ;
160
+ }
161
+ }
162
+ xtensa_arch_except (reason );
163
+ }
164
+
165
+ static void z_vrfy_xtensa_user_fault (unsigned int reason )
166
+ {
167
+ z_impl_xtensa_user_fault (reason );
168
+ }
169
+
170
+ #include <syscalls/xtensa_user_fault_mrsh.c>
171
+
172
+ #endif /* CONFIG_USERSPACE */
Original file line number Diff line number Diff line change 23
23
#include <zephyr/arch/common/sys_io.h>
24
24
#include <zephyr/arch/common/ffs.h>
25
25
#include <zephyr/sw_isr_table.h>
26
+ #include <zephyr/arch/xtensa/syscall.h>
26
27
#include <zephyr/arch/xtensa/thread.h>
27
28
#include <zephyr/arch/xtensa/irq.h>
28
29
#include <xtensa/config/core.h>
@@ -54,11 +55,31 @@ struct arch_mem_domain {
54
55
55
56
extern void xtensa_arch_except (int reason_p );
56
57
58
+ #ifdef CONFIG_USERSPACE
59
+
60
+ #define ARCH_EXCEPT (reason_p ) do { \
61
+ if (k_is_user_context()) { \
62
+ arch_syscall_invoke1(reason_p, \
63
+ K_SYSCALL_XTENSA_USER_FAULT); \
64
+ } else { \
65
+ xtensa_arch_except(reason_p); \
66
+ } \
67
+ CODE_UNREACHABLE; \
68
+ } while (false)
69
+
70
+ #else
71
+
57
72
#define ARCH_EXCEPT (reason_p ) do { \
58
73
xtensa_arch_except(reason_p); \
59
74
CODE_UNREACHABLE; \
60
75
} while (false)
61
76
77
+ #endif
78
+
79
+ __syscall void xtensa_user_fault (unsigned int reason );
80
+
81
+ #include <syscalls/arch.h>
82
+
62
83
/* internal routine documented in C file, needed by IRQ_CONNECT() macro */
63
84
extern void z_irq_priority_set (uint32_t irq , uint32_t prio , uint32_t flags );
64
85
You can’t perform that action at this time.
0 commit comments