Changeset 62257 in vbox for trunk/src/VBox
- Timestamp:
- Jul 14, 2016 2:54:37 PM (9 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r62246 r62257 9906 9906 * @returns Strict VBox status code. 9907 9907 * @param pVCpu The cross context virtual CPU structure of the calling thread. 9908 * @param cbMem The number of bytes to p ush ontothe stack.9908 * @param cbMem The number of bytes to pop from the stack. 9909 9909 * @param ppvMem Where to return the pointer to the stack memory. 9910 9910 * @param puNewRsp Where to return the new RSP value. This must be 9911 * passed unchanged to9912 * iemMemStackPopCommitSpecial() or applied9913 * manually if iemMemStackPopDoneSpecial() is used.9911 * assigned to CPUMCTX::rsp manually some time 9912 * after iemMemStackPopDoneSpecial() has been 9913 * called. 9914 9914 */ 9915 9915 IEM_STATIC VBOXSTRICTRC iemMemStackPopBeginSpecial(PVMCPU pVCpu, size_t cbMem, void const **ppvMem, uint64_t *puNewRsp) … … 9929 9929 * @returns Strict VBox status code. 9930 9930 * @param pVCpu The cross context virtual CPU structure of the calling thread. 9931 * @param cbMem The number of bytes to p ush ontothe stack.9931 * @param cbMem The number of bytes to pop from the stack. 9932 9932 * @param ppvMem Where to return the pointer to the stack memory. 9933 9933 * @param puNewRsp Where to return the new RSP value. This must be 9934 * passed unchanged to9935 * iemMemStackPopCommitSpecial() or applied9936 * manually if iemMemStackPopDoneSpecial() is used.9934 * assigned to CPUMCTX::rsp manually some time 9935 * after iemMemStackPopDoneSpecial() has been 9936 * called. 9937 9937 */ 9938 9938 IEM_STATIC VBOXSTRICTRC iemMemStackPopContinueSpecial(PVMCPU pVCpu, size_t cbMem, void const **ppvMem, uint64_t *puNewRsp) 9939 9939 { 9940 9940 Assert(cbMem < UINT8_MAX); 9941 PCPUMCTX pCtx 9941 PCPUMCTX pCtx = IEM_GET_CTX(pVCpu); 9942 9942 RTUINT64U NewRsp; 9943 9943 NewRsp.u = *puNewRsp; … … 9945 9945 *puNewRsp = NewRsp.u; 9946 9946 return iemMemMap(pVCpu, (void **)ppvMem, cbMem, X86_SREG_SS, GCPtrTop, IEM_ACCESS_STACK_R); 9947 }9948 9949 9950 /**9951 * Commits a special stack pop (started by iemMemStackPopBeginSpecial).9952 *9953 * This will update the rSP.9954 *9955 * @returns Strict VBox status code.9956 * @param pVCpu The cross context virtual CPU structure of the calling thread.9957 * @param pvMem The pointer returned by9958 * iemMemStackPopBeginSpecial().9959 * @param uNewRsp The new RSP value returned by9960 * iemMemStackPopBeginSpecial().9961 */9962 IEM_STATIC VBOXSTRICTRC iemMemStackPopCommitSpecial(PVMCPU pVCpu, void const *pvMem, uint64_t uNewRsp)9963 {9964 VBOXSTRICTRC rcStrict = iemMemCommitAndUnmap(pVCpu, (void *)pvMem, IEM_ACCESS_STACK_R);9965 if (rcStrict == VINF_SUCCESS)9966 IEM_GET_CTX(pVCpu)->rsp = uNewRsp;9967 return rcStrict;9968 9947 } 9969 9948 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r62171 r62257 2162 2162 uNewCs = uPtrFrame.pu16[4]; 2163 2163 } 2164 rcStrict = iemMemStackPopDoneSpecial(pVCpu, uPtrFrame.pv); 2165 if (RT_LIKELY(rcStrict == VINF_SUCCESS)) 2166 { /* extremely likely */ } 2167 else 2168 return rcStrict; 2164 2169 2165 2170 /* … … 2179 2184 2180 2185 /* commit the operation. */ 2181 rcStrict = iemMemStackPopCommitSpecial(pVCpu, uPtrFrame.pv, uNewRsp); 2182 if (rcStrict != VINF_SUCCESS) 2183 return rcStrict; 2186 pCtx->rsp = uNewRsp; 2184 2187 pCtx->rip = uNewRip; 2185 2188 pCtx->cs.Sel = uNewCs; … … 2266 2269 { 2267 2270 /* Read the outer stack pointer stored *after* the parameters. */ 2268 RTCPTRUNION uPtrStack; 2269 rcStrict = iemMemStackPopContinueSpecial(pVCpu, cbPop + cbRetPtr, &uPtrStack.pv, &uNewRsp); 2271 rcStrict = iemMemStackPopContinueSpecial(pVCpu, cbPop + cbRetPtr, &uPtrFrame.pv, &uNewRsp); 2270 2272 if (rcStrict != VINF_SUCCESS) 2271 2273 return rcStrict; 2272 2274 2273 uPtr Stack.pu8 += cbPop; /* Skip the parameters. */2275 uPtrFrame.pu8 += cbPop; /* Skip the parameters. */ 2274 2276 2275 2277 uint16_t uNewOuterSs; … … 2277 2279 if (enmEffOpSize == IEMMODE_16BIT) 2278 2280 { 2279 uNewOuterRsp = uPtr Stack.pu16[0];2280 uNewOuterSs = uPtr Stack.pu16[1];2281 uNewOuterRsp = uPtrFrame.pu16[0]; 2282 uNewOuterSs = uPtrFrame.pu16[1]; 2281 2283 } 2282 2284 else if (enmEffOpSize == IEMMODE_32BIT) 2283 2285 { 2284 uNewOuterRsp = uPtr Stack.pu32[0];2285 uNewOuterSs = uPtr Stack.pu16[2];2286 uNewOuterRsp = uPtrFrame.pu32[0]; 2287 uNewOuterSs = uPtrFrame.pu16[2]; 2286 2288 } 2287 2289 else 2288 2290 { 2289 uNewOuterRsp = uPtrStack.pu64[0]; 2290 uNewOuterSs = uPtrStack.pu16[4]; 2291 } 2291 uNewOuterRsp = uPtrFrame.pu64[0]; 2292 uNewOuterSs = uPtrFrame.pu16[4]; 2293 } 2294 rcStrict = iemMemStackPopDoneSpecial(pVCpu, uPtrFrame.pv); 2295 if (RT_LIKELY(rcStrict == VINF_SUCCESS)) 2296 { /* extremely likely */ } 2297 else 2298 return rcStrict; 2292 2299 2293 2300 /* Check for NULL stack selector (invalid in ring-3 and non-long mode) … … 2411 2418 2412 2419 /* commit */ 2413 rcStrict = iemMemStackPopCommitSpecial(pVCpu, uPtrFrame.pv, uNewRsp); 2414 if (rcStrict != VINF_SUCCESS) 2415 return rcStrict; 2420 pCtx->rsp = uNewRsp; 2416 2421 if (enmEffOpSize == IEMMODE_16BIT) 2417 2422 pCtx->rip = uNewRip & UINT16_MAX; /** @todo Testcase: When exactly does this occur? With call it happens prior to the limit check according to Intel... */ … … 2498 2503 2499 2504 /* commit */ 2500 rcStrict = iemMemStackPopCommitSpecial(pVCpu, uPtrFrame.pv, uNewRsp); 2501 if (rcStrict != VINF_SUCCESS) 2502 return rcStrict; 2505 pCtx->rsp = uNewRsp; 2503 2506 if (enmEffOpSize == IEMMODE_16BIT) 2504 2507 pCtx->rip = uNewRip & UINT16_MAX; /** @todo Testcase: When exactly does this occur? With call it happens prior to the limit check according to Intel... */ … … 2862 2865 uNewFlags &= ~(X86_EFL_NT | X86_EFL_IOPL); 2863 2866 } 2867 rcStrict = iemMemStackPopDoneSpecial(pVCpu, uFrame.pv); 2868 if (RT_LIKELY(rcStrict == VINF_SUCCESS)) 2869 { /* extremely likely */ } 2870 else 2871 return rcStrict; 2872 2864 2873 /** @todo Check how this is supposed to work if sp=0xfffe. */ 2865 2874 Log7(("iemCImpl_iret_real_v8086: uNewCs=%#06x uNewRip=%#010x uNewFlags=%#x uNewRsp=%#18llx\n", … … 2904 2913 * Commit the operation. 2905 2914 */ 2906 rcStrict = iemMemStackPopCommitSpecial(pVCpu, uFrame.pv, uNewRsp);2907 if (rcStrict != VINF_SUCCESS)2908 return rcStrict;2909 2915 #ifdef DBGFTRACE_ENABLED 2910 2916 RTTraceBufAddMsgF(pVCpu->CTX_SUFF(pVM)->CTX_SUFF(hTraceBuf), "iret/rm %04x:%04x -> %04x:%04x %x %04llx", 2911 2917 pCtx->cs.Sel, pCtx->eip, uNewCs, uNewEip, uNewFlags, uNewRsp); 2912 2918 #endif 2913 2919 pCtx->rsp = uNewRsp; 2914 2920 pCtx->rip = uNewEip; 2915 2921 pCtx->cs.Sel = uNewCs; … … 3123 3129 uNewFlags = uFrame.pu16[2]; 3124 3130 } 3125 rcStrict = iemMemCommitAndUnmap(pVCpu, (void *)uFrame.pv, IEM_ACCESS_STACK_R); /* don't use iemMemStackPopCommitSpecial here. */ 3126 if (rcStrict != VINF_SUCCESS) 3131 rcStrict = iemMemStackPopDoneSpecial(pVCpu, (void *)uFrame.pv); /* don't use iemMemStackPopCommitSpecial here. */ 3132 if (RT_LIKELY(rcStrict == VINF_SUCCESS)) 3133 { /* extremely likely */ } 3134 else 3127 3135 return rcStrict; 3128 3136 Log7(("iemCImpl_iret_prot: uNewCs=%#06x uNewEip=%#010x uNewFlags=%#x uNewRsp=%#18llx\n", uNewCs, uNewEip, uNewFlags, uNewRsp)); … … 3520 3528 uNewSs = uFrame.pu16[4]; 3521 3529 } 3522 rcStrict = iemMemCommitAndUnmap(pVCpu, (void *)uFrame.pv, IEM_ACCESS_STACK_R); /* don't use iemMemStackPopCommitSpecial here. */ 3523 if (rcStrict != VINF_SUCCESS) 3530 rcStrict = iemMemStackPopDoneSpecial(pVCpu, (void *)uFrame.pv); /* don't use iemMemStackPopCommitSpecial here. */ 3531 if (RT_LIKELY(rcStrict == VINF_SUCCESS)) 3532 { /* extremely like */ } 3533 else 3524 3534 return rcStrict; 3525 3535 Log7(("iretq stack: cs:rip=%04x:%016RX64 rflags=%016RX64 ss:rsp=%04x:%016RX64\n", uNewCs, uNewRip, uNewFlags, uNewSs, uNewRsp));
Note:
See TracChangeset
for help on using the changeset viewer.