VirtualBox

Ignore:
Timestamp:
Jul 15, 2016 6:44:49 PM (8 years ago)
Author:
vboxsync
Message:

REM: Killed the REMR3NotifyPendingInterrupt interface. Misguided hack for something TRPM should be doing and couldn't because REMR3State wasn't doing it's job wrt TRPM_HARDWARE_INT.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/VBoxRecompiler.c

    r62286 r62287  
    55
    66/*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    112112static DECLCALLBACK(int) remR3Save(PVM pVM, PSSMHANDLE pSSM);
    113113static DECLCALLBACK(int) remR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
     114static DECLCALLBACK(int) remR3LoadDone(PVM pVM, PSSMHANDLE pSSM);
    114115static void     remR3StateUpdate(PVM pVM, PVMCPU pVCpu);
    115116static int      remR3InitPhysRamSizeAndDirtyMap(PVM pVM, bool fGuarded);
     
    352353
    353354    /* Nothing is pending by default */
    354     pVM->rem.s.u32PendingInterrupt = REM_NO_PENDING_IRQ;
     355    pVM->rem.s.uStateLoadPendingInterrupt = REM_NO_PENDING_IRQ;
    355356
    356357    /*
     
    372373                               NULL, NULL, NULL,
    373374                               NULL, remR3Save, NULL,
    374                                NULL, remR3Load, NULL);
     375                               NULL, remR3Load, remR3LoadDone);
    375376    if (RT_FAILURE(rc))
    376377        return rc;
     
    637638    /* Remember if we've entered raw mode (vital for ring 1 checks in e.g. iret emulation). */
    638639    SSMR3PutU32(pSSM, !!(pRem->Env.state & CPU_RAW_RING0));
    639     SSMR3PutU32(pSSM, pVM->rem.s.u32PendingInterrupt);
     640    SSMR3PutU32(pSSM, REM_NO_PENDING_IRQ);
    640641
    641642    return SSMR3PutU32(pSSM, ~0);       /* terminator */
     
    732733    }
    733734
    734     rc = SSMR3GetUInt(pSSM, &pVM->rem.s.u32PendingInterrupt);
    735     if (RT_FAILURE(rc))
    736         return rc;
     735    rc = SSMR3GetUInt(pSSM, &pVM->rem.s.uStateLoadPendingInterrupt);
     736    AssertRCReturn(rc, rc);
     737    AssertLogRelMsgReturn(   pVM->rem.s.uStateLoadPendingInterrupt == REM_NO_PENDING_IRQ
     738                          || pVM->rem.s.uStateLoadPendingInterrupt < 256,
     739                          ("uStateLoadPendingInterrupt=%#x\n", pVM->rem.s.uStateLoadPendingInterrupt),
     740                          VERR_SSM_UNEXPECTED_DATA);
    737741
    738742    /* check the terminator. */
     
    769773}
    770774
     775
     776/**
     777 * @callback_method_impl{FNSSMINTLOADDONE,
     778 *    For pushing misdesigned pending-interrupt mess to TRPM where it belongs. }
     779 */
     780static DECLCALLBACK(int) remR3LoadDone(PVM pVM, PSSMHANDLE pSSM)
     781{
     782    if (pVM->rem.s.uStateLoadPendingInterrupt != REM_NO_PENDING_IRQ)
     783    {
     784        int rc = TRPMAssertTrap(&pVM->aCpus[0], pVM->rem.s.uStateLoadPendingInterrupt, TRPM_HARDWARE_INT);
     785        AssertLogRelMsgReturn(rc, ("uStateLoadPendingInterrupt=%#x rc=%Rrc\n", pVM->rem.s.uStateLoadPendingInterrupt, rc), rc);
     786        pVM->rem.s.uStateLoadPendingInterrupt = REM_NO_PENDING_IRQ;
     787    }
     788    return VINF_SUCCESS;
     789}
    771790
    772791
     
    11191138        pVM->rem.s.Env.interrupt_request = CPU_INTERRUPT_SINGLE_INSTR;
    11201139#endif
    1121         if (   VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC)
    1122             || pVM->rem.s.u32PendingInterrupt != REM_NO_PENDING_IRQ)
     1140        if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_UPDATE_APIC | VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC))
    11231141            pVM->rem.s.Env.interrupt_request |= CPU_INTERRUPT_HARD;
    11241142        RTLogPrintf("remR3RunLoggingStep: interrupt_request=%#x halted=%d exception_index=%#x\n",
     
    25202538        APICUpdatePendingInterrupts(pVCpu);
    25212539#endif
    2522     if (    pVM->rem.s.u32PendingInterrupt != REM_NO_PENDING_IRQ
    2523         ||  VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC))
    2524     {
     2540    if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC))
    25252541        pVM->rem.s.Env.interrupt_request |= CPU_INTERRUPT_HARD;
    2526     }
    25272542
    25282543    /*
     
    42424257
    42434258/* -+- FF notifications -+- */
    4244 
    4245 
    4246 /**
    4247  * Notification about a pending interrupt.
    4248  *
    4249  * @param   pVM             VM Handle.
    4250  * @param   pVCpu           VMCPU Handle.
    4251  * @param   u8Interrupt     Interrupt
    4252  * @thread  The emulation thread.
    4253  */
    4254 REMR3DECL(void) REMR3NotifyPendingInterrupt(PVM pVM, PVMCPU pVCpu, uint8_t u8Interrupt)
    4255 {
    4256     Assert(pVM->rem.s.u32PendingInterrupt == REM_NO_PENDING_IRQ);
    4257     pVM->rem.s.u32PendingInterrupt = u8Interrupt;
    4258 }
    4259 
    4260 /**
    4261  * Notification about a pending interrupt.
    4262  *
    4263  * @returns Pending interrupt or REM_NO_PENDING_IRQ
    4264  * @param   pVM             VM Handle.
    4265  * @param   pVCpu           VMCPU Handle.
    4266  * @thread  The emulation thread.
    4267  */
    4268 REMR3DECL(uint32_t) REMR3QueryPendingInterrupt(PVM pVM, PVMCPU pVCpu)
    4269 {
    4270     return pVM->rem.s.u32PendingInterrupt;
    4271 }
    42724259
    42734260/**
     
    45214508     */
    45224509    /* Note! We assume we will go directly to the recompiler to handle the pending interrupt! */
    4523     /** @todo r=bird: In the long run we should just do the interrupt handling in EM/CPUM/TRPM/somewhere and
    4524      * if we cannot execute the interrupt handler in raw-mode just reschedule to REM. Once that is done we
    4525      * remove this kludge. */
    4526     if (env->pVM->rem.s.u32PendingInterrupt != REM_NO_PENDING_IRQ)
    4527     {
    4528         rc = VINF_SUCCESS;
    4529         Assert(env->pVM->rem.s.u32PendingInterrupt <= 255);
    4530         u8Interrupt = env->pVM->rem.s.u32PendingInterrupt;
    4531         env->pVM->rem.s.u32PendingInterrupt = REM_NO_PENDING_IRQ;
    4532     }
    4533     else
    4534         rc = PDMGetInterrupt(env->pVCpu, &u8Interrupt);
    4535 
     4510    rc = PDMGetInterrupt(env->pVCpu, &u8Interrupt);
    45364511    LogFlow(("cpu_get_pic_interrupt: u8Interrupt=%d rc=%Rrc pc=%04x:%08llx ~flags=%08llx\n",
    45374512             u8Interrupt, rc, env->segs[R_CS].selector, (uint64_t)env->eip, (uint64_t)env->eflags));
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