Changeset 40187 in vbox
- Timestamp:
- Feb 21, 2012 12:32:45 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76351
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r40185 r40187 49 49 * for FPU exception delivery, because with CR0.NE=0 there is a window where we 50 50 * can trigger spurious FPU exceptions. 51 * 52 * The guest FPU state is not loaded into the host CPU and kept there till we 53 * leave IEM because the calling conventions have declared an all year open 54 * season on much of the FPU state. For instance an innocent looking call to 55 * memcpy might end up using a whole bunch of XMM or MM registers if the 56 * particular implementation finds it worthwhile. 51 57 * 52 58 * … … 4233 4239 pEvtRec->u.RamWrite.cb = pIemCpu->aMemBbMappings[iMemMap].cbFirst; 4234 4240 memcpy(pEvtRec->u.RamWrite.ab, &pIemCpu->aBounceBuffers[iMemMap].ab[0], pIemCpu->aMemBbMappings[iMemMap].cbFirst); 4241 AssertCompile(sizeof(pEvtRec->u.RamWrite.ab) == sizeof(pIemCpu->aBounceBuffers[0].ab)); 4235 4242 pEvtRec->pNext = *pIemCpu->ppIemEvtRecNext; 4236 4243 *pIemCpu->ppIemEvtRecNext = pEvtRec; … … 4285 4292 4286 4293 /* 4287 * Read in the current memory content if it's a read of execute access. 4294 * Read in the current memory content if it's a read, execute or partial 4295 * write access. 4288 4296 */ 4289 4297 uint8_t *pbBuf = &pIemCpu->aBounceBuffers[iMemMap].ab[0]; … … 4291 4299 uint32_t const cbSecondPage = (uint32_t)(cbMem - cbFirstPage); 4292 4300 4293 if (fAccess & (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_EXEC ))4301 if (fAccess & (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_EXEC | IEM_ACCESS_PARTIAL_WRITE)) 4294 4302 { 4295 4303 int rc; … … 4314 4322 4315 4323 #ifdef IEM_VERIFICATION_MODE 4316 if (!pIemCpu->fNoRem) 4324 if ( !pIemCpu->fNoRem 4325 && (fAccess & (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_EXEC)) ) 4317 4326 { 4318 4327 /* … … 4385 4394 4386 4395 /* 4387 * Read in the current memory content if it's a read of execute access. 4396 * Read in the current memory content if it's a read, execute or partial 4397 * write access. 4388 4398 */ 4389 4399 uint8_t *pbBuf = &pIemCpu->aBounceBuffers[iMemMap].ab[0]; 4390 if (fAccess & (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_EXEC ))4400 if (fAccess & (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_EXEC | IEM_ACCESS_PARTIAL_WRITE)) 4391 4401 { 4392 4402 if (rcMap == VERR_PGM_PHYS_TLB_UNASSIGNED) … … 4404 4414 4405 4415 #ifdef IEM_VERIFICATION_MODE 4406 if (!pIemCpu->fNoRem) 4416 if ( !pIemCpu->fNoRem 4417 && (fAccess & (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_EXEC)) ) 4407 4418 { 4408 4419 /* … … 6860 6871 break; 6861 6872 case IEMVERIFYEVENT_RAM_WRITE: 6862 RTAssertMsg2Add("RAM WRITE at %RGp, %#4zx bytes: %.*R Hxs\n",6873 RTAssertMsg2Add("RAM WRITE at %RGp, %#4zx bytes: %.*Rhxs\n", 6863 6874 pEvtRec->u.RamWrite.GCPhys, 6864 6875 pEvtRec->u.RamWrite.cb, … … 6918 6929 { 6919 6930 uint8_t abBuf[sizeof(pEvtRec->u.RamWrite.ab)]; RT_ZERO(abBuf); 6931 Assert(sizeof(abBuf) >= pEvtRec->u.RamWrite.cb); 6920 6932 int rc = PGMPhysSimpleReadGCPhys(IEMCPU_TO_VM(pIemCpu), abBuf, pEvtRec->u.RamWrite.GCPhys, pEvtRec->u.RamWrite.cb); 6921 6933 if ( RT_FAILURE(rc) … … 6934 6946 && pEvtRec->u.RamWrite.GCPhys - UINT32_C(0xfffc0000) > UINT32_C(0x40000) ) 6935 6947 { 6936 RTAssertMsg1(NULL, __LINE__, __FILE__, __PRETTY_FUNCTION__); 6937 RTAssertMsg2Weak("Memory at %RGv differs\n", pEvtRec->u.RamWrite.GCPhys); 6938 RTAssertMsg2Add("REM: %.*Rhxs\n" 6939 "IEM: %.*Rhxs\n", 6940 pEvtRec->u.RamWrite.cb, abBuf, 6941 pEvtRec->u.RamWrite.cb, pEvtRec->u.RamWrite.ab); 6942 iemVerifyAssertAddRecordDump(pEvtRec); 6943 iemVerifyAssertMsg2(pIemCpu); 6944 RTAssertPanic(); 6948 /* fend off fxsave */ 6949 if (pEvtRec->u.RamWrite.cb != 512) 6950 { 6951 RTAssertMsg1(NULL, __LINE__, __FILE__, __PRETTY_FUNCTION__); 6952 RTAssertMsg2Weak("Memory at %RGv differs\n", pEvtRec->u.RamWrite.GCPhys); 6953 RTAssertMsg2Add("REM: %.*Rhxs\n" 6954 "IEM: %.*Rhxs\n", 6955 pEvtRec->u.RamWrite.cb, abBuf, 6956 pEvtRec->u.RamWrite.cb, pEvtRec->u.RamWrite.ab); 6957 iemVerifyAssertAddRecordDump(pEvtRec); 6958 iemVerifyAssertMsg2(pIemCpu); 6959 RTAssertPanic(); 6960 } 6945 6961 } 6946 6962 } … … 7370 7386 iemExecVerificationModeCheck(pIemCpu); 7371 7387 #endif 7372 LogFlow(("IEMExecOne: returns %Rrc - cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x\n", 7373 VBOXSTRICTRC_VAL(rcStrict), pCtx->cs, pCtx->rip, pCtx->ss, pCtx->rsp, pCtx->eflags.u)); 7388 if (rcStrict != VINF_SUCCESS) 7389 LogFlow(("IEMExecOne: cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x - rcStrict=%Rrc\n", 7390 pCtx->cs, pCtx->rip, pCtx->ss, pCtx->rsp, pCtx->eflags.u, VBOXSTRICTRC_VAL(rcStrict))); 7374 7391 return rcStrict; 7375 7392 } -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r40184 r40187 1041 1041 VBOXSTRICTRC rcStrict; 1042 1042 uint64_t uNewRsp; 1043 void *pvRet;1043 RTPTRUNION uPtrRet; 1044 1044 1045 1045 /* … … 1055 1055 /* Check stack first - may #SS(0). */ 1056 1056 rcStrict = iemMemStackPushBeginSpecial(pIemCpu, enmEffOpSize == IEMMODE_32BIT ? 6 : 4, 1057 & pvRet, &uNewRsp);1057 &uPtrRet.pv, &uNewRsp); 1058 1058 if (rcStrict != VINF_SUCCESS) 1059 1059 return rcStrict; … … 1066 1066 if (enmEffOpSize == IEMMODE_16BIT) 1067 1067 { 1068 ((uint16_t *)pvRet)[0] = pCtx->ip + cbInstr;1069 ((uint16_t *)pvRet)[1] = pCtx->cs;1068 uPtrRet.pu16[0] = pCtx->ip + cbInstr; 1069 uPtrRet.pu16[1] = pCtx->cs; 1070 1070 } 1071 1071 else 1072 1072 { 1073 ((uint32_t *)pvRet)[0] = pCtx->eip + cbInstr;1074 ((uint16_t *)pvRet)[3] = pCtx->cs;1075 } 1076 rcStrict = iemMemStackPushCommitSpecial(pIemCpu, pvRet, uNewRsp);1073 uPtrRet.pu32[0] = pCtx->eip + cbInstr; 1074 uPtrRet.pu16[3] = pCtx->cs; 1075 } 1076 rcStrict = iemMemStackPushCommitSpecial(pIemCpu, uPtrRet.pv, uNewRsp); 1077 1077 if (rcStrict != VINF_SUCCESS) 1078 1078 return rcStrict; … … 1160 1160 1161 1161 /* Check stack first - may #SS(0). */ 1162 /** @todo check how operand prefix affects pushing of CS! Does callf 16:32 in 1163 * 16-bit code cause a two or four byte CS to be pushed? */ 1162 1164 rcStrict = iemMemStackPushBeginSpecial(pIemCpu, 1163 enmEffOpSize == IEMMODE_64BIT ? 8+ 21164 : enmEffOpSize == IEMMODE_32BIT ? 4+ 2: 2+2,1165 & pvRet, &uNewRsp);1165 enmEffOpSize == IEMMODE_64BIT ? 8+8 1166 : enmEffOpSize == IEMMODE_32BIT ? 4+4 : 2+2, 1167 &uPtrRet.pv, &uNewRsp); 1166 1168 if (rcStrict != VINF_SUCCESS) 1167 1169 return rcStrict; … … 1215 1217 if (enmEffOpSize == IEMMODE_16BIT) 1216 1218 { 1217 ((uint16_t *)pvRet)[0] = pCtx->ip + cbInstr;1218 ((uint16_t *)pvRet)[1] = pCtx->cs;1219 uPtrRet.pu16[0] = pCtx->ip + cbInstr; 1220 uPtrRet.pu16[1] = pCtx->cs; 1219 1221 } 1220 1222 else if (enmEffOpSize == IEMMODE_32BIT) 1221 1223 { 1222 ((uint32_t *)pvRet)[0] = pCtx->eip + cbInstr;1223 ((uint32_t *)pvRet)[1] = pCtx->cs;1224 uPtrRet.pu32[0] = pCtx->eip + cbInstr; 1225 uPtrRet.pu32[1] = pCtx->cs; /** @todo Testcase: What is written to the high word when callf is pushing CS? */ 1224 1226 } 1225 1227 else 1226 1228 { 1227 ((uint64_t *)pvRet)[0] = pCtx->rip + cbInstr;1228 ((uint64_t *)pvRet)[1] = pCtx->cs;1229 } 1230 rcStrict = iemMemStackPushCommitSpecial(pIemCpu, pvRet, uNewRsp);1229 uPtrRet.pu64[0] = pCtx->rip + cbInstr; 1230 uPtrRet.pu64[1] = pCtx->cs; /** @todo Testcase: What is written to the high words when callf is pushing CS? */ 1231 } 1232 rcStrict = iemMemStackPushCommitSpecial(pIemCpu, uPtrRet.pv, uNewRsp); 1231 1233 if (rcStrict != VINF_SUCCESS) 1232 1234 return rcStrict; … … 3884 3886 */ 3885 3887 void *pvMem512; 3886 VBOXSTRICTRC rcStrict = iemMemMap(pIemCpu, &pvMem512, 512, iEffSeg, GCPtrEff, IEM_ACCESS_DATA_W );3888 VBOXSTRICTRC rcStrict = iemMemMap(pIemCpu, &pvMem512, 512, iEffSeg, GCPtrEff, IEM_ACCESS_DATA_W | IEM_ACCESS_PARTIAL_WRITE); 3887 3889 if (rcStrict != VINF_SUCCESS) 3888 3890 return rcStrict; … … 3938 3940 * Commit the memory. 3939 3941 */ 3940 rcStrict = iemMemCommitAndUnmap(pIemCpu, pvMem512, IEM_ACCESS_DATA_W );3942 rcStrict = iemMemCommitAndUnmap(pIemCpu, pvMem512, IEM_ACCESS_DATA_W | IEM_ACCESS_PARTIAL_WRITE); 3941 3943 if (rcStrict != VINF_SUCCESS) 3942 3944 return rcStrict; -
trunk/src/VBox/VMM/include/IEMInternal.h
r40182 r40187 157 157 RTGCPHYS GCPhys; 158 158 uint32_t cb; 159 uint8_t ab[ 32];159 uint8_t ab[512]; 160 160 } RamWrite; 161 161 } u; … … 353 353 #define IEM_ACCESS_WHAT_SYS UINT32_C(0x00000040) 354 354 #define IEM_ACCESS_WHAT_MASK UINT32_C(0x00000070) 355 /** The writes are partial, so if initialize the bounce buffer with the 356 * orignal RAM content. */ 357 #define IEM_ACCESS_PARTIAL_WRITE UINT32_C(0x00000100) 355 358 /** Used in aMemMappings to indicate that the entry is bounce buffered. */ 356 #define IEM_ACCESS_BOUNCE_BUFFERED UINT32_C(0x00000 100)359 #define IEM_ACCESS_BOUNCE_BUFFERED UINT32_C(0x00000200) 357 360 /** Read+write data alias. */ 358 361 #define IEM_ACCESS_DATA_RW (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_WRITE | IEM_ACCESS_WHAT_DATA)
Note:
See TracChangeset
for help on using the changeset viewer.