From 9262629a8619b70ef02635eacc4f0495d178dd1a Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 13 Jan 2015 22:10:40 +0100 Subject: [PATCH] vbox: fix interrupt injection in recompiler mode Fixes #1365 --- repos/ports/ports/virtualbox.hash | 2 +- repos/ports/ports/virtualbox.port | 2 +- .../src/virtualbox/patches/rem_irq.patch | 27 +++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 repos/ports/src/virtualbox/patches/rem_irq.patch diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash index 453dfd5e2..0f8577626 100644 --- a/repos/ports/ports/virtualbox.hash +++ b/repos/ports/ports/virtualbox.hash @@ -1 +1 @@ -2f00ccc22f68eb6aa656e721e4bc82a9c5e25093 +6fdf666cabbc6926ccc8c54dc00ac471e26a0eac diff --git a/repos/ports/ports/virtualbox.port b/repos/ports/ports/virtualbox.port index 0dc69d2d7..8b7cb7e03 100644 --- a/repos/ports/ports/virtualbox.port +++ b/repos/ports/ports/virtualbox.port @@ -11,7 +11,7 @@ SHA(virtualbox) := e4c23b713e8715b8e0172fa066f2197756e901fe PATCHES_LIST := acpi_drv dev_e1000 eminternal fake_pci_vendor iconv mouse PATCHES_LIST += pdm_driver poke sharedfolder_pagelist PATCHES_LIST += time-log-deadlock vbox_inc vbox_main network -PATCHES_LIST += vga_fb vga_vbva vmdk vmmdev avoid_yield serial +PATCHES_LIST += vga_fb vga_vbva vmdk vmmdev avoid_yield serial rem_irq PATCHES := $(addsuffix .patch, $(PATCHES_LIST)) PATCHES := $(addprefix src/virtualbox/patches/, $(PATCHES)) diff --git a/repos/ports/src/virtualbox/patches/rem_irq.patch b/repos/ports/src/virtualbox/patches/rem_irq.patch new file mode 100644 index 000000000..c0a1a4929 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/rem_irq.patch @@ -0,0 +1,27 @@ ++++ src/app/virtualbox/src/VBox/VMM/VMMR3/TRPM.cpp +@@ -1561,6 +1561,17 @@ + return HMR3IsActive(pVCpu) ? VINF_EM_RESCHEDULE_HM : VINF_EM_RESCHEDULE_REM; /* (Heed the halted state if this is changed!) */ + } + #else /* !TRPM_FORWARD_TRAPS_IN_GC */ ++ /* Restore behaviour as used in 4.2.24 Virtualbox. The PDMGetInterrupt call ++ * and TRPMAssertTrap call in 4.2.24 is solely performed when HM mode is ++ * active. ++ * With 4.3 the TRPMAssertTrap is also performed when running solely (as ++ * done on Genode/Virtualbox for realmode code) in the recompiler. Calling ++ * TRPMAssertTrap in this case leads to the effect, that the Irq isn't ++ * pending anymore for the recompiler and therefore it will not inject it. ++ * ++ * Restoring the original behaviour as of 4.2.24 mitigates the issue. ++ */ ++ if (HMR3IsActive(pVCpu)) { + uint8_t u8Interrupt; + int rc = PDMGetInterrupt(pVCpu, &u8Interrupt); + Log(("TRPMR3InjectEvent: u8Interrupt=%d (%#x) rc=%Rrc\n", u8Interrupt, u8Interrupt, rc)); +@@ -1571,6 +1582,7 @@ + STAM_COUNTER_INC(&pVM->trpm.s.paStatForwardedIRQR3[u8Interrupt]); + return HMR3IsActive(pVCpu) ? VINF_EM_RESCHEDULE_HM : VINF_EM_RESCHEDULE_REM; + } ++ } + #endif /* !TRPM_FORWARD_TRAPS_IN_GC */ + } + /** @todo check if it's safe to translate the patch address to the original guest address.