X86: In non 64bit mode, throw a fault when a NULL segment is accessed.
This commit is contained in:
parent
a8384311d5
commit
b05299253f
1 changed files with 3 additions and 0 deletions
|
@ -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 we're not in 64-bit mode, do protection/limit checks
|
||||||
if (!efer.lma || !csAttr.longMode) {
|
if (!efer.lma || !csAttr.longMode) {
|
||||||
DPRINTF(TLB, "Not in long mode. Checking segment protection.\n");
|
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));
|
SegAttr attr = tc->readMiscRegNoEffect(MISCREG_SEG_ATTR(seg));
|
||||||
if (!attr.writable && write)
|
if (!attr.writable && write)
|
||||||
return new GeneralProtection(0);
|
return new GeneralProtection(0);
|
||||||
|
|
Loading…
Reference in a new issue