Changeset 41692 in vbox for trunk/include/VBox
- Timestamp:
- Jun 13, 2012 7:32:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r41690 r41692 27 27 #define ___VBox_dis_h 28 28 29 #include <VBox/cdefs.h>30 29 #include <VBox/types.h> 31 30 #include <VBox/disopcode.h> 31 #include <iprt/assert.h> 32 32 33 33 … … 390 390 * Operand Parameter. 391 391 */ 392 typedef struct OP_PARAMETER392 typedef struct DISOPPARAM 393 393 { 394 394 uint64_t parval; … … 410 410 union 411 411 { 412 uint 32_treg_gen;412 uint8_t reg_gen; 413 413 /** ST(0) - ST(7) */ 414 uint 32_treg_fp;414 uint8_t reg_fp; 415 415 /** MMX0 - MMX7 */ 416 uint 32_treg_mmx;416 uint8_t reg_mmx; 417 417 /** XMM0 - XMM7 */ 418 uint 32_treg_xmm;419 /** {ES, CS, SS, DS, FS, GS} */420 DIS_SELREGreg_seg;418 uint8_t reg_xmm; 419 /** {ES, CS, SS, DS, FS, GS} (DIS_SELREG). */ 420 uint8_t reg_seg; 421 421 /** TR0-TR7 (?) */ 422 uint 32_treg_test;422 uint8_t reg_test; 423 423 /** CR0-CR4 */ 424 uint 32_treg_ctrl;424 uint8_t reg_ctrl; 425 425 /** DR0-DR7 */ 426 uint 32_treg_dbg;426 uint8_t reg_dbg; 427 427 } base; 428 428 union 429 429 { 430 uint 32_treg_gen;430 uint8_t reg_gen; 431 431 } index; 432 432 … … 435 435 /** Parameter size. */ 436 436 uint8_t cb; 437 } OP_PARAMETER; 437 } DISOPPARAM; 438 AssertCompileSize(DISOPPARAM, 32); 438 439 /** Pointer to opcode parameter. */ 439 typedef OP_PARAMETER *POP_PARAMETER;440 typedef DISOPPARAM *PDISOPPARAM; 440 441 /** Pointer to opcode parameter. */ 441 typedef const OP_PARAMETER*PCOP_PARAMETER;442 typedef const DISOPPARAM *PCOP_PARAMETER; 442 443 443 444 … … 462 463 /** Parser callback. 463 464 * @remark no DECLCALLBACK() here because it's considered to be internal (really, I'm too lazy to update all the functions). */ 464 typedef unsigned FNDISPARSE(RTUINTPTR pu8CodeBlock, PCDISOPCODE pOp, P OP_PARAMETERpParam, PDISCPUSTATE pCpu);465 typedef unsigned FNDISPARSE(RTUINTPTR pu8CodeBlock, PCDISOPCODE pOp, PDISOPPARAM pParam, PDISCPUSTATE pCpu); 465 466 typedef FNDISPARSE *PFNDISPARSE; 467 typedef PFNDISPARSE const *PCPFNDISPARSE; 466 468 467 469 typedef struct DISCPUSTATE 468 470 { 469 /** Global setting. */ 470 DISCPUMODE mode; 471 472 /** Per instruction prefix settings. */ 473 uint32_t prefix; /**< @todo change to uint8_t */ 474 /** segment prefix value. */ 475 DIS_SELREG enmPrefixSeg; 476 /** rex prefix value (64 bits only */ 477 uint32_t prefix_rex; /**< @todo change to uint8_t */ 478 /** addressing mode (16 or 32 bits). (CPUMODE_*) */ 479 DISCPUMODE addrmode; 480 /** operand mode (16 or 32 bits). (CPUMODE_*) */ 481 DISCPUMODE opmode; 482 483 OP_PARAMETER param1; 484 OP_PARAMETER param2; 485 OP_PARAMETER param3; 486 487 /** ModRM fields. */ 471 /* Because of apvUserData[1] and apvUserData[2], put the less frequently 472 used bits at the top for now. (Might be better off in the middle?) */ 473 DISOPPARAM param3; 474 DISOPPARAM param2; 475 DISOPPARAM param1; 476 477 /* off: 0x060 (96) */ 478 /** ModRM fields. */ 488 479 union 489 480 { … … 498 489 unsigned u; 499 490 } ModRM; 500 501 491 /** SIB fields. */ 502 492 union … … 512 502 unsigned u; 513 503 } SIB; 514 int32_t i32SibDisp; 515 504 int32_t i32SibDisp; 505 506 /* off: 0x06c (108) */ 507 /** The CPU mode (DISCPUMODE). */ 508 uint8_t mode; 509 /** The addressing mode (DISCPUMODE). */ 510 uint8_t addrmode; 511 /** The operand mode (DISCPUMODE). */ 512 uint8_t opmode; 513 /** Per instruction prefix settings. */ 514 uint8_t prefix; 515 /* off: 0x070 (112) */ 516 /** REX prefix value (64 bits only). */ 517 uint8_t prefix_rex; 518 /** Segment prefix value (DIS_SELREG). */ 519 uint8_t idxSegPrefix; 520 /** Last prefix byte (for SSE2 extension tables). */ 521 uint8_t lastprefix; 522 /** First opcode byte of instruction. */ 523 uint8_t opcode; 524 /* off: 0x074 (116) */ 525 /** The size of the prefix bytes. */ 526 uint8_t cbPrefix; 516 527 /** The instruction size. */ 517 uint32_t opsize; 528 uint8_t opsize; 529 uint8_t abUnused[2]; 530 /* off: 0x078 (120) */ 531 /** Return code set by a worker function like the opcode bytes readers. */ 532 int32_t rc; 533 /** Internal: instruction filter */ 534 uint32_t fFilter; 535 /* off: 0x080 (128) */ 536 /** Internal: pointer to disassembly function table */ 537 PCPFNDISPARSE pfnDisasmFnTable; 538 #if ARCH_BITS == 32 539 uint32_t uPtrPadding1; 540 #endif 541 /** Pointer to the current instruction. */ 542 PCDISOPCODE pCurInstr; 543 #if ARCH_BITS == 32 544 uint32_t uPtrPadding2; 545 #endif 546 /* off: 0x090 (144) */ 518 547 /** The address of the instruction. */ 519 548 RTUINTPTR uInstrAddr; 520 /* * The size of the prefix bytes.*/521 uint8_t cbPrefix;522 523 /** First opcode byte of instruction. */ 524 uint 8_t opcode;525 /** Last prefix byte (for SSE2 extension tables). */ 526 uint8_t lastprefix;549 /* off: 0x098 (152) */ 550 /** Optional read function */ 551 PFNDISREADBYTES pfnReadBytes; 552 #if ARCH_BITS == 32 553 uint32_t uPadding3; 554 #endif 555 /* off: 0x0a0 (160) */ 527 556 /** The instruction bytes. */ 528 557 uint8_t abInstr[16]; 529 530 /** Internal: pointer to disassembly function table */ 531 PFNDISPARSE *pfnDisasmFnTable; 532 /** Internal: instruction filter */ 533 uint32_t fFilter; 534 /** Return code set by a worker function like the opcode bytes readers. */ 535 int32_t rc; 536 537 /** Pointer to the current instruction. */ 538 PCDISOPCODE pCurInstr; 539 #ifndef DIS_CORE_ONLY 540 /** Opcode format string for current instruction. */ 541 const char *pszOpcode; 542 #endif 543 544 /** Optional read function */ 545 PFNDISREADBYTES pfnReadBytes; 558 /* off: 0x0b0 (176) */ 546 559 /** User data slots for the read callback. The first entry is used for the 547 560 * pvUser argument, the rest are up for grabs. 548 561 * @remarks This must come last so that we can memset everything before this. */ 549 562 void *apvUserData[3]; 563 #if ARCH_BITS == 32 564 uint32_t auPadding4[3]; 565 #endif 550 566 } DISCPUSTATE; 551 567 … … 568 584 uint16_t param2; 569 585 uint16_t param3; 570 571 586 uint32_t optype; 572 587 } DISOPCODE; … … 589 604 PDISCPUSTATE pCpu, uint32_t *pcbInstr); 590 605 591 DISDECL(int) DISGetParamSize(PDISCPUSTATE pCpu, P OP_PARAMETERpParam);592 DISDECL(DIS_SELREG) DISDetectSegReg(PDISCPUSTATE pCpu, P OP_PARAMETERpParam);606 DISDECL(int) DISGetParamSize(PDISCPUSTATE pCpu, PDISOPPARAM pParam); 607 DISDECL(DIS_SELREG) DISDetectSegReg(PDISCPUSTATE pCpu, PDISOPPARAM pParam); 593 608 DISDECL(uint8_t) DISQuerySegPrefixByte(PDISCPUSTATE pCpu); 594 609 595 DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, P OP_PARAMETERpParam, POP_PARAMVAL pParamVal, PARAM_TYPE parmtype);596 DISDECL(int) DISQueryParamRegPtr(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, P OP_PARAMETERpParam, void **ppReg, size_t *pcbSize);610 DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, POP_PARAMVAL pParamVal, PARAM_TYPE parmtype); 611 DISDECL(int) DISQueryParamRegPtr(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, PDISOPPARAM pParam, void **ppReg, size_t *pcbSize); 597 612 598 613 DISDECL(int) DISFetchReg8(PCCPUMCTXCORE pCtx, unsigned reg8, uint8_t *pVal);
Note:
See TracChangeset
for help on using the changeset viewer.