Skip to content

Commit 080f9ed

Browse files
pussuwxiaoxiang781216
authored andcommitted
arm64_mmu.c: Fix kernel L1 page table size
The kernel L1 page table must be at least 1 page
1 parent 4149e45 commit 080f9ed

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

arch/arm64/src/common/arm64_mmu.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@
131131
#define NUM_BASE_LEVEL_ENTRIES GET_NUM_BASE_LEVEL_ENTRIES( \
132132
CONFIG_ARM64_VA_BITS)
133133

134+
#ifdef CONFIG_BUILD_KERNEL
135+
#define BASE_XLAT_TABLE_SIZE XLAT_TABLE_ENTRIES
136+
#define BASE_XLAT_TABLE_ALIGN PAGE_SIZE
137+
#else
138+
#define BASE_XLAT_TABLE_SIZE NUM_BASE_LEVEL_ENTRIES
139+
#define BASE_XLAT_TABLE_ALIGN NUM_BASE_LEVEL_ENTRIES * sizeof(uint64_t)
140+
#endif
141+
134142
#if (CONFIG_ARM64_PA_BITS == 48)
135143
#define TCR_PS_BITS TCR_PS_BITS_256TB
136144
#elif (CONFIG_ARM64_PA_BITS == 44)
@@ -149,8 +157,8 @@
149157
* Private Data
150158
****************************************************************************/
151159

152-
static uint64_t base_xlat_table[NUM_BASE_LEVEL_ENTRIES] aligned_data(
153-
NUM_BASE_LEVEL_ENTRIES * sizeof(uint64_t));
160+
static uint64_t base_xlat_table[BASE_XLAT_TABLE_SIZE]
161+
aligned_data(BASE_XLAT_TABLE_ALIGN);
154162

155163
static uint64_t xlat_tables[CONFIG_MAX_XLAT_TABLES][XLAT_TABLE_ENTRIES]
156164
aligned_data(XLAT_TABLE_ENTRIES * sizeof(uint64_t));

0 commit comments

Comments
 (0)