From 604b831e1e7cab84b0099fa4a4330938d09cbed4 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 23 Sep 2014 13:01:47 +0200 Subject: [PATCH] vbox: update to virtualbox 4.3.16 Fixes #1296 --- repos/ports/lib/mk/virtualbox-common.inc | 14 +- repos/ports/lib/mk/virtualbox-devices.mk | 15 +- repos/ports/lib/mk/virtualbox-drivers.mk | 6 +- repos/ports/lib/mk/virtualbox-main.mk | 67 + repos/ports/lib/mk/virtualbox-runtime.mk | 28 +- repos/ports/lib/mk/virtualbox-storage.mk | 1 + repos/ports/lib/mk/virtualbox-vmm.mk | 18 +- repos/ports/lib/mk/virtualbox-xml.mk | 23 + repos/ports/ports/virtualbox.hash | 2 +- repos/ports/ports/virtualbox.port | 124 +- repos/ports/run/test.vbox | 161 ++ repos/ports/run/virtualbox.run | 30 +- repos/ports/run/virtualbox_auto.inc | 31 +- repos/ports/run/virtualbox_auto_disk.run | 81 +- repos/ports/run/virtualbox_auto_share.run | 88 +- repos/ports/run/vm_auto_disk.vbox | 185 ++ repos/ports/run/vm_auto_share.vbox | 188 ++ repos/ports/src/virtualbox/autotest/main.cc | 45 - repos/ports/src/virtualbox/autotest/target.mk | 3 - repos/ports/src/virtualbox/cxx_dummies.cc | 45 - repos/ports/src/virtualbox/devices.cc | 2 - repos/ports/src/virtualbox/drivers.cc | 2 - repos/ports/src/virtualbox/dummies.cc | 419 ++--- repos/ports/src/virtualbox/dynlib.cc | 7 +- .../src/virtualbox/fake_pci_vendor.patch | 10 - .../src/virtualbox/frontend/ClientToken.h | 19 + .../src/virtualbox/frontend/ClientWatcher.h | 14 + .../src/virtualbox/frontend/GenodeImpl.h | 285 +++ .../virtualbox/frontend/MediumFormatWrap.h | 10 + .../ports/src/virtualbox/frontend/TokenWrap.h | 22 + .../src/virtualbox/frontend/VBoxEvents.h | 0 .../src/virtualbox/frontend/VirtualBoxBase.h | 448 +++++ .../frontend/VirtualBoxErrorInfoImpl.h | 0 .../src/virtualbox/frontend/VirtualBoxImpl.h | 0 .../ports/src/virtualbox/frontend/console.cc | 118 ++ .../SDLConsole.h => frontend/console.h} | 81 +- .../virtualbox/frontend/dummy/autostart.cc | 33 + .../virtualbox/frontend/dummy/errorinfo.cc | 31 + .../src/virtualbox/frontend/dummy/host.cc | 143 ++ .../src/virtualbox/frontend/dummy/rest.cc | 201 ++ .../frontend/dummy/virtualboxbase.cc | 58 + repos/ports/src/virtualbox/frontend/fb.h | 190 ++ repos/ports/src/virtualbox/frontend/main.cc | 244 +++ .../ports/src/virtualbox/frontend/nsMemory.h | 17 + repos/ports/src/virtualbox/guest_memory.h | 78 +- repos/ports/src/virtualbox/hda.patch | 53 - repos/ports/src/virtualbox/hm.cc | 145 ++ repos/ports/src/virtualbox/hwacc.patch | 16 - repos/ports/src/virtualbox/hwaccm.cc | 134 -- repos/ports/src/virtualbox/iconv.patch | 17 - .../src/virtualbox/include/SDLFramebuffer.h | 110 -- .../VBox/HostServices/VBoxClipboardSvc.h | 0 .../virtualbox/include/VBox/com/VirtualBox.h | 7 + .../src/virtualbox/include/VBox/com/com.h | 15 + .../src/virtualbox/include/VBox/com/defs.h | 631 +++++++ .../src/virtualbox/include/VBox/com/ptr.h | 66 + .../src/virtualbox/include/VBox/intnet.h | 0 repos/ports/src/virtualbox/include/list | 4 - repos/ports/src/virtualbox/include/map | 4 - repos/ports/src/virtualbox/iommio.cc | 117 +- repos/ports/src/virtualbox/ioport.cc | 76 +- repos/ports/src/virtualbox/libc.cc | 96 +- repos/ports/src/virtualbox/main.cc | 279 --- repos/ports/src/virtualbox/mm.cc | 76 +- repos/ports/src/virtualbox/network.patch | 131 -- repos/ports/src/virtualbox/nova/sup.cc | 44 +- repos/ports/src/virtualbox/nova/vcpu.h | 67 +- repos/ports/src/virtualbox/nova/vcpu_svm.h | 20 +- repos/ports/src/virtualbox/nova/vcpu_vmx.h | 32 +- .../virtualbox/{ => patches}/acpi_drv.patch | 0 .../src/virtualbox/patches/avoid_yield.patch | 76 + .../src/virtualbox/patches/dev_e1000.patch | 31 + .../src/virtualbox/patches/eminternal.patch | 15 + .../virtualbox/patches/fake_pci_vendor.patch | 10 + .../ports/src/virtualbox/patches/iconv.patch | 13 + .../src/virtualbox/{ => patches}/mouse.patch | 6 +- .../src/virtualbox/patches/network.patch | 79 + .../src/virtualbox/patches/pdm_driver.patch | 13 + .../{ => patches}/pdm_queue_irqs.patch | 0 .../{ => patches}/sharedfolder_pagelist.patch | 0 .../{ => patches}/time-log-deadlock.patch | 0 .../src/virtualbox/{ => patches}/timer.patch | 0 .../{ => patches}/vbetables-gen.patch | 0 .../src/virtualbox/patches/vbox_inc.patch | 128 ++ .../src/virtualbox/patches/vbox_main.patch | 1636 +++++++++++++++++ .../src/virtualbox/{ => patches}/vga_fb.patch | 0 .../virtualbox/{ => patches}/vga_vbva.patch | 0 .../src/virtualbox/{ => patches}/vmdk.patch | 0 .../ports/src/virtualbox/patches/vmmdev.patch | 49 + repos/ports/src/virtualbox/pdm.cc | 15 +- repos/ports/src/virtualbox/pgm.cc | 252 ++- repos/ports/src/virtualbox/rt.cc | 63 +- repos/ports/src/virtualbox/rtc.patch | 9 - repos/ports/src/virtualbox/serial.patch | 13 - repos/ports/src/virtualbox/sharedfolder.patch | 12 - repos/ports/src/virtualbox/sup.cc | 65 +- repos/ports/src/virtualbox/target.mk | 29 +- repos/ports/src/virtualbox/thread.cc | 106 +- repos/ports/src/virtualbox/unimpl.cc | 213 +++ repos/ports/src/virtualbox/util.h | 17 +- repos/ports/src/virtualbox/vboxbfe.patch | 13 - repos/ports/src/virtualbox/vmmdev.patch | 39 - repos/ports/src/virtualbox/vmx_c++.patch | 63 - 103 files changed, 6848 insertions(+), 1844 deletions(-) create mode 100644 repos/ports/lib/mk/virtualbox-main.mk create mode 100644 repos/ports/lib/mk/virtualbox-xml.mk create mode 100644 repos/ports/run/test.vbox create mode 100644 repos/ports/run/vm_auto_disk.vbox create mode 100644 repos/ports/run/vm_auto_share.vbox delete mode 100644 repos/ports/src/virtualbox/autotest/main.cc delete mode 100644 repos/ports/src/virtualbox/autotest/target.mk delete mode 100644 repos/ports/src/virtualbox/cxx_dummies.cc delete mode 100644 repos/ports/src/virtualbox/fake_pci_vendor.patch create mode 100644 repos/ports/src/virtualbox/frontend/ClientToken.h create mode 100644 repos/ports/src/virtualbox/frontend/ClientWatcher.h create mode 100644 repos/ports/src/virtualbox/frontend/GenodeImpl.h create mode 100644 repos/ports/src/virtualbox/frontend/MediumFormatWrap.h create mode 100644 repos/ports/src/virtualbox/frontend/TokenWrap.h create mode 100644 repos/ports/src/virtualbox/frontend/VBoxEvents.h create mode 100644 repos/ports/src/virtualbox/frontend/VirtualBoxBase.h create mode 100644 repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.h create mode 100644 repos/ports/src/virtualbox/frontend/VirtualBoxImpl.h create mode 100644 repos/ports/src/virtualbox/frontend/console.cc rename repos/ports/src/virtualbox/{include/SDLConsole.h => frontend/console.h} (74%) create mode 100644 repos/ports/src/virtualbox/frontend/dummy/autostart.cc create mode 100644 repos/ports/src/virtualbox/frontend/dummy/errorinfo.cc create mode 100644 repos/ports/src/virtualbox/frontend/dummy/host.cc create mode 100644 repos/ports/src/virtualbox/frontend/dummy/rest.cc create mode 100644 repos/ports/src/virtualbox/frontend/dummy/virtualboxbase.cc create mode 100644 repos/ports/src/virtualbox/frontend/fb.h create mode 100644 repos/ports/src/virtualbox/frontend/main.cc create mode 100644 repos/ports/src/virtualbox/frontend/nsMemory.h delete mode 100644 repos/ports/src/virtualbox/hda.patch create mode 100644 repos/ports/src/virtualbox/hm.cc delete mode 100644 repos/ports/src/virtualbox/hwacc.patch delete mode 100644 repos/ports/src/virtualbox/hwaccm.cc delete mode 100644 repos/ports/src/virtualbox/iconv.patch delete mode 100644 repos/ports/src/virtualbox/include/SDLFramebuffer.h create mode 100644 repos/ports/src/virtualbox/include/VBox/HostServices/VBoxClipboardSvc.h create mode 100644 repos/ports/src/virtualbox/include/VBox/com/VirtualBox.h create mode 100644 repos/ports/src/virtualbox/include/VBox/com/com.h create mode 100644 repos/ports/src/virtualbox/include/VBox/com/defs.h create mode 100644 repos/ports/src/virtualbox/include/VBox/com/ptr.h create mode 100644 repos/ports/src/virtualbox/include/VBox/intnet.h delete mode 100644 repos/ports/src/virtualbox/include/list delete mode 100644 repos/ports/src/virtualbox/include/map delete mode 100644 repos/ports/src/virtualbox/main.cc delete mode 100644 repos/ports/src/virtualbox/network.patch rename repos/ports/src/virtualbox/{ => patches}/acpi_drv.patch (100%) create mode 100644 repos/ports/src/virtualbox/patches/avoid_yield.patch create mode 100644 repos/ports/src/virtualbox/patches/dev_e1000.patch create mode 100644 repos/ports/src/virtualbox/patches/eminternal.patch create mode 100644 repos/ports/src/virtualbox/patches/fake_pci_vendor.patch create mode 100644 repos/ports/src/virtualbox/patches/iconv.patch rename repos/ports/src/virtualbox/{ => patches}/mouse.patch (83%) create mode 100644 repos/ports/src/virtualbox/patches/network.patch create mode 100644 repos/ports/src/virtualbox/patches/pdm_driver.patch rename repos/ports/src/virtualbox/{ => patches}/pdm_queue_irqs.patch (100%) rename repos/ports/src/virtualbox/{ => patches}/sharedfolder_pagelist.patch (100%) rename repos/ports/src/virtualbox/{ => patches}/time-log-deadlock.patch (100%) rename repos/ports/src/virtualbox/{ => patches}/timer.patch (100%) rename repos/ports/src/virtualbox/{ => patches}/vbetables-gen.patch (100%) create mode 100644 repos/ports/src/virtualbox/patches/vbox_inc.patch create mode 100644 repos/ports/src/virtualbox/patches/vbox_main.patch rename repos/ports/src/virtualbox/{ => patches}/vga_fb.patch (100%) rename repos/ports/src/virtualbox/{ => patches}/vga_vbva.patch (100%) rename repos/ports/src/virtualbox/{ => patches}/vmdk.patch (100%) create mode 100644 repos/ports/src/virtualbox/patches/vmmdev.patch delete mode 100644 repos/ports/src/virtualbox/rtc.patch delete mode 100644 repos/ports/src/virtualbox/serial.patch delete mode 100644 repos/ports/src/virtualbox/sharedfolder.patch create mode 100644 repos/ports/src/virtualbox/unimpl.cc delete mode 100644 repos/ports/src/virtualbox/vboxbfe.patch delete mode 100644 repos/ports/src/virtualbox/vmmdev.patch delete mode 100644 repos/ports/src/virtualbox/vmx_c++.patch diff --git a/repos/ports/lib/mk/virtualbox-common.inc b/repos/ports/lib/mk/virtualbox-common.inc index e3611d6730..d18bd14c89 100644 --- a/repos/ports/lib/mk/virtualbox-common.inc +++ b/repos/ports/lib/mk/virtualbox-common.inc @@ -34,6 +34,9 @@ VBOX_CC_OPT += -DVBOXBFE_WITHOUT_COM VBOX_CC_OPT += -DVBOX_WITHOUT_TESTING_FEATURES VBOX_CC_OPT += -DUSE_SDL +VBOX_CC_OPT += -DVBOX_WITH_VIDEOHWACCEL + +VBOX_CC_OPT += -DVBOX_WITH_XPCOM VBOX_CC_OPT += -DRTLOG_REL_ENABLED -DRT_STRICT -DVBOX_STRICT @@ -44,10 +47,19 @@ VIRTUALBOX_VERSION_MAJOR := $(shell cat $(VIRTUALBOX_DIR)/Config.kmk | grep "VBO VIRTUALBOX_VERSION_MINOR := $(shell cat $(VIRTUALBOX_DIR)/Config.kmk | grep "VBOX_VERSION_MINOR = " | grep -v "'VBOX_VERSION_MINOR" | sed "s/^.*= //") VIRTUALBOX_VERSION_BUILD := $(shell cat $(VIRTUALBOX_DIR)/Config.kmk | 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=\"$(VIRTUALBOX_VERSION_MAJOR).$(VIRTUALBOX_VERSION_MINOR).$(VIRTUALBOX_VERSION_BUILD)_OSE\" \ + -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\" VBOX_CC_OPT += -DVBOX_HDD_NO_DYNAMIC_BACKENDS diff --git a/repos/ports/lib/mk/virtualbox-devices.mk b/repos/ports/lib/mk/virtualbox-devices.mk index 76b72c5940..4856db8c3f 100644 --- a/repos/ports/lib/mk/virtualbox-devices.mk +++ b/repos/ports/lib/mk/virtualbox-devices.mk @@ -16,12 +16,14 @@ 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/DevATA.cpp SRC_CC += Devices/Storage/Debug.cpp -SRC_CC += Devices/Storage/fdc.c +SRC_CC += Devices/Storage/DevFdc.c SRC_CC += Devices/Storage/DrvRawImage.cpp SRC_CC += Devices/Network/DevE1000.cpp SRC_CC += Devices/Network/DevE1000Phy.cpp @@ -39,14 +41,9 @@ INC_DIR += $(VBOX_DIR)/Devices/Bus CC_WARN += -Wno-unused-but-set-variable -# -# Definitions needed to compile DevVGA.cpp -# -# VBOX_WITH_VDMA is needed because otherwise, the alignment of the -# VGASTATE::lock member would violate the assertion -# '!((uintptr_t)pvSample & 7)' in 'stamR3RegisterU'. -# -CC_OPT += -DVBOX_WITH_WDDM -DVBOX_WITH_VDMA +CC_OPT += -DVBOX_WITH_WDDM -DVBOX_WITH_WDDM_W8 -DVBOXWDDM_WITH_VBVA +CC_OPT += -DVBOX_WITH_VDMA +CC_OPT += -DVBOX_WITH_VMSVGA Devices/Graphics/DevVGA.o: vbetables.h diff --git a/repos/ports/lib/mk/virtualbox-drivers.mk b/repos/ports/lib/mk/virtualbox-drivers.mk index 591cea5ea1..8129c2aeca 100644 --- a/repos/ports/lib/mk/virtualbox-drivers.mk +++ b/repos/ports/lib/mk/virtualbox-drivers.mk @@ -9,12 +9,12 @@ 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 += Main/src-client/MouseImpl.cpp +#SRC_CC += Main/src-client/MouseImpl.cpp SRC_CC += network.cpp vpath network.cpp $(REP_DIR)/src/virtualbox # includes needed by 'MouseImpl.cpp' -INC_DIR += $(VBOX_DIR)/Main/include -INC_DIR += $(VBOX_DIR)/Frontends/VBoxBFE +#INC_DIR += $(VBOX_DIR)/Main/include +#INC_DIR += $(VBOX_DIR)/Frontends/VBoxBFE diff --git a/repos/ports/lib/mk/virtualbox-main.mk b/repos/ports/lib/mk/virtualbox-main.mk new file mode 100644 index 0000000000..0dd546d30c --- /dev/null +++ b/repos/ports/lib/mk/virtualbox-main.mk @@ -0,0 +1,67 @@ +include $(REP_DIR)/lib/mk/virtualbox-common.inc + +VBOX_CC_OPT += -DVBOX_COM_INPROC_API_CLIENT + +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/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/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/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/frontend diff --git a/repos/ports/lib/mk/virtualbox-runtime.mk b/repos/ports/lib/mk/virtualbox-runtime.mk index 3101fe9797..7a8b336e81 100644 --- a/repos/ports/lib/mk/virtualbox-runtime.mk +++ b/repos/ports/lib/mk/virtualbox-runtime.mk @@ -12,6 +12,7 @@ FILTERED_OUT_SRC_CC = RTLogDefaultInit-generic.cpp \ RTTimeLocalExplode-generic.cpp \ semrw-lockless-generic.cpp \ tls-generic.cpp \ + fs-stubs-generic.cpp \ RTSemEventMultiWait-2-ex-generic.cpp \ RTLogWriteStdErr-generic.cpp \ RTLogWriteStdOut-generic.cpp \ @@ -34,15 +35,18 @@ SRC_CC += Runtime/common/log/logrel.cpp \ 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/md5.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/sg.cpp @@ -52,29 +56,36 @@ 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/zip/zip.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 @@ -84,10 +95,12 @@ SRC_CC += Runtime/common/string/stringalloc.cpp SRC_CC += Runtime/common/string/strprintf.cpp SRC_CC += Runtime/common/string/strstrip.cpp SRC_CC += Runtime/common/string/strtonum.cpp -SRC_CC += Runtime/common/string/unidata.cpp -SRC_CC += Runtime/common/string/utf-16.cpp -SRC_CC += Runtime/common/string/utf-8-case.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 @@ -96,6 +109,8 @@ 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 @@ -106,12 +121,12 @@ 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/poll-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 @@ -128,6 +143,7 @@ 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 diff --git a/repos/ports/lib/mk/virtualbox-storage.mk b/repos/ports/lib/mk/virtualbox-storage.mk index cebc44eeaf..5797d8f413 100644 --- a/repos/ports/lib/mk/virtualbox-storage.mk +++ b/repos/ports/lib/mk/virtualbox-storage.mk @@ -11,6 +11,7 @@ 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 diff --git a/repos/ports/lib/mk/virtualbox-vmm.mk b/repos/ports/lib/mk/virtualbox-vmm.mk index 33f241999b..219707a6af 100644 --- a/repos/ports/lib/mk/virtualbox-vmm.mk +++ b/repos/ports/lib/mk/virtualbox-vmm.mk @@ -17,6 +17,7 @@ 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 @@ -32,33 +33,26 @@ SRC_CC += VMM/VMMR3/PDMDevMiscHlp.cpp SRC_CC += VMM/VMMR3/PDMDriver.cpp SRC_CC += VMM/VMMR3/PDMThread.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/PATMAll.cpp -SRC_CC += VMM/VMMR3/PATM.cpp -SRC_CC += VMM/VMMR3/PATMPatch.cpp -SRC_CC += VMM/VMMR3/PATMA.asm -SRC_CC += VMM/VMMR3/PATMSSM.cpp -SRC_CC += VMM/VMMR3/PATMGuest.cpp - -SRC_CC += VMM/VMMAll/CSAMAll.cpp -SRC_CC += VMM/VMMR3/CSAM.cpp - -SRC_CC += VMM/VMMR3/EMHwaccm.cpp - SRC_CC += VMM/VMMAll/REMAll.cpp CC_OPT += -DVBOX_IN_VMM diff --git a/repos/ports/lib/mk/virtualbox-xml.mk b/repos/ports/lib/mk/virtualbox-xml.mk new file mode 100644 index 0000000000..e192ff0092 --- /dev/null +++ b/repos/ports/lib/mk/virtualbox-xml.mk @@ -0,0 +1,23 @@ +include $(REP_DIR)/lib/mk/virtualbox-common.inc + +ZLIB_DIR = $(VIRTUALBOX_DIR)/src/libs/zlib-1.2.6 +LIBXML_DIR = $(VIRTUALBOX_DIR)/src/libs/libxml2-2.6.31 + +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 += 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) diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash index bda6f9ae8f..c3cd2e976b 100644 --- a/repos/ports/ports/virtualbox.hash +++ b/repos/ports/ports/virtualbox.hash @@ -1 +1 @@ -cc82990bfeded59df2befde90f20004f2a5a331d +fd1a0bb3692bfb4448f3b3f8978fc1c5d037e2c4 diff --git a/repos/ports/ports/virtualbox.port b/repos/ports/ports/virtualbox.port index 992b945502..9bb9bfe44a 100644 --- a/repos/ports/ports/virtualbox.port +++ b/repos/ports/ports/virtualbox.port @@ -1,52 +1,96 @@ LICENSE := GPLv2 -VERSION := 4.2.24 +VERSION := 4.3.16 DOWNLOADS := virtualbox.archive VIRTUALBOX_TBZ2 := VirtualBox-$(VERSION).tar.bz2 URL(virtualbox) := http://download.virtualbox.org/virtualbox/$(VERSION)/$(VIRTUALBOX_TBZ2) DIR(virtualbox) := src/app/virtualbox -SHA(virtualbox) := 4685a898fb426ae59081a3b3adf3f5b8c5cfd34e +SHA(virtualbox) := e4c23b713e8715b8e0172fa066f2197756e901fe -PATCHES := src/virtualbox/*.patch +PATCHES_LIST := acpi_drv dev_e1000 eminternal fake_pci_vendor iconv mouse +PATCHES_LIST += pdm_driver pdm_queue_irqs sharedfolder_pagelist timer +PATCHES_LIST += time-log-deadlock vbetables-gen vbox_inc vbox_main network +PATCHES_LIST += vga_fb vga_vbva vmdk vmmdev avoid_yield + +PATCHES := $(addsuffix .patch, $(PATCHES_LIST)) +PATCHES := $(addprefix src/virtualbox/patches/, $(PATCHES)) + +$(call check_tool,xsltproc) + +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 DHCPServerImpl MediumAttachmentImpl +VBOX_MAIN_SRV += NATEngineImpl SerialPortImpl USBControllerImpl +VBOX_MAIN_SRV += BandwidthControlImpl GuestOSTypeImpl MediumFormatImpl +VBOX_MAIN_SRV += NetworkAdapterImpl SnapshotImpl USBDeviceFiltersImpl +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_INC := AdditionsFacilityImpl AudioAdapterImpl AudioSnifferInterface +VBOX_MAIN_INC += AutoCaller AutostartDb AutoStateDep BandwidthControlImpl +VBOX_MAIN_INC += BandwidthGroupImpl BIOSSettingsImpl BusAssignmentManager Nvram +VBOX_MAIN_INC += ConsoleEvents 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 += VirtualBoxImpl VRDEServerImpl GuestProcessImpl + +VBOX_SRC_VBOX := VMM Devices Runtime GuestHost/HGSMI Storage Disassembler +VBOX_SRC_VBOX += HostServices/SharedFolders Main/xml/Settings.cpp +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_COM := array.h assert.h AutoLock.h ErrorInfo.h EventQueue.h Guid.h +VBOX_INC_COM += list.h MultiResult.h string.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 += src/libs/zlib-1.2.6 src/libs/liblzf-3.4 src/libs/libxml2-2.6.31 +VBOX_CONTENT += src/recompiler include/VBox/vmm include/iprt Config.kmk -VIRTUALBOX_CONTENT = src/VBox/VMM \ - src/VBox/Devices \ - src/VBox/Runtime \ - src/VBox/GuestHost/HGSMI \ - src/VBox/Frontends/VBoxBFE \ - src/VBox/Storage \ - src/VBox/Disassembler \ - src/VBox/HostServices/SharedFolders \ - src/recompiler \ - src/VBox/Main/include/MouseImpl.h \ - src/VBox/Main/include/ConsoleEvents.h \ - src/VBox/Main/src-client/MouseImpl.cpp \ - src/libs/zlib-1.2.6 \ - src/libs/liblzf-3.4 \ - include/VBox/vmm \ - include/iprt \ - $(addprefix include/VBox/,types.h cdefs.h hgcmsvc.h \ - err.h dis.h disopcode.h \ - log.h sup.h pci.h param.h \ - ostypes.h VMMDev.h VMMDev2.h \ - vusb.h dbg.h version.h \ - VBoxVideo.h Hardware bioslogo.h \ - scsi.h shflsvc.h VBoxGuest2.h \ - HGSMI) \ - include/VBox/msi.h \ - include/VBox/DevPCNet.h \ - include/VBox/asmdefs.mac \ - include/VBox/err.mac \ - include/VBox/vd.h \ - include/VBox/vd-ifs.h \ - include/VBox/vd-plugin.h \ - include/VBox/vd-ifs-internal.h \ - include/VBox/vd-cache-plugin.h \ - Config.kmk \ - include/VBox/VBoxVideo3D.h TAR_OPT(virtualbox) := \ --strip-components 1 \ - $(addprefix $(VIRTUALBOX_TBZ2:.tar.bz2=)/,$(VIRTUALBOX_CONTENT)) \ - --exclude SDLConsole.h --exclude SDLFramebuffer.h + $(addprefix $(VIRTUALBOX_TBZ2:.tar.bz2=)/,$(VBOX_CONTENT)) + + +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/run/test.vbox b/repos/ports/run/test.vbox new file mode 100644 index 0000000000..3130b51669 --- /dev/null +++ b/repos/ports/run/test.vbox @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/ports/run/virtualbox.run b/repos/ports/run/virtualbox.run index 3c66a40781..a1c24e3f71 100644 --- a/repos/ports/run/virtualbox.run +++ b/repos/ports/run/virtualbox.run @@ -98,20 +98,17 @@ append_if [expr $use_net] config { append config { - - - - -} - -append_if [expr $use_net] config { - } - -append config { + + - + + + + + + @@ -121,7 +118,9 @@ append config { install_config $config -set boot_modules { core init timer virtualbox test.iso } +exec cp ${genode_dir}/repos/ports/run/test.vbox bin/. + +set boot_modules { core init timer virtualbox test.iso test.vbox } # platform-specific modules lappend_if [have_spec ps2] boot_modules ps2_drv @@ -132,9 +131,10 @@ lappend_if [have_spec linux] boot_modules fb_sdl lappend_if [have_spec nova] boot_modules pci_device_pd lappend_if [have_spec x86] boot_modules rtc_drv -append boot_modules { ld.lib.so libc.lib.so libm.lib.so pthread.lib.so - libc_lock_pipe.lib.so libc_terminal.lib.so - libiconv.lib.so } +append boot_modules { + ld.lib.so libc.lib.so libm.lib.so pthread.lib.so libc_lock_pipe.lib.so + libc_terminal.lib.so libiconv.lib.so stdcxx.lib.so +} append_if [expr $use_net] boot_modules { nic_drv } diff --git a/repos/ports/run/virtualbox_auto.inc b/repos/ports/run/virtualbox_auto.inc index 4943378818..e2671beaa4 100644 --- a/repos/ports/run/virtualbox_auto.inc +++ b/repos/ports/run/virtualbox_auto.inc @@ -15,9 +15,10 @@ append build_components { drivers/timer } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci -lappend_if [have_spec x86] build_components drivers/rtc +lappend_if [have_spec acpi] build_components drivers/acpi +lappend_if [have_spec pci] build_components drivers/pci +lappend_if [have_spec x86] build_components drivers/rtc +lappend_if [expr $use_ram_fs] build_components server/ram_fs build $build_components @@ -73,6 +74,21 @@ set config { } +append_if [expr $use_ram_fs] config { + + + + + + + + + + + + + } + append_if [have_spec acpi] config { @@ -127,9 +143,9 @@ append boot_modules { part_blk ahci ld.lib.so libc.lib.so libm.lib.so pthread.lib.so libc_lock_pipe.lib.so libc_terminal.lib.so - libiconv.lib.so + libiconv.lib.so stdcxx.lib.so rump.lib.so rump_fs.lib.so rump_fs - virtualbox vbox-auto-test-helper + virtualbox } # @@ -162,6 +178,9 @@ append boot_modules { # } #} +lappend_if [expr $use_ram_fs] boot_modules ram_fs +lappend_if [expr $use_ram_fs] boot_modules overlay.vdi + # platform-specific modules lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec acpi] boot_modules acpi_drv @@ -169,5 +188,3 @@ lappend_if [have_spec pci] boot_modules pci_drv lappend_if [have_spec framebuffer] boot_modules fb_drv lappend_if [have_spec nova] boot_modules pci_device_pd lappend_if [have_spec x86] boot_modules rtc_drv - -build_boot_image $boot_modules diff --git a/repos/ports/run/virtualbox_auto_disk.run b/repos/ports/run/virtualbox_auto_disk.run index 3e8b30401e..296a228f8b 100644 --- a/repos/ports/run/virtualbox_auto_disk.run +++ b/repos/ports/run/virtualbox_auto_disk.run @@ -1,62 +1,45 @@ # Tested for nova. assert_spec nova -set use_vdi 1 -set use_iso 0 -set vdi_image "win7.vdi" - -set config_of_app { - - - - - - - - - - - - - - - +if {[is_qemu_available]} { + puts "\nRun script does not support Qemu.\n" + exit } -source ${genode_dir}/repos/ports/run/virtualbox_auto.inc +set vdi_image "win7.vdi" +# Write overlay back to harddisk if set to 0 +set use_ram_fs 0 -run_genode_until "vbox_auto_test_helper is done." 20 -exec kill [exp_pid −i $spawn_id] - -# reset values used before set build_components { } -set boot_modules { } +set boot_modules { vm_auto_disk.vbox } set config_of_app { - - } + + + + } -if {$use_iso} { -append config_of_app " - " -} - -if {$use_vdi} { -append config_of_app " - " -} +append_if [expr $use_ram_fs] config_of_app { + } append config_of_app { - - - + + - + } + +append_if [expr $use_ram_fs] config_of_app { + + + + } + +append config_of_app { @@ -65,10 +48,18 @@ append config_of_app { source ${genode_dir}/repos/ports/run/virtualbox_auto.inc +# copy vbox configuration to bin directory +exec cp ${genode_dir}/repos/ports/run/vm_auto_disk.vbox bin/. -run_genode_until "ignore resize request to 720x400" 20 -run_genode_until "ignore resize request to 640x480" 25 $spawn_id -run_genode_until "ignore resize request to 800x600" 35 $spawn_id -run_genode_until {\[init -\> vbox\].*Guest Additions capability report:.*seamless: yes, hostWindowMapping: no, graphics: yes} 60 $spawn_id +build_boot_image $boot_modules + +run_genode_until "fb resize : 1024x768@16 -> 720x400@0" 40 +run_genode_until "fb resize : 720x400@16 -> 640x480@0" 25 $spawn_id +run_genode_until "fb resize : 640x480@16 -> 800x600@16" 45 $spawn_id + +run_genode_until {\[init -\> vbox\].*Guest Additions capability report:.*seamless: yes, hostWindowMapping: no, graphics: yes} 180 $spawn_id + +# cleanup bin directory - remove vbox file +exec rm bin/vm_auto_disk.vbox puts "\nTest succeeded" diff --git a/repos/ports/run/virtualbox_auto_share.run b/repos/ports/run/virtualbox_auto_share.run index a7952c69d5..85f0bd8c16 100644 --- a/repos/ports/run/virtualbox_auto_share.run +++ b/repos/ports/run/virtualbox_auto_share.run @@ -57,7 +57,6 @@ # beforehand. test.bat contains the actual instructions to be performed by # the VM - for this script to copy the test.bin file from D: to E:. - if {[is_qemu_available]} { puts "\nRun script does not support Qemu.\n" exit @@ -66,11 +65,8 @@ if {[is_qemu_available]} { # Tested for nova. assert_spec nova -# -# Build Noux packages only once -# -foreach pkg {bash coreutils} { - lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } +# Write overlay back to harddisk if set to 0 +set use_ram_fs 0 # # Create .bat file to be executed by Win VM @@ -96,52 +92,28 @@ catch { exec unix2dos bin/template.bat } # catch { exec dd if=/dev/urandom of=bin/test.bin bs=4096 count=8160 } - -# -# Step 0: prepare overlay.vdi for a clean run of the VM -# -set config_of_app { - - - - - - - - - - - - - - - -} - -source ${genode_dir}/repos/ports/run/virtualbox_auto.inc - -run_genode_until "vbox_auto_test_helper is done." 20 -exec kill [exp_pid −i $spawn_id] - - - # # Step 1: prepare and start the actual VM # -exec tar cfv bin/bash.tar -h -C bin/bash . -exec tar cfv bin/coreutils.tar -h -C bin/coreutils . - set build_components { - server/ram_fs - server/tcp_terminal drivers/nic - noux/minimal + server/ram_fs + server/tcp_terminal drivers/nic + lib/libc_noux + noux/minimal } +# +# Build Noux packages only once +# +foreach pkg {bash coreutils} { + lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } + set boot_modules { ram_fs noux libc_noux.lib.so bash.tar coreutils.tar tcp_terminal lwip.lib.so nic_drv test.bin template.bat + vm_auto_share.vbox } set config_of_app { @@ -213,21 +185,32 @@ set config_of_app { - - - - - + + + } + +append_if [expr $use_ram_fs] config_of_app { + } + +append config_of_app { - + } + +append_if [expr $use_ram_fs] config_of_app { + + + + } + +append config_of_app { @@ -244,6 +227,12 @@ set config_of_app { source ${genode_dir}/repos/ports/run/virtualbox_auto.inc +exec tar cfv bin/bash.tar -h -C bin/bash . +exec tar cfv bin/coreutils.tar -h -C bin/coreutils . +exec cp ${genode_dir}/repos/ports/run/vm_auto_share.vbox bin/. + +build_boot_image $boot_modules + # # Step 2: Read out TCP/IP address of tcp_terminal running on Genode target # @@ -256,6 +245,8 @@ regexp {[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $serial_ip_addr serial_ip_addr # # Step 3: Wait until Windows is up for sure # + + run_genode_until {\[init -\> vbox\].*Guest Additions capability report:.*seamless: yes, hostWindowMapping: no, graphics: yes} 300 $serial_id @@ -292,7 +283,7 @@ puts $noux_id "sleep 5" puts $noux_id "done" # Wait until VM signaled shutdown state -run_genode_until {\[init -\> vbox\].*Changing the VM state from 'POWERING_OFF' to 'OFF'} 120 $serial_id +run_genode_until {\[init -\> vbox\] EMT PDMR3PowerOff: .* ns run time} 120 $serial_id # SHA1 of copied file puts $noux_id "sha1sum to/test.bin" @@ -305,6 +296,7 @@ run_genode_until {[[:xdigit:]]+ to/test\.bin} 50 $noux_id foreach pkg {bash coreutils} { exec rm -f bin/$pkg.tar } exec rm -f bin/test.bin exec rm -f bin/template.bat +exec rm -f bin/vm_auto_share.vbox # diff --git a/repos/ports/run/vm_auto_disk.vbox b/repos/ports/run/vm_auto_disk.vbox new file mode 100644 index 0000000000..ad7ca024d7 --- /dev/null +++ b/repos/ports/run/vm_auto_disk.vbox @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/ports/run/vm_auto_share.vbox b/repos/ports/run/vm_auto_share.vbox new file mode 100644 index 0000000000..9c27e60bbe --- /dev/null +++ b/repos/ports/run/vm_auto_share.vbox @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/ports/src/virtualbox/autotest/main.cc b/repos/ports/src/virtualbox/autotest/main.cc deleted file mode 100644 index d4c16d6155..0000000000 --- a/repos/ports/src/virtualbox/autotest/main.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -#include -#include -#include - -static char buf[128 * 1024]; - -int main(int argc, char **argv) -{ - using Genode::printf; - - int res = unlink("/ram/overlay.vdi"); - printf("unlink result %d\n", res); - - int fd_src = open("/ram/overlay-original.vdi", O_RDONLY); - int fd_dst = creat("/ram/overlay.vdi", O_CREAT); - size_t len, sum = 0; - - printf("fd_src %d fd_dst %d\n", fd_src, fd_dst); - if (fd_src < 0 || fd_dst < 0) - return 1; - - while ((len = read(fd_src, buf, sizeof(buf))) > 0) { - while (len) { - ssize_t written = write(fd_dst, buf, len); - len -= written; - sum += written; - - if (written > 0 && len >= 0) - continue; - - PERR("could not write whole file - %zu %zu %d\n", - sum, written, errno); - return -1; - } - } - close(fd_src); - close(fd_dst); - - printf("wrote %zu bytes to overlay.vdi - res=%zu\n", sum, len); - printf("vbox_auto_test_helper is done.\n"); - return 0; -} diff --git a/repos/ports/src/virtualbox/autotest/target.mk b/repos/ports/src/virtualbox/autotest/target.mk deleted file mode 100644 index 7bd7872327..0000000000 --- a/repos/ports/src/virtualbox/autotest/target.mk +++ /dev/null @@ -1,3 +0,0 @@ -TARGET = vbox-auto-test-helper -SRC_CC = main.cc -LIBS = libc diff --git a/repos/ports/src/virtualbox/cxx_dummies.cc b/repos/ports/src/virtualbox/cxx_dummies.cc deleted file mode 100644 index 317dfdd121..0000000000 --- a/repos/ports/src/virtualbox/cxx_dummies.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * \brief Dummy implementations of symbols needed by VirtualBox - * \author Norman Feske - * \date 2013-08-22 - */ - -/* - * Copyright (C) 2013 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include - -/* VirtualBox includes */ -#include - -#define CXX_DUMMY(retval, signature) \ -int signature { \ - PDBG( #signature " called, not implemented"); \ - for (;;); \ - return retval; \ -} - -#define CHECKED_CXX_DUMMY(retval, signature) \ -int signature { \ - PINF( #signature " called, not implemented"); \ - return retval; \ -} - -CXX_DUMMY(-1, VMMR3InitCompleted(VM*, VMINITCOMPLETED)) -CXX_DUMMY(-1, VMMR3InitR0(VM*)) -CXX_DUMMY(-1, VMMR3InitRC(VM*)) -CXX_DUMMY(-1, VMMR3Init(VM*)) -CXX_DUMMY(-1, VMMR3Relocate(VM*, long long)) -CXX_DUMMY(-1, VMMR3Term(VM*)) -CXX_DUMMY(-1, PGMR3InitCompleted(VM*, VMINITCOMPLETED)) -CXX_DUMMY(-1, PGMNotifyNxeChanged(VMCPU*, bool)) -CXX_DUMMY(-1, VMMR3SendSipi(VM*, unsigned int, unsigned int)) -CXX_DUMMY(-1, VMMR3SendInitIpi(VM*, unsigned int)) -CXX_DUMMY(-1, VMMR3EmtRendezvousFF(VM*, VMCPU*)) -CXX_DUMMY(-1, VMMR3YieldStop(VM*)) -CXX_DUMMY(-1, VMMR3EmtRendezvousSetDisabled(VMCPU*, bool)) diff --git a/repos/ports/src/virtualbox/devices.cc b/repos/ports/src/virtualbox/devices.cc index f219d3e4ff..ecef667d83 100644 --- a/repos/ports/src/virtualbox/devices.cc +++ b/repos/ports/src/virtualbox/devices.cc @@ -21,8 +21,6 @@ extern "C" int VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version) { - PDBG("VBoxDevicesRegister called"); - int rc = 0; /* pcarch */ diff --git a/repos/ports/src/virtualbox/drivers.cc b/repos/ports/src/virtualbox/drivers.cc index 2b7f393c29..3e8314f069 100644 --- a/repos/ports/src/virtualbox/drivers.cc +++ b/repos/ports/src/virtualbox/drivers.cc @@ -20,8 +20,6 @@ extern "C" int VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version) { - PDBG("VBoxDriversRegister called"); - PDMDRVREG const *drvs[] = { &g_DrvKeyboardQueue, &g_DrvMouseQueue, diff --git a/repos/ports/src/virtualbox/dummies.cc b/repos/ports/src/virtualbox/dummies.cc index 93b26b4b20..22d6177679 100644 --- a/repos/ports/src/virtualbox/dummies.cc +++ b/repos/ports/src/virtualbox/dummies.cc @@ -5,295 +5,188 @@ */ /* - * Copyright (C) 2013 Genode Labs GmbH + * Copyright (C) 2013-2014 Genode Labs GmbH * * This file is distributed under the terms of the GNU General Public License * version 2. */ #include -#include -#include +#include /* libc memcpy */ -#include -#include +#include "VMMInternal.h" +#include "EMInternal.h" +#include "PDMInternal.h" -extern "C" { +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#define DUMMY(retval, name) \ -int name(void) { \ - PDBG( #name " called, not implemented, eip=%p", __builtin_return_address(0)); \ - for (;;); \ - return retval; \ +#include "util.h" + +static const bool trace = false; + +#define TRACE(retval) \ + { \ + if (trace) \ + PDBG("called, return dummy, eip=%p", \ + __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; + + PDBG("called - not implemented - 0x%p+%0zx protect %x - '%s'", + pv, cb, fProtect, type); + + return VINF_SUCCESS; } -#define CHECKED_DUMMY(TYPE, retval, name) \ -TYPE name(void) { \ - PINF( #name " called, not implemented, eip=%p", __builtin_return_address(0)); \ - return retval; \ + +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); } -CHECKED_DUMMY(int, 0, cpumR3DbgInit) -CHECKED_DUMMY(int, 0, DBGFR3Init) /* debugger */ -DUMMY(-1, DBGFR3CoreWrite) -CHECKED_DUMMY(int, 0, FTMR3Init) /* fault tolerance manager */ -CHECKED_DUMMY(int, 0, pdmR3LdrInitU) /* module loader of pluggable device manager */ -CHECKED_DUMMY(int, 0, PDMR3LdrLoadVMMR0U) /* pretend to have successfully loaded the r0 module */ -CHECKED_DUMMY(int, 0, pdmR3LoadR3U) -CHECKED_DUMMY(int, 0, pthread_atfork) -CHECKED_DUMMY(int, 0, pthread_attr_setdetachstate) -CHECKED_DUMMY(int, 0, pthread_attr_setstacksize) -CHECKED_DUMMY(int, 0, RTMemProtect) -CHECKED_DUMMY(int, 0, SELMR3Init) /* selector manager - GDT handling */ -CHECKED_DUMMY(int, 0, sigfillset) -CHECKED_DUMMY(int, 0, vmmR3SwitcherInit) /* world switcher */ -CHECKED_DUMMY(int, -1, atexit) -CHECKED_DUMMY(pid_t, -1, getpid) -CHECKED_DUMMY(char *, (char *)-1, pdmR3FileR3) -CHECKED_DUMMY(char *, nullptr, setlocale) -CHECKED_DUMMY(int, -1, sigaddset) -CHECKED_DUMMY(int, -1, sigemptyset) -CHECKED_DUMMY(int, -1, siginterrupt) -CHECKED_DUMMY(int, -1, sysctl) -DUMMY( 0, RTErrCOMGet) -void CPUMPushHyper() { } /* called by 'VMMR3InitRC', but we don't use GC */ -DUMMY(-1, DBGCRegisterCommands) -DUMMY(-1, DBGFR3Event) -DUMMY(-1, DBGFR3EventAssertion) -DUMMY(-1, DBGFR3EventBreakpoint) -DUMMY(-1, DBGFR3EventSrc) -CHECKED_DUMMY(int, 0, DBGFR3EventSrcV) -void DBGFR3Relocate() { } -DUMMY(-1, DBGFR3Term) -DUMMY(-1, DBGFR3VMMForcedAction) - -CHECKED_DUMMY(int, -4, DBGFR3AsSymbolByAddr) /* -4 == VERR_INVALID_HANDLE */ - -DUMMY(-1, _flockfile) - -int FTMR3SetCheckpoint() { return -1; } -DUMMY(-1, FTMR3Term) -int FTMSetCheckpoint() { return 0; } -DUMMY(-1, _funlockfile) -DUMMY(-1, _fwalk) - -DUMMY(-1, HWACCMInvalidatePage) -DUMMY(-1, HWACCMFlushTLB) -DUMMY(-1, HWACCMR3EmulateIoBlock) -DUMMY(-1, HWACCMR3PatchTprInstr) -DUMMY(-1, HWACCMR3CheckError) -DUMMY(-1, HWACCMR3RestartPendingIOInstr) -void HWACCMR3Relocate() { } -void HWACCMR3Reset() { } -DUMMY(-1, HWACCMR3Term) -DUMMY(-1, HWACMMR3EnablePatching) -DUMMY(-1, HWACMMR3DisablePatching) - -CHECKED_DUMMY(int, 0, IEMR3Init) /* interpreted execution manager (seems to be just a skeleton) */ -void IEMR3Relocate() { } -DUMMY(-1, IEMR3Term) - -DUMMY(-1, MMHyperR0ToCC) -DUMMY(-1, MMHyperR0ToR3) -DUMMY(-1, MMHyperRCToCC) -DUMMY(-1, MMHyperRCToR3) -CHECKED_DUMMY(RTGCPTR, 0, MMHyperGetArea) - -DUMMY(-1, MMR3HeapAPrintfV) -CHECKED_DUMMY(int, 0, MMR3HyperInitFinalize) -CHECKED_DUMMY(int, 0, MMR3HyperSetGuard) -DUMMY(-1, MMR3LockCall) -DUMMY(-1, MMR3Term) -DUMMY(-1, MMR3TermUVM) -DUMMY(-1, PDMR3AsyncCompletionTemplateCreateDriver) -DUMMY(-1, PDMR3LdrGetInterfaceSymbols) -void PDMR3LdrRelocateU() { } -DUMMY(-1, pdmR3LdrTermU) - -DUMMY(-1, PGMNotifyNxeChanged) -DUMMY(-1, PGMPhysGCPtr2GCPhys) -DUMMY(-1, PGMPhysSimpleReadGCPhys) -DUMMY(-1, PGMPhysSimpleReadGCPtr) -DUMMY(-1, PGMPhysSimpleWriteGCPtr) -DUMMY(-1, PGMSyncCR3) - -CHECKED_DUMMY(int, 0, PGMR3CheckIntegrity) -CHECKED_DUMMY(int, 0, PGMR3FinalizeMappings) -CHECKED_DUMMY(int, 0, PGMR3InitCompleted) -CHECKED_DUMMY(int, 0, PGMR3InitDynMap) /* reserve space for "dynamic mappings" */ -CHECKED_DUMMY(int, 0, PGMR3InitFinalize) - -DUMMY(-1, PGMR3SharedModuleCheckAll) -DUMMY(-1, PGMR3SharedModuleUnregister) -DUMMY(-1, PGMR3SharedModuleRegister) -DUMMY(-1, PGMR3MappingsUnfix) -DUMMY(-1, PGMR3PhysChangeMemBalloon) -DUMMY(-1, PGMR3MappingsFix) -DUMMY(-1, PGMR3MappingsDisable) -DUMMY(-1, PGMR3LockCall) -DUMMY(-1, PGMR3PhysAllocateHandyPages) -DUMMY(-1, PGMR3PhysAllocateLargeHandyPage) -DUMMY(-1, PGMR3PhysChunkMap) -DUMMY(-1, PGMR3PhysGCPhys2CCPtrExternal) -DUMMY(-1, PGMR3PhysGCPhys2CCPtrReadOnlyExternal) -DUMMY(-1, PGMR3PhysMMIO2Deregister) -DUMMY(-1, PGMR3PhysMMIO2MapKernel) -DUMMY(-1, PGMR3PhysReadU16) -DUMMY(-1, PGMR3PhysReadU64) -DUMMY(-1, PGMR3PhysRomProtect) -DUMMY(-1, PGMR3PoolGrow) -void PGMR3Relocate() {} -DUMMY(-1, PGMR3ResetCpu) -DUMMY(-1, PGMR3Term) - -DUMMY(-1, PGMPrefetchPage) -DUMMY(-1, PGMGstGetPage) -DUMMY(-1, PGMGstIsPagePresent) -DUMMY(-1, PGMShwMakePageReadonly) -DUMMY(-1, PGMShwMakePageNotPresent) -DUMMY(-1, PGMPhysIsGCPhysNormal) -DUMMY(-1, PGMHandlerVirtualChangeInvalidateCallback) -DUMMY(-1, PGMSetLargePageUsage) -DUMMY(-1, PGMPhysSimpleDirtyWriteGCPtr) -DUMMY(-1, PGMGetShadowMode) -DUMMY(-1, PGMGetHostMode) -CHECKED_DUMMY(int, 0, PGMGetGuestMode) /* PGMMODE_INVALID == 0 */ -int PGMChangeMode() { return 0; } - -CHECKED_DUMMY(int, 0, poll) /* needed by 'DrvHostSerial.cpp' */ -DUMMY(-1, pthread_key_delete) -DUMMY(-1, RTMemExecFree) -DUMMY(-1, RTMemPageFree) -DUMMY(-1, RTPathAppend) -DUMMY(-1, RTSemEventWaitEx) - -CHECKED_DUMMY(int, 0, SELMR3InitFinalize) -void SELMR3Relocate() { } -void SELMR3DisableMonitoring () { } -void SELMR3Reset() { } -DUMMY(-1, SELMR3Term) -DUMMY(-1, SELMR3GetSelectorInfo) - -DUMMY(-1, libc_select_notify) /* needed for libc_terminal plugin */ -DUMMY(-1, DISInstrToStrEx) - -DUMMY(-1, strcat) -DUMMY(-1, strerror) -DUMMY(-1, strpbrk) - -CHECKED_DUMMY(int, 0, SUPR3SetVMForFastIOCtl) -DUMMY(-1, SUPR3HardenedLdrLoadPlugIn) -DUMMY(-1, SUPR3Term) - -uint32_t SUPSemEventMultiGetResolution() -{ return 100000*10; /* called by 'vmR3HaltGlobal1Init' */ } - -DUMMY(-1, VMMR3FatalDump) -void vmmR3SwitcherRelocate() { } -DUMMY(-1, VMMR3GetHostToGuestSwitcher) - -DUMMY(-1, pthread_kill) -DUMMY(-1, sscanf) -DUMMY(-1, RTHeapSimpleRelocate) -DUMMY(-1, RTHeapSimpleAlloc) -DUMMY(-1, RTHeapSimpleInit) -DUMMY(-1, RTHeapSimpleFree) -DUMMY(-1, RTAvloU32Get) -DUMMY(-1, RTAvloU32Remove) -DUMMY(-1, RTAvloU32GetBestFit) -CHECKED_DUMMY(void *, nullptr, RTAvloU32RemoveBestFit) -DUMMY(-1, RTAvlU32Destroy) -DUMMY(-1, RTAvlU32GetBestFit) -DUMMY(-1, RTAvloU32DoWithAll) -DUMMY(-1, RTAvloU32Insert) -DUMMY(-1, RTAvlU32Get) -DUMMY(-1, RTAvlU32DoWithAll) -DUMMY(-1, RTAvlU32Insert) - -CHECKED_DUMMY(int, 0, IOMR3Init) -int IOMR3IOPortRegisterR0() { return 0; } -int IOMR3IOPortRegisterRC() { return 0; } -CHECKED_DUMMY(int, 0, IOMR3MmioRegisterR0) -CHECKED_DUMMY(int, 0, IOMR3MmioRegisterRC) -void IOMR3Relocate() { } -void IOMR3Reset() { } -DUMMY(-1, IOMR3Term) - -DUMMY(-1, IOMInterpretOUT) -DUMMY(-1, IOMInterpretOUTS) -DUMMY(-1, IOMInterpretIN) -DUMMY(-1, IOMInterpretINS) +/* 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) -DUMMY(-1, DISInstrToStrWithReader) +/* called by 'VMMR3InitRC', but we don't use GC */ +int cpumR3DbgInit(PVM) TRACE(VINF_SUCCESS) +void CPUMPushHyper(PVMCPU, uint32_t) TRACE() -DUMMY(-1, RTFileQueryFsSizes) +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() -DUMMY(-1, pthread_mutex_timedlock) +/* debugger */ +void DBGFR3PowerOff(PVM pVM) TRACE() +int DBGFR3DisasInstrCurrent(PVMCPU, char *, uint32_t) TRACE(VINF_SUCCESS) -CHECKED_DUMMY(int, 0, PGMHandlerVirtualDeregister) /* XXX */ -CHECKED_DUMMY(int, 0, PGMR3HandlerVirtualRegister) /* XXX */ +int vmmR3SwitcherInit(PVM pVM) TRACE(VINF_SUCCESS) +void vmmR3SwitcherRelocate(PVM, RTGCINTPTR) TRACE() +int VMMR3DisableSwitcher(PVM) TRACE(VINF_SUCCESS) -/* - * Dummies added for storage - */ -DUMMY(-1, RTAvlrFileOffsetDestroy) -DUMMY(-1, RTAvlrFileOffsetGet) -DUMMY(-1, RTAvlrFileOffsetGetBestFit) -DUMMY(-1, RTAvlrFileOffsetInsert) -DUMMY(-1, RTAvlrFileOffsetRemove) -DUMMY(-1, RTAvlrU64Destroy) -DUMMY(-1, RTAvlrU64DoWithAll) -DUMMY(-1, RTAvlrU64GetBestFit) -DUMMY(-1, RTAvlrU64Insert) -DUMMY(-1, RTAvlrU64RangeGet) -DUMMY(-1, RTAvlrU64RangeRemove) -DUMMY(-1, RTAvlrU64Remove) -DUMMY(-1, RTLdrClose) -DUMMY(-1, RTMemDupExTag) -DUMMY(-1, rtPathRootSpecLen) -DUMMY(-1, RTPathStartsWithRoot) -DUMMY(-1, RTSocketToNative) -DUMMY(-1, RTStrCatP) -DUMMY(-1, RTTcpClientCloseEx) -DUMMY(-1, RTTcpClientConnect) -DUMMY(-1, RTTcpFlush) -DUMMY(-1, RTTcpGetLocalAddress) -DUMMY(-1, RTTcpGetPeerAddress) -DUMMY(-1, RTTcpRead) -DUMMY(-1, RTTcpReadNB) -DUMMY(-1, RTTcpSelectOne) -DUMMY(-1, RTTcpSelectOneEx) -DUMMY(-1, RTTcpSetSendCoalescing) -DUMMY(-1, RTTcpSgWrite) -DUMMY(-1, RTTcpSgWriteNB) -DUMMY(-1, RTTcpWrite) -DUMMY(-1, RTTcpWriteNB) -DUMMY(-1, RTTimeLocalExplode) +int emR3InitDbg(PVM pVM) TRACE(VINF_SUCCESS) -DUMMY(-1, RTSymlinkCreate) -DUMMY(-1, RTSymlinkRead) -DUMMY(-1, RTSymlinkDelete) +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) -DUMMY(-1, RTNetIPv6PseudoChecksumEx) +int IEMR3Init(PVM) TRACE(VINF_SUCCESS) +int IEMR3Term(PVM) TRACE(VINF_SUCCESS) +void IEMR3Relocate(PVM) TRACE() -CHECKED_DUMMY(int, 0, futimes) -CHECKED_DUMMY(int, 0, lutimes) +void HMR3Relocate(PVM) TRACE() +void HMR3Reset(PVM pVM) TRACE() -int __isthreaded; +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 sigprocmask() { return 0; } -int _sigprocmask() { return 0; } +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 PGMFlushTLB() { return 0; } -int PGMInvalidatePage() { return 0; } /* seems to be needed on raw mode only */ -int PGMHandlerPhysicalPageTempOff() { return 0; } +int SUPR3SetVMForFastIOCtl(PVMR0) TRACE(VINF_SUCCESS) -bool PGMIsLockOwner() { return false; } /* assertion in EMRemLock */ -bool IOMIsLockOwner() { return false; } /* XXX */ +_AVLOU32NodeCore* RTAvloU32RemoveBestFit(PAVLOU32TREE, AVLOU32KEY, bool) TRACE(VINF_SUCCESS) +int RTAvlrFileOffsetDestroy(PAVLRFOFFTREE, PAVLRFOFFCALLBACK, void*) TRACE(VINF_SUCCESS) -int MMHyperIsInsideArea() { return 0; } /* used by dbgfR3DisasInstrRead */ -void PGMPhysReleasePageMappingLock() { } -} /* extern "C" */ +/* 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) + PDBG("file %s %s %p", file, pv, __builtin_return_address(0)); + + TRACE(pv) +} + +RT_C_DECLS_END diff --git a/repos/ports/src/virtualbox/dynlib.cc b/repos/ports/src/virtualbox/dynlib.cc index 2aff8f9dd7..ad846b59c3 100644 --- a/repos/ports/src/virtualbox/dynlib.cc +++ b/repos/ports/src/virtualbox/dynlib.cc @@ -29,7 +29,7 @@ static struct shared { const char * name; const char * symbol; void * func; -} shared[] = { "/VBoxSharedFolders", VBOX_HGCM_SVCLOAD_NAME, (void *)VBoxHGCMSvcLoad }; +} shared[] = {{ "VBoxSharedFolders", VBOX_HGCM_SVCLOAD_NAME, (void *)VBoxHGCMSvcLoad }}; int RTLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod) @@ -73,4 +73,9 @@ int RTLdrGetSymbol(RTLDRMOD hLdrMod, const char *pszSymbol, void **ppvValue) return VINF_SUCCESS; } +int RTLdrClose(RTLDRMOD hLdrMod) +{ + return VINF_SUCCESS; +} + } diff --git a/repos/ports/src/virtualbox/fake_pci_vendor.patch b/repos/ports/src/virtualbox/fake_pci_vendor.patch deleted file mode 100644 index 6a69b45f70..0000000000 --- a/repos/ports/src/virtualbox/fake_pci_vendor.patch +++ /dev/null @@ -1,10 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp 2013-12-09 10:33:02.168894689 +0100 -@@ -5885,7 +5889,7 @@ - vgaR3Reset(pDevIns); - - /* The PCI devices configuration. */ -- PCIDevSetVendorId( &pThis->Dev, 0x80ee); /* PCI vendor, just a free bogus value */ -+ PCIDevSetVendorId( &pThis->Dev, 0x80ef); /* PCI vendor, just a free bogus value */ - PCIDevSetDeviceId( &pThis->Dev, 0xbeef); - PCIDevSetClassSub( &pThis->Dev, 0x00); /* VGA controller */ - PCIDevSetClassBase( &pThis->Dev, 0x03); diff --git a/repos/ports/src/virtualbox/frontend/ClientToken.h b/repos/ports/src/virtualbox/frontend/ClientToken.h new file mode 100644 index 0000000000..ce707b49bb --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/ClientToken.h @@ -0,0 +1,19 @@ + +#ifndef ____H_CLIENTTOKEN +#define ____H_CLIENTTOKEN + +#include +#include + +#include "MachineImpl.h" + +class Machine::ClientToken +{ + public: + ClientToken(const ComObjPtr &pMachine, SessionMachine *pSessionMachine); + + bool isReady(); + bool release(); + void getId(Utf8Str &strId); +}; +#endif /* !____H_CLIENTTOKEN */ diff --git a/repos/ports/src/virtualbox/frontend/ClientWatcher.h b/repos/ports/src/virtualbox/frontend/ClientWatcher.h new file mode 100644 index 0000000000..92707ddfec --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/ClientWatcher.h @@ -0,0 +1,14 @@ +#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 new file mode 100644 index 0000000000..da9ff15f0b --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/GenodeImpl.h @@ -0,0 +1,285 @@ +#ifndef ____H_GENODEIMPL +#define ____H_GENODEIMPL + +#include +#include +#include +#include +#include +#include +#include + +class Progress; +typedef Progress IProgress; + +class VirtualBoxErrorInfo; +typedef VirtualBoxErrorInfo IVirtualBoxErrorInfo; + +class IUnknown; +#include + + +#include +#include + +#include +#include +#include +#include + +class Console; + +#include "AutoCaller.h" +#include "VMMDev.h" + +#include +#include +#include + +#define TRUNKTYPE_WHATEVER "whatever" +#define TRUNKTYPE_NETFLT "netflt" +#define INTNET_MAX_NETWORK_NAME 128 +#define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS 2 + +enum INTNETTRUNKTYPE +{ + kIntNetTrunkType_WhateverNone, + kIntNetTrunkType_NetFlt, +}; + +class IHostNetworkInterface; +class IFramebufferOverlay; +class IInternalSessionControl; +class IHostUSBDevice; +class IHostUSBDeviceFilter; +class IHostVideoInputDevice; +class IVetoEvent; + +class AdditionsFacility; +class AudioAdapter; +class BandwidthControl; +class BandwidthGroup; +class BIOSSettings; +class ConsoleMouseInterface; +class Display; +class DHCPServer; +class EmulatedUSB; +class EventSource; +class Framebuffer; +class Guest; +class GuestDirectory; +class GuestFile; +class GuestFsObjInfo; +class GuestOSType; +class GuestProcess; +class GuestSession; +class Host; +class Keyboard; +class Machine; +class MachineDebugger; +class Medium; +class MediumAttachment; +class MediumFormat; +class MediumLockList; +class Mouse; +class NATEngine; +class NATNetwork; +class NetworkAdapter; +class ParallelPort; +class PCIDeviceAttachment; +class SerialPort; +class Session; +class SessionMachine; +class SharedFolder; +class Snapshot; +class StorageController; +class SystemProperties; +class Token; +class USBController; +class USBDeviceFilter; +class USBDeviceFilters; +class VBoxEvent; +class VBoxEventDesc; +class VBoxVetoEvent; +class VirtualBox; +class VRDEServer; +class VRDEServerInfo; + +class VirtualBoxErrorInfo { + + public: + HRESULT init(HRESULT aResultCode, const GUID &aIID, + const char *pcszComponent, const com::Utf8Str &strText, + IVirtualBoxErrorInfo *aNext = NULL); + HRESULT FinalConstruct() { return S_OK; } +}; + +class IStateChangedEvent +{ + public: + void get_State(MachineState_T*); +}; + +typedef AdditionsFacility IAdditionsFacility; +class IAppliance; +typedef AudioAdapter IAudioAdapter; +typedef Console IConsole; +typedef BandwidthControl IBandwidthControl; +typedef BandwidthGroup IBandwidthGroup; +typedef BIOSSettings IBIOSSettings; +typedef Display IDisplay; +typedef DHCPServer IDHCPServer; +typedef EmulatedUSB IEmulatedUSB; +typedef VBoxEvent IEvent; +typedef VBoxVetoEvent IExtraDataCanChangeEvent; +typedef EventSource IEventSource; +typedef Framebuffer IFramebuffer; +class IExtPackManager; +typedef Guest IGuest; +typedef GuestDirectory IGuestDirectory; +typedef GuestFile IGuestFile; +typedef GuestFsObjInfo IGuestFsObjInfo; +typedef GuestProcess IGuestProcess; +typedef GuestSession IGuestSession; +typedef GuestOSType IGuestOSType; +typedef Host IHost; +typedef Keyboard IKeyboard; +typedef Machine IMachine; +typedef MachineDebugger IMachineDebugger; +typedef Medium IMedium; +typedef MediumAttachment IMediumAttachment; +typedef Mouse IMouse; +typedef NetworkAdapter INetworkAdapter; +typedef NATEngine INATEngine; +typedef NATNetwork INATNetwork; +typedef ParallelPort IParallelPort; +class IPerformanceCollector; +typedef SerialPort ISerialPort; +typedef Session ISession; +typedef SharedFolder ISharedFolder; +typedef Snapshot ISnapshot; +typedef StorageController IStorageController; +typedef SystemProperties ISystemProperties; +typedef Token IToken; +typedef USBController IUSBController; +class IUSBDevice; +typedef USBDeviceFilter IUSBDeviceFilter; +typedef USBDeviceFilters IUSBDeviceFilters; +typedef VirtualBox IVirtualBox; +typedef VRDEServer IVRDEServer; +typedef VRDEServerInfo IVRDEServerInfo; +typedef PCIDeviceAttachment IPCIDeviceAttachment; +typedef SessionMachine IInternalMachineControl; + +class IVirtualSystemDescription; + +class IEventListener { + + public: + + HRESULT HandleEvent(IEvent * aEvent); +/* + { + VBoxEventType_T aType = VBoxEventType_Invalid; + aEvent->COMGETTER(Type)(&aType); + return mListener->HandleEvent(aType, aEvent); + } +*/ + }; + +template +class DummyClass { + public: + void AddRef() { } + void Release() { } + + void fireNATRedirectEvent(const ComObjPtr&, BSTR, ULONG&, bool&, short unsigned int*&, NATProtocol_T&, short unsigned int*&, uint16_t&, short unsigned int*&, uint16_t&); + void fireNATNetworkChangedEvent(const ComObjPtr&, short unsigned int*&); + void fireNATNetworkStartStopEvent(const ComObjPtr&, short unsigned int*&, BOOL&); + void fireNATNetworkSettingEvent(const ComObjPtr&, short unsigned int*&, BOOL&, short unsigned int*&, short unsigned int*&, BOOL&, BOOL&); + void fireNATNetworkPortForwardEvent(const ComObjPtr&, short unsigned int*&, BOOL&, BOOL&, short unsigned int*&, NATProtocol_T&, short unsigned int*&, LONG&, short unsigned int*&, LONG&); + void fireHostNameResolutionConfigurationChangeEvent(const ComObjPtr&); + void fireHostPCIDevicePlugEvent(ComPtr&, BSTR, bool, bool, ComObjPtr&, void *); + void fireStateChangedEvent(const ComObjPtr&, MachineState_T); + void fireRuntimeErrorEvent(const ComObjPtr&, BOOL&, short unsigned int*&, short unsigned int*&); +}; + +#define ATL_NO_VTABLE +#define DECLARE_CLASSFACTORY() +#define VBOX_SCRIPTABLE_IMPL(X) public DummyClass +#define DECLARE_NOT_AGGREGATABLE(X) + +#define DECLARE_REGISTRY_RESOURCEID(X) +#define DECLARE_PROTECT_FINAL_CONSTRUCT(Y) +#define DECLARE_CLASSFACTORY_SINGLETON(X) + +#define BEGIN_COM_MAP(X) +#define VBOX_DEFAULT_INTERFACE_ENTRIES(X) +#define COM_INTERFACE_ENTRY(X) +#define COM_INTERFACE_ENTRY2(X,Y) +#define END_COM_MAP() + +#define DECLARE_EMPTY_CTOR_DTOR(X) public: X(); ~X(); +#define DEFINE_EMPTY_CTOR_DTOR(X) X::X() {} X::~X() {} + +#define STDMETHODIMP HRESULT +#define STDMETHOD(X) virtual HRESULT X + +#define Q_OBJECT + +#include "BusAssignmentManager.h" + +#include "MediumFormatImpl.h" +typedef MediumFormat IMediumFormat; + +typedef struct sdfkkd { } VRDEUSBDEVICEDESC; +typedef struct sdfsdf3 { } VBOXGUESTCTRLHOSTCBCTX, *PVBOXGUESTCTRLHOSTCBCTX; +typedef struct sdffsd2 { } VBOXGUESTCTRLHOSTCALLBACK, *PVBOXGUESTCTRLHOSTCALLBACK; +typedef struct IFsObjInfo { } IFsObjInfo; + +#include "AdditionsFacilityImpl.h" +#include "BIOSSettingsImpl.h" +#include "EventImpl.h" +#include "FramebufferImpl.h" +#include "PCIDeviceAttachmentImpl.h" +#include "GuestImpl.h" +#include "GuestDirectoryImpl.h" +#include "GuestFsObjInfoImpl.h" +#include "GuestProcessImpl.h" +#include "GuestSessionImpl.h" +#include "NetworkServiceRunner.h" +#include "SnapshotImpl.h" +#include "ParallelPortImpl.h" +#include "MediumAttachmentImpl.h" +#include "StorageControllerImpl.h" +#include "USBControllerImpl.h" +#include "SerialPortImpl.h" + +#include "NATEngineImpl.h" +#include "NetworkAdapterImpl.h" +#include "ProgressImpl.h" +#include "VRDEServerImpl.h" +#include "GuestOSTypeImpl.h" +#include "DHCPServerImpl.h" +#include "SystemPropertiesImpl.h" +#include "KeyboardImpl.h" +#include "DisplayImpl.h" +#include "NATNetworkImpl.h" +#include "VRDEServerImpl.h" +#include "MediumImpl.h" +#include "SessionImpl.h" +#include "HostImpl.h" + +class VRDEServerInfo { }; +class EmulatedUSB { }; + +class ConsoleVRDPServer +{ + public: + void SendResize (void) {} + void SendUpdate (unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate) const; + void SendUpdateBitmap (unsigned uScreenId, uint32_t x, uint32_t y, uint32_t w, uint32_t h) const; + void Stop(); +}; + +#endif // !____H_GENODEIMPL diff --git a/repos/ports/src/virtualbox/frontend/MediumFormatWrap.h b/repos/ports/src/virtualbox/frontend/MediumFormatWrap.h new file mode 100644 index 0000000000..b885b051e4 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/MediumFormatWrap.h @@ -0,0 +1,10 @@ +#include "VirtualBoxBase.h" + +class MediumFormatWrap : public VirtualBoxBase, public DummyClass { + + public: + virtual const char* getComponentName() const + { + return "MediumFormatWrap"; + } +}; diff --git a/repos/ports/src/virtualbox/frontend/TokenWrap.h b/repos/ports/src/virtualbox/frontend/TokenWrap.h new file mode 100644 index 0000000000..a3dff56cd9 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/TokenWrap.h @@ -0,0 +1,22 @@ +#include "VirtualBoxBase.h" + +class Token : public VirtualBoxBase +{ + public: + virtual HRESULT abandon(AutoCaller &aAutoCaller) = 0; + + HRESULT Abandon() { + AutoCaller autoCaller(this); + abandon(autoCaller); + return S_OK; + } + + virtual const char* getComponentName() const + { + return "Token"; + } +}; + +class TokenWrap : public Token +{ +}; diff --git a/repos/ports/src/virtualbox/frontend/VBoxEvents.h b/repos/ports/src/virtualbox/frontend/VBoxEvents.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h b/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h new file mode 100644 index 0000000000..d32247db12 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/VirtualBoxBase.h @@ -0,0 +1,448 @@ +#ifndef ____H_VIRTUALBOXBASEIMPL +#define ____H_VIRTUALBOXBASEIMPL + +#include + +#include +#include + +#include +#include + +#include "VBox/com/defs.h" +#include "VBox/com/ptr.h" +#include "VBox/com/string.h" + +#include "VBox/com/AutoLock.h" + + +namespace com +{ + class ErrorInfo; +} + +using namespace com; +using namespace util; + +class Medium; + +typedef std::list > MediaList; +typedef std::list StringsList; + +class VirtualBoxBase : public util::Lockable { + + 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; + + /* should be used for translations */ + inline static const char *tr(const char *pcszSourceText, + const char *aComment = NULL) + { + return pcszSourceText; + } + + static HRESULT handleUnexpectedExceptions(VirtualBoxBase *const aThis, RT_SRC_POS_DECL); + static HRESULT initializeComForThread(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; +}; + +template +class Shareable { + + private: + + bool _verbose; + T * _obj; + + public: + + Shareable () : _verbose(false), _obj(nullptr) { } + + /* operators */ + T * operator->() const { if (_verbose) PDBG("called"); return _obj; } + + bool isNull() const { return _obj == nullptr; } + bool operator!() const { return isNull(); } + + void allocate() { if (_verbose) PDBG("called %p %u", __builtin_return_address(0), sizeof(*_obj)); _obj = new T; } + void attach(T * t) { if (_verbose) PDBG("called"); } + void attach(Shareable &s) { if (_verbose) PDBG("called"); } + void share(const Shareable &s) { if (_verbose) PDBG("called"); _obj = s._obj; } + void share(T * obj) { if (_verbose) PDBG("called"); _obj = obj; } + void free() { if (_verbose) PDBG("called"); } + void attachCopy(const T *) { if(_verbose) PDBG("called"); } + void attachCopy(const Shareable &) { if (_verbose)PDBG("called"); } + + T *data() const { if (_verbose) PDBG("called"); return _obj; } + + bool isShared() const { if (_verbose) PDBG("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 { PDBG("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 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 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.h b/repos/ports/src/virtualbox/frontend/VirtualBoxErrorInfoImpl.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/repos/ports/src/virtualbox/frontend/VirtualBoxImpl.h b/repos/ports/src/virtualbox/frontend/VirtualBoxImpl.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/repos/ports/src/virtualbox/frontend/console.cc b/repos/ports/src/virtualbox/frontend/console.cc new file mode 100644 index 0000000000..493fb345ff --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/console.cc @@ -0,0 +1,118 @@ +#include + +#include + +#include "ConsoleImpl.h" +#include "MachineImpl.h" + +static const bool debug = false; + +#define DUMMY(X) \ + { \ + PERR("%s called (%s), not implemented, eip=%p", __func__, __FILE__, \ + __builtin_return_address(0)); \ + while (1) \ + asm volatile ("ud2a"); \ + \ + return X; \ + } + +#define TRACE(X) \ + { \ + if (debug) \ + PDBG(" called (%s) - eip=%p", __FILE__, \ + __builtin_return_address(0)); \ + return X; \ + } + +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() +void Console::changeClipboardMode(ClipboardMode_T aClipboardMode) DUMMY() +HRESULT Console::updateMachineState(MachineState_T aMachineState) DUMMY(E_FAIL) + +HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter) +{ + HRESULT rc = S_OK; + + ULONG slot = 0; + rc = networkAdapter->COMGETTER(Slot)(&slot); + AssertComRC(rc); + + maTapFD[slot] = (RTFILE)1; + + TRACE(S_OK) +} + +HRESULT Console::teleporterTrg(UVM*, Machine*, com::Utf8Str*, bool, Progress*, + bool*) DUMMY(E_FAIL) +HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter) DUMMY(E_FAIL) +HRESULT Console::saveState(Reason_T aReason, IProgress **aProgress) DUMMY(E_FAIL) +HRESULT Console::get_Debugger(MachineDebugger**) DUMMY(E_FAIL) +HRESULT Console::get_USBDevices(unsigned int*, IUSBDevice***) DUMMY(E_FAIL) +HRESULT Console::get_RemoteUSBDevices(unsigned int*, IHostUSBDevice***) DUMMY(E_FAIL) +HRESULT Console::get_VRDEServerInfo(VRDEServerInfo**) DUMMY(E_FAIL) +HRESULT Console::get_SharedFolders(unsigned int*, SharedFolder***) DUMMY(E_FAIL) +HRESULT Console::get_AttachedPCIDevices(unsigned int*, PCIDeviceAttachment***) DUMMY(E_FAIL) +HRESULT Console::get_UseHostClipboard(bool*) DUMMY(E_FAIL) +HRESULT Console::set_UseHostClipboard(bool) DUMMY(E_FAIL) +HRESULT Console::get_EmulatedUSB(EmulatedUSB**) DUMMY(E_FAIL) +HRESULT Console::Reset() DUMMY(E_FAIL) +HRESULT Console::Pause() DUMMY(E_FAIL) +HRESULT Console::Resume() DUMMY(E_FAIL) +HRESULT Console::PowerButton() 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(Progress**) DUMMY(E_FAIL) +HRESULT Console::AdoptSavedState(unsigned short*) DUMMY(E_FAIL) +HRESULT Console::DiscardSavedState(bool) DUMMY(E_FAIL) +HRESULT Console::GetDeviceActivity(DeviceType_T, DeviceActivity_T*) DUMMY(E_FAIL) +HRESULT Console::AttachUSBDevice(unsigned short*) DUMMY(E_FAIL) +HRESULT Console::DetachUSBDevice(unsigned short*, IUSBDevice**) DUMMY(E_FAIL) +HRESULT Console::FindUSBDeviceByAddress(unsigned short*, IUSBDevice**) DUMMY(E_FAIL) +HRESULT Console::FindUSBDeviceById(unsigned short*, IUSBDevice**) DUMMY(E_FAIL) +HRESULT Console::CreateSharedFolder(unsigned short*, unsigned short*, bool, + bool) DUMMY(E_FAIL) +HRESULT Console::RemoveSharedFolder(unsigned short*) DUMMY(E_FAIL) +HRESULT Console::TakeSnapshot(unsigned short*, unsigned short*, Progress**) DUMMY(E_FAIL) +HRESULT Console::DeleteSnapshot(unsigned short*, Progress**) DUMMY(E_FAIL) +HRESULT Console::DeleteSnapshotAndAllChildren(unsigned short*, Progress**) DUMMY(E_FAIL) +HRESULT Console::DeleteSnapshotRange(unsigned short*, unsigned short*, + Progress**) DUMMY(E_FAIL) +HRESULT Console::RestoreSnapshot(Snapshot*, Progress**) DUMMY(E_FAIL) +HRESULT Console::Teleport(unsigned short*, unsigned int, unsigned short*, + unsigned int, Progress**) DUMMY(E_FAIL) +HRESULT Console::setDiskEncryptionKeys(const Utf8Str &strCfg) DUMMY(E_FAIL) + +DisplayMouseInterface *Console::getDisplayMouseInterface() DUMMY(nullptr) + +void Console::onMouseCapabilityChange(BOOL, BOOL, BOOL, BOOL) TRACE() +void Console::onAdditionsStateChange() TRACE() +void Console::onAdditionsOutdated() DUMMY() +void Console::onMousePointerShapeChange(bool, bool, uint32_t, uint32_t, + uint32_t, uint32_t, + ComSafeArrayIn(uint8_t, aShape)) DUMMY() +void Console::onKeyboardLedsChange(bool, bool, bool) TRACE() +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) diff --git a/repos/ports/src/virtualbox/include/SDLConsole.h b/repos/ports/src/virtualbox/frontend/console.h similarity index 74% rename from repos/ports/src/virtualbox/include/SDLConsole.h rename to repos/ports/src/virtualbox/frontend/console.h index 57cd5e5dba..1155a87429 100644 --- a/repos/ports/src/virtualbox/include/SDLConsole.h +++ b/repos/ports/src/virtualbox/frontend/console.h @@ -1,11 +1,12 @@ /* * \brief Console implementation of VirtualBox for Genode * \author Alexander Boettcher + * \author Norman Feske * \date 2013-10-16 */ /* - * Copyright (C) 2013 Genode Labs GmbH + * Copyright (C) 2013-2014 Genode Labs GmbH * * This file is distributed under the terms of the GNU General Public License * version 2. @@ -21,7 +22,7 @@ #include /* VirtualBox includes */ -#include +#include "ConsoleImpl.h" #include /* XXX */ @@ -102,14 +103,15 @@ class Scan_code }; -class SDLConsole : public Console { +class GenodeConsole : public Console { private: - Timer::Connection timer; - Input::Connection input; - Input::Event *_ev_buf; - unsigned _ax, _ay; + Input::Connection _input; + Genode::Signal_receiver _receiver; + Genode::Signal_context _context; + Input::Event *_ev_buf; + unsigned _ax, _ay; bool _key_status[Input::KEY_MAX + 1]; @@ -122,64 +124,29 @@ class SDLConsole : public Console { public: - SDLConsole() + GenodeConsole() : Console(), - _ev_buf(static_cast(Genode::env()->rm_session()->attach(input.dataspace()))), + _ev_buf(static_cast(Genode::env()->rm_session()->attach(_input.dataspace()))), _ax(0), _ay(0) { for (unsigned i = 0; i <= Input::KEY_MAX; i++) _key_status[i] = 0; + _input.sigh(_receiver.manage(&_context)); +/* if (FAILED(gMouse->init(this))) { PERR("mouse init failed"); return; } - - mfInitialized = true; +*/ } - void updateTitlebar() + void eventWait(IKeyboard * gKeyboard, IMouse * gMouse) { - PERR("%s:%s called", __FILE__, __FUNCTION__); - } + _receiver.wait_for_signal(); - void updateTitlebarProgress(const char *, int) - { - PERR("%s:%s called", __FILE__, __FUNCTION__); - } - - void inputGrabStart() - { - PERR("%s:%s called", __FILE__, __FUNCTION__); - } - - void inputGrabEnd() - { - PERR("%s:%s called", __FILE__, __FUNCTION__); - } - - void mouseSendEvent(int) - { - PERR("%s:%s called", __FILE__, __FUNCTION__); - } - - void onMousePointerShapeChange(bool, bool, uint32_t, uint32_t, - uint32_t, uint32_t, void *) - { - PERR("%s:%s called", __FILE__, __FUNCTION__); - } - - void progressInfo(PVM, unsigned, void *) - { - PERR("%s:%s called", __FILE__, __FUNCTION__); - } - - CONEVENT eventWait() - { - while (!input.is_pending()) { timer.msleep(50); } - - for (int i = 0, num_ev = input.flush(); i < num_ev; ++i) { + for (int i = 0, num_ev = _input.flush(); i < num_ev; ++i) { Input::Event &ev = _ev_buf[i]; bool const is_press = ev.type() == Input::Event::PRESS; @@ -218,10 +185,9 @@ class SDLConsole : public Console { bool const is_mouse_event = is_mouse_button_event || is_motion; if (is_mouse_event) { - unsigned const buttons = (_key_status[Input::BTN_LEFT] ? 0x1 : 0) - | (_key_status[Input::BTN_RIGHT] ? 0x2 : 0) - | (_key_status[Input::BTN_MIDDLE] ? 0x4 : 0); - + unsigned const buttons = (_key_status[Input::BTN_LEFT] ? MouseButtonState_LeftButton : 0) + | (_key_status[Input::BTN_RIGHT] ? MouseButtonState_RightButton : 0) + | (_key_status[Input::BTN_MIDDLE] ? MouseButtonState_MiddleButton : 0); if (ev.is_absolute_motion()) { int const rx = ev.ax() - _ax; _ax = ev.ax(); int const ry = ev.ay() - _ay; _ay = ev.ay(); @@ -235,12 +201,5 @@ class SDLConsole : public Console { gMouse->PutMouseEvent(0, 0, 0, 0, buttons); } } - - return CONEVENT_NONE; } - - void eventQuit() { PERR("%s:%s called", __FILE__, __FUNCTION__); } - void resetKeys(void) { PERR("%s:%s called", __FILE__, __FUNCTION__); } - VMMDev *getVMMDev() { return gVMMDev; } - Display *getDisplay() { return gDisplay; } }; diff --git a/repos/ports/src/virtualbox/frontend/dummy/autostart.cc b/repos/ports/src/virtualbox/frontend/dummy/autostart.cc new file mode 100644 index 0000000000..b9ad43e1d1 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/dummy/autostart.cc @@ -0,0 +1,33 @@ +#include + +#include "VirtualBoxBase.h" +#include "AutostartDb.h" + +static bool debug = false; + +#define TRACE(X) \ + { \ + if (debug) \ + PDBG(" called (%s) - eip=%p", __FILE__, \ + __builtin_return_address(0)); \ + return X; \ + } + +#define DUMMY(X) \ + { \ + PERR("%s called (%s), not implemented, eip=%p", __func__, __FILE__, \ + __builtin_return_address(0)); \ + while (1) \ + asm volatile ("ud2a"); \ + \ + return X; \ + } + +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 new file mode 100644 index 0000000000..38410f23e8 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/dummy/errorinfo.cc @@ -0,0 +1,31 @@ +#include + +#include "VirtualBoxBase.h" +#include + +static bool debug = false; + +#define TRACE(X) \ + { \ + if (debug) \ + PDBG(" called (%s) - eip=%p", __FILE__, \ + __builtin_return_address(0)); \ + return X; \ + } + +#define DUMMY(X) \ + { \ + PERR("%s called (%s), not implemented, eip=%p", __func__, __FILE__, \ + __builtin_return_address(0)); \ + while (1) \ + asm volatile ("ud2a"); \ + \ + return X; \ + } + +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 new file mode 100644 index 0000000000..5cdb57ae79 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/dummy/host.cc @@ -0,0 +1,143 @@ +#include + +#include "VirtualBoxBase.h" + +static bool debug = false; + +#define TRACE(X) \ + { \ + if (debug) \ + PDBG(" called (%s) - eip=%p", __FILE__, \ + __builtin_return_address(0)); \ + return X; \ + } + +#define DUMMY(X) \ + { \ + PERR("%s called (%s:%u), not implemented, eip=%p", __func__, \ + __FILE__, __LINE__, \ + __builtin_return_address(0)); \ + while (1) \ + asm volatile ("ud2a"); \ + \ + return X; \ + } + +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 = false; + 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() DUMMY(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 *aFilter) DUMMY(E_FAIL) + +void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters) DUMMY() +#endif + +/* +void Host::getDVDInfoFromDevTree(std::list > &list) DUMMY() +bool Host::getDVDInfoFromHal(std::list > &list) DUMMY(false) +bool Host::getFloppyInfoFromHal(std::list< ComObjPtr > &list) DUMMY(false) +void Host::parseMountTable(char *mountTable, std::list< ComObjPtr > &list) DUMMY() +bool Host::validateDevice(const char *deviceNode, bool isCDROM) DUMMY(false) +HRESULT Host::checkUSBProxyService() DUMMY(E_FAIL) +HRESULT Host::updateNetIfList() DUMMY(E_FAIL) +void Host::registerDiskMetrics(PerformanceCollector *aCollector) DUMMY() +void Host::registerMetrics(PerformanceCollector *aCollector) DUMMY() +void Host::unregisterMetrics (PerformanceCollector *aCollector) DUMMY() +*/ diff --git a/repos/ports/src/virtualbox/frontend/dummy/rest.cc b/repos/ports/src/virtualbox/frontend/dummy/rest.cc new file mode 100644 index 0000000000..b8333b00c1 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/dummy/rest.cc @@ -0,0 +1,201 @@ +#include + +#include "VirtualBoxBase.h" +#include "ClientToken.h" +#include "TokenImpl.h" +#include "ProgressProxyImpl.h" +#include "SharedFolderImpl.h" + +static bool debug = false; + +#define TRACE(X) \ + { \ + if (debug) \ + PDBG(" called (%s) - eip=%p", __FILE__, \ + __builtin_return_address(0)); \ + return X; \ + } + +#define DUMMY(X) \ + { \ + PERR("%s called (%s:%u), not implemented, eip=%p", __func__, \ + __FILE__, __LINE__, \ + __builtin_return_address(0)); \ + while (1) \ + asm volatile ("ud2a"); \ + \ + return X; \ + } + +#define DUMMY_STATIC(X) \ + { \ + static X dummy; \ + PERR("%s called (%s), not implemented, eip=%p", __func__, __FILE__, \ + __builtin_return_address(0)); \ + while (1) \ + asm volatile ("ud2a"); \ + \ + return dummy; \ + } + +/* static */ +const Guid Guid::Empty; + +HRESULT IMediumFormat::get_Capabilities(unsigned int*, + MediumFormatCapabilities_T**) DUMMY(E_FAIL) + +HRESULT Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, + IVirtualSystemDescription **aDescription) DUMMY(E_FAIL) + +int DisplayMakePNG(uint8_t *, uint32_t, uint32_t, uint8_t **, uint32_t *, + uint32_t *, uint32_t *, uint8_t) DUMMY(-1) + +ProgressErrorInfo::ProgressErrorInfo(Progress*) 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) +bool ProgressProxy::setOtherProgressObject(Progress*) DUMMY(false) +HRESULT ProgressProxy::FinalConstruct() DUMMY(E_FAIL) +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) + +STDMETHODIMP ProgressProxy::WaitForCompletion(LONG aTimeout) DUMMY(E_FAIL) +STDMETHODIMP ProgressProxy::WaitForOperationCompletion(ULONG, LONG) DUMMY(E_FAIL) +STDMETHODIMP ProgressProxy::Cancel() DUMMY(E_FAIL) +STDMETHODIMP ProgressProxy::SetCurrentOperationProgress(ULONG aPercent) DUMMY(E_FAIL) +STDMETHODIMP ProgressProxy::SetNextOperation(IN_BSTR, ULONG) DUMMY(E_FAIL) + +void ProgressProxy::clearOtherProgressObjectInternal(bool fEarly) DUMMY() +void ProgressProxy::copyProgressInfo(IProgress *pOtherProgress, bool fEarly) DUMMY() +void ProgressProxy::uninit() DUMMY() +void ProgressProxy::FinalRelease() DUMMY() + +template<> +void DummyClass::fireNATRedirectEvent(ComObjPtr const&, + unsigned short*, + unsigned int&, bool&, + unsigned short*&, + NATProtocol_T&, + unsigned short*&, + unsigned short&, + unsigned short*&, + unsigned short&) DUMMY() + +template<> +void DummyClass::fireStateChangedEvent(ComObjPtr const&, + MachineState_T) TRACE() +template<> +void DummyClass::fireRuntimeErrorEvent(ComObjPtr const&, + bool&, unsigned short*&, + unsigned short*&) DUMMY() + +template<> +void DummyClass::fireHostPCIDevicePlugEvent(ComPtr&, + unsigned short*, bool, + bool, ComObjPtr&, + void*) DUMMY() + +NATNetwork::NATNetwork() : mVirtualBox(nullptr) DUMMY() +void NATNetwork::uninit() DUMMY() +HRESULT NATNetwork::init(VirtualBox *aVirtualBox, IN_BSTR aName) DUMMY(E_FAIL) +HRESULT NATNetwork::init(VirtualBox *aVirtualBox, const settings::NATNetwork &) DUMMY(E_FAIL) +HRESULT NATNetwork::FinalConstruct() DUMMY(E_FAIL) +HRESULT NATNetwork::saveSettings(settings::NATNetwork &data) DUMMY(E_FAIL) + +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 com::Shutdown() DUMMY(E_FAIL) + +void Display::fireGuestMonitorChangedEvent(EventSource*, GuestMonitorChangedEventType, int, int, int, int, int) DUMMY() + +STDMETHODIMP Guest::UpdateGuestAdditions(IN_BSTR, + ComSafeArrayIn(IN_BSTR, aArguments), + ComSafeArrayIn(AdditionsUpdateFlag_T, aFlags), + IProgress **aProgress) DUMMY(E_FAIL) +STDMETHODIMP Guest::FindSession(IN_BSTR, + ComSafeArrayOut(IGuestSession *, aSessions)) DUMMY(E_FAIL) +STDMETHODIMP Guest::CreateSession(IN_BSTR, IN_BSTR, IN_BSTR, IN_BSTR, + IGuestSession **) DUMMY(E_FAIL) + +void ConsoleVRDPServer::SendUpdate(unsigned int, void*, unsigned int) const DUMMY() +void ConsoleVRDPServer::SendUpdateBitmap(unsigned int, unsigned int, + unsigned int, unsigned int, + unsigned int) const DUMMY() +void ConsoleVRDPServer::Stop() DUMMY() + +void IStateChangedEvent::get_State(MachineState_T*) DUMMY() + +HRESULT IEventListener::HandleEvent(IEvent*) DUMMY(E_FAIL) +HRESULT SharedFolder::init(Console*, com::Utf8Str const&, com::Utf8Str const&, + bool, bool, bool) DUMMY(E_FAIL) + +Machine::ClientToken::ClientToken(const ComObjPtr &, SessionMachine *) TRACE() +bool Machine::ClientToken::isReady() TRACE(true) +void Machine::ClientToken::getId(Utf8Str &strId) +{ + strId = "ClientTokenID DUMMY"; + TRACE() +} + +HRESULT com::Initialize(bool fGui) TRACE(S_OK) + diff --git a/repos/ports/src/virtualbox/frontend/dummy/virtualboxbase.cc b/repos/ports/src/virtualbox/frontend/dummy/virtualboxbase.cc new file mode 100644 index 0000000000..cd1faf63bc --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/dummy/virtualboxbase.cc @@ -0,0 +1,58 @@ +#include + +#include "VirtualBoxImpl.h" +#include "VBox/com/MultiResult.h" + +static bool debug = false; + +#define TRACE(X) \ + { \ + if (debug) \ + PDBG(" called (%s) - eip=%p", __FILE__, \ + __builtin_return_address(0)); \ + return X; \ + } + +#define DUMMY(X) \ + { \ + PERR("%s called (%s:%u), not implemented, eip=%p", __func__, __FILE__, __LINE__, \ + __builtin_return_address(0)); \ + while (1) \ + asm volatile ("ud2a"); \ + \ + return X; \ + } + +HRESULT VirtualBoxBase::setError(HRESULT aResultCode, const char *pcsz, ...) +{ + Genode::printf(ESC_ERR); + + va_list list; + va_start(list, pcsz); + + Genode::printf("%s : %s", this->getComponentName(), + Utf8Str(pcsz, list).c_str()); + + va_end(list); + + Genode::printf(ESC_END "\n"); + + 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) + +HRESULT VirtualBoxErrorInfo::init(HRESULT, const GUID &, const char *, + const Utf8Str &, IVirtualBoxErrorInfo *) DUMMY(E_FAIL) + +HRESULT VBoxEventDesc::init(IEventSource* aSource, VBoxEventType_T aType, ...) TRACE(S_OK) +HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...) TRACE(S_OK) diff --git a/repos/ports/src/virtualbox/frontend/fb.h b/repos/ports/src/virtualbox/frontend/fb.h new file mode 100644 index 0000000000..71f38ab211 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/fb.h @@ -0,0 +1,190 @@ +/* + * \brief Virtualbox framebuffer implementation for Genode + * \author Alexander Boettcher + * \date 2013-10-16 + */ + +/* + * Copyright (C) 2013-2014 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 */ + +class Genodefb : public Framebuffer +{ + private: + + Fb_Genode::Connection _fb; + Fb_Genode::Mode const _fb_mode; + void * _fb_base; + RTCRITSECT _fb_lock; + + unsigned long _width; + unsigned long _height; + + public: + + Genodefb () + : + _fb_mode(_fb.mode()), + _fb_base(Genode::env()->rm_session()->attach(_fb.dataspace())), + _width(_fb_mode.width()), + _height(_fb_mode.height()) + { + int rc = RTCritSectInit(&_fb_lock); + Assert(rc == VINF_SUCCESS); + } + + STDMETHODIMP COMGETTER(Width)(ULONG *width) + { + if (!width) + return E_INVALIDARG; + + *width = _width; + return S_OK; + } + + STDMETHODIMP COMGETTER(Height)(ULONG *height) + { + if (!height) + return E_INVALIDARG; + + *height = _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 = _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) + { + /* clear screen to avoid artefacts during resize */ + size_t const num_pixels = _fb_mode.width() * _fb_mode.height(); + memset(_fb_base, 0, num_pixels * _fb_mode.bytes_per_pixel()); + + _fb.refresh(0, 0, _fb_mode.width(), _fb_mode.height()); + + /* bitsPerPixel == 0 is set by DevVGA when in text mode */ + bool ok = ((bitsPerPixel == 16) || (bitsPerPixel == 0)) && + (w <= (ULONG)_fb_mode.width()) && + (h <= (ULONG)_fb_mode.height()); + + if (ok) { + PINF("fb resize : %lux%lu@%zu -> %ux%u@%u", _width, _height, + _fb_mode.bytes_per_pixel() * 8, w, h, bitsPerPixel); + _width = w; + _height = h; + } else + PERR("Could not resize to %ux%u - %u bpp, %u bpl, vram %p", + w, h, bitsPerPixel, bytesPerLine, vram); + + *finished = ok; + + return S_OK; + } + + 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) (ULONG64 *winId) + { + Assert(!"FixMe"); + return S_OK; + } + + STDMETHODIMP VideoModeSupported(ULONG width, ULONG height, ULONG bpp, BOOL *supported) + { + Assert(!"FixMe"); + 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; + } +}; diff --git a/repos/ports/src/virtualbox/frontend/main.cc b/repos/ports/src/virtualbox/frontend/main.cc new file mode 100644 index 0000000000..2910de9dbc --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/main.cc @@ -0,0 +1,244 @@ +/* + * \brief Port of VirtualBox to Genode + * \author Norman Feske + * \author Alexander Boettcher + * \date 2013-08-20 + */ + +/* + * Copyright (C) 2013-2014 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 +#include +#include +#include + +/* Virtualbox includes of generic Main frontend */ +#include "ConsoleImpl.h" +#include "MachineImpl.h" +#include "MouseImpl.h" + +/* Genode port specific includes */ +#include "console.h" +#include "fb.h" + +static char c_vbox_file[128]; +static char c_vbox_vmname[128]; + + +/** + * 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 + */ +Framebuffer::Framebuffer() { } +Framebuffer::~Framebuffer() { } + +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() +{ + HRESULT rc; + + static com::Utf8Str vm_config(c_vbox_file); + static com::Utf8Str vm_name(c_vbox_vmname); + settings::MachineConfigFile * machine_config = new settings::MachineConfigFile(&vm_config); + + /* Machine object */ + ComObjPtr machine; + rc = machine.createObject(); + if (FAILED(rc)) + return rc; + + /* Virtualbox object */ + ComObjPtr virtualbox; + rc = virtualbox.createObject(); + if (FAILED(rc)) + return rc; + + rc = machine->init(virtualbox, vm_name, *machine_config); + if (FAILED(rc)) + return rc; + + rc = virtualbox->RegisterMachine(machine); + if (FAILED(rc)) + return rc; + + // open a session + ComObjPtr session; + rc = session.createObject(); + if (FAILED(rc)) + return rc; + + rc = machine->LockMachine(session, LockType_VM); + if (FAILED(rc)) + return rc; + + /* Console object */ + GenodeConsole * gConsole = new GenodeConsole(); + /* Derived from Session::AssignMachine method in Main/src-client/SessionImpl.cpp */ + static IInternalMachineControl control; + rc = control.init(machine); + if (FAILED(rc)) + return rc; + + rc = gConsole->init(machine, &control, LockType_VM); + if (FAILED(rc)) + return 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_session()->avail() >> 20; + size_t memory_vmm = 28; + + if (memory_vbox + memory_vmm > memory_genode) { + PERR("Configured memory %u MB (vbox file) is insufficient.", + memory_vbox); + PERR("%zu MB (1) - %zu MB (2) = %zu MB (3)", + memory_genode, memory_vmm, memory_genode - memory_vmm); + PERR("(1) available memory based defined by Genode config"); + PERR("(2) minimum memory required for VBox VMM"); + PERR("(3) maximal available memory to VM"); + return E_FAIL; + } + + /* Display object */ + 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(); + 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 (RT_FAILURE(rc)) + return rc; + Assert (&*gMouse); + + /* request keyboard object */ + ComPtr gKeyboard; + rc = gConsole->COMGETTER(Keyboard)(gKeyboard.asOutParam()); + if (FAILED(rc)) + return rc; + Assert (&*gKeyboard); + + /* handle input of Genode and forward it to VMM layer */ + while (true) { + gConsole->eventWait(gKeyboard, gMouse); + } + + Assert(!"return not expected"); + return E_FAIL; +} + + +int main(int argc, char **argv) +{ + try { + using namespace Genode; + + Xml_node node = config()->xml_node(); + Xml_node::Attribute vbox_file = node.attribute("vbox_file"); + vbox_file.value(c_vbox_file, sizeof(c_vbox_file)); + Xml_node::Attribute vm_name = node.attribute("vm_name"); + vm_name.value(c_vbox_vmname, sizeof(c_vbox_vmname)); + } catch (...) { + PERR("Missing attributes in configuration, minimum requirements: "); + PERR(" " ); + throw; + } + + int rc = RTR3InitExe(argc, &argv, 0); + if (RT_FAILURE(rc)) + return -1; + + HRESULT hrc = setupmachine(); + if (FAILED(hrc)) { + PERR("Start-up of VMM failed - reason %d - exiting ...", hrc); + return -2; + } + + PERR("VMM exiting ..."); + + return 0; +} diff --git a/repos/ports/src/virtualbox/frontend/nsMemory.h b/repos/ports/src/virtualbox/frontend/nsMemory.h new file mode 100644 index 0000000000..884b2bf016 --- /dev/null +++ b/repos/ports/src/virtualbox/frontend/nsMemory.h @@ -0,0 +1,17 @@ +#ifndef nsMemory_h__ +#define nsMemory_h__ + +#define nsID GUID + +#include + +class nsMemory +{ + public: + static void * Alloc(size_t size); + static void * Realloc(void* ptr, size_t size); + static void Free(void* ptr); + static void * Clone(const void* ptr, size_t size); +}; + +#endif /* nsMemory_h__ */ diff --git a/repos/ports/src/virtualbox/guest_memory.h b/repos/ports/src/virtualbox/guest_memory.h index d6640bbe8e..a9b95db497 100644 --- a/repos/ports/src/virtualbox/guest_memory.h +++ b/repos/ports/src/virtualbox/guest_memory.h @@ -133,21 +133,49 @@ class Guest_memory int mmio_write(RTGCPHYS GCPhys, void const *pv, unsigned cb) { if (!_pfnWriteCallback) - return VERR_IOM_MMIO_RANGE_NOT_FOUND; + return VINF_SUCCESS; -// PDBG("mmio_write(GCPhys=0x%lx, cb=%u)", GCPhys, cb); + int rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo), + VINF_IOM_R3_MMIO_READ); + if (rc != VINF_SUCCESS) + return rc; - return _pfnWriteCallback(_pDevIns, _pvUser, GCPhys, pv, cb); + 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 VERR_IOM_MMIO_RANGE_NOT_FOUND; + return VINF_IOM_MMIO_UNUSED_FF; -// PDBG("mmio_read(GCPhys=0x%lx, cb=%u)", GCPhys, cb); + int rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo), + VINF_IOM_R3_MMIO_WRITE); - return _pfnReadCallback(_pDevIns, _pvUser, GCPhys, pv, cb); + 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); } }; @@ -328,35 +356,49 @@ class Guest_memory /** * \return VirtualBox return code */ - int mmio_write(PVM pVM, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue) + int mmio_write(RTGCPHYS vm_phys, uint32_t u32Value, size_t size) { - Region *r = _lookup(GCPhys, cbValue); + Region *r = _lookup(vm_phys, size); if (!r) { - PERR("Guest_memory::mmio_write: lookup failed"); - PERR("GCPhys=0x%x, u32Value=0x%x, cbValue=%zd", - GCPhys, u32Value, cbValue); + PERR("Guest_memory::mmio_write: lookup failed - " + "GCPhys=0x%llx, u32Value=0x%x, size=%zd", + (Genode::uint64_t)vm_phys, u32Value, size); return VERR_IOM_MMIO_RANGE_NOT_FOUND; } - return r->mmio_write(GCPhys, &u32Value, cbValue); + /* 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(PVM pVM, RTGCPHYS GCPhys, uint32_t *u32Value, size_t cbValue) + int mmio_read(RTGCPHYS vm_phys, uint32_t *u32Value, size_t size) { - Region *r = _lookup(GCPhys, cbValue); + Region *r = _lookup(vm_phys, size); if (!r) { - PERR("Guest_memory::mmio_read: lookup failed"); - PERR("GCPhys=0x%x, u32Value=0x%x, cbValue=%zd", - GCPhys, u32Value, cbValue); + PERR("Guest_memory::mmio_read: lookup faile - " + "GCPhys=0x%llx, u32Value=0x%p, size=%zd", + (Genode::uint64_t)vm_phys, u32Value, size); return VERR_IOM_MMIO_RANGE_NOT_FOUND; } - return r->mmio_read(GCPhys, u32Value, cbValue); + /* 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; } }; diff --git a/repos/ports/src/virtualbox/hda.patch b/repos/ports/src/virtualbox/hda.patch deleted file mode 100644 index fd21911278..0000000000 --- a/repos/ports/src/virtualbox/hda.patch +++ /dev/null @@ -1,53 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp -@@ -158,6 +160,7 @@ - static bool g_fReleaseLog = true; /**< Set if we should open the release. */ - const char *g_pszProgressString; - unsigned g_uProgressPercent = ~0U; -+static bool g_fOverlay= false; - - - /** -@@ -715,6 +718,8 @@ - g_fCSAM = false; - #endif /* VBOXSDL_ADVANCED_OPTIONS */ - /* just show the help screen */ -+ else if (strcmp(pszArg, "-overlay") == 0) -+ g_fOverlay = true; - else - { - SyntaxError("unrecognized argument '%s'\n", pszArg); -@@ -1532,7 +1550,7 @@ - rc = CFGMR3InsertNode(pLunL0, "AttachedDriver", &pDrv); UPDATE_RC(); - rc = CFGMR3InsertString(pDrv, "Driver", "VD"); UPDATE_RC(); - rc = CFGMR3InsertNode(pDrv, "Config", &pCfg); UPDATE_RC(); -- rc = CFGMR3InsertString(pCfg, "Path", g_pszHdaFile); UPDATE_RC(); -+ rc = CFGMR3InsertString(pCfg, "Type", "HardDisk"); UPDATE_RC(); - - if (g_fHdaSpf) - { -@@ -1541,13 +1559,23 @@ - else - { - char *pcExt = RTPathExt(g_pszHdaFile); -- if ((pcExt) && (!strcmp(pcExt, ".vdi"))) -+ if ((pcExt) && (!strcmp(pcExt, ".vdi") && !g_fOverlay)) - { - rc = CFGMR3InsertString(pCfg, "Format", "VDI"); UPDATE_RC(); -+ rc = CFGMR3InsertString(pCfg, "Path", g_pszHdaFile); UPDATE_RC(); - } - else - { -- rc = CFGMR3InsertString(pCfg, "Format", "VMDK"); UPDATE_RC(); -+ /* -+ * Use the overlay.vdi file to store differential changes. -+ * Leave the VMDK file passed as argument unchanged. -+ */ -+ PCFGMNODE pParent = 0; -+ rc = CFGMR3InsertString(pCfg, "Format", "VDI"); UPDATE_RC(); -+ rc = CFGMR3InsertString(pCfg, "Path", "/ram/overlay.vdi"); UPDATE_RC(); -+ rc = CFGMR3InsertNode(pCfg, "Parent", &pParent); UPDATE_RC(); -+ rc = CFGMR3InsertString(pParent, "Format", "VDI"); UPDATE_RC(); -+ rc = CFGMR3InsertString(pParent, "Path", g_pszHdaFile); UPDATE_RC(); - } - } - } diff --git a/repos/ports/src/virtualbox/hm.cc b/repos/ports/src/virtualbox/hm.cc new file mode 100644 index 0000000000..4b7215a117 --- /dev/null +++ b/repos/ports/src/virtualbox/hm.cc @@ -0,0 +1,145 @@ +/* + * \brief VirtualBox hardware-acceleration manager + * \author Norman Feske + * \date 2013-08-20 + */ + +/* + * Copyright (C) 2013 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 = true; + + +VMMR3DECL(int) HMR3Init(PVM pVM) +{ + /* + * 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 = pVM->hm.s.svm.fSupported || pVM->hm.s.vmx.fSupported; + + if (!enabled || 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); + } + + return rc; +} + + +VMMDECL(bool) HMIsEnabledNotMacro(PVM pVM) +{ + Assert(pVM->fHMEnabledFixed); + return pVM->fHMEnabled; +} + + +VMMR3DECL(bool) HMR3IsVmxPreemptionTimerUsed(PVM pVM) +{ +// PLOG("HMR3IsVmxPreemptionTimerUsed"); + 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) +{ + /* no re-schedule on AMD-V required - just works */ +/* + if (pVM->hm.s.svm.fSupported) + return false; +*/ + bool reschedule = !CPUMIsGuestInPagedProtectedModeEx(pCtx); + +// PLOG("reschedule %u %u %lx", reschedule, HMR3CanExecuteGuest(pVM, pCtx), pCtx->cr0); + + return reschedule; +} + + +VMMR3DECL(bool) HMR3IsEventPending(PVMCPU pVCpu) +{ +// PLOG("HMR3IsEventPending false"); + return false; +} + + +VMMR3DECL(bool) HMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx) +{ + PVMCPU pVCpu = VMMGetCpu(pVM); + + /* AMD-V just works */ +/* + if (pVM->hm.s.svm.fSupported) { + pVCpu->hm.s.fActive = true; + return true; + } +*/ + if (!enabled) + return false; + + /* enable H/W acceleration in protected mode only */ + bool res = (pCtx->cr0 & 1) && (pCtx->cr0 & 0x80000000); +/* + static bool on = false; + + if (res) + on = true; + + if (on) + PLOG("executeguest %lx -> %x", pCtx->cr0, res); +*/ + pVCpu->hm.s.fActive = res; + + return res; +} diff --git a/repos/ports/src/virtualbox/hwacc.patch b/repos/ports/src/virtualbox/hwacc.patch deleted file mode 100644 index 54c87ad076..0000000000 --- a/repos/ports/src/virtualbox/hwacc.patch +++ /dev/null @@ -1,16 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp -@@ -1273,6 +1279,14 @@ - rc = CFGMR3InsertInteger(pRoot, "CSAMEnabled", 1); UPDATE_RC(); - #endif - -+ /* enable HW virtualization support */ -+ -+ PCFGMNODE pHWVirtExt = NULL; -+ -+ rc = CFGMR3InsertNode(pRoot, "HWVirtExt", &pHWVirtExt); UPDATE_RC(); -+ rc = CFGMR3InsertInteger(pHWVirtExt, "Enabled", 1); UPDATE_RC(); -+ rc = CFGMR3InsertInteger(pHWVirtExt, "64bitEnabled", 0); UPDATE_RC(); -+ - /* - * PDM. - */ diff --git a/repos/ports/src/virtualbox/hwaccm.cc b/repos/ports/src/virtualbox/hwaccm.cc deleted file mode 100644 index 4c8e9f7b8a..0000000000 --- a/repos/ports/src/virtualbox/hwaccm.cc +++ /dev/null @@ -1,134 +0,0 @@ -/* - * \brief VirtualBox hardware-acceleration manager - * \author Norman Feske - * \date 2013-08-20 - */ - -/* - * Copyright (C) 2013 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include - -/* VirtualBox includes */ -#include "HWACCMInternal.h" /* enable access to hwaccm.s.* */ -#include -#include - -/* Genode's VirtualBox includes */ -#include "sup.h" - - -static bool enabled = true; - - -VMMR3DECL(int) HWACCMR3Init(PVM pVM) -{ - /* - * We always set the fHWACCMEnabled 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 - * HWACCMR3CanExecuteGuest function. - */ - pVM->fHWACCMEnabled = true; - - for (VMCPUID i = 0; i < pVM->cCpus; i++) - pVM->aCpus[i].hwaccm.s.fActive = false; - - return VINF_SUCCESS; -} - - -VMMR3_INT_DECL(int) HWACCMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat) -{ - enabled = pVM->hwaccm.s.svm.fSupported || pVM->hwaccm.s.vmx.fSupported; - - if (!enabled || enmWhat != VMINITCOMPLETED_RING0) - return VINF_SUCCESS; - - int rc = SUPR3CallVMMR0Ex(pVM->pVMR0, 0 /*idCpu*/, VMMR0_DO_HWACC_SETUP_VM, 0, NULL); - - if (rc == VINF_SUCCESS) { - CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_SEP); - } - - return rc; -} - - -VMMR3DECL(bool) HWACCMR3IsVmxPreemptionTimerUsed(PVM pVM) -{ - PLOG("HWACCMR3IsVmxPreemptionTimerUsed"); - return false; -} - - -VMMR3DECL(bool) HWACCMR3IsActive(PVMCPU pVCpu) -{ - return pVCpu->hwaccm.s.fActive; -} - - -VMMR3DECL(bool) HWACCMR3IsRescheduleRequired(PVM pVM, PCPUMCTX pCtx) -{ - /* no re-schedule on AMD-V required - just works */ -/* - if (pVM->hwaccm.s.svm.fSupported) - return false; -*/ - bool reschedule = !CPUMIsGuestInPagedProtectedModeEx(pCtx); - -// PLOG("reschedule %u %u %lx", reschedule, HWACCMR3CanExecuteGuest(pVM, pCtx), pCtx->cr0); - - return reschedule; -} - - -void HWACCMR3PagingModeChanged(PVM pVM, PVMCPU pVCpu, PGMMODE enmShadowMode, - PGMMODE enmGuestMode) -{ -// PLOG("HWACCMR3PagingModeChanged: enmShadowMode=%d enmGuestMode=%d", -// enmShadowMode, enmGuestMode); -} - - -VMMR3DECL(bool) HWACCMR3IsEventPending(PVMCPU pVCpu) -{ -// PLOG("HWACCMR3IsEventPending false"); - return false; -} - - -VMMR3DECL(bool) HWACCMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx) -{ - PVMCPU pVCpu = VMMGetCpu(pVM); - - /* AMD-V just works */ -/* - if (pVM->hwaccm.s.svm.fSupported) { - pVCpu->hwaccm.s.fActive = true; - return true; - } -*/ - if (!enabled) - return false; - - /* enable H/W acceleration in protected mode only */ - bool res = (pCtx->cr0 & 1) && (pCtx->cr0 & 0x80000000); -/* - static bool on = false; - - if (res) - on = true; - - if (on) - PLOG("executeguest %lx -> %x", pCtx->cr0, res); -*/ - pVCpu->hwaccm.s.fActive = res; - - return res; -} diff --git a/repos/ports/src/virtualbox/iconv.patch b/repos/ports/src/virtualbox/iconv.patch deleted file mode 100644 index 9f37dec85f..0000000000 --- a/repos/ports/src/virtualbox/iconv.patch +++ /dev/null @@ -1,17 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Runtime/r3/posix/utf8-posix.cpp -@@ -319,11 +319,11 @@ - size_t cbOutLeft = cbOutput2; - const void *pvInputLeft = pvInput; - void *pvOutputLeft = pvOutput; --#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || (defined(RT_OS_DARWIN) && defined(_DARWIN_FEATURE_UNIX_CONFORMANCE)) /* there are different opinions about the constness of the input buffer. */ -+//#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || (defined(RT_OS_DARWIN) && defined(_DARWIN_FEATURE_UNIX_CONFORMANCE)) /* there are different opinions about the constness of the input buffer. */ - if (iconv(icHandle, (char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft) != (size_t)-1) --#else -- if (iconv(icHandle, (const char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft) != (size_t)-1) --#endif -+//#else -+// if (iconv(icHandle, (const char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft) != (size_t)-1) -+//#endif - { - if (!cbInLeft) - { diff --git a/repos/ports/src/virtualbox/include/SDLFramebuffer.h b/repos/ports/src/virtualbox/include/SDLFramebuffer.h deleted file mode 100644 index 3a89c2b3fa..0000000000 --- a/repos/ports/src/virtualbox/include/SDLFramebuffer.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * \brief Framebuffer implementation of VirtualBox for Genode - * \author Alexander Boettcher - * \date 2013-10-16 - */ - -/* - * Copyright (C) 2013 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#define Framebuffer FramebufferGenode -#include -#undef Framebuffer - -/* VirtualBox includes */ -#include "Framebuffer.h" - -#include - -class SDLFramebuffer : public Framebuffer -{ - private: - - FramebufferGenode::Connection _fb; - FramebufferGenode::Mode const _fb_mode; - void * _fb_base; - RTCRITSECT mUpdateLock; - - public: - - SDLFramebuffer () - : - _fb_mode(_fb.mode()), - _fb_base(Genode::env()->rm_session()->attach(_fb.dataspace())) - { - int rc = RTCritSectInit(&mUpdateLock); - if (rc != VINF_SUCCESS) - PERR("Lock could not be initalized"); - } - - HRESULT getWidth(ULONG * width) - { - *width = _fb_mode.width(); - return S_OK; - } - - HRESULT getHeight(ULONG * height) - { - *height = _fb_mode.height(); - return S_OK; - } - - HRESULT Lock() { return RTCritSectEnter(&mUpdateLock); } - - HRESULT Unlock() { return RTCritSectLeave(&mUpdateLock); } - - HRESULT getAddress(uintptr_t * addr) - { - *addr = reinterpret_cast(_fb_base); - return S_OK; - } - - HRESULT getBitsPerPixel(ULONG * bits) - { - *bits = _fb_mode.bytes_per_pixel() * 8; - return S_OK; - } - - HRESULT getLineSize(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; - } - - HRESULT RequestResize(ULONG x, ULONG y, BOOL * finished) - { - PERR("ignore resize request to %lux%lu", x, y); - Genode::size_t const num_pixels = _fb_mode.width()*_fb_mode.height(); - Genode::memset(_fb_base, 0, num_pixels*_fb_mode.bytes_per_pixel()); - _fb.refresh(0, 0, _fb_mode.width(), _fb_mode.height()); - *finished = true; - return S_OK; - } - - HRESULT GetVisibleRegion(BYTE *, ULONG, ULONG *) { PERR("%s:%s called", __FILE__, __FUNCTION__); return E_NOTIMPL; } - HRESULT SetVisibleRegion(BYTE *, ULONG) { PERR("%s:%s called", __FILE__, __FUNCTION__); return E_NOTIMPL; } - - HRESULT ProcessVHWACommand(BYTE *) { PERR("%s:%s called", __FILE__, __FUNCTION__); return E_NOTIMPL; } - - void repaint() { PERR("%s:%s called", __FILE__, __FUNCTION__); } - void resize() { PERR("%s:%s called", __FILE__, __FUNCTION__); } - - void update(int, int, int, int) { PERR("%s:%s called", __FILE__, __FUNCTION__); } - bool getFullscreen() { PERR("%s:%s called", __FILE__, __FUNCTION__); } - void setFullscreen(bool) { PERR("%s:%s called", __FILE__, __FUNCTION__); } - int getYOffset() { PERR("%s:%s called", __FILE__, __FUNCTION__); } - int getHostXres() { PERR("%s:%s called", __FILE__, __FUNCTION__); } - int getHostYres() { PERR("%s:%s called", __FILE__, __FUNCTION__); } - int getHostBitsPerPixel() { PERR("%s:%s called", __FILE__, __FUNCTION__); } -}; diff --git a/repos/ports/src/virtualbox/include/VBox/HostServices/VBoxClipboardSvc.h b/repos/ports/src/virtualbox/include/VBox/HostServices/VBoxClipboardSvc.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/repos/ports/src/virtualbox/include/VBox/com/VirtualBox.h b/repos/ports/src/virtualbox/include/VBox/com/VirtualBox.h new file mode 100644 index 0000000000..29ee5af545 --- /dev/null +++ b/repos/ports/src/virtualbox/include/VBox/com/VirtualBox.h @@ -0,0 +1,7 @@ +#ifndef ___VBox_com_VirtualBox_h +#define ___VBox_com_VirtualBox_h + +#include + +#endif + diff --git a/repos/ports/src/virtualbox/include/VBox/com/com.h b/repos/ports/src/virtualbox/include/VBox/com/com.h new file mode 100644 index 0000000000..4484e7f702 --- /dev/null +++ b/repos/ports/src/virtualbox/include/VBox/com/com.h @@ -0,0 +1,15 @@ +#ifndef ___VBox_com_com_h +#define ___VBox_com_com_h + +#define COMGETTER(n) get_##n +#define COMSETTER(n) set_##n + +#include + +namespace com { + int GetVBoxUserHomeDirectory(char *aDir, size_t aDirLen, bool fCreateDir = true); + HRESULT Initialize(bool fGui = false); + HRESULT Shutdown(); +} + +#endif /* ___VBox_com_com_h */ diff --git a/repos/ports/src/virtualbox/include/VBox/com/defs.h b/repos/ports/src/virtualbox/include/VBox/com/defs.h new file mode 100644 index 0000000000..3a225c929c --- /dev/null +++ b/repos/ports/src/virtualbox/include/VBox/com/defs.h @@ -0,0 +1,631 @@ +#ifndef ___VBox_com_defs_h +#define ___VBox_com_defs_h + +#include + +typedef short unsigned int * BSTR; +typedef BSTR IN_BSTR; +typedef const short unsigned int * CBSTR; +typedef short unsigned int OLECHAR; +typedef unsigned int PRUint32; +typedef OLECHAR PRUnichar; +typedef bool BOOL; +typedef unsigned char BYTE; + +#define FALSE false +#define TRUE true + +#define SUCCEEDED(X) ((X) == VINF_SUCCESS) +#define FAILED(X) ((X) != VINF_SUCCESS) + +#define ComSafeArrayInArg(aArg) aArg##Size, aArg +#define ComSafeArrayOutArg(aArg) aArg##Size, aArg +#define ComSafeArrayOut(aType, aArg) PRUint32 *aArg##Size, aType **aArg +#define ComSafeArrayIn(aType, aArg) unsigned aArg##Size, aType *aArg +#define ComSafeGUIDArrayIn(aArg) PRUint32 aArg##Size, const nsID **aArg +#define ComSafeGUIDArrayInArg(aArg) ComSafeArrayInArg(aArg) +#define ComSafeArrayOutIsNull(aArg) ((aArg) == NULL) +#define ComSafeArrayInIsNull(aArg) ((aArg) == NULL) + +#define COM_STRUCT_OR_CLASS(I) class I + +#define FAILED_DEAD_INTERFACE(rc) ( (rc) != VINF_SUCCESS ) + +enum HRESULT { + S_OK, + E_ACCESSDENIED, + E_OUTOFMEMORY, + E_INVALIDARG, + E_FAIL, + E_POINTER, + E_NOTIMPL, + E_UNEXPECTED, + E_NOINTERFACE, + E_ABORT, + VBOX_E_VM_ERROR, + VBOX_E_INVALID_VM_STATE, + VBOX_E_INVALID_OBJECT_STATE, + VBOX_E_INVALID_SESSION_STATE, + VBOX_E_OBJECT_NOT_FOUND, + VBOX_E_FILE_ERROR, + VBOX_E_OBJECT_IN_USE, + VBOX_E_NOT_SUPPORTED, + VBOX_E_IPRT_ERROR, + VBOX_E_PDM_ERROR, + VBOX_E_HOST_ERROR, + VBOX_E_XML_ERROR, +}; + +typedef struct { char x [sizeof(RTUUID)]; } GUID; + +inline GUID& stuffstuff() { + static GUID stuff; + return stuff; +} +#define COM_IIDOF(X) stuffstuff() +#define getStaticClassIID() stuffstuff() + +#define IN_GUID GUID +#define OUT_GUID GUID * + +extern "C" +{ + BSTR SysAllocString(const OLECHAR* sz); + BSTR SysAllocStringByteLen(char *psz, unsigned int len); + BSTR SysAllocStringLen(const OLECHAR *pch, unsigned int cch); + void SysFreeString(BSTR bstr); + unsigned int SysStringByteLen(BSTR bstr); + unsigned int SysStringLen(BSTR bstr); +} + +typedef signed int LONG; +typedef unsigned int ULONG; +typedef unsigned short USHORT; +typedef short SHORT; +typedef signed long long LONG64; +typedef unsigned long long ULONG64; + +/* capiidl.xsl */ +typedef enum VARTYPE +{ + VT_I2 = 2, + VT_I4 = 3, + VT_BSTR = 8, + VT_DISPATCH = 9, + VT_BOOL = 11, + VT_UNKNOWN = 13, + VT_I1 = 16, + VT_UI1 = 17, + VT_UI2 = 18, + VT_UI4 = 19, + VT_I8 = 20, + VT_UI8 = 21, + VT_HRESULT = 25 +} VARTYPE; + +typedef struct SAFEARRAY +{ + void *pv; + ULONG c; +} SAFEARRAY; + +enum AccessMode_T +{ + AccessMode_ReadOnly, + AccessMode_ReadWrite, +}; + +enum AdditionsFacilityClass_T +{ + AdditionsFacilityClass_None, + AdditionsFacilityClass_Driver, + AdditionsFacilityClass_Feature, + AdditionsFacilityClass_Program, + AdditionsFacilityClass_Service, +}; + +enum AdditionsFacilityStatus_T +{ + AdditionsFacilityStatus_Unknown, + AdditionsFacilityStatus_Active, +}; + +enum AdditionsFacilityType_T +{ + AdditionsFacilityType_None, + AdditionsFacilityType_AutoLogon, + AdditionsFacilityType_Graphics, + AdditionsFacilityType_Seamless, + AdditionsFacilityType_VBoxService, + AdditionsFacilityType_VBoxGuestDriver, + AdditionsFacilityType_VBoxTrayClient, +}; + +enum CopyFileFlag_T { }; +enum DeviceActivity_T { }; +enum FsObjType_T { }; +enum FileStatus_T { }; +enum FileSeekType_T { }; +enum DragAndDropAction_T { }; +enum GuestSessionStatus_T { }; +enum GuestSessionWaitForFlag_T { }; +enum GuestSessionWaitResult_T { }; +enum DirectoryCreateFlag_T { }; +enum DirectoryOpenFlag_T { }; +enum DirectoryRemoveRecFlag_T { }; +enum PathRenameFlag_T { }; +enum SymlinkType_T { }; +enum SymlinkReadFlag_T { }; +enum AdditionsUpdateFlag_T { }; +enum AdditionsRunLevelType_T +{ + AdditionsRunLevelType_None, + AdditionsRunLevelType_System, + AdditionsRunLevelType_Desktop, + AdditionsRunLevelType_Userland, +}; + +enum GuestUserState_T { +}; + +enum MouseButtonState +{ + MouseButtonState_LeftButton = 0x01, + MouseButtonState_RightButton = 0x02, + MouseButtonState_MiddleButton = 0x04, + MouseButtonState_WheelUp = 0x08, + MouseButtonState_WheelDown = 0x10, + MouseButtonState_XButton1 = 0x20, + MouseButtonState_XButton2 = 0x40, + MouseButtonState_MouseStateMask = 0x7F +}; + +enum GuestMouseEventMode_T +{ + GuestMouseEventMode_Absolute, + GuestMouseEventMode_Relative, +}; + +enum GUEST_FILE_SEEKTYPE { }; +enum ProcessPriority_T +{ + ProcessPriority_Default, +}; + +enum FramebufferPixelFormat +{ + FramebufferPixelFormat_Opaque = 0, + FramebufferPixelFormat_FOURCC_RGB = 0x32424752, +}; + +enum GuestMonitorChangedEventType +{ + GuestMonitorChangedEventType_Enabled, + GuestMonitorChangedEventType_Disabled, + GuestMonitorChangedEventType_NewOrigin, +}; + +enum VBoxEventType_T +{ + VBoxEventType_Invalid = 0, + VBoxEventType_Any = 1, + VBoxEventType_Vetoable = 2, + VBoxEventType_MachineEvent = 3, + VBoxEventType_SnapshotEvent = 4, + VBoxEventType_InputEvent = 5, + VBoxEventType_LastWildcard = 31, + VBoxEventType_OnMachineStateChanged = 32, + VBoxEventType_OnMachineDataChanged = 33, + VBoxEventType_OnExtraDataChanged = 34, + VBoxEventType_OnExtraDataCanChange = 35, + VBoxEventType_OnMediumRegistered = 36, + VBoxEventType_OnMachineRegistered = 37, + VBoxEventType_OnSessionStateChanged = 38, + VBoxEventType_OnSnapshotTaken = 39, + VBoxEventType_OnSnapshotDeleted = 40, + VBoxEventType_OnSnapshotChanged = 41, + VBoxEventType_OnGuestPropertyChanged = 42, + VBoxEventType_OnMousePointerShapeChanged = 43, + VBoxEventType_OnMouseCapabilityChanged = 44, + VBoxEventType_OnKeyboardLedsChanged = 45, + VBoxEventType_OnStateChanged = 46, + VBoxEventType_OnAdditionsStateChanged = 47, + VBoxEventType_OnNetworkAdapterChanged = 48, + VBoxEventType_OnSerialPortChanged = 49, + VBoxEventType_OnParallelPortChanged = 50, + VBoxEventType_OnStorageControllerChanged = 51, + VBoxEventType_OnMediumChanged = 52, + VBoxEventType_OnVRDEServerChanged = 53, + VBoxEventType_OnUSBControllerChanged = 54, + VBoxEventType_OnUSBDeviceStateChanged = 55, + VBoxEventType_OnSharedFolderChanged = 56, + VBoxEventType_OnRuntimeError = 57, + VBoxEventType_OnCanShowWindow = 58, + VBoxEventType_OnShowWindow = 59, + VBoxEventType_OnCPUChanged = 60, + VBoxEventType_OnVRDEServerInfoChanged = 61, + VBoxEventType_OnEventSourceChanged = 62, + VBoxEventType_OnCPUExecutionCapChanged = 63, + VBoxEventType_OnGuestKeyboard = 64, + VBoxEventType_OnGuestMouse = 65, + VBoxEventType_OnNATRedirect = 66, + VBoxEventType_OnHostPCIDevicePlug = 67, + VBoxEventType_OnVBoxSVCAvailabilityChanged = 68, + VBoxEventType_OnBandwidthGroupChanged = 69, + VBoxEventType_OnGuestMonitorChanged = 70, + VBoxEventType_OnStorageDeviceChanged = 71, + VBoxEventType_OnClipboardModeChanged = 72, + VBoxEventType_OnDragAndDropModeChanged = 73, + VBoxEventType_OnGuestMultiTouch = 74, + VBoxEventType_Last = 75 +}; + +enum ProcessStatus_T { }; +enum ProcessInputStatus_T { }; +enum ProcessInputFlag_T { }; +enum ProcessWaitResult_T { }; +enum ProcessWaitForFlag_T { }; + +enum ProcessCreateFlag_T +{ + ProcessCreateFlag_None, +}; + +enum SessionType_T +{ + SessionType_Null, + SessionType_WriteLock, + SessionType_Remote, + SessionType_Shared, +}; + +enum MachineState_T { + MachineState_Null, + MachineState_Aborted, + MachineState_Running, + MachineState_Paused, + MachineState_Teleporting, + MachineState_LiveSnapshotting, + MachineState_Stuck, + MachineState_Starting, + MachineState_Stopping, + MachineState_Saving, + MachineState_Restoring, + MachineState_TeleportingPausedVM, + MachineState_TeleportingIn, + MachineState_RestoringSnapshot, + MachineState_DeletingSnapshot, + MachineState_SettingUp, + MachineState_FaultTolerantSyncing, + MachineState_PoweredOff, + MachineState_Teleported, + MachineState_Saved, + MachineState_DeletingSnapshotOnline, + MachineState_DeletingSnapshotPaused, +}; + +enum CleanupMode_T { + CleanupMode_UnregisterOnly, + CleanupMode_DetachAllReturnHardDisksOnly, + CleanupMode_Full, + }; + +enum CloneMode_T { + CloneMode_MachineState, + CloneMode_AllStates, + CloneMode_MachineAndChildStates, +}; + +enum CloneOptions_T { + CloneOptions_Link, + CloneOptions_KeepAllMACs, + CloneOptions_KeepNATMACs, + CloneOptions_KeepDiskNames, +}; + +enum LockType_T { + LockType_Shared, + LockType_Write, + LockType_VM, +}; + +enum SessionState_T { + SessionState_Null, + SessionState_Locked, + SessionState_Spawning, + SessionState_Unlocking, + SessionState_Unlocked, +}; + +enum Reason_T +{ + Reason_Unspecified, + Reason_HostSuspend, + Reason_HostResume, + Reason_HostBatteryLow, +}; + +enum MediumFormatCapabilities_T +{ + MediumFormatCapabilities_Uuid = 0x01, + MediumFormatCapabilities_CreateFixed = 0x02, + MediumFormatCapabilities_CreateDynamic = 0x04, + MediumFormatCapabilities_Differencing = 0x10, + MediumFormatCapabilities_File = 0x40 +}; + +enum DataType_T { + DataType_Int32, + DataType_Int8, + DataType_String, +}; + +enum DataFlags_T { + DataFlags_Array, +}; + +enum MediumVariant_T { + MediumVariant_Standard, + MediumVariant_Fixed, + MediumVariant_Diff, + MediumVariant_VmdkStreamOptimized, + MediumVariant_NoCreateDir, +}; +enum HostNetworkInterfaceType_T { }; + +enum NATAliasMode_T +{ + NATAliasMode_AliasLog = 0x1, + NATAliasMode_AliasProxyOnly = 0x02, + NATAliasMode_AliasUseSamePorts = 0x04, +}; + +enum MediumState_T { + MediumState_NotCreated = 0, + MediumState_Created = 1, + MediumState_LockedRead = 2, + MediumState_LockedWrite = 3, + MediumState_Inaccessible = 4, + MediumState_Creating = 5, + MediumState_Deleting = 6 +}; + +enum AuthType_T { + AuthType_Null, + AuthType_Guest, + AuthType_External, +}; + +enum BIOSBootMenuMode_T { + BIOSBootMenuMode_MessageAndMenu, + BIOSBootMenuMode_Disabled, + BIOSBootMenuMode_MenuOnly, +}; + +enum USBControllerType_T { + USBControllerType_Null, + USBControllerType_OHCI, + USBControllerType_EHCI, + USBControllerType_Last, +}; + +enum USBDeviceFilterAction_T { + USBDeviceFilterAction_Null, + USBDeviceFilterAction_Ignore, + USBDeviceFilterAction_Hold, +}; + +enum DeviceType_T { + DeviceType_Null, + DeviceType_HardDisk, + DeviceType_DVD, + DeviceType_Floppy, + DeviceType_Network, + DeviceType_USB, + DeviceType_SharedFolder, +}; + +enum MediumType_T { + MediumType_Normal, + MediumType_Immutable, + MediumType_Writethrough, + MediumType_Shareable, + MediumType_Readonly, + MediumType_MultiAttach, +}; + +enum NATProtocol_T { + NATProtocol_TCP, + NATProtocol_UDP, +}; + +enum NetworkAdapterType_T { + NetworkAdapterType_Am79C970A, + NetworkAdapterType_Am79C973, + NetworkAdapterType_I82540EM, + NetworkAdapterType_I82543GC, + NetworkAdapterType_I82545EM, + NetworkAdapterType_Virtio, +}; + +enum ProcessorFeature_T +{ + ProcessorFeature_HWVirtEx, + ProcessorFeature_LongMode, + ProcessorFeature_NestedPaging, + ProcessorFeature_PAE, +}; + +enum CPUPropertyType_T +{ + CPUPropertyType_Null, + CPUPropertyType_PAE, + CPUPropertyType_Synthetic, + CPUPropertyType_LongMode, + CPUPropertyType_TripleFaultReset, +}; + +/* End of enum CPUPropertyType Declaration */ +enum AudioDriverType_T { + AudioDriverType_Null, + AudioDriverType_WinMM, + AudioDriverType_DirectSound, + AudioDriverType_SolAudio, + AudioDriverType_ALSA, + AudioDriverType_Pulse, + AudioDriverType_OSS, + AudioDriverType_CoreAudio, + AudioDriverType_MMPM, +}; + +enum PortMode_T { + PortMode_Disconnected, + PortMode_HostPipe, + PortMode_HostDevice, + PortMode_RawFile, +}; + +enum BandwidthGroupType_T { + BandwidthGroupType_Null, + BandwidthGroupType_Disk, + BandwidthGroupType_Network, +}; + +enum ClipboardMode_T { + ClipboardMode_Disabled, + ClipboardMode_HostToGuest, + ClipboardMode_GuestToHost, + ClipboardMode_Bidirectional, +}; + +enum FaultToleranceState_T { + FaultToleranceState_Inactive, + FaultToleranceState_Master, + FaultToleranceState_Standby, +}; + +enum AudioControllerType_T { + AudioControllerType_AC97, + AudioControllerType_HDA, + AudioControllerType_SB16, +}; + +enum NetworkAttachmentType_T { + NetworkAttachmentType_Null, + NetworkAttachmentType_NAT, + NetworkAttachmentType_Bridged, + NetworkAttachmentType_Internal, + NetworkAttachmentType_HostOnly, + NetworkAttachmentType_Generic, + NetworkAttachmentType_NATNetwork, +}; + +enum NetworkAdapterPromiscModePolicy_T { + NetworkAdapterPromiscModePolicy_Deny, + NetworkAdapterPromiscModePolicy_AllowNetwork, + NetworkAdapterPromiscModePolicy_AllowAll, +}; + +enum StorageBus_T { + StorageBus_Null, + StorageBus_IDE, + StorageBus_SATA, + StorageBus_SAS, + StorageBus_SCSI, + StorageBus_Floppy, +}; + +enum FirmwareType_T { + FirmwareType_BIOS, + FirmwareType_EFI, + FirmwareType_EFI32, + FirmwareType_EFI64, + FirmwareType_EFIDUAL, +}; + +enum GraphicsControllerType_T { + GraphicsControllerType_Null, + GraphicsControllerType_VBoxVGA, + GraphicsControllerType_VMSVGA, +}; + +enum AutostopType_T { + AutostopType_Disabled, + AutostopType_SaveState, + AutostopType_PowerOff, + AutostopType_AcpiShutdown, +}; + +enum DragAndDropMode_T { + DragAndDropMode_Disabled, + DragAndDropMode_HostToGuest, + DragAndDropMode_GuestToHost, + DragAndDropMode_Bidirectional, +}; + +enum StorageControllerType_T { + StorageControllerType_PIIX3, + StorageControllerType_IntelAhci, + StorageControllerType_LsiLogic, + StorageControllerType_BusLogic, + StorageControllerType_PIIX4, + StorageControllerType_ICH6, + StorageControllerType_I82078, + StorageControllerType_LsiLogicSas, +}; + +enum KeyboardHIDType_T { + KeyboardHIDType_None, + KeyboardHIDType_PS2Keyboard, + KeyboardHIDType_USBKeyboard, + KeyboardHIDType_ComboKeyboard, +}; + +enum PointingHIDType_T { + PointingHIDType_None, + PointingHIDType_PS2Mouse, + PointingHIDType_USBMouse, + PointingHIDType_USBTablet, + PointingHIDType_ComboMouse, + PointingHIDType_USBMultiTouch, +}; + +enum ChipsetType_T { + ChipsetType_Null, + ChipsetType_ICH9, + ChipsetType_PIIX3, +}; + +enum DhcpOpt_T { + DhcpOpt_SubnetMask, + DhcpOpt_Router, +}; + +enum SettingsVersion_T { + SettingsVersion_Null, + SettingsVersion_v1_3, + SettingsVersion_v1_4, + SettingsVersion_v1_5, + SettingsVersion_v1_6, + SettingsVersion_v1_7, + SettingsVersion_v1_8, + SettingsVersion_v1_9, + SettingsVersion_v1_10, + SettingsVersion_v1_11, + SettingsVersion_v1_12, + SettingsVersion_v1_13, + SettingsVersion_v1_14, + SettingsVersion_Future, +}; + +enum HWVirtExPropertyType_T +{ + HWVirtExPropertyType_Enabled, + HWVirtExPropertyType_Force, + HWVirtExPropertyType_NestedPaging, + HWVirtExPropertyType_LargePages, + HWVirtExPropertyType_VPID, + HWVirtExPropertyType_UnrestrictedExecution, +}; + +#endif /* !___VBox_com_defs_h */ diff --git a/repos/ports/src/virtualbox/include/VBox/com/ptr.h b/repos/ports/src/virtualbox/include/VBox/com/ptr.h new file mode 100644 index 0000000000..aa2b896965 --- /dev/null +++ b/repos/ports/src/virtualbox/include/VBox/com/ptr.h @@ -0,0 +1,66 @@ +#ifndef ___VBox_com_ptr_h +#define ___VBox_com_ptr_h + +#include + +template +class ComPtr { + + protected: + + T * _obj; + + public: + + ComPtr () : _obj(nullptr) { } + + /* copy constructor */ + ComPtr (T *obj) : _obj(obj) { } + template + ComPtr (X *obj) : _obj(nullptr) { } + template + ComPtr(const ComPtr &that) : _obj(nullptr) { } + + /* operators */ + T * operator->() const { return _obj; } + operator T*() const { return _obj; } + + bool isNull () const { return _obj == nullptr; } + + T ** asOutParam() { return &_obj; } + + template + HRESULT queryInterfaceTo(T2 **pp) const { + if (pp == nullptr) + return E_INVALIDARG; + + *pp = _obj; + return S_OK; + } + + void setNull() { _obj = nullptr; } +}; + + +template +class ComObjPtr : public ComPtr { + + public: + + ComObjPtr () : ComPtr() { } + + /* copy constructor */ + ComObjPtr (T *obj) : ComPtr(obj) { } + + HRESULT createObject() + { + T * obj = new T(); + if (!obj) + return E_OUTOFMEMORY; + + ComPtr::_obj = obj; + return obj->FinalConstruct(); + } +}; + +#endif /* ___VBox_com_ptr_h */ diff --git a/repos/ports/src/virtualbox/include/VBox/intnet.h b/repos/ports/src/virtualbox/include/VBox/intnet.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/repos/ports/src/virtualbox/include/list b/repos/ports/src/virtualbox/include/list deleted file mode 100644 index 2a4ba09b4b..0000000000 --- a/repos/ports/src/virtualbox/include/list +++ /dev/null @@ -1,4 +0,0 @@ -/* - * \brief Dummy stubs needed by 'src/VBox/Frontends/VBoxBFE/VirtualBoxBase.h' - * \author Alexander Boettcher - */ diff --git a/repos/ports/src/virtualbox/include/map b/repos/ports/src/virtualbox/include/map deleted file mode 100644 index 2a4ba09b4b..0000000000 --- a/repos/ports/src/virtualbox/include/map +++ /dev/null @@ -1,4 +0,0 @@ -/* - * \brief Dummy stubs needed by 'src/VBox/Frontends/VBoxBFE/VirtualBoxBase.h' - * \author Alexander Boettcher - */ diff --git a/repos/ports/src/virtualbox/iommio.cc b/repos/ports/src/virtualbox/iommio.cc index b748fea38d..6f397c78e7 100644 --- a/repos/ports/src/virtualbox/iommio.cc +++ b/repos/ports/src/virtualbox/iommio.cc @@ -15,12 +15,55 @@ #include /* 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) +{ + if (verbose) + PDBG("called"); + 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, @@ -29,10 +72,11 @@ int IOMR3MmioRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, R3PTRTYPE(PFNIOMMMIOFILL) pfnFillCallback, uint32_t fFlags, const char *pszDesc) { - PLOG("%s: GCPhys=0x%lx cb=0x%x pszDesc=%s rd=%p wr=%p fl=%p", - __PRETTY_FUNCTION__, - (long)GCPhysStart, cbRange, pszDesc, - pfnWriteCallback, pfnReadCallback, pfnFillCallback); + if (verbose) + PLOG("%s: GCPhys=0x%llx cb=0x%x pszDesc=%s rd=%p wr=%p fl=%p flags=%x", + __PRETTY_FUNCTION__, + (Genode::uint64_t)GCPhysStart, cbRange, pszDesc, + pfnWriteCallback, pfnReadCallback, pfnFillCallback, fFlags); REMR3NotifyHandlerPhysicalRegister(pVM, PGMPHYSHANDLERTYPE_MMIO, GCPhysStart, cbRange, true); @@ -49,7 +93,9 @@ int IOMR3MmioRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, int IOMR3MmioDeregister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange) { - PLOG("%s: GCPhys=0x%lx cb=0x%x", __PRETTY_FUNCTION__, GCPhysStart, cbRange); + if (verbose) + PLOG("%s: GCPhys=0x%llx cb=0x%x", __PRETTY_FUNCTION__, + (Genode::uint64_t)GCPhysStart, cbRange); bool status = guest_memory()->remove_mmio_mapping(GCPhysStart, cbRange); if (status) @@ -60,32 +106,75 @@ int IOMR3MmioDeregister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, } -VBOXSTRICTRC IOMMMIOWrite(PVM pVM, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue) +VMMDECL(VBOXSTRICTRC) IOMMMIOWrite(PVM pVM, PVMCPU, RTGCPHYS GCPhys, + uint32_t u32Value, size_t cbValue) { -// PDBG("GCPhys=0x%x, u32Value=0x%x, cbValue=%zd", GCPhys, u32Value, cbValue); + VBOXSTRICTRC rc = IOM_LOCK_SHARED(pVM); + Assert(rc == VINF_SUCCESS); - return guest_memory()->mmio_write(pVM, GCPhys, u32Value, cbValue); + rc = guest_memory()->mmio_write(GCPhys, u32Value, cbValue); + + /* + * Check whether access is unaligned or access width is less than device + * supports. See original IOMMIOWrite & iomMMIODoComplicatedWrite of VBox. + */ + Assert(rc != VERR_IOM_NOT_MMIO_RANGE_OWNER); + + IOM_UNLOCK_SHARED(pVM); + + return rc; } -VBOXSTRICTRC IOMMMIORead(PVM pVM, RTGCPHYS GCPhys, uint32_t *pu32Value, - size_t cbValue) +VMMDECL(VBOXSTRICTRC) IOMMMIORead(PVM pVM, PVMCPU, RTGCPHYS GCPhys, + uint32_t *pvalue, size_t bytes) { -// PDBG("GCPhys=0x%x, cbValue=%zd", GCPhys, cbValue); + VBOXSTRICTRC rc = IOM_LOCK_SHARED(pVM); + Assert(rc == VINF_SUCCESS); - return guest_memory()->mmio_read(pVM, GCPhys, pu32Value, cbValue); + rc = guest_memory()->mmio_read(GCPhys, pvalue, bytes); + + /* + * Check whether access is unaligned or access width is less than device + * supports. See original IOMMIORead & iomMMIODoComplicatedRead of VBox. + */ + if (rc == VERR_IOM_NOT_MMIO_RANGE_OWNER) { + /* implement what we need to - extend by need */ + Assert((GCPhys & 3U) == 0); + Assert(bytes == 1 || bytes == 2); + uint32_t value; + rc = guest_memory()->mmio_read(GCPhys, &value, sizeof(value)); + 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; + } + } + } + + IOM_UNLOCK_SHARED(pVM); + + return rc; } int IOMMMIOMapMMIO2Page(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysRemapped, uint64_t fPageFlags) { - PDBG("called - %lx %lx", GCPhys, GCPhysRemapped); + if (verbose) + PDBG("called - %llx %llx", (Genode::uint64_t)GCPhys, + (Genode::uint64_t)GCPhysRemapped); return VINF_SUCCESS; } + int IOMMMIOResetRegion(PVM pVM, RTGCPHYS GCPhys) { - PDBG("called - %lx", GCPhys); + if (verbose) + PDBG("called - %llx", (Genode::uint64_t)GCPhys); return VINF_SUCCESS; } diff --git a/repos/ports/src/virtualbox/ioport.cc b/repos/ports/src/virtualbox/ioport.cc index 2beae56d5a..cf760bd071 100644 --- a/repos/ports/src/virtualbox/ioport.cc +++ b/repos/ports/src/virtualbox/ioport.cc @@ -57,10 +57,12 @@ class Guest_ioports && (PortStart <= _PortStart + _cPorts - 1); } - bool partof(RTIOPORT PortStart, RTUINT cPorts) const + bool partof(RTIOPORT port, RTUINT cPorts) const { - return (PortStart <= _PortStart) - && (PortStart + cPorts - 1 >= _PortStart + _cPorts - 1); + 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, @@ -87,7 +89,6 @@ class Guest_ioports if (!_pfnOutCallback) return VINF_IOM_R3_IOPORT_WRITE; -// PDBG("IOPORT write Port=0x%lx", (long)port); VBOXSTRICTRC rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_IOPORT_WRITE); if (rc != VINF_SUCCESS) @@ -111,12 +112,13 @@ class Guest_ioports return rc; rc = _pfnInCallback(_pDevIns, _pvUser, port, pu32Value, cb); - if (rc != VINF_SUCCESS) + + PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo)); + + if (rc != VERR_IOM_IOPORT_UNUSED && rc != VINF_SUCCESS) PDBG("IOPORT read port=0x%x failed - callback %p eip %p", port, _pfnInCallback, __builtin_return_address(0)); - PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo)); - return rc; } }; @@ -135,6 +137,14 @@ class Guest_ioports return 0; } + void dump() + { + for (Range *r = _ranges.first(); r; r = r->next()) + PINF("0x%x+0x%x - '%s'\n", + r->_PortStart, r->_cPorts, + r->_pDevIns && r->_pDevIns->pReg ? r->_pDevIns->pReg->szName : 0); + } + /* * The whitelist is used to suppress log messages, which the VM tries * to access I/O ports with no device model associated. TinyCore Linux @@ -146,19 +156,22 @@ class Guest_ioports /* LPT3 */ if (port >= 0x0278 && port <= 0x027f) return true; /* ECP */ if (port >= 0x0778 && port <= 0x077a) return true; /* IDE1 */ if (port >= 0x0170 && port <= 0x017f) return true; + /* COM1 */ if (port >= 0x03f8 && port <= 0x03ff) return true; + /* COM2 */ if (port >= 0x02f8 && port <= 0x02ff) return true; + /* COM3 */ if (port >= 0x03e8 && port <= 0x03ef) return true; + /* COM4 */ if (port >= 0x02e8 && port <= 0x02ef) return true; return false; } public: - int add_range(PPDMDEVINS pDevIns, - RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser, - R3PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, - R3PTRTYPE(PFNIOMIOPORTIN) pfnInCallback, - R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStringCallback, - R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStringCallback) + 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) { PERR("io port inseration failure 0x%x+0x%x - '%s'", @@ -168,7 +181,11 @@ class Guest_ioports Assert(!r); return VERR_GENERAL_FAILURE; } -*/ + + if (verbose) + PLOG("insert io port range 0x%x+0x%x - '%s'", PortStart, cPorts, + pDevIns && pDevIns->pReg ? pDevIns->pReg->szName : 0); + _ranges.insert(new (Genode::env()->heap()) Range(pDevIns, PortStart, cPorts, pvUser, pfnOutCallback, pfnInCallback, @@ -190,11 +207,17 @@ class Guest_ioports deleted = true; - PERR("delete %x+%x", r->_PortStart, r->_cPorts); + if (verbose) + PLOG("delete io port range 0x%x+0x%x out of 0x%x+0x%x - '%s'", + r->_PortStart, r->_cPorts, PortStart, cPorts, + r->_pDevIns && + r->_pDevIns->pReg ? r->_pDevIns->pReg->szName : 0); Range *s = r; r = r->next(); _ranges.remove(s); + + destroy(Genode::env()->heap(), s); } return deleted ? VINF_SUCCESS : VERR_GENERAL_FAILURE; @@ -210,22 +233,21 @@ class Guest_ioports return VINF_SUCCESS; char c = u32Value & 0xff; - PWRN("attempted to write to non-existing port 0x%lx+%u %c (%02x)", + PWRN("attempted to write to non-existing port 0x%x+%zu %c (%02x)", port, cbValue, c >= 32 && c <= 176 ? c : '.', c); return VINF_SUCCESS; } - VBOXSTRICTRC read(RTIOPORT port, uint32_t *pu32Value, unsigned cbValue) + 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 (!_white_listed(port)) - PWRN("attempted to read from non-existing port 0x%x+%u %p", + PWRN("attempted to read from non-existing port 0x%x+%zu %p", port, cbValue, r); switch (cbValue) @@ -240,7 +262,8 @@ class Guest_ioports *reinterpret_cast(pu32Value) = 0xFFFFFFFFU; break; default: - PERR("Invalid I/O port (%x) access of size (%x)", port, cbValue); + PERR("Invalid I/O port (%x) access of size (%zx)", + port, cbValue); return VERR_IOM_INVALID_IOPORT_SIZE; } return VINF_SUCCESS; @@ -289,16 +312,15 @@ int IOMR3IOPortDeregister(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, } -VMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVM pVM, RTIOPORT Port, uint32_t u32Value, - size_t cbValue) +VMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVM, PVMCPU, RTIOPORT Port, + uint32_t u32Value, size_t cbValue) { -// PDBG("IOMIOPortWrite Port=0x%lx cbValue=%zd", (long)Port, cbValue); return guest_ioports()->write(Port, u32Value, cbValue); } -VMMDECL(VBOXSTRICTRC) IOMIOPortRead(PVM pVM, RTIOPORT Port, uint32_t *pu32Value, - size_t 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/libc.cc b/repos/ports/src/virtualbox/libc.cc index 21e2de3cb8..3fb2cd58e5 100644 --- a/repos/ports/src/virtualbox/libc.cc +++ b/repos/ports/src/virtualbox/libc.cc @@ -20,18 +20,24 @@ #include #include #include +#include /* statfs */ #include #include +#include /* open */ + + /* libc memory allocator */ #include /* VirtualBox includes */ #include +#include + +static const bool verbose = false; using Genode::size_t; - /* * We cannot use the libc's version of malloc because it does not satisfies * the alignment constraints asserted by 'Runtime/r3/alloc.cpp'. @@ -108,9 +114,10 @@ extern "C" char *getenv(const char *name) // "+dev_pcnet.e.l.f" // "+dev_pic.e.l.f" // "+dev_apic.e.l.f" -// "+dev_vmm.e.l.f" + "+dev_vmm.e" // "+main.e.l.f" // "+hgcm.e.l.f" +// "+shared_folders.e.l.f" ; if (Genode::strcmp(name, "VBOX_LOG_FLAGS") == 0 || @@ -154,13 +161,94 @@ extern "C" int gettimeofday(struct timeval *tv, struct timezone *tz) } } +/* our libc provides a _nanosleep function */ +extern "C" int _nanosleep(const struct timespec *req, struct timespec *rem); +extern "C" int nanosleep(const struct timespec *req, struct timespec *rem) +{ + Assert(req); +/* + if (req) { // && req->tv_sec == 0 && req->tv_nsec <= 10 *1000000) { + char _name[64]; + Genode::Thread_base::myself()->name(_name, sizeof(_name)); + PERR("%zd:%ld s:ns rip %p '%s'", req->tv_sec, req->tv_nsec, + __builtin_return_address(0), _name); + } +*/ + return _nanosleep(req, rem); +} + + + +/* Some dummy implementation for LibC functions */ + +extern "C" pid_t getpid(void) +{ + if (verbose) + PINF("%s called - rip %p", __func__, __builtin_return_address(0)); + + return 1345; +} + +extern "C" int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) +{ + if (verbose) + PINF("%s called - rip %p", __func__, __builtin_return_address(0)); + + return -1; +} + +extern "C" int _sigaction(int, const struct sigaction *, struct sigaction *) +{ + if (verbose) + PINF("%s called - rip %p", __func__, __builtin_return_address(0)); + + return -1; +} + +extern "C" int futimes(int fd, const struct timeval tv[2]) +{ + PINF("%s called - rip %p", __func__, __builtin_return_address(0)); + return 0; +} + +extern "C" int lutimes(const char *filename, const struct timeval tv[2]) +{ + PINF("%s called - file '%s' - rip %p", __func__, filename, + __builtin_return_address(0)); + return 0; +} + +extern "C" int _sigprocmask() +{ + if (verbose) + PINF("%s called - rip %p", __func__, __builtin_return_address(0)); + + return 0; +} + + /** - * Used by Shared Folders + * Used by Shared Folders Guest additions */ +extern "C" int _fstatfs(int libc_fd, struct statfs *buf); +extern "C" int statfs(const char *path, struct statfs *buf) +{ + int fd = open(path, 0); + + if (fd < 0) + return fd; + + int res = _fstatfs(fd, buf); + + close(fd); + + return res; +} + extern "C" long pathconf(char const *path, int name) { - if (name = _PC_NAME_MAX) return 255; + if (name == _PC_NAME_MAX) return 255; PERR("pathconf does not support config option %d", name); errno = EINVAL; diff --git a/repos/ports/src/virtualbox/main.cc b/repos/ports/src/virtualbox/main.cc deleted file mode 100644 index b49fa1fd2c..0000000000 --- a/repos/ports/src/virtualbox/main.cc +++ /dev/null @@ -1,279 +0,0 @@ -/* - * \brief Port of VirtualBox to Genode - * \author Norman Feske - * \date 2013-08-20 - */ - -/* - * Copyright (C) 2013 Genode Labs GmbH - * - * This file is distributed under the terms of the GNU General Public License - * version 2. - */ - -/* Genode includes */ -#include -#include - -#include -#include - -/* libc includes */ -#include -#include - -/* libc memory allocator */ -#include - -/* Virtualbox includes of VBoxBFE */ -#include -#include - -void *operator new (Genode::size_t size) -{ - static Libc::Mem_alloc_impl heap(Genode::env()->rm_session()); - return heap.alloc(size, 0x10); -} - -void *operator new [] (Genode::size_t size) { - return Genode::env()->heap()->alloc(size); } - -void operator delete(void * p) { - if (Genode::env()->heap()->need_size_for_free()) { - PERR("leaking memory - delete operator is missing size information"); - return; - } - Genode::env()->heap()->free(p, 0); -} - - -namespace { - template - class Args - { - private: - - int _argc = 0; - char *_argv[MAX_ARGS] = { }; - - public: - - class Too_many_arguments { }; - - void add(char const *arg) - { - /* argv[MAX_ARGS - 1] must be unused and set to 0 */ - if (_argc >= MAX_ARGS - 1) - throw Too_many_arguments(); - - _argv[_argc++] = strdup(arg); - } - - char *** argvp() { - static char ** argv = _argv; - return &argv; - } - - int argc() { return _argc; } - }; -} /* unnamed namespace */ - - -extern "C" { - -/* make output of Virtualbox visible */ -size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) -{ - if (!stream || !ptr || - !(fileno(stdout) == fileno(stream) || fileno(stderr) == fileno(stream))) - return EOF; - - char const * cptr = reinterpret_cast(ptr); - for (size_t j = 0; j < nmemb; j++) - for (size_t i = 0; i < size; i++) - Genode::printf("%c", cptr[j * size + i]); - - return nmemb; -} - -int fprintf(FILE *stream, const char *format, ...) /* called by RTAssertMsg1 */ -{ - if (!stream || - !(fileno(stdout) == fileno(stream) || fileno(stderr) == fileno(stream))) - return EOF; - - va_list list; - va_start(list, format); - - Genode::vprintf(format, list); - - va_end(list); - - return 0; -} - -int fputs(const char *s, FILE *stream) /* called by RTAssertMsg2Weak */ -{ - if (!stream || - !(fileno(stdout) == fileno(stream) || fileno(stderr) == fileno(stream))) - return EOF; - - fwrite(s, Genode::strlen(s), 1, stream); -} - -/* our libc provides a _nanosleep function */ -int _nanosleep(const struct timespec *req, struct timespec *rem); -int nanosleep(const struct timespec *req, struct timespec *rem) { - return _nanosleep(req, rem); } - - -/* - * Genode way of using a configuration. Wrap VBox main until we throught it - * out eventually. - */ - -/* main function of VBox is in Frontends/VBoxBFE/VBoxBFE.cpp */ -extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char **envp); - -int main() -{ - static char c_mem[16]; - static char c_vram[16]; - static char c_type[4]; - static char c_file[128]; - static bool bOverlay = false; - - static Args<64> args; - - /* request max available memory */ - size_t vm_size = Genode::env()->ram_session()->avail(); - - enum { - VMM_MEMORY = 88 * 1024 * 1024, /* let a bit memory for the VMM */ - VRAM_MEMORY = 8 * 1024 * 1024, /* video memory */ - }; - - if (vm_size < VMM_MEMORY + VRAM_MEMORY) { - PERR("not enough memory available - need %u, available only %zu " - "- exit", VMM_MEMORY + VRAM_MEMORY, vm_size); - return 1; - } - vm_size -= VMM_MEMORY + VRAM_MEMORY; - - try { - using namespace Genode; - - Xml_node node = config()->xml_node().sub_node("image"); - Xml_node::Attribute type = node.attribute("type"); - Xml_node::Attribute file = node.attribute("file"); - try { - Xml_node::Attribute overlay = node.attribute("overlay"); - overlay.value(c_type, sizeof(c_type)); - if (!Genode::strcmp(c_type, "yes")) - bOverlay = true; - } catch (...) { } - type.value(c_type, sizeof(c_type)); - file.value(c_file, sizeof(c_file)); - } catch (...) { - PERR("C++ exception during xml parsing"); - return 2; - } - - args.add("virtualbox"); - - Genode::snprintf(c_mem, sizeof(c_mem), "%u", vm_size / 1024 / 1024); - args.add("-m"); args.add(c_mem); - - Genode::snprintf(c_vram, sizeof(c_vram), "%u", VRAM_MEMORY / 1024 / 1024); - args.add("-vram"); args.add(c_vram); - - args.add("-boot"); - if (!Genode::strcmp(c_type, "iso")) { - args.add("d"); - args.add("-cdrom"); - } else - if (!Genode::strcmp(c_type, "vdi")) { - args.add("c"); - args.add("-hda"); - } else { - PERR("invalid configuration - abort"); - return 3; - } - - args.add(c_file); - - if (bOverlay) - args.add("-overlay"); - - /* disable acpi support if requested */ - try { - Genode::Xml_node node = Genode::config()->xml_node().sub_node("noacpi"); - args.add("-noacpi"); - } catch (...) { } - - /* ioapic support */ - try { - Genode::Xml_node node = Genode::config()->xml_node().sub_node("ioapic"); - args.add("-ioapic"); - } catch (...) { } - - /* shared folder setup */ - unsigned shares = 0; - try { - using namespace Genode; - for (Xml_node node = config()->xml_node().sub_node("share"); - true; node = node.next("share")) { - - Xml_node::Attribute share_dir_host = node.attribute("host"); - Xml_node::Attribute share_dir_guest = node.attribute("guest"); - - char * dir_host = new char[share_dir_host.value_size() + 1]; - char * dir_guest = new char[share_dir_guest.value_size() + 1]; - - share_dir_host.value(dir_host, share_dir_host.value_size() + 1); - share_dir_guest.value(dir_guest, share_dir_guest.value_size() + 1); - - args.add("-share"); args.add(dir_host), args.add(dir_guest); - shares ++; - } - } catch(Genode::Xml_node::Nonexistent_sub_node) { } - - /* network setup */ - unsigned net = 0; - try { - using namespace Genode; - for (Xml_node node = config()->xml_node().sub_node("net"); - true; node = node.next("net")) { - - net ++; - - char buf [10]; - Genode::snprintf(buf, sizeof(buf), "-hifdev%d", net); - args.add(buf); - - /* read out network model, if not set use e1000 */ - try { - Xml_node::Attribute model = node.attribute("model"); - char * c_model = new char[model.value_size() + 1]; - model.value(c_model, model.value_size() + 1); - args.add(c_model); - } catch(Genode::Xml_node::Nonexistent_attribute) { - args.add("e1000"); - } - } - } catch(Genode::Xml_node::Nonexistent_sub_node) { } - - PINF("start %s image '%s' with %zu MB guest memory=%zu, %u shared folders," - " %u network connections", - c_type, c_file, vm_size / 1024 / 1024, - Genode::env()->ram_session()->avail(), shares, net); - - if (RT_FAILURE(RTR3InitExe(args.argc(), args.argvp(), 0))) { - PERR("Intialization of VBox Runtime failed."); - return 5; - } - - return TrustedMain(args.argc(), *args.argvp(), NULL); -} - -} /* extern "C" */ diff --git a/repos/ports/src/virtualbox/mm.cc b/repos/ports/src/virtualbox/mm.cc index 7ab554be93..b50643f3c7 100644 --- a/repos/ports/src/virtualbox/mm.cc +++ b/repos/ports/src/virtualbox/mm.cc @@ -84,7 +84,7 @@ class Sub_rm_connection : public Genode::Rm_connection static struct { Sub_rm_connection * conn; Libc::Mem_alloc_impl * heap; -} memory_regions [MM_TAG_HWACCM]; +} memory_regions [MM_TAG_HM + 1]; static Libc::Mem_alloc * heap_by_mmtag(MMTAG enmTag) @@ -123,18 +123,10 @@ static Libc::Mem_alloc * heap_by_pointer(void * pv) } -int MMR3Init(PVM pVM) -{ - PDBG("MMR3Init called, not implemented"); - return VINF_SUCCESS; -} - - -int MMR3InitUVM(PUVM pUVM) -{ - PDBG("MMR3InitUVM called, not implemented"); - return VINF_SUCCESS; -} +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) @@ -151,7 +143,11 @@ 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); } @@ -193,9 +189,24 @@ int MMR3HeapAllocZEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv) } +int MMR3HyperInitFinalize(PVM) +{ + return VINF_SUCCESS; +} + + +int MMR3HyperSetGuard(PVM, void* ptr, size_t, bool) +{ +// PDBG("called %p", ptr); + 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); @@ -214,13 +225,15 @@ int MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, unsigned uAlignment, 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); + AssertRelease(align_by_mmtag(enmTag) >= (uAlignment ? Genode::log2(uAlignment) : 0)); *ppv = MMR3HeapAllocZ(pVM, enmTag, cb); return VINF_SUCCESS; @@ -234,6 +247,20 @@ int MMHyperFree(PVM pVM, void *pv) } +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); @@ -244,16 +271,8 @@ void MMR3HeapFree(void *pv) } -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); } - - uint64_t MMR3PhysGetRamSize(PVM pVM) { - PDBG("MMR3PhysGetRamSize called, return 0"); - /* when called from REMR3Init, it is expected to return 0 */ return 0; } @@ -262,17 +281,15 @@ uint64_t MMR3PhysGetRamSize(PVM pVM) int MMR3HyperMapHCPhys(PVM pVM, void *pvR3, RTR0PTR pvR0, RTHCPHYS HCPhys, size_t cb, const char *pszDesc, PRTGCPTR pGCPtr) { - PDBG("pszDesc=%s", pszDesc); - + 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) { - PINF("MMR3HyperReserve: cb=0x%x, pszDesc=%s", cb, pszDesc); +// PINF("MMR3HyperReserve: cb=0x%x, pszDesc=%s", cb, pszDesc); return VINF_SUCCESS; } @@ -282,11 +299,10 @@ int MMR3HyperMapMMIO2(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb, const char *pszDesc, PRTRCPTR pRCPtr) { +/* PLOG("MMR3HyperMapMMIO2: pszDesc=%s iRegion=%u off=0x%lx cb=0x%zx", pszDesc, iRegion, (long)off, (size_t)cb); - - - +*/ return VINF_SUCCESS; } @@ -330,7 +346,7 @@ int MMR3InitPaging(PVM pVM) /* * Make the initial memory reservation with GMM. */ - PDBG("GMMR3InitialReservation missing"); + LogFlow(("GMMR3INitialReservation missing\n")); /* * If RamSize is 0 we're done now. diff --git a/repos/ports/src/virtualbox/network.patch b/repos/ports/src/virtualbox/network.patch deleted file mode 100644 index bc3538ab9e..0000000000 --- a/repos/ports/src/virtualbox/network.patch +++ /dev/null @@ -1,131 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp -@@ -7536,6 +7536,39 @@ - pState->INetworkConfig.pfnGetLinkState = e1kGetLinkState; - pState->INetworkConfig.pfnSetLinkState = e1kSetLinkState; - -+ /* For Genode attach already here to be able to overwrite mac address */ -+ rc = PDMDevHlpDriverAttach(pDevIns, 0, &pState->IBase, &pState->pDrvBase, "Network Port"); -+ if (RT_SUCCESS(rc)) -+ { -+ /* Genode: read out the mac address from nic_session interface */ -+ PPDMINETWORKCONFIG pDrvConfig = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKCONFIG); -+ Assert(pDrvConfig && pDrvConfig->pfnGetMac); -+ pDrvConfig->pfnGetMac(pDrvConfig, &pState->macConfigured); -+ -+ if (rc == VINF_NAT_DNS) -+ { -+ PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "NoDNSforNAT", -+ N_("A Domain Name Server (DNS) for NAT networking could not be determined. Ensure that your host is correctly connected to an ISP. If you ignore this warning the guest will not be able to perform nameserver lookups and it will probably observe delays if trying so")); -+ } -+ pState->pDrvR3 = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP); -+ AssertMsgReturn(pState->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"), -+ VERR_PDM_MISSING_INTERFACE_BELOW); -+ -+ pState->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASER0), PDMINETWORKUP); -+ pState->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASERC), PDMINETWORKUP); -+ } -+ else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER -+ || rc == VERR_PDM_CFG_MISSING_DRIVER_NAME) -+ { -+ /* No error! */ -+ E1kLog(("%s This adapter is not attached to any network!\n", INSTANCE(pState))); -+ } -+ else -+ return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the network LUN")); -+ -+ -+ -+ - /* Initialize the EEPROM */ - pState->eeprom.init(pState->macConfigured); - -@@ -7696,30 +7729,6 @@ - return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the status LUN")); - pState->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS); - -- rc = PDMDevHlpDriverAttach(pDevIns, 0, &pState->IBase, &pState->pDrvBase, "Network Port"); -- if (RT_SUCCESS(rc)) -- { -- if (rc == VINF_NAT_DNS) -- { -- PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "NoDNSforNAT", -- N_("A Domain Name Server (DNS) for NAT networking could not be determined. Ensure that your host is correctly connected to an ISP. If you ignore this warning the guest will not be able to perform nameserver lookups and it will probably observe delays if trying so")); -- } -- pState->pDrvR3 = PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMINETWORKUP); -- AssertMsgReturn(pState->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"), -- VERR_PDM_MISSING_INTERFACE_BELOW); -- -- pState->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASER0), PDMINETWORKUP); -- pState->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pState->pDrvBase, PDMIBASERC), PDMINETWORKUP); -- } -- else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER -- || rc == VERR_PDM_CFG_MISSING_DRIVER_NAME) -- { -- /* No error! */ -- E1kLog(("%s This adapter is not attached to any network!\n", INSTANCE(pState))); -- } -- else -- return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the network LUN")); -- - rc = RTSemEventCreate(&pState->hEventMoreRxDescAvail); - if (RT_FAILURE(rc)) - return rc; -+++ src/app/virtualbox/src/VBox/Devices/Network/DevPCNet.cpp -@@ -5331,6 +5331,11 @@ - rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Network Port"); - if (RT_SUCCESS(rc)) - { -+ /* Genode: read out the mac address from nic_session interface */ -+ PPDMINETWORKCONFIG pDrvConfig = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMINETWORKCONFIG); -+ Assert(pDrvConfig && pDrvConfig->pfnGetMac); -+ pDrvConfig->pfnGetMac(pDrvConfig, &pThis->MacConfigured); -+ - if (rc == VINF_NAT_DNS) - { - #ifdef RT_OS_LINUX -+++ src/app/virtualbox/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp -@@ -1601,11 +1630,14 @@ - /* - * Network adapters - */ -- rc = CFGMR3InsertNode(pDevices, "pcnet", &pDev); UPDATE_RC(); - for (ULONG ulInstance = 0; ulInstance < NetworkAdapterCount; ulInstance++) - { - if (g_aNetDevs[ulInstance].enmType != BFENETDEV::NOT_CONFIGURED) - { -+ /* On Genode we use pszName to select the device model */ -+ const char * device_model = g_aNetDevs[ulInstance].pszName; -+ rc = CFGMR3InsertNode(pDevices, device_model, &pDev); UPDATE_RC(); -+ - char szInstance[4]; - RTStrPrintf(szInstance, sizeof(szInstance), "%lu", ulInstance); - rc = CFGMR3InsertNode(pDev, szInstance, &pInst); UPDATE_RC(); -@@ -1616,6 +1650,10 @@ - rc = CFGMR3InsertNode(pInst, "Config", &pCfg); UPDATE_RC(); - rc = CFGMR3InsertBytes(pCfg, "MAC", &g_aNetDevs[ulInstance].Mac, sizeof(RTMAC)); - UPDATE_RC(); -+ if (!strcmp("e1000", device_model)) { -+ rc = CFGMR3InsertInteger(pCfg, "CableConnected", 1); UPDATE_RC(); -+ rc = CFGMR3InsertInteger(pCfg, "AdapterType", 0); UPDATE_RC(); -+ } - - /* - * Enable the packet sniffer if requested. -@@ -1747,10 +1785,15 @@ - - - #else -- FatalError("Name based HIF devices not implemented yet for this host platform\n"); -- return VERR_NOT_IMPLEMENTED; -+// FatalError("Name based HIF devices not implemented yet for this host platform\n"); -+// return VERR_NOT_IMPLEMENTED; - #endif - } -+ -+ rc = CFGMR3InsertNode(pInst, "LUN#999", &pLunL0); UPDATE_RC(); -+ rc = CFGMR3InsertString(pLunL0, "Driver", "MainStatus"); UPDATE_RC(); -+ rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg); UPDATE_RC(); -+ rc = CFGMR3InsertInteger(pCfg, "papLeds", (uintptr_t)&mapFDLeds[0]); UPDATE_RC(); - } - else if (g_aNetDevs[ulInstance].enmType == BFENETDEV::INTNET) - { diff --git a/repos/ports/src/virtualbox/nova/sup.cc b/repos/ports/src/virtualbox/nova/sup.cc index 48478614b0..f5dee5288b 100644 --- a/repos/ports/src/virtualbox/nova/sup.cc +++ b/repos/ports/src/virtualbox/nova/sup.cc @@ -27,10 +27,10 @@ #include /* VirtualBox includes */ -#include "HWACCMInternal.h" /* enable access to hwaccm.s.* */ +#include "HMInternal.h" /* enable access to hm.s.* */ #include "CPUMInternal.h" /* enable access to cpum.s.* */ #include -#include +#include #include /* Genode's VirtualBox includes */ @@ -58,8 +58,8 @@ void SUPR3QueryHWACCLonGenodeSupport(VM * pVM) try { Nova::Hip * hip = hip_rom.local_addr(); - pVM->hwaccm.s.svm.fSupported = hip->has_feature_svm(); - pVM->hwaccm.s.vmx.fSupported = hip->has_feature_vmx(); + pVM->hm.s.svm.fSupported = hip->has_feature_svm(); + pVM->hm.s.vmx.fSupported = hip->has_feature_vmx(); PINF("support svm %u vmx %u", hip->has_feature_svm(), hip->has_feature_vmx()); } catch (...) { @@ -75,7 +75,7 @@ int SUPR3QueryVTxSupported(void) { return VINF_SUCCESS; } int SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu) { switch (uOperation) { - case SUP_VMMR0_DO_HWACC_RUN: + case SUP_VMMR0_DO_HM_RUN: return vcpu_handler->run_hw(pVMR0, idCpu); } return VERR_INTERNAL_ERROR; @@ -107,10 +107,12 @@ int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned SUPR3QueryHWACCLonGenodeSupport(reinterpret_cast(pVMR0)); return VINF_SUCCESS; - case VMMR0_DO_HWACC_SETUP_VM: + case VMMR0_DO_GVMM_DESTROY_VM: + case VMMR0_DO_VMMR0_TERM: + case VMMR0_DO_HM_SETUP_VM: return VINF_SUCCESS; - case VMMR0_DO_HWACC_ENABLE: + case VMMR0_DO_HM_ENABLE: return VINF_SUCCESS; case VMMR0_DO_GVMM_SCHED_POKE: @@ -183,7 +185,23 @@ bool Vmm_memory::revoke_from_vm(Region *r) } -extern "C" void pthread_yield(void) { Nova::ec_ctrl(Nova::EC_YIELD); } +extern "C" void pthread_yield(void) +{ +/* + char _name[64]; + Genode::Thread_base::myself()->name(_name, sizeof(_name)); + PERR("pthread_yield %p - '%s'", __builtin_return_address(0), _name); + Assert(!"pthread_yield called"); +*/ + Nova::ec_ctrl(Nova::EC_YIELD); +} + + +void *operator new (Genode::size_t size, int log2_align) +{ + static Libc::Mem_alloc_impl heap(Genode::env()->rm_session()); + return heap.alloc(size, log2_align); +} bool create_emt_vcpu(pthread_t * pthread, size_t stack, @@ -198,12 +216,14 @@ bool create_emt_vcpu(pthread_t * pthread, size_t stack, return false; if (hip->has_feature_vmx()) - vcpu_handler = new Vcpu_handler_vmx(stack, attr, start_routine, arg, - cpu_session, location); + vcpu_handler = new (0x10) Vcpu_handler_vmx(stack, attr, start_routine, + arg, cpu_session, location); if (hip->has_feature_svm()) - vcpu_handler = new Vcpu_handler_svm(stack, attr, start_routine, arg, - cpu_session, location); + vcpu_handler = new (0x10) Vcpu_handler_svm(stack, attr, start_routine, + arg, cpu_session, location); + + Assert(!(reinterpret_cast(vcpu_handler) & 0xf)); *pthread = vcpu_handler; return true; diff --git a/repos/ports/src/virtualbox/nova/vcpu.h b/repos/ports/src/virtualbox/nova/vcpu.h index 5bd112e9d3..2fd8b4ecff 100644 --- a/repos/ports/src/virtualbox/nova/vcpu.h +++ b/repos/ports/src/virtualbox/nova/vcpu.h @@ -45,6 +45,10 @@ /* 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 packet format using a 16-bit @@ -160,14 +164,17 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher Nova::Utcb * utcb = reinterpret_cast(Thread_base::utcb()); Assert(utcb->actv_state == ACTIVITY_STATE_ACTIVE); + if (utcb->intr_state != INTERRUPT_STATE_NONE) + Vmm::printf("intr state %x %x\n", utcb->intr_state, utcb->intr_state & 0xF); + Assert(utcb->intr_state == INTERRUPT_STATE_NONE); if (utcb->inj_info & IRQ_INJ_VALID_MASK) { Assert(utcb->flags & X86_EFL_IF); - +/* if (!continue_hw_accelerated(utcb)) Vmm::printf("WARNING - recall ignored during IRQ delivery\n"); - +*/ /* got recall during irq injection and X86_EFL_IF set for * delivery of IRQ - just continue */ Nova::reply(_stack_reply); @@ -205,6 +212,9 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher Assert(utcb->actv_state == ACTIVITY_STATE_ACTIVE); Assert(utcb->intr_state == INTERRUPT_STATE_NONE); + if (utcb->inj_info & IRQ_INJ_VALID_MASK) + Vmm::printf("inj_info %x\n", utcb->inj_info); + Assert(!(utcb->inj_info & IRQ_INJ_VALID_MASK)); if (unmap) { @@ -261,6 +271,11 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher 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::printf("map guest mem %p+%x -> %lx - reason %lx\n", + flexpage.addr, 1UL << flexpage.log2_order, + flexpage.hotspot, reason); } while (res); Nova::reply(_stack_reply); @@ -335,7 +350,7 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher utcb->gdtr.limit = pCtx->gdtr.cbGdt; utcb->gdtr.base = pCtx->gdtr.pGdt; - Assert(!(VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))); + Assert(!(VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))); return true; } @@ -409,8 +424,8 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher inline bool check_to_request_irq_window(Nova::Utcb * utcb, PVMCPU pVCpu) { if (!TRPMHasTrap(pVCpu) && - !VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | - VMCPU_FF_INTERRUPT_PIC))) + !VMCPU_FF_IS_PENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | + VMCPU_FF_INTERRUPT_PIC))) return false; unsigned vector = 0; @@ -429,7 +444,7 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher Assert(utcb->intr_state == INTERRUPT_STATE_NONE); Assert(utcb->flags & X86_EFL_IF); - Assert(!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)); + Assert(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)); Assert(!(utcb->inj_info & IRQ_INJ_VALID_MASK)); Assert(_irq_win); @@ -437,10 +452,10 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher if (!TRPMHasTrap(pVCpu)) { - bool res = VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI); + bool res = VMCPU_FF_TEST_AND_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI); Assert(!res); - if (VMCPU_FF_ISPENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | + if (VMCPU_FF_IS_PENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC))) { uint8_t irq; @@ -458,26 +473,21 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher */ Assert(TRPMHasTrap(pVCpu)); - #ifdef VBOX_STRICT - if (TRPMHasTrap(pVCpu)) { - uint8_t u8Vector; - int const rc = TRPMQueryTrapAll(pVCpu, &u8Vector, 0, 0, 0); - AssertRC(rc); - } - #endif - /* interrupt can be dispatched */ uint8_t u8Vector; TRPMEVENT enmType; - SVM_EVENT Event; + SVMEVENT Event; RTGCUINT u32ErrorCode; + RTGCUINTPTR GCPtrFaultAddress; + uint8_t cbInstr; - Event.au64[0] = 0; + Event.u = 0; /* If a new event is pending, then dispatch it now. */ - int rc = TRPMQueryTrapAll(pVCpu, &u8Vector, &enmType, &u32ErrorCode, 0); + 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); @@ -489,7 +499,7 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher Event.n.u3Type = SVM_EVENT_EXTERNAL_IRQ; - utcb->inj_info = Event.au64[0]; + utcb->inj_info = Event.u; utcb->inj_error = Event.n.u32ErrorCode; /* @@ -503,21 +513,21 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher inline bool continue_hw_accelerated(Nova::Utcb * utcb) { - Assert(!(VMCPU_FF_ISSET(_current_vcpu, VMCPU_FF_INHIBIT_INTERRUPTS))); + Assert(!(VMCPU_FF_IS_SET(_current_vcpu, VMCPU_FF_INHIBIT_INTERRUPTS))); - uint32_t check_vm = VM_FF_HWACCM_TO_R3_MASK | VM_FF_REQUEST + 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_HWACCM_TO_R3_MASK + 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_ISPENDING(_current_vm, check_vm) && - !VMCPU_FF_ISPENDING(_current_vcpu, check_vcpu)) + if (!VM_FF_IS_PENDING(_current_vm, check_vm) && + !VMCPU_FF_IS_PENDING(_current_vcpu, check_vcpu)) return true; - Assert(!(VM_FF_ISPENDING(_current_vm, VM_FF_PGM_NO_MEMORY))); + Assert(!(VM_FF_IS_PENDING(_current_vm, VM_FF_PGM_NO_MEMORY))); return false; } @@ -741,6 +751,11 @@ class Vcpu_handler : public Vmm::Vcpu_dispatcher next_utcb.mtd |= Mtd::STA; } +#ifdef VBOX_WITH_REM + /* XXX see VMM/VMMR0/HMVMXR0.cpp - not necessary every time ! XXX */ + REMFlushTBs(pVM); +#endif + return _last_exit_was_recall ? VINF_SUCCESS : VINF_EM_RAW_EMULATE_INSTR; } }; diff --git a/repos/ports/src/virtualbox/nova/vcpu_svm.h b/repos/ports/src/virtualbox/nova/vcpu_svm.h index 195d01f698..1a14d0b1c9 100644 --- a/repos/ports/src/virtualbox/nova/vcpu_svm.h +++ b/repos/ports/src/virtualbox/nova/vcpu_svm.h @@ -91,26 +91,28 @@ class Vcpu_handler_svm : public Vcpu_handler { using namespace Nova; + Genode::addr_t const exc_base = vcpu().exc_base(); + typedef Vcpu_handler_svm This; register_handler(vcpu().exc_base(), Mtd(Mtd::EFL | Mtd::STA)); + &This::_svm_recall> (exc_base, Mtd::ALL | Mtd::FPU); register_handler (vcpu().exc_base(), Mtd(Mtd::ALL | Mtd::FPU)); + &This::_svm_ioio> (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); register_handler (vcpu().exc_base(), Mtd(Mtd::ALL | Mtd::FPU)); + &This::_svm_vintr> (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); register_handler (vcpu().exc_base(), Mtd(Mtd::ALL | Mtd::FPU)); + &This::_svm_default> (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); register_handler (vcpu().exc_base(), Mtd(Mtd::ALL | Mtd::FPU)); + &This::_svm_default> (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); register_handler>(vcpu().exc_base(), Mtd(Mtd::ALL | Mtd::FPU)); + &This::_svm_npt> (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); register_handler(vcpu().exc_base(), Mtd(Mtd::ALL | Mtd::FPU)); + &This::_svm_default> (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); register_handler (vcpu().exc_base(), Mtd(Mtd::ALL | Mtd::FPU)); + &This::_svm_default> (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); register_handler(vcpu().exc_base(), Mtd(Mtd::ALL | Mtd::FPU)); + &This::_svm_startup> (exc_base, Mtd(Mtd::ALL | Mtd::FPU)); start(); } diff --git a/repos/ports/src/virtualbox/nova/vcpu_vmx.h b/repos/ports/src/virtualbox/nova/vcpu_vmx.h index c8ca1800e3..24a0fdd08e 100644 --- a/repos/ports/src/virtualbox/nova/vcpu_vmx.h +++ b/repos/ports/src/virtualbox/nova/vcpu_vmx.h @@ -13,7 +13,7 @@ */ /* VirtualBox includes */ -#include +#include #include "vmm_memory.h" @@ -51,24 +51,24 @@ class Vcpu_handler_vmx : public Vcpu_handler /* 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_CONTROLS_HLT_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_MOV_DR_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDPMC_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_UNCOND_IO_EXIT | + next_utcb.ctrl[0] = VMX_VMCS_CTRL_PROC_EXEC_HLT_EXIT | + VMX_VMCS_CTRL_PROC_EXEC_MOV_DR_EXIT | + VMX_VMCS_CTRL_PROC_EXEC_RDPMC_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_CONTROLS_MONITOR_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_MWAIT_EXIT | + VMX_VMCS_CTRL_PROC_EXEC_MONITOR_EXIT | + VMX_VMCS_CTRL_PROC_EXEC_MWAIT_EXIT | */ - VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_LOAD_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_STORE_EXIT | - VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDPMC_EXIT | -/* VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_PAUSE_EXIT | */ + VMX_VMCS_CTRL_PROC_EXEC_CR8_LOAD_EXIT | + VMX_VMCS_CTRL_PROC_EXEC_CR8_STORE_EXIT | + VMX_VMCS_CTRL_PROC_EXEC_RDPMC_EXIT | +/* VMX_VMCS_CTRL_PROC_EXEC_PAUSE_EXIT | */ /* we don't support tsc offsetting for now - so let the rdtsc exit */ - VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT; + 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_REAL_MODE | + 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 | @@ -133,7 +133,7 @@ class Vcpu_handler_vmx : public Vcpu_handler &This::_vmx_triple> (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); @@ -146,7 +146,7 @@ class Vcpu_handler_vmx : public Vcpu_handler register_handler (exc_base, Mtd::ALL | Mtd::FPU); - register_handler (exc_base, Mtd::ALL | Mtd::FPU); register_handler (exc_base, Mtd::ALL | Mtd::FPU); @@ -158,7 +158,7 @@ class Vcpu_handler_vmx : public Vcpu_handler // &This::_vmx_default> (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); diff --git a/repos/ports/src/virtualbox/acpi_drv.patch b/repos/ports/src/virtualbox/patches/acpi_drv.patch similarity index 100% rename from repos/ports/src/virtualbox/acpi_drv.patch rename to repos/ports/src/virtualbox/patches/acpi_drv.patch diff --git a/repos/ports/src/virtualbox/patches/avoid_yield.patch b/repos/ports/src/virtualbox/patches/avoid_yield.patch new file mode 100644 index 0000000000..96c2d68069 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/avoid_yield.patch @@ -0,0 +1,76 @@ ++++ src/app/virtualbox/src/VBox/VMM/VMMR3/VMM.cpp +@@ -660,11 +660,13 @@ + /* + * Create the EMT yield timer. + */ ++/* + rc = TMR3TimerCreateInternal(pVM, TMCLOCK_REAL, vmmR3YieldEMT, NULL, "EMT Yielder", &pVM->vmm.s.pYieldTimer); + AssertRCReturn(rc, rc); + + rc = TMTimerSetMillies(pVM->vmm.s.pYieldTimer, pVM->vmm.s.cYieldEveryMillies); + AssertRCReturn(rc, rc); ++*/ + + #ifdef VBOX_WITH_NMI + /* +@@ -1160,6 +1162,7 @@ + */ + VMMR3_INT_DECL(void) VMMR3YieldSuspend(PVM pVM) + { ++/* + VMCPU_ASSERT_EMT(&pVM->aCpus[0]); + if (!pVM->vmm.s.cYieldResumeMillies) + { +@@ -1172,6 +1175,7 @@ + TMTimerStop(pVM->vmm.s.pYieldTimer); + } + pVM->vmm.s.u64LastYield = RTTimeNanoTS(); ++*/ + } + + +@@ -1182,10 +1186,12 @@ + */ + VMMR3_INT_DECL(void) VMMR3YieldStop(PVM pVM) + { ++#if 0 + if (!pVM->vmm.s.cYieldResumeMillies) + TMTimerStop(pVM->vmm.s.pYieldTimer); + pVM->vmm.s.cYieldResumeMillies = pVM->vmm.s.cYieldEveryMillies; + pVM->vmm.s.u64LastYield = RTTimeNanoTS(); ++#endif + } + + +@@ -1196,11 +1202,13 @@ + */ + VMMR3_INT_DECL(void) VMMR3YieldResume(PVM pVM) + { ++#if 0 + if (pVM->vmm.s.cYieldResumeMillies) + { + TMTimerSetMillies(pVM->vmm.s.pYieldTimer, pVM->vmm.s.cYieldResumeMillies); + pVM->vmm.s.cYieldResumeMillies = 0; + } ++#endif + } + + ++++ src/app/virtualbox/src/VBox/Devices/Storage/DevATA.cpp +@@ -4466,6 +4466,7 @@ + { + #ifdef IN_RING3 + cBusy = 0; ++#if 0 + PDMCritSectLeave(&pCtl->lock); + + #ifndef RT_OS_WINDOWS +@@ -4502,7 +4501,7 @@ + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + } ++#endif +- + val = s->uATARegStatus; + #else /* !IN_RING3 */ + /* Cannot yield CPU in guest context. And switching to host diff --git a/repos/ports/src/virtualbox/patches/dev_e1000.patch b/repos/ports/src/virtualbox/patches/dev_e1000.patch new file mode 100644 index 0000000000..d7b09341cd --- /dev/null +++ b/repos/ports/src/virtualbox/patches/dev_e1000.patch @@ -0,0 +1,31 @@ ++++ src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp +@@ -5721,22 +5721,29 @@ + 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 + E1kLog(("%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/eminternal.patch b/repos/ports/src/virtualbox/patches/eminternal.patch new file mode 100644 index 0000000000..c88253066e --- /dev/null +++ b/repos/ports/src/virtualbox/patches/eminternal.patch @@ -0,0 +1,15 @@ +Triggers misalignment assertion in STAM.cpp + +case STAMTYPE_PROFILE_ADV: + AssertMsg(!((uintptr_t)pvSample & 7), ("%p - %s - %u\n", pvSample, pszName, enmType)); + ++++ src/app/virtualbox/src/VBox/VMM/include/EMInternal.h +@@ -361,6 +361,8 @@ + #ifdef VBOX_WITH_RAW_MODE + /** Pointer to the PATM status structure. (R3 Ptr) */ + R3PTRTYPE(PPATMGCSTATE) pPatmGCState; ++#else ++ RTR3PTR dummyDONTUSE; + #endif + + /** Pointer to the guest CPUM state. (R3 Ptr) */ diff --git a/repos/ports/src/virtualbox/patches/fake_pci_vendor.patch b/repos/ports/src/virtualbox/patches/fake_pci_vendor.patch new file mode 100644 index 0000000000..867dd5fca9 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/fake_pci_vendor.patch @@ -0,0 +1,10 @@ ++++ src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp +@@ -5946,7 +5946,7 @@ + else + { + #endif /* VBOX_WITH_VMSVGA */ +- PCIDevSetVendorId( &pThis->Dev, 0x80ee); /* PCI vendor, just a free bogus value */ ++ PCIDevSetVendorId( &pThis->Dev, 0x80ef); /* PCI vendor, just a free bogus value */ + PCIDevSetDeviceId( &pThis->Dev, 0xbeef); + #ifdef VBOX_WITH_VMSVGA + } diff --git a/repos/ports/src/virtualbox/patches/iconv.patch b/repos/ports/src/virtualbox/patches/iconv.patch new file mode 100644 index 0000000000..186d3840a9 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/iconv.patch @@ -0,0 +1,13 @@ ++++ src/app/virtualbox/src/VBox/Runtime/r3/posix/utf8-posix.cpp +@@ -324,11 +324,7 @@ + const void *pvInputLeft = pvInput; + void *pvOutputLeft = pvOutput; + size_t cchNonRev; +-#if defined(RT_OS_LINUX) || defined(RT_OS_HAIKU) || defined(RT_OS_SOLARIS) || (defined(RT_OS_DARWIN) && defined(_DARWIN_FEATURE_UNIX_CONFORMANCE)) /* there are different opinions about the constness of the input buffer. */ + cchNonRev = iconv(icHandle, (char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft); +-#else +- cchNonRev = iconv(icHandle, (const char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft); +-#endif + if (cchNonRev != (size_t)-1) + { + if (!cbInLeft) diff --git a/repos/ports/src/virtualbox/mouse.patch b/repos/ports/src/virtualbox/patches/mouse.patch similarity index 83% rename from repos/ports/src/virtualbox/mouse.patch rename to repos/ports/src/virtualbox/patches/mouse.patch index 1459330c0e..001c59aab5 100644 --- a/repos/ports/src/virtualbox/mouse.patch +++ b/repos/ports/src/virtualbox/patches/mouse.patch @@ -8,9 +8,9 @@ alive but reads out the buffer with some delay. * @interface_method_impl{PDMIMOUSEPORT,pfnPutEvent} */ +#include - static DECLCALLBACK(int) drvMouseQueuePutEvent(PPDMIMOUSEPORT pInterface, int32_t iDeltaX, int32_t iDeltaY, int32_t iDeltaZ, int32_t iDeltaW, uint32_t fButtonStates) - { - PDRVMOUSEQUEUE pDrv = IMOUSEPORT_2_DRVMOUSEQUEUE(pInterface); + static DECLCALLBACK(int) drvMouseQueuePutEvent(PPDMIMOUSEPORT pInterface, + int32_t dx, int32_t dy, + int32_t dz, int32_t dw, @@ -121,7 +122,8 @@ PDMQueueInsert(pDrv->pQueue, &pItem->Core); return VINF_SUCCESS; diff --git a/repos/ports/src/virtualbox/patches/network.patch b/repos/ports/src/virtualbox/patches/network.patch new file mode 100644 index 0000000000..c1cc562917 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/network.patch @@ -0,0 +1,79 @@ ++++ src/app/virtualbox/src/VBox/Devices/Network/DevPCNet.cpp +@@ -5331,6 +5331,11 @@ + rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Network Port"); + if (RT_SUCCESS(rc)) + { ++ /* Genode: read out the mac address from nic_session interface */ ++ PPDMINETWORKCONFIG pDrvConfig = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMINETWORKCONFIG); ++ Assert(pDrvConfig && pDrvConfig->pfnGetMac); ++ pDrvConfig->pfnGetMac(pDrvConfig, &pThis->MacConfigured); ++ + if (rc == VINF_NAT_DNS) + { + #ifdef RT_OS_LINUX ++++ src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp +@@ -7512,6 +7519,35 @@ + pThis->fR0Enabled ? "enabled" : "disabled", + pThis->fRCEnabled ? "enabled" : "disabled")); + ++ /* For Genode attach already here to be able to overwrite mac address */ ++ /* Network driver */ ++ rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Network Port"); ++ if (RT_SUCCESS(rc)) ++ { ++ ++ /* Genode: read out the mac address from nic_session interface */ ++ PPDMINETWORKCONFIG pDrvConfig = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMINETWORKCONFIG); ++ Assert(pDrvConfig && pDrvConfig->pfnGetMac); ++ pDrvConfig->pfnGetMac(pDrvConfig, &pThis->macConfigured); ++ ++ if (rc == VINF_NAT_DNS) ++ PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "NoDNSforNAT", ++ N_("A Domain Name Server (DNS) for NAT networking could not be determined. Ensure that your host is correctly connected to an ISP. If you ignore this warning the guest will not be able to perform nameserver lookups and it will probably observe delays if trying so")); ++ pThis->pDrvR3 = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMINETWORKUP); ++ AssertMsgReturn(pThis->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"), VERR_PDM_MISSING_INTERFACE_BELOW); ++ ++ pThis->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASER0), PDMINETWORKUP); ++ pThis->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASERC), PDMINETWORKUP); ++ } ++ else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER ++ || rc == VERR_PDM_CFG_MISSING_DRIVER_NAME) ++ { ++ /* No error! */ ++ E1kLog(("%s This adapter is not attached to any network!\n", pThis->szPrf)); ++ } ++ else ++ return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the network LUN")); ++ + /* Initialize the EEPROM. */ + pThis->eeprom.init(pThis->macConfigured); + +@@ -7670,28 +7706,6 @@ + return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the status LUN")); + pThis->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS); + +- /* Network driver */ +- rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Network Port"); +- if (RT_SUCCESS(rc)) +- { +- if (rc == VINF_NAT_DNS) +- PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "NoDNSforNAT", +- N_("A Domain Name Server (DNS) for NAT networking could not be determined. Ensure that your host is correctly connected to an ISP. If you ignore this warning the guest will not be able to perform nameserver lookups and it will probably observe delays if trying so")); +- pThis->pDrvR3 = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMINETWORKUP); +- AssertMsgReturn(pThis->pDrvR3, ("Failed to obtain the PDMINETWORKUP interface!\n"), VERR_PDM_MISSING_INTERFACE_BELOW); +- +- pThis->pDrvR0 = PDMIBASER0_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASER0), PDMINETWORKUP); +- pThis->pDrvRC = PDMIBASERC_QUERY_INTERFACE(PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBASERC), PDMINETWORKUP); +- } +- else if ( rc == VERR_PDM_NO_ATTACHED_DRIVER +- || rc == VERR_PDM_CFG_MISSING_DRIVER_NAME) +- { +- /* No error! */ +- E1kLog(("%s This adapter is not attached to any network!\n", pThis->szPrf)); +- } +- else +- return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the network LUN")); +- + rc = RTSemEventCreate(&pThis->hEventMoreRxDescAvail); + if (RT_FAILURE(rc)) + return rc; diff --git a/repos/ports/src/virtualbox/patches/pdm_driver.patch b/repos/ports/src/virtualbox/patches/pdm_driver.patch new file mode 100644 index 0000000000..0241aee397 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/pdm_driver.patch @@ -0,0 +1,13 @@ ++++ src/app/virtualbox/src/VBox/VMM/VMMR3/PDMDriver.cpp +@@ -1550,7 +1550,11 @@ + LogFlow(("pdmR3DrvHlp_AsyncCompletionTemplateCreate: caller='%s'/%d: ppTemplate=%p pfnCompleted=%p pszDesc=%p:{%s}\n", + pDrvIns->pReg->szName, pDrvIns->iInstance, ppTemplate, pfnCompleted, pszDesc, pszDesc)); + ++#ifdef VBOX_WITH_PDM_ASYNC_COMPLETION + int rc = pdmR3AsyncCompletionTemplateCreateDriver(pDrvIns->Internal.s.pVMR3, pDrvIns, ppTemplate, pfnCompleted, pvTemplateUser, pszDesc); ++#else ++ int rc = VERR_NOT_IMPLEMENTED; ++#endif + + LogFlow(("pdmR3DrvHlp_AsyncCompletionTemplateCreate: caller='%s'/%d: returns %Rrc *ppThread=%p\n", pDrvIns->pReg->szName, + pDrvIns->iInstance, rc, *ppTemplate)); diff --git a/repos/ports/src/virtualbox/pdm_queue_irqs.patch b/repos/ports/src/virtualbox/patches/pdm_queue_irqs.patch similarity index 100% rename from repos/ports/src/virtualbox/pdm_queue_irqs.patch rename to repos/ports/src/virtualbox/patches/pdm_queue_irqs.patch diff --git a/repos/ports/src/virtualbox/sharedfolder_pagelist.patch b/repos/ports/src/virtualbox/patches/sharedfolder_pagelist.patch similarity index 100% rename from repos/ports/src/virtualbox/sharedfolder_pagelist.patch rename to repos/ports/src/virtualbox/patches/sharedfolder_pagelist.patch diff --git a/repos/ports/src/virtualbox/time-log-deadlock.patch b/repos/ports/src/virtualbox/patches/time-log-deadlock.patch similarity index 100% rename from repos/ports/src/virtualbox/time-log-deadlock.patch rename to repos/ports/src/virtualbox/patches/time-log-deadlock.patch diff --git a/repos/ports/src/virtualbox/timer.patch b/repos/ports/src/virtualbox/patches/timer.patch similarity index 100% rename from repos/ports/src/virtualbox/timer.patch rename to repos/ports/src/virtualbox/patches/timer.patch diff --git a/repos/ports/src/virtualbox/vbetables-gen.patch b/repos/ports/src/virtualbox/patches/vbetables-gen.patch similarity index 100% rename from repos/ports/src/virtualbox/vbetables-gen.patch rename to repos/ports/src/virtualbox/patches/vbetables-gen.patch diff --git a/repos/ports/src/virtualbox/patches/vbox_inc.patch b/repos/ports/src/virtualbox/patches/vbox_inc.patch new file mode 100644 index 0000000000..35c2bab425 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/vbox_inc.patch @@ -0,0 +1,128 @@ ++++ src/app/virtualbox/include/VBox/com/array.h +@@ -219,10 +219,10 @@ + 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; } ++++ 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 + { ++++ src/app/virtualbox/include/VBox/com/string.h +@@ -109,11 +109,13 @@ + } + + #if defined(VBOX_WITH_XPCOM) ++/* + Bstr(const wchar_t *that) + { + AssertCompile(sizeof(wchar_t) == sizeof(OLECHAR)); + copyFrom((const OLECHAR *)that); + } ++*/ + #endif + + Bstr(const RTCString &that) +@@ -151,12 +153,14 @@ + } + + #if defined(VBOX_WITH_XPCOM) ++/* + Bstr& operator=(const wchar_t *that) + { + cleanup(); + copyFrom((const OLECHAR *)that); + return *this; + } ++*/ + #endif + + Bstr& setNull() +@@ -247,7 +251,7 @@ + * 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; ++++ src/app/virtualbox/include/VBox/vmm/hm_vmx.h +@@ -1859,10 +1859,10 @@ + ".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 @@ + "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 @@ + "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 @@ + ".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 @@ + # 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 new file mode 100644 index 0000000000..e09e91bcf9 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/vbox_main.patch @@ -0,0 +1,1636 @@ ++++ src/app/virtualbox/src/VBox/Main/include/ConsoleImpl.h +@@ -50,7 +50,9 @@ + class DisplayMouseInterface; + + #include ++#if 0 + #include ++#endif /* if 0 */ + #include + #ifdef VBOX_WITH_GUEST_PROPS + # include /* For the property notification callback */ +@@ -261,10 +263,12 @@ + 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); + ++++ src/app/virtualbox/src/VBox/Main/include/DisplayImpl.h +@@ -122,7 +122,7 @@ + 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; +@@ -132,6 +132,7 @@ + + class ATL_NO_VTABLE Display : + public VirtualBoxBase, ++ public IEventListener, + VBOX_SCRIPTABLE_IMPL(IEventListener), + VBOX_SCRIPTABLE_IMPL(IDisplay), + public DisplayMouseInterface +@@ -192,7 +193,7 @@ + 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 +233,8 @@ + + static const PDMDRVREG DrvReg; + ++ static void fireGuestMonitorChangedEvent(EventSource*, GuestMonitorChangedEventType, int32_t, int32_t, int32_t, int32_t, int32_t); ++ + private: + + int updateDisplayData(void); ++++ src/app/virtualbox/src/VBox/Main/include/FramebufferImpl.h +@@ -70,6 +70,7 @@ + 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 ++++ src/app/virtualbox/src/VBox/Main/include/MachineImpl.h +@@ -1213,7 +1213,7 @@ + HRESULT setMachineState(MachineState_T aMachineState); + HRESULT updateMachineStateOnClient(); + +- HRESULT mRemoveSavedState; ++ bool mRemoveSavedState; + + ConsoleTaskData mConsoleTaskData; + ++++ src/app/virtualbox/src/VBox/Main/include/MediumFormatImpl.h +@@ -72,6 +72,8 @@ + /** Const, no need to lock */ + const PropertyArray &i_getProperties() const { return m.maProperties; } + ++ HRESULT COMGETTER(Capabilities)(ComSafeArrayOut(MediumFormatCapabilities_T, aCapabilities)); ++ + private: + + // wrapped IMediumFormat properties ++++ 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 @@ + struct Data; + Data *m; + }; ++ ++#endif /* ____H_H_NetworkServiceRunner */ ++++ src/app/virtualbox/src/VBox/Main/include/ProgressImpl.h +@@ -103,7 +103,7 @@ + #if !defined (VBOX_COM_INPROC) + VirtualBox *aParent, + #endif +- IUnknown *aInitiator, ++ void *aInitiator, + CBSTR aDescription, + BOOL aCancelable, + OUT_GUID aId = NULL) +@@ -138,7 +138,7 @@ + #if !defined (VBOX_COM_INPROC) + VirtualBox *aParent, + #endif +- IUnknown *aInitiator, ++ void *aInitiator, + CBSTR aDescription, BOOL aCancelable, + ULONG cOperations, + CBSTR bstrFirstOperationDescription, +@@ -162,7 +162,7 @@ + #if !defined (VBOX_COM_INPROC) + VirtualBox *aParent, + #endif +- IUnknown *aInitiator, ++ void *aInitiator, + CBSTR aDescription, + BOOL aCancelable, + ULONG cOperations, +@@ -180,7 +180,7 @@ + #if !defined (VBOX_COM_INPROC) + VirtualBox *aParent, + #endif +- IUnknown *aInitiator, ++ void *aInitiator, + CBSTR aDescription, OUT_GUID aId = NULL); + HRESULT init(AutoInitSpan &aAutoInitSpan); + void init(AutoUninitSpan &aAutoUninitSpan); ++++ src/app/virtualbox/src/VBox/Main/include/ProgressProxyImpl.h +@@ -52,7 +52,7 @@ + #if !defined (VBOX_COM_INPROC) + VirtualBox *pParent, + #endif +- IUnknown *pInitiator, ++ void *pInitiator, + CBSTR bstrDescription, + BOOL fCancelable, + ULONG uTotalOperationsWeight, ++++ src/app/virtualbox/src/VBox/Main/include/SessionImpl.h +@@ -135,5 +135,7 @@ + ClientTokenHolder *mClientTokenHolder; + }; + ++class IInternalSessionControl : public Session { }; ++ + #endif // !____H_SESSIONIMPL + /* vi: set tabstop=4 shiftwidth=4 expandtab: */ ++++ src/app/virtualbox/src/VBox/Main/src-all/EventImpl.cpp +@@ -1263,7 +1263,8 @@ + */ + class ATL_NO_VTABLE PassiveEventListener : + public VirtualBoxBase, +- VBOX_SCRIPTABLE_IMPL(IEventListener) ++ public IEventListener ++// VBOX_SCRIPTABLE_IMPL(IEventListener) + { + public: + +@@ -1302,7 +1303,8 @@ + /* 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 @@ + }; + + 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 @@ + 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_DECL_CLASSINFO(EventSourceAggregator) + NS_IMPL_THREADSAFE_ISUPPORTS1_CI(EventSourceAggregator, IEventSource) + #endif ++#endif + + + STDMETHODIMP EventSource::CreateListener(IEventListener **aListener) ++++ src/app/virtualbox/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp +@@ -131,6 +131,6 @@ + } + + #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 ++++ 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 @@ + else + { + ComObjPtr pVirtualBox(mParent); +- pVirtualBox.queryInterfaceTo(aInitiator); ++// pVirtualBox.queryInterfaceTo(aInitiator); + } + #else + mInitiator.queryInterfaceTo(aInitiator); +@@ -514,7 +514,7 @@ + #if !defined(VBOX_COM_INPROC) + VirtualBox *aParent, + #endif +- IUnknown *aInitiator, ++ void *aInitiator, + CBSTR aDescription, + BOOL aCancelable, + ULONG cOperations, +@@ -573,8 +573,10 @@ + #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 @@ + } + + #else /* !defined(VBOX_WITH_XPCOM) */ +- ++/* + nsCOMPtr es; + es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc); + if (NS_SUCCEEDED(rc)) +@@ -1076,6 +1078,7 @@ + } + } + } ++*/ + #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", ++++ 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 @@ + 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 @@ + #endif + } + ++#endif /* if 0 */ + + //////////////////////////////////////////////////////////////////////////////// + // ++++ 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 @@ + /* Comment out the following line to remove VMWare compatibility hack. */ + #define VMWARE_NET_IN_SLOT_11 + ++#endif + /** + * Translate IDE StorageControllerType_T to string representation. + */ +@@ -522,12 +525,12 @@ + + #define MAX_BIOS_LUN_COUNT 4 + +-static int SetBiosDiskInfo(ComPtr pMachine, PCFGMNODE pCfg, PCFGMNODE pBiosCfg, ++static HRESULT SetBiosDiskInfo(ComPtr pMachine, PCFGMNODE pCfg, PCFGMNODE pBiosCfg, + Bstr controllerName, const char * const s_apszBiosConfig[4]) + { + HRESULT hrc; + #define MAX_DEVICES 30 +-#define H() AssertMsgReturn(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), VERR_GENERAL_FAILURE) ++#define H() AssertMsgReturn(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), E_FAIL) + + LONG lPortLUN[MAX_BIOS_LUN_COUNT]; + LONG lPortUsed[MAX_DEVICES]; +@@ -599,9 +602,11 @@ + LogFlowFunc(("Top %d HBA ports = %s, %d\n", j, s_apszBiosConfig[j], lPortLUN[j])); + } + } +- return VINF_SUCCESS; ++#undef H ++ return S_OK; + } + ++#if 0 + #ifdef VBOX_WITH_PCI_PASSTHROUGH + HRESULT Console::attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *pBusMgr, PCFGMNODE pDevices) + { +@@ -741,6 +746,7 @@ + } + #endif + ++#endif /* if 0 */ + + void Console::attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds, + uint64_t uFirst, uint64_t uLast, +@@ -2070,6 +2076,8 @@ + case NetworkAdapterType_I82545EM: + InsertConfigInteger(pCfg, "AdapterType", 2); + break; ++ default: ++ break; + } + + /* +@@ -2225,6 +2233,7 @@ + /* + * Parallel (LPT) Ports + */ ++#if 0 + InsertConfigNode(pDevices, "parallel", &pDev); + for (ULONG ulInstance = 0; ulInstance < SchemaDefs::ParallelPortCount; ++ulInstance) + { +@@ -2254,6 +2263,7 @@ + InsertConfigString(pLunL1, "DevicePath", bstr); + } + ++#endif + /* + * VMM Device + */ +@@ -2286,6 +2296,7 @@ + /* + * Audio Sniffer Device + */ ++#if 0 + InsertConfigNode(pDevices, "AudioSniffer", &pDev); + InsertConfigNode(pDev, "0", &pInst); + InsertConfigNode(pInst, "Config", &pCfg); +@@ -2300,9 +2311,12 @@ + /* + * AC'97 ICH / SoundBlaster16 audio / Intel HD Audio + */ ++#endif + BOOL fAudioEnabled = FALSE; + ComPtr audioAdapter; ++#if 0 + hrc = pMachine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam()); H(); ++#endif + if (audioAdapter) + hrc = audioAdapter->COMGETTER(Enabled)(&fAudioEnabled); H(); + +@@ -2421,6 +2435,8 @@ + break; + } + #endif ++ default: ++ break; + } + hrc = pMachine->COMGETTER(Name)(bstr.asOutParam()); H(); + InsertConfigString(pCfg, "StreamName", bstr); +@@ -2430,7 +2446,9 @@ + * The USB Controllers. + */ + com::SafeIfaceArray usbCtrls; ++#if 0 + hrc = pMachine->COMGETTER(USBControllers)(ComSafeArrayAsOutParam(usbCtrls)); H(); ++#endif + bool fOhciPresent = false; /**< Flag whether at least one OHCI controller is presnet. */ + + for (size_t i = 0; i < usbCtrls.size(); ++i) +@@ -3533,6 +3551,8 @@ + 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 +3737,8 @@ + } + } + ++#endif /* if 0 */ ++ + if (pMedium) + { + BOOL fHostDrive; +@@ -3810,7 +3832,7 @@ + // InsertConfig* throws + try + { +- int rc = VINF_SUCCESS; ++// int rc = VINF_SUCCESS; + HRESULT hrc; + Bstr bstr; + PCFGMNODE pLunL1 = NULL; +@@ -4414,7 +4436,7 @@ + { + 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 +4450,12 @@ + } + } + +- 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) ++++ src/app/virtualbox/src/VBox/Main/src-client/ConsoleImpl.cpp +@@ -51,10 +51,14 @@ + #include "KeyboardImpl.h" + #include "MouseImpl.h" + #include "DisplayImpl.h" ++#include "MachineImpl.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 +@@ -68,6 +72,7 @@ + #endif + #include "BusAssignmentManager.h" + #include "EmulatedUSBImpl.h" ++#endif + + #include "VBoxEvents.h" + #include "AutoCaller.h" +@@ -75,7 +80,9 @@ + + #include + #include "VBox/com/ErrorInfo.h" ++#if 0 + #include ++#endif + + #include + #include +@@ -90,6 +97,7 @@ + #include + #include + ++#if 0 + #include + #include + #include +@@ -117,6 +125,8 @@ + # include + #endif + ++#endif /* #if 0 */ ++ + #include + #include + #include // for auto_ptr +@@ -278,6 +288,8 @@ + Reason_T mReason; + }; + ++#if 0 ++ + // Handler for global events + //////////////////////////////////////////////////////////////////////////////// + inline static const char *networkAdapterTypeToName(NetworkAdapterType_T adapterType); +@@ -383,6 +395,7 @@ + + VBOX_LISTENER_DECLARE(VmEventListenerImpl) + ++#endif /* #if 0 */ + + // constructor / destructor + ///////////////////////////////////////////////////////////////////////////// +@@ -530,6 +543,7 @@ + rc = mDisplay->init(this); + AssertComRCReturnRC(rc); + ++#if 0 + unconst(mVRDEServerInfo).createObject(); + rc = mVRDEServerInfo->init(this); + AssertComRCReturnRC(rc); +@@ -538,6 +552,7 @@ + rc = mEmulatedUSB->init(this); + AssertComRCReturnRC(rc); + ++#endif + /* Grab global and machine shared folder lists */ + + rc = fetchSharedFolders(true /* aGlobal */); +@@ -545,10 +560,12 @@ + 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 +591,11 @@ + // 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 +603,10 @@ + || 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 +614,7 @@ + AssertReturn(mUsbCardReader, E_FAIL); + #endif + ++#if 0 + /* VirtualBox events registration. */ + { + ComPtr pES; +@@ -609,6 +631,7 @@ + rc = pES->RegisterListener(aVmListener, ComSafeArrayAsInParam(eventTypes), true); + AssertComRC(rc); + } ++#endif + } + + /* Confirm a successful initialization when it's the case */ +@@ -625,6 +648,7 @@ + return S_OK; + } + ++#if 0 + /** + * Uninitializes the Console object. + */ +@@ -1035,6 +1059,8 @@ + + #endif /* VBOX_WITH_GUEST_PROPS */ + ++#endif /* #if 0 */ ++ + bool Console::isResetTurnedIntoPowerOff(void) + { + Bstr value; +@@ -1046,6 +1072,8 @@ + return false; + } + ++#if 0 ++ + #ifdef VBOX_WITH_EXTPACK + /** + * Used by VRDEServer and others to talke to the extension pack manager. +@@ -1505,6 +1533,7 @@ + return; + } + ++#endif /* if 0 */ + + //static + const char *Console::sSSMConsoleUnit = "ConsoleData"; +@@ -1970,6 +1999,8 @@ + return S_OK; + } + ++#if 0 ++ + STDMETHODIMP Console::COMGETTER(Debugger)(IMachineDebugger **aDebugger) + { + CheckComArgOutPointerValid(aDebugger); +@@ -2069,6 +2100,7 @@ + return S_OK; + } + ++#endif /* #if 0 */ + + STDMETHODIMP Console::COMGETTER(EventSource)(IEventSource ** aEventSource) + { +@@ -2085,6 +2117,8 @@ + return hrc; + } + ++#if 0 ++ + STDMETHODIMP Console::COMGETTER(AttachedPCIDevices)(ComSafeArrayOut(IPCIDeviceAttachment *, aAttachments)) + { + CheckComArgOutSafeArrayPointerValid(aAttachments); +@@ -2134,6 +2168,7 @@ + // IConsole methods + ///////////////////////////////////////////////////////////////////////////// + ++#endif /* #if 0 */ + + STDMETHODIMP Console::PowerUp(IProgress **aProgress) + { +@@ -2291,6 +2326,8 @@ + return rc; + } + ++#if 0 ++ + STDMETHODIMP Console::Reset() + { + LogFlowThisFuncEnter(); +@@ -3451,6 +3488,8 @@ + return S_OK; + } + ++#endif /* #if 0 */ ++ + // Non-interface public methods + ///////////////////////////////////////////////////////////////////////////// + +@@ -3526,6 +3565,8 @@ + } + } + ++#if 0 ++ + // private methods + ///////////////////////////////////////////////////////////////////////////// + +@@ -4388,11 +4429,15 @@ + return rc; + } + ++#endif /* #if 0 */ ++ + VMMDevMouseInterface *Console::getVMMDevMouseInterface() + { + return m_pVMMDev; + } + ++#if 0 ++ + DisplayMouseInterface *Console::getDisplayMouseInterface() + { + return mDisplay; +@@ -6490,6 +6535,8 @@ + fireMouseCapabilityChangedEvent(mEventSource, supportsAbsolute, supportsRelative, supportsMT, needsHostCursor); + } + ++#endif /* #if 0 */ ++ + void Console::onStateChange(MachineState_T machineState) + { + AutoCaller autoCaller(this); +@@ -6497,6 +6544,8 @@ + fireStateChangedEvent(mEventSource, machineState); + } + ++#if 0 ++ + void Console::onAdditionsStateChange() + { + AutoCaller autoCaller(this); +@@ -6555,6 +6604,8 @@ + fireUSBDeviceStateChangedEvent(mEventSource, aDevice, aAttached, aError); + } + ++#endif /* #if 0 */ ++ + void Console::onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage) + { + AutoCaller autoCaller(this); +@@ -6563,6 +6614,8 @@ + fireRuntimeErrorEvent(mEventSource, aFatal, aErrorID, aMessage); + } + ++#if 0 ++ + HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) + { + AssertReturn(aCanShow, E_POINTER); +@@ -6626,6 +6679,8 @@ + return S_OK; + } + ++#endif /* #if 0 */ ++ + // private methods + //////////////////////////////////////////////////////////////////////////////// + +@@ -6819,6 +6874,8 @@ + } + } + ++#if 0 ++ + char szError[RTPATH_MAX + 128]; + int vrc = com::VBoxLogRelCreate("VM", logFile.c_str(), + RTLOGFLAGS_PREFIX_TIME_PROG | RTLOGFLAGS_RESTRICT_GROUPS, +@@ -6839,6 +6896,8 @@ + if (SUCCEEDED(hrc) || cHistoryFiles) + RTDirFlush(logDir.c_str()); + ++#endif /* if 0 */ ++ + return hrc; + } + +@@ -7113,6 +7172,8 @@ + } + #endif + ++ ComPtr pVirtualBox; ++ mMachine->COMGETTER(Parent)(pVirtualBox.asOutParam()); + + // If there is immutable drive the process that. + VMPowerUpTask::ProgressList progresses(task->hardDiskProgresses); +@@ -7123,7 +7184,8 @@ + ++cOperations; + ulTotalOperationsWeight += 1; + } +- rc = pPowerupProgress->init(static_cast(this), ++ rc = pPowerupProgress->init(pVirtualBox, ++ static_cast(this), + progressDesc.raw(), + TRUE, // Cancelable + cOperations, +@@ -7136,13 +7198,15 @@ + 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 +7217,8 @@ + } + else if (fFaultToleranceSyncEnabled) + { +- rc = pPowerupProgress->init(static_cast(this), ++ rc = pPowerupProgress->init(pVirtualBox, ++ static_cast(this), + progressDesc.raw(), + TRUE /* aCancelable */, + 3 /* cOperations */, +@@ -7649,6 +7714,8 @@ + return rc; + } + ++#if 0 ++ + /** + * Searches for a shared folder with the given logical name + * in the collection of shared folders. +@@ -7684,6 +7751,8 @@ + return VBOX_E_FILE_ERROR; + } + ++#endif /* #if 0 */ ++ + /** + * Fetches the list of global or machine shared folders from the server. + * +@@ -8353,6 +8422,8 @@ + } + } + ++#if 0 ++ + /** + * Changes the clipboard mode. + * +@@ -8875,6 +8946,8 @@ + } + #endif /* (RT_OS_LINUX || RT_OS_FREEBSD) && !VBOX_WITH_NETFLT */ + ++#endif /* #if 0 */ ++ + /** + * Called at power down to terminate host interface networking. + * +@@ -9077,6 +9150,8 @@ + mControl->DetachAllUSBDevices(aDone); + } + ++#if 0 ++ + /** + * @note Locks this object for writing. + */ +@@ -9249,6 +9324,8 @@ + LogFlowThisFuncLeave(); + } + ++#endif /* #if 0 */ ++ + /** + * Progress cancelation callback for fault tolerance VM poweron + */ +@@ -9346,6 +9423,7 @@ + /* 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 +9470,7 @@ + vrc, errMsg.c_str())); + throw setErrorStatic(E_FAIL, errMsg.c_str()); + } ++#endif + + ComPtr pMachine = pConsole->machine(); + ULONG cCpus = 1; +@@ -9416,8 +9495,10 @@ + + alock.acquire(); + ++#if 0 + /* Enable client connections to the server. */ + pConsole->consoleVRDPServer()->EnableConnections(); ++#endif + + if (RT_SUCCESS(vrc)) + { +@@ -9441,9 +9522,11 @@ + /* + * Synchronize debugger settings + */ ++#if 0 + MachineDebugger *machineDebugger = pConsole->getMachineDebugger(); + if (machineDebugger) + machineDebugger->flushQueuedSettings(); ++#endif + + /* + * Shared Folders +@@ -9719,6 +9802,7 @@ + return VINF_SUCCESS; + } + ++#if 0 + + /** + * Reconfigures a medium attachment (part of taking or deleting an online snapshot). +@@ -10209,6 +10293,8 @@ + return VINF_SUCCESS; + } + ++#endif /* #if 0 */ ++ + /** + * Thread for powering down the Console. + * +@@ -10252,6 +10338,7 @@ + return VINF_SUCCESS; + } + ++#if 0 + + /** + * @interface_method_impl{VMM2USERMETHODS,pfnSaveState} +@@ -10367,6 +10454,7 @@ + } + + ++#endif /* #if 0 */ + + + /** +@@ -10461,9 +10549,11 @@ + alock.release(); + + ComPtr pNewMediumAtt; ++#if 0 + rc = pThis->pConsole->mControl->EjectMedium(pMediumAtt, pNewMediumAtt.asOutParam()); + if (SUCCEEDED(rc)) + fireMediumChangedEvent(pThis->pConsole->mEventSource, pNewMediumAtt); ++#endif + + alock.acquire(); + if (pNewMediumAtt != pMediumAtt) ++++ src/app/virtualbox/src/VBox/Main/src-client/DisplayImpl.cpp +@@ -16,9 +16,12 @@ + */ + + #include "DisplayImpl.h" ++#include "MachineImpl.h" + #include "DisplayUtils.h" + #include "ConsoleImpl.h" ++#if 0 + #include "ConsoleVRDPServer.h" ++#endif + #include "VMMDev.h" + + #include "AutoCaller.h" +@@ -1067,7 +1070,9 @@ + * 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 @@ + /* 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 @@ + 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 @@ + 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 @@ + 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 @@ + + 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 @@ + 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 @@ + { + /* VRDP server still need this notification. */ + LogRelFlowFunc(("Calling VRDP\n")); ++#if 0 + pThis->mParent->consoleVRDPServer()->SendResize(); ++#endif + } + return VINF_SUCCESS; + } ++++ 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 @@ + 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 @@ + LogFlowFuncLeave(); + } + ++#ifdef VBOX_WITH_GUEST_CONTROL + /* static */ + DECLCALLBACK(void) Guest::staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick) + { +@@ -194,6 +196,7 @@ + + NOREF(hTimerLR); + } ++#endif + + /* static */ + int Guest::staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit, +@@ -1177,8 +1180,11 @@ + + 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(); + } + ++++ 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" +@@ -329,7 +332,9 @@ + + /* query IInternalMachineControl interface */ + mControl = aMachine; ++#if 0 + AssertReturn(!!mControl, E_FAIL); ++#endif + + #ifndef VBOX_COM_INPROC_API_CLIENT + HRESULT rc = mConsole.createObject(); +@@ -349,6 +354,7 @@ + AssertPtr(aToken); + #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */ + /* create the machine client token */ ++#if 0 + try + { + #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER +@@ -367,6 +373,7 @@ + { + rc = E_OUTOFMEMORY; + } ++#endif + + /* + * Reference the VirtualBox object to ensure the server is up +@@ -1217,12 +1224,14 @@ + + if (mType == SessionType_WriteLock) + { ++#if 0 + if (mClientTokenHolder) + { + delete mClientTokenHolder; + mClientTokenHolder = NULL; + } + ++#endif + if (!aFinalRelease && !aFromServer) + { + /* ++++ 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 @@ + if (RT_FAILURE(rc)) + return rc; + ++#if 0 + rc = pCallbacks->pfnRegister(pCallbacks, &AudioSniffer::DrvReg); + if (RT_FAILURE(rc)) + return rc; +@@ -78,6 +81,7 @@ + rc = pCallbacks->pfnRegister(pCallbacks, &EmWebcam::DrvReg); + if (RT_FAILURE(rc)) + return rc; ++#endif + + #ifdef VBOX_WITH_USB_CARDREADER + rc = pCallbacks->pfnRegister(pCallbacks, &UsbCardReader::DrvReg); ++++ src/app/virtualbox/src/VBox/Main/src-client/VMMDevInterface.cpp +@@ -553,7 +553,9 @@ + { + PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface); + Console *pConsole = pDrv->pVMMDev->getParent(); ++#if 0 + BOOL val = 0; ++#endif + + if (!pfPageFusionEnabled) + return VERR_INVALID_POINTER; ++++ 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" + ++++ src/app/virtualbox/src/VBox/Main/src-server/MachineImplCloneVM.cpp +@@ -889,7 +889,7 @@ + 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, ++++ 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), ++++ src/app/virtualbox/src/VBox/Main/src-server/NetworkAdapterImpl.cpp +@@ -1332,7 +1332,7 @@ + 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; + } + ++++ 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 @@ + ComObjPtr pChildSnapshot = aTask.pSnapshot->getFirstChild(); + if (pChildSnapshot) + { +- pMachine = pChildSnapshot->getSnapshotMachine(); ++ pMachine = &*pChildSnapshot->getSnapshotMachine(); + childSnapshotId = pChildSnapshot->getId(); + } + pAtt = findAttachment(pMachine->mMediaData->mAttachments, it->mpSource); ++++ 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 @@ + 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 @@ + + 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 @@ + /* add to the collection of registered machines */ + m->allMachines.addChild(aMachine); + ++#if 0 + if (autoCaller.state() != InInit) + rc = saveSettings(); ++#endif + + return rc; + } ++++ 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 @@ + return S_OK; + } + ++#if 0 + static int loadVRDELibrary(const char *pszLibraryName, RTLDRMOD *phmod, PFNVRDESUPPORTEDPROPERTIES *ppfn) + { + int rc = VINF_SUCCESS; +@@ -530,6 +531,7 @@ + + return rc; + } ++#endif + + STDMETHODIMP VRDEServer::COMGETTER(VRDEProperties)(ComSafeArrayOut(BSTR, aProperties)) + { +@@ -584,13 +586,14 @@ + /* + * 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) + { ++++ src/app/virtualbox/src/VBox/Main/xml/Settings.cpp +@@ -4922,6 +4922,8 @@ + case DeviceType_Floppy: + pcszType = "Floppy"; + break; ++ default: ++ break; + } + + pelmDevice->setAttribute("type", pcszType); +@@ -5273,6 +5275,8 @@ + case AudioDriverType_MMPM: + #endif + return true; ++ default: ++ break; + } + + return false; ++++ src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp +@@ -3522,7 +3522,7 @@ + tr("The given session is busy")); + + // get the client's IInternalSessionControl interface +- ComPtr pSessionControl = aSession; ++ ComPtr pSessionControl = aSession; + ComAssertMsgRet(!!pSessionControl, ("No IInternalSessionControl interface"), + E_INVALIDARG); + +@@ -3826,8 +3826,10 @@ + /* 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 +@@ -3933,7 +3935,7 @@ + ComObjPtr progress; + progress.createObject(); + rc = progress->init(mParent, +- static_cast(this), ++ nullptr, + Bstr(tr("Starting VM")).raw(), + TRUE /* aCancelable */, + fTeleporterEnabled ? 20 : 10 /* uTotalOperationsWeight */, +@@ -4920,7 +4922,7 @@ + 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 @@ + 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 @@ + 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)); + +@@ -5610,7 +5612,7 @@ + + pTask->pProgress.createObject(); + pTask->pProgress->init(getVirtualBox(), +- static_cast(this) /* aInitiator */, ++ nullptr /* aInitiator */, + Bstr(tr("Deleting files")).raw(), + true /* fCancellable */, + pTask->llFilesToDelete.size() + pTask->llMediums.size() + 1, // cOperations +@@ -8025,7 +8027,9 @@ + 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; +@@ -8096,10 +8100,14 @@ + } + strSupStartLogArg.append(strStartupLogFile); + } ++#if defined(VBOX_WITH_QTGUI) || defined(VBOX_WITH_VBOXSDL) || defined(VBOX_WITH_HEADLESS) + const char *pszSupStartupLogArg = strSupStartLogArg.c_str(); ++#endif + #else ++#if defined(VBOX_WITH_QTGUI) || defined(VBOX_WITH_VBOXSDL) || defined(VBOX_WITH_HEADLESS) + const char *pszSupStartupLogArg = NULL; + #endif ++#endif + + + #ifdef VBOX_WITH_QTGUI +@@ -8500,6 +8508,7 @@ + + // 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 @@ + // 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 @@ + { + 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 @@ + 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 @@ + + 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 @@ + * 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 @@ + { + 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 @@ + 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 @@ + if (FAILED(iResult)) + setMachineState(mConsoleTaskData.mLastState); + +- return endSavingState(iResult, aErrMsg); ++ return endSavingState(Global::vboxStatusCodeToCOM(iResult), aErrMsg); + } + + /** ++++ src/app/virtualbox/src/VBox/Main/src-server/MediumImpl.cpp +@@ -20,6 +20,7 @@ + #include "ProgressImpl.h" + #include "SystemPropertiesImpl.h" + #include "VirtualBoxImpl.h" ++#include "TokenImpl.h" + + #include "AutoCaller.h" + #include "Logging.h" +@@ -679,16 +680,21 @@ + + HRESULT rc = pTask->handler(); + ++ Progress * p = nullptr; ++ + /* complete the progress if run asynchronously */ + if (pTask->isAsync()) + { + if (!pTask->mProgress.isNull()) +- pTask->mProgress->notifyComplete(rc); ++ p = pTask->mProgress; + } + + /* pTask is no longer needed, delete it. */ + delete pTask; + ++ if (p) ++ p->notifyComplete(rc); ++ + LogFlowFunc(("rc=%Rhrc\n", rc)); + LogFlowFuncLeave(); + +@@ -1231,7 +1237,7 @@ + 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 +2584,7 @@ + + 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 +2764,7 @@ + ComSafeArrayIn(MediumVariant_T, aVariant), + IProgress **aProgress) + { +- int rc = S_OK; ++ HRESULT rc = S_OK; + CheckComArgNotNull(aTarget); + CheckComArgOutPointerValid(aProgress); + CheckComArgSafeArrayNotNull(aVariant); diff --git a/repos/ports/src/virtualbox/vga_fb.patch b/repos/ports/src/virtualbox/patches/vga_fb.patch similarity index 100% rename from repos/ports/src/virtualbox/vga_fb.patch rename to repos/ports/src/virtualbox/patches/vga_fb.patch diff --git a/repos/ports/src/virtualbox/vga_vbva.patch b/repos/ports/src/virtualbox/patches/vga_vbva.patch similarity index 100% rename from repos/ports/src/virtualbox/vga_vbva.patch rename to repos/ports/src/virtualbox/patches/vga_vbva.patch diff --git a/repos/ports/src/virtualbox/vmdk.patch b/repos/ports/src/virtualbox/patches/vmdk.patch similarity index 100% rename from repos/ports/src/virtualbox/vmdk.patch rename to repos/ports/src/virtualbox/patches/vmdk.patch diff --git a/repos/ports/src/virtualbox/patches/vmmdev.patch b/repos/ports/src/virtualbox/patches/vmmdev.patch new file mode 100644 index 0000000000..42c0dc498e --- /dev/null +++ b/repos/ports/src/virtualbox/patches/vmmdev.patch @@ -0,0 +1,49 @@ ++++ src/app/virtualbox/src/VBox/Devices/VMMDev/VMMDev.cpp +@@ -2179,6 +2179,10 @@ + ("%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; +@@ -2404,7 +2408,6 @@ + pReqHdr->rc = vmmdevReqHandler_HGCMCall(pThis, pReqHdr, GCPhysReqHdr); + *pfDelayedUnlock = true; + break; +-#endif /* VBOX_WITH_HGCM */ + + case VMMDevReq_HGCMCancel: + pReqHdr->rc = vmmdevReqHandler_HGCMCancel(pThis, pReqHdr, GCPhysReqHdr); +@@ -2414,6 +2417,7 @@ + case VMMDevReq_HGCMCancel2: + pReqHdr->rc = vmmdevReqHandler_HGCMCancel2(pThis, pReqHdr); + break; ++#endif /* VBOX_WITH_HGCM */ + + case VMMDevReq_VideoAccelEnable: + pReqHdr->rc = vmmdevReqHandler_VideoAccelEnable(pThis, pReqHdr); +@@ -3595,8 +3599,10 @@ + /* disabled statistics updating */ + pThis->u32LastStatIntervalSize = 0; + ++#ifdef VBOX_WITH_HGCM + /* Clear the "HGCM event enabled" flag so the event can be automatically reenabled. */ + pThis->u32HGCMEnabled = 0; ++#endif + + /* + * Clear the event variables. ++++ src/app/virtualbox/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp +@@ -19,7 +19,7 @@ + /******************************************************************************* + * Header Files * + *******************************************************************************/ +-#define LOG_GROUP LOG_GROUP_DEV_VMM ++#define LOG_GROUP LOG_GROUP_HGCM + #include + #include + #include diff --git a/repos/ports/src/virtualbox/pdm.cc b/repos/ports/src/virtualbox/pdm.cc index 89dba21466..6b2c150685 100644 --- a/repos/ports/src/virtualbox/pdm.cc +++ b/repos/ports/src/virtualbox/pdm.cc @@ -49,8 +49,7 @@ int PDMR3LdrGetSymbolRCLazy(PVM pVM, const char *pszModule, static void R0SymbolDummy() { - PDBG("unexpected call of R0 symbol"); - for (;;); + Assert(!"unexpected call of R0 symbol"); } @@ -73,6 +72,7 @@ int PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule, extern "C" int VBoxDriversRegister(PCPDMDRVREGCB, uint32_t); extern "C" int VBoxDevicesRegister(PPDMDEVREGCB, uint32_t); +extern "C" int VBoxDriversRegister_Main(PCPDMDRVREGCB, uint32_t); static int dummy_VBoxDriversRegister(PCPDMDRVREGCB, uint32_t) { return VINF_SUCCESS; } @@ -95,13 +95,11 @@ int PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const char *pszSymbol, if (Genode::strcmp(pszSymbol, "VBoxDriversRegister") == 0) { *ppvValue = (void *)VBoxDriversRegister; - PDBG("return VBoxDriversRegister pointer"); return VINF_SUCCESS; } if (Genode::strcmp(pszSymbol, "VBoxDevicesRegister") == 0) { *ppvValue = (void *)VBoxDevicesRegister; - PDBG("return VBoxDevicesRegister pointer"); return VINF_SUCCESS; } } @@ -119,7 +117,14 @@ int PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const char *pszSymbol, } } - PDBG("pszModule=%s pszSymbol=%s", pszModule, pszSymbol); + if (Genode::strcmp(pszModule, "VBoxC") == 0) { + if (Genode::strcmp(pszSymbol, "VBoxDriversRegister") == 0) { + *ppvValue = (void *)VBoxDriversRegister_Main; + return VINF_SUCCESS; + } + } + + PERR("pszModule=%s pszSymbol=%s", pszModule, pszSymbol); return VERR_SYMBOL_NOT_FOUND; } diff --git a/repos/ports/src/virtualbox/pgm.cc b/repos/ports/src/virtualbox/pgm.cc index ea4cc80bd7..020c14acf9 100644 --- a/repos/ports/src/virtualbox/pgm.cc +++ b/repos/ports/src/virtualbox/pgm.cc @@ -19,6 +19,8 @@ /* VirtualBox includes */ #include "PGMInternal.h" /* enable access to pgm.s.* */ +#include "EMInternal.h" + #include #include #include @@ -33,7 +35,7 @@ using Genode::Ram_session; using Genode::Rm_session; -static bool debug = false; +static bool verbose = false; static bool verbose_debug = false; Vmm_memory *vmm_memory() @@ -56,18 +58,17 @@ static DECLCALLBACK(int) romwritehandler(PVM pVM, RTGCPHYS GCPhys, PGMACCESSTYPE enmAccessType, void *pvUser) { - while (1) { - Assert(!"Somebody tries to write to ROM"); - } - return 0; + 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) { - PLOG("PGMR3PhysRomRegister: GCPhys=0x%llx cb=0x%llx pvBinary=0x%p - '%s'", - GCPhys, cb, pvBinary, pszDesc); + if (verbose) + PLOG("%s: GCPhys=0x%llx cb=0x%llx pvBinary=0x%p - '%s'", __func__, + (Genode::uint64_t)GCPhys, (Genode::uint64_t)cb, pvBinary, pszDesc); try { RTGCPHYS GCPhysLast = GCPhys + (cb - 1); @@ -109,11 +110,29 @@ int PGMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, } +static int pgmR3PhysWriteExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, + const void *pvBuf, size_t cbWrite) +{ + VM_ASSERT_EMT(pVM); + + return PGMPhysWrite(pVM, *pGCPhys, pvBuf, cbWrite); +} + + int PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite) { + VM_ASSERT_EMT(pVM); + void *pv = guest_memory()->lookup(GCPhys, cbWrite); + if (verbose_debug) + PDBG("%s: GCPhys=0x%llx pvBuf=0x%p cb=0x%zx pv=%p", __func__, + (Genode::uint64_t)GCPhys, pvBuf, cbWrite, pv); + if (pv) { + void * pvx = vmm_memory()->lookup(GCPhys, cbWrite); + Assert(!pvx); + memcpy(pv, pvBuf, cbWrite); return VINF_SUCCESS; } @@ -124,8 +143,8 @@ int PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite) pv = vmm_memory()->lookup(GCPhys, cbWrite, &pfnHandlerR3, &pvUserR3); if (!pv || !pfnHandlerR3 || !pvUserR3) { - PERR("PGMPhysWrite skipped: GCPhys=0x%lx pvBuf=0x%p cbWrite=0x%zx", - GCPhys, pvBuf, cbWrite); + PERR("%s skipped: GCPhys=0x%llx pvBuf=0x%p cbWrite=0x%zx", __func__, + (Genode::uint64_t)GCPhys, pvBuf, cbWrite); return VERR_GENERAL_FAILURE; } @@ -145,21 +164,27 @@ int PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite) int PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, const char *pszWho) { -// PDBG("GCPhys=0x%llx pvBuf=0x%p cbWrite=0x%zx - '%s'", -// GCPhys, pvBuf, cbWrite, pszWho); + VM_ASSERT_OTHER_THREAD(pVM); - return PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite); + return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, + (PFNRT)pgmR3PhysWriteExternalEMT, 4, + pVM, &GCPhys, pvBuf, cbWrite); } int PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) { + VM_ASSERT_EMT(pVM); + void *pv = guest_memory()->lookup(GCPhys, cbRead); -// PLOG("PGMPhysRead: GCPhys=0x%x pvBuf=0x%p cbRead=0x%zx pv=%p", -// GCPhys, pvBuf, cbRead, pv); + if (verbose_debug) + PDBG("%s: GCPhys=0x%llx pvBuf=0x%p cbRead=0x%zx pv=%p", __func__, + (Genode::uint64_t)GCPhys, pvBuf, cbRead, pv); if (pv) { + void * pvx = vmm_memory()->lookup(GCPhys, cbRead); + Assert(!pvx); memcpy(pvBuf, pv, cbRead); return VINF_SUCCESS; } @@ -169,8 +194,8 @@ int PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) pv = vmm_memory()->lookup(GCPhys, cbRead, &pfnHandlerR3, &pvUserR3); if (!pv || !pfnHandlerR3 || !pvUserR3) { - PERR("PGMPhysRead skipped: GCPhys=0x%lx pvBuf=0x%p cbRead=0x%zx", - GCPhys, pvBuf, cbRead); + PERR("PGMPhysRead skipped: GCPhys=0x%llx pvBuf=0x%p cbRead=0x%zx", + (Genode::uint64_t)GCPhys, pvBuf, cbRead); return VERR_GENERAL_FAILURE; } @@ -179,14 +204,23 @@ int PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) } +static int pgmR3PhysReadExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, void *pvBuf, + size_t cbRead) +{ + VM_ASSERT_EMT(pVM); + + PGMPhysRead(pVM, *pGCPhys, pvBuf, cbRead); + return VINF_SUCCESS; +} + + int PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) { - void *pv = guest_memory()->lookup(GCPhys, cbRead); + VM_ASSERT_OTHER_THREAD(pVM); -// PLOG("PGMPhysReadExternal: GCPhys=0x%x pvBuf=0x%p cbRead=0x%zx pv=%p", -// GCPhys, pvBuf, cbRead, pv); - - return PGMPhysRead(pVM, GCPhys, pvBuf, cbRead); + return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, + (PFNRT)pgmR3PhysReadExternalEMT, 4, + pVM, &GCPhys, pvBuf, cbRead); } @@ -196,25 +230,34 @@ int PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, { *ppv = vmm_memory()->alloc((size_t)cb, pDevIns, iRegion); - PLOG("PGMR3PhysMMIO2Register: pszDesc=%s iRegion=%u cb=0x%zx -> 0x%p", - pszDesc, iRegion, (size_t)cb, *ppv); + if (verbose) + PLOG("PGMR3PhysMMIO2Register: pszDesc=%s iRegion=%u cb=0x%zx -> 0x%p", + pszDesc, iRegion, (size_t)cb, *ppv); return VINF_SUCCESS; } +int PGMR3PhysMMIO2Deregister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion) +{ + PERR("%s: pDevIns %p iRegion=%x", __func__, pDevIns, 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) { - PERR("PGMR3PhysMMIO2Map: lookup for pDevIns=%p iRegion=%u failed\n", + PERR("%s: lookup for pDevIns=%p iRegion=%u failed\n", __func__, pDevIns, iRegion); - for (;;); + Assert(cb); } - PLOG("PGMR3PhysMMIO2Map: pDevIns=%p iRegion=%u cb=0x%zx GCPhys=0x%lx\n", - pDevIns, iRegion, cb, (long)GCPhys); + if (verbose) + PLOG("%s: pDevIns=%p iRegion=%u cb=0x%zx GCPhys=0x%llx\n", __func__, + pDevIns, iRegion, cb, (Genode::uint64_t)GCPhys); #ifdef VBOX_WITH_REM REMR3NotifyPhysRamRegister(pVM, GCPhys, cb, REM_NOTIFY_PHYS_RAM_FLAGS_MMIO2); @@ -227,19 +270,22 @@ int PGMR3PhysMMIO2Map(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, int PGMR3PhysMMIO2Unmap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys) { - if (debug) - PDBG("called phys=%llx iRegion=0x%x", GCPhys, iRegion); + if (verbose_debug) + PDBG("called phys=%llx iRegion=0x%x", (Genode::uint64_t)GCPhys, + iRegion); + RTGCPHYS GCPhysStart = GCPhys; 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 -#if 0 /* XXX */ - if (fInformREM) - REMR3NotifyPhysRamDeregister(pVM, GCPhysRangeREM, cbRangeREM); -#endif + REMR3NotifyPhysRamDeregister(pVM, GCPhysStart, size); #endif return VINF_SUCCESS; } @@ -248,8 +294,8 @@ int PGMR3PhysMMIO2Unmap(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, bool PGMR3PhysMMIO2IsBase(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys) { bool res = vmm_memory()->lookup(GCPhys, 1); - if (debug) - PDBG("called phys=%llx res=%u", GCPhys, res); + if (verbose_debug) + PDBG("called phys=%llx res=%u", (Genode::uint64_t)GCPhys, res); return res; } @@ -263,9 +309,10 @@ int PGMR3HandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, const char *pszHandlerRC, RTRCPTR pvUserRC, const char *pszDesc) { - PLOG("PGMR3HandlerPhysicalRegister: GCPhys=0x%llx-%llx r3=0x%p " - "enmType=%x - '%s'\n", - GCPhys, GCPhysLast, pfnHandlerR3, enmType, pszDesc); + if (verbose) + PLOG("%s: GCPhys=0x%llx-%llx r3=0x%p enmType=%x - '%s'\n", __func__, + (Genode::uint64_t)GCPhys, (Genode::uint64_t)GCPhysLast, + pfnHandlerR3, enmType, pszDesc); bool ok = vmm_memory()->add_handler(GCPhys, GCPhysLast - GCPhys + 1, pfnHandlerR3, pvUserR3, enmType); @@ -286,13 +333,13 @@ int PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys) #ifdef VBOX_WITH_REM PFNPGMR3PHYSHANDLER pfnHandlerR3 = 0; - PGMPHYSHANDLERTYPE enmType; + PGMPHYSHANDLERTYPE enmType = PGMPHYSHANDLERTYPE_MMIO; void * pv = vmm_memory()->lookup(GCPhys, size, &pfnHandlerR3, 0, &enmType); Assert(pv); - if (debug) - PDBG("called phys=%llx enmType=%x", GCPhys, enmType); + if (verbose_debug) + PDBG("called phys=%llx enmType=%x", (Genode::uint64_t)GCPhys, enmType); #endif @@ -318,8 +365,9 @@ int PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys) int PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, const char *pszDesc) { - PLOG("PGMR3PhysRegisterRam: GCPhys=0x%lx, cb=0x%zx, pszDesc=%s", - (long)GCPhys, (size_t)cb, pszDesc); + if (verbose) + PLOG("PGMR3PhysRegisterRam: GCPhys=0x%llx, cb=0x%llx, pszDesc=%s", + (Genode::uint64_t)GCPhys, (Genode::uint64_t)cb, pszDesc); try { @@ -334,7 +382,9 @@ int PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, 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; } @@ -349,8 +399,10 @@ int PGMR3PhysRegisterRam(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, int PGMMapSetPage(PVM pVM, RTGCPTR GCPtr, uint64_t cb, uint64_t fFlags) { - PLOG("PGMMapSetPage: GCPtr=0x%llx cb=0x%llx, flags=0x%llx", - GCPtr, cb, fFlags); + if (verbose) + PLOG("%s: GCPtr=0x%llx cb=0x%llx, flags=0x%llx", __func__, + (Genode::uint64_t)GCPtr, (Genode::uint64_t)cb, + (Genode::uint64_t)fFlags); return VINF_SUCCESS; } @@ -378,6 +430,18 @@ int PGMR3Init(PVM pVM) 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) +{ + if (verbose) + PDBG("called"); + return VINF_SUCCESS; } @@ -388,7 +452,7 @@ int PGMPhysGCPtr2CCPtrReadOnly(PVMCPU pVCpu, RTGCPTR GCPtr, void const **ppv, PERR("%s not implemented - caller 0x%p", __func__, __builtin_return_address(0)); - while (1) { asm volatile ("ud2a"); } + Assert(!"not implemented"); return VERR_GENERAL_FAILURE; } @@ -407,22 +471,22 @@ int PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv) pv = guest_memory()->lookup(GCPhys, size); if (!pv) { - PERR("%s: lookup for GCPhys=0x%llx failed", __func__, GCPhys); + PERR("%s: lookup for GCPhys=0x%llx failed", __func__, + (Genode::uint64_t)GCPhys); return VERR_PGM_PHYS_TLB_UNASSIGNED; } *ppv = pv; if (verbose_debug) - PDBG("%llx %u -> 0x%p", GCPhys, fWritable, pv); + PDBG("%s: %llx %u -> 0x%p", __func__, + (Genode::uint64_t)GCPhys, fWritable, pv); return VINF_SUCCESS; } /* pv valid - check handlers next */ if (!pfnHandlerR3 && !pvUserR3) { - PERR("%s: %llx %u -> 0x%p no handlers", __func__, GCPhys, fWritable, pv); - *ppv = pv; return VINF_SUCCESS; } @@ -431,7 +495,8 @@ int PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv) *ppv = pv; return VINF_PGM_PHYS_TLB_CATCH_WRITE; } - PERR("%s: denied access - handlers set - GCPhys=0x%llx %p %p %x", __func__, GCPhys, pfnHandlerR3, pvUserR3, enmType); + PERR("%s: denied access - handlers set - GCPhys=0x%llx %p %p %x", __func__, + (Genode::uint64_t)GCPhys, pfnHandlerR3, pvUserR3, enmType); return VERR_PGM_PHYS_TLB_CATCH_ALL; } @@ -458,12 +523,21 @@ bool PGMPhysIsA20Enabled(PVMCPU pVCpu) void PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t value) { + VM_ASSERT_EMT(pVM); + void *pv = guest_memory()->lookup(GCPhys, sizeof(value)); + if (verbose_debug) + PDBG("%s: GCPhys=0x%llx cb=0x%zx pv=%p", __func__, + (Genode::uint64_t)GCPhys, sizeof(value), pv); + if (!pv) { - PERR("%s: invalid write attempt phy=%llx", __func__, GCPhys); + PERR("%s: invalid write attempt phy=%llx", __func__, + (Genode::uint64_t)GCPhys); return; } + void * pvx = vmm_memory()->lookup(GCPhys, sizeof(value)); + Assert(!pvx); *reinterpret_cast(pv) = value; } @@ -471,12 +545,21 @@ void PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t value) void PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t value) { + VM_ASSERT_EMT(pVM); + void *pv = guest_memory()->lookup(GCPhys, sizeof(value)); + if (verbose_debug) + PDBG("%s: GCPhys=0x%llx cb=0x%zx pv=%p", + __func__, (Genode::uint64_t)GCPhys, sizeof(value), pv); + if (!pv) { - PERR("%s: invalid write attempt phy=%llx", __func__, GCPhys); + PERR("%s: invalid write attempt phy=%llx", __func__, + (Genode::uint64_t)GCPhys); return; } + void * pvx = vmm_memory()->lookup(GCPhys, sizeof(value)); + Assert(!pvx); *reinterpret_cast(pv) = value; } @@ -486,10 +569,17 @@ void PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t value) { void *pv = guest_memory()->lookup(GCPhys, sizeof(value)); + if (verbose_debug) + PDBG("%s: GCPhys=0x%llx cb=0x%zx pv=%p", + __func__, (Genode::uint64_t)GCPhys, sizeof(value), pv); + if (!pv) { - PERR("%s: invalid write attempt phy=%llx", __func__, GCPhys); + PERR("%s: invalid write attempt phy=%llx", __func__, + (Genode::uint64_t)GCPhys); return; } + void * pvx = vmm_memory()->lookup(GCPhys, sizeof(value)); + Assert(!pvx); *reinterpret_cast(pv) = value; } @@ -499,11 +589,19 @@ uint32_t PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys) { void *pv = guest_memory()->lookup(GCPhys, 4); + if (verbose_debug) + PDBG("%s: GCPhys=0x%llx cb=0x%x pv=%p", + __func__, (Genode::uint64_t)GCPhys, 4, pv); + if (!pv) { - PERR("%s: invalid read attempt phys=%llx", __func__, GCPhys); + PERR("%s: invalid read attempt phys=%llx", __func__, + (Genode::uint64_t)GCPhys); return 0; } + void * pvx = vmm_memory()->lookup(GCPhys, 4); + Assert(!pvx); + return *reinterpret_cast(pv); } @@ -513,8 +611,13 @@ int PGMPhysGCPhys2CCPtrReadOnly(PVM pVM, RTGCPHYS GCPhys, void const **ppv, { void *pv = guest_memory()->lookup(GCPhys, 0x1000); + if (verbose_debug) + PDBG("%s: GCPhys=0x%llx cb=0x%d pv=%p", + __func__, (Genode::uint64_t)GCPhys, 0x1000, pv); + if (!pv) { - PERR("unknown address pv=%p ppv=%p GCPhys=%llx", pv, ppv, GCPhys); + PERR("unknown address pv=%p ppv=%p GCPhys=%llx", pv, ppv, + (Genode::uint64_t)GCPhys); guest_memory()->dump(); @@ -523,8 +626,6 @@ int PGMPhysGCPhys2CCPtrReadOnly(PVM pVM, RTGCPHYS GCPhys, void const **ppv, *ppv = pv; - PVMCPU pVCpu = VMMGetCpu(pVM); - return VINF_SUCCESS; } @@ -533,7 +634,8 @@ int PGMHandlerPhysicalReset(PVM, RTGCPHYS GCPhys) { size_t size = 1; if (!vmm_memory()->unmap_from_vm(GCPhys, size)) - PWRN("%s: unbacked region - GCPhys %llx", __func__, GCPhys); + PWRN("%s: unbacked region - GCPhys %llx", __func__, + (Genode::uint64_t)GCPhys); return VINF_SUCCESS; } @@ -560,6 +662,8 @@ extern "C" int MMIO2_MAPPED_SYNC(PVM pVM, RTGCPHYS GCPhys, size_t cbWrite, if (!pfnHandlerR3 && !pvUserR3) { *ppv = pv; +// Vmm::printf("------------------ %s: GCPhys=0x%llx vmm local %p io mem map - no handlers\n", __func__, GCPhys, pv); +// return VERR_PGM_PHYS_TLB_UNASSIGNED; /* you may map it */ return VINF_SUCCESS; } @@ -574,8 +678,8 @@ extern "C" int MMIO2_MAPPED_SYNC(PVM pVM, RTGCPHYS GCPhys, size_t cbWrite, return VINF_SUCCESS; } - Vmm::printf("%s: GCPhys=0x%lx failed - unexpected rc=%d\n", - __func__, GCPhys, rc); + Vmm::printf("%s: GCPhys=0x%llx failed - unexpected rc=%d\n", + __func__, (Genode::uint64_t)GCPhys, rc); return rc; } @@ -589,9 +693,10 @@ extern "C" int MMIO2_MAPPED_SYNC(PVM pVM, RTGCPHYS GCPhys, size_t cbWrite, Assert(pv); fli = Flexpage_iterator((addr_t)pv, map_size, map_start, map_size, map_start); - if (debug) - Vmm::printf("%s: GCPhys=0x%llx - %llx+%zx\n", - __func__, GCPhys, map_start, map_size); + if (verbose_debug) + Vmm::printf("%s: GCPhys=0x%llx - %llx+%zx\n", __func__, + (Genode::uint64_t)GCPhys, (Genode::uint64_t)map_start, + map_size); *ppv = pv; @@ -627,7 +732,7 @@ void PGMR3Reset(PVM pVM) #ifdef PGM_WITH_A20 pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL; VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); - HWACCMFlushTLB(pVCpu); + HMFlushTLB(pVCpu); #endif } } @@ -638,9 +743,24 @@ void PGMR3Reset(PVM pVM) int PGMR3MappingsSize(PVM pVM, uint32_t *pcb) { - PINF("%s - not implemented - %p", __func__, __builtin_return_address(0)); + if (verbose) + PINF("%s - not implemented - %p", __func__, + __builtin_return_address(0)); *pcb = 0; return 0; } + + +void PGMR3MemSetup(PVM pVM, bool fAtReset) +{ + if (verbose) + PDBG(" called"); +} + + +VMMDECL(bool) PGMIsLockOwner(PVM pVM) +{ + return PDMCritSectIsOwner(&pVM->pgm.s.CritSectX); +} diff --git a/repos/ports/src/virtualbox/rt.cc b/repos/ports/src/virtualbox/rt.cc index eca086717c..8a5fff96da 100644 --- a/repos/ports/src/virtualbox/rt.cc +++ b/repos/ports/src/virtualbox/rt.cc @@ -19,36 +19,49 @@ #include #include #include +#include #include #include #include +static void *alloc_mem(size_t cb, const char *pszTag, bool executable = false) +{ + void * local_addr = nullptr; + + using namespace Genode; + + try { + Ram_dataspace_capability ds = env()->ram_session()->alloc(cb); + Assert(ds.valid()); + + size_t const whole_size = 0; + Genode::off_t const offset = 0; + bool const any_addr = false; + void * any_local_addr = nullptr; + + local_addr = env()->rm_session()->attach(ds, whole_size, offset, + any_addr, any_local_addr, + executable); + + if (!local_addr) + PERR("size=0x%zx, tag=%s -> %p", cb, pszTag, local_addr); + Assert(local_addr); + + } catch (...) { + Assert(!"Could not allocate RTMem* memory "); + } + + return local_addr; +} + + /* * Called by the recompiler to allocate executable RAM */ - void *RTMemExecAllocTag(size_t cb, const char *pszTag) RT_NO_THROW { - PDBG("size=0x%zx, tag=%s", cb, pszTag); - - /* - * XXX error handling is missing - */ - - using namespace Genode; - Ram_dataspace_capability ds = env()->ram_session()->alloc(cb); - - size_t const whole_size = 0; - Genode::off_t const offset = 0; - bool const executable = true; - bool const any_addr = false; - - void *local_addr = - env()->rm_session()->attach(ds, whole_size, offset, - any_addr, (void *)0, executable); - - return local_addr; + return alloc_mem(cb, pszTag, true); } @@ -58,17 +71,21 @@ void *RTMemPageAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW * The RAM dataspace freshly allocated by 'RTMemExecAllocTag' is zeroed * already. */ - return RTMemExecAllocTag(cb, pszTag); + return alloc_mem(cb, pszTag); } - void *RTMemPageAllocTag(size_t cb, const char *pszTag) RT_NO_THROW { - return RTMemPageAllocZTag(cb, pszTag); + return alloc_mem(cb, pszTag); } +void RTMemPageFree(void *pv, size_t cb) RT_NO_THROW +{ + PERR("%s %p+%zx", __func__, pv, cb); +} + #include uint32_t RTBldCfgVersionMajor(void) { return VBOX_VERSION_MAJOR; } diff --git a/repos/ports/src/virtualbox/rtc.patch b/repos/ports/src/virtualbox/rtc.patch deleted file mode 100644 index da960170de..0000000000 --- a/repos/ports/src/virtualbox/rtc.patch +++ /dev/null @@ -1,9 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp -@@ -1470,6 +1481,7 @@ - rc = CFGMR3InsertNode(pDevices, "mc146818", &pDev); UPDATE_RC(); - rc = CFGMR3InsertNode(pDev, "0", &pInst); UPDATE_RC(); - rc = CFGMR3InsertNode(pInst, "Config", &pCfg); UPDATE_RC(); -+ rc = CFGMR3InsertInteger(pCfg, "UseUTC", 1); /* boolean */ UPDATE_RC(); - - /* - * Serial ports diff --git a/repos/ports/src/virtualbox/serial.patch b/repos/ports/src/virtualbox/serial.patch deleted file mode 100644 index bdd1c338f3..0000000000 --- a/repos/ports/src/virtualbox/serial.patch +++ /dev/null @@ -1,13 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp -@@ -1481,6 +1489,11 @@ - rc = CFGMR3InsertInteger(pCfg, "IRQ", 4); UPDATE_RC(); - rc = CFGMR3InsertInteger(pCfg, "IOBase", 0x3f8); UPDATE_RC(); - -+/* rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); UPDATE_RC(); -+ rc = CFGMR3InsertString(pLunL0, "Driver", "Host Serial"); UPDATE_RC(); -+ rc = CFGMR3InsertNode(pLunL0, "Config", &pLunL1); UPDATE_RC(); -+ rc = CFGMR3InsertString(pLunL1, "DevicePath", "/dev/terminal"); UPDATE_RC(); -+*/ - rc = CFGMR3InsertNode(pDev, "1", &pInst); UPDATE_RC(); - rc = CFGMR3InsertNode(pInst, "Config", &pCfg); UPDATE_RC(); - rc = CFGMR3InsertInteger(pCfg, "IRQ", 3); UPDATE_RC(); diff --git a/repos/ports/src/virtualbox/sharedfolder.patch b/repos/ports/src/virtualbox/sharedfolder.patch deleted file mode 100644 index f61eff44a8..0000000000 --- a/repos/ports/src/virtualbox/sharedfolder.patch +++ /dev/null @@ -1,12 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp 2014-05-14 -@@ -1132,7 +1135,9 @@ - parms[1].u.pointer.size = sizeof (SHFLSTRING) + cbString; - - parms[2].type = VBOX_HGCM_SVC_PARM_32BIT; -- parms[2].u.uint32 = !g_fShareReadOnly[i]; -+ parms[2].u.uint32 = g_fShareReadOnly[i] ? 0 : SHFL_ADD_MAPPING_F_WRITABLE; -+ -+ parms[2].u.uint32 |= SHFL_ADD_MAPPING_F_AUTOMOUNT; - - rc2 = gVMMDev->hgcmHostCall ("VBoxSharedFolders", - SHFL_FN_ADD_MAPPING, SHFL_CPARMS_ADD_MAPPING, &parms[0]); diff --git a/repos/ports/src/virtualbox/sup.cc b/repos/ports/src/virtualbox/sup.cc index bd35cc59cc..e7ebbeb43e 100644 --- a/repos/ports/src/virtualbox/sup.cc +++ b/repos/ports/src/virtualbox/sup.cc @@ -20,6 +20,8 @@ #include "sup.h" /* VirtualBox includes */ +#include +#include #include @@ -169,6 +171,9 @@ int SUPR3Init(PSUPDRVSESSION *ppSession) } +int SUPR3Term(bool) { return VINF_SUCCESS; } + + int SUPR3GipGetPhys(PRTHCPHYS pHCPhys) { /* @@ -181,6 +186,18 @@ int SUPR3GipGetPhys(PRTHCPHYS pHCPhys) } +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) { *phEvent = (SUPSEMEVENT)new Genode::Semaphore(); @@ -201,7 +218,7 @@ int SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) if (hEvent) reinterpret_cast(hEvent)->up(); else - PERR("%s called %lx", __FUNCTION__, hEvent); + PERR("%s called - not implemented", __FUNCTION__); return VINF_SUCCESS; } @@ -213,7 +230,7 @@ int SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, if (hEvent && cMillies == RT_INDEFINITE_WAIT) reinterpret_cast(hEvent)->down(); else { - PERR("%s called %lx millis=%u - not implemented", __FUNCTION__, hEvent, cMillies); + PERR("%s called millis=%u - not implemented", __FUNCTION__, cMillies); reinterpret_cast(hEvent)->down(); } @@ -221,16 +238,52 @@ int SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, } +SUPDECL(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; +} + + +SUPDECL(int) SUPSemEventMultiClose(PSUPDRVSESSION, SUPSEMEVENTMULTI hEvMulti) +{ + return RTSemEventMultiDestroy(reinterpret_cast(hEvMulti)); +} + + int SUPR3CallVMMR0(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation, void *pvArg) { - PDBG("SUPR3CallVMMR0 called uOperation=%d", uOperation); - if (uOperation == VMMR0_DO_CALL_HYPERVISOR) { PDBG("VMMR0_DO_CALL_HYPERVISOR - doing nothing"); return VINF_SUCCESS; } + if (uOperation == VMMR0_DO_VMMR0_TERM) { + PDBG("VMMR0_DO_VMMR0_TERM - doing nothing"); + return VINF_SUCCESS; + } + if (uOperation == VMMR0_DO_GVMM_DESTROY_VM) { + PDBG("VMMR0_DO_GVMM_DESTROY_VM - doing nothing"); + return VINF_SUCCESS; + } - PDBG("SUPR3CallVMMR0Ex: unhandled uOperation %d", uOperation); - for (;;); + AssertMsg(uOperation != VMMR0_DO_VMMR0_TERM && + uOperation != VMMR0_DO_CALL_HYPERVISOR && + uOperation != VMMR0_DO_GVMM_DESTROY_VM, + ("SUPR3CallVMMR0Ex: unhandled uOperation %d", uOperation)); + return VERR_GENERAL_FAILURE; } diff --git a/repos/ports/src/virtualbox/target.mk b/repos/ports/src/virtualbox/target.mk index 1300ed080c..a18fcb4913 100644 --- a/repos/ports/src/virtualbox/target.mk +++ b/repos/ports/src/virtualbox/target.mk @@ -2,18 +2,22 @@ VBOX_CC_OPT += -DVBOX_WITH_HARDENING include $(REP_DIR)/lib/mk/virtualbox-common.inc +CC_WARN += -Wall + TARGET = virtualbox -SRC_CC = main.cc cxx_dummies.cc devices.cc drivers.cc dummies.cc libc.cc \ +SRC_CC = frontend/main.cc frontend/console.cc \ + devices.cc drivers.cc dummies.cc libc.cc \ logger.cc mm.cc pdm.cc pgm.cc rt.cc sup.cc iommio.cc ioport.cc \ - hwaccm.cc thread.cc dynlib.cc + hm.cc thread.cc dynlib.cc unimpl.cc LIBS += base LIBS += config_args +LIBS += stdcxx LIBS += virtualbox-bios virtualbox-recompiler virtualbox-runtime \ virtualbox-vmm virtualbox-devices virtualbox-drivers \ virtualbox-storage virtualbox-zlib virtualbox-liblzf \ - virtualbox-hwaccl virtualbox-dis + virtualbox-hwaccl virtualbox-xml virtualbox-main LIBS += pthread libc_terminal libc_lock_pipe libiconv @@ -21,26 +25,21 @@ INC_DIR += $(call select_from_repositories,src/lib/libc) INC_DIR += $(call select_from_repositories,src/lib/pthread) INC_DIR += $(VBOX_DIR)/Runtime/include -INC_DIR += $(VBOX_DIR)/Frontends/VBoxBFE - -# basic frontend -SRC_CC += Frontends/VBoxBFE/DisplayImpl.cpp -SRC_CC += Frontends/VBoxBFE/HGCM.cpp -SRC_CC += Frontends/VBoxBFE/HGCMObjects.cpp -SRC_CC += Frontends/VBoxBFE/HGCMThread.cpp -SRC_CC += Frontends/VBoxBFE/KeyboardImpl.cpp -SRC_CC += Frontends/VBoxBFE/MachineDebuggerImpl.cpp -SRC_CC += Frontends/VBoxBFE/StatusImpl.cpp -SRC_CC += Frontends/VBoxBFE/VBoxBFE.cpp -SRC_CC += Frontends/VBoxBFE/VMMDevInterface.cpp 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 += 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 += $(VBOX_DIR)/Main/xml + # search path to 'scan_code_set_2.h' INC_DIR += $(call select_from_repositories,src/drivers/input/ps2) diff --git a/repos/ports/src/virtualbox/thread.cc b/repos/ports/src/virtualbox/thread.cc index d1719ca8fb..1663fa6cd5 100644 --- a/repos/ports/src/virtualbox/thread.cc +++ b/repos/ports/src/virtualbox/thread.cc @@ -45,62 +45,80 @@ static Genode::Cpu_session * get_cpu_session(RTTHREADTYPE type) { long const prio = (RTTHREADTYPE_END - type) * (Cpu_session::PRIORITY_LIMIT / RTTHREADTYPE_END); - char * data = new (env()->heap()) char[32]; + char * data = new (env()->heap()) char[16]; - snprintf(data, 32, "vbox %u", type); + snprintf(data, 16, "vbox %u", type); con[type - 1] = new (env()->heap()) Cpu_connection(data, prio); + /* upgrade memory of cpu session for frequent used thread type */ + if (type == RTTHREADTYPE_IO) + Genode::env()->parent()->upgrade(con[type - 1]->cap(), "ram_quota=4096"); + return con[type - 1]; } -extern "C" { +extern "C" int pthread_create(pthread_t *thread, const pthread_attr_t *attr, + void *(*start_routine) (void *), void *arg) +{ + PRTTHREADINT rtthread = reinterpret_cast(arg); - int pthread_create(pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine) (void *), void *arg) - { - PRTTHREADINT rtthread = reinterpret_cast(arg); + Assert(rtthread); - Assert(rtthread); + size_t stack_size = Genode::Native_config::context_virtual_size() - + sizeof(Genode::Native_utcb) - 2 * (1UL << 12); - size_t stack_size = Genode::Native_config::context_virtual_size() - - sizeof(Genode::Native_utcb) - 2 * (1UL << 12); + if (rtthread->cbStack < stack_size) + stack_size = rtthread->cbStack; + else + PWRN("requested stack for thread '%s' of %zu Bytes is too large, " + "limit to %zu Bytes", rtthread->szName, rtthread->cbStack, + stack_size); - if (rtthread->cbStack < stack_size) - stack_size = rtthread->cbStack; - else - PWRN("requested stack for thread '%s' of %zu Bytes is too large, " - "limit to %zu Bytes", rtthread->szName, rtthread->cbStack, - stack_size); + /* sanity check - emt and vcpu thread have to have same prio class */ + if (!Genode::strcmp(rtthread->szName, "EMT")) + Assert(rtthread->enmType == RTTHREADTYPE_EMULATION); - /* sanity check - emt and vcpu thread have to have same prio class */ - if (!Genode::strcmp(rtthread->szName, "EMT")) - Assert(rtthread->enmType == RTTHREADTYPE_EMULATION); - - if (rtthread->enmType == RTTHREADTYPE_EMULATION) { - Genode::Cpu_session * cpu_session = get_cpu_session(RTTHREADTYPE_EMULATION); - Genode::Affinity::Space cpu_space = cpu_session->affinity_space(); -/* Genode::Affinity::Location location = cpu_space.location_of_index(i); */ - Genode::Affinity::Location location; - if (create_emt_vcpu(thread, stack_size, attr, start_routine, arg, - cpu_session, location)) - return 0; - /* no haredware support, create normal pthread thread */ - } - - pthread_t thread_obj = new (Genode::env()->heap()) - pthread(attr ? *attr : 0, start_routine, - arg, stack_size, rtthread->szName, - get_cpu_session(rtthread->enmType)); - - if (!thread_obj) - return EAGAIN; - - *thread = thread_obj; - - thread_obj->start(); - - return 0; + if (rtthread->enmType == RTTHREADTYPE_EMULATION) { + Genode::Cpu_session * cpu_session = get_cpu_session(RTTHREADTYPE_EMULATION); +/* + Genode::Affinity::Space cpu_space = cpu_session->affinity_space(); + Genode::Affinity::Location location = cpu_space.location_of_index(i); +*/ + Genode::Affinity::Location location; + if (create_emt_vcpu(thread, stack_size, attr, start_routine, arg, + cpu_session, location)) + return 0; + /* no haredware support, create normal pthread thread */ } + + pthread_t thread_obj = new (Genode::env()->heap()) + pthread(attr ? *attr : 0, start_routine, + arg, stack_size, rtthread->szName, + get_cpu_session(rtthread->enmType)); + + if (!thread_obj) + return EAGAIN; + + *thread = thread_obj; + + thread_obj->start(); + + return 0; +} + +extern "C" int pthread_attr_setdetachstate(pthread_attr_t *, int) +{ + return 0; +} + +extern "C" int pthread_attr_setstacksize(pthread_attr_t *, size_t) +{ + return 0; +} + +extern "C" int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)) +{ + return 0; } diff --git a/repos/ports/src/virtualbox/unimpl.cc b/repos/ports/src/virtualbox/unimpl.cc new file mode 100644 index 0000000000..4ca9f84716 --- /dev/null +++ b/repos/ports/src/virtualbox/unimpl.cc @@ -0,0 +1,213 @@ +/* + * \brief Dummy implementations of symbols needed by VirtualBox + * \author Norman Feske + * \date 2013-08-22 + */ + +/* + * Copyright (C) 2013 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) { \ + PDBG( #name " called, not implemented, eip=%p", \ + __builtin_return_address(0)); \ + while (1) { Assert(!"not implemented"); } \ +} + +DUMMY(RTErrCOMGet) + +DUMMY(DBGFR3CoreWrite) +DUMMY(DBGCRegisterCommands) +DUMMY(DBGFR3Event) +DUMMY(DBGFR3EventAssertion) +DUMMY(DBGFR3EventBreakpoint) +DUMMY(DBGFR3EventSrc) +DUMMY(DBGFR3VMMForcedAction) +DUMMY(DBGFR3DisasInstrEx) +DUMMY(DBGFR3DisasInstrCurrentLogInternal) + +DUMMY(HMInvalidatePage) +DUMMY(HMFlushTLB) +DUMMY(HMR3EmulateIoBlock) +DUMMY(HMR3PatchTprInstr) +DUMMY(HMR3CheckError) +DUMMY(HMR3RestartPendingIOInstr) +DUMMY(HMR3EnablePatching) +DUMMY(HMR3DisablePatching) +DUMMY(HMGetPaePdpes) +DUMMY(HMR3ResetCpu) +DUMMY(HMSetSingleInstruction) + +DUMMY(IEMExecOne) +DUMMY(IEMExecLots) + +DUMMY(MMHyperR0ToCC) +DUMMY(MMHyperRCToCC) + +DUMMY(MMR3HeapAPrintfV) +DUMMY(MMR3LockCall) +DUMMY(PDMR3AsyncCompletionTemplateCreateDriver) +DUMMY(PDMR3LdrGetInterfaceSymbols) +DUMMY(PDMCritSectBothFF) + +DUMMY(PGMNotifyNxeChanged) +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(PGMR3ResetCpu) + +DUMMY(PGMR3PhysAllocateHandyPages) +DUMMY(PGMR3PhysAllocateLargeHandyPage) +DUMMY(PGMR3PhysChangeMemBalloon) +DUMMY(PGMR3PhysChunkMap) +DUMMY(PGMR3PhysGCPhys2CCPtrExternal) +DUMMY(PGMR3PhysGCPhys2CCPtrReadOnlyExternal) +DUMMY(PGMR3PhysMMIO2MapKernel) +DUMMY(PGMR3PhysReadU16) +DUMMY(PGMR3PhysReadU64) +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(SUPSemEventMultiWaitNoResume) +DUMMY(SUPSemEventMultiReset) + +DUMMY(VMMR3FatalDump) +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(RTTcpClientConnect) +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(RTSymlinkCreate) +DUMMY(RTSymlinkRead) +DUMMY(RTSymlinkDelete) + +DUMMY(RTNetIPv6PseudoChecksumEx) + +DUMMY(pthread_mutex_timedlock) +DUMMY(pthread_kill) + +DUMMY(RTZipXarFsStreamFromIoStream) + +DUMMY(FTMR3CancelStandby) +DUMMY(FTMR3PowerOn) + +} /* extern "C" */ diff --git a/repos/ports/src/virtualbox/util.h b/repos/ports/src/virtualbox/util.h index 71714cf730..d2779c59ff 100644 --- a/repos/ports/src/virtualbox/util.h +++ b/repos/ports/src/virtualbox/util.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2013 Genode Labs GmbH + * Copyright (C) 2013-2014 Genode Labs GmbH * * This file is distributed under the terms of the GNU General Public License * version 2. @@ -24,16 +24,13 @@ template RTRCPTR to_rtrcptr(T* ptr) { - return (RTRCPTR)((long)ptr & 0xffffffff); -} + unsigned long long u64 = reinterpret_cast(ptr); + RTRCPTR rtrcptr = u64 & 0xFFFFFFFFULL; -/** - * 64bit-aware cast of RTRCPTR (uint32_t) to pointer - */ -template -T* from_rtrcptr(RTRCPTR rcptr) -{ - return (T*)(rcptr | 0L); + AssertMsg((u64 == rtrcptr) || (u64 >> 32) == 0xFFFFFFFFULL, + ("pointer transformation - %llx != %x", u64, rtrcptr)); + + return rtrcptr; } #endif /* _UTIL_H_ */ diff --git a/repos/ports/src/virtualbox/vboxbfe.patch b/repos/ports/src/virtualbox/vboxbfe.patch deleted file mode 100644 index 53f99b3525..0000000000 --- a/repos/ports/src/virtualbox/vboxbfe.patch +++ /dev/null @@ -1,13 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Frontends/VBoxBFE/VirtualBoxBase.h -@@ -24,10 +24,9 @@ - # include - #else - # include -+# include // For the AssertComRC macro - #endif - --#include // For the AssertComRC macro -- - #include - #include - #include diff --git a/repos/ports/src/virtualbox/vmmdev.patch b/repos/ports/src/virtualbox/vmmdev.patch deleted file mode 100644 index acea3db714..0000000000 --- a/repos/ports/src/virtualbox/vmmdev.patch +++ /dev/null @@ -1,39 +0,0 @@ -+++ src/app/virtualbox/src/VBox/Devices/VMMDev/VMMDev.cpp -@@ -770,6 +770,10 @@ - ("%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; -@@ -1854,7 +1858,6 @@ - } - break; - } --#endif /* VBOX_WITH_HGCM */ - - case VMMDevReq_HGCMCancel: - { -@@ -1899,6 +1902,7 @@ - } - break; - } -+#endif /* VBOX_WITH_HGCM */ - - case VMMDevReq_VideoAccelEnable: - { -@@ -3341,8 +3345,10 @@ - /* disabled statistics updating */ - pThis->u32LastStatIntervalSize = 0; - -+#ifdef VBOX_WITH_HGCM - /* Clear the "HGCM event enabled" flag so the event can be automatically reenabled. */ - pThis->u32HGCMEnabled = 0; -+#endif - - /* - * Clear the event variables. diff --git a/repos/ports/src/virtualbox/vmx_c++.patch b/repos/ports/src/virtualbox/vmx_c++.patch deleted file mode 100644 index 1c8e4a8c00..0000000000 --- a/repos/ports/src/virtualbox/vmx_c++.patch +++ /dev/null @@ -1,63 +0,0 @@ -+++ src/app/virtualbox/include/VBox/vmm/hwacc_vmx.h -@@ -1338,10 +1338,10 @@ - ".byte 0xF3, 0x0F, 0xC7, 0x34, 0x24 # VMXON [esp] \n\t" - "ja 2f \n\t" - "je 1f \n\t" -- "movl $"STR(VERR_VMX_INVALID_VMXON_PTR)", %0 \n\t" -+ "movl $" STR(VERR_VMX_INVALID_VMXON_PTR)", %0 \n\t" - "jmp 2f \n\t" - "1: \n\t" -- "movl $"STR(VERR_VMX_GENERIC)", %0 \n\t" -+ "movl $" STR(VERR_VMX_GENERIC)", %0 \n\t" - "2: \n\t" - "add $8, %%esp \n\t" - :"=rm"(rc) -@@ -1418,7 +1418,7 @@ - "push %2 \n\t" - ".byte 0x66, 0x0F, 0xC7, 0x34, 0x24 # VMCLEAR [esp] \n\t" - "jnc 1f \n\t" -- "movl $"STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" -+ "movl $" STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" - "1: \n\t" - "add $8, %%esp \n\t" - :"=rm"(rc) -@@ -1466,7 +1466,7 @@ - "push %2 \n\t" - ".byte 0x0F, 0xC7, 0x34, 0x24 # VMPTRLD [esp] \n\t" - "jnc 1f \n\t" -- "movl $"STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" -+ "movl $" STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" - "1: \n\t" - "add $8, %%esp \n\t" - :"=rm"(rc) -@@ -1520,10 +1520,10 @@ - ".byte 0x0F, 0x79, 0xC2 # VMWRITE eax, edx \n\t" - "ja 2f \n\t" - "je 1f \n\t" -- "movl $"STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" -+ "movl $" STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" - "jmp 2f \n\t" - "1: \n\t" -- "movl $"STR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t" -+ "movl $" STR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t" - "2: \n\t" - :"=rm"(rc) - :"0"(VINF_SUCCESS), -@@ -1607,14 +1607,14 @@ - int rc = VINF_SUCCESS; - # if RT_INLINE_ASM_GNU_STYLE - __asm__ __volatile__ ( -- "movl $"STR(VINF_SUCCESS)", %0 \n\t" -+ "movl $" STR(VINF_SUCCESS)", %0 \n\t" - ".byte 0x0F, 0x78, 0xc2 # VMREAD eax, edx \n\t" - "ja 2f \n\t" - "je 1f \n\t" -- "movl $"STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" -+ "movl $" STR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t" - "jmp 2f \n\t" - "1: \n\t" -- "movl $"STR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t" -+ "movl $" STR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t" - "2: \n\t" - :"=&r"(rc), - "=d"(*pData)