Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
vm_manager.c File Reference
#include "autoconf.h"
#include "init/init.h"
#include <hal/cpu/paging.h>
#include <libk/serial.h>
#include <memory/memory_utils.h>
#include <memory/phys_base_allocator.h>
#include <memory/slab.h>
#include <memory/vm_manager.h>
#include <spinlock.h>
#include <str.h>
#include <type.h>
#include <libk/tree/rbt.h>

Go to the source code of this file.

Macros

#define RBT_TYPE   virtual_memory_t
 
#define RBT_ID_NAME   start_address
 
#define PERCPU   __attribute__((section(".data.percpu")))
 

Functions

static void vma_tree_add_locked (struct virtual_memory_page *page, mem_vma_region region, uintptr_t start_address, uintptr_t end_address)
 
struct virtual_memory_pagecreate_vmm_page ()
 
 INIT (vma)
 
void vma_register (struct virtual_memory_page *page, uintptr_t phys_address, uintptr_t virt_addr, size_t size)
 
virtual_memory_tvma_find (struct virtual_memory_page *page, uintptr_t virt_addr)
 
void vma_unregister (struct virtual_memory_page *page, uintptr_t virt_addr)
 
static void vma_rbt_debug_node (rbt_node *node, int level)
 
 __attribute__ ((unused))
 
uintptr_t vma_lookup_free_vaddr (struct virtual_memory_page *page, mem_vma_region region, size_t size)
 
 __attribute__ ((always_inline))
 

Variables

boolean_t paging_has_been_set
 
static rbt_nodeVMA_RBT_NIL = 0
 
static struct virtual_memory_pagekernel_vmm_page = 0
 
static struct slab_cacherbt_node_cache = 0
 
static struct slab_cachevma_cache = 0
 
static struct slab_cachevma_tree_zone_cache = 0
 
static struct slab_cachevma_block_cache = 0
 
static struct slab_cachevma_page = 0
 

Macro Definition Documentation

◆ PERCPU

#define PERCPU   __attribute__((section(".data.percpu")))

Definition at line 17 of file vm_manager.c.

◆ RBT_ID_NAME

#define RBT_ID_NAME   start_address

Definition at line 14 of file vm_manager.c.

◆ RBT_TYPE

#define RBT_TYPE   virtual_memory_t

Definition at line 13 of file vm_manager.c.

Function Documentation

◆ __attribute__() [1/2]

__attribute__ ( (always_inline) )

Definition at line 200 of file vm_manager.c.

References kernel_vmm_page.

◆ __attribute__() [2/2]

__attribute__ ( (unused) )

Definition at line 152 of file vm_manager.c.

References root, and vma_rbt_debug_node().

◆ create_vmm_page()

struct virtual_memory_page * create_vmm_page ( )

Definition at line 73 of file vm_manager.c.

References memset(), vma_page, VMA_RBT_NIL, and vxSlabAlloc().

Referenced by execve(), and INIT().

◆ INIT()

◆ vma_find()

virtual_memory_t * vma_find ( struct virtual_memory_page * page,
uintptr_t virt_addr )

Definition at line 117 of file vm_manager.c.

References rbt_node::data, NULL, page, rbt_search_node(), spin_acquire(), spin_release(), and VMA_RBT_NIL.

Referenced by syscall_mprotect().

◆ vma_lookup_free_vaddr()

◆ vma_rbt_debug_node()

static void vma_rbt_debug_node ( rbt_node * node,
int level )
static

◆ vma_register()

◆ vma_tree_add_locked()

◆ vma_unregister()

void vma_unregister ( struct virtual_memory_page * page,
uintptr_t virt_addr )

Variable Documentation

◆ kernel_vmm_page

struct virtual_memory_page* kernel_vmm_page = 0
static

Definition at line 23 of file vm_manager.c.

Referenced by __attribute__(), and INIT().

◆ paging_has_been_set

boolean_t paging_has_been_set
extern

Definition at line 18 of file paging.c.

Referenced by INIT(), paging_create_page_directory(), paging_setup(), paging_unmap_page(), and vxMmap().

◆ rbt_node_cache

struct slab_cache* rbt_node_cache = 0
static

Definition at line 25 of file vm_manager.c.

Referenced by __attribute__(), INIT(), INIT(), and vma_register().

◆ vma_block_cache

struct slab_cache* vma_block_cache = 0
static

Definition at line 28 of file vm_manager.c.

Referenced by INIT().

◆ vma_cache

struct slab_cache* vma_cache = 0
static

Definition at line 26 of file vm_manager.c.

Referenced by INIT(), and vma_register().

◆ vma_page

struct slab_cache* vma_page = 0
static

Definition at line 29 of file vm_manager.c.

Referenced by create_vmm_page(), and INIT().

◆ VMA_RBT_NIL

rbt_node* VMA_RBT_NIL = 0
static

◆ vma_tree_zone_cache

struct slab_cache* vma_tree_zone_cache = 0
static

Definition at line 27 of file vm_manager.c.

Referenced by INIT(), and vma_tree_add_locked().