x86: map all RAM if ACPI
ACPI tables can lurk anywhere. Map all memory so they can be read. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
c56b41f9b3
commit
77861037d9
4 changed files with 28 additions and 4 deletions
|
@ -62,7 +62,6 @@ config X86
|
|||
select ARCH_HAS_TIMING_FUNCTIONS
|
||||
select ARCH_HAS_THREAD_LOCAL_STORAGE
|
||||
select ARCH_HAS_DEMAND_PAGING
|
||||
select ARCH_MAPS_ALL_RAM
|
||||
help
|
||||
x86 architecture
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ endchoice
|
|||
|
||||
config ACPI
|
||||
bool "ACPI (Advanced Configuration and Power Interface) support"
|
||||
select ARCH_MAPS_ALL_RAM
|
||||
help
|
||||
Allow retrieval of platform configuration at runtime.
|
||||
|
||||
|
|
|
@ -457,10 +457,15 @@ def main():
|
|||
debug("building %s" % pclass.__name__)
|
||||
|
||||
vm_base = syms["CONFIG_KERNEL_VM_BASE"]
|
||||
vm_size = syms["CONFIG_KERNEL_VM_SIZE"]
|
||||
# Work around #31562
|
||||
vm_size = syms["CONFIG_KERNEL_VM_SIZE"] & 0xFFFFFFFF
|
||||
|
||||
image_base = syms["z_mapped_start"]
|
||||
image_size = syms["z_mapped_size"]
|
||||
if isdef("CONFIG_ARCH_MAPS_ALL_RAM"):
|
||||
image_base = syms["CONFIG_SRAM_BASE_ADDRESS"]
|
||||
image_size = syms["CONFIG_SRAM_SIZE"] * 1024
|
||||
else:
|
||||
image_base = syms["z_mapped_start"]
|
||||
image_size = syms["z_mapped_size"]
|
||||
ptables_phys = syms["z_x86_pagetables_start"]
|
||||
|
||||
debug("Address space: 0x%x - 0x%x size %x" %
|
||||
|
@ -471,6 +476,9 @@ def main():
|
|||
|
||||
is_perm_regions = isdef("CONFIG_SRAM_REGION_PERMISSIONS")
|
||||
|
||||
if image_size >= vm_size:
|
||||
error("VM size is too small (have 0x%x need more than 0x%x)" % (vm_size, image_size))
|
||||
|
||||
if is_perm_regions:
|
||||
# Don't allow execution by default for any pages. We'll adjust this
|
||||
# in later calls to pt.set_region_perms()
|
||||
|
|
|
@ -159,6 +159,22 @@ void test_ram_perms(void)
|
|||
PRI_ENTRY, flags, pos, expected);
|
||||
}
|
||||
#endif /* CONFIG_X86_64 */
|
||||
|
||||
#ifdef CONFIG_ARCH_MAPS_ALL_RAM
|
||||
/* All RAM page frame entries aside from 0x0 must have a mapping.
|
||||
* We currently identity-map on x86, no conversion necessary other than a cast
|
||||
*/
|
||||
for (pos = (uint8_t *)Z_PHYS_RAM_START; pos < (uint8_t *)Z_PHYS_RAM_END;
|
||||
pos += CONFIG_MMU_PAGE_SIZE) {
|
||||
if (pos == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry = get_entry(&flags, pos);
|
||||
zassert_true((flags & MMU_P) != 0,
|
||||
"address %p isn't mapped", pos);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue