|
contur2
|
Concrete virtual memory manager. More...
#include <virtual_memory.h>


Public Member Functions | |
| VirtualMemory (IMMU &mmu, std::size_t maxSlots) | |
| Constructs virtual memory backed by the given MMU. | |
| ~VirtualMemory () override | |
| VirtualMemory (const VirtualMemory &)=delete | |
| VirtualMemory & | operator= (const VirtualMemory &)=delete |
| VirtualMemory (VirtualMemory &&) noexcept | |
| VirtualMemory & | operator= (VirtualMemory &&) noexcept |
| Result< MemoryAddress > | allocateSlot (ProcessId processId, std::size_t size) override |
| Allocates a virtual memory slot for a process. | |
| Result< void > | freeSlot (ProcessId processId) override |
| Frees a previously allocated slot. | |
| Result< void > | loadSegment (ProcessId processId, const std::vector< Block > &data) override |
| Loads a code/data segment into a process's virtual address space. | |
| Result< std::vector< Block > > | readSegment (ProcessId processId) const override |
| Reads the entire code/data segment from a process's virtual memory. | |
| std::size_t | totalSlots () const noexcept override |
| Returns the number of total slots available. | |
| std::size_t | freeSlots () const noexcept override |
| Returns the number of free (unallocated) slots. | |
| bool | hasSlot (ProcessId processId) const noexcept override |
| Checks whether a process has an allocated slot. | |
| std::size_t | slotSize (ProcessId processId) const noexcept override |
| Returns the slot size (number of blocks) for a process, or 0 if no slot. | |
| Public Member Functions inherited from contur::IVirtualMemory | |
| virtual | ~IVirtualMemory ()=default |
Private Attributes | |
| std::unique_ptr< Impl > | impl_ |
Concrete virtual memory manager.
Manages slot allocation and delegates actual memory operations to the underlying IMMU. Each process gets a dedicated virtual address range (slot) for its code and data.
Definition at line 20 of file virtual_memory.h.
|
explicit |
Constructs virtual memory backed by the given MMU.
| mmu | The MMU to use for address translation (non-owning reference). |
| maxSlots | Maximum number of concurrent process slots. |
|
override |
|
delete |
|
noexcept |
|
nodiscardoverridevirtual |
Allocates a virtual memory slot for a process.
| processId | The owning process. |
| size | Number of Block cells in the virtual address range. |
Implements contur::IVirtualMemory.
Frees a previously allocated slot.
| processId | The owning process. |
Implements contur::IVirtualMemory.
|
nodiscardoverridevirtualnoexcept |
Returns the number of free (unallocated) slots.
Implements contur::IVirtualMemory.
|
nodiscardoverridevirtualnoexcept |
Checks whether a process has an allocated slot.
Implements contur::IVirtualMemory.
|
nodiscardoverridevirtual |
Loads a code/data segment into a process's virtual address space.
| processId | The owning process. |
| data | The blocks to load. |
Implements contur::IVirtualMemory.
|
delete |
|
noexcept |
|
nodiscardoverridevirtual |
Reads the entire code/data segment from a process's virtual memory.
| processId | The owning process. |
Implements contur::IVirtualMemory.
|
nodiscardoverridevirtualnoexcept |
Returns the slot size (number of blocks) for a process, or 0 if no slot.
Implements contur::IVirtualMemory.
|
nodiscardoverridevirtualnoexcept |
Returns the number of total slots available.
Implements contur::IVirtualMemory.
|
private |
Definition at line 47 of file virtual_memory.h.