62#include "debug/PageTableWalker.hh"
107 return walker->recvTimingResp(pkt);
116 bool walkComplete = senderWalk->
recvPacket(pkt);
122 if (walkerState == senderWalk) {
151 walkerState->
retry();
160 if (
port.sendTimingReq(pkt)) {
175 if (if_name ==
"port")
195 unsigned num_squashed = 0;
202 DPRINTF(PageTableWalker,
"Squashing table walk for address %#x\n",
203 currState->
req->getVaddr());
207 std::make_shared<UnimpFault>(
"Squashed Inst"),
208 currState->
req, currState->
tc, currState->
mode);
250 walker->port.sendAtomic(write);
283 logBytes =
entry.logBytes;
297 pte =
read->getLE<uint64_t>();
299 pte =
read->getLE<uint32_t>();
301 bool uncacheable = pte.pcd;
303 bool doWrite =
false;
304 bool doTLBInsert =
false;
305 bool doEndWalk =
false;
309 DPRINTF(PageTableWalker,
"Got long mode PML4 entry %#016x.\n", pte);
313 entry.writable = pte.w;
315 if (badNX || !pte.p) {
320 entry.noExec = pte.nx;
324 DPRINTF(PageTableWalker,
"Got long mode PDP entry %#016x.\n", pte);
330 if (badNX || !pte.p) {
338 DPRINTF(PageTableWalker,
"Got long mode PD entry %#016x.\n", pte);
343 if (badNX || !pte.p) {
358 entry.uncacheable = uncacheable;
359 entry.global = pte.g;
367 DPRINTF(PageTableWalker,
"Got long mode PTE entry %#016x.\n", pte);
372 if (badNX || !pte.p) {
378 entry.uncacheable = uncacheable;
379 entry.global = pte.g;
387 "Got legacy mode PAE PDP entry %#08x.\n", pte);
397 DPRINTF(PageTableWalker,
"Got legacy mode PAE PD entry %#08x.\n", pte);
400 entry.writable = pte.w;
402 if (badNX || !pte.p) {
417 entry.uncacheable = uncacheable;
418 entry.global = pte.g;
427 "Got legacy mode PAE PTE entry %#08x.\n", pte);
432 if (badNX || !pte.p) {
438 entry.uncacheable = uncacheable;
439 entry.global = pte.g;
446 DPRINTF(PageTableWalker,
"Got legacy mode PSE PD entry %#08x.\n", pte);
449 entry.writable = pte.w;
466 entry.uncacheable = uncacheable;
467 entry.global = pte.g;
475 DPRINTF(PageTableWalker,
"Got legacy mode PD entry %#08x.\n", pte);
478 entry.writable = pte.w;
491 DPRINTF(PageTableWalker,
"Got legacy mode PTE entry %#08x.\n", pte);
494 entry.writable = pte.w;
502 entry.uncacheable = uncacheable;
503 entry.global = pte.g;
510 panic(
"Unknown page table walker state %d!\n");
536 RequestPtr request = std::make_shared<Request>(
545 write->
setLE<uint64_t>(pte);
547 write->
setLE<uint32_t>(pte);
578 topAddr = (cr3.longPdtb << 12) +
addr.longl4 *
dataSize;
608 if (!cr4.pcide && cr3.pcd)
611 RequestPtr request = std::make_shared<Request>(
662 bool delayedResponse;
664 delayedResponse,
true);
665 assert(!delayedResponse);
690 if (!
walker->sendTiming(
this, pkt)) {
702 if (!
walker->sendTiming(
this, write)) {
751 DPRINTF(PageTableWalker,
"Raising page fault.\n");
756 m5reg.cpl == 3,
false);
virtual bool squashed() const
This function is used by the page table walker to determine if it should translate the a pending requ...
virtual void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode)=0
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void setLE(T v)
Set the value in the data pointer to v as little endian.
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
RequestPtr req
A pointer to the original request.
MemCmd cmd
The command field of the packet.
Ports are used to interface objects to each other.
@ PHYSICAL
The virtual address is also the physical address.
@ UNCACHEABLE
The request is to an uncacheable address.
gem5::Flags< FlagsType > Flags
ThreadContext is the external interface to all thread state for anything outside of the CPU.
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
void initState(ThreadContext *_tc, BaseMMU::Mode _mode, bool _isTiming=false)
void setupWalk(Addr vaddr)
Fault stepWalk(PacketPtr &write)
Fault startFunctional(Addr &addr, unsigned &logBytes)
Fault pageFault(bool present)
std::vector< PacketPtr > writes
unsigned numInflight() const
bool recvPacket(PacketPtr pkt)
BaseMMU::Translation * translation
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
bool recvTimingResp(PacketPtr pkt)
bool sendTiming(WalkerState *sendingState, PacketPtr pkt)
Fault start(ThreadContext *_tc, BaseMMU::Translation *translation, const RequestPtr &req, BaseMMU::Mode mode)
EventFunctionWrapper startWalkWrapperEvent
Event used to call startWalkWrapper.
std::list< WalkerState * > currStates
Fault startFunctional(ThreadContext *_tc, Addr &addr, unsigned &logBytes, BaseMMU::Mode mode)
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
constexpr T mbits(T val, unsigned first, unsigned last)
Mask off the given bits in place like bits() but without shifting.
void schedule(Event &event, Tick when)
void set(Type mask)
Set all flag's bits matching the given mask.
#define panic(...)
This implements a cprintf based panic() function.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
This is exposed globally, independent of the ISA.
Copyright (c) 2024 Arm Limited All rights reserved.
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.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
constexpr decltype(nullptr) NoFault
Declaration of a request, the overall memory request consisting of the parts of the request that are ...