Remove virtualbox 4 vmm

Fixes #3141
This commit is contained in:
Alexander Boettcher 2019-02-11 14:38:15 +01:00 committed by Norman Feske
parent 87d526968c
commit 6bb145bdd8
168 changed files with 34 additions and 14372 deletions

View File

@ -1,25 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
#
# Prevent inclusion of the Genode::Log definition after the vbox #define
# of 'Log'. Otherwise, the attemt to compile base/log.h will fail.
#
VBOX_CC_OPT += -include base/log.h
LIBS += stdcxx sinfo-muen
SRC_CC = pgm.cc sup.cc
INC_DIR += $(call select_from_repositories,src/lib/libc)
INC_DIR += $(VBOX_DIR)/Main/xml
INC_DIR += $(VBOX_DIR)/Main/include
INC_DIR += $(VBOX_DIR)/VMM/include
INC_DIR += $(REP_DIR)/src/virtualbox
INC_DIR += $(REP_DIR)/src/virtualbox/frontend
INC_DIR += $(REP_DIR)/src/virtualbox/spec/muen
vpath pgm.cc $(REP_DIR)/src/virtualbox/
vpath sup.cc $(REP_DIR)/src/virtualbox/spec/muen/
CC_CXX_WARN_STRICT =

View File

@ -1,25 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
#
# Prevent inclusion of the Genode::Log definition after the vbox #define
# of 'Log'. Otherwise, the attemt to compile base/log.h will fail.
#
VBOX_CC_OPT += -include base/log.h
LIBS += stdcxx
SRC_CC = sup.cc pgm.cc
INC_DIR += $(call select_from_repositories,src/lib/libc)
INC_DIR += $(VBOX_DIR)/Main/xml
INC_DIR += $(VBOX_DIR)/Main/include
INC_DIR += $(VBOX_DIR)/VMM/include
INC_DIR += $(REP_DIR)/src/virtualbox
INC_DIR += $(REP_DIR)/src/virtualbox/frontend
INC_DIR += $(REP_DIR)/src/virtualbox/spec/nova
vpath pgm.cc $(REP_DIR)/src/virtualbox/
vpath sup.cc $(REP_DIR)/src/virtualbox/spec/nova/
CC_CXX_WARN_STRICT =

View File

@ -11,7 +11,7 @@ INC_DIR += $(VIRTUALBOX_DIR)/VBoxAPIWrap
INC_DIR += $(VBOX_DIR)/Main/xml
INC_DIR += $(VBOX_DIR)/Main/include
INC_DIR += $(VBOX_DIR)/VMM/include
INC_DIR += $(REP_DIR)/src/virtualbox
INC_DIR += $(REP_DIR)/src/virtualbox5
INC_DIR += $(REP_DIR)/src/virtualbox5/frontend
vpath sup.cc $(REP_DIR)/src/virtualbox5/spec/nova/

View File

@ -1,39 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
ifeq ($(shell which yasm),)
REQUIRES += installation_of_yasm
endif
SRC_O += VBoxPcBiosBin.o VBoxVgaBiosBin.o VBoxBiosLogoBin.o
VBox%Bin.o : VBox%Bin.rom
$(MSG_CONVERT)$@
$(VERBOSE)echo ".global g_ab$*Binary, g_cb$*Binary;" \
".data;" \
"g_cb$*Binary:; .long g_ab$*BinaryEnd - g_ab$*Binary;" \
".align 4096;" \
"g_ab$*Binary:; .incbin \"$<\";" \
"g_ab$*BinaryEnd:;" | \
$(AS) $(AS_OPT) -f -o $@ -
VBoxPcBiosBin.rom: Devices/PC/BIOS/VBoxBiosAlternative.asm
$(MSG_ASSEM)
$(VERBOSE)yasm -f bin -o $@ $<
VBoxVgaBiosBin.rom: Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm
$(MSG_ASSEM)
$(VERBOSE)yasm -f bin -o $@ $<
VBoxBiosLogoBin.o: Devices/Graphics/BIOS/ose_logo.bmp
$(MSG_CONVERT)$@
$(VERBOSE)echo ".global g_abVgaDefBiosLogo, g_cbVgaDefBiosLogo;" \
".data;" \
"g_cbVgaDefBiosLogo:; .long g_abVgaDefBiosLogoEnd - g_abVgaDefBiosLogo;" \
".align 4096;" \
"g_abVgaDefBiosLogo:; .incbin \"$<\";" \
"g_abVgaDefBiosLogoEnd:;" | \
$(AS) $(AS_OPT) -f -o $@ -
vpath %.bmp $(VBOX_DIR)
CC_CXX_WARN_STRICT =

View File

@ -1,108 +0,0 @@
REQUIRES += x86
VBOX_MACH := $(filter $(SPECS), x86_32 x86_64)
VBOX_MACH_CC_OPT_x86_32 = -DRT_ARCH_X86 -D__X86__
VBOX_MACH_ASM_OPT_x86_32 = -f elf32
VBOX_MACH_CC_OPT_x86_64 = -DRT_ARCH_AMD64 -D__AMD64__
VBOX_MACH_ASM_OPT_x86_64 = -f elf64
ifeq ($(shell which yasm),)
REQUIRES += installation_of_yasm
REQUIRES += installation_of_iasl
endif
VIRTUALBOX_DIR = $(call select_from_ports,virtualbox)/src/app/virtualbox
VIRTUALBOX_SDK_DIR = $(call select_from_ports,virtualbox)/src/app/virtualbox_sdk
VBOX_DIR = $(VIRTUALBOX_DIR)/src/VBox
VBOX_CC_OPT += -DIN_RING3 -DVBOX -DVBOX_OSE \
-D_FILE_OFFSET_BITS=64 -DLOG_ENABLED
VBOX_CC_OPT += $(VBOX_MACH_CC_OPT_$(VBOX_MACH))
VBOX_CC_OPT += -DVBOX_WITH_64_BITS_GUESTS
VBOX_CC_OPT += -DVBOX_WITH_NEW_MSR_CODE
VBOX_CC_OPT += -DIN_SUP_R3 -DIN_VMM_R3
# we use the libc headers from FreeBSD
VBOX_CC_OPT += -DRT_OS_FREEBSD
VBOX_CC_OPT += -DVBOX_WITH_REM
VBOX_CC_OPT += -DVBOX_WITH_HGCM -DVBOX_WITH_HGSMI
VBOX_CC_OPT += -DVBOX_WITHOUT_TESTING_FEATURES
VBOX_CC_OPT += -DVBOX_WITH_VIDEOHWACCEL
VBOX_CC_OPT += -DVBOX_WITH_XPCOM
VBOX_CC_OPT += -DRTLOG_REL_ENABLED -DRT_STRICT -DVBOX_STRICT
VBOX_CC_OPT += -DVBOX_WITH_USB -DVBOX_WITH_VUSB
# Enable Intel Network model E1000
VBOX_CC_OPT += -DVBOX_WITH_E1000
VBOX_CC_OPT += -DVBOX_WITH_AHCI
VBOX_CC_OPT += -DVBOX_WITH_GUEST_PROPS
VIRTUALBOX_VERSION_MAJOR := $(shell cat $(VIRTUALBOX_DIR)/Config.kmk 2>/dev/null | grep "VBOX_VERSION_MAJOR = " | grep -v "'VBOX_VERSION_MAJOR" | sed "s/^.*= //")
VIRTUALBOX_VERSION_MINOR := $(shell cat $(VIRTUALBOX_DIR)/Config.kmk 2>/dev/null | grep "VBOX_VERSION_MINOR = " | grep -v "'VBOX_VERSION_MINOR" | sed "s/^.*= //")
VIRTUALBOX_VERSION_BUILD := $(shell cat $(VIRTUALBOX_DIR)/Config.kmk 2>/dev/null | grep "VBOX_VERSION_BUILD = " | grep -v "'VBOX_VERSION_BUILD" | sed "s/^.*= //")
ifeq ($(VBOX_MACH),x86_32)
VIRTUALBOX_PACKAGE_STRING = GenodeOS_32BIT_GENERIC
else
VIRTUALBOX_PACKAGE_STRING = GenodeOS_64BIT_GENERIC
endif
VBOX_CC_OPT += -DVBOX_VERSION_MAJOR=$(VIRTUALBOX_VERSION_MAJOR) \
-DVBOX_VERSION_MINOR=$(VIRTUALBOX_VERSION_MINOR) \
-DVBOX_VERSION_BUILD=$(VIRTUALBOX_VERSION_BUILD) \
-DVBOX_VERSION_STRING=\"$(VIRTUALBOX_VERSION_MAJOR).$(VIRTUALBOX_VERSION_MINOR).$(VIRTUALBOX_VERSION_BUILD)_OSE\" \
-DVBOX_VERSION_STRING_RAW=\"$(VIRTUALBOX_VERSION_MAJOR).$(VIRTUALBOX_VERSION_MINOR).$(VIRTUALBOX_VERSION_BUILD)\" \
-DVBOX_PACKAGE_STRING=\"$(VIRTUALBOX_PACKAGE_STRING)\" \
-DVBOX_API_VERSION_STRING=\"$(VIRTUALBOX_VERSION_MAJOR)_$(VIRTUALBOX_VERSION_MINOR)\" \
-DIPRT_BLDCFG_VERSION_STRING=\"$(VIRTUALBOX_VERSION_MAJOR).$(VIRTUALBOX_VERSION_MINOR).$(VIRTUALBOX_VERSION_BUILD)_OSE\" \
-DIPRT_BLDCFG_TARGET=\"genode\" \
-DIPRT_BLDCFG_TARGET_ARCH=\"$(VBOX_MACH)\"
VBOX_CC_OPT += -DVBOX_WITH_WDDM -DVBOX_WITH_WDDM_W8 -DVBOXWDDM_WITH_VBVA
VBOX_CC_OPT += -DVBOX_WITH_VDMA
VBOX_CC_OPT += -DVBOX_WITH_VMSVGA
VBOX_CC_OPT += -DVBOX_HDD_NO_DYNAMIC_BACKENDS
VBOX_CC_OPT += -DVBOX_WITHOUT_NS_ACCOUNTING
CC_WARN += -Wno-trigraphs
CC_OPT += $(VBOX_CC_OPT)
# VirtualBox expects wchar_t to be a 16-bit type. yasm does not understand this
# flag, therefore it gets added to CC_OPT instead of VBOX_CC_OPT.
CC_OPT += -fshort-wchar
LIBS += libc libm libc-mem
INC_DIR += $(REP_DIR)/src/virtualbox/include
INC_DIR += $(REP_DIR)/src/virtualbox/include/xpcom
INC_DIR += $(VIRTUALBOX_DIR)/include
INC_DIR += $(VIRTUALBOX_SDK_DIR)/sdk/bindings/xpcom/include
INC_DIR += $(VBOX_DIR)/Devices/build
vpath %.cpp $(VBOX_DIR)
vpath %.c $(VBOX_DIR)
vpath %.asm $(VBOX_DIR)
%.o: %.asm
$(MSG_ASSEM)$@
$(VERBOSE)yasm $(VBOX_MACH_ASM_OPT_$(VBOX_MACH)) -DASM_FORMAT_ELF -D__YASM__ \
$(addprefix -I,$(INC_DIR)) $(VBOX_CC_OPT) -o $@ $<
# vi: set ft=make :

View File

@ -1,100 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
SRC_CC += Devices/PC/DevFwCommon.cpp
SRC_CC += Devices/PC/DevPcBios.cpp
SRC_CC += Devices/Bus/DevPCI.cpp
SRC_CC += Devices/PC/DevACPI.cpp
SRC_CC += Devices/PC/ACPI/VBoxAcpi.cpp
SRC_C += Devices/PC/DevPcArch.c
SRC_CC += Devices/Input/DevPS2.cpp
SRC_CC += Devices/Input/PS2K.cpp
SRC_CC += Devices/PC/DevPit-i8254.cpp
SRC_CC += Devices/PC/DevPIC.cpp
SRC_CC += Devices/PC/DevRTC.cpp
SRC_CC += Devices/PC/DevDMA.cpp
SRC_CC += Devices/PC/DevAPIC.cpp
SRC_CC += Devices/Graphics/DevVGA.cpp
SRC_CC += Devices/Graphics/DevVGA_VBVA.cpp
SRC_CC += Devices/Graphics/DevVGA_VDMA.cpp
SRC_CC += Devices/Graphics/DevVGA-SVGA.cpp
SRC_CC += Devices/Graphics/HGSMI/HGSMIHost.cpp
SRC_CC += Devices/Graphics/HGSMI/HGSMIHostHlp.cpp
SRC_CC += Devices/Graphics/HGSMI/SHGSMIHost.cpp
SRC_CC += Devices/Storage/ATAPIPassthrough.cpp
SRC_CC += Devices/Storage/DevAHCI.cpp
SRC_CC += Devices/Storage/DevATA.cpp
SRC_CC += Devices/Storage/Debug.cpp
SRC_CC += Devices/Storage/DevFdc.c
SRC_CC += Devices/Network/DevE1000.cpp
SRC_CC += Devices/Network/DevE1000Phy.cpp
SRC_CC += Devices/Network/DevEEPROM.cpp
SRC_CC += Devices/Network/DevPCNet.cpp
SRC_CC += Devices/VMMDev/VMMDev.cpp
SRC_CC += Devices/VMMDev/VMMDevHGCM.cpp
SRC_CC += GuestHost/HGSMI/HGSMICommon.cpp
SRC_CC += Devices/Serial/DevSerial.cpp
SRC_CC += Devices/PC/DevIoApic.cpp
SRC_C += Devices/Audio/audio.c
SRC_C += Devices/Audio/audiosniffer.c
SRC_C += Devices/Audio/filteraudio.c
SRC_C += Devices/Audio/mixeng.c
SRC_C += Devices/Audio/noaudio.c
SRC_CC += Devices/Audio/DevIchAc97.cpp
SRC_CC += Devices/Audio/DevIchHda.cpp
SRC_CC += Devices/Audio/DevIchHdaCodec.cpp
SRC_CC += Devices/USB/DevOHCI.cpp
SRC_CC += Devices/USB/USBProxyDevice.cpp
SRC_CC += Devices/USB/VUSBDevice.cpp
SRC_CC += Devices/USB/VUSBReadAhead.cpp
SRC_CC += Devices/USB/VUSBSniffer.cpp
SRC_CC += Devices/USB/VUSBUrb.cpp
SRC_CC += Devices/Input/UsbMouse.cpp
SRC_CC += Devices/Input/UsbKbd.cpp
SRC_CC += Devices/build/VBoxDD.cpp
SRC_CC += devxhci.cc
INC_DIR += $(VBOX_DIR)/Devices/build
INC_DIR += $(VBOX_DIR)/Devices/Bus
CC_WARN += -Wno-unused-but-set-variable
# found in src/VBox/Devices/Makefile.kmk
CC_OPT += -DVBOX_HGCM_HOST_CODE
Devices/Graphics/DevVGA.o: vbetables.h
vbetables.h: vbetables-gen
$(MSG_CONVERT)$@
$(VERBOSE)./$^ > $@
vbetables-gen: Devices/Graphics/BIOS/vbetables-gen.c
$(MSG_BUILD)$@
$(VERBOSE)g++ $(VBOX_CC_OPT) $(addprefix -I,$(INC_DIR)) -o $@ $^
Devices/PC/ACPI/VBoxAcpi.o: vboxaml.hex vboxssdt-standard.hex vboxssdt-cpuhotplug.hex
vboxaml.hex: vbox.dsl
iasl -tc -vs -p $@ $^
vboxssdt-standard.hex: vbox-standard.dsl
iasl -tc -vs -p $@ $^ && \
mv $@ $@.tmp && \
sed "s/AmlCode/AmlCodeSsdtStandard/g" <$@.tmp >$@ && \
rm $@.tmp
vboxssdt-cpuhotplug.hex: vbox-cpuhotplug.dsl
gcc -E -P -x c -o $@.pre $< && \
iasl -tc -vs -p $@ $@.pre && \
mv $@ $@.tmp && \
sed "s/AmlCode/AmlCodeSsdtCpuHotPlug/g" <$@.tmp >$@ && \
rm $@.tmp $@.pre
vpath %.dsl $(VBOX_DIR)/Devices/PC
vpath %.cc $(REP_DIR)/src/virtualbox
CC_CXX_WARN_STRICT =

View File

@ -1,17 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
SRC_CC += VMM/VMMR3/DBGFAddr.cpp
SRC_CC += VMM/VMMR3/DBGFDisas.cpp
SRC_CC += Disassembler/DisasmCore.cpp
SRC_CC += Disassembler/DisasmTables.cpp
SRC_CC += Disassembler/DisasmReg.cpp
SRC_CC += Disassembler/DisasmTablesX64.cpp
SRC_CC += Disassembler/DisasmFormatYasm.cpp
SRC_CC += Disassembler/DisasmFormatBytes.cpp
INC_DIR += $(VBOX_DIR)/VMM/include
CC_OPT += -DVBOX_IN_VMM
CC_CXX_WARN_STRICT =

View File

@ -1,29 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
#
# Prevent inclusion of the Genode::Log definition after the vbox #define
# of 'Log'. Otherwise, the attemt to compile base/log.h will fail.
#
VBOX_CC_OPT += -include base/log.h
SRC_CC += Devices/Input/DrvKeyboardQueue.cpp
SRC_CC += Devices/Input/DrvMouseQueue.cpp
SRC_CC += Devices/USB/DrvVUSBRootHub.cpp
SRC_CC += Devices/Storage/DrvBlock.cpp
SRC_CC += Devices/Storage/DrvMediaISO.cpp
SRC_CC += Devices/Storage/DrvVD.cpp
SRC_CC += Devices/Storage/DrvRawImage.cpp
SRC_CC += Devices/PC/DrvACPI.cpp
SRC_CC += Devices/Serial/DrvChar.cpp
SRC_CC += Devices/Serial/DrvRawFile.cpp
SRC_CC += Devices/Serial/DrvHostSerial.cpp
SRC_CC += audiodrv.cpp
SRC_CC += network.cpp
INC_DIR += $(VBOX_DIR)/Devices/Audio
vpath audiodrv.cpp $(REP_DIR)/src/virtualbox
vpath network.cpp $(REP_DIR)/src/virtualbox
CC_CXX_WARN_STRICT =

View File

@ -1,18 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
LIBS += stdcxx
SRC_CC = pgm.cc sup.cc
INC_DIR += $(call select_from_repositories,src/lib/libc)
INC_DIR += $(VBOX_DIR)/Main/xml
INC_DIR += $(VBOX_DIR)/Main/include
INC_DIR += $(VBOX_DIR)/VMM/include
INC_DIR += $(REP_DIR)/src/virtualbox
INC_DIR += $(REP_DIR)/src/virtualbox/frontend
INC_DIR += $(REP_DIR)/src/virtualbox/accloff
vpath pgm.cc $(REP_DIR)/src/virtualbox/
vpath sup.cc $(REP_DIR)/src/virtualbox/accloff/
CC_CXX_WARN_STRICT =

View File

@ -1,10 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
LIBLZF_DIR = $(VIRTUALBOX_DIR)/src/libs/liblzf-3.4
INC_DIR += $(LIBLZF_DIR)
CC_OPT += -DULTRA_FAST=1 -DHLOG=12 -DSTRICT_ALIGN=0 -DPIC
SRC_C = lzf_c.c lzf_d.c
vpath % $(LIBLZF_DIR)
CC_CXX_WARN_STRICT =

View File

@ -1,83 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
VBOX_CC_OPT += -DVBOX_WITH_GENERIC_SESSION_WATCHER
#
# Prevent inclusion of the Genode::Log definition after the vbox #define
# of 'Log'. Otherwise, the attemt to compile base/log.h will fail.
#
VBOX_CC_OPT += -include base/log.h
LIBS += stdcxx
SRC_CC += Main/xml/Settings.cpp
SRC_CC += Main/src-all/EventImpl.cpp
SRC_CC += Main/src-all/DisplayResampleImage.cpp
SRC_CC += Main/src-all/DisplayUtils.cpp
SRC_CC += Main/src-all/Global.cpp
SRC_CC += Main/src-all/HashedPw.cpp
SRC_CC += Main/src-all/PCIDeviceAttachmentImpl.cpp
SRC_CC += Main/src-all/ProgressImpl.cpp
SRC_CC += Main/src-all/SharedFolderImpl.cpp
SRC_CC += Main/src-all/VirtualBoxBase.cpp
SRC_CC += Main/src-client/AdditionsFacilityImpl.cpp
SRC_CC += Main/src-client/BusAssignmentManager.cpp
SRC_CC += Main/src-client/ConsoleImpl.cpp
SRC_CC += Main/src-client/ConsoleImpl2.cpp
SRC_CC += Main/src-client/DisplayImpl.cpp
SRC_CC += Main/src-client/GuestImpl.cpp
SRC_CC += Main/src-client/HGCM.cpp
SRC_CC += Main/src-client/HGCMObjects.cpp
SRC_CC += Main/src-client/HGCMThread.cpp
SRC_CC += Main/src-client/KeyboardImpl.cpp
SRC_CC += Main/src-client/MouseImpl.cpp
SRC_CC += Main/src-client/VBoxDriversRegister.cpp
SRC_CC += Main/src-client/VMMDevInterface.cpp
SRC_CC += Main/src-client/SessionImpl.cpp
SRC_CC += Main/src-server/AudioAdapterImpl.cpp
SRC_CC += Main/src-server/BandwidthControlImpl.cpp
SRC_CC += Main/src-server/BandwidthGroupImpl.cpp
SRC_CC += Main/src-server/BIOSSettingsImpl.cpp
SRC_CC += Main/src-server/ClientToken.cpp
SRC_CC += Main/src-server/DHCPServerImpl.cpp
SRC_CC += Main/src-server/GuestOSTypeImpl.cpp
SRC_CC += Main/src-server/MachineImpl.cpp
SRC_CC += Main/src-server/MachineImplCloneVM.cpp
SRC_CC += Main/src-server/Matching.cpp
SRC_CC += Main/src-server/MediumAttachmentImpl.cpp
SRC_CC += Main/src-server/MediumImpl.cpp
SRC_CC += Main/src-server/MediumFormatImpl.cpp
SRC_CC += Main/src-server/MediumLock.cpp
SRC_CC += Main/src-server/NATEngineImpl.cpp
SRC_CC += Main/src-server/NetworkAdapterImpl.cpp
SRC_CC += Main/src-server/NetworkServiceRunner.cpp
SRC_CC += Main/src-server/ParallelPortImpl.cpp
SRC_CC += Main/src-server/SerialPortImpl.cpp
SRC_CC += Main/src-server/SnapshotImpl.cpp
SRC_CC += Main/src-server/StorageControllerImpl.cpp
SRC_CC += Main/src-server/SystemPropertiesImpl.cpp
SRC_CC += Main/src-server/TokenImpl.cpp
SRC_CC += Main/src-server/USBControllerImpl.cpp
SRC_CC += Main/src-server/USBDeviceFilterImpl.cpp
SRC_CC += Main/src-server/USBDeviceFiltersImpl.cpp
SRC_CC += Main/src-server/VirtualBoxImpl.cpp
SRC_CC += Main/src-server/VRDEServerImpl.cpp
SRC_CC += Main/glue/AutoLock.cpp
SRC_CC += Main/glue/EventQueue.cpp
SRC_CC += Main/glue/string.cpp
SRC_CC += Main/glue/xpcom/helpers.cpp
INC_DIR += $(VBOX_DIR)/Main/xml
INC_DIR += $(VBOX_DIR)/Main/include
INC_DIR += $(REP_DIR)/src/virtualbox
INC_DIR += $(REP_DIR)/src/virtualbox/frontend
INC_DIR += $(REP_DIR)/src/virtualbox/frontend/VBoxAPIWrap
# search path to 'scan_code_set_2.h'
INC_DIR += $(call select_from_repositories,src/drivers/input/spec/ps2)
CC_CXX_WARN_STRICT =

View File

@ -1,31 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
RECOMPILER_DIR = $(VIRTUALBOX_DIR)/src/recompiler
RECOMPILER_SRC_C = cpu-exec.c cutils.c exec.c host-utils.c tcg-runtime.c \
translate-all.c VBoxRecompiler.c \
tcg/tcg-dyngen.c tcg/tcg.c \
fpu/softfloat-native.c \
target-i386/helper.c target-i386/op_helper.c \
target-i386/translate.c
SRC_C = $(addprefix recompiler/,$(RECOMPILER_SRC_C))
INC_DIR += $(VBOX_DIR)/VMM/include
INC_DIR += $(RECOMPILER_DIR)/Sun/crt
INC_DIR += $(RECOMPILER_DIR)/Sun
INC_DIR += $(RECOMPILER_DIR)/target-i386
INC_DIR += $(RECOMPILER_DIR)/tcg
INC_DIR += $(RECOMPILER_DIR)/tcg/i386
INC_DIR += $(RECOMPILER_DIR)/fpu
INC_DIR += $(RECOMPILER_DIR)
CC_OPT += -DIN_REM_R3 \
-DREM_INCLUDE_CPU_H -DNEED_CPU_H -DLOG_USE_C99 -D_GNU_SOURCE
CC_WARN += -Wno-unused-but-set-variable]
vpath %.cpp $(VIRTUALBOX_DIR)/src
vpath %.c $(VIRTUALBOX_DIR)/src
CC_CXX_WARN_STRICT =

View File

