Changeset 4953 in vbox
- Timestamp:
- Sep 21, 2007 2:08:19 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r4071 r4953 33 33 * @{ 34 34 */ 35 #define CPUMODE_16BIT 1 36 #define CPUMODE_32BIT 2 35 typedef enum 36 { 37 CPUMODE_16BIT = 1, 38 CPUMODE_32BIT = 2, 39 CPUMODE_64BIT = 3 40 } DISCPUMODE; 37 41 /** @} */ 38 42 … … 313 317 typedef const struct _OPCODE *PCOPCODE; 314 318 315 typedef DECLCALLBACK(int 32_t) FN_DIS_READBYTES(RTUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTUINTPTR dwUserdata);319 typedef DECLCALLBACK(int) FN_DIS_READBYTES(RTUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata); 316 320 typedef FN_DIS_READBYTES *PFN_DIS_READBYTES; 317 321 … … 323 327 /** Parser callback. 324 328 * @remark no DECLCALLBACK() here because it's considered to be internal (really, I'm too lazy to update all the functions). */ 325 typedef intFNDISPARSE(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);329 typedef unsigned FNDISPARSE(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 326 330 typedef FNDISPARSE *PFNDISPARSE; 327 331 … … 370 374 PCOPCODE pCurInstr; 371 375 372 RTUINTPTR dwUserData[3];376 void *apvUserData[3]; 373 377 374 378 /** Optional read function */ … … 402 406 * Disassembles a code block. 403 407 * 404 * @returns Success indicator.408 * @returns VBox error code 405 409 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 406 410 * set correctly. … … 419 423 * This means *pcbSize >= cbMax sometimes. 420 424 */ 421 DISDECL( bool) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, int32_t cbMax, uint32_t*pSize);425 DISDECL(int) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, unsigned cbMax, unsigned *pSize); 422 426 423 427 /** 424 428 * Disassembles one instruction 425 429 * 426 * @returns Success indicator.430 * @returns VBox error code 427 431 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 428 432 * set correctly. … … 435 439 * @todo Define output callback. 436 440 */ 437 DISDECL( bool) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t*pcbSize, char *pszOutput);441 DISDECL(int) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, unsigned u32EipOffset, unsigned *pcbSize, char *pszOutput); 438 442 439 443 /** 440 444 * Disassembles one instruction 441 445 * 442 * @returns Success indicator.446 * @returns VBox error code 443 447 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 444 448 * set correctly. … … 452 456 * @todo Define output callback. 453 457 */ 454 DISDECL( bool) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t *pcbSize,455 char *pszOutput, u int32_tuFilter);458 DISDECL(int) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t *pcbSize, 459 char *pszOutput, unsigned uFilter); 456 460 457 461 /** … … 459 463 * The result is found in pCpu. 460 464 * 461 * @returns Success indicator.465 * @returns VBox error code 462 466 * @param pCpu Pointer to cpu structure which has DISCPUSTATE::mode set correctly. 463 467 * @param InstructionAddr Pointer to the instruction to parse. … … 465 469 * NULL is allowed. 466 470 */ 467 DISDECL( bool) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction);471 DISDECL(int) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction); 468 472 469 473 /** -
trunk/include/VBox/err.h
r4738 r4953 1117 1117 1118 1118 1119 /** @name VBox Disassembler Status Codes 1120 * @{ 1121 */ 1122 /** Invalid opcode byte(s) */ 1123 #define VERR_DIS_INVALID_OPCODE (-5000) 1124 /** Generic failure during disassembly. */ 1125 #define VERR_DIS_GEN_FAILURE (-5001) 1126 /** @} */ 1127 1119 1128 /* SED-END */ 1120 1129 -
trunk/src/VBox/Disassembler/Disasm.cpp
r4071 r4953 36 36 * Disassembles a code block. 37 37 * 38 * @returns Success indicator.38 * @returns VBox error code 39 39 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 40 40 * set correctly. … … 53 53 * This means *pcbSize >= cbMax sometimes. 54 54 */ 55 DISDECL( bool) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, int32_t cbMax, uint32_t*pSize)55 DISDECL(int) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, unsigned cbMax, unsigned *pSize) 56 56 { 57 int32_ti = 0;57 unsigned i = 0; 58 58 char szOutput[256]; 59 59 60 60 while (i < cbMax) 61 61 { 62 uint32_t cbInstr; 63 if (!DISInstr(pCpu, pvCodeBlock + i, 0, &cbInstr, szOutput)) 64 return false; 62 unsigned cbInstr; 63 int rc = DISInstr(pCpu, pvCodeBlock + i, 0, &cbInstr, szOutput); 64 if (VBOX_FAILURE(rc)) 65 return rc; 65 66 66 67 i += cbInstr; … … 75 76 * Disassembles one instruction 76 77 * 77 * @returns Success indicator.78 * @returns VBox error code 78 79 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 79 80 * set correctly. … … 86 87 * @todo Define output callback. 87 88 */ 88 DISDECL( bool) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t*pcbSize,89 DISDECL(int) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, unsigned u32EipOffset, unsigned *pcbSize, 89 90 char *pszOutput) 90 91 { … … 95 96 * Disassembles one instruction; only fully disassembly an instruction if it matches the filter criteria 96 97 * 97 * @returns Success indicator.98 * @returns VBox error code 98 99 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 99 100 * set correctly. … … 107 108 * @todo Define output callback. 108 109 */ 109 DISDECL( bool) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t*pcbSize,110 char *pszOutput, u int32_tuFilter)110 DISDECL(int) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, unsigned u32EipOffset, unsigned *pcbSize, 111 char *pszOutput, unsigned uFilter) 111 112 { 112 inti = 0, prefixbytes;113 intidx, inc;113 unsigned i = 0, prefixbytes; 114 unsigned idx, inc; 114 115 #ifdef __L4ENV__ 115 116 jmp_buf jumpbuffer; … … 165 166 AssertMsgFailed(("Invalid opcode!!\n")); 166 167 #endif 167 return false;168 return VERR_DIS_INVALID_OPCODE; 168 169 169 170 // segment override prefix byte … … 245 246 if (pcbSize) 246 247 *pcbSize = 0; 247 return false;248 return VERR_DIS_GEN_FAILURE; 248 249 } 249 250 … … 251 252 *pcbSize = i; 252 253 253 return true;254 return VINF_SUCCESS; 254 255 } 255 256 //***************************************************************************** -
trunk/src/VBox/Disassembler/DisasmCore.cpp
r4283 r4953 60 60 #endif 61 61 62 static intQueryModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc = NULL);63 static intQueryModRM_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc = NULL);64 static intUseSIB(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);65 static intParseSIB_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);62 static unsigned QueryModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc = NULL); 63 static unsigned QueryModRM_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc = NULL); 64 static void UseSIB(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 65 static unsigned ParseSIB_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 66 66 67 67 /******************************************************************************* … … 257 257 * NULL is allowed. 258 258 */ 259 DISDECL( bool) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction)259 DISDECL(int) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction) 260 260 { 261 261 /* … … 295 295 * @param InstructionAddr Address of the instruction to decode. What this means 296 296 * is left to the pfnReadBytes function. 297 * @param CpuModeThe CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT.297 * @param uCpuMode The CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT. 298 298 * @param pfnReadBytes Callback for reading instruction bytes. 299 * @param pvUser User argument for the instruction reader. (Ends up in dwUserData[0].)299 * @param pvUser User argument for the instruction reader. (Ends up in apvUserData[0].) 300 300 * @param pCpu Pointer to cpu structure. Will be initialized. 301 301 * @param pcbInstruction Where to store the size of the instruction. 302 302 * NULL is allowed. 303 303 */ 304 DISDECL(int) DISCoreOneEx(RTUINTPTR InstructionAddr, unsigned CpuMode, PFN_DIS_READBYTES pfnReadBytes, void *pvUser,304 DISDECL(int) DISCoreOneEx(RTUINTPTR InstructionAddr, unsigned uCpuMode, PFN_DIS_READBYTES pfnReadBytes, void *pvUser, 305 305 PDISCPUSTATE pCpu, unsigned *pcbInstruction) 306 306 { … … 311 311 pCpu->prefix_seg = 0; 312 312 pCpu->lastprefix = 0; 313 pCpu->mode = CpuMode;314 pCpu->addrmode = CpuMode;315 pCpu->opmode = CpuMode;313 pCpu->mode = uCpuMode; 314 pCpu->addrmode = uCpuMode; 315 pCpu->opmode = uCpuMode; 316 316 pCpu->ModRM = 0; 317 317 pCpu->SIB = 0; … … 322 322 pCpu->param2.szParam[0] = '\0'; 323 323 pCpu->param3.szParam[0] = '\0'; 324 pCpu->param1.flags = 0;325 pCpu->param2.flags = 0;326 pCpu->param3.flags = 0;327 pCpu->param1.size = 0;328 pCpu->param2.size = 0;329 pCpu->param3.size = 0;330 pCpu->pfnReadBytes = pfnReadBytes;331 pCpu-> dwUserData[0] = (uintptr_t)pvUser; Assert(sizeof(pCpu->dwUserData) >= sizeof(uintptr_t));332 pCpu->uFilter = OPTYPE_ALL;333 pCpu->pfnDisasmFnTable = pfnFullDisasm;324 pCpu->param1.flags = 0; 325 pCpu->param2.flags = 0; 326 pCpu->param3.flags = 0; 327 pCpu->param1.size = 0; 328 pCpu->param2.size = 0; 329 pCpu->param3.size = 0; 330 pCpu->pfnReadBytes = pfnReadBytes; 331 pCpu->apvUserData[0] = pvUser; 332 pCpu->uFilter = OPTYPE_ALL; 333 pCpu->pfnDisasmFnTable = pfnFullDisasm; 334 334 335 335 return disCoreOne(pCpu, InstructionAddr, pcbInstruction); … … 838 838 //***************************************************************************** 839 839 //***************************************************************************** 840 intParseInstruction(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu)840 unsigned ParseInstruction(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu) 841 841 { 842 842 int size = 0; … … 888 888 /* Floating point opcode parsing */ 889 889 //***************************************************************************** 890 intParseEscFP(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)890 unsigned ParseEscFP(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 891 891 { 892 892 int index; 893 893 const OPCODE *fpop; 894 intsize = 0;894 unsigned size = 0; 895 895 896 896 pCpu->ModRM = DISReadByte(pCpu, lpszCodeBlock); … … 971 971 972 972 //***************************************************************************** 973 intUseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)973 void UseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 974 974 { 975 975 int scale, base, index; … … 1019 1019 pParam->base.reg_gen32 = base; 1020 1020 } 1021 return 0; //already fetched everything in ParseSIB1022 } 1023 //***************************************************************************** 1024 //***************************************************************************** 1025 intParseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1026 { 1027 intsize = sizeof(uint8_t), base;1021 return; /* Already fetched everything in ParseSIB; no size returned */ 1022 } 1023 //***************************************************************************** 1024 //***************************************************************************** 1025 unsigned ParseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1026 { 1027 unsigned size = sizeof(uint8_t), base; 1028 1028 1029 1029 pCpu->SIB = DISReadByte(pCpu, lpszCodeBlock); … … 1040 1040 //***************************************************************************** 1041 1041 //***************************************************************************** 1042 intParseSIB_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1043 { 1044 intsize = sizeof(uint8_t), base;1042 unsigned ParseSIB_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1043 { 1044 unsigned size = sizeof(uint8_t), base; 1045 1045 1046 1046 pCpu->SIB = DISReadByte(pCpu, lpszCodeBlock); … … 1059 1059 // Mod Reg/Opcode R/M 1060 1060 //***************************************************************************** 1061 intUseModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1061 unsigned UseModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1062 1062 { 1063 1063 int reg = MODRM_REG(pCpu->ModRM); … … 1262 1262 // Query the size of the ModRM parameters and fetch the immediate data (if any) 1263 1263 //***************************************************************************** 1264 intQueryModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc)1264 unsigned QueryModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc) 1265 1265 { 1266 1266 int mod, rm, sibinc; 1267 intsize = 0;1267 unsigned size = 0; 1268 1268 1269 1269 rm = MODRM_RM(pCpu->ModRM); … … 1340 1340 // Query the size of the ModRM parameters and fetch the immediate data (if any) 1341 1341 //***************************************************************************** 1342 intQueryModRM_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc)1342 unsigned QueryModRM_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu, int *pSibInc) 1343 1343 { 1344 1344 int mod, rm, sibinc; 1345 intsize = 0;1345 unsigned size = 0; 1346 1346 1347 1347 rm = MODRM_RM(pCpu->ModRM); … … 1411 1411 //***************************************************************************** 1412 1412 //***************************************************************************** 1413 intParseIllegal(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1413 unsigned ParseIllegal(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1414 1414 { 1415 1415 AssertFailed(); … … 1418 1418 //***************************************************************************** 1419 1419 //***************************************************************************** 1420 intParseModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1421 { 1422 intsize = sizeof(uint8_t); //ModRM byte1420 unsigned ParseModRM(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1421 { 1422 unsigned size = sizeof(uint8_t); //ModRM byte 1423 1423 int sibinc; 1424 1424 … … 1435 1435 //***************************************************************************** 1436 1436 //***************************************************************************** 1437 intParseModRM_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1438 { 1439 intsize = sizeof(uint8_t); //ModRM byte1437 unsigned ParseModRM_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1438 { 1439 unsigned size = sizeof(uint8_t); //ModRM byte 1440 1440 int sibinc; 1441 1441 … … 1451 1451 //***************************************************************************** 1452 1452 //***************************************************************************** 1453 intParseModFence(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1453 unsigned ParseModFence(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1454 1454 { 1455 1455 ////AssertMsgFailed(("??\n")); … … 1459 1459 //***************************************************************************** 1460 1460 //***************************************************************************** 1461 intParseImmByte(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1461 unsigned ParseImmByte(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1462 1462 { 1463 1463 pParam->parval = DISReadByte(pCpu, lpszCodeBlock); … … 1469 1469 //***************************************************************************** 1470 1470 //***************************************************************************** 1471 intParseImmByte_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1471 unsigned ParseImmByte_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1472 1472 { 1473 1473 return sizeof(uint8_t); … … 1475 1475 //***************************************************************************** 1476 1476 //***************************************************************************** 1477 intParseImmByteSX(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1477 unsigned ParseImmByteSX(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1478 1478 { 1479 1479 if(pCpu->opmode == CPUMODE_32BIT) … … 1493 1493 //***************************************************************************** 1494 1494 //***************************************************************************** 1495 intParseImmByteSX_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1495 unsigned ParseImmByteSX_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1496 1496 { 1497 1497 return sizeof(uint8_t); … … 1499 1499 //***************************************************************************** 1500 1500 //***************************************************************************** 1501 intParseImmUshort(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1501 unsigned ParseImmUshort(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1502 1502 { 1503 1503 pParam->parval = DISReadWord(pCpu, lpszCodeBlock); … … 1509 1509 //***************************************************************************** 1510 1510 //***************************************************************************** 1511 intParseImmUshort_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1511 unsigned ParseImmUshort_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1512 1512 { 1513 1513 return sizeof(uint16_t); … … 1515 1515 //***************************************************************************** 1516 1516 //***************************************************************************** 1517 intParseImmUlong(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1517 unsigned ParseImmUlong(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1518 1518 { 1519 1519 pParam->parval = DISReadDWord(pCpu, lpszCodeBlock); … … 1525 1525 //***************************************************************************** 1526 1526 //***************************************************************************** 1527 intParseImmUlong_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1527 unsigned ParseImmUlong_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1528 1528 { 1529 1529 return sizeof(uint32_t); … … 1531 1531 //***************************************************************************** 1532 1532 //***************************************************************************** 1533 intParseImmQword(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1533 unsigned ParseImmQword(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1534 1534 { 1535 1535 pParam->parval = DISReadQWord(pCpu, lpszCodeBlock); … … 1542 1542 //***************************************************************************** 1543 1543 //***************************************************************************** 1544 intParseImmQword_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1544 unsigned ParseImmQword_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1545 1545 { 1546 1546 return sizeof(uint64_t); … … 1548 1548 //***************************************************************************** 1549 1549 //***************************************************************************** 1550 intParseImmV(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1550 unsigned ParseImmV(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1551 1551 { 1552 1552 if(pCpu->opmode == CPUMODE_32BIT) … … 1569 1569 //***************************************************************************** 1570 1570 //***************************************************************************** 1571 intParseImmV_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1571 unsigned ParseImmV_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1572 1572 { 1573 1573 if(pCpu->opmode == CPUMODE_32BIT) … … 1583 1583 // Relative displacement for branches (rel. to next instruction) 1584 1584 //***************************************************************************** 1585 intParseImmBRel(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1585 unsigned ParseImmBRel(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1586 1586 { 1587 1587 pParam->parval = DISReadByte(pCpu, lpszCodeBlock); … … 1594 1594 // Relative displacement for branches (rel. to next instruction) 1595 1595 //***************************************************************************** 1596 intParseImmBRel_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1596 unsigned ParseImmBRel_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1597 1597 { 1598 1598 return sizeof(char); … … 1601 1601 // Relative displacement for branches (rel. to next instruction) 1602 1602 //***************************************************************************** 1603 intParseImmVRel(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1603 unsigned ParseImmVRel(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1604 1604 { 1605 1605 if(pCpu->opmode == CPUMODE_32BIT) … … 1623 1623 // Relative displacement for branches (rel. to next instruction) 1624 1624 //***************************************************************************** 1625 intParseImmVRel_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1625 unsigned ParseImmVRel_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1626 1626 { 1627 1627 if(pCpu->opmode == CPUMODE_32BIT) … … 1636 1636 //***************************************************************************** 1637 1637 //***************************************************************************** 1638 intParseImmAddr(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1638 unsigned ParseImmAddr(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1639 1639 { 1640 1640 disasmGetPtrString(pCpu, pOp, pParam); … … 1689 1689 //***************************************************************************** 1690 1690 //***************************************************************************** 1691 intParseImmAddr_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1691 unsigned ParseImmAddr_SizeOnly(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1692 1692 { 1693 1693 if(pCpu->addrmode == CPUMODE_32BIT) … … 1716 1716 //***************************************************************************** 1717 1717 //***************************************************************************** 1718 intParseFixedReg(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1718 unsigned ParseFixedReg(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1719 1719 { 1720 1720 /* … … 1786 1786 //***************************************************************************** 1787 1787 //***************************************************************************** 1788 intParseXv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1788 unsigned ParseXv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1789 1789 { 1790 1790 disasmGetPtrString(pCpu, pOp, pParam); … … 1806 1806 //***************************************************************************** 1807 1807 //***************************************************************************** 1808 intParseXb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1808 unsigned ParseXb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1809 1809 { 1810 1810 disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), (pCpu->addrmode == CPUMODE_32BIT) ? "DS:ESI" : "DS:SI"); … … 1825 1825 //***************************************************************************** 1826 1826 //***************************************************************************** 1827 intParseYv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1827 unsigned ParseYv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1828 1828 { 1829 1829 disasmGetPtrString(pCpu, pOp, pParam); … … 1845 1845 //***************************************************************************** 1846 1846 //***************************************************************************** 1847 intParseYb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1847 unsigned ParseYb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1848 1848 { 1849 1849 disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), (pCpu->addrmode == CPUMODE_32BIT) ? "ES:EDI" : "ES:DI"); … … 1864 1864 //***************************************************************************** 1865 1865 //***************************************************************************** 1866 intParseTwoByteEsc(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1866 unsigned ParseTwoByteEsc(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1867 1867 { 1868 1868 const OPCODE *pOpcode; … … 1920 1920 //***************************************************************************** 1921 1921 //***************************************************************************** 1922 intParseNopPause(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1923 { 1924 intsize = 0;1922 unsigned ParseNopPause(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1923 { 1924 unsigned size = 0; 1925 1925 1926 1926 if (pCpu->prefix & PREFIX_REP) … … 1937 1937 //***************************************************************************** 1938 1938 //***************************************************************************** 1939 intParseImmGrpl(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1939 unsigned ParseImmGrpl(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1940 1940 { 1941 1941 int idx = (pCpu->opcode - 0x80) * 8; 1942 intsize = 0, modrm, reg;1942 unsigned size = 0, modrm, reg; 1943 1943 1944 1944 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 1958 1958 //***************************************************************************** 1959 1959 //***************************************************************************** 1960 intParseShiftGrp2(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)1960 unsigned ParseShiftGrp2(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 1961 1961 { 1962 1962 int idx; 1963 intsize = 0, modrm, reg;1963 unsigned size = 0, modrm, reg; 1964 1964 1965 1965 switch(pCpu->opcode) … … 1999 1999 //***************************************************************************** 2000 2000 //***************************************************************************** 2001 intParseGrp3(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2001 unsigned ParseGrp3(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2002 2002 { 2003 2003 int idx = (pCpu->opcode - 0xF6) * 8; 2004 intsize = 0, modrm, reg;2004 unsigned size = 0, modrm, reg; 2005 2005 2006 2006 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2021 2021 //***************************************************************************** 2022 2022 //***************************************************************************** 2023 intParseGrp4(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2024 { 2025 intsize = 0, modrm, reg;2023 unsigned ParseGrp4(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2024 { 2025 unsigned size = 0, modrm, reg; 2026 2026 2027 2027 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2042 2042 //***************************************************************************** 2043 2043 //***************************************************************************** 2044 intParseGrp5(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2045 { 2046 intsize = 0, modrm, reg;2044 unsigned ParseGrp5(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2045 { 2046 unsigned size = 0, modrm, reg; 2047 2047 2048 2048 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2067 2067 // 2068 2068 //***************************************************************************** 2069 intParse3DNow(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2070 { 2071 intsize = 0, modrmsize;2069 unsigned Parse3DNow(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2070 { 2071 unsigned size = 0, modrmsize; 2072 2072 2073 2073 #ifdef DEBUG_Sander … … 2100 2100 //***************************************************************************** 2101 2101 //***************************************************************************** 2102 intParseGrp6(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2103 { 2104 intsize = 0, modrm, reg;2102 unsigned ParseGrp6(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2103 { 2104 unsigned size = 0, modrm, reg; 2105 2105 2106 2106 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2121 2121 //***************************************************************************** 2122 2122 //***************************************************************************** 2123 intParseGrp7(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2124 { 2125 intsize = 0, modrm, reg, rm, mod;2123 unsigned ParseGrp7(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2124 { 2125 unsigned size = 0, modrm, reg, rm, mod; 2126 2126 2127 2127 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2154 2154 //***************************************************************************** 2155 2155 //***************************************************************************** 2156 intParseGrp8(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2157 { 2158 intsize = 0, modrm, reg;2156 unsigned ParseGrp8(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2157 { 2158 unsigned size = 0, modrm, reg; 2159 2159 2160 2160 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2175 2175 //***************************************************************************** 2176 2176 //***************************************************************************** 2177 intParseGrp9(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2178 { 2179 intsize = 0, modrm, reg;2177 unsigned ParseGrp9(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2178 { 2179 unsigned size = 0, modrm, reg; 2180 2180 2181 2181 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2196 2196 //***************************************************************************** 2197 2197 //***************************************************************************** 2198 intParseGrp10(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2199 { 2200 intsize = 0, modrm, reg;2198 unsigned ParseGrp10(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2199 { 2200 unsigned size = 0, modrm, reg; 2201 2201 2202 2202 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2217 2217 //***************************************************************************** 2218 2218 //***************************************************************************** 2219 intParseGrp12(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2220 { 2221 intsize = 0, modrm, reg;2219 unsigned ParseGrp12(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2220 { 2221 unsigned size = 0, modrm, reg; 2222 2222 2223 2223 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2243 2243 //***************************************************************************** 2244 2244 //***************************************************************************** 2245 intParseGrp13(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2246 { 2247 intsize = 0, modrm, reg;2245 unsigned ParseGrp13(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2246 { 2247 unsigned size = 0, modrm, reg; 2248 2248 2249 2249 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2268 2268 //***************************************************************************** 2269 2269 //***************************************************************************** 2270 intParseGrp14(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2271 { 2272 intsize = 0, modrm, reg;2270 unsigned ParseGrp14(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2271 { 2272 unsigned size = 0, modrm, reg; 2273 2273 2274 2274 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2293 2293 //***************************************************************************** 2294 2294 //***************************************************************************** 2295 intParseGrp15(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2296 { 2297 intsize = 0, modrm, reg, mod, rm;2295 unsigned ParseGrp15(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2296 { 2297 unsigned size = 0, modrm, reg, mod, rm; 2298 2298 2299 2299 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2319 2319 //***************************************************************************** 2320 2320 //***************************************************************************** 2321 intParseGrp16(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)2322 { 2323 intsize = 0, modrm, reg;2321 unsigned ParseGrp16(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 2322 { 2323 unsigned size = 0, modrm, reg; 2324 2324 2325 2325 modrm = DISReadByte(pCpu, lpszCodeBlock); … … 2511 2511 int rc; 2512 2512 2513 rc = pCpu->pfnReadBytes(pAddress, &temp, sizeof(temp), (RTUINTPTR)pCpu);2513 rc = pCpu->pfnReadBytes(pAddress, &temp, sizeof(temp), pCpu); 2514 2514 if(VBOX_FAILURE(rc)) 2515 2515 { … … 2535 2535 int rc; 2536 2536 2537 rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), (RTUINTPTR)pCpu);2537 rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), pCpu); 2538 2538 if(VBOX_FAILURE(rc)) 2539 2539 { … … 2559 2559 int rc; 2560 2560 2561 rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), (RTUINTPTR)pCpu);2561 rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), pCpu); 2562 2562 if(VBOX_FAILURE(rc)) 2563 2563 { … … 2583 2583 int rc; 2584 2584 2585 rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), (RTUINTPTR)pCpu);2585 rc = pCpu->pfnReadBytes(pAddress, (uint8_t*)&temp, sizeof(temp), pCpu); 2586 2586 if(VBOX_FAILURE(rc)) 2587 2587 { -
trunk/src/VBox/Disassembler/DisasmInternal.h
r4071 r4953 82 82 __BEGIN_DECLS 83 83 84 intParseInstruction(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu);84 unsigned ParseInstruction(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, PDISCPUSTATE pCpu); 85 85 86 intParseIllegal(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);87 intParseModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);88 intParseModRM_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);89 intUseModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);90 intParseImmByte(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);91 intParseImmByte_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);92 intParseImmByteSX(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);93 intParseImmByteSX_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);94 intParseImmBRel(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);95 intParseImmBRel_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);96 intParseImmUshort(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);97 intParseImmUshort_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);98 intParseImmV(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);99 intParseImmV_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);100 intParseImmVRel(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);101 intParseImmVRel_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);86 unsigned ParseIllegal(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 87 unsigned ParseModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 88 unsigned ParseModRM_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 89 unsigned UseModRM(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 90 unsigned ParseImmByte(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 91 unsigned ParseImmByte_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 92 unsigned ParseImmByteSX(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 93 unsigned ParseImmByteSX_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 94 unsigned ParseImmBRel(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 95 unsigned ParseImmBRel_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 96 unsigned ParseImmUshort(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 97 unsigned ParseImmUshort_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 98 unsigned ParseImmV(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 99 unsigned ParseImmV_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 100 unsigned ParseImmVRel(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 101 unsigned ParseImmVRel_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 102 102 103 intParseImmAddr(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);104 intParseImmAddr_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);105 intParseFixedReg(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);106 intParseImmUlong(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);107 intParseImmUlong_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);108 intParseImmQword(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);109 intParseImmQword_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);103 unsigned ParseImmAddr(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 104 unsigned ParseImmAddr_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 105 unsigned ParseFixedReg(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 106 unsigned ParseImmUlong(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 107 unsigned ParseImmUlong_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 108 unsigned ParseImmQword(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 109 unsigned ParseImmQword_SizeOnly(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 110 110 111 intParseTwoByteEsc(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);112 intParseImmGrpl(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);113 intParseShiftGrp2(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);114 intParseGrp3(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);115 intParseGrp4(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);116 intParseGrp5(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);117 intParse3DNow(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);118 intParseGrp6(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);119 intParseGrp7(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);120 intParseGrp8(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);121 intParseGrp9(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);122 intParseGrp10(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);123 intParseGrp12(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);124 intParseGrp13(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);125 intParseGrp14(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);126 intParseGrp15(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);127 intParseGrp16(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);128 intParseModFence(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);129 intParseNopPause(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);111 unsigned ParseTwoByteEsc(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 112 unsigned ParseImmGrpl(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 113 unsigned ParseShiftGrp2(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 114 unsigned ParseGrp3(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 115 unsigned ParseGrp4(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 116 unsigned ParseGrp5(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 117 unsigned Parse3DNow(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 118 unsigned ParseGrp6(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 119 unsigned ParseGrp7(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 120 unsigned ParseGrp8(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 121 unsigned ParseGrp9(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 122 unsigned ParseGrp10(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 123 unsigned ParseGrp12(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 124 unsigned ParseGrp13(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 125 unsigned ParseGrp14(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 126 unsigned ParseGrp15(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 127 unsigned ParseGrp16(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 128 unsigned ParseModFence(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 129 unsigned ParseNopPause(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 130 130 131 intParseYv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);132 intParseYb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);133 intParseXv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);134 intParseXb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);131 unsigned ParseYv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 132 unsigned ParseYb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 133 unsigned ParseXv(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 134 unsigned ParseXb(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 135 135 136 136 /* Floating point parsing */ 137 intParseEscFP(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu);137 unsigned ParseEscFP(RTUINTPTR pu8CodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu); 138 138 139 139 /* Disassembler printf */ -
trunk/src/VBox/VMM/CPUM.cpp
r4691 r4953 1512 1512 /** Pointer to the current page - GC Ptr. */ 1513 1513 RTGCPTR pvPageGC; 1514 /** The rc of the operation.1515 *1516 * @todo r=bird: it's rather annoying that we have to keep track of the status code of the operation.1517 * When we've got time we should adjust the disassembler to use VBox status codes and not1518 * boolean returns.1519 */1520 int rc;1521 1514 } CPUMDISASSTATE, *PCPUMDISASSTATE; 1522 1515 … … 1525 1518 * Instruction reader. 1526 1519 * 1527 * @returns VBox status code. (Why this is a int32_t and not just an int is also beyond me.)1520 * @returns VBox status code. 1528 1521 * @param PtrSrc Address to read from. 1529 1522 * In our case this is relative to the selector pointed to by the 2nd user argument of uDisCpu. 1530 1523 * @param pu8Dst Where to store the bytes. 1531 1524 * @param cbRead Number of bytes to read. 1532 * @param uDisCpu Pointer to the disassembler cpu state. (Why this is a VBOXHUINTPTR is beyond me...)1525 * @param uDisCpu Pointer to the disassembler cpu state. 1533 1526 * In this context it's always pointer to the Core of a DBGFDISASSTATE. 1534 * @todo r=bird: The status code should be an int. The PtrSrc should *NOT* be a RTHCUINTPTR. The uDisCpu could just as well be 1535 * declared as what it actually is a PDISCPUSTATE. 1536 */ 1537 static DECLCALLBACK(int32_t) cpumR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, uint32_t cbRead, RTHCUINTPTR uDisCpu) 1527 */ 1528 static DECLCALLBACK(int) cpumR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, uint32_t cbRead, void *uDisCpu) 1538 1529 { 1539 1530 PDISCPUSTATE pCpu = (PDISCPUSTATE)uDisCpu; 1540 PCPUMDISASSTATE pState = (PCPUMDISASSTATE)pCpu-> dwUserData[0]; /** @todo r=bird: Invalid prefix, dw='double word' which it isn't. Besides it's an array too. And btw. RTHCUINTPTR isn't the right thing either in a 32-bit host 64-bit guest situation */1531 PCPUMDISASSTATE pState = (PCPUMDISASSTATE)pCpu->apvUserData[0]; 1541 1532 Assert(cbRead > 0); 1542 1533 for (;;) … … 1548 1539 || (GCPtr >> PAGE_SHIFT) != (pState->pvPageGC >> PAGE_SHIFT)) 1549 1540 { 1541 int rc = VINF_SUCCESS; 1542 1550 1543 /* translate the address */ 1551 1544 pState->pvPageGC = GCPtr & PAGE_BASE_GC_MASK; … … 1554 1547 pState->pvPageHC = MMHyperGC2HC(pState->pVM, pState->pvPageGC); 1555 1548 if (!pState->pvPageHC) 1556 pState->rc = VERR_INVALID_POINTER;1549 rc = VERR_INVALID_POINTER; 1557 1550 } 1558 1551 else 1559 pState->rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC);1560 if (VBOX_FAILURE( pState->rc))1552 rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC); 1553 if (VBOX_FAILURE(rc)) 1561 1554 { 1562 1555 pState->pvPageHC = NULL; 1563 return pState->rc;1556 return rc; 1564 1557 } 1565 1558 } … … 1567 1560 /* check the segemnt limit */ 1568 1561 if (PtrSrc > pState->cbSegLimit) 1569 return pState->rc =VERR_OUT_OF_SELECTOR_BOUNDS;1562 return VERR_OUT_OF_SELECTOR_BOUNDS; 1570 1563 1571 1564 /* calc how much we can read */ … … 1607 1600 State.pvPageGC = 0; 1608 1601 State.pvPageHC = NULL; 1609 State.rc = VINF_SUCCESS;1610 1602 State.pVM = pVM; 1611 1603 … … 1662 1654 */ 1663 1655 pCpu->pfnReadBytes = cpumR3DisasInstrRead; 1664 pCpu-> dwUserData[0] = (uintptr_t)&State;1656 pCpu->apvUserData[0] = &State; 1665 1657 1666 1658 uint32_t cbInstr; 1667 1659 #ifdef LOG_ENABLED 1668 if (DISInstr(pCpu, GCPtrPC, 0, &cbInstr, NULL)) 1660 rc = DISInstr(pCpu, GCPtrPC, 0, &cbInstr, NULL); 1661 if (VBOX_SUCCESS(rc)) 1669 1662 { 1670 1663 #else 1671 1664 char szOutput[160]; 1672 if (DISInstr(pCpu, GCPtrPC, 0, &cbInstr, &szOutput[0])) 1665 rc = DISInstr(pCpu, GCPtrPC, 0, &cbInstr, &szOutput[0]); 1666 if (VBOX_SUCCESS(rc)) 1673 1667 { 1674 1668 /* log it */ … … 1681 1675 } 1682 1676 1683 /* DISInstr failure */ 1684 if (VBOX_FAILURE(State.rc)) 1685 { 1686 Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%VGv rc=%Vrc\n", pCtx->cs, GCPtrPC, State.rc)); 1687 return State.rc; 1688 } 1689 Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%VGv\n", pCtx->cs, GCPtrPC)); 1690 rc = VERR_GENERAL_FAILURE; 1677 Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%VGv rc=%Vrc\n", pCtx->cs, GCPtrPC, rc)); 1691 1678 return rc; 1692 1679 } -
trunk/src/VBox/VMM/DBGFDisas.cpp
r4071 r4953 40 40 * Internal Functions * 41 41 *******************************************************************************/ 42 static DECLCALLBACK(int 32_t) dbgfR3DisasInstrRead(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata);42 static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata); 43 43 44 44 … … 65 65 /** Pointer to the current page - GC Ptr. */ 66 66 RTGCPTR pvPageGC; 67 /** The rc of the operation.68 * @todo r=bird: it's rather annoying that we have to keep track of the status code of the operation.69 * When we've got time we should adjust the disassembler to use VBox status codes and not70 * boolean returns.71 */72 int rc;73 67 /** Pointer to the next instruction (relative to GCPtrSegBase). */ 74 68 RTGCUINTPTR GCPtrNext; … … 97 91 pState->pvPageGC = 0; 98 92 pState->pvPageHC = NULL; 99 pState->rc = VINF_SUCCESS;100 93 pState->pVM = pVM; 101 94 Assert((uintptr_t)GCPtr == GCPtr); 102 95 uint32_t cbInstr; 103 if (DISInstr(&pState->Cpu, GCPtr, 0, &cbInstr, NULL)) 96 int rc = DISInstr(&pState->Cpu, GCPtr, 0, &cbInstr, NULL); 97 if (VBOX_SUCCESS(rc)) 104 98 { 105 99 pState->GCPtrNext = GCPtr + cbInstr; 106 100 return VINF_SUCCESS; 107 101 } 108 if (VBOX_FAILURE(pState->rc)) 109 return pState->rc; 110 return VERR_GENERAL_FAILURE; 102 return rc; 111 103 } 112 104 … … 123 115 pState->rc = VINF_SUCCESS; 124 116 uint32_t cbInstr; 125 if (DISInstr(&pState->Cpu, (void *)pState->GCPtrNext, 0, &cbInstr, NULL)) 117 int rc = DISInstr(&pState->Cpu, (void *)pState->GCPtrNext, 0, &cbInstr, NULL); 118 if (VBOX_SUCCESS(rc)) 126 119 { 127 120 pState->GCPtrNext = GCPtr + cbInstr; 128 121 return VINF_SUCCESS; 129 122 } 130 if (VBOX_FAILURE(pState->rc)) 131 return pState->rc; 132 return VERR_GENERAL_FAILURE; 123 return rc; 133 124 } 134 125 #endif … … 146 137 * In this context it's always pointer to the Core of a DBGFDISASSTATE. 147 138 */ 148 static DECLCALLBACK(int 32_t) dbgfR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, uint32_t cbRead, RTHCUINTPTR uDisCpu)149 { 150 PDBGFDISASSTATE pState = (PDBGFDISASSTATE) uDisCpu;139 static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, unsigned cbRead, void *pvDisCpu) 140 { 141 PDBGFDISASSTATE pState = (PDBGFDISASSTATE)pvDisCpu; 151 142 Assert(cbRead > 0); 152 143 for (;;) … … 158 149 || (GCPtr >> PAGE_SHIFT) != (pState->pvPageGC >> PAGE_SHIFT)) 159 150 { 151 int rc = VINF_SUCCESS; 152 160 153 /* translate the address */ 161 154 pState->pvPageGC = GCPtr & PAGE_BASE_GC_MASK; … … 164 157 pState->pvPageHC = MMHyperGC2HC(pState->pVM, pState->pvPageGC); 165 158 if (!pState->pvPageHC) 166 pState->rc = VERR_INVALID_POINTER;159 rc = VERR_INVALID_POINTER; 167 160 } 168 161 else if (pState->enmMode <= PGMMODE_PROTECTED) 169 pState->rc = PGMPhysGCPhys2HCPtr(pState->pVM, pState->pvPageGC, PAGE_SIZE, &pState->pvPageHC);162 rc = PGMPhysGCPhys2HCPtr(pState->pVM, pState->pvPageGC, PAGE_SIZE, &pState->pvPageHC); 170 163 else 171 pState->rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC);172 if (VBOX_FAILURE( pState->rc))164 rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC); 165 if (VBOX_FAILURE(rc)) 173 166 { 174 167 pState->pvPageHC = NULL; 175 return pState->rc;168 return rc; 176 169 } 177 170 } … … 179 172 /* check the segemnt limit */ 180 173 if (PtrSrc > pState->cbSegLimit) 181 return pState->rc =VERR_OUT_OF_SELECTOR_BOUNDS;174 return VERR_OUT_OF_SELECTOR_BOUNDS; 182 175 183 176 /* calc how much we can read */ … … 544 537 size_t cbBits = State.Cpu.opsize; 545 538 uint8_t *pau8Bits = (uint8_t *)alloca(cbBits); 546 rc = dbgfR3DisasInstrRead(GCPtr, pau8Bits, cbBits, (uintptr_t)&State);539 rc = dbgfR3DisasInstrRead(GCPtr, pau8Bits, cbBits, &State); 547 540 AssertRC(rc); 548 541 if (fFlags & DBGF_DISAS_FLAGS_NO_ADDRESS) -
trunk/src/VBox/VMM/PATM/CSAM.cpp
r4776 r4953 593 593 * 594 594 */ 595 int32_t CSAMR3ReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)596 { 597 DISCPUSTATE *pCpu = (DISCPUSTATE *) dwUserdata;598 PVM pVM = (PVM)pCpu-> dwUserData[0];599 RTHCUINTPTR pInstrHC = pCpu->dwUserData[1];600 RTGCUINTPTR pInstrGC = pCpu->dwUserData[2];595 static DECLCALLBACK(int) CSAMR3ReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata) 596 { 597 DISCPUSTATE *pCpu = (DISCPUSTATE *)pvUserdata; 598 PVM pVM = (PVM)pCpu->apvUserData[0]; 599 RTHCUINTPTR pInstrHC = (RTHCUINTPTR)pCpu->apvUserData[1]; 600 RTGCUINTPTR pInstrGC = (RTGCUINTPTR)pCpu->apvUserData[2]; 601 601 int orgsize = size; 602 603 Assert(sizeof(RTHCUINTPTR) <= sizeof(pCpu->dwUserData[0]));604 Assert(sizeof(RTGCUINTPTR) <= sizeof(pCpu->dwUserData[0]));605 602 606 603 /* We are not interested in patched instructions, so read the original opcode bytes. */ … … 638 635 } 639 636 640 inline boolCSAMR3DISInstr(PVM pVM, DISCPUSTATE *pCpu, RTGCPTR InstrGC, uint8_t *InstrHC, uint32_t *pOpsize, char *pszOutput)637 inline int CSAMR3DISInstr(PVM pVM, DISCPUSTATE *pCpu, RTGCPTR InstrGC, uint8_t *InstrHC, uint32_t *pOpsize, char *pszOutput) 641 638 { 642 639 (pCpu)->pfnReadBytes = CSAMR3ReadBytes; 643 (pCpu)-> dwUserData[0] = (RTHCUINTPTR)pVM;644 (pCpu)-> dwUserData[1] = (RTHCUINTPTR)InstrHC;645 (pCpu)-> dwUserData[2] = (RTHCUINTPTR)InstrGC;640 (pCpu)->apvUserData[0] = pVM; 641 (pCpu)->apvUserData[1] = InstrHC; 642 (pCpu)->apvUserData[2] = (void *)InstrGC; Assert(sizeof(InstrGC) <= sizeof(pCpu->apvUserData[0])); 646 643 #ifdef DEBUG 647 644 return DISInstrEx(pCpu, InstrGC, 0, pOpsize, pszOutput, OPTYPE_ALL); … … 718 715 DISCPUSTATE cpu; 719 716 uint8_t *pCurInstrHC = 0; 720 bool disret;721 717 722 718 if (cbInstr + opsize >= SIZEOF_NEARJUMP32) … … 741 737 742 738 cpu.mode = (pPage->fCode32) ? CPUMODE_32BIT : CPUMODE_16BIT; 743 disret= CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL);744 Assert( disret == true);745 if ( disret == false)739 rc = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL); 740 Assert(VBOX_SUCCESS(rc)); 741 if (VBOX_FAILURE(rc)) 746 742 break; 747 743 } … … 889 885 uint32_t opsize; 890 886 uint8_t *pCurInstrHC = 0; 891 bool disret;887 int rc2; 892 888 #ifdef DEBUG 893 889 char szOutput[256]; … … 924 920 STAM_PROFILE_START(&pVM->csam.s.StatTimeDisasm, a); 925 921 #ifdef DEBUG 926 disret= CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, szOutput);927 if ( disret == true) Log(("CSAM Call Analysis: %s", szOutput));922 rc2 = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, szOutput); 923 if (VBOX_SUCCESS(rc2)) Log(("CSAM Call Analysis: %s", szOutput)); 928 924 #else 929 disret= CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL);925 rc2 = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL); 930 926 #endif 931 927 STAM_PROFILE_STOP(&pVM->csam.s.StatTimeDisasm, a); 932 if ( disret == false)928 if (VBOX_FAILURE(rc2)) 933 929 { 934 Log(("Disassembly failed at %VGv (probably page not present) -> return to caller\n", pCurInstrGC));930 Log(("Disassembly failed at %VGv with %Vrc (probably page not present) -> return to caller\n", pCurInstrGC, rc2)); 935 931 goto done; 936 932 } … … 1073 1069 uint32_t opsize; 1074 1070 R3PTRTYPE(uint8_t *) pCurInstrHC = 0; 1075 bool disret;1071 int rc2; 1076 1072 1077 1073 #ifdef DEBUG … … 1134 1130 STAM_PROFILE_START(&pVM->csam.s.StatTimeDisasm, a); 1135 1131 #ifdef DEBUG 1136 disret= CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, szOutput);1137 if ( disret == true) Log(("CSAM Analysis: %s", szOutput));1132 rc2 = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, szOutput); 1133 if (VBOX_SUCCESS(rc2)) Log(("CSAM Analysis: %s", szOutput)); 1138 1134 #else 1139 1135 disret = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL); 1140 1136 #endif 1141 1137 STAM_PROFILE_STOP(&pVM->csam.s.StatTimeDisasm, a); 1142 if ( disret == false)1143 { 1144 Log(("Disassembly failed at %VGv (probably page not present) -> return to caller\n", pCurInstrGC));1138 if (VBOX_FAILURE(rc2)) 1139 { 1140 Log(("Disassembly failed at %VGv with %Vrc (probably page not present) -> return to caller\n", pCurInstrGC, rc2)); 1145 1141 rc = VINF_SUCCESS; 1146 1142 goto done; -
trunk/src/VBox/VMM/PATM/PATM.cpp
r4776 r4953 506 506 * @param pDest HC destination pointer 507 507 * @param size Number of bytes to read 508 * @param dwUserdata Callback specific user data (pCpu)509 * 510 */ 511 int 32_t patmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)512 { 513 DISCPUSTATE *pCpu = (DISCPUSTATE *) dwUserdata;514 PATMDISASM *pDisInfo = (PATMDISASM *)pCpu-> dwUserData[0];508 * @param pvUserdata Callback specific user data (pCpu) 509 * 510 */ 511 int patmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata) 512 { 513 DISCPUSTATE *pCpu = (DISCPUSTATE *)pvUserdata; 514 PATMDISASM *pDisInfo = (PATMDISASM *)pCpu->apvUserData[0]; 515 515 int orgsize = size; 516 516 -
trunk/src/VBox/VMM/PATM/PATMInternal.h
r4776 r4953 662 662 * @param pDest HC destination pointer 663 663 * @param size Number of bytes to read 664 * @param dwUserdata Callback specific user data (pCpu)665 * 666 */ 667 int 32_t patmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata);664 * @param pvUserdata Callback specific user data (pCpu) 665 * 666 */ 667 int patmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata); 668 668 669 669 … … 697 697 disinfo.fReadFlags = fReadFlags; 698 698 (pCpu)->pfnReadBytes = patmReadBytes; 699 (pCpu)-> dwUserData[0] = (RTHCUINTPTR)&disinfo;700 return DISInstr(pCpu, InstrGC, 0, pOpsize, pszOutput);699 (pCpu)->apvUserData[0] = &disinfo; 700 return VBOX_SUCCESS(DISInstr(pCpu, InstrGC, 0, pOpsize, pszOutput)); 701 701 } 702 702 #endif /* !IN_GC */ -
trunk/src/VBox/VMM/PGMInternal.h
r4917 r4953 3106 3106 } 3107 3107 3108 3109 #if 0 3110 /** Soon to be obsolete conversion functions */ 3111 3112 /** 3113 * Converts a GC physical address to a HC pointer. 3114 * 3115 * @returns VINF_SUCCESS on success. 3116 * @returns VERR_PGM_PHYS_PAGE_RESERVED it it's a valid GC physical 3117 * page but has no physical backing. 3118 * @returns VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid 3119 * GC physical address. 3120 * @param pVM The VM handle. 3121 * @param GCPhys The GC physical address to convert. 3122 * @param cbRange Physical range 3123 * @param pHCPtr Where to store the HC pointer on success. 3124 */ 3125 PGMDECL(int) PGMPhysGCPhys2HCPtr(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange, PRTHCPTR pHCPtr); 3126 3127 /** 3128 * Converts a guest pointer to a HC pointer. 3129 * 3130 * This uses the current CR3/CR0/CR4 of the guest. 3131 * 3132 * @returns VBox status code. 3133 * @param pVM The VM Handle 3134 * @param GCPtr The guest pointer to convert. 3135 * @param pHCPtr Where to store the HC virtual address. 3136 */ 3137 PGMDECL(int) PGMPhysGCPtr2HCPtr(PVM pVM, RTGCPTR GCPtr, PRTHCPTR pHCPtr); 3138 3139 /** 3140 * Converts a guest virtual address to a HC pointer by specfied CR3 and flags. 3141 * 3142 * @returns VBox status code. 3143 * @param pVM The VM Handle 3144 * @param GCPtr The guest pointer to convert. 3145 * @param cr3 The guest CR3. 3146 * @param fFlags Flags used for interpreting the PD correctly: X86_CR4_PSE and X86_CR4_PAE 3147 * @param pHCPtr Where to store the HC pointer. 3148 * 3149 * @remark This function is used by the REM at a time where PGM could 3150 * potentially not be in sync. It could also be used by a 3151 * future DBGF API to cpu state independent conversions. 3152 */ 3153 PGMDECL(int) PGMPhysGCPtr2HCPtrByGstCR3(PVM pVM, RTGCPTR GCPtr, uint32_t cr3, unsigned fFlags, PRTHCPTR pHCPtr); 3154 #endif 3155 3108 3156 /** @} */ 3109 3157 -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r4773 r4953 80 80 * 81 81 */ 82 DECLCALLBACK(int 32_t) EMReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)83 { 84 DISCPUSTATE *pCpu = (DISCPUSTATE *) dwUserdata;85 PVM pVM = (PVM)pCpu-> dwUserData[0];82 DECLCALLBACK(int) EMReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata) 83 { 84 DISCPUSTATE *pCpu = (DISCPUSTATE *)pvUserdata; 85 PVM pVM = (PVM)pCpu->apvUserData[0]; 86 86 #ifdef IN_RING0 87 87 int rc = PGMPhysReadGCPtr(pVM, pDest, pSrc, size); -
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r4789 r4953 1193 1193 * @param pDest HC destination pointer 1194 1194 * @param size Number of bytes to read 1195 * @param dwUserdata Callback specific user data (pCpu)1196 * 1197 */ 1198 DECLCALLBACK(int 32_t) iomReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)1199 { 1200 DISCPUSTATE *pCpu = (DISCPUSTATE *) dwUserdata;1201 PVM pVM = (PVM)pCpu-> dwUserData[0];1195 * @param pvUserdata Callback specific user data (pCpu) 1196 * 1197 */ 1198 DECLCALLBACK(int) iomReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata) 1199 { 1200 DISCPUSTATE *pCpu = (DISCPUSTATE *)pvUserdata; 1201 PVM pVM = (PVM)pCpu->apvUserData[0]; 1202 1202 1203 1203 int rc = PGMPhysReadGCPtr(pVM, pDest, pSrc, size); … … 1206 1206 } 1207 1207 1208 inline booliomDisCoreOne(PVM pVM, DISCPUSTATE *pCpu, RTGCUINTPTR InstrGC, uint32_t *pOpsize)1208 inline int iomDisCoreOne(PVM pVM, DISCPUSTATE *pCpu, RTGCUINTPTR InstrGC, uint32_t *pOpsize) 1209 1209 { 1210 1210 return VBOX_SUCCESS(DISCoreOneEx(InstrGC, pCpu->mode, iomReadBytes, pVM, pCpu, pOpsize)); 1211 1211 } 1212 1212 #else 1213 inline booliomDisCoreOne(PVM pVM, DISCPUSTATE *pCpu, RTGCUINTPTR InstrGC, uint32_t *pOpsize)1214 { 1215 return DISCoreOne(pCpu, InstrGC, pOpsize);1213 inline int iomDisCoreOne(PVM pVM, DISCPUSTATE *pCpu, RTGCUINTPTR InstrGC, uint32_t *pOpsize) 1214 { 1215 return VBOX_SUCCESS(DISCoreOne(pCpu, InstrGC, pOpsize)); 1216 1216 } 1217 1217 -
trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
r4917 r4953 1006 1006 * @param pDest HC destination pointer 1007 1007 * @param size Number of bytes to read 1008 * @param dwUserdata Callback specific user data (pCpu)1009 * 1010 */ 1011 DECLCALLBACK(int 32_t) pgmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata)1012 { 1013 DISCPUSTATE *pCpu = (DISCPUSTATE *) dwUserdata;1014 PVM pVM = (PVM)pCpu-> dwUserData[0];1008 * @param pvUserdata Callback specific user data (pCpu) 1009 * 1010 */ 1011 DECLCALLBACK(int) pgmReadBytes(RTHCUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata) 1012 { 1013 DISCPUSTATE *pCpu = (DISCPUSTATE *)pvUserdata; 1014 PVM pVM = (PVM)pCpu->apvUserData[0]; 1015 1015 1016 1016 int rc = PGMPhysReadGCPtr(pVM, pDest, pSrc, size); -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r4932 r4953 561 561 case VMMR0_DO_RAW_RUN: 562 562 { 563 /* Safety precaution as VMX disables the switcher. */ 563 /* We must disable interrupts here */ 564 RTCCUINTREG uFlags = ASMIntDisableFlags(); 565 566 /* Safety precaution as hwaccm disables the switcher. */ 564 567 if (RT_LIKELY(!pVM->vmm.s.fSwitcherDisabled)) 565 568 { … … 575 578 vmmR0RecordRC(pVM, rc); 576 579 #endif 580 ASMSetFlags(uFlags); 577 581 return rc; 578 582 } 583 ASMSetFlags(uFlags); 579 584 580 585 Assert(!pVM->vmm.s.fSwitcherDisabled); … … 588 593 { 589 594 STAM_COUNTER_INC(&pVM->vmm.s.StatRunGC); 595 596 #ifndef RT_OS_WINDOWS /* test on other platforms */ 597 /* We must disable interrupts here */ 598 RTCCUINTREG uFlags = ASMIntDisableFlags(); 599 #endif 590 600 int rc = HWACCMR0Enable(pVM); 591 601 if (VBOX_SUCCESS(rc)) … … 602 612 } 603 613 pVM->vmm.s.iLastGCRc = rc; 614 615 #ifndef RT_OS_WINDOWS /* test on other platforms */ 616 ASMSetFlags(uFlags); 617 #endif 604 618 605 619 #ifdef VBOX_WITH_STATISTICS
Note:
See TracChangeset
for help on using the changeset viewer.