Changeset 101539 in vbox
- Timestamp:
- Oct 22, 2023 2:43:09 AM (16 months ago)
- svn:sync-xref-src-repo-rev:
- 159616
- Location:
- trunk
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis-armv8.h
r99319 r101539 53 53 * Opcode parameter (operand) details. 54 54 */ 55 typedef struct DISOPPARAMARMV855 typedef struct 56 56 { 57 57 /** The register operand. */ … … 60 60 /** General register index (DISGREG_XXX), applicable if DISUSE_REG_GEN32 61 61 * or DISUSE_REG_GEN64 is set in fUse. */ 62 uint8_t idxGenReg;62 uint8_t idxGenReg; 63 63 } Reg; 64 64 /** Scale factor. */ 65 uint8_t 65 uint8_t uScale; 66 66 /** Parameter size. */ 67 uint8_t 68 /** Copy of the corresponding DISOPCODE::fParam1 / DISOPCODE::fParam2 /69 *DISOPCODE::fParam3. */70 uint32_t 71 } DIS OPPARAMARMV8;72 //AssertCompileSize(DISOPPARAMARMV8,16);67 uint8_t cb; 68 uint8_t bPadding; 69 /** Copy of the corresponding DISOPCODE::fParam1 / DISOPCODE::fParam2 / DISOPCODE::fParam3. */ 70 uint32_t fParam; 71 } DIS_OP_PARAM_ARMV8_T; 72 AssertCompile(sizeof(DIS_OP_PARAM_ARMV8_T) <= 16); 73 73 /** Pointer to opcode parameter. */ 74 typedef DIS OPPARAMARMV8 *PDISOPPARAMARMV8;74 typedef DIS_OP_PARAM_ARMV8_T *PDIS_OP_PARAM_ARMV8_T; 75 75 /** Pointer to opcode parameter. */ 76 typedef const DIS OPPARAMARMV8 *PCDISOPPARAMARMV8;76 typedef const DIS_OP_PARAM_ARMV8_T *PCDIS_OP_PARAM_ARMV8_T; 77 77 78 78 … … 80 80 * The armv8 specific disassembler state and result. 81 81 */ 82 typedef struct DISSTATEARMV882 typedef struct 83 83 { 84 uint8_t bDummy;85 } DIS STATEARMV8;86 //AssertCompileSize(DISSTATEARMV8,32);84 uint8_t bDummy; 85 } DIS_STATE_ARMV8_T; 86 AssertCompile(sizeof(DIS_STATE_ARMV8_T) <= 32); 87 87 88 88 -
trunk/include/VBox/dis-x86-amd64.h
r99225 r101539 304 304 305 305 /** 306 * Opcode parameter (operand) details .307 */ 308 typedef struct DISOPPARAMX86306 * Opcode parameter (operand) details for x86/AMD64. 307 */ 308 typedef struct 309 309 { 310 /** Disposition. 310 /** Disposition. */ 311 311 union 312 312 { … … 372 372 } Index; 373 373 /** 2, 4 or 8, if DISUSE_SCALE is set in fUse. */ 374 uint8_t 374 uint8_t uScale; 375 375 /** Parameter size. */ 376 uint8_t 376 uint8_t cb; 377 377 /** Copy of the corresponding DISOPCODE::fParam1 / DISOPCODE::fParam2 / 378 378 * DISOPCODE::fParam3. */ 379 uint32_t 380 } DIS OPPARAMX86;381 AssertCompileSize(DIS OPPARAMX86, 16);379 uint32_t fParam; 380 } DIS_OP_PARAM_X86_T; 381 AssertCompileSize(DIS_OP_PARAM_X86_T, 16); 382 382 /** Pointer to opcode parameter. */ 383 typedef DIS OPPARAMX86 *PDISOPPARAMX86;383 typedef DIS_OP_PARAM_X86_T *PDIS_OP_PARAM_X86_T; 384 384 /** Pointer to opcode parameter. */ 385 typedef const DIS OPPARAMX86 *PCDISOPPARAMX86;385 typedef const DIS_OP_PARAM_X86_T *PCDIS_OP_PARAM_X86_T; 386 386 387 387 … … 396 396 397 397 /** 398 * The x86/ amd64 specific disassembler state and result.399 */ 400 typedef struct DISSTATEX86398 * The x86/AMD64 specific disassembler state and result. 399 */ 400 typedef struct 401 401 { 402 402 /** SIB fields. */ … … 452 452 uint32_t uPtrPadding1; 453 453 #endif 454 455 } DISSTATEX86; 456 AssertCompileSize(DISSTATEX86, 32); 454 } DIS_STATE_X86_T; 455 AssertCompileSize(DIS_STATE_X86_T, 32); 457 456 458 457 -
trunk/include/VBox/dis.h
r99319 r101539 108 108 /** Parameter \#4 parser index. */ 109 109 uint8_t idxParse4; 110 /** The opcode identifier . This DIS specific, @see grp_dis_opcodes and111 * VBox/disopcode-x86-amd64.h.*/110 /** The opcode identifier (enum OPCODESX86) - this is DIS specific. 111 * @see grp_dis_opcodes, VBox/disopcode-x86-amd64.h */ 112 112 uint16_t uOpcode; 113 113 /** Parameter \#1 info, @see grp_dis_opparam. */ … … 246 246 union 247 247 { 248 /** x86/ amd64 specific state. */249 DIS OPPARAMX86x86;248 /** x86/AMD64 specific state. */ 249 DIS_OP_PARAM_X86_T x86; 250 250 #if defined(VBOX_DIS_WITH_ARMV8) 251 251 /** ARMv8 specific state. */ 252 DISOPPARAMARMV8 armv8; 253 #endif 254 } arch; 255 252 DIS_OP_PARAM_ARMV8_T armv8; 253 #endif 254 }; 256 255 } DISOPPARAM; 257 256 AssertCompileSize(DISOPPARAM, 32); … … 263 262 * Callback for reading instruction bytes. 264 263 * 265 * @returns VBox status code, bytes in DISSTATE:: u::abInstrand byte count in264 * @returns VBox status code, bytes in DISSTATE::Instr::ab and byte count in 266 265 * DISSTATE::cbCachedInstr. 267 266 * @param pDis Pointer to the disassembler state. The user … … 273 272 * 274 273 * To calculate the destination buffer address, use it 275 * as an index into DISSTATE:: abInstr.274 * as an index into DISSTATE::Instr::ab. 276 275 * 277 276 * @param cbMinRead The minimum number of bytes to read. … … 288 287 typedef struct DISSTATE 289 288 { 290 /** The instruction as different views. */ 289 /** The different instruction views. 290 * @sa cbCachedInstr, FNDISREADBYTES */ 291 291 union 292 292 { 293 /** The instruction bytes. */ 294 uint8_t abInstr[16]; 293 /** Byte (8-bit) view. 294 * This is the one referred to by FNDISREADBYTES and cbCached. */ 295 uint8_t ab[16]; 295 296 /** Single 16-bit view. */ 296 297 uint16_t u16; … … 298 299 uint32_t u32; 299 300 /** 16-bit view. */ 300 uint16_t au16 Instr[8];301 uint16_t au16[8]; 301 302 /** 32-bit view. */ 302 uint32_t au32 Instr[4];303 uint32_t au32[4]; 303 304 /** 64-bit view. */ 304 uint64_t au64 Instr[2];305 } u;305 uint64_t au64[2]; 306 } Instr; 306 307 307 308 /** Pointer to the current instruction. */ … … 316 317 DISOPPARAM Param4; 317 318 318 /** The number of valid bytes in abInstr. */319 /** The number of valid bytes in DISSTATE::Instr. */ 319 320 uint8_t cbCachedInstr; 320 321 /** The CPU mode (DISCPUMODE). */ … … 335 336 #endif 336 337 /** User data supplied as an argument to the APIs. */ 337 void 338 void *pvUser; 338 339 #if ARCH_BITS == 32 339 340 uint32_t uPadding4; … … 343 344 union 344 345 { 345 /** x86/ amd64 specific state. */346 DIS STATEX86x86;346 /** x86/AMD64 specific state. */ 347 DIS_STATE_X86_T x86; 347 348 #if defined(VBOX_DIS_WITH_ARMV8) 348 349 /** ARMv8 specific state. */ 349 DISSTATEARMV8 armv8; 350 #endif 351 } arch; 352 350 DIS_STATE_ARMV8_T armv8; 351 #endif 352 }; 353 353 } DISSTATE; 354 AssertCompileMemberAlignment(DISSTATE, arch, 8);354 AssertCompileMemberAlignment(DISSTATE, x86, 8); 355 355 AssertCompileSize(DISSTATE, 0xd8); 356 356 -
trunk/src/VBox/Debugger/DBGPlugInLinux.cpp
r99739 r101539 438 438 || ( (DisState.Param1.fUse & (DISUSE_BASE | DISUSE_REG_GEN64)) 439 439 && cbVal == sizeof(uint64_t))) 440 && DisState.Param1. arch.x86.Base.idxGenReg == DISGREG_RAX)440 && DisState.Param1.x86.Base.idxGenReg == DISGREG_RAX) 441 441 { 442 442 /* Parse the source. */ … … 448 448 449 449 if (DisState.Param2.fUse & DISUSE_RIPDISPLACEMENT32) 450 GCPtrVal = GCPtrCur + DisState.Param2. arch.x86.uDisp.i32 + cbInstr;450 GCPtrVal = GCPtrCur + DisState.Param2.x86.uDisp.i32 + cbInstr; 451 451 else if (DisState.Param2.fUse & DISUSE_DISPLACEMENT32) 452 GCPtrVal = (RTGCPTR)DisState.Param2. arch.x86.uDisp.u32;452 GCPtrVal = (RTGCPTR)DisState.Param2.x86.uDisp.u32; 453 453 else if (DisState.Param2.fUse & DISUSE_DISPLACEMENT64) 454 GCPtrVal = (RTGCPTR)DisState.Param2. arch.x86.uDisp.u64;454 GCPtrVal = (RTGCPTR)DisState.Param2.x86.uDisp.u64; 455 455 else 456 456 AssertMsgFailedBreakStmt(("Invalid displacement\n"), rc = VERR_INVALID_STATE); … … 571 571 */ 572 572 if ( (DisState.Param2.fUse & DISUSE_REG_GEN8) 573 && ( (DisState.Param2. arch.x86.Base.idxGenReg == DISGREG_AL && !pThis->f64Bit)574 || (DisState.Param2. arch.x86.Base.idxGenReg == DISGREG_DIL && pThis->f64Bit))573 && ( (DisState.Param2.x86.Base.idxGenReg == DISGREG_AL && !pThis->f64Bit) 574 || (DisState.Param2.x86.Base.idxGenReg == DISGREG_DIL && pThis->f64Bit)) 575 575 && DISUSE_IS_EFFECTIVE_ADDR(DisState.Param1.fUse)) 576 576 { … … 657 657 */ 658 658 if ( (DisState.Param1.fUse & (DISUSE_BASE | DISUSE_REG_GEN32 | DISUSE_REG_GEN64)) 659 && (DisState.Param2. arch.x86.cb == sizeof(uint32_t) || DisState.Param2.arch.x86.cb == sizeof(uint64_t))659 && (DisState.Param2.x86.cb == sizeof(uint32_t) || DisState.Param2.x86.cb == sizeof(uint64_t)) 660 660 && (DisState.Param2.fUse & (DISUSE_RIPDISPLACEMENT32|DISUSE_DISPLACEMENT32|DISUSE_DISPLACEMENT64))) 661 661 { … … 663 663 664 664 if (DisState.Param2.fUse & DISUSE_RIPDISPLACEMENT32) 665 GCPtrVal = GCPtrCur + DisState.Param2. arch.x86.uDisp.i32 + cbInstr;665 GCPtrVal = GCPtrCur + DisState.Param2.x86.uDisp.i32 + cbInstr; 666 666 else if (DisState.Param2.fUse & DISUSE_DISPLACEMENT32) 667 GCPtrVal = (RTGCPTR)DisState.Param2. arch.x86.uDisp.u32;667 GCPtrVal = (RTGCPTR)DisState.Param2.x86.uDisp.u32; 668 668 else if (DisState.Param2.fUse & DISUSE_DISPLACEMENT64) 669 GCPtrVal = (RTGCPTR)DisState.Param2. arch.x86.uDisp.u64;669 GCPtrVal = (RTGCPTR)DisState.Param2.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. arch.x86.cb;679 aAddresses[cAddressesUsed].cb = DisState.Param2.x86.cb; 680 680 aAddresses[cAddressesUsed].GCPtrOrigSrc = GCPtrVal; 681 681 cAddressesUsed++; -
trunk/src/VBox/Devices/BiosCommonCode/MakeAlternativeSource.cpp
r99220 r101539 935 935 * modrm.reg != 0. Those encodings should be invalid AFAICT. */ 936 936 937 if ( ( pDis-> arch.x86.bOpCode == 0x8f/* group 1a */938 || pDis-> arch.x86.bOpCode == 0xc7/* group 11 */939 || pDis-> arch.x86.bOpCode == 0xc6/* group 11 - not verified */937 if ( ( pDis->x86.bOpCode == 0x8f /* group 1a */ 938 || pDis->x86.bOpCode == 0xc7 /* group 11 */ 939 || pDis->x86.bOpCode == 0xc6 /* group 11 - not verified */ 940 940 ) 941 && pDis-> arch.x86.ModRM.Bits.Reg != 0)941 && pDis->x86.ModRM.Bits.Reg != 0) 942 942 fDifferent = true; 943 943 /* … … 999 999 cbToRead = g_cbImg - offBios; 1000 1000 } 1001 memcpy(&pDis-> u.abInstr[offInstr], &g_pbImg[offBios], cbToRead);1001 memcpy(&pDis->Instr.ab[offInstr], &g_pbImg[offBios], cbToRead); 1002 1002 pDis->cbCachedInstr = (uint8_t)(offInstr + cbToRead); 1003 1003 return VINF_SUCCESS; … … 1138 1138 unsigned cbInstr; 1139 1139 DISSTATE Dis; 1140 Dis. arch.x86.ModRM.Bits.Mod = 3;1140 Dis.x86.ModRM.Bits.Mod = 3; 1141 1141 int rc = DISInstrWithReader(uFlatAddr, fIs16Bit ? DISCPUMODE_16BIT : DISCPUMODE_32BIT, 1142 1142 disReadOpcodeBytes, NULL, &Dis, &cbInstr); … … 1146 1146 && Dis.pCurInstr->uOpcode != OP_INVALID 1147 1147 && Dis.pCurInstr->uOpcode != OP_ILLUD2 1148 && ( !(Dis. arch.x86.fPrefix & DISPREFIX_ADDRSIZE)1148 && ( !(Dis.x86.fPrefix & DISPREFIX_ADDRSIZE) 1149 1149 || disAccessesMemory(&Dis))) 1150 1150 { -
trunk/src/VBox/Disassembler/Disasm.cpp
r99319 r101539 55 55 RT_NOREF_PV(cbMinRead); 56 56 AssertMsgFailed(("disReadWord with no read callback in ring 0!!\n")); 57 RT_BZERO(&pDis-> u.abInstr[offInstr], cbMaxRead);57 RT_BZERO(&pDis->Instr.ab[offInstr], cbMaxRead); 58 58 pDis->cbCachedInstr = offInstr + cbMaxRead; 59 59 return VERR_DIS_NO_READ_CALLBACK; … … 66 66 ? cbMinRead 67 67 : (uint8_t)cbLeftOnPage; 68 memcpy(&pDis-> u.abInstr[offInstr], pbSrc, cbToRead);68 memcpy(&pDis->Instr.ab[offInstr], pbSrc, cbToRead); 69 69 pDis->cbCachedInstr = offInstr + cbToRead; 70 70 return VINF_SUCCESS; … … 74 74 75 75 /** 76 * Read more bytes into the DISSTATE:: u.abInstrbuffer, advance76 * Read more bytes into the DISSTATE::Instr.ab buffer, advance 77 77 * DISSTATE::cbCachedInstr. 78 78 * 79 79 * Will set DISSTATE::rc on failure, but still advance cbCachedInstr. 80 80 * 81 * The caller shall fend off reads beyond the DISSTATE:: u.abInstrbuffer.81 * The caller shall fend off reads beyond the DISSTATE::Instr.ab buffer. 82 82 * 83 83 * @param pDis The disassembler state. … … 88 88 DECLHIDDEN(void) disReadMore(PDISSTATE pDis, uint8_t offInstr, uint8_t cbMin) 89 89 { 90 Assert(cbMin + offInstr <= sizeof(pDis-> u.abInstr));90 Assert(cbMin + offInstr <= sizeof(pDis->Instr.ab)); 91 91 92 92 /* … … 108 108 /* 109 109 * Do the read. 110 * (No need to zero anything on failure as u.abInstris already zeroed by the110 * (No need to zero anything on failure as Instr.ab is already zeroed by the 111 111 * DISInstrEx API.) 112 112 */ 113 int rc = pDis->pfnReadBytes(pDis, offInstr, cbMin, sizeof(pDis-> u.abInstr) - offInstr);113 int rc = pDis->pfnReadBytes(pDis, offInstr, cbMin, sizeof(pDis->Instr.ab) - offInstr); 114 114 if (RT_SUCCESS(rc)) 115 115 { 116 116 Assert(pDis->cbCachedInstr >= offInstr + cbMin); 117 Assert(pDis->cbCachedInstr <= sizeof(pDis-> u.abInstr));117 Assert(pDis->cbCachedInstr <= sizeof(pDis->Instr.ab)); 118 118 } 119 119 else … … 138 138 { 139 139 disReadMore(pDis, (uint8_t)offInstr, 1); 140 return pDis-> u.abInstr[offInstr];140 return pDis->Instr.ab[offInstr]; 141 141 } 142 142 143 143 Log(("disReadByte: too long instruction...\n")); 144 144 pDis->rc = VERR_DIS_TOO_LONG_INSTR; 145 ssize_t cbLeft = (ssize_t)(sizeof(pDis-> u.abInstr) - offInstr);145 ssize_t cbLeft = (ssize_t)(sizeof(pDis->Instr.ab) - offInstr); 146 146 if (cbLeft > 0) 147 return pDis-> u.abInstr[offInstr];147 return pDis->Instr.ab[offInstr]; 148 148 return 0; 149 149 } … … 164 164 disReadMore(pDis, (uint8_t)offInstr, 2); 165 165 #ifdef DIS_HOST_UNALIGNED_ACCESS_OK 166 return *(uint16_t const *)&pDis-> u.abInstr[offInstr];167 #else 168 return RT_MAKE_U16(pDis-> u.abInstr[offInstr], pDis->u.abInstr[offInstr + 1]);166 return *(uint16_t const *)&pDis->Instr.ab[offInstr]; 167 #else 168 return RT_MAKE_U16(pDis->Instr.ab[offInstr], pDis->Instr.ab[offInstr + 1]); 169 169 #endif 170 170 } … … 172 172 Log(("disReadWord: too long instruction...\n")); 173 173 pDis->rc = VERR_DIS_TOO_LONG_INSTR; 174 ssize_t cbLeft = (ssize_t)(sizeof(pDis-> u.abInstr) - offInstr);174 ssize_t cbLeft = (ssize_t)(sizeof(pDis->Instr.ab) - offInstr); 175 175 switch (cbLeft) 176 176 { 177 177 case 1: 178 return pDis-> u.abInstr[offInstr];178 return pDis->Instr.ab[offInstr]; 179 179 default: 180 180 if (cbLeft >= 2) 181 return RT_MAKE_U16(pDis-> u.abInstr[offInstr], pDis->u.abInstr[offInstr + 1]);181 return RT_MAKE_U16(pDis->Instr.ab[offInstr], pDis->Instr.ab[offInstr + 1]); 182 182 return 0; 183 183 } … … 199 199 disReadMore(pDis, (uint8_t)offInstr, 4); 200 200 #ifdef DIS_HOST_UNALIGNED_ACCESS_OK 201 return *(uint32_t const *)&pDis-> u.abInstr[offInstr];202 #else 203 return RT_MAKE_U32_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],204 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3]);201 return *(uint32_t const *)&pDis->Instr.ab[offInstr]; 202 #else 203 return RT_MAKE_U32_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 204 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3]); 205 205 #endif 206 206 } … … 208 208 Log(("disReadDWord: too long instruction...\n")); 209 209 pDis->rc = VERR_DIS_TOO_LONG_INSTR; 210 ssize_t cbLeft = (ssize_t)(sizeof(pDis-> u.abInstr) - offInstr);210 ssize_t cbLeft = (ssize_t)(sizeof(pDis->Instr.ab) - offInstr); 211 211 switch (cbLeft) 212 212 { 213 213 case 1: 214 return RT_MAKE_U32_FROM_U8(pDis-> u.abInstr[offInstr], 0, 0, 0);214 return RT_MAKE_U32_FROM_U8(pDis->Instr.ab[offInstr], 0, 0, 0); 215 215 case 2: 216 return RT_MAKE_U32_FROM_U8(pDis-> u.abInstr[offInstr], pDis->u.abInstr[offInstr + 1], 0, 0);216 return RT_MAKE_U32_FROM_U8(pDis->Instr.ab[offInstr], pDis->Instr.ab[offInstr + 1], 0, 0); 217 217 case 3: 218 return RT_MAKE_U32_FROM_U8(pDis-> u.abInstr[offInstr], pDis->u.abInstr[offInstr + 1], pDis->u.abInstr[offInstr + 2], 0);218 return RT_MAKE_U32_FROM_U8(pDis->Instr.ab[offInstr], pDis->Instr.ab[offInstr + 1], pDis->Instr.ab[offInstr + 2], 0); 219 219 default: 220 220 if (cbLeft >= 4) 221 return RT_MAKE_U32_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],222 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3]);221 return RT_MAKE_U32_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 222 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3]); 223 223 return 0; 224 224 } … … 240 240 disReadMore(pDis, (uint8_t)offInstr, 8); 241 241 #ifdef DIS_HOST_UNALIGNED_ACCESS_OK 242 return *(uint64_t const *)&pDis-> u.abInstr[offInstr];243 #else 244 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],245 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3],246 pDis-> u.abInstr[offInstr + 4], pDis->u.abInstr[offInstr + 5],247 pDis-> u.abInstr[offInstr + 6], pDis->u.abInstr[offInstr + 7]);242 return *(uint64_t const *)&pDis->Instr.ab[offInstr]; 243 #else 244 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 245 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3], 246 pDis->Instr.ab[offInstr + 4], pDis->Instr.ab[offInstr + 5], 247 pDis->Instr.ab[offInstr + 6], pDis->Instr.ab[offInstr + 7]); 248 248 #endif 249 249 } … … 251 251 Log(("disReadQWord: too long instruction...\n")); 252 252 pDis->rc = VERR_DIS_TOO_LONG_INSTR; 253 ssize_t cbLeft = (ssize_t)(sizeof(pDis-> u.abInstr) - offInstr);253 ssize_t cbLeft = (ssize_t)(sizeof(pDis->Instr.ab) - offInstr); 254 254 switch (cbLeft) 255 255 { 256 256 case 1: 257 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr], 0, 0, 0, 0, 0, 0, 0);257 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr], 0, 0, 0, 0, 0, 0, 0); 258 258 case 2: 259 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr], pDis->u.abInstr[offInstr + 1], 0, 0, 0, 0, 0, 0);259 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr], pDis->Instr.ab[offInstr + 1], 0, 0, 0, 0, 0, 0); 260 260 case 3: 261 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],262 pDis-> u.abInstr[offInstr + 2], 0, 0, 0, 0, 0);261 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 262 pDis->Instr.ab[offInstr + 2], 0, 0, 0, 0, 0); 263 263 case 4: 264 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],265 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3],264 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 265 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3], 266 266 0, 0, 0, 0); 267 267 case 5: 268 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],269 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3],270 pDis-> u.abInstr[offInstr + 4], 0, 0, 0);268 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 269 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3], 270 pDis->Instr.ab[offInstr + 4], 0, 0, 0); 271 271 case 6: 272 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],273 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3],274 pDis-> u.abInstr[offInstr + 4], pDis->u.abInstr[offInstr + 5],272 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 273 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3], 274 pDis->Instr.ab[offInstr + 4], pDis->Instr.ab[offInstr + 5], 275 275 0, 0); 276 276 case 7: 277 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],278 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3],279 pDis-> u.abInstr[offInstr + 4], pDis->u.abInstr[offInstr + 5],280 pDis-> u.abInstr[offInstr + 6], 0);277 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 278 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3], 279 pDis->Instr.ab[offInstr + 4], pDis->Instr.ab[offInstr + 5], 280 pDis->Instr.ab[offInstr + 6], 0); 281 281 default: 282 282 if (cbLeft >= 8) 283 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],284 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3],285 pDis-> u.abInstr[offInstr + 4], pDis->u.abInstr[offInstr + 5],286 pDis-> u.abInstr[offInstr + 6], pDis->u.abInstr[offInstr + 7]);283 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 284 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3], 285 pDis->Instr.ab[offInstr + 4], pDis->Instr.ab[offInstr + 5], 286 pDis->Instr.ab[offInstr + 6], pDis->Instr.ab[offInstr + 7]); 287 287 return 0; 288 288 } … … 424 424 else 425 425 { 426 if (cbPretched >= sizeof(pDis-> u.abInstr))426 if (cbPretched >= sizeof(pDis->Instr.ab)) 427 427 { 428 memcpy(pDis-> u.abInstr, pvPrefetched, sizeof(pDis->u.abInstr));429 pDis->cbCachedInstr = (uint8_t)sizeof(pDis-> u.abInstr);428 memcpy(pDis->Instr.ab, pvPrefetched, sizeof(pDis->Instr.ab)); 429 pDis->cbCachedInstr = (uint8_t)sizeof(pDis->Instr.ab); 430 430 } 431 431 else 432 432 { 433 memcpy(pDis-> u.abInstr, pvPrefetched, cbPretched);433 memcpy(pDis->Instr.ab, pvPrefetched, cbPretched); 434 434 pDis->cbCachedInstr = (uint8_t)cbPretched; 435 435 } -
trunk/src/VBox/Disassembler/DisasmCore-armv8.cpp
r99334 r101539 152 152 if (pInsnParm->cBits <= 8) 153 153 { 154 pParam->ar ch.armv8.cb = sizeof(uint8_t);154 pParam->armv8.cb = sizeof(uint8_t); 155 155 pParam->fUse |= DISUSE_IMMEDIATE8; 156 156 } 157 157 else if (pInsnParm->cBits <= 16) 158 158 { 159 pParam->ar ch.armv8.cb = sizeof(uint16_t);159 pParam->armv8.cb = sizeof(uint16_t); 160 160 pParam->fUse |= DISUSE_IMMEDIATE16; 161 161 } 162 162 else if (pInsnParm->cBits <= 32) 163 163 { 164 pParam->ar ch.armv8.cb = sizeof(uint32_t);164 pParam->armv8.cb = sizeof(uint32_t); 165 165 pParam->fUse |= DISUSE_IMMEDIATE32; 166 166 } … … 181 181 if (pInsnParm->cBits <= 8) 182 182 { 183 pParam->ar ch.armv8.cb = sizeof(int8_t);183 pParam->armv8.cb = sizeof(int8_t); 184 184 pParam->fUse |= DISUSE_IMMEDIATE8_REL; 185 185 } 186 186 else if (pInsnParm->cBits <= 16) 187 187 { 188 pParam->ar ch.armv8.cb = sizeof(int16_t);188 pParam->armv8.cb = sizeof(int16_t); 189 189 pParam->fUse |= DISUSE_IMMEDIATE16_REL; 190 190 } 191 191 else if (pInsnParm->cBits <= 32) 192 192 { 193 pParam->ar ch.armv8.cb = sizeof(int32_t);193 pParam->armv8.cb = sizeof(int32_t); 194 194 pParam->fUse |= DISUSE_IMMEDIATE32_REL; 195 195 } … … 215 215 { 216 216 RT_NOREF(pDis, pInsnClass); 217 pParam->ar ch.armv8.Reg.idxGenReg = disArmV8ExtractBitVecFromInsn(u32Insn, pInsnParm->idxBitStart, pInsnParm->cBits);218 pParam->ar ch.armv8.cb = f64Bit ? sizeof(uint64_t) : sizeof(uint32_t);217 pParam->armv8.Reg.idxGenReg = disArmV8ExtractBitVecFromInsn(u32Insn, pInsnParm->idxBitStart, pInsnParm->cBits); 218 pParam->armv8.cb = f64Bit ? sizeof(uint64_t) : sizeof(uint32_t); 219 219 pParam->fUse |= f64Bit ? DISUSE_REG_GEN64 : DISUSE_REG_GEN32; 220 220 return VINF_SUCCESS; … … 238 238 /** @todo Decode according to spec. */ 239 239 pParam->uValue = u32ImmRaw; 240 pParam->ar ch.armv8.cb = sizeof(uint32_t);240 pParam->armv8.cb = sizeof(uint32_t); 241 241 pParam->fUse |= DISUSE_IMMEDIATE32; 242 242 return VINF_SUCCESS; … … 301 301 302 302 /* Should contain the parameter type on input. */ 303 pDis->Param1.ar ch.armv8.fParam = pOp->Opc.fParam1;304 pDis->Param2.ar ch.armv8.fParam = pOp->Opc.fParam2;305 pDis->Param3.ar ch.armv8.fParam = pOp->Opc.fParam3;306 pDis->Param4.ar ch.armv8.fParam = pOp->Opc.fParam4;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; 307 307 308 308 pDis->pCurInstr = &pOp->Opc; … … 337 337 pDis->pCurInstr = &g_ArmV8A64InvalidOpcode[0]; 338 338 339 pDis->Param1.ar ch.armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam1;340 pDis->Param2.ar ch.armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam2;341 pDis->Param3.ar ch.armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam3;342 pDis->Param4.ar ch.armv8.fParam = g_ArmV8A64InvalidOpcode[0].fParam4;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; 343 343 } 344 344 pDis->rc = rc; … … 438 438 return pDis->rc; 439 439 440 pDis->u.u32 = RT_LE2H_U32(u32Insn); 441 pDis->cbInstr = sizeof(u32Insn); 440 /** @todo r=bird: This is a waste of time if the host is little endian... */ 441 pDis->Instr.u32 = RT_LE2H_U32(u32Insn); 442 pDis->cbInstr = sizeof(u32Insn); 442 443 443 444 return disInstrArmV8DecodeWorker(pDis, u32Insn, &g_ArmV8A64DecodeL0.Hdr); -
trunk/src/VBox/Disassembler/DisasmCore-x86-amd64.cpp
r99240 r101539 238 238 */ 239 239 bool fFiltered; 240 if ((pOp->fOpType & pDis-> arch.x86.fFilter) == 0)240 if ((pOp->fOpType & pDis->x86.fFilter) == 0) 241 241 { 242 242 fFiltered = true; 243 pDis-> arch.x86.pfnDisasmFnTable = g_apfnCalcSize;243 pDis->x86.pfnDisasmFnTable = g_apfnCalcSize; 244 244 } 245 245 else … … 247 247 /* Not filtered out -> full disassembly */ 248 248 fFiltered = false; 249 pDis-> arch.x86.pfnDisasmFnTable = g_apfnFullDisasm;249 pDis->x86.pfnDisasmFnTable = g_apfnFullDisasm; 250 250 } 251 251 252 252 // Should contain the parameter type on input 253 pDis->Param1. arch.x86.fParam = pOp->fParam1;254 pDis->Param2. arch.x86.fParam = pOp->fParam2;255 pDis->Param3. arch.x86.fParam = pOp->fParam3;256 pDis->Param4. arch.x86.fParam = pOp->fParam4;253 pDis->Param1.x86.fParam = pOp->fParam1; 254 pDis->Param2.x86.fParam = pOp->fParam2; 255 pDis->Param3.x86.fParam = pOp->fParam3; 256 pDis->Param4.x86.fParam = pOp->fParam4; 257 257 258 258 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ … … 264 264 { 265 265 if (pOp->fOpType & DISOPTYPE_X86_FORCED_64_OP_SIZE) 266 pDis-> arch.x86.uOpMode = DISCPUMODE_64BIT;266 pDis->x86.uOpMode = DISCPUMODE_64BIT; 267 267 else if ( (pOp->fOpType & DISOPTYPE_X86_DEFAULT_64_OP_SIZE) 268 && !(pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE))269 pDis-> arch.x86.uOpMode = DISCPUMODE_64BIT;268 && !(pDis->x86.fPrefix & DISPREFIX_OPSIZE)) 269 pDis->x86.uOpMode = DISCPUMODE_64BIT; 270 270 } 271 271 else if (pOp->fOpType & DISOPTYPE_X86_FORCED_32_OP_SIZE_X86) … … 273 273 /* Forced 32 bits operand size for certain instructions (mov crx, mov drx). */ 274 274 Assert(pDis->uCpuMode != DISCPUMODE_64BIT); 275 pDis-> arch.x86.uOpMode = DISCPUMODE_32BIT;275 pDis->x86.uOpMode = DISCPUMODE_32BIT; 276 276 } 277 277 } … … 279 279 if (pOp->idxParse1 != IDX_ParseNop) 280 280 { 281 offInstr = pDis-> arch.x86.pfnDisasmFnTable[pOp->idxParse1](offInstr, pOp, pDis, &pDis->Param1);282 if (fFiltered == false) pDis->Param1. arch.x86.cb = DISGetParamSize(pDis, &pDis->Param1);281 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse1](offInstr, pOp, pDis, &pDis->Param1); 282 if (fFiltered == false) pDis->Param1.x86.cb = DISGetParamSize(pDis, &pDis->Param1); 283 283 } 284 284 285 285 if (pOp->idxParse2 != IDX_ParseNop) 286 286 { 287 offInstr = pDis-> arch.x86.pfnDisasmFnTable[pOp->idxParse2](offInstr, pOp, pDis, &pDis->Param2);288 if (fFiltered == false) pDis->Param2. arch.x86.cb = DISGetParamSize(pDis, &pDis->Param2);287 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse2](offInstr, pOp, pDis, &pDis->Param2); 288 if (fFiltered == false) pDis->Param2.x86.cb = DISGetParamSize(pDis, &pDis->Param2); 289 289 } 290 290 291 291 if (pOp->idxParse3 != IDX_ParseNop) 292 292 { 293 offInstr = pDis-> arch.x86.pfnDisasmFnTable[pOp->idxParse3](offInstr, pOp, pDis, &pDis->Param3);294 if (fFiltered == false) pDis->Param3. arch.x86.cb = DISGetParamSize(pDis, &pDis->Param3);293 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse3](offInstr, pOp, pDis, &pDis->Param3); 294 if (fFiltered == false) pDis->Param3.x86.cb = DISGetParamSize(pDis, &pDis->Param3); 295 295 } 296 296 297 297 if (pOp->idxParse4 != IDX_ParseNop) 298 298 { 299 offInstr = pDis-> arch.x86.pfnDisasmFnTable[pOp->idxParse4](offInstr, pOp, pDis, &pDis->Param4);300 if (fFiltered == false) pDis->Param4. arch.x86.cb = DISGetParamSize(pDis, &pDis->Param4);299 offInstr = pDis->x86.pfnDisasmFnTable[pOp->idxParse4](offInstr, pOp, pDis, &pDis->Param4); 300 if (fFiltered == false) pDis->Param4.x86.cb = DISGetParamSize(pDis, &pDis->Param4); 301 301 } 302 302 // else simple one byte instruction … … 313 313 314 314 uint8_t ModRM = disReadByte(pDis, offInstr); 315 uint8_t index = pDis-> arch.x86.bOpCode - 0xD8;315 uint8_t index = pDis->x86.bOpCode - 0xD8; 316 316 if (ModRM <= 0xBF) 317 317 { … … 320 320 321 321 // Should contain the parameter type on input 322 pDis->Param1. arch.x86.fParam = fpop->fParam1;323 pDis->Param2. arch.x86.fParam = fpop->fParam2;322 pDis->Param1.x86.fParam = fpop->fParam1; 323 pDis->Param2.x86.fParam = fpop->fParam2; 324 324 } 325 325 else … … 333 333 * @note Multibyte opcodes are always marked harmless until the final byte. 334 334 */ 335 if ((fpop->fOpType & pDis-> arch.x86.fFilter) == 0)336 pDis-> arch.x86.pfnDisasmFnTable = g_apfnCalcSize;335 if ((fpop->fOpType & pDis->x86.fFilter) == 0) 336 pDis->x86.pfnDisasmFnTable = g_apfnCalcSize; 337 337 else 338 338 /* Not filtered out -> full disassembly */ 339 pDis-> arch.x86.pfnDisasmFnTable = g_apfnFullDisasm;339 pDis->x86.pfnDisasmFnTable = g_apfnFullDisasm; 340 340 341 341 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ … … 347 347 /* Note: redundant, but just in case this ever changes */ 348 348 if (fpop->fOpType & DISOPTYPE_X86_FORCED_64_OP_SIZE) 349 pDis-> arch.x86.uOpMode = DISCPUMODE_64BIT;349 pDis->x86.uOpMode = DISCPUMODE_64BIT; 350 350 else if ( (fpop->fOpType & DISOPTYPE_X86_DEFAULT_64_OP_SIZE) 351 && !(pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE))352 pDis-> arch.x86.uOpMode = DISCPUMODE_64BIT;351 && !(pDis->x86.fPrefix & DISPREFIX_OPSIZE)) 352 pDis->x86.uOpMode = DISCPUMODE_64BIT; 353 353 } 354 354 … … 358 358 359 359 if (fpop->idxParse1 != IDX_ParseNop) 360 offInstr = pDis-> arch.x86.pfnDisasmFnTable[fpop->idxParse1](offInstr, fpop, pDis, pParam);360 offInstr = pDis->x86.pfnDisasmFnTable[fpop->idxParse1](offInstr, fpop, pDis, pParam); 361 361 362 362 if (fpop->idxParse2 != IDX_ParseNop) 363 offInstr = pDis-> arch.x86.pfnDisasmFnTable[fpop->idxParse2](offInstr, fpop, pDis, pParam);363 offInstr = pDis->x86.pfnDisasmFnTable[fpop->idxParse2](offInstr, fpop, pDis, pParam); 364 364 365 365 return offInstr; … … 378 378 static void UseSIB(PDISSTATE pDis, PDISOPPARAM pParam) 379 379 { 380 unsigned scale = pDis-> arch.x86.SIB.Bits.Scale;381 uint8_t base = pDis-> arch.x86.SIB.Bits.Base;382 uint8_t index = pDis-> arch.x86.SIB.Bits.Index;380 unsigned scale = pDis->x86.SIB.Bits.Scale; 381 uint8_t base = pDis->x86.SIB.Bits.Base; 382 uint8_t index = pDis->x86.SIB.Bits.Index; 383 383 384 384 unsigned regtype, vregtype; … … 387 387 * is not an options since only one instruction (gather) 388 388 * supports it currently. May be changed in the future. */ 389 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT)389 if (pDis->x86.uAddrMode == DISCPUMODE_32BIT) 390 390 regtype = DISUSE_REG_GEN32; 391 391 else 392 392 regtype = DISUSE_REG_GEN64; 393 393 if (pDis->pCurInstr->uOpcode == OP_GATHER) 394 vregtype = (VEXREG_IS256B(pDis-> arch.x86.bVexDestReg) ? DISUSE_REG_YMM : DISUSE_REG_XMM);394 vregtype = (VEXREG_IS256B(pDis->x86.bVexDestReg) ? DISUSE_REG_YMM : DISUSE_REG_XMM); 395 395 else 396 396 vregtype = regtype; … … 399 399 { 400 400 pParam->fUse |= DISUSE_INDEX | vregtype; 401 pParam-> arch.x86.Index.idxGenReg = index;401 pParam->x86.Index.idxGenReg = index; 402 402 403 403 if (scale != 0) 404 404 { 405 405 pParam->fUse |= DISUSE_SCALE; 406 pParam-> arch.x86.uScale = (uint8_t)(1 << scale);407 } 408 } 409 410 if (base == 5 && pDis-> arch.x86.ModRM.Bits.Mod == 0)406 pParam->x86.uScale = (uint8_t)(1 << scale); 407 } 408 } 409 410 if (base == 5 && pDis->x86.ModRM.Bits.Mod == 0) 411 411 { 412 412 // [scaled index] + disp32 413 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT)413 if (pDis->x86.uAddrMode == DISCPUMODE_32BIT) 414 414 { 415 415 pParam->fUse |= DISUSE_DISPLACEMENT32; 416 pParam-> arch.x86.uDisp.i32 = pDis->arch.x86.i32SibDisp;416 pParam->x86.uDisp.i32 = pDis->x86.i32SibDisp; 417 417 } 418 418 else 419 419 { /* sign-extend to 64 bits */ 420 420 pParam->fUse |= DISUSE_DISPLACEMENT64; 421 pParam-> arch.x86.uDisp.i64 = pDis->arch.x86.i32SibDisp;421 pParam->x86.uDisp.i64 = pDis->x86.i32SibDisp; 422 422 } 423 423 } … … 425 425 { 426 426 pParam->fUse |= DISUSE_BASE | regtype; 427 pParam-> arch.x86.Base.idxGenReg = base;427 pParam->x86.Base.idxGenReg = base; 428 428 } 429 429 return; /* Already fetched everything in ParseSIB; no size returned */ … … 438 438 offInstr++; 439 439 440 pDis-> arch.x86.SIB.Bits.Base = SIB_BASE(SIB);441 pDis-> arch.x86.SIB.Bits.Index = SIB_INDEX(SIB);442 pDis-> arch.x86.SIB.Bits.Scale = SIB_SCALE(SIB);443 444 if (pDis-> arch.x86.fPrefix & DISPREFIX_REX)440 pDis->x86.SIB.Bits.Base = SIB_BASE(SIB); 441 pDis->x86.SIB.Bits.Index = SIB_INDEX(SIB); 442 pDis->x86.SIB.Bits.Scale = SIB_SCALE(SIB); 443 444 if (pDis->x86.fPrefix & DISPREFIX_REX) 445 445 { 446 446 /* REX.B extends the Base field if not scaled index + disp32 */ 447 if (!(pDis-> arch.x86.SIB.Bits.Base == 5 && pDis->arch.x86.ModRM.Bits.Mod == 0))448 pDis-> arch.x86.SIB.Bits.Base |= (!!(pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3;449 450 pDis-> arch.x86.SIB.Bits.Index |= (!!(pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_X)) << 3;451 } 452 453 if ( pDis-> arch.x86.SIB.Bits.Base == 5454 && pDis-> arch.x86.ModRM.Bits.Mod == 0)447 if (!(pDis->x86.SIB.Bits.Base == 5 && pDis->x86.ModRM.Bits.Mod == 0)) 448 pDis->x86.SIB.Bits.Base |= (!!(pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3; 449 450 pDis->x86.SIB.Bits.Index |= (!!(pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_X)) << 3; 451 } 452 453 if ( pDis->x86.SIB.Bits.Base == 5 454 && pDis->x86.ModRM.Bits.Mod == 0) 455 455 { 456 456 /* Additional 32 bits displacement. No change in long mode. */ 457 pDis-> arch.x86.i32SibDisp = (int32_t)disReadDWord(pDis, offInstr);457 pDis->x86.i32SibDisp = (int32_t)disReadDWord(pDis, offInstr); 458 458 offInstr += 4; 459 459 } … … 469 469 offInstr++; 470 470 471 pDis-> arch.x86.SIB.Bits.Base = SIB_BASE(SIB);472 pDis-> arch.x86.SIB.Bits.Index = SIB_INDEX(SIB);473 pDis-> arch.x86.SIB.Bits.Scale = SIB_SCALE(SIB);474 475 if (pDis-> arch.x86.fPrefix & DISPREFIX_REX)471 pDis->x86.SIB.Bits.Base = SIB_BASE(SIB); 472 pDis->x86.SIB.Bits.Index = SIB_INDEX(SIB); 473 pDis->x86.SIB.Bits.Scale = SIB_SCALE(SIB); 474 475 if (pDis->x86.fPrefix & DISPREFIX_REX) 476 476 { 477 477 /* REX.B extends the Base field. */ 478 pDis-> arch.x86.SIB.Bits.Base |= ((!!(pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3);478 pDis->x86.SIB.Bits.Base |= ((!!(pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3); 479 479 /* REX.X extends the Index field. */ 480 pDis-> arch.x86.SIB.Bits.Index |= ((!!(pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_X)) << 3);481 } 482 483 if ( pDis-> arch.x86.SIB.Bits.Base == 5484 && pDis-> arch.x86.ModRM.Bits.Mod == 0)480 pDis->x86.SIB.Bits.Index |= ((!!(pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_X)) << 3); 481 } 482 483 if ( pDis->x86.SIB.Bits.Base == 5 484 && pDis->x86.ModRM.Bits.Mod == 0) 485 485 { 486 486 /* Additional 32 bits displacement. No change in long mode. */ … … 506 506 507 507 #ifdef LOG_ENABLED 508 unsigned type = OP_PARM_VTYPE(pParam-> arch.x86.fParam);508 unsigned type = OP_PARM_VTYPE(pParam->x86.fParam); 509 509 #endif 510 unsigned subtype = OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam);510 unsigned subtype = OP_PARM_VSUBTYPE(pParam->x86.fParam); 511 511 if (fRegAddr) 512 subtype = (pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT) ? OP_PARM_q : OP_PARM_d;512 subtype = (pDis->x86.uAddrMode == DISCPUMODE_64BIT) ? OP_PARM_q : OP_PARM_d; 513 513 else if (subtype == OP_PARM_v || subtype == OP_PARM_NONE || subtype == OP_PARM_y) 514 514 { 515 switch (pDis-> arch.x86.uOpMode)515 switch (pDis->x86.uOpMode) 516 516 { 517 517 case DISCPUMODE_32BIT: … … 534 534 { 535 535 case OP_PARM_b: 536 Assert(idx < (pDis-> arch.x86.fPrefix & DISPREFIX_REX ? 16U : 8U));536 Assert(idx < (pDis->x86.fPrefix & DISPREFIX_REX ? 16U : 8U)); 537 537 538 538 /* AH, BH, CH & DH map to DIL, SIL, EBL & SPL when a rex prefix is present. */ 539 539 /* Intel 64 and IA-32 Architectures Software Developer's Manual: 3.4.1.1 */ 540 if ( (pDis-> arch.x86.fPrefix & DISPREFIX_REX)540 if ( (pDis->x86.fPrefix & DISPREFIX_REX) 541 541 && idx >= DISGREG_AH 542 542 && idx <= DISGREG_BH) … … 546 546 547 547 pParam->fUse |= DISUSE_REG_GEN8; 548 pParam-> arch.x86.Base.idxGenReg = (uint8_t)idx;548 pParam->x86.Base.idxGenReg = (uint8_t)idx; 549 549 break; 550 550 551 551 case OP_PARM_w: 552 Assert(idx < (pDis-> arch.x86.fPrefix & DISPREFIX_REX ? 16U : 8U));552 Assert(idx < (pDis->x86.fPrefix & DISPREFIX_REX ? 16U : 8U)); 553 553 554 554 pParam->fUse |= DISUSE_REG_GEN16; 555 pParam-> arch.x86.Base.idxGenReg = (uint8_t)idx;555 pParam->x86.Base.idxGenReg = (uint8_t)idx; 556 556 break; 557 557 558 558 case OP_PARM_d: 559 Assert(idx < (pDis-> arch.x86.fPrefix & DISPREFIX_REX ? 16U : 8U));559 Assert(idx < (pDis->x86.fPrefix & DISPREFIX_REX ? 16U : 8U)); 560 560 561 561 if ( !(pOp->fOpType & DISOPTYPE_X86_DEFAULT_64_OP_SIZE) /* Tweak for vpmovmskb & pmovmskb. */ 562 || pDis-> arch.x86.uOpMode != DISCPUMODE_64BIT)562 || pDis->x86.uOpMode != DISCPUMODE_64BIT) 563 563 pParam->fUse |= DISUSE_REG_GEN32; 564 564 else 565 565 pParam->fUse |= DISUSE_REG_GEN64; 566 pParam-> arch.x86.Base.idxGenReg = (uint8_t)idx;566 pParam->x86.Base.idxGenReg = (uint8_t)idx; 567 567 break; 568 568 569 569 case OP_PARM_q: 570 570 pParam->fUse |= DISUSE_REG_GEN64; 571 pParam-> arch.x86.Base.idxGenReg = (uint8_t)idx;571 pParam->x86.Base.idxGenReg = (uint8_t)idx; 572 572 break; 573 573 … … 587 587 RT_NOREF_PV(pDis); RT_NOREF_PV(pOp); 588 588 pParam->fUse |= DISUSE_REG_GEN16; 589 pParam-> arch.x86.Base.idxGenReg = s_auBaseModRMReg16[idx];589 pParam->x86.Base.idxGenReg = s_auBaseModRMReg16[idx]; 590 590 if (idx < 4) 591 591 { 592 592 static const uint8_t s_auIndexModRMReg16[4] = { DISGREG_SI, DISGREG_DI, DISGREG_SI, DISGREG_DI }; 593 593 pParam->fUse |= DISUSE_INDEX; 594 pParam-> arch.x86.Index.idxGenReg = s_auIndexModRMReg16[idx];594 pParam->x86.Index.idxGenReg = s_auIndexModRMReg16[idx]; 595 595 } 596 596 } … … 608 608 609 609 pParam->fUse |= DISUSE_REG_SEG; 610 pParam-> arch.x86.Base.idxSegReg = (uint8_t)idx;610 pParam->x86.Base.idxSegReg = (uint8_t)idx; 611 611 } 612 612 … … 614 614 static size_t UseModRM(size_t const offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 615 615 { 616 unsigned vtype = OP_PARM_VTYPE(pParam-> arch.x86.fParam);617 uint8_t reg = pDis-> arch.x86.ModRM.Bits.Reg;618 uint8_t mod = pDis-> arch.x86.ModRM.Bits.Mod;619 uint8_t rm = pDis-> arch.x86.ModRM.Bits.Rm;616 unsigned vtype = OP_PARM_VTYPE(pParam->x86.fParam); 617 uint8_t reg = pDis->x86.ModRM.Bits.Reg; 618 uint8_t mod = pDis->x86.ModRM.Bits.Mod; 619 uint8_t rm = pDis->x86.ModRM.Bits.Rm; 620 620 621 621 switch (vtype) … … 634 634 635 635 if ( pDis->pCurInstr->uOpcode == OP_MOV_CR 636 && pDis-> arch.x86.uOpMode == DISCPUMODE_32BIT637 && (pDis-> arch.x86.fPrefix & DISPREFIX_LOCK))636 && pDis->x86.uOpMode == DISCPUMODE_32BIT 637 && (pDis->x86.fPrefix & DISPREFIX_LOCK)) 638 638 { 639 pDis-> arch.x86.fPrefix &= ~DISPREFIX_LOCK;640 pParam-> arch.x86.Base.idxCtrlReg = DISCREG_CR8;639 pDis->x86.fPrefix &= ~DISPREFIX_LOCK; 640 pParam->x86.Base.idxCtrlReg = DISCREG_CR8; 641 641 } 642 642 else 643 pParam-> arch.x86.Base.idxCtrlReg = reg;643 pParam->x86.Base.idxCtrlReg = reg; 644 644 return offInstr; 645 645 646 646 case OP_PARM_D: //debug register 647 647 pParam->fUse |= DISUSE_REG_DBG; 648 pParam-> arch.x86.Base.idxDbgReg = reg;648 pParam->x86.Base.idxDbgReg = reg; 649 649 return offInstr; 650 650 … … 658 658 reg &= 7; /* REX.R has no effect here */ 659 659 pParam->fUse |= DISUSE_REG_MMX; 660 pParam-> arch.x86.Base.idxMmxReg = reg;660 pParam->x86.Base.idxMmxReg = reg; 661 661 return offInstr; 662 662 … … 670 670 reg &= 7; /* REX.R has no effect here */ 671 671 pParam->fUse |= DISUSE_REG_TEST; 672 pParam-> arch.x86.Base.idxTestReg = reg;672 pParam->x86.Base.idxTestReg = reg; 673 673 return offInstr; 674 674 … … 683 683 684 684 case OP_PARM_V: //XMM register 685 if (VEXREG_IS256B(pDis-> arch.x86.bVexDestReg)686 && OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) != OP_PARM_dq687 && OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) != OP_PARM_q688 && OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) != OP_PARM_d689 && OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) != OP_PARM_w)685 if (VEXREG_IS256B(pDis->x86.bVexDestReg) 686 && OP_PARM_VSUBTYPE(pParam->x86.fParam) != OP_PARM_dq 687 && OP_PARM_VSUBTYPE(pParam->x86.fParam) != OP_PARM_q 688 && OP_PARM_VSUBTYPE(pParam->x86.fParam) != OP_PARM_d 689 && OP_PARM_VSUBTYPE(pParam->x86.fParam) != OP_PARM_w) 690 690 { 691 691 // Use YMM register if VEX.L is set. 692 692 pParam->fUse |= DISUSE_REG_YMM; 693 pParam-> arch.x86.Base.idxYmmReg = reg;693 pParam->x86.Base.idxYmmReg = reg; 694 694 } 695 695 else 696 696 { 697 697 pParam->fUse |= DISUSE_REG_XMM; 698 pParam-> arch.x86.Base.idxXmmReg = reg;698 pParam->x86.Base.idxXmmReg = reg; 699 699 } 700 700 return offInstr; … … 705 705 /** @todo bound */ 706 706 707 if (pDis-> arch.x86.uAddrMode != DISCPUMODE_16BIT)708 { 709 Assert(pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT || pDis->arch.x86.uAddrMode == DISCPUMODE_64BIT);707 if (pDis->x86.uAddrMode != DISCPUMODE_16BIT) 708 { 709 Assert(pDis->x86.uAddrMode == DISCPUMODE_32BIT || pDis->x86.uAddrMode == DISCPUMODE_64BIT); 710 710 711 711 /* … … 724 724 { 725 725 pParam->fUse |= DISUSE_DISPLACEMENT32; 726 pParam-> arch.x86.uDisp.i32 = pDis->arch.x86.i32SibDisp;726 pParam->x86.uDisp.i32 = pDis->x86.i32SibDisp; 727 727 } 728 728 else 729 729 { 730 730 pParam->fUse |= DISUSE_RIPDISPLACEMENT32; 731 pParam-> arch.x86.uDisp.i32 = pDis->arch.x86.i32SibDisp;731 pParam->x86.uDisp.i32 = pDis->x86.i32SibDisp; 732 732 } 733 733 } … … 747 747 disasmModRMReg(rm, pOp, pDis, pParam, 1); 748 748 } 749 pParam-> arch.x86.uDisp.i8 = pDis->arch.x86.i32SibDisp;749 pParam->x86.uDisp.i8 = pDis->x86.i32SibDisp; 750 750 pParam->fUse |= DISUSE_DISPLACEMENT8; 751 751 break; … … 759 759 disasmModRMReg(rm, pOp, pDis, pParam, 1); 760 760 } 761 pParam-> arch.x86.uDisp.i32 = pDis->arch.x86.i32SibDisp;761 pParam->x86.uDisp.i32 = pDis->x86.i32SibDisp; 762 762 pParam->fUse |= DISUSE_DISPLACEMENT32; 763 763 break; … … 775 775 if (rm == 6) 776 776 {//16 bits displacement 777 pParam-> arch.x86.uDisp.i16 = pDis->arch.x86.i32SibDisp;777 pParam->x86.uDisp.i16 = pDis->x86.i32SibDisp; 778 778 pParam->fUse |= DISUSE_DISPLACEMENT16; 779 779 } … … 787 787 case 1: //effective address + 8 bits displacement 788 788 disasmModRMReg16(rm, pOp, pDis, pParam); 789 pParam-> arch.x86.uDisp.i8 = pDis->arch.x86.i32SibDisp;789 pParam->x86.uDisp.i8 = pDis->x86.i32SibDisp; 790 790 pParam->fUse |= DISUSE_BASE | DISUSE_DISPLACEMENT8; 791 791 break; … … 793 793 case 2: //effective address + 16 bits displacement 794 794 disasmModRMReg16(rm, pOp, pDis, pParam); 795 pParam-> arch.x86.uDisp.i16 = pDis->arch.x86.i32SibDisp;795 pParam->x86.uDisp.i16 = pDis->x86.i32SibDisp; 796 796 pParam->fUse |= DISUSE_BASE | DISUSE_DISPLACEMENT16; 797 797 break; … … 809 809 static size_t QueryModRM(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 810 810 { 811 uint8_t mod = pDis-> arch.x86.ModRM.Bits.Mod;812 uint8_t rm = pDis-> arch.x86.ModRM.Bits.Rm;813 814 if (pDis-> arch.x86.uAddrMode != DISCPUMODE_16BIT)815 { 816 Assert(pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT || pDis->arch.x86.uAddrMode == DISCPUMODE_64BIT);811 uint8_t mod = pDis->x86.ModRM.Bits.Mod; 812 uint8_t rm = pDis->x86.ModRM.Bits.Rm; 813 814 if (pDis->x86.uAddrMode != DISCPUMODE_16BIT) 815 { 816 Assert(pDis->x86.uAddrMode == DISCPUMODE_32BIT || pDis->x86.uAddrMode == DISCPUMODE_64BIT); 817 817 818 818 /* … … 827 827 if (rm == 5) /* 32 bits displacement */ 828 828 { 829 pDis-> arch.x86.i32SibDisp = (int32_t)disReadDWord(pDis, offInstr);829 pDis->x86.i32SibDisp = (int32_t)disReadDWord(pDis, offInstr); 830 830 offInstr += 4; 831 831 } … … 834 834 835 835 case 1: /* Effective address + 8 bits displacement */ 836 pDis-> arch.x86.i32SibDisp = (int8_t)disReadByte(pDis, offInstr);836 pDis->x86.i32SibDisp = (int8_t)disReadByte(pDis, offInstr); 837 837 offInstr++; 838 838 break; 839 839 840 840 case 2: /* Effective address + 32 bits displacement */ 841 pDis-> arch.x86.i32SibDisp = (int32_t)disReadDWord(pDis, offInstr);841 pDis->x86.i32SibDisp = (int32_t)disReadDWord(pDis, offInstr); 842 842 offInstr += 4; 843 843 break; … … 855 855 if (rm == 6) 856 856 { 857 pDis-> arch.x86.i32SibDisp = disReadWord(pDis, offInstr);857 pDis->x86.i32SibDisp = disReadWord(pDis, offInstr); 858 858 offInstr += 2; 859 859 } … … 862 862 863 863 case 1: /* Effective address + 8 bits displacement */ 864 pDis-> arch.x86.i32SibDisp = (int8_t)disReadByte(pDis, offInstr);864 pDis->x86.i32SibDisp = (int8_t)disReadByte(pDis, offInstr); 865 865 offInstr++; 866 866 break; 867 867 868 868 case 2: /* Effective address + 32 bits displacement */ 869 pDis-> arch.x86.i32SibDisp = (int16_t)disReadWord(pDis, offInstr);869 pDis->x86.i32SibDisp = (int16_t)disReadWord(pDis, offInstr); 870 870 offInstr += 2; 871 871 break; … … 882 882 static size_t QueryModRM_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 883 883 { 884 uint8_t mod = pDis-> arch.x86.ModRM.Bits.Mod;885 uint8_t rm = pDis-> arch.x86.ModRM.Bits.Rm;886 887 if (pDis-> arch.x86.uAddrMode != DISCPUMODE_16BIT)888 { 889 Assert(pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT || pDis->arch.x86.uAddrMode == DISCPUMODE_64BIT);884 uint8_t mod = pDis->x86.ModRM.Bits.Mod; 885 uint8_t rm = pDis->x86.ModRM.Bits.Rm; 886 887 if (pDis->x86.uAddrMode != DISCPUMODE_16BIT) 888 { 889 Assert(pDis->x86.uAddrMode == DISCPUMODE_32BIT || pDis->x86.uAddrMode == DISCPUMODE_64BIT); 890 890 /* 891 891 * Note: displacements in long mode are 8 or 32 bits and sign-extended to 64 bits … … 956 956 offInstr++; 957 957 958 pDis-> arch.x86.ModRM.Bits.Rm = MODRM_RM(ModRM);959 pDis-> arch.x86.ModRM.Bits.Mod = MODRM_MOD(ModRM);960 pDis-> arch.x86.ModRM.Bits.Reg = MODRM_REG(ModRM);958 pDis->x86.ModRM.Bits.Rm = MODRM_RM(ModRM); 959 pDis->x86.ModRM.Bits.Mod = MODRM_MOD(ModRM); 960 pDis->x86.ModRM.Bits.Reg = MODRM_REG(ModRM); 961 961 962 962 /* Disregard the mod bits for certain instructions (mov crx, mov drx). … … 967 967 */ 968 968 if (pOp->fOpType & DISOPTYPE_X86_MOD_FIXED_11) 969 pDis-> arch.x86.ModRM.Bits.Mod = 3;970 971 if (pDis-> arch.x86.fPrefix & DISPREFIX_REX)969 pDis->x86.ModRM.Bits.Mod = 3; 970 971 if (pDis->x86.fPrefix & DISPREFIX_REX) 972 972 { 973 973 Assert(pDis->uCpuMode == DISCPUMODE_64BIT); 974 974 975 975 /* REX.R extends the Reg field. */ 976 pDis-> arch.x86.ModRM.Bits.Reg |= ((!!(pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_R)) << 3);976 pDis->x86.ModRM.Bits.Reg |= ((!!(pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_R)) << 3); 977 977 978 978 /* REX.B extends the Rm field if there is no SIB byte nor a 32 bits displacement */ 979 if (!( pDis-> arch.x86.ModRM.Bits.Mod != 3980 && pDis-> arch.x86.ModRM.Bits.Rm == 4)979 if (!( pDis->x86.ModRM.Bits.Mod != 3 980 && pDis->x86.ModRM.Bits.Rm == 4) 981 981 && 982 !( pDis-> arch.x86.ModRM.Bits.Mod == 0983 && pDis-> arch.x86.ModRM.Bits.Rm == 5))984 { 985 pDis-> arch.x86.ModRM.Bits.Rm |= ((!!(pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3);982 !( pDis->x86.ModRM.Bits.Mod == 0 983 && pDis->x86.ModRM.Bits.Rm == 5)) 984 { 985 pDis->x86.ModRM.Bits.Rm |= ((!!(pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3); 986 986 } 987 987 } … … 997 997 offInstr++; 998 998 999 pDis-> arch.x86.ModRM.Bits.Rm = MODRM_RM(ModRM);1000 pDis-> arch.x86.ModRM.Bits.Mod = MODRM_MOD(ModRM);1001 pDis-> arch.x86.ModRM.Bits.Reg = MODRM_REG(ModRM);999 pDis->x86.ModRM.Bits.Rm = MODRM_RM(ModRM); 1000 pDis->x86.ModRM.Bits.Mod = MODRM_MOD(ModRM); 1001 pDis->x86.ModRM.Bits.Reg = MODRM_REG(ModRM); 1002 1002 1003 1003 /* Disregard the mod bits for certain instructions (mov crx, mov drx). … … 1008 1008 */ 1009 1009 if (pOp->fOpType & DISOPTYPE_X86_MOD_FIXED_11) 1010 pDis-> arch.x86.ModRM.Bits.Mod = 3;1011 1012 if (pDis-> arch.x86.fPrefix & DISPREFIX_REX)1010 pDis->x86.ModRM.Bits.Mod = 3; 1011 1012 if (pDis->x86.fPrefix & DISPREFIX_REX) 1013 1013 { 1014 1014 Assert(pDis->uCpuMode == DISCPUMODE_64BIT); 1015 1015 1016 1016 /* REX.R extends the Reg field. */ 1017 pDis-> arch.x86.ModRM.Bits.Reg |= ((!!(pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_R)) << 3);1017 pDis->x86.ModRM.Bits.Reg |= ((!!(pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_R)) << 3); 1018 1018 1019 1019 /* REX.B extends the Rm field if there is no SIB byte nor a 32 bits displacement */ 1020 if (!( pDis-> arch.x86.ModRM.Bits.Mod != 31021 && pDis-> arch.x86.ModRM.Bits.Rm == 4)1020 if (!( pDis->x86.ModRM.Bits.Mod != 3 1021 && pDis->x86.ModRM.Bits.Rm == 4) 1022 1022 && 1023 !( pDis-> arch.x86.ModRM.Bits.Mod == 01024 && pDis-> arch.x86.ModRM.Bits.Rm == 5))1025 { 1026 pDis-> arch.x86.ModRM.Bits.Rm |= ((!!(pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3);1023 !( pDis->x86.ModRM.Bits.Mod == 0 1024 && pDis->x86.ModRM.Bits.Rm == 5)) 1025 { 1026 pDis->x86.ModRM.Bits.Rm |= ((!!(pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) << 3); 1027 1027 } 1028 1028 } … … 1047 1047 RT_NOREF_PV(pOp); 1048 1048 uint8_t byte = disReadByte(pDis, offInstr); 1049 if (pParam-> arch.x86.fParam == OP_PARM_Lx)1050 { 1051 pParam->fUse |= (VEXREG_IS256B(pDis-> arch.x86.bVexDestReg) ? DISUSE_REG_YMM : DISUSE_REG_XMM);1049 if (pParam->x86.fParam == OP_PARM_Lx) 1050 { 1051 pParam->fUse |= (VEXREG_IS256B(pDis->x86.bVexDestReg) ? DISUSE_REG_YMM : DISUSE_REG_XMM); 1052 1052 1053 1053 // Ignore MSB in 32-bit mode. … … 1055 1055 byte &= 0x7f; 1056 1056 1057 pParam-> arch.x86.Base.idxXmmReg = byte >> 4;1057 pParam->x86.Base.idxXmmReg = byte >> 4; 1058 1058 } 1059 1059 else … … 1061 1061 pParam->uValue = byte; 1062 1062 pParam->fUse |= DISUSE_IMMEDIATE8; 1063 pParam-> arch.x86.cb = sizeof(uint8_t);1063 pParam->x86.cb = sizeof(uint8_t); 1064 1064 } 1065 1065 return offInstr + 1; … … 1077 1077 { 1078 1078 RT_NOREF_PV(pOp); 1079 if (pDis-> arch.x86.uOpMode == DISCPUMODE_32BIT)1079 if (pDis->x86.uOpMode == DISCPUMODE_32BIT) 1080 1080 { 1081 1081 pParam->uValue = (uint32_t)(int8_t)disReadByte(pDis, offInstr); 1082 1082 pParam->fUse |= DISUSE_IMMEDIATE32_SX8; 1083 pParam-> arch.x86.cb = sizeof(uint32_t);1084 } 1085 else 1086 if (pDis-> arch.x86.uOpMode == DISCPUMODE_64BIT)1083 pParam->x86.cb = sizeof(uint32_t); 1084 } 1085 else 1086 if (pDis->x86.uOpMode == DISCPUMODE_64BIT) 1087 1087 { 1088 1088 pParam->uValue = (uint64_t)(int8_t)disReadByte(pDis, offInstr); 1089 1089 pParam->fUse |= DISUSE_IMMEDIATE64_SX8; 1090 pParam-> arch.x86.cb = sizeof(uint64_t);1090 pParam->x86.cb = sizeof(uint64_t); 1091 1091 } 1092 1092 else … … 1094 1094 pParam->uValue = (uint16_t)(int8_t)disReadByte(pDis, offInstr); 1095 1095 pParam->fUse |= DISUSE_IMMEDIATE16_SX8; 1096 pParam-> arch.x86.cb = sizeof(uint16_t);1096 pParam->x86.cb = sizeof(uint16_t); 1097 1097 } 1098 1098 return offInstr + 1; … … 1112 1112 pParam->uValue = disReadWord(pDis, offInstr); 1113 1113 pParam->fUse |= DISUSE_IMMEDIATE16; 1114 pParam-> arch.x86.cb = sizeof(uint16_t);1114 pParam->x86.cb = sizeof(uint16_t); 1115 1115 return offInstr + 2; 1116 1116 } … … 1129 1129 pParam->uValue = disReadDWord(pDis, offInstr); 1130 1130 pParam->fUse |= DISUSE_IMMEDIATE32; 1131 pParam-> arch.x86.cb = sizeof(uint32_t);1131 pParam->x86.cb = sizeof(uint32_t); 1132 1132 return offInstr + 4; 1133 1133 } … … 1146 1146 pParam->uValue = disReadQWord(pDis, offInstr); 1147 1147 pParam->fUse |= DISUSE_IMMEDIATE64; 1148 pParam-> arch.x86.cb = sizeof(uint64_t);1148 pParam->x86.cb = sizeof(uint64_t); 1149 1149 return offInstr + 8; 1150 1150 } … … 1161 1161 { 1162 1162 RT_NOREF_PV(pOp); 1163 if (pDis-> arch.x86.uOpMode == DISCPUMODE_32BIT)1163 if (pDis->x86.uOpMode == DISCPUMODE_32BIT) 1164 1164 { 1165 1165 pParam->uValue = disReadDWord(pDis, offInstr); 1166 1166 pParam->fUse |= DISUSE_IMMEDIATE32; 1167 pParam-> arch.x86.cb = sizeof(uint32_t);1167 pParam->x86.cb = sizeof(uint32_t); 1168 1168 return offInstr + 4; 1169 1169 } 1170 1170 1171 if (pDis-> arch.x86.uOpMode == DISCPUMODE_64BIT)1171 if (pDis->x86.uOpMode == DISCPUMODE_64BIT) 1172 1172 { 1173 1173 pParam->uValue = disReadQWord(pDis, offInstr); 1174 1174 pParam->fUse |= DISUSE_IMMEDIATE64; 1175 pParam-> arch.x86.cb = sizeof(uint64_t);1175 pParam->x86.cb = sizeof(uint64_t); 1176 1176 return offInstr + 8; 1177 1177 } … … 1179 1179 pParam->uValue = disReadWord(pDis, offInstr); 1180 1180 pParam->fUse |= DISUSE_IMMEDIATE16; 1181 pParam-> arch.x86.cb = sizeof(uint16_t);1181 pParam->x86.cb = sizeof(uint16_t); 1182 1182 return offInstr + 2; 1183 1183 } … … 1187 1187 { 1188 1188 RT_NOREF_PV(offInstr); RT_NOREF_PV(pOp); RT_NOREF_PV(pParam); 1189 if (pDis-> arch.x86.uOpMode == DISCPUMODE_32BIT)1189 if (pDis->x86.uOpMode == DISCPUMODE_32BIT) 1190 1190 return offInstr + 4; 1191 if (pDis-> arch.x86.uOpMode == DISCPUMODE_64BIT)1191 if (pDis->x86.uOpMode == DISCPUMODE_64BIT) 1192 1192 return offInstr + 8; 1193 1193 return offInstr + 2; … … 1199 1199 RT_NOREF_PV(pOp); 1200 1200 /* Word for 16-bit operand-size or doubleword for 32 or 64-bit operand-size. */ 1201 if (pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT)1201 if (pDis->x86.uOpMode == DISCPUMODE_16BIT) 1202 1202 { 1203 1203 pParam->uValue = disReadWord(pDis, offInstr); 1204 1204 pParam->fUse |= DISUSE_IMMEDIATE16; 1205 pParam-> arch.x86.cb = sizeof(uint16_t);1205 pParam->x86.cb = sizeof(uint16_t); 1206 1206 return offInstr + 2; 1207 1207 } 1208 1208 1209 1209 /* 64 bits op mode means *sign* extend to 64 bits. */ 1210 if (pDis-> arch.x86.uOpMode == DISCPUMODE_64BIT)1210 if (pDis->x86.uOpMode == DISCPUMODE_64BIT) 1211 1211 { 1212 1212 pParam->uValue = (uint64_t)(int32_t)disReadDWord(pDis, offInstr); 1213 1213 pParam->fUse |= DISUSE_IMMEDIATE64; 1214 pParam-> arch.x86.cb = sizeof(uint64_t);1214 pParam->x86.cb = sizeof(uint64_t); 1215 1215 } 1216 1216 else … … 1218 1218 pParam->uValue = disReadDWord(pDis, offInstr); 1219 1219 pParam->fUse |= DISUSE_IMMEDIATE32; 1220 pParam-> arch.x86.cb = sizeof(uint32_t);1220 pParam->x86.cb = sizeof(uint32_t); 1221 1221 } 1222 1222 return offInstr + 4; … … 1228 1228 RT_NOREF_PV(offInstr); RT_NOREF_PV(pOp); RT_NOREF_PV(pParam); 1229 1229 /* Word for 16-bit operand-size or doubleword for 32 or 64-bit operand-size. */ 1230 if (pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT)1230 if (pDis->x86.uOpMode == DISCPUMODE_16BIT) 1231 1231 return offInstr + 2; 1232 1232 return offInstr + 4; … … 1241 1241 pParam->uValue = disReadByte(pDis, offInstr); 1242 1242 pParam->fUse |= DISUSE_IMMEDIATE8_REL; 1243 pParam-> arch.x86.cb = sizeof(uint8_t);1243 pParam->x86.cb = sizeof(uint8_t); 1244 1244 return offInstr + 1; 1245 1245 } … … 1258 1258 { 1259 1259 RT_NOREF_PV(pOp); 1260 if (pDis-> arch.x86.uOpMode == DISCPUMODE_32BIT)1260 if (pDis->x86.uOpMode == DISCPUMODE_32BIT) 1261 1261 { 1262 1262 pParam->uValue = disReadDWord(pDis, offInstr); 1263 1263 pParam->fUse |= DISUSE_IMMEDIATE32_REL; 1264 pParam-> arch.x86.cb = sizeof(int32_t);1264 pParam->x86.cb = sizeof(int32_t); 1265 1265 return offInstr + 4; 1266 1266 } 1267 1267 1268 if (pDis-> arch.x86.uOpMode == DISCPUMODE_64BIT)1268 if (pDis->x86.uOpMode == DISCPUMODE_64BIT) 1269 1269 { 1270 1270 /* 32 bits relative immediate sign extended to 64 bits. */ 1271 1271 pParam->uValue = (uint64_t)(int32_t)disReadDWord(pDis, offInstr); 1272 1272 pParam->fUse |= DISUSE_IMMEDIATE64_REL; 1273 pParam-> arch.x86.cb = sizeof(int64_t);1273 pParam->x86.cb = sizeof(int64_t); 1274 1274 return offInstr + 4; 1275 1275 } … … 1277 1277 pParam->uValue = disReadWord(pDis, offInstr); 1278 1278 pParam->fUse |= DISUSE_IMMEDIATE16_REL; 1279 pParam-> arch.x86.cb = sizeof(int16_t);1279 pParam->x86.cb = sizeof(int16_t); 1280 1280 return offInstr + 2; 1281 1281 } … … 1286 1286 { 1287 1287 RT_NOREF_PV(offInstr); RT_NOREF_PV(pOp); RT_NOREF_PV(pParam); 1288 if (pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT)1288 if (pDis->x86.uOpMode == DISCPUMODE_16BIT) 1289 1289 return offInstr + 2; 1290 1290 /* Both 32 & 64 bits mode use 32 bits relative immediates. */ … … 1296 1296 { 1297 1297 RT_NOREF_PV(pOp); 1298 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT)1299 { 1300 if (OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_p)1298 if (pDis->x86.uAddrMode == DISCPUMODE_32BIT) 1299 { 1300 if (OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_p) 1301 1301 { 1302 1302 /* far 16:32 pointer */ … … 1304 1304 *((uint32_t*)&pParam->uValue+1) = disReadWord(pDis, offInstr+sizeof(uint32_t)); 1305 1305 pParam->fUse |= DISUSE_IMMEDIATE_ADDR_16_32; 1306 pParam-> arch.x86.cb = sizeof(uint16_t) + sizeof(uint32_t);1306 pParam->x86.cb = sizeof(uint16_t) + sizeof(uint32_t); 1307 1307 return offInstr + 4 + 2; 1308 1308 } … … 1314 1314 * so we treat it like displacement. 1315 1315 */ 1316 pParam-> arch.x86.uDisp.u32 = disReadDWord(pDis, offInstr);1316 pParam->x86.uDisp.u32 = disReadDWord(pDis, offInstr); 1317 1317 pParam->fUse |= DISUSE_DISPLACEMENT32; 1318 pParam-> arch.x86.cb = sizeof(uint32_t);1318 pParam->x86.cb = sizeof(uint32_t); 1319 1319 return offInstr + 4; 1320 1320 } 1321 1321 1322 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT)1322 if (pDis->x86.uAddrMode == DISCPUMODE_64BIT) 1323 1323 { 1324 1324 /* … … 1328 1328 * so we treat it like displacement. 1329 1329 */ 1330 Assert(OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) != OP_PARM_p);1331 pParam-> arch.x86.uDisp.u64 = disReadQWord(pDis, offInstr);1330 Assert(OP_PARM_VSUBTYPE(pParam->x86.fParam) != OP_PARM_p); 1331 pParam->x86.uDisp.u64 = disReadQWord(pDis, offInstr); 1332 1332 pParam->fUse |= DISUSE_DISPLACEMENT64; 1333 pParam-> arch.x86.cb = sizeof(uint64_t);1333 pParam->x86.cb = sizeof(uint64_t); 1334 1334 return offInstr + 8; 1335 1335 } 1336 if (OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_p)1336 if (OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_p) 1337 1337 { 1338 1338 /* far 16:16 pointer */ 1339 1339 pParam->uValue = disReadDWord(pDis, offInstr); 1340 1340 pParam->fUse |= DISUSE_IMMEDIATE_ADDR_16_16; 1341 pParam-> arch.x86.cb = 2*sizeof(uint16_t);1341 pParam->x86.cb = 2*sizeof(uint16_t); 1342 1342 return offInstr + 4; 1343 1343 } … … 1349 1349 * so we treat it like displacement. 1350 1350 */ 1351 pParam-> arch.x86.uDisp.i16 = disReadWord(pDis, offInstr);1351 pParam->x86.uDisp.i16 = disReadWord(pDis, offInstr); 1352 1352 pParam->fUse |= DISUSE_DISPLACEMENT16; 1353 pParam-> arch.x86.cb = sizeof(uint16_t);1353 pParam->x86.cb = sizeof(uint16_t); 1354 1354 return offInstr + 2; 1355 1355 } … … 1359 1359 { 1360 1360 RT_NOREF_PV(offInstr); RT_NOREF_PV(pOp); 1361 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT)1362 { 1363 if (OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_p)1361 if (pDis->x86.uAddrMode == DISCPUMODE_32BIT) 1362 { 1363 if (OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_p) 1364 1364 return offInstr + 4 + 2; /* far 16:32 pointer */ 1365 1365 return offInstr + 4; /* near 32 bits pointer */ 1366 1366 } 1367 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT)1368 { 1369 Assert(OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) != OP_PARM_p);1367 if (pDis->x86.uAddrMode == DISCPUMODE_64BIT) 1368 { 1369 Assert(OP_PARM_VSUBTYPE(pParam->x86.fParam) != OP_PARM_p); 1370 1370 return offInstr + 8; 1371 1371 } 1372 if (OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_p)1372 if (OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_p) 1373 1373 return offInstr + 4; /* far 16:16 pointer */ 1374 1374 return offInstr + 2; /* near 16 bits pointer */ … … 1380 1380 RT_NOREF_PV(pOp); 1381 1381 // immediate far pointers - only 16:16 or 16:32; determined by operand, *not* address size! 1382 Assert(pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT || pDis->arch.x86.uOpMode == DISCPUMODE_32BIT);1383 Assert(OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_p);1384 if (pDis-> arch.x86.uOpMode == DISCPUMODE_32BIT)1382 Assert(pDis->x86.uOpMode == DISCPUMODE_16BIT || pDis->x86.uOpMode == DISCPUMODE_32BIT); 1383 Assert(OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_p); 1384 if (pDis->x86.uOpMode == DISCPUMODE_32BIT) 1385 1385 { 1386 1386 // far 16:32 pointer … … 1388 1388 *((uint32_t*)&pParam->uValue+1) = disReadWord(pDis, offInstr+sizeof(uint32_t)); 1389 1389 pParam->fUse |= DISUSE_IMMEDIATE_ADDR_16_32; 1390 pParam-> arch.x86.cb = sizeof(uint16_t) + sizeof(uint32_t);1390 pParam->x86.cb = sizeof(uint16_t) + sizeof(uint32_t); 1391 1391 return offInstr + 4 + 2; 1392 1392 } … … 1395 1395 pParam->uValue = disReadDWord(pDis, offInstr); 1396 1396 pParam->fUse |= DISUSE_IMMEDIATE_ADDR_16_16; 1397 pParam-> arch.x86.cb = 2*sizeof(uint16_t);1397 pParam->x86.cb = 2*sizeof(uint16_t); 1398 1398 return offInstr + 2 + 2; 1399 1399 } … … 1404 1404 RT_NOREF_PV(offInstr); RT_NOREF_PV(pOp); 1405 1405 // immediate far pointers - only 16:16 or 16:32 1406 Assert(pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT || pDis->arch.x86.uOpMode == DISCPUMODE_32BIT);1407 Assert(OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_p); RT_NOREF_PV(pParam);1408 if (pDis-> arch.x86.uOpMode == DISCPUMODE_32BIT)1406 Assert(pDis->x86.uOpMode == DISCPUMODE_16BIT || pDis->x86.uOpMode == DISCPUMODE_32BIT); 1407 Assert(OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_p); RT_NOREF_PV(pParam); 1408 if (pDis->x86.uOpMode == DISCPUMODE_32BIT) 1409 1409 return offInstr + 4 + 2; /* far 16:32 pointer */ 1410 1410 return offInstr + 2 + 2; /* far 16:16 pointer */ … … 1420 1420 */ 1421 1421 1422 if (pParam-> arch.x86.fParam == OP_PARM_NONE)1422 if (pParam->x86.fParam == OP_PARM_NONE) 1423 1423 { 1424 1424 /* No parameter at all. */ … … 1431 1431 AssertCompile(OP_PARM_REG_GEN8_END < OP_PARM_REG_FP_END); 1432 1432 1433 if (pParam-> arch.x86.fParam <= OP_PARM_REG_GEN32_END)1433 if (pParam->x86.fParam <= OP_PARM_REG_GEN32_END) 1434 1434 { 1435 1435 /* 32-bit EAX..EDI registers. */ 1436 if (pDis-> arch.x86.uOpMode == DISCPUMODE_32BIT)1436 if (pDis->x86.uOpMode == DISCPUMODE_32BIT) 1437 1437 { 1438 1438 /* Use 32-bit registers. */ 1439 pParam-> arch.x86.Base.idxGenReg = (uint8_t)(pParam->arch.x86.fParam - OP_PARM_REG_GEN32_START);1439 pParam->x86.Base.idxGenReg = (uint8_t)(pParam->x86.fParam - OP_PARM_REG_GEN32_START); 1440 1440 pParam->fUse |= DISUSE_REG_GEN32; 1441 pParam-> arch.x86.cb = 4;1442 } 1443 else if (pDis-> arch.x86.uOpMode == DISCPUMODE_64BIT)1441 pParam->x86.cb = 4; 1442 } 1443 else if (pDis->x86.uOpMode == DISCPUMODE_64BIT) 1444 1444 { 1445 1445 /* Use 64-bit registers. */ 1446 pParam-> arch.x86.Base.idxGenReg = (uint8_t)(pParam->arch.x86.fParam - OP_PARM_REG_GEN32_START);1446 pParam->x86.Base.idxGenReg = (uint8_t)(pParam->x86.fParam - OP_PARM_REG_GEN32_START); 1447 1447 pParam->fUse |= DISUSE_REG_GEN64; 1448 pParam-> arch.x86.cb = 8;1448 pParam->x86.cb = 8; 1449 1449 } 1450 1450 else 1451 1451 { 1452 1452 /* Use 16-bit registers. */ 1453 pParam-> arch.x86.Base.idxGenReg = (uint8_t)(pParam->arch.x86.fParam - OP_PARM_REG_GEN32_START);1453 pParam->x86.Base.idxGenReg = (uint8_t)(pParam->x86.fParam - OP_PARM_REG_GEN32_START); 1454 1454 pParam->fUse |= DISUSE_REG_GEN16; 1455 pParam-> arch.x86.cb = 2;1456 pParam-> arch.x86.fParam = pParam->arch.x86.fParam - OP_PARM_REG_GEN32_START + OP_PARM_REG_GEN16_START;1455 pParam->x86.cb = 2; 1456 pParam->x86.fParam = pParam->x86.fParam - OP_PARM_REG_GEN32_START + OP_PARM_REG_GEN16_START; 1457 1457 } 1458 1458 1459 1459 if ( (pOp->fOpType & DISOPTYPE_X86_REXB_EXTENDS_OPREG) 1460 1460 && pParam == &pDis->Param1 /* ugly assumption that it only applies to the first parameter */ 1461 && (pDis-> arch.x86.fPrefix & DISPREFIX_REX)1462 && (pDis-> arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_B))1461 && (pDis->x86.fPrefix & DISPREFIX_REX) 1462 && (pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)) 1463 1463 { 1464 1464 Assert(pDis->uCpuMode == DISCPUMODE_64BIT); 1465 pParam-> arch.x86.Base.idxGenReg += 8;1466 } 1467 } 1468 else if (pParam-> arch.x86.fParam <= OP_PARM_REG_SEG_END)1465 pParam->x86.Base.idxGenReg += 8; 1466 } 1467 } 1468 else if (pParam->x86.fParam <= OP_PARM_REG_SEG_END) 1469 1469 { 1470 1470 /* Segment ES..GS registers. */ 1471 pParam-> arch.x86.Base.idxSegReg = (uint8_t)(pParam->arch.x86.fParam - OP_PARM_REG_SEG_START);1471 pParam->x86.Base.idxSegReg = (uint8_t)(pParam->x86.fParam - OP_PARM_REG_SEG_START); 1472 1472 pParam->fUse |= DISUSE_REG_SEG; 1473 pParam-> arch.x86.cb = 2;1474 } 1475 else if (pParam-> arch.x86.fParam <= OP_PARM_REG_GEN16_END)1473 pParam->x86.cb = 2; 1474 } 1475 else if (pParam->x86.fParam <= OP_PARM_REG_GEN16_END) 1476 1476 { 1477 1477 /* 16-bit AX..DI registers. */ 1478 pParam-> arch.x86.Base.idxGenReg = (uint8_t)(pParam->arch.x86.fParam - OP_PARM_REG_GEN16_START);1478 pParam->x86.Base.idxGenReg = (uint8_t)(pParam->x86.fParam - OP_PARM_REG_GEN16_START); 1479 1479 pParam->fUse |= DISUSE_REG_GEN16; 1480 pParam-> arch.x86.cb = 2;1481 } 1482 else if (pParam-> arch.x86.fParam <= OP_PARM_REG_GEN8_END)1480 pParam->x86.cb = 2; 1481 } 1482 else if (pParam->x86.fParam <= OP_PARM_REG_GEN8_END) 1483 1483 { 1484 1484 /* 8-bit AL..DL, AH..DH registers. */ 1485 pParam-> arch.x86.Base.idxGenReg = (uint8_t)(pParam->arch.x86.fParam - OP_PARM_REG_GEN8_START);1485 pParam->x86.Base.idxGenReg = (uint8_t)(pParam->x86.fParam - OP_PARM_REG_GEN8_START); 1486 1486 pParam->fUse |= DISUSE_REG_GEN8; 1487 pParam-> arch.x86.cb = 1;1487 pParam->x86.cb = 1; 1488 1488 1489 1489 if ( pDis->uCpuMode == DISCPUMODE_64BIT 1490 1490 && (pOp->fOpType & DISOPTYPE_X86_REXB_EXTENDS_OPREG) 1491 1491 && pParam == &pDis->Param1 /* ugly assumption that it only applies to the first parameter */ 1492 && (pDis-> arch.x86.fPrefix & DISPREFIX_REX))1493 { 1494 if (pDis-> arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_B)1495 pParam-> arch.x86.Base.idxGenReg += 8; /* least significant byte of R8-R15 */1496 else if ( pParam-> arch.x86.Base.idxGenReg >= DISGREG_AH1497 && pParam-> arch.x86.Base.idxGenReg <= DISGREG_BH)1498 pParam-> arch.x86.Base.idxGenReg += DISGREG_SPL - DISGREG_AH;1499 } 1500 } 1501 else if (pParam-> arch.x86.fParam <= OP_PARM_REG_FP_END)1492 && (pDis->x86.fPrefix & DISPREFIX_REX)) 1493 { 1494 if (pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_B) 1495 pParam->x86.Base.idxGenReg += 8; /* least significant byte of R8-R15 */ 1496 else if ( pParam->x86.Base.idxGenReg >= DISGREG_AH 1497 && pParam->x86.Base.idxGenReg <= DISGREG_BH) 1498 pParam->x86.Base.idxGenReg += DISGREG_SPL - DISGREG_AH; 1499 } 1500 } 1501 else if (pParam->x86.fParam <= OP_PARM_REG_FP_END) 1502 1502 { 1503 1503 /* FPU registers. */ 1504 pParam-> arch.x86.Base.idxFpuReg = (uint8_t)(pParam->arch.x86.fParam - OP_PARM_REG_FP_START);1504 pParam->x86.Base.idxFpuReg = (uint8_t)(pParam->x86.fParam - OP_PARM_REG_FP_START); 1505 1505 pParam->fUse |= DISUSE_REG_FP; 1506 pParam-> arch.x86.cb = 10;1507 } 1508 Assert(!(pParam-> arch.x86.fParam >= OP_PARM_REG_GEN64_START && pParam->arch.x86.fParam <= OP_PARM_REG_GEN64_END));1506 pParam->x86.cb = 10; 1507 } 1508 Assert(!(pParam->x86.fParam >= OP_PARM_REG_GEN64_START && pParam->x86.fParam <= OP_PARM_REG_GEN64_END)); 1509 1509 1510 1510 /* else - not supported for now registers. */ … … 1519 1519 1520 1520 pParam->fUse |= DISUSE_POINTER_DS_BASED; 1521 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT)1522 { 1523 pParam-> arch.x86.Base.idxGenReg = DISGREG_ESI;1521 if (pDis->x86.uAddrMode == DISCPUMODE_32BIT) 1522 { 1523 pParam->x86.Base.idxGenReg = DISGREG_ESI; 1524 1524 pParam->fUse |= DISUSE_REG_GEN32; 1525 1525 } 1526 1526 else 1527 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT)1528 { 1529 pParam-> arch.x86.Base.idxGenReg = DISGREG_RSI;1527 if (pDis->x86.uAddrMode == DISCPUMODE_64BIT) 1528 { 1529 pParam->x86.Base.idxGenReg = DISGREG_RSI; 1530 1530 pParam->fUse |= DISUSE_REG_GEN64; 1531 1531 } 1532 1532 else 1533 1533 { 1534 pParam-> arch.x86.Base.idxGenReg = DISGREG_SI;1534 pParam->x86.Base.idxGenReg = DISGREG_SI; 1535 1535 pParam->fUse |= DISUSE_REG_GEN16; 1536 1536 } … … 1544 1544 1545 1545 pParam->fUse |= DISUSE_POINTER_DS_BASED; 1546 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT)1547 { 1548 pParam-> arch.x86.Base.idxGenReg = DISGREG_ESI;1546 if (pDis->x86.uAddrMode == DISCPUMODE_32BIT) 1547 { 1548 pParam->x86.Base.idxGenReg = DISGREG_ESI; 1549 1549 pParam->fUse |= DISUSE_REG_GEN32; 1550 1550 } 1551 1551 else 1552 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT)1553 { 1554 pParam-> arch.x86.Base.idxGenReg = DISGREG_RSI;1552 if (pDis->x86.uAddrMode == DISCPUMODE_64BIT) 1553 { 1554 pParam->x86.Base.idxGenReg = DISGREG_RSI; 1555 1555 pParam->fUse |= DISUSE_REG_GEN64; 1556 1556 } 1557 1557 else 1558 1558 { 1559 pParam-> arch.x86.Base.idxGenReg = DISGREG_SI;1559 pParam->x86.Base.idxGenReg = DISGREG_SI; 1560 1560 pParam->fUse |= DISUSE_REG_GEN16; 1561 1561 } … … 1569 1569 1570 1570 pParam->fUse |= DISUSE_POINTER_ES_BASED; 1571 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT)1572 { 1573 pParam-> arch.x86.Base.idxGenReg = DISGREG_EDI;1571 if (pDis->x86.uAddrMode == DISCPUMODE_32BIT) 1572 { 1573 pParam->x86.Base.idxGenReg = DISGREG_EDI; 1574 1574 pParam->fUse |= DISUSE_REG_GEN32; 1575 1575 } 1576 1576 else 1577 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT)1578 { 1579 pParam-> arch.x86.Base.idxGenReg = DISGREG_RDI;1577 if (pDis->x86.uAddrMode == DISCPUMODE_64BIT) 1578 { 1579 pParam->x86.Base.idxGenReg = DISGREG_RDI; 1580 1580 pParam->fUse |= DISUSE_REG_GEN64; 1581 1581 } 1582 1582 else 1583 1583 { 1584 pParam-> arch.x86.Base.idxGenReg = DISGREG_DI;1584 pParam->x86.Base.idxGenReg = DISGREG_DI; 1585 1585 pParam->fUse |= DISUSE_REG_GEN16; 1586 1586 } … … 1594 1594 1595 1595 pParam->fUse |= DISUSE_POINTER_ES_BASED; 1596 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT)1597 { 1598 pParam-> arch.x86.Base.idxGenReg = DISGREG_EDI;1596 if (pDis->x86.uAddrMode == DISCPUMODE_32BIT) 1597 { 1598 pParam->x86.Base.idxGenReg = DISGREG_EDI; 1599 1599 pParam->fUse |= DISUSE_REG_GEN32; 1600 1600 } 1601 1601 else 1602 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT)1603 { 1604 pParam-> arch.x86.Base.idxGenReg = DISGREG_RDI;1602 if (pDis->x86.uAddrMode == DISCPUMODE_64BIT) 1603 { 1604 pParam->x86.Base.idxGenReg = DISGREG_RDI; 1605 1605 pParam->fUse |= DISUSE_REG_GEN64; 1606 1606 } 1607 1607 else 1608 1608 { 1609 pParam-> arch.x86.Base.idxGenReg = DISGREG_DI;1609 pParam->x86.Base.idxGenReg = DISGREG_DI; 1610 1610 pParam->fUse |= DISUSE_REG_GEN16; 1611 1611 } … … 1627 1627 RT_NOREF_PV(pOp); 1628 1628 1629 unsigned type = OP_PARM_VTYPE(pParam-> arch.x86.fParam);1629 unsigned type = OP_PARM_VTYPE(pParam->x86.fParam); 1630 1630 switch (type) 1631 1631 { 1632 1632 case OP_PARM_H: //XMM or YMM register 1633 if (VEXREG_IS256B(pDis-> arch.x86.bVexDestReg))1633 if (VEXREG_IS256B(pDis->x86.bVexDestReg)) 1634 1634 { 1635 1635 pParam->fUse |= DISUSE_REG_YMM; 1636 pParam-> arch.x86.Base.idxYmmReg = (pDis->arch.x86.bVexDestReg >> 1) ^ 0xf;1636 pParam->x86.Base.idxYmmReg = (pDis->x86.bVexDestReg >> 1) ^ 0xf; 1637 1637 } 1638 1638 else 1639 1639 { 1640 1640 pParam->fUse |= DISUSE_REG_XMM; 1641 pParam-> arch.x86.Base.idxXmmReg = (pDis->arch.x86.bVexDestReg >> 1) ^ 0xf;1641 pParam->x86.Base.idxXmmReg = (pDis->x86.bVexDestReg >> 1) ^ 0xf; 1642 1642 } 1643 1643 break; 1644 1644 1645 1645 case OP_PARM_B: // Always OP_PARM_By. Change if it is not so. 1646 if (pDis-> arch.x86.bVexWFlag && pDis->uCpuMode == DISCPUMODE_64BIT)1646 if (pDis->x86.bVexWFlag && pDis->uCpuMode == DISCPUMODE_64BIT) 1647 1647 pParam->fUse |= DISUSE_REG_GEN64; 1648 1648 else 1649 1649 pParam->fUse |= DISUSE_REG_GEN32; 1650 1650 /// @todo Check if the register number is correct 1651 pParam-> arch.x86.Base.idxGenReg = (pDis->arch.x86.bVexDestReg >> 1) ^ 0xf;1651 pParam->x86.Base.idxGenReg = (pDis->x86.bVexDestReg >> 1) ^ 0xf; 1652 1652 break; 1653 1653 } … … 1662 1662 1663 1663 /* 2nd byte */ 1664 pDis-> arch.x86.bOpCode = disReadByte(pDis, offInstr);1664 pDis->x86.bOpCode = disReadByte(pDis, offInstr); 1665 1665 offInstr++; 1666 1666 1667 1667 /* default to the non-prefixed table. */ 1668 PCDISOPCODE pOpcode = &g_aTwoByteMapX86[pDis-> arch.x86.bOpCode];1668 PCDISOPCODE pOpcode = &g_aTwoByteMapX86[pDis->x86.bOpCode]; 1669 1669 1670 1670 /* Handle opcode table extensions that rely on the opsize, repe or repne prefix byte. */ 1671 1671 /** @todo Should we take the first or last prefix byte in case of multiple prefix bytes??? */ 1672 if (pDis-> arch.x86.bLastPrefix)1673 { 1674 switch (pDis-> arch.x86.bLastPrefix)1672 if (pDis->x86.bLastPrefix) 1673 { 1674 switch (pDis->x86.bLastPrefix) 1675 1675 { 1676 1676 case OP_OPSIZE: /* 0x66 */ 1677 if (g_aTwoByteMapX86_PF66[pDis-> arch.x86.bOpCode].uOpcode != OP_INVALID)1677 if (g_aTwoByteMapX86_PF66[pDis->x86.bOpCode].uOpcode != OP_INVALID) 1678 1678 { 1679 1679 /* Table entry is valid, so use the extension table. */ 1680 pOpcode = &g_aTwoByteMapX86_PF66[pDis-> arch.x86.bOpCode];1680 pOpcode = &g_aTwoByteMapX86_PF66[pDis->x86.bOpCode]; 1681 1681 1682 1682 /* Cancel prefix changes. */ 1683 pDis-> arch.x86.fPrefix &= ~DISPREFIX_OPSIZE;1683 pDis->x86.fPrefix &= ~DISPREFIX_OPSIZE; 1684 1684 1685 1685 if (pDis->uCpuMode == DISCPUMODE_64BIT) 1686 1686 { 1687 pDis-> arch.x86.uOpMode = (pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT);1687 pDis->x86.uOpMode = (pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT); 1688 1688 } 1689 1689 else 1690 pDis-> arch.x86.uOpMode = pDis->uCpuMode;1690 pDis->x86.uOpMode = pDis->uCpuMode; 1691 1691 } 1692 1692 break; 1693 1693 1694 1694 case OP_REPNE: /* 0xF2 */ 1695 if (g_aTwoByteMapX86_PFF2[pDis-> arch.x86.bOpCode].uOpcode != OP_INVALID)1695 if (g_aTwoByteMapX86_PFF2[pDis->x86.bOpCode].uOpcode != OP_INVALID) 1696 1696 { 1697 1697 /* Table entry is valid, so use the extension table. */ 1698 pOpcode = &g_aTwoByteMapX86_PFF2[pDis-> arch.x86.bOpCode];1698 pOpcode = &g_aTwoByteMapX86_PFF2[pDis->x86.bOpCode]; 1699 1699 1700 1700 /* Cancel prefix changes. */ 1701 pDis-> arch.x86.fPrefix &= ~DISPREFIX_REPNE;1701 pDis->x86.fPrefix &= ~DISPREFIX_REPNE; 1702 1702 } 1703 1703 break; 1704 1704 1705 1705 case OP_REPE: /* 0xF3 */ 1706 if (g_aTwoByteMapX86_PFF3[pDis-> arch.x86.bOpCode].uOpcode != OP_INVALID)1706 if (g_aTwoByteMapX86_PFF3[pDis->x86.bOpCode].uOpcode != OP_INVALID) 1707 1707 { 1708 1708 /* Table entry is valid, so use the extension table. */ 1709 pOpcode = &g_aTwoByteMapX86_PFF3[pDis-> arch.x86.bOpCode];1709 pOpcode = &g_aTwoByteMapX86_PFF3[pDis->x86.bOpCode]; 1710 1710 1711 1711 /* Cancel prefix changes. */ 1712 pDis-> arch.x86.fPrefix &= ~DISPREFIX_REP;1712 pDis->x86.fPrefix &= ~DISPREFIX_REP; 1713 1713 } 1714 1714 break; … … 1725 1725 1726 1726 /* 3rd byte */ 1727 pDis-> arch.x86.bOpCode = disReadByte(pDis, offInstr);1727 pDis->x86.bOpCode = disReadByte(pDis, offInstr); 1728 1728 offInstr++; 1729 1729 1730 1730 /* default to the non-prefixed table. */ 1731 1731 PCDISOPCODE pOpcode; 1732 if (g_apThreeByteMapX86_0F38[pDis-> arch.x86.bOpCode >> 4])1733 { 1734 pOpcode = g_apThreeByteMapX86_0F38[pDis-> arch.x86.bOpCode >> 4];1735 pOpcode = &pOpcode[pDis-> arch.x86.bOpCode & 0xf];1732 if (g_apThreeByteMapX86_0F38[pDis->x86.bOpCode >> 4]) 1733 { 1734 pOpcode = g_apThreeByteMapX86_0F38[pDis->x86.bOpCode >> 4]; 1735 pOpcode = &pOpcode[pDis->x86.bOpCode & 0xf]; 1736 1736 } 1737 1737 else … … 1740 1740 /* Handle opcode table extensions that rely on the address, repne prefix byte. */ 1741 1741 /** @todo Should we take the first or last prefix byte in case of multiple prefix bytes??? */ 1742 switch (pDis-> arch.x86.bLastPrefix)1742 switch (pDis->x86.bLastPrefix) 1743 1743 { 1744 1744 case OP_OPSIZE: /* 0x66 */ 1745 if (g_apThreeByteMapX86_660F38[pDis-> arch.x86.bOpCode >> 4])1746 { 1747 pOpcode = g_apThreeByteMapX86_660F38[pDis-> arch.x86.bOpCode >> 4];1748 pOpcode = &pOpcode[pDis-> arch.x86.bOpCode & 0xf];1745 if (g_apThreeByteMapX86_660F38[pDis->x86.bOpCode >> 4]) 1746 { 1747 pOpcode = g_apThreeByteMapX86_660F38[pDis->x86.bOpCode >> 4]; 1748 pOpcode = &pOpcode[pDis->x86.bOpCode & 0xf]; 1749 1749 1750 1750 if (pOpcode->uOpcode != OP_INVALID) … … 1753 1753 1754 1754 /* Cancel prefix changes. */ 1755 pDis-> arch.x86.fPrefix &= ~DISPREFIX_OPSIZE;1755 pDis->x86.fPrefix &= ~DISPREFIX_OPSIZE; 1756 1756 if (pDis->uCpuMode == DISCPUMODE_64BIT) 1757 1757 { 1758 pDis-> arch.x86.uOpMode = (pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT);1758 pDis->x86.uOpMode = (pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT); 1759 1759 } 1760 1760 else 1761 pDis-> arch.x86.uOpMode = pDis->uCpuMode;1761 pDis->x86.uOpMode = pDis->uCpuMode; 1762 1762 1763 1763 } … … 1766 1766 1767 1767 case OP_REPNE: /* 0xF2 */ 1768 if ((pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE) && g_apThreeByteMapX86_66F20F38[pDis->arch.x86.bOpCode >> 4])1768 if ((pDis->x86.fPrefix & DISPREFIX_OPSIZE) && g_apThreeByteMapX86_66F20F38[pDis->x86.bOpCode >> 4]) 1769 1769 { 1770 1770 /* 0x66F2 */ 1771 pOpcode = g_apThreeByteMapX86_66F20F38[pDis-> arch.x86.bOpCode >> 4];1772 pOpcode = &pOpcode[pDis-> arch.x86.bOpCode & 0xf];1771 pOpcode = g_apThreeByteMapX86_66F20F38[pDis->x86.bOpCode >> 4]; 1772 pOpcode = &pOpcode[pDis->x86.bOpCode & 0xf]; 1773 1773 1774 1774 if (pOpcode->uOpcode != OP_INVALID) … … 1777 1777 1778 1778 /* Cancel prefix changes. */ 1779 pDis-> arch.x86.fPrefix &= ~DISPREFIX_REPNE;1780 pDis-> arch.x86.fPrefix &= ~DISPREFIX_OPSIZE;1779 pDis->x86.fPrefix &= ~DISPREFIX_REPNE; 1780 pDis->x86.fPrefix &= ~DISPREFIX_OPSIZE; 1781 1781 if (pDis->uCpuMode == DISCPUMODE_64BIT) 1782 1782 { 1783 pDis-> arch.x86.uOpMode = (pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT);1783 pDis->x86.uOpMode = (pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT); 1784 1784 } 1785 1785 else 1786 pDis-> arch.x86.uOpMode = pDis->uCpuMode;1786 pDis->x86.uOpMode = pDis->uCpuMode; 1787 1787 } 1788 1788 } 1789 else if (g_apThreeByteMapX86_F20F38[pDis-> arch.x86.bOpCode >> 4])1790 { 1791 pOpcode = g_apThreeByteMapX86_F20F38[pDis-> arch.x86.bOpCode >> 4];1792 pOpcode = &pOpcode[pDis-> arch.x86.bOpCode & 0xf];1789 else if (g_apThreeByteMapX86_F20F38[pDis->x86.bOpCode >> 4]) 1790 { 1791 pOpcode = g_apThreeByteMapX86_F20F38[pDis->x86.bOpCode >> 4]; 1792 pOpcode = &pOpcode[pDis->x86.bOpCode & 0xf]; 1793 1793 1794 1794 if (pOpcode->uOpcode != OP_INVALID) … … 1797 1797 1798 1798 /* Cancel prefix changes. */ 1799 pDis-> arch.x86.fPrefix &= ~DISPREFIX_REPNE;1799 pDis->x86.fPrefix &= ~DISPREFIX_REPNE; 1800 1800 } 1801 1801 } … … 1803 1803 1804 1804 case OP_REPE: /* 0xF3 */ 1805 if (g_apThreeByteMapX86_F30F38[pDis-> arch.x86.bOpCode >> 4])1806 { 1807 pOpcode = g_apThreeByteMapX86_F30F38[pDis-> arch.x86.bOpCode >> 4];1808 pOpcode = &pOpcode[pDis-> arch.x86.bOpCode & 0xf];1805 if (g_apThreeByteMapX86_F30F38[pDis->x86.bOpCode >> 4]) 1806 { 1807 pOpcode = g_apThreeByteMapX86_F30F38[pDis->x86.bOpCode >> 4]; 1808 pOpcode = &pOpcode[pDis->x86.bOpCode & 0xf]; 1809 1809 1810 1810 if (pOpcode->uOpcode != OP_INVALID) … … 1813 1813 1814 1814 /* Cancel prefix changes. */ 1815 pDis-> arch.x86.fPrefix &= ~DISPREFIX_REP;1815 pDis->x86.fPrefix &= ~DISPREFIX_REP; 1816 1816 } 1817 1817 } … … 1827 1827 1828 1828 /* 3rd byte */ 1829 pDis-> arch.x86.bOpCode = disReadByte(pDis, offInstr);1829 pDis->x86.bOpCode = disReadByte(pDis, offInstr); 1830 1830 offInstr++; 1831 1831 1832 1832 /* default to the non-prefixed table. */ 1833 1833 PCDISOPCODE pOpcode; 1834 if (g_apThreeByteMapX86_0F3A[pDis-> arch.x86.bOpCode >> 4])1835 { 1836 pOpcode = g_apThreeByteMapX86_0F3A[pDis-> arch.x86.bOpCode >> 4];1837 pOpcode = &pOpcode[pDis-> arch.x86.bOpCode & 0xf];1834 if (g_apThreeByteMapX86_0F3A[pDis->x86.bOpCode >> 4]) 1835 { 1836 pOpcode = g_apThreeByteMapX86_0F3A[pDis->x86.bOpCode >> 4]; 1837 pOpcode = &pOpcode[pDis->x86.bOpCode & 0xf]; 1838 1838 } 1839 1839 else … … 1841 1841 1842 1842 /** @todo Should we take the first or last prefix byte in case of multiple prefix bytes??? */ 1843 if (pDis-> arch.x86.bLastPrefix == OP_OPSIZE && g_apThreeByteMapX86_660F3A[pDis->arch.x86.bOpCode >> 4])1844 { 1845 pOpcode = g_apThreeByteMapX86_660F3A[pDis-> arch.x86.bOpCode >> 4];1846 pOpcode = &pOpcode[pDis-> arch.x86.bOpCode & 0xf];1843 if (pDis->x86.bLastPrefix == OP_OPSIZE && g_apThreeByteMapX86_660F3A[pDis->x86.bOpCode >> 4]) 1844 { 1845 pOpcode = g_apThreeByteMapX86_660F3A[pDis->x86.bOpCode >> 4]; 1846 pOpcode = &pOpcode[pDis->x86.bOpCode & 0xf]; 1847 1847 1848 1848 if (pOpcode->uOpcode != OP_INVALID) … … 1851 1851 1852 1852 /* Cancel prefix changes. */ 1853 pDis-> arch.x86.fPrefix &= ~DISPREFIX_OPSIZE;1853 pDis->x86.fPrefix &= ~DISPREFIX_OPSIZE; 1854 1854 if (pDis->uCpuMode == DISCPUMODE_64BIT) 1855 1855 { 1856 pDis-> arch.x86.uOpMode = (pDis->arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT);1856 pDis->x86.uOpMode = (pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT); 1857 1857 } 1858 1858 else 1859 pDis-> arch.x86.uOpMode = pDis->uCpuMode;1859 pDis->x86.uOpMode = pDis->uCpuMode; 1860 1860 1861 1861 } … … 1870 1870 RT_NOREF_PV(pParam); 1871 1871 1872 if (pDis-> arch.x86.fPrefix & DISPREFIX_REP)1872 if (pDis->x86.fPrefix & DISPREFIX_REP) 1873 1873 { 1874 1874 pOp = &g_aMapX86_NopPause[1]; /* PAUSE */ 1875 pDis-> arch.x86.fPrefix &= ~DISPREFIX_REP;1875 pDis->x86.fPrefix &= ~DISPREFIX_REP; 1876 1876 } 1877 1877 else … … 1888 1888 uint8_t modrm = disReadByte(pDis, offInstr); 1889 1889 uint8_t reg = MODRM_REG(modrm); 1890 unsigned idx = (pDis-> arch.x86.bOpCode - 0x80) * 8;1890 unsigned idx = (pDis->x86.bOpCode - 0x80) * 8; 1891 1891 1892 1892 pOp = &g_aMapX86_Group1[idx+reg]; … … 1901 1901 1902 1902 unsigned idx; 1903 switch (pDis-> arch.x86.bOpCode)1903 switch (pDis->x86.bOpCode) 1904 1904 { 1905 1905 case 0xC0: 1906 1906 case 0xC1: 1907 idx = (pDis-> arch.x86.bOpCode - 0xC0)*8;1907 idx = (pDis->x86.bOpCode - 0xC0)*8; 1908 1908 break; 1909 1909 … … 1912 1912 case 0xD2: 1913 1913 case 0xD3: 1914 idx = (pDis-> arch.x86.bOpCode - 0xD0 + 2)*8;1914 idx = (pDis->x86.bOpCode - 0xD0 + 2)*8; 1915 1915 break; 1916 1916 1917 1917 default: 1918 Log(("ParseShiftGrp2: bOpCode=%#x\n", pDis-> arch.x86.bOpCode));1918 Log(("ParseShiftGrp2: bOpCode=%#x\n", pDis->x86.bOpCode)); 1919 1919 pDis->rc = VERR_DIS_INVALID_OPCODE; 1920 1920 return offInstr; … … 1932 1932 static size_t ParseGrp3(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam) 1933 1933 { 1934 unsigned idx = (pDis-> arch.x86.bOpCode - 0xF6) * 8;1934 unsigned idx = (pDis->x86.bOpCode - 0xF6) * 8; 1935 1935 RT_NOREF_PV(pParam); 1936 1936 … … 1979 1979 1980 1980 uint8_t ModRM = disReadByte(pDis, offInstr); 1981 pDis-> arch.x86.ModRM.Bits.Rm = MODRM_RM(ModRM);1982 pDis-> arch.x86.ModRM.Bits.Mod = MODRM_MOD(ModRM);1983 pDis-> arch.x86.ModRM.Bits.Reg = MODRM_REG(ModRM);1981 pDis->x86.ModRM.Bits.Rm = MODRM_RM(ModRM); 1982 pDis->x86.ModRM.Bits.Mod = MODRM_MOD(ModRM); 1983 pDis->x86.ModRM.Bits.Reg = MODRM_REG(ModRM); 1984 1984 1985 1985 size_t offRet = QueryModRM(offInstr + 1, pOp, pDis, pParam); … … 2084 2084 uint8_t reg = MODRM_REG(modrm); 2085 2085 2086 if (pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE)2086 if (pDis->x86.fPrefix & DISPREFIX_OPSIZE) 2087 2087 reg += 8; /* 2nd table */ 2088 2088 … … 2099 2099 uint8_t modrm = disReadByte(pDis, offInstr); 2100 2100 uint8_t reg = MODRM_REG(modrm); 2101 if (pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE)2101 if (pDis->x86.fPrefix & DISPREFIX_OPSIZE) 2102 2102 reg += 8; /* 2nd table */ 2103 2103 … … 2114 2114 uint8_t modrm = disReadByte(pDis, offInstr); 2115 2115 uint8_t reg = MODRM_REG(modrm); 2116 if (pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE)2116 if (pDis->x86.fPrefix & DISPREFIX_OPSIZE) 2117 2117 reg += 8; /* 2nd table */ 2118 2118 … … 2160 2160 2161 2161 uint8_t const bRm = disReadByte(pDis, offInstr); 2162 pOp = &g_aMapX86_Group17[(MODRM_REG(bRm) << 1) | (pDis-> arch.x86.bVexDestReg & 1)];2162 pOp = &g_aMapX86_Group17[(MODRM_REG(bRm) << 1) | (pDis->x86.bVexDestReg & 1)]; 2163 2163 2164 2164 return disParseInstruction(offInstr, pOp, pDis); … … 2173 2173 2174 2174 uint8_t byte = disReadByte(pDis, offInstr++); 2175 pDis-> arch.x86.bOpCode = disReadByte(pDis, offInstr++);2176 2177 pDis-> arch.x86.bVexDestReg = VEX_2B2INT(byte);2175 pDis->x86.bOpCode = disReadByte(pDis, offInstr++); 2176 2177 pDis->x86.bVexDestReg = VEX_2B2INT(byte); 2178 2178 2179 2179 // VEX.R (equivalent to REX.R) … … 2181 2181 { 2182 2182 /* REX prefix byte */ 2183 pDis-> arch.x86.fPrefix |= DISPREFIX_REX;2184 pDis-> arch.x86.fRexPrefix = DISPREFIX_REX_FLAGS_R;2183 pDis->x86.fPrefix |= DISPREFIX_REX; 2184 pDis->x86.fRexPrefix = DISPREFIX_REX_FLAGS_R; 2185 2185 } 2186 2186 2187 2187 PCDISOPMAPDESC const pRange = g_aapVexOpcodesMapRanges[byte & 3][1]; 2188 unsigned const idxOpcode = pDis-> arch.x86.bOpCode - pRange->idxFirst;2188 unsigned const idxOpcode = pDis->x86.bOpCode - pRange->idxFirst; 2189 2189 PCDISOPCODE pOpCode; 2190 2190 if (idxOpcode < pRange->cOpcodes) … … 2203 2203 uint8_t byte1 = disReadByte(pDis, offInstr++); 2204 2204 uint8_t byte2 = disReadByte(pDis, offInstr++); 2205 pDis-> arch.x86.bOpCode = disReadByte(pDis, offInstr++);2206 pDis-> arch.x86.bVexDestReg = VEX_2B2INT(byte2); /** @todo r=bird: why on earth ~vvvv + L; this is obfuscation non-sense. Either split the shit up or just store byte2 raw here! */2205 pDis->x86.bOpCode = disReadByte(pDis, offInstr++); 2206 pDis->x86.bVexDestReg = VEX_2B2INT(byte2); /** @todo r=bird: why on earth ~vvvv + L; this is obfuscation non-sense. Either split the shit up or just store byte2 raw here! */ 2207 2207 2208 2208 // VEX.W 2209 pDis-> arch.x86.bVexWFlag = !!(byte2 & 0x80); /** @todo r=bird: why a whole byte for this one flag? arch.x86.bVexWFlag and bVexDestReg makes little sense. */2209 pDis->x86.bVexWFlag = !!(byte2 & 0x80); /** @todo r=bird: why a whole byte for this one flag? x86.bVexWFlag and bVexDestReg makes little sense. */ 2210 2210 2211 2211 /* Hack alert! Assume VEX.W rules over any 66h prefix and that no VEX 2212 encoded instructions ever uses the regular arch.x86.uOpMode w/o VEX.W. */2213 pDis-> arch.x86.uOpMode = (byte2 & 0x80) && pDis->uCpuMode == DISCPUMODE_64BIT ? DISCPUMODE_64BIT : DISCPUMODE_32BIT;2212 encoded instructions ever uses the regular x86.uOpMode w/o VEX.W. */ 2213 pDis->x86.uOpMode = (byte2 & 0x80) && pDis->uCpuMode == DISCPUMODE_64BIT ? DISCPUMODE_64BIT : DISCPUMODE_32BIT; 2214 2214 2215 2215 // VEX.~R~X~B => REX.RXB 2216 2216 if (pDis->uCpuMode == DISCPUMODE_64BIT) 2217 2217 { 2218 pDis-> arch.x86.fRexPrefix |= (byte1 >> 5) ^ 7;2219 if (pDis-> arch.x86.fRexPrefix)2220 pDis-> arch.x86.fPrefix |= DISPREFIX_REX;2218 pDis->x86.fRexPrefix |= (byte1 >> 5) ^ 7; 2219 if (pDis->x86.fRexPrefix) 2220 pDis->x86.fPrefix |= DISPREFIX_REX; 2221 2221 } 2222 2222 … … 2226 2226 { 2227 2227 PCDISOPMAPDESC const pRange = g_aapVexOpcodesMapRanges[byte2 & 3][idxVexMap]; 2228 unsigned const idxOpcode = pDis-> arch.x86.bOpCode - pRange->idxFirst;2228 unsigned const idxOpcode = pDis->x86.bOpCode - pRange->idxFirst; 2229 2229 if (idxOpcode < pRange->cOpcodes) 2230 2230 pOpCode = &pRange->papOpcodes[idxOpcode]; … … 2267 2267 static void disValidateLockSequence(PDISSTATE pDis) 2268 2268 { 2269 Assert(pDis-> arch.x86.fPrefix & DISPREFIX_LOCK);2269 Assert(pDis->x86.fPrefix & DISPREFIX_LOCK); 2270 2270 2271 2271 /* … … 2284 2284 case OP_CMPXCHG: 2285 2285 case OP_XADD: 2286 if (pDis-> arch.x86.ModRM.Bits.Mod == 3)2286 if (pDis->x86.ModRM.Bits.Mod == 3) 2287 2287 break; 2288 2288 return; … … 2336 2336 for (;;) 2337 2337 { 2338 uint8_t const bCode = disReadByte(pDis, offInstr++);2338 uint8_t const bCode = disReadByte(pDis, offInstr++); 2339 2339 enum OPCODESX86 const enmOpcode = (enum OPCODESX86)paOneByteMap[bCode].uOpcode; 2340 2340 … … 2346 2346 { 2347 2347 /* Last prefix byte (for SSE2 extension tables); don't include the REX prefix */ 2348 pDis-> arch.x86.bLastPrefix = (uint8_t)enmOpcode;2349 pDis-> arch.x86.fPrefix &= ~DISPREFIX_REX;2348 pDis->x86.bLastPrefix = (uint8_t)enmOpcode; 2349 pDis->x86.fPrefix &= ~DISPREFIX_REX; 2350 2350 } 2351 2351 … … 2359 2359 // segment override prefix byte 2360 2360 case OP_SEG: 2361 pDis-> arch.x86.idxSegPrefix = (uint8_t)(paOneByteMap[bCode].fParam1 - OP_PARM_REG_SEG_START);2361 pDis->x86.idxSegPrefix = (uint8_t)(paOneByteMap[bCode].fParam1 - OP_PARM_REG_SEG_START); 2362 2362 #if 0 /* Try be accurate in our reporting, shouldn't break anything... :-) */ 2363 2363 /* Segment prefixes for CS, DS, ES and SS are ignored in long mode. */ 2364 2364 if ( pDis->uCpuMode != DISCPUMODE_64BIT 2365 2365 || pDis->idxSegPrefix >= DISSELREG_FS) 2366 pDis-> arch.x86.fPrefix |= DISPREFIX_SEG;2366 pDis->x86.fPrefix |= DISPREFIX_SEG; 2367 2367 #else 2368 pDis-> arch.x86.fPrefix |= DISPREFIX_SEG;2368 pDis->x86.fPrefix |= DISPREFIX_SEG; 2369 2369 #endif 2370 2370 continue; //fetch the next byte … … 2372 2372 // lock prefix byte 2373 2373 case OP_LOCK: 2374 pDis-> arch.x86.fPrefix |= DISPREFIX_LOCK;2374 pDis->x86.fPrefix |= DISPREFIX_LOCK; 2375 2375 continue; //fetch the next byte 2376 2376 2377 2377 // address size override prefix byte 2378 2378 case OP_ADDRSIZE: 2379 pDis-> arch.x86.fPrefix |= DISPREFIX_ADDRSIZE;2379 pDis->x86.fPrefix |= DISPREFIX_ADDRSIZE; 2380 2380 if (pDis->uCpuMode == DISCPUMODE_16BIT) 2381 pDis-> arch.x86.uAddrMode = DISCPUMODE_32BIT;2381 pDis->x86.uAddrMode = DISCPUMODE_32BIT; 2382 2382 else 2383 2383 if (pDis->uCpuMode == DISCPUMODE_32BIT) 2384 pDis-> arch.x86.uAddrMode = DISCPUMODE_16BIT;2384 pDis->x86.uAddrMode = DISCPUMODE_16BIT; 2385 2385 else 2386 pDis-> arch.x86.uAddrMode = DISCPUMODE_32BIT; /* 64 bits */2386 pDis->x86.uAddrMode = DISCPUMODE_32BIT; /* 64 bits */ 2387 2387 continue; //fetch the next byte 2388 2388 2389 2389 // operand size override prefix byte 2390 2390 case OP_OPSIZE: 2391 pDis-> arch.x86.fPrefix |= DISPREFIX_OPSIZE;2391 pDis->x86.fPrefix |= DISPREFIX_OPSIZE; 2392 2392 if (pDis->uCpuMode == DISCPUMODE_16BIT) 2393 pDis-> arch.x86.uOpMode = DISCPUMODE_32BIT;2393 pDis->x86.uOpMode = DISCPUMODE_32BIT; 2394 2394 else 2395 pDis-> arch.x86.uOpMode = DISCPUMODE_16BIT; /* for 32 and 64 bits mode (there is no 32 bits operand size override prefix) */2395 pDis->x86.uOpMode = DISCPUMODE_16BIT; /* for 32 and 64 bits mode (there is no 32 bits operand size override prefix) */ 2396 2396 continue; //fetch the next byte 2397 2397 2398 2398 // rep and repne are not really prefixes, but we'll treat them as such 2399 2399 case OP_REPE: 2400 pDis-> arch.x86.fPrefix |= DISPREFIX_REP;2400 pDis->x86.fPrefix |= DISPREFIX_REP; 2401 2401 continue; //fetch the next byte 2402 2402 2403 2403 case OP_REPNE: 2404 pDis-> arch.x86.fPrefix |= DISPREFIX_REPNE;2404 pDis->x86.fPrefix |= DISPREFIX_REPNE; 2405 2405 continue; //fetch the next byte 2406 2406 … … 2408 2408 Assert(pDis->uCpuMode == DISCPUMODE_64BIT); 2409 2409 /* REX prefix byte */ 2410 pDis-> arch.x86.fPrefix |= DISPREFIX_REX;2411 pDis-> arch.x86.fRexPrefix = (uint8_t)DISPREFIX_REX_OP_2_FLAGS(paOneByteMap[bCode].fParam1);2412 if (pDis-> arch.x86.fRexPrefix & DISPREFIX_REX_FLAGS_W)2413 pDis-> arch.x86.uOpMode = DISCPUMODE_64BIT; /* overrides size prefix byte */2410 pDis->x86.fPrefix |= DISPREFIX_REX; 2411 pDis->x86.fRexPrefix = (uint8_t)DISPREFIX_REX_OP_2_FLAGS(paOneByteMap[bCode].fParam1); 2412 if (pDis->x86.fRexPrefix & DISPREFIX_REX_FLAGS_W) 2413 pDis->x86.uOpMode = DISCPUMODE_64BIT; /* overrides size prefix byte */ 2414 2414 continue; //fetch the next byte 2415 2415 default: … … 2428 2428 2429 2429 /* first opcode byte. */ 2430 pDis-> arch.x86.bOpCode = bCode;2431 pDis-> arch.x86.cbPrefix = (uint8_t)offInstr - 1;2430 pDis->x86.bOpCode = bCode; 2431 pDis->x86.cbPrefix = (uint8_t)offInstr - 1; 2432 2432 2433 2433 offInstr = disParseInstruction(offInstr, &paOneByteMap[bCode], pDis); … … 2439 2439 *pcbInstr = (uint32_t)offInstr; 2440 2440 2441 if (pDis-> arch.x86.fPrefix & DISPREFIX_LOCK)2441 if (pDis->x86.fPrefix & DISPREFIX_LOCK) 2442 2442 disValidateLockSequence(pDis); 2443 2443 … … 2460 2460 { 2461 2461 #ifdef VBOX_STRICT /* poison */ 2462 pDis->Param1. arch.x86.Base.idxGenReg = 0xc1;2463 pDis->Param2. arch.x86.Base.idxGenReg = 0xc2;2464 pDis->Param3. arch.x86.Base.idxGenReg = 0xc3;2465 pDis->Param1. arch.x86.Index.idxGenReg = 0xc4;2466 pDis->Param2. arch.x86.Index.idxGenReg = 0xc5;2467 pDis->Param3. arch.x86.Index.idxGenReg = 0xc6;2468 pDis->Param1. arch.x86.uDisp.u64 = UINT64_C(0xd1d1d1d1d1d1d1d1);2469 pDis->Param2. arch.x86.uDisp.u64 = UINT64_C(0xd2d2d2d2d2d2d2d2);2470 pDis->Param3. arch.x86.uDisp.u64 = UINT64_C(0xd3d3d3d3d3d3d3d3);2462 pDis->Param1.x86.Base.idxGenReg = 0xc1; 2463 pDis->Param2.x86.Base.idxGenReg = 0xc2; 2464 pDis->Param3.x86.Base.idxGenReg = 0xc3; 2465 pDis->Param1.x86.Index.idxGenReg = 0xc4; 2466 pDis->Param2.x86.Index.idxGenReg = 0xc5; 2467 pDis->Param3.x86.Index.idxGenReg = 0xc6; 2468 pDis->Param1.x86.uDisp.u64 = UINT64_C(0xd1d1d1d1d1d1d1d1); 2469 pDis->Param2.x86.uDisp.u64 = UINT64_C(0xd2d2d2d2d2d2d2d2); 2470 pDis->Param3.x86.uDisp.u64 = UINT64_C(0xd3d3d3d3d3d3d3d3); 2471 2471 pDis->Param1.uValue = UINT64_C(0xb1b1b1b1b1b1b1b1); 2472 2472 pDis->Param2.uValue = UINT64_C(0xb2b2b2b2b2b2b2b2); 2473 2473 pDis->Param3.uValue = UINT64_C(0xb3b3b3b3b3b3b3b3); 2474 pDis->Param1. arch.x86.uScale = 28;2475 pDis->Param2. arch.x86.uScale = 29;2476 pDis->Param3. arch.x86.uScale = 30;2474 pDis->Param1.x86.uScale = 28; 2475 pDis->Param2.x86.uScale = 29; 2476 pDis->Param3.x86.uScale = 30; 2477 2477 #endif 2478 2478 2479 pDis-> arch.x86.fPrefix = DISPREFIX_NONE;2480 pDis-> arch.x86.idxSegPrefix = DISSELREG_DS;2481 pDis-> arch.x86.pfnDisasmFnTable = g_apfnFullDisasm;2482 pDis-> arch.x86.fFilter = fFilter;2479 pDis->x86.fPrefix = DISPREFIX_NONE; 2480 pDis->x86.idxSegPrefix = DISSELREG_DS; 2481 pDis->x86.pfnDisasmFnTable = g_apfnFullDisasm; 2482 pDis->x86.fFilter = fFilter; 2483 2483 2484 2484 PCDISOPCODE paOneByteMap; 2485 2485 if (enmCpuMode == DISCPUMODE_64BIT) 2486 2486 { 2487 pDis-> arch.x86.uAddrMode = DISCPUMODE_64BIT;2488 pDis-> arch.x86.uOpMode = DISCPUMODE_32BIT;2487 pDis->x86.uAddrMode = DISCPUMODE_64BIT; 2488 pDis->x86.uOpMode = DISCPUMODE_32BIT; 2489 2489 paOneByteMap = g_aOneByteMapX64; 2490 2490 } 2491 2491 else 2492 2492 { 2493 pDis-> arch.x86.uAddrMode = (uint8_t)enmCpuMode;2494 pDis-> arch.x86.uOpMode = (uint8_t)enmCpuMode;2493 pDis->x86.uAddrMode = (uint8_t)enmCpuMode; 2494 pDis->x86.uOpMode = (uint8_t)enmCpuMode; 2495 2495 paOneByteMap = g_aOneByteMapX86; 2496 2496 } -
trunk/src/VBox/Disassembler/DisasmFormatArmV8.cpp
r99321 r101539 74 74 case DISUSE_REG_GEN32: 75 75 { 76 Assert(pParam->ar ch.armv8.Reg.idxGenReg < RT_ELEMENTS(g_aszArmV8RegGen32));77 const char *psz = g_aszArmV8RegGen32[pParam->ar ch.armv8.Reg.idxGenReg];76 Assert(pParam->armv8.Reg.idxGenReg < RT_ELEMENTS(g_aszArmV8RegGen32)); 77 const char *psz = g_aszArmV8RegGen32[pParam->armv8.Reg.idxGenReg]; 78 78 *pcchReg = 2 + !!psz[2]; 79 79 return psz; … … 82 82 case DISUSE_REG_GEN64: 83 83 { 84 Assert(pParam->ar ch.armv8.Reg.idxGenReg < RT_ELEMENTS(g_aszArmV8RegGen64));85 const char *psz = g_aszArmV8RegGen64[pParam->ar ch.armv8.Reg.idxGenReg];84 Assert(pParam->armv8.Reg.idxGenReg < RT_ELEMENTS(g_aszArmV8RegGen64)); 85 const char *psz = g_aszArmV8RegGen64[pParam->armv8.Reg.idxGenReg]; 86 86 *pcchReg = 2 + !!psz[2]; 87 87 return psz; -
trunk/src/VBox/Disassembler/DisasmFormatBytes.cpp
r99220 r101539 79 79 { 80 80 if (i != 0 && (fFlags & DIS_FMT_FLAGS_BYTES_SPACED)) 81 PUT_NUM(3, " %02x", pDis-> u.abInstr[i]);81 PUT_NUM(3, " %02x", pDis->Instr.ab[i]); 82 82 else 83 PUT_NUM(2, "%02x", pDis-> u.abInstr[i]);83 PUT_NUM(2, "%02x", pDis->Instr.ab[i]); 84 84 } 85 85 -
trunk/src/VBox/Disassembler/DisasmFormatYasm.cpp
r101426 r101539 119 119 case DISUSE_REG_GEN8: 120 120 { 121 Assert(pParam-> arch.x86.Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen8));122 const char *psz = g_aszYasmRegGen8[pParam-> arch.x86.Base.idxGenReg];121 Assert(pParam->x86.Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen8)); 122 const char *psz = g_aszYasmRegGen8[pParam->x86.Base.idxGenReg]; 123 123 *pcchReg = 2 + !!psz[2] + !!psz[3]; 124 124 return psz; … … 127 127 case DISUSE_REG_GEN16: 128 128 { 129 Assert(pParam-> arch.x86.Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen16));130 const char *psz = g_aszYasmRegGen16[pParam-> arch.x86.Base.idxGenReg];129 Assert(pParam->x86.Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen16)); 130 const char *psz = g_aszYasmRegGen16[pParam->x86.Base.idxGenReg]; 131 131 *pcchReg = 2 + !!psz[2] + !!psz[3]; 132 132 return psz; … … 138 138 case DISUSE_REG_GEN32: 139 139 { 140 Assert(pParam-> arch.x86.Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen32));141 const char *psz = g_aszYasmRegGen32[pParam-> arch.x86.Base.idxGenReg];140 Assert(pParam->x86.Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen32)); 141 const char *psz = g_aszYasmRegGen32[pParam->x86.Base.idxGenReg]; 142 142 *pcchReg = 2 + !!psz[2] + !!psz[3]; 143 143 return psz; … … 149 149 case DISUSE_REG_GEN64: 150 150 { 151 Assert(pParam-> arch.x86.Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen64));152 const char *psz = g_aszYasmRegGen64[pParam-> arch.x86.Base.idxGenReg];151 Assert(pParam->x86.Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen64)); 152 const char *psz = g_aszYasmRegGen64[pParam->x86.Base.idxGenReg]; 153 153 *pcchReg = 2 + !!psz[2] + !!psz[3]; 154 154 return psz; … … 157 157 case DISUSE_REG_FP: 158 158 { 159 Assert(pParam-> arch.x86.Base.idxFpuReg < RT_ELEMENTS(g_aszYasmRegFP));160 const char *psz = g_aszYasmRegFP[pParam-> arch.x86.Base.idxFpuReg];159 Assert(pParam->x86.Base.idxFpuReg < RT_ELEMENTS(g_aszYasmRegFP)); 160 const char *psz = g_aszYasmRegFP[pParam->x86.Base.idxFpuReg]; 161 161 *pcchReg = 3; 162 162 return psz; … … 165 165 case DISUSE_REG_MMX: 166 166 { 167 Assert(pParam-> arch.x86.Base.idxMmxReg < RT_ELEMENTS(g_aszYasmRegMMX));168 const char *psz = g_aszYasmRegMMX[pParam-> arch.x86.Base.idxMmxReg];167 Assert(pParam->x86.Base.idxMmxReg < RT_ELEMENTS(g_aszYasmRegMMX)); 168 const char *psz = g_aszYasmRegMMX[pParam->x86.Base.idxMmxReg]; 169 169 *pcchReg = 3; 170 170 return psz; … … 173 173 case DISUSE_REG_XMM: 174 174 { 175 Assert(pParam-> arch.x86.Base.idxXmmReg < RT_ELEMENTS(g_aszYasmRegXMM));176 const char *psz = g_aszYasmRegXMM[pParam-> arch.x86.Base.idxXmmReg];175 Assert(pParam->x86.Base.idxXmmReg < RT_ELEMENTS(g_aszYasmRegXMM)); 176 const char *psz = g_aszYasmRegXMM[pParam->x86.Base.idxXmmReg]; 177 177 *pcchReg = 4 + !!psz[4]; 178 178 return psz; … … 181 181 case DISUSE_REG_YMM: 182 182 { 183 Assert(pParam-> arch.x86.Base.idxYmmReg < RT_ELEMENTS(g_aszYasmRegYMM));184 const char *psz = g_aszYasmRegYMM[pParam-> arch.x86.Base.idxYmmReg];183 Assert(pParam->x86.Base.idxYmmReg < RT_ELEMENTS(g_aszYasmRegYMM)); 184 const char *psz = g_aszYasmRegYMM[pParam->x86.Base.idxYmmReg]; 185 185 *pcchReg = 4 + !!psz[4]; 186 186 return psz; … … 189 189 case DISUSE_REG_CR: 190 190 { 191 Assert(pParam-> arch.x86.Base.idxCtrlReg < RT_ELEMENTS(g_aszYasmRegCRx));192 const char *psz = g_aszYasmRegCRx[pParam-> arch.x86.Base.idxCtrlReg];191 Assert(pParam->x86.Base.idxCtrlReg < RT_ELEMENTS(g_aszYasmRegCRx)); 192 const char *psz = g_aszYasmRegCRx[pParam->x86.Base.idxCtrlReg]; 193 193 *pcchReg = 3; 194 194 return psz; … … 197 197 case DISUSE_REG_DBG: 198 198 { 199 Assert(pParam-> arch.x86.Base.idxDbgReg < RT_ELEMENTS(g_aszYasmRegDRx));200 const char *psz = g_aszYasmRegDRx[pParam-> arch.x86.Base.idxDbgReg];199 Assert(pParam->x86.Base.idxDbgReg < RT_ELEMENTS(g_aszYasmRegDRx)); 200 const char *psz = g_aszYasmRegDRx[pParam->x86.Base.idxDbgReg]; 201 201 *pcchReg = 3; 202 202 return psz; … … 205 205 case DISUSE_REG_SEG: 206 206 { 207 Assert(pParam-> arch.x86.Base.idxSegReg < RT_ELEMENTS(g_aszYasmRegCRx));208 const char *psz = g_aszYasmRegSeg[pParam-> arch.x86.Base.idxSegReg];207 Assert(pParam->x86.Base.idxSegReg < RT_ELEMENTS(g_aszYasmRegCRx)); 208 const char *psz = g_aszYasmRegSeg[pParam->x86.Base.idxSegReg]; 209 209 *pcchReg = 2; 210 210 return psz; … … 213 213 case DISUSE_REG_TEST: 214 214 { 215 Assert(pParam-> arch.x86.Base.idxTestReg < RT_ELEMENTS(g_aszYasmRegTRx));216 const char *psz = g_aszYasmRegTRx[pParam-> arch.x86.Base.idxTestReg];215 Assert(pParam->x86.Base.idxTestReg < RT_ELEMENTS(g_aszYasmRegTRx)); 216 const char *psz = g_aszYasmRegTRx[pParam->x86.Base.idxTestReg]; 217 217 *pcchReg = 3; 218 218 return psz; … … 239 239 if (pParam->fUse & DISUSE_REG_XMM) 240 240 { 241 Assert(pParam-> arch.x86.Index.idxXmmReg < RT_ELEMENTS(g_aszYasmRegXMM));242 const char *psz = g_aszYasmRegXMM[pParam-> arch.x86.Index.idxXmmReg];241 Assert(pParam->x86.Index.idxXmmReg < RT_ELEMENTS(g_aszYasmRegXMM)); 242 const char *psz = g_aszYasmRegXMM[pParam->x86.Index.idxXmmReg]; 243 243 *pcchReg = 4 + !!psz[4]; 244 244 return psz; … … 246 246 else if (pParam->fUse & DISUSE_REG_YMM) 247 247 { 248 Assert(pParam-> arch.x86.Index.idxYmmReg < RT_ELEMENTS(g_aszYasmRegYMM));249 const char *psz = g_aszYasmRegYMM[pParam-> arch.x86.Index.idxYmmReg];248 Assert(pParam->x86.Index.idxYmmReg < RT_ELEMENTS(g_aszYasmRegYMM)); 249 const char *psz = g_aszYasmRegYMM[pParam->x86.Index.idxYmmReg]; 250 250 *pcchReg = 4 + !!psz[4]; 251 251 return psz; … … 253 253 } 254 254 else 255 switch (pDis-> arch.x86.uAddrMode)255 switch (pDis->x86.uAddrMode) 256 256 { 257 257 case DISCPUMODE_16BIT: 258 258 { 259 Assert(pParam-> arch.x86.Index.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen16));260 const char *psz = g_aszYasmRegGen16[pParam-> arch.x86.Index.idxGenReg];259 Assert(pParam->x86.Index.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen16)); 260 const char *psz = g_aszYasmRegGen16[pParam->x86.Index.idxGenReg]; 261 261 *pcchReg = 2 + !!psz[2] + !!psz[3]; 262 262 return psz; … … 265 265 case DISCPUMODE_32BIT: 266 266 { 267 Assert(pParam-> arch.x86.Index.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen32));268 const char *psz = g_aszYasmRegGen32[pParam-> arch.x86.Index.idxGenReg];267 Assert(pParam->x86.Index.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen32)); 268 const char *psz = g_aszYasmRegGen32[pParam->x86.Index.idxGenReg]; 269 269 *pcchReg = 2 + !!psz[2] + !!psz[3]; 270 270 return psz; … … 273 273 case DISCPUMODE_64BIT: 274 274 { 275 Assert(pParam-> arch.x86.Index.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen64));276 const char *psz = g_aszYasmRegGen64[pParam-> arch.x86.Index.idxGenReg];275 Assert(pParam->x86.Index.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen64)); 276 const char *psz = g_aszYasmRegGen64[pParam->x86.Index.idxGenReg]; 277 277 *pcchReg = 2 + !!psz[2] + !!psz[3]; 278 278 return psz; … … 280 280 281 281 default: 282 AssertMsgFailed(("%#x %#x\n", pParam->fUse, pDis-> arch.x86.uAddrMode));282 AssertMsgFailed(("%#x %#x\n", pParam->fUse, pDis->x86.uAddrMode)); 283 283 *pcchReg = 3; 284 284 return "r??"; … … 472 472 if ( pOp->uOpcode == OP_INVALID 473 473 || ( pOp->uOpcode == OP_ILLUD2 474 && (pDis-> arch.x86.fPrefix & DISPREFIX_LOCK)))474 && (pDis->x86.fPrefix & DISPREFIX_LOCK))) 475 475 PUT_SZ("Illegal opcode"); 476 476 else … … 479 479 * Prefixes 480 480 */ 481 if (pDis-> arch.x86.fPrefix & DISPREFIX_LOCK)481 if (pDis->x86.fPrefix & DISPREFIX_LOCK) 482 482 PUT_SZ("lock "); 483 if (pDis-> arch.x86.fPrefix & DISPREFIX_REP)483 if (pDis->x86.fPrefix & DISPREFIX_REP) 484 484 PUT_SZ("rep "); 485 else if(pDis-> arch.x86.fPrefix & DISPREFIX_REPNE)485 else if(pDis->x86.fPrefix & DISPREFIX_REPNE) 486 486 PUT_SZ("repne "); 487 487 … … 497 497 { 498 498 case OP_JECXZ: 499 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "jcxz %Jb" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "jecxz %Jb" : "jrcxz %Jb";499 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "jcxz %Jb" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "jecxz %Jb" : "jrcxz %Jb"; 500 500 break; 501 501 case OP_PUSHF: 502 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "pushfw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "pushfd" : "pushfq";502 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "pushfw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "pushfd" : "pushfq"; 503 503 break; 504 504 case OP_POPF: 505 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "popfw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "popfd" : "popfq";505 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "popfw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "popfd" : "popfq"; 506 506 break; 507 507 case OP_PUSHA: 508 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "pushaw" : "pushad";508 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "pushaw" : "pushad"; 509 509 break; 510 510 case OP_POPA: 511 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "popaw" : "popad";511 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "popaw" : "popad"; 512 512 break; 513 513 case OP_INSB: … … 516 516 break; 517 517 case OP_INSWD: 518 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "insw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "insd" : "insq";518 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "insw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "insd" : "insq"; 519 519 fMayNeedAddrSize = true; 520 520 break; … … 524 524 break; 525 525 case OP_OUTSWD: 526 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "outsw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "outsd" : "outsq";526 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "outsw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "outsd" : "outsq"; 527 527 fMayNeedAddrSize = true; 528 528 break; … … 532 532 break; 533 533 case OP_MOVSWD: 534 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "movsw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "movsd" : "movsq";534 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "movsw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "movsd" : "movsq"; 535 535 fMayNeedAddrSize = true; 536 536 break; … … 540 540 break; 541 541 case OP_CMPWD: 542 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "cmpsw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "cmpsd" : "cmpsq";542 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "cmpsw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "cmpsd" : "cmpsq"; 543 543 fMayNeedAddrSize = true; 544 544 break; … … 548 548 break; 549 549 case OP_SCASWD: 550 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "scasw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "scasd" : "scasq";550 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "scasw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "scasd" : "scasq"; 551 551 fMayNeedAddrSize = true; 552 552 break; … … 556 556 break; 557 557 case OP_LODSWD: 558 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "lodsw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "lodsd" : "lodsq";558 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "lodsw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "lodsd" : "lodsq"; 559 559 fMayNeedAddrSize = true; 560 560 break; … … 564 564 break; 565 565 case OP_STOSWD: 566 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "stosw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "stosd" : "stosq";566 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "stosw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "stosd" : "stosq"; 567 567 fMayNeedAddrSize = true; 568 568 break; 569 569 case OP_CBW: 570 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "cbw" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "cwde" : "cdqe";570 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "cbw" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "cwde" : "cdqe"; 571 571 break; 572 572 case OP_CWD: 573 pszFmt = pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? "cwd" : pDis->arch.x86.uOpMode == DISCPUMODE_32BIT ? "cdq" : "cqo";573 pszFmt = pDis->x86.uOpMode == DISCPUMODE_16BIT ? "cwd" : pDis->x86.uOpMode == DISCPUMODE_32BIT ? "cdq" : "cqo"; 574 574 break; 575 575 case OP_SHL: … … 588 588 */ 589 589 case OP_NOP: 590 if (pDis-> arch.x86.bOpCode == 0x90)590 if (pDis->x86.bOpCode == 0x90) 591 591 /* fine, fine */; 592 592 else if (pszFmt[sizeof("nop %Ev") - 1] == '/' && pszFmt[sizeof("nop %Ev")] == 'p') 593 593 pszFmt = "prefetch %Eb"; 594 else if (pDis-> arch.x86.bOpCode == 0x1f)594 else if (pDis->x86.bOpCode == 0x1f) 595 595 { 596 596 Assert(pDis->cbInstr >= 3); 597 597 PUT_SZ("db 00fh, 01fh,"); 598 PUT_NUM_8(MAKE_MODRM(pDis-> arch.x86.ModRM.Bits.Mod, pDis->arch.x86.ModRM.Bits.Reg, pDis->arch.x86.ModRM.Bits.Rm));598 PUT_NUM_8(MAKE_MODRM(pDis->x86.ModRM.Bits.Mod, pDis->x86.ModRM.Bits.Reg, pDis->x86.ModRM.Bits.Rm)); 599 599 for (unsigned i = 3; i < pDis->cbInstr; i++) 600 600 { … … 638 638 char *pszFmtDst = szTmpFmt; 639 639 if (pszSpace == NULL) pszSpace = strchr(pszDelim, 0); 640 if ( (*pszFmt == '#' && !pDis-> arch.x86.bVexWFlag) /** @todo check this*/641 || (*pszFmt == '@' && !VEXREG_IS256B(pDis-> arch.x86.bVexDestReg))640 if ( (*pszFmt == '#' && !pDis->x86.bVexWFlag) /** @todo check this*/ 641 || (*pszFmt == '@' && !VEXREG_IS256B(pDis->x86.bVexDestReg)) 642 642 || (*pszFmt == '&' && ( DISUSE_IS_EFFECTIVE_ADDR(pDis->Param1.fUse) 643 643 || DISUSE_IS_EFFECTIVE_ADDR(pDis->Param2.fUse) … … 663 663 */ 664 664 case OP_FLD: 665 if (pDis-> arch.x86.bOpCode == 0xdb) /* m80fp workaround. */666 *(int *)&pDis->Param1. arch.x86.fParam &= ~0x1f; /* make it pure OP_PARM_M */665 if (pDis->x86.bOpCode == 0xdb) /* m80fp workaround. */ 666 *(int *)&pDis->Param1.x86.fParam &= ~0x1f; /* make it pure OP_PARM_M */ 667 667 break; 668 668 case OP_LAR: /* hack w -> v, probably not correct. */ 669 *(int *)&pDis->Param2. arch.x86.fParam &= ~0x1f;670 *(int *)&pDis->Param2. arch.x86.fParam |= OP_PARM_v;669 *(int *)&pDis->Param2.x86.fParam &= ~0x1f; 670 *(int *)&pDis->Param2.x86.fParam |= OP_PARM_v; 671 671 break; 672 672 } … … 675 675 * Add operand size and address prefixes for outsb, movsb, etc. 676 676 */ 677 if (pDis-> arch.x86.fPrefix & (DISPREFIX_OPSIZE | DISPREFIX_ADDRSIZE))678 { 679 if (fIgnoresOpSize && (pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE) )677 if (pDis->x86.fPrefix & (DISPREFIX_OPSIZE | DISPREFIX_ADDRSIZE)) 678 { 679 if (fIgnoresOpSize && (pDis->x86.fPrefix & DISPREFIX_OPSIZE) ) 680 680 { 681 681 if (pDis->uCpuMode == DISCPUMODE_16BIT) … … 684 684 PUT_SZ("o16 "); 685 685 } 686 if (fMayNeedAddrSize && (pDis-> arch.x86.fPrefix & DISPREFIX_ADDRSIZE) )686 if (fMayNeedAddrSize && (pDis->x86.fPrefix & DISPREFIX_ADDRSIZE) ) 687 687 { 688 688 if (pDis->uCpuMode == DISCPUMODE_16BIT) … … 701 701 #define PUT_FAR() \ 702 702 do { \ 703 if ( OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_p \703 if ( OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_p \ 704 704 && pOp->uOpcode != OP_LDS /* table bugs? */ \ 705 705 && pOp->uOpcode != OP_LES \ … … 713 713 #define PUT_SIZE_OVERRIDE() \ 714 714 do { \ 715 switch (OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam)) \715 switch (OP_PARM_VSUBTYPE(pParam->x86.fParam)) \ 716 716 { \ 717 717 case OP_PARM_v: \ 718 718 case OP_PARM_y: \ 719 switch (pDis-> arch.x86.uOpMode) \719 switch (pDis->x86.uOpMode) \ 720 720 { \ 721 case DISCPUMODE_16BIT: if (OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) != OP_PARM_y) PUT_SZ("word "); break; \721 case DISCPUMODE_16BIT: if (OP_PARM_VSUBTYPE(pParam->x86.fParam) != OP_PARM_y) PUT_SZ("word "); break; \ 722 722 case DISCPUMODE_32BIT: \ 723 if (pDis->pCurInstr->uOpcode != OP_GATHER || pDis-> arch.x86.bVexWFlag) { PUT_SZ("dword "); break; } \723 if (pDis->pCurInstr->uOpcode != OP_GATHER || pDis->x86.bVexWFlag) { PUT_SZ("dword "); break; } \ 724 724 RT_FALL_THRU(); \ 725 725 case DISCPUMODE_64BIT: PUT_SZ("qword "); break; \ … … 729 729 case OP_PARM_b: PUT_SZ("byte "); break; \ 730 730 case OP_PARM_w: \ 731 if ( OP_PARM_VTYPE(pParam-> arch.x86.fParam) == OP_PARM_W \732 || OP_PARM_VTYPE(pParam-> arch.x86.fParam) == OP_PARM_M) \731 if ( OP_PARM_VTYPE(pParam->x86.fParam) == OP_PARM_W \ 732 || OP_PARM_VTYPE(pParam->x86.fParam) == OP_PARM_M) \ 733 733 { \ 734 if (VEXREG_IS256B(pDis-> arch.x86.bVexDestReg)) PUT_SZ("dword "); \734 if (VEXREG_IS256B(pDis->x86.bVexDestReg)) PUT_SZ("dword "); \ 735 735 else PUT_SZ("word "); \ 736 736 } \ 737 737 break; \ 738 738 case OP_PARM_d: \ 739 if ( OP_PARM_VTYPE(pParam-> arch.x86.fParam) == OP_PARM_W \740 || OP_PARM_VTYPE(pParam-> arch.x86.fParam) == OP_PARM_M) \739 if ( OP_PARM_VTYPE(pParam->x86.fParam) == OP_PARM_W \ 740 || OP_PARM_VTYPE(pParam->x86.fParam) == OP_PARM_M) \ 741 741 { \ 742 if (VEXREG_IS256B(pDis-> arch.x86.bVexDestReg)) PUT_SZ("qword "); \742 if (VEXREG_IS256B(pDis->x86.bVexDestReg)) PUT_SZ("qword "); \ 743 743 else PUT_SZ("dword "); \ 744 744 } \ 745 745 break; \ 746 746 case OP_PARM_q: \ 747 if ( OP_PARM_VTYPE(pParam-> arch.x86.fParam) == OP_PARM_W \748 || OP_PARM_VTYPE(pParam-> arch.x86.fParam) == OP_PARM_M) \747 if ( OP_PARM_VTYPE(pParam->x86.fParam) == OP_PARM_W \ 748 || OP_PARM_VTYPE(pParam->x86.fParam) == OP_PARM_M) \ 749 749 { \ 750 if (VEXREG_IS256B(pDis-> arch.x86.bVexDestReg)) PUT_SZ("oword "); \750 if (VEXREG_IS256B(pDis->x86.bVexDestReg)) PUT_SZ("oword "); \ 751 751 else PUT_SZ("qword "); \ 752 752 } \ … … 754 754 case OP_PARM_ps: \ 755 755 case OP_PARM_pd: \ 756 case OP_PARM_x: if (VEXREG_IS256B(pDis-> arch.x86.bVexDestReg)) { PUT_SZ("yword "); break; } RT_FALL_THRU(); \756 case OP_PARM_x: if (VEXREG_IS256B(pDis->x86.bVexDestReg)) { PUT_SZ("yword "); break; } RT_FALL_THRU(); \ 757 757 case OP_PARM_ss: \ 758 758 case OP_PARM_sd: \ … … 763 763 case OP_PARM_z: break; \ 764 764 case OP_PARM_NONE: \ 765 if ( OP_PARM_VTYPE(pParam-> arch.x86.fParam) == OP_PARM_M \765 if ( OP_PARM_VTYPE(pParam->x86.fParam) == OP_PARM_M \ 766 766 && ((pParam->fUse & DISUSE_REG_FP) || pOp->uOpcode == OP_FLD)) \ 767 767 PUT_SZ("tword "); \ … … 773 773 #define PUT_SEGMENT_OVERRIDE() \ 774 774 do { \ 775 if (pDis-> arch.x86.fPrefix & DISPREFIX_SEG) \776 PUT_STR(s_szSegPrefix[pDis-> arch.x86.idxSegPrefix], 3); \775 if (pDis->x86.fPrefix & DISPREFIX_SEG) \ 776 PUT_STR(s_szSegPrefix[pDis->x86.idxSegPrefix], 3); \ 777 777 } while (0) 778 778 … … 781 781 * Segment prefixing for instructions that doesn't do memory access. 782 782 */ 783 if ( (pDis-> arch.x86.fPrefix & DISPREFIX_SEG)783 if ( (pDis->x86.fPrefix & DISPREFIX_SEG) 784 784 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->Param1.fUse) 785 785 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->Param2.fUse) 786 786 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->Param3.fUse)) 787 787 { 788 PUT_STR(s_szSegPrefix[pDis-> arch.x86.idxSegPrefix], 2);788 PUT_STR(s_szSegPrefix[pDis->x86.idxSegPrefix], 2); 789 789 PUT_C(' '); 790 790 } … … 846 846 /* Work around mov seg,[mem16] and mov [mem16],seg as these always make a 16-bit mem 847 847 while the register variants deals with 16, 32 & 64 in the normal fashion. */ 848 if ( pParam-> arch.x86.fParam != OP_PARM_Ev848 if ( pParam->x86.fParam != OP_PARM_Ev 849 849 || pOp->uOpcode != OP_MOV 850 850 || ( pOp->fParam1 != OP_PARM_Sw … … 857 857 { 858 858 if ( (fUse & DISUSE_DISPLACEMENT8) 859 && !pParam-> arch.x86.uDisp.i8)859 && !pParam->x86.uDisp.i8) 860 860 PUT_SZ("byte "); 861 861 else if ( (fUse & DISUSE_DISPLACEMENT16) 862 && (int8_t)pParam-> arch.x86.uDisp.i16 == (int16_t)pParam->arch.x86.uDisp.i16)862 && (int8_t)pParam->x86.uDisp.i16 == (int16_t)pParam->x86.uDisp.i16) 863 863 PUT_SZ("word "); 864 864 else if ( (fUse & DISUSE_DISPLACEMENT32) 865 && (int16_t)pParam-> arch.x86.uDisp.i32 == (int32_t)pParam->arch.x86.uDisp.i32) //??865 && (int16_t)pParam->x86.uDisp.i32 == (int32_t)pParam->x86.uDisp.i32) //?? 866 866 PUT_SZ("dword "); 867 867 else if ( (fUse & DISUSE_DISPLACEMENT64) 868 && (pDis-> arch.x86.SIB.Bits.Base != 5 || pDis->arch.x86.ModRM.Bits.Mod != 0)869 && (int32_t)pParam-> arch.x86.uDisp.i64 == (int64_t)pParam->arch.x86.uDisp.i64) //??868 && (pDis->x86.SIB.Bits.Base != 5 || pDis->x86.ModRM.Bits.Mod != 0) 869 && (int32_t)pParam->x86.uDisp.i64 == (int64_t)pParam->x86.uDisp.i64) //?? 870 870 PUT_SZ("qword "); 871 871 } … … 906 906 { 907 907 PUT_C('*'); 908 PUT_C('0' + pParam-> arch.x86.uScale);908 PUT_C('0' + pParam->x86.uScale); 909 909 } 910 910 } … … 916 916 { 917 917 if (fUse & DISUSE_DISPLACEMENT8) 918 off2 = pParam-> arch.x86.uDisp.i8;918 off2 = pParam->x86.uDisp.i8; 919 919 else if (fUse & DISUSE_DISPLACEMENT16) 920 off2 = pParam-> arch.x86.uDisp.i16;920 off2 = pParam->x86.uDisp.i16; 921 921 else if (fUse & (DISUSE_DISPLACEMENT32 | DISUSE_RIPDISPLACEMENT32)) 922 off2 = pParam-> arch.x86.uDisp.i32;922 off2 = pParam->x86.uDisp.i32; 923 923 else if (fUse & DISUSE_DISPLACEMENT64) 924 off2 = pParam-> arch.x86.uDisp.i64;924 off2 = pParam->x86.uDisp.i64; 925 925 else 926 926 { … … 951 951 PUT_NUM_64(off2); 952 952 if (pfnGetSymbol) 953 PUT_SYMBOL((pDis-> arch.x86.fPrefix & DISPREFIX_SEG)954 ? DIS_FMT_SEL_FROM_REG(pDis-> arch.x86.idxSegPrefix)953 PUT_SYMBOL((pDis->x86.fPrefix & DISPREFIX_SEG) 954 ? DIS_FMT_SEL_FROM_REG(pDis->x86.idxSegPrefix) 955 955 : DIS_FMT_SEL_FROM_REG(DISSELREG_DS), 956 pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT956 pDis->x86.uAddrMode == DISCPUMODE_64BIT 957 957 ? (uint64_t)off2 958 : pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT958 : pDis->x86.uAddrMode == DISCPUMODE_32BIT 959 959 ? (uint32_t)off2 960 960 : (uint16_t)off2, … … 969 969 { 970 970 if (pfnGetSymbol && !fBase && !(fUse & (DISUSE_INDEX | DISUSE_RIPDISPLACEMENT32)) && off2 != 0) 971 PUT_SYMBOL((pDis-> arch.x86.fPrefix & DISPREFIX_SEG)972 ? DIS_FMT_SEL_FROM_REG(pDis-> arch.x86.idxSegPrefix)971 PUT_SYMBOL((pDis->x86.fPrefix & DISPREFIX_SEG) 972 ? DIS_FMT_SEL_FROM_REG(pDis->x86.idxSegPrefix) 973 973 : DIS_FMT_SEL_FROM_REG(DISSELREG_DS), 974 pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT974 pDis->x86.uAddrMode == DISCPUMODE_64BIT 975 975 ? (uint64_t)off2 976 : pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT976 : pDis->x86.uAddrMode == DISCPUMODE_32BIT 977 977 ? (uint32_t)off2 978 978 : (uint16_t)off2, … … 1003 1003 1004 1004 case DISUSE_IMMEDIATE16: 1005 if ( pDis->uCpuMode != pDis-> arch.x86.uOpMode1005 if ( pDis->uCpuMode != pDis->x86.uOpMode 1006 1006 || ( (fFlags & DIS_FMT_FLAGS_STRICT) 1007 1007 && ( (int8_t)pParam->uValue == (int16_t)pParam->uValue … … 1011 1011 ) 1012 1012 { 1013 if (OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_b)1013 if (OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_b) 1014 1014 PUT_SZ_STRICT("strict byte ", "byte "); 1015 else if ( OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_v1016 || OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_z)1015 else if ( OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_v 1016 || OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_z) 1017 1017 PUT_SZ_STRICT("strict word ", "word "); 1018 1018 } … … 1021 1021 1022 1022 case DISUSE_IMMEDIATE16_SX8: 1023 if ( !(pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE)1023 if ( !(pDis->x86.fPrefix & DISPREFIX_OPSIZE) 1024 1024 || pDis->pCurInstr->uOpcode != OP_PUSH) 1025 1025 PUT_SZ_STRICT("strict byte ", "byte "); … … 1030 1030 1031 1031 case DISUSE_IMMEDIATE32: 1032 if ( pDis-> arch.x86.uOpMode != (pDis->uCpuMode == DISCPUMODE_16BIT ? DISCPUMODE_16BIT : DISCPUMODE_32BIT) /* not perfect */1032 if ( pDis->x86.uOpMode != (pDis->uCpuMode == DISCPUMODE_16BIT ? DISCPUMODE_16BIT : DISCPUMODE_32BIT) /* not perfect */ 1033 1033 || ( (fFlags & DIS_FMT_FLAGS_STRICT) 1034 1034 && ( (int8_t)pParam->uValue == (int32_t)pParam->uValue … … 1038 1038 ) 1039 1039 { 1040 if (OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_b)1040 if (OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_b) 1041 1041 PUT_SZ_STRICT("strict byte ", "byte "); 1042 else if ( OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_v1043 || OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam) == OP_PARM_z)1042 else if ( OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_v 1043 || OP_PARM_VSUBTYPE(pParam->x86.fParam) == OP_PARM_z) 1044 1044 PUT_SZ_STRICT("strict dword ", "dword "); 1045 1045 } … … 1050 1050 1051 1051 case DISUSE_IMMEDIATE32_SX8: 1052 if ( !(pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE)1052 if ( !(pDis->x86.fPrefix & DISPREFIX_OPSIZE) 1053 1053 || pDis->pCurInstr->uOpcode != OP_PUSH) 1054 1054 PUT_SZ_STRICT("strict byte ", "byte "); … … 1059 1059 1060 1060 case DISUSE_IMMEDIATE64_SX8: 1061 if ( !(pDis-> arch.x86.fPrefix & DISPREFIX_OPSIZE)1061 if ( !(pDis->x86.fPrefix & DISPREFIX_OPSIZE) 1062 1062 || pDis->pCurInstr->uOpcode != OP_PUSH) 1063 1063 PUT_SZ_STRICT("strict byte ", "byte "); … … 1216 1216 break; 1217 1217 case DISUSE_DISPLACEMENT16: 1218 PUT_NUM_16(pParam-> arch.x86.uDisp.i16);1218 PUT_NUM_16(pParam->x86.uDisp.i16); 1219 1219 if (pfnGetSymbol) 1220 rc = pfnGetSymbol(pDis, DIS_FMT_SEL_FROM_REG(DISSELREG_CS), pParam-> arch.x86.uDisp.u16, szSymbol, sizeof(szSymbol), &off, pvUser);1220 rc = pfnGetSymbol(pDis, DIS_FMT_SEL_FROM_REG(DISSELREG_CS), pParam->x86.uDisp.u16, szSymbol, sizeof(szSymbol), &off, pvUser); 1221 1221 break; 1222 1222 case DISUSE_DISPLACEMENT32: 1223 PUT_NUM_32(pParam-> arch.x86.uDisp.i32);1223 PUT_NUM_32(pParam->x86.uDisp.i32); 1224 1224 if (pfnGetSymbol) 1225 rc = pfnGetSymbol(pDis, DIS_FMT_SEL_FROM_REG(DISSELREG_CS), pParam-> arch.x86.uDisp.u32, szSymbol, sizeof(szSymbol), &off, pvUser);1225 rc = pfnGetSymbol(pDis, DIS_FMT_SEL_FROM_REG(DISSELREG_CS), pParam->x86.uDisp.u32, szSymbol, sizeof(szSymbol), &off, pvUser); 1226 1226 break; 1227 1227 case DISUSE_DISPLACEMENT64: 1228 PUT_NUM_64(pParam-> arch.x86.uDisp.i64);1228 PUT_NUM_64(pParam->x86.uDisp.i64); 1229 1229 if (pfnGetSymbol) 1230 rc = pfnGetSymbol(pDis, DIS_FMT_SEL_FROM_REG(DISSELREG_CS), pParam-> arch.x86.uDisp.u64, szSymbol, sizeof(szSymbol), &off, pvUser);1230 rc = pfnGetSymbol(pDis, DIS_FMT_SEL_FROM_REG(DISSELREG_CS), pParam->x86.uDisp.u64, szSymbol, sizeof(szSymbol), &off, pvUser); 1231 1231 break; 1232 1232 default: … … 1385 1385 * Mod rm + SIB: Check for duplicate EBP encodings that yasm won't use for very good reasons. 1386 1386 */ 1387 if ( pDis-> arch.x86.uAddrMode != DISCPUMODE_16BIT /// @todo correct?1388 && pDis-> arch.x86.ModRM.Bits.Rm == 41389 && pDis-> arch.x86.ModRM.Bits.Mod != 3)1387 if ( pDis->x86.uAddrMode != DISCPUMODE_16BIT /// @todo correct? 1388 && pDis->x86.ModRM.Bits.Rm == 4 1389 && pDis->x86.ModRM.Bits.Mod != 3) 1390 1390 { 1391 1391 /* No scaled index SIB (index=4), except for ESP. */ 1392 if ( pDis-> arch.x86.SIB.Bits.Index == 41393 && pDis-> arch.x86.SIB.Bits.Base != 4)1392 if ( pDis->x86.SIB.Bits.Index == 4 1393 && pDis->x86.SIB.Bits.Base != 4) 1394 1394 return true; 1395 1395 1396 1396 /* EBP + displacement */ 1397 if ( pDis-> arch.x86.ModRM.Bits.Mod != 01398 && pDis-> arch.x86.SIB.Bits.Base == 51399 && pDis-> arch.x86.SIB.Bits.Scale == 0)1397 if ( pDis->x86.ModRM.Bits.Mod != 0 1398 && pDis->x86.SIB.Bits.Base == 5 1399 && pDis->x86.SIB.Bits.Scale == 0) 1400 1400 return true; 1401 1401 } … … 1405 1405 */ 1406 1406 if ( pDis->pCurInstr->uOpcode == OP_SHL 1407 && pDis-> arch.x86.ModRM.Bits.Reg == 6)1407 && pDis->x86.ModRM.Bits.Reg == 6) 1408 1408 return true; 1409 1409 … … 1415 1415 uint8_t offAddrSize = UINT8_MAX; 1416 1416 uint32_t fPrefixes = 0; 1417 for (uint32_t offOpcode = 0; offOpcode < RT_ELEMENTS(pDis-> u.abInstr); offOpcode++)1417 for (uint32_t offOpcode = 0; offOpcode < RT_ELEMENTS(pDis->Instr.ab); offOpcode++) 1418 1418 { 1419 1419 uint32_t f; 1420 switch (pDis-> u.abInstr[offOpcode])1420 switch (pDis->Instr.ab[offOpcode]) 1421 1421 { 1422 1422 case 0xf0: … … 1472 1472 { 1473 1473 /* no effective address which it may apply to. */ 1474 Assert((pDis-> arch.x86.fPrefix & DISPREFIX_SEG) || pDis->uCpuMode == DISCPUMODE_64BIT);1474 Assert((pDis->x86.fPrefix & DISPREFIX_SEG) || pDis->uCpuMode == DISCPUMODE_64BIT); 1475 1475 if ( !DISUSE_IS_EFFECTIVE_ADDR(pDis->Param1.fUse) 1476 1476 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->Param2.fUse) … … 1487 1487 if (fPrefixes & DISPREFIX_ADDRSIZE) 1488 1488 { 1489 Assert(pDis-> arch.x86.fPrefix & DISPREFIX_ADDRSIZE);1489 Assert(pDis->x86.fPrefix & DISPREFIX_ADDRSIZE); 1490 1490 if ( pDis->pCurInstr->fParam3 == OP_PARM_NONE 1491 1491 && pDis->pCurInstr->fParam2 == OP_PARM_NONE … … 1638 1638 * yasm: 18F5 sbb ch, dh ; SBB r/m8, r8 1639 1639 */ 1640 if (pDis-> arch.x86.ModRM.Bits.Mod == 3 /* reg,reg */)1640 if (pDis->x86.ModRM.Bits.Mod == 3 /* reg,reg */) 1641 1641 { 1642 1642 switch (pDis->pCurInstr->uOpcode) … … 1657 1657 1658 1658 /* 82 (see table A-6). */ 1659 if (pDis-> arch.x86.bOpCode == 0x82)1659 if (pDis->x86.bOpCode == 0x82) 1660 1660 return true; 1661 1661 break; … … 1668 1668 case OP_POP: 1669 1669 case OP_PUSH: 1670 Assert(pDis-> arch.x86.bOpCode == 0x8f);1670 Assert(pDis->x86.bOpCode == 0x8f); 1671 1671 return true; 1672 1672 1673 1673 case OP_MOV: 1674 if ( pDis-> arch.x86.bOpCode == 0x8a1675 || pDis-> arch.x86.bOpCode == 0x8b)1674 if ( pDis->x86.bOpCode == 0x8a 1675 || pDis->x86.bOpCode == 0x8b) 1676 1676 return true; 1677 1677 break; … … 1700 1700 1701 1701 /* And some more - see table A-6. */ 1702 if (pDis-> arch.x86.bOpCode == 0x82)1702 if (pDis->x86.bOpCode == 0x82) 1703 1703 { 1704 1704 switch (pDis->pCurInstr->uOpcode) … … 1740 1740 case OP_SETLE: 1741 1741 case OP_SETNLE: 1742 AssertMsg(pDis-> arch.x86.bOpCode >= 0x90 && pDis->arch.x86.bOpCode <= 0x9f, ("%#x\n", pDis->arch.x86.bOpCode));1743 if (pDis-> arch.x86.ModRM.Bits.Reg != 2)1742 AssertMsg(pDis->x86.bOpCode >= 0x90 && pDis->x86.bOpCode <= 0x9f, ("%#x\n", pDis->x86.bOpCode)); 1743 if (pDis->x86.ModRM.Bits.Reg != 2) 1744 1744 return true; 1745 1745 break; … … 1751 1751 */ 1752 1752 if ( pDis->pCurInstr->uOpcode == OP_MOVZX 1753 && pDis-> arch.x86.bOpCode == 0xB71753 && pDis->x86.bOpCode == 0xB7 1754 1754 && (pDis->uCpuMode == DISCPUMODE_16BIT) != !!(fPrefixes & DISPREFIX_OPSIZE)) 1755 1755 return true; … … 1758 1758 * YASM doesn't do ICEBP/INT1/INT01, unlike NASM. 1759 1759 */ 1760 if (pDis-> arch.x86.bOpCode == 0xF1)1760 if (pDis->x86.bOpCode == 0xF1) 1761 1761 return true; 1762 1762 -
trunk/src/VBox/Disassembler/DisasmInternal.h
r99241 r101539 45 45 */ 46 46 47 /** This must be less or equal to DISSTATE:: u.abInstr.47 /** This must be less or equal to DISSTATE::Instr.ab. 48 48 * See Vol3A/Table 6-2 and Vol3B/Section22.25 for instance. */ 49 49 #define DIS_MAX_INSTR_LENGTH 15 … … 103 103 if (offInstr >= pDis->cbCachedInstr) 104 104 return disReadByteSlow(pDis, offInstr); 105 return pDis-> u.abInstr[offInstr];105 return pDis->Instr.ab[offInstr]; 106 106 } 107 107 … … 121 121 122 122 #ifdef DIS_HOST_UNALIGNED_ACCESS_OK 123 return *(uint16_t const *)&pDis-> u.abInstr[offInstr];124 #else 125 return RT_MAKE_U16(pDis-> u.abInstr[offInstr], pDis->u.abInstr[offInstr + 1]);123 return *(uint16_t const *)&pDis->Instr.ab[offInstr]; 124 #else 125 return RT_MAKE_U16(pDis->Instr.ab[offInstr], pDis->Instr.ab[offInstr + 1]); 126 126 #endif 127 127 } … … 142 142 143 143 #ifdef DIS_HOST_UNALIGNED_ACCESS_OK 144 return *(uint32_t const *)&pDis-> u.abInstr[offInstr];145 #else 146 return RT_MAKE_U32_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],147 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3]);144 return *(uint32_t const *)&pDis->Instr.ab[offInstr]; 145 #else 146 return RT_MAKE_U32_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 147 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3]); 148 148 #endif 149 149 } … … 163 163 164 164 #ifdef DIS_HOST_UNALIGNED_ACCESS_OK 165 return *(uint64_t const *)&pDis-> u.abInstr[offInstr];166 #else 167 return RT_MAKE_U64_FROM_U8(pDis-> u.abInstr[offInstr ], pDis->u.abInstr[offInstr + 1],168 pDis-> u.abInstr[offInstr + 2], pDis->u.abInstr[offInstr + 3],169 pDis-> u.abInstr[offInstr + 4], pDis->u.abInstr[offInstr + 5],170 pDis-> u.abInstr[offInstr + 6], pDis->u.abInstr[offInstr + 7]);165 return *(uint64_t const *)&pDis->Instr.ab[offInstr]; 166 #else 167 return RT_MAKE_U64_FROM_U8(pDis->Instr.ab[offInstr ], pDis->Instr.ab[offInstr + 1], 168 pDis->Instr.ab[offInstr + 2], pDis->Instr.ab[offInstr + 3], 169 pDis->Instr.ab[offInstr + 4], pDis->Instr.ab[offInstr + 5], 170 pDis->Instr.ab[offInstr + 6], pDis->Instr.ab[offInstr + 7]); 171 171 #endif 172 172 } … … 189 189 * the cache here.) 190 190 */ 191 int rc = pDis->pfnReadBytes(pDis, 0, 1, sizeof(pDis-> u.abInstr));191 int rc = pDis->pfnReadBytes(pDis, 0, 1, sizeof(pDis->Instr.ab)); 192 192 if (RT_SUCCESS(rc)) 193 193 { 194 194 Assert(pDis->cbCachedInstr >= 1); 195 Assert(pDis->cbCachedInstr <= sizeof(pDis-> u.abInstr));195 Assert(pDis->cbCachedInstr <= sizeof(pDis->Instr.ab)); 196 196 } 197 197 else … … 204 204 205 205 #if defined(VBOX_DIS_WITH_X86_AMD64) 206 /* x86/amd64 */207 206 DECLHIDDEN(PCDISOPCODE) disInitializeStateX86(PDISSTATE pDis, DISCPUMODE enmCpuMode, uint32_t fFilter); 208 207 DECLHIDDEN(int) disInstrWorkerX86(PDISSTATE pDis, PCDISOPCODE paOneByteMap, uint32_t *pcbInstr); 209 208 #endif 210 209 #if defined(VBOX_DIS_WITH_ARMV8) 211 /* x86/amd64 */212 210 DECLHIDDEN(PCDISOPCODE) disInitializeStateArmV8(PDISSTATE pDis, DISCPUMODE enmCpuMode, uint32_t fFilter); 213 211 DECLHIDDEN(int) disInstrWorkerArmV8(PDISSTATE pDis, PCDISOPCODE paOneByteMap, uint32_t *pcbInstr); -
trunk/src/VBox/Disassembler/DisasmMisc.cpp
r99220 r101539 44 44 DISDECL(uint8_t) DISGetParamSize(PCDISSTATE pDis, PCDISOPPARAM pParam) 45 45 { 46 unsigned subtype = OP_PARM_VSUBTYPE(pParam-> arch.x86.fParam);46 unsigned subtype = OP_PARM_VSUBTYPE(pParam->x86.fParam); 47 47 switch (subtype) 48 48 { 49 49 case OP_PARM_v: 50 switch (pDis-> arch.x86.uOpMode)50 switch (pDis->x86.uOpMode) 51 51 { 52 52 case DISCPUMODE_32BIT: … … 87 87 88 88 case OP_PARM_p: /* far pointer */ 89 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_32BIT)89 if (pDis->x86.uAddrMode == DISCPUMODE_32BIT) 90 90 return 6; /* 16:32 */ 91 if (pDis-> arch.x86.uAddrMode == DISCPUMODE_64BIT)91 if (pDis->x86.uAddrMode == DISCPUMODE_64BIT) 92 92 return 12; /* 16:64 */ 93 93 return 4; /* 16:16 */ … … 97 97 98 98 case OP_PARM_a: 99 return pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? 2 + 2 : 4 + 4;99 return pDis->x86.uOpMode == DISCPUMODE_16BIT ? 2 + 2 : 4 + 4; 100 100 101 101 case OP_PARM_pi: … … 109 109 case OP_PARM_pd: 110 110 case OP_PARM_ps: 111 return VEXREG_IS256B(pDis-> arch.x86.bVexDestReg) ? 32 : 16; //??111 return VEXREG_IS256B(pDis->x86.bVexDestReg) ? 32 : 16; //?? 112 112 113 113 case OP_PARM_y: 114 return pDis-> arch.x86.uOpMode == DISCPUMODE_64BIT ? 4 : 8; //??114 return pDis->x86.uOpMode == DISCPUMODE_64BIT ? 4 : 8; //?? 115 115 116 116 case OP_PARM_z: 117 if (pParam-> arch.x86.cb)118 return pParam-> arch.x86.cb;119 return pDis-> arch.x86.uOpMode == DISCPUMODE_16BIT ? 2 : 4; //??117 if (pParam->x86.cb) 118 return pParam->x86.cb; 119 return pDis->x86.uOpMode == DISCPUMODE_16BIT ? 2 : 4; //?? 120 120 121 121 default: 122 if (pParam-> arch.x86.cb)123 return pParam-> arch.x86.cb;122 if (pParam->x86.cb) 123 return pParam->x86.cb; 124 124 /// @todo dangerous!!! 125 AssertMsgFailed(("subtype=%#x fParam=%#x fUse=%#RX64 op=%#x\n", subtype, pParam-> arch.x86.fParam, pParam->fUse,125 AssertMsgFailed(("subtype=%#x fParam=%#x fUse=%#RX64 op=%#x\n", subtype, pParam->x86.fParam, pParam->fUse, 126 126 pDis->pCurInstr ? pDis->pCurInstr->uOpcode : 0)); 127 127 return 4; … … 132 132 DISDECL(DISSELREG) DISDetectSegReg(PCDISSTATE pDis, PCDISOPPARAM pParam) 133 133 { 134 if (pDis-> arch.x86.fPrefix & DISPREFIX_SEG)134 if (pDis->x86.fPrefix & DISPREFIX_SEG) 135 135 /* Use specified SEG: prefix. */ 136 return (DISSELREG)pDis-> arch.x86.idxSegPrefix;136 return (DISSELREG)pDis->x86.idxSegPrefix; 137 137 138 138 /* Guess segment register by parameter type. */ … … 143 143 AssertCompile(DISGREG_ESP == DISGREG_SP); 144 144 AssertCompile(DISGREG_EBP == DISGREG_BP); 145 if (pParam-> arch.x86.Base.idxGenReg == DISGREG_ESP || pParam->arch.x86.Base.idxGenReg == DISGREG_EBP)145 if (pParam->x86.Base.idxGenReg == DISGREG_ESP || pParam->x86.Base.idxGenReg == DISGREG_EBP) 146 146 return DISSELREG_SS; 147 147 } … … 153 153 DISDECL(uint8_t) DISQuerySegPrefixByte(PCDISSTATE pDis) 154 154 { 155 Assert(pDis-> arch.x86.fPrefix & DISPREFIX_SEG);156 switch (pDis-> arch.x86.idxSegPrefix)155 Assert(pDis->x86.fPrefix & DISPREFIX_SEG); 156 switch (pDis->x86.idxSegPrefix) 157 157 { 158 158 case DISSELREG_ES: -
trunk/src/VBox/Disassembler/Makefile.kmk
r100046 r101539 37 37 LIBRARIES += DisasmR3 38 38 DisasmR3_TEMPLATE = VBoxR3Dll 39 DisasmR3_DEFS = IN_DIS VBOX_DIS_WITH_X86_AMD6439 DisasmR3_DEFS = IN_DIS 40 40 DisasmR3_SOURCES = \ 41 41 Disasm.cpp \ 42 DisasmMisc.cpp \ 43 DisasmFormatBytes.cpp 44 if 1 45 DisasmR3_DEFS += VBOX_DIS_WITH_X86_AMD64 46 DisasmR3_SOURCES += \ 42 47 DisasmCore-x86-amd64.cpp \ 43 48 DisasmTables-x86-amd64.cpp \ 44 49 DisasmTablesX64.cpp \ 45 DisasmMisc.cpp \46 DisasmFormatBytes.cpp \47 50 DisasmFormatYasm.cpp 51 endif 52 if 1 53 DisasmR3_DEFS += VBOX_DIS_WITH_ARMV8 54 DisasmR3_SOURCES += \ 55 DisasmCore-armv8.cpp \ 56 DisasmTables-armv8-a64.cpp \ 57 DisasmFormatArmV8.cpp 58 endif 48 59 49 60 LIBRARIES += DisasmR3Static 50 61 DisasmR3Static_TEMPLATE = VBoxR3Static 51 62 DisasmR3Static_EXTENDS = DisasmR3 52 53 ifdef VBOX_WITH_VIRT_ARMV854 LIBRARIES += DisasmR3-armv855 DisasmR3-armv8_TEMPLATE = VBoxR3Dll56 DisasmR3-armv8_DEFS = IN_DIS VBOX_DIS_WITH_ARMV857 DisasmR3-armv8_SOURCES = \58 Disasm.cpp \59 DisasmCore-armv8.cpp \60 DisasmTables-armv8-a64.cpp \61 DisasmFormatBytes.cpp \62 DisasmFormatArmV8.cpp63 endif64 63 65 64 ifndef VBOX_ONLY_VALIDATIONKIT -
trunk/src/VBox/Disassembler/testcase/tstDisasm-1.cpp
r99775 r101539 89 89 DISSTATE DisOnly; 90 90 rc = DISInstrWithPrefetchedBytes((uintptr_t)&pabInstrs[off], enmDisCpuMode, 0 /*fFilter - none */, 91 Dis. u.abInstr, Dis.cbCachedInstr, NULL, NULL, &DisOnly, &cbOnly);91 Dis.Instr.ab, Dis.cbCachedInstr, NULL, NULL, &DisOnly, &cbOnly); 92 92 93 93 RTTESTI_CHECK_RC(rc, VINF_SUCCESS); … … 109 109 { 110 110 RT_NOREF1(cbMinRead); 111 memcpy(&pDis-> u.abInstr[offInstr], (void *)((uintptr_t)pDis->uInstrAddr + offInstr), cbMaxRead);111 memcpy(&pDis->Instr.ab[offInstr], (void *)((uintptr_t)pDis->uInstrAddr + offInstr), cbMaxRead); 112 112 pDis->cbCachedInstr = offInstr + cbMaxRead; 113 113 return VINF_SUCCESS; -
trunk/src/VBox/Disassembler/testcase/tstDisasm-2.cpp
r99220 r101539 149 149 case OP_MOV_DR: 150 150 case OP_MOV_TR: 151 if (pDis-> arch.x86.ModRM.Bits.Mod != 3)151 if (pDis->x86.ModRM.Bits.Mod != 3) 152 152 return false; 153 153 break; … … 155 155 /* The 0x8f /0 variant of this instruction doesn't get its /r value verified. */ 156 156 case OP_POP: 157 if ( pDis-> arch.x86.bOpCode == 0x8f158 && pDis-> arch.x86.ModRM.Bits.Reg != 0)157 if ( pDis->x86.bOpCode == 0x8f 158 && pDis->x86.ModRM.Bits.Reg != 0) 159 159 return false; 160 160 break; … … 162 162 /* The 0xc6 /0 and 0xc7 /0 variants of this instruction don't get their /r values verified. */ 163 163 case OP_MOV: 164 if ( ( pDis-> arch.x86.bOpCode == 0xc6165 || pDis-> arch.x86.bOpCode == 0xc7)166 && pDis-> arch.x86.ModRM.Bits.Reg != 0)164 if ( ( pDis->x86.bOpCode == 0xc6 165 || pDis->x86.bOpCode == 0xc7) 166 && pDis->x86.ModRM.Bits.Reg != 0) 167 167 return false; 168 168 break; … … 192 192 //size_t cbToRead = cbMaxRead; 193 193 size_t cbToRead = cbMinRead; 194 memcpy(&pState->Dis. u.abInstr[offInstr], pState->pbNext, cbToRead);194 memcpy(&pState->Dis.Instr.ab[offInstr], pState->pbNext, cbToRead); 195 195 pState->Dis.cbCachedInstr = offInstr + (uint8_t)cbToRead; 196 196 pState->pbNext += cbToRead; … … 207 207 if (pState->cbLeft > 0) 208 208 { 209 memcpy(&pState->Dis. u.abInstr[offInstr], pState->pbNext, pState->cbLeft);209 memcpy(&pState->Dis.Instr.ab[offInstr], pState->pbNext, pState->cbLeft); 210 210 offInstr += (uint8_t)pState->cbLeft; 211 211 cbMinRead -= (uint8_t)pState->cbLeft; … … 214 214 pState->cbLeft = 0; 215 215 } 216 memset(&pState->Dis. u.abInstr[offInstr], 0xcc, cbMinRead);216 memset(&pState->Dis.Instr.ab[offInstr], 0xcc, cbMinRead); 217 217 pState->rc = VERR_EOF; 218 218 } … … 223 223 */ 224 224 RTStrmPrintf(g_pStdErr, "Reading before current instruction!\n"); 225 memset(&pState->Dis. u.abInstr[offInstr], 0x90, cbMinRead);225 memset(&pState->Dis.Instr.ab[offInstr], 0x90, cbMinRead); 226 226 pState->rc = VERR_INTERNAL_ERROR; 227 227 } … … 316 316 if (!State.cbInstr) 317 317 { 318 State.Dis. u.abInstr[0] = 0;318 State.Dis.Instr.ab[0] = 0; 319 319 State.Dis.pfnReadBytes(&State.Dis, 0, 1, 1); 320 320 State.cbInstr = 1; … … 322 322 RTPrintf(" db"); 323 323 for (unsigned off = 0; off < State.cbInstr; off++) 324 RTPrintf(off ? ", %03xh" : " %03xh", State.Dis. u.abInstr[off]);324 RTPrintf(off ? ", %03xh" : " %03xh", State.Dis.Instr.ab[off]); 325 325 RTPrintf(" ; %s\n", State.szLine); 326 326 } … … 345 345 RTPrintf(" db"); 346 346 for (unsigned off = 0; off < State.cbInstr; off++) 347 RTPrintf(off ? ", %03xh" : " %03xh", State.Dis. u.abInstr[off]);347 RTPrintf(off ? ", %03xh" : " %03xh", State.Dis.Instr.ab[off]); 348 348 RTPrintf(" ; "); 349 349 } … … 376 376 { 377 377 uint32_t cbInstrOnly = 32; 378 uint8_t abInstr[sizeof(State.Dis. u.abInstr)];379 memcpy(abInstr, State.Dis. u.abInstr, sizeof(State.Dis.u.abInstr));378 uint8_t abInstr[sizeof(State.Dis.Instr.ab)]; 379 memcpy(abInstr, State.Dis.Instr.ab, sizeof(State.Dis.Instr.ab)); 380 380 int rcOnly = DISInstrWithPrefetchedBytes(State.uAddress, enmCpuMode, 0 /*fFilter - none */, 381 381 abInstr, State.Dis.cbCachedInstr, MyDisasInstrRead, &State, -
trunk/src/VBox/Runtime/testcase/tstLdr-3.cpp
r99227 r101539 165 165 RT_NOREF1(cbMaxRead); 166 166 uint8_t const *pbSrc = (uint8_t const *)((uintptr_t)pDis->uInstrAddr + (uintptr_t)pDis->pvUser + offInstr); 167 memcpy(&pDis-> u.abInstr[offInstr], pbSrc, cbMinRead);167 memcpy(&pDis->Instr.ab[offInstr], pbSrc, cbMinRead); 168 168 pDis->cbCachedInstr = offInstr + cbMinRead; 169 169 return VINF_SUCCESS; -
trunk/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp
r99775 r101539 97 97 if (cb + pDis->uInstrAddr + offInstr > sizeof(g_ab32BitCode)) 98 98 cb = cbMinRead; 99 memcpy(&pDis-> u.abInstr[offInstr], &g_ab32BitCode[pDis->uInstrAddr + offInstr], cb);99 memcpy(&pDis->Instr.ab[offInstr], &g_ab32BitCode[pDis->uInstrAddr + offInstr], cb); 100 100 pDis->cbCachedInstr = offInstr + (uint8_t)cb; 101 101 return VINF_SUCCESS; … … 112 112 *pcb = cb; 113 113 MY_PRINTF(("DISCoreOneEx -> rc=%d cb=%d Cpu: bOpCode=%#x pCurInstr=%p (42=%d)\n", \ 114 rc, cb, pDis-> arch.x86.bOpCode, pDis->pCurInstr, 42)); \114 rc, cb, pDis->x86.bOpCode, pDis->pCurInstr, 42)); \ 115 115 return rc; 116 116 } -
trunk/src/VBox/VMM/Makefile.kmk
r101307 r101539 486 486 487 487 VBoxVMMArm_LIBS = \ 488 $(PATH_STAGE_LIB)/DisasmR3 -armv8$(VBOX_SUFF_LIB)488 $(PATH_STAGE_LIB)/DisasmR3$(VBOX_SUFF_LIB) 489 489 ifdef VBOX_WITH_DEBUGGER 490 490 VBoxVMMArm_LIBS += \ -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r99220 r101539 867 867 cbToRead = cbMinRead; 868 868 869 int rc = PGMPhysSimpleReadGCPtr(pVCpu, &pDis-> u.abInstr[offInstr], uSrcAddr, cbToRead);869 int rc = PGMPhysSimpleReadGCPtr(pVCpu, &pDis->Instr.ab[offInstr], uSrcAddr, cbToRead); 870 870 if (RT_FAILURE(rc)) 871 871 { … … 873 873 { 874 874 cbToRead = cbMinRead; 875 rc = PGMPhysSimpleReadGCPtr(pVCpu, &pDis-> u.abInstr[offInstr], uSrcAddr, cbToRead);875 rc = PGMPhysSimpleReadGCPtr(pVCpu, &pDis->Instr.ab[offInstr], uSrcAddr, cbToRead); 876 876 } 877 877 if (RT_FAILURE(rc)) … … 1020 1020 LogFlow(("EMInterpretInstructionDisasState %RGv\n", (RTGCPTR)rip)); 1021 1021 1022 VBOXSTRICTRC rc = IEMExecOneBypassWithPrefetchedByPC(pVCpu, rip, pDis-> u.abInstr, pDis->cbCachedInstr);1022 VBOXSTRICTRC rc = IEMExecOneBypassWithPrefetchedByPC(pVCpu, rip, pDis->Instr.ab, pDis->cbCachedInstr); 1023 1023 if (RT_UNLIKELY( rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED 1024 1024 || rc == VERR_IEM_INSTR_NOT_IMPLEMENTED)) -
trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
r101538 r101539 51 51 #include <VBox/vmm/iem.h> 52 52 #include <VBox/vmm/cpum.h> 53 #include <VBox/vmm/dbgf.h> 53 54 #include "IEMInternal.h" 54 55 #include <VBox/vmm/vmcc.h> 55 56 #include <VBox/log.h> 56 57 #include <VBox/err.h> 58 #include <VBox/dis.h> 57 59 #include <VBox/param.h> 58 60 #include <iprt/assert.h> … … 3977 3979 3978 3980 3981 /** @callback_method_impl{FNDISREADBYTES, Dummy.} */ 3982 static DECLCALLBACK(int) iemNativeDisasReadBytesDummy(PDISSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead) 3983 { 3984 RT_BZERO(&pDis->Instr.ab[offInstr], cbMaxRead); 3985 pDis->cbCachedInstr += cbMaxRead; 3986 RT_NOREF(cbMinRead); 3987 return VERR_NO_DATA; 3988 } 3989 3990 3991 3992 void iemNativeDisassembleTb(PCIEMTB pTb, PCDBGFINFOHLP pHlp) 3993 { 3994 AssertReturnVoid((pTb->fFlags & IEMTB_F_TYPE_MASK) == IEMTB_F_TYPE_NATIVE); 3995 3996 char szDisBuf[512]; 3997 DISSTATE Dis; 3998 PCIEMNATIVEINSTR const paInstrs = pTb->Native.paInstructions; 3999 uint32_t const cInstrs = pTb->Native.cInstructions; 4000 PCIEMTBDBG const pDbgInfo = pTb->pDbgInfo; 4001 DISCPUMODE enmGstCpuMode = (pTb->fFlags & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_16BIT ? DISCPUMODE_16BIT 4002 : (pTb->fFlags & IEM_F_MODE_CPUMODE_MASK) == IEMMODE_32BIT ? DISCPUMODE_32BIT 4003 : DISCPUMODE_64BIT; 4004 #ifdef RT_ARCH_AMD64 4005 DISCPUMODE const enmHstCpuMode = DISCPUMODE_64BIT; 4006 #elif defined(RT_ARCH_ARM64) 4007 DISCPUMODE const enmHstCpuMode = DISCPUMODE_ARMV8_A64; 4008 #else 4009 # error "Port me" 4010 #endif 4011 4012 pHlp->pfnPrintf(pHlp, 4013 "pTb=%p: GCPhysPc=%RGp cInstructions=%u LB %#x cRanges=%u\n" 4014 "pTb=%p: fFlags=%#010x cUsed=%u msLastUsed=%u\n", 4015 pTb, pTb->GCPhysPc, pTb->cInstructions, pTb->cbOpcodes, pTb->cRanges, 4016 pTb, pTb->fFlags, pTb->cUsed, pTb->msLastUsed); 4017 if (pDbgInfo) 4018 { 4019 4020 4021 } 4022 else 4023 { 4024 /* 4025 * No debug info, just disassemble the x86 code and then the native code. 4026 */ 4027 /* The guest code. */ 4028 for (unsigned i = 0; i < pTb->cRanges; i++) 4029 { 4030 RTGCPHYS GCPhysPc = pTb->aRanges[i].offPhysPage 4031 + (pTb->aRanges[i].idxPhysPage == 0 4032 ? pTb->GCPhysPc & ~(RTGCPHYS)GUEST_PAGE_OFFSET_MASK 4033 : pTb->aGCPhysPages[pTb->aRanges[i].idxPhysPage - 1]); 4034 pHlp->pfnPrintf(pHlp, " Range #%u: GCPhysPc=%RGp LB %#x [idxPg=%d]\n", 4035 i, GCPhysPc, pTb->aRanges[i].cbOpcodes, pTb->aRanges[i].idxPhysPage); 4036 unsigned off = pTb->aRanges[i].offOpcodes; 4037 unsigned const cbOpcodes = pTb->aRanges[i].cbOpcodes + off; 4038 while (off < cbOpcodes) 4039 { 4040 uint32_t cbInstr = 1; 4041 int rc = DISInstrWithPrefetchedBytes(GCPhysPc, enmGstCpuMode, DISOPTYPE_ALL, 4042 &pTb->pabOpcodes[off], cbOpcodes - off, 4043 iemNativeDisasReadBytesDummy, NULL, &Dis, &cbInstr); 4044 if (RT_SUCCESS(rc)) 4045 { 4046 DISFormatYasmEx(&Dis, szDisBuf, sizeof(szDisBuf), 4047 DIS_FMT_FLAGS_BYTES_LEFT | DIS_FMT_FLAGS_RELATIVE_BRANCH, 4048 NULL /*pfnGetSymbol*/, NULL /*pvUser*/); 4049 pHlp->pfnPrintf(pHlp, " %s\n", szDisBuf); 4050 off += cbInstr; 4051 } 4052 else 4053 { 4054 pHlp->pfnPrintf(pHlp, " %.*Rhxs - disassembly failure %Rrc\n", 4055 cbOpcodes - off, &pTb->pabOpcodes[off], rc); 4056 break; 4057 } 4058 } 4059 } 4060 4061 /* The native code: */ 4062 pHlp->pfnPrintf(pHlp, " Native code %p L %#x\n", paInstrs, cInstrs); 4063 for (uint32_t offNative = 0; offNative < cInstrs; ) 4064 { 4065 uint32_t cbInstr = sizeof(paInstrs[0]); 4066 int const rc = DISInstr(&paInstrs[offNative], enmHstCpuMode, &Dis, &cbInstr); 4067 if (RT_SUCCESS(rc)) 4068 { 4069 # if defined(RT_ARCH_AMD64) && 0 4070 if (Dis.pCurInstr->uOpcode == ) 4071 { 4072 } 4073 else 4074 # endif 4075 { 4076 DISFormatYasmEx(&Dis, szDisBuf, sizeof(szDisBuf), 4077 DIS_FMT_FLAGS_BYTES_LEFT | DIS_FMT_FLAGS_RELATIVE_BRANCH, 4078 NULL /*pfnGetSymbol*/, NULL /*pvUser*/); 4079 pHlp->pfnPrintf(pHlp, " %p: %s\n", &paInstrs[offNative], szDisBuf); 4080 } 4081 } 4082 else 4083 { 4084 # if defined(RT_ARCH_AMD64) 4085 pHlp->pfnPrintf(pHlp, " %p: %.*Rhxs - disassembly failure %Rrc\n", 4086 &paInstrs[offNative], RT_MIN(cInstrs - offNative, 16), &paInstrs[offNative], rc); 4087 # elif defined(RT_ARCH_ARM64) 4088 pHlp->pfnPrintf(pHlp, " %p: %#010RX32 - disassembly failure %Rrc\n", 4089 &paInstrs[offNative], paInstrs[offNative], rc); 4090 # else 4091 # error "Port me" 4092 #endif 4093 cbInstr = sizeof(paInstrs[0]); 4094 } 4095 offNative += cbInstr / sizeof(paInstrs[0]); 4096 } 4097 } 4098 } 4099 4100 3979 4101 /** 3980 4102 * Recompiles the given threaded TB into a native one. … … 4105 4227 4106 4228 iemExecMemAllocatorReadyForUse(pVCpu, paFinalInstrBuf, off * sizeof(IEMNATIVEINSTR)); 4107 #ifdef LOG_ENABLED4108 if (LogIs3Enabled())4109 {4110 4111 }4112 #endif4113 4229 4114 4230 /* … … 4126 4242 Assert(pTbAllocator->cNativeTbs <= pTbAllocator->cTotalTbs); 4127 4243 4244 #ifdef LOG_ENABLED 4245 /* 4246 * Disassemble to the log if enabled. 4247 */ 4248 if (LogIs3Enabled()) 4249 iemNativeDisassembleTb(pTb, DBGFR3InfoLogHlp()); 4250 #endif 4251 4128 4252 return pTb; 4129 4253 } -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r100966 r101539 227 227 if ( RT_SUCCESS(rc) 228 228 && pDis->uCpuMode == DISCPUMODE_32BIT /** @todo why does this matter? */ 229 && !(pDis-> arch.x86.fPrefix & (DISPREFIX_REPNE | DISPREFIX_REP | DISPREFIX_SEG)))229 && !(pDis->x86.fPrefix & (DISPREFIX_REPNE | DISPREFIX_REP | DISPREFIX_SEG))) 230 230 { 231 switch (pDis-> arch.x86.bOpCode)231 switch (pDis->x86.bOpCode) 232 232 { 233 233 /** @todo Find other instructions we can safely skip, possibly -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r100964 r101539 792 792 } 793 793 794 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. arch.x86.Base.idxGenReg));794 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 795 796 796 /* Non-supervisor mode write means it's used for something else. */ … … 824 824 case OP_MOVSWD: 825 825 case OP_STOSWD: 826 if ( pDis-> arch.x86.fPrefix == (DISPREFIX_REP|DISPREFIX_REX)826 if ( pDis->x86.fPrefix == (DISPREFIX_REP|DISPREFIX_REX) 827 827 && pCtx->rcx >= 0x40 828 828 ) … … 841 841 if ( ( (pDis->Param1.fUse & DISUSE_REG_GEN32) 842 842 || (pDis->Param1.fUse & DISUSE_REG_GEN64)) 843 && (pDis->Param1. arch.x86.Base.idxGenReg == DISGREG_ESP))843 && (pDis->Param1.x86.Base.idxGenReg == DISGREG_ESP)) 844 844 { 845 845 Log4(("pgmRZPoolMonitorIsReused: ESP\n")); … … 941 941 PCPUMCTX pCtx, RTGCPHYS GCPhysFault, RTGCPTR pvFault) 942 942 { 943 unsigned uIncrement = pDis->Param1. arch.x86.cb;943 unsigned uIncrement = pDis->Param1.x86.cb; 944 944 NOREF(pVM); 945 945 … … 948 948 949 949 # ifdef VBOX_STRICT 950 if (pDis-> arch.x86.uOpMode == DISCPUMODE_32BIT)950 if (pDis->x86.uOpMode == DISCPUMODE_32BIT) 951 951 Assert(uIncrement == 4); 952 952 else … … 1186 1186 if ( pPage->GCPtrLastAccessHandlerRip >= pCtx->rip - 0x40 /* observed loops in Windows 7 x64 */ 1187 1187 && pPage->GCPtrLastAccessHandlerRip < pCtx->rip + 0x40 1188 && pvFault == (pPage->GCPtrLastAccessHandlerFault + pDis->Param1. arch.x86.cb)1188 && pvFault == (pPage->GCPtrLastAccessHandlerFault + pDis->Param1.x86.cb) 1189 1189 && pVCpu->pgm.s.cPoolAccessHandler == pPage->cLastAccessHandler + 1) 1190 1190 { … … 1218 1218 * Simple instructions, no REP prefix. 1219 1219 */ 1220 if (!(pDis-> arch.x86.fPrefix & (DISPREFIX_REP | DISPREFIX_REPNE)))1220 if (!(pDis->x86.fPrefix & (DISPREFIX_REP | DISPREFIX_REPNE))) 1221 1221 { 1222 1222 rc = pgmRZPoolAccessPfHandlerSimple(pVM, pVCpu, pPool, pPage, pDis, pCtx, GCPhysFault, &fReused); … … 1261 1261 if ( pDis->pCurInstr->uOpcode == OP_STOSWD 1262 1262 && !pCtx->eflags.Bits.u1DF 1263 && pDis-> arch.x86.uOpMode == pDis->uCpuMode1264 && pDis-> arch.x86.uAddrMode == pDis->uCpuMode)1263 && pDis->x86.uOpMode == pDis->uCpuMode 1264 && pDis->x86.uAddrMode == pDis->uCpuMode) 1265 1265 { 1266 1266 bool fValidStosd = false; 1267 1267 1268 1268 if ( pDis->uCpuMode == DISCPUMODE_32BIT 1269 && pDis-> arch.x86.fPrefix == DISPREFIX_REP1269 && pDis->x86.fPrefix == DISPREFIX_REP 1270 1270 && pCtx->ecx <= 0x20 1271 1271 && pCtx->ecx * 4 <= GUEST_PAGE_SIZE - ((uintptr_t)pvFault & GUEST_PAGE_OFFSET_MASK) … … 1279 1279 else 1280 1280 if ( pDis->uCpuMode == DISCPUMODE_64BIT 1281 && pDis-> arch.x86.fPrefix == (DISPREFIX_REP | DISPREFIX_REX)1281 && pDis->x86.fPrefix == (DISPREFIX_REP | DISPREFIX_REX) 1282 1282 && pCtx->rcx <= 0x20 1283 1283 && pCtx->rcx * 8 <= GUEST_PAGE_SIZE - ((uintptr_t)pvFault & GUEST_PAGE_OFFSET_MASK) … … 1301 1301 STAM_COUNTER_INC(&pPool->StatMonitorPfRZRepPrefix); 1302 1302 Log4(("pgmRZPoolAccessPfHandler: eax=%#x ecx=%#x edi=%#x esi=%#x rip=%RGv opcode=%d prefix=%#x\n", 1303 pCtx->eax, pCtx->ecx, pCtx->edi, pCtx->esi, (RTGCPTR)pCtx->rip, pDis->pCurInstr->uOpcode, pDis-> arch.x86.fPrefix));1303 pCtx->eax, pCtx->ecx, pCtx->edi, pCtx->esi, (RTGCPTR)pCtx->rip, pDis->pCurInstr->uOpcode, pDis->x86.fPrefix)); 1304 1304 fNotReusedNotForking = true; 1305 1305 } -
trunk/src/VBox/VMM/VMMR3/CPUM-armv8.cpp
r101190 r101539 29 29 * 30 30 * The CPU Monitor / Manager keeps track of all the CPU registers. 31 * This is the ARMv8 variant which is doing much less than its x86/ amd6431 * This is the ARMv8 variant which is doing much less than its x86/AMD6464 32 32 * counterpart due to the fact that we currently only support the NEM backends 33 33 * for running ARM guests. It might become complex iff we decide to implement our -
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r101323 r101539 4474 4474 * Read and advance or exit. 4475 4475 */ 4476 memcpy(&pDis-> u.abInstr[offInstr], (uint8_t *)pState->pvPageR3 + (GCPtr & GUEST_PAGE_OFFSET_MASK), cb);4476 memcpy(&pDis->Instr.ab[offInstr], (uint8_t *)pState->pvPageR3 + (GCPtr & GUEST_PAGE_OFFSET_MASK), cb); 4477 4477 offInstr += (uint8_t)cb; 4478 4478 if (cb >= cbMinRead) -
trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp
r100108 r101539 271 271 * Read and advance, 272 272 */ 273 memcpy(&pDis-> u.abInstr[offInstr], (char *)pState->pvPageR3 + (GCPtr & GUEST_PAGE_OFFSET_MASK), cb);273 memcpy(&pDis->Instr.ab[offInstr], (char *)pState->pvPageR3 + (GCPtr & GUEST_PAGE_OFFSET_MASK), cb); 274 274 offInstr += (uint8_t)cb; 275 275 if (cb >= cbMinRead) … … 521 521 { 522 522 if (State.Dis.cbCachedInstr) 523 RTStrPrintf(pszOutput, cbOutput, "Disas -> %Rrc; %.*Rhxs\n", rc, (size_t)State.Dis.cbCachedInstr, State.Dis. u.abInstr);523 RTStrPrintf(pszOutput, cbOutput, "Disas -> %Rrc; %.*Rhxs\n", rc, (size_t)State.Dis.cbCachedInstr, State.Dis.Instr.ab); 524 524 else 525 525 RTStrPrintf(pszOutput, cbOutput, "Disas -> %Rrc\n", rc); … … 564 564 { 565 565 uint32_t cbInstr = State.Dis.cbInstr; 566 uint8_t const *pabInstr = State.Dis. u.abInstr;566 uint8_t const *pabInstr = State.Dis.Instr.ab; 567 567 if (fFlags & DBGF_DISAS_FLAGS_NO_ADDRESS) 568 568 cch = RTStrPrintf(pszOutput, cbOutput, "%.*Rhxs%*s %s", -
trunk/src/VBox/VMM/VMMR3/DBGFR3Flow.cpp
r99739 r101539 788 788 if ( DisState.pCurInstr->uOpcode == OP_MOV 789 789 && (DisState.Param1.fUse & (DISUSE_REG_GEN16 | DISUSE_REG_GEN32 | DISUSE_REG_GEN64)) 790 && DisState.Param1. arch.x86.Base.idxGenReg == idxRegTgt790 && DisState.Param1.x86.Base.idxGenReg == idxRegTgt 791 791 /*&& DisState.Param1.cb == cbPtr*/ 792 && DisState.Param2. arch.x86.cb == cbPtr792 && DisState.Param2.x86.cb == cbPtr 793 793 && (DisState.Param2.fUse & (DISUSE_IMMEDIATE16 | DISUSE_IMMEDIATE32 | DISUSE_IMMEDIATE64))) 794 794 { … … 997 997 if (pDisParam->fUse & DISUSE_BASE) 998 998 { 999 uint8_t idxRegBase = pDisParam-> arch.x86.Base.idxGenReg;999 uint8_t idxRegBase = pDisParam->x86.Base.idxGenReg; 1000 1000 1001 1001 /* Check that the used register size and the pointer size match. */ … … 1084 1084 if (pDisParam->fUse & DISUSE_BASE) 1085 1085 { 1086 uint8_t idxRegBase = pDisParam-> arch.x86.Base.idxGenReg;1086 uint8_t idxRegBase = pDisParam->x86.Base.idxGenReg; 1087 1087 1088 1088 /* Check that the used register size and the pointer size match. */ -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r101428 r101539 2341 2341 { 2342 2342 pPatch->enmType = HMTPRINSTR_WRITE_REG; 2343 pPatch->uSrcOperand = Dis.Param2. arch.x86.Base.idxGenReg;2344 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_REG %u\n", Dis.Param2. arch.x86.Base.idxGenReg));2343 pPatch->uSrcOperand = Dis.Param2.x86.Base.idxGenReg; 2344 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_REG %u\n", Dis.Param2.x86.Base.idxGenReg)); 2345 2345 } 2346 2346 else … … 2370 2370 Assert(Dis.Param1.fUse == DISUSE_REG_GEN32); 2371 2371 2372 uint8_t const idxMmioReg = Dis.Param1. arch.x86.Base.idxGenReg;2372 uint8_t const idxMmioReg = Dis.Param1.x86.Base.idxGenReg; 2373 2373 uint8_t const cbOpMmio = cbOp; 2374 2374 uint64_t const uSavedRip = pCtx->rip; … … 2382 2382 && Dis.pCurInstr->uOpcode == OP_SHR 2383 2383 && Dis.Param1.fUse == DISUSE_REG_GEN32 2384 && Dis.Param1. arch.x86.Base.idxGenReg == idxMmioReg2384 && Dis.Param1.x86.Base.idxGenReg == idxMmioReg 2385 2385 && Dis.Param2.fUse == DISUSE_IMMEDIATE8 2386 2386 && Dis.Param2.uValue == 4 … … 2400 2400 abInstr[1] = 0x0f; 2401 2401 abInstr[2] = 0x20; 2402 abInstr[3] = 0xc0 | Dis.Param1. arch.x86.Base.idxGenReg;2402 abInstr[3] = 0xc0 | Dis.Param1.x86.Base.idxGenReg; 2403 2403 for (unsigned i = 4; i < pPatch->cbOp; i++) 2404 2404 abInstr[i] = 0x90; /* nop */ … … 2532 2532 * jmp return_address [E9 return_address] 2533 2533 */ 2534 bool fUsesEax = (Dis.Param2.fUse == DISUSE_REG_GEN32 && Dis.Param2. arch.x86.Base.idxGenReg == DISGREG_EAX);2534 bool fUsesEax = (Dis.Param2.fUse == DISUSE_REG_GEN32 && Dis.Param2.x86.Base.idxGenReg == DISGREG_EAX); 2535 2535 2536 2536 aPatch[off++] = 0x51; /* push ecx */ … … 2545 2545 { 2546 2546 aPatch[off++] = 0x89; /* mov eax, src_reg */ 2547 aPatch[off++] = MAKE_MODRM(3, Dis.Param2. arch.x86.Base.idxGenReg, DISGREG_EAX);2547 aPatch[off++] = MAKE_MODRM(3, Dis.Param2.x86.Base.idxGenReg, DISGREG_EAX); 2548 2548 } 2549 2549 } … … 2584 2584 Assert(Dis.Param1.fUse == DISUSE_REG_GEN32); 2585 2585 2586 if (Dis.Param1. arch.x86.Base.idxGenReg != DISGREG_ECX)2586 if (Dis.Param1.x86.Base.idxGenReg != DISGREG_ECX) 2587 2587 aPatch[off++] = 0x51; /* push ecx */ 2588 if (Dis.Param1. arch.x86.Base.idxGenReg != DISGREG_EDX )2588 if (Dis.Param1.x86.Base.idxGenReg != DISGREG_EDX ) 2589 2589 aPatch[off++] = 0x52; /* push edx */ 2590 if (Dis.Param1. arch.x86.Base.idxGenReg != DISGREG_EAX)2590 if (Dis.Param1.x86.Base.idxGenReg != DISGREG_EAX) 2591 2591 aPatch[off++] = 0x50; /* push eax */ 2592 2592 … … 2601 2601 aPatch[off++] = 0x32; 2602 2602 2603 if (Dis.Param1. arch.x86.Base.idxGenReg != DISGREG_EAX)2603 if (Dis.Param1.x86.Base.idxGenReg != DISGREG_EAX) 2604 2604 { 2605 2605 aPatch[off++] = 0x89; /* mov dst_reg, eax */ 2606 aPatch[off++] = MAKE_MODRM(3, DISGREG_EAX, Dis.Param1. arch.x86.Base.idxGenReg);2606 aPatch[off++] = MAKE_MODRM(3, DISGREG_EAX, Dis.Param1.x86.Base.idxGenReg); 2607 2607 } 2608 2608 2609 if (Dis.Param1. arch.x86.Base.idxGenReg != DISGREG_EAX)2609 if (Dis.Param1.x86.Base.idxGenReg != DISGREG_EAX) 2610 2610 aPatch[off++] = 0x58; /* pop eax */ 2611 if (Dis.Param1. arch.x86.Base.idxGenReg != DISGREG_EDX )2611 if (Dis.Param1.x86.Base.idxGenReg != DISGREG_EDX ) 2612 2612 aPatch[off++] = 0x5a; /* pop edx */ 2613 if (Dis.Param1. arch.x86.Base.idxGenReg != DISGREG_ECX)2613 if (Dis.Param1.x86.Base.idxGenReg != DISGREG_ECX) 2614 2614 aPatch[off++] = 0x59; /* pop ecx */ 2615 2615 } -
trunk/src/VBox/VMM/include/IEMInternal.h
r101538 r101539 814 814 /** Pointer to a native instruction unit. */ 815 815 typedef IEMNATIVEINSTR *PIEMNATIVEINSTR; 816 /** Pointer to a const native instruction unit. */ 817 typedef IEMNATIVEINSTR const *PCIEMNATIVEINSTR; 816 818 817 819 /** … … 869 871 * This will throw/longjmp on occation. */ 870 872 typedef FNIEMTBNATIVE *PFNIEMTBNATIVE; 873 874 875 /** 876 * Translation block debug info entry type. 877 */ 878 typedef enum IEMTBDBGENTRYTYPE 879 { 880 kIemTbDbgEntryType_Invalid = 0, 881 /** The entry is for a new guest instruction. */ 882 kIemTbDbgEntryType_GuestInstruction, 883 /** Marks the start of a native call. */ 884 kIemTbDbgEntryType_ThreadedCall1, 885 /** 2nd entry for the start of a native call. */ 886 kIemTbDbgEntryType_ThreadedCall2, 887 /** Info about a host register shadowing a guest register. */ 888 kIemTbDbgEntryType_GuestRegShadow, 889 kIemTbDbgEntryType_End 890 } IEMTBDBGENTRYTYPE; 891 892 /** 893 * Translation block debug info entry. 894 */ 895 typedef union IEMTBDBGENTRY 896 { 897 /** Plain 32-bit view. */ 898 uint32_t u; 899 900 /** Generic view for getting at the type field. */ 901 struct 902 { 903 /** IEMTBDBGENTRYTYPE */ 904 uint32_t uType : 4; 905 uint32_t uTypeSpecific : 28; 906 } Gen; 907 908 struct 909 { 910 /** kIemTbDbgEntryType_GuestInstruction. */ 911 uint32_t uType : 4; 912 /** Index into IEMTB::aRanges. */ 913 uint32_t idxRange : 4; 914 /** Offset relative to the start of the range. */ 915 uint32_t offOpcodes : 12; 916 /** Number of opcode bytes for the instruction. */ 917 uint32_t cbOpcodes : 4; 918 /** Basic CPU mode for the disassembler (low 8 bits IEM_F_XXX). */ 919 uint32_t fCpuMode : 8; 920 } GuestInstruction; 921 922 struct 923 { 924 /** kIemTbDbgEntryType_ThreadedCall1. */ 925 uint32_t uType : 4; 926 /** Native code offset. */ 927 uint32_t offNative : 28; 928 } ThreadedCall1; 929 930 struct 931 { 932 /* kIemTbDbgEntryType_ThreadedCall2. */ 933 uint32_t uType : 4; 934 /** The threaded call number (IEMTHREADEDFUNCS). */ 935 uint32_t enmCall : 16; 936 } ThreadedCall2; 937 938 struct 939 { 940 /* kIemTbDbgEntryType_GuestRegShadow. */ 941 uint32_t uType : 4; 942 uint32_t uPadding : 4; 943 /** The host register number. */ 944 uint32_t idxHstReg : 8; 945 /** The guest register being shadowed (IEMNATIVEGSTREG). */ 946 uint32_t idxGstReg : 8; 947 uint32_t uUnused : 8; 948 } GuestRegShadow; 949 } IEMTBDBGENTRY; 950 AssertCompileSize(IEMTBDBGENTRY, sizeof(uint32_t)); 951 952 /** 953 * Translation block debug info. 954 */ 955 typedef struct IEMTBDBG 956 { 957 /** Number of entries in aEntries. */ 958 uint32_t cEntries; 959 /** Number of entries we've allocated. */ 960 uint32_t cAllocated; 961 /** Debug info entries. */ 962 RT_FLEXIBLE_ARRAY_EXTENSION 963 IEMTBDBGENTRY aEntries[RT_FLEXIBLE_ARRAY]; 964 } IEMTBDBG; 965 /** Pointer to TB debug info. */ 966 typedef IEMTBDBG *PIEMTBDBG; 967 /** Pointer to const TB debug info. */ 968 typedef IEMTBDBG const *PCIEMTBDBG; 871 969 872 970 … … 945 1043 uint8_t *pabOpcodes; 946 1044 947 /** Debug info or smth. */ 948 void *pvDbg; 1045 /** Debug info if enabled. 1046 * This is only generated by the native recompiler. */ 1047 PIEMTBDBG pDbgInfo; 949 1048 950 1049 /* --- 64 byte cache line end --- */ … … 981 1080 * The GCPhysPc w/o page offset is element zero, so starting here with 1. */ 982 1081 RTGCPHYS aGCPhysPages[2]; 983 984 1082 } IEMTB; 985 1083 #pragma pack() … … 987 1085 AssertCompileMemberAlignment(IEMTB, Thrd, sizeof(void *)); 988 1086 AssertCompileMemberAlignment(IEMTB, pabOpcodes, sizeof(void *)); 989 AssertCompileMemberAlignment(IEMTB, p vDbg, sizeof(void *));1087 AssertCompileMemberAlignment(IEMTB, pDbgInfo, sizeof(void *)); 990 1088 AssertCompileMemberAlignment(IEMTB, aGCPhysPages, sizeof(RTGCPHYS)); 991 1089 AssertCompileMemberOffset(IEMTB, aRanges[0], 64);
Note:
See TracChangeset
for help on using the changeset viewer.