Changeset 8379 in vbox for trunk/src/VBox
- Timestamp:
- Apr 25, 2008 9:09:35 AM (17 years ago)
- Location:
- trunk/src/VBox/Disassembler
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/Disasm.cpp
r8377 r8379 175 175 if (opcode <= OP_LAST_PREFIX) 176 176 { 177 pCpu->lastprefix = opcode;178 179 177 /* The REX prefix must precede the opcode byte(s). Any other placement is ignored. */ 180 178 if (opcode != OP_REX) 179 { 180 pCpu->lastprefix = opcode; 181 181 pCpu->prefix &= ~PREFIX_REX; 182 } 182 183 183 184 switch(opcode) -
trunk/src/VBox/Disassembler/DisasmCore.cpp
r8377 r8379 280 280 if (opcode <= OP_LAST_PREFIX) 281 281 { 282 pCpu->lastprefix = opcode;283 284 282 /* The REX prefix must precede the opcode byte(s). Any other placement is ignored. */ 285 283 if (opcode != OP_REX) 284 { 285 /** Last prefix byte (for SSE2 extension tables); don't include the REX prefix */ 286 pCpu->lastprefix = opcode; 286 287 pCpu->prefix &= ~PREFIX_REX; 288 } 287 289 288 290 switch (opcode) … … 516 518 // Scale Index Base 517 519 //***************************************************************************** 518 const char *szSIBBaseReg[8] = {"EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI", "EDI"}; 519 const char *szSIBIndexReg[8] = {"EAX", "ECX", "EDX", "EBX", NULL, "EBP", "ESI", "EDI"}; 520 const char *szSIBBaseReg[8] = {"EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI", "EDI"}; 521 const char *szSIBIndexReg[8] = {"EAX", "ECX", "EDX", "EBX", NULL, "EBP", "ESI", "EDI"}; 522 const char *szSIBBaseReg64[16] = {"RAX", "RCX", "RDX", "RBX", "RSP", "RBP", "RSI", "RDI", "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15"}; 523 const char *szSIBIndexReg64[16]= {"RAX", "RCX", "RDX", "RBX", NULL, "RBP", "RSI", "RDI", "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15"}; 520 524 const char *szSIBScale[4] = {"", "*2", "*4", "*8"}; 521 525 … … 523 527 void UseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu) 524 528 { 525 unsigned scale, base, index; 529 unsigned scale, base, index, regtype; 530 const char **ppszSIBIndexReg; 531 const char **ppszSIBBaseReg; 526 532 char szTemp[32]; 527 533 szTemp[0] = '\0'; … … 531 537 index = pCpu->SIB.Bits.Index; 532 538 533 if (szSIBIndexReg[index]) 539 if (pCpu->addrmode == CPUMODE_32BIT) 540 { 541 ppszSIBIndexReg = szSIBIndexReg; 542 ppszSIBBaseReg = szSIBBaseReg; 543 regtype = USE_REG_GEN32; 544 } 545 else 546 { 547 ppszSIBIndexReg = szSIBIndexReg64; 548 ppszSIBBaseReg = szSIBBaseReg64; 549 regtype = USE_REG_GEN64; 550 } 551 552 if (ppszSIBIndexReg[index]) 534 553 { 535 554 pParam->flags |= USE_INDEX; … … 543 562 544 563 if (base == 5 && pCpu->ModRM.Bits.Mod == 0) 545 disasmAddStringF(szTemp, sizeof(szTemp), "%s%s", szSIBIndexReg[index], szSIBScale[scale]);564 disasmAddStringF(szTemp, sizeof(szTemp), "%s%s", ppszSIBIndexReg[index], szSIBScale[scale]); 546 565 else 547 disasmAddStringF(szTemp, sizeof(szTemp), "%s+%s%s", szSIBBaseReg[base],szSIBIndexReg[index], szSIBScale[scale]);566 disasmAddStringF(szTemp, sizeof(szTemp), "%s+%s%s", ppszSIBBaseReg[base], ppszSIBIndexReg[index], szSIBScale[scale]); 548 567 } 549 568 else 550 569 { 551 570 if (base != 5 || pCpu->ModRM.Bits.Mod != 0) 552 disasmAddStringF(szTemp, sizeof(szTemp), "%s", szSIBBaseReg[base]);571 disasmAddStringF(szTemp, sizeof(szTemp), "%s", ppszSIBBaseReg[base]); 553 572 } 554 573 … … 566 585 disasmAddString(pParam->szParam, szTemp); 567 586 568 pParam->flags |= USE_BASE | USE_REG_GEN32;587 pParam->flags |= USE_BASE | regtype; 569 588 pParam->base.reg_gen = base; 570 589 } … … 691 710 if (mod != 3) 692 711 break; /* memory operand */ 712 reg = rm; /* the RM field specifies the xmm register */ 693 713 /* else no break */ 714 694 715 case OP_PARM_V: //XMM register 695 716 disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), "XMM%d", reg); … … 2028 2049 subtype = OP_PARM_VSUBTYPE(pParam->param); 2029 2050 if (fRegAddr) 2030 subtype = (pCpu-> opmode == CPUMODE_64BIT) ? OP_PARM_q : OP_PARM_d;2051 subtype = (pCpu->addrmode == CPUMODE_64BIT) ? OP_PARM_q : OP_PARM_d; 2031 2052 else 2032 2053 if (subtype == OP_PARM_v || subtype == OP_PARM_NONE) … … 2152 2173 if (subtype == OP_PARM_v) 2153 2174 { 2154 subtype = (pCpu->opmode == CPUMODE_32BIT) ? OP_PARM_d : OP_PARM_w; 2175 switch(pCpu->opmode) 2176 { 2177 case CPUMODE_32BIT: 2178 subtype = OP_PARM_d; 2179 break; 2180 case CPUMODE_64BIT: 2181 subtype = OP_PARM_q; 2182 break; 2183 case CPUMODE_16BIT: 2184 subtype = OP_PARM_w; 2185 break; 2186 } 2155 2187 } 2156 2188 -
trunk/src/VBox/Disassembler/DisasmTestA.asm
r8377 r8379 72 72 movzx rax,byte [edx] 73 73 movzx rax,word [edx] 74 movzx rax,byte [rdx] 74 75 lock cmpxchg [rcx], rax 75 76 lock cmpxchg [rcx], ax … … 82 83 mov rbx, [rbp + rax*4 + 4] 83 84 mov rbx, [rbp + rax*4] 85 mov rbx, [ebp + eax*4] 84 86 int 80h 85 87 in al, 60h
Note:
See TracChangeset
for help on using the changeset viewer.