Max OS 0.3
Loading...
Searching...
No Matches
virtual.h File Reference

Defines a VirtualMemoryManager class for managing virtual memory allocation and mapping to physical memory. More...

#include <stdint.h>
#include <stddef.h>
#include <memory/physical.h>
#include <common/string.h>

Go to the source code of this file.

Classes

struct  MaxOS::memory::VirtualMemoryChunk
 A container for a region of virtual memory that has been allocated by the Virtual Memory Manager. More...
 
struct  MaxOS::memory::FreeChunk
 A chunk of memory that has been freed and is available for allocation. A node in a linked list. More...
 
struct  MaxOS::memory::VirtualMemoryRegion
 A region of virtual memory containing multiple chunks (should fit in one page). More...
 
class  MaxOS::memory::VirtualMemoryManager
 Manages the virtual memory of the system and provides functions to allocate and free memory in the virtual address space. More...
 

Typedefs

typedef enum MaxOS::memory::VirtualFlags MaxOS::memory::virtual_flags_t
 Alias for VirtualFlags enum.
 
typedef struct MaxOS::memory::VirtualMemoryChunk MaxOS::memory::virtual_memory_chunk_t
 Alias for VirtualMemoryChunk struct.
 
typedef struct MaxOS::memory::FreeChunk MaxOS::memory::free_chunk_t
 Alias for FreeChunk struct.
 
typedef struct PACKED MaxOS::memory::VirtualMemoryRegion MaxOS::memory::virtual_memory_region_t
 Alias for VirtualMemoryRegion struct.
 

Enumerations

enum  MaxOS::memory::VirtualFlags { MaxOS::memory::RESERVE = (1 << 9) , MaxOS::memory::SHARED = (1 << 10) }
 Flags for chunks used in virtual memory allocation. More...
 

Detailed Description

Defines a VirtualMemoryManager class for managing virtual memory allocation and mapping to physical memory.

Date
11th February 2024
Author
Max Tyson

Definition in file virtual.h.

Typedef Documentation

◆ virtual_flags_t

Alias for VirtualFlags enum.

See also
PageFlags
Note
0 - (1 << 8) are reserved for the page flags

◆ virtual_memory_chunk_t

Alias for VirtualMemoryChunk struct.

See also
VirtualFlags

◆ virtual_memory_region_t

Alias for VirtualMemoryRegion struct.

Note
This stores the metadata for the chunks, not the actual memory they represent. (ie chunks are not slices of this region)

Enumeration Type Documentation

◆ VirtualFlags

Flags for chunks used in virtual memory allocation.

Enumerator
RESERVE 

Reserve the memory but do not map any physical memory to it.

SHARED 

The memory is shared between multiple processes.

Definition at line 31 of file virtual.h.

31 {
32
33 RESERVE = (1 << 9),
34 SHARED = (1 << 10),
35
@ RESERVE
Reserve the memory but do not map any physical memory to it.
Definition virtual.h:33
enum MaxOS::memory::VirtualFlags virtual_flags_t
Alias for VirtualFlags enum.