contur2
Loading...
Searching...
No Matches
contur::IMMU Class Referenceabstract

Abstract interface for the Memory Management Unit. More...

#include <i_mmu.h>

Inheritance diagram for contur::IMMU:

Public Member Functions

virtual ~IMMU ()=default
virtual Result< Blockread (ProcessId processId, MemoryAddress virtualAddress) const =0
 Reads a Block from a virtual address in a given process's address space.
virtual Result< void > write (ProcessId processId, MemoryAddress virtualAddress, const Block &block)=0
 Writes a Block to a virtual address in a given process's address space.
virtual Result< MemoryAddressallocate (ProcessId processId, std::size_t pageCount)=0
 Allocates a range of frames for a process.
virtual Result< void > deallocate (ProcessId processId)=0
 Deallocates all frames owned by a process.
virtual Result< void > swapIn (ProcessId processId, MemoryAddress virtualAddress)=0
 Swaps a page into physical memory.
virtual Result< void > swapOut (ProcessId processId, MemoryAddress virtualAddress)=0
 Swaps a page out of physical memory (to simulated disk).
virtual std::size_t totalFrames () const noexcept=0
 Returns the total number of physical frames managed.
virtual std::size_t freeFrames () const noexcept=0
 Returns the number of free (unallocated) physical frames.

Detailed Description

Abstract interface for the Memory Management Unit.

Translates virtual addresses to physical addresses via page tables, manages frame allocation, and handles page swapping (swap in/out). The MMU sits between the CPU and physical memory, providing virtual memory support for process isolation.

Definition at line 21 of file i_mmu.h.

Constructor & Destructor Documentation

◆ ~IMMU()

virtual contur::IMMU::~IMMU ( )
virtualdefault

Member Function Documentation

◆ allocate()

virtual Result< MemoryAddress > contur::IMMU::allocate ( ProcessId processId,
std::size_t pageCount )
nodiscardpure virtual

Allocates a range of frames for a process.

Parameters
processIdThe owning process.
pageCountNumber of pages (frames) to allocate.
Returns
The starting virtual address, or an error if out of memory.

Implemented in contur::Mmu.

◆ deallocate()

virtual Result< void > contur::IMMU::deallocate ( ProcessId processId)
nodiscardpure virtual

Deallocates all frames owned by a process.

Parameters
processIdThe process whose frames should be freed.
Returns
Success, or an error if the process has no allocations.

Implemented in contur::Mmu.

◆ freeFrames()

virtual std::size_t contur::IMMU::freeFrames ( ) const
nodiscardpure virtualnoexcept

Returns the number of free (unallocated) physical frames.

Implemented in contur::Mmu.

◆ read()

virtual Result< Block > contur::IMMU::read ( ProcessId processId,
MemoryAddress virtualAddress ) const
nodiscardpure virtual

Reads a Block from a virtual address in a given process's address space.

Parameters
processIdThe owning process.
virtualAddressThe virtual address to read from.
Returns
The Block at the translated physical address, or an error.

Implemented in contur::Mmu.

◆ swapIn()

virtual Result< void > contur::IMMU::swapIn ( ProcessId processId,
MemoryAddress virtualAddress )
nodiscardpure virtual

Swaps a page into physical memory.

Parameters
processIdThe owning process.
virtualAddressA virtual address within the target page.
Returns
Success, or an error if swap fails.

Implemented in contur::Mmu.

◆ swapOut()

virtual Result< void > contur::IMMU::swapOut ( ProcessId processId,
MemoryAddress virtualAddress )
nodiscardpure virtual

Swaps a page out of physical memory (to simulated disk).

Parameters
processIdThe owning process.
virtualAddressA virtual address within the target page.
Returns
Success, or an error if swap fails.

Implemented in contur::Mmu.

◆ totalFrames()

virtual std::size_t contur::IMMU::totalFrames ( ) const
nodiscardpure virtualnoexcept

Returns the total number of physical frames managed.

Implemented in contur::Mmu.

◆ write()

virtual Result< void > contur::IMMU::write ( ProcessId processId,
MemoryAddress virtualAddress,
const Block & block )
nodiscardpure virtual

Writes a Block to a virtual address in a given process's address space.

Parameters
processIdThe owning process.
virtualAddressThe virtual address to write to.
blockThe Block to store.
Returns
Success, or an error if translation fails.

Implemented in contur::Mmu.


The documentation for this class was generated from the following file: