MOS Source Code
|
#include "mos/io/io.h"
#include "mos/mm/mm.h"
#include "mos/mm/paging/table_ops.h"
#include "mos/platform/platform.h"
#include "mos/syslog/printk.h"
#include <mos/mm/cow.h>
#include <mos/mm/mm_types.h>
#include <mos/mm/mmap.h>
#include <mos/mm/paging/paging.h>
#include <mos/mos_global.h>
#include <mos/tasks/process.h>
#include <mos/tasks/task_types.h>
Go to the source code of this file.
Functions | |
static bool | mmap_verify_arguments (ptr_t *hint_addr, mmap_flags_t mmap_flags) |
Check if the mmap flags are valid. | |
ptr_t | mmap_anonymous (mm_context_t *ctx, ptr_t hint_addr, mmap_flags_t flags, vm_flags vm_flags, size_t n_pages) |
Map a page into the current process's address space. | |
ptr_t | mmap_file (mm_context_t *ctx, ptr_t hint_addr, mmap_flags_t flags, vm_flags vm_flags, size_t n_pages, io_t *io, off_t offset) |
Map a file into the current process's address space. | |
bool | munmap (ptr_t addr, size_t size) |
Unmap a page from the current process's address space. | |
bool | vm_protect (mm_context_t *mmctx, ptr_t addr, size_t size, vm_flags perm) |
Change the permissions of a mapping. | |
|
static |
Check if the mmap flags are valid.
hint_addr | The hint address |
mmap_flags | The mmap flags |
Definition at line 23 of file mmap.c.
Referenced by mmap_anonymous(), and mmap_file().
ptr_t mmap_anonymous | ( | mm_context_t * | ctx, |
ptr_t | hint_addr, | ||
mmap_flags_t | flags, | ||
vm_flags | vm_flags, | ||
size_t | n_pages ) |
Map a page into the current process's address space.
ctx | The memory management context |
hint_addr | A hint for the address to map the page at, the actual address is determined based on the flags |
flags | Flags to control the mapping, see mmap_flags_t |
vm_flags | Flags to control the permissions of the mapping, see vm_flags |
n_pages | Number of pages to map |
Definition at line 54 of file mmap.c.
ptr_t mmap_file | ( | mm_context_t * | ctx, |
ptr_t | hint_addr, | ||
mmap_flags_t | flags, | ||
vm_flags | vm_flags, | ||
size_t | n_pages, | ||
io_t * | io, | ||
off_t | offset ) |
Map a file into the current process's address space.
ctx | The memory management context |
hint_addr | A hint for the address to map the page at, the actual address is determined based on the flags |
flags | Flags to control the mapping, see mmap_flags_t |
vm_flags | Flags to control the permissions of the mapping, see vm_flags |
n_pages | Number of pages to map |
io | The io object to map, the io object must be backed by a file_t |
offset | The offset into the file to map, must be page aligned |
Definition at line 73 of file mmap.c.
Referenced by elf_map_segment().
Unmap a page from the current process's address space.
addr | The address to unmap |
size | The size of the mapping to unmap |
addr
nor size
need to be page aligned, all pages contained within the range specified will be unmapped even if they are not fully contained within the range. Definition at line 111 of file mmap.c.
bool vm_protect | ( | mm_context_t * | mmctx, |
ptr_t | addr, | ||
size_t | size, | ||
vm_flags | perm ) |