gem5  v22.1.0.0
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
gem5::TranslationGen Class Referenceabstract

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>

Inheritance diagram for gem5::TranslationGen:
TestTranslationGen gem5::AMDGPUVM::AGPTranslationGen gem5::AMDGPUVM::GARTTranslationGen gem5::AMDGPUVM::MMHUBTranslationGen gem5::AMDGPUVM::UserTranslationGen gem5::BaseMMU::MMUTranslationGen gem5::EmulationPageTable::PageTableTranslationGen

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. More...
 
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. More...
 

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. More...
 

Detailed Description

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 60 of file translation_gen.hh.

Member Typedef Documentation

◆ const_iterator

Definition at line 122 of file translation_gen.hh.

Constructor & Destructor Documentation

◆ TranslationGen()

gem5::TranslationGen::TranslationGen ( Addr  new_start,
Addr  new_size 
)
inline

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 106 of file translation_gen.hh.

◆ ~TranslationGen()

virtual gem5::TranslationGen::~TranslationGen ( )
inlinevirtual

Definition at line 109 of file translation_gen.hh.

Member Function Documentation

◆ begin()

TranslationGenConstIterator gem5::TranslationGen::begin ( ) const
inline

Definition at line 253 of file translation_gen.hh.

References start().

Referenced by TEST().

◆ end()

TranslationGenConstIterator gem5::TranslationGen::end ( ) const
inline

Definition at line 259 of file translation_gen.hh.

Referenced by TEST().

◆ size()

Addr gem5::TranslationGen::size ( ) const
inline

Definition at line 112 of file translation_gen.hh.

References _size.

Referenced by TEST(), and gem5::TranslationGenConstIterator::update().

◆ start()

Addr gem5::TranslationGen::start ( ) const
inline

Definition at line 111 of file translation_gen.hh.

References _start.

Referenced by begin(), TEST(), and gem5::TranslationGenConstIterator::update().

◆ translate()

virtual void gem5::TranslationGen::translate ( Range range) const
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 TestTranslationGen, gem5::EmulationPageTable::PageTableTranslationGen, gem5::AMDGPUVM::UserTranslationGen, gem5::AMDGPUVM::MMHUBTranslationGen, gem5::AMDGPUVM::GARTTranslationGen, gem5::AMDGPUVM::AGPTranslationGen, and gem5::BaseMMU::MMUTranslationGen.

Referenced by gem5::TranslationGenConstIterator::update().

Friends And Related Function Documentation

◆ TranslationGenConstIterator

friend class TranslationGenConstIterator
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 121 of file translation_gen.hh.

Member Data Documentation

◆ _size

Addr gem5::TranslationGen::_size
protected

Definition at line 97 of file translation_gen.hh.

Referenced by size().

◆ _start

Addr gem5::TranslationGen::_start
protected

Definition at line 96 of file translation_gen.hh.

Referenced by start().


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

Generated on Wed Dec 21 2022 10:23:28 for gem5 by doxygen 1.9.1