@ -1,171 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
INC_DIR += $(VBOX_DIR)/Runtime/include
INC_DIR += $(VIRTUALBOX_DIR)/src/libs/liblzf-3.4
INC_DIR += $(VIRTUALBOX_DIR)/src/libs/zlib-1.2.8
INC_DIR += $(call select_from_ports,libiconv)/include/iconv
GENERIC_SRC_CC = $(notdir $(wildcard $(VBOX_DIR)/Runtime/generic/*.cpp))
FILTERED_OUT_SRC_CC = RTLogDefaultInit-generic.cpp \
RTTimeLocalExplode-generic.cpp \
semrw-lockless-generic.cpp \
tls-generic.cpp \
fs-stubs-generic.cpp \
http-curl.cpp \
RTSemEventMultiWait-2-ex-generic.cpp \
RTLogWriteStdErr-generic.cpp \
RTLogWriteStdOut-generic.cpp \
RTMpGetDescription-generic-stub.cpp \
RTSemEventWait-2-ex-generic.cpp \
RTSemEventWait-generic.cpp \
RTSemEventWaitNoResume-2-ex-generic.cpp \
RTFileExists-generic.cpp \
RTSemMutexRequest-generic.cpp \
RTSemMutexRequestDebug-generic.cpp \
RTDirExists-generic.cpp \
RTMpOnPair-generic.cpp \
RTTimerCreate-generic.cpp \
timer-generic.cpp
CC_WARN += -Wno-unused-variable
SRC_CC += Runtime/common/log/logrel.cpp \
Runtime/r3/init.cpp \
Runtime/common/misc/thread.cpp \
$(addprefix Runtime/generic/,$(filter-out $(FILTERED_OUT_SRC_CC), $(GENERIC_SRC_CC)))
SRC_CC += Runtime/common/err/RTErrConvertFromErrno.cpp
SRC_CC += Runtime/common/alloc/memcache.cpp
SRC_CC += Runtime/common/alloc/heapoffset.cpp
SRC_CC += Runtime/common/checksum/alt-md5.cpp
SRC_CC += Runtime/common/checksum/alt-sha512.cpp
SRC_CC += Runtime/common/checksum/crc32.cpp
SRC_CC += Runtime/common/checksum/ipv4.cpp
SRC_CC += Runtime/common/checksum/sha512str.cpp
SRC_CC += Runtime/common/log/log.cpp
SRC_CC += Runtime/common/log/log.cpp
SRC_CC += Runtime/common/log/logellipsis.cpp
SRC_CC += Runtime/common/log/logrelellipsis.cpp
SRC_CC += Runtime/common/log/logformat.cpp
SRC_CC += Runtime/common/misc/assert.cpp
SRC_CC += Runtime/common/misc/buildconfig.cpp
SRC_CC += Runtime/common/misc/lockvalidator.cpp
SRC_CC += Runtime/common/misc/once.cpp
SRC_CC += Runtime/common/misc/req.cpp
SRC_CC += Runtime/common/misc/reqpool.cpp
SRC_CC += Runtime/common/misc/reqqueue.cpp
SRC_CC += Runtime/common/misc/sg.cpp
SRC_CC += Runtime/common/misc/term.cpp
SRC_CC += Runtime/common/misc/RTAssertMsg1Weak.cpp
SRC_CC += Runtime/common/misc/RTAssertMsg2AddWeak.cpp
SRC_CC += Runtime/common/misc/RTAssertMsg2AddWeakV.cpp
SRC_CC += Runtime/common/misc/RTAssertMsg2Weak.cpp
SRC_CC += Runtime/common/misc/RTAssertMsg2WeakV.cpp
SRC_CC += Runtime/common/misc/RTMemWipeThoroughly.cpp
SRC_CC += Runtime/common/path/comparepaths.cpp
SRC_CC += Runtime/common/path/RTPathAbsDup.cpp
SRC_CC += Runtime/common/path/RTPathAbsEx.cpp
SRC_CC += Runtime/common/path/RTPathAppendEx.cpp
SRC_CC += Runtime/common/path/RTPathCalcRelative.cpp
SRC_CC += Runtime/common/path/RTPathExt.cpp
SRC_CC += Runtime/common/path/RTPathFilename.cpp
SRC_CC += Runtime/common/path/RTPathHasPath.cpp
SRC_CC += Runtime/common/path/RTPathJoinA.cpp
SRC_CC += Runtime/common/path/RTPathJoinEx.cpp
SRC_CC += Runtime/common/path/RTPathParse.cpp
SRC_CC += Runtime/common/path/RTPathParseSimple.cpp
SRC_CC += Runtime/common/path/RTPathRealDup.cpp
SRC_CC += Runtime/common/path/RTPathStartsWithRoot.cpp
SRC_CC += Runtime/common/path/RTPathStripExt.cpp
SRC_CC += Runtime/common/path/RTPathStripFilename.cpp
SRC_CC += Runtime/common/path/RTPathStripTrailingSlash.cpp
SRC_CC += Runtime/common/path/rtPathVolumeSpecLen.cpp
SRC_CC += Runtime/common/path/rtPathRootSpecLen.cpp
SRC_CC += Runtime/common/rand/rand.cpp
SRC_CC += Runtime/common/rand/randadv.cpp
SRC_CC += Runtime/common/rand/randparkmiller.cpp
SRC_CC += Runtime/common/string/base64.cpp
SRC_CC += Runtime/common/string/RTStrCmp.cpp
SRC_CC += Runtime/common/string/RTStrCopy.cpp
SRC_CC += Runtime/common/string/RTStrCopyEx.cpp
SRC_CC += Runtime/common/string/RTStrNCmp.cpp
SRC_CC += Runtime/common/string/RTStrNLen.cpp
SRC_CC += Runtime/common/string/RTStrPrintHexBytes.cpp
SRC_CC += Runtime/common/string/simplepattern.cpp
SRC_CC += Runtime/common/string/straprintf.cpp
SRC_CC += Runtime/common/string/strformat.cpp
SRC_CC += Runtime/common/string/strformatrt.cpp
SRC_CC += Runtime/common/string/strformattype.cpp
SRC_CC += Runtime/common/string/stringalloc.cpp
SRC_CC += Runtime/common/string/strprintf.cpp
SRC_CC += Runtime/common/string/strspace.cpp
SRC_CC += Runtime/common/string/strstrip.cpp
SRC_CC += Runtime/common/string/strtonum.cpp
SRC_CC += Runtime/common/string/unidata-lower.cpp
SRC_CC += Runtime/common/string/unidata-upper.cpp
SRC_CC += Runtime/common/string/utf-8.cpp
SRC_CC += Runtime/common/string/utf-8-case.cpp
SRC_CC += Runtime/common/string/utf-16.cpp
SRC_CC += Runtime/common/string/utf-16-case.cpp
SRC_CC += Runtime/common/table/avlpv.cpp
SRC_CC += Runtime/common/table/avlroioport.cpp
SRC_CC += Runtime/common/table/avlrogcphys.cpp
SRC_CC += Runtime/common/table/avlul.cpp
SRC_CC += Runtime/common/time/time.cpp
SRC_CC += Runtime/common/time/timeprog.cpp
SRC_CC += Runtime/common/time/timesup.cpp
SRC_CC += Runtime/common/time/timesupref.cpp
SRC_CC += Runtime/common/vfs/vfsbase.cpp
SRC_CC += Runtime/common/zip/zip.cpp
SRC_CC += Runtime/r3/alloc.cpp
SRC_CC += Runtime/r3/dir.cpp
SRC_CC += Runtime/r3/fileio.cpp
SRC_CC += Runtime/r3/fs.cpp
SRC_CC += Runtime/r3/path.cpp
SRC_CC += Runtime/r3/generic/semspinmutex-r3-generic.cpp
SRC_CC += Runtime/r3/posix/dir-posix.cpp
SRC_CC += Runtime/r3/posix/env-posix.cpp
SRC_CC += Runtime/r3/posix/fileio-posix.cpp
SRC_CC += Runtime/r3/posix/fileio2-posix.cpp
SRC_CC += Runtime/r3/posix/fs-posix.cpp
SRC_CC += Runtime/r3/posix/fs2-posix.cpp
SRC_CC += Runtime/r3/posix/fs3-posix.cpp
SRC_CC += Runtime/r3/posix/path-posix.cpp
SRC_CC += Runtime/r3/posix/path2-posix.cpp
SRC_CC += Runtime/r3/posix/pipe-posix.cpp
SRC_CC += Runtime/r3/posix/RTTimeNow-posix.cpp
SRC_CC += Runtime/r3/posix/semeventmulti-posix.cpp
SRC_CC += Runtime/r3/posix/semevent-posix.cpp
SRC_CC += Runtime/r3/posix/semmutex-posix.cpp
SRC_CC += Runtime/r3/posix/symlink-posix.cpp
SRC_CC += Runtime/r3/posix/thread2-posix.cpp
SRC_CC += Runtime/r3/posix/thread-posix.cpp
SRC_CC += Runtime/r3/posix/time-posix.cpp
SRC_CC += Runtime/r3/posix/tls-posix.cpp
SRC_CC += Runtime/r3/posix/utf8-posix.cpp
SRC_CC += Runtime/r3/process.cpp
SRC_CC += Runtime/r3/stream.cpp
SRC_CC += Runtime/VBox/log-vbox.cpp
SRC_S += Runtime/common/asm/ASMAtomicCmpXchgU64.asm
SRC_S += Runtime/common/asm/ASMAtomicReadU64.asm
SRC_S += Runtime/common/asm/ASMAtomicUoReadU64.as
SRC_S += Runtime/common/asm/ASMAtomicXchgU64.asm
SRC_S += Runtime/common/asm/ASMCpuIdExSlow.asm
SRC_CC += Runtime/common/err/errmsg.cpp
Runtime/common/err/errmsg.o: errmsgdata.h
errmsgdata.h: $(VIRTUALBOX_DIR)/include/iprt/err.h \
$(VIRTUALBOX_DIR)/include/VBox/err.h
$(MSG_CONVERT)$@
$(VERBOSE)sed -f $(VBOX_DIR)/Runtime/common/err/errmsg.sed $^ > $@
SRC_CC += Runtime/common/err/errmsgxpcom.cpp
Runtime/common/err/errmsgxpcom.o: errmsgvboxcomdata.h
errmsgvboxcomdata.h:
touch $@
CC_CXX_WARN_STRICT =

View File

@ -1,19 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
SRC_CC += Storage/VCICache.cpp
SRC_CC += Storage/VD.cpp
SRC_CC += Storage/VMDK.cpp
SRC_CC += Storage/DMG.cpp
SRC_CC += Storage/ISCSI.cpp
SRC_CC += Storage/Parallels.cpp
SRC_CC += Storage/QCOW.cpp
SRC_CC += Storage/QED.cpp
SRC_CC += Storage/RAW.cpp
SRC_CC += Storage/VD.cpp
SRC_CC += Storage/VDI.cpp
SRC_CC += Storage/VDIfVfs.cpp
SRC_CC += Storage/VHD.cpp
SRC_CC += Storage/VHDX.cpp
SRC_CC += Storage/VMDK.cpp
CC_CXX_WARN_STRICT =

View File

@ -1,76 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
SRC_CC += VMM/VMMR3/VM.cpp
SRC_CC += VMM/VMMAll/VMAll.cpp
SRC_CC += VMM/VMMAll/VMMAll.cpp
SRC_CC += VMM/VMMR3/VMM.cpp
SRC_CC += VMM/VMMR3/STAM.cpp
SRC_CC += VMM/VMMR3/SSM.cpp
SRC_CC += VMM/VMMR3/PDM.cpp
SRC_CC += VMM/VMMR3/PDMBlkCache.cpp
SRC_CC += VMM/VMMR3/PDMDevice.cpp
SRC_CC += VMM/VMMR3/PDMQueue.cpp
SRC_CC += VMM/VMMR3/PDMCritSect.cpp
SRC_CC += VMM/VMMAll/PDMAll.cpp
SRC_CC += VMM/VMMAll/PDMAllQueue.cpp
SRC_CC += VMM/VMMAll/PDMAllCritSect.cpp
SRC_CC += VMM/VMMAll/PDMAllCritSectRw.cpp
SRC_CC += VMM/VMMR3/TM.cpp
SRC_CC += VMM/VMMAll/TMAll.cpp
SRC_CC += VMM/VMMAll/TMAllVirtual.cpp
SRC_CC += VMM/VMMAll/TMAllReal.cpp
SRC_CC += VMM/VMMAll/TMAllCpu.cpp
SRC_CC += VMM/VMMAll/TRPMAll.cpp
SRC_CC += VMM/VMMR3/CFGM.cpp
SRC_CC += VMM/VMMR3/PDMDevHlp.cpp
SRC_CC += VMM/VMMR3/PDMDevMiscHlp.cpp
SRC_CC += VMM/VMMR3/PDMDriver.cpp
SRC_CC += VMM/VMMR3/PDMThread.cpp
SRC_CC += VMM/VMMR3/PDMUsb.cpp
SRC_CC += VMM/VMMAll/CPUMAllMsrs.cpp
SRC_CC += VMM/VMMAll/CPUMAllRegs.cpp
SRC_CC += VMM/VMMR3/VMEmt.cpp
SRC_CC += VMM/VMMR3/VMReq.cpp
SRC_CC += VMM/VMMAll/DBGFAll.cpp
SRC_CC += VMM/VMMR3/DBGFInfo.cpp
SRC_CC += VMM/VMMR3/CPUM.cpp
SRC_CC += VMM/VMMR3/CPUMR3CpuId.cpp
SRC_CC += VMM/VMMR3/CPUMR3Db.cpp
SRC_CC += VMM/VMMAll/EMAll.cpp
SRC_CC += VMM/VMMR3/EM.cpp
SRC_CC += VMM/VMMR3/EMHM.cpp
SRC_CC += VMM/VMMR3/TRPM.cpp
SRC_CC += VMM/VMMAll/SELMAll.cpp
SRC_CC += VMM/VMMAll/REMAll.cpp
SRC_CC += VMM/VMMR3/VMMGuruMeditation.cpp
CC_OPT += -DVBOX_IN_VMM
# definitions needed by SSM.cpp
CC_OPT += -DKBUILD_TYPE=\"debug\" \
-DKBUILD_TARGET=\"genode\" \
-DKBUILD_TARGET_ARCH=\"x86\"
# definitions needed by VMMAll.cpp
CC_OPT += -DVBOX_SVN_REV=~0
INC_DIR += $(VBOX_DIR)/VMM/include
CC_WARN += -Wno-unused-but-set-variable
CC_CXX_WARN_STRICT =

View File

@ -1,25 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
ZLIB_DIR = $(VIRTUALBOX_DIR)/src/libs/zlib-1.2.8
LIBXML_DIR = $(VIRTUALBOX_DIR)/src/libs/libxml2-2.9.2
INC_DIR += $(ZLIB_DIR)
INC_DIR += $(LIBXML_DIR)/include
INC_DIR += $(call select_from_ports,libiconv)/include/iconv
LIBS += stdcxx
VBOX_CC_OPT += -DLIBXML_THREAD_ENABLED
SRC_C += buf.c catalog.c chvalid.c debugXML.c dict.c encoding.c error.c entities.c
SRC_C += globals.c hash.c list.c parser.c parserInternals.c pattern.c
SRC_C += relaxng.c threads.c tree.c uri.c valid.c HTMLtree.c HTMLparser.c
SRC_C += SAX.c SAX2.c xmlIO.c xmlmemory.c xmlreader.c xmlregexp.c xmlschemas.c
SRC_C += xmlschemastypes.c xmlsave.c xmlstring.c xmlunicode.c xpath.c xpointer.c
SRC_CC += Runtime/r3/xml.cpp
SRC_CC += Runtime/common/string/ministring.cpp
vpath %.c $(LIBXML_DIR)
CC_CXX_WARN_STRICT =

View File

@ -1,9 +0,0 @@
include $(REP_DIR)/lib/mk/virtualbox-common.inc
ZLIB_DIR = $(VIRTUALBOX_DIR)/src/libs/zlib-1.2.8
INC_DIR += $(ZLIB_DIR)
SRC_C = $(notdir $(wildcard $(ZLIB_DIR)/*.c))
vpath % $(ZLIB_DIR)
CC_CXX_WARN_STRICT =

View File

@ -103,8 +103,8 @@ CC_OPT += -fshort-wchar
LIBS += libc libm libc-mem
INC_DIR += $(REP_DIR)/src/virtualbox/include
INC_DIR += $(REP_DIR)/src/virtualbox/include/xpcom
INC_DIR += $(REP_DIR)/src/virtualbox5/include
INC_DIR += $(REP_DIR)/src/virtualbox5/include/xpcom
INC_DIR += $(VIRTUALBOX_DIR)/include
INC_DIR += $(VIRTUALBOX_SDK_DIR)/sdk/bindings/xpcom/include
INC_DIR += $(VBOX_DIR)/Devices/build

View File

@ -22,7 +22,7 @@ SRC_CC += audio.cc
INC_DIR += $(VBOX_DIR)/Devices/Audio
vpath network.cpp $(REP_DIR)/src/virtualbox
vpath network.cpp $(REP_DIR)/src/virtualbox5
vpath audio.cc $(REP_DIR)/src/virtualbox5
CC_CXX_WARN_STRICT =

View File

@ -11,7 +11,7 @@ INC_DIR += $(VIRTUALBOX_DIR)/VBoxAPIWrap
INC_DIR += $(VBOX_DIR)/Main/xml
INC_DIR += $(VBOX_DIR)/Main/include
INC_DIR += $(VBOX_DIR)/VMM/include
INC_DIR += $(REP_DIR)/src/virtualbox
INC_DIR += $(REP_DIR)/src/virtualbox5
INC_DIR += $(REP_DIR)/src/virtualbox5/frontend
INC_DIR += $(REP_DIR)/src/virtualbox5/accloff

View File

@ -1 +0,0 @@
6e8eff025e2e6e957b8971869af9632a8fff276b

View File

@ -1,111 +0,0 @@
LICENSE := GPLv2
VERSION := 4.3.40
DOWNLOADS := virtualbox.archive virtualbox_sdk.archive
VIRTUALBOX_TBZ2 := VirtualBox-$(VERSION).tar.bz2
VIRTUALBOX_SDK_ZIP := VirtualBoxSDK-$(VERSION)-110317.zip
URL(virtualbox) := http://download.virtualbox.org/virtualbox/$(VERSION)/$(VIRTUALBOX_TBZ2)
DIR(virtualbox) := src/app/virtualbox
SHA(virtualbox) := 4bbea49ee1eaa600db7af64b05c8ce6a1f7585de08f4f85cd7b6f0f7a798bcc6
URL(virtualbox_sdk) := http://download.virtualbox.org/virtualbox/$(VERSION)/$(VIRTUALBOX_SDK_ZIP)
DIR(virtualbox_sdk) := src/app/virtualbox_sdk
SHA(virtualbox_sdk) := e227edd309cce72921797641cbd0c668c89a6fcaf557fb0242d42d32de82aa9b
PATCHES_DIR := src/virtualbox/patches
PATCHES_DIR_VBOX4 := src/virtualbox/patches
PATCHES := $(addprefix $(PATCHES_DIR)/, $(shell cat $(REP_DIR)/$(PATCHES_DIR)/series))
PATCHES += $(addprefix $(PATCHES_DIR_VBOX4)/, $(shell cat $(REP_DIR)/$(PATCHES_DIR_VBOX4)/series_common))
PATCH_OPT := -p1
$(call check_tool,xsltproc)
$(call check_tool,yasm)
$(call check_tool,iasl)
VBOX_MAIN_GLUE := AutoLock EventQueue string xpcom/helpers
VBOX_MAIN_ALL := DisplayResampleImage DisplayUtils EventImpl Global HashedPw
VBOX_MAIN_ALL += PCIDeviceAttachmentImpl ProgressImpl SharedFolderImpl
VBOX_MAIN_ALL += VirtualBoxBase
VBOX_MAIN_CLI := AdditionsFacilityImpl ConsoleImpl2 DisplayImpl HGCM HGCMThread
VBOX_MAIN_CLI += HGCMObjects
VBOX_MAIN_CLI += KeyboardImpl SessionImpl VMMDevInterface BusAssignmentManager
VBOX_MAIN_CLI += ConsoleImpl GuestImpl MouseImpl VBoxDriversRegister
VBOX_MAIN_SRV := AudioAdapterImpl ClientToken DHCPServerImpl Matching
VBOX_MAIN_SRV += MediumAttachmentImpl NATEngineImpl SerialPortImpl
VBOX_MAIN_SRV += BandwidthControlImpl GuestOSTypeImpl HostUSBDeviceImpl
VBOX_MAIN_SRV += MediumFormatImpl NetworkAdapterImpl SnapshotImpl
VBOX_MAIN_SRV += BandwidthGroupImpl MachineImplCloneVM MediumImpl
VBOX_MAIN_SRV += NetworkServiceRunner StorageControllerImpl VirtualBoxImpl
VBOX_MAIN_SRV += BIOSSettingsImpl MachineImpl MediumLock ParallelPortImpl
VBOX_MAIN_SRV += SystemPropertiesImpl VRDEServerImpl TokenImpl
VBOX_MAIN_SRV += USBControllerImpl USBDeviceFilterImpl USBDeviceFiltersImpl
VBOX_MAIN_INC := AdditionsFacilityImpl AudioAdapterImpl AudioSnifferInterface
VBOX_MAIN_INC += AutoCaller AutostartDb AutoStateDep BandwidthControlImpl
VBOX_MAIN_INC += BandwidthGroupImpl BIOSSettingsImpl BusAssignmentManager Nvram
VBOX_MAIN_INC += ClientToken ConsoleImpl DHCPServerImpl DisplayImpl HostImpl
VBOX_MAIN_INC += DisplayUtils EventImpl FramebufferImpl Global
VBOX_MAIN_INC += GuestCtrlImplPrivate GuestDirectoryImpl GuestDnDImpl Logging
VBOX_MAIN_INC += GuestFileImpl GuestFsObjInfoImpl GuestImpl GuestOSTypeImpl
VBOX_MAIN_INC += GuestSessionImpl HashedPw KeyboardImpl MachineImplCloneVM
VBOX_MAIN_INC += HGCM HGCMThread HGCMObjects
VBOX_MAIN_INC += MachineImpl MediumAttachmentImpl MediumFormatImpl MediumImpl
VBOX_MAIN_INC += MediumLock MouseImpl NATEngineImpl NATNetworkImpl objectslist
VBOX_MAIN_INC += NetworkAdapterImpl NetworkServiceRunner ParallelPortImpl
VBOX_MAIN_INC += PCIDeviceAttachmentImpl Performance ProgressImpl SnapshotImpl
VBOX_MAIN_INC += ProgressProxyImpl SerialPortImpl SessionImpl SharedFolderImpl
VBOX_MAIN_INC += StorageControllerImpl SystemPropertiesImpl TokenImpl VMMDev
VBOX_MAIN_INC += USBControllerImpl USBDeviceFilterImpl USBDeviceFiltersImpl
VBOX_MAIN_INC += USBProxyService VirtualBoxImpl VRDEServerImpl GuestProcessImpl
VBOX_MAIN_INC += USBDeviceImpl HostUSBDeviceImpl Matching Wrapper
VBOX_SRC_VBOX := VMM Devices Runtime GuestHost/HGSMI Storage Disassembler
VBOX_SRC_VBOX += HostServices/SharedFolders Main/xml/Settings.cpp
VBOX_SRC_VBOX += HostServices/SharedClipboard
VBOX_SRC_VBOX += HostServices/GuestProperties
VBOX_SRC_VBOX += Main/xml/VirtualBox-settings.xsd Main/xml/SchemaDefs.xsl
VBOX_SRC_VBOX += $(addsuffix .h, $(addprefix Main/include/, $(VBOX_MAIN_INC)))
VBOX_SRC_VBOX += $(addsuffix .cpp, $(addprefix Main/src-client/, $(VBOX_MAIN_CLI)))
VBOX_SRC_VBOX += $(addsuffix .cpp, $(addprefix Main/src-server/, $(VBOX_MAIN_SRV)))
VBOX_SRC_VBOX += $(addsuffix .cpp, $(addprefix Main/src-all/, $(VBOX_MAIN_ALL)))
VBOX_SRC_VBOX += $(addsuffix .cpp, $(addprefix Main/glue/, $(VBOX_MAIN_GLUE)))
VBOX_INC += types.h cdefs.h hgcmsvc.h err.h dis.h disopcode.h log.h sup.h pci.h
VBOX_INC += param.h ostypes.h VMMDev.h VMMDev2.h vusb.h dbg.h version.h HGSMI
VBOX_INC += VBoxVideo.h Hardware bioslogo.h scsi.h shflsvc.h VBoxGuest2.h vd.h
VBOX_INC += vd-plugin.h vd-ifs.h vd-ifs-internal.h vd-image-backend.h
VBOX_INC += vd-cache-backend.h vd-filter-backend.h msi.h asmdefs.mac err.mac
VBOX_INC += VBoxVideoHost3D.h VBoxVideo3D.h settings.h VBoxAuth.h
VBOX_INC += usb.h usbfilter.h
VBOX_INC_COM := array.h assert.h AutoLock.h ErrorInfo.h EventQueue.h Guid.h
VBOX_INC_COM += list.h MultiResult.h string.h
VBOX_INC_HOST := VBoxClipboardExt.h VBoxClipboardSvc.h GuestPropertySvc.h
VBOX_CONTENT += $(addprefix src/VBox/,$(VBOX_SRC_VBOX))
VBOX_CONTENT += $(addprefix include/VBox/, $(VBOX_INC))
VBOX_CONTENT += $(addprefix include/VBox/com/, $(VBOX_INC_COM))
VBOX_CONTENT += $(addprefix include/VBox/HostServices/, $(VBOX_INC_HOST))
VBOX_CONTENT += src/libs/zlib-1.2.8 src/libs/liblzf-3.4 src/libs/libxml2-2.9.2
VBOX_CONTENT += src/recompiler include/VBox/vmm include/iprt Config.kmk
TAR_OPT(virtualbox) := \
--strip-components 1 \
$(addprefix $(VIRTUALBOX_TBZ2:.tar.bz2=)/,$(VBOX_CONTENT))
UNZIP_OPT(virtualbox_sdk) := $(VIRTUALBOX_SDK_ZIP) sdk/bindings/xpcom/include/VirtualBox_XPCOM.h \#
default : additional_steps
additional_steps : $(DOWNLOADS)
xsltproc --stringparam mode declare \
-o src/app/virtualbox/src/VBox/Main/xml/SchemaDefs.h \
src/app/virtualbox/src/VBox/Main/xml/SchemaDefs.xsl \
src/app/virtualbox/src/VBox/Main/xml/VirtualBox-settings.xsd

View File

@ -1 +1 @@
c6bfa150b4b3227b9e46792d4a7df7431a41a31e
48495db3bf857e7d02ede435d53904ac5239d91d

View File

@ -14,9 +14,7 @@ DIR(virtualbox_sdk) := src/app/virtualbox_sdk
SHA(virtualbox_sdk) := 038c1d069ecf2886a2a7ca1ad5483bde4169b7bee39d77fbb16943a28ce64341
PATCHES_DIR := src/virtualbox5/patches
PATCHES_DIR_VBOX4 := src/virtualbox/patches
PATCHES := $(addprefix $(PATCHES_DIR)/, $(shell cat $(REP_DIR)/$(PATCHES_DIR)/series))
PATCHES += $(addprefix $(PATCHES_DIR_VBOX4)/, $(shell cat $(REP_DIR)/$(PATCHES_DIR_VBOX4)/series_common))
PATCH_OPT := -p1
$(call check_tool,xsltproc)

View File

@ -2,18 +2,8 @@ LIB_MK_FILES := $(notdir $(wildcard $(REP_DIR)/lib/mk/virtualbox5-*)) \
spec/nova/virtualbox5-nova.mk
MIRROR_FROM_REP_DIR := src/virtualbox5 \
src/virtualbox/include \
src/virtualbox/network.cpp \
src/virtualbox/vmm.h \
src/virtualbox/sup.h \
src/virtualbox/mm.h \
src/virtualbox/util.h \
src/virtualbox/dynlib.cc \
src/virtualbox/libc.cc \
src/virtualbox/logger.cc \
src/virtualbox/pdm.cc \
src/virtualbox/rt.cc \
src/virtualbox/thread.cc \
src/virtualbox5/network.cpp \
src/virtualbox5/include \
include/vmm \
$(addprefix lib/mk/,$(LIB_MK_FILES))

View File

@ -1 +1 @@
2019-02-05 b30bb3427f39a48e6bf1127d30844860e8149a7f
2019-02-11-b e7c143cbc5c27c684261f930a8158215d579989c

View File

@ -1,23 +0,0 @@
#
# Ubuntu 14.04 32bit in VBox 4
#
set flavor "ubuntu_14_04_32"
set vm_ram "1280M"
set use_vbox4 1
set use_vbox5 0
set use_rumpfs 1
# Write overlay only into ram
set use_ram_fs 1
# However read initial overlay from disk
set use_overlay_from_disk 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 1
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -1,25 +0,0 @@
#
# Ubuntu 14.04 64bit in VBox 4
#
assert_spec 64bit
set flavor "ubuntu_14_04_64"
set vm_ram "1280M"
set use_vbox4 1
set use_vbox5 0
set use_rumpfs 1
# Write overlay only into ram
set use_ram_fs 1
# However read initial overlay from disk
set use_overlay_from_disk 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 1
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -1,23 +0,0 @@
#
# Ubuntu 16.04 32bit in VBox 4
#
set flavor "ubuntu_16_04_32"
set vm_ram "1280M"
set use_vbox4 1
set use_vbox5 0
set use_rumpfs 1
# Write overlay only into ram
set use_ram_fs 1
# However read initial overlay from disk
set use_overlay_from_disk 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 1
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -1,25 +0,0 @@
#
# Ubuntu 16.04 64bit in VBox 4
#
assert_spec 64bit
set flavor "ubuntu_16_04_64"
set vm_ram "9460M"
set use_vbox4 1
set use_vbox5 0
set use_rumpfs 1
# Write overlay only into ram
set use_ram_fs 1
# However read initial overlay from disk
set use_overlay_from_disk 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 1
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -1,26 +0,0 @@
#
# Windows 10 in VirtualBox 4
#
assert_spec nova
assert_spec 64bit
set flavor "win10"
set vm_ram "1280M"
set use_vbox4 1
set use_vbox5 0
set use_rumpfs 1
# Write overlay only into ram
set use_ram_fs 1
# However read initial overlay from disk
set use_overlay_from_disk 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 0
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -1,23 +0,0 @@
#
# Windows 7 in VirtualBox
#
set flavor "win7"
set vm_ram "1280M"
set use_vbox4 1
set use_vbox5 0
set use_rumpfs 1
# Write overlay only into ram
set use_ram_fs 1
# However read initial overlay from disk
set use_overlay_from_disk 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 0
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -1,22 +0,0 @@
set flavor "win7"
set vm_ram "1280M"
set use_vbox4 1
set use_vbox5 0
set vdi_image "${flavor}.vdi"
# Write overlay back to harddisk if set to 0
set use_ram_fs 1
set use_overlay_from_disk 1
set overlay_image "overlay_${flavor}.vdi"
set use_rumpfs 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 0
set vbox_file "vm_${flavor}_32_share.vbox"
source ${genode_dir}/repos/ports/run/vbox_share.inc

View File

@ -1,25 +0,0 @@
#
# Windows 7 64bit in VirtualBox
#
assert_spec 64bit
set flavor "win7_64"
set vm_ram "9460M"
set use_vbox4 1
set use_vbox5 0
set use_rumpfs 1
# Write overlay only into ram
set use_ram_fs 1
# However read initial overlay from disk
set use_overlay_from_disk 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 0
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -1,37 +0,0 @@
#
# Windows 7 64bit in VirtualBox
#
# Prepared for internal test machine, which has 8 logical cores.
# 6 Win7 64bit VMs are started, each having 2 vCPUs, using the same image and
# different overlays. Changes to the VM are written to the overlays of ram_fs
# and dropped after the test.
# lCPU 0 : Genode base system and drivers
# lCPU 1-2: VM1 2 vCPUs
# ...
# lCPU 6-7: VM6 2 vCPUs
assert_spec 64bit
set flavor "win7_64"
set flavor_extension "_multiple"
set vm_ram "1280M"
set use_vbox4 1
set use_vbox5 0
set use_rumpfs 1
# Write overlay only into ram
set use_ram_fs 1
# However read initial overlay from disk
set use_overlay_from_disk 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 6
set affinity_space_width 8
set use_cpu_load 0
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -1,24 +0,0 @@
#
# Windows 7 64bit in VirtualBox
#
assert_spec 64bit
set flavor "win7_64_raw"
set vm_ram "1280M"
set use_vbox4 1
set use_vbox5 0
# use vm image from a raw disk partition
set use_rumpfs 0
set use_ram_fs 0
set use_overlay_from_disk 0
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 0
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -1,25 +0,0 @@
#
# Windows 8.1 (64 bit) in VirtualBox
#
assert_spec 64bit
set flavor "win81_64"
set vm_ram "1280M"
set use_vbox4 1
set use_vbox5 0
set use_rumpfs 1
# Write overlay only into ram
set use_ram_fs 1
# However read initial overlay from disk
set use_overlay_from_disk 1
set use_usb 1
set use_ps2 [have_spec ps2]
set use_vms 1
set use_cpu_load 0
source ${genode_dir}/repos/ports/run/vbox_win.inc

View File

@ -5,7 +5,6 @@
set flavor "ubuntu_14_04_32"
set vm_ram "1280M"
set use_vbox4 0
set use_vbox5 1
set use_rumpfs 1

View File

@ -7,7 +7,6 @@ assert_spec 64bit
set flavor "ubuntu_14_04_64"
set vm_ram "1280M"
set use_vbox4 0
set use_vbox5 1
set use_rumpfs 1

View File

@ -5,7 +5,6 @@
set flavor "ubuntu_16_04_32"
set vm_ram "1280M"
set use_vbox4 0
set use_vbox5 1
set use_rumpfs 1

View File

@ -7,7 +7,6 @@ assert_spec 64bit
set flavor "ubuntu_16_04_64"
set vm_ram "9460M"
set use_vbox4 0
set use_vbox5 1
set use_rumpfs 1

View File

@ -8,7 +8,6 @@ assert_spec 64bit
set flavor "win10"
set vm_ram "1280M"
set use_vbox4 0
set use_vbox5 1
set use_rumpfs 1

View File

@ -7,7 +7,6 @@ assert_spec nova
set flavor "win7"
set vm_ram "1280M"
set use_vbox4 0
set use_vbox5 1
set use_rumpfs 1

View File

@ -7,7 +7,6 @@ assert_spec 64bit
set flavor "win7_64"
set vm_ram "9480M"
set use_vbox4 0
set use_vbox5 1
set use_rumpfs 1

View File

@ -18,7 +18,6 @@ set flavor "win7_64"
set flavor_extension "_multiple"
set vm_ram "1280M"
set use_vbox4 0
set use_vbox5 1
set use_rumpfs 1

View File

@ -7,7 +7,6 @@ assert_spec 64bit
set flavor "win7_64_raw"
set vm_ram "1280M"
set use_vbox4 0
set use_vbox5 1
# use vm image from a raw disk partition

View File

@ -3,7 +3,6 @@ assert_spec 64bit
set flavor "win7_64"
set vm_ram "1280M"
set use_vbox4 0
set use_vbox5 1
set vdi_image "${flavor}.vdi"

View File

@ -225,8 +225,6 @@ append config_of_app {
</start>
<start name="vbox1" priority="-2" caps="600">}
append_if [expr $use_vbox4] config_of_app "
<binary name=\"$virtualbox_binary\" />"
append_if [expr $use_vbox5] config_of_app "
<binary name=\"$virtualbox5_binary\" />"
append config_of_app {

View File

@ -244,8 +244,6 @@ append config_of_app {
for { set i 1} { $i <= $use_vms } { incr i} {
append config_of_app "
<start name=\"vbox${i}\" priority=\"-2\" caps=\"800\">"
append_if [expr $use_vbox4] config_of_app "
<binary name=\"$virtualbox_binary\" />"
append_if [expr $use_vbox5] config_of_app "
<binary name=\"$virtualbox5_binary\" />"

View File

@ -3,8 +3,7 @@ set use_ps2 [have_spec ps2]
set use_usb 0
set use_serial 1
set use_vbox4 0
set use_vbox5 [expr !$use_vbox4]
set use_vbox5 1
# use_gui starts two VMs
set use_gui 0
@ -16,12 +15,7 @@ set build_components {
drivers/framebuffer
}
if {$use_vbox4} {
append build_components virtualbox
set virtualbox_binary "virtualbox-rem"
if {[have_spec muen]} { set virtualbox_binary "virtualbox-muen" }
if {[have_spec nova]} { set virtualbox_binary "virtualbox-nova" }
} else {
if {$use_vbox5} {
append build_components virtualbox5
set virtualbox_binary "virtualbox5-rem"
if {[have_spec nova]} { set virtualbox_binary "virtualbox5-nova" }

View File

@ -36,7 +36,6 @@ append build_components {
}
lappend_if [expr $use_rumpfs] build_components server/rump_fs
lappend_if [expr $use_vbox4] build_components virtualbox
lappend_if [expr $use_vbox5] build_components virtualbox5
lappend_if [expr $use_ps2] build_components drivers/input
lappend_if [expr $use_usb] build_components drivers/usb
@ -375,7 +374,6 @@ append boot_modules {
lappend_if [expr $use_rumpfs] boot_modules rump.lib.so
lappend_if [expr $use_rumpfs] boot_modules rump_fs.lib.so
lappend_if [expr $use_rumpfs] boot_modules rump_fs
lappend_if [expr $use_vbox4] boot_modules $virtualbox_binary
lappend_if [expr $use_vbox5] boot_modules $virtualbox5_binary
lappend_if [expr $use_ram_fs || $use_usb] boot_modules ram_fs
lappend_if [expr $use_ram_fs && !$use_overlay_from_disk] boot_modules $overlay_image

View File

@ -1,38 +0,0 @@
VirtualBox configuration options
################################
The configuration requires an attribute named vbox_file with the name of the
vbox configuration to be used (.vbox).
<config vbox_file="file.vbox">
XHCI controller
===============
The virtual XHCI controller can be enabled with the following
configuration option:
<config xhci="yes">
IOAPIC
======
The virtual PCI model delivers IRQs to the PIC by default and to the IOAPIC
only if the guest operating system selected the IOAPIC with the '_PIC' ACPI
method and if it called the '_PRT' ACPI method afterwards. When running a
guest operating system which uses the IOAPIC, but does not call these ACPI
methods (for example Genode/NOVA), the configuration option
<config force_ioapic="yes">
enforces the delivery of PCI IRQs to the IOAPIC.
CAPSLOCK
========
<config capslock="ROM">
If the capslock attribute is set to "ROM", virtualbox will open a connection
to the ROM named "capslock" and expect in the top-level node a attribute
'enabled' (yes|no). If the ROM capslock differ from the internal VM capslock,
the VMM will trigger aritifical capslock key events to the VM.

View File

@ -1,17 +0,0 @@
/*
* \brief Memory region types
* \author Alexander Boettcher
* \date 2016-08-22
*/
/*
* Copyright (C) 2016-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#ifndef _VIRTUALBOX__ACCLOFF__MEM_REGION_H_
#define _VIRTUALBOX__ACCLOFF__MEM_REGION_H_
#include "vmm_region.h"
#endif

View File

@ -1,139 +0,0 @@
/*
* \brief Genode specific VirtualBox SUPLib supplements.
* File used by Genode platforms not supporting hardware
* virtualisation features.
* \author Alexander Boettcher
* \date 2013-11-18
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <base/log.h>
#include <base/semaphore.h>
#include <timer_session/connection.h>
/* VirtualBox includes */
#include <VBox/vmm/vm.h>
#include <VBox/err.h>
/* Genode's VirtualBox includes */
#include "sup.h"
#include "vmm_memory.h"
/* Libc include */
#include <pthread.h>
/* VirtualBox SUPLib interface */
int SUPR3QueryVTxSupported(void)
{
return VERR_INTERNAL_ERROR;
}
int SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu)
{
return VERR_INTERNAL_ERROR;
}
static Genode::Semaphore *r0_halt_sem()
{
static Genode::Semaphore sem;
return &sem;
}
int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned
uOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr)
{
switch(uOperation)
{
case VMMR0_DO_GVMM_CREATE_VM:
genode_VMMR0_DO_GVMM_CREATE_VM(pReqHdr);
return VINF_SUCCESS;
case VMMR0_DO_GVMM_SCHED_HALT:
r0_halt_sem()->down();
return VINF_SUCCESS;
case VMMR0_DO_GVMM_SCHED_WAKE_UP:
r0_halt_sem()->up();
return VINF_SUCCESS;
case VMMR0_DO_VMMR0_INIT:
return VINF_SUCCESS;
case VMMR0_DO_GVMM_SCHED_POLL:
/* called by 'vmR3HaltGlobal1Halt' */
Genode::log(__func__, ": SUPR3CallVMMR0Ex: VMMR0_DO_GVMM_SCHED_POLL");
return VINF_SUCCESS;
default:
Genode::error("SUPR3CallVMMR0Ex: unhandled uOperation ", (int)uOperation);
return VERR_GENERAL_FAILURE;
}
}
bool create_emt_vcpu(pthread_t * thread, size_t stack_size,
void *(*start_routine)(void *), void *arg,
Genode::Cpu_session * cpu_session,
Genode::Affinity::Location location,
unsigned int cpu_id,
const char * name)
{
/* no hardware acceleration support */
return false;
}
/**
* Dummies and unimplemented stuff.
*/
uint64_t genode_cpu_hz() {
return 1000000000ULL; /* XXX fixed 1GHz return value */
}
void genode_update_tsc(void (*update_func)(void), unsigned long update_us)
{
using namespace Genode;
Timer::Connection timer(genode_env());
Signal_context sig_ctx;
Signal_receiver sig_rec;
Signal_context_capability sig_cap = sig_rec.manage(&sig_ctx);
timer.sigh(sig_cap);
timer.trigger_once(update_us);
for (;;) {
Signal s = sig_rec.wait_for_signal();
update_func();
timer.trigger_once(update_us);
}
}
HRESULT genode_setup_machine(ComObjPtr<Machine> machine)
{
return genode_check_memory_config(machine);
}
bool Vmm_memory::revoke_from_vm(Mem_region *r)
{
Genode::warning(__func__, " unimplemented");
return false;
}
extern "C" void pthread_yield() { Genode::warning(__func__, " unimplemented"); }

