Changeset 41663 in vbox for trunk/src/VBox/Disassembler
- Timestamp:
- Jun 12, 2012 8:40:22 AM (12 years ago)
- Location:
- trunk/src/VBox/Disassembler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmCore.cpp
r41662 r41663 394 394 { 395 395 size += pCpu->pfnDisasmFnTable[pOp->idxParse1](lpszCodeBlock, pOp, &pCpu->param1, pCpu); 396 if (fFiltered == false) pCpu->param1. size= DISGetParamSize(pCpu, &pCpu->param1);396 if (fFiltered == false) pCpu->param1.cb = DISGetParamSize(pCpu, &pCpu->param1); 397 397 } 398 398 … … 400 400 { 401 401 size += pCpu->pfnDisasmFnTable[pOp->idxParse2](lpszCodeBlock+size, pOp, &pCpu->param2, pCpu); 402 if (fFiltered == false) pCpu->param2. size= DISGetParamSize(pCpu, &pCpu->param2);402 if (fFiltered == false) pCpu->param2.cb = DISGetParamSize(pCpu, &pCpu->param2); 403 403 } 404 404 … … 406 406 { 407 407 size += pCpu->pfnDisasmFnTable[pOp->idxParse3](lpszCodeBlock+size, pOp, &pCpu->param3, pCpu); 408 if (fFiltered == false) pCpu->param3. size= DISGetParamSize(pCpu, &pCpu->param3);408 if (fFiltered == false) pCpu->param3.cb = DISGetParamSize(pCpu, &pCpu->param3); 409 409 } 410 410 // else simple one byte instruction … … 1141 1141 pParam->parval = DISReadByte(pCpu, lpszCodeBlock); 1142 1142 pParam->flags |= USE_IMMEDIATE8; 1143 pParam-> size= sizeof(uint8_t);1143 pParam->cb = sizeof(uint8_t); 1144 1144 1145 1145 disasmAddStringF1(pParam->szParam, "0%02Xh", (uint32_t)pParam->parval); … … 1162 1162 pParam->parval = (uint32_t)(int8_t)DISReadByte(pCpu, lpszCodeBlock); 1163 1163 pParam->flags |= USE_IMMEDIATE32_SX8; 1164 pParam-> size= sizeof(uint32_t);1164 pParam->cb = sizeof(uint32_t); 1165 1165 disasmAddStringF1(pParam->szParam, "0%08Xh", (uint32_t)pParam->parval); 1166 1166 } … … 1170 1170 pParam->parval = (uint64_t)(int8_t)DISReadByte(pCpu, lpszCodeBlock); 1171 1171 pParam->flags |= USE_IMMEDIATE64_SX8; 1172 pParam-> size= sizeof(uint64_t);1172 pParam->cb = sizeof(uint64_t); 1173 1173 disasmAddStringF1(pParam->szParam, "0%016RX64h", pParam->parval); 1174 1174 } … … 1177 1177 pParam->parval = (uint16_t)(int8_t)DISReadByte(pCpu, lpszCodeBlock); 1178 1178 pParam->flags |= USE_IMMEDIATE16_SX8; 1179 pParam-> size= sizeof(uint16_t);1179 pParam->cb = sizeof(uint16_t); 1180 1180 disasmAddStringF1(pParam->szParam, "0%04Xh", (uint16_t)pParam->parval); 1181 1181 } … … 1196 1196 pParam->parval = DISReadWord(pCpu, lpszCodeBlock); 1197 1197 pParam->flags |= USE_IMMEDIATE16; 1198 pParam-> size= sizeof(uint16_t);1198 pParam->cb = sizeof(uint16_t); 1199 1199 1200 1200 disasmAddStringF1(pParam->szParam, "0%04Xh", (uint16_t)pParam->parval); … … 1215 1215 pParam->parval = DISReadDWord(pCpu, lpszCodeBlock); 1216 1216 pParam->flags |= USE_IMMEDIATE32; 1217 pParam-> size= sizeof(uint32_t);1217 pParam->cb = sizeof(uint32_t); 1218 1218 1219 1219 disasmAddStringF1(pParam->szParam, "0%08Xh", (uint32_t)pParam->parval); … … 1234 1234 pParam->parval = DISReadQWord(pCpu, lpszCodeBlock); 1235 1235 pParam->flags |= USE_IMMEDIATE64; 1236 pParam-> size= sizeof(uint64_t);1236 pParam->cb = sizeof(uint64_t); 1237 1237 1238 1238 disasmAddStringF2(pParam->szParam, "0%08X%08Xh", … … 1256 1256 pParam->parval = DISReadDWord(pCpu, lpszCodeBlock); 1257 1257 pParam->flags |= USE_IMMEDIATE32; 1258 pParam-> size= sizeof(uint32_t);1258 pParam->cb = sizeof(uint32_t); 1259 1259 1260 1260 disasmAddStringF1(pParam->szParam, "0%08Xh", (uint32_t)pParam->parval); … … 1266 1266 pParam->parval = DISReadQWord(pCpu, lpszCodeBlock); 1267 1267 pParam->flags |= USE_IMMEDIATE64; 1268 pParam-> size= sizeof(uint64_t);1268 pParam->cb = sizeof(uint64_t); 1269 1269 1270 1270 disasmAddStringF1(pParam->szParam, "0%RX64h", pParam->parval); … … 1275 1275 pParam->parval = DISReadWord(pCpu, lpszCodeBlock); 1276 1276 pParam->flags |= USE_IMMEDIATE16; 1277 pParam-> size= sizeof(uint16_t);1277 pParam->cb = sizeof(uint16_t); 1278 1278 1279 1279 disasmAddStringF1(pParam->szParam, "0%04Xh", (uint32_t)pParam->parval); … … 1302 1302 pParam->parval = DISReadWord(pCpu, lpszCodeBlock); 1303 1303 pParam->flags |= USE_IMMEDIATE16; 1304 pParam-> size= sizeof(uint16_t);1304 pParam->cb = sizeof(uint16_t); 1305 1305 1306 1306 disasmAddStringF1(pParam->szParam, "0%04Xh", (uint32_t)pParam->parval); … … 1314 1314 pParam->parval = (uint64_t)(int32_t)DISReadDWord(pCpu, lpszCodeBlock); 1315 1315 pParam->flags |= USE_IMMEDIATE64; 1316 pParam-> size= sizeof(uint64_t);1316 pParam->cb = sizeof(uint64_t); 1317 1317 disasmAddStringF1(pParam->szParam, "0%RX64h", pParam->parval); 1318 1318 } … … 1321 1321 pParam->parval = DISReadDWord(pCpu, lpszCodeBlock); 1322 1322 pParam->flags |= USE_IMMEDIATE32; 1323 pParam-> size= sizeof(uint32_t);1323 pParam->cb = sizeof(uint32_t); 1324 1324 disasmAddStringF1(pParam->szParam, "0%08Xh", (uint32_t)pParam->parval); 1325 1325 } … … 1346 1346 pParam->parval = DISReadByte(pCpu, lpszCodeBlock); 1347 1347 pParam->flags |= USE_IMMEDIATE8_REL; 1348 pParam-> size= sizeof(uint8_t);1348 pParam->cb = sizeof(uint8_t); 1349 1349 1350 1350 disasmAddStringF1(pParam->szParam, " (0%02Xh)", (uint32_t)pParam->parval); … … 1369 1369 pParam->parval = DISReadDWord(pCpu, lpszCodeBlock); 1370 1370 pParam->flags |= USE_IMMEDIATE32_REL; 1371 pParam-> size= sizeof(int32_t);1371 pParam->cb = sizeof(int32_t); 1372 1372 1373 1373 disasmAddStringF1(pParam->szParam, " (0%08Xh)", (uint32_t)pParam->parval); … … 1380 1380 pParam->parval = (uint64_t)(int32_t)DISReadDWord(pCpu, lpszCodeBlock); 1381 1381 pParam->flags |= USE_IMMEDIATE64_REL; 1382 pParam-> size= sizeof(int64_t);1382 pParam->cb = sizeof(int64_t); 1383 1383 1384 1384 disasmAddStringF1(pParam->szParam, " (0%RX64h)", pParam->parval); … … 1389 1389 pParam->parval = DISReadWord(pCpu, lpszCodeBlock); 1390 1390 pParam->flags |= USE_IMMEDIATE16_REL; 1391 pParam-> size= sizeof(int16_t);1391 pParam->cb = sizeof(int16_t); 1392 1392 1393 1393 disasmAddStringF1(pParam->szParam, " (0%04Xh)", (uint32_t)pParam->parval); … … 1418 1418 *((uint32_t*)&pParam->parval+1) = DISReadWord(pCpu, lpszCodeBlock+sizeof(uint32_t)); 1419 1419 pParam->flags |= USE_IMMEDIATE_ADDR_16_32; 1420 pParam-> size= sizeof(uint16_t) + sizeof(uint32_t);1420 pParam->cb = sizeof(uint16_t) + sizeof(uint32_t); 1421 1421 1422 1422 disasmAddStringF2(pParam->szParam, "0%04X:0%08Xh", (uint32_t)(pParam->parval>>32), (uint32_t)pParam->parval); … … 1431 1431 pParam->uDisp.i32 = DISReadDWord(pCpu, lpszCodeBlock); 1432 1432 pParam->flags |= USE_DISPLACEMENT32; 1433 pParam-> size= sizeof(uint32_t);1433 pParam->cb = sizeof(uint32_t); 1434 1434 1435 1435 disasmAddStringF1(pParam->szParam, "[0%08Xh]", pParam->uDisp.i32); … … 1448 1448 pParam->uDisp.i64 = DISReadQWord(pCpu, lpszCodeBlock); 1449 1449 pParam->flags |= USE_DISPLACEMENT64; 1450 pParam-> size= sizeof(uint64_t);1450 pParam->cb = sizeof(uint64_t); 1451 1451 1452 1452 disasmAddStringF2(pParam->szParam, "[0%08X%08Xh]", (uint32_t)(pParam->uDisp.i64 >> 32), (uint32_t)pParam->uDisp.i64); … … 1459 1459 pParam->parval = DISReadDWord(pCpu, lpszCodeBlock); 1460 1460 pParam->flags |= USE_IMMEDIATE_ADDR_16_16; 1461 pParam-> size= 2*sizeof(uint16_t);1461 pParam->cb = 2*sizeof(uint16_t); 1462 1462 1463 1463 disasmAddStringF2(pParam->szParam, "0%04X:0%04Xh", (uint32_t)(pParam->parval>>16), (uint16_t)pParam->parval ); … … 1472 1472 pParam->uDisp.i16 = DISReadWord(pCpu, lpszCodeBlock); 1473 1473 pParam->flags |= USE_DISPLACEMENT16; 1474 pParam-> size= sizeof(uint16_t);1474 pParam->cb = sizeof(uint16_t); 1475 1475 1476 1476 disasmAddStringF1(pParam->szParam, "[0%04Xh]", (uint32_t)pParam->uDisp.i16); … … 1526 1526 *((uint32_t*)&pParam->parval+1) = DISReadWord(pCpu, lpszCodeBlock+sizeof(uint32_t)); 1527 1527 pParam->flags |= USE_IMMEDIATE_ADDR_16_32; 1528 pParam-> size= sizeof(uint16_t) + sizeof(uint32_t);1528 pParam->cb = sizeof(uint16_t) + sizeof(uint32_t); 1529 1529 1530 1530 disasmAddStringF2(pParam->szParam, "0%04X:0%08Xh", (uint32_t)(pParam->parval>>32), (uint32_t)pParam->parval); … … 1536 1536 pParam->parval = DISReadDWord(pCpu, lpszCodeBlock); 1537 1537 pParam->flags |= USE_IMMEDIATE_ADDR_16_16; 1538 pParam-> size= 2*sizeof(uint16_t);1538 pParam->cb = 2*sizeof(uint16_t); 1539 1539 1540 1540 disasmAddStringF2(pParam->szParam, "0%04X:0%04Xh", (uint32_t)(pParam->parval>>16), (uint16_t)pParam->parval ); … … 1590 1590 pParam->base.reg_gen = pParam->param - OP_PARM_REG_GEN32_START; 1591 1591 pParam->flags |= USE_REG_GEN32; 1592 pParam-> size= 4;1592 pParam->cb = 4; 1593 1593 } 1594 1594 else … … 1604 1604 1605 1605 pParam->flags |= USE_REG_GEN64; 1606 pParam-> size= 8;1606 pParam->cb = 8; 1607 1607 } 1608 1608 else … … 1611 1611 pParam->base.reg_gen = pParam->param - OP_PARM_REG_GEN32_START; 1612 1612 pParam->flags |= USE_REG_GEN16; 1613 pParam-> size= 2;1613 pParam->cb = 2; 1614 1614 pParam->param = pParam->param - OP_PARM_REG_GEN32_START + OP_PARM_REG_GEN16_START; 1615 1615 } … … 1621 1621 pParam->base.reg_seg = (DIS_SELREG)(pParam->param - OP_PARM_REG_SEG_START); 1622 1622 pParam->flags |= USE_REG_SEG; 1623 pParam-> size= 2;1623 pParam->cb = 2; 1624 1624 } 1625 1625 else … … 1629 1629 pParam->base.reg_gen = pParam->param - OP_PARM_REG_GEN16_START; 1630 1630 pParam->flags |= USE_REG_GEN16; 1631 pParam-> size= 2;1631 pParam->cb = 2; 1632 1632 } 1633 1633 else … … 1637 1637 pParam->base.reg_gen = pParam->param - OP_PARM_REG_GEN8_START; 1638 1638 pParam->flags |= USE_REG_GEN8; 1639 pParam-> size= 1;1639 pParam->cb = 1; 1640 1640 1641 1641 if (pCpu->opmode == CPUMODE_64BIT) … … 1654 1654 pParam->base.reg_fp = pParam->param - OP_PARM_REG_FP_START; 1655 1655 pParam->flags |= USE_REG_FP; 1656 pParam-> size= 10;1656 pParam->cb = 10; 1657 1657 } 1658 1658 Assert(!(pParam->param >= OP_PARM_REG_GEN64_START && pParam->param <= OP_PARM_REG_GEN64_END)); -
trunk/src/VBox/Disassembler/DisasmReg.cpp
r41662 r41663 260 260 261 261 default: 262 if (pParam-> size)263 return pParam-> size;262 if (pParam->cb) 263 return pParam->cb; 264 264 else //@todo dangerous!!! 265 265 return 4; … … 523 523 // Effective address 524 524 pParamVal->type = PARMTYPE_ADDRESS; 525 pParamVal->size = pParam-> size;525 pParamVal->size = pParam->cb; 526 526 527 527 if (pParam->flags & USE_BASE) … … 651 651 // Caller needs to interpret the register according to the instruction (source/target, special value etc) 652 652 pParamVal->type = PARMTYPE_REGISTER; 653 pParamVal->size = pParam-> size;653 pParamVal->size = pParam->cb; 654 654 return VINF_SUCCESS; 655 655 } … … 700 700 { 701 701 pParamVal->flags |= PARAM_VAL8; 702 if (pParam-> size== 2)702 if (pParam->cb == 2) 703 703 { 704 704 pParamVal->size = sizeof(uint16_t); … … 717 717 pParamVal->size = sizeof(uint16_t); 718 718 pParamVal->val.val16 = (uint16_t)pParam->parval; 719 AssertMsg(pParamVal->size == pParam-> size || ((pParam->size == 1) && (pParam->flags & USE_IMMEDIATE16_SX8)), ("pParamVal->size %d vs %d EIP=%RX32\n", pParamVal->size, pParam->size, pCtx->eip) );719 AssertMsg(pParamVal->size == pParam->cb || ((pParam->cb == 1) && (pParam->flags & USE_IMMEDIATE16_SX8)), ("pParamVal->size %d vs %d EIP=%RX32\n", pParamVal->size, pParam->cb, pCtx->eip) ); 720 720 } 721 721 else … … 725 725 pParamVal->size = sizeof(uint32_t); 726 726 pParamVal->val.val32 = (uint32_t)pParam->parval; 727 Assert(pParamVal->size == pParam-> size || ((pParam->size== 1) && (pParam->flags & USE_IMMEDIATE32_SX8)) );727 Assert(pParamVal->size == pParam->cb || ((pParam->cb == 1) && (pParam->flags & USE_IMMEDIATE32_SX8)) ); 728 728 } 729 729 else … … 733 733 pParamVal->size = sizeof(uint64_t); 734 734 pParamVal->val.val64 = pParam->parval; 735 Assert(pParamVal->size == pParam-> size || ((pParam->size== 1) && (pParam->flags & USE_IMMEDIATE64_SX8)) );735 Assert(pParamVal->size == pParam->cb || ((pParam->cb == 1) && (pParam->flags & USE_IMMEDIATE64_SX8)) ); 736 736 } 737 737 else … … 742 742 pParamVal->val.farptr.sel = (uint16_t)RT_LOWORD(pParam->parval >> 16); 743 743 pParamVal->val.farptr.offset = (uint32_t)RT_LOWORD(pParam->parval); 744 Assert(pParamVal->size == pParam-> size);744 Assert(pParamVal->size == pParam->cb); 745 745 } 746 746 else … … 751 751 pParamVal->val.farptr.sel = (uint16_t)RT_LOWORD(pParam->parval >> 32); 752 752 pParamVal->val.farptr.offset = (uint32_t)(pParam->parval & 0xFFFFFFFF); 753 Assert(pParam-> size== 8);753 Assert(pParam->cb == 8); 754 754 } 755 755 }
Note:
See TracChangeset
for help on using the changeset viewer.