Changeset 11424 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Aug 14, 2008 1:46:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r10883 r11424 1301 1301 return VERR_EM_INTERPRETER; 1302 1302 } 1303 1304 #ifndef IN_GC 1305 /* 1306 * [REP] STOSWD emulation 1307 * 1308 */ 1309 static int emInterpretStosWD(PVM pVM, PDISCPUSTATE pCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 1310 { 1311 int rc; 1312 RTGCPTR GCDest, GCOffset; 1313 uint32_t cbSize; 1314 uint64_t cTransfers; 1315 1316 /* Don't support any but these three prefix bytes. */ 1317 if ((pCpu->prefix & ~(PREFIX_ADDRSIZE|PREFIX_OPSIZE|PREFIX_REP|PREFIX_REX))) 1318 return VERR_EM_INTERPRETER; 1319 1320 switch (pCpu->addrmode) 1321 { 1322 case CPUMODE_16BIT: 1323 GCOffset = pRegFrame->di; 1324 cTransfers = pRegFrame->cx; 1325 break; 1326 case CPUMODE_32BIT: 1327 GCOffset = pRegFrame->edi; 1328 cTransfers = pRegFrame->ecx; 1329 break; 1330 case CPUMODE_64BIT: 1331 GCOffset = pRegFrame->rdi; 1332 cTransfers = pRegFrame->rcx; 1333 break; 1334 default: 1335 AssertFailed(); 1336 return VERR_EM_INTERPRETER; 1337 } 1338 1339 GCDest = SELMToFlat(pVM, DIS_SELREG_ES, pRegFrame, GCOffset); 1340 switch (pCpu->opmode) 1341 { 1342 case CPUMODE_16BIT: 1343 cbSize = 2; 1344 break; 1345 case CPUMODE_32BIT: 1346 cbSize = 4; 1347 break; 1348 case CPUMODE_64BIT: 1349 cbSize = 8; 1350 break; 1351 default: 1352 AssertFailed(); 1353 return VERR_EM_INTERPRETER; 1354 } 1355 1356 LogFlow(("emInterpretStosWD dest=%VGv cbSize=%d\n", GCDest, cbSize)); 1357 1358 if (!(pCpu->prefix & PREFIX_REP)) 1359 { 1360 rc = PGMPhysWriteGCPtrSafe(pVM, GCDest, &pRegFrame->rax, cbSize); 1361 if (VBOX_FAILURE(rc)) 1362 return VERR_EM_INTERPRETER; 1363 Assert(rc == VINF_SUCCESS); 1364 } 1365 else 1366 { 1367 /* REP case */ 1368 while (cTransfers) 1369 { 1370 rc = PGMPhysWriteGCPtrSafe(pVM, GCDest, &pRegFrame->rax, cbSize); 1371 if (VBOX_FAILURE(rc)) 1372 { 1373 rc = VERR_EM_INTERPRETER; 1374 break; 1375 } 1376 1377 Assert(rc == VINF_SUCCESS); 1378 GCOffset += cbSize; 1379 GCDest += cbSize; 1380 cTransfers--; 1381 } 1382 1383 /* Update the registers. */ 1384 switch (pCpu->addrmode) 1385 { 1386 case CPUMODE_16BIT: 1387 pRegFrame->di = GCOffset; 1388 pRegFrame->cx = cTransfers; 1389 break; 1390 case CPUMODE_32BIT: 1391 pRegFrame->edi = GCOffset; 1392 pRegFrame->ecx = cTransfers; 1393 break; 1394 case CPUMODE_64BIT: 1395 pRegFrame->rdi = GCOffset; 1396 pRegFrame->rcx = cTransfers; 1397 break; 1398 } 1399 } 1400 1401 *pcbSize = cbSize; 1402 return rc; 1403 } 1404 #endif 1405 1303 1406 1304 1407 /* … … 2531 2634 ) 2532 2635 #else 2533 if ( (pCpu->prefix & (PREFIX_REPNE | PREFIX_REP)) 2636 if ( (pCpu->prefix & PREFIX_REPNE) 2637 || ( (pCpu->prefix & PREFIX_REP) 2638 && pCpu->pCurInstr->opcode != OP_STOSWD 2639 ) 2534 2640 || ( (pCpu->prefix & PREFIX_LOCK) 2535 2641 && pCpu->pCurInstr->opcode != OP_OR … … 2594 2700 INTERPRET_CASE_EX_PARAM3(OP_AND,And, OrXorAnd, EMEmulateAnd); 2595 2701 INTERPRET_CASE(OP_MOV,Mov); 2702 #ifndef IN_GC 2703 INTERPRET_CASE(OP_STOSWD,StosWD); 2704 #endif 2596 2705 INTERPRET_CASE(OP_INVLPG,InvlPg); 2597 2706 INTERPRET_CASE(OP_CPUID,CpuId); … … 2626 2735 #endif 2627 2736 INTERPRET_STAT_CASE(OP_MOVNTPS,MovNTPS); 2628 INTERPRET_STAT_CASE(OP_STOSWD,StosWD);2629 2737 INTERPRET_STAT_CASE(OP_WBINVD,WbInvd); 2630 2738 #endif
Note:
See TracChangeset
for help on using the changeset viewer.