55 auto traverse_hierarchy = [
this](
BaseTLB *starter) {
57 switch (
tlb->type()) {
58 case TypeTLB::instruction:
66 case TypeTLB::unified:
71 panic(
"Invalid TLB type\n");
76 traverse_hierarchy(
itb);
77 traverse_hierarchy(
dtb);
134 TranslationGen(new_start, new_size), tc(new_tc), cid(tc->contextId()),
135 mmu(new_mmu),
mode(new_mode),
flags(new_flags),
136 pageBytes(page_bytes)
143 if (next == range.
vaddr)
147 auto req = std::make_shared<Request>(
150 range.
fault = mmu->translateFunctional(req, tc,
mode);
153 range.
paddr = req->getPaddr();
void translate(Range &range) const override
Subclasses implement this function to complete TranslationGen.
MMUTranslationGen(Addr page_bytes, Addr new_start, Addr new_size, ThreadContext *new_tc, BaseMMU *new_mmu, BaseMMU::Mode new_mode, Request::Flags new_flags)
std::set< BaseTLB * > instruction
It is possible from the MMU to traverse the entire hierarchy of TLBs, starting from the DTB and ITB (...
void init() override
Called at init time, this method is traversing the TLB hierarchy and pupulating the instruction/data/...
virtual Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode mode)
virtual void takeOverFrom(BaseMMU *old_mmu)
void demapPage(Addr vaddr, uint64_t asn)
std::set< BaseTLB * > data
virtual void translateTiming(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode)
std::set< BaseTLB * > unified
BaseTLB * getTlb(Mode mode) const
virtual Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode)
virtual Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, Mode mode) const
virtual Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) const =0
Do post-translation physical address finalization.
virtual void translateTiming(const RequestPtr &req, ThreadContext *tc, BaseMMU::Translation *translation, BaseMMU::Mode mode)=0
virtual void takeOverFrom(BaseTLB *otlb)=0
Take over from an old tlb context.
virtual Port * getTableWalkerPort()
Get the table walker port if present.
virtual void demapPage(Addr vaddr, uint64_t asn)=0
virtual Fault translateAtomic(const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode)=0
virtual Fault translateFunctional(const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode)
Ports are used to interface objects to each other.
void takeOverFrom(Port *old)
A utility function to make it easier to swap out ports.
@ funcRequestorId
This requestor id is used for functional requests that don't come from a particular device.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
TranslationGen is a base class for a generator object which returns information about address transla...
static constexpr T roundUp(const T &val, const U &align)
This function is used to align addresses in memory.
#define panic(...)
This implements a cprintf based panic() function.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< FaultBase > Fault
std::shared_ptr< Request > RequestPtr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
constexpr decltype(nullptr) NoFault
This structure represents a single, contiguous translation, or carries information about whatever fau...