X86: Implement tlb invalidation and make it happen some of the times it should.
--HG-- extra : convert_revision : 376516d33cd539fa526c834ef2b2c33069af3040
This commit is contained in:
parent
f1f5dd79bf
commit
4950798268
3 changed files with 39 additions and 6 deletions
|
@ -86,6 +86,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "arch/x86/miscregfile.hh"
|
#include "arch/x86/miscregfile.hh"
|
||||||
|
#include "arch/x86/tlb.hh"
|
||||||
|
#include "cpu/thread_context.hh"
|
||||||
#include "sim/serialize.hh"
|
#include "sim/serialize.hh"
|
||||||
|
|
||||||
using namespace X86ISA;
|
using namespace X86ISA;
|
||||||
|
@ -158,6 +160,10 @@ void MiscRegFile::setReg(int miscReg,
|
||||||
regVal[MISCREG_EFER] = efer;
|
regVal[MISCREG_EFER] = efer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (toggled.pg) {
|
||||||
|
tc->getITBPtr()->invalidateAll();
|
||||||
|
tc->getDTBPtr()->invalidateAll();
|
||||||
|
}
|
||||||
//This must always be 1.
|
//This must always be 1.
|
||||||
newCR0.et = 1;
|
newCR0.et = 1;
|
||||||
newVal = newCR0;
|
newVal = newCR0;
|
||||||
|
@ -166,8 +172,17 @@ void MiscRegFile::setReg(int miscReg,
|
||||||
case MISCREG_CR2:
|
case MISCREG_CR2:
|
||||||
break;
|
break;
|
||||||
case MISCREG_CR3:
|
case MISCREG_CR3:
|
||||||
|
tc->getITBPtr()->invalidateNonGlobal();
|
||||||
|
tc->getDTBPtr()->invalidateNonGlobal();
|
||||||
break;
|
break;
|
||||||
case MISCREG_CR4:
|
case MISCREG_CR4:
|
||||||
|
{
|
||||||
|
CR4 toggled = regVal[miscReg] ^ val;
|
||||||
|
if (toggled.pae || toggled.pse || toggled.pge) {
|
||||||
|
tc->getITBPtr()->invalidateAll();
|
||||||
|
tc->getDTBPtr()->invalidateAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MISCREG_CR8:
|
case MISCREG_CR8:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -380,6 +380,7 @@ TLB::Walker::start(ThreadContext * _tc, Addr vaddr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nextState = Ready;
|
nextState = Ready;
|
||||||
entry.vaddr = vaddr;
|
entry.vaddr = vaddr;
|
||||||
|
|
||||||
|
@ -595,11 +596,27 @@ TLB::lookup(Addr va, bool update_lru)
|
||||||
void
|
void
|
||||||
TLB::invalidateAll()
|
TLB::invalidateAll()
|
||||||
{
|
{
|
||||||
|
DPRINTF(TLB, "Invalidating all entries.\n");
|
||||||
|
while (!entryList.empty()) {
|
||||||
|
TlbEntry *entry = entryList.front();
|
||||||
|
entryList.pop_front();
|
||||||
|
freeList.push_back(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TLB::invalidateNonGlobal()
|
TLB::invalidateNonGlobal()
|
||||||
{
|
{
|
||||||
|
DPRINTF(TLB, "Invalidating all non global entries.\n");
|
||||||
|
EntryList::iterator entryIt;
|
||||||
|
for (entryIt = entryList.begin(); entryIt != entryList.end();) {
|
||||||
|
if (!(*entryIt)->global) {
|
||||||
|
freeList.push_back(*entryIt);
|
||||||
|
entryList.erase(entryIt++);
|
||||||
|
} else {
|
||||||
|
entryIt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -215,6 +215,13 @@ namespace X86ISA
|
||||||
|
|
||||||
Port *getPort(const std::string &if_name, int idx = -1);
|
Port *getPort(const std::string &if_name, int idx = -1);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void invalidateAll();
|
||||||
|
|
||||||
|
void invalidateNonGlobal();
|
||||||
|
|
||||||
|
void demapPage(Addr va);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
|
@ -226,12 +233,6 @@ namespace X86ISA
|
||||||
|
|
||||||
void insert(Addr vpn, TlbEntry &entry);
|
void insert(Addr vpn, TlbEntry &entry);
|
||||||
|
|
||||||
void invalidateAll();
|
|
||||||
|
|
||||||
void invalidateNonGlobal();
|
|
||||||
|
|
||||||
void demapPage(Addr va);
|
|
||||||
|
|
||||||
template<class TlbFault>
|
template<class TlbFault>
|
||||||
Fault translate(RequestPtr &req, ThreadContext *tc,
|
Fault translate(RequestPtr &req, ThreadContext *tc,
|
||||||
bool write, bool execute);
|
bool write, bool execute);
|
||||||
|
|
Loading…
Reference in a new issue