VirtualBox

Ignore:
Timestamp:
Dec 4, 2024 3:20:14 PM (6 weeks ago)
Author:
vboxsync
Message:

VMM: Cleaning up ARMv8 / x86 split. jiraref:VBP-1470

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/DBGFStack.cpp

    r106383 r107227  
    7676    {
    7777        m_State.u32Magic     = RTDBGUNWINDSTATE_MAGIC;
    78 #if defined(VBOX_VMM_TARGET_ARMV8)
     78#ifdef VBOX_VMM_TARGET_ARMV8
    7979        m_State.enmArch      = RTLDRARCH_ARM64;
     80#elif defined(VBOX_VMM_TARGET_X86)
     81        m_State.enmArch      = RTLDRARCH_AMD64;
    8082#else
    81         m_State.enmArch      = RTLDRARCH_AMD64;
     83# error "port me"
    8284#endif
    8385        m_State.pfnReadStack = dbgfR3StackReadCallback;
     
    8688        if (pInitialCtx)
    8789        {
    88 #if defined(VBOX_VMM_TARGET_ARMV8)
     90#ifdef VBOX_VMM_TARGET_ARMV8
    8991            AssertCompile(RT_ELEMENTS(m_State.u.armv8.auGprs) == RT_ELEMENTS(pInitialCtx->aGRegs));
    9092
     
    9597            for (uint32_t i = 0; i < RT_ELEMENTS(m_State.u.armv8.auGprs); i++)
    9698                m_State.u.armv8.auGprs[i] = pInitialCtx->aGRegs[i].x;
    97 #else
     99
     100#elif defined(VBOX_VMM_TARGET_X86)
    98101            m_State.u.x86.auRegs[X86_GREG_xAX] = pInitialCtx->rax;
    99102            m_State.u.x86.auRegs[X86_GREG_xCX] = pInitialCtx->rcx;
     
    174177static DECLCALLBACK(int) dbgfR3StackReadCallback(PRTDBGUNWINDSTATE pThis, RTUINTPTR uSp, size_t cbToRead, void *pvDst)
    175178{
    176 #if defined(VBOX_VMM_TARGET_ARMV8)
     179#ifdef VBOX_VMM_TARGET_ARMV8
    177180    Assert(pThis->enmArch == RTLDRARCH_ARM64);
    178 #else
     181#elif defined(VBOX_VMM_TARGET_X86)
    179182    Assert(   pThis->enmArch == RTLDRARCH_AMD64
    180183           || pThis->enmArch == RTLDRARCH_X86_32);
     184#else
     185# error "port me"
    181186#endif
    182187
     
    188193    else
    189194    {
    190 #if defined(VBOX_VMM_TARGET_ARMV8)
    191         DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &SrcAddr, uSp);
    192 #else
     195#ifdef VBOX_VMM_TARGET_X86
    193196        if (   pThis->enmArch == RTLDRARCH_X86_32
    194197            || pThis->enmArch == RTLDRARCH_X86_16)
     
    201204        else
    202205            DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &SrcAddr, uSp);
     206#else
     207        DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &SrcAddr, uSp);
    203208#endif
    204209    }
     
    221226static bool dbgfR3UnwindCtxSetPcAndSp(PDBGFUNWINDCTX pUnwindCtx, PCDBGFADDRESS pAddrPC, PCDBGFADDRESS pAddrStack)
    222227{
    223 #if defined(VBOX_VMM_TARGET_ARMV8)
     228#ifdef VBOX_VMM_TARGET_ARMV8
    224229    Assert(pUnwindCtx->m_State.enmArch == RTLDRARCH_ARM64);
    225230
     
    228233    Assert(!DBGFADDRESS_IS_FAR(pAddrStack));
    229234    pUnwindCtx->m_State.u.armv8.uSpEl1 = pAddrStack->FlatPtr; /** @todo EL0 stack pointer. */
    230 #else
     235
     236#elif defined(VBOX_VMM_TARGET_X86)
    231237    Assert(   pUnwindCtx->m_State.enmArch == RTLDRARCH_AMD64
    232238           || pUnwindCtx->m_State.enmArch == RTLDRARCH_X86_32);
     
    246252        pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_SS]  = pAddrStack->Sel;
    247253    }
     254
     255#else
     256# error "port me"
    248257#endif
    249258
     
    502511
    503512
    504 #if defined(VBOX_VMM_TARGET_ARMV8)
    505513/**
    506514 * Internal worker routine.
     
    510518 *      4  return address
    511519 *      0  old fp; current fp points here
     520 *
     521 * On x86 the typical stack frame layout is like this:
     522 *     ..  ..
     523 *     16  parameter 2
     524 *     12  parameter 1
     525 *      8  parameter 0
     526 *      4  return address
     527 *      0  old ebp; current ebp points here
    512528 */
    513529DECL_NO_INLINE(static, int) dbgfR3StackWalk(PDBGFUNWINDCTX pUnwindCtx, PDBGFSTACKFRAME pFrame, bool fFirst)
     
    552568     * Figure the return address size and use the old PC to guess stack item size.
    553569     */
     570#ifdef VBOX_VMM_TARGET_ARMV8
    554571    unsigned const cbRetAddr   = 8;
    555572    unsigned const cbStackItem = 8; /** @todo AARCH32. */
    556573    PVMCPUCC const pVCpu = pUnwindCtx->m_pUVM->pVM->apCpusR3[pUnwindCtx->m_idCpu];
    557574
    558     /*
    559      * Read the raw frame data.
    560      * We double cbRetAddr in case we have a far return.
    561      */
    562     union
    563     {
    564         uint64_t *pu64;
    565         uint32_t *pu32;
    566         uint8_t  *pb;
    567         void     *pv;
    568     } u, uRet, uArgs, uBp;
    569     size_t cbRead = cbRetAddr * 2 + cbStackItem + sizeof(pFrame->Args);
    570     u.pv = alloca(cbRead);
    571     uBp = u;
    572     uRet.pb = u.pb + cbStackItem;
    573     uArgs.pb = u.pb + cbStackItem + cbRetAddr;
    574 
    575     Assert(DBGFADDRESS_IS_VALID(&pFrame->AddrFrame));
    576     int rc = dbgfR3StackRead(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, u.pv, &pFrame->AddrFrame, cbRead, &cbRead);
    577     if (   RT_FAILURE(rc)
    578         || cbRead < cbRetAddr + cbStackItem)
    579         pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_LAST;
    580 
    581     /*
    582      * Return Frame address.
    583      *
    584      * If we used unwind info to get here, the unwind register context will be
    585      * positioned after the return instruction has been executed.  We start by
    586      * picking up the rBP register here for return frame and will try improve
    587      * on it further down by using unwind info.
    588      */
    589     pFrame->AddrReturnFrame = pFrame->AddrFrame;
    590     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    591     {
    592         AssertFailed(); /** @todo */
    593     }
    594     else
    595     {
    596         switch (cbStackItem)
    597         {
    598             case 4:     pFrame->AddrReturnFrame.off = *uBp.pu32; break;
    599             case 8:     pFrame->AddrReturnFrame.off = CPUMGetGCPtrPacStripped(pVCpu, *uBp.pu64); break;
    600             default:    AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_1);
    601         }
    602 
    603         pFrame->AddrReturnFrame.FlatPtr += pFrame->AddrReturnFrame.off - pFrame->AddrFrame.off;
    604     }
    605 
    606     /*
    607      * Return Stack Address.
    608      */
    609     pFrame->AddrReturnStack = pFrame->AddrReturnFrame;
    610     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    611     {
    612         AssertFailed();
    613     }
    614     else
    615     {
    616         pFrame->AddrReturnStack.off     += cbStackItem + cbRetAddr;
    617         pFrame->AddrReturnStack.FlatPtr += cbStackItem + cbRetAddr;
    618     }
    619 
    620     /*
    621      * Return PC.
    622      */
    623     pFrame->AddrReturnPC = pFrame->AddrPC;
    624     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    625     {
    626         AssertFailed();
    627     }
    628     else
    629     {
    630         switch (pFrame->enmReturnType)
    631         {
    632             case RTDBGRETURNTYPE_NEAR64:
    633                 if (DBGFADDRESS_IS_VALID(&pFrame->AddrReturnPC))
    634                 {
    635                     pFrame->AddrReturnPC.FlatPtr += CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64) - pFrame->AddrReturnPC.off;
    636                     pFrame->AddrReturnPC.off      = CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64);
    637                 }
    638                 else
    639                     DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnPC, CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64));
    640                 break;
    641             default:
    642                 AssertMsgFailed(("enmReturnType=%d\n", pFrame->enmReturnType));
    643                 return VERR_INVALID_PARAMETER;
    644         }
    645     }
    646 
    647 
    648     pFrame->pSymReturnPC  = DBGFR3AsSymbolByAddrA(pUnwindCtx->m_pUVM, pUnwindCtx->m_hAs, &pFrame->AddrReturnPC,
    649                                                   RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL | RTDBGSYMADDR_FLAGS_SKIP_ABS_IN_DEFERRED,
    650                                                   NULL /*poffDisp*/, NULL /*phMod*/);
    651     pFrame->pLineReturnPC = DBGFR3AsLineByAddrA(pUnwindCtx->m_pUVM, pUnwindCtx->m_hAs, &pFrame->AddrReturnPC,
    652                                                 NULL /*poffDisp*/, NULL /*phMod*/);
    653 
    654     /*
    655      * Frame bitness flag.
    656      */
    657     /** @todo use previous return type for this? */
    658     pFrame->fFlags &= ~(DBGFSTACKFRAME_FLAGS_32BIT | DBGFSTACKFRAME_FLAGS_64BIT);
    659     switch (cbStackItem)
    660     {
    661         case 4: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_32BIT; break;
    662         case 8: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_64BIT; break;
    663         default:    AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_2);
    664     }
    665 
    666     /*
    667      * The arguments.
    668      */
    669     memcpy(&pFrame->Args, uArgs.pv, sizeof(pFrame->Args));
    670 
    671     /*
    672      * Collect register changes.
    673      * Then call the OS layer to assist us (e.g. NT trap frames).
    674      */
    675     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    676     {
    677         AssertFailed();
    678     }
    679 
    680     /*
    681      * Try use unwind information to locate the return frame pointer (for the
    682      * next loop iteration).
    683      */
    684     Assert(!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET));
    685     pFrame->enmReturnFrameReturnType = RTDBGRETURNTYPE_INVALID;
    686     if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_LAST))
    687     {
    688         /* Set PC and SP if we didn't unwind our way here (context will then point
    689            and the return PC and SP already). */
    690         if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO))
    691         {
    692             dbgfR3UnwindCtxSetPcAndSp(pUnwindCtx, &pFrame->AddrReturnPC, &pFrame->AddrReturnStack);
    693             pUnwindCtx->m_State.u.armv8.auGprs[ARMV8_A64_REG_BP] = pFrame->AddrReturnFrame.off;
    694         }
    695         if (pUnwindCtx->m_State.enmArch == RTLDRARCH_ARM64)
    696             pUnwindCtx->m_State.u.armv8.Loaded.fAll = 0;
    697         else
    698             AssertFailed();
    699         if (dbgfR3UnwindCtxDoOneFrame(pUnwindCtx))
    700         {
    701             Assert(!pUnwindCtx->m_fIsHostRing0);
    702 
    703             DBGFADDRESS AddrReturnFrame = pFrame->AddrReturnFrame;
    704             DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &AddrReturnFrame, pUnwindCtx->m_State.u.armv8.FrameAddr);
    705             pFrame->AddrReturnFrame = AddrReturnFrame;
    706 
    707             pFrame->enmReturnFrameReturnType = pUnwindCtx->m_State.enmRetType;
    708             pFrame->fFlags                  |= DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET;
    709         }
    710     }
    711 
    712     return VINF_SUCCESS;
    713 }
    714 #else
    715 /**
    716  * Internal worker routine.
    717  *
    718  * On x86 the typical stack frame layout is like this:
    719  *     ..  ..
    720  *     16  parameter 2
    721  *     12  parameter 1
    722  *      8  parameter 0
    723  *      4  return address
    724  *      0  old ebp; current ebp points here
    725  */
    726 DECL_NO_INLINE(static, int) dbgfR3StackWalk(PDBGFUNWINDCTX pUnwindCtx, PDBGFSTACKFRAME pFrame, bool fFirst)
    727 {
    728     /*
    729      * Stop if we got a read error in the previous run.
    730      */
    731     if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_LAST)
    732         return VERR_NO_MORE_FILES;
    733 
    734     /*
    735      * Advance the frame (except for the first).
    736      */
    737     if (!fFirst) /** @todo we can probably eliminate this fFirst business... */
    738     {
    739         /* frame, pc and stack is taken from the existing frames return members. */
    740         pFrame->AddrFrame = pFrame->AddrReturnFrame;
    741         pFrame->AddrPC    = pFrame->AddrReturnPC;
    742         pFrame->pSymPC    = pFrame->pSymReturnPC;
    743         pFrame->pLinePC   = pFrame->pLineReturnPC;
    744 
    745         /* increment the frame number. */
    746         pFrame->iFrame++;
    747 
    748         /* UNWIND_INFO_RET -> USED_UNWIND; return type */
    749         if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET))
    750             pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO;
    751         else
    752         {
    753             pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO;
    754             pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET;
    755             if (pFrame->enmReturnFrameReturnType != RTDBGRETURNTYPE_INVALID)
    756             {
    757                 pFrame->enmReturnType = pFrame->enmReturnFrameReturnType;
    758                 pFrame->enmReturnFrameReturnType = RTDBGRETURNTYPE_INVALID;
    759             }
    760         }
    761         pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_TRAP_FRAME;
    762     }
    763 
    764     /*
    765      * Figure the return address size and use the old PC to guess stack item size.
    766      */
     575#elif defined(VBOX_VMM_TARGET_X86)
    767576    /** @todo this is bogus... */
    768577    unsigned cbRetAddr = RTDbgReturnTypeSize(pFrame->enmReturnType);
     
    797606            }
    798607    }
     608#endif
    799609
    800610    /*
     
    810620        void     *pv;
    811621    } u, uRet, uArgs, uBp;
    812     size_t cbRead = cbRetAddr*2 + cbStackItem + sizeof(pFrame->Args);
     622    size_t cbRead = cbRetAddr * 2 + cbStackItem + sizeof(pFrame->Args);
    813623    u.pv = alloca(cbRead);
    814624    uBp = u;
     
    833643    if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    834644    {
     645#ifdef VBOX_VMM_TARGET_ARMV8
     646        AssertFailed(); /** @todo */
     647
     648#elif defined(VBOX_VMM_TARGET_X86)
    835649        if (   pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_PRIV
    836650            || pFrame->enmReturnType == RTDBGRETURNTYPE_IRET64)
     
    846660            pFrame->AddrReturnFrame.FlatPtr += pFrame->AddrReturnFrame.off - pFrame->AddrFrame.off;
    847661        }
     662#endif /* VBOX_VMM_TARGET_X86 */
    848663    }
    849664    else
     
    851666        switch (cbStackItem)
    852667        {
     668#ifdef VBOX_VMM_TARGET_ARMV8
     669            case 8:     pFrame->AddrReturnFrame.off = CPUMGetGCPtrPacStripped(pVCpu, *uBp.pu64); break;
     670#else
     671            case 8:     pFrame->AddrReturnFrame.off = *uBp.pu64; break;
     672#endif
     673            case 4:     pFrame->AddrReturnFrame.off = *uBp.pu32; break;
     674#ifdef VBOX_VMM_TARGET_X86
    853675            case 2:     pFrame->AddrReturnFrame.off = *uBp.pu16; break;
    854             case 4:     pFrame->AddrReturnFrame.off = *uBp.pu32; break;
    855             case 8:     pFrame->AddrReturnFrame.off = *uBp.pu64; break;
     676#endif
    856677            default:    AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_1);
    857678        }
    858679
     680#ifdef VBOX_VMM_TARGET_X86
    859681        /* Watcom tries to keep the frame pointer odd for far returns. */
    860682        if (   cbStackItem <= 4
     
    872694                else if (pFrame->enmReturnType == RTDBGRETURNTYPE_NEAR32)
    873695                {
    874 #if 1
     696# if 1
    875697                    /* Assumes returning 32-bit code. */
    876698                    pFrame->fFlags       |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN;
    877699                    pFrame->enmReturnType = RTDBGRETURNTYPE_FAR32;
    878700                    cbRetAddr = 8;
    879 #else
     701# else
    880702                    /* Assumes returning 16-bit code. */
    881703                    pFrame->fFlags       |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN;
    882704                    pFrame->enmReturnType = RTDBGRETURNTYPE_FAR16;
    883705                    cbRetAddr = 4;
    884 #endif
     706# endif
    885707                }
    886708            }
     
    901723            uArgs.pb = u.pb + cbStackItem + cbRetAddr;
    902724        }
     725#endif /* VBOX_VMM_TARGET_X86 */
    903726
    904727        pFrame->AddrReturnFrame.FlatPtr += pFrame->AddrReturnFrame.off - pFrame->AddrFrame.off;
     
    911734    if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    912735    {
     736#ifdef VBOX_VMM_TARGET_ARMV8
     737        AssertFailed();
     738
     739#elif defined(VBOX_VMM_TARGET_X86)
    913740        if (   pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_PRIV
    914741            || pFrame->enmReturnType == RTDBGRETURNTYPE_IRET64)
     
    924751            pFrame->AddrReturnStack.FlatPtr += pFrame->AddrReturnStack.off - pFrame->AddrStack.off;
    925752        }
     753#endif /* VBOX_VMM_TARGET_X86 */
    926754    }
    927755    else
     
    937765    if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    938766    {
     767#ifdef VBOX_VMM_TARGET_ARMV8
     768        AssertFailed();
     769
     770#elif defined(VBOX_VMM_TARGET_X86)
    939771        if (RTDbgReturnTypeIsNear(pFrame->enmReturnType))
    940772        {
     
    945777            DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC,
    946778                                 pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_CS], pUnwindCtx->m_State.uPc);
     779#endif
    947780    }
    948781    else
    949782    {
     783#ifdef VBOX_VMM_TARGET_ARMV8
     784        switch (pFrame->enmReturnType)
     785        {
     786            case RTDBGRETURNTYPE_NEAR64:
     787                if (DBGFADDRESS_IS_VALID(&pFrame->AddrReturnPC))
     788                {
     789                    pFrame->AddrReturnPC.FlatPtr += CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64) - pFrame->AddrReturnPC.off;
     790                    pFrame->AddrReturnPC.off      = CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64);
     791                }
     792                else
     793                    DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnPC, CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64));
     794                break;
     795            default:
     796                AssertMsgFailed(("enmReturnType=%d\n", pFrame->enmReturnType));
     797                return VERR_INVALID_PARAMETER;
     798        }
     799
     800#elif defined(VBOX_VMM_TARGET_X86)
    950801        int rc2;
    951802        switch (pFrame->enmReturnType)
     
    1020871                return VERR_INVALID_PARAMETER;
    1021872        }
     873#endif /* VBOX_VMM_TARGET_X86 */
    1022874    }
    1023875
     
    1036888    switch (cbStackItem)
    1037889    {
    1038         case 2: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_16BIT; break;
    1039890        case 4: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_32BIT; break;
    1040891        case 8: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_64BIT; break;
     892#ifdef VBOX_VMM_TARGET_X86
     893        case 2: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_16BIT; break;
     894#endif
    1041895        default:    AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_2);
    1042896    }
     
    1053907    if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)
    1054908    {
     909#if defined(VBOX_VMM_TARGET_X86)
    1055910        rc = dbgfR3StackWalkCollectRegisterChanges(pUnwindCtx->m_pUVM, pFrame, &pUnwindCtx->m_State);
    1056911        if (RT_FAILURE(rc))
     
    1065920                return rc;
    1066921        }
     922#else
     923        AssertFailed();
     924#endif
    1067925    }
    1068926
     
    1080938        {
    1081939            dbgfR3UnwindCtxSetPcAndSp(pUnwindCtx, &pFrame->AddrReturnPC, &pFrame->AddrReturnStack);
     940#ifdef VBOX_VMM_TARGET_ARMV8
     941            pUnwindCtx->m_State.u.armv8.auGprs[ARMV8_A64_REG_BP] = pFrame->AddrReturnFrame.off;
     942#elif defined(VBOX_VMM_TARGET_X86)
    1082943            pUnwindCtx->m_State.u.x86.auRegs[X86_GREG_xBP] = pFrame->AddrReturnFrame.off;
    1083         }
     944#endif
     945        }
     946
     947#ifdef VBOX_VMM_TARGET_ARMV8
     948        if (pUnwindCtx->m_State.enmArch == RTLDRARCH_ARM64)
     949            pUnwindCtx->m_State.u.armv8.Loaded.fAll = 0;
     950        else
     951            AssertFailed();
     952
     953#elif defined(VBOX_VMM_TARGET_X86)
    1084954        /** @todo Reevaluate CS if the previous frame return type isn't near. */
    1085955        if (   pUnwindCtx->m_State.enmArch == RTLDRARCH_AMD64
     
    1089959        else
    1090960            AssertFailed();
     961#endif
     962
    1091963        if (dbgfR3UnwindCtxDoOneFrame(pUnwindCtx))
    1092964        {
     965#ifdef VBOX_VMM_TARGET_ARMV8
     966            Assert(!pUnwindCtx->m_fIsHostRing0);
     967#elif defined(VBOX_VMM_TARGET_X86)
    1093968            if (pUnwindCtx->m_fIsHostRing0)
    1094969                DBGFR3AddrFromHostR0(&pFrame->AddrReturnFrame, pUnwindCtx->m_State.u.x86.FrameAddr.off);
    1095970            else
     971#endif
    1096972            {
    1097973                DBGFADDRESS AddrReturnFrame = pFrame->AddrReturnFrame;
     974#ifdef VBOX_VMM_TARGET_ARMV8
     975                DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &AddrReturnFrame, pUnwindCtx->m_State.u.armv8.FrameAddr);
     976#elif defined(VBOX_VMM_TARGET_X86)
    1098977                rc = DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &AddrReturnFrame,
    1099978                                          pUnwindCtx->m_State.u.x86.FrameAddr.sel, pUnwindCtx->m_State.u.x86.FrameAddr.off);
    1100979                if (RT_SUCCESS(rc))
     980#endif
    1101981                    pFrame->AddrReturnFrame = AddrReturnFrame;
    1102982            }
     
    1108988    return VINF_SUCCESS;
    1109989}
    1110 #endif
    1111990
    1112991
     
    11371016
    11381017    int rc = VINF_SUCCESS;
    1139 #if defined(VBOX_VMM_TARGET_ARMV8)
    11401018    if (pAddrPC)
    11411019        pCur->AddrPC = *pAddrPC;
     1020#ifdef VBOX_VMM_TARGET_ARMV8
    11421021    else
    11431022        DBGFR3AddrFromFlat(pUVM, &pCur->AddrPC, pCtx->Pc.u64);
    1144 #else
    1145     if (pAddrPC)
    1146         pCur->AddrPC = *pAddrPC;
     1023#elif defined(VBOX_VMM_TARGET_X86)
    11471024    else if (enmCodeType != DBGFCODETYPE_GUEST)
    11481025        DBGFR3AddrFromFlat(pUVM, &pCur->AddrPC, pCtx->rip);
     
    11671044            PVMCPU const   pVCpu      = pUVM->pVM->apCpusR3[idCpu];
    11681045            CPUMMODE const enmCpuMode = CPUMGetGuestMode(pVCpu);
    1169 #if defined(VBOX_VMM_TARGET_ARMV8)
     1046
     1047#ifdef VBOX_VMM_TARGET_ARMV8
    11701048            /** @todo */
    11711049            Assert(enmCpuMode == CPUMMODE_ARMV8_AARCH64); RT_NOREF(enmCpuMode);
     
    11731051            if (enmReturnType == RTDBGRETURNTYPE_INVALID)
    11741052                pCur->enmReturnType = RTDBGRETURNTYPE_NEAR64;
    1175 #else
     1053
     1054#elif defined(VBOX_VMM_TARGET_X86)
    11761055            if (enmCpuMode == CPUMMODE_REAL)
    11771056            {
     
    11961075        }
    11971076
    1198 #if !defined(VBOX_VMM_TARGET_ARMV8)
     1077#ifdef VBOX_VMM_TARGET_X86
    11991078        if (enmReturnType == RTDBGRETURNTYPE_INVALID)
    12001079            switch (pCur->AddrPC.fFlags & DBGFADDRESS_FLAGS_TYPE_MASK)
     
    12131092
    12141093
    1215 #if defined(VBOX_VMM_TARGET_ARMV8)
    12161094        if (pAddrStack)
    12171095            pCur->AddrStack = *pAddrStack;
     1096#ifdef VBOX_VMM_TARGET_ARMV8
    12181097        else
    12191098            DBGFR3AddrFromFlat(pUVM, &pCur->AddrStack, pCtx->aSpReg[1].u64 & fAddrMask); /** @todo EL0 stack. */
    1220 
    1221         Assert(!(pCur->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO));
    1222         if (pAddrFrame)
    1223             pCur->AddrFrame = *pAddrFrame;
    1224         else
    1225             DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, pCtx->aGRegs[ARMV8_A64_REG_BP].x & fAddrMask);
    1226 #else
    1227         if (pAddrStack)
    1228             pCur->AddrStack = *pAddrStack;
     1099#elif defined(VBOX_VMM_TARGET_X86)
    12291100        else if (enmCodeType != DBGFCODETYPE_GUEST)
    12301101            DBGFR3AddrFromFlat(pUVM, &pCur->AddrStack, pCtx->rsp & fAddrMask);
    12311102        else
    12321103            rc = DBGFR3AddrFromSelOff(pUVM, idCpu, &pCur->AddrStack, pCtx->ss.Sel, pCtx->rsp & fAddrMask);
     1104#endif
    12331105
    12341106        Assert(!(pCur->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO));
    12351107        if (pAddrFrame)
    12361108            pCur->AddrFrame = *pAddrFrame;
     1109#ifdef VBOX_VMM_TARGET_ARMV8
     1110        else
     1111            DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, pCtx->aGRegs[ARMV8_A64_REG_BP].x & fAddrMask);
     1112#elif defined(VBOX_VMM_TARGET_X86)
    12371113        else if (enmCodeType != DBGFCODETYPE_GUEST)
    12381114            DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, pCtx->rbp & fAddrMask);
     
    12501126            pCur->enmReturnType = UnwindCtx.m_State.enmRetType;
    12511127            pCur->fFlags |= DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO;
    1252 #if defined(VBOX_VMM_TARGET_ARMV8)
     1128#ifdef VBOX_VMM_TARGET_ARMV8
    12531129            DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, UnwindCtx.m_State.u.armv8.FrameAddr);
    1254 #else
     1130#elif defined(VBOX_VMM_TARGET_X86)
    12551131            if (!UnwindCtx.m_fIsHostRing0)
    12561132                rc = DBGFR3AddrFromSelOff(UnwindCtx.m_pUVM, UnwindCtx.m_idCpu, &pCur->AddrFrame,
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