Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
vm_manager.h File Reference
#include <spinlock.h>
#include <type.h>

Go to the source code of this file.

Data Structures

struct  virtual_memory_block
 
struct  virtual_memory
 
struct  virtual_memory_tree_node
 
struct  virtual_memory_tree
 
struct  virtual_memory_page
 

Macros

#define KERNEL_BASE   0xFFFF800000000000ULL
 
#define REGION_SIZE   0x0000008000000000ULL
 
#define USER_STACK_VADDR   0x7FFFFFFFE000ULL
 
#define USER_MMAP_BASE   0x100000000ULL
 

Typedefs

typedef struct virtual_memory_block virtual_memory_block_t
 
typedef struct virtual_memory virtual_memory_t
 

Enumerations

enum  mem_vma_region : uintptr_t {
  VMA_REGION_A = 0xFFFF800000000000ULL , VMA_REGION_B = 0xFFFF800000000000ULL + ( 0x0000008000000000ULL * 1) , VMA_REGION_C = 0xFFFF800000000000ULL + ( 0x0000008000000000ULL * 2) , VMA_REGION_KMODULE ,
  KALLOC_BASE_ADDR , mem_vma_phys_window_pt = 0xFFFFB00000000000ULL , mem_vma_phys_window_start = 0xFFFFD00000000000ULL , VMA_REGION_PROCESS = 0x400000
}
 

Functions

struct virtual_memory __attribute__ ((aligned(64)))
 
struct virtual_memory_tree_node __attribute__ ((aligned(8)))
 
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)
 
uintptr_t vma_lookup_free_vaddr (struct virtual_memory_page *page, mem_vma_region region, size_t size)
 
struct virtual_memory_pageget_kernel_vmm_page ()
 
struct virtual_memory_pagecreate_vmm_page ()
 

Variables

uintptr_t start_address
 
uintptr_t end_address
 
uintptr_t phys_address
 
size_t length
 
int flags
 
int core
 
struct virtual_memory_tree_nodeparent
 
struct virtual_memory_tree_nodenext
 
struct virtual_memory_tree __attribute__
 
spinlock_t lock
 
struct virtual_memory_tree vma_tree_zone_process
 
struct virtual_memory_tree vma_tree_zone_a
 
struct rbt_nodetree
 
uint8_t _pad [6]
 
struct virtual_memory_tree vma_tree_zone_b
 
struct virtual_memory_tree vma_tree_zone_c
 
struct virtual_memory_tree vma_tree_zone_kmodule
 

Macro Definition Documentation

◆ KERNEL_BASE

#define KERNEL_BASE   0xFFFF800000000000ULL

Definition at line 7 of file vm_manager.h.

◆ REGION_SIZE

#define REGION_SIZE   0x0000008000000000ULL

Definition at line 8 of file vm_manager.h.

◆ USER_MMAP_BASE

#define USER_MMAP_BASE   0x100000000ULL

Definition at line 10 of file vm_manager.h.

◆ USER_STACK_VADDR

#define USER_STACK_VADDR   0x7FFFFFFFE000ULL

Definition at line 9 of file vm_manager.h.

Referenced by execve().

Typedef Documentation

◆ virtual_memory_block_t

Definition at line 28 of file vm_manager.h.

◆ virtual_memory_t

Definition at line 35 of file vm_manager.h.

Enumeration Type Documentation

◆ mem_vma_region

Enumerator
VMA_REGION_A 
VMA_REGION_B 
VMA_REGION_C 
VMA_REGION_KMODULE 
KALLOC_BASE_ADDR 
mem_vma_phys_window_pt 
mem_vma_phys_window_start 
VMA_REGION_PROCESS 

Definition at line 12 of file vm_manager.h.

Function Documentation

◆ __attribute__() [1/2]

struct virtual_memory __attribute__ ( (aligned(64)) )

Definition at line 1 of file core.h.

◆ __attribute__() [2/2]

struct virtual_memory_tree_node __attribute__ ( (aligned(8)) )

◆ 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().

◆ get_kernel_vmm_page()

◆ 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_register()

◆ vma_unregister()

void vma_unregister ( struct virtual_memory_page * page,
uintptr_t virt_addr )

Variable Documentation

◆ __attribute__

struct virtual_memory_tree __attribute__

◆ _pad

uint8_t _pad[6]

Definition at line 4 of file vm_manager.h.

◆ core

◆ end_address

uintptr_t end_address

Definition at line 1 of file vm_manager.h.

Referenced by vma_tree_add_locked().

◆ flags

int flags

Definition at line 4 of file vm_manager.h.

◆ length

size_t length

Definition at line 3 of file vm_manager.h.

◆ lock

spinlock_t lock

Definition at line 0 of file vm_manager.h.

◆ next

Definition at line 3 of file vm_manager.h.

◆ parent

struct virtual_memory_tree_node* parent

Definition at line 0 of file vm_manager.h.

◆ phys_address

uintptr_t phys_address

Definition at line 2 of file vm_manager.h.

Referenced by vma_register().

◆ start_address

uintptr_t start_address

Definition at line 0 of file vm_manager.h.

Referenced by vma_tree_add_locked().

◆ tree

struct rbt_node* tree

Definition at line 3 of file vm_manager.h.

◆ vma_tree_zone_a

struct virtual_memory_tree vma_tree_zone_a

Definition at line 2 of file vm_manager.h.

◆ vma_tree_zone_b

struct virtual_memory_tree vma_tree_zone_b

Definition at line 5 of file vm_manager.h.

◆ vma_tree_zone_c

struct virtual_memory_tree vma_tree_zone_c

Definition at line 6 of file vm_manager.h.

◆ vma_tree_zone_kmodule

struct virtual_memory_tree vma_tree_zone_kmodule

Definition at line 7 of file vm_manager.h.

◆ vma_tree_zone_process

struct virtual_memory_tree vma_tree_zone_process

Definition at line 1 of file vm_manager.h.