Changeset 41793 in vbox for trunk/src/VBox/Disassembler
- Timestamp:
- Jun 16, 2012 11:58:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmCore.cpp
r41791 r41793 520 520 //***************************************************************************** 521 521 //***************************************************************************** 522 static size_t disParseInstruction(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis )522 static size_t disParseInstruction(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, size_t cbExtra) 523 523 { 524 524 size_t size = 0; … … 570 570 if (pOp->idxParse1 != IDX_ParseNop) 571 571 { 572 size += pDis->pfnDisasmFnTable[pOp->idxParse1](offInstr, pOp, &pDis->Param1, pDis);572 size += pDis->pfnDisasmFnTable[pOp->idxParse1](offInstr, pOp, pDis, &pDis->Param1); 573 573 if (fFiltered == false) pDis->Param1.cb = DISGetParamSize(pDis, &pDis->Param1); 574 574 } … … 576 576 if (pOp->idxParse2 != IDX_ParseNop) 577 577 { 578 size += pDis->pfnDisasmFnTable[pOp->idxParse2](offInstr+size, pOp, &pDis->Param2, pDis);578 size += pDis->pfnDisasmFnTable[pOp->idxParse2](offInstr+size, pOp, pDis, &pDis->Param2); 579 579 if (fFiltered == false) pDis->Param2.cb = DISGetParamSize(pDis, &pDis->Param2); 580 580 } … … 582 582 if (pOp->idxParse3 != IDX_ParseNop) 583 583 { 584 size += pDis->pfnDisasmFnTable[pOp->idxParse3](offInstr+size, pOp, &pDis->Param3, pDis);584 size += pDis->pfnDisasmFnTable[pOp->idxParse3](offInstr+size, pOp, pDis, &pDis->Param3); 585 585 if (fFiltered == false) pDis->Param3.cb = DISGetParamSize(pDis, &pDis->Param3); 586 586 } 587 587 // else simple one byte instruction 588 588 589 return size ;589 return size + cbExtra; 590 590 } 591 591 //***************************************************************************** 592 592 /* Floating point opcode parsing */ 593 593 //***************************************************************************** 594 static size_t ParseEscFP(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)594 static size_t ParseEscFP(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 595 595 { 596 596 size_t size = 0; … … 642 642 643 643 if (fpop->idxParse1 != IDX_ParseNop) 644 size += pDis->pfnDisasmFnTable[fpop->idxParse1](offInstr+size, fpop, p Param, pDis);644 size += pDis->pfnDisasmFnTable[fpop->idxParse1](offInstr+size, fpop, pDis, pParam); 645 645 646 646 if (fpop->idxParse2 != IDX_ParseNop) 647 size += pDis->pfnDisasmFnTable[fpop->idxParse2](offInstr+size, fpop, p Param, pDis);647 size += pDis->pfnDisasmFnTable[fpop->idxParse2](offInstr+size, fpop, pDis, pParam); 648 648 649 649 return size; … … 660 660 * 661 661 ********************************************************************************************************************************/ 662 static void UseSIB(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)662 static void UseSIB(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 663 663 { 664 664 NOREF(offInstr); NOREF(pOp); … … 709 709 710 710 711 static size_t ParseSIB(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)711 static size_t ParseSIB(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 712 712 { 713 713 unsigned size = sizeof(uint8_t); … … 741 741 742 742 743 static size_t ParseSIB_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)743 static size_t ParseSIB_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 744 744 { 745 745 unsigned size = sizeof(uint8_t); … … 886 886 887 887 888 static size_t UseModRM(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)888 static size_t UseModRM(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 889 889 { 890 890 unsigned vtype = OP_PARM_VTYPE(pParam->fParam); … … 969 969 if (rm == 4) 970 970 { /* SIB byte follows ModRM */ 971 UseSIB(offInstr, pOp, p Param, pDis);971 UseSIB(offInstr, pOp, pDis, pParam); 972 972 } 973 973 else … … 995 995 case 1: //effective address + 8 bits displacement 996 996 if (rm == 4) {//SIB byte follows ModRM 997 UseSIB(offInstr, pOp, p Param, pDis);997 UseSIB(offInstr, pOp, pDis, pParam); 998 998 } 999 999 else … … 1008 1008 case 2: //effective address + 32 bits displacement 1009 1009 if (rm == 4) {//SIB byte follows ModRM 1010 UseSIB(offInstr, pOp, p Param, pDis);1010 UseSIB(offInstr, pOp, pDis, pParam); 1011 1011 } 1012 1012 else … … 1063 1063 // Query the size of the ModRM parameters and fetch the immediate data (if any) 1064 1064 //***************************************************************************** 1065 static size_t QueryModRM(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis, size_t *pSibInc)1065 static size_t QueryModRM(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam, size_t *pSibInc) 1066 1066 { 1067 1067 size_t sibinc; … … 1085 1085 if (mod != 3 && rm == 4) 1086 1086 { /* SIB byte follows ModRM */ 1087 *pSibInc = ParseSIB(offInstr, pOp, p Param, pDis);1087 *pSibInc = ParseSIB(offInstr, pOp, pDis, pParam); 1088 1088 offInstr += *pSibInc; 1089 1089 size += *pSibInc; … … 1146 1146 // Query the size of the ModRM parameters and fetch the immediate data (if any) 1147 1147 //***************************************************************************** 1148 static size_t QueryModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis, size_t *pSibInc)1148 static size_t QueryModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam, size_t *pSibInc) 1149 1149 { 1150 1150 size_t sibinc; … … 1167 1167 if (mod != 3 && rm == 4) 1168 1168 { /* SIB byte follows ModRM */ 1169 *pSibInc = ParseSIB_SizeOnly(offInstr, pOp, p Param, pDis);1169 *pSibInc = ParseSIB_SizeOnly(offInstr, pOp, pDis, pParam); 1170 1170 offInstr += *pSibInc; 1171 1171 size += *pSibInc; … … 1221 1221 //***************************************************************************** 1222 1222 //***************************************************************************** 1223 static size_t ParseIllegal(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1223 static size_t ParseIllegal(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1224 1224 { 1225 1225 NOREF(offInstr); NOREF(pOp); NOREF(pParam); NOREF(pDis); … … 1229 1229 //***************************************************************************** 1230 1230 //***************************************************************************** 1231 static size_t ParseModRM(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1231 static size_t ParseModRM(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1232 1232 { 1233 1233 size_t size = sizeof(uint8_t); //ModRM byte … … 1267 1267 } 1268 1268 } 1269 size += QueryModRM(offInstr, pOp, p Param, pDis, &sibinc);1269 size += QueryModRM(offInstr, pOp, pDis, pParam, &sibinc); 1270 1270 offInstr += sibinc; 1271 1271 1272 UseModRM(offInstr, pOp, p Param, pDis);1272 UseModRM(offInstr, pOp, pDis, pParam); 1273 1273 return size; 1274 1274 } 1275 1275 //***************************************************************************** 1276 1276 //***************************************************************************** 1277 static size_t ParseModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1277 static size_t ParseModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1278 1278 { 1279 1279 size_t size = sizeof(uint8_t); //ModRM byte … … 1314 1314 } 1315 1315 1316 size += QueryModRM_SizeOnly(offInstr, pOp, p Param, pDis, &sibinc);1316 size += QueryModRM_SizeOnly(offInstr, pOp, pDis, pParam, &sibinc); 1317 1317 offInstr += sibinc; 1318 1318 … … 1322 1322 //***************************************************************************** 1323 1323 //***************************************************************************** 1324 static size_t ParseModFence(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1324 static size_t ParseModFence(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1325 1325 { 1326 1326 ////AssertMsgFailed(("??\n")); … … 1331 1331 //***************************************************************************** 1332 1332 //***************************************************************************** 1333 static size_t ParseImmByte(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1333 static size_t ParseImmByte(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1334 1334 { 1335 1335 NOREF(pOp); … … 1341 1341 //***************************************************************************** 1342 1342 //***************************************************************************** 1343 static size_t ParseImmByte_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1343 static size_t ParseImmByte_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1344 1344 { 1345 1345 NOREF(offInstr); NOREF(pOp); NOREF(pParam); NOREF(pDis); … … 1348 1348 //***************************************************************************** 1349 1349 //***************************************************************************** 1350 static size_t ParseImmByteSX(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1350 static size_t ParseImmByteSX(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1351 1351 { 1352 1352 NOREF(pOp); … … 1374 1374 //***************************************************************************** 1375 1375 //***************************************************************************** 1376 static size_t ParseImmByteSX_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1376 static size_t ParseImmByteSX_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1377 1377 { 1378 1378 NOREF(offInstr); NOREF(pOp); NOREF(pParam); NOREF(pDis); … … 1381 1381 //***************************************************************************** 1382 1382 //***************************************************************************** 1383 static size_t ParseImmUshort(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1383 static size_t ParseImmUshort(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1384 1384 { 1385 1385 NOREF(pOp); … … 1391 1391 //***************************************************************************** 1392 1392 //***************************************************************************** 1393 static size_t ParseImmUshort_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1393 static size_t ParseImmUshort_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1394 1394 { 1395 1395 NOREF(offInstr); NOREF(pOp); NOREF(pParam); NOREF(pDis); … … 1398 1398 //***************************************************************************** 1399 1399 //***************************************************************************** 1400 static size_t ParseImmUlong(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1400 static size_t ParseImmUlong(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1401 1401 { 1402 1402 NOREF(pOp); … … 1408 1408 //***************************************************************************** 1409 1409 //***************************************************************************** 1410 static size_t ParseImmUlong_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1410 static size_t ParseImmUlong_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1411 1411 { 1412 1412 NOREF(offInstr); NOREF(pOp); NOREF(pParam); NOREF(pDis); … … 1415 1415 //***************************************************************************** 1416 1416 //***************************************************************************** 1417 static size_t ParseImmQword(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1417 static size_t ParseImmQword(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1418 1418 { 1419 1419 NOREF(pOp); … … 1425 1425 //***************************************************************************** 1426 1426 //***************************************************************************** 1427 static size_t ParseImmQword_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1427 static size_t ParseImmQword_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1428 1428 { 1429 1429 NOREF(offInstr); NOREF(pOp); NOREF(pParam); NOREF(pDis); … … 1432 1432 //***************************************************************************** 1433 1433 //***************************************************************************** 1434 static size_t ParseImmV(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1434 static size_t ParseImmV(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1435 1435 { 1436 1436 NOREF(pOp); … … 1458 1458 //***************************************************************************** 1459 1459 //***************************************************************************** 1460 static size_t ParseImmV_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1460 static size_t ParseImmV_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1461 1461 { 1462 1462 NOREF(offInstr); NOREF(pOp); NOREF(pParam); … … 1469 1469 //***************************************************************************** 1470 1470 //***************************************************************************** 1471 static size_t ParseImmZ(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1471 static size_t ParseImmZ(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1472 1472 { 1473 1473 NOREF(pOp); … … 1498 1498 //***************************************************************************** 1499 1499 //***************************************************************************** 1500 static size_t ParseImmZ_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1500 static size_t ParseImmZ_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1501 1501 { 1502 1502 NOREF(offInstr); NOREF(pOp); NOREF(pParam); … … 1510 1510 // Relative displacement for branches (rel. to next instruction) 1511 1511 //***************************************************************************** 1512 static size_t ParseImmBRel(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1512 static size_t ParseImmBRel(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1513 1513 { 1514 1514 NOREF(pOp); … … 1521 1521 // Relative displacement for branches (rel. to next instruction) 1522 1522 //***************************************************************************** 1523 static size_t ParseImmBRel_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1523 static size_t ParseImmBRel_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1524 1524 { 1525 1525 NOREF(offInstr); NOREF(pOp); NOREF(pParam); NOREF(pDis); … … 1529 1529 // Relative displacement for branches (rel. to next instruction) 1530 1530 //***************************************************************************** 1531 static size_t ParseImmVRel(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1531 static size_t ParseImmVRel(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1532 1532 { 1533 1533 NOREF(pOp); … … 1557 1557 // Relative displacement for branches (rel. to next instruction) 1558 1558 //***************************************************************************** 1559 static size_t ParseImmVRel_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1559 static size_t ParseImmVRel_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1560 1560 { 1561 1561 NOREF(offInstr); NOREF(pOp); NOREF(pParam); … … 1567 1567 //***************************************************************************** 1568 1568 //***************************************************************************** 1569 static size_t ParseImmAddr(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1569 static size_t ParseImmAddr(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1570 1570 { 1571 1571 if (pDis->uAddrMode == DISCPUMODE_32BIT) … … 1629 1629 //***************************************************************************** 1630 1630 //***************************************************************************** 1631 static size_t ParseImmAddr_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1631 static size_t ParseImmAddr_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1632 1632 { 1633 1633 NOREF(offInstr); NOREF(pOp); … … 1662 1662 //***************************************************************************** 1663 1663 //***************************************************************************** 1664 static size_t ParseImmAddrF(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1664 static size_t ParseImmAddrF(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1665 1665 { 1666 1666 // immediate far pointers - only 16:16 or 16:32; determined by operand, *not* address size! … … 1685 1685 //***************************************************************************** 1686 1686 //***************************************************************************** 1687 static size_t ParseImmAddrF_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1687 static size_t ParseImmAddrF_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1688 1688 { 1689 1689 NOREF(offInstr); NOREF(pOp); … … 1704 1704 //***************************************************************************** 1705 1705 //***************************************************************************** 1706 static size_t ParseFixedReg(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1706 static size_t ParseFixedReg(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1707 1707 { 1708 1708 NOREF(offInstr); … … 1805 1805 //***************************************************************************** 1806 1806 //***************************************************************************** 1807 static size_t ParseXv(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1807 static size_t ParseXv(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1808 1808 { 1809 1809 NOREF(offInstr); … … 1830 1830 //***************************************************************************** 1831 1831 //***************************************************************************** 1832 static size_t ParseXb(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1832 static size_t ParseXb(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1833 1833 { 1834 1834 NOREF(offInstr); NOREF(pOp); … … 1855 1855 //***************************************************************************** 1856 1856 //***************************************************************************** 1857 static size_t ParseYv(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1857 static size_t ParseYv(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1858 1858 { 1859 1859 NOREF(offInstr); … … 1880 1880 //***************************************************************************** 1881 1881 //***************************************************************************** 1882 static size_t ParseYb(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1882 static size_t ParseYb(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1883 1883 { 1884 1884 NOREF(offInstr); NOREF(pOp); … … 1905 1905 //***************************************************************************** 1906 1906 //***************************************************************************** 1907 static size_t ParseTwoByteEsc(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)1907 static size_t ParseTwoByteEsc(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1908 1908 { 1909 1909 PCDISOPCODE pOpcode; … … 1959 1959 } 1960 1960 1961 size += disParseInstruction(offInstr+size, pOpcode, pDis); 1962 return size; 1963 } 1964 //***************************************************************************** 1965 //***************************************************************************** 1966 static size_t ParseThreeByteEsc4(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 1961 return disParseInstruction(offInstr+size, pOpcode, pDis, size); 1962 } 1963 //***************************************************************************** 1964 //***************************************************************************** 1965 static size_t ParseThreeByteEsc4(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1967 1966 { 1968 1967 PCDISOPCODE pOpcode; … … 2020 2019 } 2021 2020 2022 size += disParseInstruction(offInstr+size, pOpcode, pDis); 2023 return size; 2024 } 2025 //***************************************************************************** 2026 //***************************************************************************** 2027 static size_t ParseThreeByteEsc5(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2021 return disParseInstruction(offInstr+size, pOpcode, pDis, size); 2022 } 2023 //***************************************************************************** 2024 //***************************************************************************** 2025 static size_t ParseThreeByteEsc5(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2028 2026 { 2029 2027 PCDISOPCODE pOpcode; … … 2055 2053 pOpcode = &g_InvalidOpcode[0]; 2056 2054 2057 size += disParseInstruction(offInstr+size, pOpcode, pDis); 2058 return size; 2059 } 2060 //***************************************************************************** 2061 //***************************************************************************** 2062 static size_t ParseNopPause(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2055 return disParseInstruction(offInstr+size, pOpcode, pDis, size); 2056 } 2057 //***************************************************************************** 2058 //***************************************************************************** 2059 static size_t ParseNopPause(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2063 2060 { 2064 2061 size_t size = 0; … … 2073 2070 pOp = &g_aMapX86_NopPause[0]; /* NOP */ 2074 2071 2075 size += disParseInstruction(offInstr, pOp, pDis); 2076 return size; 2077 } 2078 //***************************************************************************** 2079 //***************************************************************************** 2080 static size_t ParseImmGrpl(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2072 return disParseInstruction(offInstr, pOp, pDis, size); 2073 } 2074 //***************************************************************************** 2075 //***************************************************************************** 2076 static size_t ParseImmGrpl(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2081 2077 { 2082 2078 int idx = (pDis->bOpCode - 0x80) * 8; … … 2092 2088 size = sizeof(uint8_t); //ModRM byte 2093 2089 2094 size += disParseInstruction(offInstr, pOp, pDis); 2095 2096 return size; 2097 } 2098 //***************************************************************************** 2099 //***************************************************************************** 2100 static size_t ParseShiftGrp2(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2090 return disParseInstruction(offInstr, pOp, pDis, size); 2091 } 2092 //***************************************************************************** 2093 //***************************************************************************** 2094 static size_t ParseShiftGrp2(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2101 2095 { 2102 2096 int idx; … … 2132 2126 size = sizeof(uint8_t); //ModRM byte 2133 2127 2134 size += disParseInstruction(offInstr, pOp, pDis); 2135 2136 return size; 2137 } 2138 //***************************************************************************** 2139 //***************************************************************************** 2140 static size_t ParseGrp3(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2128 return disParseInstruction(offInstr, pOp, pDis, size); 2129 } 2130 //***************************************************************************** 2131 //***************************************************************************** 2132 static size_t ParseGrp3(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2141 2133 { 2142 2134 int idx = (pDis->bOpCode - 0xF6) * 8; … … 2153 2145 size = sizeof(uint8_t); //ModRM byte 2154 2146 2155 size += disParseInstruction(offInstr, pOp, pDis); 2156 2157 return size; 2158 } 2159 //***************************************************************************** 2160 //***************************************************************************** 2161 static size_t ParseGrp4(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2147 return disParseInstruction(offInstr, pOp, pDis, size); 2148 } 2149 //***************************************************************************** 2150 //***************************************************************************** 2151 static size_t ParseGrp4(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2162 2152 { 2163 2153 size_t size = 0; … … 2173 2163 size = sizeof(uint8_t); //ModRM byte 2174 2164 2175 size += disParseInstruction(offInstr, pOp, pDis); 2176 2177 return size; 2178 } 2179 //***************************************************************************** 2180 //***************************************************************************** 2181 static size_t ParseGrp5(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2165 return disParseInstruction(offInstr, pOp, pDis, size); 2166 } 2167 //***************************************************************************** 2168 //***************************************************************************** 2169 static size_t ParseGrp5(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2182 2170 { 2183 2171 size_t size = 0; … … 2193 2181 size = sizeof(uint8_t); //ModRM byte 2194 2182 2195 size += disParseInstruction(offInstr, pOp, pDis); 2196 2197 return size; 2183 return disParseInstruction(offInstr, pOp, pDis, size); 2198 2184 } 2199 2185 //***************************************************************************** … … 2203 2189 // 2204 2190 //***************************************************************************** 2205 static size_t Parse3DNow(size_t offInstr, PCDISOPCODE pOp, PDIS OPPARAM pParam, PDISSTATE pDis)2191 static size_t Parse3DNow(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2206 2192 { 2207 2193 size_t size = 0; … … 2217 2203 pDis->ModRM.Bits.Reg = MODRM_REG(ModRM); 2218 2204 2219 size_t modrmsize = QueryModRM(offInstr+sizeof(uint8_t), pOp, p Param, pDis, NULL);2205 size_t modrmsize = QueryModRM(offInstr+sizeof(uint8_t), pOp, pDis, pParam, NULL); 2220 2206 2221 2207 uint8_t opcode = disReadByte(pDis, offInstr+sizeof(uint8_t)+modrmsize); … … 2232 2218 } 2233 2219 2234 size += disParseInstruction(offInstr, pOp, pDis);2235 2220 size += sizeof(uint8_t); //imm8_opcode uint8_t 2236 2237 return size; 2238 } 2239 //***************************************************************************** 2240 //***************************************************************************** 2241 static size_t ParseGrp6(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2221 return disParseInstruction(offInstr, pOp, pDis, size); 2222 } 2223 //***************************************************************************** 2224 //***************************************************************************** 2225 static size_t ParseGrp6(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2242 2226 { 2243 2227 size_t size = 0; … … 2253 2237 size = sizeof(uint8_t); //ModRM byte 2254 2238 2255 size += disParseInstruction(offInstr, pOp, pDis); 2256 2257 return size; 2258 } 2259 //***************************************************************************** 2260 //***************************************************************************** 2261 static size_t ParseGrp7(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2239 return disParseInstruction(offInstr, pOp, pDis, size); 2240 } 2241 //***************************************************************************** 2242 //***************************************************************************** 2243 static size_t ParseGrp7(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2262 2244 { 2263 2245 size_t size = 0; … … 2281 2263 size = sizeof(uint8_t); //ModRM byte 2282 2264 2283 size += disParseInstruction(offInstr, pOp, pDis); 2284 2285 return size; 2286 } 2287 //***************************************************************************** 2288 //***************************************************************************** 2289 static size_t ParseGrp8(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2265 return disParseInstruction(offInstr, pOp, pDis, size); 2266 } 2267 //***************************************************************************** 2268 //***************************************************************************** 2269 static size_t ParseGrp8(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2290 2270 { 2291 2271 size_t size = 0; … … 2301 2281 size = sizeof(uint8_t); //ModRM byte 2302 2282 2303 size += disParseInstruction(offInstr, pOp, pDis); 2304 2305 return size; 2306 } 2307 //***************************************************************************** 2308 //***************************************************************************** 2309 static size_t ParseGrp9(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2283 return disParseInstruction(offInstr, pOp, pDis, size); 2284 } 2285 //***************************************************************************** 2286 //***************************************************************************** 2287 static size_t ParseGrp9(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2310 2288 { 2311 2289 size_t size = 0; … … 2321 2299 size = sizeof(uint8_t); //ModRM byte 2322 2300 2323 size += disParseInstruction(offInstr, pOp, pDis); 2324 2325 return size; 2326 } 2327 //***************************************************************************** 2328 //***************************************************************************** 2329 static size_t ParseGrp10(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2301 return disParseInstruction(offInstr, pOp, pDis, size); 2302 } 2303 //***************************************************************************** 2304 //***************************************************************************** 2305 static size_t ParseGrp10(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2330 2306 { 2331 2307 size_t size = 0; … … 2341 2317 size = sizeof(uint8_t); //ModRM byte 2342 2318 2343 size += disParseInstruction(offInstr, pOp, pDis); 2344 2345 return size; 2346 } 2347 //***************************************************************************** 2348 //***************************************************************************** 2349 static size_t ParseGrp12(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2319 return disParseInstruction(offInstr, pOp, pDis, size); 2320 } 2321 //***************************************************************************** 2322 //***************************************************************************** 2323 static size_t ParseGrp12(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2350 2324 { 2351 2325 size_t size = 0; … … 2364 2338 size = sizeof(uint8_t); //ModRM byte 2365 2339 2366 size += disParseInstruction(offInstr, pOp, pDis); 2367 return size; 2368 } 2369 //***************************************************************************** 2370 //***************************************************************************** 2371 static size_t ParseGrp13(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2340 return disParseInstruction(offInstr, pOp, pDis, size); 2341 } 2342 //***************************************************************************** 2343 //***************************************************************************** 2344 static size_t ParseGrp13(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2372 2345 { 2373 2346 size_t size = 0; … … 2385 2358 size = sizeof(uint8_t); //ModRM byte 2386 2359 2387 size += disParseInstruction(offInstr, pOp, pDis); 2388 2389 return size; 2390 } 2391 //***************************************************************************** 2392 //***************************************************************************** 2393 static size_t ParseGrp14(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2394 { 2395 size_t size = 0; 2360 return disParseInstruction(offInstr, pOp, pDis, size); 2361 } 2362 //***************************************************************************** 2363 //***************************************************************************** 2364 static size_t ParseGrp14(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2365 { 2396 2366 NOREF(pParam); 2397 2367 2398 u nsignedmodrm = disReadByte(pDis, offInstr);2399 u nsignedreg = MODRM_REG(modrm);2368 uint8_t modrm = disReadByte(pDis, offInstr); 2369 uint8_t reg = MODRM_REG(modrm); 2400 2370 if (pDis->fPrefix & DISPREFIX_OPSIZE) 2401 2371 reg += 8; //2nd table … … 2404 2374 2405 2375 //little hack to make sure the ModRM byte is included in the returned size 2376 size_t size = 0; 2406 2377 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) 2407 2378 size = sizeof(uint8_t); //ModRM byte 2408 2379 2409 size += disParseInstruction(offInstr, pOp, pDis); 2410 2411 return size; 2412 } 2413 //***************************************************************************** 2414 //***************************************************************************** 2415 static size_t ParseGrp15(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2416 { 2417 size_t size = 0; 2380 return disParseInstruction(offInstr, pOp, pDis, size); 2381 } 2382 //***************************************************************************** 2383 //***************************************************************************** 2384 static size_t ParseGrp15(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2385 { 2418 2386 NOREF(pParam); 2419 2387 2420 u nsignedmodrm = disReadByte(pDis, offInstr);2421 u nsignedmod = MODRM_MOD(modrm);2422 u nsignedreg = MODRM_REG(modrm);2423 u nsignedrm = MODRM_RM(modrm);2388 uint8_t modrm = disReadByte(pDis, offInstr); 2389 uint8_t mod = MODRM_MOD(modrm); 2390 uint8_t reg = MODRM_REG(modrm); 2391 uint8_t rm = MODRM_RM(modrm); 2424 2392 2425 2393 if (mod == 3 && rm == 0) … … 2429 2397 2430 2398 //little hack to make sure the ModRM byte is included in the returned size 2399 size_t size = 0; 2431 2400 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) 2432 2401 size = sizeof(uint8_t); //ModRM byte 2433 2402 2434 size += disParseInstruction(offInstr, pOp, pDis); 2435 return size; 2436 } 2437 //***************************************************************************** 2438 //***************************************************************************** 2439 static size_t ParseGrp16(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISSTATE pDis) 2440 { 2403 return disParseInstruction(offInstr, pOp, pDis, size); 2404 } 2405 //***************************************************************************** 2406 //***************************************************************************** 2407 static size_t ParseGrp16(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 2408 { 2409 NOREF(pParam); 2410 2411 uint8_t modrm = disReadByte(pDis, offInstr); 2412 pOp = &g_aMapX86_Group16[MODRM_REG(modrm)]; 2413 2414 //little hack to make sure the ModRM byte is included in the returned size 2441 2415 size_t size = 0; 2442 NOREF(pParam);2443 2444 unsigned modrm = disReadByte(pDis, offInstr);2445 unsigned reg = MODRM_REG(modrm);2446 2447 pOp = &g_aMapX86_Group16[reg];2448 2449 //little hack to make sure the ModRM byte is included in the returned size2450 2416 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) 2451 2417 size = sizeof(uint8_t); //ModRM byte 2452 2418 2453 size += disParseInstruction(offInstr, pOp, pDis); 2454 return size; 2419 return disParseInstruction(offInstr, pOp, pDis, size); 2455 2420 } 2456 2421 … … 2564 2529 if (opcode != OP_REX) 2565 2530 { 2566 /* *Last prefix byte (for SSE2 extension tables); don't include the REX prefix */2531 /* Last prefix byte (for SSE2 extension tables); don't include the REX prefix */ 2567 2532 pDis->bLastPrefix = opcode; 2568 2533 pDis->fPrefix &= ~DISPREFIX_REX; … … 2636 2601 pDis->bOpCode = codebyte; 2637 2602 pDis->cbPrefix = (uint8_t)offInstr - 1; 2638 offInstr += disParseInstruction(offInstr, &paOneByteMap[pDis->bOpCode], pDis);2603 offInstr = disParseInstruction(offInstr, &paOneByteMap[pDis->bOpCode], pDis, offInstr); 2639 2604 break; 2640 2605 }
Note:
See TracChangeset
for help on using the changeset viewer.