Changeset 62287 in vbox for trunk/src/recompiler/VBoxRecompiler.c
- Timestamp:
- Jul 15, 2016 6:44:49 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/VBoxRecompiler.c
r62286 r62287 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 112 112 static DECLCALLBACK(int) remR3Save(PVM pVM, PSSMHANDLE pSSM); 113 113 static DECLCALLBACK(int) remR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass); 114 static DECLCALLBACK(int) remR3LoadDone(PVM pVM, PSSMHANDLE pSSM); 114 115 static void remR3StateUpdate(PVM pVM, PVMCPU pVCpu); 115 116 static int remR3InitPhysRamSizeAndDirtyMap(PVM pVM, bool fGuarded); … … 352 353 353 354 /* Nothing is pending by default */ 354 pVM->rem.s.u 32PendingInterrupt = REM_NO_PENDING_IRQ;355 pVM->rem.s.uStateLoadPendingInterrupt = REM_NO_PENDING_IRQ; 355 356 356 357 /* … … 372 373 NULL, NULL, NULL, 373 374 NULL, remR3Save, NULL, 374 NULL, remR3Load, NULL);375 NULL, remR3Load, remR3LoadDone); 375 376 if (RT_FAILURE(rc)) 376 377 return rc; … … 637 638 /* Remember if we've entered raw mode (vital for ring 1 checks in e.g. iret emulation). */ 638 639 SSMR3PutU32(pSSM, !!(pRem->Env.state & CPU_RAW_RING0)); 639 SSMR3PutU32(pSSM, pVM->rem.s.u32PendingInterrupt);640 SSMR3PutU32(pSSM, REM_NO_PENDING_IRQ); 640 641 641 642 return SSMR3PutU32(pSSM, ~0); /* terminator */ … … 732 733 } 733 734 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); 737 741 738 742 /* check the terminator. */ … … 769 773 } 770 774 775 776 /** 777 * @callback_method_impl{FNSSMINTLOADDONE, 778 * For pushing misdesigned pending-interrupt mess to TRPM where it belongs. } 779 */ 780 static 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 } 771 790 772 791 … … 1119 1138 pVM->rem.s.Env.interrupt_request = CPU_INTERRUPT_SINGLE_INSTR; 1120 1139 #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)) 1123 1141 pVM->rem.s.Env.interrupt_request |= CPU_INTERRUPT_HARD; 1124 1142 RTLogPrintf("remR3RunLoggingStep: interrupt_request=%#x halted=%d exception_index=%#x\n", … … 2520 2538 APICUpdatePendingInterrupts(pVCpu); 2521 2539 #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)) 2525 2541 pVM->rem.s.Env.interrupt_request |= CPU_INTERRUPT_HARD; 2526 }2527 2542 2528 2543 /* … … 4242 4257 4243 4258 /* -+- 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 Interrupt4252 * @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_IRQ4264 * @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 }4272 4259 4273 4260 /** … … 4521 4508 */ 4522 4509 /* 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); 4536 4511 LogFlow(("cpu_get_pic_interrupt: u8Interrupt=%d rc=%Rrc pc=%04x:%08llx ~flags=%08llx\n", 4537 4512 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.