7#ifndef ZEPHYR_INCLUDE_SYS_MEM_MANAGE_H
8#define ZEPHYR_INCLUDE_SYS_MEM_MANAGE_H
18#define K_MEM_CACHE_NONE 2
21#define K_MEM_CACHE_WT 1
24#define K_MEM_CACHE_WB 0
27#define K_MEM_CACHE_MASK (BIT(3) - 1)
34#define K_MEM_PERM_RW BIT(3)
37#define K_MEM_PERM_EXEC BIT(4)
40#define K_MEM_PERM_USER BIT(5)
61#define Z_MEM_VM_OFFSET ((CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_OFFSET) - \
62 (CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_OFFSET))
64#define Z_MEM_VM_OFFSET 0
67#define Z_MEM_PHYS_ADDR(virt) ((virt) - Z_MEM_VM_OFFSET)
68#define Z_MEM_VIRT_ADDR(phys) ((phys) + Z_MEM_VM_OFFSET)
70#if Z_MEM_VM_OFFSET != 0
73#error "XIP and a virtual memory kernel are not allowed"
84#ifdef CONFIG_DEMAND_PAGING_STATS
90 unsigned long irq_locked;
93 unsigned long irq_unlocked;
95#ifndef CONFIG_DEMAND_PAGING_ALLOW_IRQ
112#ifdef CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM
114 unsigned long counts[CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM_NUM_BINS];
119 unsigned long bounds[CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM_NUM_BINS];
124static inline uintptr_t z_mem_phys_addr(
void *virt)
129 __ASSERT((addr >= CONFIG_KERNEL_VM_BASE) &&
130 (addr < (CONFIG_KERNEL_VM_BASE +
131 (CONFIG_KERNEL_VM_SIZE))),
132 "address %p not in permanent mappings", virt);
135 __ASSERT((addr >= CONFIG_SRAM_BASE_ADDRESS) &&
136 (addr < (CONFIG_SRAM_BASE_ADDRESS +
137 (CONFIG_SRAM_SIZE * 1024UL))),
138 "physical address 0x%lx not in RAM",
139 (
unsigned long)addr);
146 return Z_MEM_PHYS_ADDR(addr);
150static inline void *z_mem_virt_addr(
uintptr_t phys)
152 __ASSERT((phys >= CONFIG_SRAM_BASE_ADDRESS) &&
153 (phys < (CONFIG_SRAM_BASE_ADDRESS +
154 (CONFIG_SRAM_SIZE * 1024UL))),
155 "physical address 0x%lx not in RAM", (
unsigned long)phys);
161 return (
void *)Z_MEM_VIRT_ADDR(phys);
239void z_phys_unmap(
uint8_t *virt,
size_t size);
256#define K_MEM_MAP_UNINIT BIT(16)
267#define K_MEM_MAP_LOCK BIT(17)
286#define K_MEM_MAP_GUARD __DEPRECATED_MACRO BIT(18)
371 uintptr_t addr,
size_t size,
size_t align);
502#include <syscalls/mem_manage.h>
static struct k_thread thread[2]
Definition: atomic.c:22
void k_mem_paging_backing_store_page_finalize(struct z_page_frame *pf, uintptr_t location)
void k_mem_paging_backing_store_page_out(uintptr_t location)
void k_mem_paging_backing_store_location_free(uintptr_t location)
void k_mem_paging_backing_store_init(void)
void k_mem_paging_backing_store_page_in(uintptr_t location)
int k_mem_paging_backing_store_location_get(struct z_page_frame *pf, uintptr_t *location, bool page_fault)
struct z_page_frame * k_mem_paging_eviction_select(bool *dirty)
void k_mem_paging_eviction_init(void)
int k_mem_page_out(void *addr, size_t size)
void k_mem_paging_histogram_backing_store_page_in_get(struct k_mem_paging_histogram_t *hist)
void k_mem_unpin(void *addr, size_t size)
void k_mem_paging_stats_get(struct k_mem_paging_stats_t *stats)
void k_mem_pin(void *addr, size_t size)
void k_mem_page_in(void *addr, size_t size)
void k_mem_paging_histogram_backing_store_page_out_get(struct k_mem_paging_histogram_t *hist)
void k_mem_paging_histogram_eviction_get(struct k_mem_paging_histogram_t *hist)
void k_mem_paging_thread_stats_get(struct k_thread *thread, struct k_mem_paging_stats_t *stats)
flags
Definition: http_parser.h:131
size_t k_mem_free_get(void)
size_t k_mem_region_align(uintptr_t *aligned_addr, size_t *aligned_size, uintptr_t addr, size_t size, size_t align)
void k_mem_unmap(void *addr, size_t size)
void * k_mem_map(size_t size, uint32_t flags)
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:75
Definition: mem_manage.h:111
Definition: mem_manage.h:83