VirtualBox

Changeset 8379 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 25, 2008 9:09:35 AM (17 years ago)
Author:
vboxsync
Message:

More fixes.

Location:
trunk/src/VBox/Disassembler
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Disassembler/Disasm.cpp

    r8377 r8379  
    175175            if (opcode <= OP_LAST_PREFIX)
    176176            {
    177                 pCpu->lastprefix = opcode;
    178 
    179177                /* The REX prefix must precede the opcode byte(s). Any other placement is ignored. */
    180178                if (opcode != OP_REX)
     179                {
     180                    pCpu->lastprefix = opcode;
    181181                    pCpu->prefix &= ~PREFIX_REX;
     182                }
    182183
    183184                switch(opcode)
  • trunk/src/VBox/Disassembler/DisasmCore.cpp

    r8377 r8379  
    280280        if (opcode <= OP_LAST_PREFIX)
    281281        {
    282             pCpu->lastprefix = opcode;
    283 
    284282            /* The REX prefix must precede the opcode byte(s). Any other placement is ignored. */
    285283            if (opcode != OP_REX)
     284            {
     285                /** Last prefix byte (for SSE2 extension tables); don't include the REX prefix */
     286                pCpu->lastprefix = opcode;
    286287                pCpu->prefix &= ~PREFIX_REX;
     288            }
    287289
    288290            switch (opcode)
     
    516518// Scale  Index  Base
    517519//*****************************************************************************
    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"};
     520const char *szSIBBaseReg[8]    = {"EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI", "EDI"};
     521const char *szSIBIndexReg[8]   = {"EAX", "ECX", "EDX", "EBX", NULL,  "EBP", "ESI", "EDI"};
     522const char *szSIBBaseReg64[16] = {"RAX", "RCX", "RDX", "RBX", "RSP", "RBP", "RSI", "RDI", "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15"};
     523const char *szSIBIndexReg64[16]= {"RAX", "RCX", "RDX", "RBX", NULL,  "RBP", "RSI", "RDI", "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15"};
    520524const char *szSIBScale[4]    = {"", "*2", "*4", "*8"};
    521525
     
    523527void UseSIB(RTUINTPTR lpszCodeBlock, PCOPCODE pOp, POP_PARAMETER pParam, PDISCPUSTATE pCpu)
    524528{
    525     unsigned scale, base, index;
     529    unsigned scale, base, index, regtype;
     530    const char **ppszSIBIndexReg;
     531    const char **ppszSIBBaseReg;
    526532    char szTemp[32];
    527533    szTemp[0] = '\0';
     
    531537    index = pCpu->SIB.Bits.Index;
    532538
    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])
    534553    {
    535554         pParam->flags |= USE_INDEX;
     
    543562
    544563         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]);
    546565         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]);
    548567    }
    549568    else
    550569    {
    551570         if (base != 5 || pCpu->ModRM.Bits.Mod != 0)
    552              disasmAddStringF(szTemp, sizeof(szTemp), "%s", szSIBBaseReg[base]);
     571             disasmAddStringF(szTemp, sizeof(szTemp), "%s", ppszSIBBaseReg[base]);
    553572    }
    554573
     
    566585        disasmAddString(pParam->szParam, szTemp);
    567586
    568         pParam->flags |= USE_BASE | USE_REG_GEN32;
     587        pParam->flags |= USE_BASE | regtype;
    569588        pParam->base.reg_gen = base;
    570589    }
     
    691710                if (mod != 3)
    692711                    break;  /* memory operand */
     712                reg = rm; /* the RM field specifies the xmm register */
    693713                /* else no break */
     714
    694715            case OP_PARM_V: //XMM register
    695716                disasmAddStringF(pParam->szParam, sizeof(pParam->szParam), "XMM%d", reg);
     
    20282049    subtype = OP_PARM_VSUBTYPE(pParam->param);
    20292050    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;
    20312052    else
    20322053    if (subtype == OP_PARM_v || subtype == OP_PARM_NONE)
     
    21522173    if (subtype == OP_PARM_v)
    21532174    {
    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        }
    21552187    }
    21562188
  • trunk/src/VBox/Disassembler/DisasmTestA.asm

    r8377 r8379  
    7272      movzx rax,byte  [edx]
    7373      movzx rax,word  [edx]
     74      movzx rax,byte  [rdx]
    7475      lock cmpxchg [rcx], rax
    7576      lock cmpxchg [rcx], ax
     
    8283      mov rbx, [rbp + rax*4 + 4]
    8384      mov rbx, [rbp + rax*4]
     85      mov rbx, [ebp + eax*4]
    8486      int 80h
    8587      in  al, 60h
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette