- Timestamp:
- Aug 18, 2008 11:51:27 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 34906
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmCore.cpp
r11406 r11460 404 404 return VINF_SUCCESS; 405 405 } 406 //***************************************************************************** 407 //***************************************************************************** 408 unsigned ParseInstruction(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu) 409 { 410 int size = 0; 411 bool fFiltered = false; 412 413 // Store the opcode format string for disasmPrintf 414 #ifndef DIS_CORE_ONLY 415 pCpu->pszOpcode = pOp->pszOpcode; 416 #endif 417 pCpu->pCurInstr = pOp; 418 419 /* 420 * Apply filter to instruction type to determine if a full disassembly is required. 421 * @note Multibyte opcodes are always marked harmless until the final byte. 422 */ 423 if ((pOp->optype & pCpu->uFilter) == 0) 424 { 425 fFiltered = true; 426 pCpu->pfnDisasmFnTable = pfnCalcSize; 427 } 428 else 429 { 430 /* Not filtered out -> full disassembly */ 431 pCpu->pfnDisasmFnTable = pfnFullDisasm; 432 } 433 434 // Should contain the parameter type on input 435 pCpu->param1.param = pOp->param1; 436 pCpu->param2.param = pOp->param2; 437 pCpu->param3.param = pOp->param3; 438 406 /**************************************************************************************/ 407 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 408 /**************************************************************************************/ 409 static void CheckForceFlags(PDISCPUSTATE pCpu, PCOPCODE pOp) 410 { 439 411 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 440 412 if (pCpu->mode == CPUMODE_64BIT) … … 447 419 pCpu->opsize = CPUMODE_64BIT; 448 420 } 421 } 422 //***************************************************************************** 423 //***************************************************************************** 424 unsigned ParseInstruction(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu) 425 { 426 int size = 0; 427 bool fFiltered = false; 428 429 // Store the opcode format string for disasmPrintf 430 #ifndef DIS_CORE_ONLY 431 pCpu->pszOpcode = pOp->pszOpcode; 432 #endif 433 pCpu->pCurInstr = pOp; 434 435 /* 436 * Apply filter to instruction type to determine if a full disassembly is required. 437 * @note Multibyte opcodes are always marked harmless until the final byte. 438 */ 439 if ((pOp->optype & pCpu->uFilter) == 0) 440 { 441 fFiltered = true; 442 pCpu->pfnDisasmFnTable = pfnCalcSize; 443 } 444 else 445 { 446 /* Not filtered out -> full disassembly */ 447 pCpu->pfnDisasmFnTable = pfnFullDisasm; 448 } 449 450 // Should contain the parameter type on input 451 pCpu->param1.param = pOp->param1; 452 pCpu->param2.param = pOp->param2; 453 pCpu->param3.param = pOp->param3; 454 455 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 456 CheckForceFlags(pCpu, pOp); 449 457 450 458 if (pOp->idxParse1 != IDX_ParseNop) … … 1792 1800 pOp = &g_aMapX86_NopPause[0]; /* NOP */ 1793 1801 1802 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 1803 CheckForceFlags(pCpu, pOp); 1804 1794 1805 size += ParseInstruction(pu8CodeBlock, pOp, pCpu); 1795 1806 return size; … … 1809 1820 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) 1810 1821 size = sizeof(uint8_t); //ModRM byte 1822 1823 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 1824 CheckForceFlags(pCpu, pOp); 1811 1825 1812 1826 size += ParseInstruction(lpszCodeBlock, pOp, pCpu); … … 1845 1859 pOp = (PCOPCODE)&g_aMapX86_Group2[idx+reg]; 1846 1860 1861 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 1862 CheckForceFlags(pCpu, pOp); 1863 1847 1864 //little hack to make sure the ModRM byte is included in the returned size 1848 1865 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 1865 1882 pOp = (PCOPCODE)&g_aMapX86_Group3[idx+reg]; 1866 1883 1884 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 1885 CheckForceFlags(pCpu, pOp); 1886 1867 1887 //little hack to make sure the ModRM byte is included in the returned size 1868 1888 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 1884 1904 pOp = (PCOPCODE)&g_aMapX86_Group4[reg]; 1885 1905 1906 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 1907 CheckForceFlags(pCpu, pOp); 1908 1886 1909 //little hack to make sure the ModRM byte is included in the returned size 1887 1910 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 1902 1925 1903 1926 pOp = (PCOPCODE)&g_aMapX86_Group5[reg]; 1927 1928 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 1929 CheckForceFlags(pCpu, pOp); 1904 1930 1905 1931 //little hack to make sure the ModRM byte is included in the returned size … … 1937 1963 pOp = (PCOPCODE)&g_aTwoByteMapX86_3DNow[opcode]; 1938 1964 1965 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 1966 CheckForceFlags(pCpu, pOp); 1967 1939 1968 //little hack to make sure the ModRM byte is included in the returned size 1940 1969 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 1962 1991 pOp = (PCOPCODE)&g_aMapX86_Group6[reg]; 1963 1992 1993 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 1994 CheckForceFlags(pCpu, pOp); 1995 1964 1996 //little hack to make sure the ModRM byte is included in the returned size 1965 1997 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 1989 2021 pOp = (PCOPCODE)&g_aMapX86_Group7_mem[reg]; 1990 2022 2023 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 2024 CheckForceFlags(pCpu, pOp); 2025 1991 2026 //little hack to make sure the ModRM byte is included in the returned size 1992 2027 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2008 2043 pOp = (PCOPCODE)&g_aMapX86_Group8[reg]; 2009 2044 2045 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 2046 CheckForceFlags(pCpu, pOp); 2047 2010 2048 //little hack to make sure the ModRM byte is included in the returned size 2011 2049 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2027 2065 pOp = (PCOPCODE)&g_aMapX86_Group9[reg]; 2028 2066 2067 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 2068 CheckForceFlags(pCpu, pOp); 2069 2029 2070 //little hack to make sure the ModRM byte is included in the returned size 2030 2071 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2046 2087 pOp = (PCOPCODE)&g_aMapX86_Group10[reg]; 2047 2088 2089 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 2090 CheckForceFlags(pCpu, pOp); 2091 2048 2092 //little hack to make sure the ModRM byte is included in the returned size 2049 2093 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2067 2111 2068 2112 pOp = (PCOPCODE)&g_aMapX86_Group12[reg]; 2113 2114 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 2115 CheckForceFlags(pCpu, pOp); 2069 2116 2070 2117 //little hack to make sure the ModRM byte is included in the returned size … … 2088 2135 pOp = (PCOPCODE)&g_aMapX86_Group13[reg]; 2089 2136 2137 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 2138 CheckForceFlags(pCpu, pOp); 2139 2090 2140 //little hack to make sure the ModRM byte is included in the returned size 2091 2141 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2109 2159 pOp = (PCOPCODE)&g_aMapX86_Group14[reg]; 2110 2160 2161 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 2162 CheckForceFlags(pCpu, pOp); 2163 2111 2164 //little hack to make sure the ModRM byte is included in the returned size 2112 2165 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2133 2186 pOp = (PCOPCODE)&g_aMapX86_Group15_mem[reg]; 2134 2187 2188 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 2189 CheckForceFlags(pCpu, pOp); 2190 2135 2191 //little hack to make sure the ModRM byte is included in the returned size 2136 2192 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2150 2206 2151 2207 pOp = (PCOPCODE)&g_aMapX86_Group16[reg]; 2208 2209 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 2210 CheckForceFlags(pCpu, pOp); 2152 2211 2153 2212 //little hack to make sure the ModRM byte is included in the returned size
Note:
See TracChangeset
for help on using the changeset viewer.