Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Kernel Memory Management Internal APIs

Functions

void * k_mem_map_impl (uintptr_t phys, size_t size, uint32_t flags, bool is_anon)
 Map memory into virtual address space with guard pages.
 
void k_mem_unmap_impl (void *addr, size_t size, bool is_anon)
 Un-map mapped memory.
 

Detailed Description

Function Documentation

◆ k_mem_map_impl()

void * k_mem_map_impl ( uintptr_t  phys,
size_t  size,
uint32_t  flags,
bool  is_anon 
)

#include <zephyr/kernel/internal/mm.h>

Map memory into virtual address space with guard pages.

This maps memory into virtual address space with a preceding and a succeeding guard pages.

See also
k_mem_map() for additional information if called via that.
k_mem_phys_map() for additional information if called via that.
Parameters
physPhysical address base of the memory region if not requesting anonymous memory. Must be page-aligned.
sizeSize of the memory mapping. This must be page-aligned.
flagsK_MEM_PERM_*, K_MEM_MAP_* control flags.
is_anonTrue is requesting mapping with anonymous memory.
Returns
The mapped memory location, or NULL if insufficient virtual address space, insufficient physical memory to establish the mapping, or insufficient memory for paging structures.

◆ k_mem_unmap_impl()

void k_mem_unmap_impl ( void *  addr,
size_t  size,
bool  is_anon 
)

#include <zephyr/kernel/internal/mm.h>

Un-map mapped memory.

This removes the memory mappings for the provided page-aligned region, and the two guard pages surrounding the region.

See also
k_mem_unmap() for additional information if called via that.
k_mem_phys_unmap() for additional information if called via that.
Note
Calling this function on a region which was not mapped to begin with is undefined behavior.
Parameters
addrPage-aligned memory region base virtual address
sizePage-aligned memory region size
is_anonTrue if the mapped memory is from anonymous memory.