Max OS 0.3
Loading...
Searching...
No Matches
memorymanagement.h
Go to the documentation of this file.
1
10#ifndef MAXOS_SYSTEM_MEMORYMANAGEMENT_H
11#define MAXOS_SYSTEM_MEMORYMANAGEMENT_H
12
13#include <cstddef>
14#include <cstdint>
15
16#include <libcommon/assert.h>
17
18#include <memory/virtual.h>
20#include <memory/allocator/bump.h>
21#include <system/multiboot.h>
22
23namespace MaxOS::memory {
24
30
31 private:
32
33 VirtualMemoryManager* m_virtual_memory_manager;
34
35 void* allocate_extra_space(size_t requested_size, size_t& actual_size) final;
36
37 public:
38
39 BumpMemoryManager(VirtualMemoryManager* virtual_memory_manager = nullptr);
41
42 // Virtual Memory Management
45 };
46
52
53
54 public:
55 inline static MemoryManager* s_kernel_memory_manager = nullptr;
56
57 explicit MemoryManager(VirtualMemoryManager* virtual_memory_manager = nullptr);
59
60 // Public Memory Management
61 static void* malloc(size_t size);
62 static void free(void* pointer);
63
64 // Kernel Memory Management
65 static void* kmalloc(size_t size);
66 static void kfree(void* pointer);
67 };
68}
69
70#endif //MAXOS_SYSTEM_MEMORYMANAGEMENT_H
needs breif
Basic doubly linked list bump memory manager.
static void switch_active_memory_manager(BumpMemoryManager *manager)
Switches the active memory manager.
Handles memory allocation and deallocation.
static void free(void *pointer)
Frees a block of memory using the current memory manager.
static MemoryManager * s_kernel_memory_manager
The memory manager for any kernel processes and all kernel allocations.
static void * malloc(size_t size)
Allocates a block of memory in the current USERSPACE heap.
static void * kmalloc(size_t size)
Allocates a block of memory in the KERNEL space.
static void kfree(void *pointer)
Frees a block of memory using the kernel memory manager.
~MemoryManager()
Destroy the Memory Manager object, frees the VMM if not the kernel memory manager.
Manages the virtual memory of the system and provides functions to allocate and free memory in the vi...
Definition virtual.h:104
Basic doubly linked list bump memory allocator.
Definition bump.h:47
Defines a VirtualMemoryManager class for managing virtual memory allocation and mapping to physical m...