View File

@ -1,514 +0,0 @@
/*
* \brief Genode audio driver backend
* \author Josef Soentgen
* \date 2015-05-17
*/
/*
* Copyright (C) 2015-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <audio_in_session/connection.h>
#include <audio_out_session/connection.h>
#include <terminal_session/connection.h>
#include <timer_session/connection.h>
/* VirtualBox includes */
#include "VBoxDD.h"
#include "vl_vbox.h"
extern "C" {
#include "audio.h"
}
#include <iprt/alloc.h>
#define AUDIO_CAP "genode"
extern "C" {
#include "audio_int.h"
}
/* VBox Genode specific */
#include "vmm.h"
template <size_t CAPACITY>
struct A_ring_buffer_to_bind_them
{
size_t wpos { 0 };
size_t rpos { 0 };
char _data[CAPACITY];
A_ring_buffer_to_bind_them() { }
size_t read_avail() const
{
if (wpos > rpos) return wpos - rpos;
else return (wpos - rpos + CAPACITY) % CAPACITY;
}
size_t write_avail() const
{
if (wpos > rpos) return ((rpos - wpos + CAPACITY) % CAPACITY) - 2;
else if (wpos < rpos) return rpos - wpos;
else return CAPACITY - 2;
}
size_t write(void const *src, size_t len)
{
size_t const avail = write_avail();
if (avail == 0) return 0;
size_t const limit_len = len > avail ? avail : len;
size_t const total = wpos + len;
size_t first, rest;
if (total > CAPACITY) {
first = CAPACITY - wpos;
rest = total % CAPACITY;
} else {
first = limit_len;
rest = 0;
}
Genode::memcpy(&_data[wpos], src, first);
wpos = (wpos + first) % CAPACITY;
if (rest) {
Genode::memcpy(&_data[wpos], ((char const*)src) + first, rest);
wpos = (wpos + rest) % CAPACITY;
}
return limit_len;
}
size_t read(void *dst, size_t len, bool peek = false)
{
size_t const avail = read_avail();
if (avail == 0) return 0;
size_t new_rpos = rpos;
size_t const limit_len = len > avail ? avail : len;
size_t const total = new_rpos + len;
size_t first, rest;
if (total > CAPACITY) {
first = CAPACITY - new_rpos;
rest = total % CAPACITY;
} else {
first = limit_len;
rest = 0;
}
Genode::memcpy(dst, &_data[new_rpos], first);
new_rpos = (new_rpos + first) % CAPACITY;
if (rest) {
Genode::memcpy(((char*)dst) + first, &_data[new_rpos], rest);
new_rpos = (new_rpos + rest) % CAPACITY;
}
if (!peek) rpos = new_rpos;
return limit_len;
}
void read_advance(size_t len) { rpos = (rpos + len) % CAPACITY; }
};
enum {
VBOX_CHANNELS = 2,
VBOX_SAMPLE_SIZE = sizeof(int16_t),
OUT_PACKET_NUM = 16, /* number of buffered packets */
IN_PACKET_NUM = 2, /* number of buffered in packets */
OUT_PCM_SIZE = Audio_out::PERIOD * VBOX_SAMPLE_SIZE * VBOX_CHANNELS,
IN_PCM_SIZE = Audio_in::PERIOD * VBOX_SAMPLE_SIZE * VBOX_CHANNELS,
OUT_PCM_BUFFER_SIZE = OUT_PCM_SIZE * OUT_PACKET_NUM,
IN_PCM_BUFFER_SIZE = IN_PCM_SIZE * IN_PACKET_NUM,
OUT_PACKET_SIZE = Audio_out::PERIOD * VBOX_SAMPLE_SIZE * VBOX_CHANNELS,
IN_PACKET_SIZE = Audio_in::PERIOD * VBOX_SAMPLE_SIZE * VBOX_CHANNELS,
OUT_PACKET_BUFFER_SIZE = OUT_PACKET_SIZE * 2,
IN_PACKET_BUFFER_SIZE = IN_PACKET_SIZE * 2,
};
static char const * const channel_names[] = { "front left", "front right" };
typedef A_ring_buffer_to_bind_them<OUT_PCM_BUFFER_SIZE> Pcm_out_buffer;
typedef A_ring_buffer_to_bind_them<OUT_PACKET_BUFFER_SIZE> Out_packet_buffer;
typedef A_ring_buffer_to_bind_them<IN_PCM_BUFFER_SIZE> Pcm_in_buffer;
typedef A_ring_buffer_to_bind_them<IN_PACKET_BUFFER_SIZE> In_packet_buffer;
struct GenodeVoiceOut
{
HWVoiceOut hw;
Audio_out::Connection *audio[VBOX_CHANNELS];
Out_packet_buffer packet_buf;
Pcm_out_buffer pcm_buf;
unsigned packets;
};
struct GenodeVoiceIn {
HWVoiceIn hw;
Audio_in::Connection *audio;
In_packet_buffer packet_buf;
Pcm_in_buffer pcm_buf;
unsigned packets;
};
static int write_samples(GenodeVoiceOut *out, int16_t *src, int samples)
{
Out_packet_buffer &packet_buf = out->packet_buf;
/* try to fill and submit packet */
if (packet_buf.read_avail() >= OUT_PACKET_SIZE) {
Audio_out::Connection *c = out->audio[0];
/* check how many submitted packets are still in the queue */
if (c->stream()->queued() > OUT_PACKET_NUM) return 0;
/* alloc new packets */
Audio_out::Packet *p[2] { nullptr, nullptr };
try { p[0] = c->stream()->alloc(); }
catch (Audio_out::Stream::Alloc_failed) { return 0; }
unsigned const ppos = out->audio[0]->stream()->packet_position(p[0]);
p[1] = out->audio[1]->stream()->get(ppos);
/* copy */
float *left_content = p[0]->content();
float *right_content = p[1]->content();
int16_t buf[Audio_out::PERIOD*2];
size_t const n = packet_buf.read(buf, sizeof(buf));
if (n != sizeof(buf))
Genode::error(__func__, ": n: ", n, " buf: ", buf);
for (int i = 0; i < Audio_out::PERIOD; i++) {
left_content[i] = (float)(buf[i * VBOX_CHANNELS + 0]) / 32768.0f;
right_content[i] = (float)(buf[i * VBOX_CHANNELS + 1]) / 32768.0f;
}
/* submit */
for (int i = 0; i < VBOX_CHANNELS; i++)
out->audio[i]->submit(p[i]);
out->packets++;
}
/* copy new samples */
int const bytes = samples * VBOX_SAMPLE_SIZE * VBOX_SAMPLE_SIZE;
size_t const n = packet_buf.write(src, bytes);
return n / (VBOX_SAMPLE_SIZE * VBOX_SAMPLE_SIZE);
}
static int genode_run_out(HWVoiceOut *hw)
{
GenodeVoiceOut * const out = (GenodeVoiceOut *)hw;
Pcm_out_buffer & pcm_buf = out->pcm_buf;
int const live = audio_pcm_hw_get_live_out(&out->hw);
if (!live)
return 0;
int const decr = audio_MIN(live, out->hw.samples);
size_t const avail = pcm_buf.read_avail();
if ((avail / (VBOX_SAMPLE_SIZE*VBOX_CHANNELS)) < decr)
Genode::error(__func__, ": avail: ", avail, " < decr ", decr);
char buf[decr*VBOX_SAMPLE_SIZE*VBOX_CHANNELS];
pcm_buf.read(buf, sizeof(buf), true);
int const samples = write_samples(out, (int16_t*)buf, decr);
if (samples == 0) return 0;
pcm_buf.read_advance(samples * (VBOX_SAMPLE_SIZE*VBOX_CHANNELS));
out->hw.rpos = (out->hw.rpos + samples) % out->hw.samples;
return samples;
}
static int genode_write(SWVoiceOut *sw, void *buf, int size)
{
GenodeVoiceOut * const out = (GenodeVoiceOut*)sw->hw;
Pcm_out_buffer &pcm_buf = out->pcm_buf;
size_t const avail = pcm_buf.write_avail();
if (size > avail)
Genode::warning(__func__, ": size: ", size, " available: ", avail);
size_t const n = pcm_buf.write(buf, size);
if (n < size)
Genode::warning(__func__, ": written: ", n, " expected: ", size);
/* needed by audio_pcm_hw_get_live_out() to calculate ``live'' samples */
sw->total_hw_samples_mixed += (size / 4);
return size;
}
static int genode_init_out(HWVoiceOut *hw, audsettings_t *as)
{
GenodeVoiceOut * const out = (GenodeVoiceOut *)hw;
if (as->nchannels != VBOX_CHANNELS) {
Genode::error("only ", (int)VBOX_CHANNELS, " channels supported ",
"( ", as->nchannels, " were requested)");
return -1;
}
if (as->freq != Audio_out::SAMPLE_RATE) {
Genode::error("only ", (int)Audio_out::SAMPLE_RATE, " frequency supported "
"(", as->freq, " was requested)");
return -1;
}
for (int i = 0; i < VBOX_CHANNELS; i++) {
try {
out->audio[i] = new (vmm_heap())
Audio_out::Connection(genode_env(), channel_names[i]);
} catch (...) {
Genode::error("could not establish Audio_out connection");
while (--i > 0)
Genode::destroy(vmm_heap(), out->audio[i]);
return -1;
}
}
audio_pcm_init_info(&out->hw.info, as);
out->hw.samples = Audio_out::PERIOD;
out->packets = 0;
Genode::log("--- using Audio_out session ---");
Genode::log("freq: ", as->freq);
Genode::log("channels: ", as->nchannels);
Genode::log("format: ", (int)as->fmt);
Genode::log("endianness: ", as->endianness);
return 0;
}
static void genode_fini_out(HWVoiceOut *hw)
{
GenodeVoiceOut * const out = (GenodeVoiceOut *)hw;
for (int i = 0; i < VBOX_CHANNELS; i++)
Genode::destroy(vmm_heap(), out->audio[i]);
}
static int genode_ctl_out(HWVoiceOut *hw, int cmd, ...)
{
GenodeVoiceOut *out = (GenodeVoiceOut*)hw;
switch (cmd) {
case VOICE_ENABLE:
out->packets = 0;
for (int i = 0; i < VBOX_CHANNELS; i++)
out->audio[i]->start();
break;
case VOICE_DISABLE:
for (int i = 0; i < VBOX_CHANNELS; i++) {
out->audio[i]->stop();
out->audio[i]->stream()->invalidate_all();
}
break;
}
return 0;
}
/***************
** Recording **
***************/
static int genode_init_in(HWVoiceIn *hw, audsettings_t *as)
{
GenodeVoiceIn *in = (GenodeVoiceIn*)hw;
try {
in->audio = new (vmm_heap()) Audio_in::Connection(genode_env(), "left");
} catch (...) {
Genode::error("could not establish Audio_in connection");
return -1;
}
audio_pcm_init_info(&in->hw.info, as);
in->hw.samples = Audio_in::PERIOD;
in->packets = 0;
Genode::log("--- using Audio_in session ---");
Genode::log("freq: ", as->freq);
Genode::log("channels: ", as->nchannels);
Genode::log("format: ", (int)as->fmt);
Genode::log("endianness: ", as->endianness);
return 0;
}
static void genode_fini_in(HWVoiceIn *hw)
{
GenodeVoiceIn * const in = (GenodeVoiceIn*)hw;
Genode::destroy(vmm_heap(), in->audio);
}
static int read_samples(GenodeVoiceIn *in, int samples)
{
In_packet_buffer &packet_buf = in->packet_buf;
Pcm_in_buffer &pcm_buf = in->pcm_buf;
while (packet_buf.read_avail() < IN_PACKET_SIZE) {
Audio_in::Stream &stream = *in->audio->stream();
Audio_in::Packet *p = stream.get(stream.pos());
if (!p->valid()) {
if (packet_buf.read_avail() < (samples*VBOX_SAMPLE_SIZE*VBOX_CHANNELS)) {
return 0;
}
break;
}
int16_t buf[Audio_in::PERIOD*VBOX_CHANNELS];
if (packet_buf.write_avail() < sizeof(buf))
return 0;
float *content = p->content();
for (int i = 0; i < Audio_in::PERIOD; i++) {
int16_t const v = content[i] * 32767;
int const j = i * 2;
buf[j + 0] = v;
buf[j + 1] = v;
}
size_t const w = packet_buf.write(buf, sizeof(buf));
if (w != sizeof(buf))
Genode::error(__func__, ": write n: ", w, " buf: ", sizeof(buf));
p->invalidate();
p->mark_as_recorded();
stream.increment_position();
in->packets++;
break;
}
int16_t buf[samples*VBOX_CHANNELS];
size_t const r = packet_buf.read(buf, sizeof(buf), true);
size_t const w = pcm_buf.write(buf, r);
if (w != r)
Genode::error(__func__, ": w: ", w, " != r: ", r);
packet_buf.read_advance(w);
return w / (VBOX_SAMPLE_SIZE*VBOX_CHANNELS);
}
static int genode_run_in(HWVoiceIn *hw)
{
GenodeVoiceIn *in = (GenodeVoiceIn*)hw;
int const live = audio_pcm_hw_get_live_in(&in->hw);
if (!(in->hw.samples - live))
return 0;
int const dead = in->hw.samples - live;
int const samples = read_samples(in, dead);
in->hw.wpos = (in->hw.wpos + samples) % in->hw.samples;
return samples;
}
static int genode_read(SWVoiceIn *sw, void *buf, int size)
{
GenodeVoiceIn * const in = (GenodeVoiceIn*)sw->hw;
Pcm_in_buffer &pcm_buf = in->pcm_buf;
size_t const avail = pcm_buf.read_avail();
if (avail < size)
Genode::error(__func__, ": avail: ", avail, " size: ", size);
size_t const r = pcm_buf.read(buf, size);
if (r != size)
Genode::error(__func__, ": r: ", r, " size: ", size);
/* needed by audio_pcm_hw_get_live_in() to calculate ``live'' samples */
sw->total_hw_samples_acquired += (r / (VBOX_SAMPLE_SIZE*VBOX_CHANNELS));
return size;
}
static int genode_ctl_in(HWVoiceIn *hw, int cmd, ...)
{
GenodeVoiceIn * const in = (GenodeVoiceIn*)hw;
switch (cmd) {
case VOICE_ENABLE:
in->packets = 0;
in->audio->start();
break;
case VOICE_DISABLE:
in->audio->stop();
break;
}
return 0;
}
static void *genode_audio_init(void) { return &oss_audio_driver; }
static void genode_audio_fini(void *) { }
static struct audio_pcm_ops genode_pcm_ops = {
genode_init_out,
genode_fini_out,
genode_run_out,
genode_write,
genode_ctl_out,
genode_init_in,
genode_fini_in,
genode_run_in,
genode_read,
genode_ctl_in
};
/*
* We claim to be the OSS driver so that we do not have to
* patch the VirtualBox source because we already claim to
* be FreeBSD.
*/
struct audio_driver oss_audio_driver = {
INIT_FIELD (name = ) "oss",
INIT_FIELD (descr = ) "Genode Audio_out/Audio_in",
INIT_FIELD (options = ) NULL,
INIT_FIELD (init = ) genode_audio_init,
INIT_FIELD (fini = ) genode_audio_fini,
INIT_FIELD (pcm_ops = ) &genode_pcm_ops,
INIT_FIELD (can_be_default = ) 1,
INIT_FIELD (max_voices_out = ) INT_MAX,
INIT_FIELD (max_voices_in = ) INT_MAX,
INIT_FIELD (voice_size_out = ) sizeof(GenodeVoiceOut),
INIT_FIELD (voice_size_in = ) sizeof(GenodeVoiceIn)
};

View File

@ -1,95 +0,0 @@
/*
* \brief VirtualBox device models
* \author Norman Feske
* \date 2013-08-20
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <base/attached_rom_dataspace.h>
/* VirtualBox includes */
#include <VBoxDD.h>
#include <VBoxDD2.h>
#include "vmm.h"
#define REGISTER(device) \
do { \
rc = pCallbacks->pfnRegister(pCallbacks, &g_##device); \
if (RT_FAILURE(rc)) \
return rc; \
} while (0)
extern "C" int VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
{
int rc = 0;
/* platform */
REGISTER(DevicePcArch);
REGISTER(DevicePcBios);
REGISTER(DeviceI8254);
REGISTER(DeviceI8259);
REGISTER(DeviceDMA);
REGISTER(DeviceMC146818);
REGISTER(DeviceACPI);
REGISTER(DeviceAPIC);
REGISTER(DeviceIOAPIC);
REGISTER(DevicePCI);
REGISTER(DevicePCIBridge);
/* devices */
REGISTER(DevicePS2KeyboardMouse);
REGISTER(DeviceVga);
REGISTER(DeviceFloppyController);
REGISTER(DeviceSerialPort);
REGISTER(DevicePIIX3IDE);
REGISTER(DeviceAHCI);
REGISTER(DevicePCNet);
REGISTER(DeviceE1000);
REGISTER(DeviceVMMDev);
REGISTER(DeviceOHCI);
REGISTER(DeviceICHAC97);
REGISTER(DeviceICH6_HDA);
REGISTER(DeviceXHCI);
return VINF_SUCCESS;
}
/*
* The virtual PCI model delivers IRQs to the PIC by default and to the IOAPIC
* only if the guest operating system selected the IOAPIC with the '_PIC' ACPI
* method and if it called the '_PRT' ACPI method afterwards. When running a
* guest operating system which uses the IOAPIC, but does not call these ACPI
* methods (for example Genode/NOVA), IRQ delivery to the IOAPIC can be
* enforced with the 'force_ioapic' configuration option.
*
* References:
* - 'pciSetIrqInternal()' in DevPCI.cpp
* - '_PIC' and '_PRT' ACPI methods in vbox.dsl
*/
static bool read_force_ioapic_from_config()
{
try {
Genode::Attached_rom_dataspace config(genode_env(), "config");
return config.xml().attribute_value("force_ioapic", false);
} catch (Genode::Rom_connection::Rom_connection_failed) {
return false;
}
}
bool force_ioapic()
{
/* read only once from config ROM */
static bool force = read_force_ioapic_from_config();
return force;
}

View File

@ -1,585 +0,0 @@
/*
* \brief NEC XHCI device frontend
* \author Josef Soentgen
* \author Sebastian Sumpf
* \date 2015-12-10
*/
/*
* Copyright (C) 2015-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <base/log.h>
#include <base/attached_rom_dataspace.h>
#include <util/list.h>
/* qemu-usb includes */
#include <qemu/usb.h>
/* Virtualbox includes */
#define LOG_GROUP LOG_GROUP_DEV_EHCI
#include <VBox/pci.h>
#include <VBox/vmm/pdm.h>
#include <VBox/vmm/pgm.h>
#include <VBox/vmm/mm.h>
#include <VBox/err.h>
#include <VBox/log.h>
#include <iprt/assert.h>
#include <iprt/string.h>
#include <iprt/asm.h>
#include <iprt/asm-math.h>
#include <iprt/semaphore.h>
#include <iprt/critsect.h>
#ifdef IN_RING3
# include <iprt/alloca.h>
# include <iprt/mem.h>
# include <iprt/thread.h>
# include <iprt/uuid.h>
#endif
#include <VBox/vusb.h>
#include <VBoxDD.h>
/* VBox Genode specific */
#include "vmm.h"
static bool const verbose_timer = false;
/************************
** xHCI device struct **
************************/
struct Timer_queue;
struct Destruction_helper;
struct XHCI
{
/** The PCI device. */
PCIDEVICE PciDev;
/** Pointer to the device instance - R3 ptr. */
PPDMDEVINSR3 pDevInsR3;
/** Pointer to the device instance - R0 ptr */
PPDMDEVINSR0 pDevInsR0;
/** Pointer to the device instance - RC ptr. */
PPDMDEVINSRC pDevInsRC;
/** Address of the MMIO region assigned by PCI. */
RTGCPHYS32 MMIOBase;
/** Receiver thread that handles all USB signals. */
PPDMTHREAD pThread;
PTMTIMERR3 controller_timer;
Timer_queue *timer_queue;
Qemu::Controller *ctl;
Genode::Signal_receiver *usb_sig_rec;
Destruction_helper *destruction_helper;
};
/** Pointer to XHCI device data. */
typedef struct XHCI *PXHCI;
/** Read-only pointer to the XHCI device data. */
typedef struct XHCI const *PCXHCI;
/*************************************
** Qemu::Controller helper classes **
*************************************/
struct Timer_queue : public Qemu::Timer_queue
{
struct Context : public Genode::List<Context>::Element
{
uint64_t timeout_abs_ns = ~0ULL;
bool pending = false;
void *qtimer = nullptr;
void (*cb)(void*) = nullptr;
void *data = nullptr;
Context(void *qtimer, void (*cb)(void*), void *data)
: qtimer(qtimer), cb(cb), data(data) { }
};
Genode::List<Context> _context_list;
PTMTIMER tm_timer;
void _append_new_context(void *qtimer, void (*cb)(void*), void *data)
{
Context *new_ctx = new (vmm_heap()) Context(qtimer, cb, data);
_context_list.insert(new_ctx);
}
Context *_find_context(void const *qtimer)
{
for (Context *c = _context_list.first(); c; c = c->next())
if (c->qtimer == qtimer)
return c;
return nullptr;
}
Context *_min_pending()
{
Context *min = nullptr;
for (min = _context_list.first(); min; min = min->next())
if (min && min->pending)
break;
if (!min || !min->next())
return min;
for (Context *c = min->next(); c; c = c->next()) {
if (c->timeout_abs_ns < min->timeout_abs_ns && c->pending)
min = c;
}
return min;
}
void _program_min_timer()
{
Context *min = _min_pending();
if (min == nullptr) return;
if (TMTimerIsActive(tm_timer))
TMTimerStop(tm_timer);
TMTimerSetNano(tm_timer, min->timeout_abs_ns - TMTimerGetNano(tm_timer));
}
void _deactivate_timer(void *qtimer)
{
Context *c = _find_context(qtimer);
if (c == nullptr) {
Genode::error("qtimer: ", qtimer, " not found");
throw -1;
}
if (c->pending) {
Context *min = _min_pending();
if (min == c) {
TMTimerStop(tm_timer);
_program_min_timer();
}
}
c->pending = false;
}
Timer_queue(PTMTIMER timer) : tm_timer(timer) { }
void timeout()
{
uint64_t now = TMTimerGetNano(tm_timer);
for (Context *c = _context_list.first(); c; c = c->next()) {
if (c->pending && c->timeout_abs_ns <= now) {
Qemu::usb_timer_callback(c->cb, c->data);
c->pending = false;
}
}
_program_min_timer();
}
/**********************
** TMTimer callback **
**********************/
static DECLCALLBACK(void) tm_timer_cb(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
{
PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
Timer_queue *q = pThis->timer_queue;
q->timeout();
}
unsigned count_timer()
{
unsigned res = 0;
for (Context *c = _context_list.first(); c; c = c->next()) {
if (c->pending) Genode::log("timer: ", c, " is pending");
res++;
}
return res;
}
/*********************************
** Qemu::Timer_queue interface **
*********************************/
Qemu::int64_t get_ns() { return TMTimerGetNano(tm_timer); }
Genode::Lock _timer_lock;
void register_timer(void *qtimer, void (*cb)(void*), void *data) override
{
Genode::Lock::Guard lock_guard(_timer_lock);
if (verbose_timer)
Genode::log("qtimer: ", qtimer, " cb: ", cb, " data: ", data);
Context *c = _find_context(qtimer);
if (c != nullptr) {
Genode::error("qtimer: ", qtimer, " already registred");
throw -1;
}
_append_new_context(qtimer, cb, data);
}
void delete_timer(void *qtimer) override
{
Genode::Lock::Guard lock_guard(_timer_lock);
if (verbose_timer)
Genode::log("qtimer: ", qtimer);
Context *c = _find_context(qtimer);
if (c == nullptr) {
Genode::error("qtimer: ", qtimer, " not found");
throw -1;
}
_deactivate_timer(qtimer);
_context_list.remove(c);
Genode::destroy(vmm_heap(), c);
}
void activate_timer(void *qtimer, long long int expire_abs) override
{
Genode::Lock::Guard lock_guard(_timer_lock);
if (verbose_timer)
Genode::log("qtimer: ", qtimer, " expire: ", expire_abs);
Context *c = _find_context(qtimer);
if (c == nullptr) {
Genode::error("qtimer: ", qtimer, " not found");
throw -1;
}
c->timeout_abs_ns = expire_abs;
c->pending = true;
_program_min_timer();
}
void deactivate_timer(void *qtimer) override
{
Genode::Lock::Guard lock_guard(_timer_lock);
if (verbose_timer)
Genode::log("qtimer: ", qtimer);
_deactivate_timer(qtimer);
}
};
struct Pci_device : public Qemu::Pci_device
{
PPDMDEVINS pci_dev;
Pci_device(PPDMDEVINS pDevIns) : pci_dev(pDevIns) { }
void raise_interrupt(int level) override {
PDMDevHlpPCISetIrqNoWait(pci_dev, 0, level); }
int read_dma(Qemu::addr_t addr, void *buf, Qemu::size_t size) override {
return PDMDevHlpPhysRead(pci_dev, addr, buf, size); }
int write_dma(Qemu::addr_t addr, void const *buf, Qemu::size_t size) override {
return PDMDevHlpPhysWrite(pci_dev, addr, buf, size); }
void *map_dma(Qemu::addr_t base, Qemu::size_t size)
{
void *addr;
PGMR3PhysTlbGCPhys2Ptr(nullptr, base, true, &addr);
return addr;
}
void unmap_dma(void *addr, Qemu::size_t size) { }
};
/*************************************
** Qemu::Usb signal thread backend **
*************************************/
struct Destruction_helper
{
Genode::Signal_receiver &sig_rec;
Genode::Signal_dispatcher<Destruction_helper> dispatcher {
sig_rec, *this, &Destruction_helper::handle };
void handle(unsigned) { }
Destruction_helper(Genode::Signal_receiver &sig_rec)
: sig_rec(sig_rec) { }
};
static DECLCALLBACK(int) usb_signal_thread(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
{
PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
if (pThread->enmState == PDMTHREADSTATE_INITIALIZING)
return VINF_SUCCESS;
while (pThread->enmState == PDMTHREADSTATE_RUNNING)
{
Genode::Signal sig = pThis->usb_sig_rec->wait_for_signal();
int num = sig.num();
Genode::Signal_dispatcher_base *dispatcher;
dispatcher = dynamic_cast<Genode::Signal_dispatcher_base *>(sig.context());
if (dispatcher) {
dispatcher->dispatch(num);
}
}
return VINF_SUCCESS;
}
static DECLCALLBACK(int) usb_signal_thread_wakeup(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
{
PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
Genode::Signal_transmitter(pThis->destruction_helper->dispatcher).submit();
return VINF_SUCCESS;
}
/***********************************************
** Virtualbox Device function implementation **
***********************************************/
/**
* @callback_method_impl{FNIOMMMIOREAD}
*/
PDMBOTHCBDECL(int) xhciMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr,
void *pv, unsigned cb)
{
PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
Genode::off_t offset = GCPhysAddr - pThis->MMIOBase;
Qemu::Controller *ctl = pThis->ctl;
ctl->mmio_read(offset, pv, cb);
return 0;
}
/**
* @callback_method_impl{FNIOMMMIOWRITE}
*/
PDMBOTHCBDECL(int) xhciMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr,
void const *pv, unsigned cb)
{
PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
Genode::off_t offset = GCPhysAddr - pThis->MMIOBase;
Qemu::Controller *ctl = pThis->ctl;
ctl->mmio_write(offset, pv, cb);
return 0;
}
/**
* @callback_method_impl{FNPCIIOREGIONMAP}
*/
static DECLCALLBACK(int) xhciR3Map(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS GCPhysAddress,
uint32_t cb, PCIADDRESSSPACE enmType)
{
PXHCI pThis = (PXHCI)pPciDev;
int rc = PDMDevHlpMMIORegister(pThis->CTX_SUFF(pDevIns), GCPhysAddress, cb, NULL /*pvUser*/,
IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_DWORD_ZEROED
| IOMMMIO_FLAGS_DBGSTOP_ON_COMPLICATED_WRITE,
xhciMmioWrite, xhciMmioRead, "USB XHCI");
if (RT_FAILURE(rc))
return rc;
rc = PDMDevHlpMMIORegisterRC(pPciDev->pDevIns, GCPhysAddress, cb, NIL_RTRCPTR /*pvUser*/,
"xhciMmioWrite", "xhciMmioRead");
if (RT_FAILURE(rc))
return rc;
pThis->MMIOBase = GCPhysAddress;
return VINF_SUCCESS;
}
/**
* @interface_method_impl{PDMDEVREG,pfnReset}
*/
static DECLCALLBACK(void) xhciReset(PPDMDEVINS pDevIns)
{
PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
Qemu::usb_reset();
Qemu::usb_update_devices();
}
/**
* @interface_method_impl{PDMDEVREG,pfnDestruct}
*/
static DECLCALLBACK(int) xhciDestruct(PPDMDEVINS pDevIns)
{
Qemu::usb_reset();
return 0;
}
/**
* @interface_method_impl{PDMDEVREG,pfnConstruct,XHCI constructor}
*/
static DECLCALLBACK(int) xhciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
{
PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
pThis->usb_sig_rec = new (vmm_heap()) Genode::Signal_receiver();
pThis->destruction_helper = new (vmm_heap())
Destruction_helper(*(pThis->usb_sig_rec));
int rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, Timer_queue::tm_timer_cb,
pThis, TMTIMER_FLAGS_NO_CRIT_SECT,
"NEC-XHCI Timer", &pThis->controller_timer);
static Timer_queue timer_queue(pThis->controller_timer);
pThis->timer_queue = &timer_queue;
static Pci_device pci_device(pDevIns);
rc = PDMDevHlpThreadCreate(pDevIns, &pThis->pThread, pThis,
usb_signal_thread, usb_signal_thread_wakeup,
32 * 1024 , RTTHREADTYPE_IO, "usb_signal");
pThis->ctl = Qemu::usb_init(timer_queue, pci_device, *pThis->usb_sig_rec,
vmm_heap(), genode_env());
/*
* Init instance data.
*/
pThis->pDevInsR3 = pDevIns;
pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
PCIDevSetVendorId (&pThis->PciDev, 0x1033); /* PCI_VENDOR_ID_NEC */
PCIDevSetDeviceId (&pThis->PciDev, 0x0194); /* PCI_DEVICE_ID_NEC_UPD720200 */
PCIDevSetClassProg (&pThis->PciDev, 0x30); /* xHCI */
PCIDevSetClassSub (&pThis->PciDev, 0x03);
PCIDevSetClassBase (&pThis->PciDev, 0x0c);
PCIDevSetInterruptPin (&pThis->PciDev, 0x01);
PCIDevSetByte (&pThis->PciDev, 0x60, 0x30); /* Serial Bus Release Number Register */
#ifdef VBOX_WITH_MSI_DEVICES
PCIDevSetStatus (&pThis->PciDev, VBOX_PCI_STATUS_CAP_LIST);
PCIDevSetCapabilityList(&pThis->PciDev, 0x80);
#endif
/*
* Register PCI device and I/O region.
*/
rc = PDMDevHlpPCIRegister(pDevIns, &pThis->PciDev);
if (RT_FAILURE(rc))
return rc;
#ifdef VBOX_WITH_MSI_DEVICES
PDMMSIREG MsiReg;
RT_ZERO(MsiReg);
MsiReg.cMsiVectors = 1;
MsiReg.iMsiCapOffset = 0x80;
MsiReg.iMsiNextOffset = 0x00;
rc = PDMDevHlpPCIRegisterMsi(pDevIns, &MsiReg);
if (RT_FAILURE(rc))
{
PCIDevSetCapabilityList(&pThis->PciDev, 0x0);
/* That's OK, we can work without MSI */
}
#endif
rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, pThis->ctl->mmio_size(),
PCI_ADDRESS_SPACE_MEM, xhciR3Map);
if (RT_FAILURE(rc))
return rc;
return VINF_SUCCESS;
}
const PDMDEVREG g_DeviceXHCI =
{
/* u32version */
PDM_DEVREG_VERSION,
/* szName */
"nec-xhci",
/* szRCMod */
"VBoxDDGC.gc",
/* szR0Mod */
"VBoxDDR0.r0",
/* pszDescription */
"NEC XHCI USB controller.\n",
/* fFlags */
PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC,
/* fClass */
PDM_DEVREG_CLASS_BUS_USB,
/* cMaxInstances */
~0U,
/* cbInstance */
sizeof(XHCI),
/* pfnConstruct */
xhciR3Construct,
/* pfnDestruct */
xhciDestruct,
/* pfnRelocate */
NULL,
/* pfnMemSetup */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
xhciReset,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnAttach */
NULL,
/* pfnDetach */
NULL,
/* pfnQueryInterface */
NULL,
/* pfnInitComplete */
NULL,
/* pfnPowerOff */
NULL,
/* pfnSoftReset */
NULL,
/* u32VersionEnd */
PDM_DEVREG_VERSION
};
bool use_xhci_controller()
{
try {
Genode::Attached_rom_dataspace config(genode_env(), "config");
return config.xml().attribute_value("xhci", false);
} catch (Genode::Rom_connection::Rom_connection_failed) {
return false;
}
}

