zephyr/include/arch/arm64/thread_stack.h
Carlo Caione 3539c2fbb3 arm/arm64: Make ARM64 a standalone architecture
Split ARM and ARM64 architectures.

Details:

- CONFIG_ARM64 is decoupled from CONFIG_ARM (not a subset anymore)
- Arch and include AArch64 files are in a dedicated directory
  (arch/arm64 and include/arch/arm64)
- AArch64 boards and SoC are moved to soc/arm64 and boards/arm64
- AArch64-specific DTS files are moved to dts/arm64
- The A72 support for the bcm_vk/viper board is moved in the
  boards/bcm_vk/viper directory

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-31 10:34:33 -05:00

59 lines
1.7 KiB
C

/*
* Copyright (c) 2020 Carlo Caione <ccaione@baylibre.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_ARCH_ARM_AARCH64_THREAD_STACK_H_
#define ZEPHYR_INCLUDE_ARCH_ARM_AARCH64_THREAD_STACK_H_
#define ARCH_STACK_PTR_ALIGN 16
#if CONFIG_USERSPACE
#define Z_ARM64_STACK_BASE_ALIGN CONFIG_MMU_PAGE_SIZE
#define Z_ARM64_STACK_SIZE_ALIGN CONFIG_MMU_PAGE_SIZE
#else
#define Z_ARM64_STACK_BASE_ALIGN ARCH_STACK_PTR_ALIGN
#define Z_ARM64_STACK_SIZE_ALIGN ARCH_STACK_PTR_ALIGN
#endif
/*
* High memory addresses
*
* +-------------------+ <- thread.stack_info.start + thread.stack_info.size
* | TLS |
* +-------------------+ <- initial sp (computable with thread.stack_info.delta)
* | |
* | Used stack |
* | |
* +...................+ <- thread's current stack pointer
* | |
* | Unused stack |
* | |
* +-------------------+ <- thread.stack_info.start
* | Reserved memory | } K_(THREAD|KERNEL)_STACK_RESERVED
* +-------------------+ <- thread.stack_obj
*
* Low Memory addresses
*/
/* thread stack */
#define ARCH_THREAD_STACK_OBJ_ALIGN(size) Z_ARM64_STACK_BASE_ALIGN
#define ARCH_THREAD_STACK_SIZE_ADJUST(size) \
ROUND_UP((size), Z_ARM64_STACK_SIZE_ALIGN)
#define ARCH_THREAD_STACK_RESERVED CONFIG_PRIVILEGED_STACK_SIZE
/* kernel stack */
#define ARCH_KERNEL_STACK_RESERVED 0
#define ARCH_KERNEL_STACK_OBJ_ALIGN ARCH_STACK_PTR_ALIGN
#ifndef _ASMLANGUAGE
struct z_arm64_thread_stack_header {
char privilege_stack[CONFIG_PRIVILEGED_STACK_SIZE];
} __packed __aligned(Z_ARM64_STACK_BASE_ALIGN);
#endif /* _ASMLANGUAGE */
#endif /* ZEPHYR_INCLUDE_ARCH_ARM_AARCH64_THREAD_STACK_H_ */