Changeset 41690 in vbox
- Timestamp:
- Jun 13, 2012 6:12:25 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r41678 r41690 442 442 443 443 444 /** Pointer to opcode. */445 typedef struct OPCODE *POPCODE;446 444 /** Pointer to const opcode. */ 447 typedef const struct OPCODE *PCOPCODE;445 typedef const struct DISOPCODE *PCDISOPCODE; 448 446 449 447 /** … … 464 462 /** Parser callback. 465 463 * @remark no DECLCALLBACK() here because it's considered to be internal (really, I'm too lazy to update all the functions). */ 466 typedef unsigned FNDISPARSE(RTUINTPTR pu8CodeBlock, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);464 typedef unsigned FNDISPARSE(RTUINTPTR pu8CodeBlock, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 467 465 typedef FNDISPARSE *PFNDISPARSE; 468 466 … … 538 536 539 537 /** Pointer to the current instruction. */ 540 PC OPCODEpCurInstr;538 PCDISOPCODE pCurInstr; 541 539 #ifndef DIS_CORE_ONLY 542 540 /** Opcode format string for current instruction. */ … … 558 556 /** Opcode. */ 559 557 #pragma pack(4) 560 typedef struct OPCODE558 typedef struct DISOPCODE 561 559 { 562 560 #ifndef DIS_CORE_ONLY … … 571 569 uint16_t param3; 572 570 573 u nsignedoptype;574 } OPCODE;571 uint32_t optype; 572 } DISOPCODE; 575 573 #pragma pack() 576 574 -
trunk/src/VBox/Disassembler/Disasm.cpp
r41676 r41690 27 27 #include <iprt/string.h> 28 28 #include "DisasmInternal.h" 29 #include "DisasmTables.h"30 29 31 30 -
trunk/src/VBox/Disassembler/DisasmCore.cpp
r41678 r41690 29 29 #include <iprt/stdarg.h> 30 30 #include "DisasmInternal.h" 31 #include "DisasmTables.h"32 31 33 32 … … 35 34 * Internal Functions * 36 35 *******************************************************************************/ 37 static int disCoreParseInstr(PDISCPUSTATE pCpu, RTUINTPTR uInstrAddr, const OPCODE *paOneByteMap, uint32_t *pcbInstr); 38 39 static unsigned QueryModRM(RTUINTPTR uCodePtr, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, unsigned *pSibInc = NULL); 40 static unsigned QueryModRM_SizeOnly(RTUINTPTR uCodePtr, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, unsigned *pSibInc = NULL); 41 static void UseSIB(RTUINTPTR uCodePtr, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 42 static unsigned ParseSIB_SizeOnly(RTUINTPTR uCodePtr, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 43 44 static void disasmModRMReg(PDISCPUSTATE pCpu, PCOPCODE pOp, unsigned idx, POP_PARAMETER pParam, int fRegAddr); 45 static void disasmModRMReg16(PDISCPUSTATE pCpu, PCOPCODE pOp, unsigned idx, POP_PARAMETER pParam); 46 static void disasmModRMSReg(PDISCPUSTATE pCpu, PCOPCODE pOp, unsigned idx, POP_PARAMETER pParam); 36 static int disInstrWorker(PDISCPUSTATE pCpu, RTUINTPTR uInstrAddr, PCDISOPCODE paOneByteMap, uint32_t *pcbInstr); 37 static unsigned disParseInstruction(RTUINTPTR uCodePtr, PCDISOPCODE pOp, PDISCPUSTATE pCpu); 38 39 static unsigned QueryModRM(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, unsigned *pSibInc = NULL); 40 static unsigned QueryModRM_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, unsigned *pSibInc = NULL); 41 static void UseSIB(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 42 static unsigned ParseSIB_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 43 44 static void disasmModRMReg(PDISCPUSTATE pCpu, PCDISOPCODE pOp, unsigned idx, POP_PARAMETER pParam, int fRegAddr); 45 static void disasmModRMReg16(PDISCPUSTATE pCpu, PCDISOPCODE pOp, unsigned idx, POP_PARAMETER pParam); 46 static void disasmModRMSReg(PDISCPUSTATE pCpu, PCDISOPCODE pOp, unsigned idx, POP_PARAMETER pParam); 47 48 static void disValidateLockSequence(PDISCPUSTATE pCpu); 49 50 /* Read functions */ 51 static uint8_t disReadByte(PDISCPUSTATE pCpu, RTUINTPTR pAddress); 52 static uint16_t disReadWord(PDISCPUSTATE pCpu, RTUINTPTR pAddress); 53 static uint32_t disReadDWord(PDISCPUSTATE pCpu, RTUINTPTR pAddress); 54 static uint64_t disReadQWord(PDISCPUSTATE pCpu, RTUINTPTR pAddress); 55 static DECLCALLBACK(int) disReadBytesDefault(PDISCPUSTATE pCpu, uint8_t *pbDst, RTUINTPTR uSrcAddr, uint32_t cbToRead); 47 56 48 57 … … 105 114 static FNDISPARSE ParseXb; 106 115 107 /* Floating point parsing */116 /** Floating point parsing */ 108 117 static FNDISPARSE ParseEscFP; 109 118 /** @} */ … … 114 123 *******************************************************************************/ 115 124 /** Parser opcode table for full disassembly. */ 116 PFNDISPARSE g_apfnFullDisasm[IDX_ParseMax] =125 static PFNDISPARSE g_apfnFullDisasm[IDX_ParseMax] = 117 126 { 118 127 ParseIllegal, … … 160 169 161 170 /** Parser opcode table for only calculating instruction size. */ 162 PFNDISPARSE g_apfnCalcSize[IDX_ParseMax] =171 static PFNDISPARSE g_apfnCalcSize[IDX_ParseMax] = 163 172 { 164 173 ParseIllegal, … … 275 284 PDISCPUSTATE pCpu, uint32_t *pcbInstr) 276 285 { 277 const OPCODE *paOneByteMap;286 PCDISOPCODE paOneByteMap; 278 287 279 288 /* … … 305 314 pCpu->apvUserData[0] = pvUser; 306 315 307 return dis CoreParseInstr(pCpu, uInstrAddr, paOneByteMap, pcbInstr);316 return disInstrWorker(pCpu, uInstrAddr, paOneByteMap, pcbInstr); 308 317 } 309 318 310 319 311 320 /** 312 * Internal worker for DIS CoreOne and DISCoreOneEx.321 * Internal worker for DISInstEx. 313 322 * 314 323 * @returns VBox status code. … … 318 327 * @param pcbInstr Where to store the instruction size. Can be NULL. 319 328 */ 320 static int dis CoreParseInstr(PDISCPUSTATE pCpu, RTUINTPTR uInstrAddr, const OPCODE *paOneByteMap, uint32_t *pcbInstr)329 static int disInstrWorker(PDISCPUSTATE pCpu, RTUINTPTR uInstrAddr, PCDISOPCODE paOneByteMap, uint32_t *pcbInstr) 321 330 { 322 331 /* … … 327 336 for (;;) 328 337 { 329 uint8_t codebyte = DISReadByte(pCpu, uInstrAddr+iByte);338 uint8_t codebyte = disReadByte(pCpu, uInstrAddr+iByte); 330 339 uint8_t opcode = paOneByteMap[codebyte].opcode; 331 340 … … 420 429 pCpu->opcode = codebyte; 421 430 422 cbInc = ParseInstruction(uInstrAddr + iByte, &paOneByteMap[pCpu->opcode], pCpu);431 cbInc = disParseInstruction(uInstrAddr + iByte, &paOneByteMap[pCpu->opcode], pCpu); 423 432 iByte += cbInc; 424 433 break; … … 437 446 //***************************************************************************** 438 447 //***************************************************************************** 439 unsigned ParseInstruction(RTUINTPTR uCodePtr, PCOPCODE pOp, PDISCPUSTATE pCpu)448 static unsigned disParseInstruction(RTUINTPTR uCodePtr, PCDISOPCODE pOp, PDISCPUSTATE pCpu) 440 449 { 441 450 int size = 0; … … 512 521 /* Floating point opcode parsing */ 513 522 //***************************************************************************** 514 unsigned ParseEscFP(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)523 unsigned ParseEscFP(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 515 524 { 516 525 int index; 517 const OPCODE *fpop;526 PCDISOPCODE fpop; 518 527 unsigned size = 0; 519 528 unsigned ModRM; 520 529 NOREF(pOp); 521 530 522 ModRM = DISReadByte(pCpu, uCodePtr);531 ModRM = disReadByte(pCpu, uCodePtr); 523 532 524 533 index = pCpu->opcode - 0xD8; … … 526 535 { 527 536 fpop = &(g_paMapX86_FP_Low[index])[MODRM_REG(ModRM)]; 528 pCpu->pCurInstr = (PC OPCODE)fpop;537 pCpu->pCurInstr = (PCDISOPCODE)fpop; 529 538 530 539 // Should contain the parameter type on input … … 535 544 { 536 545 fpop = &(g_paMapX86_FP_High[index])[ModRM - 0xC0]; 537 pCpu->pCurInstr = (PC OPCODE)fpop;546 pCpu->pCurInstr = (PCDISOPCODE)fpop; 538 547 } 539 548 … … 565 574 566 575 if (fpop->idxParse1 != IDX_ParseNop) 567 size += pCpu->pfnDisasmFnTable[fpop->idxParse1](uCodePtr+size, (PC OPCODE)fpop, pParam, pCpu);576 size += pCpu->pfnDisasmFnTable[fpop->idxParse1](uCodePtr+size, (PCDISOPCODE)fpop, pParam, pCpu); 568 577 569 578 if (fpop->idxParse2 != IDX_ParseNop) 570 size += pCpu->pfnDisasmFnTable[fpop->idxParse2](uCodePtr+size, (PC OPCODE)fpop, pParam, pCpu);579 size += pCpu->pfnDisasmFnTable[fpop->idxParse2](uCodePtr+size, (PCDISOPCODE)fpop, pParam, pCpu); 571 580 572 581 // Store the opcode format string for disasmPrintf … … 590 599 #endif 591 600 //***************************************************************************** 592 void UseSIB(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)601 void UseSIB(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 593 602 { 594 603 unsigned scale, base, index, regtype; … … 649 658 //***************************************************************************** 650 659 //***************************************************************************** 651 unsigned ParseSIB(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)660 unsigned ParseSIB(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 652 661 { 653 662 unsigned size = sizeof(uint8_t); … … 655 664 NOREF(pOp); NOREF(pParam); 656 665 657 SIB = DISReadByte(pCpu, uCodePtr);666 SIB = disReadByte(pCpu, uCodePtr); 658 667 uCodePtr += size; 659 668 … … 675 684 { 676 685 /* Additional 32 bits displacement. No change in long mode. */ 677 pCpu->i32SibDisp = DISReadDWord(pCpu, uCodePtr);686 pCpu->i32SibDisp = disReadDWord(pCpu, uCodePtr); 678 687 size += sizeof(int32_t); 679 688 } … … 682 691 //***************************************************************************** 683 692 //***************************************************************************** 684 unsigned ParseSIB_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)693 unsigned ParseSIB_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 685 694 { 686 695 unsigned size = sizeof(uint8_t); … … 688 697 NOREF(pOp); NOREF(pParam); 689 698 690 SIB = DISReadByte(pCpu, uCodePtr);699 SIB = disReadByte(pCpu, uCodePtr); 691 700 uCodePtr += size; 692 701 … … 716 725 // Mod Reg/Opcode R/M 717 726 //***************************************************************************** 718 unsigned UseModRM(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)727 unsigned UseModRM(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 719 728 { 720 729 int vtype = OP_PARM_VTYPE(pParam->param); … … 893 902 // Query the size of the ModRM parameters and fetch the immediate data (if any) 894 903 //***************************************************************************** 895 unsigned QueryModRM(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, unsigned *pSibInc)904 unsigned QueryModRM(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, unsigned *pSibInc) 896 905 { 897 906 unsigned sibinc; … … 924 933 case 0: /* Effective address */ 925 934 if (rm == 5) { /* 32 bits displacement */ 926 pCpu->i32SibDisp = DISReadDWord(pCpu, uCodePtr);935 pCpu->i32SibDisp = disReadDWord(pCpu, uCodePtr); 927 936 size += sizeof(int32_t); 928 937 } … … 931 940 932 941 case 1: /* Effective address + 8 bits displacement */ 933 pCpu->i32SibDisp = (int8_t) DISReadByte(pCpu, uCodePtr);942 pCpu->i32SibDisp = (int8_t)disReadByte(pCpu, uCodePtr); 934 943 size += sizeof(char); 935 944 break; 936 945 937 946 case 2: /* Effective address + 32 bits displacement */ 938 pCpu->i32SibDisp = DISReadDWord(pCpu, uCodePtr);947 pCpu->i32SibDisp = disReadDWord(pCpu, uCodePtr); 939 948 size += sizeof(int32_t); 940 949 break; … … 951 960 case 0: /* Effective address */ 952 961 if (rm == 6) { 953 pCpu->i32SibDisp = DISReadWord(pCpu, uCodePtr);962 pCpu->i32SibDisp = disReadWord(pCpu, uCodePtr); 954 963 size += sizeof(uint16_t); 955 964 } … … 958 967 959 968 case 1: /* Effective address + 8 bits displacement */ 960 pCpu->i32SibDisp = (int8_t) DISReadByte(pCpu, uCodePtr);969 pCpu->i32SibDisp = (int8_t)disReadByte(pCpu, uCodePtr); 961 970 size += sizeof(char); 962 971 break; 963 972 964 973 case 2: /* Effective address + 32 bits displacement */ 965 pCpu->i32SibDisp = (int16_t) DISReadWord(pCpu, uCodePtr);974 pCpu->i32SibDisp = (int16_t)disReadWord(pCpu, uCodePtr); 966 975 size += sizeof(uint16_t); 967 976 break; … … 976 985 // Query the size of the ModRM parameters and fetch the immediate data (if any) 977 986 //***************************************************************************** 978 unsigned QueryModRM_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, unsigned *pSibInc)987 unsigned QueryModRM_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, unsigned *pSibInc) 979 988 { 980 989 unsigned sibinc; … … 1051 1060 //***************************************************************************** 1052 1061 //***************************************************************************** 1053 unsigned ParseIllegal(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1062 unsigned ParseIllegal(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1054 1063 { 1055 1064 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); NOREF(pCpu); … … 1059 1068 //***************************************************************************** 1060 1069 //***************************************************************************** 1061 unsigned ParseModRM(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1070 unsigned ParseModRM(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1062 1071 { 1063 1072 unsigned size = sizeof(uint8_t); //ModRM byte 1064 1073 unsigned sibinc, ModRM; 1065 1074 1066 ModRM = DISReadByte(pCpu, uCodePtr);1075 ModRM = disReadByte(pCpu, uCodePtr); 1067 1076 uCodePtr += sizeof(uint8_t); 1068 1077 … … 1105 1114 //***************************************************************************** 1106 1115 //***************************************************************************** 1107 unsigned ParseModRM_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1116 unsigned ParseModRM_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1108 1117 { 1109 1118 unsigned size = sizeof(uint8_t); //ModRM byte 1110 1119 unsigned sibinc, ModRM; 1111 1120 1112 ModRM = DISReadByte(pCpu, uCodePtr);1121 ModRM = disReadByte(pCpu, uCodePtr); 1113 1122 uCodePtr += sizeof(uint8_t); 1114 1123 … … 1152 1161 //***************************************************************************** 1153 1162 //***************************************************************************** 1154 unsigned ParseModFence(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1163 unsigned ParseModFence(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1155 1164 { 1156 1165 ////AssertMsgFailed(("??\n")); … … 1161 1170 //***************************************************************************** 1162 1171 //***************************************************************************** 1163 unsigned ParseImmByte(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1172 unsigned ParseImmByte(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1164 1173 { 1165 1174 NOREF(pOp); 1166 pParam->parval = DISReadByte(pCpu, uCodePtr);1175 pParam->parval = disReadByte(pCpu, uCodePtr); 1167 1176 pParam->fUse |= DISUSE_IMMEDIATE8; 1168 1177 pParam->cb = sizeof(uint8_t); … … 1171 1180 //***************************************************************************** 1172 1181 //***************************************************************************** 1173 unsigned ParseImmByte_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1182 unsigned ParseImmByte_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1174 1183 { 1175 1184 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); NOREF(pCpu); … … 1178 1187 //***************************************************************************** 1179 1188 //***************************************************************************** 1180 unsigned ParseImmByteSX(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1189 unsigned ParseImmByteSX(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1181 1190 { 1182 1191 NOREF(pOp); 1183 1192 if (pCpu->opmode == DISCPUMODE_32BIT) 1184 1193 { 1185 pParam->parval = (uint32_t)(int8_t) DISReadByte(pCpu, uCodePtr);1194 pParam->parval = (uint32_t)(int8_t)disReadByte(pCpu, uCodePtr); 1186 1195 pParam->fUse |= DISUSE_IMMEDIATE32_SX8; 1187 1196 pParam->cb = sizeof(uint32_t); … … 1190 1199 if (pCpu->opmode == DISCPUMODE_64BIT) 1191 1200 { 1192 pParam->parval = (uint64_t)(int8_t) DISReadByte(pCpu, uCodePtr);1201 pParam->parval = (uint64_t)(int8_t)disReadByte(pCpu, uCodePtr); 1193 1202 pParam->fUse |= DISUSE_IMMEDIATE64_SX8; 1194 1203 pParam->cb = sizeof(uint64_t); … … 1196 1205 else 1197 1206 { 1198 pParam->parval = (uint16_t)(int8_t) DISReadByte(pCpu, uCodePtr);1207 pParam->parval = (uint16_t)(int8_t)disReadByte(pCpu, uCodePtr); 1199 1208 pParam->fUse |= DISUSE_IMMEDIATE16_SX8; 1200 1209 pParam->cb = sizeof(uint16_t); … … 1204 1213 //***************************************************************************** 1205 1214 //***************************************************************************** 1206 unsigned ParseImmByteSX_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1215 unsigned ParseImmByteSX_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1207 1216 { 1208 1217 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); NOREF(pCpu); … … 1211 1220 //***************************************************************************** 1212 1221 //***************************************************************************** 1213 unsigned ParseImmUshort(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1222 unsigned ParseImmUshort(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1214 1223 { 1215 1224 NOREF(pOp); 1216 pParam->parval = DISReadWord(pCpu, uCodePtr);1225 pParam->parval = disReadWord(pCpu, uCodePtr); 1217 1226 pParam->fUse |= DISUSE_IMMEDIATE16; 1218 1227 pParam->cb = sizeof(uint16_t); … … 1221 1230 //***************************************************************************** 1222 1231 //***************************************************************************** 1223 unsigned ParseImmUshort_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1232 unsigned ParseImmUshort_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1224 1233 { 1225 1234 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); NOREF(pCpu); … … 1228 1237 //***************************************************************************** 1229 1238 //***************************************************************************** 1230 unsigned ParseImmUlong(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1239 unsigned ParseImmUlong(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1231 1240 { 1232 1241 NOREF(pOp); 1233 pParam->parval = DISReadDWord(pCpu, uCodePtr);1242 pParam->parval = disReadDWord(pCpu, uCodePtr); 1234 1243 pParam->fUse |= DISUSE_IMMEDIATE32; 1235 1244 pParam->cb = sizeof(uint32_t); … … 1238 1247 //***************************************************************************** 1239 1248 //***************************************************************************** 1240 unsigned ParseImmUlong_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1249 unsigned ParseImmUlong_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1241 1250 { 1242 1251 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); NOREF(pCpu); … … 1245 1254 //***************************************************************************** 1246 1255 //***************************************************************************** 1247 unsigned ParseImmQword(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1256 unsigned ParseImmQword(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1248 1257 { 1249 1258 NOREF(pOp); 1250 pParam->parval = DISReadQWord(pCpu, uCodePtr);1259 pParam->parval = disReadQWord(pCpu, uCodePtr); 1251 1260 pParam->fUse |= DISUSE_IMMEDIATE64; 1252 1261 pParam->cb = sizeof(uint64_t); … … 1255 1264 //***************************************************************************** 1256 1265 //***************************************************************************** 1257 unsigned ParseImmQword_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1266 unsigned ParseImmQword_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1258 1267 { 1259 1268 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); NOREF(pCpu); … … 1262 1271 //***************************************************************************** 1263 1272 //***************************************************************************** 1264 unsigned ParseImmV(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1273 unsigned ParseImmV(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1265 1274 { 1266 1275 NOREF(pOp); 1267 1276 if (pCpu->opmode == DISCPUMODE_32BIT) 1268 1277 { 1269 pParam->parval = DISReadDWord(pCpu, uCodePtr);1278 pParam->parval = disReadDWord(pCpu, uCodePtr); 1270 1279 pParam->fUse |= DISUSE_IMMEDIATE32; 1271 1280 pParam->cb = sizeof(uint32_t); … … 1275 1284 if (pCpu->opmode == DISCPUMODE_64BIT) 1276 1285 { 1277 pParam->parval = DISReadQWord(pCpu, uCodePtr);1286 pParam->parval = disReadQWord(pCpu, uCodePtr); 1278 1287 pParam->fUse |= DISUSE_IMMEDIATE64; 1279 1288 pParam->cb = sizeof(uint64_t); … … 1281 1290 } 1282 1291 1283 pParam->parval = DISReadWord(pCpu, uCodePtr);1292 pParam->parval = disReadWord(pCpu, uCodePtr); 1284 1293 pParam->fUse |= DISUSE_IMMEDIATE16; 1285 1294 pParam->cb = sizeof(uint16_t); … … 1288 1297 //***************************************************************************** 1289 1298 //***************************************************************************** 1290 unsigned ParseImmV_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1299 unsigned ParseImmV_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1291 1300 { 1292 1301 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); … … 1299 1308 //***************************************************************************** 1300 1309 //***************************************************************************** 1301 unsigned ParseImmZ(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1310 unsigned ParseImmZ(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1302 1311 { 1303 1312 NOREF(pOp); … … 1305 1314 if (pCpu->opmode == DISCPUMODE_16BIT) 1306 1315 { 1307 pParam->parval = DISReadWord(pCpu, uCodePtr);1316 pParam->parval = disReadWord(pCpu, uCodePtr); 1308 1317 pParam->fUse |= DISUSE_IMMEDIATE16; 1309 1318 pParam->cb = sizeof(uint16_t); … … 1314 1323 if (pCpu->opmode == DISCPUMODE_64BIT) 1315 1324 { 1316 pParam->parval = (uint64_t)(int32_t) DISReadDWord(pCpu, uCodePtr);1325 pParam->parval = (uint64_t)(int32_t)disReadDWord(pCpu, uCodePtr); 1317 1326 pParam->fUse |= DISUSE_IMMEDIATE64; 1318 1327 pParam->cb = sizeof(uint64_t); … … 1320 1329 else 1321 1330 { 1322 pParam->parval = DISReadDWord(pCpu, uCodePtr);1331 pParam->parval = disReadDWord(pCpu, uCodePtr); 1323 1332 pParam->fUse |= DISUSE_IMMEDIATE32; 1324 1333 pParam->cb = sizeof(uint32_t); … … 1328 1337 //***************************************************************************** 1329 1338 //***************************************************************************** 1330 unsigned ParseImmZ_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1339 unsigned ParseImmZ_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1331 1340 { 1332 1341 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); … … 1340 1349 // Relative displacement for branches (rel. to next instruction) 1341 1350 //***************************************************************************** 1342 unsigned ParseImmBRel(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1351 unsigned ParseImmBRel(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1343 1352 { 1344 1353 NOREF(pOp); 1345 pParam->parval = DISReadByte(pCpu, uCodePtr);1354 pParam->parval = disReadByte(pCpu, uCodePtr); 1346 1355 pParam->fUse |= DISUSE_IMMEDIATE8_REL; 1347 1356 pParam->cb = sizeof(uint8_t); … … 1351 1360 // Relative displacement for branches (rel. to next instruction) 1352 1361 //***************************************************************************** 1353 unsigned ParseImmBRel_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1362 unsigned ParseImmBRel_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1354 1363 { 1355 1364 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); NOREF(pCpu); … … 1359 1368 // Relative displacement for branches (rel. to next instruction) 1360 1369 //***************************************************************************** 1361 unsigned ParseImmVRel(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1370 unsigned ParseImmVRel(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1362 1371 { 1363 1372 NOREF(pOp); 1364 1373 if (pCpu->opmode == DISCPUMODE_32BIT) 1365 1374 { 1366 pParam->parval = DISReadDWord(pCpu, uCodePtr);1375 pParam->parval = disReadDWord(pCpu, uCodePtr); 1367 1376 pParam->fUse |= DISUSE_IMMEDIATE32_REL; 1368 1377 pParam->cb = sizeof(int32_t); … … 1373 1382 { 1374 1383 /* 32 bits relative immediate sign extended to 64 bits. */ 1375 pParam->parval = (uint64_t)(int32_t) DISReadDWord(pCpu, uCodePtr);1384 pParam->parval = (uint64_t)(int32_t)disReadDWord(pCpu, uCodePtr); 1376 1385 pParam->fUse |= DISUSE_IMMEDIATE64_REL; 1377 1386 pParam->cb = sizeof(int64_t); … … 1379 1388 } 1380 1389 1381 pParam->parval = DISReadWord(pCpu, uCodePtr);1390 pParam->parval = disReadWord(pCpu, uCodePtr); 1382 1391 pParam->fUse |= DISUSE_IMMEDIATE16_REL; 1383 1392 pParam->cb = sizeof(int16_t); … … 1387 1396 // Relative displacement for branches (rel. to next instruction) 1388 1397 //***************************************************************************** 1389 unsigned ParseImmVRel_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1398 unsigned ParseImmVRel_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1390 1399 { 1391 1400 NOREF(uCodePtr); NOREF(pOp); NOREF(pParam); … … 1397 1406 //***************************************************************************** 1398 1407 //***************************************************************************** 1399 unsigned ParseImmAddr(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1408 unsigned ParseImmAddr(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1400 1409 { 1401 1410 if (pCpu->addrmode == DISCPUMODE_32BIT) … … 1404 1413 { 1405 1414 /* far 16:32 pointer */ 1406 pParam->parval = DISReadDWord(pCpu, uCodePtr);1407 *((uint32_t*)&pParam->parval+1) = DISReadWord(pCpu, uCodePtr+sizeof(uint32_t));1415 pParam->parval = disReadDWord(pCpu, uCodePtr); 1416 *((uint32_t*)&pParam->parval+1) = disReadWord(pCpu, uCodePtr+sizeof(uint32_t)); 1408 1417 pParam->fUse |= DISUSE_IMMEDIATE_ADDR_16_32; 1409 1418 pParam->cb = sizeof(uint16_t) + sizeof(uint32_t); … … 1417 1426 * so we treat it like displacement. 1418 1427 */ 1419 pParam->uDisp.i32 = DISReadDWord(pCpu, uCodePtr);1428 pParam->uDisp.i32 = disReadDWord(pCpu, uCodePtr); 1420 1429 pParam->fUse |= DISUSE_DISPLACEMENT32; 1421 1430 pParam->cb = sizeof(uint32_t); … … 1432 1441 * so we treat it like displacement. 1433 1442 */ 1434 pParam->uDisp.i64 = DISReadQWord(pCpu, uCodePtr);1443 pParam->uDisp.i64 = disReadQWord(pCpu, uCodePtr); 1435 1444 pParam->fUse |= DISUSE_DISPLACEMENT64; 1436 1445 pParam->cb = sizeof(uint64_t); … … 1440 1449 { 1441 1450 /* far 16:16 pointer */ 1442 pParam->parval = DISReadDWord(pCpu, uCodePtr);1451 pParam->parval = disReadDWord(pCpu, uCodePtr); 1443 1452 pParam->fUse |= DISUSE_IMMEDIATE_ADDR_16_16; 1444 1453 pParam->cb = 2*sizeof(uint16_t); … … 1452 1461 * so we treat it like displacement. 1453 1462 */ 1454 pParam->uDisp.i16 = DISReadWord(pCpu, uCodePtr);1463 pParam->uDisp.i16 = disReadWord(pCpu, uCodePtr); 1455 1464 pParam->fUse |= DISUSE_DISPLACEMENT16; 1456 1465 pParam->cb = sizeof(uint16_t); … … 1459 1468 //***************************************************************************** 1460 1469 //***************************************************************************** 1461 unsigned ParseImmAddr_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1470 unsigned ParseImmAddr_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1462 1471 { 1463 1472 NOREF(uCodePtr); NOREF(pOp); … … 1492 1501 //***************************************************************************** 1493 1502 //***************************************************************************** 1494 unsigned ParseImmAddrF(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1503 unsigned ParseImmAddrF(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1495 1504 { 1496 1505 // immediate far pointers - only 16:16 or 16:32; determined by operand, *not* address size! … … 1500 1509 { 1501 1510 // far 16:32 pointer 1502 pParam->parval = DISReadDWord(pCpu, uCodePtr);1503 *((uint32_t*)&pParam->parval+1) = DISReadWord(pCpu, uCodePtr+sizeof(uint32_t));1511 pParam->parval = disReadDWord(pCpu, uCodePtr); 1512 *((uint32_t*)&pParam->parval+1) = disReadWord(pCpu, uCodePtr+sizeof(uint32_t)); 1504 1513 pParam->fUse |= DISUSE_IMMEDIATE_ADDR_16_32; 1505 1514 pParam->cb = sizeof(uint16_t) + sizeof(uint32_t); … … 1508 1517 1509 1518 // far 16:16 pointer 1510 pParam->parval = DISReadDWord(pCpu, uCodePtr);1519 pParam->parval = disReadDWord(pCpu, uCodePtr); 1511 1520 pParam->fUse |= DISUSE_IMMEDIATE_ADDR_16_16; 1512 1521 pParam->cb = 2*sizeof(uint16_t); … … 1515 1524 //***************************************************************************** 1516 1525 //***************************************************************************** 1517 unsigned ParseImmAddrF_SizeOnly(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1526 unsigned ParseImmAddrF_SizeOnly(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1518 1527 { 1519 1528 NOREF(uCodePtr); NOREF(pOp); … … 1534 1543 //***************************************************************************** 1535 1544 //***************************************************************************** 1536 unsigned ParseFixedReg(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1545 unsigned ParseFixedReg(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1537 1546 { 1538 1547 NOREF(uCodePtr); … … 1635 1644 //***************************************************************************** 1636 1645 //***************************************************************************** 1637 unsigned ParseXv(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1646 unsigned ParseXv(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1638 1647 { 1639 1648 NOREF(uCodePtr); … … 1660 1669 //***************************************************************************** 1661 1670 //***************************************************************************** 1662 unsigned ParseXb(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1671 unsigned ParseXb(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1663 1672 { 1664 1673 NOREF(uCodePtr); NOREF(pOp); … … 1685 1694 //***************************************************************************** 1686 1695 //***************************************************************************** 1687 unsigned ParseYv(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1696 unsigned ParseYv(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1688 1697 { 1689 1698 NOREF(uCodePtr); … … 1710 1719 //***************************************************************************** 1711 1720 //***************************************************************************** 1712 unsigned ParseYb(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1721 unsigned ParseYb(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1713 1722 { 1714 1723 NOREF(uCodePtr); NOREF(pOp); … … 1735 1744 //***************************************************************************** 1736 1745 //***************************************************************************** 1737 unsigned ParseTwoByteEsc(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1738 { 1739 const OPCODE *pOpcode;1746 unsigned ParseTwoByteEsc(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1747 { 1748 PCDISOPCODE pOpcode; 1740 1749 int size = sizeof(uint8_t); 1741 1750 NOREF(pOp); NOREF(pParam); 1742 1751 1743 1752 /* 2nd byte */ 1744 pCpu->opcode = DISReadByte(pCpu, uCodePtr);1753 pCpu->opcode = disReadByte(pCpu, uCodePtr); 1745 1754 1746 1755 /* default to the non-prefixed table. */ … … 1789 1798 } 1790 1799 1791 size += ParseInstruction(uCodePtr+size, pOpcode, pCpu);1792 return size; 1793 } 1794 //***************************************************************************** 1795 //***************************************************************************** 1796 unsigned ParseThreeByteEsc4(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1797 { 1798 const OPCODE *pOpcode;1800 size += disParseInstruction(uCodePtr+size, pOpcode, pCpu); 1801 return size; 1802 } 1803 //***************************************************************************** 1804 //***************************************************************************** 1805 unsigned ParseThreeByteEsc4(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1806 { 1807 PCDISOPCODE pOpcode; 1799 1808 int size = sizeof(uint8_t); 1800 1809 NOREF(pOp); NOREF(pParam); 1801 1810 1802 1811 /* 3rd byte */ 1803 pCpu->opcode = DISReadByte(pCpu, uCodePtr);1812 pCpu->opcode = disReadByte(pCpu, uCodePtr); 1804 1813 1805 1814 /* default to the non-prefixed table. */ … … 1850 1859 } 1851 1860 1852 size += ParseInstruction(uCodePtr+size, pOpcode, pCpu);1853 return size; 1854 } 1855 //***************************************************************************** 1856 //***************************************************************************** 1857 unsigned ParseThreeByteEsc5(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1858 { 1859 const OPCODE *pOpcode;1861 size += disParseInstruction(uCodePtr+size, pOpcode, pCpu); 1862 return size; 1863 } 1864 //***************************************************************************** 1865 //***************************************************************************** 1866 unsigned ParseThreeByteEsc5(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1867 { 1868 PCDISOPCODE pOpcode; 1860 1869 int size = sizeof(uint8_t); 1861 1870 NOREF(pOp); NOREF(pParam); 1862 1871 1863 1872 /* 3rd byte */ 1864 pCpu->opcode = DISReadByte(pCpu, uCodePtr);1873 pCpu->opcode = disReadByte(pCpu, uCodePtr); 1865 1874 1866 1875 /** @todo Should we take the first or last prefix byte in case of multiple prefix bytes??? */ … … 1885 1894 pOpcode = &g_InvalidOpcode[0]; 1886 1895 1887 size += ParseInstruction(uCodePtr+size, pOpcode, pCpu);1888 return size; 1889 } 1890 //***************************************************************************** 1891 //***************************************************************************** 1892 unsigned ParseNopPause(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1896 size += disParseInstruction(uCodePtr+size, pOpcode, pCpu); 1897 return size; 1898 } 1899 //***************************************************************************** 1900 //***************************************************************************** 1901 unsigned ParseNopPause(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1893 1902 { 1894 1903 unsigned size = 0; … … 1903 1912 pOp = &g_aMapX86_NopPause[0]; /* NOP */ 1904 1913 1905 size += ParseInstruction(uCodePtr, pOp, pCpu);1906 return size; 1907 } 1908 //***************************************************************************** 1909 //***************************************************************************** 1910 unsigned ParseImmGrpl(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1914 size += disParseInstruction(uCodePtr, pOp, pCpu); 1915 return size; 1916 } 1917 //***************************************************************************** 1918 //***************************************************************************** 1919 unsigned ParseImmGrpl(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1911 1920 { 1912 1921 int idx = (pCpu->opcode - 0x80) * 8; … … 1914 1923 NOREF(pParam); 1915 1924 1916 modrm = DISReadByte(pCpu, uCodePtr);1925 modrm = disReadByte(pCpu, uCodePtr); 1917 1926 reg = MODRM_REG(modrm); 1918 1927 1919 pOp = (PC OPCODE)&g_aMapX86_Group1[idx+reg];1928 pOp = (PCDISOPCODE)&g_aMapX86_Group1[idx+reg]; 1920 1929 //little hack to make sure the ModRM byte is included in the returned size 1921 1930 if (pOp->idxParse1 != IDX_ParseModRM && pOp->idxParse2 != IDX_ParseModRM) 1922 1931 size = sizeof(uint8_t); //ModRM byte 1923 1932 1924 size += ParseInstruction(uCodePtr, pOp, pCpu);1925 1926 return size; 1927 } 1928 //***************************************************************************** 1929 //***************************************************************************** 1930 unsigned ParseShiftGrp2(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1933 size += disParseInstruction(uCodePtr, pOp, pCpu); 1934 1935 return size; 1936 } 1937 //***************************************************************************** 1938 //***************************************************************************** 1939 unsigned ParseShiftGrp2(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1931 1940 { 1932 1941 int idx; … … 1953 1962 } 1954 1963 1955 modrm = DISReadByte(pCpu, uCodePtr);1964 modrm = disReadByte(pCpu, uCodePtr); 1956 1965 reg = MODRM_REG(modrm); 1957 1966 1958 pOp = (PC OPCODE)&g_aMapX86_Group2[idx+reg];1967 pOp = (PCDISOPCODE)&g_aMapX86_Group2[idx+reg]; 1959 1968 1960 1969 //little hack to make sure the ModRM byte is included in the returned size … … 1962 1971 size = sizeof(uint8_t); //ModRM byte 1963 1972 1964 size += ParseInstruction(uCodePtr, pOp, pCpu);1965 1966 return size; 1967 } 1968 //***************************************************************************** 1969 //***************************************************************************** 1970 unsigned ParseGrp3(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1973 size += disParseInstruction(uCodePtr, pOp, pCpu); 1974 1975 return size; 1976 } 1977 //***************************************************************************** 1978 //***************************************************************************** 1979 unsigned ParseGrp3(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1971 1980 { 1972 1981 int idx = (pCpu->opcode - 0xF6) * 8; … … 1974 1983 NOREF(pParam); 1975 1984 1976 modrm = DISReadByte(pCpu, uCodePtr);1985 modrm = disReadByte(pCpu, uCodePtr); 1977 1986 reg = MODRM_REG(modrm); 1978 1987 1979 pOp = (PC OPCODE)&g_aMapX86_Group3[idx+reg];1988 pOp = (PCDISOPCODE)&g_aMapX86_Group3[idx+reg]; 1980 1989 1981 1990 //little hack to make sure the ModRM byte is included in the returned size … … 1983 1992 size = sizeof(uint8_t); //ModRM byte 1984 1993 1985 size += ParseInstruction(uCodePtr, pOp, pCpu);1986 1987 return size; 1988 } 1989 //***************************************************************************** 1990 //***************************************************************************** 1991 unsigned ParseGrp4(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1994 size += disParseInstruction(uCodePtr, pOp, pCpu); 1995 1996 return size; 1997 } 1998 //***************************************************************************** 1999 //***************************************************************************** 2000 unsigned ParseGrp4(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1992 2001 { 1993 2002 unsigned size = 0, modrm, reg; 1994 2003 NOREF(pParam); 1995 2004 1996 modrm = DISReadByte(pCpu, uCodePtr);2005 modrm = disReadByte(pCpu, uCodePtr); 1997 2006 reg = MODRM_REG(modrm); 1998 2007 1999 pOp = (PC OPCODE)&g_aMapX86_Group4[reg];2008 pOp = (PCDISOPCODE)&g_aMapX86_Group4[reg]; 2000 2009 2001 2010 //little hack to make sure the ModRM byte is included in the returned size … … 2003 2012 size = sizeof(uint8_t); //ModRM byte 2004 2013 2005 size += ParseInstruction(uCodePtr, pOp, pCpu);2006 2007 return size; 2008 } 2009 //***************************************************************************** 2010 //***************************************************************************** 2011 unsigned ParseGrp5(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2014 size += disParseInstruction(uCodePtr, pOp, pCpu); 2015 2016 return size; 2017 } 2018 //***************************************************************************** 2019 //***************************************************************************** 2020 unsigned ParseGrp5(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2012 2021 { 2013 2022 unsigned size = 0, modrm, reg; 2014 2023 NOREF(pParam); 2015 2024 2016 modrm = DISReadByte(pCpu, uCodePtr);2025 modrm = disReadByte(pCpu, uCodePtr); 2017 2026 reg = MODRM_REG(modrm); 2018 2027 2019 pOp = (PC OPCODE)&g_aMapX86_Group5[reg];2028 pOp = (PCDISOPCODE)&g_aMapX86_Group5[reg]; 2020 2029 2021 2030 //little hack to make sure the ModRM byte is included in the returned size … … 2023 2032 size = sizeof(uint8_t); //ModRM byte 2024 2033 2025 size += ParseInstruction(uCodePtr, pOp, pCpu);2034 size += disParseInstruction(uCodePtr, pOp, pCpu); 2026 2035 2027 2036 return size; … … 2033 2042 // 2034 2043 //***************************************************************************** 2035 unsigned Parse3DNow(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2044 unsigned Parse3DNow(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2036 2045 { 2037 2046 unsigned size = 0, modrmsize; … … 2042 2051 #endif 2043 2052 2044 unsigned ModRM = DISReadByte(pCpu, uCodePtr);2053 unsigned ModRM = disReadByte(pCpu, uCodePtr); 2045 2054 pCpu->ModRM.Bits.Rm = MODRM_RM(ModRM); 2046 2055 pCpu->ModRM.Bits.Mod = MODRM_MOD(ModRM); … … 2049 2058 modrmsize = QueryModRM(uCodePtr+sizeof(uint8_t), pOp, pParam, pCpu); 2050 2059 2051 uint8_t opcode = DISReadByte(pCpu, uCodePtr+sizeof(uint8_t)+modrmsize);2052 2053 pOp = (PC OPCODE)&g_aTwoByteMapX86_3DNow[opcode];2060 uint8_t opcode = disReadByte(pCpu, uCodePtr+sizeof(uint8_t)+modrmsize); 2061 2062 pOp = (PCDISOPCODE)&g_aTwoByteMapX86_3DNow[opcode]; 2054 2063 2055 2064 //little hack to make sure the ModRM byte is included in the returned size … … 2062 2071 } 2063 2072 2064 size += ParseInstruction(uCodePtr, pOp, pCpu);2073 size += disParseInstruction(uCodePtr, pOp, pCpu); 2065 2074 size += sizeof(uint8_t); //imm8_opcode uint8_t 2066 2075 … … 2069 2078 //***************************************************************************** 2070 2079 //***************************************************************************** 2071 unsigned ParseGrp6(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2080 unsigned ParseGrp6(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2072 2081 { 2073 2082 unsigned size = 0, modrm, reg; 2074 2083 NOREF(pParam); 2075 2084 2076 modrm = DISReadByte(pCpu, uCodePtr);2085 modrm = disReadByte(pCpu, uCodePtr); 2077 2086 reg = MODRM_REG(modrm); 2078 2087 2079 pOp = (PC OPCODE)&g_aMapX86_Group6[reg];2088 pOp = (PCDISOPCODE)&g_aMapX86_Group6[reg]; 2080 2089 2081 2090 //little hack to make sure the ModRM byte is included in the returned size … … 2083 2092 size = sizeof(uint8_t); //ModRM byte 2084 2093 2085 size += ParseInstruction(uCodePtr, pOp, pCpu);2086 2087 return size; 2088 } 2089 //***************************************************************************** 2090 //***************************************************************************** 2091 unsigned ParseGrp7(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2094 size += disParseInstruction(uCodePtr, pOp, pCpu); 2095 2096 return size; 2097 } 2098 //***************************************************************************** 2099 //***************************************************************************** 2100 unsigned ParseGrp7(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2092 2101 { 2093 2102 unsigned size = 0, modrm, reg, rm, mod; 2094 2103 NOREF(pParam); 2095 2104 2096 modrm = DISReadByte(pCpu, uCodePtr);2105 modrm = disReadByte(pCpu, uCodePtr); 2097 2106 mod = MODRM_MOD(modrm); 2098 2107 reg = MODRM_REG(modrm); … … 2100 2109 2101 2110 if (mod == 3 && rm == 0) 2102 pOp = (PC OPCODE)&g_aMapX86_Group7_mod11_rm000[reg];2111 pOp = (PCDISOPCODE)&g_aMapX86_Group7_mod11_rm000[reg]; 2103 2112 else 2104 2113 if (mod == 3 && rm == 1) 2105 pOp = (PC OPCODE)&g_aMapX86_Group7_mod11_rm001[reg];2106 else 2107 pOp = (PC OPCODE)&g_aMapX86_Group7_mem[reg];2114 pOp = (PCDISOPCODE)&g_aMapX86_Group7_mod11_rm001[reg]; 2115 else 2116 pOp = (PCDISOPCODE)&g_aMapX86_Group7_mem[reg]; 2108 2117 2109 2118 //little hack to make sure the ModRM byte is included in the returned size … … 2111 2120 size = sizeof(uint8_t); //ModRM byte 2112 2121 2113 size += ParseInstruction(uCodePtr, pOp, pCpu);2114 2115 return size; 2116 } 2117 //***************************************************************************** 2118 //***************************************************************************** 2119 unsigned ParseGrp8(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2122 size += disParseInstruction(uCodePtr, pOp, pCpu); 2123 2124 return size; 2125 } 2126 //***************************************************************************** 2127 //***************************************************************************** 2128 unsigned ParseGrp8(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2120 2129 { 2121 2130 unsigned size = 0, modrm, reg; 2122 2131 NOREF(pParam); 2123 2132 2124 modrm = DISReadByte(pCpu, uCodePtr);2133 modrm = disReadByte(pCpu, uCodePtr); 2125 2134 reg = MODRM_REG(modrm); 2126 2135 2127 pOp = (PC OPCODE)&g_aMapX86_Group8[reg];2136 pOp = (PCDISOPCODE)&g_aMapX86_Group8[reg]; 2128 2137 2129 2138 //little hack to make sure the ModRM byte is included in the returned size … … 2131 2140 size = sizeof(uint8_t); //ModRM byte 2132 2141 2133 size += ParseInstruction(uCodePtr, pOp, pCpu);2134 2135 return size; 2136 } 2137 //***************************************************************************** 2138 //***************************************************************************** 2139 unsigned ParseGrp9(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2142 size += disParseInstruction(uCodePtr, pOp, pCpu); 2143 2144 return size; 2145 } 2146 //***************************************************************************** 2147 //***************************************************************************** 2148 unsigned ParseGrp9(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2140 2149 { 2141 2150 unsigned size = 0, modrm, reg; 2142 2151 NOREF(pParam); 2143 2152 2144 modrm = DISReadByte(pCpu, uCodePtr);2153 modrm = disReadByte(pCpu, uCodePtr); 2145 2154 reg = MODRM_REG(modrm); 2146 2155 2147 pOp = (PC OPCODE)&g_aMapX86_Group9[reg];2156 pOp = (PCDISOPCODE)&g_aMapX86_Group9[reg]; 2148 2157 2149 2158 //little hack to make sure the ModRM byte is included in the returned size … … 2151 2160 size = sizeof(uint8_t); //ModRM byte 2152 2161 2153 size += ParseInstruction(uCodePtr, pOp, pCpu);2154 2155 return size; 2156 } 2157 //***************************************************************************** 2158 //***************************************************************************** 2159 unsigned ParseGrp10(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2162 size += disParseInstruction(uCodePtr, pOp, pCpu); 2163 2164 return size; 2165 } 2166 //***************************************************************************** 2167 //***************************************************************************** 2168 unsigned ParseGrp10(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2160 2169 { 2161 2170 unsigned size = 0, modrm, reg; 2162 2171 NOREF(pParam); 2163 2172 2164 modrm = DISReadByte(pCpu, uCodePtr);2173 modrm = disReadByte(pCpu, uCodePtr); 2165 2174 reg = MODRM_REG(modrm); 2166 2175 2167 pOp = (PC OPCODE)&g_aMapX86_Group10[reg];2176 pOp = (PCDISOPCODE)&g_aMapX86_Group10[reg]; 2168 2177 2169 2178 //little hack to make sure the ModRM byte is included in the returned size … … 2171 2180 size = sizeof(uint8_t); //ModRM byte 2172 2181 2173 size += ParseInstruction(uCodePtr, pOp, pCpu);2174 2175 return size; 2176 } 2177 //***************************************************************************** 2178 //***************************************************************************** 2179 unsigned ParseGrp12(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2182 size += disParseInstruction(uCodePtr, pOp, pCpu); 2183 2184 return size; 2185 } 2186 //***************************************************************************** 2187 //***************************************************************************** 2188 unsigned ParseGrp12(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2180 2189 { 2181 2190 unsigned size = 0, modrm, reg; 2182 2191 NOREF(pParam); 2183 2192 2184 modrm = DISReadByte(pCpu, uCodePtr);2193 modrm = disReadByte(pCpu, uCodePtr); 2185 2194 reg = MODRM_REG(modrm); 2186 2195 … … 2188 2197 reg += 8; //2nd table 2189 2198 2190 pOp = (PC OPCODE)&g_aMapX86_Group12[reg];2199 pOp = (PCDISOPCODE)&g_aMapX86_Group12[reg]; 2191 2200 2192 2201 //little hack to make sure the ModRM byte is included in the returned size … … 2194 2203 size = sizeof(uint8_t); //ModRM byte 2195 2204 2196 size += ParseInstruction(uCodePtr, pOp, pCpu);2197 return size; 2198 } 2199 //***************************************************************************** 2200 //***************************************************************************** 2201 unsigned ParseGrp13(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2205 size += disParseInstruction(uCodePtr, pOp, pCpu); 2206 return size; 2207 } 2208 //***************************************************************************** 2209 //***************************************************************************** 2210 unsigned ParseGrp13(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2202 2211 { 2203 2212 unsigned size = 0, modrm, reg; 2204 2213 NOREF(pParam); 2205 2214 2206 modrm = DISReadByte(pCpu, uCodePtr);2215 modrm = disReadByte(pCpu, uCodePtr); 2207 2216 reg = MODRM_REG(modrm); 2208 2217 if (pCpu->prefix & DISPREFIX_OPSIZE) 2209 2218 reg += 8; //2nd table 2210 2219 2211 pOp = (PC OPCODE)&g_aMapX86_Group13[reg];2220 pOp = (PCDISOPCODE)&g_aMapX86_Group13[reg]; 2212 2221 2213 2222 //little hack to make sure the ModRM byte is included in the returned size … … 2215 2224 size = sizeof(uint8_t); //ModRM byte 2216 2225 2217 size += ParseInstruction(uCodePtr, pOp, pCpu);2218 2219 return size; 2220 } 2221 //***************************************************************************** 2222 //***************************************************************************** 2223 unsigned ParseGrp14(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2226 size += disParseInstruction(uCodePtr, pOp, pCpu); 2227 2228 return size; 2229 } 2230 //***************************************************************************** 2231 //***************************************************************************** 2232 unsigned ParseGrp14(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2224 2233 { 2225 2234 unsigned size = 0, modrm, reg; 2226 2235 NOREF(pParam); 2227 2236 2228 modrm = DISReadByte(pCpu, uCodePtr);2237 modrm = disReadByte(pCpu, uCodePtr); 2229 2238 reg = MODRM_REG(modrm); 2230 2239 if (pCpu->prefix & DISPREFIX_OPSIZE) 2231 2240 reg += 8; //2nd table 2232 2241 2233 pOp = (PC OPCODE)&g_aMapX86_Group14[reg];2242 pOp = (PCDISOPCODE)&g_aMapX86_Group14[reg]; 2234 2243 2235 2244 //little hack to make sure the ModRM byte is included in the returned size … … 2237 2246 size = sizeof(uint8_t); //ModRM byte 2238 2247 2239 size += ParseInstruction(uCodePtr, pOp, pCpu);2240 2241 return size; 2242 } 2243 //***************************************************************************** 2244 //***************************************************************************** 2245 unsigned ParseGrp15(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2248 size += disParseInstruction(uCodePtr, pOp, pCpu); 2249 2250 return size; 2251 } 2252 //***************************************************************************** 2253 //***************************************************************************** 2254 unsigned ParseGrp15(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2246 2255 { 2247 2256 unsigned size = 0, modrm, reg, mod, rm; 2248 2257 NOREF(pParam); 2249 2258 2250 modrm = DISReadByte(pCpu, uCodePtr);2259 modrm = disReadByte(pCpu, uCodePtr); 2251 2260 mod = MODRM_MOD(modrm); 2252 2261 reg = MODRM_REG(modrm); … … 2254 2263 2255 2264 if (mod == 3 && rm == 0) 2256 pOp = (PC OPCODE)&g_aMapX86_Group15_mod11_rm000[reg];2257 else 2258 pOp = (PC OPCODE)&g_aMapX86_Group15_mem[reg];2265 pOp = (PCDISOPCODE)&g_aMapX86_Group15_mod11_rm000[reg]; 2266 else 2267 pOp = (PCDISOPCODE)&g_aMapX86_Group15_mem[reg]; 2259 2268 2260 2269 //little hack to make sure the ModRM byte is included in the returned size … … 2262 2271 size = sizeof(uint8_t); //ModRM byte 2263 2272 2264 size += ParseInstruction(uCodePtr, pOp, pCpu);2265 return size; 2266 } 2267 //***************************************************************************** 2268 //***************************************************************************** 2269 unsigned ParseGrp16(RTUINTPTR uCodePtr, PC OPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2273 size += disParseInstruction(uCodePtr, pOp, pCpu); 2274 return size; 2275 } 2276 //***************************************************************************** 2277 //***************************************************************************** 2278 unsigned ParseGrp16(RTUINTPTR uCodePtr, PCDISOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2270 2279 { 2271 2280 unsigned size = 0, modrm, reg; 2272 2281 NOREF(pParam); 2273 2282 2274 modrm = DISReadByte(pCpu, uCodePtr);2283 modrm = disReadByte(pCpu, uCodePtr); 2275 2284 reg = MODRM_REG(modrm); 2276 2285 2277 pOp = (PC OPCODE)&g_aMapX86_Group16[reg];2286 pOp = (PCDISOPCODE)&g_aMapX86_Group16[reg]; 2278 2287 2279 2288 //little hack to make sure the ModRM byte is included in the returned size … … 2281 2290 size = sizeof(uint8_t); //ModRM byte 2282 2291 2283 size += ParseInstruction(uCodePtr, pOp, pCpu);2292 size += disParseInstruction(uCodePtr, pOp, pCpu); 2284 2293 return size; 2285 2294 } … … 2296 2305 static const int IndexModRMReg16[4] = { USE_REG_SI, USE_REG_DI, USE_REG_SI, USE_REG_DI}; 2297 2306 //***************************************************************************** 2298 static void disasmModRMReg(PDISCPUSTATE pCpu, PC OPCODE pOp, unsigned idx, POP_PARAMETER pParam, int fRegAddr)2307 static void disasmModRMReg(PDISCPUSTATE pCpu, PCDISOPCODE pOp, unsigned idx, POP_PARAMETER pParam, int fRegAddr) 2299 2308 { 2300 2309 int subtype, type, mod; … … 2372 2381 //***************************************************************************** 2373 2382 //***************************************************************************** 2374 static void disasmModRMReg16(PDISCPUSTATE pCpu, PC OPCODE pOp, unsigned idx, POP_PARAMETER pParam)2383 static void disasmModRMReg16(PDISCPUSTATE pCpu, PCDISOPCODE pOp, unsigned idx, POP_PARAMETER pParam) 2375 2384 { 2376 2385 NOREF(pCpu); NOREF(pOp); … … 2385 2394 //***************************************************************************** 2386 2395 //***************************************************************************** 2387 static void disasmModRMSReg(PDISCPUSTATE pCpu, PC OPCODE pOp, unsigned idx, POP_PARAMETER pParam)2396 static void disasmModRMSReg(PDISCPUSTATE pCpu, PCDISOPCODE pOp, unsigned idx, POP_PARAMETER pParam) 2388 2397 { 2389 2398 NOREF(pOp); … … 2473 2482 { 2474 2483 #ifdef IN_RING0 2475 AssertMsgFailed((" DISReadWord with no read callback in ring 0!!\n"));2484 AssertMsgFailed(("disReadWord with no read callback in ring 0!!\n")); 2476 2485 RT_BZERO(pbDst, cbToRead); 2477 2486 return VERR_DIS_NO_READ_CALLBACK; … … 2485 2494 /* Read functions for getting the opcode bytes */ 2486 2495 //***************************************************************************** 2487 uint8_t DISReadByte(PDISCPUSTATE pCpu, RTUINTPTR uAddress)2496 uint8_t disReadByte(PDISCPUSTATE pCpu, RTUINTPTR uAddress) 2488 2497 { 2489 2498 uint8_t bTemp = 0; … … 2491 2500 if (RT_FAILURE(rc)) 2492 2501 { 2493 Log((" DISReadByte failed!!\n"));2502 Log(("disReadByte failed!!\n")); 2494 2503 pCpu->rc = VERR_DIS_MEM_READ; 2495 2504 } … … 2507 2516 //***************************************************************************** 2508 2517 //***************************************************************************** 2509 uint16_t DISReadWord(PDISCPUSTATE pCpu, RTUINTPTR uAddress)2518 uint16_t disReadWord(PDISCPUSTATE pCpu, RTUINTPTR uAddress) 2510 2519 { 2511 2520 RTUINT16U uTemp; … … 2514 2523 if (RT_FAILURE(rc)) 2515 2524 { 2516 Log((" DISReadWord failed!!\n"));2525 Log(("disReadWord failed!!\n")); 2517 2526 pCpu->rc = VERR_DIS_MEM_READ; 2518 2527 } … … 2532 2541 //***************************************************************************** 2533 2542 //***************************************************************************** 2534 uint32_t DISReadDWord(PDISCPUSTATE pCpu, RTUINTPTR uAddress)2543 uint32_t disReadDWord(PDISCPUSTATE pCpu, RTUINTPTR uAddress) 2535 2544 { 2536 2545 RTUINT32U uTemp; … … 2539 2548 if (RT_FAILURE(rc)) 2540 2549 { 2541 Log((" DISReadDWord failed!!\n"));2550 Log(("disReadDWord failed!!\n")); 2542 2551 pCpu->rc = VERR_DIS_MEM_READ; 2543 2552 } … … 2559 2568 //***************************************************************************** 2560 2569 //***************************************************************************** 2561 uint64_t DISReadQWord(PDISCPUSTATE pCpu, RTUINTPTR uAddress)2570 uint64_t disReadQWord(PDISCPUSTATE pCpu, RTUINTPTR uAddress) 2562 2571 { 2563 2572 RTUINT64U uTemp; … … 2566 2575 if (RT_FAILURE(rc)) 2567 2576 { 2568 Log((" DISReadQWord %x failed!!\n", uAddress));2577 Log(("disReadQWord %x failed!!\n", uAddress)); 2569 2578 pCpu->rc = VERR_DIS_MEM_READ; 2570 2579 } … … 2616 2625 * @param pCpu Fully disassembled instruction. 2617 2626 */ 2618 void disValidateLockSequence(PDISCPUSTATE pCpu)2627 static void disValidateLockSequence(PDISCPUSTATE pCpu) 2619 2628 { 2620 2629 Assert(pCpu->prefix & DISPREFIX_LOCK); -
trunk/src/VBox/Disassembler/DisasmFormatYasm.cpp
r41678 r41690 267 267 fFlags = (fFlags & ~DIS_FMT_FLAGS_BYTES_LEFT) | DIS_FMT_FLAGS_BYTES_RIGHT; 268 268 269 PC OPCODE constpOp = pCpu->pCurInstr;269 PCDISOPCODE const pOp = pCpu->pCurInstr; 270 270 271 271 /* -
trunk/src/VBox/Disassembler/DisasmInternal.h
r41668 r41690 22 22 #include <VBox/dis.h> 23 23 24 #define ExceptionMemRead 0x66625 #define ExceptionInvalidModRM 0x66726 #define ExceptionInvalidParameter 0x66827 24 25 /** @defgroup grp_dis_int Internals. 26 * @ingroup grp_dis 27 * @{ 28 */ 29 30 /** @name Index into g_apfnCalcSize and g_apfnFullDisasm. 31 * @{ */ 28 32 #define IDX_ParseNop 0 29 33 #define IDX_ParseModRM 1 … … 68 72 #define IDX_ParseImmAddrF 40 69 73 #define IDX_ParseMax (IDX_ParseImmAddrF+1) 74 /** @} */ 70 75 71 76 72 extern PFNDISPARSE g_apfnFullDisasm[IDX_ParseMax]; 73 extern PFNDISPARSE g_apfnCalcSize[IDX_ParseMax]; 77 /** @name Opcode maps. 78 * @{ */ 79 extern const DISOPCODE g_InvalidOpcode[1]; 74 80 75 unsigned ParseInstruction(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu); 76 void disValidateLockSequence(PDISCPUSTATE pCpu); 81 extern const DISOPCODE g_aOneByteMapX86[256]; 82 extern const DISOPCODE g_aOneByteMapX64[256]; 83 extern const DISOPCODE g_aTwoByteMapX86[256]; 77 84 78 /* Read functions */ 79 DECLCALLBACK(int) disReadBytesDefault(PDISCPUSTATE pCpu, uint8_t *pbDst, RTUINTPTR uSrcAddr, uint32_t cbToRead); 80 uint8_t DISReadByte(PDISCPUSTATE pCpu, RTUINTPTR pAddress); 81 uint16_t DISReadWord(PDISCPUSTATE pCpu, RTUINTPTR pAddress); 82 uint32_t DISReadDWord(PDISCPUSTATE pCpu, RTUINTPTR pAddress); 83 uint64_t DISReadQWord(PDISCPUSTATE pCpu, RTUINTPTR pAddress); 85 /** Two byte opcode map with prefix 0x66 */ 86 extern const DISOPCODE g_aTwoByteMapX86_PF66[256]; 87 88 /** Two byte opcode map with prefix 0xF2 */ 89 extern const DISOPCODE g_aTwoByteMapX86_PFF2[256]; 90 91 /** Two byte opcode map with prefix 0xF3 */ 92 extern const DISOPCODE g_aTwoByteMapX86_PFF3[256]; 93 94 /** Three byte opcode map (0xF 0x38) */ 95 extern PCDISOPCODE const g_apThreeByteMapX86_0F38[16]; 96 97 /** Three byte opcode map with prefix 0x66 (0xF 0x38) */ 98 extern PCDISOPCODE const g_apThreeByteMapX86_660F38[16]; 99 100 /** Three byte opcode map with prefix 0xF2 (0xF 0x38) */ 101 extern PCDISOPCODE const g_apThreeByteMapX86_F20F38[16]; 102 103 /** Three byte opcode map with prefix 0x66 (0xF 0x3A) */ 104 extern PCDISOPCODE const g_apThreeByteMapX86_660F3A[16]; 105 /** @} */ 106 107 /** @name Opcode extensions (Group tables) 108 * @{ */ 109 extern const DISOPCODE g_aMapX86_Group1[8*4]; 110 extern const DISOPCODE g_aMapX86_Group2[8*6]; 111 extern const DISOPCODE g_aMapX86_Group3[8*2]; 112 extern const DISOPCODE g_aMapX86_Group4[8]; 113 extern const DISOPCODE g_aMapX86_Group5[8]; 114 extern const DISOPCODE g_aMapX86_Group6[8]; 115 extern const DISOPCODE g_aMapX86_Group7_mem[8]; 116 extern const DISOPCODE g_aMapX86_Group7_mod11_rm000[8]; 117 extern const DISOPCODE g_aMapX86_Group7_mod11_rm001[8]; 118 extern const DISOPCODE g_aMapX86_Group8[8]; 119 extern const DISOPCODE g_aMapX86_Group9[8]; 120 extern const DISOPCODE g_aMapX86_Group10[8]; 121 extern const DISOPCODE g_aMapX86_Group11[8*2]; 122 extern const DISOPCODE g_aMapX86_Group12[8*2]; 123 extern const DISOPCODE g_aMapX86_Group13[8*2]; 124 extern const DISOPCODE g_aMapX86_Group14[8*2]; 125 extern const DISOPCODE g_aMapX86_Group15_mem[8]; 126 extern const DISOPCODE g_aMapX86_Group15_mod11_rm000[8]; 127 extern const DISOPCODE g_aMapX86_Group16[8]; 128 extern const DISOPCODE g_aMapX86_NopPause[2]; 129 /** @} */ 130 131 /** 3DNow! map (0x0F 0x0F prefix) */ 132 extern const DISOPCODE g_aTwoByteMapX86_3DNow[256]; 133 134 /** Floating point opcodes starting with escape byte 0xDF 135 * @{ */ 136 extern const DISOPCODE g_aMapX86_EscF0_Low[8]; 137 extern const DISOPCODE g_aMapX86_EscF0_High[16*4]; 138 extern const DISOPCODE g_aMapX86_EscF1_Low[8]; 139 extern const DISOPCODE g_aMapX86_EscF1_High[16*4]; 140 extern const DISOPCODE g_aMapX86_EscF2_Low[8]; 141 extern const DISOPCODE g_aMapX86_EscF2_High[16*4]; 142 extern const DISOPCODE g_aMapX86_EscF3_Low[8]; 143 extern const DISOPCODE g_aMapX86_EscF3_High[16*4]; 144 extern const DISOPCODE g_aMapX86_EscF4_Low[8]; 145 extern const DISOPCODE g_aMapX86_EscF4_High[16*4]; 146 extern const DISOPCODE g_aMapX86_EscF5_Low[8]; 147 extern const DISOPCODE g_aMapX86_EscF5_High[16*4]; 148 extern const DISOPCODE g_aMapX86_EscF6_Low[8]; 149 extern const DISOPCODE g_aMapX86_EscF6_High[16*4]; 150 extern const DISOPCODE g_aMapX86_EscF7_Low[8]; 151 extern const DISOPCODE g_aMapX86_EscF7_High[16*4]; 152 153 extern PCDISOPCODE g_paMapX86_FP_Low[8]; 154 extern PCDISOPCODE g_paMapX86_FP_High[8]; 155 /** @} */ 156 157 /** @def OP 158 * Wrapper which initializes an OPCODE. 159 * We must use this so that we can exclude unused fields in order 160 * to save precious bytes in the GC version. 161 * 162 * @internal 163 */ 164 #ifndef DIS_CORE_ONLY 165 # define OP(pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype) \ 166 { pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype } 167 #else 168 # define OP(pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype) \ 169 { idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype } 170 #endif 171 84 172 85 173 size_t disFormatBytes(PCDISCPUSTATE pCpu, char *pszDst, size_t cchDst, uint32_t fFlags); 86 174 175 /** @} */ 87 176 #endif 88 177 -
trunk/src/VBox/Disassembler/DisasmReg.cpp
r41678 r41690 30 30 #include <iprt/stdarg.h> 31 31 #include "DisasmInternal.h" 32 #include "DisasmTables.h"33 32 34 33 -
trunk/src/VBox/Disassembler/DisasmTables.cpp
r41676 r41690 57 57 58 58 /* Invalid opcode */ 59 const OPCODE g_InvalidOpcode[1] =59 const DISOPCODE g_InvalidOpcode[1] = 60 60 { 61 61 INVALID_OPCODE … … 63 63 64 64 /* Tables for the elegant Intel X86 instruction set */ 65 const OPCODE g_aOneByteMapX86[256] =65 const DISOPCODE g_aOneByteMapX86[256] = 66 66 { 67 67 /* 0 */ … … 365 365 366 366 367 const OPCODE g_aTwoByteMapX86[256] =367 const DISOPCODE g_aTwoByteMapX86[256] = 368 368 { 369 369 /* 0 */ … … 665 665 666 666 /* Two byte opcode map with prefix 0x66 */ 667 const OPCODE g_aTwoByteMapX86_PF66[256] =667 const DISOPCODE g_aTwoByteMapX86_PF66[256] = 668 668 { 669 669 /* 0 */ … … 867 867 868 868 /* Two byte opcode map with prefix 0xF2 */ 869 const OPCODE g_aTwoByteMapX86_PFF2[256] =869 const DISOPCODE g_aTwoByteMapX86_PFF2[256] = 870 870 { 871 871 /* 0 */ … … 1040 1040 1041 1041 /* Two byte opcode map with prefix 0xF3 */ 1042 const OPCODE g_aTwoByteMapX86_PFF3[256] =1042 const DISOPCODE g_aTwoByteMapX86_PFF3[256] = 1043 1043 { 1044 1044 /* 0 */ … … 1213 1213 1214 1214 /** Three byte opcode map (0xF 0x38 0x0x) */ 1215 const OPCODE g_aThreeByteMapX86_0F38_0[16] =1215 const DISOPCODE g_aThreeByteMapX86_0F38_0[16] = 1216 1216 { 1217 1217 /* 0 */ … … 1235 1235 1236 1236 /** Three byte opcode map (0x0F 0x38 0x1x) */ 1237 const OPCODE g_aThreeByteMapX86_0F38_1[16] =1237 const DISOPCODE g_aThreeByteMapX86_0F38_1[16] = 1238 1238 { 1239 1239 /* 1 */ … … 1256 1256 }; 1257 1257 1258 /* These tables are mostly sparse, so use another level of indirection to save space. */1259 const OPCODE *g_apThreeByteMapX86_0F38[16] =1258 /** These tables are mostly sparse, so use another level of indirection to save space. */ 1259 PCDISOPCODE const g_apThreeByteMapX86_0F38[16] = 1260 1260 { 1261 1261 /* 0 */ … … 1309 1309 1310 1310 /** Three byte opcode map (0x66 0x0F 0x38 0x0x) */ 1311 const OPCODE g_aThreeByteMapX86_660F38_0[16] =1311 const DISOPCODE g_aThreeByteMapX86_660F38_0[16] = 1312 1312 { 1313 1313 /* 0 */ … … 1331 1331 1332 1332 /** Three byte opcode map (0x66 0x0F 0x38 0x1x) */ 1333 const OPCODE g_aThreeByteMapX86_660F38_1[16] =1333 const DISOPCODE g_aThreeByteMapX86_660F38_1[16] = 1334 1334 { 1335 1335 /* 1 */ … … 1355 1355 1356 1356 /** Three byte opcode map (0x66 0x0F 0x38 0x8x) */ 1357 const OPCODE g_aThreeByteMapX86_660F38_8[16] =1357 const DISOPCODE g_aThreeByteMapX86_660F38_8[16] = 1358 1358 { 1359 1359 /* 8 */ … … 1377 1377 1378 1378 /** Three byte opcode map with prefix 0x66 (0xF 0x38) */ 1379 const OPCODE *g_apThreeByteMapX86_660F38[16] =1379 PCDISOPCODE const g_apThreeByteMapX86_660F38[16] = 1380 1380 { 1381 1381 /* 0 */ … … 1430 1430 /** Three byte opcode map with prefix 0xF2 (0xF 0x38) */ 1431 1431 /** @todo remainder missing (too lazy now) */ 1432 const OPCODE *g_apThreeByteMapX86_F20F38[16] =1432 PCDISOPCODE const g_apThreeByteMapX86_F20F38[16] = 1433 1433 { 1434 1434 /* 0 */ … … 1483 1483 /** Three byte opcode map with prefix 0x66 (0xF 0x3A) */ 1484 1484 /** @todo remainder missing (too lazy now) */ 1485 const OPCODE *g_apThreeByteMapX86_660F3A[16] =1485 PCDISOPCODE const g_apThreeByteMapX86_660F3A[16] = 1486 1486 { 1487 1487 /* 0 */ … … 1535 1535 1536 1536 /* 3DNow! map (0x0F 0x0F prefix) */ 1537 const OPCODE g_aTwoByteMapX86_3DNow[256] =1537 const DISOPCODE g_aTwoByteMapX86_3DNow[256] = 1538 1538 { 1539 1539 /* 0 */ … … 1677 1677 1678 1678 /* Floating point opcode starting with escape byte 0xD8 (values 0-0xBF)*/ 1679 const OPCODE g_aMapX86_EscF0_Low[8] =1679 const DISOPCODE g_aMapX86_EscF0_Low[8] = 1680 1680 { 1681 1681 /* 0 */ … … 1691 1691 1692 1692 /* Floating point opcode starting with escape byte 0xD8 (outside 0-0xBF)*/ 1693 const OPCODE g_aMapX86_EscF0_High[16*4] =1693 const DISOPCODE g_aMapX86_EscF0_High[16*4] = 1694 1694 { 1695 1695 /* c */ … … 1768 1768 1769 1769 /* Floating point opcode starting with escape byte 0xD9 (values 0-0xBF)*/ 1770 const OPCODE g_aMapX86_EscF1_Low[8] =1770 const DISOPCODE g_aMapX86_EscF1_Low[8] = 1771 1771 { 1772 1772 /* 0 */ … … 1785 1785 1786 1786 /* Floating point opcode starting with escape byte 0xD9 (outside 0-0xBF)*/ 1787 const OPCODE g_aMapX86_EscF1_High[16*4] =1787 const DISOPCODE g_aMapX86_EscF1_High[16*4] = 1788 1788 { 1789 1789 /* c */ … … 1863 1863 1864 1864 /* Floating point opcode starting with escape byte 0xDA (values 0-0xBF)*/ 1865 const OPCODE g_aMapX86_EscF2_Low[8] =1865 const DISOPCODE g_aMapX86_EscF2_Low[8] = 1866 1866 { 1867 1867 /* 0 */ … … 1878 1878 1879 1879 /* Floating point opcode starting with escape byte 0xD9 (outside 0-0xBF)*/ 1880 const OPCODE g_aMapX86_EscF2_High[16*4] =1880 const DISOPCODE g_aMapX86_EscF2_High[16*4] = 1881 1881 { 1882 1882 /* c */ … … 1940 1940 1941 1941 /* Floating point opcode starting with escape byte 0xDB (values 0-0xBF)*/ 1942 const OPCODE g_aMapX86_EscF3_Low[8] =1942 const DISOPCODE g_aMapX86_EscF3_Low[8] = 1943 1943 { 1944 1944 /* 0 */ … … 1955 1955 1956 1956 /* Floating point opcode starting with escape byte 0xDB (outside 0-0xBF)*/ 1957 const OPCODE g_aMapX86_EscF3_High[16*4] =1957 const DISOPCODE g_aMapX86_EscF3_High[16*4] = 1958 1958 { 1959 1959 /* c */ … … 2033 2033 2034 2034 /* Floating point opcode starting with escape byte 0xDC (values 0-0xBF)*/ 2035 const OPCODE g_aMapX86_EscF4_Low[8] =2035 const DISOPCODE g_aMapX86_EscF4_Low[8] = 2036 2036 { 2037 2037 /* 0 */ … … 2048 2048 2049 2049 /* Floating point opcode starting with escape byte 0xDC (outside 0-0xBF)*/ 2050 const OPCODE g_aMapX86_EscF4_High[16*4] =2050 const DISOPCODE g_aMapX86_EscF4_High[16*4] = 2051 2051 { 2052 2052 /* c */ … … 2111 2111 2112 2112 /* Floating point opcode starting with escape byte 0xDD (values 0-0xBF)*/ 2113 const OPCODE g_aMapX86_EscF5_Low[8] =2113 const DISOPCODE g_aMapX86_EscF5_Low[8] = 2114 2114 { 2115 2115 /* 0 */ … … 2126 2126 2127 2127 /* Floating point opcode starting with escape byte 0xDD (outside 0-0xBF)*/ 2128 const OPCODE g_aMapX86_EscF5_High[16*4] =2128 const DISOPCODE g_aMapX86_EscF5_High[16*4] = 2129 2129 { 2130 2130 /* c */ … … 2190 2190 2191 2191 /* Floating point opcode starting with escape byte 0xDE (values 0-0xBF)*/ 2192 const OPCODE g_aMapX86_EscF6_Low[8] =2192 const DISOPCODE g_aMapX86_EscF6_Low[8] = 2193 2193 { 2194 2194 /* 0 */ … … 2205 2205 2206 2206 /* Floating point opcode starting with escape byte 0xDE (outside 0-0xBF)*/ 2207 const OPCODE g_aMapX86_EscF6_High[16*4] =2207 const DISOPCODE g_aMapX86_EscF6_High[16*4] = 2208 2208 { 2209 2209 /* c */ … … 2282 2282 2283 2283 /* Floating point opcode starting with escape byte 0xDF (values 0-0xBF)*/ 2284 const OPCODE g_aMapX86_EscF7_Low[8] =2284 const DISOPCODE g_aMapX86_EscF7_Low[8] = 2285 2285 { 2286 2286 /* 0 */ … … 2297 2297 2298 2298 /* Floating point opcode starting with escape byte 0xDF (outside 0-0xBF)*/ 2299 const OPCODE g_aMapX86_EscF7_High[16*4] =2299 const DISOPCODE g_aMapX86_EscF7_High[16*4] = 2300 2300 { 2301 2301 /* c */ … … 2343 2343 2344 2344 2345 PC OPCODE g_paMapX86_FP_Low[8] =2345 PCDISOPCODE g_paMapX86_FP_Low[8] = 2346 2346 { 2347 2347 g_aMapX86_EscF0_Low, … … 2355 2355 }; 2356 2356 2357 PC OPCODE g_paMapX86_FP_High[8] =2357 PCDISOPCODE g_paMapX86_FP_High[8] = 2358 2358 { 2359 2359 g_aMapX86_EscF0_High, … … 2368 2368 2369 2369 /* Opcode extensions (Group tables) */ 2370 const OPCODE g_aMapX86_Group1[8*4] =2370 const DISOPCODE g_aMapX86_Group1[8*4] = 2371 2371 { 2372 2372 /* 80 */ … … 2411 2411 }; 2412 2412 2413 const OPCODE g_aMapX86_Group2[8*6] =2413 const DISOPCODE g_aMapX86_Group2[8*6] = 2414 2414 { 2415 2415 /* C0 */ … … 2476 2476 2477 2477 2478 const OPCODE g_aMapX86_Group3[8*2] =2478 const DISOPCODE g_aMapX86_Group3[8*2] = 2479 2479 { 2480 2480 /* F6 */ … … 2501 2501 }; 2502 2502 2503 const OPCODE g_aMapX86_Group4[8] =2503 const DISOPCODE g_aMapX86_Group4[8] = 2504 2504 { 2505 2505 /* FE */ … … 2514 2514 }; 2515 2515 2516 const OPCODE g_aMapX86_Group5[8] =2516 const DISOPCODE g_aMapX86_Group5[8] = 2517 2517 { 2518 2518 /* FF */ … … 2528 2528 2529 2529 2530 const OPCODE g_aMapX86_Group6[8] =2530 const DISOPCODE g_aMapX86_Group6[8] = 2531 2531 { 2532 2532 /* 0F 00 */ … … 2541 2541 }; 2542 2542 2543 const OPCODE g_aMapX86_Group7_mem[8] =2543 const DISOPCODE g_aMapX86_Group7_mem[8] = 2544 2544 { 2545 2545 /* 0F 01 */ … … 2554 2554 }; 2555 2555 2556 const OPCODE g_aMapX86_Group7_mod11_rm000[8] =2556 const DISOPCODE g_aMapX86_Group7_mod11_rm000[8] = 2557 2557 { 2558 2558 /* 0F 01 MOD=11b */ … … 2567 2567 }; 2568 2568 2569 const OPCODE g_aMapX86_Group7_mod11_rm001[8] =2569 const DISOPCODE g_aMapX86_Group7_mod11_rm001[8] = 2570 2570 { 2571 2571 /* 0F 01 MOD=11b */ … … 2580 2580 }; 2581 2581 2582 const OPCODE g_aMapX86_Group8[8] =2582 const DISOPCODE g_aMapX86_Group8[8] = 2583 2583 { 2584 2584 /* 0F BA */ … … 2593 2593 }; 2594 2594 2595 const OPCODE g_aMapX86_Group9[8] =2595 const DISOPCODE g_aMapX86_Group9[8] = 2596 2596 { 2597 2597 /* 0F C7 */ … … 2606 2606 }; 2607 2607 2608 const OPCODE g_aMapX86_Group10[8] =2608 const DISOPCODE g_aMapX86_Group10[8] = 2609 2609 { 2610 2610 /* 0F B9 */ … … 2620 2620 2621 2621 2622 const OPCODE g_aMapX86_Group11[8*2] =2622 const DISOPCODE g_aMapX86_Group11[8*2] = 2623 2623 { 2624 2624 /* 0F C6 */ … … 2644 2644 2645 2645 /* 0xF 0x71 */ 2646 const OPCODE g_aMapX86_Group12[8*2] =2646 const DISOPCODE g_aMapX86_Group12[8*2] = 2647 2647 { 2648 2648 INVALID_OPCODE, … … 2667 2667 2668 2668 /* 0xF 0x72 */ 2669 const OPCODE g_aMapX86_Group13[8*2] =2669 const DISOPCODE g_aMapX86_Group13[8*2] = 2670 2670 { 2671 2671 INVALID_OPCODE, … … 2690 2690 2691 2691 /* 0xF 0x73 */ 2692 const OPCODE g_aMapX86_Group14[8*2] =2692 const DISOPCODE g_aMapX86_Group14[8*2] = 2693 2693 { 2694 2694 INVALID_OPCODE, … … 2714 2714 2715 2715 /* 0xF 0xAE */ 2716 const OPCODE g_aMapX86_Group15_mem[8] =2716 const DISOPCODE g_aMapX86_Group15_mem[8] = 2717 2717 { 2718 2718 OP("fxsave %M", IDX_ParseModRM, 0, 0, OP_FXSAVE, OP_PARM_M, OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS), … … 2727 2727 2728 2728 /* 0xF 0xAE */ 2729 const OPCODE g_aMapX86_Group15_mod11_rm000[8] =2729 const DISOPCODE g_aMapX86_Group15_mod11_rm000[8] = 2730 2730 { 2731 2731 INVALID_OPCODE, … … 2740 2740 2741 2741 /* 0xF 0x18 */ 2742 const OPCODE g_aMapX86_Group16[8] =2742 const DISOPCODE g_aMapX86_Group16[8] = 2743 2743 { 2744 2744 OP("prefetchnta %Mb", IDX_ParseModRM, 0, 0, OP_PREFETCH,OP_PARM_Mb, OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS), … … 2753 2753 2754 2754 /* 0x90 or 0xF3 0x90 */ 2755 const OPCODE g_aMapX86_NopPause[2] =2755 const DISOPCODE g_aMapX86_NopPause[2] = 2756 2756 { 2757 2757 OP("nop", 0, 0, 0, OP_NOP, OP_PARM_NONE, OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS), -
trunk/src/VBox/Disassembler/DisasmTables.h
r41668 r41690 1 /* $Id$ */2 /** @file3 * VBox disassembler - Tables Header.4 */5 1 6 /*7 * Copyright (C) 2006-2012 Oracle Corporation8 *9 * This file is part of VirtualBox Open Source Edition (OSE), as10 * available from http://www.virtualbox.org. This file is free software;11 * you can redistribute it and/or modify it under the terms of the GNU12 * General Public License (GPL) as published by the Free Software13 * Foundation, in version 2 as it comes in the "COPYING" file of the14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.16 */17 18 #ifndef ___disasmtable_h___19 #define ___disasmtable_h___20 21 #include <VBox/dis.h>22 23 extern const OPCODE g_InvalidOpcode[1];24 25 extern const OPCODE g_aOneByteMapX86[256];26 extern const OPCODE g_aOneByteMapX64[256];27 extern const OPCODE g_aTwoByteMapX86[256];28 29 /** Two byte opcode map with prefix 0x66 */30 extern const OPCODE g_aTwoByteMapX86_PF66[256];31 32 /** Two byte opcode map with prefix 0xF2 */33 extern const OPCODE g_aTwoByteMapX86_PFF2[256];34 35 /** Two byte opcode map with prefix 0xF3 */36 extern const OPCODE g_aTwoByteMapX86_PFF3[256];37 38 /** Three byte opcode map (0xF 0x38) */39 extern const OPCODE *g_apThreeByteMapX86_0F38[16];40 41 /** Three byte opcode map with prefix 0x66 (0xF 0x38) */42 extern const OPCODE *g_apThreeByteMapX86_660F38[16];43 44 /** Three byte opcode map with prefix 0xF2 (0xF 0x38) */45 extern const OPCODE *g_apThreeByteMapX86_F20F38[16];46 47 /** Three byte opcode map with prefix 0x66 (0xF 0x3A) */48 extern const OPCODE *g_apThreeByteMapX86_660F3A[16];49 50 /** Opcode extensions (Group tables)51 * @{ */52 extern const OPCODE g_aMapX86_Group1[8*4];53 extern const OPCODE g_aMapX86_Group2[8*6];54 extern const OPCODE g_aMapX86_Group3[8*2];55 extern const OPCODE g_aMapX86_Group4[8];56 extern const OPCODE g_aMapX86_Group5[8];57 extern const OPCODE g_aMapX86_Group6[8];58 extern const OPCODE g_aMapX86_Group7_mem[8];59 extern const OPCODE g_aMapX86_Group7_mod11_rm000[8];60 extern const OPCODE g_aMapX86_Group7_mod11_rm001[8];61 extern const OPCODE g_aMapX86_Group8[8];62 extern const OPCODE g_aMapX86_Group9[8];63 extern const OPCODE g_aMapX86_Group10[8];64 extern const OPCODE g_aMapX86_Group11[8*2];65 extern const OPCODE g_aMapX86_Group12[8*2];66 extern const OPCODE g_aMapX86_Group13[8*2];67 extern const OPCODE g_aMapX86_Group14[8*2];68 extern const OPCODE g_aMapX86_Group15_mem[8];69 extern const OPCODE g_aMapX86_Group15_mod11_rm000[8];70 extern const OPCODE g_aMapX86_Group16[8];71 extern const OPCODE g_aMapX86_NopPause[2];72 /** @} */73 74 /** 3DNow! map (0x0F 0x0F prefix) */75 extern const OPCODE g_aTwoByteMapX86_3DNow[256];76 77 /** Floating point opcodes starting with escape byte 0xDF78 * @{ */79 extern const OPCODE g_aMapX86_EscF0_Low[8];80 extern const OPCODE g_aMapX86_EscF0_High[16*4];81 extern const OPCODE g_aMapX86_EscF1_Low[8];82 extern const OPCODE g_aMapX86_EscF1_High[16*4];83 extern const OPCODE g_aMapX86_EscF2_Low[8];84 extern const OPCODE g_aMapX86_EscF2_High[16*4];85 extern const OPCODE g_aMapX86_EscF3_Low[8];86 extern const OPCODE g_aMapX86_EscF3_High[16*4];87 extern const OPCODE g_aMapX86_EscF4_Low[8];88 extern const OPCODE g_aMapX86_EscF4_High[16*4];89 extern const OPCODE g_aMapX86_EscF5_Low[8];90 extern const OPCODE g_aMapX86_EscF5_High[16*4];91 extern const OPCODE g_aMapX86_EscF6_Low[8];92 extern const OPCODE g_aMapX86_EscF6_High[16*4];93 extern const OPCODE g_aMapX86_EscF7_Low[8];94 extern const OPCODE g_aMapX86_EscF7_High[16*4];95 96 extern PCOPCODE g_paMapX86_FP_Low[8];97 extern PCOPCODE g_paMapX86_FP_High[8];98 /** @} */99 100 /** @def OP101 * Wrapper which initializes an OPCODE.102 * We must use this so that we can exclude unused fields in order103 * to save precious bytes in the GC version.104 *105 * @internal106 */107 #ifndef DIS_CORE_ONLY108 # define OP(pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype) \109 { pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype }110 #else111 # define OP(pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype) \112 { idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype }113 #endif114 115 #endif116 -
trunk/src/VBox/Disassembler/DisasmTablesX64.cpp
r41676 r41690 22 22 #include <VBox/dis.h> 23 23 #include <VBox/disopcode.h> 24 #include "DisasmTables.h"25 24 #include "DisasmInternal.h" 26 25 … … 32 31 33 32 #ifndef DIS_CORE_ONLY 34 static char SZINVALID_OPCODE[] = "Invalid Opcode";33 static char g_szInvalidOpcode[] = "Invalid Opcode"; 35 34 #endif 36 35 37 36 #define INVALID_OPCODE \ 38 OP( SZINVALID_OPCODE,0, 0, 0, OP_INVALID, OP_PARM_NONE, OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_INVALID)37 OP(g_szInvalidOpcode, 0, 0, 0, OP_INVALID, OP_PARM_NONE, OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_INVALID) 39 38 40 39 #define INVALID_OPCODE_BLOCK \ … … 58 57 /* Tables for the elegant Intel X64 instruction set */ 59 58 60 const OPCODE g_aOneByteMapX64[256] =59 const DISOPCODE g_aOneByteMapX64[256] = 61 60 { 62 61 /* 0 */ -
trunk/src/VBox/Disassembler/DisasmTest.cpp
r41675 r41690 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox disassembler: 4 * Test application 3 * VBox disassembler - Test application 5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-20 07Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Disassembler/DisasmTestCore.cpp
r41675 r41690 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox disassembler: 4 * Test application for core. 3 * VBox disassembler - Test application for core. 5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-20 07Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as
Note:
See TracChangeset
for help on using the changeset viewer.