ARM TLB: Fix bug in memAttrs getting a bogus thread context

This commit is contained in:
Ali Saidi 2010-06-02 12:58:18 -05:00
parent 6b00c7fa22
commit 2bad5138e4
3 changed files with 7 additions and 5 deletions

View file

@ -150,8 +150,9 @@ TableWalker::walk(RequestPtr _req, ThreadContext *_tc, uint8_t _cid, TLB::Mode _
} }
void void
TableWalker::memAttrs(TlbEntry &te, uint8_t texcb, bool s) TableWalker::memAttrs(ThreadContext *tc, TlbEntry &te, uint8_t texcb, bool s)
{ {
// Note: tc local variable is hiding tc class variable
DPRINTF(TLBVerbose, "memAttrs texcb:%d s:%d\n", texcb, s); DPRINTF(TLBVerbose, "memAttrs texcb:%d s:%d\n", texcb, s);
te.shareable = false; // default value te.shareable = false; // default value
bool outer_shareable = false; bool outer_shareable = false;
@ -221,6 +222,7 @@ TableWalker::memAttrs(TlbEntry &te, uint8_t texcb, bool s)
panic("More than 32 states for 5 bits?\n"); panic("More than 32 states for 5 bits?\n");
} }
} else { } else {
assert(tc);
PRRR prrr = tc->readMiscReg(MISCREG_PRRR); PRRR prrr = tc->readMiscReg(MISCREG_PRRR);
NMRR nmrr = tc->readMiscReg(MISCREG_NMRR); NMRR nmrr = tc->readMiscReg(MISCREG_NMRR);
DPRINTF(TLBVerbose, "memAttrs PRRR:%08x NMRR:%08x\n", prrr, nmrr); DPRINTF(TLBVerbose, "memAttrs PRRR:%08x NMRR:%08x\n", prrr, nmrr);
@ -415,7 +417,7 @@ TableWalker::doL1Descriptor()
te.ap = l1Desc.ap(); te.ap = l1Desc.ap();
te.domain = l1Desc.domain(); te.domain = l1Desc.domain();
te.asid = contextId; te.asid = contextId;
memAttrs(te, l1Desc.texcb(), l1Desc.shareable()); memAttrs(tc, te, l1Desc.texcb(), l1Desc.shareable());
DPRINTF(TLB, "Inserting Section Descriptor into TLB\n"); DPRINTF(TLB, "Inserting Section Descriptor into TLB\n");
DPRINTF(TLB, " - N%d pfn:%#x size: %#x global:%d valid: %d\n", DPRINTF(TLB, " - N%d pfn:%#x size: %#x global:%d valid: %d\n",
@ -510,7 +512,7 @@ TableWalker::doL2Descriptor()
te.xn = l2Desc.xn(); te.xn = l2Desc.xn();
te.ap = l2Desc.ap(); te.ap = l2Desc.ap();
te.domain = l1Desc.domain(); te.domain = l1Desc.domain();
memAttrs(te, l2Desc.texcb(), l2Desc.shareable()); memAttrs(tc, te, l2Desc.texcb(), l2Desc.shareable());
if (!delayed) { if (!delayed) {
tc = NULL; tc = NULL;

View file

@ -313,7 +313,7 @@ class TableWalker : public MemObject
TLB::Translation *_trans, bool timing); TLB::Translation *_trans, bool timing);
void setTlb(TLB *_tlb) { tlb = _tlb; } void setTlb(TLB *_tlb) { tlb = _tlb; }
void memAttrs(TlbEntry &te, uint8_t texcb, bool s); void memAttrs(ThreadContext *tc, TlbEntry &te, uint8_t texcb, bool s);
private: private:

View file

@ -387,7 +387,7 @@ TLB::translateFs(RequestPtr req, ThreadContext *tc, Mode mode,
// Set memory attributes // Set memory attributes
TlbEntry temp_te; TlbEntry temp_te;
tableWalker->memAttrs(temp_te, 0, 1); tableWalker->memAttrs(tc, temp_te, 0, 1);
temp_te.shareable = true; temp_te.shareable = true;
DPRINTF(TLBVerbose, "(No MMU) setting memory attributes: shareable:\ DPRINTF(TLBVerbose, "(No MMU) setting memory attributes: shareable:\
%d, innerAttrs: %d, outerAttrs: %d\n", temp_te.shareable, %d, innerAttrs: %d, outerAttrs: %d\n", temp_te.shareable,