summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2008-06-12 00:51:50 -0400
committerGabe Black <gblack@eecs.umich.edu>2008-06-12 00:51:50 -0400
commitb05299253fdd5a8a913f2799b7cdd2df040c8559 (patch)
tree47a0c9751462537e2d74d7855542e419f7ab43f3 /src/arch/x86
parenta8384311d544391b03ff55f9384fdf8da2fa8bf6 (diff)
downloadgem5-b05299253fdd5a8a913f2799b7cdd2df040c8559.tar.xz
X86: In non 64bit mode, throw a fault when a NULL segment is accessed.
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/tlb.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc
index f5e214a88..5d101a5ae 100644
--- a/src/arch/x86/tlb.cc
+++ b/src/arch/x86/tlb.cc
@@ -571,6 +571,9 @@ TLB::translate(RequestPtr &req, ThreadContext *tc, bool write, bool execute)
// If we're not in 64-bit mode, do protection/limit checks
if (!efer.lma || !csAttr.longMode) {
DPRINTF(TLB, "Not in long mode. Checking segment protection.\n");
+ // Check for a NULL segment selector.
+ if (!tc->readMiscRegNoEffect(MISCREG_SEG_SEL(seg)))
+ return new GeneralProtection(0);
SegAttr attr = tc->readMiscRegNoEffect(MISCREG_SEG_ATTR(seg));
if (!attr.writable && write)
return new GeneralProtection(0);