40#include "debug/MMU.hh"
61 "EmulationPageTable::allocate: addr %#x already mapped",
80 DPRINTF(
MMU,
"moving pages from vaddr %08p to %08p, size = %d\n",
vaddr,
84 [[maybe_unused]]
auto new_it =
pTable.find(new_vaddr);
86 assert(old_it !=
pTable.end() && new_it ==
pTable.end());
88 pTable.emplace(new_vaddr, old_it->second);
100 addr_maps->push_back(std::make_pair(iter.first, iter.second.paddr));
112 assert(it !=
pTable.end());
139 return &(iter->second);
159 assert(
pageAlign(req->getVaddr() + req->getSize() - 1) ==
163 req->setPaddr(paddr);
165 panic(
"Request spans page boundaries!\n");
177 if (next == range.
vaddr)
191 PTable::size_type
count = 0;
192 for (
auto &pte :
pTable) {
196 paramOut(cp,
"paddr", pte.second.paddr);
197 paramOut(cp,
"flags", pte.second.flags);
226 std::stringstream
ss;
227 for (PTable::const_iterator it=
pTable.begin(); it !=
pTable.end(); ++it) {
228 ss << std::hex << it->first <<
":" << it->second.paddr <<
";";
void translate(Range &range) const override
Subclasses implement this function to complete TranslationGen.
virtual void map(Addr vaddr, Addr paddr, int64_t size, uint64_t flags=0)
Maps a virtual memory region to a physical memory region.
const Entry * lookup(Addr vaddr)
Lookup function.
virtual void remap(Addr vaddr, int64_t size, Addr new_vaddr)
void serialize(CheckpointOut &cp) const override
Serialize an object.
bool translate(Addr vaddr, Addr &paddr)
Translate function.
PTable::iterator PTableItr
virtual void unmap(Addr vaddr, int64_t size)
const std::string externalize() const
Dump all items in the pTable, to a concatenation of strings of the form Addr:Entry;.
virtual bool isUnmapped(Addr vaddr, int64_t size)
Check if any pages in a region are already allocated.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void getMappings(std::vector< std::pair< Addr, Addr > > *addr_mappings)
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.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
std::shared_ptr< Request > RequestPtr
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
std::string csprintf(const char *format, const Args &...args)
constexpr decltype(nullptr) NoFault
Declarations of a non-full system Page Table.
#define UNSERIALIZE_SCALAR(scalar)
This structure represents a single, contiguous translation, or carries information about whatever fau...