VirtualBox

Changeset 4953 in vbox for trunk/src/VBox/VMM/DBGFDisas.cpp


Ignore:
Timestamp:
Sep 21, 2007 2:08:19 PM (17 years ago)
Author:
vboxsync
Message:

Cleaned up disassembler

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/DBGFDisas.cpp

    r4071 r4953  
    4040*   Internal Functions                                                         *
    4141*******************************************************************************/
    42 static DECLCALLBACK(int32_t) dbgfR3DisasInstrRead(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, RTHCUINTPTR dwUserdata);
     42static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTHCUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata);
    4343
    4444
     
    6565    /** Pointer to the current page - GC Ptr. */
    6666    RTGCPTR         pvPageGC;
    67     /** The rc of the operation.
    68      * @todo r=bird: it's rather annoying that we have to keep track of the status code of the operation.
    69      *               When we've got time we should adjust the disassembler to use VBox status codes and not
    70      *               boolean returns.
    71      */
    72     int             rc;
    7367    /** Pointer to the next instruction (relative to GCPtrSegBase). */
    7468    RTGCUINTPTR     GCPtrNext;
     
    9791    pState->pvPageGC        = 0;
    9892    pState->pvPageHC        = NULL;
    99     pState->rc              = VINF_SUCCESS;
    10093    pState->pVM             = pVM;
    10194    Assert((uintptr_t)GCPtr == GCPtr);
    10295    uint32_t cbInstr;
    103     if (DISInstr(&pState->Cpu, GCPtr, 0, &cbInstr, NULL))
     96    int rc = DISInstr(&pState->Cpu, GCPtr, 0, &cbInstr, NULL);
     97    if (VBOX_SUCCESS(rc))
    10498    {
    10599        pState->GCPtrNext = GCPtr + cbInstr;
    106100        return VINF_SUCCESS;
    107101    }
    108     if (VBOX_FAILURE(pState->rc))
    109         return pState->rc;
    110     return VERR_GENERAL_FAILURE;
     102    return rc;
    111103}
    112104
     
    123115    pState->rc              = VINF_SUCCESS;
    124116    uint32_t cbInstr;
    125     if (DISInstr(&pState->Cpu, (void *)pState->GCPtrNext, 0, &cbInstr, NULL))
     117    int rc = DISInstr(&pState->Cpu, (void *)pState->GCPtrNext, 0, &cbInstr, NULL);
     118    if (VBOX_SUCCESS(rc))
    126119    {
    127120        pState->GCPtrNext = GCPtr + cbInstr;
    128121        return VINF_SUCCESS;
    129122    }
    130     if (VBOX_FAILURE(pState->rc))
    131         return pState->rc;
    132     return VERR_GENERAL_FAILURE;
     123    return rc;
    133124}
    134125#endif
     
    146137 *                      In this context it's always pointer to the Core of a DBGFDISASSTATE.
    147138 */
    148 static DECLCALLBACK(int32_t) dbgfR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, uint32_t cbRead, RTHCUINTPTR uDisCpu)
    149 {
    150     PDBGFDISASSTATE pState = (PDBGFDISASSTATE)uDisCpu;
     139static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, unsigned cbRead, void *pvDisCpu)
     140{
     141    PDBGFDISASSTATE pState = (PDBGFDISASSTATE)pvDisCpu;
    151142    Assert(cbRead > 0);
    152143    for (;;)
     
    158149            ||  (GCPtr >> PAGE_SHIFT) != (pState->pvPageGC >> PAGE_SHIFT))
    159150        {
     151            int rc = VINF_SUCCESS;
     152
    160153            /* translate the address */
    161154            pState->pvPageGC = GCPtr & PAGE_BASE_GC_MASK;
     
    164157                pState->pvPageHC = MMHyperGC2HC(pState->pVM, pState->pvPageGC);
    165158                if (!pState->pvPageHC)
    166                     pState->rc = VERR_INVALID_POINTER;
     159                    rc = VERR_INVALID_POINTER;
    167160            }
    168161            else if (pState->enmMode <= PGMMODE_PROTECTED)
    169                 pState->rc = PGMPhysGCPhys2HCPtr(pState->pVM, pState->pvPageGC, PAGE_SIZE, &pState->pvPageHC);
     162                rc = PGMPhysGCPhys2HCPtr(pState->pVM, pState->pvPageGC, PAGE_SIZE, &pState->pvPageHC);
    170163            else
    171                 pState->rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC);
    172             if (VBOX_FAILURE(pState->rc))
     164                rc = PGMPhysGCPtr2HCPtr(pState->pVM, pState->pvPageGC, &pState->pvPageHC);
     165            if (VBOX_FAILURE(rc))
    173166            {
    174167                pState->pvPageHC = NULL;
    175                 return pState->rc;
     168                return rc;
    176169            }
    177170        }
     
    179172        /* check the segemnt limit */
    180173        if (PtrSrc > pState->cbSegLimit)
    181             return pState->rc = VERR_OUT_OF_SELECTOR_BOUNDS;
     174            return VERR_OUT_OF_SELECTOR_BOUNDS;
    182175
    183176        /* calc how much we can read */
     
    544537        size_t  cbBits = State.Cpu.opsize;
    545538        uint8_t *pau8Bits = (uint8_t *)alloca(cbBits);
    546         rc = dbgfR3DisasInstrRead(GCPtr, pau8Bits, cbBits, (uintptr_t)&State);
     539        rc = dbgfR3DisasInstrRead(GCPtr, pau8Bits, cbBits, &State);
    547540        AssertRC(rc);
    548541        if (fFlags & DBGF_DISAS_FLAGS_NO_ADDRESS)
Note: See TracChangeset for help on using the changeset viewer.

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