From 6910baa0155a606c178ae0cd5e07bde150d7593e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 19 Apr 2009 04:57:51 -0700 Subject: [PATCH] X86: Fix how the TLB handles the storecheck flag. --- src/arch/x86/tlb.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc index 330a8682b..9b4a397ee 100644 --- a/src/arch/x86/tlb.cc +++ b/src/arch/x86/tlb.cc @@ -197,9 +197,6 @@ TLB::translate(RequestPtr req, ThreadContext *tc, Translation *translation, int seg = flags & SegmentFlagMask; - //XXX Junk code to surpress the warning - if (storeCheck); - // If this is true, we're dealing with a request to read an internal // value. if (seg == SEGMENT_REG_MS) { @@ -579,7 +576,7 @@ TLB::translate(RequestPtr req, ThreadContext *tc, Translation *translation, bool expandDown = false; SegAttr attr = tc->readMiscRegNoEffect(MISCREG_SEG_ATTR(seg)); if (seg >= SEGMENT_REG_ES && seg <= SEGMENT_REG_HS) { - if (!attr.writable && mode == Write) + if (!attr.writable && (mode == Write || storeCheck)) return new GeneralProtection(0); if (!attr.readable && mode == Read) return new GeneralProtection(0); @@ -655,6 +652,11 @@ TLB::translate(RequestPtr req, ThreadContext *tc, Translation *translation, // fine even though we're not checking them. return new PageFault(vaddr, true, mode, inUser, false); } + if (storeCheck && !entry->writable) { + // This would fault if this were a write, so return a page + // fault that reflects that happening. + return new PageFault(vaddr, true, Write, inUser, false); + } DPRINTF(TLB, "Entry found with paddr %#x, " -- 2.30.2