VirtualBox

Changeset 47205 in vbox


Ignore:
Timestamp:
Jul 16, 2013 5:54:56 PM (12 years ago)
Author:
vboxsync
Message:

IEM: Got further in the long mode interrupt dispatching code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r47173 r47205  
    21842184        return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL);
    21852185    }
    2186     /** @todo is the RPL of the interrupt/trap gate descriptor checked? */
     2186
     2187    /* Make sure the selector is present. */
     2188    if (!DescCS.Legacy.Gen.u1Present)
     2189    {
     2190        Log(("RaiseXcptOrIntInProtMode %#x - CS=%#x - segment not present -> #NP\n", u8Vector, NewCS));
     2191        return iemRaiseSelectorNotPresentBySelector(pIemCpu, NewCS);
     2192    }
    21872193
    21882194    /* Check the new EIP against the new CS limit. */
     
    21972203             u8Vector, NewCS, DescCS.Legacy.Gen.u2Dpl, pIemCpu->uCpl));
    21982204        return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL);
    2199     }
    2200 
    2201     /* Make sure the selector is present. */
    2202     if (!DescCS.Legacy.Gen.u1Present)
    2203     {
    2204         Log(("RaiseXcptOrIntInProtMode %#x - CS=%#x - segment not present -> #NP\n", u8Vector, NewCS));
    2205         return iemRaiseSelectorNotPresentBySelector(pIemCpu, NewCS);
    22062205    }
    22072206
     
    24092408{
    24102409    NOREF(cbInstr);
    2411 #if 0
     2410
    24122411    /*
    24132412     * Read the IDT entry.
     
    24502449            Log(("iemRaiseXcptOrIntInLongMode %#x - invalid type (%#x) -> #GP\n", u8Vector, Idte.Gate.u4Type));
    24512450            return iemRaiseGeneralProtectionFault(pIemCpu, X86_TRAP_ERR_IDT | ((uint16_t)u8Vector << X86_TRAP_ERR_SEL_SHIFT));
    2452 
    2453         IEM_NOT_REACHED_DEFAULT_CASE_RET();
    24542451    }
    24552452
     
    24942491        return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL);
    24952492    }
    2496     /** @todo what do we check here?  */
    2497     if (!DescCS.Long.Gen.u1Long || DescCS.Long.Gen.u1DefBig)
    2498     {
    2499         Log(("iemRaiseXcptOrIntInLongMode %#x - CS=%#x -  (%#x) -> #GP\n", u8Vector, NewCS, DescCS.Legacy.Gen.u4Type));
     2493    if (   !DescCS.Long.Gen.u1Long
     2494        || DescCS.Long.Gen.u1DefBig
     2495        || (DescCS.Long.Gen.u4Type & X86_SEL_TYPE_CODE) )
     2496    {
     2497        Log(("iemRaiseXcptOrIntInLongMode %#x - CS=%#x - not 64-bit code selector (%#x, L=%u, D=%u) -> #GP\n",
     2498             u8Vector, NewCS, DescCS.Legacy.Gen.u4Type, DescCS.Long.Gen.u1Long, DescCS.Long.Gen.u1DefBig));
    25002499        return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL);
    25012500    }
     
    25122511        return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL);
    25132512    }
    2514     /** @todo is the RPL of the interrupt/trap gate descriptor checked? */
    2515 
    2516     /* Check the new EIP against the new CS limit. */
    2517     uint32_t const uNewEip =    Idte.Gate.u4Type == X86_SEL_TYPE_SYS_286_INT_GATE
    2518                              || Idte.Gate.u4Type == X86_SEL_TYPE_SYS_286_TRAP_GATE
    2519                            ? Idte.Gate.u16OffsetLow
    2520                            : Idte.Gate.u16OffsetLow | ((uint32_t)Idte.Gate.u16OffsetHigh << 16);
    2521     uint32_t cbLimitCS = X86DESC_LIMIT_G(&DescCS.Legacy);
    2522     if (uNewEip > cbLimitCS)
    2523     {
    2524         Log(("iemRaiseXcptOrIntInLongMode %#x - CS=%#x - DPL (%d) > CPL (%d) -> #GP\n",
    2525              u8Vector, NewCS, DescCS.Legacy.Gen.u2Dpl, pIemCpu->uCpl));
    2526         return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL);
    2527     }
    25282513
    25292514    /* Make sure the selector is present. */
     
    25342519    }
    25352520
     2521    /* Check that the new RIP is canonical. */
     2522    uint64_t const uNewRip = Idte.Gate.u16OffsetLow
     2523                           | ((uint32_t)Idte.Gate.u16OffsetHigh << 16)
     2524                           | ((uint64_t)Idte.Gate.u32OffsetTop  << 32);
     2525    if (IEM_IS_CANONICAL(uNewRip))
     2526    {
     2527        Log(("iemRaiseXcptOrIntInLongMode %#x - RIP=%#x - Not canonical -> #GP(0)\n", u8Vector, uNewRip));
     2528        return iemRaiseGeneralProtectionFault0(pIemCpu);
     2529    }
     2530
     2531#if 0
    25362532    /*
    25372533     * If the privilege level changes, we need to get a new stack from the TSS.
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette