kernel: add page frame management
Initialize the page frame ontology at boot and update it when we do memory mappings. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
9d2ebfff58
commit
2ca5fb7e06
6 changed files with 579 additions and 99 deletions
|
@ -9,14 +9,16 @@
|
|||
#define ROMABLE_REGION RAM
|
||||
#define RAMABLE_REGION RAM
|
||||
|
||||
#define MMU_PAGE_ALIGN . = ALIGN(CONFIG_MMU_PAGE_SIZE);
|
||||
|
||||
/* Used to align areas with separate memory permission characteristics
|
||||
* so that the page permissions can be set in the MMU. Without this,
|
||||
* the kernel is just one blob with the same RWX permissions on all RAM
|
||||
*/
|
||||
#ifdef CONFIG_SRAM_REGION_PERMISSIONS
|
||||
#define MMU_PAGE_ALIGN . = ALIGN(CONFIG_MMU_PAGE_SIZE);
|
||||
#define MMU_PAGE_ALIGN_PERM MMU_PAGE_ALIGN
|
||||
#else
|
||||
#define MMU_PAGE_ALIGN
|
||||
#define MMU_PAGE_ALIGN_PERM
|
||||
#endif
|
||||
|
||||
ENTRY(CONFIG_KERNEL_ENTRY)
|
||||
|
@ -34,12 +36,12 @@ SECTIONS
|
|||
_locore_start = .;
|
||||
*(.locore)
|
||||
*(.locore.*)
|
||||
MMU_PAGE_ALIGN
|
||||
MMU_PAGE_ALIGN_PERM
|
||||
_locore_end = .;
|
||||
|
||||
_lorodata_start = .;
|
||||
*(.lorodata)
|
||||
MMU_PAGE_ALIGN
|
||||
MMU_PAGE_ALIGN_PERM
|
||||
_lodata_start = .;
|
||||
|
||||
*(.lodata)
|
||||
|
@ -54,7 +56,7 @@ SECTIONS
|
|||
* On x86-64 the IDT is in rodata and doesn't need to be in the
|
||||
* trampoline page.
|
||||
*/
|
||||
MMU_PAGE_ALIGN
|
||||
MMU_PAGE_ALIGN_PERM
|
||||
z_shared_kernel_page_start = .;
|
||||
#endif /* CONFIG_X86_KPTI */
|
||||
|
||||
|
@ -63,7 +65,7 @@ SECTIONS
|
|||
|
||||
#ifdef CONFIG_X86_KPTI
|
||||
*(.trampolines)
|
||||
MMU_PAGE_ALIGN
|
||||
MMU_PAGE_ALIGN_PERM
|
||||
z_shared_kernel_page_end = .;
|
||||
|
||||
ASSERT(z_shared_kernel_page_end - z_shared_kernel_page_start == 4096,
|
||||
|
@ -93,7 +95,7 @@ SECTIONS
|
|||
|
||||
#include <linker/kobject-text.ld>
|
||||
|
||||
MMU_PAGE_ALIGN
|
||||
MMU_PAGE_ALIGN_PERM
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
_image_text_end = .;
|
||||
|
@ -123,15 +125,15 @@ SECTIONS
|
|||
|
||||
#include <linker/cplusplus-rom.ld>
|
||||
|
||||
MMU_PAGE_ALIGN
|
||||
MMU_PAGE_ALIGN_PERM
|
||||
_image_rodata_end = .;
|
||||
_image_rodata_size = _image_rodata_end - _image_rodata_start;
|
||||
_image_rom_end = .;
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
/* APP SHARED MEMORY REGION */
|
||||
#define SMEM_PARTITION_ALIGN(size) MMU_PAGE_ALIGN
|
||||
#define APP_SHARED_ALIGN MMU_PAGE_ALIGN
|
||||
#define SMEM_PARTITION_ALIGN(size) MMU_PAGE_ALIGN_PERM
|
||||
#define APP_SHARED_ALIGN MMU_PAGE_ALIGN_PERM
|
||||
|
||||
#include <app_smem.ld>
|
||||
|
||||
|
@ -148,7 +150,7 @@ SECTIONS
|
|||
|
||||
SECTION_PROLOGUE(_BSS_SECTION_NAME, (NOLOAD), ALIGN(16))
|
||||
{
|
||||
MMU_PAGE_ALIGN
|
||||
MMU_PAGE_ALIGN_PERM
|
||||
#ifndef CONFIG_USERSPACE
|
||||
_image_ram_start = .;
|
||||
#endif
|
||||
|
@ -180,7 +182,7 @@ SECTIONS
|
|||
|
||||
/* Must be last in RAM */
|
||||
#include <linker/kobject.ld>
|
||||
. = ALIGN(CONFIG_MMU_PAGE_SIZE);
|
||||
MMU_PAGE_ALIGN
|
||||
_image_ram_end = .;
|
||||
z_mapped_end = .;
|
||||
_end = .;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue