Changeset 41658 in vbox for trunk/include/VBox
- Timestamp:
- Jun 11, 2012 10:21:44 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 78464
- Location:
- trunk/include/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r41501 r41658 4 4 5 5 /* 6 * Copyright (C) 2006-20 07Oracle Corporation6 * Copyright (C) 2006-2012 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 370 370 typedef struct OP_PARAMETER 371 371 { 372 /** @todo switch param and parval and move disp64 and flags up here with the other 64-bit vars to get more natural alignment and save space. */373 int param;374 372 uint64_t parval; 375 #ifndef DIS_SEPARATE_FORMATTER 376 char szParam[32];377 #endif 378 379 int32_t disp8 , disp16, disp32;373 uint64_t flags; 374 int64_t disp64; 375 int32_t disp32; 376 int32_t disp16; 377 int32_t disp8; 380 378 uint32_t size; 381 382 int64_t disp64; 383 uint64_t flags; 379 int32_t param; 384 380 385 381 union … … 409 405 uint32_t scale; 410 406 407 #ifndef DIS_SEPARATE_FORMATTER 408 char szParam[32]; 409 #endif 411 410 } OP_PARAMETER; 412 411 /** Pointer to opcode parameter. */ … … 421 420 typedef const struct OPCODE *PCOPCODE; 422 421 423 typedef DECLCALLBACK(int) FN_DIS_READBYTES(RTUINTPTR pSrc, uint8_t *pDest, unsigned size, void *pvUserdata); 424 typedef FN_DIS_READBYTES *PFN_DIS_READBYTES; 422 /** 423 * Callback for reading opcode bytes. 424 * 425 * @param pDisState Pointer to the CPU state. The primary user argument 426 * can be retrived from DISCPUSTATE::apvUserData[0]. If 427 * more is required these can be passed in the 428 * subsequent slots. 429 * @param pbDst Pointer to output buffer. 430 * @param uSrcAddr The address to start reading at. 431 * @param cbToRead The number of bytes to read. 432 */ 433 typedef DECLCALLBACK(int) FNDISREADBYTES(PDISCPUSTATE pDisState, uint8_t *pbDst, RTUINTPTR uSrcAddr, uint32_t cbToRead); 434 /** Pointer to a opcode byte reader. */ 435 typedef FNDISREADBYTES *PFNDISREADBYTES; 425 436 426 437 /** Parser callback. … … 431 442 typedef struct DISCPUSTATE 432 443 { 433 /* Global setting*/444 /** Global setting. */ 434 445 DISCPUMODE mode; 435 446 436 /* Per instruction prefix settings*/447 /** Per instruction prefix settings. */ 437 448 uint32_t prefix; 438 449 /** segment prefix value. */ … … 452 463 union 453 464 { 454 /* Bitfield view */465 /** Bitfield view */ 455 466 struct 456 467 { … … 459 470 unsigned Mod : 2; 460 471 } Bits; 461 /* unsigned view */472 /** unsigned view */ 462 473 unsigned u; 463 474 } ModRM; … … 466 477 union 467 478 { 468 /* Bitfield view */479 /** Bitfield view */ 469 480 struct 470 481 { … … 473 484 unsigned Scale : 2; 474 485 } Bits; 475 /* unsigned view */486 /** unsigned view */ 476 487 unsigned u; 477 488 } SIB; 478 479 int32_t disp; 489 int32_t i32SibDisp; 490 491 /** The instruction size. */ 492 uint32_t opsize; 493 /** The address of the instruction. */ 494 RTUINTPTR uInstrAddr; 495 /** The offsetted address of the instruction. */ 496 RTUINTPTR opaddr; 497 /** The size of the prefix bytes. */ 498 uint8_t cbPrefix; 480 499 481 500 /** First opcode byte of instruction. */ 482 501 uint8_t opcode; 483 /** Last prefix byte (for SSE2 extension tables) */502 /** Last prefix byte (for SSE2 extension tables). */ 484 503 uint8_t lastprefix; 485 RTUINTPTR opaddr; 486 uint32_t opsize; 504 /** The instruction bytes. */ 505 uint8_t abInstr[16]; 506 507 /** Internal: pointer to disassembly function table */ 508 PFNDISPARSE *pfnDisasmFnTable; 509 /** Internal: instruction filter */ 510 uint32_t uFilter; 511 /** Return code set by a worker function like the opcode bytes readers. */ 512 int32_t rc; 513 514 /** Pointer to the current instruction. */ 515 PCOPCODE pCurInstr; 487 516 #ifndef DIS_CORE_ONLY 488 517 /** Opcode format string for current instruction. */ … … 490 519 #endif 491 520 492 /** Internal: pointer to disassembly function table */ 493 PFNDISPARSE *pfnDisasmFnTable; 494 /** Internal: instruction filter */ 495 uint32_t uFilter; 496 497 /** Pointer to the current instruction. */ 498 PCOPCODE pCurInstr; 499 521 /** Optional read function */ 522 PFNDISREADBYTES pfnReadBytes; 523 /** User data slots for the read callback. The first entry is used for the 524 * pvUser argument, the rest are up for grabs. 525 * @remarks This must come last so that we can memset everything before this. */ 500 526 void *apvUserData[3]; 501 502 /** Optional read function */503 PFN_DIS_READBYTES pfnReadBytes;504 #ifdef __L4ENV__505 jmp_buf *pJumpBuffer;506 #endif /* __L4ENV__ */507 527 } DISCPUSTATE; 508 528 … … 531 551 532 552 533 /** 534 * Disassembles a code block. 535 * 536 * @returns VBox error code 537 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 538 * set correctly. 539 * @param pvCodeBlock Pointer to the structure to disassemble. 540 * @param cbMax Maximum number of bytes to disassemble. 541 * @param pcbSize Where to store the size of the instruction. 542 * NULL is allowed. 543 * 544 * 545 * @todo Define output callback. 546 * @todo Using signed integers as sizes is a bit odd. There are still 547 * some GCC warnings about mixing signed and unsigned integers. 548 * @todo Need to extend this interface to include a code address so we 549 * can disassemble GC code. Perhaps a new function is better... 550 * @remark cbMax isn't respected as a boundary. DISInstr() will read beyond cbMax. 551 * This means *pcbSize >= cbMax sometimes. 552 */ 553 DISDECL(int) DISBlock(PDISCPUSTATE pCpu, RTUINTPTR pvCodeBlock, unsigned cbMax, unsigned *pSize); 554 555 /** 556 * Disassembles one instruction 557 * 558 * @returns VBox error code 559 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 560 * set correctly. 561 * @param pu8Instruction Pointer to the instrunction to disassemble. 562 * @param u32EipOffset Offset to add to instruction address to get the real virtual address 563 * @param pcbSize Where to store the size of the instruction. 564 * NULL is allowed. 565 * @param pszOutput Storage for disassembled instruction 566 * 567 * @todo Define output callback. 568 */ 569 DISDECL(int) DISInstr(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, unsigned u32EipOffset, unsigned *pcbSize, char *pszOutput); 570 571 /** 572 * Disassembles one instruction 573 * 574 * @returns VBox error code 575 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode 576 * set correctly. 577 * @param pu8Instruction Pointer to the structure to disassemble. 578 * @param u32EipOffset Offset to add to instruction address to get the real virtual address 579 * @param pcbSize Where to store the size of the instruction. 580 * NULL is allowed. 581 * @param pszOutput Storage for disassembled instruction 582 * @param uFilter Instruction type filter 583 * 584 * @todo Define output callback. 585 */ 586 DISDECL(int) DISInstrEx(PDISCPUSTATE pCpu, RTUINTPTR pu8Instruction, uint32_t u32EipOffset, uint32_t *pcbSize, 587 char *pszOutput, unsigned uFilter); 588 589 /** 590 * Parses one instruction. 591 * The result is found in pCpu. 592 * 593 * @returns VBox error code 594 * @param pCpu Pointer to cpu structure which has DISCPUSTATE::mode set correctly. 595 * @param InstructionAddr Pointer to the instruction to parse. 596 * @param pcbInstruction Where to store the size of the instruction. 597 * NULL is allowed. 598 */ 599 DISDECL(int) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, unsigned *pcbInstruction); 600 601 /** 602 * Parses one guest instruction. 603 * The result is found in pCpu and pcbInstruction. 604 * 605 * @returns VBox status code. 606 * @param InstructionAddr Address of the instruction to decode. What this means 607 * is left to the pfnReadBytes function. 608 * @param enmCpuMode The CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT. 609 * @param pfnReadBytes Callback for reading instruction bytes. 610 * @param pvUser User argument for the instruction reader. (Ends up in apvUserData[0].) 611 * @param pCpu Pointer to cpu structure. Will be initialized. 612 * @param pcbInstruction Where to store the size of the instruction. 613 * NULL is allowed. 614 */ 615 DISDECL(int) DISCoreOneEx(RTUINTPTR InstructionAddr, DISCPUMODE enmCpuMode, PFN_DIS_READBYTES pfnReadBytes, void *pvUser, 616 PDISCPUSTATE pCpu, unsigned *pcbInstruction); 553 DISDECL(int) DISInstr(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbSize, char *pszOutput); 554 DISDECL(int) DISInstrWithOff(PDISCPUSTATE pCpu, RTUINTPTR uInstrAddr, RTUINTPTR offRealAddr, uint32_t *pcbSize, char *pszOutput); 555 DISDECL(int) DISInstrWithReader(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PFNDISREADBYTES pfnReadBytes, void *pvUser, 556 PDISCPUSTATE pCpu, uint32_t *pcbSize, char *pszOutput); 557 DISDECL(int) DISInstrEx(RTUINTPTR uInstrAddr, RTUINTPTR offRealAddr, DISCPUMODE enmCpuMode, 558 PFNDISREADBYTES pfnReadBytes, void *pvUser, uint32_t uFilter, 559 PDISCPUSTATE pCpu, uint32_t *pcbSize, char *pszOutput); 560 561 DISDECL(int) DISCoreOne(PDISCPUSTATE pCpu, RTUINTPTR InstructionAddr, uint32_t *pcbInstruction); 562 DISDECL(int) DISCoreOneEx(RTUINTPTR InstructionAddr, DISCPUMODE enmCpuMode, PFNDISREADBYTES pfnReadBytes, void *pvUser, 563 PDISCPUSTATE pCpu, uint32_t *pcbInstruction); 617 564 618 565 DISDECL(int) DISGetParamSize(PDISCPUSTATE pCpu, POP_PARAMETER pParam); … … 620 567 DISDECL(uint8_t) DISQuerySegPrefixByte(PDISCPUSTATE pCpu); 621 568 622 /**623 * Returns the value of the parameter in pParam624 *625 * @returns VBox error code626 * @param pCtx Exception structure pointer627 * @param pCpu Pointer to cpu structure which have DISCPUSTATE::mode628 * set correctly.629 * @param pParam Pointer to the parameter to parse630 * @param pParamVal Pointer to parameter value (OUT)631 * @param parmtype Parameter type632 *633 * @note Currently doesn't handle FPU/XMM/MMX/3DNow! parameters correctly!!634 *635 */636 569 DISDECL(int) DISQueryParamVal(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, POP_PARAMETER pParam, POP_PARAMVAL pParamVal, PARAM_TYPE parmtype); 637 570 DISDECL(int) DISQueryParamRegPtr(PCPUMCTXCORE pCtx, PDISCPUSTATE pCpu, POP_PARAMETER pParam, void **ppReg, size_t *pcbSize); -
trunk/include/VBox/err.h
r41573 r41658 1932 1932 /** Generic failure during disassembly. */ 1933 1933 #define VERR_DIS_GEN_FAILURE (-4201) 1934 /** No read callback. */ 1935 #define VERR_DIS_NO_READ_CALLBACK (-4202) 1936 /** Invalid Mod/RM. */ 1937 #define VERR_DIS_INVALID_MODRM (-4203) 1938 /** Invalid parameter index. */ 1939 #define VERR_DIS_INVALID_PARAMETER (-4204) 1940 /** Reading opcode bytes failed. */ 1941 #define VERR_DIS_MEM_READ (-4205) 1934 1942 /** @} */ 1935 1943 -
trunk/include/VBox/vmm/iem.h
r40453 r41658 41 41 VMMDECL(VBOXSTRICTRC) IEMExecOne(PVMCPU pVCpu); 42 42 VMMDECL(VBOXSTRICTRC) IEMExecOneEx(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint32_t *pcbWritten); 43 VMMDECL(VBOXSTRICTRC) IEMExecOneWithOpcodes(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, 44 RTGCPTR GCPtrOpcodeBytes, const void *pvOpcodeBytes, size_t cbOpcodeBytes); 43 45 VMMDECL(VBOXSTRICTRC) IEMExecLots(PVMCPU pVCpu); 44 46 VMM_INT_DECL(VBOXSTRICTRC) IEMInjectTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType, uint16_t uErrCode, RTGCPTR uCr2); -
trunk/include/VBox/vmm/patm.h
r40453 r41658 238 238 * @param pCtxCore The relevant core context. 239 239 */ 240 VMM DECL(int) PATMHandleInt3PatchTrap(PVM pVM, PCPUMCTXCORE pRegFrame);240 VMMRCDECL(int) PATMRCHandleInt3PatchTrap(PVM pVM, PCPUMCTXCORE pRegFrame); 241 241 242 242 /**
Note:
See TracChangeset
for help on using the changeset viewer.