X86: Add a check to chks which raises #GP(selector) if selector is NULL or not in the GDT.

This commit is contained in:
Gabe Black 2009-02-25 10:16:54 -08:00
parent 82288e7c3e
commit 7b1cb74ac3
2 changed files with 9 additions and 2 deletions

View file

@ -86,7 +86,8 @@ let {{
# Add in symbols for the various checks of segment selectors.
for check in ("NoCheck", "CSCheck", "CallGateCheck", "IntGateCheck",
"SoftIntGateCheck", "SSCheck", "IretCheck", "IntCSCheck"):
"SoftIntGateCheck", "SSCheck", "IretCheck", "IntCSCheck",
"TRCheck"):
assembler.symbols[check] = "Seg%s" % check
for reg in ("TR", "IDTR"):

View file

@ -234,7 +234,8 @@ output header {{
enum SegmentSelectorCheck {
SegNoCheck, SegCSCheck, SegCallGateCheck, SegIntGateCheck,
SegSoftIntGateCheck, SegSSCheck, SegIretCheck, SegIntCSCheck
SegSoftIntGateCheck, SegSSCheck, SegIretCheck, SegIntCSCheck,
SegTRCheck
};
enum LongModeDescriptorType {
@ -1118,6 +1119,11 @@ let {{
"in legacy mode.\\n");
}
break;
case SegTRCheck:
if (!selector.si || selector.ti) {
fault = new GeneralProtection(selector);
}
break;
default:
panic("Undefined segment check type.\\n");
}