X86: Distinguish between hardware and software interrupts/exceptions

This commit is contained in:
Gabe Black 2009-02-01 17:07:18 -08:00
parent 041402a949
commit 9b4d1e0f9a
2 changed files with 5 additions and 3 deletions

View file

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

View file

@ -234,7 +234,7 @@ output header {{
enum SegmentSelectorCheck { enum SegmentSelectorCheck {
SegNoCheck, SegCSCheck, SegCallGateCheck, SegIntGateCheck, SegNoCheck, SegCSCheck, SegCallGateCheck, SegIntGateCheck,
SegSSCheck, SegIretCheck, SegIntCSCheck SegSoftIntGateCheck, SegSSCheck, SegIretCheck, SegIntCSCheck
}; };
enum LongModeDescriptorType { enum LongModeDescriptorType {
@ -1066,11 +1066,13 @@ let {{
panic("CS checks for far calls/jumps through call gates" panic("CS checks for far calls/jumps through call gates"
"not implemented.\\n"); "not implemented.\\n");
break; break;
case SegIntGateCheck: case SegSoftIntGateCheck:
// Check permissions. // Check permissions.
if (desc.dpl < m5reg.cpl) { if (desc.dpl < m5reg.cpl) {
fault = new GeneralProtection((uint16_t)selector); fault = new GeneralProtection((uint16_t)selector);
} }
// Fall through on purpose
case SegIntGateCheck:
// Make sure the gate's the right type. // Make sure the gate's the right type.
if (m5reg.mode == LongMode && ((desc.type & 0xe) != 0xe) || if (m5reg.mode == LongMode && ((desc.type & 0xe) != 0xe) ||
((desc.type & 0x6) != 0x6)) { ((desc.type & 0x6) != 0x6)) {