Commit 77861037 authored by Andrew Boie's avatar Andrew Boie Committed by Anas Nashif
Browse files

x86: map all RAM if ACPI



ACPI tables can lurk anywhere. Map all memory so they can be
read.

Signed-off-by: default avatarAndrew Boie <andrew.p.boie@intel.com>
parent c56b41f9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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

+1 −0
Original line number Diff line number Diff line
@@ -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.

+11 −3
Original line number Diff line number Diff line
@@ -457,8 +457,13 @@ 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

    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"]
@@ -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()
+16 −0
Original line number Diff line number Diff line
@@ -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
}

/**