VirtualBox

Changeset 41729 in vbox


Ignore:
Timestamp:
Jun 14, 2012 11:24:17 PM (13 years ago)
Author:
vboxsync
Message:

DISQueryParamVal: renamed related types and constants and reduced the param structure by 8-12 bytes.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/dis.h

    r41728 r41729  
    382382/** @}  */
    383383
    384 /** Used by DISQueryParamVal & EMIQueryParamVal
    385  * @{
    386  */
    387 #define PARAM_VAL8             RT_BIT(0)
    388 #define PARAM_VAL16            RT_BIT(1)
    389 #define PARAM_VAL32            RT_BIT(2)
    390 #define PARAM_VAL64            RT_BIT(3)
    391 #define PARAM_VALFARPTR16      RT_BIT(4)
    392 #define PARAM_VALFARPTR32      RT_BIT(5)
    393 
    394 #define PARMTYPE_REGISTER      1
    395 #define PARMTYPE_ADDRESS       2
    396 #define PARMTYPE_IMMEDIATE     3
     384/** @name Flags returned by DISQueryParamVal (DISQPVPARAMVAL::flags).
     385 * @{
     386 */
     387#define DISQPV_FLAG_8                   UINT8_C(0x01)
     388#define DISQPV_FLAG_16                  UINT8_C(0x02)
     389#define DISQPV_FLAG_32                  UINT8_C(0x04)
     390#define DISQPV_FLAG_64                  UINT8_C(0x08)
     391#define DISQPV_FLAG_FARPTR16            UINT8_C(0x10)
     392#define DISQPV_FLAG_FARPTR32            UINT8_C(0x20)
     393/** @}  */
     394
     395/** @name Types returned by DISQueryParamVal (DISQPVPARAMVAL::flags).
     396 * @{ */
     397#define DISQPV_TYPE_REGISTER            UINT8_C(1)
     398#define DISQPV_TYPE_ADDRESS             UINT8_C(2)
     399#define DISQPV_TYPE_IMMEDIATE           UINT8_C(3)
     400/** @}  */
    397401
    398402typedef struct
    399403{
    400     uint32_t        type;
    401     uint32_t        size;
    402     uint64_t        flags;
    403 
    404404    union
    405405    {
     
    416416    } val;
    417417
    418 } OP_PARAMVAL;
     418    uint8_t         type;
     419    uint8_t         size;
     420    uint8_t         flags;
     421} DISQPVPARAMVAL;
    419422/** Pointer to opcode parameter value. */
    420 typedef OP_PARAMVAL *POP_PARAMVAL;
    421 
    422 typedef enum
     423typedef DISQPVPARAMVAL *PDISQPVPARAMVAL;
     424
     425/** Indicates which parameter DISQueryParamVal should operate on. */
     426typedef enum DISQPVWHICH
    423427{
    424     PARAM_DEST,
    425     PARAM_SOURCE
    426 } PARAM_TYPE;
    427 
    428 /** @} */
     428    DISQPVWHICH_DST = 1,
     429    DISQPVWHICH_SRC,
     430    DISQPVWHAT_32_BIT_HACK = 0x7fffffff
     431} DISQPVWHICH;
     432
    429433
    430434/**
     
    649653DISDECL(uint8_t)    DISQuerySegPrefixByte(PDISCPUSTATE pCpu);
    650654
    651 DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, POP_PARAMVAL pParamVal, PARAM_TYPE parmtype);
     655DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, PDISQPVPARAMVAL pParamVal, DISQPVWHICH parmtype);
    652656DISDECL(int) DISQueryParamRegPtr(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, void **ppReg, size_t *pcbSize);
    653657
  • trunk/src/VBox/Disassembler/DisasmReg.cpp

    r41727 r41729  
    500500 *
    501501 */
    502 DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, POP_PARAMVAL pParamVal, PARAM_TYPE parmtype)
     502DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, PDISQPVPARAMVAL pParamVal, DISQPVWHICH parmtype)
    503503{
    504504    memset(pParamVal, 0, sizeof(*pParamVal));
     
    507507    {
    508508        // Effective address
    509         pParamVal->type = PARMTYPE_ADDRESS;
     509        pParamVal->type = DISQPV_TYPE_ADDRESS;
    510510        pParamVal->size = pParam->cb;
    511511
     
    514514            if (pParam->fUse & DISUSE_REG_GEN8)
    515515            {
    516                 pParamVal->flags |= PARAM_VAL8;
     516                pParamVal->flags |= DISQPV_FLAG_8;
    517517                if (RT_FAILURE(DISFetchReg8(pCtx, pParam->base.reg_gen, &pParamVal->val.val8))) return VERR_INVALID_PARAMETER;
    518518            }
     
    520520            if (pParam->fUse & DISUSE_REG_GEN16)
    521521            {
    522                 pParamVal->flags |= PARAM_VAL16;
     522                pParamVal->flags |= DISQPV_FLAG_16;
    523523                if (RT_FAILURE(DISFetchReg16(pCtx, pParam->base.reg_gen, &pParamVal->val.val16))) return VERR_INVALID_PARAMETER;
    524524            }
     
    526526            if (pParam->fUse & DISUSE_REG_GEN32)
    527527            {
    528                 pParamVal->flags |= PARAM_VAL32;
     528                pParamVal->flags |= DISQPV_FLAG_32;
    529529                if (RT_FAILURE(DISFetchReg32(pCtx, pParam->base.reg_gen, &pParamVal->val.val32))) return VERR_INVALID_PARAMETER;
    530530            }
     
    532532            if (pParam->fUse & DISUSE_REG_GEN64)
    533533            {
    534                 pParamVal->flags |= PARAM_VAL64;
     534                pParamVal->flags |= DISQPV_FLAG_64;
    535535                if (RT_FAILURE(DISFetchReg64(pCtx, pParam->base.reg_gen, &pParamVal->val.val64))) return VERR_INVALID_PARAMETER;
    536536            }
     
    548548                uint16_t val16;
    549549
    550                 pParamVal->flags |= PARAM_VAL16;
     550                pParamVal->flags |= DISQPV_FLAG_16;
    551551                if (RT_FAILURE(DISFetchReg16(pCtx, pParam->index.reg_gen, &val16))) return VERR_INVALID_PARAMETER;
    552552
     
    560560                uint32_t val32;
    561561
    562                 pParamVal->flags |= PARAM_VAL32;
     562                pParamVal->flags |= DISQPV_FLAG_32;
    563563                if (RT_FAILURE(DISFetchReg32(pCtx, pParam->index.reg_gen, &val32))) return VERR_INVALID_PARAMETER;
    564564
     
    573573                uint64_t val64;
    574574
    575                 pParamVal->flags |= PARAM_VAL64;
     575                pParamVal->flags |= DISQPV_FLAG_64;
    576576                if (RT_FAILURE(DISFetchReg64(pCtx, pParam->index.reg_gen, &val64))) return VERR_INVALID_PARAMETER;
    577577
     
    632632    if (pParam->fUse & (DISUSE_REG_GEN8|DISUSE_REG_GEN16|DISUSE_REG_GEN32|DISUSE_REG_GEN64|DISUSE_REG_FP|DISUSE_REG_MMX|DISUSE_REG_XMM|DISUSE_REG_CR|DISUSE_REG_DBG|DISUSE_REG_SEG|DISUSE_REG_TEST))
    633633    {
    634         if (parmtype == PARAM_DEST)
     634        if (parmtype == DISQPVWHICH_DST)
    635635        {
    636636            // Caller needs to interpret the register according to the instruction (source/target, special value etc)
    637             pParamVal->type = PARMTYPE_REGISTER;
     637            pParamVal->type = DISQPV_TYPE_REGISTER;
    638638            pParamVal->size = pParam->cb;
    639639            return VINF_SUCCESS;
    640640        }
    641         //else PARAM_SOURCE
    642 
    643         pParamVal->type = PARMTYPE_IMMEDIATE;
     641        //else DISQPVWHICH_SRC
     642
     643        pParamVal->type = DISQPV_TYPE_IMMEDIATE;
    644644
    645645        if (pParam->fUse & DISUSE_REG_GEN8)
    646646        {
    647             pParamVal->flags |= PARAM_VAL8;
     647            pParamVal->flags |= DISQPV_FLAG_8;
    648648            pParamVal->size   = sizeof(uint8_t);
    649649            if (RT_FAILURE(DISFetchReg8(pCtx, pParam->base.reg_gen, &pParamVal->val.val8))) return VERR_INVALID_PARAMETER;
     
    652652        if (pParam->fUse & DISUSE_REG_GEN16)
    653653        {
    654             pParamVal->flags |= PARAM_VAL16;
     654            pParamVal->flags |= DISQPV_FLAG_16;
    655655            pParamVal->size   = sizeof(uint16_t);
    656656            if (RT_FAILURE(DISFetchReg16(pCtx, pParam->base.reg_gen, &pParamVal->val.val16))) return VERR_INVALID_PARAMETER;
     
    659659        if (pParam->fUse & DISUSE_REG_GEN32)
    660660        {
    661             pParamVal->flags |= PARAM_VAL32;
     661            pParamVal->flags |= DISQPV_FLAG_32;
    662662            pParamVal->size   = sizeof(uint32_t);
    663663            if (RT_FAILURE(DISFetchReg32(pCtx, pParam->base.reg_gen, &pParamVal->val.val32))) return VERR_INVALID_PARAMETER;
     
    666666        if (pParam->fUse & DISUSE_REG_GEN64)
    667667        {
    668             pParamVal->flags |= PARAM_VAL64;
     668            pParamVal->flags |= DISQPV_FLAG_64;
    669669            pParamVal->size   = sizeof(uint64_t);
    670670            if (RT_FAILURE(DISFetchReg64(pCtx, pParam->base.reg_gen, &pParamVal->val.val64))) return VERR_INVALID_PARAMETER;
     
    673673        {
    674674            // Caller needs to interpret the register according to the instruction (source/target, special value etc)
    675             pParamVal->type = PARMTYPE_REGISTER;
     675            pParamVal->type = DISQPV_TYPE_REGISTER;
    676676        }
    677677        Assert(!(pParam->fUse & DISUSE_IMMEDIATE));
     
    681681    if (pParam->fUse & DISUSE_IMMEDIATE)
    682682    {
    683         pParamVal->type = PARMTYPE_IMMEDIATE;
     683        pParamVal->type = DISQPV_TYPE_IMMEDIATE;
    684684        if (pParam->fUse & (DISUSE_IMMEDIATE8|DISUSE_IMMEDIATE8_REL))
    685685        {
    686             pParamVal->flags |= PARAM_VAL8;
     686            pParamVal->flags |= DISQPV_FLAG_8;
    687687            if (pParam->cb == 2)
    688688            {
     
    699699        if (pParam->fUse & (DISUSE_IMMEDIATE16|DISUSE_IMMEDIATE16_REL|DISUSE_IMMEDIATE_ADDR_0_16|DISUSE_IMMEDIATE16_SX8))
    700700        {
    701             pParamVal->flags |= PARAM_VAL16;
     701            pParamVal->flags |= DISQPV_FLAG_16;
    702702            pParamVal->size   = sizeof(uint16_t);
    703703            pParamVal->val.val16 = (uint16_t)pParam->parval;
     
    707707        if (pParam->fUse & (DISUSE_IMMEDIATE32|DISUSE_IMMEDIATE32_REL|DISUSE_IMMEDIATE_ADDR_0_32|DISUSE_IMMEDIATE32_SX8))
    708708        {
    709             pParamVal->flags |= PARAM_VAL32;
     709            pParamVal->flags |= DISQPV_FLAG_32;
    710710            pParamVal->size   = sizeof(uint32_t);
    711711            pParamVal->val.val32 = (uint32_t)pParam->parval;
     
    715715        if (pParam->fUse & (DISUSE_IMMEDIATE64 | DISUSE_IMMEDIATE64_REL | DISUSE_IMMEDIATE64_SX8))
    716716        {
    717             pParamVal->flags |= PARAM_VAL64;
     717            pParamVal->flags |= DISQPV_FLAG_64;
    718718            pParamVal->size   = sizeof(uint64_t);
    719719            pParamVal->val.val64 = pParam->parval;
     
    723723        if (pParam->fUse & (DISUSE_IMMEDIATE_ADDR_16_16))
    724724        {
    725             pParamVal->flags |= PARAM_VALFARPTR16;
     725            pParamVal->flags |= DISQPV_FLAG_FARPTR16;
    726726            pParamVal->size   = sizeof(uint16_t)*2;
    727727            pParamVal->val.farptr.sel    = (uint16_t)RT_LOWORD(pParam->parval >> 16);
     
    732732        if (pParam->fUse & (DISUSE_IMMEDIATE_ADDR_16_32))
    733733        {
    734             pParamVal->flags |= PARAM_VALFARPTR32;
     734            pParamVal->flags |= DISQPV_FLAG_FARPTR32;
    735735            pParamVal->size   = sizeof(uint16_t) + sizeof(uint32_t);
    736736            pParamVal->val.farptr.sel    = (uint16_t)RT_LOWORD(pParam->parval >> 32);
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r41728 r41729  
    805805static int emInterpretXchg(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
    806806{
    807     OP_PARAMVAL param1, param2;
     807    DISQPVPARAMVAL param1, param2;
    808808    NOREF(pvFault);
    809809
    810810    /* Source to make DISQueryParamVal read the register value - ugly hack */
    811     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_SOURCE);
     811    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_SRC);
    812812    if(RT_FAILURE(rc))
    813813        return VERR_EM_INTERPRETER;
    814814
    815     rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, PARAM_SOURCE);
     815    rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, DISQPVWHICH_SRC);
    816816    if(RT_FAILURE(rc))
    817817        return VERR_EM_INTERPRETER;
     
    829829            switch(param1.type)
    830830            {
    831             case PARMTYPE_IMMEDIATE: /* register type is translated to this one too */
     831            case DISQPV_TYPE_IMMEDIATE: /* register type is translated to this one too */
    832832                valpar1 = param1.val.val64;
    833833                break;
    834834
    835             case PARMTYPE_ADDRESS:
     835            case DISQPV_TYPE_ADDRESS:
    836836                pParam1 = (RTGCPTR)param1.val.val64;
    837837                pParam1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, pParam1);
     
    852852            switch(param2.type)
    853853            {
    854             case PARMTYPE_ADDRESS:
     854            case DISQPV_TYPE_ADDRESS:
    855855                pParam2 = (RTGCPTR)param2.val.val64;
    856856                pParam2 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param2, pParam2);
     
    863863                break;
    864864
    865             case PARMTYPE_IMMEDIATE:
     865            case DISQPV_TYPE_IMMEDIATE:
    866866                valpar2 = param2.val.val64;
    867867                break;
     
    875875            if (pParam1 == 0)
    876876            {
    877                 Assert(param1.type == PARMTYPE_IMMEDIATE); /* register actually */
     877                Assert(param1.type == DISQPV_TYPE_IMMEDIATE); /* register actually */
    878878                switch(param1.size)
    879879                {
     
    901901            if (pParam2 == 0)
    902902            {
    903                 Assert(param2.type == PARMTYPE_IMMEDIATE); /* register actually */
     903                Assert(param2.type == DISQPV_TYPE_IMMEDIATE); /* register actually */
    904904                switch(param2.size)
    905905                {
     
    940940                             PFNEMULATEPARAM2 pfnEmulate)
    941941{
    942     OP_PARAMVAL param1;
     942    DISQPVPARAMVAL param1;
    943943    NOREF(pvFault);
    944944
    945     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_DEST);
     945    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_DST);
    946946    if(RT_FAILURE(rc))
    947947        return VERR_EM_INTERPRETER;
     
    956956            uint64_t valpar1;
    957957
    958             if (param1.type == PARMTYPE_ADDRESS)
     958            if (param1.type == DISQPV_TYPE_ADDRESS)
    959959            {
    960960                pParam1 = (RTGCPTR)param1.val.val64;
     
    10101010{
    10111011    Assert(pDis->mode != DISCPUMODE_64BIT);    /** @todo check */
    1012     OP_PARAMVAL param1;
     1012    DISQPVPARAMVAL param1;
    10131013    NOREF(pvFault);
    10141014
    1015     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_DEST);
     1015    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_DST);
    10161016    if(RT_FAILURE(rc))
    10171017        return VERR_EM_INTERPRETER;
     
    10431043            }
    10441044
    1045             if (param1.type == PARMTYPE_ADDRESS)
     1045            if (param1.type == DISQPV_TYPE_ADDRESS)
    10461046            {
    10471047                pParam1 = (RTGCPTR)param1.val.val64;
     
    10921092                               PFNEMULATEPARAM3 pfnEmulate)
    10931093{
    1094     OP_PARAMVAL param1, param2;
     1094    DISQPVPARAMVAL param1, param2;
    10951095    NOREF(pvFault);
    10961096
    1097     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_DEST);
     1097    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_DST);
    10981098    if(RT_FAILURE(rc))
    10991099        return VERR_EM_INTERPRETER;
    11001100
    1101     rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, PARAM_SOURCE);
     1101    rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, DISQPVWHICH_SRC);
    11021102    if(RT_FAILURE(rc))
    11031103        return VERR_EM_INTERPRETER;
     
    11251125
    11261126            /* The destination is always a virtual address */
    1127             if (param1.type == PARMTYPE_ADDRESS)
     1127            if (param1.type == DISQPV_TYPE_ADDRESS)
    11281128            {
    11291129                pParam1 = (RTGCPTR)param1.val.val64;
     
    11461146            switch(param2.type)
    11471147            {
    1148             case PARMTYPE_IMMEDIATE:    /* both immediate data and register (ugly) */
     1148            case DISQPV_TYPE_IMMEDIATE:    /* both immediate data and register (ugly) */
    11491149                valpar2 = param2.val.val64;
    11501150                break;
     
    11891189{
    11901190    void *pvParam1;
    1191     OP_PARAMVAL param1, param2;
     1191    DISQPVPARAMVAL param1, param2;
    11921192    NOREF(pvFault);
    11931193
     
    11961196#endif
    11971197
    1198     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_DEST);
     1198    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_DST);
    11991199    if(RT_FAILURE(rc))
    12001200        return VERR_EM_INTERPRETER;
    12011201
    1202     rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, PARAM_SOURCE);
     1202    rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, DISQPVWHICH_SRC);
    12031203    if(RT_FAILURE(rc))
    12041204        return VERR_EM_INTERPRETER;
     
    12221222#endif
    12231223
    1224     /* Register and immediate data == PARMTYPE_IMMEDIATE */
    1225     AssertReturn(param2.type == PARMTYPE_IMMEDIATE, VERR_EM_INTERPRETER);
     1224    /* Register and immediate data == DISQPV_TYPE_IMMEDIATE */
     1225    AssertReturn(param2.type == DISQPV_TYPE_IMMEDIATE, VERR_EM_INTERPRETER);
    12261226    RTGCUINTREG ValPar2 = param2.val.val64;
    12271227
    12281228    /* The destination is always a virtual address */
    1229     AssertReturn(param1.type == PARMTYPE_ADDRESS, VERR_EM_INTERPRETER);
     1229    AssertReturn(param1.type == DISQPV_TYPE_ADDRESS, VERR_EM_INTERPRETER);
    12301230
    12311231    RTGCPTR GCPtrPar1 = param1.val.val64;
     
    12631263{
    12641264    NOREF(pvFault);
    1265     OP_PARAMVAL param1, param2;
    1266     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_DEST);
     1265    DISQPVPARAMVAL param1, param2;
     1266    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_DST);
    12671267    if(RT_FAILURE(rc))
    12681268        return VERR_EM_INTERPRETER;
    12691269
    1270     rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, PARAM_SOURCE);
     1270    rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, DISQPVWHICH_SRC);
    12711271    if(RT_FAILURE(rc))
    12721272        return VERR_EM_INTERPRETER;
     
    12941294
    12951295            /* The destination is always a virtual address */
    1296             if (param1.type == PARMTYPE_ADDRESS)
     1296            if (param1.type == DISQPV_TYPE_ADDRESS)
    12971297            {
    12981298                pParam1 = (RTGCPTR)param1.val.val64;
     
    13171317            switch(param2.type)
    13181318            {
    1319             case PARMTYPE_IMMEDIATE:    /* both immediate data and register (ugly) */
     1319            case DISQPV_TYPE_IMMEDIATE:    /* both immediate data and register (ugly) */
    13201320                valpar2 = param2.val.val64;
    13211321                break;
     
    13671367                              PFNEMULATEPARAM2UINT32 pfnEmulate)
    13681368{
    1369     OP_PARAMVAL param1, param2;
    1370     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_DEST);
     1369    DISQPVPARAMVAL param1, param2;
     1370    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_DST);
    13711371    if(RT_FAILURE(rc))
    13721372        return VERR_EM_INTERPRETER;
    13731373
    1374     rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, PARAM_SOURCE);
     1374    rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, DISQPVWHICH_SRC);
    13751375    if(RT_FAILURE(rc))
    13761376        return VERR_EM_INTERPRETER;
     
    13871387
    13881388            /* The destination is always a virtual address */
    1389             if (param1.type != PARMTYPE_ADDRESS)
     1389            if (param1.type != DISQPV_TYPE_ADDRESS)
    13901390                return VERR_EM_INTERPRETER;
    13911391
     
    13961396            switch(param2.type)
    13971397            {
    1398             case PARMTYPE_IMMEDIATE:    /* both immediate data and register (ugly) */
     1398            case DISQPV_TYPE_IMMEDIATE:    /* both immediate data and register (ugly) */
    13991399                valpar2 = param2.val.val64;
    14001400                break;
     
    14491449    void *pvParam1;
    14501450
    1451     OP_PARAMVAL param1, param2;
    1452     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_DEST);
     1451    DISQPVPARAMVAL param1, param2;
     1452    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_DST);
    14531453    if(RT_FAILURE(rc))
    14541454        return VERR_EM_INTERPRETER;
    14551455
    1456     rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, PARAM_SOURCE);
     1456    rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, DISQPVWHICH_SRC);
    14571457    if(RT_FAILURE(rc))
    14581458        return VERR_EM_INTERPRETER;
    14591459
    14601460    /* The destination is always a virtual address */
    1461     if (param1.type != PARMTYPE_ADDRESS)
    1462         return VERR_EM_INTERPRETER;
    1463 
    1464     /* Register and immediate data == PARMTYPE_IMMEDIATE */
    1465     AssertReturn(param2.type == PARMTYPE_IMMEDIATE, VERR_EM_INTERPRETER);
     1461    if (param1.type != DISQPV_TYPE_ADDRESS)
     1462        return VERR_EM_INTERPRETER;
     1463
     1464    /* Register and immediate data == DISQPV_TYPE_IMMEDIATE */
     1465    AssertReturn(param2.type == DISQPV_TYPE_IMMEDIATE, VERR_EM_INTERPRETER);
    14661466    uint64_t ValPar2 = param2.val.val64;
    14671467
     
    15111511{
    15121512    NOREF(pvFault);
    1513     OP_PARAMVAL param1, param2;
    1514     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_DEST);
     1513    DISQPVPARAMVAL param1, param2;
     1514    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_DST);
    15151515    if(RT_FAILURE(rc))
    15161516        return VERR_EM_INTERPRETER;
    15171517
    1518     rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, PARAM_SOURCE);
     1518    rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, DISQPVWHICH_SRC);
    15191519    if(RT_FAILURE(rc))
    15201520        return VERR_EM_INTERPRETER;
     
    15271527#else
    15281528        /** @todo Make this the default and don't rely on TRPM information. */
    1529         if (param1.type == PARMTYPE_ADDRESS)
     1529        if (param1.type == DISQPV_TYPE_ADDRESS)
    15301530        {
    15311531#endif
     
    15351535            switch(param1.type)
    15361536            {
    1537             case PARMTYPE_IMMEDIATE:
    1538                 if(!(param1.flags  & (PARAM_VAL32|PARAM_VAL64)))
     1537            case DISQPV_TYPE_IMMEDIATE:
     1538                if(!(param1.flags  & (DISQPV_FLAG_32|DISQPV_FLAG_64)))
    15391539                    return VERR_EM_INTERPRETER;
    15401540                /* fallthru */
    15411541
    1542             case PARMTYPE_ADDRESS:
     1542            case DISQPV_TYPE_ADDRESS:
    15431543                pDest = (RTGCPTR)param1.val.val64;
    15441544                pDest = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, pDest);
     
    15521552            switch(param2.type)
    15531553            {
    1554             case PARMTYPE_IMMEDIATE: /* register type is translated to this one too */
     1554            case DISQPV_TYPE_IMMEDIATE: /* register type is translated to this one too */
    15551555                val64 = param2.val.val64;
    15561556                break;
     
    15831583            switch(param2.type)
    15841584            {
    1585             case PARMTYPE_IMMEDIATE:
    1586                 if(!(param2.flags & (PARAM_VAL32|PARAM_VAL64)))
     1585            case DISQPV_TYPE_IMMEDIATE:
     1586                if(!(param2.flags & (DISQPV_FLAG_32|DISQPV_FLAG_64)))
    15871587                    return VERR_EM_INTERPRETER;
    15881588                /* fallthru */
    15891589
    1590             case PARMTYPE_ADDRESS:
     1590            case DISQPV_TYPE_ADDRESS:
    15911591                pSrc = (RTGCPTR)param2.val.val64;
    15921592                pSrc = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param2, pSrc);
     
    16061606            switch(param1.type)
    16071607            {
    1608             case PARMTYPE_REGISTER:
     1608            case DISQPV_TYPE_REGISTER:
    16091609                switch(param1.size)
    16101610                {
     
    17991799static int emInterpretCmpXchg(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
    18001800{
    1801     OP_PARAMVAL param1, param2;
     1801    DISQPVPARAMVAL param1, param2;
    18021802    NOREF(pvFault);
    18031803
     
    18071807
    18081808    /* Source to make DISQueryParamVal read the register value - ugly hack */
    1809     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_SOURCE);
     1809    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_SRC);
    18101810    if(RT_FAILURE(rc))
    18111811        return VERR_EM_INTERPRETER;
    18121812
    1813     rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, PARAM_SOURCE);
     1813    rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, &param2, DISQPVWHICH_SRC);
    18141814    if(RT_FAILURE(rc))
    18151815        return VERR_EM_INTERPRETER;
     
    18181818    switch(param2.type)
    18191819    {
    1820     case PARMTYPE_IMMEDIATE: /* register actually */
     1820    case DISQPV_TYPE_IMMEDIATE: /* register actually */
    18211821        valpar = param2.val.val64;
    18221822        break;
     
    18341834    switch(param1.type)
    18351835    {
    1836     case PARMTYPE_ADDRESS:
     1836    case DISQPV_TYPE_ADDRESS:
    18371837        GCPtrPar1 = param1.val.val64;
    18381838        GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, GCPtrPar1);
     
    18711871{
    18721872    Assert(pDis->mode != DISCPUMODE_64BIT);    /** @todo check */
    1873     OP_PARAMVAL param1;
     1873    DISQPVPARAMVAL param1;
    18741874    NOREF(pvFault);
    18751875
    18761876    /* Source to make DISQueryParamVal read the register value - ugly hack */
    1877     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_SOURCE);
     1877    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_SRC);
    18781878    if(RT_FAILURE(rc))
    18791879        return VERR_EM_INTERPRETER;
     
    18871887    switch(param1.type)
    18881888    {
    1889     case PARMTYPE_ADDRESS:
     1889    case DISQPV_TYPE_ADDRESS:
    18901890        GCPtrPar1 = param1.val.val64;
    18911891        GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, GCPtrPar1);
     
    19251925{
    19261926    Assert(pDis->mode != DISCPUMODE_64BIT);    /** @todo check */
    1927     OP_PARAMVAL param1;
     1927    DISQPVPARAMVAL param1;
    19281928    void *pvParamReg2;
    19291929    size_t cbParamReg2;
     
    19311931
    19321932    /* Source to make DISQueryParamVal read the register value - ugly hack */
    1933     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_SOURCE);
     1933    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_SRC);
    19341934    if(RT_FAILURE(rc))
    19351935        return VERR_EM_INTERPRETER;
     
    19541954            switch(param1.type)
    19551955            {
    1956             case PARMTYPE_ADDRESS:
     1956            case DISQPV_TYPE_ADDRESS:
    19571957                GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, (RTRCUINTPTR)param1.val.val64);
    19581958#ifdef IN_RC
     
    20502050static VBOXSTRICTRC emInterpretInvlPg(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
    20512051{
    2052     OP_PARAMVAL param1;
     2052    DISQPVPARAMVAL param1;
    20532053    RTGCPTR     addr;
    20542054    NOREF(pvFault); NOREF(pVM); NOREF(pcbSize);
    20552055
    2056     VBOXSTRICTRC rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_SOURCE);
     2056    VBOXSTRICTRC rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_SRC);
    20572057    if(RT_FAILURE(rc))
    20582058        return VERR_EM_INTERPRETER;
     
    20602060    switch(param1.type)
    20612061    {
    2062     case PARMTYPE_IMMEDIATE:
    2063     case PARMTYPE_ADDRESS:
    2064         if(!(param1.flags  & (PARAM_VAL32|PARAM_VAL64)))
     2062    case DISQPV_TYPE_IMMEDIATE:
     2063    case DISQPV_TYPE_ADDRESS:
     2064        if(!(param1.flags  & (DISQPV_FLAG_32|DISQPV_FLAG_64)))
    20652065            return VERR_EM_INTERPRETER;
    20662066        addr = (RTGCPTR)param1.val.val64;
     
    23852385static int emInterpretLmsw(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
    23862386{
    2387     OP_PARAMVAL param1;
     2387    DISQPVPARAMVAL param1;
    23882388    uint32_t    val;
    23892389    NOREF(pvFault); NOREF(pcbSize);
    23902390
    2391     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_SOURCE);
     2391    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_SRC);
    23922392    if(RT_FAILURE(rc))
    23932393        return VERR_EM_INTERPRETER;
     
    23952395    switch(param1.type)
    23962396    {
    2397     case PARMTYPE_IMMEDIATE:
    2398     case PARMTYPE_ADDRESS:
    2399         if(!(param1.flags  & PARAM_VAL16))
     2397    case DISQPV_TYPE_IMMEDIATE:
     2398    case DISQPV_TYPE_ADDRESS:
     2399        if(!(param1.flags  & DISQPV_FLAG_16))
    24002400            return VERR_EM_INTERPRETER;
    24012401        val = param1.val.val32;
     
    24162416static int emInterpretSmsw(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
    24172417{
    2418     OP_PARAMVAL param1;
     2418    DISQPVPARAMVAL param1;
    24192419    uint64_t    cr0 = CPUMGetGuestCR0(pVCpu);
    24202420
    2421     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_SOURCE);
     2421    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_SRC);
    24222422    if(RT_FAILURE(rc))
    24232423        return VERR_EM_INTERPRETER;
     
    24252425    switch(param1.type)
    24262426    {
    2427     case PARMTYPE_IMMEDIATE:
     2427    case DISQPV_TYPE_IMMEDIATE:
    24282428        if(param1.size != sizeof(uint16_t))
    24292429            return VERR_EM_INTERPRETER;
     
    24322432        break;
    24332433
    2434     case PARMTYPE_ADDRESS:
     2434    case DISQPV_TYPE_ADDRESS:
    24352435    {
    24362436        RTGCPTR pParam1;
     
    25792579static int emInterpretLLdt(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
    25802580{
    2581     OP_PARAMVAL param1;
     2581    DISQPVPARAMVAL param1;
    25822582    RTSEL       sel;
    25832583    NOREF(pVM); NOREF(pvFault); NOREF(pcbSize);
    25842584
    2585     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_SOURCE);
     2585    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_SRC);
    25862586    if(RT_FAILURE(rc))
    25872587        return VERR_EM_INTERPRETER;
     
    25892589    switch(param1.type)
    25902590    {
    2591     case PARMTYPE_ADDRESS:
     2591    case DISQPV_TYPE_ADDRESS:
    25922592        return VERR_EM_INTERPRETER; //feeling lazy right now
    25932593
    2594     case PARMTYPE_IMMEDIATE:
    2595         if(!(param1.flags  & PARAM_VAL16))
     2594    case DISQPV_TYPE_IMMEDIATE:
     2595        if(!(param1.flags  & DISQPV_FLAG_16))
    25962596            return VERR_EM_INTERPRETER;
    25972597        sel = (RTSEL)param1.val.val16;
     
    26272627static int emInterpretLIGdt(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
    26282628{
    2629     OP_PARAMVAL param1;
     2629    DISQPVPARAMVAL param1;
    26302630    RTGCPTR     pParam1;
    26312631    X86XDTR32   dtr32;
     
    26372637    AssertReturn(CPUMIsGuestInRealMode(pVCpu), VERR_EM_INTERPRETER);
    26382638
    2639     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, PARAM_SOURCE);
     2639    int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, &param1, DISQPVWHICH_SRC);
    26402640    if(RT_FAILURE(rc))
    26412641        return VERR_EM_INTERPRETER;
     
    26432643    switch(param1.type)
    26442644    {
    2645     case PARMTYPE_ADDRESS:
     2645    case DISQPV_TYPE_ADDRESS:
    26462646        pParam1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, param1.val.val16);
    26472647        break;
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r41692 r41729  
    29192919static int hmR0svmInterpretInvlPg(PVMCPU pVCpu, PDISCPUSTATE pCpu, PCPUMCTXCORE pRegFrame, uint32_t uASID)
    29202920{
    2921     OP_PARAMVAL param1;
     2921    DISQPVPARAMVAL param1;
    29222922    RTGCPTR     addr;
    29232923    NOREF(uASID);
    29242924
    2925     int rc = DISQueryParamVal(pRegFrame, pCpu, &pCpu->param1, &param1, PARAM_SOURCE);
    2926     if(RT_FAILURE(rc))
     2925    int rc = DISQueryParamVal(pRegFrame, pCpu, &pCpu->param1, &param1, DISQPVWHICH_SRC);
     2926    if (RT_FAILURE(rc))
    29272927        return VERR_EM_INTERPRETER;
    29282928
    2929     switch(param1.type)
    2930     {
    2931         case PARMTYPE_IMMEDIATE:
    2932         case PARMTYPE_ADDRESS:
    2933             if(!(param1.flags & (PARAM_VAL32|PARAM_VAL64)))
     2929    switch (param1.type)
     2930    {
     2931        case DISQPV_TYPE_IMMEDIATE:
     2932        case DISQPV_TYPE_ADDRESS:
     2933            if (!(param1.flags & (DISQPV_FLAG_32 | DISQPV_FLAG_64)))
    29342934                return VERR_EM_INTERPRETER;
    29352935            addr = param1.val.val64;
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