gem5 v24.0.0.0
|
TranslationGen is a base class for a generator object which returns information about address translations over a range of virtual addresses. More...
#include <translation_gen.hh>
Classes | |
struct | Range |
This structure represents a single, contiguous translation, or carries information about whatever fault might have happened while attempting it. More... | |
Public Types | |
using | const_iterator = TranslationGenConstIterator |
Public Member Functions | |
TranslationGen (Addr new_start, Addr new_size) | |
The starting virtual address and the size of the entire region being translated. | |
virtual | ~TranslationGen () |
Addr | start () const |
Addr | size () const |
const_iterator | begin () const |
const_iterator | end () const |
Protected Member Functions | |
virtual void | translate (Range &range) const =0 |
Subclasses implement this function to complete TranslationGen. | |
Protected Attributes | |
Addr | _start |
Addr | _size |
Friends | |
class | TranslationGenConstIterator |
A const iterator class is provided so this generator can be used in a range based for loop. | |
TranslationGen is a base class for a generator object which returns information about address translations over a range of virtual addresses.
An object which can perform translations, like an MMU or one representing an in memory page table, can create one of these when asked to translate a range of virtual addresses. The caller can then retrieve translation information from the generator one bit at a time, until the whole range has been translated and the generator has been exhausted.
This frees the caller from having to know how far ahead a given translation is good for, or in other words where they need to break up the region to translate its individual parts (page boundaries, etc).
This base class manages the bookkeeping during that process. Subclasses are responsible for doing the actual translation, which is requested using the "translate" virtual method.
Definition at line 61 of file translation_gen.hh.
Definition at line 125 of file translation_gen.hh.
The starting virtual address and the size of the entire region being translated.
Subclass constructors can take whatever additional info they may need, like pointers back to the object actually doing the translation.
Definition at line 109 of file translation_gen.hh.
|
inlinevirtual |
Definition at line 112 of file translation_gen.hh.
|
inline |
|
inline |
Definition at line 262 of file translation_gen.hh.
|
inline |
Definition at line 115 of file translation_gen.hh.
References _size.
Referenced by TEST(), and gem5::TranslationGenConstIterator::update().
|
inline |
Definition at line 114 of file translation_gen.hh.
References _start.
Referenced by begin(), TEST(), and gem5::TranslationGenConstIterator::update().
|
protectedpure virtual |
Subclasses implement this function to complete TranslationGen.
It should accept a Range reference which will have its "vaddr" field set to the virtual address to translate, and the "size" field set to the remaining size of the entire region being translated.
If there is a fault performing the translation of "vaddr", then this function should set the "fault" field of range and return.
If the translation was successful, this method should set "paddr" to the corresponding physical address, and set "size" to the number of bytes corresponding to the translation. Or more precisely, size should be set to the maximum "N" where vaddr + n maps to paddr + n for all 0 <= n <= N.
Implemented in gem5::AMDGPUVM::AGPTranslationGen, gem5::AMDGPUVM::GARTTranslationGen, gem5::AMDGPUVM::MMHUBTranslationGen, gem5::AMDGPUVM::UserTranslationGen, gem5::BaseMMU::MMUTranslationGen, gem5::EmulationPageTable::PageTableTranslationGen, and TestTranslationGen.
Referenced by gem5::TranslationGenConstIterator::update().
|
friend |
A const iterator class is provided so this generator can be used in a range based for loop.
When incremented, the iterator will either reattempt a translation that faulted earlier, or if there was no fault, will advance by "size" bytes and perform the translation of the next chunk.
Definition at line 124 of file translation_gen.hh.
|
protected |
Definition at line 100 of file translation_gen.hh.
Referenced by size().
|
protected |
Definition at line 99 of file translation_gen.hh.
Referenced by start().