VirtualBox

Changeset 47569 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 7, 2013 3:13:21 AM (11 years ago)
Author:
vboxsync
Message:

DBGC: v86 disassembly fixes and tweaks.

Location:
trunk/src/VBox/Debugger
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp

    r46221 r47569  
    939939        if (!DBGCVAR_ISPOINTER(pDbgc->DisasmPos.enmType))
    940940        {
    941             /** @todo Batch query CS, RIP & CPU mode. */
     941            /** @todo Batch query CS, RIP, CPU mode and flags. */
    942942            PVMCPU pVCpu = VMMR3GetCpuByIdU(pUVM, pDbgc->idCpu);
    943943            if (    pDbgc->fRegCtxGuest
     
    952952                pDbgc->SourcePos.u.GCFar.off = pDbgc->fRegCtxGuest ? CPUMGetGuestEIP(pVCpu) : CPUMGetHyperEIP(pVCpu);
    953953                pDbgc->SourcePos.u.GCFar.sel = pDbgc->fRegCtxGuest ? CPUMGetGuestCS(pVCpu)  : CPUMGetHyperCS(pVCpu);
     954                if (   (fFlags & DBGF_DISAS_FLAGS_MODE_MASK) == DBGF_DISAS_FLAGS_DEFAULT_MODE
     955                    && pDbgc->fRegCtxGuest
     956                    && (CPUMGetGuestEFlags(pVCpu) & X86_EFL_VM))
     957                {
     958                    fFlags &= ~DBGF_DISAS_FLAGS_MODE_MASK;
     959                    fFlags |= DBGF_DISAS_FLAGS_16BIT_REAL_MODE;
     960                }
    954961            }
    955962
     
    958965            else
    959966                fFlags |= DBGF_DISAS_FLAGS_CURRENT_HYPER | DBGF_DISAS_FLAGS_HYPER;
     967        }
     968        else if ((fFlags & DBGF_DISAS_FLAGS_MODE_MASK) == DBGF_DISAS_FLAGS_DEFAULT_MODE && pDbgc->fDisasm)
     969        {
     970            fFlags &= ~DBGF_DISAS_FLAGS_MODE_MASK;
     971            fFlags |= pDbgc->fDisasm & (DBGF_DISAS_FLAGS_MODE_MASK | DBGF_DISAS_FLAGS_HYPER);
    960972        }
    961973        pDbgc->DisasmPos.enmRangeType = DBGCVAR_RANGE_NONE;
     
    10151027
    10161028    DBGFADDRESS CurAddr;
    1017     rc = DBGCCmdHlpVarToDbgfAddr(pCmdHlp, &pDbgc->DisasmPos, &CurAddr);
    1018     if (RT_FAILURE(rc))
    1019         return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGCCmdHlpVarToDbgfAddr failed on '%Dv'", &pDbgc->DisasmPos);
     1029    if (   (fFlags & DBGF_DISAS_FLAGS_MODE_MASK) == DBGF_DISAS_FLAGS_16BIT_REAL_MODE
     1030        && pDbgc->DisasmPos.enmType == DBGCVAR_TYPE_GC_FAR)
     1031        DBGFR3AddrFromFlat(pUVM, &CurAddr, ((uint32_t)pDbgc->DisasmPos.u.GCFar.sel << 4) + pDbgc->DisasmPos.u.GCFar.off);
     1032    else
     1033    {
     1034        rc = DBGCCmdHlpVarToDbgfAddr(pCmdHlp, &pDbgc->DisasmPos, &CurAddr);
     1035        if (RT_FAILURE(rc))
     1036            return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGCCmdHlpVarToDbgfAddr failed on '%Dv'", &pDbgc->DisasmPos);
     1037    }
    10201038
    10211039    if (CurAddr.fFlags & DBGFADDRESS_FLAGS_HMA)
    10221040        fFlags |= DBGF_DISAS_FLAGS_HYPER; /* This crap is due to not using DBGFADDRESS as DBGFR3Disas* input. */
     1041    pDbgc->fDisasm = fFlags;
    10231042
    10241043    /*
     
    10841103        if (cbCheckSymbol <= cbInstr)
    10851104        {
    1086             rc = DBGCCmdHlpVarToDbgfAddr(pCmdHlp, &pDbgc->DisasmPos, &CurAddr);
     1105            if (   (fFlags & DBGF_DISAS_FLAGS_MODE_MASK) == DBGF_DISAS_FLAGS_16BIT_REAL_MODE
     1106                && pDbgc->DisasmPos.enmType == DBGCVAR_TYPE_GC_FAR)
     1107                DBGFR3AddrFromFlat(pUVM, &CurAddr, ((uint32_t)pDbgc->DisasmPos.u.GCFar.sel << 4) + pDbgc->DisasmPos.u.GCFar.off);
     1108            else
     1109                rc = DBGCCmdHlpVarToDbgfAddr(pCmdHlp, &pDbgc->DisasmPos, &CurAddr);
    10871110            if (RT_SUCCESS(rc))
    10881111                dbgcCmdUnassambleHelpListNear(pUVM, pCmdHlp, hDbgAs, &CurAddr, &cbCheckSymbol);
     
    14861509         * Disassemble one instruction at cs:[r|e]ip.
    14871510         */
     1511        if (!f64BitMode && strstr(pszRegs, " vm ")) /* a big ugly... */
     1512            return pCmdHlp->pfnExec(pCmdHlp, "uv86 %s", szDisAndRegs + 2);
    14881513        return pCmdHlp->pfnExec(pCmdHlp, "%s", szDisAndRegs);
    14891514    }
  • trunk/src/VBox/Debugger/DBGCInternal.h

    r44528 r47569  
    140140    /** Current disassembler position. */
    141141    DBGCVAR             DisasmPos;
     142    /** The flags that goes with DisasmPos. */
     143    uint32_t            fDisasm;
    142144    /** Current source position. (flat GC) */
    143145    DBGCVAR             SourcePos;
  • trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp

    r46217 r47569  
    380380}
    381381
     382VMMDECL(uint32_t) CPUMGetGuestEFlags(PVMCPU pVCpu)
     383{
     384    return 2;
     385}
    382386
    383387#include <VBox/vmm/hm.h>
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