kernel: mm: rename Z_VM_KERNEL to K_MEM_IS_VM_KERNEL
This is part of a series to move memory management functions away from the z_ namespace and into its own namespace. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
db9d3134c5
commit
2d2bbc05d6
7 changed files with 21 additions and 18 deletions
|
|
@ -89,7 +89,7 @@
|
|||
orl $(CR0_PG | CR0_WP), %eax
|
||||
movl %eax, %cr0
|
||||
|
||||
#ifdef Z_VM_KERNEL
|
||||
#ifdef K_MEM_IS_VM_KERNEL
|
||||
/* Jump to a virtual address, which works because the identity and
|
||||
* virtual mappings both are to the same physical address.
|
||||
*/
|
||||
|
|
@ -98,7 +98,7 @@ vm_enter:
|
|||
/* We are now executing in virtual memory. We'll un-map the identity
|
||||
* mappings later once we are in the C domain
|
||||
*/
|
||||
#endif /* Z_VM_KERNEL */
|
||||
#endif /* K_MEM_IS_VM_KERNEL */
|
||||
|
||||
#endif /* CONFIG_X86_MMU */
|
||||
.endm
|
||||
|
|
@ -244,7 +244,7 @@ __csSet:
|
|||
ltr %ax
|
||||
#endif
|
||||
|
||||
#ifdef Z_VM_KERNEL
|
||||
#ifdef K_MEM_IS_VM_KERNEL
|
||||
/* Need to reset the stack to virtual address after
|
||||
* page table is loaded.
|
||||
*/
|
||||
|
|
@ -255,7 +255,7 @@ __csSet:
|
|||
#else
|
||||
addl $CONFIG_ISR_STACK_SIZE, %esp
|
||||
#endif
|
||||
#endif /* Z_VM_KERNEL */
|
||||
#endif /* K_MEM_IS_VM_KERNEL */
|
||||
|
||||
#ifdef CONFIG_THREAD_LOCAL_STORAGE
|
||||
pushl %esp
|
||||
|
|
|
|||
|
|
@ -1307,7 +1307,7 @@ void arch_mem_unmap(void *addr, size_t size)
|
|||
ARG_UNUSED(ret);
|
||||
}
|
||||
|
||||
#ifdef Z_VM_KERNEL
|
||||
#ifdef K_MEM_IS_VM_KERNEL
|
||||
__boot_func
|
||||
static void identity_map_remove(uint32_t level)
|
||||
{
|
||||
|
|
@ -1346,7 +1346,7 @@ static void identity_map_remove(uint32_t level)
|
|||
__boot_func
|
||||
void z_x86_mmu_init(void)
|
||||
{
|
||||
#ifdef Z_VM_KERNEL
|
||||
#ifdef K_MEM_IS_VM_KERNEL
|
||||
/* We booted with physical address space being identity mapped.
|
||||
* As we are now executing in virtual address space,
|
||||
* the identity map is no longer needed. So remove them.
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
* the same as its physical location, although an identity mapping for RAM
|
||||
* is still supported by setting CONFIG_KERNEL_VM_BASE=CONFIG_SRAM_BASE_ADDRESS.
|
||||
*/
|
||||
#ifdef Z_VM_KERNEL
|
||||
#ifdef K_MEM_IS_VM_KERNEL
|
||||
|
||||
#define KERNEL_BASE_ADDR \
|
||||
(CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_OFFSET)
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
MEMORY
|
||||
{
|
||||
#if defined(Z_VM_KERNEL)
|
||||
#if defined(K_MEM_IS_VM_KERNEL)
|
||||
ROM (rx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = PHYS_RAM_AVAIL
|
||||
#endif
|
||||
RAM (wx) : ORIGIN = KERNEL_BASE_ADDR, LENGTH = KERNEL_RAM_SIZE
|
||||
|
|
@ -75,7 +75,7 @@ MEMORY
|
|||
IDT_LIST : ORIGIN = 0xFFFF1000, LENGTH = 2K
|
||||
}
|
||||
|
||||
#if defined(Z_VM_KERNEL)
|
||||
#if defined(K_MEM_IS_VM_KERNEL)
|
||||
#define ROMABLE_REGION ROM
|
||||
#define RAMABLE_REGION RAM
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include <zephyr/linker/linker-tool.h>
|
||||
|
||||
#if defined(CONFIG_XIP) || defined(Z_VM_KERNEL)
|
||||
#if defined(CONFIG_XIP) || defined(K_MEM_IS_VM_KERNEL)
|
||||
#define ROMABLE_REGION ROM
|
||||
#define RAMABLE_REGION RAM
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
* the same as its physical location, although an identity mapping for RAM
|
||||
* is still supported by setting CONFIG_KERNEL_VM_BASE=CONFIG_SRAM_BASE_ADDRESS.
|
||||
*/
|
||||
#ifdef Z_VM_KERNEL
|
||||
#ifdef K_MEM_IS_VM_KERNEL
|
||||
#define KERNEL_BASE_ADDR (CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_OFFSET)
|
||||
#define KERNEL_RAM_SIZE (CONFIG_KERNEL_VM_SIZE - CONFIG_KERNEL_VM_OFFSET)
|
||||
#define PHYS_RAM_AVAIL (PHYS_RAM_SIZE - CONFIG_SRAM_OFFSET)
|
||||
|
|
@ -87,7 +87,7 @@ MEMORY
|
|||
* or copied into physical RAM by a loader (MMU)
|
||||
*/
|
||||
ROM (rx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = FLASH_ROM_SIZE
|
||||
#elif defined(Z_VM_KERNEL)
|
||||
#elif defined(K_MEM_IS_VM_KERNEL)
|
||||
ROM (rx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = PHYS_RAM_AVAIL
|
||||
#endif
|
||||
/* Linear address range to link the kernel. If non-XIP, everything is
|
||||
|
|
|
|||
|
|
@ -67,7 +67,10 @@
|
|||
#define K_MEM_VIRT_ADDR(phys) ((phys) + K_MEM_VIRT_OFFSET)
|
||||
|
||||
#if K_MEM_VIRT_OFFSET != 0
|
||||
#define Z_VM_KERNEL 1
|
||||
/**
|
||||
* @brief Kernel is mapped in virtual memory if defined.
|
||||
*/
|
||||
#define K_MEM_IS_VM_KERNEL 1
|
||||
#ifdef CONFIG_XIP
|
||||
#error "XIP and a virtual memory kernel are not allowed"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
*/
|
||||
#if defined(CONFIG_ARCH_POSIX)
|
||||
#define GROUP_LINK_IN(where)
|
||||
#elif !defined(Z_VM_KERNEL)
|
||||
#elif !defined(K_MEM_IS_VM_KERNEL)
|
||||
#define GROUP_LINK_IN(where) > where
|
||||
#endif
|
||||
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
*/
|
||||
#if defined(CONFIG_ARCH_POSIX)
|
||||
#define GROUP_ROM_LINK_IN(vregion, lregion)
|
||||
#elif defined(Z_VM_KERNEL)
|
||||
#elif defined(K_MEM_IS_VM_KERNEL)
|
||||
#define GROUP_ROM_LINK_IN(vregion, lregion) > vregion AT > lregion
|
||||
#else
|
||||
#define GROUP_ROM_LINK_IN(vregion, lregion) > lregion
|
||||
|
|
@ -133,7 +133,7 @@
|
|||
*/
|
||||
#if defined(CONFIG_ARCH_POSIX)
|
||||
#define GROUP_DATA_LINK_IN(vregion, lregion)
|
||||
#elif defined(CONFIG_XIP) || defined(Z_VM_KERNEL)
|
||||
#elif defined(CONFIG_XIP) || defined(K_MEM_IS_VM_KERNEL)
|
||||
#define GROUP_DATA_LINK_IN(vregion, lregion) > vregion AT > lregion
|
||||
#else
|
||||
#define GROUP_DATA_LINK_IN(vregion, lregion) > vregion
|
||||
|
|
@ -151,7 +151,7 @@
|
|||
*/
|
||||
#if defined(CONFIG_ARCH_POSIX)
|
||||
#define GROUP_NOLOAD_LINK_IN(vregion, lregion)
|
||||
#elif defined(Z_VM_KERNEL)
|
||||
#elif defined(K_MEM_IS_VM_KERNEL)
|
||||
#define GROUP_NOLOAD_LINK_IN(vregion, lregion) > vregion AT > lregion
|
||||
#elif defined(CONFIG_XIP)
|
||||
#define GROUP_NOLOAD_LINK_IN(vregion, lregion) > vregion AT > vregion
|
||||
|
|
@ -172,7 +172,7 @@
|
|||
* @param align Alignment directives, such as SUBALIGN(). ALIGN() itself is
|
||||
* not allowed. May be blank.
|
||||
*/
|
||||
#ifdef Z_VM_KERNEL
|
||||
#ifdef K_MEM_IS_VM_KERNEL
|
||||
/* If we have a virtual memory map we need ALIGN_WITH_INPUT in all sections */
|
||||
#define SECTION_PROLOGUE(name, options, align) \
|
||||
name options : ALIGN_WITH_INPUT align
|
||||
|
|
|
|||
Loading…
Reference in a new issue