summaryrefslogtreecommitdiff
path: root/src/arch/x86/pagetable_walker.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2012-04-14 23:24:18 -0700
committerGabe Black <gblack@eecs.umich.edu>2012-04-14 23:24:18 -0700
commitaacb676220ac1e6049304bef31a39090487da71e (patch)
tree3a5b4c951e6be13b59b2a0574e8b31032911acf8 /src/arch/x86/pagetable_walker.cc
parentd6031d72df091a71567a7f43649d62b24c80f496 (diff)
downloadgem5-aacb676220ac1e6049304bef31a39090487da71e.tar.xz
X86: Use the AddrTrie class to implement the TLB.
This change also adjusts the TlbEntry class so that it stores the number of address bits wide a page is rather than its size in bytes. In other words, instead of storing 4K for a 4K page, it stores 12. 12 is easy to turn into 4K, but it's a little harder going the other way.
Diffstat (limited to 'src/arch/x86/pagetable_walker.cc')
-rw-r--r--src/arch/x86/pagetable_walker.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/arch/x86/pagetable_walker.cc b/src/arch/x86/pagetable_walker.cc
index 9e1d08c7b..960954f15 100644
--- a/src/arch/x86/pagetable_walker.cc
+++ b/src/arch/x86/pagetable_walker.cc
@@ -54,12 +54,12 @@
#include "arch/x86/tlb.hh"
#include "arch/x86/vtophys.hh"
#include "base/bitfield.hh"
+#include "base/trie.hh"
#include "cpu/base.hh"
#include "cpu/thread_context.hh"
#include "debug/PageTableWalker.hh"
#include "mem/packet_access.hh"
#include "mem/request.hh"
-#include "sim/system.hh"
namespace X86ISA {
@@ -106,11 +106,11 @@ Walker::start(ThreadContext * _tc, BaseTLB::Translation *_translation,
}
Fault
-Walker::startFunctional(ThreadContext * _tc, Addr &addr, Addr &pageSize,
+Walker::startFunctional(ThreadContext * _tc, Addr &addr, unsigned &logBytes,
BaseTLB::Mode _mode)
{
funcState.initState(_tc, _mode);
- return funcState.startFunctional(addr, pageSize);
+ return funcState.startFunctional(addr, logBytes);
}
bool
@@ -224,7 +224,7 @@ Walker::WalkerState::startWalk()
}
Fault
-Walker::WalkerState::startFunctional(Addr &addr, Addr &pageSize)
+Walker::WalkerState::startFunctional(Addr &addr, unsigned &logBytes)
{
Fault fault = NoFault;
assert(started == false);
@@ -241,7 +241,7 @@ Walker::WalkerState::startFunctional(Addr &addr, Addr &pageSize)
state = nextState;
nextState = Ready;
} while(read);
- pageSize = entry.size;
+ logBytes = entry.logBytes;
addr = entry.paddr;
return fault;
@@ -311,14 +311,14 @@ Walker::WalkerState::stepWalk(PacketPtr &write)
}
if (!pte.ps) {
// 4 KB page
- entry.size = 4 * (1 << 10);
+ entry.logBytes = 12;
nextRead =
((uint64_t)pte & (mask(40) << 12)) + vaddr.longl1 * dataSize;
nextState = LongPTE;
break;
} else {
// 2 MB page
- entry.size = 2 * (1 << 20);
+ entry.logBytes = 21;
entry.paddr = (uint64_t)pte & (mask(31) << 21);
entry.uncacheable = uncacheable;
entry.global = pte.g;
@@ -373,13 +373,13 @@ Walker::WalkerState::stepWalk(PacketPtr &write)
}
if (!pte.ps) {
// 4 KB page
- entry.size = 4 * (1 << 10);
+ entry.logBytes = 12;
nextRead = ((uint64_t)pte & (mask(40) << 12)) + vaddr.pael1 * dataSize;
nextState = PAEPTE;
break;
} else {
// 2 MB page
- entry.size = 2 * (1 << 20);
+ entry.logBytes = 21;
entry.paddr = (uint64_t)pte & (mask(31) << 21);
entry.uncacheable = uncacheable;
entry.global = pte.g;
@@ -423,14 +423,14 @@ Walker::WalkerState::stepWalk(PacketPtr &write)
}
if (!pte.ps) {
// 4 KB page
- entry.size = 4 * (1 << 10);
+ entry.logBytes = 12;
nextRead =
((uint64_t)pte & (mask(20) << 12)) + vaddr.norml2 * dataSize;
nextState = PTE;
break;
} else {
// 4 MB page
- entry.size = 4 * (1 << 20);
+ entry.logBytes = 21;
entry.paddr = bits(pte, 20, 13) << 32 | bits(pte, 31, 22) << 22;
entry.uncacheable = uncacheable;
entry.global = pte.g;
@@ -453,7 +453,7 @@ Walker::WalkerState::stepWalk(PacketPtr &write)
break;
}
// 4 KB page
- entry.size = 4 * (1 << 10);
+ entry.logBytes = 12;
nextRead = ((uint64_t)pte & (mask(20) << 12)) + vaddr.norml2 * dataSize;
nextState = PTE;
break;