Changeset 52724 in vbox for trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
- Timestamp:
- Sep 12, 2014 1:41:08 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r52669 r52724 3124 3124 Assert(enmTaskSwitch == IEMTASKSWITCH_INT_XCPT); 3125 3125 uint32_t cbLimitSS = X86DESC_LIMIT_G(&DescSS.Legacy); 3126 if (DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_DOWN) 3127 IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Expand down segments\n")); /** @todo Implement expand down segment support. */ 3126 uint8_t const cbStackFrame = fIsNewTSS386 ? 4 : 2; 3128 3127 3129 3128 /* Check that there is sufficient space on the stack. */ 3130 uint8_t const cbStackFrame = fIsNewTSS386 ? 4 : 2; 3131 if ( pCtx->esp - 1 > cbLimitSS 3132 || pCtx->esp < cbStackFrame) 3129 ///@todo: Factor out segment limit checking for normal/expand down segments into a separate function 3130 if (!(DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_DOWN)) 3133 3131 { 3134 /** @todo Intel says #SS(EXT) for INT/XCPT, I couldn't figure out AMD yet. */ 3135 Log(("iemTaskSwitch: SS=%#x ESP=%#x cbStackFrame=%#x is out of bounds -> #SS\n", pCtx->ss.Sel, pCtx->esp, 3136 cbStackFrame)); 3137 return iemRaiseStackSelectorNotPresentWithErr(pIemCpu, uExt); 3132 if ( pCtx->esp - 1 > cbLimitSS 3133 || pCtx->esp < cbStackFrame) 3134 { 3135 /** @todo Intel says #SS(EXT) for INT/XCPT, I couldn't figure out AMD yet. */ 3136 Log(("iemTaskSwitch: SS=%#x ESP=%#x cbStackFrame=%#x is out of bounds -> #SS\n", pCtx->ss.Sel, pCtx->esp, 3137 cbStackFrame)); 3138 return iemRaiseStackSelectorNotPresentWithErr(pIemCpu, uExt); 3139 } 3138 3140 } 3141 else 3142 { 3143 if ( pCtx->esp - 1 > (DescSS.Legacy.Gen.u4Type & X86_DESC_DB ? UINT32_MAX : UINT32_C(0xffff)) 3144 || pCtx->esp - cbStackFrame < cbLimitSS + UINT32_C(1)) 3145 { 3146 Log(("iemTaskSwitch: SS=%#x ESP=%#x cbStackFrame=%#x (expand down) is out of bounds -> #SS\n", pCtx->ss.Sel, pCtx->esp, 3147 cbStackFrame)); 3148 return iemRaiseStackSelectorNotPresentWithErr(pIemCpu, uExt); 3149 } 3150 } 3151 3139 3152 3140 3153 if (fIsNewTSS386) … … 3415 3428 /* Check that there is sufficient space for the stack frame. */ 3416 3429 uint32_t cbLimitSS = X86DESC_LIMIT_G(&DescSS.Legacy); 3417 if (DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_DOWN)3418 {3419 IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Expand down segments\n")); /** @todo Implement expand down segment support. */3420 }3421 3422 3430 uint8_t const cbStackFrame = !(fEfl & X86_EFL_VM) 3423 3431 ? (fFlags & IEM_XCPT_FLAGS_ERR ? 12 : 10) << f32BitGate 3424 3432 : (fFlags & IEM_XCPT_FLAGS_ERR ? 20 : 18) << f32BitGate; 3425 if ( uNewEsp - 1 > cbLimitSS 3426 || uNewEsp < cbStackFrame)3433 3434 if (!(DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_DOWN)) 3427 3435 { 3428 Log(("RaiseXcptOrIntInProtMode: %#x - SS=%#x ESP=%#x cbStackFrame=%#x is out of bounds -> #GP\n", 3429 u8Vector, NewSS, uNewEsp, cbStackFrame)); 3430 return iemRaiseSelectorBoundsBySelector(pIemCpu, NewSS); 3436 if ( uNewEsp - 1 > cbLimitSS 3437 || uNewEsp < cbStackFrame) 3438 { 3439 Log(("RaiseXcptOrIntInProtMode: %#x - SS=%#x ESP=%#x cbStackFrame=%#x is out of bounds -> #GP\n", 3440 u8Vector, NewSS, uNewEsp, cbStackFrame)); 3441 return iemRaiseSelectorBoundsBySelector(pIemCpu, NewSS); 3442 } 3443 } 3444 else 3445 { 3446 if ( uNewEsp - 1 > (DescSS.Legacy.Gen.u4Type & X86_DESC_DB ? UINT32_MAX : UINT32_C(0xffff)) 3447 || uNewEsp - cbStackFrame < cbLimitSS + UINT32_C(1)) 3448 { 3449 Log(("RaiseXcptOrIntInProtMode: %#x - SS=%#x ESP=%#x cbStackFrame=%#x (expand down) is out of bounds -> #GP\n", 3450 u8Vector, NewSS, uNewEsp, cbStackFrame)); 3451 return iemRaiseSelectorBoundsBySelector(pIemCpu, NewSS); 3452 } 3431 3453 } 3432 3454
Note:
See TracChangeset
for help on using the changeset viewer.