![]() |
Contur 2
Educational OS kernel simulator
|
Simulated physical RAM — a linear array of Block cells. More...
#include <physical_memory.h>
Public Member Functions | |
| PhysicalMemory (std::size_t cellCount) | |
| Constructs physical memory with the given number of cells. | |
| ~PhysicalMemory () override | |
| Destroys physical memory instance. | |
| PhysicalMemory (const PhysicalMemory &)=delete | |
| PhysicalMemory & | operator= (const PhysicalMemory &)=delete |
| PhysicalMemory (PhysicalMemory &&) noexcept | |
| Move-constructs physical memory state. | |
| PhysicalMemory & | operator= (PhysicalMemory &&) noexcept |
| Move-assigns physical memory state. | |
| Result< Block > | read (MemoryAddress address) const override |
| Reads a Block from the given address. | |
| Result< void > | write (MemoryAddress address, const Block &block) override |
| Writes a Block to the given address. | |
| std::size_t | size () const noexcept override |
| Returns the total number of addressable cells. | |
| void | clear () override |
| Clears all memory cells to default (Nop) blocks. | |
| Result< void > | writeRange (MemoryAddress startAddress, const std::vector< Block > &blocks) |
| Writes a contiguous sequence of blocks starting at the given address. | |
| Result< std::vector< Block > > | readRange (MemoryAddress startAddress, std::size_t count) const |
| Reads a contiguous sequence of blocks starting at the given address. | |
| Result< void > | clearRange (MemoryAddress startAddress, std::size_t count) |
| Clears a range of memory cells to default blocks. | |
| Public Member Functions inherited from contur::IMemory | |
| virtual | ~IMemory ()=default |
Private Attributes | |
| std::unique_ptr< Impl > | impl_ |
Simulated physical RAM — a linear array of Block cells.
Supports read, write, clear, and bulk operations for loading/saving code segments (swap in/out).
Definition at line 17 of file physical_memory.h.
|
explicit |
Constructs physical memory with the given number of cells.
| cellCount | Total addressable cells (each holds one Block). |
Referenced by operator=(), operator=(), PhysicalMemory(), and PhysicalMemory().
|
override |
Destroys physical memory instance.
|
delete |
References PhysicalMemory().
|
noexcept |
Move-constructs physical memory state.
References PhysicalMemory().
|
overridevirtual |
Clears all memory cells to default (Nop) blocks.
Implements contur::IMemory.
References clear().
Referenced by clear().
|
nodiscard |
Clears a range of memory cells to default blocks.
| startAddress | The base address to begin clearing. |
| count | Number of blocks to clear. |
References clearRange().
Referenced by clearRange().
|
delete |
References PhysicalMemory().
|
noexcept |
Move-assigns physical memory state.
References PhysicalMemory().
|
nodiscardoverridevirtual |
Reads a Block from the given address.
| address | The memory address to read from. |
Implements contur::IMemory.
References read().
Referenced by read().
|
nodiscard |
Reads a contiguous sequence of blocks starting at the given address.
| startAddress | The base address to begin reading. |
| count | Number of blocks to read. |
References readRange().
Referenced by readRange().
|
nodiscardoverridevirtualnoexcept |
Returns the total number of addressable cells.
Implements contur::IMemory.
References size().
Referenced by size().
|
nodiscardoverridevirtual |
Writes a Block to the given address.
| address | The memory address to write to. |
| block | The Block to store. |
Implements contur::IMemory.
References write().
Referenced by write().
|
nodiscard |
Writes a contiguous sequence of blocks starting at the given address.
| startAddress | The base address to begin writing. |
| blocks | The blocks to write sequentially. |
References writeRange().
Referenced by writeRange().
|
private |
Definition at line 69 of file physical_memory.h.