kernel: add CONFIG_ARCH_HAS_RESERVED_PAGE_FRAMES
We will need this to run on x86 with PC-like hardware.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/arch/Kconfig b/arch/Kconfig
index 5d099b9..dedc122 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -517,6 +517,14 @@
This hidden option is selected when the CPU has a Memory Management Unit
(MMU).
+config ARCH_HAS_RESERVED_PAGE_FRAMES
+ bool
+ help
+ This hidden configuration should be selected by the architecture if
+ certain RAM page frames need to be marked as reserved and never used for
+ memory mappings. The architecture will need to implement
+ arch_reserved_pages_update().
+
menuconfig MMU
bool "Enable MMU features"
depends on CPU_HAS_MMU
diff --git a/kernel/include/kernel_arch_interface.h b/kernel/include/kernel_arch_interface.h
index c784852..4e014d0 100644
--- a/kernel/include/kernel_arch_interface.h
+++ b/kernel/include/kernel_arch_interface.h
@@ -282,6 +282,20 @@
* @param size Page-aligned region size
*/
void arch_mem_unmap(void *addr, size_t size);
+
+#ifdef CONFIG_ARCH_HAS_RESERVED_PAGE_FRAMES
+/**
+ * Update page frame database with reserved pages
+ *
+ * Some page frames within system RAM may not be available for use. A good
+ * example of this is reserved regions in the first megabyte on PC-like systems.
+ *
+ * Implementations of this function should mark all relavent entries in
+ * z_page_frames with K_PAGE_FRAME_RESERVED. This function is called at
+ * early system initialization with mm_lock held.
+ */
+void arch_reserved_pages_update(void);
+#endif /* ARCH_HAS_RESERVED_PAGE_FRAMES */
#endif /* CONFIG_MMU */
/** @} */