View File

@ -1,45 +0,0 @@
/*
* \brief VirtualBox host drivers
* \author Norman Feske
* \date 2013-08-20
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* VirtualBox includes */
#include <VBoxDD.h>
extern "C" int VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_t u32Version)
{
PDMDRVREG const *drvs[] = {
&g_DrvKeyboardQueue,
&g_DrvMouseQueue,
&g_DrvBlock,
&g_DrvMediaISO,
&g_DrvACPI,
&g_DrvChar,
&g_DrvRawImage,
&g_DrvRawFile,
&g_DrvHostSerial,
&g_DrvVD,
&g_DrvHostInterface,
&g_DrvVUSBRootHub,
&g_DrvAUDIO,
0
};
for (unsigned i = 0; drvs[i]; i++) {
int rc = pCallbacks->pfnRegister(pCallbacks, drvs[i]);
if (RT_FAILURE(rc))
return rc;
}
return VINF_SUCCESS;
}

View File

@ -1,205 +0,0 @@
/*
* \brief Dummy implementations of symbols needed by VirtualBox
* \author Norman Feske
* \date 2013-08-22
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#include <util/string.h>
#include <base/log.h>
#include <string.h> /* libc memcpy */
#include "VMMInternal.h"
#include "EMInternal.h"
#include "PDMInternal.h"
#include <iprt/err.h>
#include <iprt/mem.h>
#include <VBox/vmm/cpum.h>
#include <VBox/vmm/mm.h>
#include <VBox/vmm/dbgf.h>
#include <VBox/vmm/ftm.h>
#include <VBox/vmm/iem.h>
#include <VBox/vmm/selm.h>
#include <VBox/vmm/hm.h>
#include <VBox/vmm/iom.h>
#include "util.h"
static const bool trace = false;
#define TRACE(retval) \
{ \
if (trace) \
Genode::log(__func__, " called, return dummy, eip=", \
__builtin_return_address(0)); \
return retval; \
}
RT_C_DECLS_BEGIN
RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW
{
if (!trace)
return VINF_SUCCESS;
char type[4];
if (fProtect & RTMEM_PROT_READ)
type[0] = 'r';
else
type[0] = '-';
if (fProtect & RTMEM_PROT_WRITE)
type[1] = 'w';
else
type[1] = '-';
if (fProtect & RTMEM_PROT_EXEC)
type[2] = 'x';
else
type[2] = '-';
type[3] = 0;
Genode::warning(__func__, " called - not implemented - ", pv, "+",
Genode::Hex(cb), " protect ", Genode::Hex(fProtect), " - "
"'", Genode::Cstring(type), "'");
return VINF_SUCCESS;
}
static_assert(sizeof(RTR0PTR) == sizeof(RTR3PTR), "pointer transformation bug");
static_assert(sizeof(RTR0PTR) == sizeof(void *) , "pointer transformation bug");
static_assert(sizeof(RTR3PTR) == sizeof(RTR0PTR), "pointer transformation bug");
RTR0PTR MMHyperR3ToR0(PVM pVM, RTR3PTR R3Ptr) { return (RTR0PTR)R3Ptr; }
RTRCPTR MMHyperR3ToRC(PVM pVM, RTR3PTR R3Ptr) { return to_rtrcptr(R3Ptr); }
RTR0PTR MMHyperCCToR0(PVM pVM, void *pv) { return (RTR0PTR)pv; }
RTRCPTR MMHyperCCToRC(PVM pVM, void *pv) { return to_rtrcptr(pv); }
RTR3PTR MMHyperR0ToR3(PVM pVM, RTR0PTR R0Ptr) { return (RTR3PTR*)(R0Ptr | 0UL); }
RTR3PTR MMHyperRCToR3(PVM pVM, RTRCPTR RCPtr)
{
static_assert(sizeof(RCPtr) <= sizeof(RTR3PTR), "ptr transformation bug");
return reinterpret_cast<RTR3PTR>(0UL | RCPtr);
}
/* debugger */
int DBGFR3Init(PVM) TRACE(VINF_SUCCESS)
int DBGFR3EventSrcV(PVM, DBGFEVENTTYPE, const char *, unsigned, const char *,
const char *, va_list) TRACE(VINF_SUCCESS)
void DBGFR3Relocate(PVM, RTGCINTPTR) TRACE()
int DBGFR3RegRegisterDevice(PVM, PCDBGFREGDESC, PPDMDEVINS, const char*,
uint32_t) TRACE(VINF_SUCCESS)
int DBGFR3AsSymbolByAddr(PUVM, RTDBGAS, PCDBGFADDRESS, uint32_t, PRTGCINTPTR,
PRTDBGSYMBOL, PRTDBGMOD) TRACE(VERR_INVALID_HANDLE)
int DBGFR3Term(PVM) TRACE(VINF_SUCCESS)
int DBGFR3Event(PVM pVM, DBGFEVENTTYPE enmEvent)
{
Genode::log(__func__, ": ", (int)enmEvent);
TRACE(VERR_NOT_SUPPORTED)
}
/* called by 'VMMR3InitRC', but we don't use GC */
int cpumR3DbgInit(PVM) TRACE(VINF_SUCCESS)
void CPUMPushHyper(PVMCPU, uint32_t) TRACE()
int PGMFlushTLB(PVMCPU, uint64_t, bool) TRACE(VINF_SUCCESS)
int PGMInvalidatePage(PVMCPU, RTGCPTR) TRACE(VINF_SUCCESS)
int PGMHandlerPhysicalPageTempOff(PVM, RTGCPHYS, RTGCPHYS) TRACE(VINF_SUCCESS)
void PGMPhysReleasePageMappingLock(PVM, PPGMPAGEMAPLOCK) TRACE()
int PGMR3CheckIntegrity(PVM) TRACE(VINF_SUCCESS)
int PGMR3FinalizeMappings(PVM) TRACE(VINF_SUCCESS)
int PGMR3InitCompleted(PVM, VMINITCOMPLETED) TRACE(VINF_SUCCESS)
int PGMR3InitDynMap(PVM) TRACE(VINF_SUCCESS)
int PGMR3InitFinalize(PVM) TRACE(VINF_SUCCESS)
int PGMR3HandlerVirtualRegister(PVM, PGMVIRTHANDLERTYPE, RTGCPTR, RTGCPTR,
PFNPGMR3VIRTINVALIDATE, PFNPGMR3VIRTHANDLER,
const char*, const char*, const char*) TRACE(VINF_SUCCESS)
int PGMHandlerVirtualDeregister(PVM, RTGCPTR) TRACE(VINF_SUCCESS)
void PGMR3Relocate(PVM, RTGCINTPTR) TRACE()
int PGMChangeMode(PVMCPU, uint64_t, uint64_t, uint64_t) TRACE(VINF_SUCCESS)
int PGMR3ChangeMode(PVM, PVMCPU, PGMMODE) TRACE(VINF_SUCCESS)
/* required for Netware */
void PGMCr0WpEnabled(PVMCPU pVCpu) TRACE()
/* debugger */
void DBGFR3PowerOff(PVM pVM) TRACE()
int DBGFR3DisasInstrCurrent(PVMCPU, char *, uint32_t) TRACE(VINF_SUCCESS)
int vmmR3SwitcherInit(PVM pVM) TRACE(VINF_SUCCESS)
void vmmR3SwitcherRelocate(PVM, RTGCINTPTR) TRACE()
int VMMR3DisableSwitcher(PVM) TRACE(VINF_SUCCESS)
int emR3InitDbg(PVM pVM) TRACE(VINF_SUCCESS)
int FTMR3Init(PVM) TRACE(VINF_SUCCESS)
int FTMR3SetCheckpoint(PVM, FTMCHECKPOINTTYPE) TRACE(-1)
int FTMSetCheckpoint(PVM, FTMCHECKPOINTTYPE) TRACE(VINF_SUCCESS)
int FTMR3Term(PVM) TRACE(VINF_SUCCESS)
int IEMR3Init(PVM) TRACE(VINF_SUCCESS)
int IEMR3Term(PVM) TRACE(VINF_SUCCESS)
void IEMR3Relocate(PVM) TRACE()
void HMR3Relocate(PVM) TRACE()
void HMR3Reset(PVM pVM) TRACE()
int SELMR3Init(PVM) TRACE(VINF_SUCCESS)
int SELMR3Term(PVM) TRACE(VINF_SUCCESS)
int SELMR3InitFinalize(PVM) TRACE(VINF_SUCCESS)
void SELMR3Relocate(PVM) TRACE()
void SELMR3Reset(PVM) TRACE()
void SELMR3DisableMonitoring(PVM) TRACE()
int IOMR3IOPortRegisterRC(PVM, PPDMDEVINS, RTIOPORT, RTUINT, RTRCPTR, RTRCPTR,
RTRCPTR, RTRCPTR, RTRCPTR, const char*) TRACE(VINF_SUCCESS)
int IOMR3IOPortRegisterR0(PVM, PPDMDEVINS, RTIOPORT, RTUINT, RTR0PTR,
RTHCUINTPTR, RTHCUINTPTR, RTHCUINTPTR, RTHCUINTPTR,
const char*) TRACE(VINF_SUCCESS)
int IOMR3MmioRegisterR0(PVM, PPDMDEVINS, RTGCPHYS, uint32_t, RTR0PTR,
RTHCUINTPTR, RTHCUINTPTR, RTHCUINTPTR) TRACE(VINF_SUCCESS)
int IOMR3MmioRegisterRC(PVM, PPDMDEVINS, RTGCPHYS, uint32_t, RTGCPTR, RTRCPTR,
RTRCPTR, RTRCPTR) TRACE(VINF_SUCCESS)
void IOMR3Relocate(PVM, RTGCINTPTR) TRACE()
void IOMR3Reset(PVM) TRACE()
int SUPR3SetVMForFastIOCtl(PVMR0) TRACE(VINF_SUCCESS)
_AVLOU32NodeCore* RTAvloU32RemoveBestFit(PAVLOU32TREE, AVLOU32KEY, bool) TRACE(VINF_SUCCESS)
int RTAvlrFileOffsetDestroy(PAVLRFOFFTREE, PAVLRFOFFCALLBACK, void*) TRACE(VINF_SUCCESS)
/* module loader of pluggable device manager */
int pdmR3LdrInitU(PUVM) TRACE(VINF_SUCCESS)
int PDMR3LdrLoadVMMR0U(PUVM) TRACE(VINF_SUCCESS)
void PDMR3LdrRelocateU(PUVM, RTGCINTPTR) TRACE()
int pdmR3LoadR3U(PUVM, const char *, const char *) TRACE(VINF_SUCCESS)
void pdmR3LdrTermU(PUVM) TRACE()
char *pdmR3FileR3(const char * file, bool)
{
char * pv = reinterpret_cast<char *>(RTMemTmpAllocZ(1));
if (trace)
Genode::log(__func__, ": file ", file, " ", (void *)pv, " ", __builtin_return_address(0));
TRACE(pv)
}
const char * RTBldCfgRevisionStr(void)
{
return "Genode";
}
RT_C_DECLS_END

View File

@ -1,14 +0,0 @@
#ifndef ____H_CLIENTWATCHER
#define ____H_CLIENTWATCHER
class VirtualBox::ClientWatcher
{
public:
ClientWatcher(VirtualBox* const) { }
bool isReady() { return true; }
void update() { }
void addProcess(RTPROCESS pid);
};
#endif /* !____H_CLIENTWATCHER */

View File

@ -1,10 +0,0 @@
#ifndef ____H_GENODEIMPL
#define ____H_GENODEIMPL
/* GuestControlSvc.h */
typedef struct { } VBOXGUESTCTRLHOSTCBCTX, *PVBOXGUESTCTRLHOSTCBCTX;
typedef struct { } VBOXGUESTCTRLHOSTCALLBACK, *PVBOXGUESTCTRLHOSTCALLBACK;
enum GUEST_FILE_SEEKTYPE { };
#endif // !____H_GENODEIMPL

View File

