34#ifndef __MEM_MULTI_LEVEL_PAGE_TABLE_HH__
35#define __MEM_MULTI_LEVEL_PAGE_TABLE_HH__
40#include "debug/MMU.hh"
106template <
class First,
class ...Rest>
110 auto *se_workload =
dynamic_cast<SEWorkload *
>(
system->workload);
111 fatal_if(!se_workload,
"Couldn't find an appropriate workload object.");
112 Addr addr = se_workload->allocPhysPages(First::tableSize());
113 PortProxy &
p =
system->physProxy;
114 p.memsetBlob(
addr, 0, First::tableSize() * pageSize);
118template <
class ...Types>
121template <
class First,
class Second,
class ...Rest>
122struct LastType<First, Second, Rest...>
124 typedef typename LastType<Second, Rest...>
::type type;
134template <
class ...Types>
137template <
class Final,
class Only>
138struct WalkWrapper<Final, Only>
142 bool allocate, Final *entry)
148template <
class Final,
class First,
class Second,
class ...Rest>
149struct WalkWrapper<Final, First, Second, Rest...>
153 bool allocate, Final *entry)
159 if (!first.present()) {
161 "Page fault while walking the page table.");
162 next = prepTopTable<Second>(
system, pageSize);
164 first.write(
system->physProxy);
166 next = first.paddr();
168 WalkWrapper<Final, Second, Rest...>::walk(
173template <
class ...EntryTypes>
176 bool allocate,
typename LastType<EntryTypes...>::type *entry)
178 WalkWrapper<
typename LastType<EntryTypes...>
::type, EntryTypes...>::walk(
185template <
class ...EntryTypes>
244 Final old_entry, new_entry;
250 old_entry.present(
false);
255 new_vaddr +
offset,
true, &new_entry);
256 new_entry.reset(old_entry.paddr(),
true, old_entry.uncacheable(),
257 old_entry.readonly());
273 "PageTable::unmap: Address %#x not mapped.",
vaddr);
274 entry.present(
false);
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
virtual void map(Addr vaddr, Addr paddr, int64_t size, uint64_t flags=0)
Maps a virtual memory region to a physical memory region.
virtual void remap(Addr vaddr, int64_t size, Addr new_vaddr)
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual void unmap(Addr vaddr, int64_t size)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Addr _basePtr
Physical address to the last level of the page table.
void serialize(CheckpointOut &cp) const override
Serialize an object.
MultiLevelPageTable(const std::string &__name, uint64_t _pid, System *_sys, Addr _pageSize)
LastType< EntryTypes... >::type Final
void unmap(Addr vaddr, int64_t size) override
void remap(Addr vaddr, int64_t size, Addr new_vaddr) override
void initState() override
void map(Addr vaddr, Addr paddr, int64_t size, uint64_t flags=0) override
Maps a virtual memory region to a physical memory region.
System * system
Pointer to System object.
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
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)
Declarations of a non-full system Page Table.