7#ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_THREAD_STACK_H_
8#define ZEPHYR_INCLUDE_ARCH_XTENSA_THREAD_STACK_H_
10#include <xtensa/config/core-isa.h>
14#ifdef CONFIG_KERNEL_COHERENCE
15#define ARCH_STACK_PTR_ALIGN XCHAL_DCACHE_LINESIZE
17#define ARCH_STACK_PTR_ALIGN 16
21#ifdef CONFIG_USERSPACE
22#ifdef CONFIG_XTENSA_MMU
23#define XTENSA_STACK_BASE_ALIGN CONFIG_MMU_PAGE_SIZE
24#define XTENSA_STACK_SIZE_ALIGN CONFIG_MMU_PAGE_SIZE
26#ifdef CONFIG_XTENSA_MPU
27#define XTENSA_STACK_BASE_ALIGN XCHAL_MPU_ALIGN
28#define XTENSA_STACK_SIZE_ALIGN XCHAL_MPU_ALIGN
31#define XTENSA_STACK_BASE_ALIGN ARCH_STACK_PTR_ALIGN
32#define XTENSA_STACK_SIZE_ALIGN ARCH_STACK_PTR_ALIGN
56#if defined(CONFIG_XTENSA_MMU) || defined(CONFIG_XTENSA_MPU)
57 char privilege_stack[CONFIG_PRIVILEGED_STACK_SIZE];
59} __packed __aligned(XTENSA_STACK_BASE_ALIGN);
61#if defined(CONFIG_XTENSA_MMU) || defined(CONFIG_XTENSA_MPU)
62#define ARCH_THREAD_STACK_RESERVED \
63 sizeof(struct xtensa_thread_stack_header)
66#define ARCH_THREAD_STACK_OBJ_ALIGN(size) XTENSA_STACK_BASE_ALIGN
67#define ARCH_THREAD_STACK_SIZE_ADJUST(size) \
68 ROUND_UP((size), XTENSA_STACK_SIZE_ALIGN)
71#define ARCH_KERNEL_STACK_RESERVED 0
72#define ARCH_KERNEL_STACK_OBJ_ALIGN ARCH_STACK_PTR_ALIGN