@ -1,210 +0,0 @@
/** @file
*
* VirtualBox API class wrapper code for IMediumFormat.
*
* DO NOT EDIT! This is a generated file.
* Generated from: src/VBox/Main/idl/VirtualBox.xidl
* Generator: src/VBox/Main/idl/apiwrap-server.xsl
*/
/**
* Copyright (C) 2010-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_MEDIUMFORMAT
#include "MediumFormatWrap.h"
#include "Logging.h"
DEFINE_EMPTY_CTOR_DTOR(MediumFormatWrap)
//
// IMediumFormat properties
//
STDMETHODIMP MediumFormatWrap::COMGETTER(Id)(BSTR *aId)
{
LogRelFlow(("{%p} %s: enter aId=%p\n", this, "MediumFormat::getId", aId));
VirtualBoxBase::clearError();
HRESULT hrc;
try
{
CheckComArgOutPointerValidThrow(aId);
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc()))
throw autoCaller.rc();
hrc = getId(BSTROutConverter(aId).str());
}
catch (HRESULT hrc2)
{
hrc = hrc2;
}
catch (...)
{
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
}
LogRelFlow(("{%p} %s: leave *aId=%ls hrc=%Rhrc\n", this, "MediumFormat::getId", *aId, hrc));
return hrc;
}
STDMETHODIMP MediumFormatWrap::COMGETTER(Name)(BSTR *aName)
{
LogRelFlow(("{%p} %s: enter aName=%p\n", this, "MediumFormat::getName", aName));
VirtualBoxBase::clearError();
HRESULT hrc;
try
{
CheckComArgOutPointerValidThrow(aName);
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc()))
throw autoCaller.rc();
hrc = getName(BSTROutConverter(aName).str());
}
catch (HRESULT hrc2)
{
hrc = hrc2;
}
catch (...)
{
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
}
LogRelFlow(("{%p} %s: leave *aName=%ls hrc=%Rhrc\n", this, "MediumFormat::getName", *aName, hrc));
return hrc;
}
STDMETHODIMP MediumFormatWrap::COMGETTER(Capabilities)(ComSafeArrayOut(MediumFormatCapabilities_T, aCapabilities))
{
LogRelFlow(("{%p} %s: enter aCapabilities=%p\n", this, "MediumFormat::getCapabilities", aCapabilities));
VirtualBoxBase::clearError();
HRESULT hrc;
try
{
CheckComArgOutPointerValidThrow(aCapabilities);
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc()))
throw autoCaller.rc();
hrc = getCapabilities(ArrayOutConverter<MediumFormatCapabilities_T>(ComSafeArrayOutArg(aCapabilities)).array());
}
catch (HRESULT hrc2)
{
hrc = hrc2;
}
catch (...)
{
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
}
LogRelFlow(("{%p} %s: leave *aCapabilities=%zu hrc=%Rhrc\n", this, "MediumFormat::getCapabilities", ComSafeArraySize(*aCapabilities), hrc));
return hrc;
}
//
// IMediumFormat methods
//
STDMETHODIMP MediumFormatWrap::DescribeFileExtensions(ComSafeArrayOut(BSTR, aExtensions),
ComSafeArrayOut(DeviceType_T, aTypes))
{
LogRelFlow(("{%p} %s:enter aExtensions=%p aTypes=%p\n", this, "MediumFormat::describeFileExtensions", aExtensions, aTypes));
VirtualBoxBase::clearError();
HRESULT hrc;
try
{
CheckComArgOutPointerValidThrow(aExtensions);
CheckComArgOutPointerValidThrow(aTypes);
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc()))
throw autoCaller.rc();
hrc = describeFileExtensions(ArrayBSTROutConverter(ComSafeArrayOutArg(aExtensions)).array(),
ArrayOutConverter<DeviceType_T>(ComSafeArrayOutArg(aTypes)).array());
}
catch (HRESULT hrc2)
{
hrc = hrc2;
}
catch (...)
{
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
}
LogRelFlow(("{%p} %s: leave *aExtensions=%zu *aTypes=%zu hrc=%Rhrc\n", this, "MediumFormat::describeFileExtensions", ComSafeArraySize(*aExtensions), ComSafeArraySize(*aTypes), hrc));
return hrc;
}
STDMETHODIMP MediumFormatWrap::DescribeProperties(ComSafeArrayOut(BSTR, aNames),
ComSafeArrayOut(BSTR, aDescriptions),
ComSafeArrayOut(DataType_T, aTypes),
ComSafeArrayOut(ULONG, aFlags),
ComSafeArrayOut(BSTR, aDefaults))
{
LogRelFlow(("{%p} %s:enter aNames=%p aDescriptions=%p aTypes=%p aFlags=%p aDefaults=%p\n", this, "MediumFormat::describeProperties", aNames, aDescriptions, aTypes, aFlags, aDefaults));
VirtualBoxBase::clearError();
HRESULT hrc;
try
{
CheckComArgOutPointerValidThrow(aNames);
CheckComArgOutPointerValidThrow(aDescriptions);
CheckComArgOutPointerValidThrow(aTypes);
CheckComArgOutPointerValidThrow(aFlags);
CheckComArgOutPointerValidThrow(aDefaults);
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc()))
throw autoCaller.rc();
hrc = describeProperties(ArrayBSTROutConverter(ComSafeArrayOutArg(aNames)).array(),
ArrayBSTROutConverter(ComSafeArrayOutArg(aDescriptions)).array(),
ArrayOutConverter<DataType_T>(ComSafeArrayOutArg(aTypes)).array(),
ArrayOutConverter<ULONG>(ComSafeArrayOutArg(aFlags)).array(),
ArrayBSTROutConverter(ComSafeArrayOutArg(aDefaults)).array());
}
catch (HRESULT hrc2)
{
hrc = hrc2;
}
catch (...)
{
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
}
LogRelFlow(("{%p} %s: leave *aNames=%zu *aDescriptions=%zu *aTypes=%zu *aFlags=%zu *aDefaults=%zu hrc=%Rhrc\n", this, "MediumFormat::describeProperties", ComSafeArraySize(*aNames), ComSafeArraySize(*aDescriptions), ComSafeArraySize(*aTypes), ComSafeArraySize(*aFlags), ComSafeArraySize(*aDefaults), hrc));
return hrc;
}
#ifdef VBOX_WITH_XPCOM
NS_DECL_CLASSINFO(MediumFormatWrap)
NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MediumFormatWrap, IMediumFormat)
#endif // VBOX_WITH_XPCOM

View File

@ -1,77 +0,0 @@
/** @file
*
* VirtualBox API class wrapper header for IMediumFormat.
*
* DO NOT EDIT! This is a generated file.
* Generated from: src/VBox/Main/idl/VirtualBox.xidl
* Generator: src/VBox/Main/idl/apiwrap-server.xsl
*/
/**
* Copyright (C) 2010-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef MediumFormatWrap_H_
#define MediumFormatWrap_H_
#include "VirtualBoxBase.h"
#include "Wrapper.h"
class ATL_NO_VTABLE MediumFormatWrap:
public VirtualBoxBase,
VBOX_SCRIPTABLE_IMPL(IMediumFormat)
{
Q_OBJECT
public:
VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumFormatWrap, IMediumFormat)
DECLARE_NOT_AGGREGATABLE(MediumFormatWrap)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(MediumFormatWrap)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IMediumFormat)
COM_INTERFACE_ENTRY2(IDispatch, IMediumFormat)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(MediumFormatWrap)
// public IMediumFormat properties
STDMETHOD(COMGETTER(Id))(BSTR *aId);
STDMETHOD(COMGETTER(Name))(BSTR *aName);
STDMETHOD(COMGETTER(Capabilities))(ComSafeArrayOut(MediumFormatCapabilities_T, aCapabilities));
// public IMediumFormat methods
STDMETHOD(DescribeFileExtensions)(ComSafeArrayOut(BSTR, aExtensions),
ComSafeArrayOut(DeviceType_T, aTypes));
STDMETHOD(DescribeProperties)(ComSafeArrayOut(BSTR, aNames),
ComSafeArrayOut(BSTR, aDescriptions),
ComSafeArrayOut(DataType_T, aTypes),
ComSafeArrayOut(ULONG, aFlags),
ComSafeArrayOut(BSTR, aDefaults));
private:
// wrapped IMediumFormat properties
virtual HRESULT getId(com::Utf8Str &aId) = 0;
virtual HRESULT getName(com::Utf8Str &aName) = 0;
virtual HRESULT getCapabilities(std::vector<MediumFormatCapabilities_T> &aCapabilities) = 0;
// wrapped IMediumFormat methods
virtual HRESULT describeFileExtensions(std::vector<com::Utf8Str> &aExtensions,
std::vector<DeviceType_T> &aTypes) = 0;
virtual HRESULT describeProperties(std::vector<com::Utf8Str> &aNames,
std::vector<com::Utf8Str> &aDescriptions,
std::vector<DataType_T> &aTypes,
std::vector<ULONG> &aFlags,
std::vector<com::Utf8Str> &aDefaults) = 0;
};
#endif // !MediumFormatWrap_H_

View File

@ -1,100 +0,0 @@
/** @file
*
* VirtualBox API class wrapper code for IToken.
*
* DO NOT EDIT! This is a generated file.
* Generated from: src/VBox/Main/idl/VirtualBox.xidl
* Generator: src/VBox/Main/idl/apiwrap-server.xsl
*/
/**
* Copyright (C) 2010-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_TOKEN
#include "TokenWrap.h"
#include "Logging.h"
DEFINE_EMPTY_CTOR_DTOR(TokenWrap)
//
// IToken properties
//
//
// IToken methods
//
STDMETHODIMP TokenWrap::Abandon()
{
LogRelFlow(("{%p} %s:enter\n", this, "Token::abandon"));
VirtualBoxBase::clearError();
HRESULT hrc;
try
{
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc()))
throw autoCaller.rc();
hrc = abandon(autoCaller);
}
catch (HRESULT hrc2)
{
hrc = hrc2;
}
catch (...)
{
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
}
LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, "Token::abandon", hrc));
return hrc;
}
STDMETHODIMP TokenWrap::Dummy()
{
LogRelFlow(("{%p} %s:enter\n", this, "Token::dummy"));
VirtualBoxBase::clearError();
HRESULT hrc;
try
{
AutoCaller autoCaller(this);
if (FAILED(autoCaller.rc()))
throw autoCaller.rc();
hrc = dummy();
}
catch (HRESULT hrc2)
{
hrc = hrc2;
}
catch (...)
{
hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
}
LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, "Token::dummy", hrc));
return hrc;
}
#ifdef VBOX_WITH_XPCOM
NS_DECL_CLASSINFO(TokenWrap)
NS_IMPL_THREADSAFE_ISUPPORTS1_CI(TokenWrap, IToken)
#endif // VBOX_WITH_XPCOM

View File

@ -1,61 +0,0 @@
/** @file
*
* VirtualBox API class wrapper header for IToken.
*
* DO NOT EDIT! This is a generated file.
* Generated from: src/VBox/Main/idl/VirtualBox.xidl
* Generator: src/VBox/Main/idl/apiwrap-server.xsl
*/
/**
* Copyright (C) 2010-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef TokenWrap_H_
#define TokenWrap_H_
#include "VirtualBoxBase.h"
#include "Wrapper.h"
class ATL_NO_VTABLE TokenWrap:
public VirtualBoxBase,
VBOX_SCRIPTABLE_IMPL(IToken)
{
Q_OBJECT
public:
VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(TokenWrap, IToken)
DECLARE_NOT_AGGREGATABLE(TokenWrap)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(TokenWrap)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IToken)
COM_INTERFACE_ENTRY2(IDispatch, IToken)
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(TokenWrap)
// public IToken properties
// public IToken methods
STDMETHOD(Abandon)();
STDMETHOD(Dummy)();
private:
// wrapped IToken properties
// wrapped IToken methods
virtual HRESULT abandon(AutoCaller &aAutoCaller) = 0;
virtual HRESULT dummy() = 0;
};
#endif // !TokenWrap_H_

View File

@ -1,45 +0,0 @@
#include "EventImpl.h"
void fireStateChangedEvent(IEventSource* aSource, MachineState_T a_state);
void fireRuntimeErrorEvent(IEventSource* aSource, BOOL a_fatal, CBSTR a_id,
CBSTR a_message);
void fireGuestMonitorChangedEvent(IEventSource* aSource,
GuestMonitorChangedEventType_T a_changeType,
ULONG a_screenId, ULONG a_originX,
ULONG a_originY, ULONG a_width,
ULONG a_height);
void fireHostPCIDevicePlugEvent(IEventSource* aSource, CBSTR a_machineId,
BOOL a_plugged, BOOL a_success,
IPCIDeviceAttachment* a_attachment,
CBSTR a_message);
void fireNATRedirectEvent(IEventSource* aSource, CBSTR a_machineId,
ULONG a_slot, BOOL a_remove, CBSTR a_name,
NATProtocol_T a_proto, CBSTR a_hostIP,
LONG a_hostPort, CBSTR a_guestIP, LONG a_guestPort);
void fireNATNetworkChangedEvent(IEventSource* aSource, CBSTR a_networkName);
void fireNATNetworkStartStopEvent(IEventSource* aSource, CBSTR a_networkName,
BOOL a_startEvent);
void fireNATNetworkSettingEvent(IEventSource* aSource, CBSTR a_networkName,
BOOL a_enabled, CBSTR a_network,
CBSTR a_gateway,
BOOL a_advertiseDefaultIPv6RouteEnabled,
BOOL a_needDhcpServer);
void fireNATNetworkPortForwardEvent(IEventSource* aSource, CBSTR a_networkName,
BOOL a_create, BOOL a_ipv6, CBSTR a_name,
NATProtocol_T a_proto, CBSTR a_hostIp,
LONG a_hostPort, CBSTR a_guestIp,
LONG a_guestPort);
void fireHostNameResolutionConfigurationChangeEvent(IEventSource* aSource);
void fireMediumChangedEvent(IEventSource *, IMediumAttachment *);
#define fireGuestPropertyChangedEvent(a, b, c, d, e)

View File

@ -1,502 +0,0 @@
/**
* VirtualBox COM base class definition adjusted to Genode
* - based on VBox/Main/include/VirtualBoxBase.h
*/
/*
* Copyright (C) 2006-2013 Oracle Corporation
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ____H_VIRTUALBOXBASEIMPL
#define ____H_VIRTUALBOXBASEIMPL
#include <base/log.h>
#include <iprt/cdefs.h>
#include <iprt/thread.h>
#include <list>
#include <map>
#include "VBox/com/AutoLock.h"
#include "VBox/com/string.h"
#include "VBox/com/Guid.h"
#include "VBox/com/VirtualBox.h"
namespace com
{
class ErrorInfo;
}
using namespace com;
using namespace util;
class AutoInitSpan;
class AutoUninitSpan;
class VirtualBox;
class Machine;
class Medium;
typedef std::list<ComObjPtr<Medium> > MediaList;
typedef std::list<Utf8Str> StringsList;
class VirtualBoxTranslatable : public util::Lockable
{
public:
/* should be used for translations */
inline static const char *tr(const char *pcszSourceText,
const char *aComment = NULL)
{
return pcszSourceText;
}
};
class VirtualBoxBase : public VirtualBoxTranslatable
{
public:
enum State { NotReady, Ready, InInit, InUninit, InitFailed, Limited };
virtual void uninit() { }
private:
RWLockHandle *_lock;
void setState(State aState)
{
Assert(mState != aState);
mState = aState;
mStateChangeThread = RTThreadSelf();
}
/** Primary state of this object */
State mState;
/** Thread that caused the last state change */
RTTHREAD mStateChangeThread;
/** Total number of active calls to this object */
unsigned mCallers;
/** Posted when the number of callers drops to zero */
RTSEMEVENT mZeroCallersSem;
/** Posted when the object goes from InInit/InUninit to some other state */
RTSEMEVENTMULTI mInitUninitSem;
/** Number of threads waiting for mInitUninitDoneSem */
unsigned mInitUninitWaiters;
/** Protects access to state related data members */
WriteLockHandle mStateLock;
/** User-level object lock for subclasses */
mutable RWLockHandle *mObjectLock;
friend class AutoInitSpan;
friend class AutoReinitSpan;
friend class AutoUninitSpan;
protected:
HRESULT BaseFinalConstruct() { return S_OK; }
void BaseFinalRelease() { }
public:
VirtualBoxBase(); // : _lock(nullptr) { }
~VirtualBoxBase();
virtual HRESULT addCaller(State *aState = NULL, bool aLimited = false);
virtual void releaseCaller();
virtual const char* getComponentName() const = 0;
static HRESULT handleUnexpectedExceptions(VirtualBoxBase *const aThis, RT_SRC_POS_DECL);
static HRESULT initializeComForThread(void);
static void uninitializeComForThread(void);
static void clearError(void);
HRESULT setError(HRESULT aResultCode);
HRESULT setError(HRESULT aResultCode, const char *pcsz, ...);
HRESULT setError(const com::ErrorInfo &ei);
static HRESULT setErrorInternal(HRESULT aResultCode,
const GUID &aIID,
const char *aComponent,
Utf8Str aText,
bool aWarning,
bool aLogIt);
virtual VBoxLockingClass getLockingClass() const
{
return LOCKCLASS_OTHEROBJECT;
}
RWLockHandle * lockHandle() const;
};
/**
* Dummy macro that is used to shut down Qt's lupdate tool warnings in some
* situations. This macro needs to be present inside (better at the very
* beginning) of the declaration of the class that inherits from
* VirtualBoxTranslatable, to make lupdate happy.
*/
#define Q_OBJECT
template <typename T>
class Shareable
{
private:
bool _verbose;
T * _obj;
public:
Shareable<T> () : _verbose(false), _obj(nullptr) { }
/* operators */
T * operator->() const { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); return _obj; }
bool isNull() const { return _obj == nullptr; }
bool operator!() const { return isNull(); }
void allocate() { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); _obj = new T; }
void attach(T * t) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); }
void attach(Shareable &s) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); }
void share(const Shareable &s) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); _obj = s._obj; }
void share(T * obj) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); _obj = obj; }
void free() { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); }
void attachCopy(const T *) { if(_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); }
void attachCopy(const Shareable &) { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); }
T *data() const { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); return _obj; }
bool isShared() const { if (_verbose) Genode::log(__PRETTY_FUNCTION__, " called"); return false; }
};
template <typename T>
class Backupable : public Shareable<T>
{
public:
Backupable() : Shareable<T>() { }
void backup() { }
void rollback() { }
void commit() { }
void commitCopy() { }
void assignCopy(const T *) { }
void assignCopy(const Backupable &) { }
HRESULT backupEx() { return S_OK; }
T *backedUpData() const { Genode::log(__PRETTY_FUNCTION__, " called"); return nullptr; }
bool isBackedUp() const { return false; }
};
/**
* Special version of the Assert macro to be used within VirtualBoxBase
* subclasses.
*
* In the debug build, this macro is equivalent to Assert.
* In the release build, this macro uses |setError(E_FAIL, ...)| to set the
* error info from the asserted expression.
*
* @see VirtualBoxBase::setError
*
* @param expr Expression which should be true.
*/
#if defined(DEBUG)
#define ComAssert(expr) Assert(expr)
#else
#define ComAssert(expr) \
do { \
if (RT_UNLIKELY(!(expr))) \
setError(E_FAIL, \
"Assertion failed: [%s] at '%s' (%d) in %s.\nPlease contact the product vendor!", \
#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
} while (0)
#endif
/**
* Special version of the AssertFailed macro to be used within VirtualBoxBase
* subclasses.
*
* In the debug build, this macro is equivalent to AssertFailed.
* In the release build, this macro uses |setError(E_FAIL, ...)| to set the
* error info from the asserted expression.
*
* @see VirtualBoxBase::setError
*
*/
#if defined(DEBUG)
#define ComAssertFailed() AssertFailed()
#else
#define ComAssertFailed() \
do { \
setError(E_FAIL, \
"Assertion failed: at '%s' (%d) in %s.\nPlease contact the product vendor!", \
__FILE__, __LINE__, __PRETTY_FUNCTION__); \
} while (0)
#endif
/**
* Special version of the AssertMsg macro to be used within VirtualBoxBase
* subclasses.
*
* See ComAssert for more info.
*
* @param expr Expression which should be true.
* @param a printf argument list (in parenthesis).
*/
#if defined(DEBUG)
#define ComAssertMsg(expr, a) AssertMsg(expr, a)
#else
#define ComAssertMsg(expr, a) \
do { \
if (RT_UNLIKELY(!(expr))) \
setError(E_FAIL, \
"Assertion failed: [%s] at '%s' (%d) in %s.\n%s.\nPlease contact the product vendor!", \
#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__, Utf8StrFmt a .c_str()); \
} while (0)
#endif
/**
* Special version of the AssertComRC macro to be used within VirtualBoxBase
* subclasses.
*
* See ComAssert for more info.
*
* @param rc COM result code
*/
#if defined(DEBUG)
#define ComAssertComRC(rc) AssertComRC(rc)
#else
#define ComAssertComRC(rc) ComAssertMsg(SUCCEEDED(rc), ("COM RC = %Rhrc (0x%08X)", (rc), (rc)))
#endif
/**
* Special version of the AssertMsgRC macro to be used within VirtualBoxBase
* subclasses.
*
* See ComAssert for more info.
*
* @param vrc VBox status code.
* @param msg printf argument list (in parenthesis).
*/
#if defined(DEBUG)
#define ComAssertMsgRC(vrc, msg) AssertMsgRC(vrc, msg)
#else
#define ComAssertMsgRC(vrc, msg) ComAssertMsg(RT_SUCCESS(vrc), msg)
#endif
/**
* Special version of the AssertRC macro to be used within VirtualBoxBase
* subclasses.
*
* See ComAssert for more info.
*
* @param vrc VBox status code.
*/
#if defined(DEBUG)
#define ComAssertRC(vrc) AssertRC(vrc)
#else
#define ComAssertRC(vrc) ComAssertMsgRC(vrc, ("%Rra", vrc))
#endif
/** Special version of ComAssert that returns ret if expr fails */
#define ComAssertRet(expr, ret) \
do { ComAssert(expr); if (!(expr)) return (ret); } while (0)
/** Special version of ComAssertMsg that returns ret if expr fails */
#define ComAssertMsgRet(expr, a, ret) \
do { ComAssertMsg(expr, a); if (!(expr)) return (ret); } while (0)
/** Special version of ComAssertComRC that returns ret if rc does not succeed */
#define ComAssertComRCRet(rc, ret) \
do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) return (ret); } while (0)
/** Special version of ComAssertMsg that evaluates eval and breaks if expr fails */
#define ComAssertMsgBreak(expr, a, eval) \
if (1) { ComAssertMsg(expr, a); if (!(expr)) { eval; break; } } else do {} while (0)
/** Special version of ComAssert that evaluates eval and throws it if expr fails */
#define ComAssertThrow(expr, eval) \
do { ComAssert(expr); if (!(expr)) { throw (eval); } } while (0)
/** Special version of ComAssertRC that evaluates eval and throws it if vrc does not succeed */
#define ComAssertRCThrow(vrc, eval) \
do { ComAssertRC(vrc); if (!RT_SUCCESS(vrc)) { throw (eval); } } while (0)
/** Special version of ComAssertFailed that returns ret */
#define ComAssertFailedRet(ret) \
do { ComAssertFailed(); return (ret); } while (0)
/** Special version of ComAssertFailed that returns ret */
#define ComAssertFailedRet(ret) \
do { ComAssertFailed(); return (ret); } while (0)
/** Special version of ComAssertRC that returns ret if vrc does not succeed */
#define ComAssertRCRet(vrc, ret) \
do { ComAssertRC(vrc); if (!RT_SUCCESS(vrc)) return (ret); } while (0)
/** Special version of ComAssertComRC that just throws rc if rc does not succeed */
#define ComAssertComRCThrowRC(rc) \
do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) { throw rc; } } while (0)
/** Special version of ComAssertComRC that returns rc if rc does not succeed */
#define ComAssertComRCRetRC(rc) \
do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) return (rc); } while (0)
/**
* Checks that the pointer argument is not NULL and returns E_INVALIDARG +
* extended error info on failure.
* @param arg Input pointer-type argument (strings, interface pointers...)
*/
#define CheckComArgNotNull(arg) \
do { \
if (RT_UNLIKELY((arg) == NULL)) \
return setError(E_INVALIDARG, tr("Argument %s is NULL"), #arg); \
} while (0)
/**
* Checks that the pointer argument is a valid pointer or NULL and returns
* E_INVALIDARG + extended error info on failure.
* @param arg Input pointer-type argument (strings, interface pointers...)
*/
#define CheckComArgMaybeNull(arg) \
do { \
if (RT_UNLIKELY(!RT_VALID_PTR(arg) && (arg) != NULL)) \
return setError(E_INVALIDARG, tr("Argument %s is an invalid pointer"), #arg); \
} while (0)
/**
* Checks that the given expression (that must involve the argument) is true and
* returns E_INVALIDARG + extended error info on failure.
* @param arg Argument.
* @param expr Expression to evaluate.
*/
#define CheckComArgExpr(arg, expr) \
do { \
if (RT_UNLIKELY(!(expr))) \
return setError(E_INVALIDARG, \
tr("Argument %s is invalid (must be %s)"), #arg, #expr); \
} while (0)
/**
* Checks that the given pointer to an output argument is valid and returns
* E_POINTER + extended error info otherwise.
* @param arg Pointer argument.
*/
#define CheckComArgOutPointerValid(arg) \
do { \
if (RT_UNLIKELY(!VALID_PTR(arg))) \
return setError(E_POINTER, \
tr("Output argument %s points to invalid memory location (%p)"), \
#arg, (void *)(arg)); \
} while (0)
/**
* Checks that a string input argument is valid (not NULL or obviously invalid
* pointer), returning E_INVALIDARG + extended error info if invalid.
* @param a_bstrIn Input string argument (IN_BSTR).
*/
#define CheckComArgStr(a_bstrIn) \
do { \
IN_BSTR const bstrInCheck = (a_bstrIn); /* type check */ \
if (RT_UNLIKELY(!RT_VALID_PTR(bstrInCheck))) \
return setError(E_INVALIDARG, tr("Argument %s is an invalid pointer"), #a_bstrIn); \
} while (0)
/**
* Checks that the string argument is not a NULL, a invalid pointer or an empty
* string, returning E_INVALIDARG + extended error info on failure.
* @param a_bstrIn Input string argument (BSTR etc.).
*/
#define CheckComArgStrNotEmptyOrNull(a_bstrIn) \
do { \
IN_BSTR const bstrInCheck = (a_bstrIn); /* type check */ \
if (RT_UNLIKELY(!RT_VALID_PTR(bstrInCheck) || *(bstrInCheck) == '\0')) \
return setError(E_INVALIDARG, tr("Argument %s is empty or an invalid pointer"), #a_bstrIn); \
} while (0)
/**
* Checks that the given pointer to an output safe array argument is valid and
* returns E_POINTER + extended error info otherwise.
* @param arg Safe array argument.
*/
#define CheckComArgOutSafeArrayPointerValid(arg) \
do { \
if (RT_UNLIKELY(ComSafeArrayOutIsNull(arg))) \
return setError(E_POINTER, \
tr("Output argument %s points to invalid memory location (%p)"), \
#arg, (void*)(arg)); \
} while (0)
/**
* Checks that safe array argument is not NULL and returns E_INVALIDARG +
* extended error info on failure.
* @param arg Input safe array argument (strings, interface pointers...)
*/
#define CheckComArgSafeArrayNotNull(arg) \
do { \
if (RT_UNLIKELY(ComSafeArrayInIsNull(arg))) \
return setError(E_INVALIDARG, tr("Argument %s is NULL"), #arg); \
} while (0)
/**
* Sets the extended error info and returns E_NOTIMPL.
*/
#define ReturnComNotImplemented() \
do { \
return setError(E_NOTIMPL, tr("Method %s is not implemented"), __FUNCTION__); \
} while (0)
#define DECLARE_EMPTY_CTOR_DTOR(X) public: X(); ~X();
#define DEFINE_EMPTY_CTOR_DTOR(X) X::X() {} X::~X() {}
#define VIRTUALBOXBASE_ADD_VIRTUAL_COMPONENT_METHODS(cls, iface) \
virtual const GUID& getClassIID() const \
{ \
return cls::getStaticClassIID(); \
} \
static const GUID& getStaticClassIID() \
{ \
return COM_IIDOF(iface); \
} \
virtual const char* getComponentName() const \
{ \
return cls::getStaticComponentName(); \
} \
static const char* getStaticComponentName() \
{ \
return #cls; \
}
/**
* VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT:
* This macro must be used once in the declaration of any class derived
* from VirtualBoxBase. It implements the pure virtual getClassIID() and
* getComponentName() methods. If this macro is not present, instances
* of a class derived from VirtualBoxBase cannot be instantiated.
*
* @param X The class name, e.g. "Class".
* @param IX The interface name which this class implements, e.g. "IClass".
*/
#define VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(cls, iface) \
VIRTUALBOXBASE_ADD_VIRTUAL_COMPONENT_METHODS(cls, iface)
#include "GenodeImpl.h"
#endif // !____H_VIRTUALBOXBASEIMPL

View File

@ -1,6 +0,0 @@
#include "dummy/macros.h"
#include "VirtualBoxErrorInfoImpl.h"
HRESULT VirtualBoxErrorInfo::init(HRESULT, const GUID &, const char *,
const Utf8Str &, IVirtualBoxErrorInfo *) DUMMY(E_FAIL)

View File

@ -1,49 +0,0 @@
#ifndef ____H_VIRTUALBOXERRORINFO
#define ____H_VIRTUALBOXERRORINFO
#include <VirtualBoxBase.h>
class VirtualBoxErrorInfo :
public VirtualBoxBase,
VBOX_SCRIPTABLE_IMPL(IVirtualBoxErrorInfo)
{
public:
VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VirtualBoxErrorInfo, IVirtualBoxErrorInfo)
DECLARE_NOT_AGGREGATABLE(VirtualBoxErrorInfo)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(VirtualBoxErrorInfo)
COM_INTERFACE_ENTRY(IErrorInfo)
COM_INTERFACE_ENTRY(IVirtualBoxErrorInfo)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
HRESULT init(HRESULT aResultCode, const GUID &aIID,
const char *pcszComponent, const com::Utf8Str &strText,
IVirtualBoxErrorInfo *aNext = NULL);
HRESULT FinalConstruct() { return S_OK; }
/* readonly attribute long resultCode; */
HRESULT GetResultCode(PRInt32 *aResultCode) { return S_OK; }
/* readonly attribute long resultDetail; */
HRESULT GetResultDetail(PRInt32 *aResultDetail) { return S_OK; }
/* readonly attribute wstring interfaceID; */
HRESULT GetInterfaceID(PRUnichar * *aInterfaceID) { return S_OK; }
/* readonly attribute wstring component; */
HRESULT GetComponent(PRUnichar * *aComponent) { return S_OK; }
/* readonly attribute wstring text; */
HRESULT GetText(PRUnichar * *aText) { return S_OK; }
/* readonly attribute IVirtualBoxErrorInfo next; */
HRESULT GetNext(IVirtualBoxErrorInfo * *aNext) { return S_OK; }
};
#endif /* ____H_VIRTUALBOXERRORINFO */

View File

@ -1,598 +0,0 @@
/*
* \brief Port of VirtualBox to Genode
* \author Norman Feske
* \author Alexander Boettcher
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#include <base/log.h>
#include <util/xml_node.h>
#include <VBox/settings.h>
#include <SharedClipboard/VBoxClipboard.h>
#include <VBox/HostServices/VBoxClipboardSvc.h>
#include "ConsoleImpl.h"
#include "MachineImpl.h"
#include "MouseImpl.h"
#include "DisplayImpl.h"
#include "GuestImpl.h"
#include "dummy/macros.h"
#include "console.h"
#include "fb.h"
#include "../vmm.h"
static const bool debug = false;
static bool vm_down = false;
static Genode::Attached_rom_dataspace *clipboard_rom = nullptr;
static Genode::Reporter *clipboard_reporter = nullptr;
static char *decoded_clipboard_content = nullptr;
void Console::uninit() DUMMY()
HRESULT Console::resume(Reason_T aReason) DUMMY(E_FAIL)
HRESULT Console::pause(Reason_T aReason) DUMMY(E_FAIL)
void Console::enableVMMStatistics(BOOL aEnable) DUMMY()
HRESULT Console::updateMachineState(MachineState_T aMachineState) DUMMY(E_FAIL)
HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter)
{
ULONG slot = 0;
HRESULT rc = networkAdapter->COMGETTER(Slot)(&slot);
AssertComRC(rc);
maTapFD[slot] = (RTFILE)1;
TRACE(rc)
}
HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter)
{
ULONG slot = 0;
HRESULT rc = networkAdapter->COMGETTER(Slot)(&slot);
AssertComRC(rc);
if (maTapFD[slot] != NIL_RTFILE)
maTapFD[slot] = NIL_RTFILE;
TRACE(rc)
}
HRESULT Console::teleporterTrg(PUVM, IMachine*, com::Utf8Str*, bool, Progress*,
bool*) DUMMY(E_FAIL)
HRESULT Console::saveState(Reason_T aReason, IProgress **aProgress) DUMMY(E_FAIL)
STDMETHODIMP Console::COMGETTER(Debugger)(IMachineDebugger **aDebugger) DUMMY(E_FAIL)
STDMETHODIMP Console::COMGETTER(USBDevices)(ComSafeArrayOut(IUSBDevice *, aUSBDevices)) DUMMY(E_FAIL)
STDMETHODIMP Console::COMGETTER(RemoteUSBDevices)(ComSafeArrayOut(IHostUSBDevice *, aRemoteUSBDevices)) DUMMY(E_FAIL)
STDMETHODIMP Console::COMGETTER(VRDEServerInfo)(IVRDEServerInfo **aVRDEServerInfo) DUMMY(E_FAIL)
STDMETHODIMP Console::COMGETTER(EmulatedUSB)(IEmulatedUSB **aEmulatedUSB) DUMMY(E_FAIL)
STDMETHODIMP Console::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders)) DUMMY(E_FAIL)
STDMETHODIMP Console::COMGETTER(AttachedPCIDevices)(ComSafeArrayOut(IPCIDeviceAttachment *, aAttachments)) DUMMY(E_FAIL)
STDMETHODIMP Console::COMGETTER(UseHostClipboard)(BOOL *aUseHostClipboard) DUMMY(E_FAIL)
STDMETHODIMP Console::COMSETTER(UseHostClipboard)(BOOL aUseHostClipboard) DUMMY(E_FAIL)
HRESULT Console::Reset() DUMMY(E_FAIL)
HRESULT Console::Pause() DUMMY(E_FAIL)
HRESULT Console::Resume() DUMMY(E_FAIL)
HRESULT Console::SleepButton() DUMMY(E_FAIL)
HRESULT Console::GetPowerButtonHandled(bool*) DUMMY(E_FAIL)
HRESULT Console::GetGuestEnteredACPIMode(bool*) DUMMY(E_FAIL)
HRESULT Console::SaveState(IProgress**) DUMMY(E_FAIL)
HRESULT Console::AdoptSavedState(IN_BSTR) DUMMY(E_FAIL)
HRESULT Console::DiscardSavedState(bool) DUMMY(E_FAIL)
HRESULT Console::GetDeviceActivity(DeviceType_T, DeviceActivity_T*) DUMMY(E_FAIL)
HRESULT Console::AttachUSBDevice(IN_BSTR) DUMMY(E_FAIL)
HRESULT Console::DetachUSBDevice(IN_BSTR, IUSBDevice**) DUMMY(E_FAIL)
HRESULT Console::FindUSBDeviceByAddress(IN_BSTR, IUSBDevice**) DUMMY(E_FAIL)
HRESULT Console::FindUSBDeviceById(IN_BSTR, IUSBDevice**) DUMMY(E_FAIL)
HRESULT Console::CreateSharedFolder(IN_BSTR, IN_BSTR, BOOL, BOOL) DUMMY(E_FAIL)
HRESULT Console::RemoveSharedFolder(IN_BSTR) DUMMY(E_FAIL)
HRESULT Console::TakeSnapshot(IN_BSTR, IN_BSTR, IProgress**) DUMMY(E_FAIL)
HRESULT Console::DeleteSnapshot(IN_BSTR, IProgress**) DUMMY(E_FAIL)
HRESULT Console::DeleteSnapshotAndAllChildren(IN_BSTR, IProgress**) DUMMY(E_FAIL)
HRESULT Console::DeleteSnapshotRange(IN_BSTR, IN_BSTR, IProgress**) DUMMY(E_FAIL)
HRESULT Console::RestoreSnapshot(ISnapshot*, IProgress**) DUMMY(E_FAIL)
HRESULT Console::Teleport(IN_BSTR, ULONG, IN_BSTR, ULONG, IProgress **) DUMMY(E_FAIL)
HRESULT Console::setDiskEncryptionKeys(const Utf8Str &strCfg) DUMMY(E_FAIL)
void Console::onAdditionsOutdated() DUMMY()
HRESULT Console::onVideoCaptureChange() DUMMY(E_FAIL)
HRESULT Console::onSharedFolderChange(BOOL aGlobal) DUMMY(E_FAIL)
HRESULT Console::onUSBControllerChange() DUMMY(E_FAIL)
HRESULT Console::onCPUChange(ULONG aCPU, BOOL aRemove) DUMMY(E_FAIL)
HRESULT Console::onClipboardModeChange(ClipboardMode_T aClipboardMode) DUMMY(E_FAIL)
HRESULT Console::onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode) DUMMY(E_FAIL)
HRESULT Console::onCPUExecutionCapChange(ULONG aExecutionCap) DUMMY(E_FAIL)
HRESULT Console::onStorageControllerChange() DUMMY(E_FAIL)
HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment, BOOL) DUMMY(E_FAIL)
HRESULT Console::onVRDEServerChange(BOOL aRestart) DUMMY(E_FAIL)
HRESULT Console::onUSBDeviceAttach(IUSBDevice *, IVirtualBoxErrorInfo *, ULONG) DUMMY(E_FAIL)
HRESULT Console::onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError) DUMMY(E_FAIL)
HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) DUMMY(E_FAIL)
HRESULT Console::onNetworkAdapterChange(INetworkAdapter *, BOOL changeAdapter) DUMMY(E_FAIL)
HRESULT Console::onStorageDeviceChange(IMediumAttachment *, BOOL, BOOL) DUMMY(E_FAIL)
HRESULT Console::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup) DUMMY(E_FAIL)
HRESULT Console::onSerialPortChange(ISerialPort *aSerialPort) DUMMY(E_FAIL)
HRESULT Console::onParallelPortChange(IParallelPort *aParallelPort) DUMMY(E_FAIL)
HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment,
ULONG aSourceIdx, ULONG aTargetIdx,
IProgress *aProgress) DUMMY(E_FAIL)
void fireStateChangedEvent(IEventSource* aSource,
MachineState_T a_state)
{
if (a_state != MachineState_PoweredOff)
return;
vm_down = true;
genode_env().parent().exit(0);
}
void fireRuntimeErrorEvent(IEventSource* aSource, BOOL a_fatal,
CBSTR a_id, CBSTR a_message)
{
Genode::error(__func__, " : ", a_fatal, " ",
Utf8Str(a_id).c_str(), " ",
Utf8Str(a_message).c_str());
TRACE();
}
void Console::onAdditionsStateChange()
{
dynamic_cast<GenodeConsole *>(this)->update_video_mode();
}
void GenodeConsole::update_video_mode()
{
Display *d = getDisplay();
Genodefb *fb = dynamic_cast<Genodefb *>(d->getFramebuffer());
if (!fb)
return;
if ((fb->w() == 0) && (fb->h() == 0)) {
/* interpret a size of 0x0 as indication to quit VirtualBox */
if (PowerButton() != S_OK)
Genode::error("ACPI shutdown failed");
return;
}
d->SetVideoModeHint(0 /*=display*/,
true /*=enabled*/, false /*=changeOrigin*/,
0 /*=originX*/, 0 /*=originY*/,
fb->w(), fb->h(),
/* Windows 8 only accepts 32-bpp modes */
32);
}
void GenodeConsole::handle_input()
{
/* disable input processing if vm is powered down */
if (vm_down && (_vbox_mouse || _vbox_keyboard)) {
_vbox_mouse = nullptr;
_vbox_keyboard = nullptr;
_input.sigh(Genode::Signal_context_capability());
}
static LONG64 mt_events [64];
unsigned mt_number = 0;
/* read out input capabilities of guest */
bool guest_abs = false, guest_rel = false, guest_multi = false;
if (_vbox_mouse) {
_vbox_mouse->COMGETTER(AbsoluteSupported)(&guest_abs);
_vbox_mouse->COMGETTER(RelativeSupported)(&guest_rel);
_vbox_mouse->COMGETTER(MultiTouchSupported)(&guest_multi);
}
_input.for_each_event([&] (Input::Event const &ev) {
/* if keyboard/mouse not available, consume input events and drop it */
if (!_vbox_keyboard || !_vbox_mouse)
return;
auto keyboard_submit = [&] (Input::Keycode key, bool release) {
Scan_code scan_code(key);
unsigned char const release_bit = release ? 0x80 : 0;
if (scan_code.normal())
_vbox_keyboard->PutScancode(scan_code.code() | release_bit);
if (scan_code.ext()) {
_vbox_keyboard->PutScancode(0xe0);
_vbox_keyboard->PutScancode(scan_code.ext() | release_bit);
}
};
/* obtain bit mask of currently pressed mouse buttons */
auto curr_mouse_button_bits = [&] () {
return (_key_status[Input::BTN_LEFT] ? MouseButtonState_LeftButton : 0)
| (_key_status[Input::BTN_RIGHT] ? MouseButtonState_RightButton : 0)
| (_key_status[Input::BTN_MIDDLE] ? MouseButtonState_MiddleButton : 0);
};
unsigned const old_mouse_button_bits = curr_mouse_button_bits();
ev.handle_press([&] (Input::Keycode key, Genode::Codepoint) {
keyboard_submit(key, false);
_key_status[key] = true;
});
ev.handle_release([&] (Input::Keycode key) {
keyboard_submit(key, true);
_key_status[key] = false;
});
unsigned const mouse_button_bits = curr_mouse_button_bits();
if (mouse_button_bits != old_mouse_button_bits) {
if (_last_received_motion_event_was_absolute) {
/* prefer absolute button event */
if (guest_abs)
_vbox_mouse->PutMouseEventAbsolute(_ax, _ay, 0, 0, mouse_button_bits);
else if (guest_rel)
_vbox_mouse->PutMouseEvent(0, 0, 0, 0, mouse_button_bits);
} else {
/* prefer relative button event */
if (guest_rel)
_vbox_mouse->PutMouseEvent(0, 0, 0, 0, mouse_button_bits);
else if (guest_abs)
_vbox_mouse->PutMouseEventAbsolute(_ax, _ay, 0, 0, mouse_button_bits);
}
}
ev.handle_absolute_motion([&] (int x, int y) {
_last_received_motion_event_was_absolute = true;
/* transform absolute to relative if guest is so odd */
if (!guest_abs && guest_rel) {
int const boundary = 20;
int rx = x - _ax;
int ry = y - _ay;
rx = Genode::min(boundary, Genode::max(-boundary, rx));
ry = Genode::min(boundary, Genode::max(-boundary, ry));
_vbox_mouse->PutMouseEvent(rx, ry, 0, 0, mouse_button_bits);
} else
_vbox_mouse->PutMouseEventAbsolute(x, y, 0, 0, mouse_button_bits);
_ax = x;
_ay = y;
});
ev.handle_relative_motion([&] (int x, int y) {
_last_received_motion_event_was_absolute = false;
/* prefer relative motion event */
if (guest_rel)
_vbox_mouse->PutMouseEvent(x, y, 0, 0, mouse_button_bits);
else if (guest_abs) {
_ax += x;
_ay += y;
_vbox_mouse->PutMouseEventAbsolute(_ax, _ay, 0, 0, mouse_button_bits);
}
});
ev.handle_wheel([&] (int x, int y) {
if (_last_received_motion_event_was_absolute)
_vbox_mouse->PutMouseEventAbsolute(_ax, _ay, -y, -x, 0);
else
_vbox_mouse->PutMouseEvent(0, 0, -y, -x, 0);
});
ev.handle_touch([&] (Input::Touch_id id, int x, int y) {
/* if multitouch queue is full - send it */
if (mt_number >= sizeof(mt_events) / sizeof(mt_events[0])) {
_vbox_mouse->PutEventMultiTouch(mt_number, mt_number,
mt_events, RTTimeMilliTS());
mt_number = 0;
}
/* Mouse::putEventMultiTouch drops values of 0 */
if (x <= 0) x = 1;
if (y <= 0) y = 1;
enum { IN_CONTACT = 0x01, IN_RANGE = 0x02 };
uint16_t const s = RT_MAKE_U16(id.value, IN_CONTACT | IN_RANGE);
mt_events[mt_number++] = RT_MAKE_U64_FROM_U16(x, y, s, 0);
});
ev.handle_touch_release([&] (Input::Touch_id id) {
uint16_t const s = RT_MAKE_U16(id.value, 0);
mt_events[mt_number++] = RT_MAKE_U64_FROM_U16(0, 0, s, 0);
});
});
/* if there are elements in multi-touch queue - send it */
if (mt_number)
_vbox_mouse->PutEventMultiTouch(mt_number, mt_number, mt_events,
RTTimeMilliTS());
}
void GenodeConsole::handle_mode_change()
{
Display *d = getDisplay();
Genodefb *fb = dynamic_cast<Genodefb *>(d->getFramebuffer());
fb->update_mode();
update_video_mode();
}
void GenodeConsole::init_clipboard()
{
if (!&*machine())
return;
ClipboardMode_T mode;
machine()->COMGETTER(ClipboardMode)(&mode);
if (mode == ClipboardMode_Bidirectional ||
mode == ClipboardMode_HostToGuest) {
_clipboard_rom = new Genode::Attached_rom_dataspace(genode_env(), "clipboard");
_clipboard_rom->sigh(_clipboard_signal_dispatcher);
clipboard_rom = _clipboard_rom;
}
if (mode == ClipboardMode_Bidirectional ||
mode == ClipboardMode_GuestToHost) {
_clipboard_reporter = new Genode::Reporter(genode_env(), "clipboard");
_clipboard_reporter->enabled(true);
clipboard_reporter = _clipboard_reporter;
}
}
void GenodeConsole::handle_cb_rom_change()
{
if (!_clipboard_rom)
return;
vboxClipboardSync(nullptr);
}
void GenodeConsole::init_backends(IKeyboard * gKeyboard, IMouse * gMouse)
{
_vbox_keyboard = gKeyboard;
_vbox_mouse = gMouse;
/* register the mode change signal dispatcher at the framebuffer */
Display *d = getDisplay();
Genodefb *fb = dynamic_cast<Genodefb *>(d->getFramebuffer());
fb->mode_sigh(_mode_change_signal_dispatcher);
handle_mode_change();
}
void GenodeConsole::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
BOOL supportsMT, BOOL needsHostCursor)
{
if (supportsAbsolute) {
/* let the guest hide the software cursor */
Mouse *gMouse = getMouse();
gMouse->PutMouseEventAbsolute(-1, -1, 0, 0, 0);
}
}
/**********************
* Clipboard handling *
**********************/
struct _VBOXCLIPBOARDCONTEXT
{
VBOXCLIPBOARDCLIENTDATA *pClient;
};
static VBOXCLIPBOARDCONTEXT context;
int vboxClipboardInit (void) { return VINF_SUCCESS; }
void vboxClipboardDestroy (void)
{
free(decoded_clipboard_content);
clipboard_rom = nullptr;
}
int vboxClipboardConnect (VBOXCLIPBOARDCLIENTDATA *pClient, bool fHeadless)
{
if (!pClient || context.pClient != NULL)
return VERR_NOT_SUPPORTED;
vboxSvcClipboardLock();
pClient->pCtx = &context;
pClient->pCtx->pClient = pClient;
vboxSvcClipboardUnlock();
int rc = vboxClipboardSync (pClient);
return rc;
}
void vboxClipboardDisconnect (VBOXCLIPBOARDCLIENTDATA *pClient)
{
if (!pClient || !pClient->pCtx)
return;
vboxSvcClipboardLock();
pClient->pCtx->pClient = NULL;
vboxSvcClipboardUnlock();
}
void vboxClipboardFormatAnnounce (VBOXCLIPBOARDCLIENTDATA *pClient,
uint32_t formats)
{
if (!pClient)
return;
vboxSvcClipboardReportMsg (pClient,
VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA,
formats);
}
int vboxClipboardReadData (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t format,
void *pv, uint32_t const cb, uint32_t *pcbActual)
{
if (!clipboard_rom || format != VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT)
return VERR_NOT_SUPPORTED;
if (!pv || !pcbActual || cb == 0)
return VERR_INVALID_PARAMETER;
clipboard_rom->update();
if (!clipboard_rom->valid()) {
Genode::error("invalid clipboard dataspace");
return VERR_NOT_SUPPORTED;
}
char * data = clipboard_rom->local_addr<char>();
try {
Genode::Xml_node node(data);
if (!node.has_type("clipboard")) {
Genode::error("invalid clipboard xml syntax");
return VERR_INVALID_PARAMETER;
}
free(decoded_clipboard_content);
decoded_clipboard_content = (char*)malloc(node.content_size());
if (!decoded_clipboard_content) {
Genode::error("could not allocate buffer for decoded clipboard content");
return 0;
}
size_t const len = node.decoded_content(decoded_clipboard_content,
node.content_size());
size_t written = 0;
PRTUTF16 utf16_string = reinterpret_cast<PRTUTF16>(pv);
int rc = RTStrToUtf16Ex(decoded_clipboard_content, len, &utf16_string, cb, &written);
if (RT_SUCCESS(rc)) {
if ((written * 2) + 2 > cb)
written = (cb - 2) / 2;
/* +1 stuff required for Windows guests ... linux guest doesn't care */
*pcbActual = (written + 1) * 2;
utf16_string[written] = 0;
} else
*pcbActual = 0;
} catch (Genode::Xml_node::Invalid_syntax) {
Genode::error("invalid clipboard xml syntax");
return VERR_INVALID_PARAMETER;
}
return VINF_SUCCESS;
}
void vboxClipboardWriteData (VBOXCLIPBOARDCLIENTDATA *pClient, void *pv,
uint32_t cb, uint32_t format)
{
if (format != VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT || !pv || !pClient ||
!clipboard_reporter)
return;
PCRTUTF16 utf16str = reinterpret_cast<PCRTUTF16>(pv);
char * message = 0;
int rc = RTUtf16ToUtf8(utf16str, &message);
if (!RT_SUCCESS(rc) || !message)
return;
try {
Genode::Reporter::Xml_generator xml(*clipboard_reporter, [&] () {
xml.append_sanitized(message, strlen(message)); });
} catch (...) {
Genode::error("could not write clipboard data");
}
RTStrFree(message);
}
int vboxClipboardSync (VBOXCLIPBOARDCLIENTDATA *pClient)
{
if (!pClient)
pClient = context.pClient;
if (!pClient)
return VERR_NOT_SUPPORTED;
vboxSvcClipboardReportMsg (pClient, VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS,
VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT);
return VINF_SUCCESS;
}
/**
* Sticky key handling
*/
static bool host_caps_lock = false;
static bool guest_caps_lock = false;
void Console::onKeyboardLedsChange(bool num_lock, bool caps_lock, bool scroll_lock)
{
guest_caps_lock = caps_lock;
}
void GenodeConsole::handle_sticky_keys()
{
/* no keyboard - no sticky key handling */
if (!_vbox_keyboard || !_caps_lock.constructed())
return;
_caps_lock->update();
if (!_caps_lock->valid())
return;
bool const caps_lock = _caps_lock->xml().attribute_value("enabled",
guest_caps_lock);
bool trigger_caps_lock = false;
/*
* If guest didn't respond with led change last time, we have to
* trigger caps_lock change - mainly assuming that guest don't use the
* led to externalize its internal caps_lock state.
*/
if (caps_lock != host_caps_lock && host_caps_lock != guest_caps_lock)
trigger_caps_lock = true;
if (caps_lock != guest_caps_lock)
trigger_caps_lock = true;
if (trigger_caps_lock) {
_vbox_keyboard->PutScancode(Input::KEY_CAPSLOCK);
_vbox_keyboard->PutScancode(Input::KEY_CAPSLOCK | 0x80);
}
}

View File

@ -1,247 +0,0 @@
/*
* \brief Console implementation of VirtualBox for Genode
* \author Alexander Boettcher
* \author Norman Feske
* \date 2013-10-16
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <base/log.h>
#include <input/event.h>
#include <input/keycodes.h>
#include <input_session/connection.h>
#include <base/attached_dataspace.h>
#include <base/attached_rom_dataspace.h>
#include <os/reporter.h>
#include <report_session/connection.h>
#include <timer_session/connection.h>
/* included from os/src/drivers/input/spec/ps2 */
#include <scan_code_set_1.h>
/* repos/ports includes */
#include <pointer/shape_report.h>
#include "../vmm.h"
/* VirtualBox includes */
#include "ConsoleImpl.h"
class Scan_code
{
private:
class Converter
{
public:
unsigned char scan_code [Input::KEY_UNKNOWN];
unsigned char scan_code_ext [Input::KEY_UNKNOWN];
private:
unsigned char _search_scan_code(Input::Keycode keycode)
{
for (unsigned i = 0; i < SCAN_CODE_SET_1_NUM_KEYS; i++)
if (scan_code_set_1[i] == keycode)
return i;
return 0;
}
unsigned char _search_scan_code_ext(Input::Keycode keycode)
{
for (unsigned i = 0; i < SCAN_CODE_SET_1_NUM_KEYS; i++)
if (scan_code_set_1_0xe0[i] == keycode)
return i;
return 0;
}
public:
Converter()
{
init_scan_code_set_1_0xe0();
for (unsigned i = 0; i < Input::KEY_UNKNOWN; i++) {
scan_code [i] = _search_scan_code ((Input::Keycode)i);
scan_code_ext [i] = _search_scan_code_ext((Input::Keycode)i);
}
}
};
static Converter &converter()
{
static Converter inst;
return inst;
}
Input::Keycode _keycode;
public:
Scan_code(Input::Keycode keycode) : _keycode(keycode) { }
bool normal() const { return converter().scan_code[_keycode]; }
bool valid() const
{
return normal() || ext();
}
unsigned char code() const
{
return converter().scan_code[_keycode];
}
unsigned char ext() const
{
return converter().scan_code_ext[_keycode];
}
};
class GenodeConsole : public Console {
private:
Input::Connection _input;
unsigned _ax, _ay;
bool _last_received_motion_event_was_absolute;
Report::Connection _shape_report_connection;
Genode::Attached_dataspace _shape_report_ds;
Genode::Constructible<Genode::Attached_rom_dataspace> _caps_lock;
Pointer::Shape_report *_shape_report;
Genode::Reporter *_clipboard_reporter;
Genode::Attached_rom_dataspace *_clipboard_rom;
IKeyboard *_vbox_keyboard;
IMouse *_vbox_mouse;
Genode::Signal_handler<GenodeConsole> _input_signal_dispatcher;
Genode::Signal_handler<GenodeConsole> _mode_change_signal_dispatcher;
Genode::Signal_handler<GenodeConsole> _clipboard_signal_dispatcher;
Genode::Signal_handler<GenodeConsole> _input_sticky_keys_dispatcher;
bool _key_status[Input::KEY_MAX + 1];
static bool _mouse_button(Input::Keycode keycode)
{
return keycode == Input::BTN_LEFT
|| keycode == Input::BTN_RIGHT
|| keycode == Input::BTN_MIDDLE;
}
public:
GenodeConsole()
:
Console(),
_input(genode_env()),
_ax(0), _ay(0),
_last_received_motion_event_was_absolute(false),
_shape_report_connection(genode_env(), "shape",
sizeof(Pointer::Shape_report)),
_shape_report_ds(genode_env().rm(), _shape_report_connection.dataspace()),
_shape_report(_shape_report_ds.local_addr<Pointer::Shape_report>()),
_clipboard_reporter(nullptr),
_clipboard_rom(nullptr),
_vbox_keyboard(0),
_vbox_mouse(0),
_input_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_input),
_mode_change_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_mode_change),
_clipboard_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_cb_rom_change),
_input_sticky_keys_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_sticky_keys)
{
for (unsigned i = 0; i <= Input::KEY_MAX; i++)
_key_status[i] = 0;
_input.sigh(_input_signal_dispatcher);
Genode::Attached_rom_dataspace config(genode_env(), "config");
/* by default we take the capslock key from the input stream */
Genode::String<10> capslock("input");
if (config.xml().attribute_value("capslock", capslock) == "ROM") {
_caps_lock.construct(genode_env(), "capslock");
_caps_lock->sigh(_input_sticky_keys_dispatcher);
}
}
void init_clipboard();
void init_backends(IKeyboard * gKeyboard, IMouse * gMouse);
void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
BOOL supportsMT, BOOL needsHostCursor);
void onMousePointerShapeChange(bool fVisible, bool fAlpha,
uint32_t xHot, uint32_t yHot,
uint32_t width, uint32_t height,
ComSafeArrayIn(BYTE,pShape))
{
com::SafeArray<BYTE> shape_array(ComSafeArrayInArg(pShape));
if (fVisible && ((width == 0) || (height == 0)))
return;
_shape_report->visible = fVisible;
_shape_report->x_hot = xHot;
_shape_report->y_hot = yHot;
_shape_report->width = width;
_shape_report->height = height;
unsigned int and_mask_size = (_shape_report->width + 7) / 8 *
_shape_report->height;
unsigned char *and_mask = shape_array.raw();
unsigned char *shape = and_mask + ((and_mask_size + 3) & ~3);
size_t shape_size = shape_array.size() - (shape - and_mask);
if (shape_size > Pointer::MAX_SHAPE_SIZE) {
Genode::error(__func__, ": shape data buffer is too small "
"for ", shape_size, " bytes");
return;
}
Genode::memcpy(_shape_report->shape,
shape,
shape_size);
if (fVisible && !fAlpha) {
for (unsigned int i = 0; i < width * height; i++) {
unsigned int *color =
&((unsigned int*)_shape_report->shape)[i];
/* heuristic from VBoxSDL.cpp */
if (and_mask[i / 8] & (1 << (7 - (i % 8)))) {
if (*color & 0x00ffffff)
*color = 0xff000000;
else
*color = 0x00000000;
} else
*color |= 0xff000000;
}
}
_shape_report_connection.submit(sizeof(Pointer::Shape_report));
}
void update_video_mode();
void handle_input();
void handle_mode_change();
void handle_cb_rom_change();
void handle_sticky_keys();
};

