VirtualBox

Changeset 41674 in vbox


Ignore:
Timestamp:
Jun 12, 2012 8:16:31 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
78481
Message:

DISCoreOne* -> DISCore*.

Location:
trunk
Files:
16 edited

Legend:

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

    r41671 r41674  
    3535
    3636
    37 /** CPU mode flags (DISCPUSTATE::mode).
    38  * @{
    39  */
    40 typedef enum
     37/**
     38 * CPU mode flags (DISCPUSTATE::mode).
     39 */
     40typedef enum DISCPUMODE
    4141{
    42     CPUMODE_16BIT = 1,
    43     CPUMODE_32BIT = 2,
    44     CPUMODE_64BIT = 3,
     42    CPUMODE_INVALID = 0,
     43    CPUMODE_16BIT,
     44    CPUMODE_32BIT,
     45    CPUMODE_64BIT,
    4546    /** hack forcing the size of the enum to 32-bits. */
    4647    CPUMODE_MAKE_32BIT_HACK = 0x7fffffff
    4748} DISCPUMODE;
    48 /** @} */
    49 
    50 /** Prefix byte flags
     49
     50/** @name Prefix byte flags
    5151 * @{
    5252 */
    5353#define PREFIX_NONE                     0
    5454/** non-default address size. */
    55 #define PREFIX_ADDRSIZE                 RT_BIT(0)
     55#define PREFIX_ADDRSIZE                 UINT8_C(0x00)
    5656/** non-default operand size. */
    57 #define PREFIX_OPSIZE                   RT_BIT(1)
     57#define PREFIX_OPSIZE                   UINT8_C(0x01)
    5858/** lock prefix. */
    59 #define PREFIX_LOCK                     RT_BIT(2)
     59#define PREFIX_LOCK                     UINT8_C(0x02)
    6060/** segment prefix. */
    61 #define PREFIX_SEG                      RT_BIT(3)
     61#define PREFIX_SEG                      UINT8_C(0x04)
    6262/** rep(e) prefix (not a prefix, but we'll treat is as one). */
    63 #define PREFIX_REP                      RT_BIT(4)
     63#define PREFIX_REP                      UINT8_C(0x08)
    6464/** rep(e) prefix (not a prefix, but we'll treat is as one). */
    65 #define PREFIX_REPNE                    RT_BIT(5)
     65#define PREFIX_REPNE                    UINT8_C(0x10)
    6666/** REX prefix (64 bits) */
    67 #define PREFIX_REX                      RT_BIT(6)
    68 /** @} */
    69 
    70 /** 64 bits prefix byte flags
     67#define PREFIX_REX                      UINT8_C(0x20)
     68/** @} */
     69
     70/** @name 64 bits prefix byte flags
    7171 * @{
    7272 */
     
    9090/** @} */
    9191
    92 /**
    93  * Operand type.
     92/** @name Operand type.
     93 * @{
    9494 */
    9595#define OPTYPE_INVALID                  RT_BIT(0)
     
    119119#define OPTYPE_MOD_FIXED_11             RT_BIT(24)  /**< modrm.mod is always 11b */
    120120#define OPTYPE_FORCED_32_OP_SIZE_X86    RT_BIT(25)  /**< Forced 32 bits operand size; regardless of prefix bytes (only in 16 & 32 bits mode!) */
    121 #define OPTYPE_ALL                      (0xffffffff)
    122 
    123 /** Parameter usage flags.
     121#define OPTYPE_ALL                      UINT32_C(0xffffffff)
     122/** @}  */
     123
     124/** @name Parameter usage flags.
    124125 * @{
    125126 */
     
    507508    PFNDISPARSE    *pfnDisasmFnTable;
    508509    /** Internal: instruction filter */
    509     uint32_t        uFilter;
     510    uint32_t        fFilter;
    510511    /** Return code set by a worker function like the opcode bytes readers. */
    511512    int32_t         rc;
     
    558559                             PDISCPUSTATE pCpu, uint32_t *pcbInstr, char *pszOutput, size_t cbOutput);
    559560
    560 DISDECL(int) DISCoreOne(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbInstr);
    561 DISDECL(int) DISCoreOneWithReader(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PFNDISREADBYTES pfnReadBytes, void *pvUser,
    562                                   PDISCPUSTATE pCpu, uint32_t *pcbInstr);
    563 DISDECL(int) DISCoreOneExEx(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, uint32_t uFilter,
    564                             PFNDISREADBYTES pfnReadBytes, void *pvUser,
    565                             PDISCPUSTATE pCpu, uint32_t *pcbInstr);
     561DISDECL(int) DISInstr(void const *pvInstr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbInstr);
     562DISDECL(int) DISInstrWithReader(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PFNDISREADBYTES pfnReadBytes, void *pvUser,
     563                                PDISCPUSTATE pCpu, uint32_t *pcbInstr);
     564DISDECL(int) DISInstEx(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, uint32_t uFilter,
     565                       PFNDISREADBYTES pfnReadBytes, void *pvUser,
     566                       PDISCPUSTATE pCpu, uint32_t *pcbInstr);
    566567
    567568DISDECL(int)        DISGetParamSize(PDISCPUSTATE pCpu, POP_PARAMETER pParam);
  • trunk/src/VBox/Devices/PC/BIOS-new/MakeDebianBiosAssembly.cpp

    r41668 r41674  
    968968            unsigned    cbInstr;
    969969            DISCPUSTATE CpuState;
    970             int rc = DISCoreOneWithReader(uFlatAddr, fIs16Bit ? CPUMODE_16BIT : CPUMODE_32BIT,
    971                                           disReadOpcodeBytes, NULL, &CpuState, &cbInstr);
     970            int rc = DISInstrWithReader(uFlatAddr, fIs16Bit ? CPUMODE_16BIT : CPUMODE_32BIT,
     971                                        disReadOpcodeBytes, NULL, &CpuState, &cbInstr);
    972972            if (   RT_SUCCESS(rc)
    973973                && cbInstr <= cb)
  • trunk/src/VBox/Disassembler/Disasm.cpp

    r41671 r41674  
    9696                             PDISCPUSTATE pCpu, uint32_t *pcbInstr, char *pszOutput, size_t cbOutput)
    9797{
    98     int rc = DISCoreOneExEx(uInstrAddr, enmCpuMode, uFilter, pfnReadBytes, pvUser, pCpu, pcbInstr);
     98    int rc = DISInstEx(uInstrAddr, enmCpuMode, uFilter, pfnReadBytes, pvUser, pCpu, pcbInstr);
    9999    if (RT_SUCCESS(rc) && pszOutput && cbOutput)
    100100    {
  • trunk/src/VBox/Disassembler/DisasmCore.cpp

    r41668 r41674  
    212212 *
    213213 * @returns VBox status code.
    214  * @param   uInstrAddr      Address of the instruction to decode.  This is a
     214 * @param   pvInstr         Address of the instruction to decode.  This is a
    215215 *                          real address in the current context that can be
    216  *                          derefferenced.  (Consider DISCoreOneWithReader if
    217  *                          this isn't the case.)
     216 *                          accessed without faulting.  (Consider
     217 *                          DISInstrWithReader if this isn't the case.)
    218218 * @param   enmCpuMode      The CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT.
    219219 * @param   pfnReadBytes    Callback for reading instruction bytes.
     
    224224 *                          PDISCPUSTATE::opsize.
    225225 */
    226 DISDECL(int) DISCoreOne(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbInstr)
    227 {
    228     return DISCoreOneExEx(uInstrAddr, enmCpuMode, OPTYPE_ALL, NULL /*pfnReadBytes*/, NULL /*pvUser*/, pCpu, pcbInstr);
     226DISDECL(int) DISInstr(const void *pvInstr, DISCPUMODE enmCpuMode, PDISCPUSTATE pCpu, uint32_t *pcbInstr)
     227{
     228    return DISInstEx((uintptr_t)pvInstr, enmCpuMode, OPTYPE_ALL, NULL /*pfnReadBytes*/, NULL /*pvUser*/, pCpu, pcbInstr);
    229229}
    230230
     
    246246 *                          PDISCPUSTATE::opsize.
    247247 */
    248 DISDECL(int) DISCoreOneWithReader(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PFNDISREADBYTES pfnReadBytes, void *pvUser,
    249                                   PDISCPUSTATE pCpu, uint32_t *pcbInstr)
    250 {
    251     return DISCoreOneExEx(uInstrAddr, enmCpuMode, OPTYPE_ALL, pfnReadBytes, pvUser, pCpu, pcbInstr);
     248DISDECL(int) DISInstrWithReader(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, PFNDISREADBYTES pfnReadBytes, void *pvUser,
     249                                PDISCPUSTATE pCpu, uint32_t *pcbInstr)
     250{
     251    return DISInstEx(uInstrAddr, enmCpuMode, OPTYPE_ALL, pfnReadBytes, pvUser, pCpu, pcbInstr);
    252252}
    253253
    254254
    255255/**
    256  * Parses one guest instruction.
    257  *
    258  * The result is found in pCpu and pcbInstr.
     256 * Disassembles on instruction, details in @a pCpu and length in @a pcbInstr.
    259257 *
    260258 * @returns VBox status code.
     
    263261 * @param   enmCpuMode      The CPU mode. CPUMODE_32BIT, CPUMODE_16BIT, or CPUMODE_64BIT.
    264262 * @param   pfnReadBytes    Callback for reading instruction bytes.
    265  * @param   uFilter         Instruction type filter.
     263 * @param   fFilter         Instruction type filter.
    266264 * @param   pvUser          User argument for the instruction reader. (Ends up in apvUserData[0].)
    267  * @param   pCpu            Pointer to cpu structure. Will be initialized.
    268  * @param   pcbInstr        Where to store the size of the instruction.
    269  *                          NULL is allowed.  This is also stored in
    270  *                          PDISCPUSTATE::opsize.
     265 * @param   pCpu            Pointer to CPU structure. With the exception of
     266 *                          DISCPUSTATE::apvUserData[1] and
     267 *                          DISCPUSTATE::apvUserData[2], the structure will be
     268 *                          completely initialized by this API, i.e. no input is
     269 *                          taken from it.
     270 * @param   pcbInstr        Where to store the size of the instruction.  (This
     271 *                          is also stored in PDISCPUSTATE::opsize.)  Optional.
    271272 */
    272 DISDECL(int) DISCoreOneExEx(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, uint32_t uFilter,
    273                             PFNDISREADBYTES pfnReadBytes, void *pvUser,
    274                             PDISCPUSTATE pCpu, uint32_t *pcbInstr)
     273DISDECL(int) DISInstEx(RTUINTPTR uInstrAddr, DISCPUMODE enmCpuMode, uint32_t fFilter,
     274                       PFNDISREADBYTES pfnReadBytes, void *pvUser,
     275                       PDISCPUSTATE pCpu, uint32_t *pcbInstr)
    275276{
    276277    const OPCODE *paOneByteMap;
     
    299300    pCpu->uInstrAddr        = uInstrAddr;
    300301    pCpu->pfnDisasmFnTable  = g_apfnFullDisasm;
    301     pCpu->uFilter           = uFilter;
     302    pCpu->fFilter           = fFilter;
    302303    pCpu->rc                = VINF_SUCCESS;
    303304    pCpu->pfnReadBytes      = pfnReadBytes ? pfnReadBytes : disReadBytesDefault;
     
    451452    /*
    452453     * Apply filter to instruction type to determine if a full disassembly is required.
    453      * @note Multibyte opcodes are always marked harmless until the final byte.
     454     * Note! Multibyte opcodes are always marked harmless until the final byte.
    454455     */
    455     if ((pOp->optype & pCpu->uFilter) == 0)
     456    if ((pOp->optype & pCpu->fFilter) == 0)
    456457    {
    457458        fFiltered = true;
     
    541542     * @note Multibyte opcodes are always marked harmless until the final byte.
    542543     */
    543     if ((fpop->optype & pCpu->uFilter) == 0)
     544    if ((fpop->optype & pCpu->fFilter) == 0)
    544545        pCpu->pfnDisasmFnTable = g_apfnCalcSize;
    545546    else
  • trunk/src/VBox/Disassembler/DisasmTestCore.cpp

    r41668 r41674  
    3939        unsigned    cb;
    4040        DISCPUSTATE cpu;
    41         if (DISCoreOne((uintptr_t)&DISCoreOne, CPUMODE_32BIT, &cpu, &cb))
     41        if (DISInstr((void *)(uintptr_t)&DISInstr, CPUMODE_32BIT, &cpu, &cb))
    4242            printf("ok %d\n", cpu.addrmode);
    4343        else
  • trunk/src/VBox/Runtime/testcase/tstLdr-3.cpp

    r41668 r41674  
    164164        char        szOutput[256];
    165165        unsigned    cbInstr;
    166         int rc = DISCoreOneWithReader(uNearAddr + i, pCpu->mode,
    167                                       MyReadBytes, (uint8_t *)pvCodeBlock - (uintptr_t)uNearAddr,
    168                                       pCpu, &cbInstr);
     166        int rc = DISInstrWithReader(uNearAddr + i, pCpu->mode,
     167                                    MyReadBytes, (uint8_t *)pvCodeBlock - (uintptr_t)uNearAddr,
     168                                    pCpu, &cbInstr);
    169169        RTAssertSetMayPanic(fMayPanic);
    170170        RTAssertSetQuiet(fQuiet);
  • trunk/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp

    r41668 r41674  
    105105{
    106106    uint32_t cb;
    107     int rc = DISCoreOneWithReader(CodeIndex, CPUMODE_32BIT, DisasmTest1ReadCode, 0, pCpu, &cb);
     107    int rc = DISInstrWithReader(CodeIndex, CPUMODE_32BIT, DisasmTest1ReadCode, 0, pCpu, &cb);
    108108    *pcb = cb;
    109109    MY_PRINTF(("DISCoreOneEx -> rc=%d cb=%d  Cpu: opcode=%#x pCurInstr=%p (42=%d)\n", \
  • trunk/src/VBox/Runtime/testcase/tstLdrObj.cpp

    r41668 r41674  
    9898    static unsigned cb;
    9999    DISCPUSTATE Cpu;
    100     DISCoreOne((uintptr_t)SomeExportFunction3, CPUMODE_32BIT, &Cpu, &cb);
     100    DISInstr((void *)(uintptr_t)SomeExportFunction3, CPUMODE_32BIT, &Cpu, &cb);
    101101    return (void *)(uintptr_t)&SomeExportFunction1;
    102102}
  • trunk/src/VBox/Runtime/testcase/tstLdrObjR0.cpp

    r41668 r41674  
    9898    Cpu.mode = CPUMODE_32BIT;
    9999
    100     DISCoreOne((uintptr_t)SomeExportFunction3, CPUMODE_32BIT, &Cpu, &cb);
     100    DISInstr((void *)(uintptr_t)SomeExportFunction3, CPUMODE_32BIT, &Cpu, &cb);
    101101    return (void *)(uintptr_t)&SomeExportFunction1;
    102102}
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r41668 r41674  
    364364        State.GCPtr = NIL_RTGCPTR;
    365365    }
    366     return DISCoreOneWithReader(InstrGC, pDis->mode, emReadBytes, &State, pDis, pOpsize);
     366    return DISInstrWithReader(InstrGC, pDis->mode, emReadBytes, &State, pDis, pOpsize);
    367367}
    368368
     
    377377    State.GCPtr = InstrGC;
    378378
    379     return DISCoreOneWithReader(InstrGC, pDis->mode, emReadBytes, &State, pDis, pOpsize);
     379    return DISInstrWithReader(InstrGC, pDis->mode, emReadBytes, &State, pDis, pOpsize);
    380380}
    381381
     
    460460
    461461    DISCPUMODE enmCpuMode = SELMGetCpuModeFromSelector(pVCpu, pCtxCore->eflags, pCtxCore->cs, (PCPUMSELREGHID)&pCtxCore->csHid);
    462     rc = DISCoreOneWithReader(GCPtrInstr, enmCpuMode, emReadBytes, &State, pDis, pcbInstr);
     462    rc = DISInstrWithReader(GCPtrInstr, enmCpuMode, emReadBytes, &State, pDis, pcbInstr);
    463463    if (RT_SUCCESS(rc))
    464464        return VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r41671 r41674  
    36763676    uint32_t cbInstr;
    36773677#ifndef LOG_ENABLED
    3678     rc = DISCoreOneWithReader(GCPtrPC, enmDisCpuMode, cpumR3DisasInstrRead, &State, pCpu, &cbInstr);
     3678    rc = DISInstrWithReader(GCPtrPC, enmDisCpuMode, cpumR3DisasInstrRead, &State, pCpu, &cbInstr);
    36793679    if (RT_SUCCESS(rc))
    36803680    {
  • trunk/src/VBox/VMM/VMMR3/CSAM.cpp

    r41673 r41674  
    765765{
    766766    (pCpu)->apvUserData[1] = InstrHC;
    767     (pCpu)->apvUserData[2] = (void *)(uintptr_t)InstrGC; Assert(sizeof(InstrGC) <= sizeof(pCpu->apvUserData[0]));
    768767#ifdef DEBUG
    769768    return DISInstrToStrEx(InstrGC, enmCpuMode, CSAMR3ReadBytes, pVM, OPTYPE_ALL,
     
    774773        return DISInstrToStrEx(InstrGC, enmCpuMode, CSAMR3ReadBytes, pVM, ~(OPTYPE_INVALID | OPTYPE_HARMLESS | OPTYPE_RRM_MASK),
    775774                               pCpu, pcbInstr, pszOutput, cbOutput);
    776     return DISCoreOneExEx(InstrGC, enmCpuMode, ~(OPTYPE_INVALID | OPTYPE_HARMLESS | OPTYPE_RRM_MASK), CSAMR3ReadBytes, pVM,
    777                           pCpu, pcbInstr);
     775    return DISInstEx(InstrGC, enmCpuMode, ~(OPTYPE_INVALID | OPTYPE_HARMLESS | OPTYPE_RRM_MASK), CSAMR3ReadBytes, pVM,
     776                     pCpu, pcbInstr);
    778777#endif
    779778}
  • trunk/src/VBox/VMM/VMMR3/DBGFDisas.cpp

    r41668 r41674  
    140140
    141141    uint32_t cbInstr;
    142     int rc = DISCoreOneWithReader(GCPtr,
    143                                   enmCpuMode,
    144                                   dbgfR3DisasInstrRead,
    145                                   &pState->Cpu,
    146                                   &pState->Cpu,
    147                                   &cbInstr);
     142    int rc = DISInstrWithReader(GCPtr,
     143                                enmCpuMode,
     144                                dbgfR3DisasInstrRead,
     145                                &pState->Cpu,
     146                                &pState->Cpu,
     147                                &cbInstr);
    148148    if (RT_SUCCESS(rc))
    149149    {
  • trunk/src/VBox/VMM/VMMR3/PATM.cpp

    r41671 r41674  
    603603    disinfo.pInstrGC    = InstrGCPtr32;
    604604    disinfo.fReadFlags  = fReadFlags;
    605     (pCpu)->pfnReadBytes = patmReadBytes;
    606     (pCpu)->apvUserData[0] = &disinfo;
    607605    return RT_SUCCESS(DISInstrToStrWithReader(InstrGCPtr32,
    608606                                              (pPatch->flags & PATMFL_CODE32) ? CPUMODE_32BIT : CPUMODE_16BIT,
     
    621619    disinfo.pInstrGC    = InstrGCPtr32;
    622620    disinfo.fReadFlags  = fReadFlags;
    623     (pCpu)->pfnReadBytes = patmReadBytes;
    624     (pCpu)->apvUserData[0] = &disinfo;
    625     return RT_SUCCESS(DISCoreOneWithReader(InstrGCPtr32,
    626                                            (pPatch->flags & PATMFL_CODE32) ? CPUMODE_32BIT : CPUMODE_16BIT,
    627                                            patmReadBytes, &disinfo,
    628                                            pCpu, pcbInstr));
     621    return RT_SUCCESS(DISInstrWithReader(InstrGCPtr32,
     622                                         (pPatch->flags & PATMFL_CODE32) ? CPUMODE_32BIT : CPUMODE_16BIT,
     623                                         patmReadBytes, &disinfo,
     624                                         pCpu, pcbInstr));
    629625}
    630626
     
    640636    disinfo.pInstrGC    = InstrGCPtr32;
    641637    disinfo.fReadFlags  = fReadFlags;
    642     (pCpu)->pfnReadBytes = patmReadBytes;
    643     (pCpu)->apvUserData[0] = &disinfo;
    644     return RT_SUCCESS(DISCoreOneWithReader(InstrGCPtr32, pPatch->uOpMode, patmReadBytes, &disinfo,
    645                                            pCpu, pcbInstr));
     638    return RT_SUCCESS(DISInstrWithReader(InstrGCPtr32, pPatch->uOpMode, patmReadBytes, &disinfo,
     639                                         pCpu, pcbInstr));
    646640}
    647641
  • trunk/src/VBox/VMM/VMMR3/VMMSwitcher.cpp

    r41671 r41674  
    835835                DISCPUSTATE Cpu;
    836836                char        szDisas[256];
    837                 int rc = DISCoreOne((uintptr_t)pu8CodeR3 + offCode, CPUMODE_32BIT, &Cpu, &cbInstr);
     837                int rc = DISInstr(pu8CodeR3 + offCode, CPUMODE_32BIT, &Cpu, &cbInstr);
    838838                if (RT_SUCCESS(rc))
    839839                {
  • trunk/src/VBox/VMM/VMMRC/PATMRC.cpp

    r41668 r41674  
    523523            rc = VBOXSTRICTRC_TODO(rcStrict);
    524524#else
    525             rc = DISCoreOne((uintptr_t)&pRec->patch.aPrivInstr[0], cpu.mode, &cpu, &cbOp);
     525            rc = DISInstr(&pRec->patch.aPrivInstr[0], cpu.mode, &cpu, &cbOp);
    526526            if (RT_FAILURE(rc))
    527527            {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette