From 6a58c34aa6856381e07f2108b278ad08771ea10e Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 21 Jul 2021 17:11:02 -0700 Subject: [PATCH] tests: x86/pagetables: limit permission test under demand paging When demand paging is enabled and not all generic sections are in physical memory at boot, only tests the permission up to the end of the pinned section. Signed-off-by: Daniel Leung --- tests/arch/x86/pagetables/src/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/arch/x86/pagetables/src/main.c b/tests/arch/x86/pagetables/src/main.c index df3e21e1eef..4e4197f2da8 100644 --- a/tests/arch/x86/pagetables/src/main.c +++ b/tests/arch/x86/pagetables/src/main.c @@ -80,7 +80,13 @@ void test_ram_perms(void) pentry_t entry, flags, expected; - for (pos = Z_KERNEL_VIRT_START; pos < Z_KERNEL_VIRT_END; +#ifdef CONFIG_LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT + const uint8_t *mem_range_end = Z_KERNEL_VIRT_END; +#else + const uint8_t *mem_range_end = (uint8_t *)lnkr_pinned_end; +#endif /* CONFIG_LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT */ + + for (pos = Z_KERNEL_VIRT_START; pos < mem_range_end; pos += CONFIG_MMU_PAGE_SIZE) { if (pos == NULL) { /* We have another test specifically for NULL page */