View File

@ -1,17 +0,0 @@
#include "VirtualBoxBase.h"
#include "dummy/macros.h"
#include "AutostartDb.h"
static bool debug = false;
int AutostartDb::addAutostartVM(const char *pszVMId) DUMMY(-1)
int AutostartDb::addAutostopVM(char const*) DUMMY(-1)
int AutostartDb::removeAutostopVM(char const*) DUMMY(-1)
int AutostartDb::removeAutostartVM(char const*) DUMMY(-1)
AutostartDb::AutostartDb() TRACE()
AutostartDb::~AutostartDb() DUMMY()
int AutostartDb::setAutostartDbPath(char const*path) TRACE(VINF_SUCCESS)

View File

@ -1,14 +0,0 @@
#include "VirtualBoxBase.h"
#include "dummy/macros.h"
#include <VBox/com/ErrorInfo.h>
static bool debug = false;
void ErrorInfo::init(bool aKeepObj) TRACE()
void ErrorInfo::cleanup() TRACE()
HRESULT ErrorInfoKeeper::restore() TRACE(S_OK)
void ErrorInfo::copyFrom(const ErrorInfo &x) DUMMY()

View File

@ -1,128 +0,0 @@
#include "VirtualBoxBase.h"
#include <VBox/usbfilter.h>
#include "dummy/macros.h"
#include "HostImpl.h"
static bool debug = false;
STDMETHODIMP Host::COMGETTER(DVDDrives)(ComSafeArrayOut(IMedium *, drives)) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(FloppyDrives)(ComSafeArrayOut(IMedium *, drives)) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(USBDevices)(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices)) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(USBDeviceFilters)(ComSafeArrayOut(IHostUSBDeviceFilter *, aUSBDeviceFilters)) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(NetworkInterfaces)(ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces)) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(NameServers)(ComSafeArrayOut(BSTR, aNameServers)) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(DomainName)(BSTR *aDomainName) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(SearchStrings)(ComSafeArrayOut(BSTR, aSearchStrings)) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(ProcessorCount)(ULONG *count) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(ProcessorOnlineCount)(ULONG *count) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(ProcessorCoreCount)(ULONG *count) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(ProcessorOnlineCoreCount)(ULONG *count) DUMMY(E_FAIL)
STDMETHODIMP Host::GetProcessorSpeed(ULONG cpuId, ULONG *speed) DUMMY(E_FAIL)
STDMETHODIMP Host::GetProcessorDescription(ULONG cpuId, BSTR *description) DUMMY(E_FAIL)
STDMETHODIMP Host::GetProcessorCPUIDLeaf(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(MemorySize)(ULONG *size) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(MemoryAvailable)(ULONG *available) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(OperatingSystem)(BSTR *os) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(OSVersion)(BSTR *version) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(UTCTime)(LONG64 *aUTCTime) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(Acceleration3DAvailable)(BOOL *aSupported) DUMMY(E_FAIL)
STDMETHODIMP Host::COMGETTER(VideoInputDevices)(ComSafeArrayOut(IHostVideoInputDevice*, aVideoInputDevices)) DUMMY(E_FAIL)
// IHost methods
STDMETHODIMP Host::CreateHostOnlyNetworkInterface(IHostNetworkInterface **aHostNetworkInterface,
IProgress **aProgress) DUMMY(E_FAIL)
STDMETHODIMP Host::RemoveHostOnlyNetworkInterface(IN_BSTR aId, IProgress **aProgress) DUMMY(E_FAIL)
STDMETHODIMP Host::CreateUSBDeviceFilter(IN_BSTR aName, IHostUSBDeviceFilter **aFilter) DUMMY(E_FAIL)
STDMETHODIMP Host::InsertUSBDeviceFilter(ULONG aPosition, IHostUSBDeviceFilter *aFilter) DUMMY(E_FAIL)
STDMETHODIMP Host::RemoveUSBDeviceFilter(ULONG aPosition) DUMMY(E_FAIL)
STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IMedium **aDrive) DUMMY(E_FAIL)
STDMETHODIMP Host::FindHostFloppyDrive(IN_BSTR aName, IMedium **aDrive) DUMMY(E_FAIL)
STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR aName, IHostNetworkInterface **networkInterface) DUMMY(E_FAIL)
STDMETHODIMP Host::FindHostNetworkInterfaceById(IN_BSTR id, IHostNetworkInterface **networkInterface) DUMMY(E_FAIL)
STDMETHODIMP Host::FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_T type, ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces)) DUMMY(E_FAIL)
STDMETHODIMP Host::FindUSBDeviceByAddress(IN_BSTR aAddress, IHostUSBDevice **aDevice) DUMMY(E_FAIL)
STDMETHODIMP Host::FindUSBDeviceById(IN_BSTR aId, IHostUSBDevice **aDevice) DUMMY(E_FAIL)
STDMETHODIMP Host::GenerateMACAddress(BSTR *aAddress) DUMMY(E_FAIL)
HRESULT Host::findHostDriveByName(DeviceType_T mediumType,
const Utf8Str &strLocationFull,
bool fRefresh,
ComObjPtr<Medium> &pMedium) DUMMY(E_FAIL)
HRESULT Host::findHostDriveById(DeviceType_T, com::Guid const&, bool,
ComObjPtr<Medium>&) TRACE(VBOX_E_OBJECT_NOT_FOUND)
HRESULT Host::saveSettings(settings::Host&) TRACE(S_OK)
HRESULT Host::init(VirtualBox *aParent) TRACE(S_OK)
HRESULT Host::loadSettings(const settings::Host &) TRACE(S_OK)
HRESULT Host::FinalConstruct() TRACE(S_OK)
void Host::FinalRelease() DUMMY()
void Host::uninit() DUMMY()
void Host::generateMACAddress(Utf8Str &mac)
{
static unsigned counter = 1;
mac = Utf8StrFmt("080027%06X", counter++);
TRACE();
}
HRESULT Host::GetProcessorFeature(ProcessorFeature_T feature, BOOL *supported)
{
CheckComArgOutPointerValid(supported);
switch (feature)
{
case ProcessorFeature_HWVirtEx:
*supported = true;
break;
case ProcessorFeature_PAE:
*supported = true;
break;
case ProcessorFeature_LongMode:
*supported = (sizeof(void *) > 4);
break;
case ProcessorFeature_NestedPaging:
*supported = true;
break;
default:
return setError(E_INVALIDARG, tr("The feature value is out of range."));
}
return S_OK;
}
HRESULT Host::getDrives(DeviceType_T, bool, MediaList*&, util::AutoWriteLock&) DUMMY(E_FAIL)
HRESULT Host::findHostDriveByNameOrId(DeviceType_T, const com::Utf8Str&,
ComObjPtr<Medium>&) DUMMY(E_FAIL)
HRESULT Host::buildDVDDrivesList(MediaList &list) DUMMY(E_FAIL)
HRESULT Host::buildFloppyDrivesList(MediaList &list) DUMMY(E_FAIL)
#ifdef VBOX_WITH_USB
USBProxyService* Host::usbProxyService()
{
TRACE(nullptr)
}
HRESULT Host::addChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL)
HRESULT Host::removeChild(HostUSBDeviceFilter *pChild) DUMMY(E_FAIL)
VirtualBox* Host::parent() DUMMY(nullptr)
HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *, BOOL) DUMMY(E_FAIL)
void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters) DUMMY()
HRESULT Host::checkUSBProxyService() TRACE(S_OK)
#include "HostUSBDeviceImpl.h"
#include "USBDeviceFilterImpl.h"
bool HostUSBDevice::isMatch(const USBDeviceFilter::Data &aData) DUMMY(false)
#endif

View File

@ -1,37 +0,0 @@
#ifndef ____H_MACROS
#define ____H_MACROS
#include <base/log.h>
#define TRACE(X) \
{ \
if (debug) \
Genode::log(__func__, " called (", __FILE__, ") - eip=", \
__builtin_return_address(0)); \
return X; \
}
#define DUMMY(X) \
{ \
Genode::error(__func__, " called (", __FILE__, ":", __LINE__, "), " \
"not implemented, eip=", \
__builtin_return_address(0)); \
while (1) \
asm volatile ("ud2a"); \
\
return X; \
}
#define DUMMY_STATIC(X) \
{ \
static X dummy; \
Genode::error(__func__, " called (", __FILE__, "), " \
"not implemented, eip=", \
__builtin_return_address(0)); \
while (1) \
asm volatile ("ud2a"); \
\
return dummy; \
}
#endif /* ____H_MACROS */

View File

@ -1,252 +0,0 @@
#include "dummy/macros.h"
static bool debug = false;
/* ApplianceImplExport.cpp */
#include "MachineImpl.h"
HRESULT Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location,
IVirtualSystemDescription **aDescription) DUMMY(E_FAIL)
/* com.cpp */
#include "VBox/com/Guid.h"
const com::Guid com::Guid::Empty;
/* DisplayImpl.cpp */
#include "DisplayImpl.h"
void fireGuestMonitorChangedEvent(IEventSource* aSource,
GuestMonitorChangedEventType_T a_changeType,
ULONG a_screenId,
ULONG a_originX,
ULONG a_originY,
ULONG a_width,
ULONG a_height) TRACE()
/* DisplayPNGUtil.cpp */
#include "DisplayImpl.h"
int DisplayMakePNG(uint8_t *, uint32_t, uint32_t, uint8_t **, uint32_t *,
uint32_t *, uint32_t *, uint8_t) DUMMY(-1)
/* ErrorInfo.cpp */
#include "VBox/com/ErrorInfo.h"
com::ProgressErrorInfo::ProgressErrorInfo(IProgress*) DUMMY()
/* EventImpl.cpp */
#include "EventImpl.h"
HRESULT VBoxEventDesc::init(IEventSource* aSource, VBoxEventType_T aType, ...) TRACE(S_OK)
HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...) TRACE(S_OK)
/* GuestCtrlImpl.cpp */
#include "GuestImpl.h"
STDMETHODIMP Guest::CreateSession(IN_BSTR, IN_BSTR, IN_BSTR, IN_BSTR,
IGuestSession **) DUMMY(E_FAIL)
STDMETHODIMP Guest::FindSession(IN_BSTR,
ComSafeArrayOut(IGuestSession *, aSessions)) DUMMY(E_FAIL)
STDMETHODIMP Guest::UpdateGuestAdditions(IN_BSTR,
ComSafeArrayIn(IN_BSTR, aArguments),
ComSafeArrayIn(AdditionsUpdateFlag_T, aFlags),
IProgress **aProgress) DUMMY(E_FAIL)
/* initterm.cpp */
#include "VBox/com/com.h"
HRESULT com::Initialize(bool fGui) TRACE(S_OK)
HRESULT com::Shutdown() DUMMY(E_FAIL)
/* MachineImpl.cpp */
#include "MachineImpl.h"
void fireHostPCIDevicePlugEvent(IEventSource* aSource,
CBSTR a_machineId,
BOOL a_plugged,
BOOL a_success,
IPCIDeviceAttachment* a_attachment,
CBSTR a_message) TRACE()
/* NATNetworkImpl.cpp */
#include "NetworkServiceRunner.h"
#include "NATNetworkImpl.h"
NATNetwork::NATNetwork() : mVirtualBox(nullptr) DUMMY()
NATNetwork::~NATNetwork() DUMMY()
STDMETHODIMP NATNetwork::COMGETTER(EventSource)(IEventSource **IEventSource) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(Enabled)(BOOL *aEnabled) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMSETTER(Enabled)(BOOL aEnabled) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(NetworkName)(BSTR *aName) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMSETTER(NetworkName)(IN_BSTR aName) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(Gateway)(BSTR *aIPGateway) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(Network)(BSTR *aIPNetwork) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMSETTER(Network)(IN_BSTR aIPNetwork) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(IPv6Enabled)(BOOL *aEnabled) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMSETTER(IPv6Enabled)(BOOL aEnabled) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(IPv6Prefix)(BSTR *aName) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMSETTER(IPv6Prefix)(IN_BSTR aName) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(AdvertiseDefaultIPv6RouteEnabled)(BOOL *aEnabled) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMSETTER(AdvertiseDefaultIPv6RouteEnabled)(BOOL aEnabled) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(NeedDhcpServer)(BOOL *aEnabled) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMSETTER(NeedDhcpServer)(BOOL aEnabled) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(LocalMappings)(ComSafeArrayOut(BSTR, aLocalMappings)) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::AddLocalMapping(IN_BSTR aHostId, LONG aOffset) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(LoopbackIp6)(LONG *aLoopbackIp6) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMSETTER(LoopbackIp6)(LONG aLoopbackIp6) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(PortForwardRules4)(ComSafeArrayOut(BSTR, aPortForwardRules4)) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::COMGETTER(PortForwardRules6)(ComSafeArrayOut(BSTR, aPortForwardRules6)) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::AddPortForwardRule(BOOL aIsIpv6,
IN_BSTR aPortForwardRuleName,
NATProtocol_T aProto,
IN_BSTR aHostIp,
USHORT aHostPort,
IN_BSTR aGuestIp,
USHORT aGuestPort) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::RemovePortForwardRule(BOOL aIsIpv6, IN_BSTR aPortForwardRuleName) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::Start(IN_BSTR aTrunkType) DUMMY(E_FAIL)
STDMETHODIMP NATNetwork::Stop() DUMMY(E_FAIL)
HRESULT NATNetwork::init(VirtualBox *aVirtualBox, const settings::NATNetwork &) DUMMY(E_FAIL)
HRESULT NATNetwork::FinalConstruct() DUMMY(E_FAIL)
void NATNetwork::uninit() DUMMY()
/* ProgressProxyImpl.cpp */
#include "ProgressProxyImpl.h"
STDMETHODIMP ProgressProxy::Cancel() DUMMY(E_FAIL)
void ProgressProxy::clearOtherProgressObjectInternal(bool fEarly) DUMMY()
STDMETHODIMP ProgressProxy::COMGETTER(Cancelable)(BOOL *) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(Percent)(ULONG *) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(TimeRemaining)(LONG *) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(Completed)(BOOL *) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(Canceled)(BOOL *) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(ResultCode)(LONG *) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(ErrorInfo)(IVirtualBoxErrorInfo **) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(Operation)(ULONG *) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(OperationDescription)(BSTR *) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(OperationPercent)(ULONG *) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMSETTER(Timeout)(ULONG) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::COMGETTER(Timeout)(ULONG *) DUMMY(E_FAIL)
void ProgressProxy::copyProgressInfo(IProgress *pOtherProgress, bool fEarly) DUMMY()
HRESULT ProgressProxy::FinalConstruct() DUMMY(E_FAIL)
void ProgressProxy::FinalRelease() DUMMY()
HRESULT ProgressProxy::init(VirtualBox*, IUnknown*, unsigned short const*,
bool) DUMMY(E_FAIL)
HRESULT ProgressProxy::init(VirtualBox*, void*, unsigned short const*, bool,
unsigned int, unsigned short const*, unsigned int,
unsigned int) DUMMY(E_FAIL)
HRESULT ProgressProxy::notifyComplete(HRESULT) DUMMY(E_FAIL)
HRESULT ProgressProxy::notifyComplete(HRESULT, GUID const&, char const*,
char const*, ...) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::SetCurrentOperationProgress(ULONG aPercent) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::SetNextOperation(IN_BSTR, ULONG) DUMMY(E_FAIL)
bool ProgressProxy::setOtherProgressObject(IProgress*) DUMMY(false)
void ProgressProxy::uninit() DUMMY()
STDMETHODIMP ProgressProxy::WaitForCompletion(LONG aTimeout) DUMMY(E_FAIL)
STDMETHODIMP ProgressProxy::WaitForOperationCompletion(ULONG, LONG) DUMMY(E_FAIL)
/* SharedFolderImpl.cpp */
#include "SharedFolderImpl.h"
HRESULT SharedFolder::init(Console*, com::Utf8Str const&, com::Utf8Str const&,
bool, bool, bool) DUMMY(E_FAIL)
/* USBFilter.cpp */
#include "VBox/usbfilter.h"
USBFILTERMATCH USBFilterGetMatchingMethod(PCUSBFILTER, USBFILTERIDX) DUMMY(USBFILTERMATCH_INVALID)
int USBFilterGetNum(PCUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(-1)
const char * USBFilterGetString(PCUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(nullptr)
void USBFilterInit(PUSBFILTER pFilter, USBFILTERTYPE enmType) DUMMY()
bool USBFilterIsMethodNumeric(USBFILTERMATCH enmMatchingMethod) DUMMY(false)
bool USBFilterIsMethodString(USBFILTERMATCH enmMatchingMethod) DUMMY(false)
bool USBFilterIsNumericField(USBFILTERIDX enmFieldIdx) DUMMY(false)
bool USBFilterIsStringField(USBFILTERIDX enmFieldIdx) DUMMY(false)
bool USBFilterMatch(PCUSBFILTER pFilter, PCUSBFILTER pDevice) DUMMY(false)
int USBFilterSetIgnore(PUSBFILTER pFilter, USBFILTERIDX enmFieldIdx) DUMMY(-1)
int USBFilterSetNumExact(PUSBFILTER, USBFILTERIDX, uint16_t, bool) DUMMY(-1)
int USBFilterSetNumExpression(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1)
int USBFilterSetStringExact(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1)
int USBFilterSetStringPattern(PUSBFILTER, USBFILTERIDX, const char *, bool) DUMMY(-1)
/* USBProxyService.cpp */
#include "USBProxyService.h"
HRESULT USBProxyService::autoCaptureDevicesForVM(SessionMachine *) DUMMY(E_FAIL)
HRESULT USBProxyService::captureDeviceForVM(SessionMachine *, IN_GUID) DUMMY(E_FAIL)
HRESULT USBProxyService::detachAllDevicesFromVM(SessionMachine*, bool, bool) DUMMY(E_FAIL)
HRESULT USBProxyService::detachDeviceFromVM(SessionMachine*, IN_GUID, bool) DUMMY(E_FAIL)
/* VirtualBoxImpl.cpp */
#include "VirtualBoxImpl.h"
void fireNATRedirectEvent(IEventSource* aSource,
CBSTR a_machineId,
ULONG a_slot,
BOOL a_remove,
CBSTR a_name,
NATProtocol_T a_proto,
CBSTR a_hostIP,
LONG a_hostPort,
CBSTR a_guestIP,
LONG a_guestPort) TRACE()
void fireNATNetworkChangedEvent(IEventSource* aSource,
CBSTR a_networkName) TRACE()
void fireNATNetworkStartStopEvent(IEventSource* aSource,
CBSTR a_networkName,
BOOL a_startEvent) TRACE()
void fireNATNetworkSettingEvent(IEventSource* aSource,
CBSTR a_networkName,
BOOL a_enabled,
CBSTR a_network,
CBSTR a_gateway,
BOOL a_advertiseDefaultIPv6RouteEnabled,
BOOL a_needDhcpServer) TRACE()
void fireNATNetworkPortForwardEvent(IEventSource* aSource,
CBSTR a_networkName,
BOOL a_create,
BOOL a_ipv6,
CBSTR a_name,
NATProtocol_T a_proto,
CBSTR a_hostIp,
LONG a_hostPort,
CBSTR a_guestIp,
LONG a_guestPort) TRACE()
void fireHostNameResolutionConfigurationChangeEvent(IEventSource* aSource) TRACE()
void fireMediumChangedEvent(IEventSource *, IMediumAttachment *) DUMMY()

View File

@ -1,32 +0,0 @@
#include <base/log.h>
#include "VirtualBoxImpl.h"
#include "VBox/com/MultiResult.h"
#include "dummy/macros.h"
static bool debug = false;
HRESULT VirtualBoxBase::setError(HRESULT aResultCode, const char *pcsz, ...)
{
va_list list;
va_start(list, pcsz);
Genode::error(this->getComponentName(), " : ", Utf8Str(pcsz, list).c_str());
va_end(list);
TRACE(aResultCode);
}
HRESULT VirtualBox::CreateAppliance(IAppliance**) DUMMY(E_FAIL)
void VirtualBoxBase::clearError() TRACE()
HRESULT VirtualBoxBase::setError(HRESULT aResultCode) DUMMY(E_FAIL)
HRESULT VirtualBoxBase::setError(const com::ErrorInfo &ei) DUMMY(E_FAIL)
HRESULT VirtualBoxBase::handleUnexpectedExceptions(VirtualBoxBase *const,
RT_SRC_POS_DECL) TRACE(E_FAIL)
HRESULT VirtualBoxBase::setErrorInternal(HRESULT, GUID const&, char const*,
com::Utf8Str, bool, bool) DUMMY(E_FAIL)
HRESULT VirtualBoxBase::initializeComForThread(void) TRACE(S_OK)
void VirtualBoxBase::uninitializeComForThread(void) TRACE()

View File

@ -1,259 +0,0 @@
/*
* \brief Virtualbox framebuffer implementation for Genode
* \author Alexander Boettcher
* \date 2013-10-16
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#define Framebuffer Fb_Genode
#include <framebuffer_session/connection.h>
#undef Framebuffer
/* VirtualBox includes */
#include "Global.h"
#include "VirtualBoxBase.h"
class Genodefb :
VBOX_SCRIPTABLE_IMPL(IFramebuffer)
{
private:
Genode::Env &_env;
Fb_Genode::Connection _fb;
/* The mode matching the currently attached dataspace */
Fb_Genode::Mode _fb_mode;
/* The mode at the time when the mode change signal was received */
Fb_Genode::Mode _next_fb_mode;
/*
* The mode currently used by the VM. Can be smaller than the
* framebuffer mode.
*/
Fb_Genode::Mode _virtual_fb_mode;
void *_fb_base;
RTCRITSECT _fb_lock;
void _clear_screen()
{
size_t const num_pixels = _fb_mode.width() * _virtual_fb_mode.height();
memset(_fb_base, 0, num_pixels * _fb_mode.bytes_per_pixel());
_fb.refresh(0, 0, _virtual_fb_mode.width(), _virtual_fb_mode.height());
}
public:
Genodefb (Genode::Env &env)
:
_env(env),
_fb(env, Fb_Genode::Mode(0, 0, Fb_Genode::Mode::INVALID)),
_fb_mode(_fb.mode()),
_next_fb_mode(_fb_mode),
_virtual_fb_mode(_fb_mode),
_fb_base(env.rm().attach(_fb.dataspace()))
{
int rc = RTCritSectInit(&_fb_lock);
Assert(rc == VINF_SUCCESS);
}
/* Return the next mode of the framebuffer */
int w() const { return _next_fb_mode.width(); }
int h() const { return _next_fb_mode.height(); }
void mode_sigh(Genode::Signal_context_capability sigh)
{
_fb.mode_sigh(sigh);
}
void update_mode()
{
Lock();
_next_fb_mode = _fb.mode();
Unlock();
}
STDMETHODIMP COMGETTER(Width)(ULONG *width)
{
if (!width)
return E_INVALIDARG;
*width = _virtual_fb_mode.width();
return S_OK;
}
STDMETHODIMP COMGETTER(Height)(ULONG *height)
{
if (!height)
return E_INVALIDARG;
*height = _virtual_fb_mode.height();
return S_OK;
}
STDMETHODIMP Lock()
{
return Global::vboxStatusCodeToCOM(RTCritSectEnter(&_fb_lock));
}
STDMETHODIMP Unlock()
{
return Global::vboxStatusCodeToCOM(RTCritSectLeave(&_fb_lock));
}
STDMETHODIMP COMGETTER(Address)(BYTE **addr)
{
*addr = reinterpret_cast<BYTE*>(_fb_base);
return S_OK;
}
STDMETHODIMP COMGETTER(BitsPerPixel)(ULONG *bits)
{
if (!bits)
return E_INVALIDARG;
*bits = _virtual_fb_mode.bytes_per_pixel() * 8;
return S_OK;
}
STDMETHODIMP COMGETTER(BytesPerLine)(ULONG *line)
{
*line = _fb_mode.width() * _fb_mode.bytes_per_pixel();
return S_OK;
}
HRESULT NotifyUpdate(ULONG x, ULONG y, ULONG w, ULONG h)
{
_fb.refresh(x, y, w, h);
return S_OK;
}
STDMETHODIMP RequestResize(ULONG aScreenId, ULONG pixelFormat,
BYTE *vram, ULONG bitsPerPixel,
ULONG bytesPerLine, ULONG w, ULONG h,
BOOL *finished)
{
HRESULT result = E_FAIL;
Lock();
bool ok = (w <= (ULONG)_next_fb_mode.width()) &&
(h <= (ULONG)_next_fb_mode.height());
if (ok) {
Genode::log("fb resize : ", _virtual_fb_mode.width(),
"x", _virtual_fb_mode.height(), "@",
_virtual_fb_mode.bytes_per_pixel() * 8, " -> ",
w, "x", h, "@", bitsPerPixel);
if ((w < (ULONG)_next_fb_mode.width()) ||
(h < (ULONG)_next_fb_mode.height())) {
/* clear the old content around the new, smaller area. */
_clear_screen();
}
_fb_mode = _next_fb_mode;
_virtual_fb_mode = Fb_Genode::Mode(w, h, Fb_Genode::Mode::RGB565);
_env.rm().detach(_fb_base);
_fb_base = _env.rm().attach(_fb.dataspace());
result = S_OK;
} else
Genode::warning("fb resize : ", _virtual_fb_mode.width(),
"x", _virtual_fb_mode.height(), "@",
_virtual_fb_mode.bytes_per_pixel() * 8, " -> ",
w, "x", h, "@", bitsPerPixel, " ignored");
*finished = true;
Unlock();
return result;
}
STDMETHODIMP COMGETTER(PixelFormat) (ULONG *format)
{
if (!format)
return E_POINTER;
*format = FramebufferPixelFormat_Opaque;
return S_OK;
}
STDMETHODIMP COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM)
{
if (!usesGuestVRAM)
return E_POINTER;
*usesGuestVRAM = FALSE;
return S_OK;
}
STDMETHODIMP COMGETTER(HeightReduction) (ULONG *reduce)
{
*reduce = 0;
return S_OK;
}
STDMETHODIMP COMGETTER(Overlay) (IFramebufferOverlay **aOverlay)
{
Assert(!"FixMe");
return S_OK;
}
STDMETHODIMP COMGETTER(WinId) (PRInt64 *winId)
{
Assert(!"FixMe");
return S_OK;
}
STDMETHODIMP VideoModeSupported(ULONG width, ULONG height, ULONG bpp, BOOL *supported)
{
if (!supported)
return E_POINTER;
*supported = ((width <= (ULONG)_next_fb_mode.width()) &&
(height <= (ULONG)_next_fb_mode.height()));
return S_OK;
}
STDMETHODIMP GetVisibleRegion(BYTE *aRectangles, ULONG aCount,
ULONG *aCountCopied)
{
Assert(!"FixMe");
return S_OK;
}
STDMETHODIMP SetVisibleRegion(BYTE *aRectangles, ULONG aCount)
{
Assert(!"FixMe");
return S_OK;
}
STDMETHODIMP ProcessVHWACommand(BYTE *pCommand)
{
return E_NOTIMPL;
}
STDMETHODIMP Notify3DEvent(PRUint32, PRUint8*)
{
return E_NOTIMPL;
}
};

View File

@ -1,253 +0,0 @@
/*
* \brief Port of VirtualBox to Genode
* \author Norman Feske
* \author Alexander Boettcher
* \date 2013-08-20
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <base/attached_rom_dataspace.h>
#include <base/heap.h>
#include <base/log.h>
#include <libc/component.h>
/* Virtualbox includes */
#include <iprt/initterm.h>
#include <iprt/assert.h>
#include <iprt/err.h>
#include <VBox/com/com.h>
#include <VBox/vmm/vmapi.h>
/* Virtualbox includes of generic Main frontend */
#include "ConsoleImpl.h"
#include "MachineImpl.h"
#include "MouseImpl.h"
#include "SessionImpl.h"
#include "VirtualBoxImpl.h"
/* Genode port specific includes */
#include "console.h"
#include "fb.h"
#include "../sup.h"
static char c_vbox_file[128];
static char c_vbox_vmname[128];
extern "C" void init_libc_vbox_logger(void);
/**
* xpcom style memory allocation
*/
void * nsMemory::Alloc(size_t size)
{
return new char[size];
}
void nsMemory::Free(void* ptr)
{
Assert(ptr);
delete [] reinterpret_cast<char *>(ptr);
}
void *nsMemory::Realloc(void* ptr, size_t size)
{
Assert(!"not implemented");
return nullptr;
}
void * nsMemory::Clone(const void*, size_t)
{
Assert(!"not implemented");
return nullptr;
}
/**
* Other stuff
*/
int com::GetVBoxUserHomeDirectory(char *aDir, size_t aDirLen, bool fCreateDir)
{
AssertReturn(aDir, VERR_INVALID_POINTER);
AssertReturn(aDirLen > 1, VERR_BUFFER_OVERFLOW);
memcpy(aDir, "/", 1);
aDir[1] = 0;
return VINF_SUCCESS;
}
extern "C"
RTDECL(int) RTPathUserHome(char *pszPath, size_t cchPath)
{
return com::GetVBoxUserHomeDirectory(pszPath, cchPath);
}
HRESULT setupmachine(Genode::Env &env)
{
HRESULT rc;
static com::Utf8Str vm_config(c_vbox_file);
static com::Utf8Str vm_name(c_vbox_vmname);
/* Machine object */
static ComObjPtr<Machine> machine;
rc = machine.createObject();
if (FAILED(rc))
return rc;
/* Virtualbox object */
static ComObjPtr<VirtualBox> virtualbox;
rc = virtualbox.createObject();
if (FAILED(rc))
return rc;
rc = machine->initFromSettings(virtualbox, vm_config, nullptr);
if (FAILED(rc))
return rc;
rc = genode_setup_machine(machine);
if (FAILED(rc))
return rc;
rc = virtualbox->RegisterMachine(machine);
if (FAILED(rc))
return rc;
// open a session
static ComObjPtr<Session> session;
rc = session.createObject();
if (FAILED(rc))
return rc;
rc = machine->LockMachine(session, LockType_VM);
if (FAILED(rc))
return rc;
/* Console object */
static ComPtr<IConsole> gConsole;
rc = session->COMGETTER(Console)(gConsole.asOutParam());
/* handle input of Genode and forward it to VMM layer */
static ComPtr<GenodeConsole> genodeConsole = gConsole;
genodeConsole->init_clipboard();
/* Display object */
static ComPtr<IDisplay> display;
rc = gConsole->COMGETTER(Display)(display.asOutParam());
if (FAILED(rc))
return rc;
ULONG cMonitors = 1;
rc = machine->COMGETTER(MonitorCount)(&cMonitors);
if (FAILED(rc))
return rc;
unsigned uScreenId;
for (uScreenId = 0; uScreenId < cMonitors; uScreenId++)
{
Genodefb *fb = new Genodefb(env);
display->SetFramebuffer(uScreenId, fb);
}
/* Power up the VMM */
ComPtr <IProgress> 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<IMouse> gMouse;
rc = gConsole->COMGETTER(Mouse)(gMouse.asOutParam());
if (FAILED(rc))
return rc;
Assert (&*gMouse);
/* request keyboard object */
static ComPtr<IKeyboard> gKeyboard;
rc = gConsole->COMGETTER(Keyboard)(gKeyboard.asOutParam());
if (FAILED(rc))
return rc;
Assert (&*gKeyboard);
genodeConsole->init_backends(gKeyboard, gMouse);
return rc;
}
static Genode::Env *genode_env_ptr = nullptr;
Genode::Env &genode_env()
{
struct Genode_env_ptr_uninitialized : Genode::Exception { };
if (!genode_env_ptr)
throw Genode_env_ptr_uninitialized();
return *genode_env_ptr;
}
Genode::Allocator &vmm_heap()
{
static Genode::Heap heap (genode_env().ram(), genode_env().rm());
return heap;
}
void Libc::Component::construct(Libc::Env &env)
{
/* make Genode environment accessible via the global 'genode_env()' */
genode_env_ptr = &env;
try {
using namespace Genode;
Attached_rom_dataspace config(env, "config");
Xml_node::Attribute vbox_file = config.xml().attribute("vbox_file");
vbox_file.value(c_vbox_file, sizeof(c_vbox_file));
Xml_node::Attribute vm_name = config.xml().attribute("vm_name");
vm_name.value(c_vbox_vmname, sizeof(c_vbox_vmname));
} catch (...) {
Genode::error("missing attributes in configuration, minimum requirements: ");
Genode::error(" <config vbox_file=\"...\" vm_name=\"...\">" );
throw;
}
/* enable stdout/stderr for VBox Log infrastructure */
init_libc_vbox_logger();
Libc::with_libc([&] () {
static char argv0[] = { '_', 'm', 'a', 'i', 'n', 0};
static char *argv[1] = { argv0 };
char **dummy_argv = argv;
int rc = RTR3InitExe(1, &dummy_argv, 0);
if (RT_FAILURE(rc))
throw -1;
HRESULT hrc = setupmachine(env);
if (FAILED(hrc)) {
Genode::error("startup of VMM failed - reason ", hrc, " - exiting ...");
throw -2;
}
});
}

View File

@ -1,401 +0,0 @@
/*
* \brief Registry of known guest-physical memory regions
* \author Norman Feske
* \date 2013-09-02
*
* Contains the mapping of guest-phyiscal to VMM-local addresses.
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#ifndef _GUEST_MEMORY_H_
#define _GUEST_MEMORY_H_
/* Genode includes */
#include <base/lock.h>
#include <base/log.h>
#include <util/flex_iterator.h>
#include <util/list.h>
#include "vmm.h"
/* VirtualBox includes */
#include <VBox/vmm/pgm.h>
#include <VBox/vmm/iom.h>
#include <VBox/vmm/pdmdev.h>
class Guest_memory
{
struct Region;
/*
* XXX Use AVL tree instead of a linked list
*/
typedef Genode::List<Region> Region_list;
typedef Genode::Lock Lock;
typedef Genode::addr_t addr_t;
private:
struct Region : Region_list::Element
{
RTGCPHYS const _GCPhys; /* guest-physical address */
RTGCPHYS const _cb; /* size */
void * const _pv; /* VMM-local address */
/*
* MMIO-specific members
*/
PPDMDEVINS const _pDevIns;
RTHCPTR const _pvUser;
PFNIOMMMIOWRITE const _pfnWriteCallback;
PFNIOMMMIOREAD const _pfnReadCallback;
PFNIOMMMIOFILL const _pfnFillCallback;
uint32_t const _fFlags;
Region(RTGCPHYS const GCPhys, RTGCPHYS const cb, void *const pv,
PPDMDEVINS pDevIns,
RTHCPTR pvUser,
PFNIOMMMIOWRITE pfnWriteCallback,
PFNIOMMMIOREAD pfnReadCallback,
PFNIOMMMIOFILL pfnFillCallback,
uint32_t fFlags)
:
_GCPhys(GCPhys), _cb(cb), _pv(pv),
_pDevIns (pDevIns),
_pvUser (pvUser),
_pfnWriteCallback (pfnWriteCallback),
_pfnReadCallback (pfnReadCallback),
_pfnFillCallback (pfnFillCallback),
_fFlags (fFlags)
{ }
/**
* Return true if region contains specified guest-physical area
*/
bool contains(RTGCPHYS GCPhys, size_t size) const
{
return (_GCPhys <= GCPhys) && (GCPhys < _GCPhys + _cb) &&
(_GCPhys + _cb - GCPhys >= size);
}
/**
* Return true if region is disjunct to specified guest-physical area
*/
bool disjunct(RTGCPHYS GCPhys, size_t size) const
{
return (GCPhys + size - 1 < _GCPhys) ||
(_GCPhys + _cb - 1 < GCPhys);
}
/**
* Return guest-physical base address
*/
RTGCPHYS GCPhys() const { return _GCPhys; }
/**
* Return VMM-local base address
*/
void *pv() const { return _pv; }
void dump() const
{
Genode::log("phys ", Genode::Hex_range<RTGCPHYS>(_GCPhys, _cb),
" -> virt ", Genode::Hex_range<Genode::addr_t>((Genode::addr_t)_pv, _cb),
" (dev='", _pDevIns && _pDevIns->pReg ? _pDevIns->pReg->szName : 0, "'");
}
void *pv_at_offset(addr_t offset)
{
if (_pv)
return (void *)((addr_t)_pv + (addr_t)offset);
return 0;
}
int mmio_write(RTGCPHYS GCPhys, void const *pv, unsigned cb)
{
if (!_pfnWriteCallback)
return VINF_SUCCESS;
int rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo),
VINF_IOM_R3_MMIO_READ);
if (rc != VINF_SUCCESS)
return rc;
rc = _pfnWriteCallback(_pDevIns, _pvUser, GCPhys, pv, cb);
PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo));
return rc;
}
int mmio_read(RTGCPHYS GCPhys, void *pv, unsigned cb)
{
if (!_pfnReadCallback)
return VINF_IOM_MMIO_UNUSED_FF;
int rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo),
VINF_IOM_R3_MMIO_WRITE);
rc = _pfnReadCallback(_pDevIns, _pvUser, GCPhys, pv, cb);
PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo));
return rc;
}
bool simple_mmio_write(RTGCPHYS vm_phys, unsigned cb)
{
/* adhere to original IOMMIOWrite check */
return (cb == 4 && !(vm_phys & 3)) ||
((_fFlags & IOMMMIO_FLAGS_WRITE_MODE) == IOMMMIO_FLAGS_WRITE_PASSTHRU) ||
(cb == 8 && !(vm_phys & 7) && IOMMMIO_DOES_WRITE_MODE_ALLOW_QWORD(_fFlags));
}
bool simple_mmio_read(RTGCPHYS vm_phys, unsigned cb)
{
/* adhere to original IOMMIORead check */
return (cb == 4 && !(vm_phys & 3)) ||
((_fFlags & IOMMMIO_FLAGS_READ_MODE) == IOMMMIO_FLAGS_READ_PASSTHRU) ||
(cb == 8 && !(vm_phys & 7) && (_fFlags & IOMMMIO_FLAGS_READ_MODE) == IOMMMIO_FLAGS_READ_DWORD_QWORD);
}
};
Lock _lock;
Region_list _ram_regions;
Region_list _rom_regions;
Region_list _mmio_regions;
static Region *_lookup(RTGCPHYS GCPhys, Region_list &regions, size_t size)
{
using Genode::addr_t;
for (Region *r = regions.first(); r; r = r->next())
if (r->contains(GCPhys, size))
return r;
return 0;
}
static bool _overlap(RTGCPHYS GCPhys, size_t size,
Region_list &regions)
{
using Genode::addr_t;
for (Region *r = regions.first(); r; r = r->next())
{
if (r->disjunct(GCPhys, size))
continue;
return true;
}
return false;
}
/**
* \return looked-up region, or 0 if lookup failed
*/
Region *_lookup(RTGCPHYS GCPhys, size_t size)
{
using Genode::addr_t;
/*
* ROM regions may alias RAM regions. For the lookup, always
* consider ROM regions first.
*/
if (Region *r = _lookup(GCPhys, _rom_regions, size))
return r;
if (Region *r = _lookup(GCPhys, _mmio_regions, size))
return r;
if (Region *r = _lookup(GCPhys, _ram_regions, size))
return r;
return 0;
}
public:
class Region_conflict { };
/**
* \throw Region_conflict
*/
void add_ram_mapping(RTGCPHYS const GCPhys, RTGCPHYS const cb, void * const pv)
{
/*
* XXX check for overlapping regions
*/
_ram_regions.insert(new (vmm_heap())
Region(GCPhys, cb, pv, 0, 0, 0, 0, 0, 0));
}
/**
* \throw Region_conflict
*/
void add_rom_mapping(RTGCPHYS const GCPhys, RTGCPHYS const cb,
void const * const pv, PPDMDEVINS pDevIns)
{
/*
* XXX check for overlapping regions
*/
_rom_regions.insert(new (vmm_heap())
Region(GCPhys, cb,
(void *)pv, pDevIns, 0, 0, 0, 0, 0));
}
/**
* \throw Region_conflict
*/
void add_mmio_mapping(RTGCPHYS const GCPhys, RTGCPHYS const cb,
PPDMDEVINS pDevIns,
RTHCPTR pvUser,
PFNIOMMMIOWRITE pfnWriteCallback,
PFNIOMMMIOREAD pfnReadCallback,
PFNIOMMMIOFILL pfnFillCallback,
uint32_t fFlags)
{
/*
* XXX check for overlapping regions
*/
_mmio_regions.insert(new (vmm_heap())
Region(GCPhys, cb, 0,
pDevIns, pvUser, pfnWriteCallback,
pfnReadCallback, pfnFillCallback, fFlags));
}
bool remove_mmio_mapping(RTGCPHYS const GCPhys, RTGCPHYS const size)
{
Region *r = _lookup(GCPhys, _mmio_regions, size);
if (!r)
return false;
_mmio_regions.remove(r);
delete r;
return true;
}
void dump() const
{
Genode::log("guest-physical to VMM-local RAM mappings:");
for (Region const *r = _ram_regions.first(); r; r = r->next())
r->dump();
Genode::log("guest-physical to VMM-local ROM mappings:");
for (Region const *r = _rom_regions.first(); r; r = r->next())
r->dump();
Genode::log("guest-physical MMIO regions:");
for (Region const *r = _mmio_regions.first(); r; r = r->next())
r->dump();
}
/**
* \return looked-up VMM-local address, or 0 if lookup failed
*/
void *lookup(RTGCPHYS GCPhys, size_t size)
{
Region *r = _lookup(GCPhys, size);
if (!r)
return 0;
return r->pv_at_offset(GCPhys - r->GCPhys());
}
/**
* \return looked-up VMM-local address if Guest address is RAM
*/
void *lookup_ram(RTGCPHYS const GCPhys, size_t size,
Genode::Flexpage_iterator &it)
{
if (_overlap(GCPhys, size, _rom_regions))
return 0;
if (_overlap(GCPhys, size, _mmio_regions))
return 0;
if (!_overlap(GCPhys, size, _ram_regions))
return 0;
Region *r = _lookup(GCPhys, _ram_regions, size);
if (!r)
return 0;
void * vmm_local = lookup_ram(GCPhys & ~(size * 2UL - 1), size * 2UL, it);
if (vmm_local)
return vmm_local;
it = Genode::Flexpage_iterator((addr_t)r->pv_at_offset(GCPhys - r->GCPhys()), size, GCPhys, size, GCPhys);
return r->pv_at_offset(GCPhys - r->GCPhys());
}
/**
* \return VirtualBox return code
*/
int mmio_write(RTGCPHYS vm_phys, uint32_t u32Value, size_t size)
{
Region *r = _lookup(vm_phys, size);
if (!r) {
Genode::error("Guest_memory::mmio_write: lookup failed - "
"GCPhys=", Genode::Hex(vm_phys), " u32Value=",
u32Value, " size=", size);
return VERR_IOM_MMIO_RANGE_NOT_FOUND;
}
/* use VERR_IOM_NOT_MMIO_RANGE_OWNER to request complicated write */
if (!r->simple_mmio_write(vm_phys, size))
return VERR_IOM_NOT_MMIO_RANGE_OWNER;
int rc = r->mmio_write(vm_phys, &u32Value, size);
/* check that VERR_IOM_NOT_MMIO_RANGE_OWNER is unused, see above */
Assert(rc != VERR_IOM_NOT_MMIO_RANGE_OWNER);
return rc;
}
/**
* \return VirtualBox return code
*/
int mmio_read(RTGCPHYS vm_phys, uint32_t *u32Value, size_t size)
{
Region *r = _lookup(vm_phys, size);
if (!r) {
Genode::error("Guest_memory::mmio_read: lookup failed - "
"GCPhys=", Genode::Hex(vm_phys), " u32Value=",
u32Value, " size=", size);
return VERR_IOM_MMIO_RANGE_NOT_FOUND;
}
/* use VERR_IOM_NOT_MMIO_RANGE_OWNER to request complicated read */
if (!r->simple_mmio_read(vm_phys, size))
return VERR_IOM_NOT_MMIO_RANGE_OWNER;
int rc = r->mmio_read(vm_phys, u32Value, size);
/* check that VERR_IOM_NOT_MMIO_RANGE_OWNER is unused, see above */
Assert(rc != VERR_IOM_NOT_MMIO_RANGE_OWNER);
return rc;
}
};
/**
* Return pointer to singleton instance
*/
Guest_memory *guest_memory();
#endif /* _GUEST_MEMORY_H_ */

