Changeset 41733 in vbox
- Timestamp:
- Jun 15, 2012 12:11:28 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r41732 r41733 48 48 } DISCPUMODE; 49 49 50 /** @name Prefix byte flags (DISCPUSTATE:: prefix_rex).50 /** @name Prefix byte flags (DISCPUSTATE::fRexPrefix). 51 51 * @{ 52 52 */ … … 68 68 /** @} */ 69 69 70 /** @name 64 bits prefix byte flags (DISCPUSTATE:: prefix_rex).70 /** @name 64 bits prefix byte flags (DISCPUSTATE::fRexPrefix). 71 71 * Requires VBox/disopcode.h. 72 72 * @{ … … 537 537 /* off: 0x070 (112) */ 538 538 /** REX prefix value (64 bits only). */ 539 uint8_t prefix_rex;539 uint8_t fRexPrefix; 540 540 /** Segment prefix value (DISSELREG). */ 541 541 uint8_t idxSegPrefix; 542 542 /** Last prefix byte (for SSE2 extension tables). */ 543 uint8_t lastprefix;543 uint8_t bLastPrefix; 544 544 /** First opcode byte of instruction. */ 545 uint8_t opcode;545 uint8_t bOpCode; 546 546 /* off: 0x074 (116) */ 547 547 /** The size of the prefix bytes. */ -
trunk/src/VBox/Disassembler/DisasmCore.cpp
r41732 r41733 345 345 { 346 346 /** Last prefix byte (for SSE2 extension tables); don't include the REX prefix */ 347 pCpu-> lastprefix = opcode;347 pCpu->bLastPrefix = opcode; 348 348 pCpu->prefix &= ~DISPREFIX_REX; 349 349 } … … 414 414 /* REX prefix byte */ 415 415 pCpu->prefix |= DISPREFIX_REX; 416 pCpu-> prefix_rex = DISPREFIX_REX_OP_2_FLAGS(paOneByteMap[codebyte].param1);416 pCpu->fRexPrefix = DISPREFIX_REX_OP_2_FLAGS(paOneByteMap[codebyte].param1); 417 417 iByte += sizeof(uint8_t); 418 418 419 if (pCpu-> prefix_rex & DISPREFIX_REX_FLAGS_W)419 if (pCpu->fRexPrefix & DISPREFIX_REX_FLAGS_W) 420 420 pCpu->opmode = DISCPUMODE_64BIT; /* overrides size prefix byte */ 421 421 continue; //fetch the next byte … … 426 426 iByte += sizeof(uint8_t); //first opcode byte 427 427 428 pCpu-> opcode = codebyte;429 430 cbInc = disParseInstruction(uInstrAddr + iByte, &paOneByteMap[pCpu-> opcode], pCpu);428 pCpu->bOpCode = codebyte; 429 430 cbInc = disParseInstruction(uInstrAddr + iByte, &paOneByteMap[pCpu->bOpCode], pCpu); 431 431 iByte += cbInc; 432 432 break; … … 527 527 ModRM = disReadByte(pCpu, uCodePtr); 528 528 529 index = pCpu-> opcode - 0xD8;529 index = pCpu->bOpCode - 0xD8; 530 530 if (ModRM <= 0xBF) 531 531 { … … 666 666 /* REX.B extends the Base field if not scaled index + disp32 */ 667 667 if (!(pCpu->SIB.Bits.Base == 5 && pCpu->ModRM.Bits.Mod == 0)) 668 pCpu->SIB.Bits.Base |= ((!!(pCpu-> prefix_rex & DISPREFIX_REX_FLAGS_B)) << 3);669 670 pCpu->SIB.Bits.Index |= ((!!(pCpu-> prefix_rex & DISPREFIX_REX_FLAGS_X)) << 3);668 pCpu->SIB.Bits.Base |= ((!!(pCpu->fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3); 669 670 pCpu->SIB.Bits.Index |= ((!!(pCpu->fRexPrefix & DISPREFIX_REX_FLAGS_X)) << 3); 671 671 } 672 672 … … 698 698 { 699 699 /* REX.B extends the Base field. */ 700 pCpu->SIB.Bits.Base |= ((!!(pCpu-> prefix_rex & DISPREFIX_REX_FLAGS_B)) << 3);700 pCpu->SIB.Bits.Base |= ((!!(pCpu->fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3); 701 701 /* REX.X extends the Index field. */ 702 pCpu->SIB.Bits.Index |= ((!!(pCpu-> prefix_rex & DISPREFIX_REX_FLAGS_X)) << 3);702 pCpu->SIB.Bits.Index |= ((!!(pCpu->fRexPrefix & DISPREFIX_REX_FLAGS_X)) << 3); 703 703 } 704 704 … … 1085 1085 1086 1086 /* REX.R extends the Reg field. */ 1087 pCpu->ModRM.Bits.Reg |= ((!!(pCpu-> prefix_rex & DISPREFIX_REX_FLAGS_R)) << 3);1087 pCpu->ModRM.Bits.Reg |= ((!!(pCpu->fRexPrefix & DISPREFIX_REX_FLAGS_R)) << 3); 1088 1088 1089 1089 /* REX.B extends the Rm field if there is no SIB byte nor a 32 bits displacement */ … … 1094 1094 && pCpu->ModRM.Bits.Rm == 5)) 1095 1095 { 1096 pCpu->ModRM.Bits.Rm |= ((!!(pCpu-> prefix_rex & DISPREFIX_REX_FLAGS_B)) << 3);1096 pCpu->ModRM.Bits.Rm |= ((!!(pCpu->fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3); 1097 1097 } 1098 1098 } … … 1131 1131 1132 1132 /* REX.R extends the Reg field. */ 1133 pCpu->ModRM.Bits.Reg |= ((!!(pCpu-> prefix_rex & DISPREFIX_REX_FLAGS_R)) << 3);1133 pCpu->ModRM.Bits.Reg |= ((!!(pCpu->fRexPrefix & DISPREFIX_REX_FLAGS_R)) << 3); 1134 1134 1135 1135 /* REX.B extends the Rm field if there is no SIB byte nor a 32 bits displacement */ … … 1140 1140 && pCpu->ModRM.Bits.Rm == 5)) 1141 1141 { 1142 pCpu->ModRM.Bits.Rm |= ((!!(pCpu-> prefix_rex & DISPREFIX_REX_FLAGS_B)) << 3);1142 pCpu->ModRM.Bits.Rm |= ((!!(pCpu->fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3); 1143 1143 } 1144 1144 } … … 1571 1571 && pParam == &pCpu->param1 /* ugly assumption that it only applies to the first parameter */ 1572 1572 && (pCpu->prefix & DISPREFIX_REX) 1573 && (pCpu-> prefix_rex & DISPREFIX_REX_FLAGS))1573 && (pCpu->fRexPrefix & DISPREFIX_REX_FLAGS)) 1574 1574 pParam->base.reg_gen += 8; 1575 1575 … … 1615 1615 && pParam == &pCpu->param1 /* ugly assumption that it only applies to the first parameter */ 1616 1616 && (pCpu->prefix & DISPREFIX_REX) 1617 && (pCpu-> prefix_rex & DISPREFIX_REX_FLAGS))1617 && (pCpu->fRexPrefix & DISPREFIX_REX_FLAGS)) 1618 1618 pParam->base.reg_gen += 8; /* least significant byte of R8-R15 */ 1619 1619 } … … 1742 1742 1743 1743 /* 2nd byte */ 1744 pCpu-> opcode = disReadByte(pCpu, uCodePtr);1744 pCpu->bOpCode = disReadByte(pCpu, uCodePtr); 1745 1745 1746 1746 /* default to the non-prefixed table. */ 1747 pOpcode = &g_aTwoByteMapX86[pCpu-> opcode];1747 pOpcode = &g_aTwoByteMapX86[pCpu->bOpCode]; 1748 1748 1749 1749 /* Handle opcode table extensions that rely on the address, repe or repne prefix byte. */ 1750 1750 /** @todo Should we take the first or last prefix byte in case of multiple prefix bytes??? */ 1751 if (pCpu-> lastprefix)1752 { 1753 switch (pCpu-> lastprefix)1751 if (pCpu->bLastPrefix) 1752 { 1753 switch (pCpu->bLastPrefix) 1754 1754 { 1755 1755 case OP_OPSIZE: /* 0x66 */ 1756 if (g_aTwoByteMapX86_PF66[pCpu-> opcode].opcode != OP_INVALID)1756 if (g_aTwoByteMapX86_PF66[pCpu->bOpCode].opcode != OP_INVALID) 1757 1757 { 1758 1758 /* Table entry is valid, so use the extension table. */ 1759 pOpcode = &g_aTwoByteMapX86_PF66[pCpu-> opcode];1759 pOpcode = &g_aTwoByteMapX86_PF66[pCpu->bOpCode]; 1760 1760 1761 1761 /* Cancel prefix changes. */ … … 1766 1766 1767 1767 case OP_REPNE: /* 0xF2 */ 1768 if (g_aTwoByteMapX86_PFF2[pCpu-> opcode].opcode != OP_INVALID)1768 if (g_aTwoByteMapX86_PFF2[pCpu->bOpCode].opcode != OP_INVALID) 1769 1769 { 1770 1770 /* Table entry is valid, so use the extension table. */ 1771 pOpcode = &g_aTwoByteMapX86_PFF2[pCpu-> opcode];1771 pOpcode = &g_aTwoByteMapX86_PFF2[pCpu->bOpCode]; 1772 1772 1773 1773 /* Cancel prefix changes. */ … … 1777 1777 1778 1778 case OP_REPE: /* 0xF3 */ 1779 if (g_aTwoByteMapX86_PFF3[pCpu-> opcode].opcode != OP_INVALID)1779 if (g_aTwoByteMapX86_PFF3[pCpu->bOpCode].opcode != OP_INVALID) 1780 1780 { 1781 1781 /* Table entry is valid, so use the extension table. */ 1782 pOpcode = &g_aTwoByteMapX86_PFF3[pCpu-> opcode];1782 pOpcode = &g_aTwoByteMapX86_PFF3[pCpu->bOpCode]; 1783 1783 1784 1784 /* Cancel prefix changes. */ … … 1801 1801 1802 1802 /* 3rd byte */ 1803 pCpu-> opcode = disReadByte(pCpu, uCodePtr);1803 pCpu->bOpCode = disReadByte(pCpu, uCodePtr); 1804 1804 1805 1805 /* default to the non-prefixed table. */ 1806 if (g_apThreeByteMapX86_0F38[pCpu-> opcode >> 4])1807 { 1808 pOpcode = g_apThreeByteMapX86_0F38[pCpu-> opcode >> 4];1809 pOpcode = &pOpcode[pCpu-> opcode & 0xf];1806 if (g_apThreeByteMapX86_0F38[pCpu->bOpCode >> 4]) 1807 { 1808 pOpcode = g_apThreeByteMapX86_0F38[pCpu->bOpCode >> 4]; 1809 pOpcode = &pOpcode[pCpu->bOpCode & 0xf]; 1810 1810 } 1811 1811 else … … 1814 1814 /* Handle opcode table extensions that rely on the address, repne prefix byte. */ 1815 1815 /** @todo Should we take the first or last prefix byte in case of multiple prefix bytes??? */ 1816 switch (pCpu-> lastprefix)1816 switch (pCpu->bLastPrefix) 1817 1817 { 1818 1818 case OP_OPSIZE: /* 0x66 */ 1819 if (g_apThreeByteMapX86_660F38[pCpu-> opcode >> 4])1819 if (g_apThreeByteMapX86_660F38[pCpu->bOpCode >> 4]) 1820 1820 { 1821 pOpcode = g_apThreeByteMapX86_660F38[pCpu-> opcode >> 4];1822 pOpcode = &pOpcode[pCpu-> opcode & 0xf];1821 pOpcode = g_apThreeByteMapX86_660F38[pCpu->bOpCode >> 4]; 1822 pOpcode = &pOpcode[pCpu->bOpCode & 0xf]; 1823 1823 1824 1824 if (pOpcode->opcode != OP_INVALID) … … 1834 1834 1835 1835 case OP_REPNE: /* 0xF2 */ 1836 if (g_apThreeByteMapX86_F20F38[pCpu-> opcode >> 4])1836 if (g_apThreeByteMapX86_F20F38[pCpu->bOpCode >> 4]) 1837 1837 { 1838 pOpcode = g_apThreeByteMapX86_F20F38[pCpu-> opcode >> 4];1839 pOpcode = &pOpcode[pCpu-> opcode & 0xf];1838 pOpcode = g_apThreeByteMapX86_F20F38[pCpu->bOpCode >> 4]; 1839 pOpcode = &pOpcode[pCpu->bOpCode & 0xf]; 1840 1840 1841 1841 if (pOpcode->opcode != OP_INVALID) … … 1862 1862 1863 1863 /* 3rd byte */ 1864 pCpu-> opcode = disReadByte(pCpu, uCodePtr);1864 pCpu->bOpCode = disReadByte(pCpu, uCodePtr); 1865 1865 1866 1866 /** @todo Should we take the first or last prefix byte in case of multiple prefix bytes??? */ 1867 Assert(pCpu-> lastprefix == OP_OPSIZE);1867 Assert(pCpu->bLastPrefix == OP_OPSIZE); 1868 1868 1869 1869 /* default to the non-prefixed table. */ 1870 if (g_apThreeByteMapX86_660F3A[pCpu-> opcode >> 4])1871 { 1872 pOpcode = g_apThreeByteMapX86_660F3A[pCpu-> opcode >> 4];1873 pOpcode = &pOpcode[pCpu-> opcode & 0xf];1870 if (g_apThreeByteMapX86_660F3A[pCpu->bOpCode >> 4]) 1871 { 1872 pOpcode = g_apThreeByteMapX86_660F3A[pCpu->bOpCode >> 4]; 1873 pOpcode = &pOpcode[pCpu->bOpCode & 0xf]; 1874 1874 1875 1875 if (pOpcode->opcode != OP_INVALID) … … 1910 1910 unsigned ParseImmGrpl(RTUINTPTR uCodePtr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 1911 1911 { 1912 int idx = (pCpu-> opcode - 0x80) * 8;1912 int idx = (pCpu->bOpCode - 0x80) * 8; 1913 1913 unsigned size = 0, modrm, reg; 1914 1914 NOREF(pParam); … … 1934 1934 NOREF(pParam); 1935 1935 1936 switch (pCpu-> opcode)1936 switch (pCpu->bOpCode) 1937 1937 { 1938 1938 case 0xC0: 1939 1939 case 0xC1: 1940 idx = (pCpu-> opcode - 0xC0)*8;1940 idx = (pCpu->bOpCode - 0xC0)*8; 1941 1941 break; 1942 1942 … … 1945 1945 case 0xD2: 1946 1946 case 0xD3: 1947 idx = (pCpu-> opcode - 0xD0 + 2)*8;1947 idx = (pCpu->bOpCode - 0xD0 + 2)*8; 1948 1948 break; 1949 1949 … … 1970 1970 unsigned ParseGrp3(RTUINTPTR uCodePtr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 1971 1971 { 1972 int idx = (pCpu-> opcode - 0xF6) * 8;1972 int idx = (pCpu->bOpCode - 0xF6) * 8; 1973 1973 unsigned size = 0, modrm, reg; 1974 1974 NOREF(pParam); -
trunk/src/VBox/Disassembler/DisasmFormatYasm.cpp
r41732 r41733 494 494 */ 495 495 case OP_NOP: 496 if (pCpu-> opcode == 0x90)496 if (pCpu->bOpCode == 0x90) 497 497 /* fine, fine */; 498 498 else if (pszFmt[sizeof("nop %Ev") - 1] == '/' && pszFmt[sizeof("nop %Ev")] == 'p') 499 499 pszFmt = "prefetch %Eb"; 500 else if (pCpu-> opcode == 0x1f)500 else if (pCpu->bOpCode == 0x1f) 501 501 { 502 502 Assert(pCpu->cbInstr >= 3); … … 542 542 */ 543 543 case OP_FLD: 544 if (pCpu-> opcode == 0xdb) /* m80fp workaround. */544 if (pCpu->bOpCode == 0xdb) /* m80fp workaround. */ 545 545 *(int *)&pCpu->param1.param &= ~0x1f; /* make it pure OP_PARM_M */ 546 546 break; … … 1422 1422 1423 1423 /* 82 (see table A-6). */ 1424 if (pCpu-> opcode == 0x82)1424 if (pCpu->bOpCode == 0x82) 1425 1425 return true; 1426 1426 break; … … 1433 1433 case OP_POP: 1434 1434 case OP_PUSH: 1435 Assert(pCpu-> opcode == 0x8f);1435 Assert(pCpu->bOpCode == 0x8f); 1436 1436 return true; 1437 1437 1438 1438 case OP_MOV: 1439 if ( pCpu-> opcode == 0x8a1440 || pCpu-> opcode == 0x8b)1439 if ( pCpu->bOpCode == 0x8a 1440 || pCpu->bOpCode == 0x8b) 1441 1441 return true; 1442 1442 break; … … 1465 1465 1466 1466 /* And some more - see table A-6. */ 1467 if (pCpu-> opcode == 0x82)1467 if (pCpu->bOpCode == 0x82) 1468 1468 { 1469 1469 switch (pCpu->pCurInstr->opcode) … … 1505 1505 case OP_SETLE: 1506 1506 case OP_SETNLE: 1507 AssertMsg(pCpu-> opcode >= 0x90 && pCpu->opcode <= 0x9f, ("%#x\n", pCpu->opcode));1507 AssertMsg(pCpu->bOpCode >= 0x90 && pCpu->bOpCode <= 0x9f, ("%#x\n", pCpu->bOpCode)); 1508 1508 if (pCpu->ModRM.Bits.Reg != 2) 1509 1509 return true; … … 1516 1516 */ 1517 1517 if ( pCpu->pCurInstr->opcode == OP_MOVZX 1518 && pCpu-> opcode == 0xB71518 && pCpu->bOpCode == 0xB7 1519 1519 && (pCpu->mode == DISCPUMODE_16BIT) != !!(fPrefixes & DISPREFIX_OPSIZE)) 1520 1520 return true; -
trunk/src/VBox/Disassembler/testcase/tstDisasm-2.cpp
r41675 r41733 144 144 /* The 0x8f /0 variant of this instruction doesn't get its /r value verified. */ 145 145 case OP_POP: 146 if ( pCpu-> opcode == 0x8f146 if ( pCpu->bOpCode == 0x8f 147 147 && pCpu->ModRM.Bits.Reg != 0) 148 148 return false; … … 151 151 /* The 0xc6 /0 and 0xc7 /0 variants of this instruction don't get their /r values verified. */ 152 152 case OP_MOV: 153 if ( ( pCpu-> opcode == 0xc6154 || pCpu-> opcode == 0xc7)153 if ( ( pCpu->bOpCode == 0xc6 154 || pCpu->bOpCode == 0xc7) 155 155 && pCpu->ModRM.Bits.Reg != 0) 156 156 return false; -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r41675 r41733 110 110 && !(pDis->prefix & (DISPREFIX_REPNE | DISPREFIX_REP | DISPREFIX_SEG))) 111 111 { 112 switch (pDis-> opcode)112 switch (pDis->bOpCode) 113 113 { 114 114 /** @todo Find other instructions we can safely skip, possibly
Note:
See TracChangeset
for help on using the changeset viewer.