Changeset 41729 in vbox
- Timestamp:
- Jun 14, 2012 11:24:17 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r41728 r41729 382 382 /** @} */ 383 383 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 /** @} */ 397 401 398 402 typedef struct 399 403 { 400 uint32_t type;401 uint32_t size;402 uint64_t flags;403 404 404 union 405 405 { … … 416 416 } val; 417 417 418 } OP_PARAMVAL; 418 uint8_t type; 419 uint8_t size; 420 uint8_t flags; 421 } DISQPVPARAMVAL; 419 422 /** Pointer to opcode parameter value. */ 420 typedef OP_PARAMVAL *POP_PARAMVAL; 421 422 typedef enum 423 typedef DISQPVPARAMVAL *PDISQPVPARAMVAL; 424 425 /** Indicates which parameter DISQueryParamVal should operate on. */ 426 typedef enum DISQPVWHICH 423 427 { 424 PARAM_DEST,425 PARAM_SOURCE426 } PARAM_TYPE; 427 428 /** @} */ 428 DISQPVWHICH_DST = 1, 429 DISQPVWHICH_SRC, 430 DISQPVWHAT_32_BIT_HACK = 0x7fffffff 431 } DISQPVWHICH; 432 429 433 430 434 /** … … 649 653 DISDECL(uint8_t) DISQuerySegPrefixByte(PDISCPUSTATE pCpu); 650 654 651 DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, P OP_PARAMVAL pParamVal, PARAM_TYPEparmtype);655 DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, PDISQPVPARAMVAL pParamVal, DISQPVWHICH parmtype); 652 656 DISDECL(int) DISQueryParamRegPtr(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, void **ppReg, size_t *pcbSize); 653 657 -
trunk/src/VBox/Disassembler/DisasmReg.cpp
r41727 r41729 500 500 * 501 501 */ 502 DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, P OP_PARAMVAL pParamVal, PARAM_TYPEparmtype)502 DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, PDISQPVPARAMVAL pParamVal, DISQPVWHICH parmtype) 503 503 { 504 504 memset(pParamVal, 0, sizeof(*pParamVal)); … … 507 507 { 508 508 // Effective address 509 pParamVal->type = PARMTYPE_ADDRESS;509 pParamVal->type = DISQPV_TYPE_ADDRESS; 510 510 pParamVal->size = pParam->cb; 511 511 … … 514 514 if (pParam->fUse & DISUSE_REG_GEN8) 515 515 { 516 pParamVal->flags |= PARAM_VAL8;516 pParamVal->flags |= DISQPV_FLAG_8; 517 517 if (RT_FAILURE(DISFetchReg8(pCtx, pParam->base.reg_gen, &pParamVal->val.val8))) return VERR_INVALID_PARAMETER; 518 518 } … … 520 520 if (pParam->fUse & DISUSE_REG_GEN16) 521 521 { 522 pParamVal->flags |= PARAM_VAL16;522 pParamVal->flags |= DISQPV_FLAG_16; 523 523 if (RT_FAILURE(DISFetchReg16(pCtx, pParam->base.reg_gen, &pParamVal->val.val16))) return VERR_INVALID_PARAMETER; 524 524 } … … 526 526 if (pParam->fUse & DISUSE_REG_GEN32) 527 527 { 528 pParamVal->flags |= PARAM_VAL32;528 pParamVal->flags |= DISQPV_FLAG_32; 529 529 if (RT_FAILURE(DISFetchReg32(pCtx, pParam->base.reg_gen, &pParamVal->val.val32))) return VERR_INVALID_PARAMETER; 530 530 } … … 532 532 if (pParam->fUse & DISUSE_REG_GEN64) 533 533 { 534 pParamVal->flags |= PARAM_VAL64;534 pParamVal->flags |= DISQPV_FLAG_64; 535 535 if (RT_FAILURE(DISFetchReg64(pCtx, pParam->base.reg_gen, &pParamVal->val.val64))) return VERR_INVALID_PARAMETER; 536 536 } … … 548 548 uint16_t val16; 549 549 550 pParamVal->flags |= PARAM_VAL16;550 pParamVal->flags |= DISQPV_FLAG_16; 551 551 if (RT_FAILURE(DISFetchReg16(pCtx, pParam->index.reg_gen, &val16))) return VERR_INVALID_PARAMETER; 552 552 … … 560 560 uint32_t val32; 561 561 562 pParamVal->flags |= PARAM_VAL32;562 pParamVal->flags |= DISQPV_FLAG_32; 563 563 if (RT_FAILURE(DISFetchReg32(pCtx, pParam->index.reg_gen, &val32))) return VERR_INVALID_PARAMETER; 564 564 … … 573 573 uint64_t val64; 574 574 575 pParamVal->flags |= PARAM_VAL64;575 pParamVal->flags |= DISQPV_FLAG_64; 576 576 if (RT_FAILURE(DISFetchReg64(pCtx, pParam->index.reg_gen, &val64))) return VERR_INVALID_PARAMETER; 577 577 … … 632 632 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)) 633 633 { 634 if (parmtype == PARAM_DEST)634 if (parmtype == DISQPVWHICH_DST) 635 635 { 636 636 // 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; 638 638 pParamVal->size = pParam->cb; 639 639 return VINF_SUCCESS; 640 640 } 641 //else PARAM_SOURCE642 643 pParamVal->type = PARMTYPE_IMMEDIATE;641 //else DISQPVWHICH_SRC 642 643 pParamVal->type = DISQPV_TYPE_IMMEDIATE; 644 644 645 645 if (pParam->fUse & DISUSE_REG_GEN8) 646 646 { 647 pParamVal->flags |= PARAM_VAL8;647 pParamVal->flags |= DISQPV_FLAG_8; 648 648 pParamVal->size = sizeof(uint8_t); 649 649 if (RT_FAILURE(DISFetchReg8(pCtx, pParam->base.reg_gen, &pParamVal->val.val8))) return VERR_INVALID_PARAMETER; … … 652 652 if (pParam->fUse & DISUSE_REG_GEN16) 653 653 { 654 pParamVal->flags |= PARAM_VAL16;654 pParamVal->flags |= DISQPV_FLAG_16; 655 655 pParamVal->size = sizeof(uint16_t); 656 656 if (RT_FAILURE(DISFetchReg16(pCtx, pParam->base.reg_gen, &pParamVal->val.val16))) return VERR_INVALID_PARAMETER; … … 659 659 if (pParam->fUse & DISUSE_REG_GEN32) 660 660 { 661 pParamVal->flags |= PARAM_VAL32;661 pParamVal->flags |= DISQPV_FLAG_32; 662 662 pParamVal->size = sizeof(uint32_t); 663 663 if (RT_FAILURE(DISFetchReg32(pCtx, pParam->base.reg_gen, &pParamVal->val.val32))) return VERR_INVALID_PARAMETER; … … 666 666 if (pParam->fUse & DISUSE_REG_GEN64) 667 667 { 668 pParamVal->flags |= PARAM_VAL64;668 pParamVal->flags |= DISQPV_FLAG_64; 669 669 pParamVal->size = sizeof(uint64_t); 670 670 if (RT_FAILURE(DISFetchReg64(pCtx, pParam->base.reg_gen, &pParamVal->val.val64))) return VERR_INVALID_PARAMETER; … … 673 673 { 674 674 // 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; 676 676 } 677 677 Assert(!(pParam->fUse & DISUSE_IMMEDIATE)); … … 681 681 if (pParam->fUse & DISUSE_IMMEDIATE) 682 682 { 683 pParamVal->type = PARMTYPE_IMMEDIATE;683 pParamVal->type = DISQPV_TYPE_IMMEDIATE; 684 684 if (pParam->fUse & (DISUSE_IMMEDIATE8|DISUSE_IMMEDIATE8_REL)) 685 685 { 686 pParamVal->flags |= PARAM_VAL8;686 pParamVal->flags |= DISQPV_FLAG_8; 687 687 if (pParam->cb == 2) 688 688 { … … 699 699 if (pParam->fUse & (DISUSE_IMMEDIATE16|DISUSE_IMMEDIATE16_REL|DISUSE_IMMEDIATE_ADDR_0_16|DISUSE_IMMEDIATE16_SX8)) 700 700 { 701 pParamVal->flags |= PARAM_VAL16;701 pParamVal->flags |= DISQPV_FLAG_16; 702 702 pParamVal->size = sizeof(uint16_t); 703 703 pParamVal->val.val16 = (uint16_t)pParam->parval; … … 707 707 if (pParam->fUse & (DISUSE_IMMEDIATE32|DISUSE_IMMEDIATE32_REL|DISUSE_IMMEDIATE_ADDR_0_32|DISUSE_IMMEDIATE32_SX8)) 708 708 { 709 pParamVal->flags |= PARAM_VAL32;709 pParamVal->flags |= DISQPV_FLAG_32; 710 710 pParamVal->size = sizeof(uint32_t); 711 711 pParamVal->val.val32 = (uint32_t)pParam->parval; … … 715 715 if (pParam->fUse & (DISUSE_IMMEDIATE64 | DISUSE_IMMEDIATE64_REL | DISUSE_IMMEDIATE64_SX8)) 716 716 { 717 pParamVal->flags |= PARAM_VAL64;717 pParamVal->flags |= DISQPV_FLAG_64; 718 718 pParamVal->size = sizeof(uint64_t); 719 719 pParamVal->val.val64 = pParam->parval; … … 723 723 if (pParam->fUse & (DISUSE_IMMEDIATE_ADDR_16_16)) 724 724 { 725 pParamVal->flags |= PARAM_VALFARPTR16;725 pParamVal->flags |= DISQPV_FLAG_FARPTR16; 726 726 pParamVal->size = sizeof(uint16_t)*2; 727 727 pParamVal->val.farptr.sel = (uint16_t)RT_LOWORD(pParam->parval >> 16); … … 732 732 if (pParam->fUse & (DISUSE_IMMEDIATE_ADDR_16_32)) 733 733 { 734 pParamVal->flags |= PARAM_VALFARPTR32;734 pParamVal->flags |= DISQPV_FLAG_FARPTR32; 735 735 pParamVal->size = sizeof(uint16_t) + sizeof(uint32_t); 736 736 pParamVal->val.farptr.sel = (uint16_t)RT_LOWORD(pParam->parval >> 32); -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r41728 r41729 805 805 static int emInterpretXchg(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 806 806 { 807 OP_PARAMVAL param1, param2;807 DISQPVPARAMVAL param1, param2; 808 808 NOREF(pvFault); 809 809 810 810 /* Source to make DISQueryParamVal read the register value - ugly hack */ 811 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_SOURCE);811 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_SRC); 812 812 if(RT_FAILURE(rc)) 813 813 return VERR_EM_INTERPRETER; 814 814 815 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, PARAM_SOURCE);815 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, DISQPVWHICH_SRC); 816 816 if(RT_FAILURE(rc)) 817 817 return VERR_EM_INTERPRETER; … … 829 829 switch(param1.type) 830 830 { 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 */ 832 832 valpar1 = param1.val.val64; 833 833 break; 834 834 835 case PARMTYPE_ADDRESS:835 case DISQPV_TYPE_ADDRESS: 836 836 pParam1 = (RTGCPTR)param1.val.val64; 837 837 pParam1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, pParam1); … … 852 852 switch(param2.type) 853 853 { 854 case PARMTYPE_ADDRESS:854 case DISQPV_TYPE_ADDRESS: 855 855 pParam2 = (RTGCPTR)param2.val.val64; 856 856 pParam2 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param2, pParam2); … … 863 863 break; 864 864 865 case PARMTYPE_IMMEDIATE:865 case DISQPV_TYPE_IMMEDIATE: 866 866 valpar2 = param2.val.val64; 867 867 break; … … 875 875 if (pParam1 == 0) 876 876 { 877 Assert(param1.type == PARMTYPE_IMMEDIATE); /* register actually */877 Assert(param1.type == DISQPV_TYPE_IMMEDIATE); /* register actually */ 878 878 switch(param1.size) 879 879 { … … 901 901 if (pParam2 == 0) 902 902 { 903 Assert(param2.type == PARMTYPE_IMMEDIATE); /* register actually */903 Assert(param2.type == DISQPV_TYPE_IMMEDIATE); /* register actually */ 904 904 switch(param2.size) 905 905 { … … 940 940 PFNEMULATEPARAM2 pfnEmulate) 941 941 { 942 OP_PARAMVAL param1;942 DISQPVPARAMVAL param1; 943 943 NOREF(pvFault); 944 944 945 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_DEST);945 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_DST); 946 946 if(RT_FAILURE(rc)) 947 947 return VERR_EM_INTERPRETER; … … 956 956 uint64_t valpar1; 957 957 958 if (param1.type == PARMTYPE_ADDRESS)958 if (param1.type == DISQPV_TYPE_ADDRESS) 959 959 { 960 960 pParam1 = (RTGCPTR)param1.val.val64; … … 1010 1010 { 1011 1011 Assert(pDis->mode != DISCPUMODE_64BIT); /** @todo check */ 1012 OP_PARAMVAL param1;1012 DISQPVPARAMVAL param1; 1013 1013 NOREF(pvFault); 1014 1014 1015 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_DEST);1015 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_DST); 1016 1016 if(RT_FAILURE(rc)) 1017 1017 return VERR_EM_INTERPRETER; … … 1043 1043 } 1044 1044 1045 if (param1.type == PARMTYPE_ADDRESS)1045 if (param1.type == DISQPV_TYPE_ADDRESS) 1046 1046 { 1047 1047 pParam1 = (RTGCPTR)param1.val.val64; … … 1092 1092 PFNEMULATEPARAM3 pfnEmulate) 1093 1093 { 1094 OP_PARAMVAL param1, param2;1094 DISQPVPARAMVAL param1, param2; 1095 1095 NOREF(pvFault); 1096 1096 1097 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_DEST);1097 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_DST); 1098 1098 if(RT_FAILURE(rc)) 1099 1099 return VERR_EM_INTERPRETER; 1100 1100 1101 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, PARAM_SOURCE);1101 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, DISQPVWHICH_SRC); 1102 1102 if(RT_FAILURE(rc)) 1103 1103 return VERR_EM_INTERPRETER; … … 1125 1125 1126 1126 /* The destination is always a virtual address */ 1127 if (param1.type == PARMTYPE_ADDRESS)1127 if (param1.type == DISQPV_TYPE_ADDRESS) 1128 1128 { 1129 1129 pParam1 = (RTGCPTR)param1.val.val64; … … 1146 1146 switch(param2.type) 1147 1147 { 1148 case PARMTYPE_IMMEDIATE: /* both immediate data and register (ugly) */1148 case DISQPV_TYPE_IMMEDIATE: /* both immediate data and register (ugly) */ 1149 1149 valpar2 = param2.val.val64; 1150 1150 break; … … 1189 1189 { 1190 1190 void *pvParam1; 1191 OP_PARAMVAL param1, param2;1191 DISQPVPARAMVAL param1, param2; 1192 1192 NOREF(pvFault); 1193 1193 … … 1196 1196 #endif 1197 1197 1198 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_DEST);1198 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_DST); 1199 1199 if(RT_FAILURE(rc)) 1200 1200 return VERR_EM_INTERPRETER; 1201 1201 1202 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, PARAM_SOURCE);1202 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, DISQPVWHICH_SRC); 1203 1203 if(RT_FAILURE(rc)) 1204 1204 return VERR_EM_INTERPRETER; … … 1222 1222 #endif 1223 1223 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); 1226 1226 RTGCUINTREG ValPar2 = param2.val.val64; 1227 1227 1228 1228 /* 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); 1230 1230 1231 1231 RTGCPTR GCPtrPar1 = param1.val.val64; … … 1263 1263 { 1264 1264 NOREF(pvFault); 1265 OP_PARAMVAL param1, param2;1266 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_DEST);1265 DISQPVPARAMVAL param1, param2; 1266 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_DST); 1267 1267 if(RT_FAILURE(rc)) 1268 1268 return VERR_EM_INTERPRETER; 1269 1269 1270 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, PARAM_SOURCE);1270 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, DISQPVWHICH_SRC); 1271 1271 if(RT_FAILURE(rc)) 1272 1272 return VERR_EM_INTERPRETER; … … 1294 1294 1295 1295 /* The destination is always a virtual address */ 1296 if (param1.type == PARMTYPE_ADDRESS)1296 if (param1.type == DISQPV_TYPE_ADDRESS) 1297 1297 { 1298 1298 pParam1 = (RTGCPTR)param1.val.val64; … … 1317 1317 switch(param2.type) 1318 1318 { 1319 case PARMTYPE_IMMEDIATE: /* both immediate data and register (ugly) */1319 case DISQPV_TYPE_IMMEDIATE: /* both immediate data and register (ugly) */ 1320 1320 valpar2 = param2.val.val64; 1321 1321 break; … … 1367 1367 PFNEMULATEPARAM2UINT32 pfnEmulate) 1368 1368 { 1369 OP_PARAMVAL param1, param2;1370 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_DEST);1369 DISQPVPARAMVAL param1, param2; 1370 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_DST); 1371 1371 if(RT_FAILURE(rc)) 1372 1372 return VERR_EM_INTERPRETER; 1373 1373 1374 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, PARAM_SOURCE);1374 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, DISQPVWHICH_SRC); 1375 1375 if(RT_FAILURE(rc)) 1376 1376 return VERR_EM_INTERPRETER; … … 1387 1387 1388 1388 /* The destination is always a virtual address */ 1389 if (param1.type != PARMTYPE_ADDRESS)1389 if (param1.type != DISQPV_TYPE_ADDRESS) 1390 1390 return VERR_EM_INTERPRETER; 1391 1391 … … 1396 1396 switch(param2.type) 1397 1397 { 1398 case PARMTYPE_IMMEDIATE: /* both immediate data and register (ugly) */1398 case DISQPV_TYPE_IMMEDIATE: /* both immediate data and register (ugly) */ 1399 1399 valpar2 = param2.val.val64; 1400 1400 break; … … 1449 1449 void *pvParam1; 1450 1450 1451 OP_PARAMVAL param1, param2;1452 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_DEST);1451 DISQPVPARAMVAL param1, param2; 1452 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_DST); 1453 1453 if(RT_FAILURE(rc)) 1454 1454 return VERR_EM_INTERPRETER; 1455 1455 1456 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, PARAM_SOURCE);1456 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, DISQPVWHICH_SRC); 1457 1457 if(RT_FAILURE(rc)) 1458 1458 return VERR_EM_INTERPRETER; 1459 1459 1460 1460 /* 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); 1466 1466 uint64_t ValPar2 = param2.val.val64; 1467 1467 … … 1511 1511 { 1512 1512 NOREF(pvFault); 1513 OP_PARAMVAL param1, param2;1514 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_DEST);1513 DISQPVPARAMVAL param1, param2; 1514 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_DST); 1515 1515 if(RT_FAILURE(rc)) 1516 1516 return VERR_EM_INTERPRETER; 1517 1517 1518 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, PARAM_SOURCE);1518 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, DISQPVWHICH_SRC); 1519 1519 if(RT_FAILURE(rc)) 1520 1520 return VERR_EM_INTERPRETER; … … 1527 1527 #else 1528 1528 /** @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) 1530 1530 { 1531 1531 #endif … … 1535 1535 switch(param1.type) 1536 1536 { 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))) 1539 1539 return VERR_EM_INTERPRETER; 1540 1540 /* fallthru */ 1541 1541 1542 case PARMTYPE_ADDRESS:1542 case DISQPV_TYPE_ADDRESS: 1543 1543 pDest = (RTGCPTR)param1.val.val64; 1544 1544 pDest = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, pDest); … … 1552 1552 switch(param2.type) 1553 1553 { 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 */ 1555 1555 val64 = param2.val.val64; 1556 1556 break; … … 1583 1583 switch(param2.type) 1584 1584 { 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))) 1587 1587 return VERR_EM_INTERPRETER; 1588 1588 /* fallthru */ 1589 1589 1590 case PARMTYPE_ADDRESS:1590 case DISQPV_TYPE_ADDRESS: 1591 1591 pSrc = (RTGCPTR)param2.val.val64; 1592 1592 pSrc = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param2, pSrc); … … 1606 1606 switch(param1.type) 1607 1607 { 1608 case PARMTYPE_REGISTER:1608 case DISQPV_TYPE_REGISTER: 1609 1609 switch(param1.size) 1610 1610 { … … 1799 1799 static int emInterpretCmpXchg(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 1800 1800 { 1801 OP_PARAMVAL param1, param2;1801 DISQPVPARAMVAL param1, param2; 1802 1802 NOREF(pvFault); 1803 1803 … … 1807 1807 1808 1808 /* Source to make DISQueryParamVal read the register value - ugly hack */ 1809 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_SOURCE);1809 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_SRC); 1810 1810 if(RT_FAILURE(rc)) 1811 1811 return VERR_EM_INTERPRETER; 1812 1812 1813 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, PARAM_SOURCE);1813 rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param2, ¶m2, DISQPVWHICH_SRC); 1814 1814 if(RT_FAILURE(rc)) 1815 1815 return VERR_EM_INTERPRETER; … … 1818 1818 switch(param2.type) 1819 1819 { 1820 case PARMTYPE_IMMEDIATE: /* register actually */1820 case DISQPV_TYPE_IMMEDIATE: /* register actually */ 1821 1821 valpar = param2.val.val64; 1822 1822 break; … … 1834 1834 switch(param1.type) 1835 1835 { 1836 case PARMTYPE_ADDRESS:1836 case DISQPV_TYPE_ADDRESS: 1837 1837 GCPtrPar1 = param1.val.val64; 1838 1838 GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, GCPtrPar1); … … 1871 1871 { 1872 1872 Assert(pDis->mode != DISCPUMODE_64BIT); /** @todo check */ 1873 OP_PARAMVAL param1;1873 DISQPVPARAMVAL param1; 1874 1874 NOREF(pvFault); 1875 1875 1876 1876 /* Source to make DISQueryParamVal read the register value - ugly hack */ 1877 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_SOURCE);1877 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_SRC); 1878 1878 if(RT_FAILURE(rc)) 1879 1879 return VERR_EM_INTERPRETER; … … 1887 1887 switch(param1.type) 1888 1888 { 1889 case PARMTYPE_ADDRESS:1889 case DISQPV_TYPE_ADDRESS: 1890 1890 GCPtrPar1 = param1.val.val64; 1891 1891 GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, GCPtrPar1); … … 1925 1925 { 1926 1926 Assert(pDis->mode != DISCPUMODE_64BIT); /** @todo check */ 1927 OP_PARAMVAL param1;1927 DISQPVPARAMVAL param1; 1928 1928 void *pvParamReg2; 1929 1929 size_t cbParamReg2; … … 1931 1931 1932 1932 /* Source to make DISQueryParamVal read the register value - ugly hack */ 1933 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_SOURCE);1933 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_SRC); 1934 1934 if(RT_FAILURE(rc)) 1935 1935 return VERR_EM_INTERPRETER; … … 1954 1954 switch(param1.type) 1955 1955 { 1956 case PARMTYPE_ADDRESS:1956 case DISQPV_TYPE_ADDRESS: 1957 1957 GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, (RTRCUINTPTR)param1.val.val64); 1958 1958 #ifdef IN_RC … … 2050 2050 static VBOXSTRICTRC emInterpretInvlPg(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 2051 2051 { 2052 OP_PARAMVAL param1;2052 DISQPVPARAMVAL param1; 2053 2053 RTGCPTR addr; 2054 2054 NOREF(pvFault); NOREF(pVM); NOREF(pcbSize); 2055 2055 2056 VBOXSTRICTRC rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_SOURCE);2056 VBOXSTRICTRC rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_SRC); 2057 2057 if(RT_FAILURE(rc)) 2058 2058 return VERR_EM_INTERPRETER; … … 2060 2060 switch(param1.type) 2061 2061 { 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))) 2065 2065 return VERR_EM_INTERPRETER; 2066 2066 addr = (RTGCPTR)param1.val.val64; … … 2385 2385 static int emInterpretLmsw(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 2386 2386 { 2387 OP_PARAMVAL param1;2387 DISQPVPARAMVAL param1; 2388 2388 uint32_t val; 2389 2389 NOREF(pvFault); NOREF(pcbSize); 2390 2390 2391 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_SOURCE);2391 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_SRC); 2392 2392 if(RT_FAILURE(rc)) 2393 2393 return VERR_EM_INTERPRETER; … … 2395 2395 switch(param1.type) 2396 2396 { 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)) 2400 2400 return VERR_EM_INTERPRETER; 2401 2401 val = param1.val.val32; … … 2416 2416 static int emInterpretSmsw(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 2417 2417 { 2418 OP_PARAMVAL param1;2418 DISQPVPARAMVAL param1; 2419 2419 uint64_t cr0 = CPUMGetGuestCR0(pVCpu); 2420 2420 2421 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_SOURCE);2421 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_SRC); 2422 2422 if(RT_FAILURE(rc)) 2423 2423 return VERR_EM_INTERPRETER; … … 2425 2425 switch(param1.type) 2426 2426 { 2427 case PARMTYPE_IMMEDIATE:2427 case DISQPV_TYPE_IMMEDIATE: 2428 2428 if(param1.size != sizeof(uint16_t)) 2429 2429 return VERR_EM_INTERPRETER; … … 2432 2432 break; 2433 2433 2434 case PARMTYPE_ADDRESS:2434 case DISQPV_TYPE_ADDRESS: 2435 2435 { 2436 2436 RTGCPTR pParam1; … … 2579 2579 static int emInterpretLLdt(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 2580 2580 { 2581 OP_PARAMVAL param1;2581 DISQPVPARAMVAL param1; 2582 2582 RTSEL sel; 2583 2583 NOREF(pVM); NOREF(pvFault); NOREF(pcbSize); 2584 2584 2585 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_SOURCE);2585 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_SRC); 2586 2586 if(RT_FAILURE(rc)) 2587 2587 return VERR_EM_INTERPRETER; … … 2589 2589 switch(param1.type) 2590 2590 { 2591 case PARMTYPE_ADDRESS:2591 case DISQPV_TYPE_ADDRESS: 2592 2592 return VERR_EM_INTERPRETER; //feeling lazy right now 2593 2593 2594 case PARMTYPE_IMMEDIATE:2595 if(!(param1.flags & PARAM_VAL16))2594 case DISQPV_TYPE_IMMEDIATE: 2595 if(!(param1.flags & DISQPV_FLAG_16)) 2596 2596 return VERR_EM_INTERPRETER; 2597 2597 sel = (RTSEL)param1.val.val16; … … 2627 2627 static int emInterpretLIGdt(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 2628 2628 { 2629 OP_PARAMVAL param1;2629 DISQPVPARAMVAL param1; 2630 2630 RTGCPTR pParam1; 2631 2631 X86XDTR32 dtr32; … … 2637 2637 AssertReturn(CPUMIsGuestInRealMode(pVCpu), VERR_EM_INTERPRETER); 2638 2638 2639 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, PARAM_SOURCE);2639 int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->param1, ¶m1, DISQPVWHICH_SRC); 2640 2640 if(RT_FAILURE(rc)) 2641 2641 return VERR_EM_INTERPRETER; … … 2643 2643 switch(param1.type) 2644 2644 { 2645 case PARMTYPE_ADDRESS:2645 case DISQPV_TYPE_ADDRESS: 2646 2646 pParam1 = emConvertToFlatAddr(pVM, pRegFrame, pDis, &pDis->param1, param1.val.val16); 2647 2647 break; -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r41692 r41729 2919 2919 static int hmR0svmInterpretInvlPg(PVMCPU pVCpu, PDISCPUSTATE pCpu, PCPUMCTXCORE pRegFrame, uint32_t uASID) 2920 2920 { 2921 OP_PARAMVAL param1;2921 DISQPVPARAMVAL param1; 2922 2922 RTGCPTR addr; 2923 2923 NOREF(uASID); 2924 2924 2925 int rc = DISQueryParamVal(pRegFrame, pCpu, &pCpu->param1, ¶m1, PARAM_SOURCE);2926 if (RT_FAILURE(rc))2925 int rc = DISQueryParamVal(pRegFrame, pCpu, &pCpu->param1, ¶m1, DISQPVWHICH_SRC); 2926 if (RT_FAILURE(rc)) 2927 2927 return VERR_EM_INTERPRETER; 2928 2928 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))) 2934 2934 return VERR_EM_INTERPRETER; 2935 2935 addr = param1.val.val64;
Note:
See TracChangeset
for help on using the changeset viewer.