VirtualBox

Changeset 21187 in vbox for trunk/src


Ignore:
Timestamp:
Jul 3, 2009 9:49:33 AM (16 years ago)
Author:
vboxsync
Message:

Deal with operand size and mod default values for certain instructions (mov crx, mov drx)

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

Legend:

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

    r20961 r21187  
    415415    bool fFiltered = false;
    416416
     417    Assert(lpszCodeBlock && pOp && pCpu);
     418
    417419    // Store the opcode format string for disasmPrintf
    418420#ifndef DIS_CORE_ONLY
     
    450452            &&  !(pCpu->prefix & PREFIX_OPSIZE))
    451453            pCpu->opmode = CPUMODE_64BIT;
     454    }
     455    else
     456    if (pOp->optype & OPTYPE_FORCED_32_OP_SIZE_X86)
     457    {
     458        /* Forced 32 bits operand size for certain instructions (mov crx, mov drx). */
     459        Assert(pCpu->mode != CPUMODE_64BIT);
     460        pCpu->opmode = CPUMODE_32BIT;
    452461    }
    453462
     
    11051114    pCpu->ModRM.Bits.Reg = MODRM_REG(ModRM);
    11061115
     1116    /* Disregard the mod bits for certain instructions (mov crx, mov drx).
     1117     *
     1118     * From the AMD manual:
     1119     * This instruction is always treated as a register-to-register (MOD = 11) instruction, regardless of the
     1120     * encoding of the MOD field in the MODR/M byte.
     1121     */
     1122    if (pOp->optype & OPTYPE_MOD_FIXED_11)
     1123        pCpu->ModRM.Bits.Mod = 3;
     1124
    11071125    if (pCpu->prefix & PREFIX_REX)
    11081126    {
     
    11411159    pCpu->ModRM.Bits.Mod = MODRM_MOD(ModRM);
    11421160    pCpu->ModRM.Bits.Reg = MODRM_REG(ModRM);
     1161
     1162    /* Disregard the mod bits for certain instructions (mov crx, mov drx).
     1163     *
     1164     * From the AMD manual:
     1165     * This instruction is always treated as a register-to-register (MOD = 11) instruction, regardless of the
     1166     * encoding of the MOD field in the MODR/M byte.
     1167     */
     1168    if (pOp->optype & OPTYPE_MOD_FIXED_11)
     1169        pCpu->ModRM.Bits.Mod = 3;
    11431170
    11441171    if (pCpu->prefix & PREFIX_REX)
  • trunk/src/VBox/Disassembler/DisasmTables.cpp

    r18768 r21187  
    430430
    431431    /* 2 */
    432     OP("mov %Rd,%Cd",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOV_CR,  OP_PARM_Rd,         OP_PARM_Cd,     OP_PARM_NONE,   OPTYPE_DANGEROUS | OPTYPE_PRIVILEGED),
    433     OP("mov %Rd,%Dd",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOV_DR,  OP_PARM_Rd,         OP_PARM_Dd,     OP_PARM_NONE,   OPTYPE_DANGEROUS | OPTYPE_PRIVILEGED),
    434     OP("mov %Cd,%Rd",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOV_CR,  OP_PARM_Cd,         OP_PARM_Rd,     OP_PARM_NONE,   OPTYPE_DANGEROUS | OPTYPE_PRIVILEGED),
    435     OP("mov %Dd,%Rd",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOV_DR,  OP_PARM_Dd,         OP_PARM_Rd,     OP_PARM_NONE,   OPTYPE_DANGEROUS | OPTYPE_PRIVILEGED),
     432    OP("mov %Rd,%Cd",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOV_CR,  OP_PARM_Rd,         OP_PARM_Cd,     OP_PARM_NONE,   OPTYPE_DANGEROUS | OPTYPE_PRIVILEGED | OPTYPE_MOD_FIXED_11 | OPTYPE_FORCED_32_OP_SIZE_X86),
     433    OP("mov %Rd,%Dd",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOV_DR,  OP_PARM_Rd,         OP_PARM_Dd,     OP_PARM_NONE,   OPTYPE_DANGEROUS | OPTYPE_PRIVILEGED | OPTYPE_MOD_FIXED_11 | OPTYPE_FORCED_32_OP_SIZE_X86),
     434    OP("mov %Cd,%Rd",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOV_CR,  OP_PARM_Cd,         OP_PARM_Rd,     OP_PARM_NONE,   OPTYPE_DANGEROUS | OPTYPE_PRIVILEGED | OPTYPE_MOD_FIXED_11 | OPTYPE_FORCED_32_OP_SIZE_X86),
     435    OP("mov %Dd,%Rd",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOV_DR,  OP_PARM_Dd,         OP_PARM_Rd,     OP_PARM_NONE,   OPTYPE_DANGEROUS | OPTYPE_PRIVILEGED | OPTYPE_MOD_FIXED_11 | OPTYPE_FORCED_32_OP_SIZE_X86),
    436436    /* only valid for Pentium Pro & Pentium II */
    437437    OP("mov %Rd,%Td",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOV_TR,  OP_PARM_Rd,         OP_PARM_Td,     OP_PARM_NONE,   OPTYPE_PRIVILEGED),
  • trunk/src/VBox/Disassembler/DisasmTestA.asm

    r20041 r21187  
    3434align 16
    3535BEGINPROC   TestProc
     36    xor eax, eax
     37    mov al, 4
     38    lea edx, [4]
     39    mov edx, 4
     40    mov eax, 4
     41    shl eax, 4
     42    shl edx, 4
     43    shr edx, 4
     44    mov eax, edx
     45    mov eax, ecx
     46    mov edx, eax
     47    mov ecx, eax
    3648    DB 0xF0, 0x0F, 0x22, 0xC0
    3749    DB 0xF0, 0x0F, 0x20, 0xC0
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