include: arm64: Refine the mem alignment macros
Add a new macro MEM_DOMAIN_ALIGN_AND_SIZE for mmu and mpu mem alignment. MEM_DOMAIN_ALIGN_AND_SIZE is - CONFIG_MMU_PAGE_SIZE, when mmu is enabled. - CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE when mpu enabled. Signed-off-by: Jaxson Han <jaxson.han@arm.com>
This commit is contained in:
parent
d282d86d7e
commit
ac0c0a61d5
4 changed files with 18 additions and 4 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <offsets_short.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <syscall.h>
|
||||
#include <arch/arm64/mm.h>
|
||||
#include "macro_priv.inc"
|
||||
|
||||
_ASM_FILE_PROLOGUE
|
||||
|
@ -66,7 +67,7 @@ abv_loop:
|
|||
b 2f
|
||||
1: at S1E0W, x0
|
||||
|
||||
2: orr x0, x0, #(CONFIG_MMU_PAGE_SIZE - 1)
|
||||
2: orr x0, x0, #(MEM_DOMAIN_ALIGN_AND_SIZE - 1)
|
||||
add x0, x0, #1
|
||||
|
||||
isb
|
||||
|
|
|
@ -8,8 +8,19 @@
|
|||
|
||||
#if defined(CONFIG_ARM_MMU)
|
||||
#include <arch/arm64/arm_mmu.h>
|
||||
/*
|
||||
* When mmu enabled, some section addresses need to be aligned with
|
||||
* page size which is CONFIG_MMU_PAGE_SIZE
|
||||
*/
|
||||
#define MEM_DOMAIN_ALIGN_AND_SIZE CONFIG_MMU_PAGE_SIZE
|
||||
#elif defined(CONFIG_ARM_MPU)
|
||||
#include <arch/arm64/cortex_r/arm_mpu.h>
|
||||
/*
|
||||
* When mpu enabled, some section addresses need to be aligned with
|
||||
* mpu region min align size which is
|
||||
* CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE
|
||||
*/
|
||||
#define MEM_DOMAIN_ALIGN_AND_SIZE CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
|
|
@ -49,7 +49,7 @@ struct z_arm64_fp_context {
|
|||
};
|
||||
|
||||
struct _thread_arch {
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#if defined(CONFIG_USERSPACE) && defined(CONFIG_ARM_MMU)
|
||||
struct arm_mmu_ptables *ptables;
|
||||
#endif
|
||||
#ifdef CONFIG_FPU_SHARING
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
#ifndef ZEPHYR_INCLUDE_ARCH_ARM64_THREAD_STACK_H_
|
||||
#define ZEPHYR_INCLUDE_ARCH_ARM64_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
|
||||
#include <arch/arm64/mm.h>
|
||||
#define Z_ARM64_STACK_BASE_ALIGN MEM_DOMAIN_ALIGN_AND_SIZE
|
||||
#define Z_ARM64_STACK_SIZE_ALIGN MEM_DOMAIN_ALIGN_AND_SIZE
|
||||
#else
|
||||
#define Z_ARM64_STACK_BASE_ALIGN ARCH_STACK_PTR_ALIGN
|
||||
#define Z_ARM64_STACK_SIZE_ALIGN ARCH_STACK_PTR_ALIGN
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue