Changeset 41787 in vbox for trunk/src/VBox/Disassembler
- Timestamp:
- Jun 16, 2012 8:08:56 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmCore.cpp
r41786 r41787 313 313 } 314 314 315 disReadMore(pCpu, offInstr, 1);315 disReadMore(pCpu, (uint8_t)offInstr, 1); 316 316 return pCpu->abInstr[offInstr]; 317 317 } … … 353 353 } 354 354 355 disReadMore(pCpu, offInstr, 2);355 disReadMore(pCpu, (uint8_t)offInstr, 2); 356 356 #ifdef DIS_HOST_UNALIGNED_ACCESS_OK 357 357 return *(uint16_t const *)&pCpu->abInstr[offInstr]; … … 409 409 } 410 410 411 disReadMore(pCpu, offInstr, 4);411 disReadMore(pCpu, (uint8_t)offInstr, 4); 412 412 #ifdef DIS_HOST_UNALIGNED_ACCESS_OK 413 413 return *(uint32_t const *)&pCpu->abInstr[offInstr]; … … 481 481 } 482 482 483 disReadMore(pCpu, offInstr, 8);483 disReadMore(pCpu, (uint8_t)offInstr, 8); 484 484 #ifdef DIS_HOST_UNALIGNED_ACCESS_OK 485 485 return *(uint64_t const *)&pCpu->abInstr[offInstr]; … … 519 519 //***************************************************************************** 520 520 //***************************************************************************** 521 static unsigneddisParseInstruction(size_t offInstr, PCDISOPCODE pOp, PDISCPUSTATE pCpu)522 { 523 intsize = 0;521 static size_t disParseInstruction(size_t offInstr, PCDISOPCODE pOp, PDISCPUSTATE pCpu) 522 { 523 size_t size = 0; 524 524 bool fFiltered = false; 525 525 … … 595 595 int index; 596 596 PCDISOPCODE fpop; 597 unsignedsize = 0;597 size_t size = 0; 598 598 unsigned ModRM; 599 599 NOREF(pOp); … … 948 948 // Query the size of the ModRM parameters and fetch the immediate data (if any) 949 949 //***************************************************************************** 950 static unsigned QueryModRM(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu, unsigned*pSibInc)951 { 952 unsignedsibinc;953 unsignedsize = 0;950 static size_t QueryModRM(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu, size_t *pSibInc) 951 { 952 size_t sibinc; 953 size_t size = 0; 954 954 // unsigned reg = pCpu->ModRM.Bits.Reg; 955 955 unsigned mod = pCpu->ModRM.Bits.Mod; … … 1031 1031 // Query the size of the ModRM parameters and fetch the immediate data (if any) 1032 1032 //***************************************************************************** 1033 static unsigned QueryModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu, unsigned*pSibInc)1034 { 1035 unsignedsibinc;1036 unsignedsize = 0;1033 static size_t QueryModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu, size_t *pSibInc) 1034 { 1035 size_t sibinc; 1036 size_t size = 0; 1037 1037 // unsigned reg = pCpu->ModRM.Bits.Reg; 1038 1038 unsigned mod = pCpu->ModRM.Bits.Mod; … … 1116 1116 static size_t ParseModRM(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 1117 1117 { 1118 unsignedsize = sizeof(uint8_t); //ModRM byte1119 unsigned sibinc, ModRM;1120 1121 ModRM = disReadByte(pCpu, offInstr);1118 size_t size = sizeof(uint8_t); //ModRM byte 1119 size_t sibinc; 1120 1121 unsigned ModRM = disReadByte(pCpu, offInstr); 1122 1122 offInstr += sizeof(uint8_t); 1123 1123 … … 1162 1162 static size_t ParseModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 1163 1163 { 1164 unsignedsize = sizeof(uint8_t); //ModRM byte1165 unsigned sibinc, ModRM;1166 1167 ModRM = disReadByte(pCpu, offInstr);1164 size_t size = sizeof(uint8_t); //ModRM byte 1165 size_t sibinc; 1166 1167 unsigned ModRM = disReadByte(pCpu, offInstr); 1168 1168 offInstr += sizeof(uint8_t); 1169 1169 … … 1793 1793 { 1794 1794 PCDISOPCODE pOpcode; 1795 intsize = sizeof(uint8_t);1795 size_t size = sizeof(uint8_t); 1796 1796 NOREF(pOp); NOREF(pParam); 1797 1797 … … 1852 1852 { 1853 1853 PCDISOPCODE pOpcode; 1854 intsize = sizeof(uint8_t);1854 size_t size = sizeof(uint8_t); 1855 1855 NOREF(pOp); NOREF(pParam); 1856 1856 … … 1913 1913 { 1914 1914 PCDISOPCODE pOpcode; 1915 intsize = sizeof(uint8_t);1915 size_t size = sizeof(uint8_t); 1916 1916 NOREF(pOp); NOREF(pParam); 1917 1917 … … 1947 1947 static size_t ParseNopPause(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 1948 1948 { 1949 unsignedsize = 0;1949 size_t size = 0; 1950 1950 NOREF(pParam); 1951 1951 … … 1966 1966 { 1967 1967 int idx = (pCpu->bOpCode - 0x80) * 8; 1968 unsigned size = 0, modrm, reg;1968 size_t size = 0; 1969 1969 NOREF(pParam); 1970 1970 1971 modrm = disReadByte(pCpu, offInstr);1972 reg = MODRM_REG(modrm);1971 unsigned modrm = disReadByte(pCpu, offInstr); 1972 unsigned reg = MODRM_REG(modrm); 1973 1973 1974 1974 pOp = (PCDISOPCODE)&g_aMapX86_Group1[idx+reg]; … … 1986 1986 { 1987 1987 int idx; 1988 unsigned size = 0, modrm, reg;1988 size_t size = 0; 1989 1989 NOREF(pParam); 1990 1990 … … 2008 2008 } 2009 2009 2010 modrm = disReadByte(pCpu, offInstr);2011 reg = MODRM_REG(modrm);2012 2013 pOp = (PCDISOPCODE)&g_aMapX86_Group2[idx+reg];2010 unsigned modrm = disReadByte(pCpu, offInstr); 2011 unsigned reg = MODRM_REG(modrm); 2012 2013 pOp = &g_aMapX86_Group2[idx+reg]; 2014 2014 2015 2015 //little hack to make sure the ModRM byte is included in the returned size … … 2026 2026 { 2027 2027 int idx = (pCpu->bOpCode - 0xF6) * 8; 2028 unsigned size = 0, modrm, reg;2028 size_t size = 0; 2029 2029 NOREF(pParam); 2030 2030 2031 modrm = disReadByte(pCpu, offInstr);2032 reg = MODRM_REG(modrm);2031 unsigned modrm = disReadByte(pCpu, offInstr); 2032 unsigned reg = MODRM_REG(modrm); 2033 2033 2034 2034 pOp = (PCDISOPCODE)&g_aMapX86_Group3[idx+reg]; … … 2046 2046 static size_t ParseGrp4(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2047 2047 { 2048 unsigned size = 0, modrm, reg;2048 size_t size = 0; 2049 2049 NOREF(pParam); 2050 2050 2051 modrm = disReadByte(pCpu, offInstr);2052 reg = MODRM_REG(modrm);2051 unsigned modrm = disReadByte(pCpu, offInstr); 2052 unsigned reg = MODRM_REG(modrm); 2053 2053 2054 2054 pOp = (PCDISOPCODE)&g_aMapX86_Group4[reg]; … … 2066 2066 static size_t ParseGrp5(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2067 2067 { 2068 unsigned size = 0, modrm, reg;2068 size_t size = 0; 2069 2069 NOREF(pParam); 2070 2070 2071 modrm = disReadByte(pCpu, offInstr);2072 reg = MODRM_REG(modrm);2071 unsigned modrm = disReadByte(pCpu, offInstr); 2072 unsigned reg = MODRM_REG(modrm); 2073 2073 2074 2074 pOp = (PCDISOPCODE)&g_aMapX86_Group5[reg]; … … 2090 2090 static size_t Parse3DNow(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2091 2091 { 2092 unsigned size = 0, modrmsize;2092 size_t size = 0; 2093 2093 2094 2094 #ifdef DEBUG_Sander … … 2102 2102 pCpu->ModRM.Bits.Reg = MODRM_REG(ModRM); 2103 2103 2104 modrmsize = QueryModRM(offInstr+sizeof(uint8_t), pOp, pParam, pCpu, NULL);2104 size_t modrmsize = QueryModRM(offInstr+sizeof(uint8_t), pOp, pParam, pCpu, NULL); 2105 2105 2106 2106 uint8_t opcode = disReadByte(pCpu, offInstr+sizeof(uint8_t)+modrmsize); … … 2126 2126 static size_t ParseGrp6(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2127 2127 { 2128 unsigned size = 0, modrm, reg;2128 size_t size = 0; 2129 2129 NOREF(pParam); 2130 2130 2131 modrm = disReadByte(pCpu, offInstr);2132 reg = MODRM_REG(modrm);2131 unsigned modrm = disReadByte(pCpu, offInstr); 2132 unsigned reg = MODRM_REG(modrm); 2133 2133 2134 2134 pOp = (PCDISOPCODE)&g_aMapX86_Group6[reg]; … … 2146 2146 static size_t ParseGrp7(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2147 2147 { 2148 unsigned size = 0, modrm, reg, rm, mod;2148 size_t size = 0; 2149 2149 NOREF(pParam); 2150 2150 2151 modrm = disReadByte(pCpu, offInstr);2152 mod = MODRM_MOD(modrm);2153 reg = MODRM_REG(modrm);2154 rm = MODRM_RM(modrm);2151 unsigned modrm = disReadByte(pCpu, offInstr); 2152 unsigned mod = MODRM_MOD(modrm); 2153 unsigned reg = MODRM_REG(modrm); 2154 unsigned rm = MODRM_RM(modrm); 2155 2155 2156 2156 if (mod == 3 && rm == 0) … … 2174 2174 static size_t ParseGrp8(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2175 2175 { 2176 unsigned size = 0, modrm, reg;2176 size_t size = 0; 2177 2177 NOREF(pParam); 2178 2178 2179 modrm = disReadByte(pCpu, offInstr);2180 reg = MODRM_REG(modrm);2179 unsigned modrm = disReadByte(pCpu, offInstr); 2180 unsigned reg = MODRM_REG(modrm); 2181 2181 2182 2182 pOp = (PCDISOPCODE)&g_aMapX86_Group8[reg]; … … 2194 2194 static size_t ParseGrp9(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2195 2195 { 2196 unsigned size = 0, modrm, reg;2196 size_t size = 0; 2197 2197 NOREF(pParam); 2198 2198 2199 modrm = disReadByte(pCpu, offInstr);2200 reg = MODRM_REG(modrm);2199 unsigned modrm = disReadByte(pCpu, offInstr); 2200 unsigned reg = MODRM_REG(modrm); 2201 2201 2202 2202 pOp = (PCDISOPCODE)&g_aMapX86_Group9[reg]; … … 2214 2214 static size_t ParseGrp10(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2215 2215 { 2216 unsigned size = 0, modrm, reg;2216 size_t size = 0; 2217 2217 NOREF(pParam); 2218 2218 2219 modrm = disReadByte(pCpu, offInstr);2220 reg = MODRM_REG(modrm);2219 unsigned modrm = disReadByte(pCpu, offInstr); 2220 unsigned reg = MODRM_REG(modrm); 2221 2221 2222 2222 pOp = (PCDISOPCODE)&g_aMapX86_Group10[reg]; … … 2234 2234 static size_t ParseGrp12(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2235 2235 { 2236 unsigned size = 0, modrm, reg;2236 size_t size = 0; 2237 2237 NOREF(pParam); 2238 2238 2239 modrm = disReadByte(pCpu, offInstr);2240 reg = MODRM_REG(modrm);2239 unsigned modrm = disReadByte(pCpu, offInstr); 2240 unsigned reg = MODRM_REG(modrm); 2241 2241 2242 2242 if (pCpu->fPrefix & DISPREFIX_OPSIZE) … … 2256 2256 static size_t ParseGrp13(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2257 2257 { 2258 unsigned size = 0, modrm, reg;2258 size_t size = 0; 2259 2259 NOREF(pParam); 2260 2260 2261 modrm = disReadByte(pCpu, offInstr);2262 reg = MODRM_REG(modrm);2261 unsigned modrm = disReadByte(pCpu, offInstr); 2262 unsigned reg = MODRM_REG(modrm); 2263 2263 if (pCpu->fPrefix & DISPREFIX_OPSIZE) 2264 2264 reg += 8; //2nd table … … 2278 2278 static size_t ParseGrp14(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2279 2279 { 2280 unsigned size = 0, modrm, reg;2280 size_t size = 0; 2281 2281 NOREF(pParam); 2282 2282 2283 modrm = disReadByte(pCpu, offInstr);2284 reg = MODRM_REG(modrm);2283 unsigned modrm = disReadByte(pCpu, offInstr); 2284 unsigned reg = MODRM_REG(modrm); 2285 2285 if (pCpu->fPrefix & DISPREFIX_OPSIZE) 2286 2286 reg += 8; //2nd table … … 2300 2300 static size_t ParseGrp15(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2301 2301 { 2302 unsigned size = 0, modrm, reg, mod, rm;2302 size_t size = 0; 2303 2303 NOREF(pParam); 2304 2304 2305 modrm = disReadByte(pCpu, offInstr);2306 mod = MODRM_MOD(modrm);2307 reg = MODRM_REG(modrm);2308 rm = MODRM_RM(modrm);2305 unsigned modrm = disReadByte(pCpu, offInstr); 2306 unsigned mod = MODRM_MOD(modrm); 2307 unsigned reg = MODRM_REG(modrm); 2308 unsigned rm = MODRM_RM(modrm); 2309 2309 2310 2310 if (mod == 3 && rm == 0) … … 2324 2324 static size_t ParseGrp16(size_t offInstr, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu) 2325 2325 { 2326 unsigned size = 0, modrm, reg;2326 size_t size = 0; 2327 2327 NOREF(pParam); 2328 2328 2329 modrm = disReadByte(pCpu, offInstr);2330 reg = MODRM_REG(modrm);2329 unsigned modrm = disReadByte(pCpu, offInstr); 2330 unsigned reg = MODRM_REG(modrm); 2331 2331 2332 2332 pOp = (PCDISOPCODE)&g_aMapX86_Group16[reg]; … … 2630 2630 } 2631 2631 2632 pCpu->cbInstr = offInstr;2632 pCpu->cbInstr = (uint8_t)offInstr; 2633 2633 if (pcbInstr) 2634 *pcbInstr = offInstr;2634 *pcbInstr = (uint32_t)offInstr; 2635 2635 2636 2636 if (pCpu->fPrefix & DISPREFIX_LOCK)
Note:
See TracChangeset
for help on using the changeset viewer.