Changeset 47205 in vbox
- Timestamp:
- Jul 16, 2013 5:54:56 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r47173 r47205 2184 2184 return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL); 2185 2185 } 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 } 2187 2193 2188 2194 /* Check the new EIP against the new CS limit. */ … … 2197 2203 u8Vector, NewCS, DescCS.Legacy.Gen.u2Dpl, pIemCpu->uCpl)); 2198 2204 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);2206 2205 } 2207 2206 … … 2409 2408 { 2410 2409 NOREF(cbInstr); 2411 #if 0 2410 2412 2411 /* 2413 2412 * Read the IDT entry. … … 2450 2449 Log(("iemRaiseXcptOrIntInLongMode %#x - invalid type (%#x) -> #GP\n", u8Vector, Idte.Gate.u4Type)); 2451 2450 return iemRaiseGeneralProtectionFault(pIemCpu, X86_TRAP_ERR_IDT | ((uint16_t)u8Vector << X86_TRAP_ERR_SEL_SHIFT)); 2452 2453 IEM_NOT_REACHED_DEFAULT_CASE_RET();2454 2451 } 2455 2452 … … 2494 2491 return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL); 2495 2492 } 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)); 2500 2499 return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL); 2501 2500 } … … 2512 2511 return iemRaiseGeneralProtectionFault(pIemCpu, NewCS & X86_SEL_MASK_OFF_RPL); 2513 2512 } 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_GATE2518 || Idte.Gate.u4Type == X86_SEL_TYPE_SYS_286_TRAP_GATE2519 ? Idte.Gate.u16OffsetLow2520 : 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 }2528 2513 2529 2514 /* Make sure the selector is present. */ … … 2534 2519 } 2535 2520 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 2536 2532 /* 2537 2533 * 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.