x86: reserve the first megabyte
A more comprehensive solution would use E820 enumeration, but we are unlikely to ever care that much, as we intend to use demand paging on microcontrollers and not PC-like hardware. This is really to just prevent QEMU from crashing. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
5db615bb38
commit
f3e9b61a91
|
@ -17,6 +17,7 @@
|
|||
#include <x86_mmu.h>
|
||||
#include <init.h>
|
||||
#include <kernel_internal.h>
|
||||
#include <mmu.h>
|
||||
#include <drivers/interrupt_controller/loapic.h>
|
||||
|
||||
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
|
||||
|
@ -1775,3 +1776,22 @@ void z_x86_current_stack_perms(void)
|
|||
#endif
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
#ifdef CONFIG_ARCH_HAS_RESERVED_PAGE_FRAMES
|
||||
/* Selected on PC-like targets at the SOC level.
|
||||
*
|
||||
* Best is to do some E820 or similar enumeration to specifically identify
|
||||
* all page frames which are reserved by the hardware or firmware.
|
||||
*
|
||||
* For now, just reserve everything in the first megabyte of physical memory.
|
||||
*/
|
||||
void arch_reserved_pages_update(void)
|
||||
{
|
||||
for (uintptr_t pos = 0; pos < (1024 * 1024);
|
||||
pos += CONFIG_MMU_PAGE_SIZE) {
|
||||
struct z_page_frame *pf = z_phys_to_page_frame(pos);
|
||||
|
||||
pf->flags |= Z_PAGE_FRAME_RESERVED;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_ARCH_HAS_RESERVED_PAGE_FRAMES */
|
||||
|
|
|
@ -10,3 +10,4 @@ config SOC_APOLLO_LAKE
|
|||
select PCIE_MSI
|
||||
select DYNAMIC_INTERRUPTS
|
||||
select X86_MMU
|
||||
select ARCH_HAS_RESERVED_PAGE_FRAMES
|
||||
|
|
|
@ -6,3 +6,4 @@ config SOC_ATOM
|
|||
select CPU_ATOM
|
||||
select X86_MMU
|
||||
select ARCH_HAS_USERSPACE
|
||||
select ARCH_HAS_RESERVED_PAGE_FRAMES
|
||||
|
|
|
@ -4,3 +4,4 @@ config SOC_IA32
|
|||
bool "Generic IA32 SoC"
|
||||
select X86
|
||||
select CPU_MINUTEIA
|
||||
select ARCH_HAS_RESERVED_PAGE_FRAMES if SRAM_BASE_ADDRESS = 0
|
||||
|
|
Loading…
Reference in a new issue