summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/x86/tlb.cc10
1 files 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, "