kernel: mm: rename Z_VM_RESERVED to K_MEM_VM_RESERVED

This is part of a series to move memory management related
stuff from Z_ namespace into its own namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2024-06-07 10:14:49 -07:00 committed by Anas Nashif
parent a459cdf51e
commit 01682756b6
3 changed files with 13 additions and 8 deletions

View file

@ -95,7 +95,7 @@ below.
+--------------+
| Mapping |
+--------------+ <- memory mappings start here
| Reserved | <- special purpose virtual page(s) of size Z_VM_RESERVED
| Reserved | <- special purpose virtual page(s) of size K_MEM_VM_RESERVED
+--------------+ <- K_MEM_VIRT_RAM_END
* ``K_MEM_VIRT_RAM_START`` is the beginning of the virtual memory address space.
@ -126,7 +126,7 @@ below.
* If it is disabled, ``K_MEM_VM_FREE_START`` is the same ``K_MEM_KERNEL_VIRT_END`` which
is the end of the kernel image.
* ``Z_VM_RESERVED`` is an area reserved to support kernel functions. For example,
* ``K_MEM_VM_RESERVED`` is an area reserved to support kernel functions. For example,
some addresses are reserved to support demand paging.

View file

@ -313,16 +313,21 @@ void z_page_frames_dump(void);
(_phys) < K_MEM_PHYS_RAM_END; \
(_phys) += CONFIG_MMU_PAGE_SIZE, (_pageframe)++)
/**
* @def K_MEM_VM_RESERVED
* @brief Reserve space at the end of virtual memory.
*/
#ifdef CONFIG_DEMAND_PAGING
/* We reserve a virtual page as a scratch area for page-ins/outs at the end
* of the address space
*/
#define Z_VM_RESERVED CONFIG_MMU_PAGE_SIZE
#define K_MEM_VM_RESERVED CONFIG_MMU_PAGE_SIZE
#define Z_SCRATCH_PAGE ((void *)((uintptr_t)CONFIG_KERNEL_VM_BASE + \
(uintptr_t)CONFIG_KERNEL_VM_SIZE - \
CONFIG_MMU_PAGE_SIZE))
#else
#define Z_VM_RESERVED 0
#define K_MEM_VM_RESERVED 0
#endif /* CONFIG_DEMAND_PAGING */
#ifdef CONFIG_DEMAND_PAGING

View file

@ -179,7 +179,7 @@ void z_page_frames_dump(void)
* +--------------+
* | Mapping |
* +--------------+ <- mappings start here
* | Reserved | <- special purpose virtual page(s) of size Z_VM_RESERVED
* | Reserved | <- special purpose virtual page(s) of size K_MEM_VM_RESERVED
* +--------------+ <- K_MEM_VIRT_RAM_END
*/
@ -196,7 +196,7 @@ SYS_BITARRAY_DEFINE_STATIC(virt_region_bitmap,
static bool virt_region_inited;
#define Z_VIRT_REGION_START_ADDR K_MEM_VM_FREE_START
#define Z_VIRT_REGION_END_ADDR (K_MEM_VIRT_RAM_END - Z_VM_RESERVED)
#define Z_VIRT_REGION_END_ADDR (K_MEM_VIRT_RAM_END - K_MEM_VM_RESERVED)
static inline uintptr_t virt_from_bitmap_offset(size_t offset, size_t size)
{
@ -219,9 +219,9 @@ static void virt_region_init(void)
* already allocated so they will never be used.
*/
if (Z_VM_RESERVED > 0) {
if (K_MEM_VM_RESERVED > 0) {
/* Mark reserved region at end of virtual address space */
num_bits = Z_VM_RESERVED / CONFIG_MMU_PAGE_SIZE;
num_bits = K_MEM_VM_RESERVED / CONFIG_MMU_PAGE_SIZE;
(void)sys_bitarray_set_region(&virt_region_bitmap,
num_bits, 0);
}