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
62
62
select ARCH_HAS_TIMING_FUNCTIONS
63
63
select ARCH_HAS_THREAD_LOCAL_STORAGE
64
64
select ARCH_HAS_DEMAND_PAGING
65
- select ARCH_MAPS_ALL_RAM
66
65
help
67
66
x86 architecture
68
67
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ endchoice
95
95
96
96
config ACPI
97
97
bool "ACPI (Advanced Configuration and Power Interface) support"
98
+ select ARCH_MAPS_ALL_RAM
98
99
help
99
100
Allow retrieval of platform configuration at runtime.
100
101
Original file line number Diff line number Diff line change @@ -457,10 +457,15 @@ def main():
457
457
debug ("building %s" % pclass .__name__ )
458
458
459
459
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
461
462
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" ]
464
469
ptables_phys = syms ["z_x86_pagetables_start" ]
465
470
466
471
debug ("Address space: 0x%x - 0x%x size %x" %
@@ -471,6 +476,9 @@ def main():
471
476
472
477
is_perm_regions = isdef ("CONFIG_SRAM_REGION_PERMISSIONS" )
473
478
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
+
474
482
if is_perm_regions :
475
483
# Don't allow execution by default for any pages. We'll adjust this
476
484
# 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)
159
159
PRI_ENTRY , flags , pos , expected );
160
160
}
161
161
#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
162
178
}
163
179
164
180
/**
You can’t perform that action at this time.
0 commit comments