From 6bb145bdd89f66bf83e389bddfe5f8c282426003 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Mon, 11 Feb 2019 14:38:15 +0100 Subject: [PATCH] Remove virtualbox 4 vmm Fixes #3141 --- .../ports/lib/mk/spec/muen/virtualbox-muen.mk | 25 - .../ports/lib/mk/spec/nova/virtualbox-nova.mk | 25 - .../lib/mk/spec/nova/virtualbox5-nova.mk | 2 +- repos/ports/lib/mk/virtualbox-bios.mk | 39 - repos/ports/lib/mk/virtualbox-common.inc | 108 - repos/ports/lib/mk/virtualbox-devices.mk | 100 - repos/ports/lib/mk/virtualbox-dis.mk | 17 - repos/ports/lib/mk/virtualbox-drivers.mk | 29 - repos/ports/lib/mk/virtualbox-hwaccl-off.mk | 18 - repos/ports/lib/mk/virtualbox-liblzf.mk | 10 - repos/ports/lib/mk/virtualbox-main.mk | 83 - repos/ports/lib/mk/virtualbox-recompiler.mk | 31 - repos/ports/lib/mk/virtualbox-runtime.mk | 171 -- repos/ports/lib/mk/virtualbox-storage.mk | 19 - repos/ports/lib/mk/virtualbox-vmm.mk | 76 - repos/ports/lib/mk/virtualbox-xml.mk | 25 - repos/ports/lib/mk/virtualbox-zlib.mk | 9 - repos/ports/lib/mk/virtualbox5-common.inc | 4 +- repos/ports/lib/mk/virtualbox5-drivers.mk | 2 +- repos/ports/lib/mk/virtualbox5-hwaccl-off.mk | 2 +- repos/ports/ports/virtualbox.hash | 1 - repos/ports/ports/virtualbox.port | 111 - repos/ports/ports/virtualbox5.hash | 2 +- repos/ports/ports/virtualbox5.port | 2 - repos/ports/recipes/src/vbox5-nova/content.mk | 14 +- repos/ports/recipes/src/vbox5-nova/hash | 2 +- repos/ports/run/vbox4_ubuntu_14_04_32.run | 23 - repos/ports/run/vbox4_ubuntu_14_04_64.run | 25 - repos/ports/run/vbox4_ubuntu_16_04_32.run | 23 - repos/ports/run/vbox4_ubuntu_16_04_64.run | 25 - repos/ports/run/vbox4_win10_64.run | 26 - repos/ports/run/vbox4_win7_32.run | 23 - repos/ports/run/vbox4_win7_32_share.run | 22 - repos/ports/run/vbox4_win7_64.run | 25 - repos/ports/run/vbox4_win7_64_multiple.run | 37 - repos/ports/run/vbox4_win7_64_raw.run | 24 - repos/ports/run/vbox4_win81_64.run | 25 - repos/ports/run/vbox5_ubuntu_14_04_32.run | 1 - repos/ports/run/vbox5_ubuntu_14_04_64.run | 1 - repos/ports/run/vbox5_ubuntu_16_04_32.run | 1 - repos/ports/run/vbox5_ubuntu_16_04_64.run | 1 - repos/ports/run/vbox5_win10_64.run | 1 - repos/ports/run/vbox5_win7_32.run | 1 - repos/ports/run/vbox5_win7_64.run | 1 - repos/ports/run/vbox5_win7_64_multiple.run | 1 - repos/ports/run/vbox5_win7_64_raw.run | 1 - repos/ports/run/vbox5_win7_64_share.run | 1 - repos/ports/run/vbox_share.inc | 2 - repos/ports/run/vbox_win.inc | 2 - repos/ports/run/virtualbox.run | 10 +- repos/ports/run/virtualbox_auto.inc | 2 - repos/ports/src/virtualbox/README | 38 - .../ports/src/virtualbox/accloff/mem_region.h | 17 - repos/ports/src/virtualbox/accloff/sup.cc | 139 -- repos/ports/src/virtualbox/audiodrv.cpp | 514 ----- repos/ports/src/virtualbox/devices.cc | 95 - repos/ports/src/virtualbox/devxhci.cc | 585 ------ repos/ports/src/virtualbox/drivers.cc | 45 - repos/ports/src/virtualbox/dummies.cc | 205 -- .../src/virtualbox/frontend/ClientWatcher.h | 14 - .../src/virtualbox/frontend/GenodeImpl.h | 10 - .../frontend/VBoxAPIWrap/MediumFormatWrap.cpp | 210 -- .../frontend/VBoxAPIWrap/MediumFormatWrap.h | 77 - .../frontend/VBoxAPIWrap/TokenWrap.cpp | 100 - .../frontend/VBoxAPIWrap/TokenWrap.h | 61 - .../src/virtualbox/frontend/VBoxEvents.h | 45 - .../src/virtualbox/frontend/VirtualBoxBase.h | 502 ----- .../frontend/VirtualBoxErrorInfoImpl.cpp | 6 - .../frontend/VirtualBoxErrorInfoImpl.h | 49 - .../ports/src/virtualbox/frontend/console.cc | 598 ------ repos/ports/src/virtualbox/frontend/console.h | 247 --- .../virtualbox/frontend/dummy/autostart.cc | 17 - .../virtualbox/frontend/dummy/errorinfo.cc | 14 - .../src/virtualbox/frontend/dummy/host.cc | 128 -- .../src/virtualbox/frontend/dummy/macros.h | 37 - .../src/virtualbox/frontend/dummy/rest.cc | 252 --- .../frontend/dummy/virtualboxbase.cc | 32 - repos/ports/src/virtualbox/frontend/fb.h | 259 --- repos/ports/src/virtualbox/frontend/main.cc | 253 --- repos/ports/src/virtualbox/guest_memory.h | 401 ---- repos/ports/src/virtualbox/hm.cc | 157 -- repos/ports/src/virtualbox/iommio.cc | 190 -- repos/ports/src/virtualbox/ioport.cc | 316 --- repos/ports/src/virtualbox/mm.cc | 365 ---- repos/ports/src/virtualbox/muen/target.mk | 11 - repos/ports/src/virtualbox/nova/target.mk | 11 - .../ports/src/virtualbox/patches/audio.patch | 16 - .../src/virtualbox/patches/dev_e1000.patch | 36 - .../src/virtualbox/patches/force_ioapic.patch | 24 - repos/ports/src/virtualbox/patches/ide.patch | 12 - .../src/virtualbox/patches/rem_irq.patch | 32 - repos/ports/src/virtualbox/patches/series | 14 - .../src/virtualbox/patches/series_common | 18 - repos/ports/src/virtualbox/patches/usb.patch | 136 -- .../patches/vbox-cpuhotplug.dsl.patch | 30 - .../src/virtualbox/patches/vbox_dd.patch | 10 - .../src/virtualbox/patches/vbox_inc.patch | 113 - .../src/virtualbox/patches/vbox_main.patch | 1872 ----------------- .../ports/src/virtualbox/patches/vga_fb.patch | 23 - .../src/virtualbox/patches/vga_vbva.patch | 16 - .../ports/src/virtualbox/patches/vmmdev.patch | 91 - repos/ports/src/virtualbox/pgm.cc | 672 ------ .../virtualbox/spec/muen/guest_interrupts.h | 77 - .../src/virtualbox/spec/muen/mem_region.h | 138 -- repos/ports/src/virtualbox/spec/muen/sup.cc | 779 ------- repos/ports/src/virtualbox/spec/muen/vcpu.h | 79 - .../src/virtualbox/spec/muen/vm_handler.h | 64 - .../src/virtualbox/spec/nova/mem_region.h | 17 - repos/ports/src/virtualbox/spec/nova/sup.cc | 323 --- repos/ports/src/virtualbox/spec/nova/svm.h | 120 -- repos/ports/src/virtualbox/spec/nova/vcpu.h | 907 -------- .../ports/src/virtualbox/spec/nova/vcpu_svm.h | 161 -- .../ports/src/virtualbox/spec/nova/vcpu_vmx.h | 246 --- repos/ports/src/virtualbox/spec/nova/vmx.h | 128 -- repos/ports/src/virtualbox/sup.cc | 397 ---- repos/ports/src/virtualbox/target.inc | 61 - repos/ports/src/virtualbox/target.mk | 7 - repos/ports/src/virtualbox/unimpl.cc | 202 -- repos/ports/src/virtualbox/vmm.h | 10 - repos/ports/src/virtualbox/vmm_memory.h | 217 -- repos/ports/src/virtualbox/vmm_region.h | 74 - .../src/{virtualbox => virtualbox5}/dynlib.cc | 0 .../include/VBox/com/VirtualBox.h | 0 .../include/VBox/com/com.h | 0 .../include/VBox/com/defs.h | 0 .../include/VBox/com/ptr.h | 0 .../include/VBox/intnet.h | 0 .../include/dtrace/VBoxVMM.h | 0 .../include/product-generated.h | 0 .../include/version-generated.h | 0 .../include/xpcom/nsError.h | 0 .../include/xpcom/nsID.h | 0 .../include/xpcom/nsIException.h | 0 .../include/xpcom/nsISupports.h | 0 .../include/xpcom/nsISupportsImpl.h | 0 .../include/xpcom/nsMemory.h | 0 .../include/xpcom/nscore.h | 0 .../include/xpcom/prtypes.h | 0 .../src/{virtualbox => virtualbox5}/libc.cc | 0 .../src/{virtualbox => virtualbox5}/logger.cc | 0 .../src/{virtualbox => virtualbox5}/mm.h | 0 .../{virtualbox => virtualbox5}/network.cpp | 0 .../patches/acpi_drv.patch | 0 .../patches/avoid_yield.patch | 0 .../patches/eminternal.patch | 0 .../patches/hostservice.patch | 0 .../patches/iconv.patch | 0 .../patches/mouse.patch | 0 .../patches/network.patch | 0 .../patches/pdm_driver.patch | 0 .../patches/poke.patch | 0 .../patches/posix.patch | 0 .../patches/rem_tss.patch | 0 .../patches/serial.patch | 0 repos/ports/src/virtualbox5/patches/series | 18 + .../patches/sharedfolder_pagelist.patch | 0 .../patches/time-log-deadlock.patch | 0 .../patches/tm_4s.patch | 0 .../patches/tm_retries.patch | 0 .../patches/tm_tpr.patch | 0 .../patches/vmdk.patch | 0 .../src/{virtualbox => virtualbox5}/pdm.cc | 0 .../src/{virtualbox => virtualbox5}/rt.cc | 13 +- .../src/{virtualbox => virtualbox5}/sup.h | 0 repos/ports/src/virtualbox5/target.inc | 11 +- .../src/{virtualbox => virtualbox5}/thread.cc | 0 .../src/{virtualbox => virtualbox5}/util.h | 0 tool/autopilot.list | 11 - 168 files changed, 34 insertions(+), 14372 deletions(-) delete mode 100644 repos/ports/lib/mk/spec/muen/virtualbox-muen.mk delete mode 100644 repos/ports/lib/mk/spec/nova/virtualbox-nova.mk delete mode 100644 repos/ports/lib/mk/virtualbox-bios.mk delete mode 100644 repos/ports/lib/mk/virtualbox-common.inc delete mode 100644 repos/ports/lib/mk/virtualbox-devices.mk delete mode 100644 repos/ports/lib/mk/virtualbox-dis.mk delete mode 100644 repos/ports/lib/mk/virtualbox-drivers.mk delete mode 100644 repos/ports/lib/mk/virtualbox-hwaccl-off.mk delete mode 100644 repos/ports/lib/mk/virtualbox-liblzf.mk delete mode 100644 repos/ports/lib/mk/virtualbox-main.mk delete mode 100644 repos/ports/lib/mk/virtualbox-recompiler.mk delete mode 100644 repos/ports/lib/mk/virtualbox-runtime.mk delete mode 100644 repos/ports/lib/mk/virtualbox-storage.mk delete mode 100644 repos/ports/lib/mk/virtualbox-vmm.mk delete mode 100644 repos/ports/lib/mk/virtualbox-xml.mk delete mode 100644 repos/ports/lib/mk/virtualbox-zlib.mk delete mode 100644 repos/ports/ports/virtualbox.hash delete mode 100644 repos/ports/ports/virtualbox.port delete mode 100644 repos/ports/run/vbox4_ubuntu_14_04_32.run delete mode 100644 repos/ports/run/vbox4_ubuntu_14_04_64.run delete mode 100644 repos/ports/run/vbox4_ubuntu_16_04_32.run delete mode 100644 repos/ports/run/vbox4_ubuntu_16_04_64.run delete mode 100644 repos/ports/run/vbox4_win10_64.run delete mode 100644 repos/ports/run/vbox4_win7_32.run delete mode 100644 repos/ports/run/vbox4_win7_32_share.run delete mode 100644 repos/ports/run/vbox4_win7_64.run delete mode 100644 repos/ports/run/vbox4_win7_64_multiple.run delete mode 100644 repos/ports/run/vbox4_win7_64_raw.run delete mode 100644 repos/ports/run/vbox4_win81_64.run delete mode 100644 repos/ports/src/virtualbox/README delete mode 100644 repos/ports/src/virtualbox/accloff/mem_region.h delete mode 100644 repos/ports/src/virtualbox/accloff/sup.cc delete mode 100644 repos/ports/src/virtualbox/audiodrv.cpp delete mode 100644 repos/ports/src/virtualbox/devices.cc delete mode 100644 repos/ports/src/virtualbox/devxhci.cc delete mode 100644 repos/ports/src/virtualbox/drivers.cc delete mode 100644 repos/ports/src/virtualbox/dummies.cc delete mode 100644 repos/ports/src/virtualbox/frontend/ClientWatcher.h delete mode 100644 repos/ports/src/virtualbox/frontend/GenodeImpl.h delete mode 100644 repos/ports/src/virtualbox/frontend/VBoxAPIWrap/MediumFormatWrap.cpp delete mode 100644 repos/ports/src/virtualbox/frontend/VBoxAPIWrap/MediumFormatWrap.h delete mode 100644 repos/ports/src/virtualbox/frontend/VBoxAPIWrap/TokenWrap.cpp delete mode 100644 repos/ports/src/virtualbox/frontend/VBoxAPIWrap/TokenWrap.h delete mode 100644 repos/ports/src/virtualbox/frontend/VBoxEvents.h delete mode 100644 repos/ports/src/virtualbox/frontend/VirtualBoxBase.h delete mode 100644 repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.cpp delete mode 100644 repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.h delete mode 100644 repos/ports/src/virtualbox/frontend/console.cc delete mode 100644 repos/ports/src/virtualbox/frontend/console.h delete mode 100644 repos/ports/src/virtualbox/frontend/dummy/autostart.cc delete mode 100644 repos/ports/src/virtualbox/frontend/dummy/errorinfo.cc delete mode 100644 repos/ports/src/virtualbox/frontend/dummy/host.cc delete mode 100644 repos/ports/src/virtualbox/frontend/dummy/macros.h delete mode 100644 repos/ports/src/virtualbox/frontend/dummy/rest.cc delete mode 100644 repos/ports/src/virtualbox/frontend/dummy/virtualboxbase.cc delete mode 100644 repos/ports/src/virtualbox/frontend/fb.h delete mode 100644 repos/ports/src/virtualbox/frontend/main.cc delete mode 100644 repos/ports/src/virtualbox/guest_memory.h delete mode 100644 repos/ports/src/virtualbox/hm.cc delete mode 100644 repos/ports/src/virtualbox/iommio.cc delete mode 100644 repos/ports/src/virtualbox/ioport.cc delete mode 100644 repos/ports/src/virtualbox/mm.cc delete mode 100644 repos/ports/src/virtualbox/muen/target.mk delete mode 100644 repos/ports/src/virtualbox/nova/target.mk delete mode 100644 repos/ports/src/virtualbox/patches/audio.patch delete mode 100644 repos/ports/src/virtualbox/patches/dev_e1000.patch delete mode 100644 repos/ports/src/virtualbox/patches/force_ioapic.patch delete mode 100644 repos/ports/src/virtualbox/patches/ide.patch delete mode 100644 repos/ports/src/virtualbox/patches/rem_irq.patch delete mode 100644 repos/ports/src/virtualbox/patches/series delete mode 100644 repos/ports/src/virtualbox/patches/series_common delete mode 100644 repos/ports/src/virtualbox/patches/usb.patch delete mode 100644 repos/ports/src/virtualbox/patches/vbox-cpuhotplug.dsl.patch delete mode 100644 repos/ports/src/virtualbox/patches/vbox_dd.patch delete mode 100644 repos/ports/src/virtualbox/patches/vbox_inc.patch delete mode 100644 repos/ports/src/virtualbox/patches/vbox_main.patch delete mode 100644 repos/ports/src/virtualbox/patches/vga_fb.patch delete mode 100644 repos/ports/src/virtualbox/patches/vga_vbva.patch delete mode 100644 repos/ports/src/virtualbox/patches/vmmdev.patch delete mode 100644 repos/ports/src/virtualbox/pgm.cc delete mode 100644 repos/ports/src/virtualbox/spec/muen/guest_interrupts.h delete mode 100644 repos/ports/src/virtualbox/spec/muen/mem_region.h delete mode 100644 repos/ports/src/virtualbox/spec/muen/sup.cc delete mode 100644 repos/ports/src/virtualbox/spec/muen/vcpu.h delete mode 100644 repos/ports/src/virtualbox/spec/muen/vm_handler.h delete mode 100644 repos/ports/src/virtualbox/spec/nova/mem_region.h delete mode 100644 repos/ports/src/virtualbox/spec/nova/sup.cc delete mode 100644 repos/ports/src/virtualbox/spec/nova/svm.h delete mode 100644 repos/ports/src/virtualbox/spec/nova/vcpu.h delete mode 100644 repos/ports/src/virtualbox/spec/nova/vcpu_svm.h delete mode 100644 repos/ports/src/virtualbox/spec/nova/vcpu_vmx.h delete mode 100644 repos/ports/src/virtualbox/spec/nova/vmx.h delete mode 100644 repos/ports/src/virtualbox/sup.cc delete mode 100644 repos/ports/src/virtualbox/target.inc delete mode 100644 repos/ports/src/virtualbox/target.mk delete mode 100644 repos/ports/src/virtualbox/unimpl.cc delete mode 100644 repos/ports/src/virtualbox/vmm.h delete mode 100644 repos/ports/src/virtualbox/vmm_memory.h delete mode 100644 repos/ports/src/virtualbox/vmm_region.h rename repos/ports/src/{virtualbox => virtualbox5}/dynlib.cc (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/VBox/com/VirtualBox.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/VBox/com/com.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/VBox/com/defs.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/VBox/com/ptr.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/VBox/intnet.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/dtrace/VBoxVMM.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/product-generated.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/version-generated.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/xpcom/nsError.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/xpcom/nsID.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/xpcom/nsIException.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/xpcom/nsISupports.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/xpcom/nsISupportsImpl.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/xpcom/nsMemory.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/xpcom/nscore.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/include/xpcom/prtypes.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/libc.cc (100%) rename repos/ports/src/{virtualbox => virtualbox5}/logger.cc (100%) rename repos/ports/src/{virtualbox => virtualbox5}/mm.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/network.cpp (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/acpi_drv.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/avoid_yield.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/eminternal.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/hostservice.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/iconv.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/mouse.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/network.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/pdm_driver.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/poke.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/posix.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/rem_tss.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/serial.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/sharedfolder_pagelist.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/time-log-deadlock.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/tm_4s.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/tm_retries.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/tm_tpr.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/patches/vmdk.patch (100%) rename repos/ports/src/{virtualbox => virtualbox5}/pdm.cc (100%) rename repos/ports/src/{virtualbox => virtualbox5}/rt.cc (94%) rename repos/ports/src/{virtualbox => virtualbox5}/sup.h (100%) rename repos/ports/src/{virtualbox => virtualbox5}/thread.cc (100%) rename repos/ports/src/{virtualbox => virtualbox5}/util.h (100%) diff --git a/repos/ports/lib/mk/spec/muen/virtualbox-muen.mk b/repos/ports/lib/mk/spec/muen/virtualbox-muen.mk deleted file mode 100644 index 187d2d898..000000000 --- a/repos/ports/lib/mk/spec/muen/virtualbox-muen.mk +++ /dev/null @@ -1,25 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -# -# Prevent inclusion of the Genode::Log definition after the vbox #define -# of 'Log'. Otherwise, the attemt to compile base/log.h will fail. -# -VBOX_CC_OPT += -include base/log.h - -LIBS += stdcxx sinfo-muen - -SRC_CC = pgm.cc sup.cc - -INC_DIR += $(call select_from_repositories,src/lib/libc) - -INC_DIR += $(VBOX_DIR)/Main/xml -INC_DIR += $(VBOX_DIR)/Main/include -INC_DIR += $(VBOX_DIR)/VMM/include -INC_DIR += $(REP_DIR)/src/virtualbox -INC_DIR += $(REP_DIR)/src/virtualbox/frontend -INC_DIR += $(REP_DIR)/src/virtualbox/spec/muen - -vpath pgm.cc $(REP_DIR)/src/virtualbox/ -vpath sup.cc $(REP_DIR)/src/virtualbox/spec/muen/ - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/spec/nova/virtualbox-nova.mk b/repos/ports/lib/mk/spec/nova/virtualbox-nova.mk deleted file mode 100644 index 9de4f8e50..000000000 --- a/repos/ports/lib/mk/spec/nova/virtualbox-nova.mk +++ /dev/null @@ -1,25 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -# -# Prevent inclusion of the Genode::Log definition after the vbox #define -# of 'Log'. Otherwise, the attemt to compile base/log.h will fail. -# -VBOX_CC_OPT += -include base/log.h - -LIBS += stdcxx - -SRC_CC = sup.cc pgm.cc - -INC_DIR += $(call select_from_repositories,src/lib/libc) - -INC_DIR += $(VBOX_DIR)/Main/xml -INC_DIR += $(VBOX_DIR)/Main/include -INC_DIR += $(VBOX_DIR)/VMM/include -INC_DIR += $(REP_DIR)/src/virtualbox -INC_DIR += $(REP_DIR)/src/virtualbox/frontend -INC_DIR += $(REP_DIR)/src/virtualbox/spec/nova - -vpath pgm.cc $(REP_DIR)/src/virtualbox/ -vpath sup.cc $(REP_DIR)/src/virtualbox/spec/nova/ - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/spec/nova/virtualbox5-nova.mk b/repos/ports/lib/mk/spec/nova/virtualbox5-nova.mk index 7f71f9fef..6f0e9570f 100644 --- a/repos/ports/lib/mk/spec/nova/virtualbox5-nova.mk +++ b/repos/ports/lib/mk/spec/nova/virtualbox5-nova.mk @@ -11,7 +11,7 @@ INC_DIR += $(VIRTUALBOX_DIR)/VBoxAPIWrap INC_DIR += $(VBOX_DIR)/Main/xml INC_DIR += $(VBOX_DIR)/Main/include INC_DIR += $(VBOX_DIR)/VMM/include -INC_DIR += $(REP_DIR)/src/virtualbox +INC_DIR += $(REP_DIR)/src/virtualbox5 INC_DIR += $(REP_DIR)/src/virtualbox5/frontend vpath sup.cc $(REP_DIR)/src/virtualbox5/spec/nova/ diff --git a/repos/ports/lib/mk/virtualbox-bios.mk b/repos/ports/lib/mk/virtualbox-bios.mk deleted file mode 100644 index 7687be525..000000000 --- a/repos/ports/lib/mk/virtualbox-bios.mk +++ /dev/null @@ -1,39 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -ifeq ($(shell which yasm),) -REQUIRES += installation_of_yasm -endif - -SRC_O += VBoxPcBiosBin.o VBoxVgaBiosBin.o VBoxBiosLogoBin.o - -VBox%Bin.o : VBox%Bin.rom - $(MSG_CONVERT)$@ - $(VERBOSE)echo ".global g_ab$*Binary, g_cb$*Binary;" \ - ".data;" \ - "g_cb$*Binary:; .long g_ab$*BinaryEnd - g_ab$*Binary;" \ - ".align 4096;" \ - "g_ab$*Binary:; .incbin \"$<\";" \ - "g_ab$*BinaryEnd:;" | \ - $(AS) $(AS_OPT) -f -o $@ - - -VBoxPcBiosBin.rom: Devices/PC/BIOS/VBoxBiosAlternative.asm - $(MSG_ASSEM) - $(VERBOSE)yasm -f bin -o $@ $< - -VBoxVgaBiosBin.rom: Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm - $(MSG_ASSEM) - $(VERBOSE)yasm -f bin -o $@ $< - -VBoxBiosLogoBin.o: Devices/Graphics/BIOS/ose_logo.bmp - $(MSG_CONVERT)$@ - $(VERBOSE)echo ".global g_abVgaDefBiosLogo, g_cbVgaDefBiosLogo;" \ - ".data;" \ - "g_cbVgaDefBiosLogo:; .long g_abVgaDefBiosLogoEnd - g_abVgaDefBiosLogo;" \ - ".align 4096;" \ - "g_abVgaDefBiosLogo:; .incbin \"$<\";" \ - "g_abVgaDefBiosLogoEnd:;" | \ - $(AS) $(AS_OPT) -f -o $@ - - -vpath %.bmp $(VBOX_DIR) - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-common.inc b/repos/ports/lib/mk/virtualbox-common.inc deleted file mode 100644 index 1254492d5..000000000 --- a/repos/ports/lib/mk/virtualbox-common.inc +++ /dev/null @@ -1,108 +0,0 @@ -REQUIRES += x86 - -VBOX_MACH := $(filter $(SPECS), x86_32 x86_64) - -VBOX_MACH_CC_OPT_x86_32 = -DRT_ARCH_X86 -D__X86__ -VBOX_MACH_ASM_OPT_x86_32 = -f elf32 -VBOX_MACH_CC_OPT_x86_64 = -DRT_ARCH_AMD64 -D__AMD64__ -VBOX_MACH_ASM_OPT_x86_64 = -f elf64 - -ifeq ($(shell which yasm),) -REQUIRES += installation_of_yasm -REQUIRES += installation_of_iasl -endif - -VIRTUALBOX_DIR = $(call select_from_ports,virtualbox)/src/app/virtualbox -VIRTUALBOX_SDK_DIR = $(call select_from_ports,virtualbox)/src/app/virtualbox_sdk - -VBOX_DIR = $(VIRTUALBOX_DIR)/src/VBox - -VBOX_CC_OPT += -DIN_RING3 -DVBOX -DVBOX_OSE \ - -D_FILE_OFFSET_BITS=64 -DLOG_ENABLED - -VBOX_CC_OPT += $(VBOX_MACH_CC_OPT_$(VBOX_MACH)) - -VBOX_CC_OPT += -DVBOX_WITH_64_BITS_GUESTS -VBOX_CC_OPT += -DVBOX_WITH_NEW_MSR_CODE - -VBOX_CC_OPT += -DIN_SUP_R3 -DIN_VMM_R3 - -# we use the libc headers from FreeBSD -VBOX_CC_OPT += -DRT_OS_FREEBSD - -VBOX_CC_OPT += -DVBOX_WITH_REM -VBOX_CC_OPT += -DVBOX_WITH_HGCM -DVBOX_WITH_HGSMI - -VBOX_CC_OPT += -DVBOX_WITHOUT_TESTING_FEATURES - -VBOX_CC_OPT += -DVBOX_WITH_VIDEOHWACCEL - -VBOX_CC_OPT += -DVBOX_WITH_XPCOM - -VBOX_CC_OPT += -DRTLOG_REL_ENABLED -DRT_STRICT -DVBOX_STRICT - -VBOX_CC_OPT += -DVBOX_WITH_USB -DVBOX_WITH_VUSB - -# Enable Intel Network model E1000 -VBOX_CC_OPT += -DVBOX_WITH_E1000 - -VBOX_CC_OPT += -DVBOX_WITH_AHCI - -VBOX_CC_OPT += -DVBOX_WITH_GUEST_PROPS - -VIRTUALBOX_VERSION_MAJOR := $(shell cat $(VIRTUALBOX_DIR)/Config.kmk 2>/dev/null | grep "VBOX_VERSION_MAJOR = " | grep -v "'VBOX_VERSION_MAJOR" | sed "s/^.*= //") -VIRTUALBOX_VERSION_MINOR := $(shell cat $(VIRTUALBOX_DIR)/Config.kmk 2>/dev/null | grep "VBOX_VERSION_MINOR = " | grep -v "'VBOX_VERSION_MINOR" | sed "s/^.*= //") -VIRTUALBOX_VERSION_BUILD := $(shell cat $(VIRTUALBOX_DIR)/Config.kmk 2>/dev/null | grep "VBOX_VERSION_BUILD = " | grep -v "'VBOX_VERSION_BUILD" | sed "s/^.*= //") - -ifeq ($(VBOX_MACH),x86_32) -VIRTUALBOX_PACKAGE_STRING = GenodeOS_32BIT_GENERIC -else -VIRTUALBOX_PACKAGE_STRING = GenodeOS_64BIT_GENERIC -endif - -VBOX_CC_OPT += -DVBOX_VERSION_MAJOR=$(VIRTUALBOX_VERSION_MAJOR) \ - -DVBOX_VERSION_MINOR=$(VIRTUALBOX_VERSION_MINOR) \ - -DVBOX_VERSION_BUILD=$(VIRTUALBOX_VERSION_BUILD) \ - -DVBOX_VERSION_STRING=\"$(VIRTUALBOX_VERSION_MAJOR).$(VIRTUALBOX_VERSION_MINOR).$(VIRTUALBOX_VERSION_BUILD)_OSE\" \ - -DVBOX_VERSION_STRING_RAW=\"$(VIRTUALBOX_VERSION_MAJOR).$(VIRTUALBOX_VERSION_MINOR).$(VIRTUALBOX_VERSION_BUILD)\" \ - -DVBOX_PACKAGE_STRING=\"$(VIRTUALBOX_PACKAGE_STRING)\" \ - -DVBOX_API_VERSION_STRING=\"$(VIRTUALBOX_VERSION_MAJOR)_$(VIRTUALBOX_VERSION_MINOR)\" \ - -DIPRT_BLDCFG_VERSION_STRING=\"$(VIRTUALBOX_VERSION_MAJOR).$(VIRTUALBOX_VERSION_MINOR).$(VIRTUALBOX_VERSION_BUILD)_OSE\" \ - -DIPRT_BLDCFG_TARGET=\"genode\" \ - -DIPRT_BLDCFG_TARGET_ARCH=\"$(VBOX_MACH)\" - -VBOX_CC_OPT += -DVBOX_WITH_WDDM -DVBOX_WITH_WDDM_W8 -DVBOXWDDM_WITH_VBVA -VBOX_CC_OPT += -DVBOX_WITH_VDMA -VBOX_CC_OPT += -DVBOX_WITH_VMSVGA - - -VBOX_CC_OPT += -DVBOX_HDD_NO_DYNAMIC_BACKENDS - -VBOX_CC_OPT += -DVBOX_WITHOUT_NS_ACCOUNTING - -CC_WARN += -Wno-trigraphs - -CC_OPT += $(VBOX_CC_OPT) - -# VirtualBox expects wchar_t to be a 16-bit type. yasm does not understand this -# flag, therefore it gets added to CC_OPT instead of VBOX_CC_OPT. -CC_OPT += -fshort-wchar - -LIBS += libc libm libc-mem - -INC_DIR += $(REP_DIR)/src/virtualbox/include -INC_DIR += $(REP_DIR)/src/virtualbox/include/xpcom -INC_DIR += $(VIRTUALBOX_DIR)/include -INC_DIR += $(VIRTUALBOX_SDK_DIR)/sdk/bindings/xpcom/include -INC_DIR += $(VBOX_DIR)/Devices/build - -vpath %.cpp $(VBOX_DIR) -vpath %.c $(VBOX_DIR) -vpath %.asm $(VBOX_DIR) - -%.o: %.asm - $(MSG_ASSEM)$@ - $(VERBOSE)yasm $(VBOX_MACH_ASM_OPT_$(VBOX_MACH)) -DASM_FORMAT_ELF -D__YASM__ \ - $(addprefix -I,$(INC_DIR)) $(VBOX_CC_OPT) -o $@ $< - -# vi: set ft=make : diff --git a/repos/ports/lib/mk/virtualbox-devices.mk b/repos/ports/lib/mk/virtualbox-devices.mk deleted file mode 100644 index ac4e52ea0..000000000 --- a/repos/ports/lib/mk/virtualbox-devices.mk +++ /dev/null @@ -1,100 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -SRC_CC += Devices/PC/DevFwCommon.cpp -SRC_CC += Devices/PC/DevPcBios.cpp -SRC_CC += Devices/Bus/DevPCI.cpp -SRC_CC += Devices/PC/DevACPI.cpp -SRC_CC += Devices/PC/ACPI/VBoxAcpi.cpp -SRC_C += Devices/PC/DevPcArch.c -SRC_CC += Devices/Input/DevPS2.cpp -SRC_CC += Devices/Input/PS2K.cpp -SRC_CC += Devices/PC/DevPit-i8254.cpp -SRC_CC += Devices/PC/DevPIC.cpp -SRC_CC += Devices/PC/DevRTC.cpp -SRC_CC += Devices/PC/DevDMA.cpp -SRC_CC += Devices/PC/DevAPIC.cpp -SRC_CC += Devices/Graphics/DevVGA.cpp -SRC_CC += Devices/Graphics/DevVGA_VBVA.cpp -SRC_CC += Devices/Graphics/DevVGA_VDMA.cpp -SRC_CC += Devices/Graphics/DevVGA-SVGA.cpp -SRC_CC += Devices/Graphics/HGSMI/HGSMIHost.cpp -SRC_CC += Devices/Graphics/HGSMI/HGSMIHostHlp.cpp -SRC_CC += Devices/Graphics/HGSMI/SHGSMIHost.cpp -SRC_CC += Devices/Storage/ATAPIPassthrough.cpp -SRC_CC += Devices/Storage/DevAHCI.cpp -SRC_CC += Devices/Storage/DevATA.cpp -SRC_CC += Devices/Storage/Debug.cpp -SRC_CC += Devices/Storage/DevFdc.c -SRC_CC += Devices/Network/DevE1000.cpp -SRC_CC += Devices/Network/DevE1000Phy.cpp -SRC_CC += Devices/Network/DevEEPROM.cpp -SRC_CC += Devices/Network/DevPCNet.cpp -SRC_CC += Devices/VMMDev/VMMDev.cpp -SRC_CC += Devices/VMMDev/VMMDevHGCM.cpp -SRC_CC += GuestHost/HGSMI/HGSMICommon.cpp -SRC_CC += Devices/Serial/DevSerial.cpp -SRC_CC += Devices/PC/DevIoApic.cpp - -SRC_C += Devices/Audio/audio.c -SRC_C += Devices/Audio/audiosniffer.c -SRC_C += Devices/Audio/filteraudio.c -SRC_C += Devices/Audio/mixeng.c -SRC_C += Devices/Audio/noaudio.c -SRC_CC += Devices/Audio/DevIchAc97.cpp -SRC_CC += Devices/Audio/DevIchHda.cpp -SRC_CC += Devices/Audio/DevIchHdaCodec.cpp -SRC_CC += Devices/USB/DevOHCI.cpp -SRC_CC += Devices/USB/USBProxyDevice.cpp -SRC_CC += Devices/USB/VUSBDevice.cpp -SRC_CC += Devices/USB/VUSBReadAhead.cpp -SRC_CC += Devices/USB/VUSBSniffer.cpp -SRC_CC += Devices/USB/VUSBUrb.cpp -SRC_CC += Devices/Input/UsbMouse.cpp -SRC_CC += Devices/Input/UsbKbd.cpp - -SRC_CC += Devices/build/VBoxDD.cpp - -SRC_CC += devxhci.cc - -INC_DIR += $(VBOX_DIR)/Devices/build -INC_DIR += $(VBOX_DIR)/Devices/Bus - -CC_WARN += -Wno-unused-but-set-variable - -# found in src/VBox/Devices/Makefile.kmk -CC_OPT += -DVBOX_HGCM_HOST_CODE - -Devices/Graphics/DevVGA.o: vbetables.h - -vbetables.h: vbetables-gen - $(MSG_CONVERT)$@ - $(VERBOSE)./$^ > $@ - -vbetables-gen: Devices/Graphics/BIOS/vbetables-gen.c - $(MSG_BUILD)$@ - $(VERBOSE)g++ $(VBOX_CC_OPT) $(addprefix -I,$(INC_DIR)) -o $@ $^ - - - -Devices/PC/ACPI/VBoxAcpi.o: vboxaml.hex vboxssdt-standard.hex vboxssdt-cpuhotplug.hex - -vboxaml.hex: vbox.dsl - iasl -tc -vs -p $@ $^ - -vboxssdt-standard.hex: vbox-standard.dsl - iasl -tc -vs -p $@ $^ && \ - mv $@ $@.tmp && \ - sed "s/AmlCode/AmlCodeSsdtStandard/g" <$@.tmp >$@ && \ - rm $@.tmp - -vboxssdt-cpuhotplug.hex: vbox-cpuhotplug.dsl - gcc -E -P -x c -o $@.pre $< && \ - iasl -tc -vs -p $@ $@.pre && \ - mv $@ $@.tmp && \ - sed "s/AmlCode/AmlCodeSsdtCpuHotPlug/g" <$@.tmp >$@ && \ - rm $@.tmp $@.pre - -vpath %.dsl $(VBOX_DIR)/Devices/PC -vpath %.cc $(REP_DIR)/src/virtualbox - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-dis.mk b/repos/ports/lib/mk/virtualbox-dis.mk deleted file mode 100644 index 06381605d..000000000 --- a/repos/ports/lib/mk/virtualbox-dis.mk +++ /dev/null @@ -1,17 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -SRC_CC += VMM/VMMR3/DBGFAddr.cpp -SRC_CC += VMM/VMMR3/DBGFDisas.cpp - -SRC_CC += Disassembler/DisasmCore.cpp -SRC_CC += Disassembler/DisasmTables.cpp -SRC_CC += Disassembler/DisasmReg.cpp -SRC_CC += Disassembler/DisasmTablesX64.cpp -SRC_CC += Disassembler/DisasmFormatYasm.cpp -SRC_CC += Disassembler/DisasmFormatBytes.cpp - -INC_DIR += $(VBOX_DIR)/VMM/include - -CC_OPT += -DVBOX_IN_VMM - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-drivers.mk b/repos/ports/lib/mk/virtualbox-drivers.mk deleted file mode 100644 index 634e48a54..000000000 --- a/repos/ports/lib/mk/virtualbox-drivers.mk +++ /dev/null @@ -1,29 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -# -# Prevent inclusion of the Genode::Log definition after the vbox #define -# of 'Log'. Otherwise, the attemt to compile base/log.h will fail. -# -VBOX_CC_OPT += -include base/log.h - -SRC_CC += Devices/Input/DrvKeyboardQueue.cpp -SRC_CC += Devices/Input/DrvMouseQueue.cpp -SRC_CC += Devices/USB/DrvVUSBRootHub.cpp -SRC_CC += Devices/Storage/DrvBlock.cpp -SRC_CC += Devices/Storage/DrvMediaISO.cpp -SRC_CC += Devices/Storage/DrvVD.cpp -SRC_CC += Devices/Storage/DrvRawImage.cpp -SRC_CC += Devices/PC/DrvACPI.cpp -SRC_CC += Devices/Serial/DrvChar.cpp -SRC_CC += Devices/Serial/DrvRawFile.cpp -SRC_CC += Devices/Serial/DrvHostSerial.cpp - -SRC_CC += audiodrv.cpp -SRC_CC += network.cpp - -INC_DIR += $(VBOX_DIR)/Devices/Audio - -vpath audiodrv.cpp $(REP_DIR)/src/virtualbox -vpath network.cpp $(REP_DIR)/src/virtualbox - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-hwaccl-off.mk b/repos/ports/lib/mk/virtualbox-hwaccl-off.mk deleted file mode 100644 index f49dbe85f..000000000 --- a/repos/ports/lib/mk/virtualbox-hwaccl-off.mk +++ /dev/null @@ -1,18 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -LIBS += stdcxx - -SRC_CC = pgm.cc sup.cc - -INC_DIR += $(call select_from_repositories,src/lib/libc) -INC_DIR += $(VBOX_DIR)/Main/xml -INC_DIR += $(VBOX_DIR)/Main/include -INC_DIR += $(VBOX_DIR)/VMM/include -INC_DIR += $(REP_DIR)/src/virtualbox -INC_DIR += $(REP_DIR)/src/virtualbox/frontend -INC_DIR += $(REP_DIR)/src/virtualbox/accloff - -vpath pgm.cc $(REP_DIR)/src/virtualbox/ -vpath sup.cc $(REP_DIR)/src/virtualbox/accloff/ - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-liblzf.mk b/repos/ports/lib/mk/virtualbox-liblzf.mk deleted file mode 100644 index 35d193ac9..000000000 --- a/repos/ports/lib/mk/virtualbox-liblzf.mk +++ /dev/null @@ -1,10 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -LIBLZF_DIR = $(VIRTUALBOX_DIR)/src/libs/liblzf-3.4 -INC_DIR += $(LIBLZF_DIR) -CC_OPT += -DULTRA_FAST=1 -DHLOG=12 -DSTRICT_ALIGN=0 -DPIC -SRC_C = lzf_c.c lzf_d.c - -vpath % $(LIBLZF_DIR) - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-main.mk b/repos/ports/lib/mk/virtualbox-main.mk deleted file mode 100644 index 712202a78..000000000 --- a/repos/ports/lib/mk/virtualbox-main.mk +++ /dev/null @@ -1,83 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -VBOX_CC_OPT += -DVBOX_WITH_GENERIC_SESSION_WATCHER - -# -# Prevent inclusion of the Genode::Log definition after the vbox #define -# of 'Log'. Otherwise, the attemt to compile base/log.h will fail. -# -VBOX_CC_OPT += -include base/log.h - -LIBS += stdcxx - -SRC_CC += Main/xml/Settings.cpp - -SRC_CC += Main/src-all/EventImpl.cpp -SRC_CC += Main/src-all/DisplayResampleImage.cpp -SRC_CC += Main/src-all/DisplayUtils.cpp -SRC_CC += Main/src-all/Global.cpp -SRC_CC += Main/src-all/HashedPw.cpp -SRC_CC += Main/src-all/PCIDeviceAttachmentImpl.cpp -SRC_CC += Main/src-all/ProgressImpl.cpp -SRC_CC += Main/src-all/SharedFolderImpl.cpp -SRC_CC += Main/src-all/VirtualBoxBase.cpp - -SRC_CC += Main/src-client/AdditionsFacilityImpl.cpp -SRC_CC += Main/src-client/BusAssignmentManager.cpp -SRC_CC += Main/src-client/ConsoleImpl.cpp -SRC_CC += Main/src-client/ConsoleImpl2.cpp -SRC_CC += Main/src-client/DisplayImpl.cpp -SRC_CC += Main/src-client/GuestImpl.cpp -SRC_CC += Main/src-client/HGCM.cpp -SRC_CC += Main/src-client/HGCMObjects.cpp -SRC_CC += Main/src-client/HGCMThread.cpp -SRC_CC += Main/src-client/KeyboardImpl.cpp -SRC_CC += Main/src-client/MouseImpl.cpp -SRC_CC += Main/src-client/VBoxDriversRegister.cpp -SRC_CC += Main/src-client/VMMDevInterface.cpp -SRC_CC += Main/src-client/SessionImpl.cpp - -SRC_CC += Main/src-server/AudioAdapterImpl.cpp -SRC_CC += Main/src-server/BandwidthControlImpl.cpp -SRC_CC += Main/src-server/BandwidthGroupImpl.cpp -SRC_CC += Main/src-server/BIOSSettingsImpl.cpp -SRC_CC += Main/src-server/ClientToken.cpp -SRC_CC += Main/src-server/DHCPServerImpl.cpp -SRC_CC += Main/src-server/GuestOSTypeImpl.cpp -SRC_CC += Main/src-server/MachineImpl.cpp -SRC_CC += Main/src-server/MachineImplCloneVM.cpp -SRC_CC += Main/src-server/Matching.cpp -SRC_CC += Main/src-server/MediumAttachmentImpl.cpp -SRC_CC += Main/src-server/MediumImpl.cpp -SRC_CC += Main/src-server/MediumFormatImpl.cpp -SRC_CC += Main/src-server/MediumLock.cpp -SRC_CC += Main/src-server/NATEngineImpl.cpp -SRC_CC += Main/src-server/NetworkAdapterImpl.cpp -SRC_CC += Main/src-server/NetworkServiceRunner.cpp -SRC_CC += Main/src-server/ParallelPortImpl.cpp -SRC_CC += Main/src-server/SerialPortImpl.cpp -SRC_CC += Main/src-server/SnapshotImpl.cpp -SRC_CC += Main/src-server/StorageControllerImpl.cpp -SRC_CC += Main/src-server/SystemPropertiesImpl.cpp -SRC_CC += Main/src-server/TokenImpl.cpp -SRC_CC += Main/src-server/USBControllerImpl.cpp -SRC_CC += Main/src-server/USBDeviceFilterImpl.cpp -SRC_CC += Main/src-server/USBDeviceFiltersImpl.cpp -SRC_CC += Main/src-server/VirtualBoxImpl.cpp -SRC_CC += Main/src-server/VRDEServerImpl.cpp - -SRC_CC += Main/glue/AutoLock.cpp -SRC_CC += Main/glue/EventQueue.cpp -SRC_CC += Main/glue/string.cpp -SRC_CC += Main/glue/xpcom/helpers.cpp - -INC_DIR += $(VBOX_DIR)/Main/xml -INC_DIR += $(VBOX_DIR)/Main/include -INC_DIR += $(REP_DIR)/src/virtualbox -INC_DIR += $(REP_DIR)/src/virtualbox/frontend -INC_DIR += $(REP_DIR)/src/virtualbox/frontend/VBoxAPIWrap - -# search path to 'scan_code_set_2.h' -INC_DIR += $(call select_from_repositories,src/drivers/input/spec/ps2) - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-recompiler.mk b/repos/ports/lib/mk/virtualbox-recompiler.mk deleted file mode 100644 index 81e3cc9fa..000000000 --- a/repos/ports/lib/mk/virtualbox-recompiler.mk +++ /dev/null @@ -1,31 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -RECOMPILER_DIR = $(VIRTUALBOX_DIR)/src/recompiler - -RECOMPILER_SRC_C = cpu-exec.c cutils.c exec.c host-utils.c tcg-runtime.c \ - translate-all.c VBoxRecompiler.c \ - tcg/tcg-dyngen.c tcg/tcg.c \ - fpu/softfloat-native.c \ - target-i386/helper.c target-i386/op_helper.c \ - target-i386/translate.c - -SRC_C = $(addprefix recompiler/,$(RECOMPILER_SRC_C)) - -INC_DIR += $(VBOX_DIR)/VMM/include -INC_DIR += $(RECOMPILER_DIR)/Sun/crt -INC_DIR += $(RECOMPILER_DIR)/Sun -INC_DIR += $(RECOMPILER_DIR)/target-i386 -INC_DIR += $(RECOMPILER_DIR)/tcg -INC_DIR += $(RECOMPILER_DIR)/tcg/i386 -INC_DIR += $(RECOMPILER_DIR)/fpu -INC_DIR += $(RECOMPILER_DIR) - -CC_OPT += -DIN_REM_R3 \ - -DREM_INCLUDE_CPU_H -DNEED_CPU_H -DLOG_USE_C99 -D_GNU_SOURCE - -CC_WARN += -Wno-unused-but-set-variable] - -vpath %.cpp $(VIRTUALBOX_DIR)/src -vpath %.c $(VIRTUALBOX_DIR)/src - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-runtime.mk b/repos/ports/lib/mk/virtualbox-runtime.mk deleted file mode 100644 index 35e9b1e89..000000000 --- a/repos/ports/lib/mk/virtualbox-runtime.mk +++ /dev/null @@ -1,171 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -INC_DIR += $(VBOX_DIR)/Runtime/include - -INC_DIR += $(VIRTUALBOX_DIR)/src/libs/liblzf-3.4 -INC_DIR += $(VIRTUALBOX_DIR)/src/libs/zlib-1.2.8 -INC_DIR += $(call select_from_ports,libiconv)/include/iconv - -GENERIC_SRC_CC = $(notdir $(wildcard $(VBOX_DIR)/Runtime/generic/*.cpp)) - -FILTERED_OUT_SRC_CC = RTLogDefaultInit-generic.cpp \ - RTTimeLocalExplode-generic.cpp \ - semrw-lockless-generic.cpp \ - tls-generic.cpp \ - fs-stubs-generic.cpp \ - http-curl.cpp \ - RTSemEventMultiWait-2-ex-generic.cpp \ - RTLogWriteStdErr-generic.cpp \ - RTLogWriteStdOut-generic.cpp \ - RTMpGetDescription-generic-stub.cpp \ - RTSemEventWait-2-ex-generic.cpp \ - RTSemEventWait-generic.cpp \ - RTSemEventWaitNoResume-2-ex-generic.cpp \ - RTFileExists-generic.cpp \ - RTSemMutexRequest-generic.cpp \ - RTSemMutexRequestDebug-generic.cpp \ - RTDirExists-generic.cpp \ - RTMpOnPair-generic.cpp \ - RTTimerCreate-generic.cpp \ - timer-generic.cpp - -CC_WARN += -Wno-unused-variable - -SRC_CC += Runtime/common/log/logrel.cpp \ - Runtime/r3/init.cpp \ - Runtime/common/misc/thread.cpp \ - $(addprefix Runtime/generic/,$(filter-out $(FILTERED_OUT_SRC_CC), $(GENERIC_SRC_CC))) - -SRC_CC += Runtime/common/err/RTErrConvertFromErrno.cpp -SRC_CC += Runtime/common/alloc/memcache.cpp -SRC_CC += Runtime/common/alloc/heapoffset.cpp -SRC_CC += Runtime/common/checksum/alt-md5.cpp -SRC_CC += Runtime/common/checksum/alt-sha512.cpp -SRC_CC += Runtime/common/checksum/crc32.cpp -SRC_CC += Runtime/common/checksum/ipv4.cpp -SRC_CC += Runtime/common/checksum/sha512str.cpp -SRC_CC += Runtime/common/log/log.cpp -SRC_CC += Runtime/common/log/log.cpp -SRC_CC += Runtime/common/log/logellipsis.cpp -SRC_CC += Runtime/common/log/logrelellipsis.cpp -SRC_CC += Runtime/common/log/logformat.cpp -SRC_CC += Runtime/common/misc/assert.cpp -SRC_CC += Runtime/common/misc/buildconfig.cpp -SRC_CC += Runtime/common/misc/lockvalidator.cpp -SRC_CC += Runtime/common/misc/once.cpp -SRC_CC += Runtime/common/misc/req.cpp -SRC_CC += Runtime/common/misc/reqpool.cpp -SRC_CC += Runtime/common/misc/reqqueue.cpp -SRC_CC += Runtime/common/misc/sg.cpp -SRC_CC += Runtime/common/misc/term.cpp -SRC_CC += Runtime/common/misc/RTAssertMsg1Weak.cpp -SRC_CC += Runtime/common/misc/RTAssertMsg2AddWeak.cpp -SRC_CC += Runtime/common/misc/RTAssertMsg2AddWeakV.cpp -SRC_CC += Runtime/common/misc/RTAssertMsg2Weak.cpp -SRC_CC += Runtime/common/misc/RTAssertMsg2WeakV.cpp -SRC_CC += Runtime/common/misc/RTMemWipeThoroughly.cpp -SRC_CC += Runtime/common/path/comparepaths.cpp -SRC_CC += Runtime/common/path/RTPathAbsDup.cpp -SRC_CC += Runtime/common/path/RTPathAbsEx.cpp -SRC_CC += Runtime/common/path/RTPathAppendEx.cpp -SRC_CC += Runtime/common/path/RTPathCalcRelative.cpp -SRC_CC += Runtime/common/path/RTPathExt.cpp -SRC_CC += Runtime/common/path/RTPathFilename.cpp -SRC_CC += Runtime/common/path/RTPathHasPath.cpp -SRC_CC += Runtime/common/path/RTPathJoinA.cpp -SRC_CC += Runtime/common/path/RTPathJoinEx.cpp -SRC_CC += Runtime/common/path/RTPathParse.cpp -SRC_CC += Runtime/common/path/RTPathParseSimple.cpp -SRC_CC += Runtime/common/path/RTPathRealDup.cpp -SRC_CC += Runtime/common/path/RTPathStartsWithRoot.cpp -SRC_CC += Runtime/common/path/RTPathStripExt.cpp -SRC_CC += Runtime/common/path/RTPathStripFilename.cpp -SRC_CC += Runtime/common/path/RTPathStripTrailingSlash.cpp -SRC_CC += Runtime/common/path/rtPathVolumeSpecLen.cpp -SRC_CC += Runtime/common/path/rtPathRootSpecLen.cpp -SRC_CC += Runtime/common/rand/rand.cpp -SRC_CC += Runtime/common/rand/randadv.cpp -SRC_CC += Runtime/common/rand/randparkmiller.cpp -SRC_CC += Runtime/common/string/base64.cpp -SRC_CC += Runtime/common/string/RTStrCmp.cpp -SRC_CC += Runtime/common/string/RTStrCopy.cpp -SRC_CC += Runtime/common/string/RTStrCopyEx.cpp -SRC_CC += Runtime/common/string/RTStrNCmp.cpp -SRC_CC += Runtime/common/string/RTStrNLen.cpp -SRC_CC += Runtime/common/string/RTStrPrintHexBytes.cpp -SRC_CC += Runtime/common/string/simplepattern.cpp -SRC_CC += Runtime/common/string/straprintf.cpp -SRC_CC += Runtime/common/string/strformat.cpp -SRC_CC += Runtime/common/string/strformatrt.cpp -SRC_CC += Runtime/common/string/strformattype.cpp -SRC_CC += Runtime/common/string/stringalloc.cpp -SRC_CC += Runtime/common/string/strprintf.cpp -SRC_CC += Runtime/common/string/strspace.cpp -SRC_CC += Runtime/common/string/strstrip.cpp -SRC_CC += Runtime/common/string/strtonum.cpp -SRC_CC += Runtime/common/string/unidata-lower.cpp -SRC_CC += Runtime/common/string/unidata-upper.cpp -SRC_CC += Runtime/common/string/utf-8.cpp -SRC_CC += Runtime/common/string/utf-8-case.cpp -SRC_CC += Runtime/common/string/utf-16.cpp -SRC_CC += Runtime/common/string/utf-16-case.cpp -SRC_CC += Runtime/common/table/avlpv.cpp -SRC_CC += Runtime/common/table/avlroioport.cpp -SRC_CC += Runtime/common/table/avlrogcphys.cpp -SRC_CC += Runtime/common/table/avlul.cpp -SRC_CC += Runtime/common/time/time.cpp -SRC_CC += Runtime/common/time/timeprog.cpp -SRC_CC += Runtime/common/time/timesup.cpp -SRC_CC += Runtime/common/time/timesupref.cpp -SRC_CC += Runtime/common/vfs/vfsbase.cpp -SRC_CC += Runtime/common/zip/zip.cpp -SRC_CC += Runtime/r3/alloc.cpp -SRC_CC += Runtime/r3/dir.cpp -SRC_CC += Runtime/r3/fileio.cpp -SRC_CC += Runtime/r3/fs.cpp -SRC_CC += Runtime/r3/path.cpp -SRC_CC += Runtime/r3/generic/semspinmutex-r3-generic.cpp -SRC_CC += Runtime/r3/posix/dir-posix.cpp -SRC_CC += Runtime/r3/posix/env-posix.cpp -SRC_CC += Runtime/r3/posix/fileio-posix.cpp -SRC_CC += Runtime/r3/posix/fileio2-posix.cpp -SRC_CC += Runtime/r3/posix/fs-posix.cpp -SRC_CC += Runtime/r3/posix/fs2-posix.cpp -SRC_CC += Runtime/r3/posix/fs3-posix.cpp -SRC_CC += Runtime/r3/posix/path-posix.cpp -SRC_CC += Runtime/r3/posix/path2-posix.cpp -SRC_CC += Runtime/r3/posix/pipe-posix.cpp -SRC_CC += Runtime/r3/posix/RTTimeNow-posix.cpp -SRC_CC += Runtime/r3/posix/semeventmulti-posix.cpp -SRC_CC += Runtime/r3/posix/semevent-posix.cpp -SRC_CC += Runtime/r3/posix/semmutex-posix.cpp -SRC_CC += Runtime/r3/posix/symlink-posix.cpp -SRC_CC += Runtime/r3/posix/thread2-posix.cpp -SRC_CC += Runtime/r3/posix/thread-posix.cpp -SRC_CC += Runtime/r3/posix/time-posix.cpp -SRC_CC += Runtime/r3/posix/tls-posix.cpp -SRC_CC += Runtime/r3/posix/utf8-posix.cpp -SRC_CC += Runtime/r3/process.cpp -SRC_CC += Runtime/r3/stream.cpp -SRC_CC += Runtime/VBox/log-vbox.cpp -SRC_S += Runtime/common/asm/ASMAtomicCmpXchgU64.asm -SRC_S += Runtime/common/asm/ASMAtomicReadU64.asm -SRC_S += Runtime/common/asm/ASMAtomicUoReadU64.as -SRC_S += Runtime/common/asm/ASMAtomicXchgU64.asm -SRC_S += Runtime/common/asm/ASMCpuIdExSlow.asm - -SRC_CC += Runtime/common/err/errmsg.cpp -Runtime/common/err/errmsg.o: errmsgdata.h - -errmsgdata.h: $(VIRTUALBOX_DIR)/include/iprt/err.h \ - $(VIRTUALBOX_DIR)/include/VBox/err.h - $(MSG_CONVERT)$@ - $(VERBOSE)sed -f $(VBOX_DIR)/Runtime/common/err/errmsg.sed $^ > $@ - -SRC_CC += Runtime/common/err/errmsgxpcom.cpp -Runtime/common/err/errmsgxpcom.o: errmsgvboxcomdata.h - -errmsgvboxcomdata.h: - touch $@ - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-storage.mk b/repos/ports/lib/mk/virtualbox-storage.mk deleted file mode 100644 index 5ca2c6943..000000000 --- a/repos/ports/lib/mk/virtualbox-storage.mk +++ /dev/null @@ -1,19 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -SRC_CC += Storage/VCICache.cpp -SRC_CC += Storage/VD.cpp -SRC_CC += Storage/VMDK.cpp -SRC_CC += Storage/DMG.cpp -SRC_CC += Storage/ISCSI.cpp -SRC_CC += Storage/Parallels.cpp -SRC_CC += Storage/QCOW.cpp -SRC_CC += Storage/QED.cpp -SRC_CC += Storage/RAW.cpp -SRC_CC += Storage/VD.cpp -SRC_CC += Storage/VDI.cpp -SRC_CC += Storage/VDIfVfs.cpp -SRC_CC += Storage/VHD.cpp -SRC_CC += Storage/VHDX.cpp -SRC_CC += Storage/VMDK.cpp - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-vmm.mk b/repos/ports/lib/mk/virtualbox-vmm.mk deleted file mode 100644 index faead26dc..000000000 --- a/repos/ports/lib/mk/virtualbox-vmm.mk +++ /dev/null @@ -1,76 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -SRC_CC += VMM/VMMR3/VM.cpp -SRC_CC += VMM/VMMAll/VMAll.cpp -SRC_CC += VMM/VMMAll/VMMAll.cpp -SRC_CC += VMM/VMMR3/VMM.cpp - -SRC_CC += VMM/VMMR3/STAM.cpp - -SRC_CC += VMM/VMMR3/SSM.cpp - -SRC_CC += VMM/VMMR3/PDM.cpp -SRC_CC += VMM/VMMR3/PDMBlkCache.cpp -SRC_CC += VMM/VMMR3/PDMDevice.cpp -SRC_CC += VMM/VMMR3/PDMQueue.cpp -SRC_CC += VMM/VMMR3/PDMCritSect.cpp -SRC_CC += VMM/VMMAll/PDMAll.cpp -SRC_CC += VMM/VMMAll/PDMAllQueue.cpp -SRC_CC += VMM/VMMAll/PDMAllCritSect.cpp -SRC_CC += VMM/VMMAll/PDMAllCritSectRw.cpp - -SRC_CC += VMM/VMMR3/TM.cpp -SRC_CC += VMM/VMMAll/TMAll.cpp -SRC_CC += VMM/VMMAll/TMAllVirtual.cpp -SRC_CC += VMM/VMMAll/TMAllReal.cpp -SRC_CC += VMM/VMMAll/TMAllCpu.cpp -SRC_CC += VMM/VMMAll/TRPMAll.cpp - -SRC_CC += VMM/VMMR3/CFGM.cpp - -SRC_CC += VMM/VMMR3/PDMDevHlp.cpp -SRC_CC += VMM/VMMR3/PDMDevMiscHlp.cpp -SRC_CC += VMM/VMMR3/PDMDriver.cpp -SRC_CC += VMM/VMMR3/PDMThread.cpp - -SRC_CC += VMM/VMMR3/PDMUsb.cpp - -SRC_CC += VMM/VMMAll/CPUMAllMsrs.cpp -SRC_CC += VMM/VMMAll/CPUMAllRegs.cpp - -SRC_CC += VMM/VMMR3/VMEmt.cpp -SRC_CC += VMM/VMMR3/VMReq.cpp - -SRC_CC += VMM/VMMAll/DBGFAll.cpp -SRC_CC += VMM/VMMR3/DBGFInfo.cpp - -SRC_CC += VMM/VMMR3/CPUM.cpp -SRC_CC += VMM/VMMR3/CPUMR3CpuId.cpp -SRC_CC += VMM/VMMR3/CPUMR3Db.cpp - -SRC_CC += VMM/VMMAll/EMAll.cpp -SRC_CC += VMM/VMMR3/EM.cpp -SRC_CC += VMM/VMMR3/EMHM.cpp - -SRC_CC += VMM/VMMR3/TRPM.cpp -SRC_CC += VMM/VMMAll/SELMAll.cpp - -SRC_CC += VMM/VMMAll/REMAll.cpp - -SRC_CC += VMM/VMMR3/VMMGuruMeditation.cpp - -CC_OPT += -DVBOX_IN_VMM - -# definitions needed by SSM.cpp -CC_OPT += -DKBUILD_TYPE=\"debug\" \ - -DKBUILD_TARGET=\"genode\" \ - -DKBUILD_TARGET_ARCH=\"x86\" - -# definitions needed by VMMAll.cpp -CC_OPT += -DVBOX_SVN_REV=~0 - -INC_DIR += $(VBOX_DIR)/VMM/include - -CC_WARN += -Wno-unused-but-set-variable - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-xml.mk b/repos/ports/lib/mk/virtualbox-xml.mk deleted file mode 100644 index 964e0705e..000000000 --- a/repos/ports/lib/mk/virtualbox-xml.mk +++ /dev/null @@ -1,25 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -ZLIB_DIR = $(VIRTUALBOX_DIR)/src/libs/zlib-1.2.8 -LIBXML_DIR = $(VIRTUALBOX_DIR)/src/libs/libxml2-2.9.2 - -INC_DIR += $(ZLIB_DIR) -INC_DIR += $(LIBXML_DIR)/include -INC_DIR += $(call select_from_ports,libiconv)/include/iconv - -LIBS += stdcxx - -VBOX_CC_OPT += -DLIBXML_THREAD_ENABLED - -SRC_C += buf.c catalog.c chvalid.c debugXML.c dict.c encoding.c error.c entities.c -SRC_C += globals.c hash.c list.c parser.c parserInternals.c pattern.c -SRC_C += relaxng.c threads.c tree.c uri.c valid.c HTMLtree.c HTMLparser.c -SRC_C += SAX.c SAX2.c xmlIO.c xmlmemory.c xmlreader.c xmlregexp.c xmlschemas.c -SRC_C += xmlschemastypes.c xmlsave.c xmlstring.c xmlunicode.c xpath.c xpointer.c - -SRC_CC += Runtime/r3/xml.cpp -SRC_CC += Runtime/common/string/ministring.cpp - -vpath %.c $(LIBXML_DIR) - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox-zlib.mk b/repos/ports/lib/mk/virtualbox-zlib.mk deleted file mode 100644 index 9c442abd8..000000000 --- a/repos/ports/lib/mk/virtualbox-zlib.mk +++ /dev/null @@ -1,9 +0,0 @@ -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -ZLIB_DIR = $(VIRTUALBOX_DIR)/src/libs/zlib-1.2.8 -INC_DIR += $(ZLIB_DIR) -SRC_C = $(notdir $(wildcard $(ZLIB_DIR)/*.c)) - -vpath % $(ZLIB_DIR) - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox5-common.inc b/repos/ports/lib/mk/virtualbox5-common.inc index bc1be9489..24e523a32 100644 --- a/repos/ports/lib/mk/virtualbox5-common.inc +++ b/repos/ports/lib/mk/virtualbox5-common.inc @@ -103,8 +103,8 @@ CC_OPT += -fshort-wchar LIBS += libc libm libc-mem -INC_DIR += $(REP_DIR)/src/virtualbox/include -INC_DIR += $(REP_DIR)/src/virtualbox/include/xpcom +INC_DIR += $(REP_DIR)/src/virtualbox5/include +INC_DIR += $(REP_DIR)/src/virtualbox5/include/xpcom INC_DIR += $(VIRTUALBOX_DIR)/include INC_DIR += $(VIRTUALBOX_SDK_DIR)/sdk/bindings/xpcom/include INC_DIR += $(VBOX_DIR)/Devices/build diff --git a/repos/ports/lib/mk/virtualbox5-drivers.mk b/repos/ports/lib/mk/virtualbox5-drivers.mk index 5fbe8c656..b530eb779 100644 --- a/repos/ports/lib/mk/virtualbox5-drivers.mk +++ b/repos/ports/lib/mk/virtualbox5-drivers.mk @@ -22,7 +22,7 @@ SRC_CC += audio.cc INC_DIR += $(VBOX_DIR)/Devices/Audio -vpath network.cpp $(REP_DIR)/src/virtualbox +vpath network.cpp $(REP_DIR)/src/virtualbox5 vpath audio.cc $(REP_DIR)/src/virtualbox5 CC_CXX_WARN_STRICT = diff --git a/repos/ports/lib/mk/virtualbox5-hwaccl-off.mk b/repos/ports/lib/mk/virtualbox5-hwaccl-off.mk index 26b1a32d8..a445a9cff 100644 --- a/repos/ports/lib/mk/virtualbox5-hwaccl-off.mk +++ b/repos/ports/lib/mk/virtualbox5-hwaccl-off.mk @@ -11,7 +11,7 @@ INC_DIR += $(VIRTUALBOX_DIR)/VBoxAPIWrap INC_DIR += $(VBOX_DIR)/Main/xml INC_DIR += $(VBOX_DIR)/Main/include INC_DIR += $(VBOX_DIR)/VMM/include -INC_DIR += $(REP_DIR)/src/virtualbox +INC_DIR += $(REP_DIR)/src/virtualbox5 INC_DIR += $(REP_DIR)/src/virtualbox5/frontend INC_DIR += $(REP_DIR)/src/virtualbox5/accloff diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash deleted file mode 100644 index 790d6dcf0..000000000 --- a/repos/ports/ports/virtualbox.hash +++ /dev/null @@ -1 +0,0 @@ -6e8eff025e2e6e957b8971869af9632a8fff276b diff --git a/repos/ports/ports/virtualbox.port b/repos/ports/ports/virtualbox.port deleted file mode 100644 index 93f5adafc..000000000 --- a/repos/ports/ports/virtualbox.port +++ /dev/null @@ -1,111 +0,0 @@ -LICENSE := GPLv2 -VERSION := 4.3.40 -DOWNLOADS := virtualbox.archive virtualbox_sdk.archive - -VIRTUALBOX_TBZ2 := VirtualBox-$(VERSION).tar.bz2 -VIRTUALBOX_SDK_ZIP := VirtualBoxSDK-$(VERSION)-110317.zip - -URL(virtualbox) := http://download.virtualbox.org/virtualbox/$(VERSION)/$(VIRTUALBOX_TBZ2) -DIR(virtualbox) := src/app/virtualbox -SHA(virtualbox) := 4bbea49ee1eaa600db7af64b05c8ce6a1f7585de08f4f85cd7b6f0f7a798bcc6 - -URL(virtualbox_sdk) := http://download.virtualbox.org/virtualbox/$(VERSION)/$(VIRTUALBOX_SDK_ZIP) -DIR(virtualbox_sdk) := src/app/virtualbox_sdk -SHA(virtualbox_sdk) := e227edd309cce72921797641cbd0c668c89a6fcaf557fb0242d42d32de82aa9b - -PATCHES_DIR := src/virtualbox/patches -PATCHES_DIR_VBOX4 := src/virtualbox/patches -PATCHES := $(addprefix $(PATCHES_DIR)/, $(shell cat $(REP_DIR)/$(PATCHES_DIR)/series)) -PATCHES += $(addprefix $(PATCHES_DIR_VBOX4)/, $(shell cat $(REP_DIR)/$(PATCHES_DIR_VBOX4)/series_common)) -PATCH_OPT := -p1 - -$(call check_tool,xsltproc) -$(call check_tool,yasm) -$(call check_tool,iasl) - -VBOX_MAIN_GLUE := AutoLock EventQueue string xpcom/helpers - -VBOX_MAIN_ALL := DisplayResampleImage DisplayUtils EventImpl Global HashedPw -VBOX_MAIN_ALL += PCIDeviceAttachmentImpl ProgressImpl SharedFolderImpl -VBOX_MAIN_ALL += VirtualBoxBase - -VBOX_MAIN_CLI := AdditionsFacilityImpl ConsoleImpl2 DisplayImpl HGCM HGCMThread -VBOX_MAIN_CLI += HGCMObjects -VBOX_MAIN_CLI += KeyboardImpl SessionImpl VMMDevInterface BusAssignmentManager -VBOX_MAIN_CLI += ConsoleImpl GuestImpl MouseImpl VBoxDriversRegister - -VBOX_MAIN_SRV := AudioAdapterImpl ClientToken DHCPServerImpl Matching -VBOX_MAIN_SRV += MediumAttachmentImpl NATEngineImpl SerialPortImpl -VBOX_MAIN_SRV += BandwidthControlImpl GuestOSTypeImpl HostUSBDeviceImpl -VBOX_MAIN_SRV += MediumFormatImpl NetworkAdapterImpl SnapshotImpl -VBOX_MAIN_SRV += BandwidthGroupImpl MachineImplCloneVM MediumImpl -VBOX_MAIN_SRV += NetworkServiceRunner StorageControllerImpl VirtualBoxImpl -VBOX_MAIN_SRV += BIOSSettingsImpl MachineImpl MediumLock ParallelPortImpl -VBOX_MAIN_SRV += SystemPropertiesImpl VRDEServerImpl TokenImpl -VBOX_MAIN_SRV += USBControllerImpl USBDeviceFilterImpl USBDeviceFiltersImpl - -VBOX_MAIN_INC := AdditionsFacilityImpl AudioAdapterImpl AudioSnifferInterface -VBOX_MAIN_INC += AutoCaller AutostartDb AutoStateDep BandwidthControlImpl -VBOX_MAIN_INC += BandwidthGroupImpl BIOSSettingsImpl BusAssignmentManager Nvram -VBOX_MAIN_INC += ClientToken ConsoleImpl DHCPServerImpl DisplayImpl HostImpl -VBOX_MAIN_INC += DisplayUtils EventImpl FramebufferImpl Global -VBOX_MAIN_INC += GuestCtrlImplPrivate GuestDirectoryImpl GuestDnDImpl Logging -VBOX_MAIN_INC += GuestFileImpl GuestFsObjInfoImpl GuestImpl GuestOSTypeImpl -VBOX_MAIN_INC += GuestSessionImpl HashedPw KeyboardImpl MachineImplCloneVM -VBOX_MAIN_INC += HGCM HGCMThread HGCMObjects -VBOX_MAIN_INC += MachineImpl MediumAttachmentImpl MediumFormatImpl MediumImpl -VBOX_MAIN_INC += MediumLock MouseImpl NATEngineImpl NATNetworkImpl objectslist -VBOX_MAIN_INC += NetworkAdapterImpl NetworkServiceRunner ParallelPortImpl -VBOX_MAIN_INC += PCIDeviceAttachmentImpl Performance ProgressImpl SnapshotImpl -VBOX_MAIN_INC += ProgressProxyImpl SerialPortImpl SessionImpl SharedFolderImpl -VBOX_MAIN_INC += StorageControllerImpl SystemPropertiesImpl TokenImpl VMMDev -VBOX_MAIN_INC += USBControllerImpl USBDeviceFilterImpl USBDeviceFiltersImpl -VBOX_MAIN_INC += USBProxyService VirtualBoxImpl VRDEServerImpl GuestProcessImpl -VBOX_MAIN_INC += USBDeviceImpl HostUSBDeviceImpl Matching Wrapper - -VBOX_SRC_VBOX := VMM Devices Runtime GuestHost/HGSMI Storage Disassembler -VBOX_SRC_VBOX += HostServices/SharedFolders Main/xml/Settings.cpp -VBOX_SRC_VBOX += HostServices/SharedClipboard -VBOX_SRC_VBOX += HostServices/GuestProperties -VBOX_SRC_VBOX += Main/xml/VirtualBox-settings.xsd Main/xml/SchemaDefs.xsl -VBOX_SRC_VBOX += $(addsuffix .h, $(addprefix Main/include/, $(VBOX_MAIN_INC))) -VBOX_SRC_VBOX += $(addsuffix .cpp, $(addprefix Main/src-client/, $(VBOX_MAIN_CLI))) -VBOX_SRC_VBOX += $(addsuffix .cpp, $(addprefix Main/src-server/, $(VBOX_MAIN_SRV))) -VBOX_SRC_VBOX += $(addsuffix .cpp, $(addprefix Main/src-all/, $(VBOX_MAIN_ALL))) -VBOX_SRC_VBOX += $(addsuffix .cpp, $(addprefix Main/glue/, $(VBOX_MAIN_GLUE))) - -VBOX_INC += types.h cdefs.h hgcmsvc.h err.h dis.h disopcode.h log.h sup.h pci.h -VBOX_INC += param.h ostypes.h VMMDev.h VMMDev2.h vusb.h dbg.h version.h HGSMI -VBOX_INC += VBoxVideo.h Hardware bioslogo.h scsi.h shflsvc.h VBoxGuest2.h vd.h -VBOX_INC += vd-plugin.h vd-ifs.h vd-ifs-internal.h vd-image-backend.h -VBOX_INC += vd-cache-backend.h vd-filter-backend.h msi.h asmdefs.mac err.mac -VBOX_INC += VBoxVideoHost3D.h VBoxVideo3D.h settings.h VBoxAuth.h -VBOX_INC += usb.h usbfilter.h - -VBOX_INC_COM := array.h assert.h AutoLock.h ErrorInfo.h EventQueue.h Guid.h -VBOX_INC_COM += list.h MultiResult.h string.h - -VBOX_INC_HOST := VBoxClipboardExt.h VBoxClipboardSvc.h GuestPropertySvc.h - -VBOX_CONTENT += $(addprefix src/VBox/,$(VBOX_SRC_VBOX)) -VBOX_CONTENT += $(addprefix include/VBox/, $(VBOX_INC)) -VBOX_CONTENT += $(addprefix include/VBox/com/, $(VBOX_INC_COM)) -VBOX_CONTENT += $(addprefix include/VBox/HostServices/, $(VBOX_INC_HOST)) - -VBOX_CONTENT += src/libs/zlib-1.2.8 src/libs/liblzf-3.4 src/libs/libxml2-2.9.2 -VBOX_CONTENT += src/recompiler include/VBox/vmm include/iprt Config.kmk - - -TAR_OPT(virtualbox) := \ - --strip-components 1 \ - $(addprefix $(VIRTUALBOX_TBZ2:.tar.bz2=)/,$(VBOX_CONTENT)) - -UNZIP_OPT(virtualbox_sdk) := $(VIRTUALBOX_SDK_ZIP) sdk/bindings/xpcom/include/VirtualBox_XPCOM.h \# - - -default : additional_steps -additional_steps : $(DOWNLOADS) - xsltproc --stringparam mode declare \ - -o src/app/virtualbox/src/VBox/Main/xml/SchemaDefs.h \ - src/app/virtualbox/src/VBox/Main/xml/SchemaDefs.xsl \ - src/app/virtualbox/src/VBox/Main/xml/VirtualBox-settings.xsd diff --git a/repos/ports/ports/virtualbox5.hash b/repos/ports/ports/virtualbox5.hash index b0ef7d76d..fd545b0f8 100644 --- a/repos/ports/ports/virtualbox5.hash +++ b/repos/ports/ports/virtualbox5.hash @@ -1 +1 @@ -c6bfa150b4b3227b9e46792d4a7df7431a41a31e +48495db3bf857e7d02ede435d53904ac5239d91d diff --git a/repos/ports/ports/virtualbox5.port b/repos/ports/ports/virtualbox5.port index 8c510795d..13d6ee227 100644 --- a/repos/ports/ports/virtualbox5.port +++ b/repos/ports/ports/virtualbox5.port @@ -14,9 +14,7 @@ DIR(virtualbox_sdk) := src/app/virtualbox_sdk SHA(virtualbox_sdk) := 038c1d069ecf2886a2a7ca1ad5483bde4169b7bee39d77fbb16943a28ce64341 PATCHES_DIR := src/virtualbox5/patches -PATCHES_DIR_VBOX4 := src/virtualbox/patches PATCHES := $(addprefix $(PATCHES_DIR)/, $(shell cat $(REP_DIR)/$(PATCHES_DIR)/series)) -PATCHES += $(addprefix $(PATCHES_DIR_VBOX4)/, $(shell cat $(REP_DIR)/$(PATCHES_DIR_VBOX4)/series_common)) PATCH_OPT := -p1 $(call check_tool,xsltproc) diff --git a/repos/ports/recipes/src/vbox5-nova/content.mk b/repos/ports/recipes/src/vbox5-nova/content.mk index 489e48bf6..d110e839a 100644 --- a/repos/ports/recipes/src/vbox5-nova/content.mk +++ b/repos/ports/recipes/src/vbox5-nova/content.mk @@ -2,18 +2,8 @@ LIB_MK_FILES := $(notdir $(wildcard $(REP_DIR)/lib/mk/virtualbox5-*)) \ spec/nova/virtualbox5-nova.mk MIRROR_FROM_REP_DIR := src/virtualbox5 \ - src/virtualbox/include \ - src/virtualbox/network.cpp \ - src/virtualbox/vmm.h \ - src/virtualbox/sup.h \ - src/virtualbox/mm.h \ - src/virtualbox/util.h \ - src/virtualbox/dynlib.cc \ - src/virtualbox/libc.cc \ - src/virtualbox/logger.cc \ - src/virtualbox/pdm.cc \ - src/virtualbox/rt.cc \ - src/virtualbox/thread.cc \ + src/virtualbox5/network.cpp \ + src/virtualbox5/include \ include/vmm \ $(addprefix lib/mk/,$(LIB_MK_FILES)) diff --git a/repos/ports/recipes/src/vbox5-nova/hash b/repos/ports/recipes/src/vbox5-nova/hash index 836037ce4..cf978e53f 100644 --- a/repos/ports/recipes/src/vbox5-nova/hash +++ b/repos/ports/recipes/src/vbox5-nova/hash @@ -1 +1 @@ -2019-02-05 b30bb3427f39a48e6bf1127d30844860e8149a7f +2019-02-11-b e7c143cbc5c27c684261f930a8158215d579989c diff --git a/repos/ports/run/vbox4_ubuntu_14_04_32.run b/repos/ports/run/vbox4_ubuntu_14_04_32.run deleted file mode 100644 index 76c3edb91..000000000 --- a/repos/ports/run/vbox4_ubuntu_14_04_32.run +++ /dev/null @@ -1,23 +0,0 @@ -# -# Ubuntu 14.04 32bit in VBox 4 -# - -set flavor "ubuntu_14_04_32" -set vm_ram "1280M" - -set use_vbox4 1 -set use_vbox5 0 - -set use_rumpfs 1 -# Write overlay only into ram -set use_ram_fs 1 -# However read initial overlay from disk -set use_overlay_from_disk 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 1 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox4_ubuntu_14_04_64.run b/repos/ports/run/vbox4_ubuntu_14_04_64.run deleted file mode 100644 index d5015a0d5..000000000 --- a/repos/ports/run/vbox4_ubuntu_14_04_64.run +++ /dev/null @@ -1,25 +0,0 @@ -# -# Ubuntu 14.04 64bit in VBox 4 -# - -assert_spec 64bit - -set flavor "ubuntu_14_04_64" -set vm_ram "1280M" - -set use_vbox4 1 -set use_vbox5 0 - -set use_rumpfs 1 -# Write overlay only into ram -set use_ram_fs 1 -# However read initial overlay from disk -set use_overlay_from_disk 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 1 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox4_ubuntu_16_04_32.run b/repos/ports/run/vbox4_ubuntu_16_04_32.run deleted file mode 100644 index b77595ad9..000000000 --- a/repos/ports/run/vbox4_ubuntu_16_04_32.run +++ /dev/null @@ -1,23 +0,0 @@ -# -# Ubuntu 16.04 32bit in VBox 4 -# - -set flavor "ubuntu_16_04_32" -set vm_ram "1280M" - -set use_vbox4 1 -set use_vbox5 0 - -set use_rumpfs 1 -# Write overlay only into ram -set use_ram_fs 1 -# However read initial overlay from disk -set use_overlay_from_disk 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 1 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox4_ubuntu_16_04_64.run b/repos/ports/run/vbox4_ubuntu_16_04_64.run deleted file mode 100644 index 817af9d0e..000000000 --- a/repos/ports/run/vbox4_ubuntu_16_04_64.run +++ /dev/null @@ -1,25 +0,0 @@ -# -# Ubuntu 16.04 64bit in VBox 4 -# - -assert_spec 64bit - -set flavor "ubuntu_16_04_64" -set vm_ram "9460M" - -set use_vbox4 1 -set use_vbox5 0 - -set use_rumpfs 1 -# Write overlay only into ram -set use_ram_fs 1 -# However read initial overlay from disk -set use_overlay_from_disk 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 1 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox4_win10_64.run b/repos/ports/run/vbox4_win10_64.run deleted file mode 100644 index bcbba76dd..000000000 --- a/repos/ports/run/vbox4_win10_64.run +++ /dev/null @@ -1,26 +0,0 @@ -# -# Windows 10 in VirtualBox 4 -# - -assert_spec nova -assert_spec 64bit - -set flavor "win10" -set vm_ram "1280M" - -set use_vbox4 1 -set use_vbox5 0 - -set use_rumpfs 1 -# Write overlay only into ram -set use_ram_fs 1 -# However read initial overlay from disk -set use_overlay_from_disk 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 0 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox4_win7_32.run b/repos/ports/run/vbox4_win7_32.run deleted file mode 100644 index 73919ae0b..000000000 --- a/repos/ports/run/vbox4_win7_32.run +++ /dev/null @@ -1,23 +0,0 @@ -# -# Windows 7 in VirtualBox -# - -set flavor "win7" -set vm_ram "1280M" - -set use_vbox4 1 -set use_vbox5 0 - -set use_rumpfs 1 -# Write overlay only into ram -set use_ram_fs 1 -# However read initial overlay from disk -set use_overlay_from_disk 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 0 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox4_win7_32_share.run b/repos/ports/run/vbox4_win7_32_share.run deleted file mode 100644 index 5650073eb..000000000 --- a/repos/ports/run/vbox4_win7_32_share.run +++ /dev/null @@ -1,22 +0,0 @@ -set flavor "win7" -set vm_ram "1280M" - -set use_vbox4 1 -set use_vbox5 0 - -set vdi_image "${flavor}.vdi" -# Write overlay back to harddisk if set to 0 -set use_ram_fs 1 -set use_overlay_from_disk 1 -set overlay_image "overlay_${flavor}.vdi" -set use_rumpfs 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 0 - -set vbox_file "vm_${flavor}_32_share.vbox" - -source ${genode_dir}/repos/ports/run/vbox_share.inc diff --git a/repos/ports/run/vbox4_win7_64.run b/repos/ports/run/vbox4_win7_64.run deleted file mode 100644 index 17f27398a..000000000 --- a/repos/ports/run/vbox4_win7_64.run +++ /dev/null @@ -1,25 +0,0 @@ -# -# Windows 7 64bit in VirtualBox -# - -assert_spec 64bit - -set flavor "win7_64" -set vm_ram "9460M" - -set use_vbox4 1 -set use_vbox5 0 - -set use_rumpfs 1 -# Write overlay only into ram -set use_ram_fs 1 -# However read initial overlay from disk -set use_overlay_from_disk 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 0 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox4_win7_64_multiple.run b/repos/ports/run/vbox4_win7_64_multiple.run deleted file mode 100644 index 4b336168b..000000000 --- a/repos/ports/run/vbox4_win7_64_multiple.run +++ /dev/null @@ -1,37 +0,0 @@ -# -# Windows 7 64bit in VirtualBox -# -# Prepared for internal test machine, which has 8 logical cores. - -# 6 Win7 64bit VMs are started, each having 2 vCPUs, using the same image and -# different overlays. Changes to the VM are written to the overlays of ram_fs -# and dropped after the test. - -# lCPU 0 : Genode base system and drivers -# lCPU 1-2: VM1 2 vCPUs -# ... -# lCPU 6-7: VM6 2 vCPUs - -assert_spec 64bit - -set flavor "win7_64" -set flavor_extension "_multiple" -set vm_ram "1280M" - -set use_vbox4 1 -set use_vbox5 0 - -set use_rumpfs 1 -# Write overlay only into ram -set use_ram_fs 1 -# However read initial overlay from disk -set use_overlay_from_disk 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 6 -set affinity_space_width 8 -set use_cpu_load 0 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox4_win7_64_raw.run b/repos/ports/run/vbox4_win7_64_raw.run deleted file mode 100644 index 72ea3d81e..000000000 --- a/repos/ports/run/vbox4_win7_64_raw.run +++ /dev/null @@ -1,24 +0,0 @@ -# -# Windows 7 64bit in VirtualBox -# - -assert_spec 64bit - -set flavor "win7_64_raw" -set vm_ram "1280M" - -set use_vbox4 1 -set use_vbox5 0 - -# use vm image from a raw disk partition -set use_rumpfs 0 -set use_ram_fs 0 -set use_overlay_from_disk 0 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 0 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox4_win81_64.run b/repos/ports/run/vbox4_win81_64.run deleted file mode 100644 index 3bdff2787..000000000 --- a/repos/ports/run/vbox4_win81_64.run +++ /dev/null @@ -1,25 +0,0 @@ -# -# Windows 8.1 (64 bit) in VirtualBox -# - -assert_spec 64bit - -set flavor "win81_64" -set vm_ram "1280M" - -set use_vbox4 1 -set use_vbox5 0 - -set use_rumpfs 1 -# Write overlay only into ram -set use_ram_fs 1 -# However read initial overlay from disk -set use_overlay_from_disk 1 - -set use_usb 1 -set use_ps2 [have_spec ps2] - -set use_vms 1 -set use_cpu_load 0 - -source ${genode_dir}/repos/ports/run/vbox_win.inc diff --git a/repos/ports/run/vbox5_ubuntu_14_04_32.run b/repos/ports/run/vbox5_ubuntu_14_04_32.run index d560c3f84..096b9830b 100644 --- a/repos/ports/run/vbox5_ubuntu_14_04_32.run +++ b/repos/ports/run/vbox5_ubuntu_14_04_32.run @@ -5,7 +5,6 @@ set flavor "ubuntu_14_04_32" set vm_ram "1280M" -set use_vbox4 0 set use_vbox5 1 set use_rumpfs 1 diff --git a/repos/ports/run/vbox5_ubuntu_14_04_64.run b/repos/ports/run/vbox5_ubuntu_14_04_64.run index 61f887152..1ca124a45 100644 --- a/repos/ports/run/vbox5_ubuntu_14_04_64.run +++ b/repos/ports/run/vbox5_ubuntu_14_04_64.run @@ -7,7 +7,6 @@ assert_spec 64bit set flavor "ubuntu_14_04_64" set vm_ram "1280M" -set use_vbox4 0 set use_vbox5 1 set use_rumpfs 1 diff --git a/repos/ports/run/vbox5_ubuntu_16_04_32.run b/repos/ports/run/vbox5_ubuntu_16_04_32.run index 930d432c4..06d76e3a8 100644 --- a/repos/ports/run/vbox5_ubuntu_16_04_32.run +++ b/repos/ports/run/vbox5_ubuntu_16_04_32.run @@ -5,7 +5,6 @@ set flavor "ubuntu_16_04_32" set vm_ram "1280M" -set use_vbox4 0 set use_vbox5 1 set use_rumpfs 1 diff --git a/repos/ports/run/vbox5_ubuntu_16_04_64.run b/repos/ports/run/vbox5_ubuntu_16_04_64.run index 70d8cba6a..84a837db9 100644 --- a/repos/ports/run/vbox5_ubuntu_16_04_64.run +++ b/repos/ports/run/vbox5_ubuntu_16_04_64.run @@ -7,7 +7,6 @@ assert_spec 64bit set flavor "ubuntu_16_04_64" set vm_ram "9460M" -set use_vbox4 0 set use_vbox5 1 set use_rumpfs 1 diff --git a/repos/ports/run/vbox5_win10_64.run b/repos/ports/run/vbox5_win10_64.run index 656d9db34..f5c9f2b92 100644 --- a/repos/ports/run/vbox5_win10_64.run +++ b/repos/ports/run/vbox5_win10_64.run @@ -8,7 +8,6 @@ assert_spec 64bit set flavor "win10" set vm_ram "1280M" -set use_vbox4 0 set use_vbox5 1 set use_rumpfs 1 diff --git a/repos/ports/run/vbox5_win7_32.run b/repos/ports/run/vbox5_win7_32.run index 93437979c..b311ce416 100644 --- a/repos/ports/run/vbox5_win7_32.run +++ b/repos/ports/run/vbox5_win7_32.run @@ -7,7 +7,6 @@ assert_spec nova set flavor "win7" set vm_ram "1280M" -set use_vbox4 0 set use_vbox5 1 set use_rumpfs 1 diff --git a/repos/ports/run/vbox5_win7_64.run b/repos/ports/run/vbox5_win7_64.run index 96b00492e..ba7dfc2c6 100644 --- a/repos/ports/run/vbox5_win7_64.run +++ b/repos/ports/run/vbox5_win7_64.run @@ -7,7 +7,6 @@ assert_spec 64bit set flavor "win7_64" set vm_ram "9480M" -set use_vbox4 0 set use_vbox5 1 set use_rumpfs 1 diff --git a/repos/ports/run/vbox5_win7_64_multiple.run b/repos/ports/run/vbox5_win7_64_multiple.run index 679313b4a..6a2d79306 100644 --- a/repos/ports/run/vbox5_win7_64_multiple.run +++ b/repos/ports/run/vbox5_win7_64_multiple.run @@ -18,7 +18,6 @@ set flavor "win7_64" set flavor_extension "_multiple" set vm_ram "1280M" -set use_vbox4 0 set use_vbox5 1 set use_rumpfs 1 diff --git a/repos/ports/run/vbox5_win7_64_raw.run b/repos/ports/run/vbox5_win7_64_raw.run index e13c1e013..e048e621c 100644 --- a/repos/ports/run/vbox5_win7_64_raw.run +++ b/repos/ports/run/vbox5_win7_64_raw.run @@ -7,7 +7,6 @@ assert_spec 64bit set flavor "win7_64_raw" set vm_ram "1280M" -set use_vbox4 0 set use_vbox5 1 # use vm image from a raw disk partition diff --git a/repos/ports/run/vbox5_win7_64_share.run b/repos/ports/run/vbox5_win7_64_share.run index bea5f5f6c..f44441ffb 100644 --- a/repos/ports/run/vbox5_win7_64_share.run +++ b/repos/ports/run/vbox5_win7_64_share.run @@ -3,7 +3,6 @@ assert_spec 64bit set flavor "win7_64" set vm_ram "1280M" -set use_vbox4 0 set use_vbox5 1 set vdi_image "${flavor}.vdi" diff --git a/repos/ports/run/vbox_share.inc b/repos/ports/run/vbox_share.inc index da3e61411..9c8985aa7 100644 --- a/repos/ports/run/vbox_share.inc +++ b/repos/ports/run/vbox_share.inc @@ -225,8 +225,6 @@ append config_of_app { } -append_if [expr $use_vbox4] config_of_app " - " append_if [expr $use_vbox5] config_of_app " " append config_of_app { diff --git a/repos/ports/run/vbox_win.inc b/repos/ports/run/vbox_win.inc index ccdfabf82..e6ab19f9d 100644 --- a/repos/ports/run/vbox_win.inc +++ b/repos/ports/run/vbox_win.inc @@ -244,8 +244,6 @@ append config_of_app { for { set i 1} { $i <= $use_vms } { incr i} { append config_of_app " " - append_if [expr $use_vbox4] config_of_app " - " append_if [expr $use_vbox5] config_of_app " " diff --git a/repos/ports/run/virtualbox.run b/repos/ports/run/virtualbox.run index ae0970bd2..49f864f02 100644 --- a/repos/ports/run/virtualbox.run +++ b/repos/ports/run/virtualbox.run @@ -3,8 +3,7 @@ set use_ps2 [have_spec ps2] set use_usb 0 set use_serial 1 -set use_vbox4 0 -set use_vbox5 [expr !$use_vbox4] +set use_vbox5 1 # use_gui starts two VMs set use_gui 0 @@ -16,12 +15,7 @@ set build_components { drivers/framebuffer } -if {$use_vbox4} { - append build_components virtualbox - set virtualbox_binary "virtualbox-rem" - if {[have_spec muen]} { set virtualbox_binary "virtualbox-muen" } - if {[have_spec nova]} { set virtualbox_binary "virtualbox-nova" } -} else { +if {$use_vbox5} { append build_components virtualbox5 set virtualbox_binary "virtualbox5-rem" if {[have_spec nova]} { set virtualbox_binary "virtualbox5-nova" } diff --git a/repos/ports/run/virtualbox_auto.inc b/repos/ports/run/virtualbox_auto.inc index f3795bc65..2add1bffa 100644 --- a/repos/ports/run/virtualbox_auto.inc +++ b/repos/ports/run/virtualbox_auto.inc @@ -36,7 +36,6 @@ append build_components { } lappend_if [expr $use_rumpfs] build_components server/rump_fs -lappend_if [expr $use_vbox4] build_components virtualbox lappend_if [expr $use_vbox5] build_components virtualbox5 lappend_if [expr $use_ps2] build_components drivers/input lappend_if [expr $use_usb] build_components drivers/usb @@ -375,7 +374,6 @@ append boot_modules { lappend_if [expr $use_rumpfs] boot_modules rump.lib.so lappend_if [expr $use_rumpfs] boot_modules rump_fs.lib.so lappend_if [expr $use_rumpfs] boot_modules rump_fs -lappend_if [expr $use_vbox4] boot_modules $virtualbox_binary lappend_if [expr $use_vbox5] boot_modules $virtualbox5_binary lappend_if [expr $use_ram_fs || $use_usb] boot_modules ram_fs lappend_if [expr $use_ram_fs && !$use_overlay_from_disk] boot_modules $overlay_image diff --git a/repos/ports/src/virtualbox/README b/repos/ports/src/virtualbox/README deleted file mode 100644 index eec7691b6..000000000 --- a/repos/ports/src/virtualbox/README +++ /dev/null @@ -1,38 +0,0 @@ -VirtualBox configuration options -################################ - -The configuration requires an attribute named vbox_file with the name of the -vbox configuration to be used (.vbox). - - - -XHCI controller -=============== - -The virtual XHCI controller can be enabled with the following -configuration option: - - - -IOAPIC -====== - -The virtual PCI model delivers IRQs to the PIC by default and to the IOAPIC -only if the guest operating system selected the IOAPIC with the '_PIC' ACPI -method and if it called the '_PRT' ACPI method afterwards. When running a -guest operating system which uses the IOAPIC, but does not call these ACPI -methods (for example Genode/NOVA), the configuration option - - - -enforces the delivery of PCI IRQs to the IOAPIC. - -CAPSLOCK -======== - - - -If the capslock attribute is set to "ROM", virtualbox will open a connection -to the ROM named "capslock" and expect in the top-level node a attribute -'enabled' (yes|no). If the ROM capslock differ from the internal VM capslock, -the VMM will trigger aritifical capslock key events to the VM. diff --git a/repos/ports/src/virtualbox/accloff/mem_region.h b/repos/ports/src/virtualbox/accloff/mem_region.h deleted file mode 100644 index 0362bca67..000000000 --- a/repos/ports/src/virtualbox/accloff/mem_region.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * \brief Memory region types - * \author Alexander Boettcher - * \date 2016-08-22 - */ - -/* - * Copyright (C) 2016-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__ACCLOFF__MEM_REGION_H_ -#define _VIRTUALBOX__ACCLOFF__MEM_REGION_H_ -#include "vmm_region.h" -#endif diff --git a/repos/ports/src/virtualbox/accloff/sup.cc b/repos/ports/src/virtualbox/accloff/sup.cc deleted file mode 100644 index 003d112ef..000000000 --- a/repos/ports/src/virtualbox/accloff/sup.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - * \brief Genode specific VirtualBox SUPLib supplements. - * File used by Genode platforms not supporting hardware - * virtualisation features. - * \author Alexander Boettcher - * \date 2013-11-18 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include - -/* VirtualBox includes */ -#include -#include - -/* Genode's VirtualBox includes */ -#include "sup.h" -#include "vmm_memory.h" - -/* Libc include */ -#include - -/* VirtualBox SUPLib interface */ - -int SUPR3QueryVTxSupported(void) -{ - return VERR_INTERNAL_ERROR; -} - -int SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu) -{ - return VERR_INTERNAL_ERROR; -} - - -static Genode::Semaphore *r0_halt_sem() -{ - static Genode::Semaphore sem; - return &sem; -} - - -int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned - uOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr) -{ - switch(uOperation) - { - case VMMR0_DO_GVMM_CREATE_VM: - genode_VMMR0_DO_GVMM_CREATE_VM(pReqHdr); - return VINF_SUCCESS; - - case VMMR0_DO_GVMM_SCHED_HALT: - r0_halt_sem()->down(); - return VINF_SUCCESS; - - case VMMR0_DO_GVMM_SCHED_WAKE_UP: - r0_halt_sem()->up(); - return VINF_SUCCESS; - - case VMMR0_DO_VMMR0_INIT: - return VINF_SUCCESS; - - case VMMR0_DO_GVMM_SCHED_POLL: - /* called by 'vmR3HaltGlobal1Halt' */ - Genode::log(__func__, ": SUPR3CallVMMR0Ex: VMMR0_DO_GVMM_SCHED_POLL"); - return VINF_SUCCESS; - - default: - Genode::error("SUPR3CallVMMR0Ex: unhandled uOperation ", (int)uOperation); - return VERR_GENERAL_FAILURE; - } -} - - -bool create_emt_vcpu(pthread_t * thread, size_t stack_size, - void *(*start_routine)(void *), void *arg, - Genode::Cpu_session * cpu_session, - Genode::Affinity::Location location, - unsigned int cpu_id, - const char * name) -{ - /* no hardware acceleration support */ - return false; -} - - -/** - * Dummies and unimplemented stuff. - */ - -uint64_t genode_cpu_hz() { - return 1000000000ULL; /* XXX fixed 1GHz return value */ -} - - -void genode_update_tsc(void (*update_func)(void), unsigned long update_us) -{ - using namespace Genode; - - Timer::Connection timer(genode_env()); - Signal_context sig_ctx; - Signal_receiver sig_rec; - Signal_context_capability sig_cap = sig_rec.manage(&sig_ctx); - - timer.sigh(sig_cap); - timer.trigger_once(update_us); - - for (;;) { - Signal s = sig_rec.wait_for_signal(); - update_func(); - - timer.trigger_once(update_us); - } -} - - -HRESULT genode_setup_machine(ComObjPtr machine) -{ - return genode_check_memory_config(machine); -} - - -bool Vmm_memory::revoke_from_vm(Mem_region *r) -{ - Genode::warning(__func__, " unimplemented"); - return false; -} - - -extern "C" void pthread_yield() { Genode::warning(__func__, " unimplemented"); } diff --git a/repos/ports/src/virtualbox/audiodrv.cpp b/repos/ports/src/virtualbox/audiodrv.cpp deleted file mode 100644 index 32fc57004..000000000 --- a/repos/ports/src/virtualbox/audiodrv.cpp +++ /dev/null @@ -1,514 +0,0 @@ -/* - * \brief Genode audio driver backend - * \author Josef Soentgen - * \date 2015-05-17 - */ - -/* - * Copyright (C) 2015-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include - -/* VirtualBox includes */ -#include "VBoxDD.h" -#include "vl_vbox.h" -extern "C" { -#include "audio.h" -} -#include - -#define AUDIO_CAP "genode" -extern "C" { -#include "audio_int.h" -} - -/* VBox Genode specific */ -#include "vmm.h" - -template -struct A_ring_buffer_to_bind_them -{ - size_t wpos { 0 }; - size_t rpos { 0 }; - - char _data[CAPACITY]; - - A_ring_buffer_to_bind_them() { } - - size_t read_avail() const - { - if (wpos > rpos) return wpos - rpos; - else return (wpos - rpos + CAPACITY) % CAPACITY; - } - - size_t write_avail() const - { - if (wpos > rpos) return ((rpos - wpos + CAPACITY) % CAPACITY) - 2; - else if (wpos < rpos) return rpos - wpos; - else return CAPACITY - 2; - } - - size_t write(void const *src, size_t len) - { - size_t const avail = write_avail(); - if (avail == 0) return 0; - - size_t const limit_len = len > avail ? avail : len; - size_t const total = wpos + len; - size_t first, rest; - - if (total > CAPACITY) { - first = CAPACITY - wpos; - rest = total % CAPACITY; - } else { - first = limit_len; - rest = 0; - } - - Genode::memcpy(&_data[wpos], src, first); - wpos = (wpos + first) % CAPACITY; - - if (rest) { - Genode::memcpy(&_data[wpos], ((char const*)src) + first, rest); - wpos = (wpos + rest) % CAPACITY; - } - - return limit_len; - } - - size_t read(void *dst, size_t len, bool peek = false) - { - size_t const avail = read_avail(); - if (avail == 0) return 0; - - size_t new_rpos = rpos; - - size_t const limit_len = len > avail ? avail : len; - size_t const total = new_rpos + len; - size_t first, rest; - - if (total > CAPACITY) { - first = CAPACITY - new_rpos; - rest = total % CAPACITY; - } else { - first = limit_len; - rest = 0; - } - - Genode::memcpy(dst, &_data[new_rpos], first); - new_rpos = (new_rpos + first) % CAPACITY; - - if (rest) { - Genode::memcpy(((char*)dst) + first, &_data[new_rpos], rest); - new_rpos = (new_rpos + rest) % CAPACITY; - } - - if (!peek) rpos = new_rpos; - - return limit_len; - } - - void read_advance(size_t len) { rpos = (rpos + len) % CAPACITY; } -}; - - -enum { - VBOX_CHANNELS = 2, - VBOX_SAMPLE_SIZE = sizeof(int16_t), - - OUT_PACKET_NUM = 16, /* number of buffered packets */ - IN_PACKET_NUM = 2, /* number of buffered in packets */ - - OUT_PCM_SIZE = Audio_out::PERIOD * VBOX_SAMPLE_SIZE * VBOX_CHANNELS, - IN_PCM_SIZE = Audio_in::PERIOD * VBOX_SAMPLE_SIZE * VBOX_CHANNELS, - OUT_PCM_BUFFER_SIZE = OUT_PCM_SIZE * OUT_PACKET_NUM, - IN_PCM_BUFFER_SIZE = IN_PCM_SIZE * IN_PACKET_NUM, - - OUT_PACKET_SIZE = Audio_out::PERIOD * VBOX_SAMPLE_SIZE * VBOX_CHANNELS, - IN_PACKET_SIZE = Audio_in::PERIOD * VBOX_SAMPLE_SIZE * VBOX_CHANNELS, - OUT_PACKET_BUFFER_SIZE = OUT_PACKET_SIZE * 2, - IN_PACKET_BUFFER_SIZE = IN_PACKET_SIZE * 2, -}; - - -static char const * const channel_names[] = { "front left", "front right" }; - - -typedef A_ring_buffer_to_bind_them Pcm_out_buffer; -typedef A_ring_buffer_to_bind_them Out_packet_buffer; -typedef A_ring_buffer_to_bind_them Pcm_in_buffer; -typedef A_ring_buffer_to_bind_them In_packet_buffer; - - -struct GenodeVoiceOut -{ - HWVoiceOut hw; - Audio_out::Connection *audio[VBOX_CHANNELS]; - Out_packet_buffer packet_buf; - Pcm_out_buffer pcm_buf; - unsigned packets; -}; - - -struct GenodeVoiceIn { - HWVoiceIn hw; - Audio_in::Connection *audio; - In_packet_buffer packet_buf; - Pcm_in_buffer pcm_buf; - unsigned packets; -}; - - -static int write_samples(GenodeVoiceOut *out, int16_t *src, int samples) -{ - Out_packet_buffer &packet_buf = out->packet_buf; - - /* try to fill and submit packet */ - if (packet_buf.read_avail() >= OUT_PACKET_SIZE) { - Audio_out::Connection *c = out->audio[0]; - - /* check how many submitted packets are still in the queue */ - if (c->stream()->queued() > OUT_PACKET_NUM) return 0; - - /* alloc new packets */ - Audio_out::Packet *p[2] { nullptr, nullptr }; - - try { p[0] = c->stream()->alloc(); } - catch (Audio_out::Stream::Alloc_failed) { return 0; } - - unsigned const ppos = out->audio[0]->stream()->packet_position(p[0]); - p[1] = out->audio[1]->stream()->get(ppos); - - /* copy */ - float *left_content = p[0]->content(); - float *right_content = p[1]->content(); - - int16_t buf[Audio_out::PERIOD*2]; - size_t const n = packet_buf.read(buf, sizeof(buf)); - if (n != sizeof(buf)) - Genode::error(__func__, ": n: ", n, " buf: ", buf); - - for (int i = 0; i < Audio_out::PERIOD; i++) { - left_content[i] = (float)(buf[i * VBOX_CHANNELS + 0]) / 32768.0f; - right_content[i] = (float)(buf[i * VBOX_CHANNELS + 1]) / 32768.0f; - } - - /* submit */ - for (int i = 0; i < VBOX_CHANNELS; i++) - out->audio[i]->submit(p[i]); - - out->packets++; - } - - /* copy new samples */ - int const bytes = samples * VBOX_SAMPLE_SIZE * VBOX_SAMPLE_SIZE; - size_t const n = packet_buf.write(src, bytes); - return n / (VBOX_SAMPLE_SIZE * VBOX_SAMPLE_SIZE); -} - - -static int genode_run_out(HWVoiceOut *hw) -{ - GenodeVoiceOut * const out = (GenodeVoiceOut *)hw; - Pcm_out_buffer & pcm_buf = out->pcm_buf; - - int const live = audio_pcm_hw_get_live_out(&out->hw); - if (!live) - return 0; - - int const decr = audio_MIN(live, out->hw.samples); - size_t const avail = pcm_buf.read_avail(); - - if ((avail / (VBOX_SAMPLE_SIZE*VBOX_CHANNELS)) < decr) - Genode::error(__func__, ": avail: ", avail, " < decr ", decr); - - char buf[decr*VBOX_SAMPLE_SIZE*VBOX_CHANNELS]; - pcm_buf.read(buf, sizeof(buf), true); - - int const samples = write_samples(out, (int16_t*)buf, decr); - if (samples == 0) return 0; - - pcm_buf.read_advance(samples * (VBOX_SAMPLE_SIZE*VBOX_CHANNELS)); - - out->hw.rpos = (out->hw.rpos + samples) % out->hw.samples; - return samples; -} - - -static int genode_write(SWVoiceOut *sw, void *buf, int size) -{ - GenodeVoiceOut * const out = (GenodeVoiceOut*)sw->hw; - Pcm_out_buffer &pcm_buf = out->pcm_buf; - - size_t const avail = pcm_buf.write_avail(); - if (size > avail) - Genode::warning(__func__, ": size: ", size, " available: ", avail); - - size_t const n = pcm_buf.write(buf, size); - if (n < size) - Genode::warning(__func__, ": written: ", n, " expected: ", size); - - /* needed by audio_pcm_hw_get_live_out() to calculate ``live'' samples */ - sw->total_hw_samples_mixed += (size / 4); - return size; -} - - -static int genode_init_out(HWVoiceOut *hw, audsettings_t *as) -{ - GenodeVoiceOut * const out = (GenodeVoiceOut *)hw; - - if (as->nchannels != VBOX_CHANNELS) { - Genode::error("only ", (int)VBOX_CHANNELS, " channels supported ", - "( ", as->nchannels, " were requested)"); - return -1; - } - - if (as->freq != Audio_out::SAMPLE_RATE) { - Genode::error("only ", (int)Audio_out::SAMPLE_RATE, " frequency supported " - "(", as->freq, " was requested)"); - return -1; - } - - for (int i = 0; i < VBOX_CHANNELS; i++) { - try { - out->audio[i] = new (vmm_heap()) - Audio_out::Connection(genode_env(), channel_names[i]); - } catch (...) { - Genode::error("could not establish Audio_out connection"); - while (--i > 0) - Genode::destroy(vmm_heap(), out->audio[i]); - return -1; - } - } - - audio_pcm_init_info(&out->hw.info, as); - out->hw.samples = Audio_out::PERIOD; - out->packets = 0; - - Genode::log("--- using Audio_out session ---"); - Genode::log("freq: ", as->freq); - Genode::log("channels: ", as->nchannels); - Genode::log("format: ", (int)as->fmt); - Genode::log("endianness: ", as->endianness); - - return 0; -} - - -static void genode_fini_out(HWVoiceOut *hw) -{ - GenodeVoiceOut * const out = (GenodeVoiceOut *)hw; - for (int i = 0; i < VBOX_CHANNELS; i++) - Genode::destroy(vmm_heap(), out->audio[i]); -} - - -static int genode_ctl_out(HWVoiceOut *hw, int cmd, ...) -{ - GenodeVoiceOut *out = (GenodeVoiceOut*)hw; - switch (cmd) { - case VOICE_ENABLE: - out->packets = 0; - for (int i = 0; i < VBOX_CHANNELS; i++) - out->audio[i]->start(); - break; - case VOICE_DISABLE: - for (int i = 0; i < VBOX_CHANNELS; i++) { - out->audio[i]->stop(); - out->audio[i]->stream()->invalidate_all(); - } - break; - } - return 0; -} - - -/*************** - ** Recording ** - ***************/ - -static int genode_init_in(HWVoiceIn *hw, audsettings_t *as) -{ - GenodeVoiceIn *in = (GenodeVoiceIn*)hw; - - try { - in->audio = new (vmm_heap()) Audio_in::Connection(genode_env(), "left"); - } catch (...) { - Genode::error("could not establish Audio_in connection"); - return -1; - } - - audio_pcm_init_info(&in->hw.info, as); - in->hw.samples = Audio_in::PERIOD; - in->packets = 0; - - Genode::log("--- using Audio_in session ---"); - Genode::log("freq: ", as->freq); - Genode::log("channels: ", as->nchannels); - Genode::log("format: ", (int)as->fmt); - Genode::log("endianness: ", as->endianness); - - return 0; -} - - -static void genode_fini_in(HWVoiceIn *hw) -{ - GenodeVoiceIn * const in = (GenodeVoiceIn*)hw; - Genode::destroy(vmm_heap(), in->audio); -} - - -static int read_samples(GenodeVoiceIn *in, int samples) -{ - In_packet_buffer &packet_buf = in->packet_buf; - Pcm_in_buffer &pcm_buf = in->pcm_buf; - - while (packet_buf.read_avail() < IN_PACKET_SIZE) { - Audio_in::Stream &stream = *in->audio->stream(); - Audio_in::Packet *p = stream.get(stream.pos()); - - if (!p->valid()) { - if (packet_buf.read_avail() < (samples*VBOX_SAMPLE_SIZE*VBOX_CHANNELS)) { - return 0; - } - break; - } - - int16_t buf[Audio_in::PERIOD*VBOX_CHANNELS]; - - if (packet_buf.write_avail() < sizeof(buf)) - return 0; - - float *content = p->content(); - for (int i = 0; i < Audio_in::PERIOD; i++) { - int16_t const v = content[i] * 32767; - int const j = i * 2; - buf[j + 0] = v; - buf[j + 1] = v; - } - - size_t const w = packet_buf.write(buf, sizeof(buf)); - if (w != sizeof(buf)) - Genode::error(__func__, ": write n: ", w, " buf: ", sizeof(buf)); - - p->invalidate(); - p->mark_as_recorded(); - stream.increment_position(); - - in->packets++; - break; - } - - int16_t buf[samples*VBOX_CHANNELS]; - size_t const r = packet_buf.read(buf, sizeof(buf), true); - size_t const w = pcm_buf.write(buf, r); - if (w != r) - Genode::error(__func__, ": w: ", w, " != r: ", r); - - packet_buf.read_advance(w); - - return w / (VBOX_SAMPLE_SIZE*VBOX_CHANNELS); -} - - -static int genode_run_in(HWVoiceIn *hw) -{ - GenodeVoiceIn *in = (GenodeVoiceIn*)hw; - - int const live = audio_pcm_hw_get_live_in(&in->hw); - if (!(in->hw.samples - live)) - return 0; - - int const dead = in->hw.samples - live; - int const samples = read_samples(in, dead); - - in->hw.wpos = (in->hw.wpos + samples) % in->hw.samples; - return samples; -} - - -static int genode_read(SWVoiceIn *sw, void *buf, int size) -{ - GenodeVoiceIn * const in = (GenodeVoiceIn*)sw->hw; - Pcm_in_buffer &pcm_buf = in->pcm_buf; - - size_t const avail = pcm_buf.read_avail(); - if (avail < size) - Genode::error(__func__, ": avail: ", avail, " size: ", size); - - size_t const r = pcm_buf.read(buf, size); - if (r != size) - Genode::error(__func__, ": r: ", r, " size: ", size); - - /* needed by audio_pcm_hw_get_live_in() to calculate ``live'' samples */ - sw->total_hw_samples_acquired += (r / (VBOX_SAMPLE_SIZE*VBOX_CHANNELS)); - return size; -} - - -static int genode_ctl_in(HWVoiceIn *hw, int cmd, ...) -{ - GenodeVoiceIn * const in = (GenodeVoiceIn*)hw; - switch (cmd) { - case VOICE_ENABLE: - in->packets = 0; - in->audio->start(); - break; - case VOICE_DISABLE: - in->audio->stop(); - break; - } - - return 0; -} - - -static void *genode_audio_init(void) { return &oss_audio_driver; } - - -static void genode_audio_fini(void *) { } - - -static struct audio_pcm_ops genode_pcm_ops = { - genode_init_out, - genode_fini_out, - genode_run_out, - genode_write, - genode_ctl_out, - - genode_init_in, - genode_fini_in, - genode_run_in, - genode_read, - genode_ctl_in -}; - - -/* - * We claim to be the OSS driver so that we do not have to - * patch the VirtualBox source because we already claim to - * be FreeBSD. - */ -struct audio_driver oss_audio_driver = { - INIT_FIELD (name = ) "oss", - INIT_FIELD (descr = ) "Genode Audio_out/Audio_in", - INIT_FIELD (options = ) NULL, - INIT_FIELD (init = ) genode_audio_init, - INIT_FIELD (fini = ) genode_audio_fini, - INIT_FIELD (pcm_ops = ) &genode_pcm_ops, - INIT_FIELD (can_be_default = ) 1, - INIT_FIELD (max_voices_out = ) INT_MAX, - INIT_FIELD (max_voices_in = ) INT_MAX, - INIT_FIELD (voice_size_out = ) sizeof(GenodeVoiceOut), - INIT_FIELD (voice_size_in = ) sizeof(GenodeVoiceIn) -}; diff --git a/repos/ports/src/virtualbox/devices.cc b/repos/ports/src/virtualbox/devices.cc deleted file mode 100644 index 909fc2a99..000000000 --- a/repos/ports/src/virtualbox/devices.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - * \brief VirtualBox device models - * \author Norman Feske - * \date 2013-08-20 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include - -/* VirtualBox includes */ -#include -#include - -#include "vmm.h" - -#define REGISTER(device) \ - do { \ - rc = pCallbacks->pfnRegister(pCallbacks, &g_##device); \ - if (RT_FAILURE(rc)) \ - return rc; \ - } while (0) - - -extern "C" int VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version) -{ - int rc = 0; - - /* platform */ - REGISTER(DevicePcArch); - REGISTER(DevicePcBios); - REGISTER(DeviceI8254); - REGISTER(DeviceI8259); - REGISTER(DeviceDMA); - REGISTER(DeviceMC146818); - REGISTER(DeviceACPI); - REGISTER(DeviceAPIC); - REGISTER(DeviceIOAPIC); - REGISTER(DevicePCI); - REGISTER(DevicePCIBridge); - - /* devices */ - REGISTER(DevicePS2KeyboardMouse); - REGISTER(DeviceVga); - REGISTER(DeviceFloppyController); - REGISTER(DeviceSerialPort); - REGISTER(DevicePIIX3IDE); - REGISTER(DeviceAHCI); - REGISTER(DevicePCNet); - REGISTER(DeviceE1000); - REGISTER(DeviceVMMDev); - REGISTER(DeviceOHCI); - REGISTER(DeviceICHAC97); - REGISTER(DeviceICH6_HDA); - - REGISTER(DeviceXHCI); - - return VINF_SUCCESS; -} - -/* - * The virtual PCI model delivers IRQs to the PIC by default and to the IOAPIC - * only if the guest operating system selected the IOAPIC with the '_PIC' ACPI - * method and if it called the '_PRT' ACPI method afterwards. When running a - * guest operating system which uses the IOAPIC, but does not call these ACPI - * methods (for example Genode/NOVA), IRQ delivery to the IOAPIC can be - * enforced with the 'force_ioapic' configuration option. - * - * References: - * - 'pciSetIrqInternal()' in DevPCI.cpp - * - '_PIC' and '_PRT' ACPI methods in vbox.dsl - */ - -static bool read_force_ioapic_from_config() -{ - try { - Genode::Attached_rom_dataspace config(genode_env(), "config"); - return config.xml().attribute_value("force_ioapic", false); - } catch (Genode::Rom_connection::Rom_connection_failed) { - return false; - } -} - -bool force_ioapic() -{ - /* read only once from config ROM */ - static bool force = read_force_ioapic_from_config(); - return force; -} diff --git a/repos/ports/src/virtualbox/devxhci.cc b/repos/ports/src/virtualbox/devxhci.cc deleted file mode 100644 index c764519b1..000000000 --- a/repos/ports/src/virtualbox/devxhci.cc +++ /dev/null @@ -1,585 +0,0 @@ -/* - * \brief NEC XHCI device frontend - * \author Josef Soentgen - * \author Sebastian Sumpf - * \date 2015-12-10 - */ - -/* - * Copyright (C) 2015-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include - -/* qemu-usb includes */ -#include - -/* Virtualbox includes */ -#define LOG_GROUP LOG_GROUP_DEV_EHCI -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef IN_RING3 -# include -# include -# include -# include -#endif -#include -#include - -/* VBox Genode specific */ -#include "vmm.h" - -static bool const verbose_timer = false; - - -/************************ - ** xHCI device struct ** - ************************/ - -struct Timer_queue; -struct Destruction_helper; - - -struct XHCI -{ - /** The PCI device. */ - PCIDEVICE PciDev; - - /** Pointer to the device instance - R3 ptr. */ - PPDMDEVINSR3 pDevInsR3; - - /** Pointer to the device instance - R0 ptr */ - PPDMDEVINSR0 pDevInsR0; - - /** Pointer to the device instance - RC ptr. */ - PPDMDEVINSRC pDevInsRC; - - /** Address of the MMIO region assigned by PCI. */ - RTGCPHYS32 MMIOBase; - - /** Receiver thread that handles all USB signals. */ - PPDMTHREAD pThread; - - PTMTIMERR3 controller_timer; - Timer_queue *timer_queue; - Qemu::Controller *ctl; - - Genode::Signal_receiver *usb_sig_rec; - Destruction_helper *destruction_helper; -}; - - -/** Pointer to XHCI device data. */ -typedef struct XHCI *PXHCI; -/** Read-only pointer to the XHCI device data. */ -typedef struct XHCI const *PCXHCI; - - -/************************************* - ** Qemu::Controller helper classes ** - *************************************/ - -struct Timer_queue : public Qemu::Timer_queue -{ - struct Context : public Genode::List::Element - { - uint64_t timeout_abs_ns = ~0ULL; - bool pending = false; - - void *qtimer = nullptr; - void (*cb)(void*) = nullptr; - void *data = nullptr; - - Context(void *qtimer, void (*cb)(void*), void *data) - : qtimer(qtimer), cb(cb), data(data) { } - }; - - Genode::List _context_list; - PTMTIMER tm_timer; - - void _append_new_context(void *qtimer, void (*cb)(void*), void *data) - { - Context *new_ctx = new (vmm_heap()) Context(qtimer, cb, data); - - _context_list.insert(new_ctx); - } - - Context *_find_context(void const *qtimer) - { - for (Context *c = _context_list.first(); c; c = c->next()) - if (c->qtimer == qtimer) - return c; - return nullptr; - } - - Context *_min_pending() - { - Context *min = nullptr; - for (min = _context_list.first(); min; min = min->next()) - if (min && min->pending) - break; - - if (!min || !min->next()) - return min; - - for (Context *c = min->next(); c; c = c->next()) { - if (c->timeout_abs_ns < min->timeout_abs_ns && c->pending) - min = c; - } - - return min; - } - - void _program_min_timer() - { - Context *min = _min_pending(); - if (min == nullptr) return; - - if (TMTimerIsActive(tm_timer)) - TMTimerStop(tm_timer); - - TMTimerSetNano(tm_timer, min->timeout_abs_ns - TMTimerGetNano(tm_timer)); - } - - void _deactivate_timer(void *qtimer) - { - Context *c = _find_context(qtimer); - if (c == nullptr) { - Genode::error("qtimer: ", qtimer, " not found"); - throw -1; - } - - if (c->pending) { - Context *min = _min_pending(); - if (min == c) { - TMTimerStop(tm_timer); - _program_min_timer(); - } - } - - c->pending = false; - } - - Timer_queue(PTMTIMER timer) : tm_timer(timer) { } - - void timeout() - { - uint64_t now = TMTimerGetNano(tm_timer); - - for (Context *c = _context_list.first(); c; c = c->next()) { - if (c->pending && c->timeout_abs_ns <= now) { - Qemu::usb_timer_callback(c->cb, c->data); - c->pending = false; - } - } - - _program_min_timer(); - } - - /********************** - ** TMTimer callback ** - **********************/ - - static DECLCALLBACK(void) tm_timer_cb(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) - { - PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI); - Timer_queue *q = pThis->timer_queue; - - q->timeout(); - } - - - unsigned count_timer() - { - unsigned res = 0; - - for (Context *c = _context_list.first(); c; c = c->next()) { - if (c->pending) Genode::log("timer: ", c, " is pending"); - res++; - } - - return res; - } - - /********************************* - ** Qemu::Timer_queue interface ** - *********************************/ - - Qemu::int64_t get_ns() { return TMTimerGetNano(tm_timer); } - - Genode::Lock _timer_lock; - - void register_timer(void *qtimer, void (*cb)(void*), void *data) override - { - Genode::Lock::Guard lock_guard(_timer_lock); - if (verbose_timer) - Genode::log("qtimer: ", qtimer, " cb: ", cb, " data: ", data); - - Context *c = _find_context(qtimer); - if (c != nullptr) { - Genode::error("qtimer: ", qtimer, " already registred"); - throw -1; - } - - _append_new_context(qtimer, cb, data); - } - - void delete_timer(void *qtimer) override - { - Genode::Lock::Guard lock_guard(_timer_lock); - if (verbose_timer) - Genode::log("qtimer: ", qtimer); - - Context *c = _find_context(qtimer); - if (c == nullptr) { - Genode::error("qtimer: ", qtimer, " not found"); - throw -1; - } - - _deactivate_timer(qtimer); - - _context_list.remove(c); - Genode::destroy(vmm_heap(), c); - } - - void activate_timer(void *qtimer, long long int expire_abs) override - { - Genode::Lock::Guard lock_guard(_timer_lock); - if (verbose_timer) - Genode::log("qtimer: ", qtimer, " expire: ", expire_abs); - - Context *c = _find_context(qtimer); - if (c == nullptr) { - Genode::error("qtimer: ", qtimer, " not found"); - throw -1; - } - - c->timeout_abs_ns = expire_abs; - c->pending = true; - - _program_min_timer(); - } - - void deactivate_timer(void *qtimer) override - { - Genode::Lock::Guard lock_guard(_timer_lock); - if (verbose_timer) - Genode::log("qtimer: ", qtimer); - - _deactivate_timer(qtimer); - } -}; - - -struct Pci_device : public Qemu::Pci_device -{ - PPDMDEVINS pci_dev; - - Pci_device(PPDMDEVINS pDevIns) : pci_dev(pDevIns) { } - - void raise_interrupt(int level) override { - PDMDevHlpPCISetIrqNoWait(pci_dev, 0, level); } - - int read_dma(Qemu::addr_t addr, void *buf, Qemu::size_t size) override { - return PDMDevHlpPhysRead(pci_dev, addr, buf, size); } - - int write_dma(Qemu::addr_t addr, void const *buf, Qemu::size_t size) override { - return PDMDevHlpPhysWrite(pci_dev, addr, buf, size); } - - void *map_dma(Qemu::addr_t base, Qemu::size_t size) - { - void *addr; - PGMR3PhysTlbGCPhys2Ptr(nullptr, base, true, &addr); - return addr; - } - - void unmap_dma(void *addr, Qemu::size_t size) { } -}; - - -/************************************* - ** Qemu::Usb signal thread backend ** - *************************************/ - -struct Destruction_helper -{ - Genode::Signal_receiver &sig_rec; - - Genode::Signal_dispatcher dispatcher { - sig_rec, *this, &Destruction_helper::handle }; - - void handle(unsigned) { } - - Destruction_helper(Genode::Signal_receiver &sig_rec) - : sig_rec(sig_rec) { } -}; - - -static DECLCALLBACK(int) usb_signal_thread(PPDMDEVINS pDevIns, PPDMTHREAD pThread) -{ - PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI); - if (pThread->enmState == PDMTHREADSTATE_INITIALIZING) - return VINF_SUCCESS; - - while (pThread->enmState == PDMTHREADSTATE_RUNNING) - { - Genode::Signal sig = pThis->usb_sig_rec->wait_for_signal(); - int num = sig.num(); - - Genode::Signal_dispatcher_base *dispatcher; - dispatcher = dynamic_cast(sig.context()); - if (dispatcher) { - dispatcher->dispatch(num); - } - } - - return VINF_SUCCESS; -} - - -static DECLCALLBACK(int) usb_signal_thread_wakeup(PPDMDEVINS pDevIns, PPDMTHREAD pThread) -{ - PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI); - - Genode::Signal_transmitter(pThis->destruction_helper->dispatcher).submit(); - - return VINF_SUCCESS; -} - - -/*********************************************** - ** Virtualbox Device function implementation ** - ***********************************************/ - -/** - * @callback_method_impl{FNIOMMMIOREAD} - */ -PDMBOTHCBDECL(int) xhciMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, - void *pv, unsigned cb) -{ - PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI); - - Genode::off_t offset = GCPhysAddr - pThis->MMIOBase; - Qemu::Controller *ctl = pThis->ctl; - - ctl->mmio_read(offset, pv, cb); - return 0; -} - - -/** - * @callback_method_impl{FNIOMMMIOWRITE} - */ -PDMBOTHCBDECL(int) xhciMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, - void const *pv, unsigned cb) -{ - PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI); - - Genode::off_t offset = GCPhysAddr - pThis->MMIOBase; - Qemu::Controller *ctl = pThis->ctl; - - ctl->mmio_write(offset, pv, cb); - return 0; -} - - -/** - * @callback_method_impl{FNPCIIOREGIONMAP} - */ -static DECLCALLBACK(int) xhciR3Map(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS GCPhysAddress, - uint32_t cb, PCIADDRESSSPACE enmType) -{ - PXHCI pThis = (PXHCI)pPciDev; - int rc = PDMDevHlpMMIORegister(pThis->CTX_SUFF(pDevIns), GCPhysAddress, cb, NULL /*pvUser*/, - IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_DWORD_ZEROED - | IOMMMIO_FLAGS_DBGSTOP_ON_COMPLICATED_WRITE, - xhciMmioWrite, xhciMmioRead, "USB XHCI"); - if (RT_FAILURE(rc)) - return rc; - - rc = PDMDevHlpMMIORegisterRC(pPciDev->pDevIns, GCPhysAddress, cb, NIL_RTRCPTR /*pvUser*/, - "xhciMmioWrite", "xhciMmioRead"); - if (RT_FAILURE(rc)) - return rc; - - pThis->MMIOBase = GCPhysAddress; - return VINF_SUCCESS; -} - - -/** - * @interface_method_impl{PDMDEVREG,pfnReset} - */ -static DECLCALLBACK(void) xhciReset(PPDMDEVINS pDevIns) -{ - PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI); - - Qemu::usb_reset(); - Qemu::usb_update_devices(); -} - - -/** - * @interface_method_impl{PDMDEVREG,pfnDestruct} - */ -static DECLCALLBACK(int) xhciDestruct(PPDMDEVINS pDevIns) -{ - Qemu::usb_reset(); - return 0; -} - - -/** - * @interface_method_impl{PDMDEVREG,pfnConstruct,XHCI constructor} - */ -static DECLCALLBACK(int) xhciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg) -{ - PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI); - PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); - - pThis->usb_sig_rec = new (vmm_heap()) Genode::Signal_receiver(); - pThis->destruction_helper = new (vmm_heap()) - Destruction_helper(*(pThis->usb_sig_rec)); - - int rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, Timer_queue::tm_timer_cb, - pThis, TMTIMER_FLAGS_NO_CRIT_SECT, - "NEC-XHCI Timer", &pThis->controller_timer); - - static Timer_queue timer_queue(pThis->controller_timer); - pThis->timer_queue = &timer_queue; - static Pci_device pci_device(pDevIns); - - rc = PDMDevHlpThreadCreate(pDevIns, &pThis->pThread, pThis, - usb_signal_thread, usb_signal_thread_wakeup, - 32 * 1024 , RTTHREADTYPE_IO, "usb_signal"); - - pThis->ctl = Qemu::usb_init(timer_queue, pci_device, *pThis->usb_sig_rec, - vmm_heap(), genode_env()); - - /* - * Init instance data. - */ - pThis->pDevInsR3 = pDevIns; - pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); - pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); - - PCIDevSetVendorId (&pThis->PciDev, 0x1033); /* PCI_VENDOR_ID_NEC */ - PCIDevSetDeviceId (&pThis->PciDev, 0x0194); /* PCI_DEVICE_ID_NEC_UPD720200 */ - PCIDevSetClassProg (&pThis->PciDev, 0x30); /* xHCI */ - PCIDevSetClassSub (&pThis->PciDev, 0x03); - PCIDevSetClassBase (&pThis->PciDev, 0x0c); - PCIDevSetInterruptPin (&pThis->PciDev, 0x01); - PCIDevSetByte (&pThis->PciDev, 0x60, 0x30); /* Serial Bus Release Number Register */ -#ifdef VBOX_WITH_MSI_DEVICES - PCIDevSetStatus (&pThis->PciDev, VBOX_PCI_STATUS_CAP_LIST); - PCIDevSetCapabilityList(&pThis->PciDev, 0x80); -#endif - - /* - * Register PCI device and I/O region. - */ - rc = PDMDevHlpPCIRegister(pDevIns, &pThis->PciDev); - if (RT_FAILURE(rc)) - return rc; - -#ifdef VBOX_WITH_MSI_DEVICES - PDMMSIREG MsiReg; - RT_ZERO(MsiReg); - MsiReg.cMsiVectors = 1; - MsiReg.iMsiCapOffset = 0x80; - MsiReg.iMsiNextOffset = 0x00; - rc = PDMDevHlpPCIRegisterMsi(pDevIns, &MsiReg); - if (RT_FAILURE(rc)) - { - PCIDevSetCapabilityList(&pThis->PciDev, 0x0); - /* That's OK, we can work without MSI */ - } -#endif - - rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, pThis->ctl->mmio_size(), - PCI_ADDRESS_SPACE_MEM, xhciR3Map); - if (RT_FAILURE(rc)) - return rc; - - return VINF_SUCCESS; -} - -const PDMDEVREG g_DeviceXHCI = -{ - /* u32version */ - PDM_DEVREG_VERSION, - /* szName */ - "nec-xhci", - /* szRCMod */ - "VBoxDDGC.gc", - /* szR0Mod */ - "VBoxDDR0.r0", - /* pszDescription */ - "NEC XHCI USB controller.\n", - /* fFlags */ - PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC, - /* fClass */ - PDM_DEVREG_CLASS_BUS_USB, - /* cMaxInstances */ - ~0U, - /* cbInstance */ - sizeof(XHCI), - /* pfnConstruct */ - xhciR3Construct, - /* pfnDestruct */ - xhciDestruct, - /* pfnRelocate */ - NULL, - /* pfnMemSetup */ - NULL, - /* pfnPowerOn */ - NULL, - /* pfnReset */ - xhciReset, - /* pfnSuspend */ - NULL, - /* pfnResume */ - NULL, - /* pfnAttach */ - NULL, - /* pfnDetach */ - NULL, - /* pfnQueryInterface */ - NULL, - /* pfnInitComplete */ - NULL, - /* pfnPowerOff */ - NULL, - /* pfnSoftReset */ - NULL, - /* u32VersionEnd */ - PDM_DEVREG_VERSION -}; - - -bool use_xhci_controller() -{ - try { - Genode::Attached_rom_dataspace config(genode_env(), "config"); - return config.xml().attribute_value("xhci", false); - } catch (Genode::Rom_connection::Rom_connection_failed) { - return false; - } -} diff --git a/repos/ports/src/virtualbox/drivers.cc b/repos/ports/src/virtualbox/drivers.cc deleted file mode 100644 index 937de8891..000000000 --- a/repos/ports/src/virtualbox/drivers.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * \brief VirtualBox host drivers - * \author Norman Feske - * \date 2013-08-20 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* VirtualBox includes */ -#include - - -extern "C" int VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version) -{ - PDMDRVREG const *drvs[] = { - &g_DrvKeyboardQueue, - &g_DrvMouseQueue, - &g_DrvBlock, - &g_DrvMediaISO, - &g_DrvACPI, - &g_DrvChar, - &g_DrvRawImage, - &g_DrvRawFile, - &g_DrvHostSerial, - &g_DrvVD, - &g_DrvHostInterface, - &g_DrvVUSBRootHub, - &g_DrvAUDIO, - 0 - }; - - for (unsigned i = 0; drvs[i]; i++) { - int rc = pCallbacks->pfnRegister(pCallbacks, drvs[i]); - if (RT_FAILURE(rc)) - return rc; - } - - return VINF_SUCCESS; -} - diff --git a/repos/ports/src/virtualbox/dummies.cc b/repos/ports/src/virtualbox/dummies.cc deleted file mode 100644 index b19206560..000000000 --- a/repos/ports/src/virtualbox/dummies.cc +++ /dev/null @@ -1,205 +0,0 @@ -/* - * \brief Dummy implementations of symbols needed by VirtualBox - * \author Norman Feske - * \date 2013-08-22 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#include -#include - -#include /* libc memcpy */ - -#include "VMMInternal.h" -#include "EMInternal.h" -#include "PDMInternal.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "util.h" - -static const bool trace = false; - -#define TRACE(retval) \ - { \ - if (trace) \ - Genode::log(__func__, " called, return dummy, eip=", \ - __builtin_return_address(0)); \ - return retval; \ - } - - -RT_C_DECLS_BEGIN - -RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW -{ - if (!trace) - return VINF_SUCCESS; - - char type[4]; - - if (fProtect & RTMEM_PROT_READ) - type[0] = 'r'; - else - type[0] = '-'; - - if (fProtect & RTMEM_PROT_WRITE) - type[1] = 'w'; - else - type[1] = '-'; - - if (fProtect & RTMEM_PROT_EXEC) - type[2] = 'x'; - else - type[2] = '-'; - - type[3] = 0; - - Genode::warning(__func__, " called - not implemented - ", pv, "+", - Genode::Hex(cb), " protect ", Genode::Hex(fProtect), " - " - "'", Genode::Cstring(type), "'"); - - return VINF_SUCCESS; -} - - -static_assert(sizeof(RTR0PTR) == sizeof(RTR3PTR), "pointer transformation bug"); -static_assert(sizeof(RTR0PTR) == sizeof(void *) , "pointer transformation bug"); -static_assert(sizeof(RTR3PTR) == sizeof(RTR0PTR), "pointer transformation bug"); - -RTR0PTR MMHyperR3ToR0(PVM pVM, RTR3PTR R3Ptr) { return (RTR0PTR)R3Ptr; } -RTRCPTR MMHyperR3ToRC(PVM pVM, RTR3PTR R3Ptr) { return to_rtrcptr(R3Ptr); } -RTR0PTR MMHyperCCToR0(PVM pVM, void *pv) { return (RTR0PTR)pv; } -RTRCPTR MMHyperCCToRC(PVM pVM, void *pv) { return to_rtrcptr(pv); } -RTR3PTR MMHyperR0ToR3(PVM pVM, RTR0PTR R0Ptr) { return (RTR3PTR*)(R0Ptr | 0UL); } -RTR3PTR MMHyperRCToR3(PVM pVM, RTRCPTR RCPtr) -{ - static_assert(sizeof(RCPtr) <= sizeof(RTR3PTR), "ptr transformation bug"); - return reinterpret_cast(0UL | RCPtr); -} - -/* debugger */ -int DBGFR3Init(PVM) TRACE(VINF_SUCCESS) -int DBGFR3EventSrcV(PVM, DBGFEVENTTYPE, const char *, unsigned, const char *, - const char *, va_list) TRACE(VINF_SUCCESS) -void DBGFR3Relocate(PVM, RTGCINTPTR) TRACE() -int DBGFR3RegRegisterDevice(PVM, PCDBGFREGDESC, PPDMDEVINS, const char*, - uint32_t) TRACE(VINF_SUCCESS) -int DBGFR3AsSymbolByAddr(PUVM, RTDBGAS, PCDBGFADDRESS, uint32_t, PRTGCINTPTR, - PRTDBGSYMBOL, PRTDBGMOD) TRACE(VERR_INVALID_HANDLE) -int DBGFR3Term(PVM) TRACE(VINF_SUCCESS) -int DBGFR3Event(PVM pVM, DBGFEVENTTYPE enmEvent) -{ - Genode::log(__func__, ": ", (int)enmEvent); - - TRACE(VERR_NOT_SUPPORTED) -} - - -/* called by 'VMMR3InitRC', but we don't use GC */ -int cpumR3DbgInit(PVM) TRACE(VINF_SUCCESS) -void CPUMPushHyper(PVMCPU, uint32_t) TRACE() - -int PGMFlushTLB(PVMCPU, uint64_t, bool) TRACE(VINF_SUCCESS) -int PGMInvalidatePage(PVMCPU, RTGCPTR) TRACE(VINF_SUCCESS) -int PGMHandlerPhysicalPageTempOff(PVM, RTGCPHYS, RTGCPHYS) TRACE(VINF_SUCCESS) -void PGMPhysReleasePageMappingLock(PVM, PPGMPAGEMAPLOCK) TRACE() -int PGMR3CheckIntegrity(PVM) TRACE(VINF_SUCCESS) -int PGMR3FinalizeMappings(PVM) TRACE(VINF_SUCCESS) -int PGMR3InitCompleted(PVM, VMINITCOMPLETED) TRACE(VINF_SUCCESS) -int PGMR3InitDynMap(PVM) TRACE(VINF_SUCCESS) -int PGMR3InitFinalize(PVM) TRACE(VINF_SUCCESS) -int PGMR3HandlerVirtualRegister(PVM, PGMVIRTHANDLERTYPE, RTGCPTR, RTGCPTR, - PFNPGMR3VIRTINVALIDATE, PFNPGMR3VIRTHANDLER, - const char*, const char*, const char*) TRACE(VINF_SUCCESS) -int PGMHandlerVirtualDeregister(PVM, RTGCPTR) TRACE(VINF_SUCCESS) -void PGMR3Relocate(PVM, RTGCINTPTR) TRACE() -int PGMChangeMode(PVMCPU, uint64_t, uint64_t, uint64_t) TRACE(VINF_SUCCESS) -int PGMR3ChangeMode(PVM, PVMCPU, PGMMODE) TRACE(VINF_SUCCESS) -/* required for Netware */ -void PGMCr0WpEnabled(PVMCPU pVCpu) TRACE() - -/* debugger */ -void DBGFR3PowerOff(PVM pVM) TRACE() -int DBGFR3DisasInstrCurrent(PVMCPU, char *, uint32_t) TRACE(VINF_SUCCESS) - -int vmmR3SwitcherInit(PVM pVM) TRACE(VINF_SUCCESS) -void vmmR3SwitcherRelocate(PVM, RTGCINTPTR) TRACE() -int VMMR3DisableSwitcher(PVM) TRACE(VINF_SUCCESS) - -int emR3InitDbg(PVM pVM) TRACE(VINF_SUCCESS) - -int FTMR3Init(PVM) TRACE(VINF_SUCCESS) -int FTMR3SetCheckpoint(PVM, FTMCHECKPOINTTYPE) TRACE(-1) -int FTMSetCheckpoint(PVM, FTMCHECKPOINTTYPE) TRACE(VINF_SUCCESS) -int FTMR3Term(PVM) TRACE(VINF_SUCCESS) - -int IEMR3Init(PVM) TRACE(VINF_SUCCESS) -int IEMR3Term(PVM) TRACE(VINF_SUCCESS) -void IEMR3Relocate(PVM) TRACE() - -void HMR3Relocate(PVM) TRACE() -void HMR3Reset(PVM pVM) TRACE() - -int SELMR3Init(PVM) TRACE(VINF_SUCCESS) -int SELMR3Term(PVM) TRACE(VINF_SUCCESS) -int SELMR3InitFinalize(PVM) TRACE(VINF_SUCCESS) -void SELMR3Relocate(PVM) TRACE() -void SELMR3Reset(PVM) TRACE() -void SELMR3DisableMonitoring(PVM) TRACE() - -int IOMR3IOPortRegisterRC(PVM, PPDMDEVINS, RTIOPORT, RTUINT, RTRCPTR, RTRCPTR, - RTRCPTR, RTRCPTR, RTRCPTR, const char*) TRACE(VINF_SUCCESS) -int IOMR3IOPortRegisterR0(PVM, PPDMDEVINS, RTIOPORT, RTUINT, RTR0PTR, - RTHCUINTPTR, RTHCUINTPTR, RTHCUINTPTR, RTHCUINTPTR, - const char*) TRACE(VINF_SUCCESS) -int IOMR3MmioRegisterR0(PVM, PPDMDEVINS, RTGCPHYS, uint32_t, RTR0PTR, - RTHCUINTPTR, RTHCUINTPTR, RTHCUINTPTR) TRACE(VINF_SUCCESS) -int IOMR3MmioRegisterRC(PVM, PPDMDEVINS, RTGCPHYS, uint32_t, RTGCPTR, RTRCPTR, - RTRCPTR, RTRCPTR) TRACE(VINF_SUCCESS) -void IOMR3Relocate(PVM, RTGCINTPTR) TRACE() -void IOMR3Reset(PVM) TRACE() - -int SUPR3SetVMForFastIOCtl(PVMR0) TRACE(VINF_SUCCESS) - -_AVLOU32NodeCore* RTAvloU32RemoveBestFit(PAVLOU32TREE, AVLOU32KEY, bool) TRACE(VINF_SUCCESS) -int RTAvlrFileOffsetDestroy(PAVLRFOFFTREE, PAVLRFOFFCALLBACK, void*) TRACE(VINF_SUCCESS) - -/* module loader of pluggable device manager */ -int pdmR3LdrInitU(PUVM) TRACE(VINF_SUCCESS) -int PDMR3LdrLoadVMMR0U(PUVM) TRACE(VINF_SUCCESS) -void PDMR3LdrRelocateU(PUVM, RTGCINTPTR) TRACE() -int pdmR3LoadR3U(PUVM, const char *, const char *) TRACE(VINF_SUCCESS) -void pdmR3LdrTermU(PUVM) TRACE() - -char *pdmR3FileR3(const char * file, bool) -{ - char * pv = reinterpret_cast(RTMemTmpAllocZ(1)); - - if (trace) - Genode::log(__func__, ": file ", file, " ", (void *)pv, " ", __builtin_return_address(0)); - - TRACE(pv) -} - -const char * RTBldCfgRevisionStr(void) -{ - return "Genode"; -} - -RT_C_DECLS_END diff --git a/repos/ports/src/virtualbox/frontend/ClientWatcher.h b/repos/ports/src/virtualbox/frontend/ClientWatcher.h deleted file mode 100644 index 92707ddfe..000000000 --- a/repos/ports/src/virtualbox/frontend/ClientWatcher.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ____H_CLIENTWATCHER -#define ____H_CLIENTWATCHER - -class VirtualBox::ClientWatcher -{ - public: - - ClientWatcher(VirtualBox* const) { } - - bool isReady() { return true; } - void update() { } - void addProcess(RTPROCESS pid); -}; -#endif /* !____H_CLIENTWATCHER */ diff --git a/repos/ports/src/virtualbox/frontend/GenodeImpl.h b/repos/ports/src/virtualbox/frontend/GenodeImpl.h deleted file mode 100644 index 505377349..000000000 --- a/repos/ports/src/virtualbox/frontend/GenodeImpl.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef ____H_GENODEIMPL -#define ____H_GENODEIMPL - -/* GuestControlSvc.h */ - -typedef struct { } VBOXGUESTCTRLHOSTCBCTX, *PVBOXGUESTCTRLHOSTCBCTX; -typedef struct { } VBOXGUESTCTRLHOSTCALLBACK, *PVBOXGUESTCTRLHOSTCALLBACK; -enum GUEST_FILE_SEEKTYPE { }; - -#endif // !____H_GENODEIMPL diff --git a/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/MediumFormatWrap.cpp b/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/MediumFormatWrap.cpp deleted file mode 100644 index e0e0716e9..000000000 --- a/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/MediumFormatWrap.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/** @file - * - * VirtualBox API class wrapper code for IMediumFormat. - * - * DO NOT EDIT! This is a generated file. - * Generated from: src/VBox/Main/idl/VirtualBox.xidl - * Generator: src/VBox/Main/idl/apiwrap-server.xsl - */ - -/** - * Copyright (C) 2010-2014 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - -#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_MEDIUMFORMAT - -#include "MediumFormatWrap.h" -#include "Logging.h" - -DEFINE_EMPTY_CTOR_DTOR(MediumFormatWrap) - -// -// IMediumFormat properties -// - -STDMETHODIMP MediumFormatWrap::COMGETTER(Id)(BSTR *aId) -{ - LogRelFlow(("{%p} %s: enter aId=%p\n", this, "MediumFormat::getId", aId)); - - VirtualBoxBase::clearError(); - - HRESULT hrc; - - try - { - CheckComArgOutPointerValidThrow(aId); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) - throw autoCaller.rc(); - - hrc = getId(BSTROutConverter(aId).str()); - } - catch (HRESULT hrc2) - { - hrc = hrc2; - } - catch (...) - { - hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); - } - - LogRelFlow(("{%p} %s: leave *aId=%ls hrc=%Rhrc\n", this, "MediumFormat::getId", *aId, hrc)); - return hrc; -} - -STDMETHODIMP MediumFormatWrap::COMGETTER(Name)(BSTR *aName) -{ - LogRelFlow(("{%p} %s: enter aName=%p\n", this, "MediumFormat::getName", aName)); - - VirtualBoxBase::clearError(); - - HRESULT hrc; - - try - { - CheckComArgOutPointerValidThrow(aName); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) - throw autoCaller.rc(); - - hrc = getName(BSTROutConverter(aName).str()); - } - catch (HRESULT hrc2) - { - hrc = hrc2; - } - catch (...) - { - hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); - } - - LogRelFlow(("{%p} %s: leave *aName=%ls hrc=%Rhrc\n", this, "MediumFormat::getName", *aName, hrc)); - return hrc; -} - -STDMETHODIMP MediumFormatWrap::COMGETTER(Capabilities)(ComSafeArrayOut(MediumFormatCapabilities_T, aCapabilities)) -{ - LogRelFlow(("{%p} %s: enter aCapabilities=%p\n", this, "MediumFormat::getCapabilities", aCapabilities)); - - VirtualBoxBase::clearError(); - - HRESULT hrc; - - try - { - CheckComArgOutPointerValidThrow(aCapabilities); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) - throw autoCaller.rc(); - - hrc = getCapabilities(ArrayOutConverter(ComSafeArrayOutArg(aCapabilities)).array()); - } - catch (HRESULT hrc2) - { - hrc = hrc2; - } - catch (...) - { - hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); - } - - LogRelFlow(("{%p} %s: leave *aCapabilities=%zu hrc=%Rhrc\n", this, "MediumFormat::getCapabilities", ComSafeArraySize(*aCapabilities), hrc)); - return hrc; -} - -// -// IMediumFormat methods -// - -STDMETHODIMP MediumFormatWrap::DescribeFileExtensions(ComSafeArrayOut(BSTR, aExtensions), - ComSafeArrayOut(DeviceType_T, aTypes)) -{ - LogRelFlow(("{%p} %s:enter aExtensions=%p aTypes=%p\n", this, "MediumFormat::describeFileExtensions", aExtensions, aTypes)); - - VirtualBoxBase::clearError(); - - HRESULT hrc; - - try - { - CheckComArgOutPointerValidThrow(aExtensions); - CheckComArgOutPointerValidThrow(aTypes); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) - throw autoCaller.rc(); - - hrc = describeFileExtensions(ArrayBSTROutConverter(ComSafeArrayOutArg(aExtensions)).array(), - ArrayOutConverter(ComSafeArrayOutArg(aTypes)).array()); - } - catch (HRESULT hrc2) - { - hrc = hrc2; - } - catch (...) - { - hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); - } - - LogRelFlow(("{%p} %s: leave *aExtensions=%zu *aTypes=%zu hrc=%Rhrc\n", this, "MediumFormat::describeFileExtensions", ComSafeArraySize(*aExtensions), ComSafeArraySize(*aTypes), hrc)); - return hrc; -} - -STDMETHODIMP MediumFormatWrap::DescribeProperties(ComSafeArrayOut(BSTR, aNames), - ComSafeArrayOut(BSTR, aDescriptions), - ComSafeArrayOut(DataType_T, aTypes), - ComSafeArrayOut(ULONG, aFlags), - ComSafeArrayOut(BSTR, aDefaults)) -{ - LogRelFlow(("{%p} %s:enter aNames=%p aDescriptions=%p aTypes=%p aFlags=%p aDefaults=%p\n", this, "MediumFormat::describeProperties", aNames, aDescriptions, aTypes, aFlags, aDefaults)); - - VirtualBoxBase::clearError(); - - HRESULT hrc; - - try - { - CheckComArgOutPointerValidThrow(aNames); - CheckComArgOutPointerValidThrow(aDescriptions); - CheckComArgOutPointerValidThrow(aTypes); - CheckComArgOutPointerValidThrow(aFlags); - CheckComArgOutPointerValidThrow(aDefaults); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) - throw autoCaller.rc(); - - hrc = describeProperties(ArrayBSTROutConverter(ComSafeArrayOutArg(aNames)).array(), - ArrayBSTROutConverter(ComSafeArrayOutArg(aDescriptions)).array(), - ArrayOutConverter(ComSafeArrayOutArg(aTypes)).array(), - ArrayOutConverter(ComSafeArrayOutArg(aFlags)).array(), - ArrayBSTROutConverter(ComSafeArrayOutArg(aDefaults)).array()); - } - catch (HRESULT hrc2) - { - hrc = hrc2; - } - catch (...) - { - hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); - } - - LogRelFlow(("{%p} %s: leave *aNames=%zu *aDescriptions=%zu *aTypes=%zu *aFlags=%zu *aDefaults=%zu hrc=%Rhrc\n", this, "MediumFormat::describeProperties", ComSafeArraySize(*aNames), ComSafeArraySize(*aDescriptions), ComSafeArraySize(*aTypes), ComSafeArraySize(*aFlags), ComSafeArraySize(*aDefaults), hrc)); - return hrc; -} - -#ifdef VBOX_WITH_XPCOM -NS_DECL_CLASSINFO(MediumFormatWrap) -NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MediumFormatWrap, IMediumFormat) -#endif // VBOX_WITH_XPCOM diff --git a/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/MediumFormatWrap.h b/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/MediumFormatWrap.h deleted file mode 100644 index 1a9836a3b..000000000 --- a/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/MediumFormatWrap.h +++ /dev/null @@ -1,77 +0,0 @@ -/** @file - * - * VirtualBox API class wrapper header for IMediumFormat. - * - * DO NOT EDIT! This is a generated file. - * Generated from: src/VBox/Main/idl/VirtualBox.xidl - * Generator: src/VBox/Main/idl/apiwrap-server.xsl - */ - -/** - * Copyright (C) 2010-2014 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - -#ifndef MediumFormatWrap_H_ -#define MediumFormatWrap_H_ - -#include "VirtualBoxBase.h" -#include "Wrapper.h" - -class ATL_NO_VTABLE MediumFormatWrap: - public VirtualBoxBase, - VBOX_SCRIPTABLE_IMPL(IMediumFormat) -{ - Q_OBJECT - -public: - VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumFormatWrap, IMediumFormat) - DECLARE_NOT_AGGREGATABLE(MediumFormatWrap) - DECLARE_PROTECT_FINAL_CONSTRUCT() - - BEGIN_COM_MAP(MediumFormatWrap) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(IMediumFormat) - COM_INTERFACE_ENTRY2(IDispatch, IMediumFormat) - END_COM_MAP() - - DECLARE_EMPTY_CTOR_DTOR(MediumFormatWrap) - - // public IMediumFormat properties - STDMETHOD(COMGETTER(Id))(BSTR *aId); - STDMETHOD(COMGETTER(Name))(BSTR *aName); - STDMETHOD(COMGETTER(Capabilities))(ComSafeArrayOut(MediumFormatCapabilities_T, aCapabilities)); - - // public IMediumFormat methods - STDMETHOD(DescribeFileExtensions)(ComSafeArrayOut(BSTR, aExtensions), - ComSafeArrayOut(DeviceType_T, aTypes)); - STDMETHOD(DescribeProperties)(ComSafeArrayOut(BSTR, aNames), - ComSafeArrayOut(BSTR, aDescriptions), - ComSafeArrayOut(DataType_T, aTypes), - ComSafeArrayOut(ULONG, aFlags), - ComSafeArrayOut(BSTR, aDefaults)); - -private: - // wrapped IMediumFormat properties - virtual HRESULT getId(com::Utf8Str &aId) = 0; - virtual HRESULT getName(com::Utf8Str &aName) = 0; - virtual HRESULT getCapabilities(std::vector &aCapabilities) = 0; - - // wrapped IMediumFormat methods - virtual HRESULT describeFileExtensions(std::vector &aExtensions, - std::vector &aTypes) = 0; - virtual HRESULT describeProperties(std::vector &aNames, - std::vector &aDescriptions, - std::vector &aTypes, - std::vector &aFlags, - std::vector &aDefaults) = 0; -}; - -#endif // !MediumFormatWrap_H_ diff --git a/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/TokenWrap.cpp b/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/TokenWrap.cpp deleted file mode 100644 index d7b9b2877..000000000 --- a/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/TokenWrap.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/** @file - * - * VirtualBox API class wrapper code for IToken. - * - * DO NOT EDIT! This is a generated file. - * Generated from: src/VBox/Main/idl/VirtualBox.xidl - * Generator: src/VBox/Main/idl/apiwrap-server.xsl - */ - -/** - * Copyright (C) 2010-2014 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - -#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_TOKEN - -#include "TokenWrap.h" -#include "Logging.h" - -DEFINE_EMPTY_CTOR_DTOR(TokenWrap) - -// -// IToken properties -// - -// -// IToken methods -// - -STDMETHODIMP TokenWrap::Abandon() -{ - LogRelFlow(("{%p} %s:enter\n", this, "Token::abandon")); - - VirtualBoxBase::clearError(); - - HRESULT hrc; - - try - { - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) - throw autoCaller.rc(); - - hrc = abandon(autoCaller); - } - catch (HRESULT hrc2) - { - hrc = hrc2; - } - catch (...) - { - hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); - } - - LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, "Token::abandon", hrc)); - return hrc; -} - -STDMETHODIMP TokenWrap::Dummy() -{ - LogRelFlow(("{%p} %s:enter\n", this, "Token::dummy")); - - VirtualBoxBase::clearError(); - - HRESULT hrc; - - try - { - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) - throw autoCaller.rc(); - - hrc = dummy(); - } - catch (HRESULT hrc2) - { - hrc = hrc2; - } - catch (...) - { - hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); - } - - LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, "Token::dummy", hrc)); - return hrc; -} - -#ifdef VBOX_WITH_XPCOM -NS_DECL_CLASSINFO(TokenWrap) -NS_IMPL_THREADSAFE_ISUPPORTS1_CI(TokenWrap, IToken) -#endif // VBOX_WITH_XPCOM diff --git a/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/TokenWrap.h b/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/TokenWrap.h deleted file mode 100644 index ca48cd1b8..000000000 --- a/repos/ports/src/virtualbox/frontend/VBoxAPIWrap/TokenWrap.h +++ /dev/null @@ -1,61 +0,0 @@ -/** @file - * - * VirtualBox API class wrapper header for IToken. - * - * DO NOT EDIT! This is a generated file. - * Generated from: src/VBox/Main/idl/VirtualBox.xidl - * Generator: src/VBox/Main/idl/apiwrap-server.xsl - */ - -/** - * Copyright (C) 2010-2014 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - -#ifndef TokenWrap_H_ -#define TokenWrap_H_ - -#include "VirtualBoxBase.h" -#include "Wrapper.h" - -class ATL_NO_VTABLE TokenWrap: - public VirtualBoxBase, - VBOX_SCRIPTABLE_IMPL(IToken) -{ - Q_OBJECT - -public: - VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(TokenWrap, IToken) - DECLARE_NOT_AGGREGATABLE(TokenWrap) - DECLARE_PROTECT_FINAL_CONSTRUCT() - - BEGIN_COM_MAP(TokenWrap) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(IToken) - COM_INTERFACE_ENTRY2(IDispatch, IToken) - END_COM_MAP() - - DECLARE_EMPTY_CTOR_DTOR(TokenWrap) - - // public IToken properties - - // public IToken methods - STDMETHOD(Abandon)(); - STDMETHOD(Dummy)(); - -private: - // wrapped IToken properties - - // wrapped IToken methods - virtual HRESULT abandon(AutoCaller &aAutoCaller) = 0; - virtual HRESULT dummy() = 0; -}; - -#endif // !TokenWrap_H_ diff --git a/repos/ports/src/virtualbox/frontend/VBoxEvents.h b/repos/ports/src/virtualbox/frontend/VBoxEvents.h deleted file mode 100644 index f2519b943..000000000 --- a/repos/ports/src/virtualbox/frontend/VBoxEvents.h +++ /dev/null @@ -1,45 +0,0 @@ -#include "EventImpl.h" - -void fireStateChangedEvent(IEventSource* aSource, MachineState_T a_state); - -void fireRuntimeErrorEvent(IEventSource* aSource, BOOL a_fatal, CBSTR a_id, - CBSTR a_message); - -void fireGuestMonitorChangedEvent(IEventSource* aSource, - GuestMonitorChangedEventType_T a_changeType, - ULONG a_screenId, ULONG a_originX, - ULONG a_originY, ULONG a_width, - ULONG a_height); - -void fireHostPCIDevicePlugEvent(IEventSource* aSource, CBSTR a_machineId, - BOOL a_plugged, BOOL a_success, - IPCIDeviceAttachment* a_attachment, - CBSTR a_message); - -void fireNATRedirectEvent(IEventSource* aSource, CBSTR a_machineId, - ULONG a_slot, BOOL a_remove, CBSTR a_name, - NATProtocol_T a_proto, CBSTR a_hostIP, - LONG a_hostPort, CBSTR a_guestIP, LONG a_guestPort); - -void fireNATNetworkChangedEvent(IEventSource* aSource, CBSTR a_networkName); - -void fireNATNetworkStartStopEvent(IEventSource* aSource, CBSTR a_networkName, - BOOL a_startEvent); - -void fireNATNetworkSettingEvent(IEventSource* aSource, CBSTR a_networkName, - BOOL a_enabled, CBSTR a_network, - CBSTR a_gateway, - BOOL a_advertiseDefaultIPv6RouteEnabled, - BOOL a_needDhcpServer); - -void fireNATNetworkPortForwardEvent(IEventSource* aSource, CBSTR a_networkName, - BOOL a_create, BOOL a_ipv6, CBSTR a_name, - NATProtocol_T a_proto, CBSTR a_hostIp, - LONG a_hostPort, CBSTR a_guestIp, - LONG a_guestPort); - -void fireHostNameResolutionConfigurationChangeEvent(IEventSource* aSource); - -void fireMediumChangedEvent(IEventSource *, IMediumAttachment *); - -#define fireGuestPropertyChangedEvent(a, b, c, d, e) diff --git a/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h b/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h deleted file mode 100644 index fa2f1337a..000000000 --- a/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h +++ /dev/null @@ -1,502 +0,0 @@ -/** - * VirtualBox COM base class definition adjusted to Genode - * - based on VBox/Main/include/VirtualBoxBase.h - */ - -/* - * Copyright (C) 2006-2013 Oracle Corporation - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - - -#ifndef ____H_VIRTUALBOXBASEIMPL -#define ____H_VIRTUALBOXBASEIMPL - -#include - -#include -#include - -#include -#include - -#include "VBox/com/AutoLock.h" -#include "VBox/com/string.h" -#include "VBox/com/Guid.h" - -#include "VBox/com/VirtualBox.h" - -namespace com -{ - class ErrorInfo; -} - -using namespace com; -using namespace util; - -class AutoInitSpan; -class AutoUninitSpan; - -class VirtualBox; -class Machine; -class Medium; - -typedef std::list > MediaList; -typedef std::list StringsList; - -class VirtualBoxTranslatable : public util::Lockable -{ - public: - - /* should be used for translations */ - inline static const char *tr(const char *pcszSourceText, - const char *aComment = NULL) - { - return pcszSourceText; - } -}; - -class VirtualBoxBase : public VirtualBoxTranslatable -{ - - public: - - enum State { NotReady, Ready, InInit, InUninit, InitFailed, Limited }; - - virtual void uninit() { } - - private: - - RWLockHandle *_lock; - - - void setState(State aState) - { - Assert(mState != aState); - mState = aState; - mStateChangeThread = RTThreadSelf(); - } - - /** Primary state of this object */ - State mState; - /** Thread that caused the last state change */ - RTTHREAD mStateChangeThread; - /** Total number of active calls to this object */ - unsigned mCallers; - /** Posted when the number of callers drops to zero */ - RTSEMEVENT mZeroCallersSem; - /** Posted when the object goes from InInit/InUninit to some other state */ - RTSEMEVENTMULTI mInitUninitSem; - /** Number of threads waiting for mInitUninitDoneSem */ - unsigned mInitUninitWaiters; - - /** Protects access to state related data members */ - WriteLockHandle mStateLock; - - /** User-level object lock for subclasses */ - mutable RWLockHandle *mObjectLock; - - friend class AutoInitSpan; - friend class AutoReinitSpan; - friend class AutoUninitSpan; - - protected: - - HRESULT BaseFinalConstruct() { return S_OK; } - - void BaseFinalRelease() { } - - public: - - VirtualBoxBase(); // : _lock(nullptr) { } - ~VirtualBoxBase(); - - virtual HRESULT addCaller(State *aState = NULL, bool aLimited = false); - virtual void releaseCaller(); - - virtual const char* getComponentName() const = 0; - - static HRESULT handleUnexpectedExceptions(VirtualBoxBase *const aThis, RT_SRC_POS_DECL); - static HRESULT initializeComForThread(void); - static void uninitializeComForThread(void); - static void clearError(void); - - HRESULT setError(HRESULT aResultCode); - HRESULT setError(HRESULT aResultCode, const char *pcsz, ...); - HRESULT setError(const com::ErrorInfo &ei); - - static HRESULT setErrorInternal(HRESULT aResultCode, - const GUID &aIID, - const char *aComponent, - Utf8Str aText, - bool aWarning, - bool aLogIt); - - virtual VBoxLockingClass getLockingClass() const - { - return LOCKCLASS_OTHEROBJECT; - } - - RWLockHandle * lockHandle() const; -}; - - -/** - * Dummy macro that is used to shut down Qt's lupdate tool warnings in some - * situations. This macro needs to be present inside (better at the very - * beginning) of the declaration of the class that inherits from - * VirtualBoxTranslatable, to make lupdate happy. - */ -#define Q_OBJECT - - -template -class Shareable -{ - - private: - - bool _verbose; - T * _obj; - - public: - - Shareable () : _verbose(false), _obj(nullptr) { } - - /* operators */ - T * operator->() const { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); return _obj; } - - bool isNull() const { return _obj == nullptr; } - bool operator!() const { return isNull(); } - - void allocate() { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); _obj = new T; } - void attach(T * t) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); } - void attach(Shareable &s) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); } - void share(const Shareable &s) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); _obj = s._obj; } - void share(T * obj) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); _obj = obj; } - void free() { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); } - void attachCopy(const T *) { if(_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); } - void attachCopy(const Shareable &) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); } - - T *data() const { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); return _obj; } - - bool isShared() const { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); return false; } -}; - -template -class Backupable : public Shareable -{ - - public: - - Backupable() : Shareable() { } - - void backup() { } - void rollback() { } - void commit() { } - void commitCopy() { } - void assignCopy(const T *) { } - void assignCopy(const Backupable &) { } - - HRESULT backupEx() { return S_OK; } - - T *backedUpData() const { Genode::log(__PRETTY_FUNCTION__, " called"); return nullptr; } - bool isBackedUp() const { return false; } -}; - -/** - * Special version of the Assert macro to be used within VirtualBoxBase - * subclasses. - * - * In the debug build, this macro is equivalent to Assert. - * In the release build, this macro uses |setError(E_FAIL, ...)| to set the - * error info from the asserted expression. - * - * @see VirtualBoxBase::setError - * - * @param expr Expression which should be true. - */ -#if defined(DEBUG) -#define ComAssert(expr) Assert(expr) -#else -#define ComAssert(expr) \ - do { \ - if (RT_UNLIKELY(!(expr))) \ - setError(E_FAIL, \ - "Assertion failed: [%s] at '%s' (%d) in %s.\nPlease contact the product vendor!", \ - #expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \ - } while (0) -#endif - -/** - * Special version of the AssertFailed macro to be used within VirtualBoxBase - * subclasses. - * - * In the debug build, this macro is equivalent to AssertFailed. - * In the release build, this macro uses |setError(E_FAIL, ...)| to set the - * error info from the asserted expression. - * - * @see VirtualBoxBase::setError - * - */ -#if defined(DEBUG) -#define ComAssertFailed() AssertFailed() -#else -#define ComAssertFailed() \ - do { \ - setError(E_FAIL, \ - "Assertion failed: at '%s' (%d) in %s.\nPlease contact the product vendor!", \ - __FILE__, __LINE__, __PRETTY_FUNCTION__); \ - } while (0) -#endif - -/** - * Special version of the AssertMsg macro to be used within VirtualBoxBase - * subclasses. - * - * See ComAssert for more info. - * - * @param expr Expression which should be true. - * @param a printf argument list (in parenthesis). - */ -#if defined(DEBUG) -#define ComAssertMsg(expr, a) AssertMsg(expr, a) -#else -#define ComAssertMsg(expr, a) \ - do { \ - if (RT_UNLIKELY(!(expr))) \ - setError(E_FAIL, \ - "Assertion failed: [%s] at '%s' (%d) in %s.\n%s.\nPlease contact the product vendor!", \ - #expr, __FILE__, __LINE__, __PRETTY_FUNCTION__, Utf8StrFmt a .c_str()); \ - } while (0) -#endif - -/** - * Special version of the AssertComRC macro to be used within VirtualBoxBase - * subclasses. - * - * See ComAssert for more info. - * - * @param rc COM result code - */ -#if defined(DEBUG) -#define ComAssertComRC(rc) AssertComRC(rc) -#else -#define ComAssertComRC(rc) ComAssertMsg(SUCCEEDED(rc), ("COM RC = %Rhrc (0x%08X)", (rc), (rc))) -#endif - -/** - * Special version of the AssertMsgRC macro to be used within VirtualBoxBase - * subclasses. - * - * See ComAssert for more info. - * - * @param vrc VBox status code. - * @param msg printf argument list (in parenthesis). - */ -#if defined(DEBUG) -#define ComAssertMsgRC(vrc, msg) AssertMsgRC(vrc, msg) -#else -#define ComAssertMsgRC(vrc, msg) ComAssertMsg(RT_SUCCESS(vrc), msg) -#endif - -/** - * Special version of the AssertRC macro to be used within VirtualBoxBase - * subclasses. - * - * See ComAssert for more info. - * - * @param vrc VBox status code. - */ -#if defined(DEBUG) -#define ComAssertRC(vrc) AssertRC(vrc) -#else -#define ComAssertRC(vrc) ComAssertMsgRC(vrc, ("%Rra", vrc)) -#endif - -/** Special version of ComAssert that returns ret if expr fails */ -#define ComAssertRet(expr, ret) \ - do { ComAssert(expr); if (!(expr)) return (ret); } while (0) -/** Special version of ComAssertMsg that returns ret if expr fails */ -#define ComAssertMsgRet(expr, a, ret) \ - do { ComAssertMsg(expr, a); if (!(expr)) return (ret); } while (0) -/** Special version of ComAssertComRC that returns ret if rc does not succeed */ -#define ComAssertComRCRet(rc, ret) \ - do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) return (ret); } while (0) -/** Special version of ComAssertMsg that evaluates eval and breaks if expr fails */ -#define ComAssertMsgBreak(expr, a, eval) \ - if (1) { ComAssertMsg(expr, a); if (!(expr)) { eval; break; } } else do {} while (0) -/** Special version of ComAssert that evaluates eval and throws it if expr fails */ -#define ComAssertThrow(expr, eval) \ - do { ComAssert(expr); if (!(expr)) { throw (eval); } } while (0) -/** Special version of ComAssertRC that evaluates eval and throws it if vrc does not succeed */ -#define ComAssertRCThrow(vrc, eval) \ - do { ComAssertRC(vrc); if (!RT_SUCCESS(vrc)) { throw (eval); } } while (0) -/** Special version of ComAssertFailed that returns ret */ -#define ComAssertFailedRet(ret) \ - do { ComAssertFailed(); return (ret); } while (0) -/** Special version of ComAssertFailed that returns ret */ -#define ComAssertFailedRet(ret) \ - do { ComAssertFailed(); return (ret); } while (0) -/** Special version of ComAssertRC that returns ret if vrc does not succeed */ -#define ComAssertRCRet(vrc, ret) \ - do { ComAssertRC(vrc); if (!RT_SUCCESS(vrc)) return (ret); } while (0) -/** Special version of ComAssertComRC that just throws rc if rc does not succeed */ -#define ComAssertComRCThrowRC(rc) \ - do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) { throw rc; } } while (0) -/** Special version of ComAssertComRC that returns rc if rc does not succeed */ -#define ComAssertComRCRetRC(rc) \ - do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) return (rc); } while (0) - -/** - * Checks that the pointer argument is not NULL and returns E_INVALIDARG + - * extended error info on failure. - * @param arg Input pointer-type argument (strings, interface pointers...) - */ -#define CheckComArgNotNull(arg) \ - do { \ - if (RT_UNLIKELY((arg) == NULL)) \ - return setError(E_INVALIDARG, tr("Argument %s is NULL"), #arg); \ - } while (0) - -/** - * Checks that the pointer argument is a valid pointer or NULL and returns - * E_INVALIDARG + extended error info on failure. - * @param arg Input pointer-type argument (strings, interface pointers...) - */ -#define CheckComArgMaybeNull(arg) \ - do { \ - if (RT_UNLIKELY(!RT_VALID_PTR(arg) && (arg) != NULL)) \ - return setError(E_INVALIDARG, tr("Argument %s is an invalid pointer"), #arg); \ - } while (0) - -/** - * Checks that the given expression (that must involve the argument) is true and - * returns E_INVALIDARG + extended error info on failure. - * @param arg Argument. - * @param expr Expression to evaluate. - */ -#define CheckComArgExpr(arg, expr) \ - do { \ - if (RT_UNLIKELY(!(expr))) \ - return setError(E_INVALIDARG, \ - tr("Argument %s is invalid (must be %s)"), #arg, #expr); \ - } while (0) - -/** - * Checks that the given pointer to an output argument is valid and returns - * E_POINTER + extended error info otherwise. - * @param arg Pointer argument. - */ -#define CheckComArgOutPointerValid(arg) \ - do { \ - if (RT_UNLIKELY(!VALID_PTR(arg))) \ - return setError(E_POINTER, \ - tr("Output argument %s points to invalid memory location (%p)"), \ - #arg, (void *)(arg)); \ - } while (0) - -/** - * Checks that a string input argument is valid (not NULL or obviously invalid - * pointer), returning E_INVALIDARG + extended error info if invalid. - * @param a_bstrIn Input string argument (IN_BSTR). - */ -#define CheckComArgStr(a_bstrIn) \ - do { \ - IN_BSTR const bstrInCheck = (a_bstrIn); /* type check */ \ - if (RT_UNLIKELY(!RT_VALID_PTR(bstrInCheck))) \ - return setError(E_INVALIDARG, tr("Argument %s is an invalid pointer"), #a_bstrIn); \ - } while (0) - -/** - * Checks that the string argument is not a NULL, a invalid pointer or an empty - * string, returning E_INVALIDARG + extended error info on failure. - * @param a_bstrIn Input string argument (BSTR etc.). - */ -#define CheckComArgStrNotEmptyOrNull(a_bstrIn) \ - do { \ - IN_BSTR const bstrInCheck = (a_bstrIn); /* type check */ \ - if (RT_UNLIKELY(!RT_VALID_PTR(bstrInCheck) || *(bstrInCheck) == '\0')) \ - return setError(E_INVALIDARG, tr("Argument %s is empty or an invalid pointer"), #a_bstrIn); \ - } while (0) - -/** - * Checks that the given pointer to an output safe array argument is valid and - * returns E_POINTER + extended error info otherwise. - * @param arg Safe array argument. - */ -#define CheckComArgOutSafeArrayPointerValid(arg) \ - do { \ - if (RT_UNLIKELY(ComSafeArrayOutIsNull(arg))) \ - return setError(E_POINTER, \ - tr("Output argument %s points to invalid memory location (%p)"), \ - #arg, (void*)(arg)); \ - } while (0) - -/** - * Checks that safe array argument is not NULL and returns E_INVALIDARG + - * extended error info on failure. - * @param arg Input safe array argument (strings, interface pointers...) - */ -#define CheckComArgSafeArrayNotNull(arg) \ - do { \ - if (RT_UNLIKELY(ComSafeArrayInIsNull(arg))) \ - return setError(E_INVALIDARG, tr("Argument %s is NULL"), #arg); \ - } while (0) - -/** - * Sets the extended error info and returns E_NOTIMPL. - */ -#define ReturnComNotImplemented() \ - do { \ - return setError(E_NOTIMPL, tr("Method %s is not implemented"), __FUNCTION__); \ - } while (0) - - -#define DECLARE_EMPTY_CTOR_DTOR(X) public: X(); ~X(); - -#define DEFINE_EMPTY_CTOR_DTOR(X) X::X() {} X::~X() {} - - -#define VIRTUALBOXBASE_ADD_VIRTUAL_COMPONENT_METHODS(cls, iface) \ - virtual const GUID& getClassIID() const \ - { \ - return cls::getStaticClassIID(); \ - } \ - static const GUID& getStaticClassIID() \ - { \ - return COM_IIDOF(iface); \ - } \ - virtual const char* getComponentName() const \ - { \ - return cls::getStaticComponentName(); \ - } \ - static const char* getStaticComponentName() \ - { \ - return #cls; \ - } - -/** - * VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT: - * This macro must be used once in the declaration of any class derived - * from VirtualBoxBase. It implements the pure virtual getClassIID() and - * getComponentName() methods. If this macro is not present, instances - * of a class derived from VirtualBoxBase cannot be instantiated. - * - * @param X The class name, e.g. "Class". - * @param IX The interface name which this class implements, e.g. "IClass". - */ - #define VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(cls, iface) \ - VIRTUALBOXBASE_ADD_VIRTUAL_COMPONENT_METHODS(cls, iface) - -#include "GenodeImpl.h" - -#endif // !____H_VIRTUALBOXBASEIMPL diff --git a/repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.cpp b/repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.cpp deleted file mode 100644 index 874b99cc5..000000000 --- a/repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "dummy/macros.h" - -#include "VirtualBoxErrorInfoImpl.h" - -HRESULT VirtualBoxErrorInfo::init(HRESULT, const GUID &, const char *, - const Utf8Str &, IVirtualBoxErrorInfo *) DUMMY(E_FAIL) diff --git a/repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.h b/repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.h deleted file mode 100644 index 19afd6e10..000000000 --- a/repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef ____H_VIRTUALBOXERRORINFO -#define ____H_VIRTUALBOXERRORINFO - -#include - -class VirtualBoxErrorInfo : - public VirtualBoxBase, - VBOX_SCRIPTABLE_IMPL(IVirtualBoxErrorInfo) -{ - public: - - VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VirtualBoxErrorInfo, IVirtualBoxErrorInfo) - - DECLARE_NOT_AGGREGATABLE(VirtualBoxErrorInfo) - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - BEGIN_COM_MAP(VirtualBoxErrorInfo) - COM_INTERFACE_ENTRY(IErrorInfo) - COM_INTERFACE_ENTRY(IVirtualBoxErrorInfo) - COM_INTERFACE_ENTRY(IDispatch) - END_COM_MAP() - - HRESULT init(HRESULT aResultCode, const GUID &aIID, - const char *pcszComponent, const com::Utf8Str &strText, - IVirtualBoxErrorInfo *aNext = NULL); - HRESULT FinalConstruct() { return S_OK; } - - /* readonly attribute long resultCode; */ - HRESULT GetResultCode(PRInt32 *aResultCode) { return S_OK; } - - /* readonly attribute long resultDetail; */ - HRESULT GetResultDetail(PRInt32 *aResultDetail) { return S_OK; } - - /* readonly attribute wstring interfaceID; */ - HRESULT GetInterfaceID(PRUnichar * *aInterfaceID) { return S_OK; } - - /* readonly attribute wstring component; */ - HRESULT GetComponent(PRUnichar * *aComponent) { return S_OK; } - - /* readonly attribute wstring text; */ - HRESULT GetText(PRUnichar * *aText) { return S_OK; } - - /* readonly attribute IVirtualBoxErrorInfo next; */ - HRESULT GetNext(IVirtualBoxErrorInfo * *aNext) { return S_OK; } - -}; - -#endif /* ____H_VIRTUALBOXERRORINFO */ diff --git a/repos/ports/src/virtualbox/frontend/console.cc b/repos/ports/src/virtualbox/frontend/console.cc deleted file mode 100644 index 0380aa100..000000000 --- a/repos/ports/src/virtualbox/frontend/console.cc +++ /dev/null @@ -1,598 +0,0 @@ -/* - * \brief Port of VirtualBox to Genode - * \author Norman Feske - * \author Alexander Boettcher - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#include -#include - -#include -#include -#include - -#include "ConsoleImpl.h" -#include "MachineImpl.h" -#include "MouseImpl.h" -#include "DisplayImpl.h" -#include "GuestImpl.h" - -#include "dummy/macros.h" - -#include "console.h" -#include "fb.h" -#include "../vmm.h" - -static const bool debug = false; -static bool vm_down = false; - -static Genode::Attached_rom_dataspace *clipboard_rom = nullptr; -static Genode::Reporter *clipboard_reporter = nullptr; -static char *decoded_clipboard_content = nullptr; - -void Console::uninit() DUMMY() -HRESULT Console::resume(Reason_T aReason) DUMMY(E_FAIL) -HRESULT Console::pause(Reason_T aReason) DUMMY(E_FAIL) -void Console::enableVMMStatistics(BOOL aEnable) DUMMY() -HRESULT Console::updateMachineState(MachineState_T aMachineState) DUMMY(E_FAIL) - -HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter) -{ - ULONG slot = 0; - HRESULT rc = networkAdapter->COMGETTER(Slot)(&slot); - AssertComRC(rc); - - maTapFD[slot] = (RTFILE)1; - - TRACE(rc) -} - -HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter) -{ - ULONG slot = 0; - HRESULT rc = networkAdapter->COMGETTER(Slot)(&slot); - AssertComRC(rc); - - if (maTapFD[slot] != NIL_RTFILE) - maTapFD[slot] = NIL_RTFILE; - - TRACE(rc) -} - -HRESULT Console::teleporterTrg(PUVM, IMachine*, com::Utf8Str*, bool, Progress*, - bool*) DUMMY(E_FAIL) -HRESULT Console::saveState(Reason_T aReason, IProgress **aProgress) DUMMY(E_FAIL) - -STDMETHODIMP Console::COMGETTER(Debugger)(IMachineDebugger **aDebugger) DUMMY(E_FAIL) -STDMETHODIMP Console::COMGETTER(USBDevices)(ComSafeArrayOut(IUSBDevice *, aUSBDevices)) DUMMY(E_FAIL) -STDMETHODIMP Console::COMGETTER(RemoteUSBDevices)(ComSafeArrayOut(IHostUSBDevice *, aRemoteUSBDevices)) DUMMY(E_FAIL) -STDMETHODIMP Console::COMGETTER(VRDEServerInfo)(IVRDEServerInfo **aVRDEServerInfo) DUMMY(E_FAIL) -STDMETHODIMP Console::COMGETTER(EmulatedUSB)(IEmulatedUSB **aEmulatedUSB) DUMMY(E_FAIL) -STDMETHODIMP Console::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders)) DUMMY(E_FAIL) -STDMETHODIMP Console::COMGETTER(AttachedPCIDevices)(ComSafeArrayOut(IPCIDeviceAttachment *, aAttachments)) DUMMY(E_FAIL) -STDMETHODIMP Console::COMGETTER(UseHostClipboard)(BOOL *aUseHostClipboard) DUMMY(E_FAIL) -STDMETHODIMP Console::COMSETTER(UseHostClipboard)(BOOL aUseHostClipboard) DUMMY(E_FAIL) - -HRESULT Console::Reset() DUMMY(E_FAIL) -HRESULT Console::Pause() DUMMY(E_FAIL) -HRESULT Console::Resume() DUMMY(E_FAIL) -HRESULT Console::SleepButton() DUMMY(E_FAIL) -HRESULT Console::GetPowerButtonHandled(bool*) DUMMY(E_FAIL) -HRESULT Console::GetGuestEnteredACPIMode(bool*) DUMMY(E_FAIL) -HRESULT Console::SaveState(IProgress**) DUMMY(E_FAIL) -HRESULT Console::AdoptSavedState(IN_BSTR) DUMMY(E_FAIL) -HRESULT Console::DiscardSavedState(bool) DUMMY(E_FAIL) -HRESULT Console::GetDeviceActivity(DeviceType_T, DeviceActivity_T*) DUMMY(E_FAIL) -HRESULT Console::AttachUSBDevice(IN_BSTR) DUMMY(E_FAIL) -HRESULT Console::DetachUSBDevice(IN_BSTR, IUSBDevice**) DUMMY(E_FAIL) -HRESULT Console::FindUSBDeviceByAddress(IN_BSTR, IUSBDevice**) DUMMY(E_FAIL) -HRESULT Console::FindUSBDeviceById(IN_BSTR, IUSBDevice**) DUMMY(E_FAIL) -HRESULT Console::CreateSharedFolder(IN_BSTR, IN_BSTR, BOOL, BOOL) DUMMY(E_FAIL) -HRESULT Console::RemoveSharedFolder(IN_BSTR) DUMMY(E_FAIL) -HRESULT Console::TakeSnapshot(IN_BSTR, IN_BSTR, IProgress**) DUMMY(E_FAIL) -HRESULT Console::DeleteSnapshot(IN_BSTR, IProgress**) DUMMY(E_FAIL) -HRESULT Console::DeleteSnapshotAndAllChildren(IN_BSTR, IProgress**) DUMMY(E_FAIL) -HRESULT Console::DeleteSnapshotRange(IN_BSTR, IN_BSTR, IProgress**) DUMMY(E_FAIL) -HRESULT Console::RestoreSnapshot(ISnapshot*, IProgress**) DUMMY(E_FAIL) -HRESULT Console::Teleport(IN_BSTR, ULONG, IN_BSTR, ULONG, IProgress **) DUMMY(E_FAIL) -HRESULT Console::setDiskEncryptionKeys(const Utf8Str &strCfg) DUMMY(E_FAIL) - -void Console::onAdditionsOutdated() DUMMY() - -HRESULT Console::onVideoCaptureChange() DUMMY(E_FAIL) -HRESULT Console::onSharedFolderChange(BOOL aGlobal) DUMMY(E_FAIL) -HRESULT Console::onUSBControllerChange() DUMMY(E_FAIL) -HRESULT Console::onCPUChange(ULONG aCPU, BOOL aRemove) DUMMY(E_FAIL) -HRESULT Console::onClipboardModeChange(ClipboardMode_T aClipboardMode) DUMMY(E_FAIL) -HRESULT Console::onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode) DUMMY(E_FAIL) -HRESULT Console::onCPUExecutionCapChange(ULONG aExecutionCap) DUMMY(E_FAIL) -HRESULT Console::onStorageControllerChange() DUMMY(E_FAIL) -HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment, BOOL) DUMMY(E_FAIL) -HRESULT Console::onVRDEServerChange(BOOL aRestart) DUMMY(E_FAIL) -HRESULT Console::onUSBDeviceAttach(IUSBDevice *, IVirtualBoxErrorInfo *, ULONG) DUMMY(E_FAIL) -HRESULT Console::onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError) DUMMY(E_FAIL) - -HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) DUMMY(E_FAIL) -HRESULT Console::onNetworkAdapterChange(INetworkAdapter *, BOOL changeAdapter) DUMMY(E_FAIL) -HRESULT Console::onStorageDeviceChange(IMediumAttachment *, BOOL, BOOL) DUMMY(E_FAIL) -HRESULT Console::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup) DUMMY(E_FAIL) -HRESULT Console::onSerialPortChange(ISerialPort *aSerialPort) DUMMY(E_FAIL) -HRESULT Console::onParallelPortChange(IParallelPort *aParallelPort) DUMMY(E_FAIL) -HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment, - ULONG aSourceIdx, ULONG aTargetIdx, - IProgress *aProgress) DUMMY(E_FAIL) - -void fireStateChangedEvent(IEventSource* aSource, - MachineState_T a_state) -{ - if (a_state != MachineState_PoweredOff) - return; - - vm_down = true; - - genode_env().parent().exit(0); -} - -void fireRuntimeErrorEvent(IEventSource* aSource, BOOL a_fatal, - CBSTR a_id, CBSTR a_message) -{ - Genode::error(__func__, " : ", a_fatal, " ", - Utf8Str(a_id).c_str(), " ", - Utf8Str(a_message).c_str()); - - TRACE(); -} - -void Console::onAdditionsStateChange() -{ - dynamic_cast(this)->update_video_mode(); -} - -void GenodeConsole::update_video_mode() -{ - Display *d = getDisplay(); - Genodefb *fb = dynamic_cast(d->getFramebuffer()); - - if (!fb) - return; - - if ((fb->w() == 0) && (fb->h() == 0)) { - /* interpret a size of 0x0 as indication to quit VirtualBox */ - if (PowerButton() != S_OK) - Genode::error("ACPI shutdown failed"); - return; - } - - d->SetVideoModeHint(0 /*=display*/, - true /*=enabled*/, false /*=changeOrigin*/, - 0 /*=originX*/, 0 /*=originY*/, - fb->w(), fb->h(), - /* Windows 8 only accepts 32-bpp modes */ - 32); -} - -void GenodeConsole::handle_input() -{ - /* disable input processing if vm is powered down */ - if (vm_down && (_vbox_mouse || _vbox_keyboard)) { - _vbox_mouse = nullptr; - _vbox_keyboard = nullptr; - _input.sigh(Genode::Signal_context_capability()); - } - - static LONG64 mt_events [64]; - unsigned mt_number = 0; - - /* read out input capabilities of guest */ - bool guest_abs = false, guest_rel = false, guest_multi = false; - if (_vbox_mouse) { - _vbox_mouse->COMGETTER(AbsoluteSupported)(&guest_abs); - _vbox_mouse->COMGETTER(RelativeSupported)(&guest_rel); - _vbox_mouse->COMGETTER(MultiTouchSupported)(&guest_multi); - } - - _input.for_each_event([&] (Input::Event const &ev) { - /* if keyboard/mouse not available, consume input events and drop it */ - if (!_vbox_keyboard || !_vbox_mouse) - return; - - auto keyboard_submit = [&] (Input::Keycode key, bool release) { - - Scan_code scan_code(key); - - unsigned char const release_bit = release ? 0x80 : 0; - - if (scan_code.normal()) - _vbox_keyboard->PutScancode(scan_code.code() | release_bit); - - if (scan_code.ext()) { - _vbox_keyboard->PutScancode(0xe0); - _vbox_keyboard->PutScancode(scan_code.ext() | release_bit); - } - }; - - /* obtain bit mask of currently pressed mouse buttons */ - auto curr_mouse_button_bits = [&] () { - return (_key_status[Input::BTN_LEFT] ? MouseButtonState_LeftButton : 0) - | (_key_status[Input::BTN_RIGHT] ? MouseButtonState_RightButton : 0) - | (_key_status[Input::BTN_MIDDLE] ? MouseButtonState_MiddleButton : 0); - }; - - unsigned const old_mouse_button_bits = curr_mouse_button_bits(); - - ev.handle_press([&] (Input::Keycode key, Genode::Codepoint) { - keyboard_submit(key, false); - _key_status[key] = true; - }); - - ev.handle_release([&] (Input::Keycode key) { - keyboard_submit(key, true); - _key_status[key] = false; - }); - - unsigned const mouse_button_bits = curr_mouse_button_bits(); - - if (mouse_button_bits != old_mouse_button_bits) { - - if (_last_received_motion_event_was_absolute) { - /* prefer absolute button event */ - if (guest_abs) - _vbox_mouse->PutMouseEventAbsolute(_ax, _ay, 0, 0, mouse_button_bits); - else if (guest_rel) - _vbox_mouse->PutMouseEvent(0, 0, 0, 0, mouse_button_bits); - } else { - /* prefer relative button event */ - if (guest_rel) - _vbox_mouse->PutMouseEvent(0, 0, 0, 0, mouse_button_bits); - else if (guest_abs) - _vbox_mouse->PutMouseEventAbsolute(_ax, _ay, 0, 0, mouse_button_bits); - } - } - - ev.handle_absolute_motion([&] (int x, int y) { - - _last_received_motion_event_was_absolute = true; - - /* transform absolute to relative if guest is so odd */ - if (!guest_abs && guest_rel) { - int const boundary = 20; - int rx = x - _ax; - int ry = y - _ay; - rx = Genode::min(boundary, Genode::max(-boundary, rx)); - ry = Genode::min(boundary, Genode::max(-boundary, ry)); - _vbox_mouse->PutMouseEvent(rx, ry, 0, 0, mouse_button_bits); - } else - _vbox_mouse->PutMouseEventAbsolute(x, y, 0, 0, mouse_button_bits); - - _ax = x; - _ay = y; - }); - - ev.handle_relative_motion([&] (int x, int y) { - - _last_received_motion_event_was_absolute = false; - - /* prefer relative motion event */ - if (guest_rel) - _vbox_mouse->PutMouseEvent(x, y, 0, 0, mouse_button_bits); - else if (guest_abs) { - _ax += x; - _ay += y; - _vbox_mouse->PutMouseEventAbsolute(_ax, _ay, 0, 0, mouse_button_bits); - } - }); - - ev.handle_wheel([&] (int x, int y) { - - if (_last_received_motion_event_was_absolute) - _vbox_mouse->PutMouseEventAbsolute(_ax, _ay, -y, -x, 0); - else - _vbox_mouse->PutMouseEvent(0, 0, -y, -x, 0); - }); - - ev.handle_touch([&] (Input::Touch_id id, int x, int y) { - - /* if multitouch queue is full - send it */ - if (mt_number >= sizeof(mt_events) / sizeof(mt_events[0])) { - _vbox_mouse->PutEventMultiTouch(mt_number, mt_number, - mt_events, RTTimeMilliTS()); - mt_number = 0; - } - - /* Mouse::putEventMultiTouch drops values of 0 */ - if (x <= 0) x = 1; - if (y <= 0) y = 1; - - enum { IN_CONTACT = 0x01, IN_RANGE = 0x02 }; - - uint16_t const s = RT_MAKE_U16(id.value, IN_CONTACT | IN_RANGE); - mt_events[mt_number++] = RT_MAKE_U64_FROM_U16(x, y, s, 0); - }); - - ev.handle_touch_release([&] (Input::Touch_id id) { - uint16_t const s = RT_MAKE_U16(id.value, 0); - mt_events[mt_number++] = RT_MAKE_U64_FROM_U16(0, 0, s, 0); - }); - }); - - /* if there are elements in multi-touch queue - send it */ - if (mt_number) - _vbox_mouse->PutEventMultiTouch(mt_number, mt_number, mt_events, - RTTimeMilliTS()); -} - -void GenodeConsole::handle_mode_change() -{ - Display *d = getDisplay(); - Genodefb *fb = dynamic_cast(d->getFramebuffer()); - - fb->update_mode(); - update_video_mode(); -} - -void GenodeConsole::init_clipboard() -{ - if (!&*machine()) - return; - - ClipboardMode_T mode; - machine()->COMGETTER(ClipboardMode)(&mode); - - if (mode == ClipboardMode_Bidirectional || - mode == ClipboardMode_HostToGuest) { - - _clipboard_rom = new Genode::Attached_rom_dataspace(genode_env(), "clipboard"); - _clipboard_rom->sigh(_clipboard_signal_dispatcher); - - clipboard_rom = _clipboard_rom; - } - - if (mode == ClipboardMode_Bidirectional || - mode == ClipboardMode_GuestToHost) { - - _clipboard_reporter = new Genode::Reporter(genode_env(), "clipboard"); - _clipboard_reporter->enabled(true); - - clipboard_reporter = _clipboard_reporter; - } -} - -void GenodeConsole::handle_cb_rom_change() -{ - if (!_clipboard_rom) - return; - - vboxClipboardSync(nullptr); -} - -void GenodeConsole::init_backends(IKeyboard * gKeyboard, IMouse * gMouse) -{ - _vbox_keyboard = gKeyboard; - _vbox_mouse = gMouse; - - /* register the mode change signal dispatcher at the framebuffer */ - Display *d = getDisplay(); - Genodefb *fb = dynamic_cast(d->getFramebuffer()); - fb->mode_sigh(_mode_change_signal_dispatcher); - - handle_mode_change(); -} - -void GenodeConsole::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, - BOOL supportsMT, BOOL needsHostCursor) -{ - if (supportsAbsolute) { - /* let the guest hide the software cursor */ - Mouse *gMouse = getMouse(); - gMouse->PutMouseEventAbsolute(-1, -1, 0, 0, 0); - } -} - - - - -/********************** - * Clipboard handling * - **********************/ - -struct _VBOXCLIPBOARDCONTEXT -{ - VBOXCLIPBOARDCLIENTDATA *pClient; -}; - -static VBOXCLIPBOARDCONTEXT context; - -int vboxClipboardInit (void) { return VINF_SUCCESS; } - -void vboxClipboardDestroy (void) -{ - free(decoded_clipboard_content); - clipboard_rom = nullptr; -} - -int vboxClipboardConnect (VBOXCLIPBOARDCLIENTDATA *pClient, bool fHeadless) -{ - if (!pClient || context.pClient != NULL) - return VERR_NOT_SUPPORTED; - - vboxSvcClipboardLock(); - - pClient->pCtx = &context; - pClient->pCtx->pClient = pClient; - - vboxSvcClipboardUnlock(); - - int rc = vboxClipboardSync (pClient); - - return rc; -} - -void vboxClipboardDisconnect (VBOXCLIPBOARDCLIENTDATA *pClient) -{ - if (!pClient || !pClient->pCtx) - return; - - vboxSvcClipboardLock(); - pClient->pCtx->pClient = NULL; - vboxSvcClipboardUnlock(); -} - -void vboxClipboardFormatAnnounce (VBOXCLIPBOARDCLIENTDATA *pClient, - uint32_t formats) -{ - if (!pClient) - return; - - vboxSvcClipboardReportMsg (pClient, - VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, - formats); -} - -int vboxClipboardReadData (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t format, - void *pv, uint32_t const cb, uint32_t *pcbActual) -{ - if (!clipboard_rom || format != VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT) - return VERR_NOT_SUPPORTED; - - if (!pv || !pcbActual || cb == 0) - return VERR_INVALID_PARAMETER; - - clipboard_rom->update(); - - if (!clipboard_rom->valid()) { - Genode::error("invalid clipboard dataspace"); - return VERR_NOT_SUPPORTED; - } - - char * data = clipboard_rom->local_addr(); - - try { - - Genode::Xml_node node(data); - if (!node.has_type("clipboard")) { - Genode::error("invalid clipboard xml syntax"); - return VERR_INVALID_PARAMETER; - } - - free(decoded_clipboard_content); - - decoded_clipboard_content = (char*)malloc(node.content_size()); - - if (!decoded_clipboard_content) { - Genode::error("could not allocate buffer for decoded clipboard content"); - return 0; - } - - size_t const len = node.decoded_content(decoded_clipboard_content, - node.content_size()); - size_t written = 0; - - PRTUTF16 utf16_string = reinterpret_cast(pv); - int rc = RTStrToUtf16Ex(decoded_clipboard_content, len, &utf16_string, cb, &written); - - if (RT_SUCCESS(rc)) { - if ((written * 2) + 2 > cb) - written = (cb - 2) / 2; - - /* +1 stuff required for Windows guests ... linux guest doesn't care */ - *pcbActual = (written + 1) * 2; - utf16_string[written] = 0; - } else - *pcbActual = 0; - - } catch (Genode::Xml_node::Invalid_syntax) { - Genode::error("invalid clipboard xml syntax"); - return VERR_INVALID_PARAMETER; - } - - return VINF_SUCCESS; -} - -void vboxClipboardWriteData (VBOXCLIPBOARDCLIENTDATA *pClient, void *pv, - uint32_t cb, uint32_t format) -{ - if (format != VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT || !pv || !pClient || - !clipboard_reporter) - return; - - PCRTUTF16 utf16str = reinterpret_cast(pv); - char * message = 0; - - int rc = RTUtf16ToUtf8(utf16str, &message); - - if (!RT_SUCCESS(rc) || !message) - return; - - try { - Genode::Reporter::Xml_generator xml(*clipboard_reporter, [&] () { - xml.append_sanitized(message, strlen(message)); }); - } catch (...) { - Genode::error("could not write clipboard data"); - } - - RTStrFree(message); -} - -int vboxClipboardSync (VBOXCLIPBOARDCLIENTDATA *pClient) -{ - if (!pClient) - pClient = context.pClient; - - if (!pClient) - return VERR_NOT_SUPPORTED; - - vboxSvcClipboardReportMsg (pClient, VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS, - VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT); - - return VINF_SUCCESS; -} - -/** - * Sticky key handling - */ -static bool host_caps_lock = false; -static bool guest_caps_lock = false; - -void Console::onKeyboardLedsChange(bool num_lock, bool caps_lock, bool scroll_lock) -{ - guest_caps_lock = caps_lock; -} - -void GenodeConsole::handle_sticky_keys() -{ - /* no keyboard - no sticky key handling */ - if (!_vbox_keyboard || !_caps_lock.constructed()) - return; - - _caps_lock->update(); - - if (!_caps_lock->valid()) - return; - - bool const caps_lock = _caps_lock->xml().attribute_value("enabled", - guest_caps_lock); - bool trigger_caps_lock = false; - - /* - * If guest didn't respond with led change last time, we have to - * trigger caps_lock change - mainly assuming that guest don't use the - * led to externalize its internal caps_lock state. - */ - if (caps_lock != host_caps_lock && host_caps_lock != guest_caps_lock) - trigger_caps_lock = true; - - if (caps_lock != guest_caps_lock) - trigger_caps_lock = true; - - if (trigger_caps_lock) { - _vbox_keyboard->PutScancode(Input::KEY_CAPSLOCK); - _vbox_keyboard->PutScancode(Input::KEY_CAPSLOCK | 0x80); - } -} diff --git a/repos/ports/src/virtualbox/frontend/console.h b/repos/ports/src/virtualbox/frontend/console.h deleted file mode 100644 index c2fd378d3..000000000 --- a/repos/ports/src/virtualbox/frontend/console.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * \brief Console implementation of VirtualBox for Genode - * \author Alexander Boettcher - * \author Norman Feske - * \date 2013-10-16 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* included from os/src/drivers/input/spec/ps2 */ -#include - -/* repos/ports includes */ -#include - -#include "../vmm.h" - -/* VirtualBox includes */ -#include "ConsoleImpl.h" - -class Scan_code -{ - private: - - class Converter - { - public: - - unsigned char scan_code [Input::KEY_UNKNOWN]; - unsigned char scan_code_ext [Input::KEY_UNKNOWN]; - - private: - - unsigned char _search_scan_code(Input::Keycode keycode) - { - for (unsigned i = 0; i < SCAN_CODE_SET_1_NUM_KEYS; i++) - if (scan_code_set_1[i] == keycode) - return i; - return 0; - } - - unsigned char _search_scan_code_ext(Input::Keycode keycode) - { - for (unsigned i = 0; i < SCAN_CODE_SET_1_NUM_KEYS; i++) - if (scan_code_set_1_0xe0[i] == keycode) - return i; - return 0; - } - - public: - - Converter() - { - init_scan_code_set_1_0xe0(); - - for (unsigned i = 0; i < Input::KEY_UNKNOWN; i++) { - scan_code [i] = _search_scan_code ((Input::Keycode)i); - scan_code_ext [i] = _search_scan_code_ext((Input::Keycode)i); - } - } - }; - - static Converter &converter() - { - static Converter inst; - return inst; - } - - Input::Keycode _keycode; - - public: - - Scan_code(Input::Keycode keycode) : _keycode(keycode) { } - - bool normal() const { return converter().scan_code[_keycode]; } - - bool valid() const - { - return normal() || ext(); - } - - unsigned char code() const - { - return converter().scan_code[_keycode]; - } - - unsigned char ext() const - { - return converter().scan_code_ext[_keycode]; - } -}; - - -class GenodeConsole : public Console { - - private: - - Input::Connection _input; - unsigned _ax, _ay; - bool _last_received_motion_event_was_absolute; - Report::Connection _shape_report_connection; - Genode::Attached_dataspace _shape_report_ds; - Genode::Constructible _caps_lock; - Pointer::Shape_report *_shape_report; - Genode::Reporter *_clipboard_reporter; - Genode::Attached_rom_dataspace *_clipboard_rom; - IKeyboard *_vbox_keyboard; - IMouse *_vbox_mouse; - Genode::Signal_handler _input_signal_dispatcher; - Genode::Signal_handler _mode_change_signal_dispatcher; - Genode::Signal_handler _clipboard_signal_dispatcher; - Genode::Signal_handler _input_sticky_keys_dispatcher; - - bool _key_status[Input::KEY_MAX + 1]; - - static bool _mouse_button(Input::Keycode keycode) - { - return keycode == Input::BTN_LEFT - || keycode == Input::BTN_RIGHT - || keycode == Input::BTN_MIDDLE; - } - - public: - - GenodeConsole() - : - Console(), - _input(genode_env()), - _ax(0), _ay(0), - _last_received_motion_event_was_absolute(false), - _shape_report_connection(genode_env(), "shape", - sizeof(Pointer::Shape_report)), - _shape_report_ds(genode_env().rm(), _shape_report_connection.dataspace()), - _shape_report(_shape_report_ds.local_addr()), - _clipboard_reporter(nullptr), - _clipboard_rom(nullptr), - _vbox_keyboard(0), - _vbox_mouse(0), - _input_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_input), - _mode_change_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_mode_change), - _clipboard_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_cb_rom_change), - _input_sticky_keys_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_sticky_keys) - { - for (unsigned i = 0; i <= Input::KEY_MAX; i++) - _key_status[i] = 0; - - _input.sigh(_input_signal_dispatcher); - - Genode::Attached_rom_dataspace config(genode_env(), "config"); - - /* by default we take the capslock key from the input stream */ - Genode::String<10> capslock("input"); - if (config.xml().attribute_value("capslock", capslock) == "ROM") { - _caps_lock.construct(genode_env(), "capslock"); - _caps_lock->sigh(_input_sticky_keys_dispatcher); - } - } - - void init_clipboard(); - - void init_backends(IKeyboard * gKeyboard, IMouse * gMouse); - - void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, - BOOL supportsMT, BOOL needsHostCursor); - - void onMousePointerShapeChange(bool fVisible, bool fAlpha, - uint32_t xHot, uint32_t yHot, - uint32_t width, uint32_t height, - ComSafeArrayIn(BYTE,pShape)) - { - com::SafeArray shape_array(ComSafeArrayInArg(pShape)); - - if (fVisible && ((width == 0) || (height == 0))) - return; - - _shape_report->visible = fVisible; - _shape_report->x_hot = xHot; - _shape_report->y_hot = yHot; - _shape_report->width = width; - _shape_report->height = height; - - unsigned int and_mask_size = (_shape_report->width + 7) / 8 * - _shape_report->height; - - unsigned char *and_mask = shape_array.raw(); - - unsigned char *shape = and_mask + ((and_mask_size + 3) & ~3); - - size_t shape_size = shape_array.size() - (shape - and_mask); - - if (shape_size > Pointer::MAX_SHAPE_SIZE) { - Genode::error(__func__, ": shape data buffer is too small " - "for ", shape_size, " bytes"); - return; - } - - Genode::memcpy(_shape_report->shape, - shape, - shape_size); - - if (fVisible && !fAlpha) { - - for (unsigned int i = 0; i < width * height; i++) { - - unsigned int *color = - &((unsigned int*)_shape_report->shape)[i]; - - /* heuristic from VBoxSDL.cpp */ - - if (and_mask[i / 8] & (1 << (7 - (i % 8)))) { - - if (*color & 0x00ffffff) - *color = 0xff000000; - else - *color = 0x00000000; - - } else - *color |= 0xff000000; - } - } - - _shape_report_connection.submit(sizeof(Pointer::Shape_report)); - } - - void update_video_mode(); - - void handle_input(); - void handle_mode_change(); - void handle_cb_rom_change(); - void handle_sticky_keys(); -}; diff --git a/repos/ports/src/virtualbox/frontend/dummy/autostart.cc b/repos/ports/src/virtualbox/frontend/dummy/autostart.cc deleted file mode 100644 index b75420939..000000000 --- a/repos/ports/src/virtualbox/frontend/dummy/autostart.cc +++ /dev/null @@ -1,17 +0,0 @@ -#include "VirtualBoxBase.h" - -#include "dummy/macros.h" - -#include "AutostartDb.h" - -static bool debug = false; - - -int AutostartDb::addAutostartVM(const char *pszVMId) DUMMY(-1) -int AutostartDb::addAutostopVM(char const*) DUMMY(-1) -int AutostartDb::removeAutostopVM(char const*) DUMMY(-1) -int AutostartDb::removeAutostartVM(char const*) DUMMY(-1) - -AutostartDb::AutostartDb() TRACE() -AutostartDb::~AutostartDb() DUMMY() -int AutostartDb::setAutostartDbPath(char const*path) TRACE(VINF_SUCCESS) diff --git a/repos/ports/src/virtualbox/frontend/dummy/errorinfo.cc b/repos/ports/src/virtualbox/frontend/dummy/errorinfo.cc deleted file mode 100644 index b8e1a783a..000000000 --- a/repos/ports/src/virtualbox/frontend/dummy/errorinfo.cc +++ /dev/null @@ -1,14 +0,0 @@ -#include "VirtualBoxBase.h" - -#include "dummy/macros.h" - -#include - -static bool debug = false; - - -void ErrorInfo::init(bool aKeepObj) TRACE() -void ErrorInfo::cleanup() TRACE() -HRESULT ErrorInfoKeeper::restore() TRACE(S_OK) - -void ErrorInfo::copyFrom(const ErrorInfo &x) DUMMY() diff --git a/repos/ports/src/virtualbox/frontend/dummy/host.cc b/repos/ports/src/virtualbox/frontend/dummy/host.cc deleted file mode 100644 index 98500cbbe..000000000 --- a/repos/ports/src/virtualbox/frontend/dummy/host.cc +++ /dev/null @@ -1,128 +0,0 @@ -#include "VirtualBoxBase.h" - -#include - -#include "dummy/macros.h" - -#include "HostImpl.h" - -static bool debug = false; - - -STDMETHODIMP Host::COMGETTER(DVDDrives)(ComSafeArrayOut(IMedium *, drives)) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(FloppyDrives)(ComSafeArrayOut(IMedium *, drives)) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(USBDevices)(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices)) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(USBDeviceFilters)(ComSafeArrayOut(IHostUSBDeviceFilter *, aUSBDeviceFilters)) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(NetworkInterfaces)(ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces)) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(NameServers)(ComSafeArrayOut(BSTR, aNameServers)) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(DomainName)(BSTR *aDomainName) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(SearchStrings)(ComSafeArrayOut(BSTR, aSearchStrings)) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(ProcessorCount)(ULONG *count) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(ProcessorOnlineCount)(ULONG *count) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(ProcessorCoreCount)(ULONG *count) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(ProcessorOnlineCoreCount)(ULONG *count) DUMMY(E_FAIL) -STDMETHODIMP Host::GetProcessorSpeed(ULONG cpuId, ULONG *speed) DUMMY(E_FAIL) -STDMETHODIMP Host::GetProcessorDescription(ULONG cpuId, BSTR *description) DUMMY(E_FAIL) -STDMETHODIMP Host::GetProcessorCPUIDLeaf(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(MemorySize)(ULONG *size) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(MemoryAvailable)(ULONG *available) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(OperatingSystem)(BSTR *os) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(OSVersion)(BSTR *version) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(UTCTime)(LONG64 *aUTCTime) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(Acceleration3DAvailable)(BOOL *aSupported) DUMMY(E_FAIL) -STDMETHODIMP Host::COMGETTER(VideoInputDevices)(ComSafeArrayOut(IHostVideoInputDevice*, aVideoInputDevices)) DUMMY(E_FAIL) - - // IHost methods -STDMETHODIMP Host::CreateHostOnlyNetworkInterface(IHostNetworkInterface **aHostNetworkInterface, - IProgress **aProgress) DUMMY(E_FAIL) -STDMETHODIMP Host::RemoveHostOnlyNetworkInterface(IN_BSTR aId, IProgress **aProgress) DUMMY(E_FAIL) -STDMETHODIMP Host::CreateUSBDeviceFilter(IN_BSTR aName, IHostUSBDeviceFilter **aFilter) DUMMY(E_FAIL) -STDMETHODIMP Host::InsertUSBDeviceFilter(ULONG aPosition, IHostUSBDeviceFilter *aFilter) DUMMY(E_FAIL) -STDMETHODIMP Host::RemoveUSBDeviceFilter(ULONG aPosition) DUMMY(E_FAIL) - -STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IMedium **aDrive) DUMMY(E_FAIL) -STDMETHODIMP Host::FindHostFloppyDrive(IN_BSTR aName, IMedium **aDrive) DUMMY(E_FAIL) -STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR aName, IHostNetworkInterface **networkInterface) DUMMY(E_FAIL) -STDMETHODIMP Host::FindHostNetworkInterfaceById(IN_BSTR id, IHostNetworkInterface **networkInterface) DUMMY(E_FAIL) -STDMETHODIMP Host::FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_T type, ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces)) DUMMY(E_FAIL) -STDMETHODIMP Host::FindUSBDeviceByAddress(IN_BSTR aAddress, IHostUSBDevice **aDevice) DUMMY(E_FAIL) -STDMETHODIMP Host::FindUSBDeviceById(IN_BSTR aId, IHostUSBDevice **aDevice) DUMMY(E_FAIL) -STDMETHODIMP Host::GenerateMACAddress(BSTR *aAddress) DUMMY(E_FAIL) - -HRESULT Host::findHostDriveByName(DeviceType_T mediumType, - const Utf8Str &strLocationFull, - bool fRefresh, - ComObjPtr &pMedium) DUMMY(E_FAIL) - -HRESULT Host::findHostDriveById(DeviceType_T, com::Guid const&, bool, - ComObjPtr&) TRACE(VBOX_E_OBJECT_NOT_FOUND) - -HRESULT Host::saveSettings(settings::Host&) TRACE(S_OK) - -HRESULT Host::init(VirtualBox *aParent) TRACE(S_OK) -HRESULT Host::loadSettings(const settings::Host &) TRACE(S_OK) -HRESULT Host::FinalConstruct() TRACE(S_OK) -void Host::FinalRelease() DUMMY() -void Host::uninit() DUMMY() - -void Host::generateMACAddress(Utf8Str &mac) -{ - static unsigned counter = 1; - - mac = Utf8StrFmt("080027%06X", counter++); - - TRACE(); -} - -HRESULT Host::GetProcessorFeature(ProcessorFeature_T feature, BOOL *supported) -{ - CheckComArgOutPointerValid(supported); - - switch (feature) - { - case ProcessorFeature_HWVirtEx: - *supported = true; - break; - case ProcessorFeature_PAE: - *supported = true; - break; - case ProcessorFeature_LongMode: - *supported = (sizeof(void *) > 4); - break; - case ProcessorFeature_NestedPaging: - *supported = true; - break; - default: - return setError(E_INVALIDARG, tr("The feature value is out of range.")); - } - return S_OK; -} - -HRESULT Host::getDrives(DeviceType_T, bool, MediaList*&, util::AutoWriteLock&) DUMMY(E_FAIL) -HRESULT Host::findHostDriveByNameOrId(DeviceType_T, const com::Utf8Str&, - ComObjPtr&) DUMMY(E_FAIL) -HRESULT Host::buildDVDDrivesList(MediaList &list) DUMMY(E_FAIL) -HRESULT Host::buildFloppyDrivesList(MediaList &list) DUMMY(E_FAIL) - -#ifdef VBOX_WITH_USB -USBProxyService* Host::usbProxyService() -{ - TRACE(nullptr) -} - -HRESULT Host::addChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL) -HRESULT Host::removeChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL) -VirtualBox* Host::parent() DUMMY(nullptr) - -HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *, BOOL) DUMMY(E_FAIL) - -void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters) DUMMY() - -HRESULT Host::checkUSBProxyService() TRACE(S_OK) - -#include "HostUSBDeviceImpl.h" -#include "USBDeviceFilterImpl.h" - -bool HostUSBDevice::isMatch(const USBDeviceFilter::Data &aData) DUMMY(false) - -#endif diff --git a/repos/ports/src/virtualbox/frontend/dummy/macros.h b/repos/ports/src/virtualbox/frontend/dummy/macros.h deleted file mode 100644 index 77121bbb7..000000000 --- a/repos/ports/src/virtualbox/frontend/dummy/macros.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef ____H_MACROS -#define ____H_MACROS - -#include - -#define TRACE(X) \ - { \ - if (debug) \ - Genode::log(__func__, " called (", __FILE__, ") - eip=", \ - __builtin_return_address(0)); \ - return X; \ - } - -#define DUMMY(X) \ - { \ - Genode::error(__func__, " called (", __FILE__, ":", __LINE__, "), " \ - "not implemented, eip=", \ - __builtin_return_address(0)); \ - while (1) \ - asm volatile ("ud2a"); \ - \ - return X; \ - } - -#define DUMMY_STATIC(X) \ - { \ - static X dummy; \ - Genode::error(__func__, " called (", __FILE__, "), " \ - "not implemented, eip=", \ - __builtin_return_address(0)); \ - while (1) \ - asm volatile ("ud2a"); \ - \ - return dummy; \ - } - -#endif /* ____H_MACROS */ diff --git a/repos/ports/src/virtualbox/frontend/dummy/rest.cc b/repos/ports/src/virtualbox/frontend/dummy/rest.cc deleted file mode 100644 index bcf8f3bfe..000000000 --- a/repos/ports/src/virtualbox/frontend/dummy/rest.cc +++ /dev/null @@ -1,252 +0,0 @@ -#include "dummy/macros.h" - -static bool debug = false; - - -/* ApplianceImplExport.cpp */ - -#include "MachineImpl.h" - -HRESULT Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, - IVirtualSystemDescription **aDescription) DUMMY(E_FAIL) - - -/* com.cpp */ - -#include "VBox/com/Guid.h" - -const com::Guid com::Guid::Empty; - - -/* DisplayImpl.cpp */ - -#include "DisplayImpl.h" - -void fireGuestMonitorChangedEvent(IEventSource* aSource, - GuestMonitorChangedEventType_T a_changeType, - ULONG a_screenId, - ULONG a_originX, - ULONG a_originY, - ULONG a_width, - ULONG a_height) TRACE() - - -/* DisplayPNGUtil.cpp */ - -#include "DisplayImpl.h" - -int DisplayMakePNG(uint8_t *, uint32_t, uint32_t, uint8_t **, uint32_t *, - uint32_t *, uint32_t *, uint8_t) DUMMY(-1) - - -/* ErrorInfo.cpp */ - -#include "VBox/com/ErrorInfo.h" - -com::ProgressErrorInfo::ProgressErrorInfo(IProgress*) DUMMY() - - -/* EventImpl.cpp */ - -#include "EventImpl.h" - -HRESULT VBoxEventDesc::init(IEventSource* aSource, VBoxEventType_T aType, ...) TRACE(S_OK) -HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...) TRACE(S_OK) - - -/* GuestCtrlImpl.cpp */ - -#include "GuestImpl.h" - -STDMETHODIMP Guest::CreateSession(IN_BSTR, IN_BSTR, IN_BSTR, IN_BSTR, - IGuestSession **) DUMMY(E_FAIL) -STDMETHODIMP Guest::FindSession(IN_BSTR, - ComSafeArrayOut(IGuestSession *, aSessions)) DUMMY(E_FAIL) -STDMETHODIMP Guest::UpdateGuestAdditions(IN_BSTR, - ComSafeArrayIn(IN_BSTR, aArguments), - ComSafeArrayIn(AdditionsUpdateFlag_T, aFlags), - IProgress **aProgress) DUMMY(E_FAIL) - - -/* initterm.cpp */ - -#include "VBox/com/com.h" - -HRESULT com::Initialize(bool fGui) TRACE(S_OK) -HRESULT com::Shutdown() DUMMY(E_FAIL) - - -/* MachineImpl.cpp */ - -#include "MachineImpl.h" - -void fireHostPCIDevicePlugEvent(IEventSource* aSource, - CBSTR a_machineId, - BOOL a_plugged, - BOOL a_success, - IPCIDeviceAttachment* a_attachment, - CBSTR a_message) TRACE() - -/* NATNetworkImpl.cpp */ - -#include "NetworkServiceRunner.h" -#include "NATNetworkImpl.h" - -NATNetwork::NATNetwork() : mVirtualBox(nullptr) DUMMY() -NATNetwork::~NATNetwork() DUMMY() -STDMETHODIMP NATNetwork::COMGETTER(EventSource)(IEventSource **IEventSource) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(Enabled)(BOOL *aEnabled) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMSETTER(Enabled)(BOOL aEnabled) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(NetworkName)(BSTR *aName) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMSETTER(NetworkName)(IN_BSTR aName) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(Gateway)(BSTR *aIPGateway) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(Network)(BSTR *aIPNetwork) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMSETTER(Network)(IN_BSTR aIPNetwork) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(IPv6Enabled)(BOOL *aEnabled) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMSETTER(IPv6Enabled)(BOOL aEnabled) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(IPv6Prefix)(BSTR *aName) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMSETTER(IPv6Prefix)(IN_BSTR aName) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(AdvertiseDefaultIPv6RouteEnabled)(BOOL *aEnabled) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMSETTER(AdvertiseDefaultIPv6RouteEnabled)(BOOL aEnabled) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(NeedDhcpServer)(BOOL *aEnabled) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMSETTER(NeedDhcpServer)(BOOL aEnabled) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(LocalMappings)(ComSafeArrayOut(BSTR, aLocalMappings)) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::AddLocalMapping(IN_BSTR aHostId, LONG aOffset) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(LoopbackIp6)(LONG *aLoopbackIp6) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMSETTER(LoopbackIp6)(LONG aLoopbackIp6) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(PortForwardRules4)(ComSafeArrayOut(BSTR, aPortForwardRules4)) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::COMGETTER(PortForwardRules6)(ComSafeArrayOut(BSTR, aPortForwardRules6)) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::AddPortForwardRule(BOOL aIsIpv6, - IN_BSTR aPortForwardRuleName, - NATProtocol_T aProto, - IN_BSTR aHostIp, - USHORT aHostPort, - IN_BSTR aGuestIp, - USHORT aGuestPort) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::RemovePortForwardRule(BOOL aIsIpv6, IN_BSTR aPortForwardRuleName) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::Start(IN_BSTR aTrunkType) DUMMY(E_FAIL) -STDMETHODIMP NATNetwork::Stop() DUMMY(E_FAIL) -HRESULT NATNetwork::init(VirtualBox *aVirtualBox, const settings::NATNetwork &) DUMMY(E_FAIL) -HRESULT NATNetwork::FinalConstruct() DUMMY(E_FAIL) -void NATNetwork::uninit() DUMMY() - - -/* ProgressProxyImpl.cpp */ - -#include "ProgressProxyImpl.h" - -STDMETHODIMP ProgressProxy::Cancel() DUMMY(E_FAIL) -void ProgressProxy::clearOtherProgressObjectInternal(bool fEarly) DUMMY() -STDMETHODIMP ProgressProxy::COMGETTER(Cancelable)(BOOL *) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(Percent)(ULONG *) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(TimeRemaining)(LONG *) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(Completed)(BOOL *) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(Canceled)(BOOL *) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(ResultCode)(LONG *) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(ErrorInfo)(IVirtualBoxErrorInfo **) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(Operation)(ULONG *) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(OperationDescription)(BSTR *) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(OperationPercent)(ULONG *) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMSETTER(Timeout)(ULONG) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::COMGETTER(Timeout)(ULONG *) DUMMY(E_FAIL) -void ProgressProxy::copyProgressInfo(IProgress *pOtherProgress, bool fEarly) DUMMY() -HRESULT ProgressProxy::FinalConstruct() DUMMY(E_FAIL) -void ProgressProxy::FinalRelease() DUMMY() -HRESULT ProgressProxy::init(VirtualBox*, IUnknown*, unsigned short const*, - bool) DUMMY(E_FAIL) -HRESULT ProgressProxy::init(VirtualBox*, void*, unsigned short const*, bool, - unsigned int, unsigned short const*, unsigned int, - unsigned int) DUMMY(E_FAIL) -HRESULT ProgressProxy::notifyComplete(HRESULT) DUMMY(E_FAIL) -HRESULT ProgressProxy::notifyComplete(HRESULT, GUID const&, char const*, - char const*, ...) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::SetCurrentOperationProgress(ULONG aPercent) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::SetNextOperation(IN_BSTR, ULONG) DUMMY(E_FAIL) -bool ProgressProxy::setOtherProgressObject(IProgress*) DUMMY(false) -void ProgressProxy::uninit() DUMMY() -STDMETHODIMP ProgressProxy::WaitForCompletion(LONG aTimeout) DUMMY(E_FAIL) -STDMETHODIMP ProgressProxy::WaitForOperationCompletion(ULONG, LONG) DUMMY(E_FAIL) - - -/* SharedFolderImpl.cpp */ - -#include "SharedFolderImpl.h" - -HRESULT SharedFolder::init(Console*, com::Utf8Str const&, com::Utf8Str const&, - bool, bool, bool) DUMMY(E_FAIL) - - -/* USBFilter.cpp */ - -#include "VBox/usbfilter.h" - -USBFILTERMATCH USBFilterGetMatchingMethod(PCUSBFILTER, USBFILTERIDX) DUMMY(USBFILTERMATCH_INVALID) -int USBFilterGetNum(PCUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(-1) -const char * USBFilterGetString(PCUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(nullptr) -void USBFilterInit(PUSBFILTER pFilter, USBFILTERTYPE enmType) DUMMY() -bool USBFilterIsMethodNumeric(USBFILTERMATCH enmMatchingMethod) DUMMY(false) -bool USBFilterIsMethodString(USBFILTERMATCH enmMatchingMethod) DUMMY(false) -bool USBFilterIsNumericField(USBFILTERIDX enmFieldIdx) DUMMY(false) -bool USBFilterIsStringField(USBFILTERIDX enmFieldIdx) DUMMY(false) -bool USBFilterMatch(PCUSBFILTER pFilter, PCUSBFILTER pDevice) DUMMY(false) -int USBFilterSetIgnore(PUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(-1) -int USBFilterSetNumExact(PUSBFILTER, USBFILTERIDX, uint16_t, bool) DUMMY(-1) -int USBFilterSetNumExpression(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1) -int USBFilterSetStringExact(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1) -int USBFilterSetStringPattern(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1) - - -/* USBProxyService.cpp */ - -#include "USBProxyService.h" - -HRESULT USBProxyService::autoCaptureDevicesForVM(SessionMachine *) DUMMY(E_FAIL) -HRESULT USBProxyService::captureDeviceForVM(SessionMachine *, IN_GUID) DUMMY(E_FAIL) -HRESULT USBProxyService::detachAllDevicesFromVM(SessionMachine*, bool, bool) DUMMY(E_FAIL) -HRESULT USBProxyService::detachDeviceFromVM(SessionMachine*, IN_GUID, bool) DUMMY(E_FAIL) - - -/* VirtualBoxImpl.cpp */ - -#include "VirtualBoxImpl.h" - -void fireNATRedirectEvent(IEventSource* aSource, - CBSTR a_machineId, - ULONG a_slot, - BOOL a_remove, - CBSTR a_name, - NATProtocol_T a_proto, - CBSTR a_hostIP, - LONG a_hostPort, - CBSTR a_guestIP, - LONG a_guestPort) TRACE() - -void fireNATNetworkChangedEvent(IEventSource* aSource, - CBSTR a_networkName) TRACE() - -void fireNATNetworkStartStopEvent(IEventSource* aSource, - CBSTR a_networkName, - BOOL a_startEvent) TRACE() - -void fireNATNetworkSettingEvent(IEventSource* aSource, - CBSTR a_networkName, - BOOL a_enabled, - CBSTR a_network, - CBSTR a_gateway, - BOOL a_advertiseDefaultIPv6RouteEnabled, - BOOL a_needDhcpServer) TRACE() - -void fireNATNetworkPortForwardEvent(IEventSource* aSource, - CBSTR a_networkName, - BOOL a_create, - BOOL a_ipv6, - CBSTR a_name, - NATProtocol_T a_proto, - CBSTR a_hostIp, - LONG a_hostPort, - CBSTR a_guestIp, - LONG a_guestPort) TRACE() - -void fireHostNameResolutionConfigurationChangeEvent(IEventSource* aSource) TRACE() - -void fireMediumChangedEvent(IEventSource *, IMediumAttachment *) DUMMY() diff --git a/repos/ports/src/virtualbox/frontend/dummy/virtualboxbase.cc b/repos/ports/src/virtualbox/frontend/dummy/virtualboxbase.cc deleted file mode 100644 index cb62bc50b..000000000 --- a/repos/ports/src/virtualbox/frontend/dummy/virtualboxbase.cc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#include "VirtualBoxImpl.h" -#include "VBox/com/MultiResult.h" - -#include "dummy/macros.h" - -static bool debug = false; - -HRESULT VirtualBoxBase::setError(HRESULT aResultCode, const char *pcsz, ...) -{ - va_list list; - va_start(list, pcsz); - - Genode::error(this->getComponentName(), " : ", Utf8Str(pcsz, list).c_str()); - - va_end(list); - - TRACE(aResultCode); -} - -HRESULT VirtualBox::CreateAppliance(IAppliance**) DUMMY(E_FAIL) - -void VirtualBoxBase::clearError() TRACE() -HRESULT VirtualBoxBase::setError(HRESULT aResultCode) DUMMY(E_FAIL) -HRESULT VirtualBoxBase::setError(const com::ErrorInfo &ei) DUMMY(E_FAIL) -HRESULT VirtualBoxBase::handleUnexpectedExceptions(VirtualBoxBase *const, - RT_SRC_POS_DECL) TRACE(E_FAIL) -HRESULT VirtualBoxBase::setErrorInternal(HRESULT, GUID const&, char const*, - com::Utf8Str, bool, bool) DUMMY(E_FAIL) -HRESULT VirtualBoxBase::initializeComForThread(void) TRACE(S_OK) -void VirtualBoxBase::uninitializeComForThread(void) TRACE() diff --git a/repos/ports/src/virtualbox/frontend/fb.h b/repos/ports/src/virtualbox/frontend/fb.h deleted file mode 100644 index bc2e4394f..000000000 --- a/repos/ports/src/virtualbox/frontend/fb.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * \brief Virtualbox framebuffer implementation for Genode - * \author Alexander Boettcher - * \date 2013-10-16 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#define Framebuffer Fb_Genode -#include -#undef Framebuffer - -/* VirtualBox includes */ - -#include "Global.h" -#include "VirtualBoxBase.h" - -class Genodefb : - VBOX_SCRIPTABLE_IMPL(IFramebuffer) -{ - private: - - Genode::Env &_env; - Fb_Genode::Connection _fb; - - /* The mode matching the currently attached dataspace */ - Fb_Genode::Mode _fb_mode; - - /* The mode at the time when the mode change signal was received */ - Fb_Genode::Mode _next_fb_mode; - - /* - * The mode currently used by the VM. Can be smaller than the - * framebuffer mode. - */ - Fb_Genode::Mode _virtual_fb_mode; - - void *_fb_base; - RTCRITSECT _fb_lock; - - void _clear_screen() - { - size_t const num_pixels = _fb_mode.width() * _virtual_fb_mode.height(); - memset(_fb_base, 0, num_pixels * _fb_mode.bytes_per_pixel()); - _fb.refresh(0, 0, _virtual_fb_mode.width(), _virtual_fb_mode.height()); - } - - public: - - Genodefb (Genode::Env &env) - : - _env(env), - _fb(env, Fb_Genode::Mode(0, 0, Fb_Genode::Mode::INVALID)), - _fb_mode(_fb.mode()), - _next_fb_mode(_fb_mode), - _virtual_fb_mode(_fb_mode), - _fb_base(env.rm().attach(_fb.dataspace())) - { - int rc = RTCritSectInit(&_fb_lock); - Assert(rc == VINF_SUCCESS); - } - - /* Return the next mode of the framebuffer */ - int w() const { return _next_fb_mode.width(); } - int h() const { return _next_fb_mode.height(); } - - void mode_sigh(Genode::Signal_context_capability sigh) - { - _fb.mode_sigh(sigh); - } - - void update_mode() - { - Lock(); - _next_fb_mode = _fb.mode(); - Unlock(); - } - - STDMETHODIMP COMGETTER(Width)(ULONG *width) - { - if (!width) - return E_INVALIDARG; - - *width = _virtual_fb_mode.width(); - - return S_OK; - } - - STDMETHODIMP COMGETTER(Height)(ULONG *height) - { - if (!height) - return E_INVALIDARG; - - *height = _virtual_fb_mode.height(); - - return S_OK; - } - - STDMETHODIMP Lock() - { - return Global::vboxStatusCodeToCOM(RTCritSectEnter(&_fb_lock)); - } - - STDMETHODIMP Unlock() - { - return Global::vboxStatusCodeToCOM(RTCritSectLeave(&_fb_lock)); - } - - STDMETHODIMP COMGETTER(Address)(BYTE **addr) - { - *addr = reinterpret_cast(_fb_base); - return S_OK; - } - - STDMETHODIMP COMGETTER(BitsPerPixel)(ULONG *bits) - { - if (!bits) - return E_INVALIDARG; - - *bits = _virtual_fb_mode.bytes_per_pixel() * 8; - - return S_OK; - } - - STDMETHODIMP COMGETTER(BytesPerLine)(ULONG *line) - { - *line = _fb_mode.width() * _fb_mode.bytes_per_pixel(); - return S_OK; - } - - HRESULT NotifyUpdate(ULONG x, ULONG y, ULONG w, ULONG h) - { - _fb.refresh(x, y, w, h); - return S_OK; - } - - STDMETHODIMP RequestResize(ULONG aScreenId, ULONG pixelFormat, - BYTE *vram, ULONG bitsPerPixel, - ULONG bytesPerLine, ULONG w, ULONG h, - BOOL *finished) - { - HRESULT result = E_FAIL; - - Lock(); - - bool ok = (w <= (ULONG)_next_fb_mode.width()) && - (h <= (ULONG)_next_fb_mode.height()); - - if (ok) { - Genode::log("fb resize : ", _virtual_fb_mode.width(), - "x", _virtual_fb_mode.height(), "@", - _virtual_fb_mode.bytes_per_pixel() * 8, " -> ", - w, "x", h, "@", bitsPerPixel); - - if ((w < (ULONG)_next_fb_mode.width()) || - (h < (ULONG)_next_fb_mode.height())) { - /* clear the old content around the new, smaller area. */ - _clear_screen(); - } - - _fb_mode = _next_fb_mode; - - _virtual_fb_mode = Fb_Genode::Mode(w, h, Fb_Genode::Mode::RGB565); - - _env.rm().detach(_fb_base); - - _fb_base = _env.rm().attach(_fb.dataspace()); - - result = S_OK; - - } else - Genode::warning("fb resize : ", _virtual_fb_mode.width(), - "x", _virtual_fb_mode.height(), "@", - _virtual_fb_mode.bytes_per_pixel() * 8, " -> ", - w, "x", h, "@", bitsPerPixel, " ignored"); - - *finished = true; - - Unlock(); - - return result; - } - - STDMETHODIMP COMGETTER(PixelFormat) (ULONG *format) - { - if (!format) - return E_POINTER; - - *format = FramebufferPixelFormat_Opaque; - return S_OK; - } - - STDMETHODIMP COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM) - { - if (!usesGuestVRAM) - return E_POINTER; - - *usesGuestVRAM = FALSE; - return S_OK; - } - - STDMETHODIMP COMGETTER(HeightReduction) (ULONG *reduce) - { - *reduce = 0; - return S_OK; - } - - STDMETHODIMP COMGETTER(Overlay) (IFramebufferOverlay **aOverlay) - { - Assert(!"FixMe"); - return S_OK; - } - - STDMETHODIMP COMGETTER(WinId) (PRInt64 *winId) - { - Assert(!"FixMe"); - return S_OK; - } - - STDMETHODIMP VideoModeSupported(ULONG width, ULONG height, ULONG bpp, BOOL *supported) - { - if (!supported) - return E_POINTER; - - *supported = ((width <= (ULONG)_next_fb_mode.width()) && - (height <= (ULONG)_next_fb_mode.height())); - - return S_OK; - } - - STDMETHODIMP GetVisibleRegion(BYTE *aRectangles, ULONG aCount, - ULONG *aCountCopied) - { - Assert(!"FixMe"); - return S_OK; - } - - STDMETHODIMP SetVisibleRegion(BYTE *aRectangles, ULONG aCount) - { - Assert(!"FixMe"); - return S_OK; - } - - STDMETHODIMP ProcessVHWACommand(BYTE *pCommand) - { - return E_NOTIMPL; - } - - STDMETHODIMP Notify3DEvent(PRUint32, PRUint8*) - { - return E_NOTIMPL; - } -}; diff --git a/repos/ports/src/virtualbox/frontend/main.cc b/repos/ports/src/virtualbox/frontend/main.cc deleted file mode 100644 index 2ade9d48d..000000000 --- a/repos/ports/src/virtualbox/frontend/main.cc +++ /dev/null @@ -1,253 +0,0 @@ -/* - * \brief Port of VirtualBox to Genode - * \author Norman Feske - * \author Alexander Boettcher - * \date 2013-08-20 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - - -/* Genode includes */ -#include -#include -#include -#include - -/* Virtualbox includes */ -#include -#include -#include -#include -#include - -/* Virtualbox includes of generic Main frontend */ -#include "ConsoleImpl.h" -#include "MachineImpl.h" -#include "MouseImpl.h" -#include "SessionImpl.h" -#include "VirtualBoxImpl.h" - -/* Genode port specific includes */ -#include "console.h" -#include "fb.h" -#include "../sup.h" - -static char c_vbox_file[128]; -static char c_vbox_vmname[128]; - -extern "C" void init_libc_vbox_logger(void); - - -/** - * xpcom style memory allocation - */ -void * nsMemory::Alloc(size_t size) -{ - return new char[size]; -} -void nsMemory::Free(void* ptr) -{ - Assert(ptr); - delete [] reinterpret_cast(ptr); -} -void *nsMemory::Realloc(void* ptr, size_t size) -{ - Assert(!"not implemented"); - return nullptr; -} -void * nsMemory::Clone(const void*, size_t) -{ - Assert(!"not implemented"); - return nullptr; -} - -/** - * Other stuff - */ - -int com::GetVBoxUserHomeDirectory(char *aDir, size_t aDirLen, bool fCreateDir) -{ - AssertReturn(aDir, VERR_INVALID_POINTER); - AssertReturn(aDirLen > 1, VERR_BUFFER_OVERFLOW); - - memcpy(aDir, "/", 1); - aDir[1] = 0; - return VINF_SUCCESS; -} - -extern "C" -RTDECL(int) RTPathUserHome(char *pszPath, size_t cchPath) -{ - return com::GetVBoxUserHomeDirectory(pszPath, cchPath); -} - - -HRESULT setupmachine(Genode::Env &env) -{ - HRESULT rc; - - static com::Utf8Str vm_config(c_vbox_file); - static com::Utf8Str vm_name(c_vbox_vmname); - - /* Machine object */ - static ComObjPtr machine; - rc = machine.createObject(); - if (FAILED(rc)) - return rc; - - /* Virtualbox object */ - static ComObjPtr virtualbox; - rc = virtualbox.createObject(); - if (FAILED(rc)) - return rc; - - rc = machine->initFromSettings(virtualbox, vm_config, nullptr); - if (FAILED(rc)) - return rc; - - rc = genode_setup_machine(machine); - if (FAILED(rc)) - return rc; - - rc = virtualbox->RegisterMachine(machine); - if (FAILED(rc)) - return rc; - - // open a session - static ComObjPtr session; - rc = session.createObject(); - if (FAILED(rc)) - return rc; - - rc = machine->LockMachine(session, LockType_VM); - if (FAILED(rc)) - return rc; - - /* Console object */ - static ComPtr gConsole; - rc = session->COMGETTER(Console)(gConsole.asOutParam()); - - /* handle input of Genode and forward it to VMM layer */ - static ComPtr genodeConsole = gConsole; - - genodeConsole->init_clipboard(); - - /* Display object */ - static ComPtr display; - rc = gConsole->COMGETTER(Display)(display.asOutParam()); - if (FAILED(rc)) - return rc; - - ULONG cMonitors = 1; - rc = machine->COMGETTER(MonitorCount)(&cMonitors); - if (FAILED(rc)) - return rc; - - unsigned uScreenId; - for (uScreenId = 0; uScreenId < cMonitors; uScreenId++) - { - Genodefb *fb = new Genodefb(env); - display->SetFramebuffer(uScreenId, fb); - } - - /* Power up the VMM */ - ComPtr progress; - rc = gConsole->PowerUp(progress.asOutParam()); - if (FAILED(rc)) - return rc; - - /* wait until VM is up */ - MachineState_T machineState = MachineState_Null; - do { - if (machineState != MachineState_Null) - RTThreadSleep(1000); - - rc = machine->COMGETTER(State)(&machineState); - } while (machineState == MachineState_Starting); - if (rc != S_OK || (machineState != MachineState_Running)) - return E_FAIL; - - /* request mouse object */ - static ComPtr gMouse; - rc = gConsole->COMGETTER(Mouse)(gMouse.asOutParam()); - if (FAILED(rc)) - return rc; - Assert (&*gMouse); - - /* request keyboard object */ - static ComPtr gKeyboard; - rc = gConsole->COMGETTER(Keyboard)(gKeyboard.asOutParam()); - if (FAILED(rc)) - return rc; - Assert (&*gKeyboard); - - genodeConsole->init_backends(gKeyboard, gMouse); - - return rc; -} - - -static Genode::Env *genode_env_ptr = nullptr; - - -Genode::Env &genode_env() -{ - struct Genode_env_ptr_uninitialized : Genode::Exception { }; - if (!genode_env_ptr) - throw Genode_env_ptr_uninitialized(); - - return *genode_env_ptr; -} - - -Genode::Allocator &vmm_heap() -{ - static Genode::Heap heap (genode_env().ram(), genode_env().rm()); - return heap; -} - - -void Libc::Component::construct(Libc::Env &env) -{ - /* make Genode environment accessible via the global 'genode_env()' */ - genode_env_ptr = &env; - - try { - using namespace Genode; - - Attached_rom_dataspace config(env, "config"); - Xml_node::Attribute vbox_file = config.xml().attribute("vbox_file"); - vbox_file.value(c_vbox_file, sizeof(c_vbox_file)); - Xml_node::Attribute vm_name = config.xml().attribute("vm_name"); - vm_name.value(c_vbox_vmname, sizeof(c_vbox_vmname)); - } catch (...) { - Genode::error("missing attributes in configuration, minimum requirements: "); - Genode::error(" " ); - throw; - } - - /* enable stdout/stderr for VBox Log infrastructure */ - init_libc_vbox_logger(); - - Libc::with_libc([&] () { - static char argv0[] = { '_', 'm', 'a', 'i', 'n', 0}; - static char *argv[1] = { argv0 }; - char **dummy_argv = argv; - - int rc = RTR3InitExe(1, &dummy_argv, 0); - if (RT_FAILURE(rc)) - throw -1; - - HRESULT hrc = setupmachine(env); - if (FAILED(hrc)) { - Genode::error("startup of VMM failed - reason ", hrc, " - exiting ..."); - throw -2; - } - }); -} diff --git a/repos/ports/src/virtualbox/guest_memory.h b/repos/ports/src/virtualbox/guest_memory.h deleted file mode 100644 index ca3a60bb0..000000000 --- a/repos/ports/src/virtualbox/guest_memory.h +++ /dev/null @@ -1,401 +0,0 @@ -/* - * \brief Registry of known guest-physical memory regions - * \author Norman Feske - * \date 2013-09-02 - * - * Contains the mapping of guest-phyiscal to VMM-local addresses. - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _GUEST_MEMORY_H_ -#define _GUEST_MEMORY_H_ - -/* Genode includes */ -#include -#include -#include -#include - -#include "vmm.h" - -/* VirtualBox includes */ -#include -#include -#include - - -class Guest_memory -{ - struct Region; - - /* - * XXX Use AVL tree instead of a linked list - */ - - typedef Genode::List Region_list; - typedef Genode::Lock Lock; - typedef Genode::addr_t addr_t; - - private: - - struct Region : Region_list::Element - { - RTGCPHYS const _GCPhys; /* guest-physical address */ - RTGCPHYS const _cb; /* size */ - void * const _pv; /* VMM-local address */ - - /* - * MMIO-specific members - */ - PPDMDEVINS const _pDevIns; - RTHCPTR const _pvUser; - PFNIOMMMIOWRITE const _pfnWriteCallback; - PFNIOMMMIOREAD const _pfnReadCallback; - PFNIOMMMIOFILL const _pfnFillCallback; - uint32_t const _fFlags; - - Region(RTGCPHYS const GCPhys, RTGCPHYS const cb, void *const pv, - PPDMDEVINS pDevIns, - RTHCPTR pvUser, - PFNIOMMMIOWRITE pfnWriteCallback, - PFNIOMMMIOREAD pfnReadCallback, - PFNIOMMMIOFILL pfnFillCallback, - uint32_t fFlags) - : - _GCPhys(GCPhys), _cb(cb), _pv(pv), - _pDevIns (pDevIns), - _pvUser (pvUser), - _pfnWriteCallback (pfnWriteCallback), - _pfnReadCallback (pfnReadCallback), - _pfnFillCallback (pfnFillCallback), - _fFlags (fFlags) - { } - - /** - * Return true if region contains specified guest-physical area - */ - bool contains(RTGCPHYS GCPhys, size_t size) const - { - return (_GCPhys <= GCPhys) && (GCPhys < _GCPhys + _cb) && - (_GCPhys + _cb - GCPhys >= size); - } - - /** - * Return true if region is disjunct to specified guest-physical area - */ - bool disjunct(RTGCPHYS GCPhys, size_t size) const - { - return (GCPhys + size - 1 < _GCPhys) || - (_GCPhys + _cb - 1 < GCPhys); - } - - /** - * Return guest-physical base address - */ - RTGCPHYS GCPhys() const { return _GCPhys; } - - /** - * Return VMM-local base address - */ - void *pv() const { return _pv; } - - void dump() const - { - Genode::log("phys ", Genode::Hex_range(_GCPhys, _cb), - " -> virt ", Genode::Hex_range((Genode::addr_t)_pv, _cb), - " (dev='", _pDevIns && _pDevIns->pReg ? _pDevIns->pReg->szName : 0, "'"); - } - - void *pv_at_offset(addr_t offset) - { - if (_pv) - return (void *)((addr_t)_pv + (addr_t)offset); - return 0; - } - - int mmio_write(RTGCPHYS GCPhys, void const *pv, unsigned cb) - { - if (!_pfnWriteCallback) - return VINF_SUCCESS; - - int rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo), - VINF_IOM_R3_MMIO_READ); - if (rc != VINF_SUCCESS) - return rc; - - rc = _pfnWriteCallback(_pDevIns, _pvUser, GCPhys, pv, cb); - - PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo)); - - return rc; - } - - int mmio_read(RTGCPHYS GCPhys, void *pv, unsigned cb) - { - if (!_pfnReadCallback) - return VINF_IOM_MMIO_UNUSED_FF; - - int rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo), - VINF_IOM_R3_MMIO_WRITE); - - rc = _pfnReadCallback(_pDevIns, _pvUser, GCPhys, pv, cb); - - PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo)); - - return rc; - } - - bool simple_mmio_write(RTGCPHYS vm_phys, unsigned cb) - { - /* adhere to original IOMMIOWrite check */ - return (cb == 4 && !(vm_phys & 3)) || - ((_fFlags & IOMMMIO_FLAGS_WRITE_MODE) == IOMMMIO_FLAGS_WRITE_PASSTHRU) || - (cb == 8 && !(vm_phys & 7) && IOMMMIO_DOES_WRITE_MODE_ALLOW_QWORD(_fFlags)); - } - - bool simple_mmio_read(RTGCPHYS vm_phys, unsigned cb) - { - /* adhere to original IOMMIORead check */ - return (cb == 4 && !(vm_phys & 3)) || - ((_fFlags & IOMMMIO_FLAGS_READ_MODE) == IOMMMIO_FLAGS_READ_PASSTHRU) || - (cb == 8 && !(vm_phys & 7) && (_fFlags & IOMMMIO_FLAGS_READ_MODE) == IOMMMIO_FLAGS_READ_DWORD_QWORD); - } - }; - - Lock _lock; - Region_list _ram_regions; - Region_list _rom_regions; - Region_list _mmio_regions; - - static Region *_lookup(RTGCPHYS GCPhys, Region_list ®ions, size_t size) - { - using Genode::addr_t; - - for (Region *r = regions.first(); r; r = r->next()) - if (r->contains(GCPhys, size)) - return r; - - return 0; - } - - static bool _overlap(RTGCPHYS GCPhys, size_t size, - Region_list ®ions) - { - using Genode::addr_t; - - for (Region *r = regions.first(); r; r = r->next()) - { - if (r->disjunct(GCPhys, size)) - continue; - - return true; - } - - return false; - } - - /** - * \return looked-up region, or 0 if lookup failed - */ - Region *_lookup(RTGCPHYS GCPhys, size_t size) - { - using Genode::addr_t; - - /* - * ROM regions may alias RAM regions. For the lookup, always - * consider ROM regions first. - */ - - if (Region *r = _lookup(GCPhys, _rom_regions, size)) - return r; - - if (Region *r = _lookup(GCPhys, _mmio_regions, size)) - return r; - - if (Region *r = _lookup(GCPhys, _ram_regions, size)) - return r; - - return 0; - } - - public: - - class Region_conflict { }; - - /** - * \throw Region_conflict - */ - void add_ram_mapping(RTGCPHYS const GCPhys, RTGCPHYS const cb, void * const pv) - { - /* - * XXX check for overlapping regions - */ - _ram_regions.insert(new (vmm_heap()) - Region(GCPhys, cb, pv, 0, 0, 0, 0, 0, 0)); - } - - /** - * \throw Region_conflict - */ - void add_rom_mapping(RTGCPHYS const GCPhys, RTGCPHYS const cb, - void const * const pv, PPDMDEVINS pDevIns) - { - /* - * XXX check for overlapping regions - */ - _rom_regions.insert(new (vmm_heap()) - Region(GCPhys, cb, - (void *)pv, pDevIns, 0, 0, 0, 0, 0)); - } - - /** - * \throw Region_conflict - */ - void add_mmio_mapping(RTGCPHYS const GCPhys, RTGCPHYS const cb, - PPDMDEVINS pDevIns, - RTHCPTR pvUser, - PFNIOMMMIOWRITE pfnWriteCallback, - PFNIOMMMIOREAD pfnReadCallback, - PFNIOMMMIOFILL pfnFillCallback, - uint32_t fFlags) - { - /* - * XXX check for overlapping regions - */ - _mmio_regions.insert(new (vmm_heap()) - Region(GCPhys, cb, 0, - pDevIns, pvUser, pfnWriteCallback, - pfnReadCallback, pfnFillCallback, fFlags)); - } - - - bool remove_mmio_mapping(RTGCPHYS const GCPhys, RTGCPHYS const size) - { - Region *r = _lookup(GCPhys, _mmio_regions, size); - if (!r) - return false; - - _mmio_regions.remove(r); - delete r; - return true; - } - - - void dump() const - { - Genode::log("guest-physical to VMM-local RAM mappings:"); - for (Region const *r = _ram_regions.first(); r; r = r->next()) - r->dump(); - - Genode::log("guest-physical to VMM-local ROM mappings:"); - for (Region const *r = _rom_regions.first(); r; r = r->next()) - r->dump(); - - Genode::log("guest-physical MMIO regions:"); - for (Region const *r = _mmio_regions.first(); r; r = r->next()) - r->dump(); - } - - /** - * \return looked-up VMM-local address, or 0 if lookup failed - */ - void *lookup(RTGCPHYS GCPhys, size_t size) - { - Region *r = _lookup(GCPhys, size); - if (!r) - return 0; - - return r->pv_at_offset(GCPhys - r->GCPhys()); - } - - /** - * \return looked-up VMM-local address if Guest address is RAM - */ - void *lookup_ram(RTGCPHYS const GCPhys, size_t size, - Genode::Flexpage_iterator &it) - { - if (_overlap(GCPhys, size, _rom_regions)) - return 0; - - if (_overlap(GCPhys, size, _mmio_regions)) - return 0; - - if (!_overlap(GCPhys, size, _ram_regions)) - return 0; - - Region *r = _lookup(GCPhys, _ram_regions, size); - if (!r) - return 0; - - void * vmm_local = lookup_ram(GCPhys & ~(size * 2UL - 1), size * 2UL, it); - if (vmm_local) - return vmm_local; - - it = Genode::Flexpage_iterator((addr_t)r->pv_at_offset(GCPhys - r->GCPhys()), size, GCPhys, size, GCPhys); - - return r->pv_at_offset(GCPhys - r->GCPhys()); - } - - /** - * \return VirtualBox return code - */ - int mmio_write(RTGCPHYS vm_phys, uint32_t u32Value, size_t size) - { - Region *r = _lookup(vm_phys, size); - - if (!r) { - Genode::error("Guest_memory::mmio_write: lookup failed - " - "GCPhys=", Genode::Hex(vm_phys), " u32Value=", - u32Value, " size=", size); - return VERR_IOM_MMIO_RANGE_NOT_FOUND; - } - - /* use VERR_IOM_NOT_MMIO_RANGE_OWNER to request complicated write */ - if (!r->simple_mmio_write(vm_phys, size)) - return VERR_IOM_NOT_MMIO_RANGE_OWNER; - - int rc = r->mmio_write(vm_phys, &u32Value, size); - /* check that VERR_IOM_NOT_MMIO_RANGE_OWNER is unused, see above */ - Assert(rc != VERR_IOM_NOT_MMIO_RANGE_OWNER); - return rc; - } - - /** - * \return VirtualBox return code - */ - int mmio_read(RTGCPHYS vm_phys, uint32_t *u32Value, size_t size) - { - Region *r = _lookup(vm_phys, size); - - if (!r) { - Genode::error("Guest_memory::mmio_read: lookup failed - " - "GCPhys=", Genode::Hex(vm_phys), " u32Value=", - u32Value, " size=", size); - return VERR_IOM_MMIO_RANGE_NOT_FOUND; - } - - /* use VERR_IOM_NOT_MMIO_RANGE_OWNER to request complicated read */ - if (!r->simple_mmio_read(vm_phys, size)) - return VERR_IOM_NOT_MMIO_RANGE_OWNER; - - int rc = r->mmio_read(vm_phys, u32Value, size); - /* check that VERR_IOM_NOT_MMIO_RANGE_OWNER is unused, see above */ - Assert(rc != VERR_IOM_NOT_MMIO_RANGE_OWNER); - return rc; - } -}; - - -/** - * Return pointer to singleton instance - */ -Guest_memory *guest_memory(); - - -#endif /* _GUEST_MEMORY_H_ */ diff --git a/repos/ports/src/virtualbox/hm.cc b/repos/ports/src/virtualbox/hm.cc deleted file mode 100644 index d5581f09d..000000000 --- a/repos/ports/src/virtualbox/hm.cc +++ /dev/null @@ -1,157 +0,0 @@ -/* - * \brief VirtualBox hardware-acceleration manager - * \author Norman Feske - * \date 2013-08-20 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include - -/* VirtualBox includes */ -#include "HMInternal.h" /* enable access to hm.s.* */ -#include -#include - -/* Genode's VirtualBox includes */ -#include "sup.h" - - -static bool enabled_hm = true; -static bool enable_pae_nx = false; -static bool enable_64bit = false; - -VMMR3DECL(int) HMR3Init(PVM pVM) -{ - PCFGMNODE pCfgHM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "HM/"); - - /* check whether to stay for non-paged modi in recompiler */ - int rc = CFGMR3QueryBoolDef(pCfgHM, "EnableUX", - &pVM->hm.s.vmx.fAllowUnrestricted, true); - AssertRCReturn(rc, rc); - - /* check whether to enable pae and nx bit - in 64bit host mode */ - rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnablePAE", &enable_pae_nx, - false); - AssertRCReturn(rc, rc); - - /* check whether to enable long-mode bit - in 64bit host mode */ - rc = CFGMR3QueryBoolDef(pCfgHM, "64bitEnabled", &enable_64bit, false); - AssertRCReturn(rc, rc); - - /* - * We always set the fHMEnabled flag. Otherwise, the EM won't - * consult us for taking scheduling decisions. The actual switch to - * HW accelerated mode is still dependent on the result of the - * HMR3CanExecuteGuest function. - */ - pVM->fHMEnabled = true; - - for (VMCPUID i = 0; i < pVM->cCpus; i++) - pVM->aCpus[i].hm.s.fActive = false; - - pVM->fHMEnabledFixed = true; - - return VINF_SUCCESS; -} - - -VMMR3_INT_DECL(int) HMR3Term(PVM pVM) -{ - return VINF_SUCCESS; -} - - -VMMR3_INT_DECL(int) HMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) -{ - enabled_hm = pVM->hm.s.svm.fSupported || pVM->hm.s.vmx.fSupported; - - if (!enabled_hm || enmWhat != VMINITCOMPLETED_RING0) - return VINF_SUCCESS; - - int rc = SUPR3CallVMMR0Ex(pVM->pVMR0, 0 /*idCpu*/, VMMR0_DO_HM_SETUP_VM, 0, NULL); - - if (rc == VINF_SUCCESS) { - CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_SEP); - - /* nova kernel supports solely on 64bit the following features */ - if (sizeof(void *) > 4 && enable_pae_nx) { - CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_PAE); - CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_NX); - } - if (sizeof(void *) > 4 && enable_64bit) { - CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_LONG_MODE); - CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_SYSCALL); - CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_LAHF); - } - } - - return rc; -} - - -VMMDECL(bool) HMIsEnabledNotMacro(PVM pVM) -{ - Assert(pVM->fHMEnabledFixed); - return pVM->fHMEnabled; -} - - -VMMR3DECL(bool) HMR3IsVmxPreemptionTimerUsed(PVM pVM) -{ - return false; -} - - -VMMR3DECL(bool) HMR3IsActive(PVMCPU pVCpu) -{ - return pVCpu->hm.s.fActive; -} - -VMM_INT_DECL(bool) HMIsLongModeAllowed(PVM pVM) -{ - return HMIsEnabled(pVM) && pVM->hm.s.fAllow64BitGuests; -} - -VMMR3DECL(bool) HMR3IsRescheduleRequired(PVM pVM, PCPUMCTX pCtx) -{ - if (pVM->hm.s.vmx.fAllowUnrestricted) - return false; - - return !CPUMIsGuestInPagedProtectedModeEx(pCtx); -} - - -VMMR3DECL(bool) HMR3IsEventPending(PVMCPU pVCpu) -{ - return false; -} - - -VMMR3DECL(bool) HMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx) -{ - if (!enabled_hm) - return false; - - PVMCPU pVCpu = VMMGetCpu(pVM); - - if (pVM->hm.s.vmx.fAllowUnrestricted) { - pVCpu->hm.s.fActive = true; - } else - /* enable H/W acceleration in protected and paged mode only */ - pVCpu->hm.s.fActive = CPUMIsGuestInPagedProtectedModeEx(pCtx); - - return pVCpu->hm.s.fActive; -} - - -VMM_INT_DECL(int) HMFlushTLB(PVMCPU pVCpu) { return VINF_SUCCESS; } - - -void HMR3ResetCpu(PVMCPU pVCpu) { } diff --git a/repos/ports/src/virtualbox/iommio.cc b/repos/ports/src/virtualbox/iommio.cc deleted file mode 100644 index a498fdb9d..000000000 --- a/repos/ports/src/virtualbox/iommio.cc +++ /dev/null @@ -1,190 +0,0 @@ -/* - * \brief VirtualBox Memory-mapped I/O monitor - * \author Norman Feske - * \date 2013-09-02 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* VirtualBox includes */ -#include "IOMInternal.h" -#include -#include -#include - -/* local includes */ -#include "guest_memory.h" - -static const bool verbose = false; - -VMMR3_INT_DECL(int) IOMR3Init(PVM pVM) -{ - /* - * Assert alignment and sizes. - */ - AssertCompileMemberAlignment(VM, iom.s, 32); - AssertCompile(sizeof(pVM->iom.s) <= sizeof(pVM->iom.padding)); - AssertCompileMemberAlignment(IOM, CritSect, sizeof(uintptr_t)); - - /* - * Initialize the REM critical section. - */ -#ifdef IOM_WITH_CRIT_SECT_RW - int rc = PDMR3CritSectRwInit(pVM, &pVM->iom.s.CritSect, RT_SRC_POS, "IOM Lock"); -#else - int rc = PDMR3CritSectInit(pVM, &pVM->iom.s.CritSect, RT_SRC_POS, "IOM Lock"); -#endif - AssertRCReturn(rc, rc); - return VINF_SUCCESS; -} - -int IOMR3Term(PVM) -{ - return VINF_SUCCESS; -} - - -VMMDECL(bool) IOMIsLockWriteOwner(PVM pVM) -{ -#ifdef IOM_WITH_CRIT_SECT_RW - return PDMCritSectRwIsInitialized(&pVM->iom.s.CritSect) - && PDMCritSectRwIsWriteOwner(&pVM->iom.s.CritSect); -#else - return PDMCritSectIsOwner(&pVM->iom.s.CritSect); -#endif -} - - -int IOMR3MmioRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, - uint32_t cbRange, RTHCPTR pvUser, - R3PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback, - R3PTRTYPE(PFNIOMMMIOREAD) pfnReadCallback, - R3PTRTYPE(PFNIOMMMIOFILL) pfnFillCallback, - uint32_t fFlags, const char *pszDesc) -{ - REMR3NotifyHandlerPhysicalRegister(pVM, PGMPHYSHANDLERTYPE_MMIO, - GCPhysStart, cbRange, true); - - guest_memory()->add_mmio_mapping(GCPhysStart, cbRange, - pDevIns, pvUser, pfnWriteCallback, - pfnReadCallback, pfnFillCallback, fFlags); - - return VINF_SUCCESS; - -} - - -int IOMR3MmioDeregister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, - uint32_t cbRange) -{ - bool status = guest_memory()->remove_mmio_mapping(GCPhysStart, cbRange); - if (status) - return VINF_SUCCESS; - - - return !VINF_SUCCESS; -} - - -VMMDECL(VBOXSTRICTRC) IOMMMIOWrite(PVM pVM, PVMCPU, RTGCPHYS GCPhys, - uint32_t u32Value, size_t cbValue) -{ - VBOXSTRICTRC rc = IOM_LOCK_SHARED(pVM); - Assert(rc == VINF_SUCCESS); - - rc = guest_memory()->mmio_write(GCPhys, u32Value, cbValue); - - /* - * Check whether access is unaligned or access width is less than device - * supports. See original IOMMMIOWrite & iomMMIODoComplicatedWrite of VBox. - */ - if (rc == VERR_IOM_NOT_MMIO_RANGE_OWNER) { - - Assert(cbValue <= 4); - - uint32_t value; - RTGCPHYS aligned = GCPhys & ~0x3U; - rc = guest_memory()->mmio_read(aligned, &value, sizeof(value)); - - uint32_t offset = GCPhys & 0x3; - memcpy(((char *)&value) + offset, &u32Value, cbValue); - rc = guest_memory()->mmio_write(aligned, value, sizeof(value)); - } - - Assert(rc != VERR_IOM_NOT_MMIO_RANGE_OWNER); - - IOM_UNLOCK_SHARED(pVM); - - return rc; -} - - -VMMDECL(VBOXSTRICTRC) IOMMMIORead(PVM pVM, PVMCPU, RTGCPHYS GCPhys, - uint32_t *pvalue, size_t bytes) -{ - VBOXSTRICTRC rc = IOM_LOCK_SHARED(pVM); - Assert(rc == VINF_SUCCESS); - - rc = guest_memory()->mmio_read(GCPhys, pvalue, bytes); - - /* - * Check whether access is unaligned or access width is less than device - * supports. See original IOMMMIORead & iomMMIODoComplicatedRead of VBox. - */ - if (rc == VERR_IOM_NOT_MMIO_RANGE_OWNER) { - /* implement what we need to - extend by need */ - Assert(bytes == 1 || bytes == 2); - - uint32_t value = 0; - if ((GCPhys & 3UL) == 0) - rc = guest_memory()->mmio_read(GCPhys, &value, sizeof(value)); - else { - /* only read until word boundary */ - Assert(((GCPhys & 3UL) + bytes) <= sizeof(value)); - - /* - * Do an aligned read and shift the result to get the value at - * the unaligned address. - */ - rc = guest_memory()->mmio_read((GCPhys & ~3UL), &value, sizeof(value)); - value >>= (8 * (GCPhys & 3UL)); - } - - Assert(rc == VINF_SUCCESS); - if (rc == VINF_SUCCESS) { - switch (bytes) { - case 1: - *(uint8_t *) pvalue = (uint8_t)value; - case 2: - *(uint16_t *)pvalue = (uint16_t)value; - } - } - } - else if (rc == VERR_IOM_MMIO_RANGE_NOT_FOUND) { - *pvalue = ~0U; - rc = VINF_SUCCESS; - } - - - IOM_UNLOCK_SHARED(pVM); - - return rc; -} - - -int IOMMMIOMapMMIO2Page(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysRemapped, - uint64_t fPageFlags) -{ - return VINF_SUCCESS; -} - - -int IOMMMIOResetRegion(PVM pVM, RTGCPHYS GCPhys) -{ - return VINF_SUCCESS; -} diff --git a/repos/ports/src/virtualbox/ioport.cc b/repos/ports/src/virtualbox/ioport.cc deleted file mode 100644 index eb2bc2380..000000000 --- a/repos/ports/src/virtualbox/ioport.cc +++ /dev/null @@ -1,316 +0,0 @@ -/* - * \brief VirtualBox I/O port monitor - * \author Norman Feske - * \date 2013-09-02 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include - -/* VirtualBox includes */ -#include -#include -#include - -#include "vmm.h" - -static bool verbose = false; - -class Guest_ioports -{ - struct Range; - - /* - * XXX Use AVL tree instead of a linked list - */ - - typedef Genode::List Range_list; - typedef Genode::Lock Lock; - - private: - - struct Range : Range_list::Element - { - PPDMDEVINS _pDevIns; - RTIOPORT _PortStart; - RTUINT _cPorts; - RTHCPTR _pvUser; - PFNIOMIOPORTOUT _pfnOutCallback; - PFNIOMIOPORTIN _pfnInCallback; - PFNIOMIOPORTOUTSTRING _pfnOutStringCallback; - PFNIOMIOPORTINSTRING _pfnInStringCallback; - - /** - * Return true if range contains specified subrange - */ - bool contains(RTIOPORT PortStart, RTUINT cPorts) const - { - return (PortStart >= _PortStart) - && (PortStart <= _PortStart + _cPorts - 1); - } - - bool partof(RTIOPORT port, RTUINT cPorts) const - { - RTIOPORT last_port = port + cPorts - 1; - RTIOPORT _last_port = _PortStart + _cPorts - 1; - return ((port <= _PortStart) && (_PortStart <= last_port)) || - ((port <= _last_port) && (_last_port <= last_port)); - } - - Range(PPDMDEVINS pDevIns, - RTIOPORT PortStart, - RTUINT cPorts, - RTHCPTR pvUser, - PFNIOMIOPORTOUT pfnOutCallback, - PFNIOMIOPORTIN pfnInCallback, - PFNIOMIOPORTOUTSTRING pfnOutStringCallback, - PFNIOMIOPORTINSTRING pfnInStringCallback) - : - _pDevIns (pDevIns), - _PortStart (PortStart), - _cPorts (cPorts), - _pvUser (pvUser), - _pfnOutCallback (pfnOutCallback), - _pfnInCallback (pfnInCallback), - _pfnOutStringCallback (pfnOutStringCallback), - _pfnInStringCallback (pfnInStringCallback) - { } - - VBOXSTRICTRC write(RTIOPORT port, uint32_t u32Value, unsigned cb) - { - if (!_pfnOutCallback) - return VINF_IOM_R3_IOPORT_WRITE; - - VBOXSTRICTRC rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo), - VINF_IOM_R3_IOPORT_WRITE); - if (rc != VINF_SUCCESS) - return rc; - - rc = _pfnOutCallback(_pDevIns, _pvUser, port, u32Value, cb); - - PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo)); - - return rc; - } - - VBOXSTRICTRC read(RTIOPORT port, uint32_t *pu32Value, unsigned cb) - { - if (!_pfnInCallback) - return VINF_IOM_R3_IOPORT_READ; - - VBOXSTRICTRC rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo), - VINF_IOM_R3_IOPORT_READ); - if (rc != VINF_SUCCESS) - return rc; - - rc = _pfnInCallback(_pDevIns, _pvUser, port, pu32Value, cb); - - PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo)); - - if (rc != VERR_IOM_IOPORT_UNUSED && rc != VINF_SUCCESS) - Genode::log("IOPORT read port=", Genode::Hex(port), " failed" - " - callback=", _pfnInCallback, " eip=", - __builtin_return_address(0)); - - return rc; - } - }; - - Lock _lock; - Range_list _ranges; - - Range *_lookup(RTIOPORT PortStart, RTUINT cPorts) - { - for (Range *r = _ranges.first(); r; r = r->next()) - if (r->contains(PortStart, cPorts)) - return r; - - return 0; - } - - void dump() - { - for (Range *r = _ranges.first(); r; r = r->next()) - Genode::log(Genode::Hex(r->_PortStart), "+", - Genode::Hex(r->_cPorts), " - '", - r->_pDevIns && r->_pDevIns->pReg ? r->_pDevIns->pReg->szName : 0, "'"); - } - - public: - - int add_range(PPDMDEVINS pDevIns, - RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser, - R3PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, - R3PTRTYPE(PFNIOMIOPORTIN) pfnInCallback, - R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStringCallback, - R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStringCallback) - { - Range *r = _lookup(PortStart, cPorts); - if (r) { - Genode::error("io port inseration failure ", - Genode::Hex(PortStart), "+", - Genode::Hex(cPorts), " - '", - pDevIns && pDevIns->pReg ? pDevIns->pReg->szName : 0, "'"); - dump(); - Assert(!r); - return VERR_GENERAL_FAILURE; - } - - if (verbose) - Genode::log("insert io port range ", Genode::Hex(PortStart), "+", - Genode::Hex(cPorts), " - '", - pDevIns && pDevIns->pReg ? pDevIns->pReg->szName : 0, "'"); - - _ranges.insert(new (vmm_heap()) - Range(pDevIns, PortStart, cPorts, pvUser, - pfnOutCallback, pfnInCallback, - pfnOutStringCallback, pfnInStringCallback)); - - return VINF_SUCCESS; - } - - int remove_range(PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts) - { - bool deleted = false; - - for (Range *r = _ranges.first(); r;) - { - if (!r->partof(PortStart, cPorts)) { - r = r->next(); - continue; - } - - deleted = true; - - if (verbose) - Genode::log("delete io port range ", - Genode::Hex(r->_PortStart), "+", - Genode::Hex(r->_cPorts), " out of ", - Genode::Hex(PortStart), "+", - Genode::Hex(cPorts), " - '", - r->_pDevIns && - r->_pDevIns->pReg ? r->_pDevIns->pReg->szName : 0, "'"); - - Range *s = r; - r = r->next(); - _ranges.remove(s); - - destroy(vmm_heap(), s); - } - - return deleted ? VINF_SUCCESS : VERR_GENERAL_FAILURE; - } - - VBOXSTRICTRC write(RTIOPORT port, uint32_t u32Value, size_t cbValue) - { - Range *r = _lookup(port, cbValue); - if (r) - return r->write(port, u32Value, cbValue); - - if (verbose) { - char c = u32Value & 0xff; - Genode::warning("attempted to write to non-existing port ", - Genode::Hex(port), "+", cbValue, " " - "value=", Genode::Hex(c)); - } - - return VINF_SUCCESS; - } - - VBOXSTRICTRC read(RTIOPORT port, uint32_t *pu32Value, size_t cbValue) - { - Range *r = _lookup(port, cbValue); - if (r) { - VBOXSTRICTRC err = r->read(port, pu32Value, cbValue); - if (err != VERR_IOM_IOPORT_UNUSED) - return err; - } else - if (verbose) - Genode::warning("attempted to read from non-existing port ", - Genode::Hex(port), "+", cbValue, " ", r); - - switch (cbValue) - { - case 1: - *reinterpret_cast(pu32Value) = 0xFFU; - break; - case 2: - *reinterpret_cast(pu32Value) = 0xFFFFU; - break; - case 4: - *reinterpret_cast(pu32Value) = 0xFFFFFFFFU; - break; - default: - Genode::error("Invalid I/O port (", Genode::Hex(port), ") " - "access of size (", Genode::Hex(cbValue), ")"); - return VERR_IOM_INVALID_IOPORT_SIZE; - } - return VINF_SUCCESS; -// return VERR_IOM_IOPORT_UNUSED; /* recompiler does not like this */ - } -}; - - -/** - * Return pointer to singleton instance - */ -Guest_ioports *guest_ioports() -{ - static Guest_ioports inst; - return &inst; -} - - -int -IOMR3IOPortRegisterR3(PVM pVM, PPDMDEVINS pDevIns, - RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser, - R3PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, - R3PTRTYPE(PFNIOMIOPORTIN) pfnInCallback, - R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStringCallback, - R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStringCallback, - const char *pszDesc) -{ - if (verbose) - Genode::log("register I/O port range ", - Genode::Hex(PortStart), "-", - Genode::Hex(PortStart + cPorts - 1), " '", pszDesc, "'"); - - return guest_ioports()->add_range(pDevIns, PortStart, cPorts, pvUser, - pfnOutCallback, pfnInCallback, - pfnOutStringCallback, pfnInStringCallback); -} - - -int IOMR3IOPortDeregister(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, - RTUINT cPorts) -{ - if (verbose) - Genode::log("deregister I/O port range ", - Genode::Hex(PortStart), "-", - Genode::Hex(PortStart + cPorts - 1)); - - return guest_ioports()->remove_range(pDevIns, PortStart, cPorts); -} - - -VMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVM, PVMCPU, RTIOPORT Port, - uint32_t u32Value, size_t cbValue) -{ - return guest_ioports()->write(Port, u32Value, cbValue); -} - - -VMMDECL(VBOXSTRICTRC) IOMIOPortRead(PVM, PVMCPU, RTIOPORT Port, - uint32_t *pu32Value, size_t cbValue) -{ - return guest_ioports()->read(Port, pu32Value, cbValue); -} diff --git a/repos/ports/src/virtualbox/mm.cc b/repos/ports/src/virtualbox/mm.cc deleted file mode 100644 index 6f1e27c88..000000000 --- a/repos/ports/src/virtualbox/mm.cc +++ /dev/null @@ -1,365 +0,0 @@ -/* - * \brief VirtualBox memory manager (MMR3) - * \author Norman Feske - * \date 2013-08-20 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include - -/* VirtualBox includes */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* libc memory allocator */ -#include - -#include "util.h" -#include "mm.h" -#include "vmm.h" - -static struct { - Sub_rm_connection * conn; - Libc::Mem_alloc_impl * heap; -} memory_regions [MM_TAG_HM + 1]; - - -static Libc::Mem_alloc * heap_by_mmtag(MMTAG enmTag) -{ - enum { REGION_SIZE = 4096 * 4096 }; - static Genode::Lock memory_init_lock; - - Assert(enmTag < sizeof(memory_regions) / sizeof(memory_regions[0])); - - if (memory_regions[enmTag].conn) - return memory_regions[enmTag].heap; - - Genode::Lock::Guard guard(memory_init_lock); - - if (memory_regions[enmTag].conn) - return memory_regions[enmTag].heap; - - memory_regions[enmTag].conn = new Sub_rm_connection(genode_env(), REGION_SIZE); - memory_regions[enmTag].heap = new Libc::Mem_alloc_impl(*memory_regions[enmTag].conn, - genode_env().ram()); - - return memory_regions[enmTag].heap; -} - - -static Libc::Mem_alloc * heap_by_pointer(void * pv) -{ - for (unsigned i = 0; i < sizeof(memory_regions) / sizeof(memory_regions[0]); i++) { - if (!memory_regions[i].heap) - continue; - - if (memory_regions[i].conn->contains(pv)) - return memory_regions[i].heap; - } - - return nullptr; -} - - -int MMR3Init(PVM) { return VINF_SUCCESS; } -int MMR3Term(PVM) { return VINF_SUCCESS; } -int MMR3InitUVM(PUVM) { return VINF_SUCCESS; } -void MMR3TermUVM(PUVM) { } - - -void *MMR3HeapAllocU(PUVM pUVM, MMTAG enmTag, size_t cbSize) -{ - return heap_by_mmtag(enmTag)->alloc(cbSize, Genode::log2(RTMEM_ALIGNMENT)); -} - - -/** - * Return alignment to be used for allocations of given tag - */ -static unsigned align_by_mmtag(MMTAG enmTag) -{ - switch (enmTag) { - case MM_TAG_PDM_DEVICE: - case MM_TAG_PDM_DEVICE_USER: - case MM_TAG_VMM: - return 12; - case MM_TAG_CPUM_CPUID: - case MM_TAG_CPUM_MSRS: - return Genode::log2(32); - default: - return Genode::log2(RTMEM_ALIGNMENT); - } -} - - -/** - * Round allocation size for a given tag - */ -static size_t round_size_by_mmtag(MMTAG enmTag, size_t cb) -{ - return Genode::align_addr(cb, align_by_mmtag(enmTag)); -} - - -void *MMR3HeapAlloc(PVM pVM, MMTAG enmTag, size_t cbSize) -{ - size_t const rounded_size = round_size_by_mmtag(enmTag, cbSize); - return heap_by_mmtag(enmTag)->alloc(rounded_size, align_by_mmtag(enmTag)); -} - - -void *MMR3HeapAllocZ(PVM pVM, MMTAG enmTag, size_t cbSize) -{ - void * const ret = MMR3HeapAlloc(pVM, enmTag, cbSize); - - if (ret) - Genode::memset(ret, 0, cbSize); - - return ret; -} - - -int MMR3HeapAllocZEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv) -{ - *ppv = MMR3HeapAllocZ(pVM, enmTag, cbSize); - - return VINF_SUCCESS; -} - - -int MMR3HyperInitFinalize(PVM) -{ - return VINF_SUCCESS; -} - - -int MMR3HyperSetGuard(PVM, void* ptr, size_t, bool) -{ - return VINF_SUCCESS; -} - - -int MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, unsigned uAlignment, - MMTAG enmTag, void **ppv) -{ - AssertRelease(align_by_mmtag(enmTag) >= (uAlignment ? Genode::log2(uAlignment) : 0)); - - unsigned const align_log2 = uAlignment ? Genode::log2(uAlignment) - : align_by_mmtag(enmTag); - - size_t const rounded_size = round_size_by_mmtag(enmTag, cb); - - void *ret = heap_by_mmtag(enmTag)->alloc(rounded_size, align_log2); - if (ret) - Genode::memset(ret, 0, cb); - - *ppv = ret; - - return VINF_SUCCESS; -} - - -int MMR3HyperAllocOnceNoRelEx(PVM pVM, size_t cb, uint32_t uAlignment, - MMTAG enmTag, uint32_t fFlags, void **ppv) -{ - AssertRelease(align_by_mmtag(enmTag) >= (uAlignment ? Genode::log2(uAlignment) : 0)); - - return MMR3HyperAllocOnceNoRel(pVM, cb, uAlignment, enmTag, ppv); -} - - -int MMHyperAlloc(PVM pVM, size_t cb, unsigned uAlignment, MMTAG enmTag, void **ppv) -{ - AssertRelease(align_by_mmtag(enmTag) >= (uAlignment ? Genode::log2(uAlignment) : 0)); - - *ppv = MMR3HeapAllocZ(pVM, enmTag, cb); - return VINF_SUCCESS; -} - - -int MMHyperFree(PVM pVM, void *pv) -{ - MMR3HeapFree(pv); - return VINF_SUCCESS; -} - - -int MMHyperDupMem(PVM pVM, const void *pvSrc, size_t cb, - unsigned uAlignment, MMTAG enmTag, void **ppv) -{ - int rc = MMHyperAlloc(pVM, cb, uAlignment, enmTag, ppv); - if (RT_SUCCESS(rc)) - memcpy(*ppv, pvSrc, cb); - return rc; -} - -bool MMHyperIsInsideArea(PVM, RTGCPTR ptr) -{ - return false; -} - -void MMR3HeapFree(void *pv) -{ - Libc::Mem_alloc *heap = heap_by_pointer(pv); - - Assert(heap); - - heap->free(pv); -} - - -uint64_t MMR3PhysGetRamSize(PVM pVM) -{ - /* when called from REMR3Init, it is expected to return 0 */ - return 0; -} - - -int MMR3HyperMapHCPhys(PVM pVM, void *pvR3, RTR0PTR pvR0, RTHCPHYS HCPhys, - size_t cb, const char *pszDesc, PRTGCPTR pGCPtr) -{ - static_assert(sizeof(*pGCPtr) == sizeof(HCPhys) , "pointer transformation bug"); - *pGCPtr = (RTGCPTR)HCPhys; - return VINF_SUCCESS; -} - - -int MMR3HyperReserve(PVM pVM, unsigned cb, const char *pszDesc, PRTGCPTR pGCPtr) -{ - return VINF_SUCCESS; -} - - -int MMR3HyperMapMMIO2(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, - RTGCPHYS off, RTGCPHYS cb, const char *pszDesc, - PRTRCPTR pRCPtr) -{ - return VINF_SUCCESS; -} - - -/* - * Based on 'VBox/VMM/VMMR3/MM.cpp' - */ -int MMR3InitPaging(PVM pVM) -{ - /* - * Query the CFGM values. - */ - int rc; - PCFGMNODE pMMCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "MM"); - if (!pMMCfg) - { - rc = CFGMR3InsertNode(CFGMR3GetRoot(pVM), "MM", &pMMCfg); - AssertRCReturn(rc, rc); - } - - /** @cfgm{RamSize, uint64_t, 0, 16TB, 0} - * Specifies the size of the base RAM that is to be set up during - * VM initialization. - */ - uint64_t cbRam; - rc = CFGMR3QueryU64(CFGMR3GetRoot(pVM), "RamSize", &cbRam); - if (rc == VERR_CFGM_VALUE_NOT_FOUND) - cbRam = 0; - else - AssertMsgRCReturn(rc, ("Configuration error: Failed to query integer \"RamSize\", rc=%Rrc.\n", rc), rc); - cbRam &= X86_PTE_PAE_PG_MASK; - - /** @cfgm{RamHoleSize, uint32_t, 0, 4032MB, 512MB} - * Specifies the size of the memory hole. The memory hole is used - * to avoid mapping RAM to the range normally used for PCI memory regions. - * Must be aligned on a 4MB boundary. */ - uint32_t cbRamHole; - rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "RamHoleSize", &cbRamHole, MM_RAM_HOLE_SIZE_DEFAULT); - uint64_t const offRamHole = _4G - cbRamHole; - - /* - * Make the initial memory reservation with GMM. - */ - LogFlow(("GMMR3INitialReservation missing\n")); - - /* - * If RamSize is 0 we're done now. - */ - if (cbRam < PAGE_SIZE) - { - Log(("MM: No RAM configured\n")); - return VINF_SUCCESS; - } - - /* - * Setup the base ram (PGM). - */ - if (cbRam > offRamHole) - { - rc = PGMR3PhysRegisterRam(pVM, 0, offRamHole, "Base RAM"); - if (RT_SUCCESS(rc)) - rc = PGMR3PhysRegisterRam(pVM, _4G, cbRam - offRamHole, "Above 4GB Base RAM"); - } - else - rc = PGMR3PhysRegisterRam(pVM, 0, RT_MIN(cbRam, offRamHole), "Base RAM"); - - LogFlow(("MMR3InitPaging: returns %Rrc\n", rc)); - return rc; -} - - -char * MMR3HeapStrDup(PVM pVM, MMTAG enmTag, const char *psz) -{ - size_t cch = strlen(psz) + 1; - char *pszDup = (char *)MMR3HeapAllocU(pVM->pUVM, enmTag, cch); - if (pszDup) - memcpy(pszDup, psz, cch); - - return pszDup; -} - - -char * MMR3HeapAPrintfVU(PUVM pUVM, MMTAG enmTag, const char *pszFormat, va_list va) -{ - /* - * The lazy bird way. - */ - char *psz; - int cch = RTStrAPrintfV(&psz, pszFormat, va); - if (cch < 0) - return NULL; - Assert(psz[cch] == '\0'); - char *pszRet = (char *)MMR3HeapAllocU(pUVM, enmTag, cch + 1); - if (pszRet) - memcpy(pszRet, psz, cch + 1); - RTStrFree(psz); - return pszRet; -} - - -extern "C" { - -char * MMR3HeapAPrintf(PVM pVM, MMTAG enmTag, const char *pszFormat, ...) -{ - va_list va; - va_start(va, pszFormat); - char *psz = MMR3HeapAPrintfVU(pVM->pUVM, enmTag, pszFormat, va); - va_end(va); - return psz; -} - -} diff --git a/repos/ports/src/virtualbox/muen/target.mk b/repos/ports/src/virtualbox/muen/target.mk deleted file mode 100644 index ee678aaca..000000000 --- a/repos/ports/src/virtualbox/muen/target.mk +++ /dev/null @@ -1,11 +0,0 @@ -TARGET = virtualbox-muen -REQUIRES = muen - -LIBS += virtualbox-muen - -include $(REP_DIR)/src/virtualbox/target.inc - -vpath frontend/% $(REP_DIR)/src/virtualbox/ -vpath %.cc $(REP_DIR)/src/virtualbox/ - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/src/virtualbox/nova/target.mk b/repos/ports/src/virtualbox/nova/target.mk deleted file mode 100644 index a2c85db66..000000000 --- a/repos/ports/src/virtualbox/nova/target.mk +++ /dev/null @@ -1,11 +0,0 @@ -TARGET = virtualbox-nova -REQUIRES = nova - -LIBS += virtualbox-nova - -include $(REP_DIR)/src/virtualbox/target.inc - -vpath frontend/% $(REP_DIR)/src/virtualbox/ -vpath %.cc $(REP_DIR)/src/virtualbox/ - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/src/virtualbox/patches/audio.patch b/repos/ports/src/virtualbox/patches/audio.patch deleted file mode 100644 index f0636d6c1..000000000 --- a/repos/ports/src/virtualbox/patches/audio.patch +++ /dev/null @@ -1,16 +0,0 @@ -Omit the filter layer in VirtualBox and use the actual driver directly. -This is needed because we want to use our genode_write() function but -the filter layer always calls audio_pcm_sw_write() instead. ---- a/src/app/virtualbox/src/VBox/Devices/Audio/audio.c 2015-06-05 16:48:33.535360035 +0200 -+++ b/src/app/virtualbox/src/VBox/Devices/Audio/audio.c 2015-06-05 16:49:25.077358248 +0200 -@@ -1579,8 +1579,8 @@ - s->drv_opaque = drv->init (); - - if (s->drv_opaque) { -- /* Filter must be installed before initializing voices. */ -- drv = filteraudio_install(drv, s->drv_opaque); -+ // we do not use the filter layer so use the drv directly; -+ drv = s->drv_opaque; - audio_init_nb_voices_out (s, drv); - audio_init_nb_voices_in (s, drv); - s->drv = drv; diff --git a/repos/ports/src/virtualbox/patches/dev_e1000.patch b/repos/ports/src/virtualbox/patches/dev_e1000.patch deleted file mode 100644 index d7f5f2598..000000000 --- a/repos/ports/src/virtualbox/patches/dev_e1000.patch +++ /dev/null @@ -1,36 +0,0 @@ -dev_e1000.patch - -diff --git a/src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp b/src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp -index b8f9ebf..aa3eb87 100644 ---- a/src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp -+++ b/src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp -@@ -5721,22 +5721,29 @@ static int e1kRegReadUnaligned(PE1KSTATE pThis, uint32_t offReg, void *pv, uint3 - rc = g_aE1kRegMap[index].pfnRead(pThis, offReg & 0xFFFFFFFC, index, &u32); - u32 &= mask; - //e1kCsLeave(pThis); -+#ifdef DEBUG - E1kLog2(("%s At %08X read %s from %s (%s)\n", - pThis->szPrf, offReg, e1kU32toHex(u32, mask, buf), g_aE1kRegMap[index].abbrev, g_aE1kRegMap[index].name)); - Log6(("%s At %08X read %s from %s (%s) [UNALIGNED]\n", - pThis->szPrf, offReg, e1kU32toHex(u32, mask, buf), g_aE1kRegMap[index].abbrev, g_aE1kRegMap[index].name)); -+#endif - /* Shift back the result. */ - u32 >>= shift; - } -+#ifdef DEBUG - else - E1kLog(("%s At %08X read (%s) attempt from write-only register %s (%s)\n", - pThis->szPrf, offReg, e1kU32toHex(u32, mask, buf), g_aE1kRegMap[index].abbrev, g_aE1kRegMap[index].name)); -+#endif -+ - if (IOM_SUCCESS(rc)) - STAM_COUNTER_INC(&pThis->aStatRegReads[index]); - } -+#ifdef DEBUG - else - E1kLog2(("%s At %08X read (%s) attempt from non-existing register\n", - pThis->szPrf, offReg, e1kU32toHex(u32, mask, buf))); -+#endif - - memcpy(pv, &u32, cb); - return rc; diff --git a/repos/ports/src/virtualbox/patches/force_ioapic.patch b/repos/ports/src/virtualbox/patches/force_ioapic.patch deleted file mode 100644 index 587b2a054..000000000 --- a/repos/ports/src/virtualbox/patches/force_ioapic.patch +++ /dev/null @@ -1,24 +0,0 @@ -Deliver PCI IRQs to the IOAPIC if the 'force_ioapic' configuration option is set. - -From: Christian Prochaska - -Issue #2029 ---- - src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp b/src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp -index c454d8b..35061d5 100644 ---- a/src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp -+++ b/src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp -@@ -663,7 +663,9 @@ static void pciSetIrqInternal(PPCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE p - * is opened to route PCI interrupts directly to the I/O APIC and bypass the PIC. - * See the \_SB_.PCI0._PRT method in vbox.dsl. - */ -- const bool fIsApicEnabled = pGlobals->fUseIoApic && pbCfg[0xde] == 0xbe && pbCfg[0xad] == 0xef; -+ extern bool force_ioapic(); -+ const bool fIsApicEnabled = pGlobals->fUseIoApic && -+ (force_ioapic() || (pbCfg[0xde] == 0xbe && pbCfg[0xad] == 0xef)); - int pic_irq, pic_level; - - /* Check if the state changed. */ diff --git a/repos/ports/src/virtualbox/patches/ide.patch b/repos/ports/src/virtualbox/patches/ide.patch deleted file mode 100644 index a2469fc2c..000000000 --- a/repos/ports/src/virtualbox/patches/ide.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/src/app/virtualbox/src/VBox/Devices/Storage/ide.h -+++ b/src/app/virtualbox/src/VBox/Devices/Storage/ide.h -@@ -202,8 +202,7 @@ - #define ATAPI_INQUIRY_PRODUCT_ID_LENGTH 16 - #define ATAPI_INQUIRY_REVISION_LENGTH 4 - -- --#if defined(DEBUG) && defined(IN_RING3) -+#if defined(LOG_ENABLED) && defined(IN_RING3) - const char * ATACmdText(uint8_t uCmd); - #endif - diff --git a/repos/ports/src/virtualbox/patches/rem_irq.patch b/repos/ports/src/virtualbox/patches/rem_irq.patch deleted file mode 100644 index 4b2937b91..000000000 --- a/repos/ports/src/virtualbox/patches/rem_irq.patch +++ /dev/null @@ -1,32 +0,0 @@ -rem_irq.patch - -diff --git a/src/app/virtualbox/src/VBox/VMM/VMMR3/TRPM.cpp b/src/app/virtualbox/src/VBox/VMM/VMMR3/TRPM.cpp -index 8c12949..a7fd67e 100644 ---- a/src/app/virtualbox/src/VBox/VMM/VMMR3/TRPM.cpp -+++ b/src/app/virtualbox/src/VBox/VMM/VMMR3/TRPM.cpp -@@ -1561,6 +1561,17 @@ VMMR3DECL(int) TRPMR3InjectEvent(PVM pVM, PVMCPU pVCpu, TRPMEVENT enmEvent) - 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 @@ VMMR3DECL(int) TRPMR3InjectEvent(PVM pVM, PVMCPU pVCpu, TRPMEVENT enmEvent) - 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. diff --git a/repos/ports/src/virtualbox/patches/series b/repos/ports/src/virtualbox/patches/series deleted file mode 100644 index c46eef601..000000000 --- a/repos/ports/src/virtualbox/patches/series +++ /dev/null @@ -1,14 +0,0 @@ -audio.patch -ide.patch -vbox_inc.patch -vbox_main.patch -vga_fb.patch -vga_vbva.patch -vmmdev.patch -usb.patch -vbox_dd.patch -ide.patch -rem_irq.patch -force_ioapic.patch -vbox-cpuhotplug.dsl.patch -dev_e1000.patch diff --git a/repos/ports/src/virtualbox/patches/series_common b/repos/ports/src/virtualbox/patches/series_common deleted file mode 100644 index e3b8265ca..000000000 --- a/repos/ports/src/virtualbox/patches/series_common +++ /dev/null @@ -1,18 +0,0 @@ -acpi_drv.patch -avoid_yield.patch -eminternal.patch -hostservice.patch -iconv.patch -mouse.patch -network.patch -pdm_driver.patch -poke.patch -posix.patch -serial.patch -sharedfolder_pagelist.patch -time-log-deadlock.patch -tm_retries.patch -vmdk.patch -tm_tpr.patch -tm_4s.patch -rem_tss.patch diff --git a/repos/ports/src/virtualbox/patches/usb.patch b/repos/ports/src/virtualbox/patches/usb.patch deleted file mode 100644 index ff1d0f3b4..000000000 --- a/repos/ports/src/virtualbox/patches/usb.patch +++ /dev/null @@ -1,136 +0,0 @@ -usb.patch - -diff --git a/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp b/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp -index a51bc36..bed42e8 100644 ---- a/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp -+++ b/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp -@@ -843,10 +843,14 @@ static DECLCALLBACK(int) usbProxyConstruct(PPDMUSBINS pUsbIns, int iInstance, PC - /* - * Select backend and open the device. - */ -+ -+ return PDMUSB_SET_ERROR(pUsbIns, VERR_NOT_SUPPORTED, N_("USBProxy: not supported on Genode")); -+#if 0 - if (!fRemote) - pThis->pOps = &g_USBProxyDeviceHost; - else - pThis->pOps = &g_USBProxyDeviceVRDP; -+#endif /* if 0 */ - - pThis->pvInstanceDataR3 = RTMemAllocZ(pThis->pOps->cbBackend); - if (!pThis->pvInstanceDataR3) -diff --git a/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp b/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp -index 4790fcb..d649ad6 100644 ---- a/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp -+++ b/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp -@@ -1134,7 +1143,7 @@ static DECLCALLBACK(int) vusbDevUrbIoThread(RTTHREAD hThread, void *pvUser) - vusbUrbDoReapAsyncDev(pDev, RT_INDEFINITE_WAIT); - - /* Process any URBs waiting to be cancelled first. */ -- int rc = RTReqQueueProcess(pDev->hReqQueueSync, 0); /* Don't wait if there is nothing to do. */ -+ int rc = RTReqQueueProcess(pDev->hReqQueueSync, pDev->enmState == VUSB_DEVICE_STATE_RESET ? 5 : 0); /* if in reset state (takes 10ms) sleep a bit - otherwise this thread consumes in this loop a lot of cpu time */ - Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT); - } - -diff --git a/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.cpp b/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.cpp -index 3173a36..8105987 100644 ---- a/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.cpp -+++ b/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.cpp -@@ -39,6 +39,7 @@ const void *g_apvVBoxDDDependencies[] = - NULL, - }; - -+#if 0 - - /** - * Register builtin devices. -@@ -329,6 +330,7 @@ extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_ - return VINF_SUCCESS; - } - -+#endif /* if 0 */ - - /** - * Register builtin USB device. -diff --git a/src/app/virtualbox/src/VBox/Main/include/Matching.h b/src/app/virtualbox/src/VBox/Main/include/Matching.h -index 2f01f69..9b13e37 100644 ---- a/src/app/virtualbox/src/VBox/Main/include/Matching.h -+++ b/src/app/virtualbox/src/VBox/Main/include/Matching.h -@@ -291,10 +291,12 @@ public: - return mValueAny || mValue == aValue; - } - -+#if 0 - bool isMatch (const BOOL aValue) const - { - return isMatch (bool (aValue == TRUE)); - } -+#endif /* if 0 */ - - private: - -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -index 3889a01..7ae9d1c 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -@@ -13571,6 +13582,7 @@ STDMETHODIMP SessionMachine::AutoCaptureUSBDevices() - AutoCaller autoCaller(this); - AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); - -+#if 0 - #ifdef VBOX_WITH_USB - HRESULT rc = mUSBDeviceFilters->notifyProxy(true /* aInsertFilters */); - AssertComRC(rc); -@@ -13579,6 +13591,7 @@ STDMETHODIMP SessionMachine::AutoCaptureUSBDevices() - USBProxyService *service = mParent->host()->usbProxyService(); - AssertReturn(service, E_FAIL); - return service->autoCaptureDevicesForVM(this); -+#endif /* if 0 */ - #else - return S_OK; - #endif -@@ -13614,6 +13614,7 @@ - AutoCaller autoCaller(this); - AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); - -+#if 0 - #ifdef VBOX_WITH_USB - HRESULT rc = mUSBDeviceFilters->notifyProxy(false /* aInsertFilters */); - AssertComRC(rc); -@@ -13622,6 +13623,7 @@ - USBProxyService *service = mParent->host()->usbProxyService(); - AssertReturn(service, E_FAIL); - return service->detachAllDevicesFromVM(this, !!aDone, false /* aAbnormal */); -+#endif /* if 0 */ - #else - NOREF(aDone); - return S_OK; -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp -index 09b42f5..c179ca6 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp -@@ -1037,13 +1037,10 @@ HRESULT USBDeviceFilters::notifyProxy(bool aInsertFilters) - LogFlowThisFunc(("aInsertFilters=%RTbool\n", aInsertFilters)); - - AutoCaller autoCaller(this); -- AssertComRCReturn(autoCaller.rc(), false); -+ AssertComRCReturnRC(autoCaller.rc()); - - AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); - -- USBProxyService *pProxySvc = m->pHost->usbProxyService(); -- AssertReturn(pProxySvc, E_FAIL); -- - DeviceFilterList::const_iterator it = m->llDeviceFilters->begin(); - while (it != m->llDeviceFilters->end()) - { -@@ -1054,6 +1051,9 @@ HRESULT USBDeviceFilters::notifyProxy(bool aInsertFilters) - && pFilter->getData().mRemote.isMatch(false) /* and if the filter is NOT remote */ - ) - { -+ USBProxyService *pProxySvc = m->pHost->usbProxyService(); -+ AssertReturn(pProxySvc, E_FAIL); -+ - if (aInsertFilters) - { - AssertReturn(pFilter->getId() == NULL, E_FAIL); diff --git a/repos/ports/src/virtualbox/patches/vbox-cpuhotplug.dsl.patch b/repos/ports/src/virtualbox/patches/vbox-cpuhotplug.dsl.patch deleted file mode 100644 index ecfa57768..000000000 --- a/repos/ports/src/virtualbox/patches/vbox-cpuhotplug.dsl.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/src/app/virtualbox/src/VBox/Devices/PC/vbox-cpuhotplug.dsl -+++ b/src/app/virtualbox/src/VBox/Devices/PC/vbox-cpuhotplug.dsl -@@ -27,6 +27,18 @@ - Return(LEqual(CPUL, 0x01)) - } - -+ // Method to notify the VMM that a CPU is not -+ // in use anymore and can be safely removed. -+ // Using the extra method here because the CPUL -+ // register identifer clashes with the CPUL object defined -+ // below making iasl starting with version 20150930 fail. -+ // -+ // Think of CPLO as "CPU Lock Open" -+ Method(CPLO, 1) -+ { -+ Store (Arg0, CPUL) -+ } -+ - Scope (\_SB) - { - -@@ -73,7 +85,7 @@ - } \ - Method(_EJ0, 1) \ - { \ -- Store(id, CPUL) /* Unlock the CPU */ \ -+ CPLO(id) /* Unlock the CPU */ \ - Return \ - } \ - } \ diff --git a/repos/ports/src/virtualbox/patches/vbox_dd.patch b/repos/ports/src/virtualbox/patches/vbox_dd.patch deleted file mode 100644 index 7043f28ff..000000000 --- a/repos/ports/src/virtualbox/patches/vbox_dd.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.h -+++ b/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.h -@@ -58,6 +58,7 @@ - extern const PDMDEVREG g_DeviceAudioSniffer; - extern const PDMDEVREG g_DeviceOHCI; - extern const PDMDEVREG g_DeviceEHCI; -+extern const PDMDEVREG g_DeviceXHCI; - extern const PDMDEVREG g_DeviceACPI; - extern const PDMDEVREG g_DeviceDMA; - extern const PDMDEVREG g_DeviceFloppyController; diff --git a/repos/ports/src/virtualbox/patches/vbox_inc.patch b/repos/ports/src/virtualbox/patches/vbox_inc.patch deleted file mode 100644 index c529d75b8..000000000 --- a/repos/ports/src/virtualbox/patches/vbox_inc.patch +++ /dev/null @@ -1,113 +0,0 @@ -vbox_inc.patch - -diff --git a/src/app/virtualbox/include/VBox/com/ErrorInfo.h b/src/app/virtualbox/include/VBox/com/ErrorInfo.h -index 869b998..c6adf70 100644 ---- a/src/app/virtualbox/include/VBox/com/ErrorInfo.h -+++ b/src/app/virtualbox/include/VBox/com/ErrorInfo.h -@@ -31,8 +31,8 @@ - #include "VBox/com/Guid.h" - #include "VBox/com/assert.h" - --struct IProgress; --struct IVirtualBoxErrorInfo; -+//struct IProgress; -+//struct IVirtualBoxErrorInfo; - - namespace com - { -diff --git a/src/app/virtualbox/include/VBox/com/array.h b/src/app/virtualbox/include/VBox/com/array.h -index 77f9d60..dcbad41 100644 ---- a/src/app/virtualbox/include/VBox/com/array.h -+++ b/src/app/virtualbox/include/VBox/com/array.h -@@ -219,10 +219,10 @@ struct SafeArrayTraits - protected: - - /** Initializes memory for aElem. */ -- static void Init(T &aElem) { aElem = 0; } -+ static void Init(T &aElem) { /*aElem = 0; */ } - - /** Initializes memory occupied by aElem. */ -- static void Uninit(T &aElem) { aElem = 0; } -+ static void Uninit(T &aElem) { /* aElem = 0; */ } - - /** Creates a deep copy of aFrom and stores it in aTo. */ - static void Copy(const T &aFrom, T &aTo) { aTo = aFrom; } -diff --git a/src/app/virtualbox/include/VBox/com/string.h b/src/app/virtualbox/include/VBox/com/string.h -index 263dc40..768c336 100644 ---- a/src/app/virtualbox/include/VBox/com/string.h -+++ b/src/app/virtualbox/include/VBox/com/string.h -@@ -247,7 +247,7 @@ public: - * returns a pointer to a global variable containing an empty BSTR with a proper zero - * length prefix so that Windows is happy. - */ -- CBSTR raw() const -+ BSTR raw() const - { - if (m_bstr) - return m_bstr; -diff --git a/src/app/virtualbox/include/VBox/vmm/hm_vmx.h b/src/app/virtualbox/include/VBox/vmm/hm_vmx.h -index 7deb357..668764c 100644 ---- a/src/app/virtualbox/include/VBox/vmm/hm_vmx.h -+++ b/src/app/virtualbox/include/VBox/vmm/hm_vmx.h -@@ -1859,10 +1859,10 @@ DECLINLINE(int) VMXEnable(RTHCPHYS pVMXOn) - ".byte 0xF3, 0x0F, 0xC7, 0x34, 0x24 # VMXON [esp] \n\t" - "ja 2f \n\t" - "je 1f \n\t" -- "movl $"RT_XSTR(VERR_VMX_INVALID_VMXON_PTR)", %0 \n\t" -+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMXON_PTR)", %0 \n\t" - "jmp 2f \n\t" - "1: \n\t" -- "movl $"RT_XSTR(VERR_VMX_VMXON_FAILED)", %0 \n\t" -+ "movl $" RT_XSTR(VERR_VMX_VMXON_FAILED)", %0 \n\t" - "2: \n\t" - "add $8, %%esp \n\t" - :"=rm"(rc) -@@ -1952,7 +1952,7 @@ DECLINLINE(int) VMXClearVmcs(RTHCPHYS pVMCS) - "push %2 \n\t" - ".byte 0x66, 0x0F, 0xC7, 0x34, 0x24 # VMCLEAR [esp] \n\t" - "jnc 1f \n\t" -- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" -+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" - "1: \n\t" - "add $8, %%esp \n\t" - :"=rm"(rc) -@@ -2009,7 +2009,7 @@ DECLINLINE(int) VMXActivateVmcs(RTHCPHYS pVMCS) - "push %2 \n\t" - ".byte 0x0F, 0xC7, 0x34, 0x24 # VMPTRLD [esp] \n\t" - "jnc 1f \n\t" -- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" -+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" - "1: \n\t" - "add $8, %%esp \n\t" - :"=rm"(rc) -@@ -2079,10 +2079,10 @@ DECLINLINE(int) VMXWriteVmcs32(uint32_t idxField, uint32_t u32Val) - ".byte 0x0F, 0x79, 0xC2 # VMWRITE eax, edx \n\t" - "ja 2f \n\t" - "je 1f \n\t" -- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" -+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" - "jmp 2f \n\t" - "1: \n\t" -- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t" -+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t" - "2: \n\t" - :"=rm"(rc) - :"0"(VINF_SUCCESS), -@@ -2207,14 +2207,14 @@ DECLINLINE(int) VMXReadVmcs32(uint32_t idxField, uint32_t *pData) - # if RT_INLINE_ASM_GNU_STYLE - int rc = VINF_SUCCESS; - __asm__ __volatile__ ( -- "movl $"RT_XSTR(VINF_SUCCESS)", %0 \n\t" -+ "movl $" RT_XSTR(VINF_SUCCESS)", %0 \n\t" - ".byte 0x0F, 0x78, 0xc2 # VMREAD eax, edx \n\t" - "ja 2f \n\t" - "je 1f \n\t" -- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" -+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" - "jmp 2f \n\t" - "1: \n\t" -- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t" -+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t" - "2: \n\t" - :"=&r"(rc), - "=d"(*pData) diff --git a/repos/ports/src/virtualbox/patches/vbox_main.patch b/repos/ports/src/virtualbox/patches/vbox_main.patch deleted file mode 100644 index 95cef9ab1..000000000 --- a/repos/ports/src/virtualbox/patches/vbox_main.patch +++ /dev/null @@ -1,1872 +0,0 @@ -vbox_main.patch - -From: Christian Prochaska - - ---- - .../virtualbox/src/VBox/Main/include/ConsoleImpl.h | 18 ++- - .../virtualbox/src/VBox/Main/include/DisplayImpl.h | 8 + - .../src/VBox/Main/include/FramebufferImpl.h | 1 - .../virtualbox/src/VBox/Main/include/MachineImpl.h | 2 - .../src/VBox/Main/include/NetworkServiceRunner.h | 5 + - .../src/VBox/Main/include/ProgressProxyImpl.h | 2 - .../virtualbox/src/VBox/Main/include/SessionImpl.h | 4 + - .../virtualbox/src/VBox/Main/src-all/EventImpl.cpp | 13 ++ - .../VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp | 4 - - .../src/VBox/Main/src-all/ProgressImpl.cpp | 13 +- - .../src/VBox/Main/src-all/VirtualBoxBase.cpp | 4 + - .../VBox/Main/src-client/BusAssignmentManager.cpp | 2 - .../src/VBox/Main/src-client/ConsoleImpl.cpp | 116 +++++++++++++++++++- - .../src/VBox/Main/src-client/ConsoleImpl2.cpp | 51 +++++++-- - .../src/VBox/Main/src-client/DisplayImpl.cpp | 19 +++ - .../src/VBox/Main/src-client/GuestImpl.cpp | 8 + - .../src/VBox/Main/src-client/MouseImpl.cpp | 6 + - .../src/VBox/Main/src-client/SessionImpl.cpp | 11 ++ - .../VBox/Main/src-client/VBoxDriversRegister.cpp | 6 + - .../src/VBox/Main/src-client/VMMDevInterface.cpp | 2 - .../src/VBox/Main/src-server/ClientToken.cpp | 6 - - .../src/VBox/Main/src-server/DHCPServerImpl.cpp | 1 - .../src/VBox/Main/src-server/MachineImpl.cpp | 35 ++++-- - .../VBox/Main/src-server/MachineImplCloneVM.cpp | 2 - .../src/VBox/Main/src-server/MediumImpl.cpp | 15 ++- - .../src/VBox/Main/src-server/MediumLock.cpp | 2 - .../VBox/Main/src-server/NetworkAdapterImpl.cpp | 2 - .../src/VBox/Main/src-server/SnapshotImpl.cpp | 3 - - .../src/VBox/Main/src-server/VRDEServerImpl.cpp | 11 +- - .../src/VBox/Main/src-server/VirtualBoxImpl.cpp | 8 + - src/app/virtualbox/src/VBox/Main/xml/Settings.cpp | 4 + - 31 files changed, 311 insertions(+), 73 deletions(-) - -diff --git a/src/app/virtualbox/src/VBox/Main/include/ConsoleImpl.h b/src/app/virtualbox/src/VBox/Main/include/ConsoleImpl.h -index 030a601..7fce453 100644 ---- a/src/app/virtualbox/src/VBox/Main/include/ConsoleImpl.h -+++ b/src/app/virtualbox/src/VBox/Main/include/ConsoleImpl.h -@@ -50,7 +50,9 @@ class VMMDevMouseInterface; - class DisplayMouseInterface; - - #include -+#if 0 - #include -+#endif /* if 0 */ - #include - #ifdef VBOX_WITH_GUEST_PROPS - # include /* For the property notification callback */ -@@ -251,7 +253,9 @@ public: - void VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept); - void VRDPInterceptClipboard(uint32_t u32ClientId); - -+#if 0 - void processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt); -+#endif /* if 0 */ - void reportVmStatistics(ULONG aValidStats, ULONG aCpuUser, - ULONG aCpuKernel, ULONG aCpuIdle, - ULONG aMemTotal, ULONG aMemFree, -@@ -261,10 +265,12 @@ public: - ULONG aBalloonedVMM, ULONG aSharedVMM, - ULONG aVmNetRx, ULONG aVmNetTx) - { -+#if 0 - mControl->ReportVmStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle, - aMemTotal, aMemFree, aMemBalloon, aMemShared, - aMemCache, aPageTotal, aAllocVMM, aFreeVMM, - aBalloonedVMM, aSharedVMM, aVmNetRx, aVmNetTx); -+#endif /* if 0 */ - } - void enableVMMStatistics(BOOL aEnable); - -@@ -274,12 +280,12 @@ public: - - // callback callers (partly; for some events console callbacks are notified - // directly from IInternalSessionControl event handlers declared above) -- void onMousePointerShapeChange(bool fVisible, bool fAlpha, -- uint32_t xHot, uint32_t yHot, -- uint32_t width, uint32_t height, -- ComSafeArrayIn(uint8_t, aShape)); -- void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, -- BOOL supportsMT, BOOL needsHostCursor); -+ virtual void onMousePointerShapeChange(bool fVisible, bool fAlpha, -+ uint32_t xHot, uint32_t yHot, -+ uint32_t width, uint32_t height, -+ ComSafeArrayIn(uint8_t, aShape)) = 0; -+ virtual void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, -+ BOOL supportsMT, BOOL needsHostCursor) = 0; - void onStateChange(MachineState_T aMachineState); - void onAdditionsStateChange(); - void onAdditionsOutdated(); -diff --git a/src/app/virtualbox/src/VBox/Main/include/DisplayImpl.h b/src/app/virtualbox/src/VBox/Main/include/DisplayImpl.h -index 585f6b2..ecb58b9 100644 ---- a/src/app/virtualbox/src/VBox/Main/include/DisplayImpl.h -+++ b/src/app/virtualbox/src/VBox/Main/include/DisplayImpl.h -@@ -122,7 +122,7 @@ typedef struct _DISPLAYFBINFO - class DisplayMouseInterface - { - public: -- virtual int getScreenResolution(uint32_t cScreen, ULONG *pcx, -+ virtual HRESULT getScreenResolution(uint32_t cScreen, ULONG *pcx, - ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0; - virtual void getFramebufferDimensions(int32_t *px1, int32_t *py1, - int32_t *px2, int32_t *py2) = 0; -@@ -192,7 +192,7 @@ public: - return maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer; - } - void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2, int32_t *py2); -- int getScreenResolution(uint32_t cScreen, ULONG *pcx, ULONG *pcy, -+ HRESULT getScreenResolution(uint32_t cScreen, ULONG *pcx, ULONG *pcy, - ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) - { - return GetScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin); -@@ -232,6 +232,10 @@ public: - - static const PDMDRVREG DrvReg; - -+#if 0 -+ static void fireGuestMonitorChangedEvent(EventSource*, GuestMonitorChangedEventType, int32_t, int32_t, int32_t, int32_t, int32_t); -+#endif -+ - private: - - int updateDisplayData(void); -diff --git a/src/app/virtualbox/src/VBox/Main/include/FramebufferImpl.h b/src/app/virtualbox/src/VBox/Main/include/FramebufferImpl.h -index feebfcd..4136d6d 100644 ---- a/src/app/virtualbox/src/VBox/Main/include/FramebufferImpl.h -+++ b/src/app/virtualbox/src/VBox/Main/include/FramebufferImpl.h -@@ -70,6 +70,7 @@ public: - STDMETHOD(SetVisibleRegion)(BYTE *aRectangles, ULONG aCount) = 0; - - STDMETHOD(ProcessVHWACommand)(BYTE *pCommand) = 0; -+ STDMETHOD(NotifyUpdate)(ULONG x, ULONG y, ULONG w, ULONG h) = 0; - }; - - #endif // ____H_H_FRAMEBUFFERIMPL -diff --git a/src/app/virtualbox/src/VBox/Main/include/NetworkServiceRunner.h b/src/app/virtualbox/src/VBox/Main/include/NetworkServiceRunner.h -index f0ec275..78a390e 100644 ---- a/src/app/virtualbox/src/VBox/Main/include/NetworkServiceRunner.h -+++ b/src/app/virtualbox/src/VBox/Main/include/NetworkServiceRunner.h -@@ -15,6 +15,9 @@ - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - */ - -+#ifndef ____H_H_NetworkServiceRunner -+#define ____H_H_NetworkServiceRunner -+ - #include - #include - #include -@@ -55,3 +58,5 @@ private: - struct Data; - Data *m; - }; -+ -+#endif /* ____H_H_NetworkServiceRunner */ -diff --git a/src/app/virtualbox/src/VBox/Main/include/ProgressProxyImpl.h b/src/app/virtualbox/src/VBox/Main/include/ProgressProxyImpl.h -index 66f2b31..0ac7ab8 100644 ---- a/src/app/virtualbox/src/VBox/Main/include/ProgressProxyImpl.h -+++ b/src/app/virtualbox/src/VBox/Main/include/ProgressProxyImpl.h -@@ -52,7 +52,7 @@ public: - #if !defined (VBOX_COM_INPROC) - VirtualBox *pParent, - #endif -- IUnknown *pInitiator, -+ void *pInitiator, - CBSTR bstrDescription, - BOOL fCancelable, - ULONG uTotalOperationsWeight, -diff --git a/src/app/virtualbox/src/VBox/Main/include/SessionImpl.h b/src/app/virtualbox/src/VBox/Main/include/SessionImpl.h -index b0f600e..bcd6b4c 100644 ---- a/src/app/virtualbox/src/VBox/Main/include/SessionImpl.h -+++ b/src/app/virtualbox/src/VBox/Main/include/SessionImpl.h -@@ -24,6 +24,8 @@ - # include "win/resource.h" - #endif - -+class GenodeConsole; -+ - #ifdef RT_OS_WINDOWS - [threading(free)] - #endif -@@ -122,7 +124,7 @@ private: - ComPtr mControl; - - #ifndef VBOX_COM_INPROC_API_CLIENT -- ComObjPtr mConsole; -+ ComObjPtr mConsole; - #endif - - ComPtr mRemoteMachine; -diff --git a/src/app/virtualbox/src/VBox/Main/src-all/EventImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-all/EventImpl.cpp -index 182f267..90b8716 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-all/EventImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-all/EventImpl.cpp -@@ -1263,7 +1263,8 @@ STDMETHODIMP EventSource::EventProcessed(IEventListener *aListener, - */ - class ATL_NO_VTABLE PassiveEventListener : - public VirtualBoxBase, -- VBOX_SCRIPTABLE_IMPL(IEventListener) -+ public IEventListener -+// VBOX_SCRIPTABLE_IMPL(IEventListener) - { - public: - -@@ -1302,7 +1303,8 @@ public: - /* Proxy listener class, used to aggregate multiple event sources into one */ - class ATL_NO_VTABLE ProxyEventListener : - public VirtualBoxBase, -- VBOX_SCRIPTABLE_IMPL(IEventListener) -+ public IEventListener -+// VBOX_SCRIPTABLE_IMPL(IEventListener) - { - ComPtr mSource; - public: -@@ -1349,8 +1351,9 @@ public: - }; - - class ATL_NO_VTABLE EventSourceAggregator : -- public VirtualBoxBase, -- VBOX_SCRIPTABLE_IMPL(IEventSource) -+// public VirtualBoxBase, -+ public EventSource -+// VBOX_SCRIPTABLE_IMPL(IEventSource) - { - typedef std::list > EventSourceList; - /* key is weak reference */ -@@ -1417,6 +1420,7 @@ public: - HRESULT removeProxyListener(IEventListener *aListener); - }; - -+#if 0 - #ifdef VBOX_WITH_XPCOM - NS_DECL_CLASSINFO(ProxyEventListener) - NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ProxyEventListener, IEventListener) -@@ -1431,6 +1435,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1_CI(EventSource, IEventSource) - NS_DECL_CLASSINFO(EventSourceAggregator) - NS_IMPL_THREADSAFE_ISUPPORTS1_CI(EventSourceAggregator, IEventSource) - #endif -+#endif - - - STDMETHODIMP EventSource::CreateListener(IEventListener **aListener) -diff --git a/src/app/virtualbox/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp -index e984238..b02cb45 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp -@@ -131,6 +131,6 @@ STDMETHODIMP PCIDeviceAttachment::COMGETTER(GuestAddress)(LONG * aGuestAddress) - } - - #ifdef VBOX_WITH_XPCOM --NS_DECL_CLASSINFO(PCIDeviceAttachment) --NS_IMPL_THREADSAFE_ISUPPORTS1_CI(PCIDeviceAttachment, IPCIDeviceAttachment) -+//NS_DECL_CLASSINFO(PCIDeviceAttachment) -+//NS_IMPL_THREADSAFE_ISUPPORTS1_CI(PCIDeviceAttachment, IPCIDeviceAttachment) - #endif -diff --git a/src/app/virtualbox/src/VBox/Main/src-all/ProgressImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-all/ProgressImpl.cpp -index fa3ecea..ac1a203 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-all/ProgressImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-all/ProgressImpl.cpp -@@ -20,9 +20,9 @@ - - - #if defined(VBOX_WITH_XPCOM) --#include --#include --#include -+//#include -+//#include -+//#include - #endif /* defined(VBOX_WITH_XPCOM) */ - - #include "ProgressImpl.h" -@@ -98,7 +98,7 @@ STDMETHODIMP Progress::COMGETTER(Initiator)(IUnknown **aInitiator) - else - { - ComObjPtr pVirtualBox(mParent); -- pVirtualBox.queryInterfaceTo(aInitiator); -+// pVirtualBox.queryInterfaceTo(aInitiator); - } - #else - mInitiator.queryInterfaceTo(aInitiator); -@@ -573,8 +573,10 @@ HRESULT Progress::init( - #endif - - unconst(mId).create(); -+/* - if (aId) - mId.cloneTo(aId); -+*/ - - #if !defined(VBOX_COM_INPROC) - /* add to the global collection of progress operations (note: after -@@ -1057,7 +1059,7 @@ HRESULT Progress::setResultCode(HRESULT aResultCode) - } - - #else /* !defined(VBOX_WITH_XPCOM) */ -- -+/* - nsCOMPtr es; - es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc); - if (NS_SUCCEEDED(rc)) -@@ -1076,6 +1078,7 @@ HRESULT Progress::setResultCode(HRESULT aResultCode) - } - } - } -+*/ - #endif /* !defined(VBOX_WITH_XPCOM) */ - - AssertMsg(rc == S_OK, ("Couldn't get error info (rc=%08X) while trying to set a failed result (%08X)!\n", -diff --git a/src/app/virtualbox/src/VBox/Main/src-all/VirtualBoxBase.cpp b/src/app/virtualbox/src/VBox/Main/src-all/VirtualBoxBase.cpp -index b43f5a6..6aef9df 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-all/VirtualBoxBase.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-all/VirtualBoxBase.cpp -@@ -23,6 +23,7 @@ - - #include - -+#if 0 - #if !defined (VBOX_WITH_XPCOM) - #include - #include -@@ -31,6 +32,7 @@ - #include - #include - #endif /* !defined (VBOX_WITH_XPCOM) */ -+#endif - - #include "VirtualBoxBase.h" - #include "AutoCaller.h" -@@ -296,6 +298,7 @@ void VirtualBoxBase::releaseCaller() - AssertMsgFailed (("mState = %d!", mState)); - } - -+#if 0 - /** - * Handles unexpected exceptions by turning them into COM errors in release - * builds or by hitting a breakpoint in the release builds. -@@ -770,6 +773,7 @@ void VirtualBoxBase::clearError(void) - #endif - } - -+#endif /* if 0 */ - - //////////////////////////////////////////////////////////////////////////////// - // -diff --git a/src/app/virtualbox/src/VBox/Main/src-client/BusAssignmentManager.cpp b/src/app/virtualbox/src/VBox/Main/src-client/BusAssignmentManager.cpp -index 068bb79..3b6adb3 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-client/BusAssignmentManager.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-client/BusAssignmentManager.cpp -@@ -72,6 +72,8 @@ static const DeviceAssignmentRule aGenericRules[] = - {"usb-ohci", 0, 6, 0, 0}, - {"usb-ehci", 0, 11, 0, 0}, - -+ {"nec-xhci", 0, 29, 0, 0}, -+ - /* ACPI controller */ - {"acpi", 0, 7, 0, 0}, - -diff --git a/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp -index 69e3109..3c534df 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp -@@ -51,23 +51,32 @@ - #include "KeyboardImpl.h" - #include "MouseImpl.h" - #include "DisplayImpl.h" -+#if 0 - #include "MachineDebuggerImpl.h" - #include "USBDeviceImpl.h" - #include "RemoteUSBDeviceImpl.h" -+#endif - #include "SharedFolderImpl.h" -+#if 0 - #include "AudioSnifferInterface.h" - #include "Nvram.h" - #ifdef VBOX_WITH_USB_CARDREADER - # include "UsbCardReader.h" - #endif -+#endif - #include "ProgressImpl.h" -+#if 0 - #include "ConsoleVRDPServer.h" -+#endif - #include "VMMDev.h" -+#if 0 - #ifdef VBOX_WITH_EXTPACK - # include "ExtPackManagerImpl.h" - #endif - #include "BusAssignmentManager.h" - #include "EmulatedUSBImpl.h" -+#endif -+#include "VirtualBoxImpl.h" - - #include "VBoxEvents.h" - #include "AutoCaller.h" -@@ -75,7 +84,9 @@ - - #include - #include "VBox/com/ErrorInfo.h" -+#if 0 - #include -+#endif - - #include - #include -@@ -90,9 +101,12 @@ - #include - #include - -+#if 0 - #include - #include -+#endif - #include -+#if 0 - #include - #include - #ifdef VBOX_WITH_USB -@@ -109,14 +123,17 @@ - #include - - #include -- -+#endif - #include -+#if 0 - #include - #ifdef VBOX_WITH_GUEST_PROPS - # include - # include - #endif - -+#endif /* #if 0 */ -+ - #include - #include - #include // for auto_ptr -@@ -278,6 +295,8 @@ struct VMSaveTask : public VMTask - Reason_T mReason; - }; - -+#if 0 -+ - // Handler for global events - //////////////////////////////////////////////////////////////////////////////// - inline static const char *networkAdapterTypeToName(NetworkAdapterType_T adapterType); -@@ -383,6 +402,7 @@ typedef ListenerImpl VmEventListenerImpl; - - VBOX_LISTENER_DECLARE(VmEventListenerImpl) - -+#endif /* #if 0 */ - - // constructor / destructor - ///////////////////////////////////////////////////////////////////////////// -@@ -530,6 +550,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc - rc = mDisplay->init(this); - AssertComRCReturnRC(rc); - -+#if 0 - unconst(mVRDEServerInfo).createObject(); - rc = mVRDEServerInfo->init(this); - AssertComRCReturnRC(rc); -@@ -538,6 +559,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc - rc = mEmulatedUSB->init(this); - AssertComRCReturnRC(rc); - -+#endif - /* Grab global and machine shared folder lists */ - - rc = fetchSharedFolders(true /* aGlobal */); -@@ -545,10 +567,12 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc - rc = fetchSharedFolders(false /* aGlobal */); - AssertComRCReturnRC(rc); - -+#if 0 - /* Create other child objects */ - - unconst(mConsoleVRDPServer) = new ConsoleVRDPServer(this); - AssertReturn(mConsoleVRDPServer, E_FAIL); -+#endif - - /* Figure out size of meAttachmentType vector */ - ComPtr pVirtualBox; -@@ -574,9 +598,11 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc - // unconst(m_pVMMDev) = new VMMDev(this); - // AssertReturn(mVMMDev, E_FAIL); - -+#if 0 - unconst(mAudioSniffer) = new AudioSniffer(this); - AssertReturn(mAudioSniffer, E_FAIL); - -+#endif - FirmwareType_T enmFirmwareType; - mMachine->COMGETTER(FirmwareType)(&enmFirmwareType); - if ( enmFirmwareType == FirmwareType_EFI -@@ -584,8 +610,10 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc - || enmFirmwareType == FirmwareType_EFI64 - || enmFirmwareType == FirmwareType_EFIDUAL) - { -+#if 0 - unconst(mNvram) = new Nvram(this); - AssertReturn(mNvram, E_FAIL); -+#endif - } - - #ifdef VBOX_WITH_USB_CARDREADER -@@ -593,6 +621,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc - AssertReturn(mUsbCardReader, E_FAIL); - #endif - -+#if 0 - /* VirtualBox events registration. */ - { - ComPtr pES; -@@ -609,6 +638,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc - rc = pES->RegisterListener(aVmListener, ComSafeArrayAsInParam(eventTypes), true); - AssertComRC(rc); - } -+#endif - } - - /* Confirm a successful initialization when it's the case */ -@@ -625,6 +655,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc - return S_OK; - } - -+#if 0 - /** - * Uninitializes the Console object. - */ -@@ -817,6 +848,8 @@ - LogFlowThisFuncLeave(); - } - -+#endif /* #if 0 */ -+ - #ifdef VBOX_WITH_GUEST_PROPS - - /** -@@ -858,6 +891,8 @@ - LogRel(("RESET: Unable to enumerate guest properties, rc=%Rhrc\n", hrc)); - } - -+#if 0 -+ - bool Console::guestPropertiesVRDPEnabled(void) - { - Bstr value; -@@ -1055,6 +1090,8 @@ - return; - } - -+#endif /* #if 0 */ -+ - #endif /* VBOX_WITH_GUEST_PROPS */ - - bool Console::isResetTurnedIntoPowerOff(void) -@@ -1046,6 +1079,8 @@ bool Console::isResetTurnedIntoPowerOff(void) - return false; - } - -+#if 0 -+ - #ifdef VBOX_WITH_EXTPACK - /** - * Used by VRDEServer and others to talke to the extension pack manager. -@@ -1505,6 +1540,7 @@ void Console::VRDPInterceptClipboard(uint32_t u32ClientId) - return; - } - -+#endif /* if 0 */ - - //static - const char *Console::sSSMConsoleUnit = "ConsoleData"; -@@ -1970,6 +2006,8 @@ STDMETHODIMP Console::COMGETTER(Display)(IDisplay **aDisplay) - return S_OK; - } - -+#if 0 -+ - STDMETHODIMP Console::COMGETTER(Debugger)(IMachineDebugger **aDebugger) - { - CheckComArgOutPointerValid(aDebugger); -@@ -2069,6 +2107,7 @@ Console::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolder - return S_OK; - } - -+#endif /* #if 0 */ - - STDMETHODIMP Console::COMGETTER(EventSource)(IEventSource ** aEventSource) - { -@@ -2085,6 +2124,8 @@ STDMETHODIMP Console::COMGETTER(EventSource)(IEventSource ** aEventSource) - return hrc; - } - -+#if 0 -+ - STDMETHODIMP Console::COMGETTER(AttachedPCIDevices)(ComSafeArrayOut(IPCIDeviceAttachment *, aAttachments)) - { - CheckComArgOutSafeArrayPointerValid(aAttachments); -@@ -2134,6 +2175,7 @@ STDMETHODIMP Console::COMSETTER(UseHostClipboard)(BOOL aUseHostClipboard) - // IConsole methods - ///////////////////////////////////////////////////////////////////////////// - -+#endif /* #if 0 */ - - STDMETHODIMP Console::PowerUp(IProgress **aProgress) - { -@@ -2291,6 +2333,8 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress) - return rc; - } - -+#if 0 -+ - STDMETHODIMP Console::Reset() - { - LogFlowThisFuncEnter(); -@@ -2579,6 +2623,7 @@ STDMETHODIMP Console::Resume() - LogFlowThisFuncLeave(); - return rc; - } -+#endif - - STDMETHODIMP Console::PowerButton() - { -@@ -2625,6 +2670,7 @@ STDMETHODIMP Console::PowerButton() - return rc; - } - -+#if 0 - STDMETHODIMP Console::GetPowerButtonHandled(BOOL *aHandled) - { - LogFlowThisFuncEnter(); -@@ -3451,6 +3497,8 @@ STDMETHODIMP Console::RestoreSnapshot(ISnapshot *aSnapshot, IProgress **aProgres - return S_OK; - } - -+#endif /* #if 0 */ -+ - // Non-interface public methods - ///////////////////////////////////////////////////////////////////////////// - -@@ -3526,6 +3574,8 @@ HRESULT Console::convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG - } - } - -+#if 0 -+ - // private methods - ///////////////////////////////////////////////////////////////////////////// - -@@ -4388,6 +4438,8 @@ HRESULT Console::onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove, - return rc; - } - -+#endif /* #if 0 */ -+ - VMMDevMouseInterface *Console::getVMMDevMouseInterface() - { - return m_pVMMDev; -@@ -4398,6 +4450,8 @@ DisplayMouseInterface *Console::getDisplayMouseInterface() - return mDisplay; - } - -+#if 0 -+ - /** - * Parses one key value pair. - * -@@ -4566,6 +4620,8 @@ - return rc; - } - -+#endif /* #if 0 */ -+ - /** - * Removes the key interfaces from all disk attachments, useful when - * changing the key store or dropping it. -@@ -4650,6 +4706,8 @@ - return hrc; - } - -+#if 0 -+ - /** - * Configures the encryption support for the disk identified by the gien UUID with - * the given key. -@@ -5344,6 +5402,8 @@ - fireVRDEServerInfoChangedEvent(mEventSource); - } - -+#endif /* #if 0 */ -+ - HRESULT Console::i_sendACPIMonitorHotPlugEvent() - { - LogFlowThisFuncEnter(); -@@ -5385,6 +5445,8 @@ - return rc; - } - -+#if 0 -+ - HRESULT Console::onVideoCaptureChange() - { - AutoCaller autoCaller(this); -@@ -5778,6 +5844,8 @@ - return hrc; - } - -+#endif /* #if 0 */ -+ - /** - * @note Temporarily locks this object for writing. - */ -@@ -5978,6 +6046,7 @@ - #endif /* VBOX_WITH_GUEST_PROPS */ - } - -+#if 0 - - /* - * Internal: helper function for connecting progress reporting -@@ -6490,6 +6544,8 @@ void Console::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelati - fireMouseCapabilityChangedEvent(mEventSource, supportsAbsolute, supportsRelative, supportsMT, needsHostCursor); - } - -+#endif /* #if 0 */ -+ - void Console::onStateChange(MachineState_T machineState) - { - AutoCaller autoCaller(this); -@@ -6497,6 +6553,8 @@ void Console::onStateChange(MachineState_T machineState) - fireStateChangedEvent(mEventSource, machineState); - } - -+#if 0 -+ - void Console::onAdditionsStateChange() - { - AutoCaller autoCaller(this); -@@ -6555,6 +6613,8 @@ void Console::onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached, - fireUSBDeviceStateChangedEvent(mEventSource, aDevice, aAttached, aError); - } - -+#endif /* #if 0 */ -+ - void Console::onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage) - { - AutoCaller autoCaller(this); -@@ -6563,6 +6623,8 @@ void Console::onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage) - fireRuntimeErrorEvent(mEventSource, aFatal, aErrorID, aMessage); - } - -+#if 0 -+ - HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) - { - AssertReturn(aCanShow, E_POINTER); -@@ -6626,6 +6688,8 @@ HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) - return S_OK; - } - -+#endif /* #if 0 */ -+ - // private methods - //////////////////////////////////////////////////////////////////////////////// - -@@ -6819,6 +6883,8 @@ HRESULT Console::consoleInitReleaseLog(const ComPtr aMachine) - } - } - -+#if 0 -+ - char szError[RTPATH_MAX + 128]; - int vrc = com::VBoxLogRelCreate("VM", logFile.c_str(), - RTLOGFLAGS_PREFIX_TIME_PROG | RTLOGFLAGS_RESTRICT_GROUPS, -@@ -6839,6 +6905,8 @@ HRESULT Console::consoleInitReleaseLog(const ComPtr aMachine) - if (SUCCEEDED(hrc) || cHistoryFiles) - RTDirFlush(logDir.c_str()); - -+#endif /* if 0 */ -+ - return hrc; - } - -@@ -7113,6 +7181,10 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) - } - #endif - -+ ComPtr pIVirtualBox; -+ mMachine->COMGETTER(Parent)(pIVirtualBox.asOutParam()); -+ VirtualBox *pVirtualBox = -+ dynamic_cast(*pIVirtualBox.asOutParam()); - - // If there is immutable drive the process that. - VMPowerUpTask::ProgressList progresses(task->hardDiskProgresses); -@@ -7123,7 +7195,8 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) - ++cOperations; - ulTotalOperationsWeight += 1; - } -- rc = pPowerupProgress->init(static_cast(this), -+ rc = pPowerupProgress->init(pVirtualBox, -+ static_cast(this), - progressDesc.raw(), - TRUE, // Cancelable - cOperations, -@@ -7136,13 +7209,15 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) - else if ( mMachineState == MachineState_Saved - || (!fTeleporterEnabled && !fFaultToleranceSyncEnabled)) - { -- rc = pPowerupProgress->init(static_cast(this), -+ rc = pPowerupProgress->init(pVirtualBox, -+ static_cast(this), - progressDesc.raw(), - FALSE /* aCancelable */); - } - else if (fTeleporterEnabled) - { -- rc = pPowerupProgress->init(static_cast(this), -+ rc = pPowerupProgress->init(pVirtualBox, -+ static_cast(this), - progressDesc.raw(), - TRUE /* aCancelable */, - 3 /* cOperations */, -@@ -7153,7 +7228,8 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused) - } - else if (fFaultToleranceSyncEnabled) - { -- rc = pPowerupProgress->init(static_cast(this), -+ rc = pPowerupProgress->init(pVirtualBox, -+ static_cast(this), - progressDesc.raw(), - TRUE /* aCancelable */, - 3 /* cOperations */, -@@ -7399,6 +7475,7 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/) - * safe to release the object lock now if needed) - * ---------------------------------------------------------------------- */ - -+#if 0 - /* Stop the VRDP server to prevent new clients connection while VM is being - * powered off. */ - if (mConsoleVRDPServer) -@@ -7413,6 +7490,7 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/) - - alock.acquire(); - } -+#endif - - /* advance percent count */ - if (aProgress) -@@ -7649,6 +7727,8 @@ HRESULT Console::setMachineState(MachineState_T aMachineState, - return rc; - } - -+#if 0 -+ - /** - * Searches for a shared folder with the given logical name - * in the collection of shared folders. -@@ -7684,6 +7764,8 @@ HRESULT Console::findSharedFolder(const Utf8Str &strName, - return VBOX_E_FILE_ERROR; - } - -+#endif /* #if 0 */ -+ - /** - * Fetches the list of global or machine shared folders from the server. - * -@@ -8390,6 +8472,8 @@ void Console::changeClipboardMode(ClipboardMode_T aClipboardMode) - pVMMDev->hgcmHostCall("VBoxSharedClipboard", VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE, 1, &parm); - } - -+#if 0 -+ - /** - * Changes the drag'n_drop mode. - * -@@ -8590,12 +8674,13 @@ HRESULT Console::detachUSBDevice(const ComObjPtr &aHostDevice) - setErrorStatic(hrc2, "GetRemote() failed"); - - PCRTUUID pUuid = aHostDevice->id().raw(); -+#if 0 - if (fRemote) - { - Guid guid(*pUuid); - consoleVRDPServer()->USBBackendReleasePointer(&guid); - } -- -+#endif - alock.release(); - int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */, - (PFNRT)usbDetachCallback, 5, -@@ -8875,6 +8960,8 @@ HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter) - } - #endif /* (RT_OS_LINUX || RT_OS_FREEBSD) && !VBOX_WITH_NETFLT */ - -+#endif /* #if 0 */ -+ - /** - * Called at power down to terminate host interface networking. - * -@@ -9077,6 +9164,8 @@ void Console::detachAllUSBDevices(bool aDone) - mControl->DetachAllUSBDevices(aDone); - } - -+#if 0 -+ - /** - * @note Locks this object for writing. - */ -@@ -9249,6 +9338,8 @@ void Console::processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *p - LogFlowThisFuncLeave(); - } - -+#endif /* #if 0 */ -+ - /** - * Progress cancelation callback for fault tolerance VM poweron - */ -@@ -9346,6 +9437,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) - /* Create the VRDP server. In case of headless operation, this will - * also create the framebuffer, required at VM creation. - */ -+#if 0 - ConsoleVRDPServer *server = pConsole->consoleVRDPServer(); - Assert(server); - -@@ -9392,6 +9484,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) - vrc, errMsg.c_str())); - throw setErrorStatic(E_FAIL, errMsg.c_str()); - } -+#endif - - ComPtr pMachine = pConsole->machine(); - ULONG cCpus = 1; -@@ -9416,8 +9509,10 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) - - alock.acquire(); - -+#if 0 - /* Enable client connections to the server. */ - pConsole->consoleVRDPServer()->EnableConnections(); -+#endif - - if (RT_SUCCESS(vrc)) - { -@@ -9441,9 +9536,11 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) - /* - * Synchronize debugger settings - */ -+#if 0 - MachineDebugger *machineDebugger = pConsole->getMachineDebugger(); - if (machineDebugger) - machineDebugger->flushQueuedSettings(); -+#endif - - /* - * Shared Folders -@@ -9719,6 +9816,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser) - return VINF_SUCCESS; - } - -+#if 0 - - /** - * Reconfigures a medium attachment (part of taking or deleting an online snapshot). -@@ -10209,6 +10307,8 @@ DECLCALLBACK(int) Console::saveStateThread(RTTHREAD Thread, void *pvUser) - return VINF_SUCCESS; - } - -+#endif /* #if 0 */ -+ - /** - * Thread for powering down the Console. - * -diff --git a/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl2.cpp b/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl2.cpp -index caed4be..19c3dc0 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl2.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl2.cpp -@@ -27,6 +27,7 @@ - #include "VBox/com/ptr.h" - - #include "ConsoleImpl.h" -+#include "MachineImpl.h" - #include "DisplayImpl.h" - #ifdef VBOX_WITH_GUEST_CONTROL - # include "GuestImpl.h" -@@ -129,6 +130,7 @@ - *******************************************************************************/ - static Utf8Str *GetExtraDataBoth(IVirtualBox *pVirtualBox, IMachine *pMachine, const char *pszName, Utf8Str *pStrValue); - -+#if 0 - - - #if defined(RT_OS_DARWIN) -@@ -202,6 +204,7 @@ static int DarwinSmcKey(char *pabKey, uint32_t cbKey) - /* Comment out the following line to remove VMWare compatibility hack. */ - #define VMWARE_NET_IN_SLOT_11 - -+#endif - /** - * Translate IDE StorageControllerType_T to string representation. - */ -@@ -602,6 +602,7 @@ static int SetBiosDiskInfo(ComPtr pMachine, PCFGMNODE pCfg, PCFGMNODE - return S_OK; - } - -+#if 0 - #ifdef VBOX_WITH_PCI_PASSTHROUGH - HRESULT Console::attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *pBusMgr, PCFGMNODE pDevices) - { -@@ -741,6 +746,7 @@ HRESULT Console::attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *pBusMgr, P - } - #endif - -+#endif /* if 0 */ - - void Console::attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds, - uint64_t uFirst, uint64_t uLast, -@@ -2070,6 +2076,8 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock) - case NetworkAdapterType_I82545EM: - InsertConfigInteger(pCfg, "AdapterType", 2); - break; -+ default: -+ break; - } - - /* -@@ -2225,6 +2233,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock) - /* - * Parallel (LPT) Ports - */ -+#if 0 - InsertConfigNode(pDevices, "parallel", &pDev); - for (ULONG ulInstance = 0; ulInstance < SchemaDefs::ParallelPortCount; ++ulInstance) - { -@@ -2254,6 +2263,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock) - InsertConfigString(pLunL1, "DevicePath", bstr); - } - -+#endif - /* - * VMM Device - */ -@@ -2286,6 +2296,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock) - /* - * Audio Sniffer Device - */ -+#if 0 - InsertConfigNode(pDevices, "AudioSniffer", &pDev); - InsertConfigNode(pDev, "0", &pInst); - InsertConfigNode(pInst, "Config", &pCfg); -@@ -2300,6 +2311,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock) - /* - * AC'97 ICH / SoundBlaster16 audio / Intel HD Audio - */ -+#endif - BOOL fAudioEnabled = FALSE; - ComPtr audioAdapter; - hrc = pMachine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam()); H(); -@@ -2421,6 +2433,8 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock) - break; - } - #endif -+ default: -+ break; - } - hrc = pMachine->COMGETTER(Name)(bstr.asOutParam()); H(); - InsertConfigString(pCfg, "StreamName", bstr); -@@ -2523,7 +2537,6 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock) - #endif - } /* for every USB controller. */ - -- - /* - * Virtual USB Devices. - */ -@@ -2652,6 +2665,18 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock) - } - } - -+ extern bool use_xhci_controller(); -+ if (use_xhci_controller()) { -+ /* -+ * NEC XHCI Device -+ */ -+ InsertConfigNode(pDevices, "nec-xhci", &pDev); -+ InsertConfigNode(pDev, "0", &pInst); -+ InsertConfigNode(pInst, "Config", &pCfg); -+ InsertConfigInteger(pInst, "Trusted", 1); -+ hrc = pBusMgr->assignPCIDevice("nec-xhci", pInst); H(); -+ } -+ - /* - * Clipboard - */ -@@ -3533,6 +3558,8 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst, - ComPtr pMedium; - hrc = pMediumAtt->COMGETTER(Medium)(pMedium.asOutParam()); H(); - -+#if 0 -+ - /* - * 1. Only check this for hard disk images. - * 2. Only check during VM creation and not later, especially not during -@@ -3717,6 +3744,8 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst, - } - } - -+#endif /* if 0 */ -+ - if (pMedium) - { - BOOL fHostDrive; -@@ -3810,7 +3839,7 @@ int Console::configMedium(PCFGMNODE pLunL0, - // InsertConfig* throws - try - { -- int rc = VINF_SUCCESS; -+// int rc = VINF_SUCCESS; - HRESULT hrc; - Bstr bstr; - PCFGMNODE pLunL1 = NULL; -@@ -4414,7 +4443,7 @@ int Console::configNetwork(const char *pszDevice, - { - switch (hrc) - { -- case VERR_ACCESS_DENIED: -+ case E_ACCESSDENIED: - return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_( - "Failed to open '/dev/net/tun' for read/write access. Please check the " - "permissions of that node. Either run 'chmod 0666 /dev/net/tun' or " -@@ -4428,12 +4457,12 @@ int Console::configNetwork(const char *pszDevice, - } - } - -- Assert((int)maTapFD[uInstance] >= 0); -- if ((int)maTapFD[uInstance] >= 0) -+ Assert((long)maTapFD[uInstance] >= 0); -+ if ((long)maTapFD[uInstance] >= 0) - { - InsertConfigString(pLunL0, "Driver", "HostInterface"); - InsertConfigNode(pLunL0, "Config", &pCfg); -- InsertConfigInteger(pCfg, "FileHandle", maTapFD[uInstance]); -+ InsertConfigInteger(pCfg, "FileHandle", (long)maTapFD[uInstance]); - } - - #elif defined(VBOX_WITH_NETFLT) -@@ -5180,6 +5209,10 @@ int Console::configNetwork(const char *pszDevice, - - #undef H - -+ /* store the slot index for later */ -+ InsertConfigInteger(pCfg, "Slot", uInstance); -+ -+ - return VINF_SUCCESS; - } - -diff --git a/src/app/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp -index fed0ac3..bc3c334 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp -@@ -16,7 +16,9 @@ - #include "DisplayImpl.h" - #include "DisplayUtils.h" - #include "ConsoleImpl.h" -+#if 0 - #include "ConsoleVRDPServer.h" -+#endif - #include "GuestImpl.h" - #include "VMMDev.h" - -@@ -1067,7 +1070,9 @@ void Display::handleResizeCompletedEMT(BOOL fResizeContext) - * Must be done before calling NotifyUpdate below. - */ - LogRelFlowFunc(("Calling VRDP\n")); -+#if 0 - mParent->consoleVRDPServer()->SendResize(); -+#endif - - /* @todo Merge these two 'if's within one 'if (!pFBInfo->pFramebuffer.isNull())' */ - if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && !pFBInfo->pFramebuffer.isNull()) -@@ -1266,8 +1271,10 @@ void Display::handleDisplayUpdate (unsigned uScreenId, int x, int y, int w, int - /* When VBVA is enabled, the VRDP server is informed in the VideoAccelFlush. - * Inform the server here only if VBVA is disabled. - */ -+#if 0 - if (maFramebuffers[uScreenId].u32ResizeStatus == ResizeStatus_Void) - mParent->consoleVRDPServer()->SendUpdateBitmap(uScreenId, x, y, w, h); -+#endif - } - } - -@@ -2260,7 +2267,9 @@ void Display::videoAccelFlush (void) - vbvaRgnDirtyRect (&rgn, uScreenId, phdr); - - /* Forward the command to VRDP server. */ -+#if 0 - mParent->consoleVRDPServer()->SendUpdate (uScreenId, phdr, cbCmd); -+#endif - - *phdr = hdrSaved; - } -@@ -3248,9 +3257,11 @@ int Display::drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, - rc = VERR_INVALID_PARAMETER; - } - -+#if 0 - if ( RT_SUCCESS(rc) - && pDisplay->maFramebuffers[aScreenId].u32ResizeStatus == ResizeStatus_Void) - pDisplay->mParent->consoleVRDPServer()->SendUpdateBitmap(aScreenId, x, y, width, height); -+#endif - - pDisplay->vbvaUnlock(); - return rc; -@@ -3701,7 +3712,9 @@ DECLCALLBACK(int) Display::changeFramebuffer (Display *that, IFramebuffer *aFB, - DISPLAYFBINFO *pDisplayFBInfo = &that->maFramebuffers[uScreenId]; - pDisplayFBInfo->pFramebuffer = aFB; - -+#if 0 - that->mParent->consoleVRDPServer()->SendResize (); -+#endif - - /* The driver might not have been constructed yet */ - if (that->mpDrv) -@@ -3877,8 +3890,10 @@ DECLCALLBACK(void) Display::displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterf - - if (!pFBInfo->pFramebuffer.isNull() && pFBInfo->u32ResizeStatus == ResizeStatus_Void) - { -+#if 0 - Assert (pDisplay->mParent && pDisplay->mParent->consoleVRDPServer()); - pDisplay->mParent->consoleVRDPServer()->SendUpdate (uScreenId, NULL, 0); -+#endif - } - } - } -@@ -4758,7 +4773,9 @@ DECLCALLBACK(void) Display::displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInte - pHdrUnconst->y -= (int16_t)pFBInfo->yOrigin; - - /* @todo new SendUpdate entry which can get a separate cmd header or coords. */ -+#if 0 - pThis->mParent->consoleVRDPServer()->SendUpdate (uScreenId, pCmd, (uint32_t)cbCmd); -+#endif - - *pHdrUnconst = hdrSaved; - } -@@ -5004,7 +5021,9 @@ DECLCALLBACK(int) Display::displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, c - { - /* VRDP server still need this notification. */ - LogRelFlowFunc(("Calling VRDP\n")); -+#if 0 - pThis->mParent->consoleVRDPServer()->SendResize(); -+#endif - } - return VINF_SUCCESS; - } -diff --git a/src/app/virtualbox/src/VBox/Main/src-client/GuestImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-client/GuestImpl.cpp -index b438f9d..2b9755e 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-client/GuestImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-client/GuestImpl.cpp -@@ -16,6 +16,7 @@ - */ - - #include "GuestImpl.h" -+#include "MachineImpl.h" - #include "GuestSessionImpl.h" - - #include "Global.h" -@@ -104,11 +105,11 @@ HRESULT Guest::init(Console *aParent) - mVmValidStats = pm::VMSTATMASK_NONE; - - mMagic = GUEST_MAGIC; -+#ifdef VBOX_WITH_GUEST_CONTROL - int vrc = RTTimerLRCreate(&mStatTimer, 1000 /* ms */, - &Guest::staticUpdateStats, this); - AssertMsgRC(vrc, ("Failed to create guest statistics update timer (%Rrc)\n", vrc)); - --#ifdef VBOX_WITH_GUEST_CONTROL - hr = unconst(mEventSource).createObject(); - if (SUCCEEDED(hr)) - hr = mEventSource->init(); -@@ -183,6 +184,7 @@ void Guest::uninit() - LogFlowFuncLeave(); - } - -+#ifdef VBOX_WITH_GUEST_CONTROL - /* static */ - DECLCALLBACK(void) Guest::staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick) - { -@@ -194,6 +196,7 @@ DECLCALLBACK(void) Guest::staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, ui - - NOREF(hTimerLR); - } -+#endif - - /* static */ - int Guest::staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit, -@@ -1177,8 +1180,11 @@ void Guest::onUserStateChange(Bstr aUser, Bstr aDomain, VBoxGuestUserState enmSt - - Bstr strDetails; /** @todo Implement state details here. */ - -+#ifdef VBOX_WITH_GUEST_CONTROL - fireGuestUserStateChangedEvent(mEventSource, aUser.raw(), aDomain.raw(), - (GuestUserState_T)enmState, strDetails.raw()); -+#endif -+ - LogFlowFuncLeave(); - } - -diff --git a/src/app/virtualbox/src/VBox/Main/src-client/MouseImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-client/MouseImpl.cpp -index 652f2df..877b775 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-client/MouseImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-client/MouseImpl.cpp -@@ -816,7 +816,11 @@ HRESULT Mouse::putEventMultiTouch(LONG aCount, - } - } - -- if (SUCCEEDED(rc)) -+ /* -+ * Contrary to the comment of the previous if clause, the usb model -+ * triggers various assertions if 0 contacts are propagated. -+ */ -+ if (SUCCEEDED(rc) && cContacts) - { - rc = reportMultiTouchEventToDevice(cContacts, cContacts? pau64Contacts: NULL, (uint32_t)aScanTime); - -diff --git a/src/app/virtualbox/src/VBox/Main/src-client/SessionImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-client/SessionImpl.cpp -index 6ea10d3..267be48 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-client/SessionImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-client/SessionImpl.cpp -@@ -17,8 +17,11 @@ - - #include "SessionImpl.h" - #include "ConsoleImpl.h" -+#include "MachineImpl.h" - #include "Global.h" -+#if 0 - #include "ClientTokenHolder.h" -+#endif - - #include "AutoCaller.h" - #include "Logging.h" -@@ -26,6 +29,8 @@ - #include - #include - -+#include "console.h" -+ - /** - * Local macro to check whether the session is open and return an error if not. - * @note Don't forget to do |Auto[Reader]Lock alock (this);| before using this -@@ -329,7 +334,9 @@ STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType, - - /* query IInternalMachineControl interface */ - mControl = aMachine; -+#if 0 - AssertReturn(!!mControl, E_FAIL); -+#endif - - #ifndef VBOX_COM_INPROC_API_CLIENT - HRESULT rc = mConsole.createObject(); -@@ -349,6 +356,7 @@ STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType, - AssertPtr(aToken); - #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */ - /* create the machine client token */ -+#if 0 - try - { - #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER -@@ -367,6 +375,7 @@ STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType, - { - rc = E_OUTOFMEMORY; - } -+#endif - - /* - * Reference the VirtualBox object to ensure the server is up -@@ -1217,12 +1226,14 @@ HRESULT Session::unlockMachine(bool aFinalRelease, bool aFromServer, AutoWriteLo - - if (mType == SessionType_WriteLock) - { -+#if 0 - if (mClientTokenHolder) - { - delete mClientTokenHolder; - mClientTokenHolder = NULL; - } - -+#endif - if (!aFinalRelease && !aFromServer) - { - /* -diff --git a/src/app/virtualbox/src/VBox/Main/src-client/VBoxDriversRegister.cpp b/src/app/virtualbox/src/VBox/Main/src-client/VBoxDriversRegister.cpp -index 7fa0f99..d85976d 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-client/VBoxDriversRegister.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-client/VBoxDriversRegister.cpp -@@ -25,7 +25,9 @@ - #include "VMMDev.h" - #include "AudioSnifferInterface.h" - #include "Nvram.h" -+#if 0 - #include "UsbWebcamInterface.h" -+#endif - #ifdef VBOX_WITH_USB_CARDREADER - # include "UsbCardReader.h" - #endif -@@ -46,7 +48,7 @@ - * @param pCallbacks Pointer to the callback table. - * @param u32Version VBox version number. - */ --extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version) -+extern "C" DECLEXPORT(int) VBoxDriversRegister_Main(PCPDMDRVREGCB pCallbacks, uint32_t u32Version) - { - LogFlow(("VBoxDriversRegister: u32Version=%#x\n", u32Version)); - AssertReleaseMsg(u32Version == VBOX_VERSION, ("u32Version=%#x VBOX_VERSION=%#x\n", u32Version, VBOX_VERSION)); -@@ -67,6 +69,7 @@ extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_ - if (RT_FAILURE(rc)) - return rc; - -+#if 0 - rc = pCallbacks->pfnRegister(pCallbacks, &AudioSniffer::DrvReg); - if (RT_FAILURE(rc)) - return rc; -@@ -78,6 +81,7 @@ extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_ - rc = pCallbacks->pfnRegister(pCallbacks, &EmWebcam::DrvReg); - if (RT_FAILURE(rc)) - return rc; -+#endif - - #ifdef VBOX_WITH_USB_CARDREADER - rc = pCallbacks->pfnRegister(pCallbacks, &UsbCardReader::DrvReg); -diff --git a/src/app/virtualbox/src/VBox/Main/src-client/VMMDevInterface.cpp b/src/app/virtualbox/src/VBox/Main/src-client/VMMDevInterface.cpp -index b4f4da4..a341e45 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-client/VMMDevInterface.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-client/VMMDevInterface.cpp -@@ -553,7 +553,9 @@ DECLCALLBACK(int) vmmdevIsPageFusionEnabled(PPDMIVMMDEVCONNECTOR pInterface, boo - { - PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface); - Console *pConsole = pDrv->pVMMDev->getParent(); -+#if 0 - BOOL val = 0; -+#endif - - if (!pfPageFusionEnabled) - return VERR_INVALID_POINTER; -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/ClientToken.cpp b/src/app/virtualbox/src/VBox/Main/src-server/ClientToken.cpp -index be0afb8..54d5ba4 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/ClientToken.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/ClientToken.cpp -@@ -179,11 +179,7 @@ Machine::ClientToken::ClientToken(const ComObjPtr &pMachine, - { - mClientToken = pToken; - if (mClientToken) -- { -- rc = mClientToken->AddRef(); -- if (FAILED(rc)) -- mClientToken = NULL; -- } -+ mClientToken->AddRef(); - } - } - pToken.setNull(); -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/DHCPServerImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/DHCPServerImpl.cpp -index 1cd7ce7..366d693 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/DHCPServerImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/DHCPServerImpl.cpp -@@ -20,6 +20,7 @@ - #include - #include "NetworkServiceRunner.h" - #include "DHCPServerImpl.h" -+#include "MachineImpl.h" - #include "AutoCaller.h" - #include "Logging.h" - -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -index 3889a01..5fcb53c 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp -@@ -3826,8 +3826,10 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession, - /* request an IUnknown pointer early from the remote party for later - * identity checks (it will be internally cached within mDirectControl - * at least on XPCOM) */ -+#if 0 - ComPtr unk = mData->mSession.mDirectControl; - NOREF(unk); -+#endif - } - - /* Release the lock since SessionMachine::uninit() locks VirtualBox which -@@ -4920,7 +4922,7 @@ STDMETHODIMP Machine::SetHotPluggableForDevice(IN_BSTR aControllerName, LONG aCo - STDMETHODIMP Machine::SetNoBandwidthGroupForDevice(IN_BSTR aControllerName, LONG aControllerPort, - LONG aDevice) - { -- int rc = S_OK; -+ HRESULT rc = S_OK; - LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n", - aControllerName, aControllerPort, aDevice)); - -@@ -5014,7 +5016,7 @@ STDMETHODIMP Machine::UnmountMedium(IN_BSTR aControllerName, - LONG aDevice, - BOOL aForce) - { -- int rc = S_OK; -+ HRESULT rc = S_OK; - LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d", - aControllerName, aControllerPort, aForce)); - -@@ -5029,7 +5031,7 @@ STDMETHODIMP Machine::MountMedium(IN_BSTR aControllerName, - IMedium *aMedium, - BOOL aForce) - { -- int rc = S_OK; -+ HRESULT rc = S_OK; - LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aForce=%d\n", - aControllerName, aControllerPort, aDevice, aForce)); - -@@ -8025,7 +8027,9 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl, - size_t cchBufLeft = strlen(szPath); - szPath[cchBufLeft++] = RTPATH_DELIMITER; - szPath[cchBufLeft] = 0; -+#ifdef VBOX_WITH_QTGUI - char *pszNamePart = szPath + cchBufLeft; -+#endif - cchBufLeft = sizeof(szPath) - cchBufLeft; - - int vrc = VINF_SUCCESS; -@@ -8500,6 +8508,7 @@ HRESULT Machine::prepareRegister() - - // Ensure the settings are saved. If we are going to be registered and - // no config file exists yet, create it by calling saveSettings() too. -+#if 0 - if ( (mData->flModifications) - || (!mData->pMachineConfigFile->fileExists()) - ) -@@ -8509,6 +8518,7 @@ HRESULT Machine::prepareRegister() - // we can't have a machine XML file rename pending - if (FAILED(rc)) return rc; - } -+#endif - - /* more config checking goes here */ - -@@ -8740,9 +8750,8 @@ HRESULT Machine::initDataAndChildObjects() - { - AutoCaller autoCaller(this); - AssertComRCReturnRC(autoCaller.rc()); -- AssertComRCReturn(autoCaller.state() == InInit || -+ AssertReturn(autoCaller.state() == InInit || - autoCaller.state() == Limited, E_FAIL); -- - AssertReturn(!mData->mAccessible, E_FAIL); - - /* allocate data structures */ -@@ -9097,7 +9106,7 @@ HRESULT Machine::loadMachineDataFromSettings(const settings::MachineConfigFile & - cbOut, - DECODE_STR_MAX); - com::SafeArray iconByte(cbOut); -- HRESULT rc = RTBase64Decode(pszStr, iconByte.raw(), cbOut, NULL, NULL); -+ HRESULT rc = Global::vboxStatusCodeToCOM(RTBase64Decode(pszStr, iconByte.raw(), cbOut, NULL, NULL)); - if (FAILED(rc)) - return setError(E_FAIL, - tr("Failure to Decode Icon Data. '%s' (%d)"), -@@ -12844,7 +12853,9 @@ HRESULT SessionMachine::init(Machine *aMachine) - - AssertReturn(aMachine, E_INVALIDARG); - -+#if 0 - AssertReturn(aMachine->lockHandle()->isWriteLockOnCurrentThread(), E_FAIL); -+#endif - - /* Enclose the state transition NotReady->InInit->Ready */ - AutoInitSpan autoInitSpan(this); -@@ -12975,7 +12986,7 @@ void SessionMachine::uninit(Uninit::Reason aReason) - * accessing any members (and before AutoUninitSpan that does it as well). - * This self reference will be released as the very last step on return. - */ -- ComObjPtr selfRef = this; -+// ComObjPtr selfRef = this; - - /* Enclose the state transition Ready->InUninit->NotReady */ - AutoUninitSpan autoUninitSpan(this); -@@ -13464,12 +13475,12 @@ STDMETHODIMP SessionMachine::EndPoweringDown(LONG iResult, IN_BSTR aErrMsg) - { - Utf8Str strErrMsg(aErrMsg); - if (strErrMsg.length()) -- mConsoleTaskData.mProgress->notifyComplete(iResult, -+ mConsoleTaskData.mProgress->notifyComplete(Global::vboxStatusCodeToCOM(iResult), - COM_IIDOF(ISession), - getComponentName(), - strErrMsg.c_str()); - else -- mConsoleTaskData.mProgress->notifyComplete(iResult); -+ mConsoleTaskData.mProgress->notifyComplete(Global::vboxStatusCodeToCOM(iResult)); - } - - /* clear out the temporary saved state data */ -@@ -13679,8 +13690,8 @@ STDMETHODIMP SessionMachine::OnSessionEnd(ISession *aSession, - Assert(mData->mSession.mProgress.isNull()); - ComObjPtr progress; - progress.createObject(); -- ComPtr pPeer(mPeer); -- progress->init(mParent, pPeer, -+// ComPtr pPeer(mPeer); -+ progress->init(mParent, nullptr, - Bstr(tr("Closing session")).raw(), - FALSE /* aCancelable */); - progress.queryInterfaceTo(aProgress); -@@ -13787,7 +13798,7 @@ STDMETHODIMP SessionMachine::EndSavingState(LONG iResult, IN_BSTR aErrMsg) - if (FAILED(iResult)) - setMachineState(mConsoleTaskData.mLastState); - -- return endSavingState(iResult, aErrMsg); -+ return endSavingState(Global::vboxStatusCodeToCOM(iResult), aErrMsg); - } - - /** -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/MachineImplCloneVM.cpp b/src/app/virtualbox/src/VBox/Main/src-server/MachineImplCloneVM.cpp -index 3a7507d..ce9a2b3 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/MachineImplCloneVM.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/MachineImplCloneVM.cpp -@@ -889,7 +889,7 @@ HRESULT MachineCloneVM::start(IProgress **pProgress) - rc = d->pProgress.createObject(); - if (FAILED(rc)) throw rc; - rc = d->pProgress->init(p->getVirtualBox(), -- static_cast(d->pSrcMachine) /* aInitiator */, -+ nullptr /* aInitiator */, - Bstr(p->tr("Cloning Machine")).raw(), - true /* fCancellable */, - uCount, -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/MediumImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/MediumImpl.cpp -index c61ea6f..ed4bb7a 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/MediumImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/MediumImpl.cpp -@@ -20,7 +20,9 @@ - #include "ProgressImpl.h" - #include "SystemPropertiesImpl.h" - #include "VirtualBoxImpl.h" -+#include "TokenImpl.h" - -+#include "Global.h" - #include "AutoCaller.h" - #include "Logging.h" - -@@ -697,7 +704,7 @@ DECLCALLBACK(int) Medium::Task::fntMediumTask(RTTHREAD aThread, void *pvUser) - delete pTask; - - /* complete the progress if run asynchronously */ -- if (!pProgress.isNull()) -+ if (pProgress && !pProgress.isNull()) - pProgress->notifyComplete(rc); - - LogFlowFunc(("rc=%Rhrc\n", rc)); -@@ -1231,7 +1238,7 @@ HRESULT Medium::init(VirtualBox *aVirtualBox, - else - { - // Otherwise use the old VirtualBox "make absolute path" logic: -- rc = m->pVirtualBox->calculateFullPath(data.strLocation, strFull); -+ rc = Global::vboxStatusCodeToCOM(m->pVirtualBox->calculateFullPath(data.strLocation, strFull)); - if (FAILED(rc)) return rc; - } - } -@@ -2578,7 +2585,7 @@ STDMETHODIMP Medium::CreateBaseStorage(LONG64 aLogicalSize, - - pProgress.createObject(); - rc = pProgress->init(m->pVirtualBox, -- static_cast(this), -+ nullptr, - (mediumVariantFlags & MediumVariant_Fixed) - ? BstrFmt(tr("Creating fixed medium storage unit '%s'"), m->strLocationFull.c_str()).raw() - : BstrFmt(tr("Creating dynamic medium storage unit '%s'"), m->strLocationFull.c_str()).raw(), -@@ -2758,7 +2765,7 @@ STDMETHODIMP Medium::CloneToBase(IMedium *aTarget, - ComSafeArrayIn(MediumVariant_T, aVariant), - IProgress **aProgress) - { -- int rc = S_OK; -+ HRESULT rc = S_OK; - CheckComArgNotNull(aTarget); - CheckComArgOutPointerValid(aProgress); - CheckComArgSafeArrayNotNull(aVariant); -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/MediumLock.cpp b/src/app/virtualbox/src/VBox/Main/src-server/MediumLock.cpp -index 567973d..2cda8b2 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/MediumLock.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/MediumLock.cpp -@@ -18,7 +18,7 @@ - #include "MediumLock.h" - #include "MediumImpl.h" - #include "MediumAttachmentImpl.h" -- -+#include "TokenImpl.h" - - MediumLock::MediumLock() - : mMedium(NULL), mMediumCaller(NULL), mLockWrite(false), -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/NetworkAdapterImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/NetworkAdapterImpl.cpp -index e3908bb..c5cee5c 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/NetworkAdapterImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/NetworkAdapterImpl.cpp -@@ -1332,7 +1332,7 @@ HRESULT NetworkAdapter::saveSettings(settings::NetworkAdapter &data) - bool NetworkAdapter::isModified() { - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - bool fChanged = m_fModified; -- fChanged |= (mData->mAdapterType == NetworkAttachmentType_NAT? mNATEngine->isModified() : false); -+ fChanged |= (mData->mAttachmentType == NetworkAttachmentType_NAT? mNATEngine->isModified() : false); - return fChanged; - } - -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/SnapshotImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/SnapshotImpl.cpp -index ddce18b..55065d2 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/SnapshotImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/SnapshotImpl.cpp -@@ -24,6 +24,7 @@ - #include "MediumFormatImpl.h" - #include "Global.h" - #include "ProgressImpl.h" -+#include "TokenImpl.h" - - // @todo these three includes are required for about one or two lines, try - // to remove them and put that code in shared code in MachineImplcpp -@@ -2863,7 +2864,7 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask) - ComObjPtr pChildSnapshot = aTask.pSnapshot->getFirstChild(); - if (pChildSnapshot) - { -- pMachine = pChildSnapshot->getSnapshotMachine(); -+ pMachine = &*pChildSnapshot->getSnapshotMachine(); - childSnapshotId = pChildSnapshot->getId(); - } - pAtt = findAttachment(pMachine->mMediaData->mAttachments, it->mpSource); -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/VRDEServerImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/VRDEServerImpl.cpp -index a717aff..3d52b9f 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/VRDEServerImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/VRDEServerImpl.cpp -@@ -31,7 +31,7 @@ - #include - #include - --#include -+//#include - - #include "AutoStateDep.h" - #include "AutoCaller.h" -@@ -486,6 +486,7 @@ STDMETHODIMP VRDEServer::GetVRDEProperty(IN_BSTR aKey, BSTR *aValue) - return S_OK; - } - -+#if 0 - static int loadVRDELibrary(const char *pszLibraryName, RTLDRMOD *phmod, PFNVRDESUPPORTEDPROPERTIES *ppfn) - { - int rc = VINF_SUCCESS; -@@ -530,6 +531,7 @@ static int loadVRDELibrary(const char *pszLibraryName, RTLDRMOD *phmod, PFNVRDES - - return rc; - } -+#endif - - STDMETHODIMP VRDEServer::COMGETTER(VRDEProperties)(ComSafeArrayOut(BSTR, aProperties)) - { -@@ -584,13 +586,14 @@ STDMETHODIMP VRDEServer::COMGETTER(VRDEProperties)(ComSafeArrayOut(BSTR, aProper - /* - * Load the VRDE library and start the server, if it is enabled. - */ -- PFNVRDESUPPORTEDPROPERTIES pfn = NULL; -+// PFNVRDESUPPORTEDPROPERTIES pfn = NULL; - RTLDRMOD hmod = NIL_RTLDRMOD; -- vrc = loadVRDELibrary(strVrdeLibrary.c_str(), &hmod, &pfn); -+// vrc = loadVRDELibrary(strVrdeLibrary.c_str(), &hmod, &pfn); -+ vrc = !vrc; - Log(("VRDEPROP: load library [%s] rc %Rrc\n", strVrdeLibrary.c_str(), vrc)); - if (RT_SUCCESS(vrc)) - { -- const char * const *papszNames = pfn(); -+ const char * const *papszNames = nullptr; //pfn(); - - if (papszNames) - { -diff --git a/src/app/virtualbox/src/VBox/Main/src-server/VirtualBoxImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/VirtualBoxImpl.cpp -index 9ce039a..2e6ac11 100644 ---- a/src/app/virtualbox/src/VBox/Main/src-server/VirtualBoxImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/VirtualBoxImpl.cpp -@@ -42,7 +42,9 @@ - #include - #include - -+#if 0 - #include -+#endif - - #include - #include -@@ -1367,7 +1369,7 @@ VirtualBox::CheckFirmwarePresent(FirmwareType_T aFirmwareType, - RTPATH_DELIMITER, - firmwareDesc[i].fileName); - int rc = calculateFullPath(shortName, fullName); -- AssertRCReturn(rc, rc); -+ AssertRCReturn(rc, Global::vboxStatusCodeToCOM(rc)); - if (RTFileExists(fullName.c_str())) - { - *aResult = TRUE; -@@ -1378,7 +1380,7 @@ VirtualBox::CheckFirmwarePresent(FirmwareType_T aFirmwareType, - - char pszVBoxPath[RTPATH_MAX]; - rc = RTPathExecDir(pszVBoxPath, RTPATH_MAX); -- AssertRCReturn(rc, rc); -+ AssertRCReturn(rc, Global::vboxStatusCodeToCOM(rc)); - fullName = Utf8StrFmt("%s%c%s", - pszVBoxPath, - RTPATH_DELIMITER, -@@ -4368,8 +4370,10 @@ HRESULT VirtualBox::registerMachine(Machine *aMachine) - /* add to the collection of registered machines */ - m->allMachines.addChild(aMachine); - -+#if 0 - if (autoCaller.state() != InInit) - rc = saveSettings(); -+#endif - - return rc; - } -diff --git a/src/app/virtualbox/src/VBox/Main/xml/Settings.cpp b/src/app/virtualbox/src/VBox/Main/xml/Settings.cpp -index 3520c9c..e3288af 100644 ---- a/src/app/virtualbox/src/VBox/Main/xml/Settings.cpp -+++ b/src/app/virtualbox/src/VBox/Main/xml/Settings.cpp -@@ -4922,6 +4922,8 @@ void MachineConfigFile::buildStorageControllersXML(xml::ElementNode &elmParent, - case DeviceType_Floppy: - pcszType = "Floppy"; - break; -+ default: -+ break; - } - - pelmDevice->setAttribute("type", pcszType); -@@ -5273,6 +5275,8 @@ bool MachineConfigFile::isAudioDriverAllowedOnThisHost(AudioDriverType_T drv) - case AudioDriverType_MMPM: - #endif - return true; -+ default: -+ break; - } - - return false; ---- a/src/app/virtualbox/src/VBox/Main/src-server/SystemPropertiesImpl.cpp -+++ b/src/app/virtualbox/src/VBox/Main/src-server/SystemPropertiesImpl.cpp -@@ -1191,8 +1191,8 @@ - HRESULT SystemProperties::setLoggingLevel(const Utf8Str &aLoggingLevel) - { - Utf8Str useLoggingLevel(aLoggingLevel); -- if (useLoggingLevel.isEmpty()) -- useLoggingLevel = VBOXSVC_LOG_DEFAULT; -+// if (useLoggingLevel.isEmpty()) -+// useLoggingLevel = VBOXSVC_LOG_DEFAULT; - int rc = RTLogGroupSettings(RTLogRelDefaultInstance(), useLoggingLevel.c_str()); - // If failed and not the default logging level - try to use the default logging level. - if (RT_FAILURE(rc)) ---- a/src/app/virtualbox/include/iprt/string.h -+++ b/src/app/virtualbox/include/iprt/string.h -@@ -113,12 +113,6 @@ - RT_C_DECLS_END - #endif - --#if !defined(RT_OS_LINUX) || !defined(_GNU_SOURCE) --RT_C_DECLS_BEGIN --void *memrchr(const char *pv, int ch, size_t cb); --RT_C_DECLS_END --#endif -- - - /** @def RT_USE_RTC_3629 - * When defined the UTF-8 range will stop at 0x10ffff. If not defined, the diff --git a/repos/ports/src/virtualbox/patches/vga_fb.patch b/repos/ports/src/virtualbox/patches/vga_fb.patch deleted file mode 100644 index 27fefa673..000000000 --- a/repos/ports/src/virtualbox/patches/vga_fb.patch +++ /dev/null @@ -1,23 +0,0 @@ -vga_fb.patch - -diff --git a/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp b/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp -index a21fe7e..5b3b9b3 100644 ---- a/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp -+++ b/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp -@@ -3494,9 +3494,15 @@ static DECLCALLBACK(int) vgaR3LFBAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *p - int rc; - Assert(pThis); - Assert(GCPhys >= pThis->GCPhysVRAM); -+ Assert(GCPhys - pThis->GCPhysVRAM + cbBuf <= pThis->vram_size); - NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf); NOREF(enmAccessType); - -- rc = vgaLFBAccess(pVM, pThis, GCPhys, 0); -+ rc = VINF_SUCCESS; -+ size_t offset = 0; -+ while (RT_SUCCESS(rc) && offset < cbBuf) { -+ rc = vgaLFBAccess(pVM, pThis, GCPhys + offset, 0); -+ offset += 1UL << PAGE_SHIFT; -+ } - if (RT_SUCCESS(rc)) - return VINF_PGM_HANDLER_DO_DEFAULT; - AssertMsg(rc <= VINF_SUCCESS, ("rc=%Rrc\n", rc)); diff --git a/repos/ports/src/virtualbox/patches/vga_vbva.patch b/repos/ports/src/virtualbox/patches/vga_vbva.patch deleted file mode 100644 index 6631563d7..000000000 --- a/repos/ports/src/virtualbox/patches/vga_vbva.patch +++ /dev/null @@ -1,16 +0,0 @@ -vga_vbva.patch - -diff --git a/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp b/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp -index 28ab4a8..1cc8e6b 100644 ---- a/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp -+++ b/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp -@@ -546,7 +546,8 @@ static int vbvaDisable (unsigned uScreenId, PVGASTATE pVGAState, VBVACONTEXT *pC - pView->u32VBVAOffset = HGSMIOFFSET_VOID; - } - -- pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, uScreenId); -+ if (pVGAState->pDrv->pfnVBVADisable) -+ pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, uScreenId); - return VINF_SUCCESS; - } - diff --git a/repos/ports/src/virtualbox/patches/vmmdev.patch b/repos/ports/src/virtualbox/patches/vmmdev.patch deleted file mode 100644 index 1761430fd..000000000 --- a/repos/ports/src/virtualbox/patches/vmmdev.patch +++ /dev/null @@ -1,91 +0,0 @@ -vmmdev.patch - -diff --git a/src/app/virtualbox/src/VBox/Devices/VMMDev/VMMDev.cpp b/src/app/virtualbox/src/VBox/Devices/VMMDev/VMMDev.cpp -index 8ce46a8..a6b84b0 100644 ---- a/src/app/virtualbox/src/VBox/Devices/VMMDev/VMMDev.cpp -+++ b/src/app/virtualbox/src/VBox/Devices/VMMDev/VMMDev.cpp -@@ -335,9 +335,9 @@ - /* Check additions interface version. */ - pThis->fu32AdditionsOk = VBOX_GUEST_INTERFACE_VERSION_OK(pThis->guestInfo.interfaceVersion); - -- LogRel(("Guest Additions information report: Interface = 0x%08X osType = 0x%08X (%u-bit)\n", -+ RTLogPrintf("Guest Additions information report: Interface = 0x%08X osType = 0x%08X (%u-bit)\n", - pThis->guestInfo.interfaceVersion, pThis->guestInfo.osType, -- (pThis->guestInfo.osType & VBOXOSTYPE_x64) ? 64 : 32)); -+ (pThis->guestInfo.osType & VBOXOSTYPE_x64) ? 64 : 32); - - if (pThis->pDrv && pThis->pDrv->pfnUpdateGuestInfo) - pThis->pDrv->pfnUpdateGuestInfo(pThis->pDrv, &pThis->guestInfo); -@@ -413,9 +413,9 @@ - AssertMsgReturn(pReqHdr->size == sizeof(VMMDevReportGuestInfo2), ("%u\n", pReqHdr->size), VERR_INVALID_PARAMETER); - VBoxGuestInfo2 const *pInfo2 = &((VMMDevReportGuestInfo2 *)pReqHdr)->guestInfo; - -- LogRel(("Guest Additions information report: Version %d.%d.%d r%d '%.*s'\n", -+ RTLogPrintf("Guest Additions information report: Version %d.%d.%d r%d '%.*s'\n", - pInfo2->additionsMajor, pInfo2->additionsMinor, pInfo2->additionsBuild, -- pInfo2->additionsRevision, sizeof(pInfo2->szName), pInfo2->szName)); -+ pInfo2->additionsRevision, sizeof(pInfo2->szName), pInfo2->szName); - - /* The interface was introduced in 3.2 and will definitely not be - backported beyond 3.0 (bird). */ -@@ -746,10 +746,10 @@ - /* make a copy of supplied information */ - pThis->guestCaps = fu32Caps; - -- LogRel(("Guest Additions capability report (legacy): (0x%x) seamless: %s, hostWindowMapping: %s, graphics: yes\n", -+ RTLogPrintf("Guest Additions capability report (legacy): (0x%x) seamless: %s, hostWindowMapping: %s, graphics: yes\n", - fu32Caps, - fu32Caps & VMMDEV_GUEST_SUPPORTS_SEAMLESS ? "yes" : "no", -- fu32Caps & VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING ? "yes" : "no")); -+ fu32Caps & VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING ? "yes" : "no"); - - if (pThis->pDrv && pThis->pDrv->pfnUpdateGuestCapabilities) - pThis->pDrv->pfnUpdateGuestCapabilities(pThis->pDrv, fu32Caps); -@@ -774,11 +774,11 @@ - fu32Caps |= pReq->u32OrMask; - fu32Caps &= ~pReq->u32NotMask; - -- LogRel(("Guest Additions capability report: (%#x -> %#x) seamless: %s, hostWindowMapping: %s, graphics: %s\n", -+ RTLogPrintf("Guest Additions capability report: (%#x -> %#x) seamless: %s, hostWindowMapping: %s, graphics: %s\n", - pThis->guestCaps, fu32Caps, - fu32Caps & VMMDEV_GUEST_SUPPORTS_SEAMLESS ? "yes" : "no", - fu32Caps & VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING ? "yes" : "no", -- fu32Caps & VMMDEV_GUEST_SUPPORTS_GRAPHICS ? "yes" : "no")); -+ fu32Caps & VMMDEV_GUEST_SUPPORTS_GRAPHICS ? "yes" : "no"); - - pThis->guestCaps = fu32Caps; - -@@ -2179,6 +2179,10 @@ static int vmmdevReqHandler_GetPageSharingStatus(PVMMDEV pThis, VMMDevRequestHea - ("%u\n", pReq->header.size), VERR_INVALID_PARAMETER); - - pReq->fEnabled = false; -+ -+ if (!pThis || !pThis->pDrv || !pThis->pDrv->pfnIsPageFusionEnabled) -+ return VINF_SUCCESS; -+ - int rc = pThis->pDrv->pfnIsPageFusionEnabled(pThis->pDrv, &pReq->fEnabled); - if (RT_FAILURE(rc)) - pReq->fEnabled = false; -@@ -3469,9 +3469,9 @@ - - if (pThis->fu32AdditionsOk) - { -- LogRel(("Guest Additions information report: additionsVersion = 0x%08X, osType = 0x%08X (%u-bit)\n", -+ RTLogPrintf("Guest Additions information report: additionsVersion = 0x%08X, osType = 0x%08X (%u-bit)\n", - pThis->guestInfo.interfaceVersion, pThis->guestInfo.osType, -- (pThis->guestInfo.osType & VBOXOSTYPE_x64) ? 64 : 32)); -+ (pThis->guestInfo.osType & VBOXOSTYPE_x64) ? 64 : 32); - if (pThis->pDrv) - { - if (pThis->guestInfo2.uFullVersion && pThis->pDrv->pfnUpdateGuestInfo2) -+++ a/src/app/virtualbox/src/VBox/VMM/VMMR3/VM.cpp -+++ b/src/app/virtualbox/src/VBox/VMM/VMMR3/VM.cpp -@@ -2805,7 +2805,7 @@ - * Debug logging. - */ - RTLogPrintf("\n\nThe VM was reset:\n"); -- DBGFR3Info(pVM->pUVM, "cpum", "verbose", NULL); -+// DBGFR3Info(pVM->pUVM, "cpum", "verbose", NULL); - #endif - - /* diff --git a/repos/ports/src/virtualbox/pgm.cc b/repos/ports/src/virtualbox/pgm.cc deleted file mode 100644 index ae8f15f81..000000000 --- a/repos/ports/src/virtualbox/pgm.cc +++ /dev/null @@ -1,672 +0,0 @@ -/* - * \brief VirtualBox page manager (PGM) - * \author Norman Feske - * \date 2013-08-20 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include - -/* VirtualBox includes */ -#include "PGMInternal.h" /* enable access to pgm.s.* */ -#include "EMInternal.h" - -#include -#include -#include -#include -#include - -/* local includes */ -#include "util.h" -#include "vmm_memory.h" -#include "guest_memory.h" - -using Genode::Ram_session; -using Genode::Rm_session; - - -Vmm_memory *vmm_memory() -{ - static Vmm_memory inst(genode_env()); - return &inst; -} - - -Guest_memory *guest_memory() -{ - static Guest_memory inst; - return &inst; -} - - -static DECLCALLBACK(int) romwritehandler(PVM pVM, RTGCPHYS GCPhys, - void *pvPhys, void *pvBuf, - size_t cbBuf, - PGMACCESSTYPE enmAccessType, - void *pvUser) -{ - Assert(!"Somebody tries to write to ROM"); - return -1; -} - -int PGMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, - RTGCPHYS cb, const void *pvBinary, uint32_t cbBinary, - uint32_t fFlags, const char *pszDesc) -{ - try { - RTGCPHYS GCPhysLast = GCPhys + (cb - 1); - - size_t size = (size_t)cb; - Assert(cb == size); - - void *pv = vmm_memory()->alloc_rom(size, pDevIns); - Assert(pv); - memcpy(pv, pvBinary, size); - - /* associate memory of VMM with guest VM */ - vmm_memory()->map_to_vm(pDevIns, GCPhys); - - guest_memory()->add_rom_mapping(GCPhys, cb, pv, pDevIns); - - bool fShadowed = fFlags & PGMPHYS_ROM_FLAGS_SHADOWED; - Assert(!fShadowed); - - int rc = PGMR3HandlerPhysicalRegister(pVM, - PGMPHYSHANDLERTYPE_PHYSICAL_WRITE, - GCPhys, GCPhysLast, - romwritehandler, - NULL, - NULL, NULL, 0, - NULL, NULL, 0, pszDesc); - Assert(rc == VINF_SUCCESS); - -#ifdef VBOX_WITH_REM - REMR3NotifyPhysRomRegister(pVM, GCPhys, cb, NULL, fShadowed); -#endif - - } - catch (Guest_memory::Region_conflict) { return VERR_PGM_MAPPING_CONFLICT; } - catch (Genode::Out_of_ram) { return VERR_PGM_MAPPING_CONFLICT; } - catch (Genode::Out_of_caps) { return VERR_PGM_MAPPING_CONFLICT; } - - return VINF_SUCCESS; -} - - -int PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite) -{ - void *pv = guest_memory()->lookup(GCPhys, cbWrite); - - if (pv) { - void * pvx = vmm_memory()->lookup(GCPhys, cbWrite); - Assert(!pvx); - - memcpy(pv, pvBuf, cbWrite); - return VINF_SUCCESS; - } - - PFNPGMR3PHYSHANDLER pfnHandlerR3 = 0; - void *pvUserR3 = 0; - - pv = vmm_memory()->lookup(GCPhys, cbWrite, &pfnHandlerR3, &pvUserR3); - - if (!pv || !pfnHandlerR3 || !pvUserR3) { - Genode::error(__func__, " skipped: GCPhys=", Genode::Hex(GCPhys)); - return VERR_GENERAL_FAILURE; - } - - int rc = pfnHandlerR3(pVM, GCPhys, 0, 0, cbWrite, PGMACCESSTYPE_WRITE, - pvUserR3); - - if (rc != VINF_PGM_HANDLER_DO_DEFAULT) { - Genode::error(__FUNCTION__, " unexpected return code ", rc); - return VERR_GENERAL_FAILURE; - } - - memcpy(pv, pvBuf, cbWrite); - return VINF_SUCCESS; -} - - -int PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, - size_t cbWrite, const char *pszWho) -{ - VM_ASSERT_OTHER_THREAD(pVM); - - return PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite); -} - - -int PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) -{ - void *pv = guest_memory()->lookup(GCPhys, cbRead); - - if (pv) { - void * pvx = vmm_memory()->lookup(GCPhys, cbRead); - Assert(!pvx); - memcpy(pvBuf, pv, cbRead); - return VINF_SUCCESS; - } - - PFNPGMR3PHYSHANDLER pfnHandlerR3 = 0; - void *pvUserR3 = 0; - - pv = vmm_memory()->lookup(GCPhys, cbRead, &pfnHandlerR3, &pvUserR3); - if (!pv || !pfnHandlerR3 || !pvUserR3) { - Genode::error("PGMPhysRead skipped: GCPhys=", Genode::Hex(GCPhys)); - return VERR_GENERAL_FAILURE; - } - - memcpy(pvBuf, pv, cbRead); - return VINF_SUCCESS; -} - - -int PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) -{ - VM_ASSERT_OTHER_THREAD(pVM); - - return PGMPhysRead(pVM, GCPhys, pvBuf, cbRead); -} - - -int PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, - RTGCPHYS cb, uint32_t fFlags, void **ppv, const char - *pszDesc) -{ - *ppv = vmm_memory()->alloc((size_t)cb, pDevIns, iRegion); - - return VINF_SUCCESS; -} - - -int PGMR3PhysMMIO2Deregister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion) -{ - Genode::warning(__func__, ": pDevIns ", pDevIns, " iRegion=", iRegion); - return VINF_SUCCESS; -} - - -int PGMR3PhysMMIO2Map(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, - RTGCPHYS GCPhys) -{ - size_t cb = vmm_memory()->map_to_vm(pDevIns, GCPhys, iRegion); - if (cb == 0) { - Genode::error(__func__, ": lookup for pDevIns=", pDevIns, " iRegion=", - iRegion, " failed"); - Assert(cb); - } - -#ifdef VBOX_WITH_REM - REMR3NotifyPhysRamRegister(pVM, GCPhys, cb, REM_NOTIFY_PHYS_RAM_FLAGS_MMIO2); -#endif - - return VINF_SUCCESS; -} - - -int PGMR3PhysMMIO2Unmap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, - RTGCPHYS GCPhys) -{ - RTGCPHYS GCPhysStart = GCPhys; - Genode::size_t size = 1; - bool io = vmm_memory()->lookup_range(GCPhysStart, size); - Assert(io); - Assert(GCPhysStart == GCPhys); - - bool INVALIDATE = true; - bool ok = vmm_memory()->unmap_from_vm(GCPhys, size, INVALIDATE); - Assert(ok); - -#ifdef VBOX_WITH_REM - REMR3NotifyPhysRamDeregister(pVM, GCPhysStart, size); -#endif - return VINF_SUCCESS; -} - - -bool PGMR3PhysMMIO2IsBase(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys) -{ - return vmm_memory()->lookup(GCPhys, 1); -} - - -int PGMR3HandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, - RTGCPHYS GCPhys, RTGCPHYS GCPhysLast, - PFNPGMR3PHYSHANDLER pfnHandlerR3, - void *pvUserR3, const char *pszModR0, - const char *pszHandlerR0, RTR0PTR pvUserR0, - const char *pszModRC, - const char *pszHandlerRC, - RTRCPTR pvUserRC, const char *pszDesc) -{ - bool ok = vmm_memory()->add_handler(GCPhys, GCPhysLast - GCPhys + 1, - pfnHandlerR3, pvUserR3, enmType); - Assert(ok); - -#ifdef VBOX_WITH_REM - REMR3NotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, GCPhysLast - - GCPhys + 1, !!pfnHandlerR3); -#endif - - return VINF_SUCCESS; -} - - -int PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys) -{ - Genode::size_t size = 1; - -#ifdef VBOX_WITH_REM - PFNPGMR3PHYSHANDLER pfnHandlerR3 = 0; - PGMPHYSHANDLERTYPE enmType = PGMPHYSHANDLERTYPE_MMIO; - - void * pv = vmm_memory()->lookup(GCPhys, size, &pfnHandlerR3, 0, &enmType); - Assert(pv); -#endif - - bool ok = vmm_memory()->add_handler(GCPhys, size, 0, 0); - Assert(ok); - -#ifdef VBOX_WITH_REM - bool fRestoreAsRAM = pfnHandlerR3 && enmType != PGMPHYSHANDLERTYPE_MMIO; - - /* GCPhysstart and size gets written ! */ - RTGCPHYS GCPhysStart = GCPhys; - bool io = vmm_memory()->lookup_range(GCPhysStart, size); - Assert(io); - - REMR3NotifyHandlerPhysicalDeregister(pVM, enmType, GCPhysStart, size, - !!pfnHandlerR3, fRestoreAsRAM); -#endif - - return VINF_SUCCESS; -} - - -int PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, - const char *pszDesc) -{ - try { - - /* - * XXX Is this function the right place for the allocation? - * The lack of allocation-related VERR_PGM_ error codes suggests - * so. - */ - size_t size = (size_t)cb; - Assert(cb == size); - void *pv = vmm_memory()->alloc_ram(size); - - guest_memory()->add_ram_mapping(GCPhys, cb, pv); - -#ifdef VBOX_WITH_REM - REMR3NotifyPhysRamRegister(pVM, GCPhys, cb, REM_NOTIFY_PHYS_RAM_FLAGS_RAM); -#endif - } - catch (Guest_memory::Region_conflict) { - return VERR_PGM_MAPPING_CONFLICT; } - catch (Genode::Out_of_ram) { - return VERR_PGM_MAPPING_CONFLICT; /* XXX use a better error code? */ } - catch (Genode::Out_of_caps) { - Genode::warning("Out_of_caps during 'add_ram_mapping'"); - return VERR_PGM_MAPPING_CONFLICT; /* XXX use a better error code? */ } - catch (Genode::Region_map::Region_conflict) { - Genode::warning("Region_conflict during 'add_ram_mapping'"); - return VERR_PGM_MAPPING_CONFLICT; /* XXX use a better error code? */ } - - return VINF_SUCCESS; -} - - -int PGMMapSetPage(PVM pVM, RTGCPTR GCPtr, uint64_t cb, uint64_t fFlags) -{ - return VINF_SUCCESS; -} - - -RTHCPHYS PGMGetHyperCR3(PVMCPU pVCpu) -{ - return 1; -} - - -int PGMR3Init(PVM pVM) -{ - /* - * Satisfy assertion in VMMR3Init. Normally called via: - * - * PGMR3Init -> pgmR3InitPaging -> pgmR3ModeDataInit -> InitData -> MapCR3 - */ - for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) { - PVMCPU pVCpu = &pVM->aCpus[idCpu]; - CPUMSetHyperCR3(pVCpu, PGMGetHyperCR3(pVCpu)); - - pVCpu->pgm.s.fA20Enabled = true; - pVCpu->pgm.s.GCPhysA20Mask = ~((RTGCPHYS)!pVCpu->pgm.s.fA20Enabled << 20); - } - - int rc = PDMR3CritSectInit(pVM, &pVM->pgm.s.CritSectX, RT_SRC_POS, "PGM"); - AssertRCReturn(rc, rc); - - return VINF_SUCCESS; -} - - -int PGMR3Term(PVM pVM) { return VINF_SUCCESS; } - - -int PGMPhysGCPtr2CCPtrReadOnly(PVMCPU pVCpu, RTGCPTR GCPtr, void const **ppv, - PPGMPAGEMAPLOCK pLock) -{ - Genode::error(__func__, " not implemented - caller ", - __builtin_return_address(0)); - - Assert(!"not implemented"); - return VERR_GENERAL_FAILURE; -} - - -int PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv) -{ - size_t const size = 1; - PFNPGMR3PHYSHANDLER pfnHandlerR3 = 0; - void *pvUserR3 = 0; - PGMPHYSHANDLERTYPE enmType; - - void * pv = vmm_memory()->lookup(GCPhys, size, &pfnHandlerR3, &pvUserR3, - &enmType); - if (!pv) { - /* It could be ordinary guest memory - look it up. */ - pv = guest_memory()->lookup(GCPhys, size); - - if (!pv) { - Genode::error(__func__, ": lookup for GCPhys=", - Genode::Hex(GCPhys), " failed"); - return VERR_PGM_PHYS_TLB_UNASSIGNED; - } - - *ppv = pv; - - return VINF_SUCCESS; - } - - /* pv valid - check handlers next */ - if (!pfnHandlerR3 && !pvUserR3) { - *ppv = pv; - return VINF_SUCCESS; - } - - if (enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE) { - *ppv = pv; - return VINF_PGM_PHYS_TLB_CATCH_WRITE; - } - Genode::error(__func__, ": denied access - handlers set - GCPhys=", - Genode::Hex(GCPhys)); - - return VERR_PGM_PHYS_TLB_CATCH_ALL; -} - - -void PGMR3PhysSetA20(PVMCPU pVCpu, bool fEnable) -{ - if (!pVCpu->pgm.s.fA20Enabled != fEnable) { - pVCpu->pgm.s.fA20Enabled = fEnable; -#ifdef VBOX_WITH_REM - REMR3A20Set(pVCpu->pVMR3, pVCpu, fEnable); -#endif - } - - return; -} - - -bool PGMPhysIsA20Enabled(PVMCPU pVCpu) -{ - return pVCpu->pgm.s.fA20Enabled; -} - - -template -static void PGMR3PhysWrite(PVM pVM, RTGCPHYS GCPhys, T value) -{ - VM_ASSERT_EMT(pVM); - - void *pv = guest_memory()->lookup(GCPhys, sizeof(value)); - - if (!pv) { - Genode::error(__func__, ": invalid write attempt GCPhys=", - Genode::Hex(GCPhys)); - return; - } - - /* sanity check */ - void * pvx = vmm_memory()->lookup(GCPhys, sizeof(value)); - Assert(!pvx); - - *reinterpret_cast(pv) = value; -} - - -void PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t value) -{ - PGMR3PhysWrite(pVM, GCPhys, value); -} - - -void PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t value) -{ - PGMR3PhysWrite(pVM, GCPhys, value); -} - - -void PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t value) -{ - PGMR3PhysWrite(pVM, GCPhys, value); -} - - -template -static T PGMR3PhysRead(PVM pVM, RTGCPHYS GCPhys) -{ - void *pv = guest_memory()->lookup(GCPhys, sizeof(T)); - - if (!pv) { - Genode::error(__func__, ": invalid read attempt GCPhys=", - Genode::Hex(GCPhys)); - return 0; - } - - /* sanity check */ - void * pvx = vmm_memory()->lookup(GCPhys, sizeof(T)); - Assert(!pvx); - - return *reinterpret_cast(pv); -} - - -uint64_t PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys) -{ - return PGMR3PhysRead(pVM, GCPhys); -} - - -uint32_t PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys) -{ - return PGMR3PhysRead(pVM, GCPhys); -} - - -int PGMPhysGCPhys2CCPtrReadOnly(PVM pVM, RTGCPHYS GCPhys, void const **ppv, - PPGMPAGEMAPLOCK pLock) -{ - void *pv = guest_memory()->lookup(GCPhys, 0x1000); - - if (!pv) { - Genode::error("unknown address GCPhys=", Genode::Hex(GCPhys)); - - guest_memory()->dump(); - - return VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS; - } - - *ppv = pv; - - return VINF_SUCCESS; -} - - -int PGMHandlerPhysicalReset(PVM, RTGCPHYS GCPhys) -{ - size_t size = 1; - if (!vmm_memory()->unmap_from_vm(GCPhys, size)) - Genode::warning(__func__, ": unbacked region - GCPhys ", - Genode::Hex(GCPhys)); - - return VINF_SUCCESS; -} - - -extern "C" int MMIO2_MAPPED_SYNC(PVM pVM, RTGCPHYS GCPhys, size_t cbWrite, - void **ppv, Genode::Flexpage_iterator &fli, - bool &writeable) -{ - using Genode::Flexpage_iterator; - using Genode::addr_t; - - /* DON'T USE normal printf in this function - corrupts unsaved UTCB !!! */ - - PFNPGMR3PHYSHANDLER pfnHandlerR3 = 0; - void *pvUserR3 = 0; - - void * pv = vmm_memory()->lookup(GCPhys, cbWrite, &pfnHandlerR3, &pvUserR3); - - if (!pv) - return VERR_PGM_PHYS_TLB_UNASSIGNED; - - fli = Flexpage_iterator((addr_t)pv, cbWrite, GCPhys, cbWrite, GCPhys); - - if (!pfnHandlerR3 && !pvUserR3) { - *ppv = pv; - /* you may map it */ - return VINF_SUCCESS; - } - - if (pfnHandlerR3 && pvUserR3) { - int rc = pfnHandlerR3(pVM, GCPhys, 0, 0, cbWrite, PGMACCESSTYPE_WRITE, - pvUserR3); - - if (rc == VINF_PGM_HANDLER_DO_DEFAULT) { - *ppv = pv; - /* you may map it */ - return VINF_SUCCESS; - } - return rc; - } - - RTGCPHYS map_start = GCPhys; - Genode::size_t map_size = 1; - - bool io = vmm_memory()->lookup_range(map_start, map_size); - Assert(io); - - pv = vmm_memory()->lookup(map_start, map_size); - Assert(pv); - - fli = Flexpage_iterator((addr_t)pv, map_size, map_start, map_size, map_start); - - *ppv = pv; - - writeable = false; - - return VINF_SUCCESS; -} - - -/** - * Resets a virtual CPU when unplugged. - * - * @param pVM Pointer to the VM. - * @param pVCpu Pointer to the VMCPU. - */ -VMMR3DECL(void) PGMR3ResetCpu(PVM pVM, PVMCPU pVCpu) -{ - int rc = PGMR3ChangeMode(pVM, pVCpu, PGMMODE_REAL); - AssertRC(rc); - - /* - * Re-init other members. - */ - pVCpu->pgm.s.fA20Enabled = true; - pVCpu->pgm.s.GCPhysA20Mask = ~((RTGCPHYS)!pVCpu->pgm.s.fA20Enabled << 20); - - /* - * Clear the FFs PGM owns. - */ - VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3); - VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); -} - - -void PGMR3Reset(PVM pVM) -{ - VM_ASSERT_EMT(pVM); - - for (VMCPUID i = 0; i < pVM->cCpus; i++) - { -// int rc = PGMR3ChangeMode(pVM, &pVM->aCpus[i], PGMMODE_REAL); -// AssertRC(rc); - } - - for (VMCPUID i = 0; i < pVM->cCpus; i++) - { - PVMCPU pVCpu = &pVM->aCpus[i]; - - VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3); - VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); - - VMCPU_FF_SET(pVCpu, VMCPU_FF_TLB_FLUSH); - - if (!pVCpu->pgm.s.fA20Enabled) - { - pVCpu->pgm.s.fA20Enabled = true; - pVCpu->pgm.s.GCPhysA20Mask = ~((RTGCPHYS)!pVCpu->pgm.s.fA20Enabled << 20); -#ifdef PGM_WITH_A20 - pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL; - VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); - HMFlushTLB(pVCpu); -#endif - } - } - - vmm_memory()->revoke_all(); -} - - -int PGMR3MappingsSize(PVM pVM, uint32_t *pcb) -{ - *pcb = 0; - - return 0; -} - - -void PGMR3MemSetup(PVM pVM, bool fAtReset) { } - - -VMMDECL(bool) PGMIsLockOwner(PVM pVM) -{ - return PDMCritSectIsOwner(&pVM->pgm.s.CritSectX); -} - - -VMM_INT_DECL(void) PGMNotifyNxeChanged(PVMCPU pVCpu, bool fNxe) { } diff --git a/repos/ports/src/virtualbox/spec/muen/guest_interrupts.h b/repos/ports/src/virtualbox/spec/muen/guest_interrupts.h deleted file mode 100644 index 6d3eb225e..000000000 --- a/repos/ports/src/virtualbox/spec/muen/guest_interrupts.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * \brief Muen subject pending interrupt handling - * \author Adrian-Ken Rueegsegger - * \author Reto Buerki - * \date 2016-04-27 - */ - -/* - * Copyright (C) 2016-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__MUEN__INTERRUPTS_H_ -#define _VIRTUALBOX__SPEC__MUEN__INTERRUPTS_H_ - -/* Genode includes */ -#include - -namespace Genode -{ - /** - * Vm execution handler. - */ - class Guest_interrupts; -} - - -class Genode::Guest_interrupts -{ - private: - - addr_t _base; - - public: - - Guest_interrupts (addr_t base) : _base(base) { } - - /** - * Returns true if the bit corresponding to the specified IRQ is set. - */ - bool is_pending_interrupt(uint8_t irq) - { - bool result; - asm volatile ("bt %1, %2;" - "sbb %0, %0;" - : "=r" (result) - : "Ir" ((uint32_t)irq), "m" (*(char *)_base) - : "memory"); - return result; - } - - /** - * Set bit corresponding to given IRQ in pending interrupts region. - */ - void set_pending_interrupt(uint8_t irq) - { - asm volatile ("bts %1, %0" - : "+m" (*(char *)_base) - : "Ir" ((uint32_t)irq) - : "memory"); - } - - /** - * Clear bit corresponding to given IRQ in pending interrupts region. - */ - void clear_pending_interrupt(uint8_t irq) - { - asm volatile ("btr %1, %0" - : "+m" (*(char *)_base) - : "Ir" ((uint32_t)irq) - : "memory"); - } -}; - -#endif /* _VIRTUALBOX__SPEC__MUEN__INTERRUPTS_H_ */ diff --git a/repos/ports/src/virtualbox/spec/muen/mem_region.h b/repos/ports/src/virtualbox/spec/muen/mem_region.h deleted file mode 100644 index f5dfda193..000000000 --- a/repos/ports/src/virtualbox/spec/muen/mem_region.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * \brief Memory region types - * \author Norman Feske - * \author Adrian-Ken Rueegsegger - * \author Reto Buerki - * \date 2015-06-23 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__MUEN__MEM_REGION_H_ -#define _VIRTUALBOX__SPEC__MUEN__MEM_REGION_H_ - -/* Genode includes */ -#include -#include -#include -#include -#include -#include - -/* VirtualBox includes */ -#include -#include - -struct Mem_region; - -struct Mem_region : Genode::List::Element, - Genode::Attached_io_mem_dataspace -{ - typedef Genode::size_t size_t; - typedef Genode::addr_t addr_t; - - PPDMDEVINS pDevIns; - unsigned const iRegion; - RTGCPHYS vm_phys; - PFNPGMR3PHYSHANDLER pfnHandlerR3; - void *pvUserR3; - PGMPHYSHANDLERTYPE enmType; - size_t region_size; - bool _clear; - - addr_t _phys_base(Genode::Env &env, size_t size) - { - struct Region_info - { - addr_t base; - size_t size; - }; - static unsigned counter; - static Region_info regions[] = { - /* pcbios phys 0xe1000 */ - { 0x810000000, 0x1000 }, - /* pcbios phys 0xf0000*/ - { 0x820000000, 0x10000 }, - /* pcbios 0xffff0000 */ - { 0x830000000, 0x10000 }, - /* VMMDev */ - { 0x840000000, 0x400000 }, - /* VMMDev */ - { 0x850000000, 0x4000 }, - /* vga */ - { 0x860000000, 0x8000000 }, - /* vga phys 0xc0000 */ - { 0x870000000, 0x9000 }, - /* acpi phys e0000 */ - { 0x880000000, 0x1000 }, - { 0x0, 0x0 }, - }; - - Region_info cur_region; - - if (!counter) { - Genode::Rom_connection sinfo_rom(env, "subject_info_page"); - Genode::Sinfo sinfo ((addr_t)env.rm().attach (sinfo_rom.dataspace())); - - const struct Genode::Sinfo::Resource_type *region1 - = sinfo.get_resource("vm_ram_1", Genode::Sinfo::RES_MEMORY); - const struct Genode::Sinfo::Resource_type *region4 - = sinfo.get_resource("vm_ram_4", Genode::Sinfo::RES_MEMORY); - - if (!region1) { - Genode::error("unable to retrieve vm_ram_1 region"); - return 0; - } - if (!region4) { - Genode::error("unable to retrieve vm_ram_4 region"); - return 0; - } - - cur_region.base = region1->data.mem.address; - cur_region.size = region4->data.mem.address + region4->data.mem.size - - region1->data.mem.address; - counter++; - _clear = false; - - } else { - cur_region = regions[counter - 1]; - - if (cur_region.size == 0) - { - Genode::error("region size is zero!!!"); - return 0; - } - counter++; - _clear = true; - } - - if (size > cur_region.size) - Genode::error("size: ", Genode::Hex(size), ", " - "cur_region.size: ", Genode::Hex(cur_region.size)); - Assert(size <= cur_region.size); - - return cur_region.base; - } - - size_t size() const { return region_size; } - - Mem_region(Genode::Env &env, size_t size, - PPDMDEVINS pDevIns, unsigned iRegion) - : - Attached_io_mem_dataspace(env, _phys_base(env, size), size), - pDevIns(pDevIns), - iRegion(iRegion), - vm_phys(0), pfnHandlerR3(0), pvUserR3(0), - region_size(size) - { - if (_clear) - Genode::memset(local_addr(), 0, size); - } -}; - -#endif /* _VIRTUALBOX__SPEC__MUEN__MEM_REGION_H_ */ diff --git a/repos/ports/src/virtualbox/spec/muen/sup.cc b/repos/ports/src/virtualbox/spec/muen/sup.cc deleted file mode 100644 index 731b53837..000000000 --- a/repos/ports/src/virtualbox/spec/muen/sup.cc +++ /dev/null @@ -1,779 +0,0 @@ -/* - * \brief Genode specific VirtualBox SUPLib supplements. - * \author Alexander Boettcher - * \author Adrian-Ken Rueegsegger - * \author Reto Buerki - * \date 2013-11-18 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include -#include - -/* VirtualBox includes */ -#include "HMInternal.h" /* enable access to hm.s.* */ -#include "CPUMInternal.h" /* enable access to cpum.s.* */ -#include -#include -#include - -/* Genode's VirtualBox includes */ -#include "sup.h" -#include "vcpu.h" -#include "vm_handler.h" -#include "vmm_memory.h" -#include "guest_interrupts.h" - -/* Libc include */ -#include - -enum { - VMCS_SEG_UNUSABLE = 0x10000, - INTERRUPT_STATE_NONE = 0U, - BLOCKING_BY_STI = 1U << 0, - BLOCKING_BY_MOV_SS = 1U << 1, -}; - -#define GENODE_READ_SELREG_REQUIRED(REG) \ - (pCtx->REG.Sel != cur_state->REG.sel) || \ - (pCtx->REG.ValidSel != cur_state->REG.sel) || \ - (pCtx->REG.fFlags != CPUMSELREG_FLAGS_VALID) || \ - (pCtx->REG.u32Limit != cur_state->REG.limit) || \ - (pCtx->REG.u64Base != cur_state->REG.base) || \ - (pCtx->REG.Attr.u != cur_state->REG.access) - -#define GENODE_READ_SELREG(REG) \ - pCtx->REG.Sel = cur_state->REG.sel; \ - pCtx->REG.ValidSel = cur_state->REG.sel; \ - pCtx->REG.fFlags = CPUMSELREG_FLAGS_VALID; \ - pCtx->REG.u32Limit = cur_state->REG.limit; \ - pCtx->REG.u64Base = cur_state->REG.base; \ - pCtx->REG.Attr.u = cur_state->REG.access; - -#define GENODE_ASSERT_SELREG(REG) \ - Assert(pCtx->REG.Sel == cur_state->REG.sel); \ - Assert(pCtx->REG.ValidSel == cur_state->REG.sel); \ - Assert(pCtx->REG.fFlags == CPUMSELREG_FLAGS_VALID); \ - Assert(pCtx->REG.u32Limit == cur_state->REG.limit); \ - Assert(pCtx->REG.u64Base == cur_state->REG.base); - -#define GENODE_WRITE_SELREG(REG) \ - Assert(pCtx->REG.fFlags & CPUMSELREG_FLAGS_VALID); \ - Assert(pCtx->REG.ValidSel == pCtx->REG.Sel); \ - cur_state->REG.sel = pCtx->REG.Sel; \ - cur_state->REG.limit = pCtx->REG.u32Limit; \ - cur_state->REG.base = pCtx->REG.u64Base; \ - cur_state->REG.access = pCtx->REG.Attr.u ? : VMCS_SEG_UNUSABLE - -struct Subject_state *cur_state; - -Genode::Guest_interrupts *guest_interrupts; - -/** - * Return pointer to sinfo. - */ -static Genode::Sinfo * sinfo() -{ - using namespace Genode; - - static Sinfo *ptr; - - if (!ptr) { - try { - static Rom_connection sinfo_rom(genode_env(), "subject_info_page"); - static Sinfo sinfo( - (addr_t)genode_env().rm().attach(sinfo_rom.dataspace())); - ptr = &sinfo; - } catch (...) { - error("unable to attach Sinfo ROM"); - Assert(false); - } - } - return ptr; -} - - -/** - * Setup guest subject state. - */ -bool setup_subject_state() -{ - using namespace Genode; - - if (cur_state) - return true; - - const struct Sinfo::Resource_type *region - = sinfo()->get_resource("monitor_state", Sinfo::RES_MEMORY); - - if (!region) { - error("unable to retrieve monitor state region"); - return false; - } - - try { - static Attached_io_mem_dataspace subject_ds - (genode_env(), region->data.mem.address, region->data.mem.size); - cur_state = subject_ds.local_addr(); - return true; - } catch (...) { - error("unable to attach subject state I/O mem dataspace"); - } - return false; -} - - -/** - * Setup guest interrupts page. - */ -bool setup_subject_interrupts() -{ - using namespace Genode; - - if (guest_interrupts) - return true; - - const struct Sinfo::Resource_type *region - = sinfo()->get_resource("monitor_interrupts", Sinfo::RES_MEMORY); - - if (!region) { - error("unable to retrieve monitor interrupts region"); - return false; - } - - try { - static Attached_io_mem_dataspace subject_intrs - (genode_env(), region->data.mem.address, region->data.mem.size); - static Guest_interrupts g((addr_t)subject_intrs.local_addr()); - guest_interrupts = &g; - return true; - } catch (...) { - error("unable to attach subject interrupts I/O mem dataspace"); - } - return false; -} - - -/** - * Returns the value of the register identified by reg. - * The register mapping is specified by Intel SDM Vol. 3C, table 27-3. - */ -inline uint64_t get_reg_val (struct Subject_state *cur_state, unsigned reg) -{ - switch (reg) { - case 0: - return cur_state->Regs.Rax; - break; - case 1: - return cur_state->Regs.Rcx; - break; - case 2: - return cur_state->Regs.Rdx; - break; - case 3: - return cur_state->Regs.Rbx; - break; - case 4: - return cur_state->Rsp; - break; - case 5: - return cur_state->Regs.Rbp; - break; - case 6: - return cur_state->Regs.Rsi; - break; - case 7: - return cur_state->Regs.Rdi; - break; - default: - Genode::error("invalid register ", reg); - return 0; - } -} - - -/** - * Sets the control register identified by cr to the given value. - */ -inline bool set_cr(struct Subject_state *cur_state, unsigned cr, uint64_t value) -{ - bool res = false; - switch (cr) { - case 0: - cur_state->Shadow_cr0 = value; - cur_state->Cr0 = value | 1 << 5; - cur_state->Cr0 &= ~(1 << 30 | 1 << 29); - res = true; - break; - case 2: - cur_state->Regs.Cr2 = value; - res = true; - break; - case 4: - cur_state->Shadow_cr4 = value; - cur_state->Cr4 = value | 1 << 13; - res = true; - break; - default: - Genode::error("invalid control register ", cr); - res = false; - } - - return res; -} - - -/** - * Handle control register access by evaluating the VM-exit qualification - * according to Intel SDM Vol. 3C, table 27-3. - */ -inline bool handle_cr(struct Subject_state *cur_state) -{ - uint64_t qual = cur_state->Exit_qualification; - unsigned cr = qual & 0xf; - unsigned acc = (qual & 0x30) >> 4; - unsigned reg = (qual & 0xf00) >> 8; - bool res; - - switch (acc) { - case 0: // MOV to CR - res = set_cr(cur_state, cr, get_reg_val(cur_state, reg)); - break; - default: - Genode::error("Invalid control register ", cr, " access ", acc, ", reg ", reg); - return false; - } - - if (res) - cur_state->Rip += cur_state->Instruction_len; - - return res; -} - - -inline void check_vm_state(PVMCPU pVCpu, struct Subject_state *cur_state) -{ - PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); - - Assert(cur_state->Rip == pCtx->rip); - Assert(cur_state->Rsp == pCtx->rsp); - Assert(cur_state->Regs.Rax == pCtx->rax); - Assert(cur_state->Regs.Rbx == pCtx->rbx); - Assert(cur_state->Regs.Rcx == pCtx->rcx); - Assert(cur_state->Regs.Rdx == pCtx->rdx); - Assert(cur_state->Regs.Rbp == pCtx->rbp); - Assert(cur_state->Regs.Rsi == pCtx->rsi); - Assert(cur_state->Regs.Rdi == pCtx->rdi); - Assert(cur_state->Regs.R08 == pCtx->r8); - Assert(cur_state->Regs.R09 == pCtx->r9); - Assert(cur_state->Regs.R10 == pCtx->r10); - Assert(cur_state->Regs.R11 == pCtx->r11); - Assert(cur_state->Regs.R12 == pCtx->r12); - Assert(cur_state->Regs.R13 == pCtx->r13); - Assert(cur_state->Regs.R14 == pCtx->r14); - Assert(cur_state->Regs.R15 == pCtx->r15); - - Assert(cur_state->Rflags == pCtx->rflags.u); - - Assert(cur_state->Sysenter_cs == pCtx->SysEnter.cs); - Assert(cur_state->Sysenter_eip == pCtx->SysEnter.eip); - Assert(cur_state->Sysenter_esp == pCtx->SysEnter.esp); - - { - uint32_t val; - val = (cur_state->Shadow_cr0 & pVCpu->hm.s.vmx.u32CR0Mask); - val |= (cur_state->Cr0 & ~pVCpu->hm.s.vmx.u32CR0Mask); - Assert(pCtx->cr0 == val); - } - Assert(cur_state->Regs.Cr2 == pCtx->cr2); - Assert(cur_state->Cr3 == pCtx->cr3); - { - uint32_t val; - val = (cur_state->Shadow_cr4 & pVCpu->hm.s.vmx.u32CR4Mask); - val |= (cur_state->Cr4 & ~pVCpu->hm.s.vmx.u32CR4Mask); - Assert(pCtx->cr4 == val); - } - - GENODE_ASSERT_SELREG(cs); - GENODE_ASSERT_SELREG(ss); - GENODE_ASSERT_SELREG(ds); - GENODE_ASSERT_SELREG(es); - GENODE_ASSERT_SELREG(fs); - GENODE_ASSERT_SELREG(gs); - - Assert(cur_state->ldtr.sel == pCtx->ldtr.Sel); - Assert(cur_state->ldtr.limit == pCtx->ldtr.u32Limit); - Assert(cur_state->ldtr.base == pCtx->ldtr.u64Base); - if(cur_state->ldtr.sel != 0) - Assert(cur_state->ldtr.access == pCtx->ldtr.Attr.u); - { - Assert(cur_state->tr.sel == pCtx->tr.Sel); - Assert(cur_state->tr.limit == pCtx->tr.u32Limit); - Assert(cur_state->tr.base == pCtx->tr.u64Base); - Assert(cur_state->tr.access == pCtx->tr.Attr.u); - } - - Assert(cur_state->idtr.limit == pCtx->idtr.cbIdt); - Assert(cur_state->idtr.base == pCtx->idtr.pIdt); - Assert(cur_state->gdtr.limit == pCtx->gdtr.cbGdt); - Assert(cur_state->gdtr.base == pCtx->gdtr.pGdt); - - Assert(cur_state->Ia32_efer == CPUMGetGuestEFER(pVCpu)); -} - - -inline bool has_pending_irq(PVMCPU pVCpu) -{ - return TRPMHasTrap(pVCpu) || - VMCPU_FF_IS_PENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | - VMCPU_FF_INTERRUPT_PIC)); -} - - -/** - * Return vector of currently pending IRQ. - */ -inline uint8_t get_irq(PVMCPU pVCpu) -{ - int rc; - - if (!TRPMHasTrap(pVCpu)) { - bool res = VMCPU_FF_TEST_AND_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI); - Assert(!res); - - if (VMCPU_FF_IS_PENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | - VMCPU_FF_INTERRUPT_PIC))) { - - uint8_t irq; - rc = PDMGetInterrupt(pVCpu, &irq); - Assert(RT_SUCCESS(rc)); - - rc = TRPMAssertTrap(pVCpu, irq, TRPM_HARDWARE_INT); - Assert(RT_SUCCESS(rc)); - } - } - - Assert(TRPMHasTrap(pVCpu)); - - uint8_t u8Vector; - TRPMEVENT enmType; - RTGCUINT u32ErrorCode; - - rc = TRPMQueryTrapAll(pVCpu, &u8Vector, &enmType, 0, 0, 0); - AssertRC(rc); - Assert(enmType == TRPM_HARDWARE_INT); - Assert(u8Vector != X86_XCPT_NMI); - - /* Clear the pending trap. */ - rc = TRPMResetTrap(pVCpu); - AssertRC(rc); - - return u8Vector; -} - - -int SUPR3QueryVTxSupported(void) { return VINF_SUCCESS; } - - -int SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu) -{ - static Genode::Vm_handler vm_handler(genode_env()); - - switch (uOperation) { - - case SUP_VMMR0_DO_HM_RUN: - VM * pVM = reinterpret_cast(pVMR0); - PVMCPU pVCpu = &pVM->aCpus[idCpu]; - PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); - int rc; - - Assert(!(pVCpu->cpum.s.fUseFlags & (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM | CPUM_SYNC_FPU_STATE))); - - if (!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS) && (cur_state->Intr_state & 3)) - cur_state->Intr_state &= ~3U; - - cur_state->Rip = pCtx->rip; - cur_state->Rsp = pCtx->rsp; - - cur_state->Regs.Rax = pCtx->rax; - cur_state->Regs.Rbx = pCtx->rbx; - cur_state->Regs.Rcx = pCtx->rcx; - cur_state->Regs.Rdx = pCtx->rdx; - cur_state->Regs.Rbp = pCtx->rbp; - cur_state->Regs.Rsi = pCtx->rsi; - cur_state->Regs.Rdi = pCtx->rdi; - cur_state->Regs.R08 = pCtx->r8; - cur_state->Regs.R09 = pCtx->r9; - cur_state->Regs.R10 = pCtx->r10; - cur_state->Regs.R11 = pCtx->r11; - cur_state->Regs.R12 = pCtx->r12; - cur_state->Regs.R13 = pCtx->r13; - cur_state->Regs.R14 = pCtx->r14; - cur_state->Regs.R15 = pCtx->r15; - - cur_state->Rflags = pCtx->rflags.u; - - cur_state->Sysenter_cs = pCtx->SysEnter.cs; - cur_state->Sysenter_eip = pCtx->SysEnter.eip; - cur_state->Sysenter_esp = pCtx->SysEnter.esp; - - set_cr(cur_state, 0, pCtx->cr0); - set_cr(cur_state, 2, pCtx->cr2); - set_cr(cur_state, 4, pCtx->cr4); - - GENODE_WRITE_SELREG(cs); - GENODE_WRITE_SELREG(ss); - GENODE_WRITE_SELREG(ds); - GENODE_WRITE_SELREG(es); - GENODE_WRITE_SELREG(fs); - GENODE_WRITE_SELREG(gs); - - if (pCtx->ldtr.Sel == 0) { - cur_state->ldtr.sel = 0; - cur_state->ldtr.limit = 0; - cur_state->ldtr.base = 0; - cur_state->ldtr.access = 0x82; - } else { - cur_state->ldtr.sel = pCtx->ldtr.Sel; - cur_state->ldtr.limit = pCtx->ldtr.u32Limit; - cur_state->ldtr.base = pCtx->ldtr.u64Base; - cur_state->ldtr.access = pCtx->ldtr.Attr.u; - } - { - cur_state->tr.sel = pCtx->tr.Sel; - cur_state->tr.limit = pCtx->tr.u32Limit; - cur_state->tr.base = pCtx->tr.u64Base; - cur_state->tr.access = pCtx->tr.Attr.u; - } - - cur_state->idtr.limit = pCtx->idtr.cbIdt; - cur_state->idtr.base = pCtx->idtr.pIdt; - cur_state->gdtr.limit = pCtx->gdtr.cbGdt; - cur_state->gdtr.base = pCtx->gdtr.pGdt; - - cur_state->Ia32_efer = CPUMGetGuestEFER(pVCpu); - - VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC); - - int irq = -1; - if (has_pending_irq(pVCpu) && - cur_state->Intr_state == INTERRUPT_STATE_NONE && - cur_state->Rflags & X86_EFL_IF) - { - TRPMSaveTrap(pVCpu); - irq = get_irq(pVCpu); - guest_interrupts->set_pending_interrupt(irq); - } - - vm_handler.run_vm(); - - const uint64_t reason = cur_state->Exit_reason; - uint32_t changed_state = CPUM_CHANGED_GLOBAL_TLB_FLUSH - | CPUM_CHANGED_HIDDEN_SEL_REGS; - - switch(reason) - { - case VMX_EXIT_MOV_CRX: - if (handle_cr(cur_state)) - rc = VINF_SUCCESS; - else - rc = VINF_EM_RAW_EMULATE_INSTR; - - break; - - case VMX_EXIT_EXT_INT: - case VMX_EXIT_TASK_SWITCH: - case VMX_EXIT_PREEMPT_TIMER: - rc = VINF_SUCCESS; - break; - case VMX_EXIT_TRIPLE_FAULT: - rc = VINF_EM_TRIPLE_FAULT; - break; - case VMX_EXIT_CPUID: - case VMX_EXIT_HLT: - case VMX_EXIT_INVLPG: - case VMX_EXIT_RDTSC: - case VMX_EXIT_MOV_DRX: - case VMX_EXIT_IO_INSTR: - case VMX_EXIT_RDMSR: - case VMX_EXIT_WRMSR: - case VMX_EXIT_PAUSE: - case VMX_EXIT_EPT_VIOLATION: - case VMX_EXIT_WBINVD: - rc = VINF_EM_RAW_EMULATE_INSTR; - break; - default: - rc = VINF_EM_RAW_EMULATE_INSTR; - } - - VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED); - - pCtx->rip = cur_state->Rip; - pCtx->rsp = cur_state->Rsp; - - pCtx->rax = cur_state->Regs.Rax; - pCtx->rbx = cur_state->Regs.Rbx; - pCtx->rcx = cur_state->Regs.Rcx; - pCtx->rdx = cur_state->Regs.Rdx; - pCtx->rbp = cur_state->Regs.Rbp; - pCtx->rsi = cur_state->Regs.Rsi; - pCtx->rdi = cur_state->Regs.Rdi; - pCtx->r8 = cur_state->Regs.R08; - pCtx->r9 = cur_state->Regs.R09; - pCtx->r10 = cur_state->Regs.R10; - pCtx->r11 = cur_state->Regs.R11; - pCtx->r12 = cur_state->Regs.R12; - pCtx->r13 = cur_state->Regs.R13; - pCtx->r14 = cur_state->Regs.R14; - pCtx->r15 = cur_state->Regs.R15; - - pCtx->rflags.u = cur_state->Rflags; - - if (pCtx->SysEnter.cs != cur_state->Sysenter_cs) { - pCtx->SysEnter.cs = cur_state->Sysenter_cs; - changed_state |= CPUM_CHANGED_SYSENTER_MSR; - } - if (pCtx->SysEnter.esp != cur_state->Sysenter_esp) { - pCtx->SysEnter.esp = cur_state->Sysenter_esp; - changed_state |= CPUM_CHANGED_SYSENTER_MSR; - } - if (pCtx->SysEnter.eip != cur_state->Sysenter_eip) { - pCtx->SysEnter.eip = cur_state->Sysenter_eip; - changed_state |= CPUM_CHANGED_SYSENTER_MSR; - } - - if (pCtx->idtr.cbIdt != cur_state->idtr.limit || - pCtx->idtr.pIdt != cur_state->idtr.base) - CPUMSetGuestIDTR(pVCpu, cur_state->idtr.base, cur_state->idtr.limit); - if (pCtx->gdtr.cbGdt != cur_state->gdtr.limit || - pCtx->gdtr.pGdt != cur_state->gdtr.base) - CPUMSetGuestGDTR(pVCpu, cur_state->gdtr.base, cur_state->gdtr.limit); - - { - uint32_t val; - val = (cur_state->Shadow_cr0 & pVCpu->hm.s.vmx.u32CR0Mask); - val |= (cur_state->Cr0 & ~pVCpu->hm.s.vmx.u32CR0Mask); - if (pCtx->cr0 != val) - CPUMSetGuestCR0(pVCpu, val); - } - if (pCtx->cr2 != cur_state->Regs.Cr2) - CPUMSetGuestCR2(pVCpu, cur_state->Regs.Cr2); - { - uint32_t val; - val = (cur_state->Shadow_cr4 & pVCpu->hm.s.vmx.u32CR4Mask); - val |= (cur_state->Cr4 & ~pVCpu->hm.s.vmx.u32CR4Mask); - if (pCtx->cr4 != val) - CPUMSetGuestCR4(pVCpu, val); - } - - /* - * Guest CR3 must be handled after saving CR0 & CR4. - * See HMVMXR0.cpp, function hmR0VmxSaveGuestControlRegs - */ - if (pCtx->cr3 != cur_state->Cr3) { - CPUMSetGuestCR3(pVCpu, cur_state->Cr3); - } - - GENODE_READ_SELREG(cs); - GENODE_READ_SELREG(ss); - GENODE_READ_SELREG(ds); - GENODE_READ_SELREG(es); - GENODE_READ_SELREG(fs); - GENODE_READ_SELREG(gs); - - if (GENODE_READ_SELREG_REQUIRED(ldtr)) { - GENODE_READ_SELREG(ldtr); - CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_LDTR); - } - if (GENODE_READ_SELREG_REQUIRED(tr)) { - GENODE_READ_SELREG(tr); - CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_TR); - } - - CPUMSetGuestEFER(pVCpu, cur_state->Ia32_efer); - - VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3); - - CPUMSetChangedFlags(pVCpu, changed_state); - - if (cur_state->Intr_state != 0) { - Assert(cur_state->Intr_state == BLOCKING_BY_STI || - cur_state->Intr_state == BLOCKING_BY_MOV_SS); - EMSetInhibitInterruptsPC(pVCpu, pCtx->rip); - } else - VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); - - if ((irq != -1) && guest_interrupts->is_pending_interrupt(irq)) - { - TRPMRestoreTrap(pVCpu); - guest_interrupts->clear_pending_interrupt(irq); - } - -#ifdef VBOX_WITH_REM - /* XXX see VMM/VMMR0/HMVMXR0.cpp - not necessary every time ! XXX */ - REMFlushTBs(pVM); -#endif - - return rc; - } - - Genode::error("SUPR3CallVMMR0Fast: unhandled uOperation ", (int)uOperation); - return VERR_INTERNAL_ERROR; -} - - -static Genode::Semaphore *r0_halt_sem() -{ - static Genode::Semaphore sem; - return &sem; -} - - -int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned - uOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr) -{ - switch(uOperation) - { - case VMMR0_DO_GVMM_CREATE_VM: - { - GVMMCREATEVMREQ &req = reinterpret_cast(*pReqHdr); - AssertMsgReturn(req.cCpus == 1, - ("VM with multiple CPUs not supported\n"), - VERR_INVALID_PARAMETER); - AssertMsgReturn(setup_subject_state(), - ("Unable to map guest subject state\n"), - VERR_INVALID_PARAMETER); - AssertMsgReturn(setup_subject_interrupts(), - ("Unable to map guest interrupts page\n"), - VERR_INVALID_PARAMETER); - genode_VMMR0_DO_GVMM_CREATE_VM(pReqHdr); - return VINF_SUCCESS; - } - - case VMMR0_DO_GVMM_SCHED_HALT: - r0_halt_sem()->down(); - return VINF_SUCCESS; - - case VMMR0_DO_GVMM_SCHED_WAKE_UP: - r0_halt_sem()->up(); - return VINF_SUCCESS; - - case VMMR0_DO_VMMR0_INIT: - { - VM * pVM = reinterpret_cast(pVMR0); - PVMCPU pVCpu = &pVM->aCpus[idCpu]; - pVM->hm.s.svm.fSupported = false; - pVM->hm.s.vmx.fSupported = true; - pVM->hm.s.vmx.fAllowUnrestricted = true; - pVCpu->hm.s.vmx.u32CR0Mask = 0x60000020; - pVCpu->hm.s.vmx.u32CR4Mask = 0x2000; - return VINF_SUCCESS; - } - case VMMR0_DO_GVMM_SCHED_POLL: - case VMMR0_DO_GVMM_DESTROY_VM: - case VMMR0_DO_VMMR0_TERM: - case VMMR0_DO_HM_SETUP_VM: - case VMMR0_DO_HM_ENABLE: - return VINF_SUCCESS; - - case VMMR0_DO_GVMM_SCHED_POKE: - return VINF_SUCCESS; - - default: - Genode::error("SUPR3CallVMMR0Ex: unhandled uOperation ", (int)uOperation); - return VERR_GENERAL_FAILURE; - } -} - - -bool create_emt_vcpu(pthread_t * thread, size_t stack_size, - void *(*start_routine)(void *), void *arg, - Genode::Cpu_session * cpu_session, - Genode::Affinity::Location location, - unsigned int cpu_id, - const char * name) -{ - /* No support for multiple vcpus */ - return false; -} - - -void genode_update_tsc(void (*update_func)(void), unsigned long update_us) -{ - using namespace Genode; - - Timer::Connection timer(genode_env()); - Signal_context sig_ctx; - Signal_receiver sig_rec; - Signal_context_capability sig_cap = sig_rec.manage(&sig_ctx); - - timer.sigh(sig_cap); - timer.trigger_once(update_us); - - for (;;) { - Signal s = sig_rec.wait_for_signal(); - update_func(); - - timer.trigger_once(update_us); - } -} - - -uint64_t genode_cpu_hz() -{ - static uint64_t cpu_freq = 0; - - if (!cpu_freq) { - cpu_freq = sinfo()->get_tsc_khz() * 1000; - if (!cpu_freq) - Genode::error("unable to determine CPU frequency"); - } - return cpu_freq; -} - - -HRESULT genode_setup_machine(ComObjPtr machine) -{ - HRESULT rc; - ULONG cCpus; - rc = machine->COMGETTER(CPUCount)(&cCpus); - if (FAILED(rc)) - return rc; - - if (cCpus != 1) { - Genode::warning("configured CPUs ", cCpus, " not supported, reducing to 1."); - rc = machine->COMSETTER(CPUCount)(1); - if (FAILED(rc)) - return rc; - } - - return S_OK; -} - - -/** - * Dummies and unimplemented stuff. - */ - - -/** - * VM memory layout on Muen is static. Always report success for revocation - * operation. - */ -bool Vmm_memory::revoke_from_vm(Mem_region *r) -{ - return true; -} - - -extern "C" void pthread_yield() { Genode::warning(__func__, " unimplemented"); } diff --git a/repos/ports/src/virtualbox/spec/muen/vcpu.h b/repos/ports/src/virtualbox/spec/muen/vcpu.h deleted file mode 100644 index 2dcff27a0..000000000 --- a/repos/ports/src/virtualbox/spec/muen/vcpu.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * \brief Muen subject state - * \author Adrian-Ken Rueegsegger - * \author Reto Buerki - */ - -/* - * Copyright (C) 2015-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__MUEN__VCPU_H_ -#define _VIRTUALBOX__SPEC__MUEN__VCPU_H_ - -#include - -struct Cpu_registers -{ - Genode::uint64_t Cr2; - Genode::uint64_t Rax; - Genode::uint64_t Rbx; - Genode::uint64_t Rcx; - Genode::uint64_t Rdx; - Genode::uint64_t Rdi; - Genode::uint64_t Rsi; - Genode::uint64_t Rbp; - Genode::uint64_t R08; - Genode::uint64_t R09; - Genode::uint64_t R10; - Genode::uint64_t R11; - Genode::uint64_t R12; - Genode::uint64_t R13; - Genode::uint64_t R14; - Genode::uint64_t R15; -} __attribute__((packed)); - -struct Segment -{ - Genode::uint64_t sel; - Genode::uint64_t base; - Genode::uint32_t limit; - Genode::uint32_t access; -} __attribute__((packed)); - -struct Subject_state -{ - struct Cpu_registers Regs; - Genode::uint32_t Exit_reason; - Genode::uint32_t Intr_state; - Genode::uint32_t Sysenter_cs; - Genode::uint32_t Instruction_len; - Genode::uint64_t Exit_qualification; - Genode::uint64_t Guest_phys_addr; - Genode::uint64_t Rip; - Genode::uint64_t Rsp; - Genode::uint64_t Cr0; - Genode::uint64_t Shadow_cr0; - Genode::uint64_t Cr3; - Genode::uint64_t Cr4; - Genode::uint64_t Shadow_cr4; - Genode::uint64_t Rflags; - Genode::uint64_t Ia32_efer; - Genode::uint64_t Sysenter_esp; - Genode::uint64_t Sysenter_eip; - Segment cs; - Segment ss; - Segment ds; - Segment es; - Segment fs; - Segment gs; - Segment tr; - Segment ldtr; - Segment gdtr; - Segment idtr; -} __attribute__((packed)); - -#endif /* _VIRTUALBOX__SPEC__MUEN__VCPU_H_ */ diff --git a/repos/ports/src/virtualbox/spec/muen/vm_handler.h b/repos/ports/src/virtualbox/spec/muen/vm_handler.h deleted file mode 100644 index 64f756eb9..000000000 --- a/repos/ports/src/virtualbox/spec/muen/vm_handler.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * \brief Genode/Muen specific VirtualBox SUPLib supplements - * \author Adrian-Ken Rueegsegger - */ - -/* - * Copyright (C) 2015-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__MUEN__VM_HANDLER_H_ -#define _VIRTUALBOX__SPEC__MUEN__VM_HANDLER_H_ - -#include - -#include -#include - -namespace Genode -{ - /** - * Vm execution handler. - */ - class Vm_handler; -} - - -class Genode::Vm_handler -{ - private: - - Vm_connection _vm_session; - Signal_context_capability _sig_cap; - Signal_receiver _sig_rcv; - Signal_transmitter _sig_xmit; - Signal_context _sig_ctx; - - public: - - Vm_handler(Genode::Env &env) - : - _vm_session(env) - { - _sig_cap = _sig_rcv.manage(&_sig_ctx); - _sig_xmit.context(_sig_cap); - _vm_session.exception_handler(_sig_cap); - } - - ~Vm_handler() { _sig_rcv.dissolve(&_sig_ctx); } - - /** - * Starts execution of the Vm and blocks until the Vm returns or the - * execution handler gets poked. - */ - void run_vm() - { - _vm_session.run(); - _sig_rcv.wait_for_signal(); - } -}; - -#endif /* _VIRTUALBOX__SPEC__MUEN__VM_HANDLER_H_ */ diff --git a/repos/ports/src/virtualbox/spec/nova/mem_region.h b/repos/ports/src/virtualbox/spec/nova/mem_region.h deleted file mode 100644 index 523bc7e20..000000000 --- a/repos/ports/src/virtualbox/spec/nova/mem_region.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * \brief Memory region types - * \author Alexander Boettcher - * \date 2016-08-22 - */ - -/* - * Copyright (C) 2016-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__NOVA__VMM_REGION_H_ -#define _VIRTUALBOX__SPEC__NOVA__VMM_REGION_H_ -#include "vmm_region.h" -#endif diff --git a/repos/ports/src/virtualbox/spec/nova/sup.cc b/repos/ports/src/virtualbox/spec/nova/sup.cc deleted file mode 100644 index c759f8471..000000000 --- a/repos/ports/src/virtualbox/spec/nova/sup.cc +++ /dev/null @@ -1,323 +0,0 @@ -/* - * \brief Genode/Nova specific VirtualBox SUPLib supplements - * \author Alexander Boettcher - * \author Norman Feske - * \author Christian Helmuth - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* NOVA includes that come with Genode */ -#include - -/* VirtualBox includes */ -#include "HMInternal.h" /* enable access to hm.s.* */ -#include "CPUMInternal.h" /* enable access to cpum.s.* */ -#include -#include -#include - -/* Genode's VirtualBox includes */ -#include "vmm.h" -#include "vcpu.h" -#include "vcpu_svm.h" -#include "vcpu_vmx.h" - -/* libc memory allocator */ -#include - - -static Genode::List &vcpu_handler_list() -{ - static Genode::List _inst; - return _inst; -} - - -static Vcpu_handler *lookup_vcpu_handler(unsigned int cpu_id) -{ - for (Vcpu_handler *vcpu_handler = vcpu_handler_list().first(); - vcpu_handler; - vcpu_handler = vcpu_handler->next()) - if (vcpu_handler->cpu_id() == cpu_id) - return vcpu_handler; - - return 0; -} - - -/* Genode specific function */ - -Genode::Xml_node platform_rom() -{ - static Genode::Attached_rom_dataspace const platform(genode_env(), - "platform_info"); - return platform.xml().sub_node("hardware"); -} - -void SUPR3QueryHWACCLonGenodeSupport(VM * pVM) -{ - try { - Genode::Xml_node const features = platform_rom().sub_node("features"); - pVM->hm.s.svm.fSupported = features.attribute_value("svm", false); - pVM->hm.s.vmx.fSupported = features.attribute_value("vmx", false); - - if (pVM->hm.s.svm.fSupported || pVM->hm.s.vmx.fSupported) { - Genode::log("Using ", pVM->hm.s.svm.fSupported ? "SVM" : "VMX", - " virtualization extension."); - return; - } - } catch (...) { /* if we get an exception let hardware support off */ } - - Genode::warning("No virtualization hardware acceleration available"); -} - - -/* VirtualBox SUPLib interface */ -int SUPR3QueryVTxSupported(void) { return VINF_SUCCESS; } - - -int SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu) -{ - switch (uOperation) { - case SUP_VMMR0_DO_HM_RUN: - Vcpu_handler *vcpu_handler = lookup_vcpu_handler(idCpu); - Assert(vcpu_handler); - return vcpu_handler->run_hw(pVMR0); - } - return VERR_INTERNAL_ERROR; -} - - -int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned - uOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr) -{ - switch (uOperation) { - - case VMMR0_DO_GVMM_CREATE_VM: - genode_VMMR0_DO_GVMM_CREATE_VM(pReqHdr); - return VINF_SUCCESS; - - case VMMR0_DO_GVMM_REGISTER_VMCPU: - genode_VMMR0_DO_GVMM_REGISTER_VMCPU(pVMR0, idCpu); - return VINF_SUCCESS; - - case VMMR0_DO_GVMM_SCHED_HALT: - { - const uint64_t u64NowGip = RTTimeNanoTS(); - const uint64_t ns_diff = u64Arg > u64NowGip ? u64Arg - u64NowGip : 0; - - if (!ns_diff) - return VINF_SUCCESS; - - uint64_t const tsc_offset = genode_cpu_hz() * ns_diff / (1000*1000*1000); - uint64_t const tsc_abs = Genode::Trace::timestamp() + tsc_offset; - - using namespace Genode; - - if (ns_diff > RT_NS_1SEC) - warning(" more than 1 sec vcpu halt ", ns_diff, " ns"); - - Vcpu_handler *vcpu_handler = lookup_vcpu_handler(idCpu); - Assert(vcpu_handler); - vcpu_handler->halt(tsc_abs); - - return VINF_SUCCESS; - } - - case VMMR0_DO_GVMM_SCHED_WAKE_UP: - { - Vcpu_handler *vcpu_handler = lookup_vcpu_handler(idCpu); - Assert(vcpu_handler); - - /* don't wake the currently running thread again */ - if (vcpu_handler->utcb() == Genode::Thread::myself()->utcb()) - return VINF_SUCCESS; - - vcpu_handler->wake_up(); - return VINF_SUCCESS; - } - - /* called by 'vmR3HaltGlobal1Halt' */ - case VMMR0_DO_GVMM_SCHED_POLL: - return VINF_SUCCESS; - - case VMMR0_DO_VMMR0_INIT: - SUPR3QueryHWACCLonGenodeSupport(reinterpret_cast(pVMR0)); - return VINF_SUCCESS; - - case VMMR0_DO_GVMM_DESTROY_VM: - case VMMR0_DO_VMMR0_TERM: - case VMMR0_DO_HM_SETUP_VM: - return VINF_SUCCESS; - - case VMMR0_DO_HM_ENABLE: - return VINF_SUCCESS; - - case VMMR0_DO_GVMM_SCHED_POKE: - { - Vcpu_handler *vcpu_handler = lookup_vcpu_handler(idCpu); - Assert(vcpu_handler); - if (vcpu_handler) - vcpu_handler->recall(); - return VINF_SUCCESS; - } - - default: - Genode::error("SUPR3CallVMMR0Ex: unhandled uOperation ", uOperation); - return VERR_GENERAL_FAILURE; - } -} - - -/** - * Various support stuff - base-nova specific. - */ -uint64_t genode_cpu_hz() -{ - static uint64_t cpu_freq = 0; - - if (!cpu_freq) { - try { - platform_rom().sub_node("tsc").attribute("freq_khz").value(&cpu_freq); - cpu_freq *= 1000ULL; - } catch (...) { - Genode::error("could not read out CPU frequency"); - Genode::Lock lock; - lock.lock(); - } - } - - return cpu_freq; -} - - -void genode_update_tsc(void (*update_func)(void), unsigned long update_us) -{ - using namespace Genode; - using namespace Nova; - - enum { TSC_FACTOR = 1000ULL }; - - Genode::addr_t sem = Thread::myself()->native_thread().exc_pt_sel + Nova::SM_SEL_EC; - unsigned long tsc_khz = (genode_cpu_hz() / 1000) / TSC_FACTOR; - - Trace::Timestamp us_64 = update_us; - - for (;;) { - update_func(); - - Trace::Timestamp now = Trace::timestamp(); - - /* block until timeout fires or it gets canceled */ - unsigned long long tsc_absolute = now + us_64 * tsc_khz; - Genode::uint8_t res = sm_ctrl(sem, SEMAPHORE_DOWN, tsc_absolute); - if (res != Nova::NOVA_OK && res != Nova::NOVA_TIMEOUT) - nova_die(); - } -} - - -HRESULT genode_setup_machine(ComObjPtr machine) -{ - return genode_check_memory_config(machine); -}; - - -bool Vmm_memory::revoke_from_vm(Mem_region *r) -{ - Assert(r); - - using namespace Genode; - - addr_t const vmm_local = (addr_t)r->local_addr(); - Assert(vmm_local); - - Flexpage_iterator fli(vmm_local, r->size(), 0, ~0UL, 0); - - Flexpage revoke_page = fli.page(); - while (revoke_page.valid()) { - Assert(revoke_page.log2_order >= 12); - Assert(!(((1UL << revoke_page.log2_order) - 1) & revoke_page.addr)); - - using namespace Nova; - - Rights const revoke_rwx(true, true, true); - Crd crd = Mem_crd(revoke_page.addr >> 12, revoke_page.log2_order - 12, - revoke_rwx); - revoke(crd, false); - - /* request next page(s) to be revoked */ - revoke_page = fli.page(); - } - - return true; -} - - -extern "C" void pthread_yield(void) -{ - Nova::ec_ctrl(Nova::EC_YIELD); -} - - -void *operator new (__SIZE_TYPE__ size, int log2_align) -{ - static Libc::Mem_alloc_impl heap(genode_env().rm(), genode_env().ram()); - return heap.alloc(size, log2_align); -} - - -bool create_emt_vcpu(pthread_t * pthread, size_t stack, - void *(*start_routine)(void *), void *arg, - Genode::Cpu_session * cpu_session, - Genode::Affinity::Location location, - unsigned int cpu_id, const char * name) -{ - Genode::Xml_node const features = platform_rom().sub_node("features"); - bool const svm = features.attribute_value("svm", false); - bool const vmx = features.attribute_value("vmx", false); - - if (!svm && !vmx) - return false; - - static Genode::Pd_connection pd_vcpus(genode_env(), "VM"); - - Vcpu_handler *vcpu_handler = 0; - - if (vmx) - vcpu_handler = new (0x10) Vcpu_handler_vmx(genode_env(), - stack, start_routine, - arg, cpu_session, location, - cpu_id, name, pd_vcpus); - - if (svm) - vcpu_handler = new (0x10) Vcpu_handler_svm(genode_env(), - stack, start_routine, - arg, cpu_session, location, - cpu_id, name, pd_vcpus); - - Assert(!(reinterpret_cast(vcpu_handler) & 0xf)); - - vcpu_handler_list().insert(vcpu_handler); - - *pthread = &vcpu_handler->pthread_obj(); - return true; -} diff --git a/repos/ports/src/virtualbox/spec/nova/svm.h b/repos/ports/src/virtualbox/spec/nova/svm.h deleted file mode 100644 index 534481f61..000000000 --- a/repos/ports/src/virtualbox/spec/nova/svm.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * \brief Genode/Nova specific VirtualBox SUPLib supplements - * \author Norman Feske - * \author Alexander Boettcher - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__NOVA__SVM_H_ -#define _VIRTUALBOX__SPEC__NOVA__SVM_H_ - -/* based on HWSVMR0.h - adjusted to Genode/Nova */ - -#define GENODE_SVM_ASSERT_SELREG(REG) \ - AssertMsg(!pCtx->REG.Attr.n.u1Present || \ - (pCtx->REG.Attr.n.u1Granularity \ - ? (pCtx->REG.u32Limit & 0xfffU) == 0xfffU \ - : pCtx->REG.u32Limit <= 0xfffffU), \ - ("Invalid Segment Attributes %u %u %#x %#x %#llx line=%u\n", pCtx->REG.Attr.n.u1Present, \ - pCtx->REG.Attr.n.u1Granularity, pCtx->REG.u32Limit, \ - pCtx->REG.Attr.u, pCtx->REG.u64Base, __LINE__)) - -#define GENODE_READ_SELREG(REG) \ - pCtx->REG.Sel = utcb->REG.sel; \ - pCtx->REG.ValidSel = utcb->REG.sel; \ - pCtx->REG.fFlags = CPUMSELREG_FLAGS_VALID; \ - pCtx->REG.u32Limit = utcb->REG.limit; \ - pCtx->REG.u64Base = utcb->REG.base; \ - pCtx->REG.Attr.u = sel_ar_conv_from_nova(utcb->REG.ar) - -static inline bool svm_save_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu) -{ - PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); - - GENODE_READ_SELREG(cs); - GENODE_READ_SELREG(ds); - GENODE_READ_SELREG(es); - GENODE_READ_SELREG(fs); - GENODE_READ_SELREG(gs); - GENODE_READ_SELREG(ss); - - if ( !pCtx->cs.Attr.n.u1Granularity - && pCtx->cs.Attr.n.u1Present - && pCtx->cs.u32Limit > UINT32_C(0xfffff)) - { - Assert((pCtx->cs.u32Limit & 0xfff) == 0xfff); - pCtx->cs.Attr.n.u1Granularity = 1; - } - - GENODE_SVM_ASSERT_SELREG(cs); - GENODE_SVM_ASSERT_SELREG(ds); - GENODE_SVM_ASSERT_SELREG(es); - GENODE_SVM_ASSERT_SELREG(fs); - GENODE_SVM_ASSERT_SELREG(gs); - GENODE_SVM_ASSERT_SELREG(ss); - - GENODE_READ_SELREG(ldtr); - GENODE_READ_SELREG(tr); - - return true; -} - -#undef GENODE_ASSERT_SELREG -#undef GENODE_READ_SELREG - - - - -#define GENODE_WRITE_SELREG(REG) \ - Assert(pCtx->REG.fFlags & CPUMSELREG_FLAGS_VALID); \ - Assert(pCtx->REG.ValidSel == pCtx->REG.Sel); \ - utcb->REG.sel = pCtx->REG.Sel; \ - utcb->REG.limit = pCtx->REG.u32Limit; \ - utcb->REG.base = pCtx->REG.u64Base; \ - utcb->REG.ar = sel_ar_conv_to_nova(pCtx->REG.Attr.u) - -static inline bool svm_load_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu) -{ - PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); - -#ifdef __x86_64__ - utcb->mtd |= Nova::Mtd::EFER; - utcb->efer = pCtx->msrEFER | MSR_K6_EFER_SVME; - /* unimplemented */ - if (CPUMIsGuestInLongModeEx(pCtx)) - return false; - utcb->efer &= ~MSR_K6_EFER_LME; -#endif - - utcb->mtd |= Nova::Mtd::ESDS; - GENODE_WRITE_SELREG(es); - GENODE_WRITE_SELREG(ds); - - utcb->mtd |= Nova::Mtd::FSGS; - GENODE_WRITE_SELREG(fs); - GENODE_WRITE_SELREG(gs); - - utcb->mtd |= Nova::Mtd::CSSS; - GENODE_WRITE_SELREG(cs); - GENODE_WRITE_SELREG(ss); - - /* ldtr */ - utcb->mtd |= Nova::Mtd::LDTR; - GENODE_WRITE_SELREG(ldtr); - - /* tr */ - utcb->mtd |= Nova::Mtd::TR; - GENODE_WRITE_SELREG(tr); - - return true; -} - -#undef GENODE_WRITE_SELREG - -#endif /* _VIRTUALBOX__SPEC__NOVA__SVM_H_ */ diff --git a/repos/ports/src/virtualbox/spec/nova/vcpu.h b/repos/ports/src/virtualbox/spec/nova/vcpu.h deleted file mode 100644 index 2a5c730cf..000000000 --- a/repos/ports/src/virtualbox/spec/nova/vcpu.h +++ /dev/null @@ -1,907 +0,0 @@ -/* - * \brief Genode/Nova specific VirtualBox SUPLib supplements - * \author Alexander Boettcher - * \author Norman Feske - * \author Christian Helmuth - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__NOVA__VCPU_H_ -#define _VIRTUALBOX__SPEC__NOVA__VCPU_H_ - -/* Genode includes */ -#include -#include -#include -#include -#include - -#include -#include -#include - -/* NOVA includes that come with Genode */ -#include - -/* VirtualBox includes */ -#include -#include -#include - -/* Genode's VirtualBox includes */ -#include "sup.h" -#include "guest_memory.h" -#include "vmm_memory.h" - -/* Genode libc pthread binding */ -#include "thread.h" - -/* LibC includes */ -#include - -#include - -static bool debug_map_memory = false; - -/* - * VirtualBox stores segment attributes in Intel format using a 32-bit - * value. NOVA represents the attributes in packed format using a 16-bit - * value. - */ -static inline Genode::uint16_t sel_ar_conv_to_nova(Genode::uint32_t v) -{ - return (v & 0xff) | ((v & 0x1f000) >> 4); -} - - -static inline Genode::uint32_t sel_ar_conv_from_nova(Genode::uint16_t v) -{ - return (v & 0xff) | (((uint32_t )v << 4) & 0x1f000); -} - - -/* - * Used to map mmio memory to VM - */ -extern "C" int MMIO2_MAPPED_SYNC(PVM pVM, RTGCPHYS GCPhys, size_t cbWrite, - void **ppv, Genode::Flexpage_iterator &fli, - bool &writeable); - - -class Vcpu_handler : public Vmm::Vcpu_dispatcher, - public Genode::List::Element -{ - protected: - - pthread::start_routine_t const _start_routine; - void * const _start_routine_arg; - - private: - - X86FXSTATE _guest_fpu_state __attribute__((aligned(0x10))); - X86FXSTATE _emt_fpu_state __attribute__((aligned(0x10))); - - pthread _pthread; - - Vmm::Vcpu_other_pd _vcpu; - - Genode::addr_t _ec_sel; - bool _irq_win; - - unsigned int _cpu_id; - - unsigned int _last_inj_info; - unsigned int _last_inj_error; - - void fpu_save(char * data) { - Assert(!(reinterpret_cast(data) & 0xF)); - asm volatile ("fxsave %0" : "=m" (*data)); - } - - void fpu_load(char * data) { - Assert(!(reinterpret_cast(data) & 0xF)); - asm volatile ("fxrstor %0" : : "m" (*data)); - } - - enum { - NOVA_REQ_IRQWIN_EXIT = 0x1000U, - IRQ_INJ_VALID_MASK = 0x80000000UL, - IRQ_INJ_NONE = 0U, - - /* - * Intel® 64 and IA-32 Architectures Software Developer’s Manual - * Volume 3C, Chapter 24.4.2. - * May 2012 - */ - BLOCKING_BY_STI = 1U << 0, - BLOCKING_BY_MOV_SS = 1U << 1, - ACTIVITY_STATE_ACTIVE = 0U, - INTERRUPT_STATE_NONE = 0U, - }; - - /* - * 'longjmp()' restores some FPU registers saved by 'setjmp()', - * so we need to save the guest FPU state before calling 'longjmp()' - */ - __attribute__((noreturn)) void _fpu_save_and_longjmp() - { - fpu_save(reinterpret_cast(&_guest_fpu_state)); - longjmp(_env, 1); - } - - protected: - - struct { - Nova::mword_t mtd; - unsigned intr_state; - unsigned ctrl[2]; - } next_utcb; - - PVM _current_vm; - PVMCPU _current_vcpu; - void * _stack_reply; - jmp_buf _env; - - void switch_to_hw() - { - unsigned long value; - - if (!setjmp(_env)) { - _stack_reply = reinterpret_cast(&value - 1); - Nova::reply(_stack_reply); - } - } - - __attribute__((noreturn)) void _default_handler() - { - Nova::Utcb * utcb = reinterpret_cast(Thread::utcb()); - - Assert(utcb->actv_state == ACTIVITY_STATE_ACTIVE); - Assert(!(utcb->inj_info & IRQ_INJ_VALID_MASK)); - - /* go back to VirtualBox */ - _fpu_save_and_longjmp(); - } - - __attribute__((noreturn)) void _recall_handler() - { - Nova::Utcb * utcb = reinterpret_cast(Thread::utcb()); - - Assert(utcb->actv_state == ACTIVITY_STATE_ACTIVE); - - if (utcb->inj_info & IRQ_INJ_VALID_MASK) { - - Assert(utcb->flags & X86_EFL_IF); - - if (utcb->intr_state != INTERRUPT_STATE_NONE) - Vmm::log("intr state ", Genode::Hex(utcb->intr_state), - " ", Genode::Hex(utcb->intr_state & 0xf)); - - Assert(utcb->intr_state == INTERRUPT_STATE_NONE); - -/* - if (!continue_hw_accelerated(utcb)) - Vmm::log("WARNING - recall ignored during IRQ delivery"); -*/ - /* got recall during irq injection and the guest is ready for - * delivery of IRQ - just continue */ - Nova::reply(_stack_reply); - } - - /* are we forced to go back to emulation mode ? */ - if (!continue_hw_accelerated(utcb)) { - /* go back to emulation mode */ - _fpu_save_and_longjmp(); - } - - /* check whether we have to request irq injection window */ - utcb->mtd = Nova::Mtd::FPU; - if (check_to_request_irq_window(utcb, _current_vcpu)) { - _irq_win = true; - Nova::reply(_stack_reply); - } - - unsigned long utcb_tpr = utcb->read_tpr(); - bool interrupt_pending = false; - uint8_t tpr = 0; - uint8_t pending_interrupt = 0; - PDMApicGetTPR(_current_vcpu, &tpr, &interrupt_pending, &pending_interrupt); - - /* we have a pending interrupt but nothing should be requested ? */ - if (interrupt_pending) { - PDMApicSetTPR(_current_vcpu, utcb_tpr); - - utcb->mtd = Nova::Mtd::FPU; - _irq_win = check_to_request_irq_window(utcb, _current_vcpu); - if (_irq_win) - Nova::reply(_stack_reply); - } - - /* nothing to do at all - continue hardware accelerated */ - - /* - * Print a debug message if there actually IS something to do now. - * This can happen, for example, if one of the worker threads has - * set a flag in the meantime. Usually, setting a flag is followed - * by a recall request, but we haven't verified this for each flag - * yet. - */ - utcb->mtd = Nova::Mtd::FPU; - continue_hw_accelerated(utcb, true); - - if (_irq_win) { - _irq_win = false; - utcb->inj_info = IRQ_INJ_NONE; - utcb->mtd |= Nova::Mtd::INJ; - } - - Nova::reply(_stack_reply); - } - - template - __attribute__((noreturn)) inline - void _exc_memory(Genode::Thread * myself, Nova::Utcb * utcb, - bool unmap, Genode::addr_t reason) - { - using namespace Nova; - using namespace Genode; - - Assert(utcb->actv_state == ACTIVITY_STATE_ACTIVE); - - if (unmap) { - Vmm::log("error: unmap not implemented"); - Nova::reply(_stack_reply); - } - - enum { MAP_SIZE = 0x1000UL }; - - bool writeable = true; - Flexpage_iterator fli; - void *pv = guest_memory()->lookup_ram(reason, MAP_SIZE, fli); - - if (!pv) { - /** - * Check whether this is some mmio memory provided by VMM - * we can map, e.g. VMMDev memory or framebuffer currently. - */ - int res = MMIO2_MAPPED_SYNC(_current_vm, reason, MAP_SIZE, &pv, - fli, writeable); - if (res != VINF_SUCCESS) - pv = 0; - } - - /* emulator has to take over if fault region is not ram */ - if (!pv) { - /* event re-injection is not handled yet for this case */ - Assert(!(utcb->inj_info & IRQ_INJ_VALID_MASK)); - _fpu_save_and_longjmp(); - } - - /* fault region can be mapped - prepare utcb */ - utcb->set_msg_word(0); - utcb->mtd = Mtd::FPU; - - if (utcb->inj_info & IRQ_INJ_VALID_MASK) { - /* - * The EPT violation occurred during event injection, - * so the event needs to be injected again. - */ - utcb->mtd |= Mtd::INJ; - utcb->inj_info = _last_inj_info; - utcb->inj_error = _last_inj_error; - } - - enum { - USER_PD = false, GUEST_PGT = true, - READABLE = true, EXECUTABLE = true - }; - - Rights permission(READABLE, writeable, EXECUTABLE); - - - /* add map items until no space is left on utcb anymore */ - bool res; - do { - Flexpage flexpage = fli.page(); - if (!flexpage.valid() || flexpage.log2_order < 12) - break; - - /* touch memory - otherwise no mapping will take place */ - addr_t touch_me = flexpage.addr; - while (touch_me < flexpage.addr + (1UL << flexpage.log2_order)) { - touch_read(reinterpret_cast(touch_me)); - touch_me += 0x1000UL; - } - - Crd crd = Mem_crd(flexpage.addr >> 12, flexpage.log2_order - 12, - permission); - res = utcb->append_item(crd, flexpage.hotspot, USER_PD, GUEST_PGT); - - if (debug_map_memory) - Vmm::log("map guest mem ", Genode::Hex(flexpage.addr), - "+", 1UL << flexpage.log2_order, " -> ", - Genode::Hex(flexpage.hotspot), " reason=", reason); - } while (res); - - Nova::reply(_stack_reply); - } - - /** - * Shortcut for calling 'Vmm::Vcpu_dispatcher::register_handler' - * with 'Vcpu_dispatcher' as template argument - */ - template - void _register_handler(Genode::addr_t exc_base, Nova::Mtd mtd) - { - if (!register_handler(exc_base, mtd)) - Genode::error("could not register handler ", - Genode::Hex(exc_base + EV)); - } - - - Vmm::Vcpu_other_pd &vcpu() { return _vcpu; } - - - inline bool vbox_to_utcb(Nova::Utcb * utcb, VM *pVM, PVMCPU pVCpu) - { - PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); - - /* avoid utcb corruption by requesting tpr state early */ - bool interrupt_pending = false; - uint8_t tpr = 0; - uint8_t pending_interrupt = 0; - PDMApicGetTPR(pVCpu, &tpr, &interrupt_pending, &pending_interrupt); - - /* don't call function hereafter which may corrupt the utcb ! */ - using namespace Nova; - - utcb->mtd |= Mtd::EIP; - utcb->ip = pCtx->rip; - - utcb->mtd |= Mtd::ESP; - utcb->sp = pCtx->rsp; - - utcb->mtd |= Mtd::ACDB; - utcb->ax = pCtx->rax; - utcb->bx = pCtx->rbx; - utcb->cx = pCtx->rcx; - utcb->dx = pCtx->rdx; - - utcb->mtd |= Mtd::EBSD; - utcb->bp = pCtx->rbp; - utcb->si = pCtx->rsi; - utcb->di = pCtx->rdi; - - utcb->mtd |= Mtd::R8_R15; - utcb->write_r8(pCtx->r8); - utcb->write_r9(pCtx->r9); - utcb->write_r10(pCtx->r10); - utcb->write_r11(pCtx->r11); - utcb->write_r12(pCtx->r12); - utcb->write_r13(pCtx->r13); - utcb->write_r14(pCtx->r14); - utcb->write_r15(pCtx->r15); - - utcb->mtd |= Mtd::EFL; - utcb->flags = pCtx->rflags.u; - - utcb->mtd |= Mtd::SYS; - utcb->sysenter_cs = pCtx->SysEnter.cs; - utcb->sysenter_sp = pCtx->SysEnter.esp; - utcb->sysenter_ip = pCtx->SysEnter.eip; - - utcb->mtd |= Mtd::DR; - utcb->dr7 = pCtx->dr[7]; - - utcb->mtd |= Mtd::CR; - utcb->cr0 = pCtx->cr0; - - utcb->mtd |= Mtd::CR; - utcb->cr2 = pCtx->cr2; - - utcb->mtd |= Mtd::CR; - utcb->cr3 = pCtx->cr3; - - utcb->mtd |= Mtd::CR; - utcb->cr4 = pCtx->cr4; - - utcb->mtd |= Mtd::IDTR; - utcb->idtr.limit = pCtx->idtr.cbIdt; - utcb->idtr.base = pCtx->idtr.pIdt; - - utcb->mtd |= Mtd::GDTR; - utcb->gdtr.limit = pCtx->gdtr.cbGdt; - utcb->gdtr.base = pCtx->gdtr.pGdt; - - utcb->mtd |= Mtd::EFER; - utcb->write_efer(CPUMGetGuestEFER(pVCpu)); - - /* - * Update the PDPTE registers if necessary - * - * Intel manual sections 4.4.1 of Vol. 3A and 26.3.2.4 of Vol. 3C - * indicate the conditions when this is the case. The following - * code currently does not check if the recompiler modified any - * CR registers, which means the update can happen more often - * than really necessary. - */ - if (pVM->hm.s.vmx.fSupported && - CPUMIsGuestPagingEnabledEx(pCtx) && - CPUMIsGuestInPAEModeEx(pCtx)) { - - utcb->mtd |= Mtd::PDPTE; - - Genode::uint64_t *pdpte = (Genode::uint64_t*) - guest_memory()->lookup(utcb->cr3, sizeof(utcb->pdpte)); - - Assert(pdpte != 0); - - utcb->pdpte[0] = pdpte[0]; - utcb->pdpte[1] = pdpte[1]; - utcb->pdpte[2] = pdpte[2]; - utcb->pdpte[3] = pdpte[3]; - } - - utcb->mtd |= Mtd::SYSCALL_SWAPGS; - utcb->write_star(pCtx->msrSTAR); - utcb->write_lstar(pCtx->msrLSTAR); - utcb->write_fmask(pCtx->msrSFMASK); - utcb->write_kernel_gs_base(pCtx->msrKERNELGSBASE); - - /* from HMVMXR0.cpp */ - utcb->mtd |= Mtd::TPR; - utcb->write_tpr(tpr); - utcb->write_tpr_threshold(0); - if (interrupt_pending) { - const uint8_t pending_priority = (pending_interrupt >> 4) & 0xf; - const uint8_t tpr_priority = (tpr >> 4) & 0xf; - if (pending_priority <= tpr_priority) - utcb->write_tpr_threshold(pending_priority); - else - utcb->write_tpr_threshold(tpr_priority); - } - - return true; - } - - - inline bool utcb_to_vbox(Nova::Utcb * utcb, VM *pVM, PVMCPU pVCpu) - { - PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); - - pCtx->rip = utcb->ip; - pCtx->rsp = utcb->sp; - - pCtx->rax = utcb->ax; - pCtx->rbx = utcb->bx; - pCtx->rcx = utcb->cx; - pCtx->rdx = utcb->dx; - - pCtx->rbp = utcb->bp; - pCtx->rsi = utcb->si; - pCtx->rdi = utcb->di; - pCtx->rflags.u = utcb->flags; - - pCtx->r8 = utcb->read_r8(); - pCtx->r9 = utcb->read_r9(); - pCtx->r10 = utcb->read_r10(); - pCtx->r11 = utcb->read_r11(); - pCtx->r12 = utcb->read_r12(); - pCtx->r13 = utcb->read_r13(); - pCtx->r14 = utcb->read_r14(); - pCtx->r15 = utcb->read_r15(); - - pCtx->dr[7] = utcb->dr7; - - if (pCtx->SysEnter.cs != utcb->sysenter_cs) - CPUMSetGuestMsr(pVCpu, MSR_IA32_SYSENTER_CS, utcb->sysenter_cs); - - if (pCtx->SysEnter.esp != utcb->sysenter_sp) - CPUMSetGuestMsr(pVCpu, MSR_IA32_SYSENTER_ESP, utcb->sysenter_sp); - - if (pCtx->SysEnter.eip != utcb->sysenter_ip) - CPUMSetGuestMsr(pVCpu, MSR_IA32_SYSENTER_EIP, utcb->sysenter_ip); - - if (pCtx->idtr.cbIdt != utcb->idtr.limit || - pCtx->idtr.pIdt != utcb->idtr.base) - CPUMSetGuestIDTR(pVCpu, utcb->idtr.base, utcb->idtr.limit); - - if (pCtx->gdtr.cbGdt != utcb->gdtr.limit || - pCtx->gdtr.pGdt != utcb->gdtr.base) - CPUMSetGuestGDTR(pVCpu, utcb->gdtr.base, utcb->gdtr.limit); - - CPUMSetGuestEFER(pVCpu, utcb->read_efer()); - - if (pCtx->cr0 != utcb->cr0) - CPUMSetGuestCR0(pVCpu, utcb->cr0); - - if (pCtx->cr2 != utcb->cr2) - CPUMSetGuestCR2(pVCpu, utcb->cr2); - - if (pCtx->cr3 != utcb->cr3) - CPUMSetGuestCR3(pVCpu, utcb->cr3); - - if (pCtx->cr4 != utcb->cr4) - CPUMSetGuestCR4(pVCpu, utcb->cr4); - - if (pCtx->msrSTAR != utcb->read_star()) - CPUMSetGuestMsr(pVCpu, MSR_K6_STAR, utcb->read_star()); - - if (pCtx->msrLSTAR != utcb->read_lstar()) - CPUMSetGuestMsr(pVCpu, MSR_K8_LSTAR, utcb->read_lstar()); - - if (pCtx->msrSFMASK != utcb->read_fmask()) - CPUMSetGuestMsr(pVCpu, MSR_K8_SF_MASK, utcb->read_fmask()); - - if (pCtx->msrKERNELGSBASE != utcb->read_kernel_gs_base()) - CPUMSetGuestMsr(pVCpu, MSR_K8_KERNEL_GS_BASE, utcb->read_kernel_gs_base()); - - const uint32_t tpr = utcb->read_tpr(); - - /* reset message transfer descriptor for next invocation */ - Assert (!(utcb->inj_info & IRQ_INJ_VALID_MASK)); - /* Reset irq window next time if we are still requesting it */ - next_utcb.mtd = _irq_win ? Nova::Mtd::INJ : 0; - - next_utcb.intr_state = utcb->intr_state; - next_utcb.ctrl[0] = utcb->ctrl[0]; - next_utcb.ctrl[1] = utcb->ctrl[1]; - - if (next_utcb.intr_state & 3) { - next_utcb.intr_state &= ~3U; - next_utcb.mtd |= Nova::Mtd::STA; - } - - VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3); - - /* tell rem compiler that FPU register changed XXX optimizations ? */ - CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_FPU_REM); /* redundant ? XXX */ - pVCpu->cpum.s.fUseFlags |= (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM); /* redundant ? XXX */ - - if (utcb->intr_state != 0) { - Assert(utcb->intr_state == BLOCKING_BY_STI || - utcb->intr_state == BLOCKING_BY_MOV_SS); - EMSetInhibitInterruptsPC(pVCpu, pCtx->rip); - } else - VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); - - /* functions that corrupt utcb (e.g. when logging enabled) */ - PDMApicSetTPR(pVCpu, tpr); - - return true; - } - - - inline bool check_to_request_irq_window(Nova::Utcb * utcb, PVMCPU pVCpu) - { - if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)) - return false; - - if (!TRPMHasTrap(pVCpu) && - !VMCPU_FF_IS_PENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | - VMCPU_FF_INTERRUPT_PIC))) - return false; - - unsigned vector = 0; - utcb->inj_info = NOVA_REQ_IRQWIN_EXIT | vector; - utcb->mtd |= Nova::Mtd::INJ; - - return true; - } - - - __attribute__((noreturn)) void _irq_window() - { - Nova::Utcb * utcb = reinterpret_cast(Thread::utcb()); - - PVMCPU pVCpu = _current_vcpu; - - Assert(utcb->intr_state == INTERRUPT_STATE_NONE); - Assert(utcb->flags & X86_EFL_IF); - Assert(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)); - Assert(!(utcb->inj_info & IRQ_INJ_VALID_MASK)); - - Assert(_irq_win); - _irq_win = false; - - /* request current tpr state from guest, it may block IRQs */ - PDMApicSetTPR(pVCpu, utcb->read_tpr()); - - if (!TRPMHasTrap(pVCpu)) { - bool res = VMCPU_FF_TEST_AND_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI); - if (res) - Vmm::log("NMI was set"); - - if (VMCPU_FF_IS_PENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | - VMCPU_FF_INTERRUPT_PIC))) { - - uint8_t irq; - int rc = PDMGetInterrupt(pVCpu, &irq); - Assert(RT_SUCCESS(rc)); - - rc = TRPMAssertTrap(pVCpu, irq, TRPM_HARDWARE_INT); - Assert(RT_SUCCESS(rc)); - } - - if (!TRPMHasTrap(pVCpu)) { - /* happens if PDMApicSetTPR (see above) mask IRQ */ - utcb->inj_info = IRQ_INJ_NONE; - utcb->mtd = Nova::Mtd::INJ | Nova::Mtd::FPU; - Nova::reply(_stack_reply); - } - } - - /* - * If we have no IRQ for injection, something with requesting the - * IRQ window went wrong. Probably it was forgotten to be reset. - */ - Assert(TRPMHasTrap(pVCpu)); - - /* interrupt can be dispatched */ - uint8_t u8Vector; - TRPMEVENT enmType; - SVMEVENT Event; - RTGCUINT u32ErrorCode; - RTGCUINTPTR GCPtrFaultAddress; - uint8_t cbInstr; - - Event.u = 0; - - /* If a new event is pending, then dispatch it now. */ - int rc = TRPMQueryTrapAll(pVCpu, &u8Vector, &enmType, &u32ErrorCode, 0, 0); - AssertRC(rc); - Assert(enmType == TRPM_HARDWARE_INT); - Assert(u8Vector != X86_XCPT_NMI); - - /* Clear the pending trap. */ - rc = TRPMResetTrap(pVCpu); - AssertRC(rc); - - Event.n.u8Vector = u8Vector; - Event.n.u1Valid = 1; - Event.n.u32ErrorCode = u32ErrorCode; - - Event.n.u3Type = SVM_EVENT_EXTERNAL_IRQ; - - utcb->inj_info = Event.u; - utcb->inj_error = Event.n.u32ErrorCode; - - _last_inj_info = utcb->inj_info; - _last_inj_error = utcb->inj_error; - -/* - Vmm::log("type:info:vector ", Genode::Hex(Event.n.u3Type), - Genode::Hex(utcb->inj_info), Genode::Hex(u8Vector), - " intr:actv - ", Genode::Hex(utcb->intr_state), - Genode::Hex(utcb->actv_state), " mtd ", - Genode::Hex(utcb->mtd)); -*/ - utcb->mtd = Nova::Mtd::INJ | Nova::Mtd::FPU; - Nova::reply(_stack_reply); - } - - - inline bool continue_hw_accelerated(Nova::Utcb * utcb, bool verbose = false) - { - uint32_t check_vm = VM_FF_HM_TO_R3_MASK | VM_FF_REQUEST - | VM_FF_PGM_POOL_FLUSH_PENDING - | VM_FF_PDM_DMA; - uint32_t check_vcpu = VMCPU_FF_HM_TO_R3_MASK - | VMCPU_FF_PGM_SYNC_CR3 - | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL - | VMCPU_FF_REQUEST; - - if (!VM_FF_IS_PENDING(_current_vm, check_vm) && - !VMCPU_FF_IS_PENDING(_current_vcpu, check_vcpu)) - return true; - - Assert(!(VM_FF_IS_PENDING(_current_vm, VM_FF_PGM_NO_MEMORY))); - -#define VERBOSE_VM(flag) \ - do { \ - if (VM_FF_IS_PENDING(_current_vm, flag)) \ - Vmm::log("flag ", flag, " pending"); \ - } while (0) - -#define VERBOSE_VMCPU(flag) \ - do { \ - if (VMCPU_FF_IS_PENDING(_current_vcpu, flag)) \ - Vmm::log("flag ", flag, " pending"); \ - } while (0) - - if (verbose) { - /* - * VM_FF_HM_TO_R3_MASK - */ - VERBOSE_VM(VM_FF_TM_VIRTUAL_SYNC); - VERBOSE_VM(VM_FF_PGM_NEED_HANDY_PAGES); - /* handled by the assertion above */ - /* VERBOSE_VM(VM_FF_PGM_NO_MEMORY); */ - VERBOSE_VM(VM_FF_PDM_QUEUES); - VERBOSE_VM(VM_FF_EMT_RENDEZVOUS); - - VERBOSE_VM(VM_FF_REQUEST); - VERBOSE_VM(VM_FF_PGM_POOL_FLUSH_PENDING); - VERBOSE_VM(VM_FF_PDM_DMA); - - /* - * VMCPU_FF_HM_TO_R3_MASK - */ - VERBOSE_VMCPU(VMCPU_FF_TO_R3); - /* when this flag gets set, a recall request follows */ - /* VERBOSE_VMCPU(VMCPU_FF_TIMER); */ - VERBOSE_VMCPU(VMCPU_FF_PDM_CRITSECT); - - VERBOSE_VMCPU(VMCPU_FF_PGM_SYNC_CR3); - VERBOSE_VMCPU(VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); - VERBOSE_VMCPU(VMCPU_FF_REQUEST); - } - -#undef VERBOSE_VMCPU -#undef VERBOSE_VM - - return false; - } - - virtual bool hw_load_state(Nova::Utcb *, VM *, PVMCPU) = 0; - virtual bool hw_save_state(Nova::Utcb *, VM *, PVMCPU) = 0; - virtual bool vm_exit_requires_instruction_emulation() = 0; - - public: - - enum Exit_condition - { - SVM_NPT = 0xfc, - SVM_INVALID = 0xfd, - - VCPU_STARTUP = 0xfe, - - RECALL = 0xff, - EMULATE_INSTR = 0x100 - }; - - - Vcpu_handler(Genode::Env &env, size_t stack_size, - void *(*start_routine) (void *), void *arg, - Genode::Cpu_session * cpu_session, - Genode::Affinity::Location location, - unsigned int cpu_id, const char * name, - Genode::Pd_session_capability pd_vcpu) - : - Vmm::Vcpu_dispatcher(env, stack_size, cpu_session, - location, name), - _pthread(*this), - _start_routine(start_routine), - _start_routine_arg(arg), - _vcpu(cpu_session, location, pd_vcpu), - _ec_sel(Genode::cap_map().insert()), - _irq_win(false), - _cpu_id(cpu_id) - { } - - pthread &pthread_obj() { return _pthread; } - - unsigned int cpu_id() { return _cpu_id; } - - void start() { - _vcpu.start(_ec_sel); - } - - void recall() - { - using namespace Nova; - - if (ec_ctrl(EC_RECALL, _ec_sel) != NOVA_OK) { - Genode::error("recall failed"); - Genode::Lock lock(Genode::Lock::LOCKED); - lock.lock(); - } - } - - void halt(Genode::uint64_t tsc_abs) - { - Assert(utcb() == Thread::myself()->utcb()); - - Genode::addr_t sem = native_thread().exc_pt_sel + Nova::SM_SEL_EC; - Nova::sm_ctrl(sem, Nova::SEMAPHORE_DOWNZERO, tsc_abs); - } - - void wake_up() - { - Genode::addr_t sem = native_thread().exc_pt_sel + Nova::SM_SEL_EC; - Nova::sm_ctrl(sem, Nova::SEMAPHORE_UP); - } - - int run_hw(PVMR0 pVMR0) - { - VM * pVM = reinterpret_cast(pVMR0); - PVMCPU pVCpu = &pVM->aCpus[_cpu_id]; - PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); - - Nova::Utcb *utcb = reinterpret_cast(Thread::utcb()); - - Assert(Thread::utcb() == Thread::myself()->utcb()); - - /* take the utcb state prepared during the last exit */ - utcb->mtd = next_utcb.mtd; - utcb->inj_info = IRQ_INJ_NONE; - utcb->intr_state = next_utcb.intr_state; - utcb->actv_state = ACTIVITY_STATE_ACTIVE; - utcb->ctrl[0] = next_utcb.ctrl[0]; - utcb->ctrl[1] = next_utcb.ctrl[1]; - - using namespace Nova; - - /* Transfer vCPU state from vBox to Nova format */ - if (!vbox_to_utcb(utcb, pVM, pVCpu) || - !hw_load_state(utcb, pVM, pVCpu)) { - - Genode::error("loading vCPU state failed"); - return VERR_INTERNAL_ERROR; - } - - /* check whether to request interrupt window for injection */ - _irq_win = check_to_request_irq_window(utcb, pVCpu); - - /* - * Flag vCPU to be "pokeable" by external events such as interrupts - * from virtual devices. Only if this flag is set, the - * 'vmR3HaltGlobal1NotifyCpuFF' function calls 'SUPR3CallVMMR0Ex' - * with VMMR0_DO_GVMM_SCHED_POKE as argument to indicate such - * events. This function, in turn, will recall the vCPU. - */ - VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC); - - /* save current FPU state */ - fpu_save(reinterpret_cast(&_emt_fpu_state)); - /* write FPU state from pCtx to FPU registers */ - fpu_load(reinterpret_cast(&pCtx->fpu)); - /* tell kernel to transfer current fpu registers to vCPU */ - utcb->mtd |= Mtd::FPU; - - _current_vm = pVM; - _current_vcpu = pVCpu; - - /* switch to hardware accelerated mode */ - switch_to_hw(); - - Assert(utcb->actv_state == ACTIVITY_STATE_ACTIVE); - - _current_vm = 0; - _current_vcpu = 0; - - /* write FPU state of vCPU (in current FPU registers) to pCtx */ - Genode::memcpy(&pCtx->fpu, &_guest_fpu_state, sizeof(X86FXSTATE)); - - /* load saved FPU state of EMT thread */ - fpu_load(reinterpret_cast(&_emt_fpu_state)); - - CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_GLOBAL_TLB_FLUSH); - - VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED); - - /* Transfer vCPU state from Nova to vBox format */ - if (!utcb_to_vbox(utcb, pVM, pVCpu) || - !hw_save_state(utcb, pVM, pVCpu)) { - - Genode::error("saving vCPU state failed"); - return VERR_INTERNAL_ERROR; - } - -#ifdef VBOX_WITH_REM - /* XXX see VMM/VMMR0/HMVMXR0.cpp - not necessary every time ! XXX */ - REMFlushTBs(pVM); -#endif - - return vm_exit_requires_instruction_emulation() ? VINF_EM_RAW_EMULATE_INSTR - : VINF_SUCCESS; - } -}; - -#endif /* _VIRTUALBOX__SPEC__NOVA__VCPU_H_ */ diff --git a/repos/ports/src/virtualbox/spec/nova/vcpu_svm.h b/repos/ports/src/virtualbox/spec/nova/vcpu_svm.h deleted file mode 100644 index 03c4929ca..000000000 --- a/repos/ports/src/virtualbox/spec/nova/vcpu_svm.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * \brief Genode/Nova specific VirtualBox SUPLib supplements - * \author Alexander Boettcher - * \date 2013-11-18 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__NOVA__VCPU_SVM_H_ -#define _VIRTUALBOX__SPEC__NOVA__VCPU_SVM_H_ - -/* Genode's VirtualBox includes */ -#include "vcpu.h" -#include "svm.h" - -class Vcpu_handler_svm : public Vcpu_handler -{ - private: - - __attribute__((noreturn)) void _svm_default() { _default_handler(); } - - __attribute__((noreturn)) void _svm_invalid() - { - Vmm::error("invalid guest state - dead ?"); - _default_handler(); - } - - __attribute__((noreturn)) void _svm_vintr() { _irq_window(); } - - template - __attribute__((noreturn)) void _svm_npt() - { - using namespace Nova; - using namespace Genode; - - Thread *myself = Thread::myself(); - Utcb *utcb = reinterpret_cast(myself->utcb()); - - _exc_memory(myself, utcb, utcb->qual[0] & 1, - utcb->qual[1] & ~((1UL << 12) - 1)); - } - - __attribute__((noreturn)) void _svm_startup() - { - using namespace Nova; - - /* enable VM exits for CPUID */ - next_utcb.mtd = Nova::Mtd::CTRL; - next_utcb.ctrl[0] = SVM_CTRL1_INTERCEPT_INTR - | SVM_CTRL1_INTERCEPT_NMI - | SVM_CTRL1_INTERCEPT_INIT - | SVM_CTRL1_INTERCEPT_RDPMC - | SVM_CTRL1_INTERCEPT_CPUID - | SVM_CTRL1_INTERCEPT_RSM - | SVM_CTRL1_INTERCEPT_HLT - | SVM_CTRL1_INTERCEPT_INOUT_BITMAP - | SVM_CTRL1_INTERCEPT_MSR_SHADOW - | SVM_CTRL1_INTERCEPT_INVLPGA - | SVM_CTRL1_INTERCEPT_SHUTDOWN - | SVM_CTRL1_INTERCEPT_FERR_FREEZE; - - next_utcb.ctrl[1] = SVM_CTRL2_INTERCEPT_VMRUN - | SVM_CTRL2_INTERCEPT_VMMCALL - | SVM_CTRL2_INTERCEPT_VMLOAD - | SVM_CTRL2_INTERCEPT_VMSAVE - | SVM_CTRL2_INTERCEPT_STGI - | SVM_CTRL2_INTERCEPT_CLGI - | SVM_CTRL2_INTERCEPT_SKINIT - | SVM_CTRL2_INTERCEPT_WBINVD - | SVM_CTRL2_INTERCEPT_MONITOR - | SVM_CTRL2_INTERCEPT_MWAIT; - - void *exit_status = _start_routine(_start_routine_arg); - pthread_exit(exit_status); - - Nova::reply(nullptr); - } - - __attribute__((noreturn)) void _svm_recall() - { - Vcpu_handler::_recall_handler(); - } - - __attribute__((noreturn)) void _svm_triple() - { - Vmm::error("triple fault - dead"); - exit(-1); - } - - public: - - Vcpu_handler_svm(Genode::Env &env, size_t stack_size, - void *(*start_routine) (void *), void *arg, - Genode::Cpu_session * cpu_session, - Genode::Affinity::Location location, - unsigned int cpu_id, const char * name, - Genode::Pd_session_capability pd_vcpu) - : - Vcpu_handler(env, stack_size, start_routine, arg, cpu_session, - location, cpu_id, name, pd_vcpu) - { - using namespace Nova; - - Genode::addr_t const exc_base = vcpu().exc_base(); - - typedef Vcpu_handler_svm This; - - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - register_handler> (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - - register_handler (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); - - start(); - } - - bool hw_save_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu) { - return svm_save_state(utcb, pVM, pVCpu); - } - - bool hw_load_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu) { - return svm_load_state(utcb, pVM, pVCpu); - } - - bool vm_exit_requires_instruction_emulation() - { - if (exit_reason == RECALL) - return false; - - return true; - } -}; - -#endif /* _VIRTUALBOX__SPEC__NOVA__VCPU_SVM_H_ */ diff --git a/repos/ports/src/virtualbox/spec/nova/vcpu_vmx.h b/repos/ports/src/virtualbox/spec/nova/vcpu_vmx.h deleted file mode 100644 index fb0f0da8f..000000000 --- a/repos/ports/src/virtualbox/spec/nova/vcpu_vmx.h +++ /dev/null @@ -1,246 +0,0 @@ -/* - * \brief Genode/Nova specific VirtualBox SUPLib supplements - * \author Alexander Boettcher - * \author Norman Feske - * \author Christian Helmuth - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__NOVA__VCPU_VMX_H_ -#define _VIRTUALBOX__SPEC__NOVA__VCPU_VMX_H_ - -/* libc includes */ -#include - -/* VirtualBox includes */ -#include - -#include "vmm_memory.h" - -/* Genode's VirtualBox includes */ -#include "vcpu.h" -#include "vmx.h" - - -class Vcpu_handler_vmx : public Vcpu_handler -{ - private: - - template - __attribute__((noreturn)) void _vmx_ept() - { - using namespace Nova; - using namespace Genode; - - Thread *myself = Thread::myself(); - Utcb *utcb = reinterpret_cast(myself->utcb()); - - _exc_memory(myself, utcb, utcb->qual[0] & 0x38, - utcb->qual[1] & ~((1UL << 12) - 1)); - } - - __attribute__((noreturn)) void _vmx_default() { _default_handler(); } - - __attribute__((noreturn)) void _vmx_startup() - { - using namespace Nova; - - Genode::Thread *myself = Genode::Thread::myself(); - Utcb *utcb = reinterpret_cast(myself->utcb()); - - /* configure VM exits to get */ - next_utcb.mtd = Nova::Mtd::CTRL; - /* from src/VBox/VMM/VMMR0/HWVMXR0.cpp of virtualbox sources */ - next_utcb.ctrl[0] = VMX_VMCS_CTRL_PROC_EXEC_HLT_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_MOV_DR_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_UNCOND_IO_EXIT | -/* XXX commented out because TinyCore Linux won't run as guest otherwise - VMX_VMCS_CTRL_PROC_EXEC_MONITOR_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_MWAIT_EXIT | -*/ -/* VMX_VMCS_CTRL_PROC_EXEC_CR8_LOAD_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_CR8_STORE_EXIT |*/ - VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW | - VMX_VMCS_CTRL_PROC_EXEC_RDPMC_EXIT; -/* VMX_VMCS_CTRL_PROC_EXEC_PAUSE_EXIT | */ - /* - * Disable trapping RDTSC for now as it creates a huge load with - * VM guests that execute it frequently. - */ - // VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT; - - next_utcb.ctrl[1] = VMX_VMCS_CTRL_PROC_EXEC2_VIRT_APIC | - VMX_VMCS_CTRL_PROC_EXEC2_WBINVD_EXIT | - VMX_VMCS_CTRL_PROC_EXEC2_UNRESTRICTED_GUEST | - VMX_VMCS_CTRL_PROC_EXEC2_VPID | -/* VMX_VMCS_CTRL_PROC_EXEC2_X2APIC | */ - VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP | - VMX_VMCS_CTRL_PROC_EXEC2_EPT; - - void *exit_status = _start_routine(_start_routine_arg); - pthread_exit(exit_status); - - Nova::reply(nullptr); - } - - __attribute__((noreturn)) void _vmx_triple() - { - Vmm::error("triple fault - dead"); - exit(-1); - } - - __attribute__((noreturn)) void _vmx_irqwin() { _irq_window(); } - - __attribute__((noreturn)) void _vmx_recall() - { - Vcpu_handler::_recall_handler(); - } - - __attribute__((noreturn)) void _vmx_invalid() - { - Genode::Thread *myself = Genode::Thread::myself(); - Nova::Utcb *utcb = reinterpret_cast(myself->utcb()); - - unsigned const dubious = utcb->inj_info | - utcb->intr_state | utcb->actv_state; - if (dubious) - Vmm::warning(__func__, " - dubious -" - " inj_info=", Genode::Hex(utcb->inj_info), - " inj_error=", Genode::Hex(utcb->inj_error), - " intr_state=", Genode::Hex(utcb->intr_state), - " actv_state=", Genode::Hex(utcb->actv_state)); - - Vmm::error("invalid guest state - dead"); - exit(-1); - } - - /* - * This VM exit is in part handled by the NOVA kernel (writing the CR - * register) and in part by VirtualBox (updating the PDPTE registers, - * which requires access to the guest physical memory). - * Intel manual sections 4.4.1 of Vol. 3A and 26.3.2.4 of Vol. 3C - * indicate the conditions when the PDPTE registers need to get - * updated. - */ - __attribute__((noreturn)) void _vmx_mov_crx() - { - unsigned long value; - void *stack_reply = reinterpret_cast(&value - 1); - - Genode::Thread *myself = Genode::Thread::myself(); - Nova::Utcb *utcb = reinterpret_cast(myself->utcb()); - - unsigned int cr = utcb->qual[0] & 0xf; - - if (cr == 8) - _default_handler(); - - Genode::uint64_t *pdpte = (Genode::uint64_t*) - guest_memory()->lookup(utcb->cr3, sizeof(utcb->pdpte)); - - Assert(pdpte != 0); - - utcb->pdpte[0] = pdpte[0]; - utcb->pdpte[1] = pdpte[1]; - utcb->pdpte[2] = pdpte[2]; - utcb->pdpte[3] = pdpte[3]; - - utcb->mtd = Nova::Mtd::PDPTE | Nova::Mtd::FPU; - - Nova::reply(stack_reply); - } - - public: - - Vcpu_handler_vmx(Genode::Env &env, size_t stack_size, - void *(*start_routine) (void *), void *arg, - Genode::Cpu_session * cpu_session, - Genode::Affinity::Location location, - unsigned int cpu_id, const char * name, - Genode::Pd_session_capability pd_vcpu) - : - Vcpu_handler(env, stack_size, start_routine, arg, cpu_session, - location, cpu_id, name, pd_vcpu) - { - using namespace Nova; - - typedef Vcpu_handler_vmx This; - - Genode::addr_t const exc_base = vcpu().exc_base(); - - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - - /* we don't support tsc offsetting for now - so let the rdtsc exit */ - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); -// register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler> (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); - - start(); - } - - bool hw_save_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu) { - return vmx_save_state(utcb, pVM, pVCpu); - } - - bool hw_load_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu) { - return vmx_load_state(utcb, pVM, pVCpu); - } - - bool vm_exit_requires_instruction_emulation() - { - if (exit_reason == VMX_EXIT_TPR_BELOW_THRESHOLD) { - /* the instruction causing the exit has already been executed */ - return false; - } - - if (exit_reason == RECALL) - return false; - - return true; - } -}; - -#endif /* _VIRTUALBOX__SPEC__NOVA__VCPU_VMX_H_ */ diff --git a/repos/ports/src/virtualbox/spec/nova/vmx.h b/repos/ports/src/virtualbox/spec/nova/vmx.h deleted file mode 100644 index cdfe86c62..000000000 --- a/repos/ports/src/virtualbox/spec/nova/vmx.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * \brief Genode/Nova specific VirtualBox SUPLib supplements - * \author Norman Feske - * \author Alexander Boettcher - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__SPEC__NOVA__VMX_H_ -#define _VIRTUALBOX__SPEC__NOVA__VMX_H_ - -#define GENODE_READ_SELREG_REQUIRED(REG) \ - (pCtx->REG.Sel != utcb->REG.sel) || \ - (pCtx->REG.ValidSel != utcb->REG.sel) || \ - (pCtx->REG.fFlags != CPUMSELREG_FLAGS_VALID) || \ - (pCtx->REG.u32Limit != utcb->REG.limit) || \ - (pCtx->REG.u64Base != utcb->REG.base) || \ - (pCtx->REG.Attr.u != sel_ar_conv_from_nova(utcb->REG.ar)) - -#define GENODE_READ_SELREG(REG) \ - pCtx->REG.Sel = utcb->REG.sel; \ - pCtx->REG.ValidSel = utcb->REG.sel; \ - pCtx->REG.fFlags = CPUMSELREG_FLAGS_VALID; \ - pCtx->REG.u32Limit = utcb->REG.limit; \ - pCtx->REG.u64Base = utcb->REG.base; \ - pCtx->REG.Attr.u = sel_ar_conv_from_nova(utcb->REG.ar) - -static inline bool vmx_save_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu) -{ - PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); - - GENODE_READ_SELREG(cs); - GENODE_READ_SELREG(ds); - GENODE_READ_SELREG(es); - GENODE_READ_SELREG(fs); - GENODE_READ_SELREG(gs); - GENODE_READ_SELREG(ss); - - if (GENODE_READ_SELREG_REQUIRED(ldtr)) { - GENODE_READ_SELREG(ldtr); - CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_LDTR); - } - if (GENODE_READ_SELREG_REQUIRED(tr)) { - GENODE_READ_SELREG(tr); - CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_TR); - } - - return true; -} - -#undef GENODE_READ_SELREG_REQUIRED -#undef GENODE_READ_SELREG - - -enum { VMCS_SEG_UNUSABLE = 0x10000 }; - -#define GENODE_WRITE_SELREG(REG) \ - Assert(pCtx->REG.fFlags & CPUMSELREG_FLAGS_VALID); \ - Assert(pCtx->REG.ValidSel == pCtx->REG.Sel); \ - utcb->REG.sel = pCtx->REG.Sel; \ - utcb->REG.limit = pCtx->REG.u32Limit; \ - utcb->REG.base = pCtx->REG.u64Base; \ - utcb->REG.ar = sel_ar_conv_to_nova(pCtx->REG.Attr.u ? : VMCS_SEG_UNUSABLE); - -static inline bool vmx_load_state(Nova::Utcb * utcb, VM * pVM, PVMCPU pVCpu) -{ - PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); - - { - utcb->mtd |= Nova::Mtd::ESDS; - GENODE_WRITE_SELREG(es); - GENODE_WRITE_SELREG(ds); - } - - { - utcb->mtd |= Nova::Mtd::FSGS; - GENODE_WRITE_SELREG(fs); - GENODE_WRITE_SELREG(gs); - } - - { - utcb->mtd |= Nova::Mtd::CSSS; - GENODE_WRITE_SELREG(cs); - GENODE_WRITE_SELREG(ss); - } - - /* ldtr */ - if (pCtx->ldtr.Sel == 0) { - { - utcb->mtd |= Nova::Mtd::LDTR; - - utcb->ldtr.sel = 0; - utcb->ldtr.limit = 0; - utcb->ldtr.base = 0; - utcb->ldtr.ar = sel_ar_conv_to_nova(0x82); - } - } else { - { - utcb->mtd |= Nova::Mtd::LDTR; - - utcb->ldtr.sel = pCtx->ldtr.Sel; - utcb->ldtr.limit = pCtx->ldtr.u32Limit; - utcb->ldtr.base = pCtx->ldtr.u64Base; - utcb->ldtr.ar = sel_ar_conv_to_nova(pCtx->ldtr.Attr.u); - } - } - - /* tr */ - { - utcb->mtd |= Nova::Mtd::TR; - - utcb->tr.sel = pCtx->tr.Sel; - utcb->tr.limit = pCtx->tr.u32Limit; - utcb->tr.base = pCtx->tr.u64Base; - utcb->tr.ar = sel_ar_conv_to_nova(pCtx->tr.Attr.u); - } - - return true; -} - -#undef GENODE_WRITE_SELREG - -#endif /* _VIRTUALBOX__SPEC__NOVA__VMX_H_ */ diff --git a/repos/ports/src/virtualbox/sup.cc b/repos/ports/src/virtualbox/sup.cc deleted file mode 100644 index 8469beebc..000000000 --- a/repos/ports/src/virtualbox/sup.cc +++ /dev/null @@ -1,397 +0,0 @@ -/* - * \brief VirtualBox SUPLib supplements - * \author Norman Feske - * \date 2013-08-20 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include - -/* Genode/Virtualbox includes */ -#include "sup.h" -#include "vmm.h" - -/* VirtualBox includes */ -#include -#include -#include -#include -#include - -static PFNRTTIMER rttimer_func = nullptr; -static void * rttimer_obj = nullptr; - -enum { - UPDATE_HZ = 1000, - UPDATE_US = 1000 * 1000 / UPDATE_HZ, - UPDATE_NS = UPDATE_US * 1000, -}; - - -PSUPGLOBALINFOPAGE g_pSUPGlobalInfoPage; - - -struct Periodic_gip : public Genode::Thread -{ - Periodic_gip(Genode::Env &env) : Thread(env, "periodic_gip", 8192) { start(); } - - static void update() - { - /** - * We're using rdtsc here since timer_session->elapsed_ms produces - * instable results when the timer service is using the Genode PIC - * driver as done for base-nova currently. - */ - - Genode::uint64_t tsc_current = Genode::Trace::timestamp(); - - /* - * Convert tsc to nanoseconds. - * - * There is no 'uint128_t' type on x86_32, so we use the 128-bit type - * and functions provided by VirtualBox. - * - * nanots128 = tsc_current * 1000*1000*1000 / genode_cpu_hz() - * - */ - - RTUINT128U nanots128; - RTUInt128AssignU64(&nanots128, tsc_current); - - RTUINT128U multiplier; - RTUInt128AssignU32(&multiplier, 1000*1000*1000); - RTUInt128AssignMul(&nanots128, &multiplier); - - RTUINT128U divisor; - RTUInt128AssignU64(&divisor, genode_cpu_hz()); - RTUInt128AssignDiv(&nanots128, &divisor); - - SUPGIPCPU *cpu = &g_pSUPGlobalInfoPage->aCPUs[0]; - - /* - * Transaction id must be incremented before and after update, - * read struct SUPGIPCPU description for more details. - */ - ASMAtomicIncU32(&cpu->u32TransactionId); - - cpu->u64TSC = tsc_current; - cpu->u64NanoTS = nanots128.s.Lo; - - /* - * Transaction id must be incremented before and after update, - * read struct SUPGIPCPU description for more details. - */ - ASMAtomicIncU32(&cpu->u32TransactionId); - - /* call the timer function of the RTTimerCreate call */ - if (rttimer_func) - rttimer_func(nullptr, rttimer_obj, 0); - } - - void entry() override { genode_update_tsc(update, UPDATE_US); } -}; - - -struct Attached_gip : Genode::Attached_ram_dataspace -{ - Attached_gip() - : Attached_ram_dataspace(genode_env().ram(), genode_env().rm(), PAGE_SIZE) - { } -}; - - -int RTTimerCreate(PRTTIMER *pptimer, unsigned ms, PFNRTTIMER func, void *obj) -{ - if (pptimer) - *pptimer = NULL; - - /* used solely at one place in TM.cpp */ - Assert(!rttimer_func); - - /* - * Ignore (10) ms which is too high for audio. Instead the callback - * handler will run at UPDATE_HZ rate. - */ - rttimer_func = func; - rttimer_obj = obj; - - return VINF_SUCCESS; -} - - -int RTTimerDestroy(PRTTIMER) -{ - rttimer_obj = nullptr; - rttimer_func = nullptr; - return VINF_SUCCESS; -} - - -int SUPR3Init(PSUPDRVSESSION *ppSession) -{ - static bool initialized = false; - - if (initialized) return VINF_SUCCESS; - - static Attached_gip gip; - - g_pSUPGlobalInfoPage = gip.local_addr(); - - /* checked by TMR3Init */ - g_pSUPGlobalInfoPage->u32Version = SUPGLOBALINFOPAGE_VERSION; - g_pSUPGlobalInfoPage->u32Magic = SUPGLOBALINFOPAGE_MAGIC; - g_pSUPGlobalInfoPage->u32Mode = SUPGIPMODE_SYNC_TSC; - g_pSUPGlobalInfoPage->cCpus = 1; - g_pSUPGlobalInfoPage->cPages = 1; - g_pSUPGlobalInfoPage->u32UpdateHz = UPDATE_HZ; - g_pSUPGlobalInfoPage->u32UpdateIntervalNS = UPDATE_NS; -// g_pSUPGlobalInfoPage->u64NanoTSLastUpdateHz = -// g_pSUPGlobalInfoPage->OnlineCpuSet = -// g_pSUPGlobalInfoPage->PresentCpuSet = -// g_pSUPGlobalInfoPage->PossibleCpuSet = - g_pSUPGlobalInfoPage->cOnlineCpus = 0; - g_pSUPGlobalInfoPage->cPresentCpus = 0; - g_pSUPGlobalInfoPage->cPossibleCpus = 0; - g_pSUPGlobalInfoPage->idCpuMax = 0; - - SUPGIPCPU *cpu = &g_pSUPGlobalInfoPage->aCPUs[0]; - - cpu->u32TransactionId = 0; - cpu->u32UpdateIntervalTSC = genode_cpu_hz() / UPDATE_HZ; - cpu->u64NanoTS = 0ULL; - cpu->u64TSC = 0ULL; - cpu->u64CpuHz = genode_cpu_hz(); - cpu->cErrors = 0; - cpu->iTSCHistoryHead = 0; -// cpu->au32TSCHistory[8] = - cpu->u32PrevUpdateIntervalNS = UPDATE_NS; - cpu->enmState = SUPGIPCPUSTATE_ONLINE; - cpu->idCpu = 0; - cpu->iCpuSet = 0; - cpu->idApic = 0; - - /* schedule periodic call of GIP update function */ - static Periodic_gip periodic_gip (genode_env()); - - initialized = true; - - return VINF_SUCCESS; -} - - -int SUPR3Term(bool) { return VINF_SUCCESS; } - - -int SUPR3GipGetPhys(PRTHCPHYS pHCPhys) -{ - /* - * Return VMM-local address as physical address. This address is - * then fed to MMR3HyperMapHCPhys. (TMR3Init) - */ - *pHCPhys = (RTHCPHYS)g_pSUPGlobalInfoPage; - - return VINF_SUCCESS; -} - - -int SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, - uint32_t fFlags, PRTERRINFO pErrInfo) -{ - return RTLdrLoad(pszFilename, phLdrMod); -} - - -uint32_t SUPSemEventMultiGetResolution(PSUPDRVSESSION) -{ - return 100000*10; /* called by 'vmR3HaltGlobal1Init' */ -} - - -int SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent) -{ - return RTSemEventCreate((PRTSEMEVENT)phEvent); -} - - -int SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) -{ - Assert (hEvent); - - return RTSemEventDestroy((RTSEMEVENT)hEvent); -} - - -int SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) -{ - Assert (hEvent); - - return RTSemEventSignal((RTSEMEVENT)hEvent); -} - - -int SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, - uint32_t cMillies) -{ - Assert (hEvent); - - return RTSemEventWaitNoResume((RTSEMEVENT)hEvent, cMillies); -} - - -int SUPSemEventMultiCreate(PSUPDRVSESSION, PSUPSEMEVENTMULTI phEventMulti) -{ - RTSEMEVENTMULTI sem; - - /* - * Input validation. - */ - AssertPtrReturn(phEventMulti, VERR_INVALID_POINTER); - - /* - * Create the event semaphore object. - */ - int rc = RTSemEventMultiCreate(&sem); - - static_assert(sizeof(sem) == sizeof(*phEventMulti), "oi"); - *phEventMulti = reinterpret_cast(sem); - return rc; -} - - -int SUPSemEventMultiWaitNoResume(PSUPDRVSESSION, SUPSEMEVENTMULTI event, - uint32_t ms) -{ - RTSEMEVENTMULTI const rtevent = reinterpret_cast(event); - return RTSemEventMultiWait(rtevent, ms); -} - -int SUPSemEventMultiSignal(PSUPDRVSESSION, SUPSEMEVENTMULTI event) { - return RTSemEventMultiSignal(reinterpret_cast(event)); } - -int SUPSemEventMultiReset(PSUPDRVSESSION, SUPSEMEVENTMULTI event) { - return RTSemEventMultiReset(reinterpret_cast(event)); } - -int SUPSemEventMultiClose(PSUPDRVSESSION, SUPSEMEVENTMULTI event) { - return RTSemEventMultiDestroy(reinterpret_cast(event)); } - - -int SUPR3CallVMMR0(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation, - void *pvArg) -{ - if (uOperation == VMMR0_DO_CALL_HYPERVISOR) { - Genode::log(__func__, ": VMMR0_DO_CALL_HYPERVISOR - doing nothing"); - return VINF_SUCCESS; - } - if (uOperation == VMMR0_DO_VMMR0_TERM) { - Genode::log(__func__, ": VMMR0_DO_VMMR0_TERM - doing nothing"); - return VINF_SUCCESS; - } - if (uOperation == VMMR0_DO_GVMM_DESTROY_VM) { - Genode::log(__func__, ": VMMR0_DO_GVMM_DESTROY_VM - doing nothing"); - return VINF_SUCCESS; - } - - AssertMsg(uOperation != VMMR0_DO_VMMR0_TERM && - uOperation != VMMR0_DO_CALL_HYPERVISOR && - uOperation != VMMR0_DO_GVMM_DESTROY_VM, - ("SUPR3CallVMMR0: unhandled uOperation %d", uOperation)); - return VERR_GENERAL_FAILURE; -} - - -void genode_VMMR0_DO_GVMM_CREATE_VM(PSUPVMMR0REQHDR pReqHdr) -{ - GVMMCREATEVMREQ &req = reinterpret_cast(*pReqHdr); - - size_t const cCpus = req.cCpus; - - /* - * Allocate and initialize VM struct - * - * The VM struct is followed by the variable-sizedA array of VMCPU - * objects. 'RT_UOFFSETOF' is used to determine the size including - * the VMCPU array. - * - * VM struct must be page-aligned, which is checked at least in - * PDMR3CritSectGetNop(). - */ - size_t const cbVM = RT_UOFFSETOF(VM, aCpus[cCpus]); - - static Genode::Attached_ram_dataspace vm(genode_env().ram(), - genode_env().rm(), - cbVM); - Assert (vm.size() >= cbVM); - - VM *pVM = vm.local_addr(); - Genode::memset(pVM, 0, cbVM); - - /* - * On Genode, VMMR0 and VMMR3 share a single address space. Hence, the - * same pVM pointer is valid as pVMR0 and pVMR3. - */ - pVM->enmVMState = VMSTATE_CREATING; - pVM->pVMR0 = (RTHCUINTPTR)pVM; - pVM->pVMRC = (RTGCUINTPTR)pVM; - pVM->pSession = req.pSession; - pVM->cbSelf = cbVM; - pVM->cCpus = cCpus; - pVM->uCpuExecutionCap = 100; /* expected by 'vmR3CreateU()' */ - pVM->offVMCPU = RT_UOFFSETOF(VM, aCpus); - - for (uint32_t i = 0; i < cCpus; i++) { - pVM->aCpus[i].pVMR0 = pVM->pVMR0; - pVM->aCpus[i].pVMR3 = pVM; - pVM->aCpus[i].idHostCpu = NIL_RTCPUID; - pVM->aCpus[i].hNativeThreadR0 = NIL_RTNATIVETHREAD; - } - - pVM->aCpus[0].hNativeThreadR0 = RTThreadNativeSelf(); - - /* out parameters of the request */ - req.pVMR0 = pVM->pVMR0; - req.pVMR3 = pVM; -} - - -void genode_VMMR0_DO_GVMM_REGISTER_VMCPU(PVMR0 pVMR0, VMCPUID idCpu) -{ - PVM pVM = reinterpret_cast(pVMR0); - pVM->aCpus[idCpu].hNativeThreadR0 = RTThreadNativeSelf(); -} - - -HRESULT genode_check_memory_config(ComObjPtr machine) -{ - HRESULT rc; - - /* Validate configured memory of vbox file and Genode config */ - ULONG memory_vbox; - rc = machine->COMGETTER(MemorySize)(&memory_vbox); - if (FAILED(rc)) - return rc; - - /* Request max available memory */ - size_t memory_genode = genode_env().ram().avail_ram().value >> 20; - size_t memory_vmm = 28; - - if (memory_vbox + memory_vmm > memory_genode) { - using Genode::error; - error("Configured memory ", memory_vbox, " MB (vbox file) is insufficient."); - error(memory_genode, " MB (1) - ", - memory_vmm, " MB (2) = ", - memory_genode - memory_vmm, " MB (3)"); - error("(1) available memory based defined by Genode config"); - error("(2) minimum memory required for VBox VMM"); - error("(3) maximal available memory to VM"); - return E_FAIL; - } - return S_OK; -} diff --git a/repos/ports/src/virtualbox/target.inc b/repos/ports/src/virtualbox/target.inc deleted file mode 100644 index 50448b7cf..000000000 --- a/repos/ports/src/virtualbox/target.inc +++ /dev/null @@ -1,61 +0,0 @@ -VBOX_CC_OPT += -DVBOX_WITH_HARDENING -VBOX_CC_OPT += -DVBOX_WITH_GENERIC_SESSION_WATCHER - -include $(REP_DIR)/lib/mk/virtualbox-common.inc - -# -# Prevent inclusion of the Genode::Log definition after the vbox #define -# of 'Log'. Otherwise, the attemt to compile base/log.h will fail. -# -VBOX_CC_OPT += -include base/log.h - -CC_WARN += -Wall - -SRC_CC = frontend/main.cc frontend/console.cc \ - frontend/VBoxAPIWrap/MediumFormatWrap.cpp \ - frontend/VBoxAPIWrap/TokenWrap.cpp \ - frontend/VirtualBoxErrorInfoImpl.cpp \ - devices.cc drivers.cc dummies.cc libc.cc \ - logger.cc mm.cc pdm.cc rt.cc sup.cc iommio.cc ioport.cc \ - hm.cc thread.cc dynlib.cc unimpl.cc - -LIBS += base -LIBS += stdcxx - -LIBS += virtualbox-bios virtualbox-recompiler virtualbox-runtime \ - virtualbox-vmm virtualbox-devices virtualbox-drivers \ - virtualbox-storage virtualbox-zlib virtualbox-liblzf \ - virtualbox-xml virtualbox-main - -LIBS += libc_terminal libc_pipe libiconv - -LIBS += qemu-usb - -INC_DIR += $(call select_from_repositories,src/lib/libc) - -INC_DIR += $(VBOX_DIR)/Runtime/include - -SRC_CC += HostServices/SharedFolders/service.cpp -SRC_CC += HostServices/SharedFolders/mappings.cpp -SRC_CC += HostServices/SharedFolders/vbsf.cpp -SRC_CC += HostServices/SharedFolders/shflhandle.cpp - -SRC_CC += HostServices/SharedClipboard/service.cpp - -SRC_CC += HostServices/GuestProperties/service.cpp - -SRC_CC += frontend/dummy/errorinfo.cc frontend/dummy/virtualboxbase.cc -SRC_CC += frontend/dummy/autostart.cc frontend/dummy/rest.cc -SRC_CC += frontend/dummy/host.cc - -INC_DIR += $(VBOX_DIR)/Main/include -INC_DIR += $(VBOX_DIR)/VMM/include - -INC_DIR += $(REP_DIR)/src/virtualbox/frontend -INC_DIR += $(REP_DIR)/src/virtualbox/frontend/VBoxAPIWrap - -INC_DIR += $(VBOX_DIR)/Main/xml -INC_DIR += $(VBOX_DIR)/HostServices - -# search path to 'scan_code_set_2.h' -INC_DIR += $(call select_from_repositories,src/drivers/input/spec/ps2) diff --git a/repos/ports/src/virtualbox/target.mk b/repos/ports/src/virtualbox/target.mk deleted file mode 100644 index e092858f9..000000000 --- a/repos/ports/src/virtualbox/target.mk +++ /dev/null @@ -1,7 +0,0 @@ -TARGET = virtualbox-rem - -LIBS += virtualbox-hwaccl-off - -include $(REP_DIR)/src/virtualbox/target.inc - -CC_CXX_WARN_STRICT = diff --git a/repos/ports/src/virtualbox/unimpl.cc b/repos/ports/src/virtualbox/unimpl.cc deleted file mode 100644 index 071b0fef1..000000000 --- a/repos/ports/src/virtualbox/unimpl.cc +++ /dev/null @@ -1,202 +0,0 @@ -/* - * \brief Dummy implementations of symbols needed by VirtualBox - * \author Norman Feske - * \date 2013-08-22 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#include - -#include - -extern "C" { - -#define DUMMY(name) \ -void name(void) { \ - Genode::warning(__func__, ": " #name " called, not implemented, eip=", \ - __builtin_return_address(0)); \ - while (1) { Assert(!"not implemented"); } \ -} - -DUMMY(DBGFR3CoreWrite) -DUMMY(DBGCRegisterCommands) -DUMMY(DBGFR3EventAssertion) -DUMMY(DBGFR3EventBreakpoint) -DUMMY(DBGFR3EventSrc) -DUMMY(DBGFR3VMMForcedAction) -DUMMY(DBGFR3DisasInstrEx) -DUMMY(DBGFR3DisasInstrCurrentLogInternal) -DUMMY(DBGFR3StackWalkBegin) -DUMMY(DBGFR3StackWalkBeginEx) -DUMMY(DBGFR3StackWalkNext) -DUMMY(DBGFR3StackWalkEnd) - -DUMMY(HMInvalidatePage) -DUMMY(HMR3EmulateIoBlock) -DUMMY(HMR3PatchTprInstr) -DUMMY(HMR3CheckError) -DUMMY(HMR3RestartPendingIOInstr) -DUMMY(HMR3EnablePatching) -DUMMY(HMR3DisablePatching) -DUMMY(HMGetPaePdpes) -DUMMY(HMSetSingleInstruction) - -DUMMY(IEMExecOne) -DUMMY(IEMExecLots) - -DUMMY(MMHyperR0ToCC) -DUMMY(MMHyperRCToCC) - -DUMMY(MMR3HeapAPrintfV) -DUMMY(MMR3LockCall) -DUMMY(PDMR3AsyncCompletionTemplateCreateDriver) -DUMMY(PDMR3LdrGetInterfaceSymbols) -DUMMY(PDMR3LdrQueryRCModFromPC) -DUMMY(PDMCritSectBothFF) - -DUMMY(PGMPhysGCPtr2GCPhys) -DUMMY(PGMPhysSimpleReadGCPhys) -DUMMY(PGMPhysSimpleReadGCPtr) -DUMMY(PGMPhysSimpleWriteGCPtr) -DUMMY(PGMSyncCR3) - -DUMMY(PGMR3SharedModuleCheckAll) -DUMMY(PGMR3SharedModuleUnregister) -DUMMY(PGMR3SharedModuleRegister) -DUMMY(PGMR3MappingsUnfix) -DUMMY(PGMR3MappingsFix) -DUMMY(PGMR3MappingsDisable) -DUMMY(PGMR3LockCall) -DUMMY(PGMR3PoolGrow) -DUMMY(PGMR3QueryGlobalMemoryStats) -DUMMY(PGMR3QueryMemoryStats) - -DUMMY(PGMR3PhysAllocateHandyPages) -DUMMY(PGMR3PhysAllocateLargeHandyPage) -DUMMY(PGMR3PhysChangeMemBalloon) -DUMMY(PGMR3PhysChunkMap) -DUMMY(PGMR3PhysGCPhys2CCPtrExternal) -DUMMY(PGMR3PhysGCPhys2CCPtrReadOnlyExternal) -DUMMY(PGMR3PhysMMIO2MapKernel) -DUMMY(PGMR3PhysReadU16) -DUMMY(PGMR3PhysRomProtect) - -DUMMY(PGMPrefetchPage) -DUMMY(PGMGstGetPage) -DUMMY(PGMGstIsPagePresent) -DUMMY(PGMGstUpdatePaePdpes) -DUMMY(PGMShwMakePageReadonly) -DUMMY(PGMShwMakePageNotPresent) -DUMMY(PGMPhysIsGCPhysNormal) -DUMMY(PGMHandlerVirtualChangeInvalidateCallback) -DUMMY(PGMSetLargePageUsage) -DUMMY(PGMPhysSimpleDirtyWriteGCPtr) -DUMMY(PGMGetShadowMode) -DUMMY(PGMGetHostMode) - -DUMMY(PGMUpdateCR3) -DUMMY(PGMGetGuestMode) - -DUMMY(RTPoll) -DUMMY(RTPollSetAdd) -DUMMY(RTPollSetCreate) -DUMMY(RTPollSetEventsChange) -DUMMY(RTPollSetRemove) -DUMMY(RTPollSetDestroy) - -DUMMY(RTProcCreate) -DUMMY(RTProcTerminate) -DUMMY(RTProcWait) -DUMMY(RTLdrGetSuff) - -DUMMY(RTPathAppend) -DUMMY(RTPathChangeToDosSlashes) -DUMMY(RTSemEventWaitEx) - -DUMMY(RTMemDupExTag) -DUMMY(RTMemDupTag) -DUMMY(RTMemExecFree) - -DUMMY(SELMR3GetSelectorInfo) -DUMMY(SELMR3GetShadowSelectorInfo) - -DUMMY(SUPR3HardenedLdrLoadPlugIn) - -DUMMY(VMMR3GetHostToGuestSwitcher) - -DUMMY(RTHeapSimpleRelocate) -DUMMY(RTHeapSimpleAlloc) -DUMMY(RTHeapSimpleInit) -DUMMY(RTHeapSimpleFree) -DUMMY(RTAvloU32Remove) -DUMMY(RTAvloU32Get) -DUMMY(RTAvloU32GetBestFit) -DUMMY(RTAvlU32Destroy) -DUMMY(RTAvlU32GetBestFit) -DUMMY(RTAvloU32DoWithAll) -DUMMY(RTAvloU32Insert) -DUMMY(RTAvlU32Get) -DUMMY(RTAvlU32DoWithAll) -DUMMY(RTAvlU32Insert) - -DUMMY(IOMInterpretOUT) -DUMMY(IOMInterpretOUTS) -DUMMY(IOMInterpretIN) -DUMMY(IOMInterpretINS) - -DUMMY(DISInstrToStrWithReader) -DUMMY(DISInstrToStrEx) -DUMMY(DISFetchRegSegEx) - -DUMMY(RTFileQueryFsSizes) - -DUMMY(RTAvlrFileOffsetGet) -DUMMY(RTAvlrFileOffsetGetBestFit) -DUMMY(RTAvlrFileOffsetInsert) -DUMMY(RTAvlrFileOffsetRemove) -DUMMY(RTAvlrU64Destroy) -DUMMY(RTAvlrU64DoWithAll) -DUMMY(RTAvlrU64GetBestFit) -DUMMY(RTAvlrU64Insert) -DUMMY(RTAvlrU64RangeGet) -DUMMY(RTAvlrU64RangeRemove) -DUMMY(RTAvlrU64Remove) -DUMMY(RTSocketToNative) - -DUMMY(RTStrCat) -DUMMY(RTStrCatP) -DUMMY(RTStrStr) - -DUMMY(RTTcpClientCloseEx) -DUMMY(RTTcpClientConnectEx) -DUMMY(RTTcpFlush) -DUMMY(RTTcpGetLocalAddress) -DUMMY(RTTcpGetPeerAddress) -DUMMY(RTTcpRead) -DUMMY(RTTcpReadNB) -DUMMY(RTTcpSelectOne) -DUMMY(RTTcpSelectOneEx) -DUMMY(RTTcpSetSendCoalescing) -DUMMY(RTTcpSgWrite) -DUMMY(RTTcpSgWriteNB) -DUMMY(RTTcpWrite) -DUMMY(RTTcpWriteNB) -DUMMY(RTTimeLocalExplode) - -DUMMY(RTNetIPv6PseudoChecksumEx) - -DUMMY(pthread_mutex_timedlock) -DUMMY(pthread_kill) - -DUMMY(RTZipXarFsStreamFromIoStream) - -DUMMY(FTMR3CancelStandby) -DUMMY(FTMR3PowerOn) - -} /* extern "C" */ diff --git a/repos/ports/src/virtualbox/vmm.h b/repos/ports/src/virtualbox/vmm.h deleted file mode 100644 index c72e76400..000000000 --- a/repos/ports/src/virtualbox/vmm.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _VMM_H_ -#define _VMM_H_ - -#include -#include - -Genode::Env & genode_env(); -Genode::Allocator & vmm_heap(); - -#endif /* _VMM_H_ */ diff --git a/repos/ports/src/virtualbox/vmm_memory.h b/repos/ports/src/virtualbox/vmm_memory.h deleted file mode 100644 index 32c5ddc5b..000000000 --- a/repos/ports/src/virtualbox/vmm_memory.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * \brief Registry of VMM-local memory regions - * \author Norman Feske - * \date 2013-09-02 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VMM_MEMORY_H_ -#define _VMM_MEMORY_H_ - -/* Genode includes */ -#include -#include -#include - -/* Genode/Virtualbox includes */ -#include "mem_region.h" -#include "vmm.h" - -/* VirtualBox includes */ -#include - - -class Vmm_memory -{ - typedef Genode::size_t size_t; - typedef Genode::Lock Lock; - typedef Genode::List Mem_region_list; - - private: - - Lock _lock; - Mem_region_list _regions; - Genode::Env &_env; - - /** - * Backing store - */ - - Mem_region *_lookup_unsynchronized(PPDMDEVINS pDevIns, unsigned iRegion) - { - for (Mem_region *r = _regions.first(); r; r = r->next()) - if (r->pDevIns == pDevIns && r->iRegion == iRegion) - return r; - return 0; - } - - Mem_region *_lookup_unsynchronized(RTGCPHYS vm_phys, size_t size) - { - for (Mem_region *r = _regions.first(); r; r = r->next()) - if (r->vm_phys && r->vm_phys <= vm_phys - && vm_phys - r->vm_phys < r->size() - && r->size() - (vm_phys - r->vm_phys) >= size) - return r; - - return 0; - } - - public: - - Vmm_memory(Genode::Env &env) : _env(env) { } - - /** - * \throw Out_of_ram - * \throw Out_of_caps - * \throw Region_map::Region_conflict - */ - void *alloc(size_t cb, PPDMDEVINS pDevIns, unsigned iRegion) - { - Lock::Guard guard(_lock); - - try { - Mem_region *r = new (vmm_heap()) Mem_region(_env, cb, - pDevIns, iRegion); - _regions.insert(r); - - return r->local_addr(); - - } catch (Genode::Out_of_ram) { - Genode::error("Vmm_memory::alloc(", Genode::Hex(cb), "): " - "RAM allocation failed"); - throw; - } catch (Genode::Out_of_caps) { - Genode::error("Vmm_memory::alloc(", Genode::Hex(cb), "): " - "RAM allocation failed (out of caps)"); - throw; - } catch (Genode::Region_map::Region_conflict) { - Genode::error("Vmm_memory::alloc(", Genode::Hex(cb), "): " - "RM attach failed"); - throw; - } - - return 0; - } - - void *alloc_rom(size_t cb, PPDMDEVINS pDevIns) - { - return alloc(cb, pDevIns, ~0U); - } - - void *alloc_ram(size_t cb) - { - return alloc(cb, 0, ~0U); - } - - bool add_handler(RTGCPHYS vm_phys, size_t size, - PFNPGMR3PHYSHANDLER pfnHandlerR3, void *pvUserR3, - PGMPHYSHANDLERTYPE enmType = PGMPHYSHANDLERTYPE_PHYSICAL_ALL) - { - Lock::Guard guard(_lock); - - Mem_region *r = _lookup_unsynchronized(vm_phys, size); - - if (!r) return false; - - r->enmType = enmType; - r->pfnHandlerR3 = pfnHandlerR3; - r->pvUserR3 = pvUserR3; - - return true; - } - - void * lookup(RTGCPHYS vm_phys, size_t size, - PFNPGMR3PHYSHANDLER *ppfnHandlerR3 = 0, - void **ppvUserR3 = 0, - PGMPHYSHANDLERTYPE *enmType = 0) - { - Lock::Guard guard(_lock); - - Mem_region *r = _lookup_unsynchronized(vm_phys, size); - - if (!r) return 0; - - if (enmType) *enmType = r->enmType; - if (ppfnHandlerR3) *ppfnHandlerR3 = r->pfnHandlerR3; - if (ppvUserR3) *ppvUserR3 = r->pvUserR3; - - return reinterpret_cast(r->local_addr() + - (vm_phys - r->vm_phys)); - } - - bool lookup_range(RTGCPHYS &vm_phys, size_t &size) - { - Lock::Guard guard(_lock); - - Mem_region *r = _lookup_unsynchronized(vm_phys, size); - - if (!r) - return false; - - vm_phys = r->vm_phys; - size = r->size(); - - return true; - } - - size_t map_to_vm(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, - unsigned iRegion = ~0U) - { - Lock::Guard guard(_lock); - - Mem_region *r = _lookup_unsynchronized(pDevIns, iRegion); - - if (r) r->vm_phys = GCPhys; - - return r ? r->size() : 0; - } - - bool unmap_from_vm(RTGCPHYS GCPhys, size_t size, bool invalidate = false) - { - Lock::Guard guard(_lock); - - Mem_region *r = _lookup_unsynchronized(GCPhys, size); - if (!r) return false; - - bool result = revoke_from_vm(r); - - if (invalidate) - r->vm_phys = 0ULL; - - return result; - } - - /** - * Platform specific implemented. - */ - bool revoke_from_vm(Mem_region *r); - - /** - * Revoke all memory (RAM or ROM) from VM - */ - void revoke_all() - { - Lock::Guard guard(_lock); - - for (Mem_region *r = _regions.first(); r; r = r->next()) - { - bool ok = revoke_from_vm(r); - Assert(ok); - } - } -}; - - -/** - * Return pointer to singleton instance - */ -Vmm_memory *vmm_memory(); - - -#endif /* _VMM_MEMORY_H_ */ diff --git a/repos/ports/src/virtualbox/vmm_region.h b/repos/ports/src/virtualbox/vmm_region.h deleted file mode 100644 index fb74452b4..000000000 --- a/repos/ports/src/virtualbox/vmm_region.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * \brief Memory region types - * \author Norman Feske - * \author Adrian-Ken Rueegsegger - * \author Reto Buerki - * \date 2013-09-02 - */ - -/* - * Copyright (C) 2013-2017 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -#ifndef _VIRTUALBOX__VMM_REGION_H_ -#define _VIRTUALBOX__VMM_REGION_H_ - -/* Genode includes */ -#include -#include -#include - -/* VirtualBox includes */ -#include - -struct Mem_region; - -struct Mem_region : public Genode::List::Element, - private Genode::Rm_connection, - public Genode::Region_map_client -{ - PPDMDEVINS pDevIns; - unsigned const iRegion; - RTGCPHYS vm_phys; - PFNPGMR3PHYSHANDLER pfnHandlerR3; - void *pvUserR3; - PGMPHYSHANDLERTYPE enmType; - - Genode::addr_t _base; - Genode::size_t _size; - - Mem_region(Genode::Env &env, size_t size, - PPDMDEVINS pDevIns, unsigned iRegion, - unsigned sub_rm_max_ds = 32 * 1024 * 1024) - : - Rm_connection(env), - Region_map_client(Rm_connection::create(size)), - pDevIns(pDevIns), - iRegion(iRegion), - vm_phys(0), pfnHandlerR3(0), pvUserR3(0), - _base(env.rm().attach(Region_map_client::dataspace())), - _size(size) - - { - Genode::addr_t rest_size = _size; - Genode::addr_t map_size = rest_size < sub_rm_max_ds ? rest_size : sub_rm_max_ds; - - do { - Genode::Ram_dataspace_capability ds = env.ram().alloc(map_size); - attach_executable(ds, _size - rest_size, map_size); - - rest_size -= map_size; - map_size = rest_size < sub_rm_max_ds ? rest_size : sub_rm_max_ds; - } while (rest_size); - } - - size_t size() { return _size; } - - template - T * local_addr() { return reinterpret_cast(_base); } -}; - -#endif /* _VIRTUALBOX__ACCLOFF__MEM_REGION_H_ */ diff --git a/repos/ports/src/virtualbox/dynlib.cc b/repos/ports/src/virtualbox5/dynlib.cc similarity index 100% rename from repos/ports/src/virtualbox/dynlib.cc rename to repos/ports/src/virtualbox5/dynlib.cc diff --git a/repos/ports/src/virtualbox/include/VBox/com/VirtualBox.h b/repos/ports/src/virtualbox5/include/VBox/com/VirtualBox.h similarity index 100% rename from repos/ports/src/virtualbox/include/VBox/com/VirtualBox.h rename to repos/ports/src/virtualbox5/include/VBox/com/VirtualBox.h diff --git a/repos/ports/src/virtualbox/include/VBox/com/com.h b/repos/ports/src/virtualbox5/include/VBox/com/com.h similarity index 100% rename from repos/ports/src/virtualbox/include/VBox/com/com.h rename to repos/ports/src/virtualbox5/include/VBox/com/com.h diff --git a/repos/ports/src/virtualbox/include/VBox/com/defs.h b/repos/ports/src/virtualbox5/include/VBox/com/defs.h similarity index 100% rename from repos/ports/src/virtualbox/include/VBox/com/defs.h rename to repos/ports/src/virtualbox5/include/VBox/com/defs.h diff --git a/repos/ports/src/virtualbox/include/VBox/com/ptr.h b/repos/ports/src/virtualbox5/include/VBox/com/ptr.h similarity index 100% rename from repos/ports/src/virtualbox/include/VBox/com/ptr.h rename to repos/ports/src/virtualbox5/include/VBox/com/ptr.h diff --git a/repos/ports/src/virtualbox/include/VBox/intnet.h b/repos/ports/src/virtualbox5/include/VBox/intnet.h similarity index 100% rename from repos/ports/src/virtualbox/include/VBox/intnet.h rename to repos/ports/src/virtualbox5/include/VBox/intnet.h diff --git a/repos/ports/src/virtualbox/include/dtrace/VBoxVMM.h b/repos/ports/src/virtualbox5/include/dtrace/VBoxVMM.h similarity index 100% rename from repos/ports/src/virtualbox/include/dtrace/VBoxVMM.h rename to repos/ports/src/virtualbox5/include/dtrace/VBoxVMM.h diff --git a/repos/ports/src/virtualbox/include/product-generated.h b/repos/ports/src/virtualbox5/include/product-generated.h similarity index 100% rename from repos/ports/src/virtualbox/include/product-generated.h rename to repos/ports/src/virtualbox5/include/product-generated.h diff --git a/repos/ports/src/virtualbox/include/version-generated.h b/repos/ports/src/virtualbox5/include/version-generated.h similarity index 100% rename from repos/ports/src/virtualbox/include/version-generated.h rename to repos/ports/src/virtualbox5/include/version-generated.h diff --git a/repos/ports/src/virtualbox/include/xpcom/nsError.h b/repos/ports/src/virtualbox5/include/xpcom/nsError.h similarity index 100% rename from repos/ports/src/virtualbox/include/xpcom/nsError.h rename to repos/ports/src/virtualbox5/include/xpcom/nsError.h diff --git a/repos/ports/src/virtualbox/include/xpcom/nsID.h b/repos/ports/src/virtualbox5/include/xpcom/nsID.h similarity index 100% rename from repos/ports/src/virtualbox/include/xpcom/nsID.h rename to repos/ports/src/virtualbox5/include/xpcom/nsID.h diff --git a/repos/ports/src/virtualbox/include/xpcom/nsIException.h b/repos/ports/src/virtualbox5/include/xpcom/nsIException.h similarity index 100% rename from repos/ports/src/virtualbox/include/xpcom/nsIException.h rename to repos/ports/src/virtualbox5/include/xpcom/nsIException.h diff --git a/repos/ports/src/virtualbox/include/xpcom/nsISupports.h b/repos/ports/src/virtualbox5/include/xpcom/nsISupports.h similarity index 100% rename from repos/ports/src/virtualbox/include/xpcom/nsISupports.h rename to repos/ports/src/virtualbox5/include/xpcom/nsISupports.h diff --git a/repos/ports/src/virtualbox/include/xpcom/nsISupportsImpl.h b/repos/ports/src/virtualbox5/include/xpcom/nsISupportsImpl.h similarity index 100% rename from repos/ports/src/virtualbox/include/xpcom/nsISupportsImpl.h rename to repos/ports/src/virtualbox5/include/xpcom/nsISupportsImpl.h diff --git a/repos/ports/src/virtualbox/include/xpcom/nsMemory.h b/repos/ports/src/virtualbox5/include/xpcom/nsMemory.h similarity index 100% rename from repos/ports/src/virtualbox/include/xpcom/nsMemory.h rename to repos/ports/src/virtualbox5/include/xpcom/nsMemory.h diff --git a/repos/ports/src/virtualbox/include/xpcom/nscore.h b/repos/ports/src/virtualbox5/include/xpcom/nscore.h similarity index 100% rename from repos/ports/src/virtualbox/include/xpcom/nscore.h rename to repos/ports/src/virtualbox5/include/xpcom/nscore.h diff --git a/repos/ports/src/virtualbox/include/xpcom/prtypes.h b/repos/ports/src/virtualbox5/include/xpcom/prtypes.h similarity index 100% rename from repos/ports/src/virtualbox/include/xpcom/prtypes.h rename to repos/ports/src/virtualbox5/include/xpcom/prtypes.h diff --git a/repos/ports/src/virtualbox/libc.cc b/repos/ports/src/virtualbox5/libc.cc similarity index 100% rename from repos/ports/src/virtualbox/libc.cc rename to repos/ports/src/virtualbox5/libc.cc diff --git a/repos/ports/src/virtualbox/logger.cc b/repos/ports/src/virtualbox5/logger.cc similarity index 100% rename from repos/ports/src/virtualbox/logger.cc rename to repos/ports/src/virtualbox5/logger.cc diff --git a/repos/ports/src/virtualbox/mm.h b/repos/ports/src/virtualbox5/mm.h similarity index 100% rename from repos/ports/src/virtualbox/mm.h rename to repos/ports/src/virtualbox5/mm.h diff --git a/repos/ports/src/virtualbox/network.cpp b/repos/ports/src/virtualbox5/network.cpp similarity index 100% rename from repos/ports/src/virtualbox/network.cpp rename to repos/ports/src/virtualbox5/network.cpp diff --git a/repos/ports/src/virtualbox/patches/acpi_drv.patch b/repos/ports/src/virtualbox5/patches/acpi_drv.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/acpi_drv.patch rename to repos/ports/src/virtualbox5/patches/acpi_drv.patch diff --git a/repos/ports/src/virtualbox/patches/avoid_yield.patch b/repos/ports/src/virtualbox5/patches/avoid_yield.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/avoid_yield.patch rename to repos/ports/src/virtualbox5/patches/avoid_yield.patch diff --git a/repos/ports/src/virtualbox/patches/eminternal.patch b/repos/ports/src/virtualbox5/patches/eminternal.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/eminternal.patch rename to repos/ports/src/virtualbox5/patches/eminternal.patch diff --git a/repos/ports/src/virtualbox/patches/hostservice.patch b/repos/ports/src/virtualbox5/patches/hostservice.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/hostservice.patch rename to repos/ports/src/virtualbox5/patches/hostservice.patch diff --git a/repos/ports/src/virtualbox/patches/iconv.patch b/repos/ports/src/virtualbox5/patches/iconv.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/iconv.patch rename to repos/ports/src/virtualbox5/patches/iconv.patch diff --git a/repos/ports/src/virtualbox/patches/mouse.patch b/repos/ports/src/virtualbox5/patches/mouse.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/mouse.patch rename to repos/ports/src/virtualbox5/patches/mouse.patch diff --git a/repos/ports/src/virtualbox/patches/network.patch b/repos/ports/src/virtualbox5/patches/network.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/network.patch rename to repos/ports/src/virtualbox5/patches/network.patch diff --git a/repos/ports/src/virtualbox/patches/pdm_driver.patch b/repos/ports/src/virtualbox5/patches/pdm_driver.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/pdm_driver.patch rename to repos/ports/src/virtualbox5/patches/pdm_driver.patch diff --git a/repos/ports/src/virtualbox/patches/poke.patch b/repos/ports/src/virtualbox5/patches/poke.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/poke.patch rename to repos/ports/src/virtualbox5/patches/poke.patch diff --git a/repos/ports/src/virtualbox/patches/posix.patch b/repos/ports/src/virtualbox5/patches/posix.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/posix.patch rename to repos/ports/src/virtualbox5/patches/posix.patch diff --git a/repos/ports/src/virtualbox/patches/rem_tss.patch b/repos/ports/src/virtualbox5/patches/rem_tss.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/rem_tss.patch rename to repos/ports/src/virtualbox5/patches/rem_tss.patch diff --git a/repos/ports/src/virtualbox/patches/serial.patch b/repos/ports/src/virtualbox5/patches/serial.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/serial.patch rename to repos/ports/src/virtualbox5/patches/serial.patch diff --git a/repos/ports/src/virtualbox5/patches/series b/repos/ports/src/virtualbox5/patches/series index 88ec4c0cf..9865ca030 100644 --- a/repos/ports/src/virtualbox5/patches/series +++ b/repos/ports/src/virtualbox5/patches/series @@ -13,3 +13,21 @@ substr.patch vusburb.patch audio.patch microcode.patch +acpi_drv.patch +avoid_yield.patch +eminternal.patch +hostservice.patch +iconv.patch +mouse.patch +network.patch +pdm_driver.patch +poke.patch +posix.patch +serial.patch +sharedfolder_pagelist.patch +time-log-deadlock.patch +tm_retries.patch +vmdk.patch +tm_tpr.patch +tm_4s.patch +rem_tss.patch diff --git a/repos/ports/src/virtualbox/patches/sharedfolder_pagelist.patch b/repos/ports/src/virtualbox5/patches/sharedfolder_pagelist.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/sharedfolder_pagelist.patch rename to repos/ports/src/virtualbox5/patches/sharedfolder_pagelist.patch diff --git a/repos/ports/src/virtualbox/patches/time-log-deadlock.patch b/repos/ports/src/virtualbox5/patches/time-log-deadlock.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/time-log-deadlock.patch rename to repos/ports/src/virtualbox5/patches/time-log-deadlock.patch diff --git a/repos/ports/src/virtualbox/patches/tm_4s.patch b/repos/ports/src/virtualbox5/patches/tm_4s.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/tm_4s.patch rename to repos/ports/src/virtualbox5/patches/tm_4s.patch diff --git a/repos/ports/src/virtualbox/patches/tm_retries.patch b/repos/ports/src/virtualbox5/patches/tm_retries.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/tm_retries.patch rename to repos/ports/src/virtualbox5/patches/tm_retries.patch diff --git a/repos/ports/src/virtualbox/patches/tm_tpr.patch b/repos/ports/src/virtualbox5/patches/tm_tpr.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/tm_tpr.patch rename to repos/ports/src/virtualbox5/patches/tm_tpr.patch diff --git a/repos/ports/src/virtualbox/patches/vmdk.patch b/repos/ports/src/virtualbox5/patches/vmdk.patch similarity index 100% rename from repos/ports/src/virtualbox/patches/vmdk.patch rename to repos/ports/src/virtualbox5/patches/vmdk.patch diff --git a/repos/ports/src/virtualbox/pdm.cc b/repos/ports/src/virtualbox5/pdm.cc similarity index 100% rename from repos/ports/src/virtualbox/pdm.cc rename to repos/ports/src/virtualbox5/pdm.cc diff --git a/repos/ports/src/virtualbox/rt.cc b/repos/ports/src/virtualbox5/rt.cc similarity index 94% rename from repos/ports/src/virtualbox/rt.cc rename to repos/ports/src/virtualbox5/rt.cc index c3b3c88a9..8f3b886bd 100644 --- a/repos/ports/src/virtualbox/rt.cc +++ b/repos/ports/src/virtualbox5/rt.cc @@ -238,21 +238,16 @@ static void *alloc_mem(size_t cb, const char *pszTag, bool executable = false) } } -#ifndef RT_NO_THROW - /* not defined in vbox5, but this code is used by vbox4 and vbox5 */ - #define RT_NO_THROW -#endif - /* * Called by the recompiler to allocate executable RAM */ -void *RTMemExecAllocTag(size_t cb, const char *pszTag) RT_NO_THROW +void *RTMemExecAllocTag(size_t cb, const char *pszTag) { return alloc_mem(cb, pszTag, true); } -void *RTMemPageAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW +void *RTMemPageAllocZTag(size_t cb, const char *pszTag) { /* * The RAM dataspace freshly allocated by 'RTMemExecAllocTag' is zeroed @@ -265,13 +260,13 @@ void *RTMemPageAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW } -void *RTMemPageAllocTag(size_t cb, const char *pszTag) RT_NO_THROW +void *RTMemPageAllocTag(size_t cb, const char *pszTag) { return alloc_mem(cb, pszTag); } -void RTMemPageFree(void *pv, size_t cb) RT_NO_THROW +void RTMemPageFree(void *pv, size_t cb) { Genode::Lock::Guard guard(lock_ds); diff --git a/repos/ports/src/virtualbox/sup.h b/repos/ports/src/virtualbox5/sup.h similarity index 100% rename from repos/ports/src/virtualbox/sup.h rename to repos/ports/src/virtualbox5/sup.h diff --git a/repos/ports/src/virtualbox5/target.inc b/repos/ports/src/virtualbox5/target.inc index f7594a1af..73adb0a18 100644 --- a/repos/ports/src/virtualbox5/target.inc +++ b/repos/ports/src/virtualbox5/target.inc @@ -11,14 +11,6 @@ SRC_CC = frontend/main.cc frontend/console.cc \ logger.cc mm.cc pdm.cc pgm.cc rt.cc sup.cc \ hm.cc thread.cc dynlib.cc unimpl.cc -# use implementation of VBOX 4 -vpath dynlib.cc $(REP_DIR)/src/virtualbox -vpath libc.cc $(REP_DIR)/src/virtualbox -vpath logger.cc $(REP_DIR)/src/virtualbox -vpath pdm.cc $(REP_DIR)/src/virtualbox -vpath rt.cc $(REP_DIR)/src/virtualbox -vpath thread.cc $(REP_DIR)/src/virtualbox - LIBS += base LIBS += stdcxx @@ -51,8 +43,7 @@ SRC_CC += frontend/dummy/errorinfo.cc frontend/dummy/virtualboxbase.cc SRC_CC += frontend/dummy/autostart.cc frontend/dummy/rest.cc SRC_CC += frontend/dummy/host.cc -#vbox 4 include -INC_DIR += $(REP_DIR)/src/virtualbox +INC_DIR += $(REP_DIR)/src/virtualbox5 INC_DIR += $(VBOX_DIR)/Main/include INC_DIR += $(VBOX_DIR)/VMM/include diff --git a/repos/ports/src/virtualbox/thread.cc b/repos/ports/src/virtualbox5/thread.cc similarity index 100% rename from repos/ports/src/virtualbox/thread.cc rename to repos/ports/src/virtualbox5/thread.cc diff --git a/repos/ports/src/virtualbox/util.h b/repos/ports/src/virtualbox5/util.h similarity index 100% rename from repos/ports/src/virtualbox/util.h rename to repos/ports/src/virtualbox5/util.h diff --git a/tool/autopilot.list b/tool/autopilot.list index fec8a9e10..aa0076903 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -58,17 +58,6 @@ timer_accuracy tz_vmm usb_hid usb_hid_raw -vbox4_ubuntu_14_04_32 -vbox4_ubuntu_14_04_64 -vbox4_ubuntu_16_04_32 -vbox4_ubuntu_16_04_64 -vbox4_win10_64 -vbox4_win7_32 -vbox4_win7_32_share -vbox4_win7_64 -vbox4_win7_64_multiple -vbox4_win7_64_raw -vbox4_win81_64 vbox5_genode_usb_hid vbox5_ubuntu_14_04_32 vbox5_ubuntu_14_04_64