File tree Expand file tree Collapse file tree 4 files changed +28
-4
lines changed
tests/arch/x86/pagetables/src Expand file tree Collapse file tree 4 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ config X86
6262 select ARCH_HAS_TIMING_FUNCTIONS
6363 select ARCH_HAS_THREAD_LOCAL_STORAGE
6464 select ARCH_HAS_DEMAND_PAGING
65- select ARCH_MAPS_ALL_RAM
6665 help
6766 x86 architecture
6867
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ endchoice
9595
9696config ACPI
9797 bool "ACPI (Advanced Configuration and Power Interface) support"
98+ select ARCH_MAPS_ALL_RAM
9899 help
99100 Allow retrieval of platform configuration at runtime.
100101
Original file line number Diff line number Diff line change @@ -457,10 +457,15 @@ def main():
457457 debug ("building %s" % pclass .__name__ )
458458
459459 vm_base = syms ["CONFIG_KERNEL_VM_BASE" ]
460- vm_size = syms ["CONFIG_KERNEL_VM_SIZE" ]
460+ # Work around #31562
461+ vm_size = syms ["CONFIG_KERNEL_VM_SIZE" ] & 0xFFFFFFFF
461462
462- image_base = syms ["z_mapped_start" ]
463- image_size = syms ["z_mapped_size" ]
463+ if isdef ("CONFIG_ARCH_MAPS_ALL_RAM" ):
464+ image_base = syms ["CONFIG_SRAM_BASE_ADDRESS" ]
465+ image_size = syms ["CONFIG_SRAM_SIZE" ] * 1024
466+ else :
467+ image_base = syms ["z_mapped_start" ]
468+ image_size = syms ["z_mapped_size" ]
464469 ptables_phys = syms ["z_x86_pagetables_start" ]
465470
466471 debug ("Address space: 0x%x - 0x%x size %x" %
@@ -471,6 +476,9 @@ def main():
471476
472477 is_perm_regions = isdef ("CONFIG_SRAM_REGION_PERMISSIONS" )
473478
479+ if image_size >= vm_size :
480+ error ("VM size is too small (have 0x%x need more than 0x%x)" % (vm_size , image_size ))
481+
474482 if is_perm_regions :
475483 # Don't allow execution by default for any pages. We'll adjust this
476484 # in later calls to pt.set_region_perms()
Original file line number Diff line number Diff line change @@ -159,6 +159,22 @@ void test_ram_perms(void)
159159 PRI_ENTRY , flags , pos , expected );
160160 }
161161#endif /* CONFIG_X86_64 */
162+
163+ #ifdef CONFIG_ARCH_MAPS_ALL_RAM
164+ /* All RAM page frame entries aside from 0x0 must have a mapping.
165+ * We currently identity-map on x86, no conversion necessary other than a cast
166+ */
167+ for (pos = (uint8_t * )Z_PHYS_RAM_START ; pos < (uint8_t * )Z_PHYS_RAM_END ;
168+ pos += CONFIG_MMU_PAGE_SIZE ) {
169+ if (pos == NULL ) {
170+ continue ;
171+ }
172+
173+ entry = get_entry (& flags , pos );
174+ zassert_true ((flags & MMU_P ) != 0 ,
175+ "address %p isn't mapped" , pos );
176+ }
177+ #endif
162178}
163179
164180/**
You can’t perform that action at this time.
0 commit comments