VirtualBox

Changeset 92727 in vbox


Ignore:
Timestamp:
Dec 3, 2021 12:33:33 AM (3 years ago)
Author:
vboxsync
Message:

VMM/DBGF: Adjusted the breakpoint code for driverless operation (minimal testing). bugref:10138

File:
1 edited

Legend:

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

    r92726 r92727  
    305305        && !pUVM->dbgf.s.paBpLocL1R3)
    306306    {
    307         DBGFBPINITREQ Req;
    308         Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    309         Req.Hdr.cbReq    = sizeof(Req);
    310         Req.paBpLocL1R3  = NULL;
    311         int rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_INIT, 0 /*u64Arg*/, &Req.Hdr);
    312         AssertLogRelMsgRCReturn(rc, ("VMMR0_DO_DBGF_BP_INIT failed: %Rrc\n", rc), rc);
    313         pUVM->dbgf.s.paBpLocL1R3 = Req.paBpLocL1R3;
     307        if (!SUPR3IsDriverless())
     308        {
     309            DBGFBPINITREQ Req;
     310            Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
     311            Req.Hdr.cbReq    = sizeof(Req);
     312            Req.paBpLocL1R3  = NULL;
     313            int rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_INIT, 0 /*u64Arg*/, &Req.Hdr);
     314            AssertLogRelMsgRCReturn(rc, ("VMMR0_DO_DBGF_BP_INIT failed: %Rrc\n", rc), rc);
     315            pUVM->dbgf.s.paBpLocL1R3 = Req.paBpLocL1R3;
     316        }
     317        else
     318        {
     319            /* Driverless: Do dbgfR0BpInitWorker here, ring-3 style. */
     320            uint32_t const cbL1Loc = RT_ALIGN_32(UINT16_MAX * sizeof(uint32_t), PAGE_SIZE);
     321            pUVM->dbgf.s.paBpLocL1R3 = (uint32_t *)RTMemPageAllocZ(cbL1Loc);
     322            AssertLogRelMsgReturn(pUVM->dbgf.s.paBpLocL1R3, ("cbL1Loc=%#x\n", cbL1Loc), VERR_NO_PAGE_MEMORY);
     323        }
    314324    }
    315325
     
    358368        && !pUVM->dbgf.s.paBpLocPortIoR3)
    359369    {
    360         DBGFBPINITREQ Req;
    361         Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    362         Req.Hdr.cbReq    = sizeof(Req);
    363         Req.paBpLocL1R3  = NULL;
    364         int rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_PORTIO_INIT, 0 /*u64Arg*/, &Req.Hdr);
    365         AssertLogRelMsgRCReturn(rc, ("VMMR0_DO_DBGF_BP_PORTIO_INIT failed: %Rrc\n", rc), rc);
    366         pUVM->dbgf.s.paBpLocPortIoR3 = Req.paBpLocL1R3;
     370        if (!SUPR3IsDriverless())
     371        {
     372            DBGFBPINITREQ Req;
     373            Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
     374            Req.Hdr.cbReq    = sizeof(Req);
     375            Req.paBpLocL1R3  = NULL;
     376            int rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_PORTIO_INIT, 0 /*u64Arg*/, &Req.Hdr);
     377            AssertLogRelMsgRCReturn(rc, ("VMMR0_DO_DBGF_BP_PORTIO_INIT failed: %Rrc\n", rc), rc);
     378            pUVM->dbgf.s.paBpLocPortIoR3 = Req.paBpLocL1R3;
     379        }
     380        else
     381        {
     382            /* Driverless: Do dbgfR0BpPortIoInitWorker here, ring-3 style. */
     383            uint32_t const cbPortIoLoc = RT_ALIGN_32(UINT16_MAX * sizeof(uint32_t), PAGE_SIZE);
     384            pUVM->dbgf.s.paBpLocPortIoR3 = (uint32_t *)RTMemPageAllocZ(cbPortIoLoc);
     385            AssertLogRelMsgReturn(pUVM->dbgf.s.paBpLocPortIoR3, ("cbPortIoLoc=%#x\n", cbPortIoLoc), VERR_NO_PAGE_MEMORY);
     386        }
    367387    }
    368388
     
    421441        if (pUVM->dbgf.s.pbmBpOwnersAllocR3)
    422442        {
    423             DBGFBPOWNERINITREQ Req;
    424             Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    425             Req.Hdr.cbReq    = sizeof(Req);
    426             Req.paBpOwnerR3  = NULL;
    427             rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_OWNER_INIT, 0 /*u64Arg*/, &Req.Hdr);
    428             AssertLogRelMsgRC(rc, ("VMMR0_DO_DBGF_BP_OWNER_INIT failed: %Rrc\n", rc));
    429             if (RT_SUCCESS(rc))
    430             {
    431                 pUVM->dbgf.s.paBpOwnersR3 = (PDBGFBPOWNERINT)Req.paBpOwnerR3;
    432                 return VINF_SUCCESS;
     443            if (!SUPR3IsDriverless())
     444            {
     445                DBGFBPOWNERINITREQ Req;
     446                Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
     447                Req.Hdr.cbReq    = sizeof(Req);
     448                Req.paBpOwnerR3  = NULL;
     449                rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_OWNER_INIT, 0 /*u64Arg*/, &Req.Hdr);
     450                if (RT_SUCCESS(rc))
     451                {
     452                    pUVM->dbgf.s.paBpOwnersR3 = (PDBGFBPOWNERINT)Req.paBpOwnerR3;
     453                    return VINF_SUCCESS;
     454                }
     455                AssertLogRelMsgRC(rc, ("VMMR0_DO_DBGF_BP_OWNER_INIT failed: %Rrc\n", rc));
     456            }
     457            else
     458            {
     459                /* Driverless: Do dbgfR0BpOwnerInitWorker here, ring-3 style. */
     460                uint32_t const cbBpOwnerR3 = RT_ALIGN_32(DBGF_BP_OWNER_COUNT_MAX * sizeof(DBGFBPOWNERINT), PAGE_SIZE);
     461                pUVM->dbgf.s.paBpLocPortIoR3 = (uint32_t *)RTMemPageAllocZ(cbBpOwnerR3);
     462                if (pUVM->dbgf.s.paBpLocPortIoR3)
     463                    return VINF_SUCCESS;
     464                AssertLogRelMsgFailed(("cbBpOwnerR3=%#x\n", cbBpOwnerR3));
     465                rc = VERR_NO_PAGE_MEMORY;
    433466            }
    434467
     
    577610        if (RT_LIKELY(pbmAlloc))
    578611        {
    579             DBGFBPCHUNKALLOCREQ Req;
    580             Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    581             Req.Hdr.cbReq    = sizeof(Req);
    582             Req.idChunk      = idChunk;
    583             Req.pChunkBaseR3 = NULL;
    584             rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_CHUNK_ALLOC, 0 /*u64Arg*/, &Req.Hdr);
    585             AssertLogRelMsgRC(rc, ("VMMR0_DO_DBGF_BP_CHUNK_ALLOC failed: %Rrc\n", rc));
     612            if (!SUPR3IsDriverless())
     613            {
     614                DBGFBPCHUNKALLOCREQ Req;
     615                Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
     616                Req.Hdr.cbReq    = sizeof(Req);
     617                Req.idChunk      = idChunk;
     618                Req.pChunkBaseR3 = NULL;
     619                rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_CHUNK_ALLOC, 0 /*u64Arg*/, &Req.Hdr);
     620                if (RT_SUCCESS(rc))
     621                    pBpChunk->pBpBaseR3 = (PDBGFBPINT)Req.pChunkBaseR3;
     622                else
     623                    AssertLogRelMsgRC(rc, ("VMMR0_DO_DBGF_BP_CHUNK_ALLOC failed: %Rrc\n", rc));
     624            }
     625            else
     626            {
     627                /* Driverless: Do dbgfR0BpChunkAllocWorker here, ring-3 style. */
     628                uint32_t const cbShared = RT_ALIGN_32(DBGF_BP_COUNT_PER_CHUNK * sizeof(DBGFBPINT), PAGE_SIZE);
     629                pBpChunk->pBpBaseR3 = (PDBGFBPINT)RTMemPageAllocZ(cbShared);
     630                AssertLogRelMsgStmt(pBpChunk->pBpBaseR3, ("cbShared=%#x\n", cbShared), rc = VERR_NO_PAGE_MEMORY);
     631            }
    586632            if (RT_SUCCESS(rc))
    587633            {
    588                 pBpChunk->pBpBaseR3 = (PDBGFBPINT)Req.pChunkBaseR3;
    589634                pBpChunk->pbmAlloc  = (void volatile *)pbmAlloc;
    590635                pBpChunk->cBpsFree  = DBGF_BP_COUNT_PER_CHUNK;
     
    787832        if (RT_LIKELY(pbmAlloc))
    788833        {
    789             DBGFBPL2TBLCHUNKALLOCREQ Req;
    790             Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    791             Req.Hdr.cbReq    = sizeof(Req);
    792             Req.idChunk      = idChunk;
    793             Req.pChunkBaseR3 = NULL;
    794             rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_L2_TBL_CHUNK_ALLOC, 0 /*u64Arg*/, &Req.Hdr);
    795             AssertLogRelMsgRC(rc, ("VMMR0_DO_DBGF_BP_L2_TBL_CHUNK_ALLOC failed: %Rrc\n", rc));
     834            if (!SUPR3IsDriverless())
     835            {
     836                DBGFBPL2TBLCHUNKALLOCREQ Req;
     837                Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
     838                Req.Hdr.cbReq    = sizeof(Req);
     839                Req.idChunk      = idChunk;
     840                Req.pChunkBaseR3 = NULL;
     841                rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_DBGF_BP_L2_TBL_CHUNK_ALLOC, 0 /*u64Arg*/, &Req.Hdr);
     842                if (RT_SUCCESS(rc))
     843                    pL2Chunk->pL2BaseR3 = (PDBGFBPL2ENTRY)Req.pChunkBaseR3;
     844                else
     845                    AssertLogRelMsgRC(rc, ("VMMR0_DO_DBGF_BP_L2_TBL_CHUNK_ALLOC failed: %Rrc\n", rc));
     846            }
     847            else
     848            {
     849                /* Driverless: Do dbgfR0BpL2TblChunkAllocWorker here, ring-3 style. */
     850                uint32_t const cbTotal = RT_ALIGN_32(DBGF_BP_L2_TBL_ENTRIES_PER_CHUNK * sizeof(DBGFBPL2ENTRY), PAGE_SIZE);
     851                pL2Chunk->pL2BaseR3 = (PDBGFBPL2ENTRY)RTMemPageAllocZ(cbTotal);
     852                AssertLogRelMsgStmt(pL2Chunk->pL2BaseR3, ("cbTotal=%#x\n", cbTotal), rc = VERR_NO_PAGE_MEMORY);
     853            }
    796854            if (RT_SUCCESS(rc))
    797855            {
    798                 pL2Chunk->pL2BaseR3 = (PDBGFBPL2ENTRY)Req.pChunkBaseR3;
    799856                pL2Chunk->pbmAlloc  = (void volatile *)pbmAlloc;
    800857                pL2Chunk->cFree     = DBGF_BP_L2_TBL_ENTRIES_PER_CHUNK;
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