View File

@ -1,157 +0,0 @@
/*
* \brief VirtualBox hardware-acceleration manager
* \author Norman Feske
* \date 2013-08-20
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <base/log.h>
/* VirtualBox includes */
#include "HMInternal.h" /* enable access to hm.s.* */
#include <VBox/vmm/hm.h>
#include <VBox/vmm/vm.h>
/* Genode's VirtualBox includes */
#include "sup.h"
static bool enabled_hm = true;
static bool enable_pae_nx = false;
static bool enable_64bit = false;
VMMR3DECL(int) HMR3Init(PVM pVM)
{
PCFGMNODE pCfgHM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "HM/");
/* check whether to stay for non-paged modi in recompiler */
int rc = CFGMR3QueryBoolDef(pCfgHM, "EnableUX",
&pVM->hm.s.vmx.fAllowUnrestricted, true);
AssertRCReturn(rc, rc);
/* check whether to enable pae and nx bit - in 64bit host mode */
rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnablePAE", &enable_pae_nx,
false);
AssertRCReturn(rc, rc);
/* check whether to enable long-mode bit - in 64bit host mode */
rc = CFGMR3QueryBoolDef(pCfgHM, "64bitEnabled", &enable_64bit, false);
AssertRCReturn(rc, rc);
/*
* We always set the fHMEnabled flag. Otherwise, the EM won't
* consult us for taking scheduling decisions. The actual switch to
* HW accelerated mode is still dependent on the result of the
* HMR3CanExecuteGuest function.
*/
pVM->fHMEnabled = true;
for (VMCPUID i = 0; i < pVM->cCpus; i++)
pVM->aCpus[i].hm.s.fActive = false;
pVM->fHMEnabledFixed = true;
return VINF_SUCCESS;
}
VMMR3_INT_DECL(int) HMR3Term(PVM pVM)
{
return VINF_SUCCESS;
}
VMMR3_INT_DECL(int) HMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat)
{
enabled_hm = pVM->hm.s.svm.fSupported || pVM->hm.s.vmx.fSupported;
if (!enabled_hm || enmWhat != VMINITCOMPLETED_RING0)
return VINF_SUCCESS;
int rc = SUPR3CallVMMR0Ex(pVM->pVMR0, 0 /*idCpu*/, VMMR0_DO_HM_SETUP_VM, 0, NULL);
if (rc == VINF_SUCCESS) {
CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_SEP);
/* nova kernel supports solely on 64bit the following features */
if (sizeof(void *) > 4 && enable_pae_nx) {
CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_PAE);
CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_NX);
}
if (sizeof(void *) > 4 && enable_64bit) {
CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_LONG_MODE);
CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_SYSCALL);
CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_LAHF);
}
}
return rc;
}
VMMDECL(bool) HMIsEnabledNotMacro(PVM pVM)
{
Assert(pVM->fHMEnabledFixed);
return pVM->fHMEnabled;
}
VMMR3DECL(bool) HMR3IsVmxPreemptionTimerUsed(PVM pVM)
{
return false;
}
VMMR3DECL(bool) HMR3IsActive(PVMCPU pVCpu)
{
return pVCpu->hm.s.fActive;
}
VMM_INT_DECL(bool) HMIsLongModeAllowed(PVM pVM)
{
return HMIsEnabled(pVM) && pVM->hm.s.fAllow64BitGuests;
}
VMMR3DECL(bool) HMR3IsRescheduleRequired(PVM pVM, PCPUMCTX pCtx)
{
if (pVM->hm.s.vmx.fAllowUnrestricted)
return false;
return !CPUMIsGuestInPagedProtectedModeEx(pCtx);
}
VMMR3DECL(bool) HMR3IsEventPending(PVMCPU pVCpu)
{
return false;
}
VMMR3DECL(bool) HMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx)
{
if (!enabled_hm)
return false;
PVMCPU pVCpu = VMMGetCpu(pVM);
if (pVM->hm.s.vmx.fAllowUnrestricted) {
pVCpu->hm.s.fActive = true;
} else
/* enable H/W acceleration in protected and paged mode only */
pVCpu->hm.s.fActive = CPUMIsGuestInPagedProtectedModeEx(pCtx);
return pVCpu->hm.s.fActive;
}
VMM_INT_DECL(int) HMFlushTLB(PVMCPU pVCpu) { return VINF_SUCCESS; }
void HMR3ResetCpu(PVMCPU pVCpu) { }

View File

@ -1,190 +0,0 @@
/*
* \brief VirtualBox Memory-mapped I/O monitor
* \author Norman Feske
* \date 2013-09-02
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* VirtualBox includes */
#include "IOMInternal.h"
#include <VBox/vmm/vm.h>
#include <VBox/vmm/iom.h>
#include <VBox/vmm/rem.h>
/* local includes */
#include "guest_memory.h"
static const bool verbose = false;
VMMR3_INT_DECL(int) IOMR3Init(PVM pVM)
{
/*
* Assert alignment and sizes.
*/
AssertCompileMemberAlignment(VM, iom.s, 32);
AssertCompile(sizeof(pVM->iom.s) <= sizeof(pVM->iom.padding));
AssertCompileMemberAlignment(IOM, CritSect, sizeof(uintptr_t));
/*
* Initialize the REM critical section.
*/
#ifdef IOM_WITH_CRIT_SECT_RW
int rc = PDMR3CritSectRwInit(pVM, &pVM->iom.s.CritSect, RT_SRC_POS, "IOM Lock");
#else
int rc = PDMR3CritSectInit(pVM, &pVM->iom.s.CritSect, RT_SRC_POS, "IOM Lock");
#endif
AssertRCReturn(rc, rc);
return VINF_SUCCESS;
}
int IOMR3Term(PVM)
{
return VINF_SUCCESS;
}
VMMDECL(bool) IOMIsLockWriteOwner(PVM pVM)
{
#ifdef IOM_WITH_CRIT_SECT_RW
return PDMCritSectRwIsInitialized(&pVM->iom.s.CritSect)
&& PDMCritSectRwIsWriteOwner(&pVM->iom.s.CritSect);
#else
return PDMCritSectIsOwner(&pVM->iom.s.CritSect);
#endif
}
int IOMR3MmioRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart,
uint32_t cbRange, RTHCPTR pvUser,
R3PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback,
R3PTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
R3PTRTYPE(PFNIOMMMIOFILL) pfnFillCallback,
uint32_t fFlags, const char *pszDesc)
{
REMR3NotifyHandlerPhysicalRegister(pVM, PGMPHYSHANDLERTYPE_MMIO,
GCPhysStart, cbRange, true);
guest_memory()->add_mmio_mapping(GCPhysStart, cbRange,
pDevIns, pvUser, pfnWriteCallback,
pfnReadCallback, pfnFillCallback, fFlags);
return VINF_SUCCESS;
}
int IOMR3MmioDeregister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart,
uint32_t cbRange)
{
bool status = guest_memory()->remove_mmio_mapping(GCPhysStart, cbRange);
if (status)
return VINF_SUCCESS;
return !VINF_SUCCESS;
}
VMMDECL(VBOXSTRICTRC) IOMMMIOWrite(PVM pVM, PVMCPU, RTGCPHYS GCPhys,
uint32_t u32Value, size_t cbValue)
{
VBOXSTRICTRC rc = IOM_LOCK_SHARED(pVM);
Assert(rc == VINF_SUCCESS);
rc = guest_memory()->mmio_write(GCPhys, u32Value, cbValue);
/*
* Check whether access is unaligned or access width is less than device
* supports. See original IOMMMIOWrite & iomMMIODoComplicatedWrite of VBox.
*/
if (rc == VERR_IOM_NOT_MMIO_RANGE_OWNER) {
Assert(cbValue <= 4);
uint32_t value;
RTGCPHYS aligned = GCPhys & ~0x3U;
rc = guest_memory()->mmio_read(aligned, &value, sizeof(value));
uint32_t offset = GCPhys & 0x3;
memcpy(((char *)&value) + offset, &u32Value, cbValue);
rc = guest_memory()->mmio_write(aligned, value, sizeof(value));
}
Assert(rc != VERR_IOM_NOT_MMIO_RANGE_OWNER);
IOM_UNLOCK_SHARED(pVM);
return rc;
}
VMMDECL(VBOXSTRICTRC) IOMMMIORead(PVM pVM, PVMCPU, RTGCPHYS GCPhys,
uint32_t *pvalue, size_t bytes)
{
VBOXSTRICTRC rc = IOM_LOCK_SHARED(pVM);
Assert(rc == VINF_SUCCESS);
rc = guest_memory()->mmio_read(GCPhys, pvalue, bytes);
/*
* Check whether access is unaligned or access width is less than device
* supports. See original IOMMMIORead & iomMMIODoComplicatedRead of VBox.
*/
if (rc == VERR_IOM_NOT_MMIO_RANGE_OWNER) {
/* implement what we need to - extend by need */
Assert(bytes == 1 || bytes == 2);
uint32_t value = 0;
if ((GCPhys & 3UL) == 0)
rc = guest_memory()->mmio_read(GCPhys, &value, sizeof(value));
else {
/* only read until word boundary */
Assert(((GCPhys & 3UL) + bytes) <= sizeof(value));
/*
* Do an aligned read and shift the result to get the value at
* the unaligned address.
*/
rc = guest_memory()->mmio_read((GCPhys & ~3UL), &value, sizeof(value));
value >>= (8 * (GCPhys & 3UL));
}
Assert(rc == VINF_SUCCESS);
if (rc == VINF_SUCCESS) {
switch (bytes) {
case 1:
*(uint8_t *) pvalue = (uint8_t)value;
case 2:
*(uint16_t *)pvalue = (uint16_t)value;
}
}
}
else if (rc == VERR_IOM_MMIO_RANGE_NOT_FOUND) {
*pvalue = ~0U;
rc = VINF_SUCCESS;
}
IOM_UNLOCK_SHARED(pVM);
return rc;
}
int IOMMMIOMapMMIO2Page(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysRemapped,
uint64_t fPageFlags)
{
return VINF_SUCCESS;
}
int IOMMMIOResetRegion(PVM pVM, RTGCPHYS GCPhys)
{
return VINF_SUCCESS;
}

View File

@ -1,316 +0,0 @@
/*
* \brief VirtualBox I/O port monitor
* \author Norman Feske
* \date 2013-09-02
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <util/list.h>
#include <base/log.h>
#include <base/lock.h>
/* VirtualBox includes */
#include <VBox/vmm/iom.h>
#include <VBox/err.h>
#include <VBox/vmm/pdmdev.h>
#include "vmm.h"
static bool verbose = false;
class Guest_ioports
{
struct Range;
/*
* XXX Use AVL tree instead of a linked list
*/
typedef Genode::List<Range> Range_list;
typedef Genode::Lock Lock;
private:
struct Range : Range_list::Element
{
PPDMDEVINS _pDevIns;
RTIOPORT _PortStart;
RTUINT _cPorts;
RTHCPTR _pvUser;
PFNIOMIOPORTOUT _pfnOutCallback;
PFNIOMIOPORTIN _pfnInCallback;
PFNIOMIOPORTOUTSTRING _pfnOutStringCallback;
PFNIOMIOPORTINSTRING _pfnInStringCallback;
/**
* Return true if range contains specified subrange
*/
bool contains(RTIOPORT PortStart, RTUINT cPorts) const
{
return (PortStart >= _PortStart)
&& (PortStart <= _PortStart + _cPorts - 1);
}
bool partof(RTIOPORT port, RTUINT cPorts) const
{
RTIOPORT last_port = port + cPorts - 1;
RTIOPORT _last_port = _PortStart + _cPorts - 1;
return ((port <= _PortStart) && (_PortStart <= last_port)) ||
((port <= _last_port) && (_last_port <= last_port));
}
Range(PPDMDEVINS pDevIns,
RTIOPORT PortStart,
RTUINT cPorts,
RTHCPTR pvUser,
PFNIOMIOPORTOUT pfnOutCallback,
PFNIOMIOPORTIN pfnInCallback,
PFNIOMIOPORTOUTSTRING pfnOutStringCallback,
PFNIOMIOPORTINSTRING pfnInStringCallback)
:
_pDevIns (pDevIns),
_PortStart (PortStart),
_cPorts (cPorts),
_pvUser (pvUser),
_pfnOutCallback (pfnOutCallback),
_pfnInCallback (pfnInCallback),
_pfnOutStringCallback (pfnOutStringCallback),
_pfnInStringCallback (pfnInStringCallback)
{ }
VBOXSTRICTRC write(RTIOPORT port, uint32_t u32Value, unsigned cb)
{
if (!_pfnOutCallback)
return VINF_IOM_R3_IOPORT_WRITE;
VBOXSTRICTRC rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo),
VINF_IOM_R3_IOPORT_WRITE);
if (rc != VINF_SUCCESS)
return rc;
rc = _pfnOutCallback(_pDevIns, _pvUser, port, u32Value, cb);
PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo));
return rc;
}
VBOXSTRICTRC read(RTIOPORT port, uint32_t *pu32Value, unsigned cb)
{
if (!_pfnInCallback)
return VINF_IOM_R3_IOPORT_READ;
VBOXSTRICTRC rc = PDMCritSectEnter(_pDevIns->CTX_SUFF(pCritSectRo),
VINF_IOM_R3_IOPORT_READ);
if (rc != VINF_SUCCESS)
return rc;
rc = _pfnInCallback(_pDevIns, _pvUser, port, pu32Value, cb);
PDMCritSectLeave(_pDevIns->CTX_SUFF(pCritSectRo));
if (rc != VERR_IOM_IOPORT_UNUSED && rc != VINF_SUCCESS)
Genode::log("IOPORT read port=", Genode::Hex(port), " failed"
" - callback=", _pfnInCallback, " eip=",
__builtin_return_address(0));
return rc;
}
};
Lock _lock;
Range_list _ranges;
Range *_lookup(RTIOPORT PortStart, RTUINT cPorts)
{
for (Range *r = _ranges.first(); r; r = r->next())
if (r->contains(PortStart, cPorts))
return r;
return 0;
}
void dump()
{
for (Range *r = _ranges.first(); r; r = r->next())
Genode::log(Genode::Hex(r->_PortStart), "+",
Genode::Hex(r->_cPorts), " - '",
r->_pDevIns && r->_pDevIns->pReg ? r->_pDevIns->pReg->szName : 0, "'");
}
public:
int add_range(PPDMDEVINS pDevIns,
RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser,
R3PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback,
R3PTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStringCallback,
R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStringCallback)
{
Range *r = _lookup(PortStart, cPorts);
if (r) {
Genode::error("io port inseration failure ",
Genode::Hex(PortStart), "+",
Genode::Hex(cPorts), " - '",
pDevIns && pDevIns->pReg ? pDevIns->pReg->szName : 0, "'");
dump();
Assert(!r);
return VERR_GENERAL_FAILURE;
}
if (verbose)
Genode::log("insert io port range ", Genode::Hex(PortStart), "+",
Genode::Hex(cPorts), " - '",
pDevIns && pDevIns->pReg ? pDevIns->pReg->szName : 0, "'");
_ranges.insert(new (vmm_heap())
Range(pDevIns, PortStart, cPorts, pvUser,
pfnOutCallback, pfnInCallback,
pfnOutStringCallback, pfnInStringCallback));
return VINF_SUCCESS;
}
int remove_range(PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts)
{
bool deleted = false;
for (Range *r = _ranges.first(); r;)
{
if (!r->partof(PortStart, cPorts)) {
r = r->next();
continue;
}
deleted = true;
if (verbose)
Genode::log("delete io port range ",
Genode::Hex(r->_PortStart), "+",
Genode::Hex(r->_cPorts), " out of ",
Genode::Hex(PortStart), "+",
Genode::Hex(cPorts), " - '",
r->_pDevIns &&
r->_pDevIns->pReg ? r->_pDevIns->pReg->szName : 0, "'");
Range *s = r;
r = r->next();
_ranges.remove(s);
destroy(vmm_heap(), s);
}
return deleted ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
}
VBOXSTRICTRC write(RTIOPORT port, uint32_t u32Value, size_t cbValue)
{
Range *r = _lookup(port, cbValue);
if (r)
return r->write(port, u32Value, cbValue);
if (verbose) {
char c = u32Value & 0xff;
Genode::warning("attempted to write to non-existing port ",
Genode::Hex(port), "+", cbValue, " "
"value=", Genode::Hex(c));
}
return VINF_SUCCESS;
}
VBOXSTRICTRC read(RTIOPORT port, uint32_t *pu32Value, size_t cbValue)
{
Range *r = _lookup(port, cbValue);
if (r) {
VBOXSTRICTRC err = r->read(port, pu32Value, cbValue);
if (err != VERR_IOM_IOPORT_UNUSED)
return err;
} else
if (verbose)
Genode::warning("attempted to read from non-existing port ",
Genode::Hex(port), "+", cbValue, " ", r);
switch (cbValue)
{
case 1:
*reinterpret_cast<uint8_t *>(pu32Value) = 0xFFU;
break;
case 2:
*reinterpret_cast<uint16_t *>(pu32Value) = 0xFFFFU;
break;
case 4:
*reinterpret_cast<uint32_t *>(pu32Value) = 0xFFFFFFFFU;
break;
default:
Genode::error("Invalid I/O port (", Genode::Hex(port), ") "
"access of size (", Genode::Hex(cbValue), ")");
return VERR_IOM_INVALID_IOPORT_SIZE;
}
return VINF_SUCCESS;
// return VERR_IOM_IOPORT_UNUSED; /* recompiler does not like this */
}
};
/**
* Return pointer to singleton instance
*/
Guest_ioports *guest_ioports()
{
static Guest_ioports inst;
return &inst;
}
int
IOMR3IOPortRegisterR3(PVM pVM, PPDMDEVINS pDevIns,
RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser,
R3PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback,
R3PTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStringCallback,
R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStringCallback,
const char *pszDesc)
{
if (verbose)
Genode::log("register I/O port range ",
Genode::Hex(PortStart), "-",
Genode::Hex(PortStart + cPorts - 1), " '", pszDesc, "'");
return guest_ioports()->add_range(pDevIns, PortStart, cPorts, pvUser,
pfnOutCallback, pfnInCallback,
pfnOutStringCallback, pfnInStringCallback);
}
int IOMR3IOPortDeregister(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart,
RTUINT cPorts)
{
if (verbose)
Genode::log("deregister I/O port range ",
Genode::Hex(PortStart), "-",
Genode::Hex(PortStart + cPorts - 1));
return guest_ioports()->remove_range(pDevIns, PortStart, cPorts);
}
VMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVM, PVMCPU, RTIOPORT Port,
uint32_t u32Value, size_t cbValue)
{
return guest_ioports()->write(Port, u32Value, cbValue);
}
VMMDECL(VBOXSTRICTRC) IOMIOPortRead(PVM, PVMCPU, RTIOPORT Port,
uint32_t *pu32Value, size_t cbValue)
{
return guest_ioports()->read(Port, pu32Value, cbValue);
}

