VirtualBox

Changeset 47660 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Aug 12, 2013 12:37:34 AM (11 years ago)
Author:
vboxsync
Message:

VMM: Debug register handling redo. (only partly tested on AMD-V so far.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r47652 r47660  
    317317
    318318
     319/** @MAYBE_LOAD_DRx
     320 * Macro for updating DRx values in raw-mode and ring-0 contexts.
     321 */
     322#ifdef IN_RING0
     323# if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS)
     324#  ifndef VBOX_WITH_HYBRID_32BIT_KERNEL
     325#   define MAYBE_LOAD_DRx(a_pVCpu, a_fnLoad, a_uValue) \
     326    do { \
     327        if (!CPUMIsGuestInLongModeEx(&(a_pVCpu)->cpum.s.Guest)) \
     328            a_fnLoad(a_uValue); \
     329        else \
     330            (a_pVCpu)->cpum.s.fUseFlags |= CPUM_SYNC_DEBUG_REGS_HYPER; \
     331    } while (0)
     332#  else
     333#   define MAYBE_LOAD_DRx(a_pVCpu, a_fnLoad, a_uValue) \
     334    do { \
     335        /** @todo we're not loading the correct guest value here! */ \
     336        a_fnLoad(a_uValue); \
     337    } while (0)
     338#  endif
     339# else
     340# define MAYBE_LOAD_DRx(a_pVCpu, a_fnLoad, a_uValue) \
     341    do { \
     342        a_fnLoad(a_uValue); \
     343    } while (0)
     344# endif
     345
     346#elif defined(IN_RC)
     347# define MAYBE_LOAD_DRx(a_pVCpu, a_fnLoad, a_uValue) \
     348    do { \
     349        if ((a_pVCpu)->cpum.s.fUseFlags & CPUM_USED_DEBUG_REGS_HYPER) \
     350        { a_fnLoad(a_uValue); } \
     351    } while (0)
     352
     353#else
     354# define MAYBE_LOAD_DRx(a_pVCpu, a_fnLoad, a_uValue) do { } while (0)
     355#endif
     356
    319357VMMDECL(void) CPUMSetHyperDR0(PVMCPU pVCpu, RTGCUINTREG uDr0)
    320358{
    321359    pVCpu->cpum.s.Hyper.dr[0] = uDr0;
    322     /** @todo in GC we must load it! */
     360    MAYBE_LOAD_DRx(pVCpu, ASMSetDR0, uDr0);
    323361}
    324362
     
    327365{
    328366    pVCpu->cpum.s.Hyper.dr[1] = uDr1;
    329     /** @todo in GC we must load it! */
     367    MAYBE_LOAD_DRx(pVCpu, ASMSetDR1, uDr1);
    330368}
    331369
     
    334372{
    335373    pVCpu->cpum.s.Hyper.dr[2] = uDr2;
    336     /** @todo in GC we must load it! */
     374    MAYBE_LOAD_DRx(pVCpu, ASMSetDR2, uDr2);
    337375}
    338376
     
    341379{
    342380    pVCpu->cpum.s.Hyper.dr[3] = uDr3;
    343     /** @todo in GC we must load it! */
     381    MAYBE_LOAD_DRx(pVCpu, ASMSetDR3, uDr3);
    344382}
    345383
     
    348386{
    349387    pVCpu->cpum.s.Hyper.dr[6] = uDr6;
    350     /** @todo in GC we must load it! */
    351388}
    352389
     
    355392{
    356393    pVCpu->cpum.s.Hyper.dr[7] = uDr7;
    357     /** @todo in GC we must load it! */
     394#ifdef IN_RC
     395    MAYBE_LOAD_DRx(pVCpu, ASMSetDR7, uDr7);
     396#endif
    358397}
    359398
     
    21182157{
    21192158    pVCpu->cpum.s.Guest.dr[0] = uDr0;
    2120     return CPUMRecalcHyperDRx(pVCpu);
     2159    return CPUMRecalcHyperDRx(pVCpu, 0);
    21212160}
    21222161
     
    21252164{
    21262165    pVCpu->cpum.s.Guest.dr[1] = uDr1;
    2127     return CPUMRecalcHyperDRx(pVCpu);
     2166    return CPUMRecalcHyperDRx(pVCpu, 1);
    21282167}
    21292168
     
    21322171{
    21332172    pVCpu->cpum.s.Guest.dr[2] = uDr2;
    2134     return CPUMRecalcHyperDRx(pVCpu);
     2173    return CPUMRecalcHyperDRx(pVCpu, 2);
    21352174}
    21362175
     
    21392178{
    21402179    pVCpu->cpum.s.Guest.dr[3] = uDr3;
    2141     return CPUMRecalcHyperDRx(pVCpu);
     2180    return CPUMRecalcHyperDRx(pVCpu, 3);
    21422181}
    21432182
     
    21462185{
    21472186    pVCpu->cpum.s.Guest.dr[6] = uDr6;
    2148     return CPUMRecalcHyperDRx(pVCpu);
     2187    return VINF_SUCCESS; /* No need to recalc. */
    21492188}
    21502189
     
    21532192{
    21542193    pVCpu->cpum.s.Guest.dr[7] = uDr7;
    2155     return CPUMRecalcHyperDRx(pVCpu);
     2194    return CPUMRecalcHyperDRx(pVCpu, 7);
    21562195}
    21572196
     
    21642203        iReg += 2;
    21652204    pVCpu->cpum.s.Guest.dr[iReg] = Value;
    2166     return CPUMRecalcHyperDRx(pVCpu);
    2167 }
    2168 
    2169 
    2170 /**
    2171  * Recalculates the hypervisor DRx register values based on
    2172  * current guest registers and DBGF breakpoints.
    2173  *
    2174  * This is called whenever a guest DRx register is modified and when DBGF
    2175  * sets a hardware breakpoint. In guest context this function will reload
    2176  * any (hyper) DRx registers which comes out with a different value.
     2205    return CPUMRecalcHyperDRx(pVCpu, iReg);
     2206}
     2207
     2208
     2209/**
     2210 * Recalculates the hypervisor DRx register values based on current guest
     2211 * registers and DBGF breakpoints, updating changed registers depending on the
     2212 * context.
     2213 *
     2214 * This is called whenever a guest DRx register is modified (any context) and
     2215 * when DBGF sets a hardware breakpoint (ring-3 only, rendezvous).
     2216 *
     2217 * In raw-mode context this function will reload any (hyper) DRx registers which
     2218 * comes out with a different value.  It may also have to save the host debug
     2219 * registers if that haven't been done already.  In this context though, we'll
     2220 * be intercepting and emulating all DRx accesses, so the hypervisor DRx values
     2221 * are only important when breakpoints are actually enabled.
     2222 *
     2223 * In ring-0 (HM) context DR0-3 will be relocated by us, while DR7 will be
     2224 * reloaded by the HM code if it changes.  Further more, we will only use the
     2225 * combined register set when the VBox debugger is actually using hardware BPs,
     2226 * when it isn't we'll keep the guest DR0-3 + (maybe) DR6 loaded (DR6 doesn't
     2227 * concern us here).
     2228 *
     2229 * In ring-3 we won't be loading anything, so well calculate hypervisor values
     2230 * all the time.
    21772231 *
    21782232 * @returns VINF_SUCCESS.
    21792233 * @param   pVCpu       Pointer to the VMCPU.
    2180  */
    2181 VMMDECL(int) CPUMRecalcHyperDRx(PVMCPU pVCpu)
     2234 * @param   iGstReg     The guest debug register number that was modified.
     2235 *                      UINT8_MAX if not guest register.
     2236 */
     2237VMMDECL(int) CPUMRecalcHyperDRx(PVMCPU pVCpu, uint8_t iGstReg)
    21822238{
    21832239    PVM pVM = pVCpu->CTX_SUFF(pVM);
     
    21862242     * Compare the DR7s first.
    21872243     *
    2188      * We only care about the enabled flags. The GE and LE flags are always
    2189      * set and we don't care if the guest doesn't set them. GD is virtualized
    2190      * when we dispatch #DB, we never enable it.
     2244     * We only care about the enabled flags.  GD is virtualized when we
     2245     * dispatch the #DB, we never enable it.  The DBGF DR7 value is will
     2246     * always have the LE and GE bits set, so no need to check and disable
     2247     * stuff if they're cleared like we have to for the guest DR7.
    21912248     */
     2249    RTGCUINTREG uGstDr7 = CPUMGetGuestDR7(pVCpu);
     2250    if (!(uGstDr7 & (X86_DR7_LE | X86_DR7_GE)))
     2251        uGstDr7 = 0;
     2252    else if (!(uGstDr7 & X86_DR7_LE))
     2253        uGstDr7 &= ~X86_DR7_LE_ALL;
     2254    else if (!(uGstDr7 & X86_DR7_GE))
     2255        uGstDr7 &= ~X86_DR7_GE_ALL;
     2256
    21922257    const RTGCUINTREG uDbgfDr7 = DBGFBpGetDR7(pVM);
    2193 #ifdef CPUM_VIRTUALIZE_DRX
    2194     const RTGCUINTREG uGstDr7  = CPUMGetGuestDR7(pVCpu);
    2195 #else
    2196     const RTGCUINTREG uGstDr7  = 0;
    2197 #endif
    2198     if ((uGstDr7 | uDbgfDr7) & X86_DR7_ENABLED_MASK)
     2258    if ((HMIsEnabled(pVCpu->CTX_SUFF(pVM)) ? uDbgfDr7 : (uGstDr7 | uDbgfDr7)) & X86_DR7_ENABLED_MASK)
    21992259    {
     2260        Assert(!CPUMIsGuestDebugStateActive(pVCpu));
     2261
    22002262        /*
    2201          * Ok, something is enabled. Recalc each of the breakpoints.
    2202          * Straight forward code, not optimized/minimized in any way.
     2263         * Ok, something is enabled.  Recalc each of the breakpoints, taking
     2264         * the VM debugger ones of the guest ones.  In raw-mode context we will
     2265         * not allow breakpoints with values inside the hypervisor area.
    22032266         */
    22042267        RTGCUINTREG uNewDr7 = X86_DR7_GE | X86_DR7_LE | X86_DR7_RA1_MASK;
     
    22132276        else if (uGstDr7 & (X86_DR7_L0 | X86_DR7_G0))
    22142277        {
    2215             uNewDr7 |= uGstDr7 & (X86_DR7_L0 | X86_DR7_G0 | X86_DR7_RW0_MASK | X86_DR7_LEN0_MASK);
    22162278            uNewDr0 = CPUMGetGuestDR0(pVCpu);
     2279#ifdef IN_RC
     2280            if (MMHyperIsInsideArea(pVM, uNewDr0))
     2281                uNewDr0 = 0;
     2282            else
     2283#endif
     2284                uNewDr7 |= uGstDr7 & (X86_DR7_L0 | X86_DR7_G0 | X86_DR7_RW0_MASK | X86_DR7_LEN0_MASK);
    22172285        }
    22182286        else
    2219             uNewDr0 = pVCpu->cpum.s.Hyper.dr[0];
     2287            uNewDr0 = 0;
    22202288
    22212289        /* bp 1 */
     
    22282296        else if (uGstDr7 & (X86_DR7_L1 | X86_DR7_G1))
    22292297        {
    2230             uNewDr7 |= uGstDr7 & (X86_DR7_L1 | X86_DR7_G1 | X86_DR7_RW1_MASK | X86_DR7_LEN1_MASK);
    22312298            uNewDr1 = CPUMGetGuestDR1(pVCpu);
     2299#ifdef IN_RC
     2300            if (MMHyperIsInsideArea(pVM, uNewDr1))
     2301                uNewDr1 = 0;
     2302            else
     2303#endif
     2304                uNewDr7 |= uGstDr7 & (X86_DR7_L1 | X86_DR7_G1 | X86_DR7_RW1_MASK | X86_DR7_LEN1_MASK);
    22322305        }
    22332306        else
    2234             uNewDr1 = pVCpu->cpum.s.Hyper.dr[1];
     2307            uNewDr1 = 0;
    22352308
    22362309        /* bp 2 */
     
    22432316        else if (uGstDr7 & (X86_DR7_L2 | X86_DR7_G2))
    22442317        {
    2245             uNewDr7 |= uGstDr7 & (X86_DR7_L2 | X86_DR7_G2 | X86_DR7_RW2_MASK | X86_DR7_LEN2_MASK);
    22462318            uNewDr2 = CPUMGetGuestDR2(pVCpu);
     2319#ifdef IN_RC
     2320            if (MMHyperIsInsideArea(pVM, uNewDr2))
     2321                uNewDr2 = 0;
     2322            else
     2323#endif
     2324                uNewDr7 |= uGstDr7 & (X86_DR7_L2 | X86_DR7_G2 | X86_DR7_RW2_MASK | X86_DR7_LEN2_MASK);
    22472325        }
    22482326        else
    2249             uNewDr2 = pVCpu->cpum.s.Hyper.dr[2];
     2327            uNewDr2 = 0;
    22502328
    22512329        /* bp 3 */
     
    22582336        else if (uGstDr7 & (X86_DR7_L3 | X86_DR7_G3))
    22592337        {
    2260             uNewDr7 |= uGstDr7 & (X86_DR7_L3 | X86_DR7_G3 | X86_DR7_RW3_MASK | X86_DR7_LEN3_MASK);
    22612338            uNewDr3 = CPUMGetGuestDR3(pVCpu);
     2339#ifdef IN_RC
     2340            if (MMHyperIsInsideArea(pVM, uNewDr3))
     2341                uNewDr3 = 0;
     2342            else
     2343#endif
     2344                uNewDr7 |= uGstDr7 & (X86_DR7_L3 | X86_DR7_G3 | X86_DR7_RW3_MASK | X86_DR7_LEN3_MASK);
    22622345        }
    22632346        else
    2264             uNewDr3 = pVCpu->cpum.s.Hyper.dr[3];
     2347            uNewDr3 = 0;
    22652348
    22662349        /*
     
    22682351         */
    22692352#ifdef IN_RC
    2270         if (!(pVCpu->cpum.s.fUseFlags & CPUM_USE_DEBUG_REGS))
    2271         {
    2272             /** @todo save host DBx registers. */
    2273         }
     2353        /* Make sure to save host registers first. */
     2354        if (!(pVCpu->cpum.s.fUseFlags & (CPUM_USE_DEBUG_REGS_HOST | CPUM_USE_DEBUG_REGS_HYPER)))
     2355        {
     2356            Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_DEBUG_REGS_HOST));
     2357            pVCpu->cpum.s.Host.dr6 = ASMGetDR6();
     2358            pVCpu->cpum.s.Host.dr7 = ASMGetDR7();
     2359            pVCpu->cpum.s.fUseFlags |= CPUM_USE_DEBUG_REGS_HYPER;
     2360            ASMSetDR6(X86_DR6_INIT_VAL);
     2361        }
     2362        if (!(pVCpu->cpum.s.fUseFlags & CPUM_USED_DEBUG_REGS_HOST))
     2363        {
     2364            pVCpu->cpum.s.Host.dr0 = ASMGetDR0();
     2365            pVCpu->cpum.s.Host.dr1 = ASMGetDR1();
     2366            pVCpu->cpum.s.Host.dr2 = ASMGetDR2();
     2367            pVCpu->cpum.s.Host.dr3 = ASMGetDR3();
     2368            pVCpu->cpum.s.fUseFlags |= CPUM_USED_DEBUG_REGS_HOST | CPUM_USE_DEBUG_REGS_HYPER | CPUM_USED_DEBUG_REGS_HYPER;
     2369
     2370            /* We haven't loaded any hyper DRxes yet, so we'll have to load them all now. */
     2371            pVCpu->cpum.s.Hyper.dr[0] = uNewDr0;
     2372            ASMSetDR0(uNewDr0);
     2373            pVCpu->cpum.s.Hyper.dr[1] = uNewDr1;
     2374            ASMSetDR1(uNewDr1);
     2375            pVCpu->cpum.s.Hyper.dr[2] = uNewDr2;
     2376            ASMSetDR2(uNewDr2);
     2377            pVCpu->cpum.s.Hyper.dr[3] = uNewDr3;
     2378            ASMSetDR3(uNewDr3);
     2379            pVCpu->cpum.s.Hyper.dr[7] = uNewDr7;
     2380            ASMSetDR7(uNewDr7);
     2381        }
     2382        else
    22742383#endif
    2275         /** @todo Should this not be setting CPUM_USE_DEBUG_REGS_HYPER?
    2276          *        (CPUM_VIRTUALIZE_DRX is never defined). */
    2277         pVCpu->cpum.s.fUseFlags |= CPUM_USE_DEBUG_REGS;
    2278         if (uNewDr3 != pVCpu->cpum.s.Hyper.dr[3])
    2279             CPUMSetHyperDR3(pVCpu, uNewDr3);
    2280         if (uNewDr2 != pVCpu->cpum.s.Hyper.dr[2])
    2281             CPUMSetHyperDR2(pVCpu, uNewDr2);
    2282         if (uNewDr1 != pVCpu->cpum.s.Hyper.dr[1])
    2283             CPUMSetHyperDR1(pVCpu, uNewDr1);
    2284         if (uNewDr0 != pVCpu->cpum.s.Hyper.dr[0])
    2285             CPUMSetHyperDR0(pVCpu, uNewDr0);
    2286         if (uNewDr7 != pVCpu->cpum.s.Hyper.dr[7])
    2287             CPUMSetHyperDR7(pVCpu, uNewDr7);
     2384        {
     2385            pVCpu->cpum.s.fUseFlags |= CPUM_USE_DEBUG_REGS_HYPER;
     2386            if (uNewDr3 != pVCpu->cpum.s.Hyper.dr[3])
     2387                CPUMSetHyperDR3(pVCpu, uNewDr3);
     2388            if (uNewDr2 != pVCpu->cpum.s.Hyper.dr[2])
     2389                CPUMSetHyperDR2(pVCpu, uNewDr2);
     2390            if (uNewDr1 != pVCpu->cpum.s.Hyper.dr[1])
     2391                CPUMSetHyperDR1(pVCpu, uNewDr1);
     2392            if (uNewDr0 != pVCpu->cpum.s.Hyper.dr[0])
     2393                CPUMSetHyperDR0(pVCpu, uNewDr0);
     2394            if (uNewDr7 != pVCpu->cpum.s.Hyper.dr[7])
     2395                CPUMSetHyperDR7(pVCpu, uNewDr7);
     2396        }
    22882397    }
     2398#ifdef IN_RING0
     2399    else if (CPUMIsGuestDebugStateActive(pVCpu))
     2400    {
     2401        /*
     2402         * Reload the register that was modified.  Normally this won't happen
     2403         * as we won't intercept DRx writes when not having the hyper debug
     2404         * state loaded, but in case we do for some reason we'll simply deal
     2405         * with it.
     2406         */
     2407        switch (iGstReg)
     2408        {
     2409            case 0: ASMSetDR0(CPUMGetGuestDR0(pVCpu)); break;
     2410            case 1: ASMSetDR1(CPUMGetGuestDR1(pVCpu)); break;
     2411            case 2: ASMSetDR2(CPUMGetGuestDR2(pVCpu)); break;
     2412            case 3: ASMSetDR3(CPUMGetGuestDR3(pVCpu)); break;
     2413            default:
     2414                AssertReturn(iGstReg != UINT8_MAX, VERR_INTERNAL_ERROR_3);
     2415        }
     2416    }
     2417#endif
    22892418    else
    22902419    {
    2291 #ifdef IN_RC
    2292         if (pVCpu->cpum.s.fUseFlags & CPUM_USE_DEBUG_REGS)
    2293         {
    2294             /** @todo restore host DBx registers. */
    2295         }
     2420        /*
     2421         * No active debug state any more.  In raw-mode this means we have to
     2422         * make sure DR7 has everything disabled now, if we armed it already.
     2423         *
     2424         * In the ring-0 this only happens when we decided to lazy load the
     2425         * debug state because it wasn't active, and that didn't change with
     2426         * the latest changes, so nothing to do here.
     2427         */
     2428#if defined(IN_RC)
     2429        if (pVCpu->cpum.s.fUseFlags & CPUM_USED_DEBUG_REGS_HYPER)
     2430        {
     2431            ASMSetDR7(X86_DR7_INIT_VAL);
     2432            if (pVCpu->cpum.s.Hyper.dr[0])
     2433                ASMSetDR0(0);
     2434            if (pVCpu->cpum.s.Hyper.dr[1])
     2435                ASMSetDR1(0);
     2436            if (pVCpu->cpum.s.Hyper.dr[2])
     2437                ASMSetDR2(0);
     2438            if (pVCpu->cpum.s.Hyper.dr[3])
     2439                ASMSetDR3(0);
     2440            pVCpu->cpum.s.fUseFlags &= ~CPUM_USED_DEBUG_REGS_HYPER;
     2441        }
     2442
     2443#else defined(IN_RING0)
     2444        Assert(!CPUMIsHyperDebugStateActive(pVCpu)); /* (can only change while in ring-3) */
    22962445#endif
    2297         pVCpu->cpum.s.fUseFlags &= ~CPUM_USE_DEBUG_REGS;
     2446        pVCpu->cpum.s.fUseFlags &= ~CPUM_USE_DEBUG_REGS_HYPER;
     2447
     2448        /* Clear all the registers. */
     2449        pVCpu->cpum.s.Hyper.dr[7] = X86_DR7_RA1_MASK;
     2450        pVCpu->cpum.s.Hyper.dr[3] = 0;
     2451        pVCpu->cpum.s.Hyper.dr[2] = 0;
     2452        pVCpu->cpum.s.Hyper.dr[1] = 0;
     2453        pVCpu->cpum.s.Hyper.dr[0] = 0;
     2454
    22982455    }
    22992456    Log2(("CPUMRecalcHyperDRx: fUseFlags=%#x %RGr %RGr %RGr %RGr  %RGr %RGr\n",
    23002457          pVCpu->cpum.s.fUseFlags, pVCpu->cpum.s.Hyper.dr[0], pVCpu->cpum.s.Hyper.dr[1],
    2301          pVCpu->cpum.s.Hyper.dr[2], pVCpu->cpum.s.Hyper.dr[3], pVCpu->cpum.s.Hyper.dr[6],
    2302          pVCpu->cpum.s.Hyper.dr[7]));
     2458          pVCpu->cpum.s.Hyper.dr[2], pVCpu->cpum.s.Hyper.dr[3], pVCpu->cpum.s.Hyper.dr[6],
     2459          pVCpu->cpum.s.Hyper.dr[7]));
    23032460
    23042461    return VINF_SUCCESS;
     
    27212878VMMDECL(bool) CPUMIsHostUsingSysEnter(PVM pVM)
    27222879{
    2723     return (pVM->cpum.s.fHostUseFlags & CPUM_USE_SYSENTER) != 0;
     2880    return RT_BOOL(pVM->cpum.s.fHostUseFlags & CPUM_USE_SYSENTER);
    27242881}
    27252882
     
    27332890VMMDECL(bool) CPUMIsHostUsingSysCall(PVM pVM)
    27342891{
    2735     return (pVM->cpum.s.fHostUseFlags & CPUM_USE_SYSCALL) != 0;
     2892    return RT_BOOL(pVM->cpum.s.fHostUseFlags & CPUM_USE_SYSCALL);
    27362893}
    27372894
     
    27592916VMMDECL(bool) CPUMIsGuestFPUStateActive(PVMCPU pVCpu)
    27602917{
    2761     return (pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU) != 0;
     2918    return RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU);
    27622919}
    27632920
     
    27662923 * Deactivate the FPU/XMM state of the guest OS.
    27672924 * @param   pVCpu       Pointer to the VMCPU.
     2925 *
     2926 * @todo    r=bird: Why is this needed? Looks like a workaround for mishandled
     2927 *          FPU state management.
    27682928 */
    27692929VMMDECL(void) CPUMDeactivateGuestFPUState(PVMCPU pVCpu)
    27702930{
     2931    Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU));
    27712932    pVCpu->cpum.s.fUseFlags &= ~CPUM_USED_FPU;
    27722933}
     
    27812942VMMDECL(bool) CPUMIsGuestDebugStateActive(PVMCPU pVCpu)
    27822943{
    2783     return (pVCpu->cpum.s.fUseFlags & CPUM_USE_DEBUG_REGS) != 0;
     2944    return RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_DEBUG_REGS_GUEST);
    27842945}
    27852946
     
    27922953VMMDECL(bool) CPUMIsHyperDebugStateActive(PVMCPU pVCpu)
    27932954{
    2794     return (pVCpu->cpum.s.fUseFlags & CPUM_USE_DEBUG_REGS_HYPER) != 0;
     2955    return RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_DEBUG_REGS_HYPER);
    27952956}
    27962957
     
    28012962 * @returns boolean
    28022963 * @param   pVM         Pointer to the VM.
     2964 * @todo    This API doesn't make sense any more.
    28032965 */
    28042966VMMDECL(void) CPUMDeactivateGuestDebugState(PVMCPU pVCpu)
    28052967{
    2806     pVCpu->cpum.s.fUseFlags &= ~CPUM_USE_DEBUG_REGS;
    2807 }
    2808 
    2809 
    2810 /**
    2811  * Mark the hypervisor's debug state as inactive.
    2812  *
    2813  * @returns boolean
    2814  * @param   pVM         Pointer to the VM.
    2815  */
    2816 VMMDECL(void) CPUMDeactivateHyperDebugState(PVMCPU pVCpu)
    2817 {
    2818     pVCpu->cpum.s.fUseFlags &= ~CPUM_USE_DEBUG_REGS_HYPER;
     2968    Assert(!(pVCpu->cpum.s.fUseFlags & (CPUM_USED_DEBUG_REGS_GUEST | CPUM_USED_DEBUG_REGS_HYPER | CPUM_USED_DEBUG_REGS_HOST)));
    28192969}
    28202970
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