Changeset 41662 in vbox
- Timestamp:
- Jun 12, 2012 8:29:07 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r41658 r41662 372 372 uint64_t parval; 373 373 uint64_t flags; 374 int64_t disp64; 375 int32_t disp32; 376 int32_t disp16; 377 int32_t disp8; 374 union 375 { 376 int64_t i64; 377 int32_t i32; 378 int32_t i16; 379 int32_t i8; 380 uint64_t u64; 381 uint32_t u32; 382 uint32_t u16; 383 uint32_t u8; 384 } uDisp; 378 385 uint32_t size; 379 386 int32_t param; -
trunk/src/VBox/Disassembler/DisasmCore.cpp
r41661 r41662 549 549 { 550 550 pParam->flags |= USE_DISPLACEMENT32; 551 pParam-> disp32 = pCpu->i32SibDisp;551 pParam->uDisp.i32 = pCpu->i32SibDisp; 552 552 disasmAddChar(pParam->szParam, '+'); 553 553 disasmPrintDisp32(pParam); … … 556 556 { /* sign-extend to 64 bits */ 557 557 pParam->flags |= USE_DISPLACEMENT64; 558 pParam-> disp64 = pCpu->i32SibDisp;558 pParam->uDisp.i64 = pCpu->i32SibDisp; 559 559 disasmAddChar(pParam->szParam, '+'); 560 560 disasmPrintDisp64(pParam); … … 737 737 { 738 738 pParam->flags |= USE_DISPLACEMENT32; 739 pParam-> disp32 = pCpu->i32SibDisp;739 pParam->uDisp.i32 = pCpu->i32SibDisp; 740 740 disasmPrintDisp32(pParam); 741 741 } … … 743 743 { 744 744 pParam->flags |= USE_RIPDISPLACEMENT32; 745 pParam-> disp32 = pCpu->i32SibDisp;745 pParam->uDisp.i32 = pCpu->i32SibDisp; 746 746 disasmAddString(pParam->szParam, "RIP+"); 747 747 disasmPrintDisp32(pParam); 748 748 } 749 749 } 750 else {//register address 750 else 751 { //register address 751 752 pParam->flags |= USE_BASE; 752 753 disasmModRMReg(pCpu, pOp, rm, pParam, 1); … … 766 767 disasmModRMReg(pCpu, pOp, rm, pParam, 1); 767 768 } 768 pParam-> disp8 = pCpu->i32SibDisp;769 pParam->uDisp.i8 = pCpu->i32SibDisp; 769 770 pParam->flags |= USE_DISPLACEMENT8; 770 771 771 if (pParam-> disp8 != 0)772 if (pParam->uDisp.i8 != 0) 772 773 { 773 if (pParam-> disp8 > 0)774 if (pParam->uDisp.i8 > 0) 774 775 disasmAddChar(pParam->szParam, '+'); 775 776 disasmPrintDisp8(pParam); … … 789 790 disasmModRMReg(pCpu, pOp, rm, pParam, 1); 790 791 } 791 pParam-> disp32 = pCpu->i32SibDisp;792 pParam->uDisp.i32 = pCpu->i32SibDisp; 792 793 pParam->flags |= USE_DISPLACEMENT32; 793 794 794 if (pParam-> disp32 != 0)795 if (pParam->uDisp.i32 != 0) 795 796 { 796 797 disasmAddChar(pParam->szParam, '+'); … … 814 815 if (rm == 6) 815 816 {//16 bits displacement 816 pParam-> disp16 = pCpu->i32SibDisp;817 pParam->uDisp.i16 = pCpu->i32SibDisp; 817 818 pParam->flags |= USE_DISPLACEMENT16; 818 819 disasmPrintDisp16(pParam); … … 830 831 disasmAddChar(pParam->szParam, '['); 831 832 disasmModRMReg16(pCpu, pOp, rm, pParam); 832 pParam-> disp8 = pCpu->i32SibDisp;833 pParam->uDisp.i8 = pCpu->i32SibDisp; 833 834 pParam->flags |= USE_BASE | USE_DISPLACEMENT8; 834 835 835 if (pParam-> disp8 != 0)836 if (pParam->uDisp.i8 != 0) 836 837 { 837 if (pParam-> disp8 > 0)838 if (pParam->uDisp.i8 > 0) 838 839 disasmAddChar(pParam->szParam, '+'); 839 840 disasmPrintDisp8(pParam); … … 846 847 disasmAddChar(pParam->szParam, '['); 847 848 disasmModRMReg16(pCpu, pOp, rm, pParam); 848 pParam-> disp16 = pCpu->i32SibDisp;849 pParam->uDisp.i16 = pCpu->i32SibDisp; 849 850 pParam->flags |= USE_BASE | USE_DISPLACEMENT16; 850 851 851 if (pParam-> disp16 != 0)852 if (pParam->uDisp.i16 != 0) 852 853 { 853 854 disasmAddChar(pParam->szParam, '+'); … … 1428 1429 * so we treat it like displacement. 1429 1430 */ 1430 pParam-> disp32 = DISReadDWord(pCpu, lpszCodeBlock);1431 pParam->uDisp.i32 = DISReadDWord(pCpu, lpszCodeBlock); 1431 1432 pParam->flags |= USE_DISPLACEMENT32; 1432 1433 pParam->size = sizeof(uint32_t); 1433 1434 1434 disasmAddStringF1(pParam->szParam, "[0%08Xh]", pParam-> disp32);1435 disasmAddStringF1(pParam->szParam, "[0%08Xh]", pParam->uDisp.i32); 1435 1436 return sizeof(uint32_t); 1436 1437 } … … 1445 1446 * so we treat it like displacement. 1446 1447 */ 1447 pParam-> disp64 = DISReadQWord(pCpu, lpszCodeBlock);1448 pParam->uDisp.i64 = DISReadQWord(pCpu, lpszCodeBlock); 1448 1449 pParam->flags |= USE_DISPLACEMENT64; 1449 1450 pParam->size = sizeof(uint64_t); 1450 1451 1451 disasmAddStringF2(pParam->szParam, "[0%08X%08Xh]", (uint32_t)(pParam-> disp64 >> 32), (uint32_t)pParam->disp64);1452 disasmAddStringF2(pParam->szParam, "[0%08X%08Xh]", (uint32_t)(pParam->uDisp.i64 >> 32), (uint32_t)pParam->uDisp.i64); 1452 1453 return sizeof(uint64_t); 1453 1454 } … … 1469 1470 * so we treat it like displacement. 1470 1471 */ 1471 pParam-> disp16 = DISReadWord(pCpu, lpszCodeBlock);1472 pParam->uDisp.i16 = DISReadWord(pCpu, lpszCodeBlock); 1472 1473 pParam->flags |= USE_DISPLACEMENT16; 1473 1474 pParam->size = sizeof(uint16_t); 1474 1475 1475 disasmAddStringF1(pParam->szParam, "[0%04Xh]", (uint32_t)pParam-> disp16);1476 disasmAddStringF1(pParam->szParam, "[0%04Xh]", (uint32_t)pParam->uDisp.i16); 1476 1477 return sizeof(uint16_t); 1477 1478 } … … 2442 2443 void disasmPrintAbs32(POP_PARAMETER pParam) 2443 2444 { 2444 disasmAddStringF1(pParam->szParam, "%08Xh", pParam-> disp32); NOREF(pParam);2445 disasmAddStringF1(pParam->szParam, "%08Xh", pParam->uDisp.i32); NOREF(pParam); 2445 2446 } 2446 2447 //***************************************************************************** … … 2448 2449 void disasmPrintDisp32(POP_PARAMETER pParam) 2449 2450 { 2450 disasmAddStringF1(pParam->szParam, "%08Xh", pParam-> disp32); NOREF(pParam);2451 disasmAddStringF1(pParam->szParam, "%08Xh", pParam->uDisp.i32); NOREF(pParam); 2451 2452 } 2452 2453 //***************************************************************************** … … 2454 2455 void disasmPrintDisp64(POP_PARAMETER pParam) 2455 2456 { 2456 disasmAddStringF1(pParam->szParam, "%16RX64h", pParam-> disp64); NOREF(pParam);2457 disasmAddStringF1(pParam->szParam, "%16RX64h", pParam->uDisp.i64); NOREF(pParam); 2457 2458 } 2458 2459 //***************************************************************************** … … 2460 2461 void disasmPrintDisp8(POP_PARAMETER pParam) 2461 2462 { 2462 disasmAddStringF1(pParam->szParam, "%d", pParam-> disp8); NOREF(pParam);2463 disasmAddStringF1(pParam->szParam, "%d", pParam->uDisp.i8); NOREF(pParam); 2463 2464 } 2464 2465 //***************************************************************************** … … 2466 2467 void disasmPrintDisp16(POP_PARAMETER pParam) 2467 2468 { 2468 disasmAddStringF1(pParam->szParam, "%04Xh", pParam-> disp16); NOREF(pParam);2469 disasmAddStringF1(pParam->szParam, "%04Xh", pParam->uDisp.i16); NOREF(pParam); 2469 2470 } 2470 2471 //***************************************************************************** -
trunk/src/VBox/Disassembler/DisasmFormatYasm.cpp
r41658 r41662 683 683 { 684 684 if ( (pParam->flags & USE_DISPLACEMENT8) 685 && !pParam-> disp8)685 && !pParam->uDisp.i8) 686 686 PUT_SZ("byte "); 687 687 else if ( (pParam->flags & USE_DISPLACEMENT16) 688 && (int8_t)pParam-> disp16 == (int16_t)pParam->disp16)688 && (int8_t)pParam->uDisp.i16 == (int16_t)pParam->uDisp.i16) 689 689 PUT_SZ("word "); 690 690 else if ( (pParam->flags & USE_DISPLACEMENT32) 691 && (int16_t)pParam-> disp32 == (int32_t)pParam->disp32) //??691 && (int16_t)pParam->uDisp.i32 == (int32_t)pParam->uDisp.i32) //?? 692 692 PUT_SZ("dword "); 693 693 else if ( (pParam->flags & USE_DISPLACEMENT64) 694 694 && (pCpu->SIB.Bits.Base != 5 || pCpu->ModRM.Bits.Mod != 0) 695 && (int32_t)pParam-> disp64 == (int64_t)pParam->disp64) //??695 && (int32_t)pParam->uDisp.i64 == (int64_t)pParam->uDisp.i64) //?? 696 696 PUT_SZ("qword "); 697 697 } … … 731 731 int64_t off2; 732 732 if (pParam->flags & USE_DISPLACEMENT8) 733 off2 = pParam-> disp8;733 off2 = pParam->uDisp.i8; 734 734 else if (pParam->flags & USE_DISPLACEMENT16) 735 off2 = pParam-> disp16;735 off2 = pParam->uDisp.i16; 736 736 else if (pParam->flags & (USE_DISPLACEMENT32 | USE_RIPDISPLACEMENT32)) 737 off2 = pParam-> disp32;737 off2 = pParam->uDisp.i32; 738 738 else if (pParam->flags & USE_DISPLACEMENT64) 739 off2 = pParam-> disp64;739 off2 = pParam->uDisp.i64; 740 740 else 741 741 { … … 1019 1019 break; 1020 1020 case USE_DISPLACEMENT16: 1021 PUT_NUM_16(pParam-> disp16);1021 PUT_NUM_16(pParam->uDisp.i16); 1022 1022 if (pfnGetSymbol) 1023 rc = pfnGetSymbol(pCpu, DIS_FMT_SEL_FROM_REG(DIS_SELREG_CS), (uint16_t)pParam->disp16, szSymbol, sizeof(szSymbol), &off, pvUser);1023 rc = pfnGetSymbol(pCpu, DIS_FMT_SEL_FROM_REG(DIS_SELREG_CS), pParam->uDisp.u16, szSymbol, sizeof(szSymbol), &off, pvUser); 1024 1024 break; 1025 1025 case USE_DISPLACEMENT32: 1026 PUT_NUM_32(pParam-> disp32);1026 PUT_NUM_32(pParam->uDisp.i32); 1027 1027 if (pfnGetSymbol) 1028 rc = pfnGetSymbol(pCpu, DIS_FMT_SEL_FROM_REG(DIS_SELREG_CS), (uint32_t)pParam->disp32, szSymbol, sizeof(szSymbol), &off, pvUser);1028 rc = pfnGetSymbol(pCpu, DIS_FMT_SEL_FROM_REG(DIS_SELREG_CS), pParam->uDisp.u32, szSymbol, sizeof(szSymbol), &off, pvUser); 1029 1029 break; 1030 1030 case USE_DISPLACEMENT64: 1031 PUT_NUM_64(pParam-> disp64);1031 PUT_NUM_64(pParam->uDisp.i64); 1032 1032 if (pfnGetSymbol) 1033 rc = pfnGetSymbol(pCpu, DIS_FMT_SEL_FROM_REG(DIS_SELREG_CS), (uint64_t)pParam->disp64, szSymbol, sizeof(szSymbol), &off, pvUser);1033 rc = pfnGetSymbol(pCpu, DIS_FMT_SEL_FROM_REG(DIS_SELREG_CS), pParam->uDisp.u64, szSymbol, sizeof(szSymbol), &off, pvUser); 1034 1034 break; 1035 1035 default: -
trunk/src/VBox/Disassembler/DisasmReg.cpp
r39086 r41662 603 603 { 604 604 if (pCpu->mode == CPUMODE_32BIT) 605 pParamVal->val.val32 += (int32_t)pParam-> disp8;605 pParamVal->val.val32 += (int32_t)pParam->uDisp.i8; 606 606 else 607 607 if (pCpu->mode == CPUMODE_64BIT) 608 pParamVal->val.val64 += (int64_t)pParam-> disp8;609 else 610 pParamVal->val.val16 += (int16_t)pParam-> disp8;608 pParamVal->val.val64 += (int64_t)pParam->uDisp.i8; 609 else 610 pParamVal->val.val16 += (int16_t)pParam->uDisp.i8; 611 611 } 612 612 else … … 614 614 { 615 615 if (pCpu->mode == CPUMODE_32BIT) 616 pParamVal->val.val32 += (int32_t)pParam-> disp16;616 pParamVal->val.val32 += (int32_t)pParam->uDisp.i16; 617 617 else 618 618 if (pCpu->mode == CPUMODE_64BIT) 619 pParamVal->val.val64 += (int64_t)pParam-> disp16;620 else 621 pParamVal->val.val16 += pParam-> disp16;619 pParamVal->val.val64 += (int64_t)pParam->uDisp.i16; 620 else 621 pParamVal->val.val16 += pParam->uDisp.i16; 622 622 } 623 623 else … … 625 625 { 626 626 if (pCpu->mode == CPUMODE_32BIT) 627 pParamVal->val.val32 += pParam-> disp32;628 else 629 pParamVal->val.val64 += pParam-> disp32;627 pParamVal->val.val32 += pParam->uDisp.i32; 628 else 629 pParamVal->val.val64 += pParam->uDisp.i32; 630 630 } 631 631 else … … 633 633 { 634 634 Assert(pCpu->mode == CPUMODE_64BIT); 635 pParamVal->val.val64 += (int64_t)pParam->disp64;635 pParamVal->val.val64 += pParam->uDisp.i64; 636 636 } 637 637 else … … 640 640 Assert(pCpu->mode == CPUMODE_64BIT); 641 641 /* Relative to the RIP of the next instruction. */ 642 pParamVal->val.val64 += pParam-> disp32 + pCtx->rip + pCpu->opsize;642 pParamVal->val.val64 += pParam->uDisp.i32 + pCtx->rip + pCpu->opsize; 643 643 } 644 644 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMR3/CSAM.cpp
r41659 r41662 1333 1333 { 1334 1334 addr = 0; 1335 PGMPhysSimpleReadGCPtr(pVCpu, &addr, (RTRCUINTPTR)cpu.param1. disp32, sizeof(addr));1335 PGMPhysSimpleReadGCPtr(pVCpu, &addr, (RTRCUINTPTR)cpu.param1.uDisp.i32, sizeof(addr)); 1336 1336 } 1337 1337 else
Note:
See TracChangeset
for help on using the changeset viewer.