- Timestamp:
- Aug 19, 2024 1:27:44 PM (5 months ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r101546 r105724 312 312 #endif 313 313 314 DISOPPARAM Param1; 315 DISOPPARAM Param2; 316 DISOPPARAM Param3; 317 DISOPPARAM Param4; 314 /** Array of opcode parameters. */ 315 DISOPPARAM aParams[4]; 318 316 319 317 /** The number of valid bytes in DISSTATE::Instr. */ -
trunk/src/VBox/Debugger/DBGPlugInLinux.cpp
r104608 r105724 432 432 * value size. 433 433 * 434 * Param1 is the destination and Param2the source.434 * aParams[0] is the destination and aParams[1] the source. 435 435 */ 436 if ( ( ( (DisState. Param1.fUse & (DISUSE_BASE | DISUSE_REG_GEN32))436 if ( ( ( (DisState.aParams[0].fUse & (DISUSE_BASE | DISUSE_REG_GEN32)) 437 437 && cbVal == sizeof(uint32_t)) 438 || ( (DisState. Param1.fUse & (DISUSE_BASE | DISUSE_REG_GEN64))438 || ( (DisState.aParams[0].fUse & (DISUSE_BASE | DISUSE_REG_GEN64)) 439 439 && cbVal == sizeof(uint64_t))) 440 && DisState. Param1.x86.Base.idxGenReg == DISGREG_RAX)440 && DisState.aParams[0].x86.Base.idxGenReg == DISGREG_RAX) 441 441 { 442 442 /* Parse the source. */ 443 if (DisState. Param2.fUse & (DISUSE_IMMEDIATE32 | DISUSE_IMMEDIATE64))444 memcpy(pvVal, &DisState. Param2.uValue, cbVal);445 else if (DisState. Param2.fUse & (DISUSE_RIPDISPLACEMENT32|DISUSE_DISPLACEMENT32|DISUSE_DISPLACEMENT64))443 if (DisState.aParams[1].fUse & (DISUSE_IMMEDIATE32 | DISUSE_IMMEDIATE64)) 444 memcpy(pvVal, &DisState.aParams[1].uValue, cbVal); 445 else if (DisState.aParams[1].fUse & (DISUSE_RIPDISPLACEMENT32|DISUSE_DISPLACEMENT32|DISUSE_DISPLACEMENT64)) 446 446 { 447 447 RTGCPTR GCPtrVal = 0; 448 448 449 if (DisState. Param2.fUse & DISUSE_RIPDISPLACEMENT32)450 GCPtrVal = GCPtrCur + DisState. Param2.x86.uDisp.i32 + cbInstr;451 else if (DisState. Param2.fUse & DISUSE_DISPLACEMENT32)452 GCPtrVal = (RTGCPTR)DisState. Param2.x86.uDisp.u32;453 else if (DisState. Param2.fUse & DISUSE_DISPLACEMENT64)454 GCPtrVal = (RTGCPTR)DisState. Param2.x86.uDisp.u64;449 if (DisState.aParams[1].fUse & DISUSE_RIPDISPLACEMENT32) 450 GCPtrVal = GCPtrCur + DisState.aParams[1].x86.uDisp.i32 + cbInstr; 451 else if (DisState.aParams[1].fUse & DISUSE_DISPLACEMENT32) 452 GCPtrVal = (RTGCPTR)DisState.aParams[1].x86.uDisp.u32; 453 else if (DisState.aParams[1].fUse & DISUSE_DISPLACEMENT64) 454 GCPtrVal = (RTGCPTR)DisState.aParams[1].x86.uDisp.u64; 455 455 else 456 456 AssertMsgFailedBreakStmt(("Invalid displacement\n"), rc = VERR_INVALID_STATE); … … 570 570 * the source addresses. 571 571 */ 572 if ( (DisState. Param2.fUse & DISUSE_REG_GEN8)573 && ( (DisState. Param2.x86.Base.idxGenReg == DISGREG_AL && !pThis->f64Bit)574 || (DisState. Param2.x86.Base.idxGenReg == DISGREG_DIL && pThis->f64Bit))575 && DISUSE_IS_EFFECTIVE_ADDR(DisState. Param1.fUse))572 if ( (DisState.aParams[1].fUse & DISUSE_REG_GEN8) 573 && ( (DisState.aParams[1].x86.Base.idxGenReg == DISGREG_AL && !pThis->f64Bit) 574 || (DisState.aParams[1].x86.Base.idxGenReg == DISGREG_DIL && pThis->f64Bit)) 575 && DISUSE_IS_EFFECTIVE_ADDR(DisState.aParams[0].fUse)) 576 576 { 577 577 RTGCPTR GCPtrLogBuf = 0; … … 656 656 * source address in the relation table for later processing. 657 657 */ 658 if ( (DisState. Param1.fUse & (DISUSE_BASE | DISUSE_REG_GEN32 | DISUSE_REG_GEN64))659 && (DisState. Param2.x86.cb == sizeof(uint32_t) || DisState.Param2.x86.cb == sizeof(uint64_t))660 && (DisState. Param2.fUse & (DISUSE_RIPDISPLACEMENT32|DISUSE_DISPLACEMENT32|DISUSE_DISPLACEMENT64)))658 if ( (DisState.aParams[0].fUse & (DISUSE_BASE | DISUSE_REG_GEN32 | DISUSE_REG_GEN64)) 659 && (DisState.aParams[1].x86.cb == sizeof(uint32_t) || DisState.aParams[1].x86.cb == sizeof(uint64_t)) 660 && (DisState.aParams[1].fUse & (DISUSE_RIPDISPLACEMENT32|DISUSE_DISPLACEMENT32|DISUSE_DISPLACEMENT64))) 661 661 { 662 662 RTGCPTR GCPtrVal = 0; 663 663 664 if (DisState. Param2.fUse & DISUSE_RIPDISPLACEMENT32)665 GCPtrVal = GCPtrCur + DisState. Param2.x86.uDisp.i32 + cbInstr;666 else if (DisState. Param2.fUse & DISUSE_DISPLACEMENT32)667 GCPtrVal = (RTGCPTR)DisState. Param2.x86.uDisp.u32;668 else if (DisState. Param2.fUse & DISUSE_DISPLACEMENT64)669 GCPtrVal = (RTGCPTR)DisState. Param2.x86.uDisp.u64;664 if (DisState.aParams[1].fUse & DISUSE_RIPDISPLACEMENT32) 665 GCPtrVal = GCPtrCur + DisState.aParams[1].x86.uDisp.i32 + cbInstr; 666 else if (DisState.aParams[1].fUse & DISUSE_DISPLACEMENT32) 667 GCPtrVal = (RTGCPTR)DisState.aParams[1].x86.uDisp.u32; 668 else if (DisState.aParams[1].fUse & DISUSE_DISPLACEMENT64) 669 GCPtrVal = (RTGCPTR)DisState.aParams[1].x86.uDisp.u64; 670 670 else 671 671 AssertMsgFailedBreakStmt(("Invalid displacement\n"), rc = VERR_INVALID_STATE); … … 677 677 aAddresses[cAddressesUsed].cb = sizeof(uint32_t); 678 678 else 679 aAddresses[cAddressesUsed].cb = DisState. Param2.x86.cb;679 aAddresses[cAddressesUsed].cb = DisState.aParams[1].x86.cb; 680 680 aAddresses[cAddressesUsed].GCPtrOrigSrc = GCPtrVal; 681 681 cAddressesUsed++; -
trunk/src/VBox/Devices/BiosCommonCode/MakeAlternativeSource.cpp
r103005 r105724 914 914 { 915 915 PCDISOPCODE pCurInstr = pDis->pCurInstr; 916 return disIsMemoryParameter(&pDis-> Param1, pCurInstr->fParam1)917 || disIsMemoryParameter(&pDis-> Param2, pCurInstr->fParam2)918 || disIsMemoryParameter(&pDis-> Param3, pCurInstr->fParam3)919 || disIsMemoryParameter(&pDis-> Param4, pCurInstr->fParam4);916 return disIsMemoryParameter(&pDis->aParams[0], pCurInstr->fParam1) 917 || disIsMemoryParameter(&pDis->aParams[1], pCurInstr->fParam2) 918 || disIsMemoryParameter(&pDis->aParams[2], pCurInstr->fParam3) 919 || disIsMemoryParameter(&pDis->aParams[3], pCurInstr->fParam4); 920 920 } 921 921 -
trunk/src/VBox/Disassembler/Disasm.cpp
r101539 r105724 308 308 309 309 #ifdef VBOX_STRICT 310 pDis->Param1.uValue = UINT64_C(0xb1b1b1b1b1b1b1b1); 311 pDis->Param2.uValue = UINT64_C(0xb2b2b2b2b2b2b2b2); 312 pDis->Param3.uValue = UINT64_C(0xb3b3b3b3b3b3b3b3); 310 pDis->aParams[0].uValue = UINT64_C(0xb1b1b1b1b1b1b1b1); 311 pDis->aParams[1].uValue = UINT64_C(0xb2b2b2b2b2b2b2b2); 312 pDis->aParams[2].uValue = UINT64_C(0xb3b3b3b3b3b3b3b3); 313 pDis->aParams[3].uValue = UINT64_C(0xb4b4b4b4b4b4b4b4); 313 314 #endif 314 315 -
trunk/src/VBox/Disassembler/DisasmCore-armv8.cpp
r101539 r105724 301 301 302 302 /* Should contain the parameter type on input. */ 303 pDis-> Param1.armv8.fParam = pOp->Opc.fParam1;304 pDis-> Param2.armv8.fParam = pOp->Opc.fParam2;305 pDis-> Param3.armv8.fParam = pOp->Opc.fParam3;306 pDis-> Param4.armv8.fParam = pOp->Opc.fParam4;303 pDis->aParams[0].armv8.fParam = pOp->Opc.fParam1; 304 pDis->aParams[1].armv8.fParam = pOp->Opc.fParam2; 305 pDis->aParams[2].armv8.fParam = pOp->Opc.fParam3; 306 pDis->aParams[3].armv8.fParam = pOp->Opc.fParam4; 307 307 308 308 pDis->pCurInstr = &pOp->Opc; … … 318 318 int rc = VINF_SUCCESS; 319 319 if (pInsnClass->aParms[0].idxParse != kDisParmParseNop) 320 rc = g_apfnDisasm[pInsnClass->aParms[0].idxParse](pDis, u32Insn, pInsnClass, &pDis-> Param1, &pInsnClass->aParms[0], f64Bit);320 rc = g_apfnDisasm[pInsnClass->aParms[0].idxParse](pDis, u32Insn, pInsnClass, &pDis->aParams[0], &pInsnClass->aParms[0], f64Bit); 321 321 322 322 if ( pInsnClass->aParms[1].idxParse != kDisParmParseNop 323 323 && RT_SUCCESS(rc)) 324 rc = g_apfnDisasm[pInsnClass->aParms[1].idxParse](pDis, u32Insn, pInsnClass, &pDis-> Param2, &pInsnClass->aParms[1], f64Bit);324 rc = g_apfnDisasm[pInsnClass->aParms[1].idxParse](pDis, u32Insn, pInsnClass, &pDis->aParams[1], &pInsnClass->aParms[1], f64Bit); 325 325 326 326 if ( pInsnClass->aParms[2].idxParse != kDisParmParseNop 327 327 && RT_SUCCESS(rc)) 328 rc = g_apfnDisasm[pInsnClass->aParms[2].idxParse](pDis, u32Insn, pInsnClass, &pDis-> Param3, &pInsnClass->aParms[2], f64Bit);328 rc = g_apfnDisasm[pInsnClass->aParms[2].idxParse](pDis, u32Insn, pInsnClass, &pDis->aParams[2], &pInsnClass->aParms[2], f64Bit); 329 329 330 330 if ( pInsnClass->aParms[3].idxParse != kDisParmParseNop 331 331 && RT_SUCCESS(rc)) 332 rc = g_apfnDisasm[pInsnClass->aParms[3].idxParse](pDis, u32Insn, pInsnClass, &pDis-> Param4, &pInsnClass->aParms[3], f64Bit);332 rc = g_apfnDisasm[pInsnClass->aParms[3].idxParse](pDis, u32Insn, pInsnClass, &pDis->aParams[3], &pInsnClass->aParms[3], f64Bit); 333 333 334 334 /* If parameter parsing returned an invalid opcode error the encoding is invalid. */ … … 337 337 pDis->pCurInstr = &g_ArmV8A64InvalidOpcode[0]; 338 338 339 pDis-> Param1.armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam1;340 pDis-> Param2.armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam2;341 pDis-> Param3.armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam3;342 pDis-> Param4.armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam4;339 pDis->aParams[0].armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam1; 340 pDis->aParams[1].armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam2; 341 pDis->aParams[2].armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam3; 342 pDis->aParams[3].armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam4; 343 343 } 344 344 pDis->rc = rc; -
trunk/src/VBox/Disassembler/DisasmCore-x86-amd64.cpp
r103927 r105724 265 265 266 266 // Should contain the parameter type on input 267 pDis-> Param1.x86.fParam = pOp->fParam1;268 pDis-> Param2.x86.fParam = pOp->fParam2;269 pDis-> Param3.x86.fParam = pOp->fParam3;270 pDis-> Param4.x86.fParam = pOp->fParam4;267 pDis->aParams[0].x86.fParam = pOp->fParam1; 268 pDis->aParams[1].x86.fParam = pOp->fParam2; 269 pDis->aParams[2].x86.fParam = pOp->fParam3; 270 pDis->aParams[3].x86.fParam = pOp->fParam4; 271 271 272 272 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ … … 293 293 if (pOp->idxParse1 != IDX_ParseNop) 294 294 { 295 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse1](offInstr, pOp, pDis, &pDis-> Param1);296 if (fFiltered == false) pDis-> Param1.x86.cb = DISGetParamSize(pDis, &pDis->Param1);295 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse1](offInstr, pOp, pDis, &pDis->aParams[0]); 296 if (fFiltered == false) pDis->aParams[0].x86.cb = DISGetParamSize(pDis, &pDis->aParams[0]); 297 297 } 298 298 299 299 if (pOp->idxParse2 != IDX_ParseNop) 300 300 { 301 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse2](offInstr, pOp, pDis, &pDis-> Param2);302 if (fFiltered == false) pDis-> Param2.x86.cb = DISGetParamSize(pDis, &pDis->Param2);301 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse2](offInstr, pOp, pDis, &pDis->aParams[1]); 302 if (fFiltered == false) pDis->aParams[1].x86.cb = DISGetParamSize(pDis, &pDis->aParams[1]); 303 303 } 304 304 305 305 if (pOp->idxParse3 != IDX_ParseNop) 306 306 { 307 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse3](offInstr, pOp, pDis, &pDis-> Param3);308 if (fFiltered == false) pDis-> Param3.x86.cb = DISGetParamSize(pDis, &pDis->Param3);307 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse3](offInstr, pOp, pDis, &pDis->aParams[2]); 308 if (fFiltered == false) pDis->aParams[2].x86.cb = DISGetParamSize(pDis, &pDis->aParams[2]); 309 309 } 310 310 311 311 if (pOp->idxParse4 != IDX_ParseNop) 312 312 { 313 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse4](offInstr, pOp, pDis, &pDis-> Param4);314 if (fFiltered == false) pDis-> Param4.x86.cb = DISGetParamSize(pDis, &pDis->Param4);313 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse4](offInstr, pOp, pDis, &pDis->aParams[3]); 314 if (fFiltered == false) pDis->aParams[3].x86.cb = DISGetParamSize(pDis, &pDis->aParams[3]); 315 315 } 316 316 // else simple one byte instruction … … 334 334 335 335 // Should contain the parameter type on input 336 pDis-> Param1.x86.fParam = fpop->fParam1;337 pDis-> Param2.x86.fParam = fpop->fParam2;336 pDis->aParams[0].x86.fParam = fpop->fParam1; 337 pDis->aParams[1].x86.fParam = fpop->fParam2; 338 338 } 339 339 else … … 1479 1479 1480 1480 if ( (pOp->fOpType & DISOPTYPE_X86_REXB_EXTENDS_OPREG) 1481 && pParam == &pDis-> Param1/* ugly assumption that it only applies to the first parameter */1481 && pParam == &pDis->aParams[0] /* ugly assumption that it only applies to the first parameter */ 1482 1482 && (pDis->x86.fPrefix & DISPREFIX_REX) 1483 1483 && (pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) … … 1510 1510 if ( pDis->uCpuMode == DISCPUMODE_64BIT 1511 1511 && (pOp->fOpType & DISOPTYPE_X86_REXB_EXTENDS_OPREG) 1512 && pParam == &pDis-> Param1/* ugly assumption that it only applies to the first parameter */1512 && pParam == &pDis->aParams[0] /* ugly assumption that it only applies to the first parameter */ 1513 1513 && (pDis->x86.fPrefix & DISPREFIX_REX)) 1514 1514 { … … 2452 2452 case OP_XCHG: 2453 2453 case OP_XOR: 2454 if (pDis-> Param1.fUse & (DISUSE_BASE | DISUSE_INDEX | DISUSE_DISPLACEMENT64 | DISUSE_DISPLACEMENT322455 | DISUSE_DISPLACEMENT16 | DISUSE_DISPLACEMENT8 | DISUSE_RIPDISPLACEMENT32))2454 if (pDis->aParams[0].fUse & ( DISUSE_BASE | DISUSE_INDEX | DISUSE_DISPLACEMENT64 | DISUSE_DISPLACEMENT32 2455 | DISUSE_DISPLACEMENT16 | DISUSE_DISPLACEMENT8 | DISUSE_RIPDISPLACEMENT32)) 2456 2456 return; 2457 2457 break; … … 2600 2600 { 2601 2601 #ifdef VBOX_STRICT /* poison */ 2602 pDis-> Param1.x86.Base.idxGenReg = 0xc1;2603 pDis-> Param2.x86.Base.idxGenReg = 0xc2;2604 pDis-> Param3.x86.Base.idxGenReg = 0xc3;2605 pDis-> Param1.x86.Index.idxGenReg = 0xc4;2606 pDis-> Param2.x86.Index.idxGenReg = 0xc5;2607 pDis-> Param3.x86.Index.idxGenReg = 0xc6;2608 pDis-> Param1.x86.uDisp.u64 = UINT64_C(0xd1d1d1d1d1d1d1d1);2609 pDis-> Param2.x86.uDisp.u64 = UINT64_C(0xd2d2d2d2d2d2d2d2);2610 pDis-> Param3.x86.uDisp.u64 = UINT64_C(0xd3d3d3d3d3d3d3d3);2611 pDis-> Param1.uValue= UINT64_C(0xb1b1b1b1b1b1b1b1);2612 pDis-> Param2.uValue= UINT64_C(0xb2b2b2b2b2b2b2b2);2613 pDis-> Param3.uValue= UINT64_C(0xb3b3b3b3b3b3b3b3);2614 pDis-> Param1.x86.uScale = 28;2615 pDis-> Param2.x86.uScale = 29;2616 pDis-> Param3.x86.uScale = 30;2602 pDis->aParams[0].x86.Base.idxGenReg = 0xc1; 2603 pDis->aParams[1].x86.Base.idxGenReg = 0xc2; 2604 pDis->aParams[2].x86.Base.idxGenReg = 0xc3; 2605 pDis->aParams[0].x86.Index.idxGenReg = 0xc4; 2606 pDis->aParams[1].x86.Index.idxGenReg = 0xc5; 2607 pDis->aParams[2].x86.Index.idxGenReg = 0xc6; 2608 pDis->aParams[0].x86.uDisp.u64 = UINT64_C(0xd1d1d1d1d1d1d1d1); 2609 pDis->aParams[1].x86.uDisp.u64 = UINT64_C(0xd2d2d2d2d2d2d2d2); 2610 pDis->aParams[2].x86.uDisp.u64 = UINT64_C(0xd3d3d3d3d3d3d3d3); 2611 pDis->aParams[0].uValue = UINT64_C(0xb1b1b1b1b1b1b1b1); 2612 pDis->aParams[1].uValue = UINT64_C(0xb2b2b2b2b2b2b2b2); 2613 pDis->aParams[2].uValue = UINT64_C(0xb3b3b3b3b3b3b3b3); 2614 pDis->aParams[0].x86.uScale = 28; 2615 pDis->aParams[1].x86.uScale = 29; 2616 pDis->aParams[2].x86.uScale = 30; 2617 2617 #endif 2618 2618 -
trunk/src/VBox/Disassembler/DisasmFormatArmV8.cpp
r101540 r105724 286 286 * Formatting context and associated macros. 287 287 */ 288 PCDISOPPARAM pParam = &pDis-> Param1;289 int iParam = 1;288 PCDISOPPARAM pParam = &pDis->aParams[0]; 289 uint32_t iParam = 0; 290 290 291 291 const char *pszFmt = pOp->pszOpcode; … … 401 401 pszFmt++; 402 402 403 switch (++iParam) 403 iParam++; 404 if (iParam >= RT_ELEMENTS(pDis->aParams)) 404 405 { 405 case 2: pParam = &pDis->Param2; break; 406 case 3: pParam = &pDis->Param3; break; 407 case 4: pParam = &pDis->Param4; break; 408 default: pParam = NULL; break; 406 AssertFailed(); 407 pParam = NULL; 409 408 } 409 else 410 pParam = &pDis->aParams[iParam]; 410 411 break; 411 412 } … … 424 425 Assert(*pszFmt != ' '); 425 426 PUT_C(' '); 426 switch (++iParam) 427 iParam++; 428 if (iParam >= RT_ELEMENTS(pDis->aParams)) 427 429 { 428 case 2: pParam = &pDis->Param2; break; 429 case 3: pParam = &pDis->Param3; break; 430 case 4: pParam = &pDis->Param4; break; 431 default: pParam = NULL; break; 430 AssertFailed(); 431 pParam = NULL; 432 432 } 433 else 434 pParam = &pDis->aParams[iParam]; 433 435 } 434 436 } -
trunk/src/VBox/Disassembler/DisasmFormatYasm.cpp
r103928 r105724 642 642 if ( (*pszFmt == '#' && !(pDis->x86.bVexByte2 & DISPREFIX_VEX_F_W)) /** @todo check this*/ 643 643 || (*pszFmt == '@' && !VEXREG_IS256B(pDis->x86.bVexDestReg)) 644 || (*pszFmt == '&' && ( DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param1.fUse)645 || DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param2.fUse)646 || DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param3.fUse)647 || DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param4.fUse))))644 || (*pszFmt == '&' && ( DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[0].fUse) 645 || DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[1].fUse) 646 || DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[2].fUse) 647 || DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[3].fUse)))) 648 648 { 649 649 strncpy(pszFmtDst, pszFmt + 1, pszDelim - pszFmt - 1); … … 666 666 case OP_FLD: 667 667 if (pDis->x86.bOpCode == 0xdb) /* m80fp workaround. */ 668 *(int *)&pDis-> Param1.x86.fParam &= ~0x1f; /* make it pure OP_PARM_M */668 *(int *)&pDis->aParams[0].x86.fParam &= ~0x1f; /* make it pure OP_PARM_M */ 669 669 break; 670 670 case OP_LAR: /* hack w -> v, probably not correct. */ 671 *(int *)&pDis-> Param2.x86.fParam &= ~0x1f;672 *(int *)&pDis-> Param2.x86.fParam |= OP_PARM_v;671 *(int *)&pDis->aParams[1].x86.fParam &= ~0x1f; 672 *(int *)&pDis->aParams[2].x86.fParam |= OP_PARM_v; 673 673 break; 674 674 } … … 698 698 * Formatting context and associated macros. 699 699 */ 700 PCDISOPPARAM pParam = &pDis-> Param1;701 int iParam = 1;700 PCDISOPPARAM pParam = &pDis->aParams[0]; 701 uint32_t iParam = 0; 702 702 703 703 #define PUT_FAR() \ … … 787 787 */ 788 788 if ( (pDis->x86.fPrefix & DISPREFIX_SEG) 789 && !DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param1.fUse)790 && !DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param2.fUse)791 && !DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param3.fUse))789 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[0].fUse) 790 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[1].fUse) 791 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[2].fUse)) 792 792 { 793 793 PUT_STR(s_szSegPrefix[pDis->x86.idxSegPrefix], 2); … … 1085 1085 { 1086 1086 int32_t offDisplacement; 1087 Assert(iParam == 1);1087 Assert(iParam == 0); 1088 1088 bool fPrefix = (fFlags & DIS_FMT_FLAGS_STRICT) 1089 1089 && pOp->uOpcode != OP_CALL … … 1287 1287 Assert(*pszFmt != ' '); 1288 1288 PUT_C(' '); 1289 switch (++iParam) 1289 iParam++; 1290 if (iParam >= RT_ELEMENTS(pDis->aParams)) 1290 1291 { 1291 case 2: pParam = &pDis->Param2; break; 1292 case 3: pParam = &pDis->Param3; break; 1293 case 4: pParam = &pDis->Param4; break; 1294 default: pParam = NULL; break; 1292 AssertFailed(); 1293 pParam = NULL; 1295 1294 } 1295 else 1296 pParam = &pDis->aParams[iParam]; 1296 1297 } 1297 1298 } … … 1478 1479 /* no effective address which it may apply to. */ 1479 1480 Assert((pDis->x86.fPrefix & DISPREFIX_SEG) || pDis->uCpuMode == DISCPUMODE_64BIT); 1480 if ( !DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param1.fUse)1481 && !DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param2.fUse)1482 && !DISUSE_IS_EFFECTIVE_ADDR(pDis-> Param3.fUse))1481 if ( !DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[0].fUse) 1482 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[1].fUse) 1483 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->aParams[2].fUse)) 1483 1484 return true; 1484 1485 … … 1689 1690 /* shl eax,1 will be assembled to the form without the immediate byte. */ 1690 1691 if ( pDis->pCurInstr->fParam2 == OP_PARM_Ib 1691 && (uint8_t)pDis-> Param2.uValue == 1)1692 && (uint8_t)pDis->aParams[1].uValue == 1) 1692 1693 { 1693 1694 switch (pDis->pCurInstr->uOpcode) -
trunk/src/VBox/Disassembler/testcase/tstDisasm-1.cpp
r101539 r105724 160 160 { 161 161 uint32_t cb2; 162 RTTESTI_CHECK_MSG((cb2 = DISGetParamSize(&Dis, &Dis. Param1)) == s_gInstrs[i].cbParam1,162 RTTESTI_CHECK_MSG((cb2 = DISGetParamSize(&Dis, &Dis.aParams[0])) == s_gInstrs[i].cbParam1, 163 163 ("%u: %#x vs %#x\n", i , cb2, s_gInstrs[i].cbParam1)); 164 164 #ifndef DIS_CORE_ONLY 165 RTTESTI_CHECK_MSG((cb2 = DISGetParamSize(&Dis, &Dis. Param2)) == s_gInstrs[i].cbParam2,165 RTTESTI_CHECK_MSG((cb2 = DISGetParamSize(&Dis, &Dis.aParams[1])) == s_gInstrs[i].cbParam2, 166 166 ("%u: %#x vs %#x (%s)\n", i , cb2, s_gInstrs[i].cbParam2, Dis.pCurInstr->pszOpcode)); 167 167 #else 168 RTTESTI_CHECK_MSG((cb2 = DISGetParamSize(&Dis, &Dis. Param2)) == s_gInstrs[i].cbParam2,168 RTTESTI_CHECK_MSG((cb2 = DISGetParamSize(&Dis, &Dis.aParams[1])) == s_gInstrs[i].cbParam2, 169 169 ("%u: %#x vs %#x\n", i , cb2, s_gInstrs[i].cbParam2)); 170 170 #endif 171 RTTESTI_CHECK_MSG((cb2 = DISGetParamSize(&Dis, &Dis. Param3)) == s_gInstrs[i].cbParam3,171 RTTESTI_CHECK_MSG((cb2 = DISGetParamSize(&Dis, &Dis.aParams[2])) == s_gInstrs[i].cbParam3, 172 172 ("%u: %#x vs %#x\n", i , cb2, s_gInstrs[i].cbParam3)); 173 173 } -
trunk/src/VBox/HostDrivers/Support/posix/SUPR3HardenedMain-posix.cpp
r101541 r105724 251 251 252 252 /* Extract start address. */ 253 pbSym = (pbSym + cbInstr + Dis. Param1.x86.uDisp.i32);253 pbSym = (pbSym + cbInstr + Dis.aParams[0].x86.uDisp.i32); 254 254 pbSym = (uint8_t *)*((uintptr_t *)pbSym); 255 255 # else … … 423 423 { 424 424 /* Deduce destination register and write out new instruction. */ 425 if (RT_UNLIKELY(!( (Dis. Param1.fUse & (DISUSE_BASE | DISUSE_REG_GEN64))426 && (Dis. Param2.fUse & DISUSE_RIPDISPLACEMENT32))))425 if (RT_UNLIKELY(!( (Dis.aParams[0].fUse & (DISUSE_BASE | DISUSE_REG_GEN64)) 426 && (Dis.aParams[1].fUse & DISUSE_RIPDISPLACEMENT32)))) 427 427 return VERR_SUPLIB_UNEXPECTED_INSTRUCTION; 428 428 429 uintptr_t uAddr = (uintptr_t)&pbTarget[offInsn + cbInstr] + (intptr_t)Dis. Param2.x86.uDisp.i32;429 uintptr_t uAddr = (uintptr_t)&pbTarget[offInsn + cbInstr] + (intptr_t)Dis.aParams[1].x86.uDisp.i32; 430 430 431 431 if (fConvRipRelMovs) … … 437 437 438 438 *pbPatchMem++ = 0x48; 439 *pbPatchMem++ = 0xb8 + Dis. Param1.x86.Base.idxGenReg;439 *pbPatchMem++ = 0xb8 + Dis.aParams[0].x86.Base.idxGenReg; 440 440 *(uintptr_t *)pbPatchMem = uAddr; 441 441 pbPatchMem += sizeof(uintptr_t); … … 443 443 *pbPatchMem++ = 0x48; 444 444 *pbPatchMem++ = 0x8b; 445 *pbPatchMem++ = (Dis. Param1.x86.Base.idxGenReg << X86_MODRM_REG_SHIFT) | Dis.Param1.x86.Base.idxGenReg;445 *pbPatchMem++ = (Dis.aParams[0].x86.Base.idxGenReg << X86_MODRM_REG_SHIFT) | Dis.aParams[0].x86.Base.idxGenReg; 446 446 } 447 447 else … … 453 453 *pbPatchMem++ = 0x48; 454 454 *pbPatchMem++ = 0x8b; 455 *pbPatchMem++ = (Dis. Param1.x86.Base.idxGenReg << X86_MODRM_REG_SHIFT) | 5;455 *pbPatchMem++ = (Dis.aParams[0].x86.Base.idxGenReg << X86_MODRM_REG_SHIFT) | 5; 456 456 *(int32_t *)pbPatchMem = (int32_t)iDispNew; 457 457 pbPatchMem += sizeof(int32_t); … … 462 462 { 463 463 /* Convert to absolute jump. */ 464 uintptr_t uAddr = (uintptr_t)&pbTarget[offInsn + cbInstr] + (intptr_t)Dis. Param1.uValue;464 uintptr_t uAddr = (uintptr_t)&pbTarget[offInsn + cbInstr] + (intptr_t)Dis.aParams[0].uValue; 465 465 466 466 /* Skip the push instructions till the return address is known. */ … … 575 575 576 576 /* jmp rel32 to the call target */ 577 uintptr_t const uAddr = uAddrReturn + (int32_t)Dis. Param1.uValue;577 uintptr_t const uAddr = uAddrReturn + (int32_t)Dis.aParams[0].uValue; 578 578 int32_t const i32DispNew = uAddr - (uintptr_t)&pbPatchMem[5]; 579 579 -
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r105723 r105724 9459 9459 iemNativeDisasmGetSymbolCb, &SymCtx); 9460 9460 PCDISOPPARAM pMemOp; 9461 if (DISUSE_IS_EFFECTIVE_ADDR(Dis. Param1.fUse))9462 pMemOp = &Dis. Param1;9463 else if (DISUSE_IS_EFFECTIVE_ADDR(Dis. Param2.fUse))9464 pMemOp = &Dis. Param2;9465 else if (DISUSE_IS_EFFECTIVE_ADDR(Dis. Param3.fUse))9466 pMemOp = &Dis. Param3;9461 if (DISUSE_IS_EFFECTIVE_ADDR(Dis.aParams[0].fUse)) 9462 pMemOp = &Dis.aParams[0]; 9463 else if (DISUSE_IS_EFFECTIVE_ADDR(Dis.aParams[1].fUse)) 9464 pMemOp = &Dis.aParams[1]; 9465 else if (DISUSE_IS_EFFECTIVE_ADDR(Dis.aParams[2].fUse)) 9466 pMemOp = &Dis.aParams[2]; 9467 9467 else 9468 9468 pMemOp = NULL; -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r104840 r105724 793 793 } 794 794 795 LogFlow(("Reused instr %RGv %d at %RGv param1.fUse=%llx param1.reg=%d\n", pCtx->rip, pDis->pCurInstr->uOpcode, pvFault, pDis-> Param1.fUse, pDis->Param1.x86.Base.idxGenReg));795 LogFlow(("Reused instr %RGv %d at %RGv param1.fUse=%llx param1.reg=%d\n", pCtx->rip, pDis->pCurInstr->uOpcode, pvFault, pDis->aParams[0].fUse, pDis->aParams[0].x86.Base.idxGenReg)); 796 796 797 797 /* Non-supervisor mode write means it's used for something else. */ … … 840 840 * Anything having ESP on the left side means stack writes. 841 841 */ 842 if ( ( (pDis-> Param1.fUse & DISUSE_REG_GEN32)843 || (pDis-> Param1.fUse & DISUSE_REG_GEN64))844 && (pDis-> Param1.x86.Base.idxGenReg == DISGREG_ESP))842 if ( ( (pDis->aParams[0].fUse & DISUSE_REG_GEN32) 843 || (pDis->aParams[0].fUse & DISUSE_REG_GEN64)) 844 && (pDis->aParams[0].x86.Base.idxGenReg == DISGREG_ESP)) 845 845 { 846 846 Log4(("pgmRZPoolMonitorIsReused: ESP\n")); … … 854 854 * and we don't want to deal with that in pgmPoolMonitorChainChanging and such. 855 855 */ 856 uint32_t const cbWrite = DISGetParamSize(pDis, &pDis-> Param1);856 uint32_t const cbWrite = DISGetParamSize(pDis, &pDis->aParams[0]); 857 857 if ( (((uintptr_t)pvFault + cbWrite) >> X86_PAGE_SHIFT) != ((uintptr_t)pvFault >> X86_PAGE_SHIFT) ) 858 858 { … … 942 942 PCPUMCTX pCtx, RTGCPHYS GCPhysFault, RTGCPTR pvFault) 943 943 { 944 unsigned uIncrement = pDis-> Param1.x86.cb;944 unsigned uIncrement = pDis->aParams[0].x86.cb; 945 945 NOREF(pVM); 946 946 … … 1018 1018 * Clear all the pages. 1019 1019 */ 1020 uint32_t cbWrite = DISGetParamSize(pDis, &pDis-> Param1);1020 uint32_t cbWrite = DISGetParamSize(pDis, &pDis->aParams[0]); 1021 1021 if (cbWrite <= 8) 1022 1022 pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault, NULL, cbWrite); … … 1187 1187 if ( pPage->GCPtrLastAccessHandlerRip >= pCtx->rip - 0x40 /* observed loops in Windows 7 x64 */ 1188 1188 && pPage->GCPtrLastAccessHandlerRip < pCtx->rip + 0x40 1189 && pvFault == (pPage->GCPtrLastAccessHandlerFault + pDis-> Param1.x86.cb)1189 && pvFault == (pPage->GCPtrLastAccessHandlerFault + pDis->aParams[0].x86.cb) 1190 1190 && pVCpu->pgm.s.cPoolAccessHandler == pPage->cLastAccessHandler + 1) 1191 1191 { -
trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp
r105352 r105724 609 609 pDisState->pCurInstr = State.Dis.pCurInstr; 610 610 pDisState->cbInstr = State.Dis.cbInstr; 611 pDisState->Param1 = State.Dis. Param1;612 pDisState->Param2 = State.Dis. Param2;613 pDisState->Param3 = State.Dis. Param3;614 pDisState->Param4 = State.Dis. Param4;611 pDisState->Param1 = State.Dis.aParams[0]; 612 pDisState->Param2 = State.Dis.aParams[1]; 613 pDisState->Param3 = State.Dis.aParams[2]; 614 pDisState->Param4 = State.Dis.aParams[3]; 615 615 } 616 616 -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r104511 r105724 2347 2347 pPatch->cbOp = cbOp; 2348 2348 2349 if (Dis. Param1.fUse == DISUSE_DISPLACEMENT32)2349 if (Dis.aParams[0].fUse == DISUSE_DISPLACEMENT32) 2350 2350 { 2351 2351 /* write. */ 2352 if (Dis. Param2.fUse == DISUSE_REG_GEN32)2352 if (Dis.aParams[1].fUse == DISUSE_REG_GEN32) 2353 2353 { 2354 2354 pPatch->enmType = HMTPRINSTR_WRITE_REG; 2355 pPatch->uSrcOperand = Dis. Param2.x86.Base.idxGenReg;2356 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_REG %u\n", Dis. Param2.x86.Base.idxGenReg));2355 pPatch->uSrcOperand = Dis.aParams[1].x86.Base.idxGenReg; 2356 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_REG %u\n", Dis.aParams[1].x86.Base.idxGenReg)); 2357 2357 } 2358 2358 else 2359 2359 { 2360 Assert(Dis. Param2.fUse == DISUSE_IMMEDIATE32);2360 Assert(Dis.aParams[1].fUse == DISUSE_IMMEDIATE32); 2361 2361 pPatch->enmType = HMTPRINSTR_WRITE_IMM; 2362 pPatch->uSrcOperand = Dis. Param2.uValue;2363 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_IMM %#llx\n", Dis. Param2.uValue));2362 pPatch->uSrcOperand = Dis.aParams[1].uValue; 2363 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_IMM %#llx\n", Dis.aParams[1].uValue)); 2364 2364 } 2365 2365 rc = PGMPhysSimpleWriteGCPtr(pVCpu, pCtx->rip, s_abVMMCall, sizeof(s_abVMMCall)); … … 2380 2380 * shr eax, 4 2381 2381 */ 2382 Assert(Dis. Param1.fUse == DISUSE_REG_GEN32);2383 2384 uint8_t const idxMmioReg = Dis. Param1.x86.Base.idxGenReg;2382 Assert(Dis.aParams[0].fUse == DISUSE_REG_GEN32); 2383 2384 uint8_t const idxMmioReg = Dis.aParams[0].x86.Base.idxGenReg; 2385 2385 uint8_t const cbOpMmio = cbOp; 2386 2386 uint64_t const uSavedRip = pCtx->rip; … … 2393 2393 if ( rc == VINF_SUCCESS 2394 2394 && Dis.pCurInstr->uOpcode == OP_SHR 2395 && Dis. Param1.fUse == DISUSE_REG_GEN322396 && Dis. Param1.x86.Base.idxGenReg == idxMmioReg2397 && Dis. Param2.fUse == DISUSE_IMMEDIATE82398 && Dis. Param2.uValue == 42395 && Dis.aParams[0].fUse == DISUSE_REG_GEN32 2396 && Dis.aParams[0].x86.Base.idxGenReg == idxMmioReg 2397 && Dis.aParams[1].fUse == DISUSE_IMMEDIATE8 2398 && Dis.aParams[1].uValue == 4 2399 2399 && cbOpMmio + cbOp < sizeof(pVM->hm.s.aPatches[idx].aOpcode)) 2400 2400 { … … 2412 2412 abInstr[1] = 0x0f; 2413 2413 abInstr[2] = 0x20; 2414 abInstr[3] = 0xc0 | Dis. Param1.x86.Base.idxGenReg;2414 abInstr[3] = 0xc0 | Dis.aParams[0].x86.Base.idxGenReg; 2415 2415 for (unsigned i = 4; i < pPatch->cbOp; i++) 2416 2416 abInstr[i] = 0x90; /* nop */ … … 2525 2525 pPatch->enmType = HMTPRINSTR_JUMP_REPLACEMENT; 2526 2526 2527 if (Dis. Param1.fUse == DISUSE_DISPLACEMENT32)2527 if (Dis.aParams[0].fUse == DISUSE_DISPLACEMENT32) 2528 2528 { 2529 2529 /* … … 2544 2544 * jmp return_address [E9 return_address] 2545 2545 */ 2546 bool fUsesEax = (Dis. Param2.fUse == DISUSE_REG_GEN32 && Dis.Param2.x86.Base.idxGenReg == DISGREG_EAX);2546 bool fUsesEax = (Dis.aParams[1].fUse == DISUSE_REG_GEN32 && Dis.aParams[1].x86.Base.idxGenReg == DISGREG_EAX); 2547 2547 2548 2548 aPatch[off++] = 0x51; /* push ecx */ … … 2552 2552 aPatch[off++] = 0x31; /* xor edx, edx */ 2553 2553 aPatch[off++] = 0xd2; 2554 if (Dis. Param2.fUse == DISUSE_REG_GEN32)2554 if (Dis.aParams[1].fUse == DISUSE_REG_GEN32) 2555 2555 { 2556 2556 if (!fUsesEax) 2557 2557 { 2558 2558 aPatch[off++] = 0x89; /* mov eax, src_reg */ 2559 aPatch[off++] = MAKE_MODRM(3, Dis. Param2.x86.Base.idxGenReg, DISGREG_EAX);2559 aPatch[off++] = MAKE_MODRM(3, Dis.aParams[1].x86.Base.idxGenReg, DISGREG_EAX); 2560 2560 } 2561 2561 } 2562 2562 else 2563 2563 { 2564 Assert(Dis. Param2.fUse == DISUSE_IMMEDIATE32);2564 Assert(Dis.aParams[1].fUse == DISUSE_IMMEDIATE32); 2565 2565 aPatch[off++] = 0xb8; /* mov eax, immediate */ 2566 *(uint32_t *)&aPatch[off] = Dis. Param2.uValue;2566 *(uint32_t *)&aPatch[off] = Dis.aParams[1].uValue; 2567 2567 off += sizeof(uint32_t); 2568 2568 } … … 2594 2594 * jmp return_address [E9 return_address] 2595 2595 */ 2596 Assert(Dis. Param1.fUse == DISUSE_REG_GEN32);2597 2598 if (Dis. Param1.x86.Base.idxGenReg != DISGREG_ECX)2596 Assert(Dis.aParams[0].fUse == DISUSE_REG_GEN32); 2597 2598 if (Dis.aParams[0].x86.Base.idxGenReg != DISGREG_ECX) 2599 2599 aPatch[off++] = 0x51; /* push ecx */ 2600 if (Dis. Param1.x86.Base.idxGenReg != DISGREG_EDX )2600 if (Dis.aParams[0].x86.Base.idxGenReg != DISGREG_EDX ) 2601 2601 aPatch[off++] = 0x52; /* push edx */ 2602 if (Dis. Param1.x86.Base.idxGenReg != DISGREG_EAX)2602 if (Dis.aParams[0].x86.Base.idxGenReg != DISGREG_EAX) 2603 2603 aPatch[off++] = 0x50; /* push eax */ 2604 2604 … … 2613 2613 aPatch[off++] = 0x32; 2614 2614 2615 if (Dis. Param1.x86.Base.idxGenReg != DISGREG_EAX)2615 if (Dis.aParams[0].x86.Base.idxGenReg != DISGREG_EAX) 2616 2616 { 2617 2617 aPatch[off++] = 0x89; /* mov dst_reg, eax */ 2618 aPatch[off++] = MAKE_MODRM(3, DISGREG_EAX, Dis. Param1.x86.Base.idxGenReg);2618 aPatch[off++] = MAKE_MODRM(3, DISGREG_EAX, Dis.aParams[0].x86.Base.idxGenReg); 2619 2619 } 2620 2620 2621 if (Dis. Param1.x86.Base.idxGenReg != DISGREG_EAX)2621 if (Dis.aParams[0].x86.Base.idxGenReg != DISGREG_EAX) 2622 2622 aPatch[off++] = 0x58; /* pop eax */ 2623 if (Dis. Param1.x86.Base.idxGenReg != DISGREG_EDX )2623 if (Dis.aParams[0].x86.Base.idxGenReg != DISGREG_EDX ) 2624 2624 aPatch[off++] = 0x5a; /* pop edx */ 2625 if (Dis. Param1.x86.Base.idxGenReg != DISGREG_ECX)2625 if (Dis.aParams[0].x86.Base.idxGenReg != DISGREG_ECX) 2626 2626 aPatch[off++] = 0x59; /* pop ecx */ 2627 2627 }
Note:
See TracChangeset
for help on using the changeset viewer.