15#ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_H_
16#define ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_H_
21#if !defined(_ASMLANGUAGE) && !defined(__ASSEMBLER__)
31#include <xtensa/config/core.h>
40#ifdef CONFIG_XTENSA_MMU
44#ifdef CONFIG_XTENSA_MPU
67#ifdef CONFIG_XTENSA_MMU
80#ifdef CONFIG_XTENSA_MPU
107#ifdef CONFIG_USERSPACE
109#define ARCH_EXCEPT(reason_p) do { \
110 if (k_is_user_context()) { \
111 arch_syscall_invoke1(reason_p, \
112 K_SYSCALL_XTENSA_USER_FAULT); \
114 xtensa_arch_except(reason_p); \
121#define ARCH_EXCEPT(reason_p) do { \
122 xtensa_arch_except(reason_p); \
130#include <zephyr/syscalls/arch.h>
135#define ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
137 Z_ISR_DECLARE(irq_p, flags_p, isr_p, isr_param_p); \
155 __asm__
volatile(
"nop");
170 __asm__
volatile(
"rsr.vecbase %0" :
"=r" (vecbase));
171 __asm__
volatile(
"wsr.vecbase %0; rsync" : :
"r" (vecbase | 1));
174#if defined(CONFIG_XTENSA_RPO_CACHE) || defined(__DOXYGEN__)
175#if defined(CONFIG_ARCH_HAS_COHERENCE) || defined(__DOXYGEN__)
179 size_t addr = (
size_t) ptr;
181 return (addr >> 29) == CONFIG_XTENSA_UNCACHED_REGION;
209#define _REGION_ATTR(r) \
211 ((r) == CONFIG_XTENSA_CACHED_REGION ? 4 : \
212 ((r) == CONFIG_XTENSA_UNCACHED_REGION ? 2 : 15)))
214#define _SET_ONE_TLB(region) do { \
215 uint32_t attr = _REGION_ATTR(region); \
216 if (XCHAL_HAVE_XLT_CACHEATTR) { \
219 if (region != CONFIG_XTENSA_CACHED_REGION) { \
220 __asm__ volatile("wdtlb %0, %1; witlb %0, %1" \
221 :: "r"(attr), "r"(addr)); \
223 __asm__ volatile("wdtlb %0, %1" \
224 :: "r"(attr), "r"(addr)); \
225 __asm__ volatile("j 1f; .align 8; 1:"); \
226 __asm__ volatile("witlb %0, %1; isync" \
227 :: "r"(attr), "r"(addr)); \
235#define ARCH_XTENSA_SET_RPO_TLB() \
237 register uint32_t addr = 0, addrincr = 0x20000000; \
238 FOR_EACH(_SET_ONE_TLB, (;), 0, 1, 2, 3, 4, 5, 6, 7); \
242#if defined(CONFIG_XTENSA_MMU) || defined(__DOXYGEN__)
static ALWAYS_INLINE void arch_nop(void)
Definition arch.h:348
Xtensa specific syscall header.
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
Public interface for configuring interrupts.
uint64_t sys_clock_cycle_get_64(void)
uint32_t sys_clock_cycle_get_32(void)
static uint32_t arch_k_cycle_get_32(void)
Definition arch.h:108
static uint64_t arch_k_cycle_get_64(void)
Definition arch.h:115
flags
Definition parser.h:97
Size of off_t must be equal or less than size of size_t
Definition retained_mem.h:28
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
sys_snode_t node
Definition arch.h:50
pentry_t * ptables
Definition mmustructs.h:89
Struct to hold foreground MPU map and its entries.
Definition mpu.h:186
Software-managed ISR table.
void xtensa_user_fault(unsigned int reason)
void xtensa_arch_kernel_oops(int reason_p, void *ssf)
Generate kernel oops.
void xtensa_arch_except(int reason_p)
Generate hardware exception.
static bool arch_mem_coherent(void *ptr)
Implementation of arch_mem_coherent.
Definition arch.h:177
void arch_xtensa_mmu_post_init(bool is_core0)
Perform additional steps after MMU initialization.
static ALWAYS_INLINE void xtensa_vecbase_lock(void)
Lock VECBASE if supported by hardware.
Definition arch.h:166
Xtensa public exception handling.