X86: Add a check type for interrupt gates.
authorGabe Black <gblack@eecs.umich.edu>
Mon, 13 Oct 2008 03:33:37 +0000 (20:33 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Mon, 13 Oct 2008 03:33:37 +0000 (20:33 -0700)
src/arch/x86/isa/microasm.isa
src/arch/x86/isa/microops/regop.isa

index 75e1dc52436595fb72a5eb59150efd3975ddf1ed..29ec6dc9462816f2b834149fc0eded461fabe32b 100644 (file)
@@ -85,7 +85,7 @@ let {{
         assembler.symbols["%ss" % letter.lower()] = "SEGMENT_REG_%sS" % letter
 
     # Add in symbols for the various checks of segment selectors.
-    for check in ("NoCheck", "CSCheck", "CallGateCheck",
+    for check in ("NoCheck", "CSCheck", "CallGateCheck", "IntGateCheck",
                   "SSCheck", "IretCheck", "IntCSCheck"):
         assembler.symbols[check] = "Seg%s" % check
 
index b7883b2e2a3f6f9f5f96bd153ebda07f23ffb5a0..0d019729f1734b0779207d123593978d06ef0415 100644 (file)
@@ -233,7 +233,7 @@ output header {{
             uint64_t &quotient, uint64_t &remainder);
 
     enum SegmentSelectorCheck {
-      SegNoCheck, SegCSCheck, SegCallGateCheck,
+      SegNoCheck, SegCSCheck, SegCallGateCheck, SegIntGateCheck,
       SegSSCheck, SegIretCheck, SegIntCSCheck
     };
 }};
@@ -1041,6 +1041,11 @@ let {{
                 panic("CS checks for far calls/jumps through call gates"
                         "not implemented.\\n");
                 break;
+              case SegIntGateCheck:
+                if (desc.dpl < m5reg.cpl) {
+                    return new GeneralProtection((uint16_t)selector);
+                }
+                break;
               case SegSSCheck:
                 if (selector.si || selector.ti) {
                     if (!desc.p) {