Changeset 41794 in vbox for trunk/src/VBox/Disassembler
- Timestamp:
- Jun 17, 2012 12:08:19 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmCore.cpp
r41793 r41794 47 47 * Internal Functions * 48 48 *******************************************************************************/ 49 static void disasmModRMReg(PDISSTATE pDis, PCDISOPCODE pOp, unsigned idx, PDISOPPARAM pParam, int fRegAddr);50 51 52 49 /** @name Parsers 53 50 * @{ */ … … 523 520 { 524 521 size_t size = 0; 525 bool fFiltered = false;526 522 527 523 Assert(pOp); Assert(pDis); … … 534 530 * Note! Multibyte opcodes are always marked harmless until the final byte. 535 531 */ 532 bool fFiltered; 536 533 if ((pOp->fOpType & pDis->fFilter) == 0) 537 534 { … … 542 539 { 543 540 /* Not filtered out -> full disassembly */ 541 fFiltered = false; 544 542 pDis->pfnDisasmFnTable = g_apfnFullDisasm; 545 543 } … … 594 592 static size_t ParseEscFP(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 595 593 { 596 size_t size = 0;597 594 PCDISOPCODE fpop; 598 595 NOREF(pOp); 599 596 600 u nsignedModRM = disReadByte(pDis, offInstr);601 u nsignedindex = pDis->bOpCode - 0xD8;597 uint8_t ModRM = disReadByte(pDis, offInstr); 598 uint8_t index = pDis->bOpCode - 0xD8; 602 599 if (ModRM <= 0xBF) 603 600 { … … 638 635 639 636 // Little hack to make sure the ModRM byte is included in the returned size 637 size_t size = 0; 640 638 if (fpop->idxParse1 != IDX_ParseModRM && fpop->idxParse2 != IDX_ParseModRM) 641 639 size = sizeof(uint8_t); //ModRM byte … … 660 658 * 661 659 ********************************************************************************************************************************/ 662 static void UseSIB(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 663 { 664 NOREF(offInstr); NOREF(pOp); 665 660 static void UseSIB(PDISSTATE pDis, PDISOPPARAM pParam) 661 { 666 662 unsigned scale = pDis->SIB.Bits.Scale; 667 663 unsigned base = pDis->SIB.Bits.Base; … … 780 776 * 781 777 ********************************************************************************************************************************/ 782 static void disasmModRMReg( PDISSTATE pDis, PCDISOPCODE pOp, unsigned idx, PDISOPPARAM pParam, int fRegAddr)778 static void disasmModRMReg(unsigned idx, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam, int fRegAddr) 783 779 { 784 780 NOREF(pOp); NOREF(pDis); … … 854 850 } 855 851 856 static void disasmModRMReg16(PDISSTATE pDis, PCDISOPCODE pOp, unsigned idx, PDISOPPARAM pParam) 852 853 static void disasmModRMReg16(unsigned idx, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 857 854 { 858 855 static const uint8_t s_auBaseModRMReg16[8] = … … 869 866 } 870 867 } 871 //***************************************************************************** 872 //***************************************************************************** 873 static void disasmModRMSReg( PDISSTATE pDis, PCDISOPCODE pOp, unsigned idx, PDISOPPARAM pParam)868 869 870 static void disasmModRMSReg(unsigned idx, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 874 871 { 875 872 NOREF(pOp); … … 896 893 { 897 894 case OP_PARM_G: //general purpose register 898 disasmModRMReg( pDis, pOp, reg, pParam, 0);895 disasmModRMReg(reg, pOp, pDis, pParam, 0); 899 896 return 0; 900 897 … … 931 928 case OP_PARM_S: //segment register 932 929 reg &= 7; /* REX.R has no effect here */ 933 disasmModRMSReg( pDis, pOp, reg, pParam);930 disasmModRMSReg(reg, pOp, pDis, pParam); 934 931 pParam->fUse |= DISUSE_REG_SEG; 935 932 return 0; … … 967 964 { 968 965 case 0: //effective address 969 if (rm == 4) 970 { /* SIB byte follows ModRM */ 971 UseSIB(offInstr, pOp, pDis, pParam); 972 } 966 if (rm == 4) /* SIB byte follows ModRM */ 967 UseSIB(pDis, pParam); 973 968 else 974 969 if (rm == 5) … … 989 984 { //register address 990 985 pParam->fUse |= DISUSE_BASE; 991 disasmModRMReg( pDis, pOp, rm, pParam, 1);986 disasmModRMReg(rm, pOp, pDis, pParam, 1); 992 987 } 993 988 break; 994 989 995 990 case 1: //effective address + 8 bits displacement 996 if (rm == 4) {//SIB byte follows ModRM 997 UseSIB(offInstr, pOp, pDis, pParam); 998 } 991 if (rm == 4) /* SIB byte follows ModRM */ 992 UseSIB(pDis, pParam); 999 993 else 1000 994 { 1001 995 pParam->fUse |= DISUSE_BASE; 1002 disasmModRMReg( pDis, pOp, rm, pParam, 1);996 disasmModRMReg(rm, pOp, pDis, pParam, 1); 1003 997 } 1004 998 pParam->uDisp.i8 = pDis->i32SibDisp; … … 1007 1001 1008 1002 case 2: //effective address + 32 bits displacement 1009 if (rm == 4) {//SIB byte follows ModRM 1010 UseSIB(offInstr, pOp, pDis, pParam); 1011 } 1003 if (rm == 4) /* SIB byte follows ModRM */ 1004 UseSIB(pDis, pParam); 1012 1005 else 1013 1006 { 1014 1007 pParam->fUse |= DISUSE_BASE; 1015 disasmModRMReg( pDis, pOp, rm, pParam, 1);1008 disasmModRMReg(rm, pOp, pDis, pParam, 1); 1016 1009 } 1017 1010 pParam->uDisp.i32 = pDis->i32SibDisp; … … 1020 1013 1021 1014 case 3: //registers 1022 disasmModRMReg( pDis, pOp, rm, pParam, 0);1015 disasmModRMReg(rm, pOp, pDis, pParam, 0); 1023 1016 break; 1024 1017 } … … 1037 1030 { 1038 1031 pParam->fUse |= DISUSE_BASE; 1039 disasmModRMReg16( pDis, pOp, rm, pParam);1032 disasmModRMReg16(rm, pOp, pDis, pParam); 1040 1033 } 1041 1034 break; 1042 1035 1043 1036 case 1: //effective address + 8 bits displacement 1044 disasmModRMReg16( pDis, pOp, rm, pParam);1037 disasmModRMReg16(rm, pOp, pDis, pParam); 1045 1038 pParam->uDisp.i8 = pDis->i32SibDisp; 1046 1039 pParam->fUse |= DISUSE_BASE | DISUSE_DISPLACEMENT8; … … 1048 1041 1049 1042 case 2: //effective address + 16 bits displacement 1050 disasmModRMReg16( pDis, pOp, rm, pParam);1043 disasmModRMReg16(rm, pOp, pDis, pParam); 1051 1044 pParam->uDisp.i16 = pDis->i32SibDisp; 1052 1045 pParam->fUse |= DISUSE_BASE | DISUSE_DISPLACEMENT16; … … 1054 1047 1055 1048 case 3: //registers 1056 disasmModRMReg( pDis, pOp, rm, pParam, 0);1049 disasmModRMReg(rm, pOp, pDis, pParam, 0); 1057 1050 break; 1058 1051 }
Note:
See TracChangeset
for help on using the changeset viewer.