View File

@ -1,365 +0,0 @@
/*
* \brief VirtualBox memory manager (MMR3)
* \author Norman Feske
* \date 2013-08-20
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode includes */
#include <base/log.h>
#include <util/string.h>
#include <rm_session/connection.h>
#include <region_map/client.h>
/* VirtualBox includes */
#include <VBox/vmm/mm.h>
#include <VBox/vmm/cfgm.h>
#include <VBox/err.h>
#include <VBox/vmm/gmm.h>
#include <VBox/vmm/vm.h>
#include <VBox/vmm/pgm.h>
#include <iprt/err.h>
#include <iprt/mem.h>
#include <iprt/string.h>
/* libc memory allocator */
#include <libc_mem_alloc.h>
#include "util.h"
#include "mm.h"
#include "vmm.h"
static struct {
Sub_rm_connection * conn;
Libc::Mem_alloc_impl * heap;
} memory_regions [MM_TAG_HM + 1];
static Libc::Mem_alloc * heap_by_mmtag(MMTAG enmTag)
{
enum { REGION_SIZE = 4096 * 4096 };
static Genode::Lock memory_init_lock;
Assert(enmTag < sizeof(memory_regions) / sizeof(memory_regions[0]));
if (memory_regions[enmTag].conn)
return memory_regions[enmTag].heap;
Genode::Lock::Guard guard(memory_init_lock);
if (memory_regions[enmTag].conn)
return memory_regions[enmTag].heap;
memory_regions[enmTag].conn = new Sub_rm_connection(genode_env(), REGION_SIZE);
memory_regions[enmTag].heap = new Libc::Mem_alloc_impl(*memory_regions[enmTag].conn,
genode_env().ram());
return memory_regions[enmTag].heap;
}
static Libc::Mem_alloc * heap_by_pointer(void * pv)
{
for (unsigned i = 0; i < sizeof(memory_regions) / sizeof(memory_regions[0]); i++) {
if (!memory_regions[i].heap)
continue;
if (memory_regions[i].conn->contains(pv))
return memory_regions[i].heap;
}
return nullptr;
}
int MMR3Init(PVM) { return VINF_SUCCESS; }
int MMR3Term(PVM) { return VINF_SUCCESS; }
int MMR3InitUVM(PUVM) { return VINF_SUCCESS; }
void MMR3TermUVM(PUVM) { }
void *MMR3HeapAllocU(PUVM pUVM, MMTAG enmTag, size_t cbSize)
{
return heap_by_mmtag(enmTag)->alloc(cbSize, Genode::log2(RTMEM_ALIGNMENT));
}
/**
* Return alignment to be used for allocations of given tag
*/
static unsigned align_by_mmtag(MMTAG enmTag)
{
switch (enmTag) {
case MM_TAG_PDM_DEVICE:
case MM_TAG_PDM_DEVICE_USER:
case MM_TAG_VMM:
return 12;
case MM_TAG_CPUM_CPUID:
case MM_TAG_CPUM_MSRS:
return Genode::log2(32);
default:
return Genode::log2(RTMEM_ALIGNMENT);
}
}
/**
* Round allocation size for a given tag
*/
static size_t round_size_by_mmtag(MMTAG enmTag, size_t cb)
{
return Genode::align_addr(cb, align_by_mmtag(enmTag));
}
void *MMR3HeapAlloc(PVM pVM, MMTAG enmTag, size_t cbSize)
{
size_t const rounded_size = round_size_by_mmtag(enmTag, cbSize);
return heap_by_mmtag(enmTag)->alloc(rounded_size, align_by_mmtag(enmTag));
}
void *MMR3HeapAllocZ(PVM pVM, MMTAG enmTag, size_t cbSize)
{
void * const ret = MMR3HeapAlloc(pVM, enmTag, cbSize);
if (ret)
Genode::memset(ret, 0, cbSize);
return ret;
}
int MMR3HeapAllocZEx(PVM pVM, MMTAG enmTag, size_t cbSize, void **ppv)
{
*ppv = MMR3HeapAllocZ(pVM, enmTag, cbSize);
return VINF_SUCCESS;
}
int MMR3HyperInitFinalize(PVM)
{
return VINF_SUCCESS;
}
int MMR3HyperSetGuard(PVM, void* ptr, size_t, bool)
{
return VINF_SUCCESS;
}
int MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, unsigned uAlignment,
MMTAG enmTag, void **ppv)
{
AssertRelease(align_by_mmtag(enmTag) >= (uAlignment ? Genode::log2(uAlignment) : 0));
unsigned const align_log2 = uAlignment ? Genode::log2(uAlignment)
: align_by_mmtag(enmTag);
size_t const rounded_size = round_size_by_mmtag(enmTag, cb);
void *ret = heap_by_mmtag(enmTag)->alloc(rounded_size, align_log2);
if (ret)
Genode::memset(ret, 0, cb);
*ppv = ret;
return VINF_SUCCESS;
}
int MMR3HyperAllocOnceNoRelEx(PVM pVM, size_t cb, uint32_t uAlignment,
MMTAG enmTag, uint32_t fFlags, void **ppv)
{
AssertRelease(align_by_mmtag(enmTag) >= (uAlignment ? Genode::log2(uAlignment) : 0));
return MMR3HyperAllocOnceNoRel(pVM, cb, uAlignment, enmTag, ppv);
}
int MMHyperAlloc(PVM pVM, size_t cb, unsigned uAlignment, MMTAG enmTag, void **ppv)
{
AssertRelease(align_by_mmtag(enmTag) >= (uAlignment ? Genode::log2(uAlignment) : 0));
*ppv = MMR3HeapAllocZ(pVM, enmTag, cb);
return VINF_SUCCESS;
}
int MMHyperFree(PVM pVM, void *pv)
{
MMR3HeapFree(pv);
return VINF_SUCCESS;
}
int MMHyperDupMem(PVM pVM, const void *pvSrc, size_t cb,
unsigned uAlignment, MMTAG enmTag, void **ppv)
{
int rc = MMHyperAlloc(pVM, cb, uAlignment, enmTag, ppv);
if (RT_SUCCESS(rc))
memcpy(*ppv, pvSrc, cb);
return rc;
}
bool MMHyperIsInsideArea(PVM, RTGCPTR ptr)
{
return false;
}
void MMR3HeapFree(void *pv)
{
Libc::Mem_alloc *heap = heap_by_pointer(pv);
Assert(heap);
heap->free(pv);
}
uint64_t MMR3PhysGetRamSize(PVM pVM)
{
/* when called from REMR3Init, it is expected to return 0 */
return 0;
}
int MMR3HyperMapHCPhys(PVM pVM, void *pvR3, RTR0PTR pvR0, RTHCPHYS HCPhys,
size_t cb, const char *pszDesc, PRTGCPTR pGCPtr)
{
static_assert(sizeof(*pGCPtr) == sizeof(HCPhys) , "pointer transformation bug");
*pGCPtr = (RTGCPTR)HCPhys;
return VINF_SUCCESS;
}
int MMR3HyperReserve(PVM pVM, unsigned cb, const char *pszDesc, PRTGCPTR pGCPtr)
{
return VINF_SUCCESS;
}
int MMR3HyperMapMMIO2(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion,
RTGCPHYS off, RTGCPHYS cb, const char *pszDesc,
PRTRCPTR pRCPtr)
{
return VINF_SUCCESS;
}
/*
* Based on 'VBox/VMM/VMMR3/MM.cpp'
*/
int MMR3InitPaging(PVM pVM)
{
/*
* Query the CFGM values.
*/
int rc;
PCFGMNODE pMMCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "MM");
if (!pMMCfg)
{
rc = CFGMR3InsertNode(CFGMR3GetRoot(pVM), "MM", &pMMCfg);
AssertRCReturn(rc, rc);
}
/** @cfgm{RamSize, uint64_t, 0, 16TB, 0}
* Specifies the size of the base RAM that is to be set up during
* VM initialization.
*/
uint64_t cbRam;
rc = CFGMR3QueryU64(CFGMR3GetRoot(pVM), "RamSize", &cbRam);
if (rc == VERR_CFGM_VALUE_NOT_FOUND)
cbRam = 0;
else
AssertMsgRCReturn(rc, ("Configuration error: Failed to query integer \"RamSize\", rc=%Rrc.\n", rc), rc);
cbRam &= X86_PTE_PAE_PG_MASK;
/** @cfgm{RamHoleSize, uint32_t, 0, 4032MB, 512MB}
* Specifies the size of the memory hole. The memory hole is used
* to avoid mapping RAM to the range normally used for PCI memory regions.
* Must be aligned on a 4MB boundary. */
uint32_t cbRamHole;
rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "RamHoleSize", &cbRamHole, MM_RAM_HOLE_SIZE_DEFAULT);
uint64_t const offRamHole = _4G - cbRamHole;
/*
* Make the initial memory reservation with GMM.
*/
LogFlow(("GMMR3INitialReservation missing\n"));
/*
* If RamSize is 0 we're done now.
*/
if (cbRam < PAGE_SIZE)
{
Log(("MM: No RAM configured\n"));
return VINF_SUCCESS;
}
/*
* Setup the base ram (PGM).
*/
if (cbRam > offRamHole)
{
rc = PGMR3PhysRegisterRam(pVM, 0, offRamHole, "Base RAM");
if (RT_SUCCESS(rc))
rc = PGMR3PhysRegisterRam(pVM, _4G, cbRam - offRamHole, "Above 4GB Base RAM");
}
else
rc = PGMR3PhysRegisterRam(pVM, 0, RT_MIN(cbRam, offRamHole), "Base RAM");
LogFlow(("MMR3InitPaging: returns %Rrc\n", rc));
return rc;
}
char * MMR3HeapStrDup(PVM pVM, MMTAG enmTag, const char *psz)
{
size_t cch = strlen(psz) + 1;
char *pszDup = (char *)MMR3HeapAllocU(pVM->pUVM, enmTag, cch);
if (pszDup)
memcpy(pszDup, psz, cch);
return pszDup;
}
char * MMR3HeapAPrintfVU(PUVM pUVM, MMTAG enmTag, const char *pszFormat, va_list va)
{
/*
* The lazy bird way.
*/
char *psz;
int cch = RTStrAPrintfV(&psz, pszFormat, va);
if (cch < 0)
return NULL;
Assert(psz[cch] == '\0');
char *pszRet = (char *)MMR3HeapAllocU(pUVM, enmTag, cch + 1);
if (pszRet)
memcpy(pszRet, psz, cch + 1);
RTStrFree(psz);
return pszRet;
}
extern "C" {
char * MMR3HeapAPrintf(PVM pVM, MMTAG enmTag, const char *pszFormat, ...)
{
va_list va;
va_start(va, pszFormat);
char *psz = MMR3HeapAPrintfVU(pVM->pUVM, enmTag, pszFormat, va);
va_end(va);
return psz;
}
}

View File

@ -1,11 +0,0 @@
TARGET = virtualbox-muen
REQUIRES = muen
LIBS += virtualbox-muen
include $(REP_DIR)/src/virtualbox/target.inc
vpath frontend/% $(REP_DIR)/src/virtualbox/
vpath %.cc $(REP_DIR)/src/virtualbox/
CC_CXX_WARN_STRICT =

View File

@ -1,11 +0,0 @@
TARGET = virtualbox-nova
REQUIRES = nova
LIBS += virtualbox-nova
include $(REP_DIR)/src/virtualbox/target.inc
vpath frontend/% $(REP_DIR)/src/virtualbox/
vpath %.cc $(REP_DIR)/src/virtualbox/
CC_CXX_WARN_STRICT =

View File

@ -1,16 +0,0 @@
Omit the filter layer in VirtualBox and use the actual driver directly.
This is needed because we want to use our genode_write() function but
the filter layer always calls audio_pcm_sw_write() instead.
--- a/src/app/virtualbox/src/VBox/Devices/Audio/audio.c 2015-06-05 16:48:33.535360035 +0200
+++ b/src/app/virtualbox/src/VBox/Devices/Audio/audio.c 2015-06-05 16:49:25.077358248 +0200
@@ -1579,8 +1579,8 @@
s->drv_opaque = drv->init ();
if (s->drv_opaque) {
- /* Filter must be installed before initializing voices. */
- drv = filteraudio_install(drv, s->drv_opaque);
+ // we do not use the filter layer so use the drv directly;
+ drv = s->drv_opaque;
audio_init_nb_voices_out (s, drv);
audio_init_nb_voices_in (s, drv);
s->drv = drv;

View File

@ -1,36 +0,0 @@
dev_e1000.patch
diff --git a/src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp b/src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp
index b8f9ebf..aa3eb87 100644
--- a/src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/Network/DevE1000.cpp
@@ -5721,22 +5721,29 @@ static int e1kRegReadUnaligned(PE1KSTATE pThis, uint32_t offReg, void *pv, uint3
rc = g_aE1kRegMap[index].pfnRead(pThis, offReg & 0xFFFFFFFC, index, &u32);
u32 &= mask;
//e1kCsLeave(pThis);
+#ifdef DEBUG
E1kLog2(("%s At %08X read %s from %s (%s)\n",
pThis->szPrf, offReg, e1kU32toHex(u32, mask, buf), g_aE1kRegMap[index].abbrev, g_aE1kRegMap[index].name));
Log6(("%s At %08X read %s from %s (%s) [UNALIGNED]\n",
pThis->szPrf, offReg, e1kU32toHex(u32, mask, buf), g_aE1kRegMap[index].abbrev, g_aE1kRegMap[index].name));
+#endif
/* Shift back the result. */
u32 >>= shift;
}
+#ifdef DEBUG
else
E1kLog(("%s At %08X read (%s) attempt from write-only register %s (%s)\n",
pThis->szPrf, offReg, e1kU32toHex(u32, mask, buf), g_aE1kRegMap[index].abbrev, g_aE1kRegMap[index].name));
+#endif
+
if (IOM_SUCCESS(rc))
STAM_COUNTER_INC(&pThis->aStatRegReads[index]);
}
+#ifdef DEBUG
else
E1kLog2(("%s At %08X read (%s) attempt from non-existing register\n",
pThis->szPrf, offReg, e1kU32toHex(u32, mask, buf)));
+#endif
memcpy(pv, &u32, cb);
return rc;

View File

@ -1,24 +0,0 @@
Deliver PCI IRQs to the IOAPIC if the 'force_ioapic' configuration option is set.
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Issue #2029
---
src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp b/src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp
index c454d8b..35061d5 100644
--- a/src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/Bus/DevPCI.cpp
@@ -663,7 +663,9 @@ static void pciSetIrqInternal(PPCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE p
* is opened to route PCI interrupts directly to the I/O APIC and bypass the PIC.
* See the \_SB_.PCI0._PRT method in vbox.dsl.
*/
- const bool fIsApicEnabled = pGlobals->fUseIoApic && pbCfg[0xde] == 0xbe && pbCfg[0xad] == 0xef;
+ extern bool force_ioapic();
+ const bool fIsApicEnabled = pGlobals->fUseIoApic &&
+ (force_ioapic() || (pbCfg[0xde] == 0xbe && pbCfg[0xad] == 0xef));
int pic_irq, pic_level;
/* Check if the state changed. */

View File

@ -1,12 +0,0 @@
--- a/src/app/virtualbox/src/VBox/Devices/Storage/ide.h
+++ b/src/app/virtualbox/src/VBox/Devices/Storage/ide.h
@@ -202,8 +202,7 @@
#define ATAPI_INQUIRY_PRODUCT_ID_LENGTH 16
#define ATAPI_INQUIRY_REVISION_LENGTH 4
-
-#if defined(DEBUG) && defined(IN_RING3)
+#if defined(LOG_ENABLED) && defined(IN_RING3)
const char * ATACmdText(uint8_t uCmd);
#endif

View File

@ -1,32 +0,0 @@
rem_irq.patch
diff --git a/src/app/virtualbox/src/VBox/VMM/VMMR3/TRPM.cpp b/src/app/virtualbox/src/VBox/VMM/VMMR3/TRPM.cpp
index 8c12949..a7fd67e 100644
--- a/src/app/virtualbox/src/VBox/VMM/VMMR3/TRPM.cpp
+++ b/src/app/virtualbox/src/VBox/VMM/VMMR3/TRPM.cpp
@@ -1561,6 +1561,17 @@ VMMR3DECL(int) TRPMR3InjectEvent(PVM pVM, PVMCPU pVCpu, TRPMEVENT enmEvent)
return HMR3IsActive(pVCpu) ? VINF_EM_RESCHEDULE_HM : VINF_EM_RESCHEDULE_REM; /* (Heed the halted state if this is changed!) */
}
#else /* !TRPM_FORWARD_TRAPS_IN_GC */
+ /* Restore behaviour as used in 4.2.24 Virtualbox. The PDMGetInterrupt call
+ * and TRPMAssertTrap call in 4.2.24 is solely performed when HM mode is
+ * active.
+ * With 4.3 the TRPMAssertTrap is also performed when running solely (as
+ * done on Genode/Virtualbox for realmode code) in the recompiler. Calling
+ * TRPMAssertTrap in this case leads to the effect, that the Irq isn't
+ * pending anymore for the recompiler and therefore it will not inject it.
+ *
+ * Restoring the original behaviour as of 4.2.24 mitigates the issue.
+ */
+ if (HMR3IsActive(pVCpu)) {
uint8_t u8Interrupt;
int rc = PDMGetInterrupt(pVCpu, &u8Interrupt);
Log(("TRPMR3InjectEvent: u8Interrupt=%d (%#x) rc=%Rrc\n", u8Interrupt, u8Interrupt, rc));
@@ -1571,6 +1582,7 @@ VMMR3DECL(int) TRPMR3InjectEvent(PVM pVM, PVMCPU pVCpu, TRPMEVENT enmEvent)
STAM_COUNTER_INC(&pVM->trpm.s.paStatForwardedIRQR3[u8Interrupt]);
return HMR3IsActive(pVCpu) ? VINF_EM_RESCHEDULE_HM : VINF_EM_RESCHEDULE_REM;
}
+ }
#endif /* !TRPM_FORWARD_TRAPS_IN_GC */
}
/** @todo check if it's safe to translate the patch address to the original guest address.

View File

@ -1,14 +0,0 @@
audio.patch
ide.patch
vbox_inc.patch
vbox_main.patch
vga_fb.patch
vga_vbva.patch
vmmdev.patch
usb.patch
vbox_dd.patch
ide.patch
rem_irq.patch
force_ioapic.patch
vbox-cpuhotplug.dsl.patch
dev_e1000.patch

View File

@ -1,18 +0,0 @@
acpi_drv.patch
avoid_yield.patch
eminternal.patch
hostservice.patch
iconv.patch
mouse.patch
network.patch
pdm_driver.patch
poke.patch
posix.patch
serial.patch
sharedfolder_pagelist.patch
time-log-deadlock.patch
tm_retries.patch
vmdk.patch
tm_tpr.patch
tm_4s.patch
rem_tss.patch

View File

@ -1,136 +0,0 @@
usb.patch
diff --git a/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp b/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp
index a51bc36..bed42e8 100644
--- a/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/USB/USBProxyDevice.cpp
@@ -843,10 +843,14 @@ static DECLCALLBACK(int) usbProxyConstruct(PPDMUSBINS pUsbIns, int iInstance, PC
/*
* Select backend and open the device.
*/
+
+ return PDMUSB_SET_ERROR(pUsbIns, VERR_NOT_SUPPORTED, N_("USBProxy: not supported on Genode"));
+#if 0
if (!fRemote)
pThis->pOps = &g_USBProxyDeviceHost;
else
pThis->pOps = &g_USBProxyDeviceVRDP;
+#endif /* if 0 */
pThis->pvInstanceDataR3 = RTMemAllocZ(pThis->pOps->cbBackend);
if (!pThis->pvInstanceDataR3)
diff --git a/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp b/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp
index 4790fcb..d649ad6 100644
--- a/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/USB/VUSBDevice.cpp
@@ -1134,7 +1143,7 @@ static DECLCALLBACK(int) vusbDevUrbIoThread(RTTHREAD hThread, void *pvUser)
vusbUrbDoReapAsyncDev(pDev, RT_INDEFINITE_WAIT);
/* Process any URBs waiting to be cancelled first. */
- int rc = RTReqQueueProcess(pDev->hReqQueueSync, 0); /* Don't wait if there is nothing to do. */
+ int rc = RTReqQueueProcess(pDev->hReqQueueSync, pDev->enmState == VUSB_DEVICE_STATE_RESET ? 5 : 0); /* if in reset state (takes 10ms) sleep a bit - otherwise this thread consumes in this loop a lot of cpu time */
Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT);
}
diff --git a/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.cpp b/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.cpp
index 3173a36..8105987 100644
--- a/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.cpp
@@ -39,6 +39,7 @@ const void *g_apvVBoxDDDependencies[] =
NULL,
};
+#if 0
/**
* Register builtin devices.
@@ -329,6 +330,7 @@ extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_
return VINF_SUCCESS;
}
+#endif /* if 0 */
/**
* Register builtin USB device.
diff --git a/src/app/virtualbox/src/VBox/Main/include/Matching.h b/src/app/virtualbox/src/VBox/Main/include/Matching.h
index 2f01f69..9b13e37 100644
--- a/src/app/virtualbox/src/VBox/Main/include/Matching.h
+++ b/src/app/virtualbox/src/VBox/Main/include/Matching.h
@@ -291,10 +291,12 @@ public:
return mValueAny || mValue == aValue;
}
+#if 0
bool isMatch (const BOOL aValue) const
{
return isMatch (bool (aValue == TRUE));
}
+#endif /* if 0 */
private:
diff --git a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp
index 3889a01..7ae9d1c 100644
--- a/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp
+++ b/src/app/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp
@@ -13571,6 +13582,7 @@ STDMETHODIMP SessionMachine::AutoCaptureUSBDevices()
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+#if 0
#ifdef VBOX_WITH_USB
HRESULT rc = mUSBDeviceFilters->notifyProxy(true /* aInsertFilters */);
AssertComRC(rc);
@@ -13579,6 +13591,7 @@ STDMETHODIMP SessionMachine::AutoCaptureUSBDevices()
USBProxyService *service = mParent->host()->usbProxyService();
AssertReturn(service, E_FAIL);
return service->autoCaptureDevicesForVM(this);
+#endif /* if 0 */
#else
return S_OK;
#endif
@@ -13614,6 +13614,7 @@
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+#if 0
#ifdef VBOX_WITH_USB
HRESULT rc = mUSBDeviceFilters->notifyProxy(false /* aInsertFilters */);
AssertComRC(rc);
@@ -13622,6 +13623,7 @@
USBProxyService *service = mParent->host()->usbProxyService();
AssertReturn(service, E_FAIL);
return service->detachAllDevicesFromVM(this, !!aDone, false /* aAbnormal */);
+#endif /* if 0 */
#else
NOREF(aDone);
return S_OK;
diff --git a/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp b/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
index 09b42f5..c179ca6 100644
--- a/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
+++ b/src/app/virtualbox/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
@@ -1037,13 +1037,10 @@ HRESULT USBDeviceFilters::notifyProxy(bool aInsertFilters)
LogFlowThisFunc(("aInsertFilters=%RTbool\n", aInsertFilters));
AutoCaller autoCaller(this);
- AssertComRCReturn(autoCaller.rc(), false);
+ AssertComRCReturnRC(autoCaller.rc());
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
- USBProxyService *pProxySvc = m->pHost->usbProxyService();
- AssertReturn(pProxySvc, E_FAIL);
-
DeviceFilterList::const_iterator it = m->llDeviceFilters->begin();
while (it != m->llDeviceFilters->end())
{
@@ -1054,6 +1051,9 @@ HRESULT USBDeviceFilters::notifyProxy(bool aInsertFilters)
&& pFilter->getData().mRemote.isMatch(false) /* and if the filter is NOT remote */
)
{
+ USBProxyService *pProxySvc = m->pHost->usbProxyService();
+ AssertReturn(pProxySvc, E_FAIL);
+
if (aInsertFilters)
{
AssertReturn(pFilter->getId() == NULL, E_FAIL);

View File

@ -1,30 +0,0 @@
--- a/src/app/virtualbox/src/VBox/Devices/PC/vbox-cpuhotplug.dsl
+++ b/src/app/virtualbox/src/VBox/Devices/PC/vbox-cpuhotplug.dsl
@@ -27,6 +27,18 @@
Return(LEqual(CPUL, 0x01))
}
+ // Method to notify the VMM that a CPU is not
+ // in use anymore and can be safely removed.
+ // Using the extra method here because the CPUL
+ // register identifer clashes with the CPUL object defined
+ // below making iasl starting with version 20150930 fail.
+ //
+ // Think of CPLO as "CPU Lock Open"
+ Method(CPLO, 1)
+ {
+ Store (Arg0, CPUL)
+ }
+
Scope (\_SB)
{
@@ -73,7 +85,7 @@
} \
Method(_EJ0, 1) \
{ \
- Store(id, CPUL) /* Unlock the CPU */ \
+ CPLO(id) /* Unlock the CPU */ \
Return \
} \
} \

View File

@ -1,10 +0,0 @@
--- a/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.h
+++ b/src/app/virtualbox/src/VBox/Devices/build/VBoxDD.h
@@ -58,6 +58,7 @@
extern const PDMDEVREG g_DeviceAudioSniffer;
extern const PDMDEVREG g_DeviceOHCI;
extern const PDMDEVREG g_DeviceEHCI;
+extern const PDMDEVREG g_DeviceXHCI;
extern const PDMDEVREG g_DeviceACPI;
extern const PDMDEVREG g_DeviceDMA;
extern const PDMDEVREG g_DeviceFloppyController;

View File

@ -1,113 +0,0 @@
vbox_inc.patch
diff --git a/src/app/virtualbox/include/VBox/com/ErrorInfo.h b/src/app/virtualbox/include/VBox/com/ErrorInfo.h
index 869b998..c6adf70 100644
--- a/src/app/virtualbox/include/VBox/com/ErrorInfo.h
+++ b/src/app/virtualbox/include/VBox/com/ErrorInfo.h
@@ -31,8 +31,8 @@
#include "VBox/com/Guid.h"
#include "VBox/com/assert.h"
-struct IProgress;
-struct IVirtualBoxErrorInfo;
+//struct IProgress;
+//struct IVirtualBoxErrorInfo;
namespace com
{
diff --git a/src/app/virtualbox/include/VBox/com/array.h b/src/app/virtualbox/include/VBox/com/array.h
index 77f9d60..dcbad41 100644
--- a/src/app/virtualbox/include/VBox/com/array.h
+++ b/src/app/virtualbox/include/VBox/com/array.h
@@ -219,10 +219,10 @@ struct SafeArrayTraits
protected:
/** Initializes memory for aElem. */
- static void Init(T &aElem) { aElem = 0; }
+ static void Init(T &aElem) { /*aElem = 0; */ }
/** Initializes memory occupied by aElem. */
- static void Uninit(T &aElem) { aElem = 0; }
+ static void Uninit(T &aElem) { /* aElem = 0; */ }
/** Creates a deep copy of aFrom and stores it in aTo. */
static void Copy(const T &aFrom, T &aTo) { aTo = aFrom; }
diff --git a/src/app/virtualbox/include/VBox/com/string.h b/src/app/virtualbox/include/VBox/com/string.h
index 263dc40..768c336 100644
--- a/src/app/virtualbox/include/VBox/com/string.h
+++ b/src/app/virtualbox/include/VBox/com/string.h
@@ -247,7 +247,7 @@ public:
* returns a pointer to a global variable containing an empty BSTR with a proper zero
* length prefix so that Windows is happy.
*/
- CBSTR raw() const
+ BSTR raw() const
{
if (m_bstr)
return m_bstr;
diff --git a/src/app/virtualbox/include/VBox/vmm/hm_vmx.h b/src/app/virtualbox/include/VBox/vmm/hm_vmx.h
index 7deb357..668764c 100644
--- a/src/app/virtualbox/include/VBox/vmm/hm_vmx.h
+++ b/src/app/virtualbox/include/VBox/vmm/hm_vmx.h
@@ -1859,10 +1859,10 @@ DECLINLINE(int) VMXEnable(RTHCPHYS pVMXOn)
".byte 0xF3, 0x0F, 0xC7, 0x34, 0x24 # VMXON [esp] \n\t"
"ja 2f \n\t"
"je 1f \n\t"
- "movl $"RT_XSTR(VERR_VMX_INVALID_VMXON_PTR)", %0 \n\t"
+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMXON_PTR)", %0 \n\t"
"jmp 2f \n\t"
"1: \n\t"
- "movl $"RT_XSTR(VERR_VMX_VMXON_FAILED)", %0 \n\t"
+ "movl $" RT_XSTR(VERR_VMX_VMXON_FAILED)", %0 \n\t"
"2: \n\t"
"add $8, %%esp \n\t"
:"=rm"(rc)
@@ -1952,7 +1952,7 @@ DECLINLINE(int) VMXClearVmcs(RTHCPHYS pVMCS)
"push %2 \n\t"
".byte 0x66, 0x0F, 0xC7, 0x34, 0x24 # VMCLEAR [esp] \n\t"
"jnc 1f \n\t"
- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
"1: \n\t"
"add $8, %%esp \n\t"
:"=rm"(rc)
@@ -2009,7 +2009,7 @@ DECLINLINE(int) VMXActivateVmcs(RTHCPHYS pVMCS)
"push %2 \n\t"
".byte 0x0F, 0xC7, 0x34, 0x24 # VMPTRLD [esp] \n\t"
"jnc 1f \n\t"
- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
"1: \n\t"
"add $8, %%esp \n\t"
:"=rm"(rc)
@@ -2079,10 +2079,10 @@ DECLINLINE(int) VMXWriteVmcs32(uint32_t idxField, uint32_t u32Val)
".byte 0x0F, 0x79, 0xC2 # VMWRITE eax, edx \n\t"
"ja 2f \n\t"
"je 1f \n\t"
- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
"jmp 2f \n\t"
"1: \n\t"
- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t"
+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t"
"2: \n\t"
:"=rm"(rc)
:"0"(VINF_SUCCESS),
@@ -2207,14 +2207,14 @@ DECLINLINE(int) VMXReadVmcs32(uint32_t idxField, uint32_t *pData)
# if RT_INLINE_ASM_GNU_STYLE
int rc = VINF_SUCCESS;
__asm__ __volatile__ (
- "movl $"RT_XSTR(VINF_SUCCESS)", %0 \n\t"
+ "movl $" RT_XSTR(VINF_SUCCESS)", %0 \n\t"
".byte 0x0F, 0x78, 0xc2 # VMREAD eax, edx \n\t"
"ja 2f \n\t"
"je 1f \n\t"
- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0 \n\t"
"jmp 2f \n\t"
"1: \n\t"
- "movl $"RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t"
+ "movl $" RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0 \n\t"
"2: \n\t"
:"=&r"(rc),
"=d"(*pData)

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
vga_fb.patch
diff --git a/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp b/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp
index a21fe7e..5b3b9b3 100644
--- a/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA.cpp
@@ -3494,9 +3494,15 @@ static DECLCALLBACK(int) vgaR3LFBAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *p
int rc;
Assert(pThis);
Assert(GCPhys >= pThis->GCPhysVRAM);
+ Assert(GCPhys - pThis->GCPhysVRAM + cbBuf <= pThis->vram_size);
NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf); NOREF(enmAccessType);
- rc = vgaLFBAccess(pVM, pThis, GCPhys, 0);
+ rc = VINF_SUCCESS;
+ size_t offset = 0;
+ while (RT_SUCCESS(rc) && offset < cbBuf) {
+ rc = vgaLFBAccess(pVM, pThis, GCPhys + offset, 0);
+ offset += 1UL << PAGE_SHIFT;
+ }
if (RT_SUCCESS(rc))
return VINF_PGM_HANDLER_DO_DEFAULT;
AssertMsg(rc <= VINF_SUCCESS, ("rc=%Rrc\n", rc));

View File

@ -1,16 +0,0 @@
vga_vbva.patch
diff --git a/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp b/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
index 28ab4a8..1cc8e6b 100644
--- a/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
@@ -546,7 +546,8 @@ static int vbvaDisable (unsigned uScreenId, PVGASTATE pVGAState, VBVACONTEXT *pC
pView->u32VBVAOffset = HGSMIOFFSET_VOID;
}
- pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, uScreenId);
+ if (pVGAState->pDrv->pfnVBVADisable)
+ pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, uScreenId);
return VINF_SUCCESS;
}

Some files were not shown because too many files have changed in this diff Show More