Files
kernel/include/sys/mm.h
T
Mark e0f0087ccc mman: rewrite physical memory manager
Better protection of reserved memory regions,
merged "pool" allocation functions into main
memory manager
2020-08-23 22:59:29 +03:00

36 lines
1.0 KiB
C

/** vim: set ft=cpp.doxygen :
* @file sys/mm.h
* @brief Virtual memory space management functions
*/
#pragma once
#include <stddef.h>
#include <stdint.h>
#if defined(ARCH_AMD64)
#include "arch/amd64/mm/mm.h"
#endif
struct process;
/// An invalid address analogous to NULL
#define MM_NADDR ((uintptr_t) -1)
#define MM_CLONE_FLG_KERNEL (1 << 0)
#define MM_CLONE_FLG_USER (1 << 1)
#define userspace
mm_space_t mm_space_create(void);
int mm_space_clone(mm_space_t dst, const mm_space_t src, uint32_t flags);
int mm_space_fork(struct process *dst, const struct process *src, uint32_t flags);
void mm_space_release(struct process *proc);
void mm_space_free(struct process *proc);
void mm_describe(const mm_space_t pd);
int mm_map_single(mm_space_t pd, uintptr_t virt_page, uintptr_t phys_page, uint64_t flags);
uintptr_t mm_umap_single(mm_space_t pd, uintptr_t virt_page, uint32_t size);
uintptr_t mm_map_get(mm_space_t pd, uintptr_t virt, uint64_t *rflags);
void userptr_check(const void *ptr);