VirtualBox

Changeset 75829 in vbox


Ignore:
Timestamp:
Nov 30, 2018 9:11:46 AM (6 years ago)
Author:
vboxsync
Message:

HMSVMR0: More fixes on the mesa hack, now it works.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r75828 r75829  
    78157815 * @sa hmR0VmxHandleMesaDrvGp
    78167816 */
    7817 static int hmR0SvmHandleMesaDrvGp(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient, PCPUMCTX pCtx, PCSVMVMCB pVmcb)
    7818 {
     7817static int hmR0SvmHandleMesaDrvGp(PVMCPU pVCpu, PCPUMCTX pCtx, PCSVMVMCB pVmcb)
     7818{
     7819    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CS  | CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_RFLAGS | CPUMCTX_EXTRN_GPRS_MASK);
    78197820    Log(("hmR0SvmHandleMesaDrvGp: at %04x:%08RX64 rcx=%RX64 rbx=%RX64\n",
    78207821         pVmcb->guest.CS.u16Sel, pVmcb->guest.u64RIP, pCtx->rcx, pCtx->rbx));
    7821     RT_NOREF(pCtx, pSvmTransient, pVmcb);
     7822    RT_NOREF(pCtx, pVmcb);
    78227823
    78237824    /* For now we'll just skip the instruction. */
     
    78417842    /* Check magic and port. */
    78427843    Assert(!(pCtx->fExtrn & (CPUMCTX_EXTRN_RDX | CPUMCTX_EXTRN_RCX)));
    7843     /*Log(("hmR0SvmIsMesaDrvGp: rax=%RX64 rdx=%RX64\n", pCtx->fExtrn & CPUMCTX_EXTRN_RAX ? pCtx->rax : pVmcb->guest.u64RAX, pCtx->rdx));*/
     7844    /*Log8(("hmR0SvmIsMesaDrvGp: rax=%RX64 rdx=%RX64\n", pCtx->fExtrn & CPUMCTX_EXTRN_RAX ? pVmcb->guest.u64RAX : pCtx->rax, pCtx->rdx));*/
    78447845    if (pCtx->dx != UINT32_C(0x5658))
    78457846        return false;
    7846     if ((pCtx->fExtrn & CPUMCTX_EXTRN_RAX ? pCtx->rax : pVmcb->guest.u64RAX) != UINT32_C(0x564d5868))
     7847    if ((pCtx->fExtrn & CPUMCTX_EXTRN_RAX ? pVmcb->guest.u64RAX : pCtx->rax) != UINT32_C(0x564d5868))
    78477848        return false;
    78487849
     
    78527853
    78537854    /* Flat ring-3 CS. */
    7854     /*Log(("hmR0SvmIsMesaDrvGp: u8CPL=%d base=%Rx64\n", pVmcb->guest.u8CPL, pCtx->fExtrn & CPUMCTX_EXTRN_CS ? pVmcb->guest.CS.u64Base : pCtx->cs.Sel));*/
     7855    /*Log8(("hmR0SvmIsMesaDrvGp: u8CPL=%d base=%RX64\n", pVmcb->guest.u8CPL, pCtx->fExtrn & CPUMCTX_EXTRN_CS ? pVmcb->guest.CS.u64Base : pCtx->cs.u64Base));*/
    78557856    if (pVmcb->guest.u8CPL != 3)
    78567857        return false;
    7857     if ((pCtx->fExtrn & CPUMCTX_EXTRN_CS ? pVmcb->guest.CS.u64Base : pCtx->cs.Sel) != 0)
     7858    if ((pCtx->fExtrn & CPUMCTX_EXTRN_CS ? pVmcb->guest.CS.u64Base : pCtx->cs.u64Base) != 0)
    78587859        return false;
    78597860
    78607861    /* 0xed:  IN eAX,dx */
    7861     uint64_t const uRip = pCtx->fExtrn & CPUMCTX_EXTRN_RIP ? pCtx->rip : pVmcb->guest.u64RIP;
    7862     uint8_t abInstr[1];
    7863     if (   hmR0SvmSupportsNextRipSave(pVCpu)
    7864         && pVmcb->ctrl.u64NextRIP - uRip != sizeof(abInstr))
    7865         return false;
    7866     if (pVmcb->ctrl.cbInstrFetched >= 1)
    7867     {
    7868         /*Log(("hmR0SvmIsMesaDrvGp: %#x\n", pVmcb->ctrl.abInstr));*/
    7869         if (pVmcb->ctrl.abInstr[0] != 0xed)
    7870             return false;
    7871     }
    7872     else
    7873     {
    7874         int rc = PGMPhysSimpleReadGCPtr(pVCpu, abInstr, uRip, sizeof(abInstr));
    7875         /*Log(("hmR0SvmIsMesaDrvGp: PGMPhysSimpleReadGCPtr -> %Rrc %#x\n", rc, abInstr[0]));*/
     7862    if (pVmcb->ctrl.cbInstrFetched < 1) /* unlikely, it turns out. */
     7863    {
     7864        HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CS  | CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_GPRS_MASK
     7865                                        | CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_CR3 | CPUMCTX_EXTRN_CR4 | CPUMCTX_EXTRN_EFER);
     7866        uint8_t abInstr[1];
     7867        int rc = PGMPhysSimpleReadGCPtr(pVCpu, abInstr, pCtx->rip, sizeof(abInstr));
     7868        /*Log8(("hmR0SvmIsMesaDrvGp: PGMPhysSimpleReadGCPtr -> %Rrc %#x\n", rc, abInstr[0])); */
    78767869        if (RT_FAILURE(rc))
    78777870            return false;
     
    78797872            return false;
    78807873    }
    7881 
     7874    else
     7875    {
     7876        /*Log8(("hmR0SvmIsMesaDrvGp: %#x\n", pVmcb->ctrl.abInstr));*/
     7877        if (pVmcb->ctrl.abInstr[0] != 0xed)
     7878            return false;
     7879    }
    78827880    return true;
    78837881}
     
    79107908        return VINF_SUCCESS;
    79117909    }
    7912     return hmR0SvmHandleMesaDrvGp(pVCpu, pSvmTransient, pCtx, pVmcb);
     7910    return hmR0SvmHandleMesaDrvGp(pVCpu, pCtx, pVmcb);
    79137911}
    79147912
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