- Timestamp:
- Aug 18, 2008 12:26:35 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmCore.cpp
r11460 r11461 404 404 return VINF_SUCCESS; 405 405 } 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 { 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 411 439 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 412 440 if (pCpu->mode == CPUMODE_64BIT) … … 419 447 pCpu->opsize = CPUMODE_64BIT; 420 448 } 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 disasmPrintf430 #ifndef DIS_CORE_ONLY431 pCpu->pszOpcode = pOp->pszOpcode;432 #endif433 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 else445 {446 /* Not filtered out -> full disassembly */447 pCpu->pfnDisasmFnTable = pfnFullDisasm;448 }449 450 // Should contain the parameter type on input451 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);457 449 458 450 if (pOp->idxParse1 != IDX_ParseNop) … … 1800 1792 pOp = &g_aMapX86_NopPause[0]; /* NOP */ 1801 1793 1802 /* Correct the operand size if the instruction is marked as forced or default 64 bits */1803 CheckForceFlags(pCpu, pOp);1804 1805 1794 size += ParseInstruction(pu8CodeBlock, pOp, pCpu); 1806 1795 return size; … … 1820 1809 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) 1821 1810 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);1825 1811 1826 1812 size += ParseInstruction(lpszCodeBlock, pOp, pCpu); … … 1859 1845 pOp = (PCOPCODE)&g_aMapX86_Group2[idx+reg]; 1860 1846 1861 /* Correct the operand size if the instruction is marked as forced or default 64 bits */1862 CheckForceFlags(pCpu, pOp);1863 1864 1847 //little hack to make sure the ModRM byte is included in the returned size 1865 1848 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 1882 1865 pOp = (PCOPCODE)&g_aMapX86_Group3[idx+reg]; 1883 1866 1884 /* Correct the operand size if the instruction is marked as forced or default 64 bits */1885 CheckForceFlags(pCpu, pOp);1886 1887 1867 //little hack to make sure the ModRM byte is included in the returned size 1888 1868 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 1904 1884 pOp = (PCOPCODE)&g_aMapX86_Group4[reg]; 1905 1885 1906 /* Correct the operand size if the instruction is marked as forced or default 64 bits */1907 CheckForceFlags(pCpu, pOp);1908 1909 1886 //little hack to make sure the ModRM byte is included in the returned size 1910 1887 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 1925 1902 1926 1903 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);1930 1904 1931 1905 //little hack to make sure the ModRM byte is included in the returned size … … 1963 1937 pOp = (PCOPCODE)&g_aTwoByteMapX86_3DNow[opcode]; 1964 1938 1965 /* Correct the operand size if the instruction is marked as forced or default 64 bits */1966 CheckForceFlags(pCpu, pOp);1967 1968 1939 //little hack to make sure the ModRM byte is included in the returned size 1969 1940 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 1991 1962 pOp = (PCOPCODE)&g_aMapX86_Group6[reg]; 1992 1963 1993 /* Correct the operand size if the instruction is marked as forced or default 64 bits */1994 CheckForceFlags(pCpu, pOp);1995 1996 1964 //little hack to make sure the ModRM byte is included in the returned size 1997 1965 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2021 1989 pOp = (PCOPCODE)&g_aMapX86_Group7_mem[reg]; 2022 1990 2023 /* Correct the operand size if the instruction is marked as forced or default 64 bits */2024 CheckForceFlags(pCpu, pOp);2025 2026 1991 //little hack to make sure the ModRM byte is included in the returned size 2027 1992 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2043 2008 pOp = (PCOPCODE)&g_aMapX86_Group8[reg]; 2044 2009 2045 /* Correct the operand size if the instruction is marked as forced or default 64 bits */2046 CheckForceFlags(pCpu, pOp);2047 2048 2010 //little hack to make sure the ModRM byte is included in the returned size 2049 2011 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2065 2027 pOp = (PCOPCODE)&g_aMapX86_Group9[reg]; 2066 2028 2067 /* Correct the operand size if the instruction is marked as forced or default 64 bits */2068 CheckForceFlags(pCpu, pOp);2069 2070 2029 //little hack to make sure the ModRM byte is included in the returned size 2071 2030 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2087 2046 pOp = (PCOPCODE)&g_aMapX86_Group10[reg]; 2088 2047 2089 /* Correct the operand size if the instruction is marked as forced or default 64 bits */2090 CheckForceFlags(pCpu, pOp);2091 2092 2048 //little hack to make sure the ModRM byte is included in the returned size 2093 2049 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2111 2067 2112 2068 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);2116 2069 2117 2070 //little hack to make sure the ModRM byte is included in the returned size … … 2135 2088 pOp = (PCOPCODE)&g_aMapX86_Group13[reg]; 2136 2089 2137 /* Correct the operand size if the instruction is marked as forced or default 64 bits */2138 CheckForceFlags(pCpu, pOp);2139 2140 2090 //little hack to make sure the ModRM byte is included in the returned size 2141 2091 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2159 2109 pOp = (PCOPCODE)&g_aMapX86_Group14[reg]; 2160 2110 2161 /* Correct the operand size if the instruction is marked as forced or default 64 bits */2162 CheckForceFlags(pCpu, pOp);2163 2164 2111 //little hack to make sure the ModRM byte is included in the returned size 2165 2112 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2186 2133 pOp = (PCOPCODE)&g_aMapX86_Group15_mem[reg]; 2187 2134 2188 /* Correct the operand size if the instruction is marked as forced or default 64 bits */2189 CheckForceFlags(pCpu, pOp);2190 2191 2135 //little hack to make sure the ModRM byte is included in the returned size 2192 2136 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) … … 2206 2150 2207 2151 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);2211 2152 2212 2153 //little hack to make sure the ModRM byte is included in the returned size
Note:
See TracChangeset
for help on using the changeset viewer.