diff options
1648 files changed, 46604 insertions, 7274 deletions
diff --git a/Config.kmk b/Config.kmk index 959cd73c6..6ee57e295 100644 --- a/Config.kmk +++ b/Config.kmk @@ -1,4 +1,4 @@ -# $Id: Config.kmk 21065 2009-06-30 11:03:08Z vboxsync $ +# $Id: Config.kmk $ ## @file # The global build configuration file for VBox. # @@ -150,7 +150,7 @@ VBOX_VERSION_MINOR = 0 # This is the current build number. It should be increased every time we publish a # new build. The define is available in every source file. Only even build numbers # will be published, odd numbers are set during development. -VBOX_VERSION_BUILD = 0 +VBOX_VERSION_BUILD = 2 # Full version string (may include more than just x.y.z, but no spaces or other problematic chars). VBOX_VERSION_STRING = $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) # Force the additions.sh script to get an exact additions build when we're doing the release. @@ -414,6 +414,10 @@ if1of ($(KBUILD_TARGET), darwin solaris linux win freebsd) endif # Enables the Python<->XPCOM and Python<->COM bindings. VBOX_WITH_PYTHON ?= 1 +# Build multiple Python<->XPCOM bridges for different Python version +ifn1of ($(KBUILD_TARGET), darwin) + VBOX_WITH_MULTIVERSION_PYTHON ?= 1 +endif # Enables hardening. # Most developers will want to disable this in their LocalConfig.kmk. ifn1of ($(KBUILD_TARGET), win) @@ -660,7 +664,7 @@ ifdef VBOX_OSE VBOX_WITH_USB= VBOX_WITH_EHCI= VBOX_WITH_VMI= - ifn1of ($(KBUILD_TARGET), darwin linux solaris) + ifn1of ($(KBUILD_TARGET), darwin linux solaris win) VBOX_WITH_NETFLT= endif VBOX_WITH_DEBUGGER= @@ -680,10 +684,6 @@ ifdef VBOX_OSE # Only the Linux, Solaris installers are public VBOX_WITH_INSTALLER= endif - VBOX_WITH_AHCI= - VBOX_WITH_BUSLOGIC= - VBOX_WITH_LSILOGIC= - VBOX_WITH_SCSI= VBOX_WITH_HPET= VBOX_WITH_LPC= VBOX_WITH_SMC= @@ -3783,7 +3783,7 @@ endif SVN ?= svn$(HOSTSUFF_EXE) VBOX_SVN_REV_KMK = $(PATH_OUT)/revision.kmk ifndef VBOX_SVN_REV - VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 21065 $ ) + VBOX_SVN_REV_FALLBACK := $(patsubst %:,, $Rev: 49928 $ ) VBOX_SVN_DEP := $(wildcard $(PATH_ROOT)/.svn/entries) ifeq ($(which $(SVN)),) VBOX_SVN_DEP := diff --git a/Makefile.kmk b/Makefile.kmk index bec42ed77..0393dd1a7 100644 --- a/Makefile.kmk +++ b/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20645 2009-06-16 18:41:16Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top level makefile. # diff --git a/configure.vbs b/configure.vbs index 9fbc61d0b..dbba81be2 100644 --- a/configure.vbs +++ b/configure.vbs @@ -1,4 +1,4 @@ -' $Id: configure.vbs 20258 2009-06-04 10:05:48Z vboxsync $
+' $Id: configure.vbs $
'' @file
' The purpose of this script is to check for all external tools, headers, and
' libraries VBox OSE depends on.
@@ -9,20 +9,20 @@ '
'
-' Copyright (C) 2006-2007 Sun Microsystems, Inc.
-'
-' 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.
-'
-' Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
-' Clara, CA 95054 USA or visit http://www.sun.com if you need
-' additional information or have any questions.
-'
+' Copyright (C) 2006-2007 Sun Microsystems, Inc. +' +' 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. +' +' Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa +' Clara, CA 95054 USA or visit http://www.sun.com if you need +' additional information or have any questions. +' '*****************************************************************************
diff --git a/doc/VBox-CodingGuidelines.cpp b/doc/VBox-CodingGuidelines.cpp index 89d425549..446852af7 100644 --- a/doc/VBox-CodingGuidelines.cpp +++ b/doc/VBox-CodingGuidelines.cpp @@ -1,4 +1,4 @@ -/* $Id: VBox-CodingGuidelines.cpp 19010 2009-04-19 16:07:51Z vboxsync $ */ +/* $Id: VBox-CodingGuidelines.cpp $ */ /** @file * VBox - Coding Guidelines. */ diff --git a/doc/VBox-MakefileGuidelines.cpp b/doc/VBox-MakefileGuidelines.cpp index 887e2c4f5..a271dadf1 100644 --- a/doc/VBox-MakefileGuidelines.cpp +++ b/doc/VBox-MakefileGuidelines.cpp @@ -1,4 +1,4 @@ -/* $Id: VBox-MakefileGuidelines.cpp 19033 2009-04-20 15:39:13Z vboxsync $ */ +/* $Id: VBox-MakefileGuidelines.cpp $ */ /** @file * VBox - Makefile Guidelines. */ diff --git a/doc/VBox-doc.c b/doc/VBox-doc.c index 79124c55a..3bb3d9e97 100644 --- a/doc/VBox-doc.c +++ b/doc/VBox-doc.c @@ -1,4 +1,4 @@ -/* $Id: VBox-doc.c 13001 2008-10-06 11:06:14Z vboxsync $ */ +/* $Id: VBox-doc.c $ */ /** @file * VirtualBox Top Level Documentation File. */ diff --git a/include/Makefile.kmk b/include/Makefile.kmk index 18d92fc19..8a5dedaa1 100644 --- a/include/Makefile.kmk +++ b/include/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18068 2009-03-18 14:42:47Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Some hacks to allow syntax and prerequisite include checking of headers. # This makefile doesn't and shouldn't build successfully. diff --git a/include/VBox/GuestHost/clipboard-helper.h b/include/VBox/GuestHost/clipboard-helper.h index 398a274ad..2b7575e68 100644 --- a/include/VBox/GuestHost/clipboard-helper.h +++ b/include/VBox/GuestHost/clipboard-helper.h @@ -1,4 +1,4 @@ -/* $Id: clipboard-helper.h 18824 2009-04-07 13:48:13Z vboxsync $ */ +/* $Id: clipboard-helper.h $ */ /** @file * Shared Clipboard: Some helper function for converting between the various eol. */ diff --git a/include/VBox/WinNetConfig.h b/include/VBox/WinNetConfig.h new file mode 100644 index 000000000..9ba99e561 --- /dev/null +++ b/include/VBox/WinNetConfig.h @@ -0,0 +1,125 @@ +/** @file + * VBoxNetFlt - Briefly describe this file, optionally with a longer description in a separate paragraph. + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * The contents of this file may alternatively be used under the terms + * of the Common Development and Distribution License Version 1.0 + * (CDDL) only, as it comes in the "COPYING.CDDL" file of the + * VirtualBox OSE distribution, in which case the provisions of the + * CDDL are applicable instead of those of the GPL. + * + * You may elect to license modified versions of this file under the + * terms and conditions of either the GPL or the CDDL or both. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. + *+--------------------------------------------------------------------------- + * + * Microsoft Windows + * Copyright (C) Microsoft Corporation, 2001. + * + * Author: Alok Sinha 15-May-01 + * + *---------------------------------------------------------------------------- + */ + +#ifndef ___VBox_WinNetConfig_h +#define ___VBox_WinNetConfig_h + +#include <winsock2.h> +#include <Windows.h> +#include <Netcfgn.h> +#include <Setupapi.h> +#include <iprt/cdefs.h> + +/** @defgroup grp_vboxnetcfgwin The Windows Network Configration Library + * @{ */ + +/** @def VBOXNETCFGWIN_DECL + * The usual declaration wrapper. + */ +#if 0 +/* enable this in case we include this in a dll*/ +# ifdef IN_VBOXDDU +# define VBOXNETCFGWIN_DECL(_type) DECLEXPORT(_type) +# else +# define VBOXNETCFGWIN_DECL(_type) DECLIMPORT(_type) +# endif +#else +/*enable this in case we include this in a static lib*/ +# define VBOXNETCFGWIN_DECL(_type) _type +#endif + +RT_C_DECLS_BEGIN + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinQueryINetCfg(IN BOOL fGetWriteLock, IN LPCWSTR lpszAppName, OUT INetCfg** ppnc, OUT LPWSTR *lpszLockedBy); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinReleaseINetCfg(IN INetCfg *pnc, IN BOOL fHasWriteLock); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetComponentEnum(INetCfg *pnc, IN const GUID *pguidClass, OUT IEnumNetCfgComponent **ppencc); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetFirstComponent(IN IEnumNetCfgComponent *pencc, OUT INetCfgComponent **ppncc); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetNextComponent(IN IEnumNetCfgComponent *pencc, OUT INetCfgComponent **ppncc); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinInstallComponent(IN INetCfg *pnc, IN LPCWSTR szComponentId, IN const GUID *pguidClass); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinInstallNetComponent(IN INetCfg *pnc, IN LPCWSTR lpszComponentId, IN const GUID *pguidClass, + IN LPCWSTR * apInfFullPaths, IN UINT cInfFullPaths); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinUninstallComponent(IN INetCfg *pnc, IN INetCfgComponent *pncc); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetNextBindingPath(IN IEnumNetCfgBindingPath *pencbp, OUT INetCfgBindingPath **ppncbp); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetNextBindingInterface(IN IEnumNetCfgBindingInterface *pencbi, OUT INetCfgBindingInterface **ppncbi); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetFirstBindingInterface(IN IEnumNetCfgBindingInterface *pencbi, OUT INetCfgBindingInterface **ppncbi); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetBindingInterfaceEnum(IN INetCfgBindingPath *pncbp, OUT IEnumNetCfgBindingInterface **ppencbi); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetFirstBindingPath(IN IEnumNetCfgBindingPath *pencbp, OUT INetCfgBindingPath **ppncbp); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetBindingPathEnum(IN INetCfgComponent *pncc, IN DWORD dwBindingType, OUT IEnumNetCfgBindingPath **ppencbp); +VBOXNETCFGWIN_DECL(VOID) VBoxNetCfgWinReleaseRef(IN IUnknown *punk); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetComponentByGuid(IN INetCfg *pNc, IN const GUID *pguidClass, IN const GUID * pComponentGuid, OUT INetCfgComponent **ppncc); + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltUninstall(IN INetCfg *pNc); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltInstall(IN INetCfg *pNc, IN LPCWSTR * apInfFullPaths, IN UINT cInfFullPaths); + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGenHostonlyConnectionName (PCWSTR DevName, WCHAR *pBuf, PULONG pcbBuf); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRenameConnection (LPWSTR pGuid, PCWSTR NewName); + +typedef BOOL (*VBOXNETCFGWIN_NETENUM_CALLBACK) (HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDev, PVOID pContext); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnumNetDevices(LPWSTR pPnPId, VBOXNETCFGWIN_NETENUM_CALLBACK callback, PVOID pContext); + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRemoveHostOnlyNetworkInterface (const GUID *pGUID, BSTR *pErrMsg); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRemoveAllNetDevicesOfId(LPWSTR pPnPId); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinCreateHostOnlyNetworkInterface (GUID *pGuid, BSTR *lppszName, BSTR *pErrMsg); + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinDhcpRediscover(const GUID *pGuid); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnableDynamicIpConfig(const GUID *pGuid); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnableStaticIpConfig(const GUID *pGuid, ULONG ip, ULONG mask); +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinIsDhcpEnabled(const GUID * pGuid, BOOL *pEnabled); + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGenHostOnlyNetworkNetworkIp(PULONG pNetIp, PULONG pNetMask); + +typedef struct _ADAPTER_SETTINGS +{ + ULONG ip; + ULONG mask; + BOOL bDhcp; +}ADAPTER_SETTINGS, *PADAPTER_SETTINGS; + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetAdapterSettings(const GUID * pGuid, PADAPTER_SETTINGS pSettings); + +typedef VOID (*LOG_ROUTINE) (LPCWSTR szString); +VBOXNETCFGWIN_DECL(VOID) VBoxNetCfgWinSetLogging(LOG_ROUTINE Log); + +RT_C_DECLS_END + +/** @} */ + +#endif + diff --git a/include/VBox/bioslogo.h b/include/VBox/bioslogo.h index ad2a4f1a1..d5d21e53d 100644 --- a/include/VBox/bioslogo.h +++ b/include/VBox/bioslogo.h @@ -1,4 +1,4 @@ -/* $Id: bioslogo.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: bioslogo.h $ */ /** @file * BiosLogo - The Private BIOS Logo Interface. */ diff --git a/include/VBox/com/Guid.h b/include/VBox/com/Guid.h index 89b65cbe5..616a99636 100644 --- a/include/VBox/com/Guid.h +++ b/include/VBox/com/Guid.h @@ -1,4 +1,4 @@ -/* $Id: Guid.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: Guid.h $ */ /** @file * MS COM / XPCOM Abstraction Layer: diff --git a/include/VBox/com/SupportErrorInfo.h b/include/VBox/com/SupportErrorInfo.h index 4f62b98d9..54cada288 100644 --- a/include/VBox/com/SupportErrorInfo.h +++ b/include/VBox/com/SupportErrorInfo.h @@ -1,4 +1,4 @@ -/* $Id: SupportErrorInfo.h 17911 2009-03-16 10:30:55Z vboxsync $ */ +/* $Id: SupportErrorInfo.h $ */ /** @file * MS COM / XPCOM Abstraction Layer: diff --git a/include/VBox/com/VirtualBoxErrorInfo.h b/include/VBox/com/VirtualBoxErrorInfo.h index 75054325b..a2bc68e11 100644 --- a/include/VBox/com/VirtualBoxErrorInfo.h +++ b/include/VBox/com/VirtualBoxErrorInfo.h @@ -1,4 +1,4 @@ -/* $Id: VirtualBoxErrorInfo.h 20267 2009-06-04 11:27:27Z vboxsync $ */ +/* $Id: VirtualBoxErrorInfo.h $ */ /** @file * MS COM / XPCOM Abstraction Layer: diff --git a/include/VBox/com/string.h b/include/VBox/com/string.h index dfd71a3da..6e7e72604 100644 --- a/include/VBox/com/string.h +++ b/include/VBox/com/string.h @@ -1,4 +1,4 @@ -/* $Id: string.h 18589 2009-04-01 09:11:02Z vboxsync $ */ +/* $Id: string.h $ */ /** @file * MS COM / XPCOM Abstraction Layer: diff --git a/include/VBox/gvm.h b/include/VBox/gvm.h index ea617c53c..602f62ee7 100644 --- a/include/VBox/gvm.h +++ b/include/VBox/gvm.h @@ -1,4 +1,4 @@ -/* $Id: gvm.h 19395 2009-05-05 20:28:42Z vboxsync $ */ +/* $Id: gvm.h $ */ /** @file * GVM - The Global VM Data. */ diff --git a/include/VBox/gvmm.h b/include/VBox/gvmm.h index 0e31c4c09..d6b04088c 100644 --- a/include/VBox/gvmm.h +++ b/include/VBox/gvmm.h @@ -1,4 +1,4 @@ -/* $Id: gvmm.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: gvmm.h $ */ /** @file * GVMM - The Global VM Manager. */ diff --git a/include/VBox/pdmasynccompletion.h b/include/VBox/pdmasynccompletion.h index 4e1b8b8e7..c60c05ae5 100644 --- a/include/VBox/pdmasynccompletion.h +++ b/include/VBox/pdmasynccompletion.h @@ -1,4 +1,4 @@ -/* $Id: pdmasynccompletion.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: pdmasynccompletion.h $ */ /** @file * PDM - Pluggable Device Manager, Async I/O Completion. */ diff --git a/include/VBox/shflsvc.h b/include/VBox/shflsvc.h index c20fb573d..bc1e653a8 100644 --- a/include/VBox/shflsvc.h +++ b/include/VBox/shflsvc.h @@ -126,6 +126,8 @@ */ typedef uint32_t SHFLROOT; +#define SHFL_ROOT_NIL ((SHFLROOT)~0) + /** A shared folders handle for an opened object. */ typedef uint64_t SHFLHANDLE; diff --git a/include/VBox/sup.mac b/include/VBox/sup.mac index 87d6b56cf..ed0cf2352 100644 --- a/include/VBox/sup.mac +++ b/include/VBox/sup.mac @@ -1,4 +1,4 @@ -; $Id: sup.mac 8155 2008-04-18 15:16:47Z vboxsync $ +; $Id: sup.mac $ ;; @file ; SUP - Support Library, assembly definitions. ; diff --git a/include/VBox/uvm.h b/include/VBox/uvm.h index f7a25d3f7..a1f7ed547 100644 --- a/include/VBox/uvm.h +++ b/include/VBox/uvm.h @@ -1,4 +1,4 @@ -/* $Id: uvm.h 19217 2009-04-27 15:00:59Z vboxsync $ */ +/* $Id: uvm.h $ */ /** @file * GVM - The Global VM Data. */ diff --git a/include/VBox/vm.h b/include/VBox/vm.h index fe9f71dae..62364a41c 100644 --- a/include/VBox/vm.h +++ b/include/VBox/vm.h @@ -477,7 +477,7 @@ typedef struct VMCPU * @param pVM VM Handle. * @param iBit Bit position to check and clear */ -#define VM_FF_TESTANDCLEAR(pVM, iBit) (ASMBitTestAndClear(&(pVM)->fGlobalForcedActions, iBit)) +#define VM_FF_TESTANDCLEAR(pVM, iBit) (ASMAtomicBitTestAndClear(&(pVM)->fGlobalForcedActions, iBit##_BIT)) /** @def VMCPU_FF_TESTANDCLEAR * Checks if one (!) force action in the specified set is pending and clears it atomically @@ -487,7 +487,7 @@ typedef struct VMCPU * @param pVCpu VMCPU Handle. * @param iBit Bit position to check and clear */ -#define VMCPU_FF_TESTANDCLEAR(pVCpu, iBit) (ASMBitTestAndClear(&(pVCpu)->fLocalForcedActions, iBit)) +#define VMCPU_FF_TESTANDCLEAR(pVCpu, iBit) (ASMAtomicBitTestAndClear(&(pVCpu)->fLocalForcedActions, iBit##_BIT)) /** @def VMCPU_FF_ISPENDING * Checks if one or more force action in the specified set is pending for the given VCPU. diff --git a/include/iprt/dbg.h b/include/iprt/dbg.h index 4cefbfa71..168ea0f9b 100644 --- a/include/iprt/dbg.h +++ b/include/iprt/dbg.h @@ -1,4 +1,4 @@ -/* $Id: dbg.h 20801 2009-06-23 00:10:32Z vboxsync $ */ +/* $Id: dbg.h $ */ /** @file * IPRT - Debugging Routines. */ diff --git a/include/iprt/linux/sysfs.h b/include/iprt/linux/sysfs.h index bc3c60afe..f273f0baa 100644 --- a/include/iprt/linux/sysfs.h +++ b/include/iprt/linux/sysfs.h @@ -1,4 +1,4 @@ -/* $Id: sysfs.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: sysfs.h $ */ /** @file * IPRT - Linux sysfs access. */ diff --git a/include/iprt/s3.h b/include/iprt/s3.h index b6b7f908f..6293b1218 100644 --- a/include/iprt/s3.h +++ b/include/iprt/s3.h @@ -1,4 +1,4 @@ -/* $Id: s3.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: s3.h $ */ /** @file * IPRT - Simple Storage Service (S3) Communication API. */ diff --git a/include/iprt/strcache.h b/include/iprt/strcache.h index 7d783b0e0..38ecd6bbd 100644 --- a/include/iprt/strcache.h +++ b/include/iprt/strcache.h @@ -1,4 +1,4 @@ -/* $Id: strcache.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: strcache.h $ */ /** @file * IPRT - String Cache, stub implementation. */ diff --git a/include/iprt/timer.h b/include/iprt/timer.h index ced48157d..f629bb8ce 100644 --- a/include/iprt/timer.h +++ b/include/iprt/timer.h @@ -230,8 +230,8 @@ RTDECL(int) RTTimerReleaseSystemGranularity(uint32_t u32Granted); * @param hTimerLR The low resolution timer handle. * @param pvUser User argument. * @param iTick The current timer tick. This is always 1 on the first - * callback after the timer was started. For omni timers - * this will be 1 when a cpu comes back online. + * callback after the timer was started. Will jump if we've + * skipped ticks when lagging behind. */ typedef DECLCALLBACK(void) FNRTTIMERLR(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick); /** Pointer to FNRTTIMER() function. */ diff --git a/src/Makefile.kmk b/src/Makefile.kmk index 416e884de..6f87bff9d 100644 --- a/src/Makefile.kmk +++ b/src/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19297 2009-05-01 17:03:40Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for the src directory. # diff --git a/src/VBox/Additions/Makefile.kmk b/src/VBox/Additions/Makefile.kmk index f295a2c0f..1323b3993 100644 --- a/src/VBox/Additions/Makefile.kmk +++ b/src/VBox/Additions/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18377 2009-03-27 10:44:02Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for the VirtualBox Guest Additions. # diff --git a/src/VBox/Additions/common/Makefile.kmk b/src/VBox/Additions/common/Makefile.kmk index b91da7316..220cc2614 100644 --- a/src/VBox/Additions/common/Makefile.kmk +++ b/src/VBox/Additions/common/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19517 2009-05-08 11:49:52Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the common addition code. # diff --git a/src/VBox/Additions/common/VBoxControl/Makefile.kmk b/src/VBox/Additions/common/VBoxControl/Makefile.kmk index d90b931d3..dee9d172e 100644 --- a/src/VBox/Additions/common/VBoxControl/Makefile.kmk +++ b/src/VBox/Additions/common/VBoxControl/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 14220 2008-11-14 15:05:30Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Guest Additions Command Line Management Interface. # diff --git a/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp b/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp index ee47c20c2..244fbf261 100644 --- a/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp +++ b/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp @@ -1,4 +1,4 @@ -/** $Id: VBoxControl.cpp 18509 2009-03-29 02:48:19Z vboxsync $ */ +/** $Id: VBoxControl.cpp $ */ /** @file * VBoxControl - Guest Additions Command Line Management Interface */ diff --git a/src/VBox/Additions/common/VBoxControl/VBoxControlSVN.cpp b/src/VBox/Additions/common/VBoxControl/VBoxControlSVN.cpp index 847044616..babb7e839 100644 --- a/src/VBox/Additions/common/VBoxControl/VBoxControlSVN.cpp +++ b/src/VBox/Additions/common/VBoxControl/VBoxControlSVN.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxControlSVN.cpp 10099 2008-07-02 12:40:08Z vboxsync $ */ +/* $Id: VBoxControlSVN.cpp $ */ /** @file * VBoxControl - Guest Additions Command Line Management Interface * SVN revision. diff --git a/src/VBox/Additions/common/VBoxControl/testcase/Makefile.kmk b/src/VBox/Additions/common/VBoxControl/testcase/Makefile.kmk index 8ae7d3d78..0ec0c73fb 100644 --- a/src/VBox/Additions/common/VBoxControl/testcase/Makefile.kmk +++ b/src/VBox/Additions/common/VBoxControl/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 14233 2008-11-17 07:32:42Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VBoxControl testcases. # diff --git a/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp b/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp index a28b9887e..b3aa5b2f4 100644 --- a/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp +++ b/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp @@ -1,4 +1,4 @@ -/** $Id: tstVBoxControl.cpp 14233 2008-11-17 07:32:42Z vboxsync $ */ +/** $Id: tstVBoxControl.cpp $ */ /** @file * VBoxControl - Guest Additions Command Line Management Interface, test case */ diff --git a/src/VBox/Additions/common/VBoxGuest/Makefile.kmk b/src/VBox/Additions/common/VBoxGuest/Makefile.kmk index 5284b0263..40ad23c7e 100644 --- a/src/VBox/Additions/common/VBoxGuest/Makefile.kmk +++ b/src/VBox/Additions/common/VBoxGuest/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 16013 2009-01-17 23:58:41Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Makefile for the Cross Platform Guest Additions Driver. # diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c index a1f7efda6..0749d2384 100644 --- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c +++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: VBoxGuest-freebsd.c 8250 2008-04-21 18:42:58Z vboxsync $ */ +/* $Id: VBoxGuest-freebsd.c $ */ /** @file * VirtualBox Guest Additions Driver for FreeBSD. */ @@ -558,7 +558,7 @@ static int VBoxGuestFreeBSDAttach(device_t pDevice) * Call the common device extension initializer. */ rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, - pState->VMMDevMemSize, VBOXOSTYPE_FreeBSD); + pState->VMMDevMemSize, VBOXOSTYPE_FreeBSD, 0); if (RT_SUCCESS(rc)) { /* diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp index d6e43cbc8..0798c6760 100644 --- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp +++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxGuest-os2.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxGuest-os2.cpp $ */ /** @file * VBoxGuest - OS/2 specifics. */ diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.def b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.def index b44c50edc..d41ee37de 100644 --- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.def +++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.def @@ -1,4 +1,4 @@ -; $Id: VBoxGuest-os2.def 8155 2008-04-18 15:16:47Z vboxsync $ +; $Id: VBoxGuest-os2.def $ ;; @file ; VBoxGuest - OS/2 definition file. ; diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c index 664493a48..032aa55a4 100644 --- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c +++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c @@ -1,4 +1,4 @@ -/* $Id: VBoxGuest-solaris.c 14203 2008-11-14 11:04:50Z vboxsync $ */ +/* $Id: VBoxGuest-solaris.c $ */ /** @file * VirtualBox Guest Additions Driver for Solaris. */ @@ -41,6 +41,8 @@ #include <iprt/initterm.h> #include <iprt/process.h> #include <iprt/mem.h> +#include <iprt/cdefs.h> +#include <iprt/asm.h> /******************************************************************************* @@ -62,13 +64,14 @@ static int VBoxGuestSolarisClose(dev_t Dev, int fFlag, int fType, cred_t *pCred) static int VBoxGuestSolarisRead(dev_t Dev, struct uio *pUio, cred_t *pCred); static int VBoxGuestSolarisWrite(dev_t Dev, struct uio *pUio, cred_t *pCred); static int VBoxGuestSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArg, int Mode, cred_t *pCred, int *pVal); +static int VBoxGuestSolarisPoll(dev_t Dev, short fEvents, int fAnyYet, short *pReqEvents, struct pollhead **ppPollHead); static int VBoxGuestSolarisGetInfo(dev_info_t *pDip, ddi_info_cmd_t enmCmd, void *pArg, void **ppResult); static int VBoxGuestSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd); static int VBoxGuestSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd); -static int VBoxGuestSolarisAddIRQ(dev_info_t *pDip, void *pvState); -static void VBoxGuestSolarisRemoveIRQ(dev_info_t *pDip, void *pvState); +static int VBoxGuestSolarisAddIRQ(dev_info_t *pDip); +static void VBoxGuestSolarisRemoveIRQ(dev_info_t *pDip); static uint_t VBoxGuestSolarisISR(caddr_t Arg); DECLVBGL(int) VBoxGuestSolarisServiceCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned); @@ -95,7 +98,7 @@ static struct cb_ops g_VBoxGuestSolarisCbOps = nodev, /* c devmap */ nodev, /* c mmap */ nodev, /* c segmap */ - nochpoll, /* c poll */ + VBoxGuestSolarisPoll, ddi_prop_op, /* property ops */ NULL, /* streamtab */ D_NEW | D_MP, /* compat. flag */ @@ -145,32 +148,10 @@ static struct modlinkage g_VBoxGuestSolarisModLinkage = */ typedef struct { - /** IO port handle. */ - ddi_acc_handle_t PciIOHandle; - /** MMIO handle. */ - ddi_acc_handle_t PciMMIOHandle; -#if 0 - /** Interrupt block cookie. */ - ddi_iblock_cookie_t BlockCookie; -#endif - /** Driver Mutex. */ - kmutex_t Mtx; - /** IO Port. */ - uint16_t uIOPortBase; - /** Address of the MMIO region.*/ - caddr_t pMMIOBase; - /** Size of the MMIO region. */ - off_t cbMMIO; - /** VMMDev Version. */ - uint32_t u32Version; - /** Pointer to the interrupt handle vector */ - ddi_intr_handle_t *pIntr; - /** Number of actually allocated interrupt handles */ - size_t cIntrAllocated; -#ifndef USE_SESSION_HASH /** Pointer to the session handle. */ PVBOXGUESTSESSION pSession; -#endif + /** The process reference for posting signals */ + void *pvProcRef; } vboxguest_state_t; @@ -178,24 +159,32 @@ typedef struct * Global Variables * *******************************************************************************/ /** Device handle (we support only one instance). */ -static dev_info_t *g_pDip; - -/** Opaque pointer to state */ -static void *g_pVBoxGuestSolarisState; - +static dev_info_t *g_pDip = NULL; +/** Opaque pointer to file-descriptor states */ +static void *g_pVBoxGuestSolarisState = NULL; /** Device extention & session data association structure. */ static VBOXGUESTDEVEXT g_DevExt; -/** Spinlock protecting g_apSessionHashTab. */ -static RTSPINLOCK g_Spinlock = NIL_RTSPINLOCK; -#ifdef USE_SESSION_HASH -/** Hash table */ -static PVBOXGUESTSESSION g_apSessionHashTab[19]; -/** Calculates the index into g_apSessionHashTab.*/ -#define SESSION_HASH(sfn) ((sfn) % RT_ELEMENTS(g_apSessionHashTab)) -#endif /* USE_SESSION_HASH */ - -/** GCC C++ hack. */ -unsigned __gxx_personality_v0 = 0xdecea5ed; +/** IO port handle. */ +static ddi_acc_handle_t g_PciIOHandle; +/** MMIO handle. */ +static ddi_acc_handle_t g_PciMMIOHandle; +/** IO Port. */ +static uint16_t g_uIOPortBase; +/** Address of the MMIO region.*/ +static caddr_t g_pMMIOBase; +/** Size of the MMIO region. */ +static off_t g_cbMMIO; +/** VMMDev Version. */ +static uint32_t g_u32Version; +/** Pointer to the interrupt handle vector */ +static ddi_intr_handle_t *g_pIntr; +/** Number of actually allocated interrupt handles */ +static size_t g_cIntrAllocated; +/** The pollhead structure */ +static pollhead_t g_PollHead; +/** The IRQ Mutex */ +static kmutex_t g_IrqMtx; + /** * Kernel entry points @@ -246,34 +235,16 @@ static int VBoxGuestSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd) { case DDI_ATTACH: { - int rc; - int instance; - vboxguest_state_t *pState; - - instance = ddi_get_instance(pDip); -#ifdef USE_SESSION_HASH - rc = ddi_soft_state_zalloc(g_pVBoxGuestSolarisState, instance); - if (rc != DDI_SUCCESS) + if (g_pDip) { - Log((DEVICE_NAME ":ddi_soft_state_zalloc failed.\n")); + LogRel((DEVICE_NAME "::Attach: Only one instance supported.\n")); return DDI_FAILURE; } - pState = ddi_get_soft_state(g_pVBoxGuestSolarisState, instance); - if (!pState) - { - ddi_soft_state_free(g_pVBoxGuestSolarisState, instance); - Log((DEVICE_NAME ":ddi_get_soft_state for instance %d failed\n", instance)); - return DDI_FAILURE; - } -#else - pState = RTMemAllocZ(sizeof(vboxguest_state_t)); - if (!pState) - { - Log((DEVICE_NAME ":RTMemAllocZ failed to allocate %d bytes\n", sizeof(vboxguest_state_t))); - return DDI_FAILURE; - } -#endif + int rc; + int instance; + + instance = ddi_get_instance(pDip); /* * Initialize IPRT R0 driver, which internally calls OS-specific r0 init. @@ -281,97 +252,86 @@ static int VBoxGuestSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd) rc = RTR0Init(0); if (RT_FAILURE(rc)) { - Log((DEVICE_NAME ":RTR0Init failed.\n")); + Log((DEVICE_NAME "::Attach: RTR0Init failed.\n")); return DDI_FAILURE; } /* - * Initialize the session hash table. + * Enable resources for PCI access. */ - rc = RTSpinlockCreate(&g_Spinlock); - if (RT_SUCCESS(rc)) + ddi_acc_handle_t PciHandle; + rc = pci_config_setup(pDip, &PciHandle); + if (rc == DDI_SUCCESS) { /* - * Enable resources for PCI access. + * Map the register address space. */ - ddi_acc_handle_t PciHandle; - rc = pci_config_setup(pDip, &PciHandle); + caddr_t baseAddr; + ddi_device_acc_attr_t deviceAttr; + deviceAttr.devacc_attr_version = DDI_DEVICE_ATTR_V0; + deviceAttr.devacc_attr_endian_flags = DDI_NEVERSWAP_ACC; + deviceAttr.devacc_attr_dataorder = DDI_STRICTORDER_ACC; + deviceAttr.devacc_attr_access = DDI_DEFAULT_ACC; + rc = ddi_regs_map_setup(pDip, 1, &baseAddr, 0, 0, &deviceAttr, &g_PciIOHandle); if (rc == DDI_SUCCESS) { /* - * Map the register address space. + * Read size of the MMIO region. */ - caddr_t baseAddr; - ddi_device_acc_attr_t deviceAttr; - deviceAttr.devacc_attr_version = DDI_DEVICE_ATTR_V0; - deviceAttr.devacc_attr_endian_flags = DDI_NEVERSWAP_ACC; - deviceAttr.devacc_attr_dataorder = DDI_STRICTORDER_ACC; - deviceAttr.devacc_attr_access = DDI_DEFAULT_ACC; - rc = ddi_regs_map_setup(pDip, 1, &baseAddr, 0, 0, &deviceAttr, &pState->PciIOHandle); + g_uIOPortBase = (uintptr_t)baseAddr; + rc = ddi_dev_regsize(pDip, 2, &g_cbMMIO); if (rc == DDI_SUCCESS) { - /* - * Read size of the MMIO region. - */ - pState->uIOPortBase = (uintptr_t)baseAddr; - rc = ddi_dev_regsize(pDip, 2, &pState->cbMMIO); + rc = ddi_regs_map_setup(pDip, 2, &g_pMMIOBase, 0, g_cbMMIO, &deviceAttr, + &g_PciMMIOHandle); if (rc == DDI_SUCCESS) { - rc = ddi_regs_map_setup(pDip, 2, &pState->pMMIOBase, 0, pState->cbMMIO, &deviceAttr, - &pState->PciMMIOHandle); + /* + * Add IRQ of VMMDev. + */ + rc = VBoxGuestSolarisAddIRQ(pDip); if (rc == DDI_SUCCESS) { /* - * Add IRQ of VMMDev. + * Call the common device extension initializer. */ - rc = VBoxGuestSolarisAddIRQ(pDip, pState); - if (rc == DDI_SUCCESS) + rc = VBoxGuestInitDevExt(&g_DevExt, g_uIOPortBase, g_pMMIOBase, + g_cbMMIO, VBOXOSTYPE_Solaris, + VMMDEV_EVENT_MOUSE_POSITION_CHANGED); + if (RT_SUCCESS(rc)) { - /* - * Call the common device extension initializer. - */ - rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, - pState->cbMMIO, VBOXOSTYPE_Solaris); - if (RT_SUCCESS(rc)) + rc = ddi_create_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, 0); + if (rc == DDI_SUCCESS) { - rc = ddi_create_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, 0); - if (rc == DDI_SUCCESS) - { - g_pDip = pDip; - ddi_set_driver_private(pDip, pState); - pci_config_teardown(&PciHandle); - ddi_report_dev(pDip); - return DDI_SUCCESS; - } - - LogRel((DEVICE_NAME ":ddi_create_minor_node failed.\n")); + g_pDip = pDip; + pci_config_teardown(&PciHandle); + return DDI_SUCCESS; } - else - LogRel((DEVICE_NAME ":VBoxGuestInitDevExt failed.\n")); - VBoxGuestSolarisRemoveIRQ(pDip, pState); + + LogRel((DEVICE_NAME "::Attach: ddi_create_minor_node failed.\n")); + VBoxGuestDeleteDevExt(&g_DevExt); } else - LogRel((DEVICE_NAME ":VBoxGuestSolarisAddIRQ failed.\n")); - ddi_regs_map_free(&pState->PciMMIOHandle); + LogRel((DEVICE_NAME "::Attach: VBoxGuestInitDevExt failed.\n")); + VBoxGuestSolarisRemoveIRQ(pDip); } else - LogRel((DEVICE_NAME ":ddi_regs_map_setup for MMIO region failed.\n")); + LogRel((DEVICE_NAME "::Attach: VBoxGuestSolarisAddIRQ failed.\n")); + ddi_regs_map_free(&g_PciMMIOHandle); } else - LogRel((DEVICE_NAME ":ddi_dev_regsize for MMIO region failed.\n")); - ddi_regs_map_free(&pState->PciIOHandle); + LogRel((DEVICE_NAME "::Attach: ddi_regs_map_setup for MMIO region failed.\n")); } else - LogRel((DEVICE_NAME ":ddi_regs_map_setup for IOport failed.\n")); - pci_config_teardown(&PciHandle); + LogRel((DEVICE_NAME "::Attach: ddi_dev_regsize for MMIO region failed.\n")); + ddi_regs_map_free(&g_PciIOHandle); } else - LogRel((DEVICE_NAME ":pci_config_setup failed rc=%d.\n", rc)); - RTSpinlockDestroy(g_Spinlock); - g_Spinlock = NIL_RTSPINLOCK; + LogRel((DEVICE_NAME "::Attach: ddi_regs_map_setup for IOport failed.\n")); + pci_config_teardown(&PciHandle); } else - LogRel((DEVICE_NAME ":RTSpinlockCreate failed.\n")); + LogRel((DEVICE_NAME "::Attach: pci_config_setup failed rc=%d.\n", rc)); RTR0Term(); return DDI_FAILURE; @@ -404,34 +364,13 @@ static int VBoxGuestSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd) { case DDI_DETACH: { - int rc; - int instance = ddi_get_instance(pDip); -#ifdef USE_SESSION_HASH - vboxguest_state_t *pState = ddi_get_soft_state(g_pVBoxGuestSolarisState, instance); -#else - vboxguest_state_t *pState = ddi_get_driver_private(g_pDip); -#endif - if (pState) - { - VBoxGuestSolarisRemoveIRQ(pDip, pState); - ddi_regs_map_free(&pState->PciIOHandle); - ddi_regs_map_free(&pState->PciMMIOHandle); - ddi_remove_minor_node(pDip, NULL); -#ifdef USE_SESSION_HASH - ddi_soft_state_free(g_pVBoxGuestSolarisState, instance); -#else - RTMemFree(pState); -#endif + VBoxGuestSolarisRemoveIRQ(pDip); + ddi_regs_map_free(&g_PciIOHandle); + ddi_regs_map_free(&g_PciMMIOHandle); + ddi_remove_minor_node(pDip, NULL); - rc = RTSpinlockDestroy(g_Spinlock); - AssertRC(rc); - g_Spinlock = NIL_RTSPINLOCK; - - RTR0Term(); - return DDI_SUCCESS; - } - Log((DEVICE_NAME ":ddi_get_soft_state failed. Cannot detach instance %d\n", instance)); - return DDI_FAILURE; + RTR0Term(); + return DDI_SUCCESS; } case DDI_SUSPEND: @@ -497,7 +436,6 @@ static int VBoxGuestSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred if (fType != OTYP_CHR) return EINVAL; -#ifndef USE_SESSION_HASH vboxguest_state_t *pState = NULL; unsigned iOpenInstance; for (iOpenInstance = 0; iOpenInstance < 4096; iOpenInstance++) @@ -521,6 +459,7 @@ static int VBoxGuestSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession); if (RT_SUCCESS(rc)) { + pState->pvProcRef = proc_ref(); pState->pSession = pSession; *pDev = makedevice(getmajor(*pDev), iOpenInstance); Log((DEVICE_NAME "VBoxGuestSolarisOpen: pSession=%p pState=%p pid=%d\n", pSession, pState, (int)RTProcSelf())); @@ -529,40 +468,7 @@ static int VBoxGuestSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred /* Failed, clean up. */ ddi_soft_state_free(g_pVBoxGuestSolarisState, iOpenInstance); -#else - /* - * Create a new session. - */ - rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession); - if (RT_SUCCESS(rc)) - { - /* - * Insert it into the hash table. - */ - unsigned iHash = SESSION_HASH(pSession->Process); - RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; - RTSpinlockAcquireNoInts(g_Spinlock, &Tmp); - pSession->pNextHash = g_apSessionHashTab[iHash]; - g_apSessionHashTab[iHash] = pSession; - RTSpinlockReleaseNoInts(g_Spinlock, &Tmp); - - int instance; - for (instance = 0; instance < 4096; instance++) - { - vboxguest_state_t *pState = ddi_get_soft_state(g_pVBoxGuestSolarisState, instance); - if (pState) - break; - } - if (instance >= 4096) - { - Log((DEVICE_NAME ":VBoxGuestSolarisOpen: All instances exhausted\n")); - return ENXIO; - } - *pDev = makedevice(getmajor(*pDev), instance); - Log((DEVICE_NAME ":VBoxGuestSolarisOpen success: g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf())); - return 0; - } -#endif + LogRel((DEVICE_NAME ":VBoxGuestSolarisOpen: VBoxGuestCreateUserSession failed. rc=%d\n", rc)); return EFAULT; } @@ -572,7 +478,6 @@ static int VBoxGuestSolarisClose(dev_t Dev, int flag, int fType, cred_t *pCred) { LogFlow((DEVICE_NAME ":VBoxGuestSolarisClose pid=%d\n", (int)RTProcSelf())); -#ifndef USE_SESSION_HASH PVBOXGUESTSESSION pSession; vboxguest_state_t *pState = ddi_get_soft_state(g_pVBoxGuestSolarisState, getminor(Dev)); if (!pState) @@ -581,6 +486,7 @@ static int VBoxGuestSolarisClose(dev_t Dev, int flag, int fType, cred_t *pCred) return EFAULT; } + proc_unref(pState->pvProcRef); pSession = pState->pSession; pState->pSession = NULL; Log((DEVICE_NAME ":VBoxGuestSolarisClose: pSession=%p pState=%p\n", pSession, pState)); @@ -591,52 +497,6 @@ static int VBoxGuestSolarisClose(dev_t Dev, int flag, int fType, cred_t *pCred) return EFAULT; } -#else /* USE_SESSION_HASH */ - /* - * Remove from the hash table. - */ - PVBOXGUESTSESSION pSession; - const RTPROCESS Process = RTProcSelf(); - const unsigned iHash = SESSION_HASH(Process); - RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; - RTSpinlockAcquireNoInts(g_Spinlock, &Tmp); - - pSession = g_apSessionHashTab[iHash]; - if (pSession) - { - if (pSession->Process == Process) - { - g_apSessionHashTab[iHash] = pSession->pNextHash; - pSession->pNextHash = NULL; - } - else - { - PVBOXGUESTSESSION pPrev = pSession; - pSession = pSession->pNextHash; - while (pSession) - { - if (pSession->Process == Process) - { - pPrev->pNextHash = pSession->pNextHash; - pSession->pNextHash = NULL; - break; - } - - /* next */ - pPrev = pSession; - pSession = pSession->pNextHash; - } - } - } - RTSpinlockReleaseNoInts(g_Spinlock, &Tmp); - if (!pSession) - { - Log((DEVICE_NAME ":VBoxGuestSolarisClose: WHUT?!? pSession == NULL! This must be a mistake... pid=%d", (int)Process)); - return EFAULT; - } - Log((DEVICE_NAME ":VBoxGuestSolarisClose: pid=%d\n", (int)Process)); -#endif /* USE_SESSION_HASH */ - /* * Close the session. */ @@ -648,6 +508,19 @@ static int VBoxGuestSolarisClose(dev_t Dev, int flag, int fType, cred_t *pCred) static int VBoxGuestSolarisRead(dev_t Dev, struct uio *pUio, cred_t *pCred) { LogFlow((DEVICE_NAME ":VBoxGuestSolarisRead\n")); + + PVBOXGUESTSESSION pSession; + vboxguest_state_t *pState = ddi_get_soft_state(g_pVBoxGuestSolarisState, getminor(Dev)); + if (!pState) + { + Log((DEVICE_NAME "::Close: failed to get pState.\n")); + return EFAULT; + } + + uint32_t u32CurSeq = ASMAtomicUoReadU32(&g_DevExt.u32MousePosChangedSeq); + if (pSession->u32MousePosChangedSeq != u32CurSeq) + pSession->u32MousePosChangedSeq = u32CurSeq; + return 0; } @@ -684,7 +557,6 @@ static int VBoxGuestSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArg, int Mode, cr { LogFlow((DEVICE_NAME ":VBoxGuestSolarisIOCtl\n")); -#ifndef USE_SESSION_HASH /* * Get the session from the soft state item. */ @@ -702,30 +574,6 @@ static int VBoxGuestSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArg, int Mode, cr return EINVAL; } -#else /* USE_SESSION_HASH */ - RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; - const RTPROCESS Process = RTProcSelf(); - const unsigned iHash = SESSION_HASH(Process); - PVBOXGUESTSESSION pSession; - - /* - * Find the session. - */ - RTSpinlockAcquireNoInts(g_Spinlock, &Tmp); - pSession = g_apSessionHashTab[iHash]; - if (pSession && pSession->Process != Process) - { - do pSession = pSession->pNextHash; - while (pSession && pSession->Process != Process); - } - RTSpinlockReleaseNoInts(g_Spinlock, &Tmp); - if (!pSession) - { - Log((DEVICE_NAME ":VBoxGuestSolarisIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x\n", (int)Process, Cmd)); - return EINVAL; - } -#endif /* USE_SESSION_HASH */ - /* * Read and validate the request wrapper. */ @@ -815,36 +663,47 @@ static int VBoxGuestSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArg, int Mode, cr } +static int VBoxGuestSolarisPoll(dev_t Dev, short fEvents, int fAnyYet, short *pReqEvents, struct pollhead **ppPollHead) +{ + LogFlow((DEVICE_NAME "::Poll: fEvents=%d fAnyYet=%d\n", fEvents, fAnyYet)); + + vboxguest_state_t *pState = ddi_get_soft_state(g_pVBoxGuestSolarisState, getminor(Dev)); + if (RT_LIKELY(pState)) + { + PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pState->pSession; + uint32_t u32CurSeq = ASMAtomicUoReadU32(&g_DevExt.u32MousePosChangedSeq); + if (pSession->u32MousePosChangedSeq != u32CurSeq) + { + *pReqEvents |= (POLLIN | POLLRDNORM); + pSession->u32MousePosChangedSeq = u32CurSeq; + } + else + { + *pReqEvents = 0; + if (!fAnyYet) + *ppPollHead = &g_PollHead; + } + + return 0; + } + else + { + Log((DEVICE_NAME "::Poll: no state data for %d\n", getminor(Dev))); + return EINVAL; + } +} + + /** * Sets IRQ for VMMDev. * * @returns Solaris error code. * @param pDip Pointer to the device info structure. - * @param pvState Pointer to the state info structure. */ -static int VBoxGuestSolarisAddIRQ(dev_info_t *pDip, void *pvState) +static int VBoxGuestSolarisAddIRQ(dev_info_t *pDip) { - LogFlow((DEVICE_NAME ":VBoxGuestSolarisAddIRQ %p\n", pvState)); + LogFlow((DEVICE_NAME "::AddIRQ: pDip=%p\n", pDip)); - vboxguest_state_t *pState = (vboxguest_state_t *)pvState; -#if 0 - /* - * These calls are supposedly deprecated. But Sun seems to use them all over - * the place. Anyway, once this works we will switch to the highly elaborate - * and non-obsolete way of setting up IRQs. - */ - int rc = ddi_get_iblock_cookie(pDip, 0, &pState->BlockCookie); - if (rc == DDI_SUCCESS) - { - mutex_init(&pState->Mtx, "VBoxGuest Driver Mutex", MUTEX_DRIVER, (void *)pState->BlockCookie); - rc = ddi_add_intr(pDip, 0, &pState->BlockCookie, NULL, VBoxGuestSolarisISR, (caddr_t)pState); - if (rc != DDI_SUCCESS) - Log((DEVICE_NAME ":ddi_add_intr failed. Cannot set IRQ for VMMDev.\n")); - } - else - Log((DEVICE_NAME ":ddi_get_iblock_cookie failed. Cannot set IRQ for VMMDev.\n")); - return rc; -#else int IntrType = 0; int rc = ddi_intr_get_supported_types(pDip, &IntrType); if (rc == DDI_SUCCESS) @@ -863,29 +722,29 @@ static int VBoxGuestSolarisAddIRQ(dev_info_t *pDip, void *pvState) && IntrAvail > 0) { /* Allocated kernel memory for the interrupt handles. The allocation size is stored internally. */ - pState->pIntr = RTMemAlloc(IntrCount * sizeof(ddi_intr_handle_t)); - if (pState->pIntr) + g_pIntr = RTMemAlloc(IntrCount * sizeof(ddi_intr_handle_t)); + if (g_pIntr) { int IntrAllocated; - rc = ddi_intr_alloc(pDip, pState->pIntr, IntrType, 0, IntrCount, &IntrAllocated, DDI_INTR_ALLOC_NORMAL); + rc = ddi_intr_alloc(pDip, g_pIntr, IntrType, 0, IntrCount, &IntrAllocated, DDI_INTR_ALLOC_NORMAL); if ( rc == DDI_SUCCESS && IntrAllocated > 0) { - pState->cIntrAllocated = IntrAllocated; + g_cIntrAllocated = IntrAllocated; uint_t uIntrPriority; - rc = ddi_intr_get_pri(pState->pIntr[0], &uIntrPriority); + rc = ddi_intr_get_pri(g_pIntr[0], &uIntrPriority); if (rc == DDI_SUCCESS) { /* Initialize the mutex. */ - mutex_init(&pState->Mtx, "VBoxGuestMtx", MUTEX_DRIVER, DDI_INTR_PRI(uIntrPriority)); + mutex_init(&g_IrqMtx, NULL, MUTEX_DRIVER, DDI_INTR_PRI(uIntrPriority)); /* Assign interrupt handler functions and enable interrupts. */ for (int i = 0; i < IntrAllocated; i++) { - rc = ddi_intr_add_handler(pState->pIntr[i], (ddi_intr_handler_t *)VBoxGuestSolarisISR, - (caddr_t)pState, NULL); + rc = ddi_intr_add_handler(g_pIntr[i], (ddi_intr_handler_t *)VBoxGuestSolarisISR, + NULL /* No Private Data */, NULL); if (rc == DDI_SUCCESS) - rc = ddi_intr_enable(pState->pIntr[i]); + rc = ddi_intr_enable(g_pIntr[i]); if (rc != DDI_SUCCESS) { /* Changing local IntrAllocated to hold so-far allocated handles for freeing. */ @@ -899,18 +758,18 @@ static int VBoxGuestSolarisAddIRQ(dev_info_t *pDip, void *pvState) /* Remove any assigned handlers */ LogRel((DEVICE_NAME ":failed to assign IRQs allocated=%d\n", IntrAllocated)); for (int x = 0; x < IntrAllocated; x++) - ddi_intr_remove_handler(pState->pIntr[x]); + ddi_intr_remove_handler(g_pIntr[x]); } else LogRel((DEVICE_NAME ":VBoxGuestSolarisAddIRQ: failed to get priority of interrupt. rc=%d\n", rc)); /* Remove allocated IRQs, too bad we can free only one handle at a time. */ - for (int k = 0; k < pState->cIntrAllocated; k++) - ddi_intr_free(pState->pIntr[k]); + for (int k = 0; k < g_cIntrAllocated; k++) + ddi_intr_free(g_pIntr[k]); } else LogRel((DEVICE_NAME ":VBoxGuestSolarisAddIRQ: failed to allocated IRQs. count=%d\n", IntrCount)); - RTMemFree(pState->pIntr); + RTMemFree(g_pIntr); } else LogRel((DEVICE_NAME ":VBoxGuestSolarisAddIRQ: failed to allocated IRQs. count=%d\n", IntrCount)); @@ -927,7 +786,6 @@ static int VBoxGuestSolarisAddIRQ(dev_info_t *pDip, void *pvState) else LogRel((DEVICE_NAME ":VBoxGuestSolarisAddIRQ: failed to get supported interrupt types\n")); return rc; -#endif } @@ -935,51 +793,55 @@ static int VBoxGuestSolarisAddIRQ(dev_info_t *pDip, void *pvState) * Removes IRQ for VMMDev. * * @param pDip Pointer to the device info structure. - * @param pvState Opaque pointer to the state info structure. */ -static void VBoxGuestSolarisRemoveIRQ(dev_info_t *pDip, void *pvState) +static void VBoxGuestSolarisRemoveIRQ(dev_info_t *pDip) { - vboxguest_state_t *pState = (vboxguest_state_t *)pvState; - LogFlow((DEVICE_NAME ":VBoxGuestSolarisRemoveIRQ pvState=%p\n")); - -#if 0 - ddi_remove_intr(pDip, 0, pState->BlockCookie); - mutex_destroy(&pState->Mtx); -#else - for (int i = 0; i < pState->cIntrAllocated; i++) + LogFlow((DEVICE_NAME "::RemoveIRQ:\n")); + + for (int i = 0; i < g_cIntrAllocated; i++) { - int rc = ddi_intr_disable(pState->pIntr[i]); + int rc = ddi_intr_disable(g_pIntr[i]); if (rc == DDI_SUCCESS) { - rc = ddi_intr_remove_handler(pState->pIntr[i]); + rc = ddi_intr_remove_handler(g_pIntr[i]); if (rc == DDI_SUCCESS) - ddi_intr_free(pState->pIntr[i]); + ddi_intr_free(g_pIntr[i]); } } - RTMemFree(pState->pIntr); - mutex_destroy(&pState->Mtx); -#endif + RTMemFree(g_pIntr); + mutex_destroy(&g_IrqMtx); } /** * Interrupt Service Routine for VMMDev. * + * @param Arg Private data (unused, will be NULL). * @returns DDI_INTR_CLAIMED if it's our interrupt, DDI_INTR_UNCLAIMED if it isn't. */ static uint_t VBoxGuestSolarisISR(caddr_t Arg) { - LogFlow((DEVICE_NAME ":VBoxGuestSolarisISR Arg=%p\n", Arg)); + LogFlow((DEVICE_NAME "::ISR:\n")); - vboxguest_state_t *pState = (vboxguest_state_t *)Arg; - mutex_enter(&pState->Mtx); + mutex_enter(&g_IrqMtx); bool fOurIRQ = VBoxGuestCommonISR(&g_DevExt); - mutex_exit(&pState->Mtx); + mutex_exit(&g_IrqMtx); return fOurIRQ ? DDI_INTR_CLAIMED : DDI_INTR_UNCLAIMED; } +void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt) +{ + LogFlow((DEVICE_NAME "::NativeISRMousePollEvent:\n")); + + /* + * Wake up poll waiters. + */ + pollwakeup(&g_PollHead, POLLIN | POLLRDNORM); +} + + /** * VBoxGuest Common ioctl wrapper from VBoxGuestLib. * diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp index e34098f50..53ee7fe0f 100644 --- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp +++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp @@ -1,10 +1,10 @@ -/* $Id: VBoxGuest.cpp 21023 2009-06-29 13:35:52Z vboxsync $ */ +/* $Id: VBoxGuest.cpp $ */ /** @file - * VBoxGuest - Guest Additions Driver. + * VBoxGuest - Guest Additions Driver, Common Code. */ /* - * Copyright (C) 2007 Sun Microsystems, Inc. + * Copyright (C) 2007-2009 Sun Microsystems, Inc. * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -141,9 +141,10 @@ static int vboxGuestInitReportGuestInfo(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enm * @param cbMMIO The size of the MMIO memory mapping. * This is optional, pass 0 if not present. * @param enmOSType The guest OS type to report to the VMMDev. + * @param fEvents Additional requested events (like Mouse events). */ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, - void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType) + void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fEvents) { int rc, rc2; @@ -163,14 +164,15 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, pDevExt->FreeList.pTail = NULL; pDevExt->f32PendingEvents = 0; pDevExt->u32ClipboardClientId = 0; + pDevExt->u32MousePosChangedSeq = 0; /* * If there is an MMIO region validate the version and size. */ if (pvMMIOBase) { - Assert(cbMMIO); VMMDevMemory *pVMMDev = (VMMDevMemory *)pvMMIOBase; + Assert(cbMMIO); if ( pVMMDev->u32Version == VMMDEV_MEMORY_VERSION && pVMMDev->u32Size >= 32 && pVMMDev->u32Size <= cbMMIO) @@ -213,9 +215,9 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, if (RT_SUCCESS(rc)) { #ifdef VBOX_WITH_HGCM - rc = vboxGuestInitFilterMask(pDevExt, VMMDEV_EVENT_HGCM); + rc = vboxGuestInitFilterMask(pDevExt, VMMDEV_EVENT_HGCM | fEvents); #else - rc = vboxGuestInitFilterMask(pDevExt, 0); + rc = vboxGuestInitFilterMask(pDevExt, fEvents); #endif if (RT_SUCCESS(rc)) { @@ -257,12 +259,13 @@ static void VBoxGuestDeleteWaitList(PVBOXGUESTWAITLIST pList) { while (pList->pHead) { - PVBOXGUESTWAIT pWait = pList->pHead; + int rc2; + PVBOXGUESTWAIT pWait = pList->pHead; pList->pHead = pWait->pNext; pWait->pNext = NULL; pWait->pPrev = NULL; - int rc2 = RTSemEventMultiDestroy(pWait->Event); AssertRC(rc2); + rc2 = RTSemEventMultiDestroy(pWait->Event); AssertRC(rc2); pWait->Event = NIL_RTSEMEVENTMULTI; RTMemFree(pWait); } @@ -376,11 +379,12 @@ int VBoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *pp */ void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession) { + unsigned i; NOREF(i); Log(("VBoxGuestCloseSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n", pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */ #ifdef VBOX_WITH_HGCM - for (unsigned i = 0; i < RT_ELEMENTS(pSession->aHGCMClientIds); i++) + for (i = 0; i < RT_ELEMENTS(pSession->aHGCMClientIds); i++) if (pSession->aHGCMClientIds[i]) { VBoxGuestHGCMDisconnectInfo Info; @@ -465,6 +469,7 @@ static PVBOXGUESTWAIT VBoxGuestWaitAlloc(PVBOXGUESTDEVEXT pDevExt) if (!pWait) { static unsigned s_cErrors = 0; + int rc; pWait = (PVBOXGUESTWAIT)RTMemAlloc(sizeof(*pWait)); if (!pWait) @@ -474,7 +479,7 @@ static PVBOXGUESTWAIT VBoxGuestWaitAlloc(PVBOXGUESTDEVEXT pDevExt) return NULL; } - int rc = RTSemEventMultiCreate(&pWait->Event); + rc = RTSemEventMultiCreate(&pWait->Event); if (RT_FAILURE(rc)) { if (s_cErrors++ < 32) @@ -746,26 +751,27 @@ static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWai } -static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, VMMDevRequestHeader *pReqHdr, - size_t cbData, size_t *pcbDataReturned) +static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, + VMMDevRequestHeader *pReqHdr, size_t cbData, size_t *pcbDataReturned) { Log(("VBoxGuestCommonIOCtl: VMMREQUEST type %d\n", pReqHdr->requestType)); /* * Validate the header and request size. */ - const uint32_t cbReq = pReqHdr->size; - const uint32_t cbMinSize = vmmdevGetRequestSize(pReqHdr->requestType); + const VMMDevRequestType enmType = pReqHdr->requestType; + const uint32_t cbReq = pReqHdr->size; + const uint32_t cbMinSize = vmmdevGetRequestSize(enmType); if (cbReq < cbMinSize) { Log(("VBoxGuestCommonIOCtl: VMMREQUEST: invalid hdr size %#x, expected >= %#x; type=%#x!!\n", - cbReq, cbMinSize, pReqHdr->requestType)); + cbReq, cbMinSize, enmType)); return VERR_INVALID_PARAMETER; } if (cbReq > cbData) { Log(("VBoxGuestCommonIOCtl: VMMREQUEST: invalid size %#x, expected >= %#x (hdr); type=%#x!!\n", - cbData, cbReq, pReqHdr->requestType)); + cbData, cbReq, enmType)); return VERR_INVALID_PARAMETER; } @@ -777,15 +783,18 @@ static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, VMMDevReque * it does makes things a bit simpler wrt to phys address.) */ VMMDevRequestHeader *pReqCopy; - int rc = VbglGRAlloc(&pReqCopy, cbReq, pReqHdr->requestType); + int rc = VbglGRAlloc(&pReqCopy, cbReq, enmType); if (RT_FAILURE(rc)) { Log(("VBoxGuestCommonIOCtl: VMMREQUEST: failed to allocate %u (%#x) bytes to cache the request. rc=%d!!\n", cbReq, cbReq, rc)); return rc; } - memcpy(pReqCopy, pReqHdr, cbReq); + + if (enmType == VMMDevReq_GetMouseStatus) /* clear poll condition. */ + pSession->u32MousePosChangedSeq = ASMAtomicUoReadU32(&pDevExt->u32MousePosChangedSeq); + rc = VbglGRPerform(pReqCopy); if ( RT_SUCCESS(rc) && RT_SUCCESS(pReqCopy->rc)) @@ -1268,7 +1277,7 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUE if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_VMMREQUEST(0))) { CHECKRET_MIN_SIZE("VMMREQUEST", sizeof(VMMDevRequestHeader)); - rc = VBoxGuestCommonIOCtl_VMMRequest(pDevExt, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned); + rc = VBoxGuestCommonIOCtl_VMMRequest(pDevExt, pSession, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned); } #ifdef VBOX_WITH_HGCM /* @@ -1412,6 +1421,8 @@ bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt) RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; RTSpinlockAcquireNoInts(pDevExt->WaitSpinlock, &Tmp); + /** @todo This looks wrong: Seems like VMMDEV_EVENT_HGCM will always be set in + * f32PendingEvents... */ #ifdef VBOX_WITH_HGCM /* The HGCM event/list is kind of different in that we evaluate all entries. */ if (fEvents & VMMDEV_EVENT_HGCM) @@ -1424,6 +1435,16 @@ bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt) } #endif + /* VMMDEV_EVENT_MOUSE_POSITION_CHANGED can only be polled for. */ +#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) + if (fEvents & VMMDEV_EVENT_MOUSE_POSITION_CHANGED) + { + pDevExt->u32MousePosChangedSeq++; + VBoxGuestNativeISRMousePollEvent(pDevExt); + } +#endif + fEvents &= ~VMMDEV_EVENT_MOUSE_POSITION_CHANGED; + /* Normal FIFO evaluation. */ fEvents |= pDevExt->f32PendingEvents; for (pWait = pDevExt->WaitList.pHead; pWait; pWait = pWait->pNext) diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm b/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm index 8106612e0..0720186d6 100644 --- a/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm +++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm @@ -1,4 +1,4 @@ -; $Id: VBoxGuestA-os2.asm 8155 2008-04-18 15:16:47Z vboxsync $ +; $Id: VBoxGuestA-os2.asm $ ;; @file ; VBoxGuest - OS/2 assembly file, the first file in the link. ; diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h b/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h index 26a02b267..2ffa1df70 100644 --- a/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h +++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h @@ -1,4 +1,4 @@ -/* $Id: VBoxGuestInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxGuestInternal.h $ */ /** @file * VBoxGuest - Guest Additions Driver. */ @@ -96,6 +96,9 @@ typedef struct VBOXGUESTDEVEXT VBOXGUESTWAITLIST FreeList; /** Mask of pending events. */ uint32_t volatile f32PendingEvents; + /** Current VMMDEV_EVENT_MOUSE_POSITION_CHANGED sequence number. + * Used to implement polling. */ + uint32_t volatile u32MousePosChangedSeq; /** Spinlock various items in the VBOXGUESTSESSION. */ RTSPINLOCK SessionSpinlock; @@ -143,12 +146,14 @@ typedef struct VBOXGUESTSESSION * This will be automatically disconnected when the session is closed. */ uint32_t volatile aHGCMClientIds[8]; #endif + /** The last consumed VMMDEV_EVENT_MOUSE_POSITION_CHANGED sequence number. + * Used to implement polling. */ + uint32_t volatile u32MousePosChangedSeq; } VBOXGUESTSESSION; - RT_C_DECLS_BEGIN -int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType); +int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fEvents); void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt); bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt); int VBoxGuestSetGuestCapabilities(uint32_t fOr, uint32_t fNot); @@ -161,6 +166,13 @@ int VBoxGuestCommonIOCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBO int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, void *pvData, size_t cbData, size_t *pcbDataReturned); +/** + * ISR callback for notifying threads polling for mouse events. + * + * @param pDevExt The device extension. + */ +void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt); + RT_C_DECLS_END #endif diff --git a/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk b/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk index 0a78318ff..f7069ec0c 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk +++ b/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 16954 2009-02-19 16:55:55Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the common guest addition code library. # diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBGLR3Internal.h b/src/VBox/Additions/common/VBoxGuestLib/VBGLR3Internal.h index c4036da11..5de741cbe 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBGLR3Internal.h +++ b/src/VBox/Additions/common/VBoxGuestLib/VBGLR3Internal.h @@ -1,4 +1,4 @@ -/* $Id: VBGLR3Internal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBGLR3Internal.h $ */ /** @file * VBoxGuestR3Lib - Ring-3 support library for the guest additions, Internal header. */ diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp index 1ed8c3bd5..580edbe22 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxGuestR3Lib.cpp 18452 2009-03-28 04:05:10Z vboxsync $ */ +/* $Id: VBoxGuestR3Lib.cpp $ */ /** @file * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Core. */ diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibClipboard.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibClipboard.cpp index 3f97a4a6c..243cea404 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibClipboard.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibClipboard.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxGuestR3LibClipboard.cpp 17999 2009-03-17 08:22:40Z vboxsync $ */ +/* $Id: VBoxGuestR3LibClipboard.cpp $ */ /** @file * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Clipboard. */ diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp index 2e9414029..ff27115d3 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp @@ -1,4 +1,4 @@ -/** $Id: VBoxGuestR3LibDaemonize.cpp 18526 2009-03-30 11:47:27Z vboxsync $ */ +/** $Id: VBoxGuestR3LibDaemonize.cpp $ */ /** @file * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, daemonize a process. */ diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGR.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGR.cpp index 894e480c4..b4806909d 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGR.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGR.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxGuestR3LibGR.cpp 10553 2008-07-11 20:11:27Z vboxsync $ */ +/* $Id: VBoxGuestR3LibGR.cpp $ */ /** @file * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, GR. */ diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestProp.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestProp.cpp index cf0545cc2..5bbb6d7ee 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestProp.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestProp.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxGuestR3LibGuestProp.cpp 18451 2009-03-28 04:04:18Z vboxsync $ */ +/* $Id: VBoxGuestR3LibGuestProp.cpp $ */ /** @file * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, * guest properties. diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp index 9b60c06cf..969207a89 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxGuestR3LibMisc.cpp 10638 2008-07-15 10:01:32Z vboxsync $ */ +/* $Id: VBoxGuestR3LibMisc.cpp $ */ /** @file * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Misc. */ diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMouse.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMouse.cpp index 9b8de26c2..01b05e8dd 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMouse.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMouse.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxGuestR3LibMouse.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: VBoxGuestR3LibMouse.cpp $ */ /** @file * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Mouse. */ diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp index ee59a5075..5c15891cf 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibSeamless.cpp @@ -1,4 +1,4 @@ -/** $Id: VBoxGuestR3LibSeamless.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/** $Id: VBoxGuestR3LibSeamless.cpp $ */ /** @file * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Seamless mode. */ diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibTime.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibTime.cpp index 68034bd9d..8cd2425f6 100644 --- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibTime.cpp +++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibTime.cpp @@ -1,4 +1,4 @@ -/** $Id: VBoxGuestR3LibTime.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/** $Id: VBoxGuestR3LibTime.cpp $ */ /** @file * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Time. */ diff --git a/src/VBox/Additions/common/VBoxService/Makefile.kmk b/src/VBox/Additions/common/VBoxService/Makefile.kmk index cc9303481..98efa22b7 100644 --- a/src/VBox/Additions/common/VBoxService/Makefile.kmk +++ b/src/VBox/Additions/common/VBoxService/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19644 2009-05-12 15:29:22Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Cross Platform Guest Addition Services. # @@ -21,13 +21,16 @@ SUB_DEPTH = ../../../../.. include $(KBUILD_PATH)/subheader.kmk - if "$(KBUILD_HOST)" != "os2" || defined(VBOX_WITH_OS2_ADDITIONS) - PROGRAMS += VBoxService -endif # -# VBoxService.exe +# Target lists. +# +PROGRAMS += VBoxService +PROGRAMS.win.x86 += VBoxServiceNT + +# +# VBoxService # VBoxService_TEMPLATE = VBOXGUESTR3EXE VBoxService_DEFS = VBOXSERVICE_TIMESYNC @@ -65,7 +68,16 @@ ifdef VBOX_WITH_GUEST_PROPS nsl endif +# +# VBoxServiceNT - NT4 version of VBoxService. +# +VBoxServiceNT_TEMPLATE = VBOXGUESTR3EXE +VBoxServiceNT_EXTENDS = VBoxService +VBoxServiceNT_DEFS.win = _WIN32_WINNT=0x0400 _UNICODE UNICODE TARGET_NT4 + +# # The icon is configurable. +# VBoxService-win.rc_INCS = $(PATH_VBoxService) VBoxService-win.rc_DEPS = $(PATH_VBoxService)/VBoxService-win-icon.rc VBoxService-win.rc_CLEAN = $(PATH_VBoxService)/VBoxService-win-icon.rc @@ -75,5 +87,6 @@ $$(PATH_VBoxService)/VBoxService-win-icon.rc: $(VBOX_WINDOWS_ADDITIONS_ICON_FILE $(RM) -f $@ $(APPEND) $@ 'IDI_VIRTUALBOX ICON DISCARDABLE "$(subst /,\\,$(VBOX_WINDOWS_ADDITIONS_ICON_FILE))"' +endif # os2 || with os2 additions include $(KBUILD_PATH)/subfooter.kmk diff --git a/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp b/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp index 7d92ff413..190dcb0bf 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxService-win.cpp 19374 2009-05-05 13:23:32Z vboxsync $ */ +/* $Id: VBoxService-win.cpp $ */ /** @file * VBoxService - Guest Additions Service Skeleton, Windows Specific Parts. */ @@ -211,6 +211,7 @@ int VBoxServiceWinStart() { int rc = VINF_SUCCESS; +#ifndef TARGET_NT4 /* Create a well-known SID for the "Builtin Users" group. */ PSID pBuiltinUsersSID = NULL; SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_LOCAL_SID_AUTHORITY; @@ -236,6 +237,7 @@ int VBoxServiceWinStart() rc = VERR_ACCESS_DENIED; /* Need to add some better code later. */ } } +#endif if (RT_SUCCESS(rc)) { @@ -260,14 +262,22 @@ int VBoxServiceWinStart() return rc; } +#ifdef TARGET_NT4 +VOID WINAPI VBoxServiceWinCtrlHandler (DWORD dwControl) +#else DWORD WINAPI VBoxServiceWinCtrlHandler (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext) +#endif { DWORD rc = NO_ERROR; - VBoxServiceVerbose(2, "Control handler: Control=%ld, EventType=%ld\n", dwControl, dwEventType); + VBoxServiceVerbose(2, "Control handler: Control=%ld\n", dwControl); +#ifndef TARGET_NT4 + VBoxServiceVerbose(2, "Control handler: EventType=%ld\n", dwEventType); +#endif + switch (dwControl) { @@ -288,9 +298,9 @@ DWORD WINAPI VBoxServiceWinCtrlHandler (DWORD dwControl, case SERVICE_CONTROL_SESSIONCHANGE: /* Only Win XP and up. */ +#ifndef TARGET_NT4 switch (dwEventType) { - /*case WTS_SESSION_LOGON: VBoxServiceVerbose(2, "A user has logged on to the session.\n"); break; @@ -298,10 +308,10 @@ DWORD WINAPI VBoxServiceWinCtrlHandler (DWORD dwControl, case WTS_SESSION_LOGOFF: VBoxServiceVerbose(2, "A user has logged off from the session.\n"); break;*/ - default: break; } +#endif /* TARGET_NT4 */ break; default: @@ -310,7 +320,10 @@ DWORD WINAPI VBoxServiceWinCtrlHandler (DWORD dwControl, rc = ERROR_CALL_NOT_IMPLEMENTED; break; } + +#ifndef TARGET_NT4 return rc; +#endif } void WINAPI VBoxServiceWinMain (DWORD argc, LPTSTR *argv) @@ -318,7 +331,11 @@ void WINAPI VBoxServiceWinMain (DWORD argc, LPTSTR *argv) int rc = VINF_SUCCESS; VBoxServiceVerbose(2, "Registering service control handler ...\n"); +#ifdef TARGET_NT4 + g_hWinServiceStatus = RegisterServiceCtrlHandler (VBOXSERVICE_NAME, VBoxServiceWinCtrlHandler); +#else g_hWinServiceStatus = RegisterServiceCtrlHandlerEx (VBOXSERVICE_NAME, VBoxServiceWinCtrlHandler, NULL); +#endif if (NULL == g_hWinServiceStatus) { diff --git a/src/VBox/Additions/common/VBoxService/VBoxService-win.rc b/src/VBox/Additions/common/VBoxService/VBoxService-win.rc index a6fc67325..f2f4c7574 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxService-win.rc +++ b/src/VBox/Additions/common/VBoxService/VBoxService-win.rc @@ -1,4 +1,4 @@ -/* $Id: VBoxService-win.rc 19376 2009-05-05 13:41:37Z vboxsync $ */ +/* $Id: VBoxService-win.rc $ */ /** @file * VBoxService - Resouce file containing version info and icon. */ diff --git a/src/VBox/Additions/common/VBoxService/VBoxService.cpp b/src/VBox/Additions/common/VBoxService/VBoxService.cpp index 42d0d66f7..fd6ff2e06 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxService.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxService.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxService.cpp 19532 2009-05-08 14:53:35Z vboxsync $ */ +/* $Id: VBoxService.cpp $ */ /** @file * VBoxService - Guest Additions Service Skeleton. */ diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceClipboard-os2.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceClipboard-os2.cpp index 82f38d528..f161de99d 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceClipboard-os2.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceClipboard-os2.cpp @@ -1,4 +1,4 @@ -/** $Id: VBoxServiceClipboard-os2.cpp 19374 2009-05-05 13:23:32Z vboxsync $ */ +/** $Id: VBoxServiceClipboard-os2.cpp $ */ /** @file * VBoxService - Guest Additions Clipboard Service, OS/2. */ diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h b/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h index d5478ec50..1d194cfb0 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h @@ -1,4 +1,4 @@ -/* $Id: VBoxServiceInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxServiceInternal.h $ */ /** @file * VBoxService - Guest Additions Services. */ diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceResource-win.h b/src/VBox/Additions/common/VBoxService/VBoxServiceResource-win.h index e9829cc13..6067e27d2 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceResource-win.h +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceResource-win.h @@ -1,4 +1,4 @@ -/* $Id: VBoxServiceResource-win.h 19376 2009-05-05 13:41:37Z vboxsync $ */ +/* $Id: VBoxServiceResource-win.h $ */ /** @file * VBoxService - Guest Additions Service, resource IDs. */ diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp index fab45760f..6746c8a9e 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp @@ -1,4 +1,4 @@ -/** $Id: VBoxServiceTimeSync.cpp 19374 2009-05-05 13:23:32Z vboxsync $ */ +/** $Id: VBoxServiceTimeSync.cpp $ */ /** @file * VBoxService - Guest Additions TimeSync Service. */ diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.cpp index 899583fb3..e6f111b97 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.cpp @@ -1,5 +1,5 @@ -/* $Id: VBoxServiceUtils.cpp 19644 2009-05-12 15:29:22Z vboxsync $ */ +/* $Id: VBoxServiceUtils.cpp $ */ /** @file * VBoxServiceUtils - Some utility functions. */ diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.h b/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.h index 2ff321b9c..b0a8a0aee 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.h +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.h @@ -1,4 +1,4 @@ -/* $Id: VBoxServiceUtils.h 19644 2009-05-12 15:29:22Z vboxsync $ */ +/* $Id: VBoxServiceUtils.h $ */ /** @file * VBoxServiceUtils - Guest Additions Services (Utilities). */ diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp index a47435967..e16b2351f 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxServiceVMInfo-win.cpp 20721 2009-06-19 12:28:41Z vboxsync $ */ +/* $Id: VBoxServiceVMInfo-win.cpp $ */ /** @file * VBoxVMInfo-win - Virtual machine (guest) information for the host. */ @@ -44,12 +44,15 @@ /******************************************************************************* * Global Variables * *******************************************************************************/ -/** Function prototypes for dynamic loading. */ -extern fnWTSGetActiveConsoleSessionId g_pfnWTSGetActiveConsoleSessionId; -/** The vminfo interval (millseconds). */ -uint32_t g_VMInfoLoggedInUsersCount = 0; +#ifndef TARGET_NT4 + /** Function prototypes for dynamic loading. */ + extern fnWTSGetActiveConsoleSessionId g_pfnWTSGetActiveConsoleSessionId; + /** The vminfo interval (millseconds). */ + uint32_t g_VMInfoLoggedInUsersCount = 0; +#endif +#ifndef TARGET_NT4 /* Function GetLUIDsFromProcesses() written by Stefan Kuhr. */ DWORD VboxServiceVMInfoWinGetLUIDsFromProcesses(PLUID *ppLuid) { @@ -265,7 +268,7 @@ BOOL VboxServiceVMInfoWinIsLoggedIn(VBOXSERVICEVMINFOUSER* a_pUserInfo, if (g_pfnWTSGetActiveConsoleSessionId != NULL) /* Check terminal session ID. */ dwActiveSession = g_pfnWTSGetActiveConsoleSessionId(); - /*VBoxServiceVerbose(3, ("vboxVMInfoThread: Users: Current active session ID: %ld\n", dwActiveSession));*/ + /*VBoxServiceVerbose(3, ("Users: Current active session ID: %ld\n", dwActiveSession));*/ if (SidTypeUser == ownerType) { @@ -325,6 +328,8 @@ BOOL VboxServiceVMInfoWinIsLoggedIn(VBOXSERVICEVMINFOUSER* a_pUserInfo, return bLoggedIn; } +#endif /* TARGET_NT4 */ + int VboxServiceWinGetAddsVersion(uint32_t uiClientID) { char szInstDir[_MAX_PATH] = {0}; @@ -336,19 +341,26 @@ int VboxServiceWinGetAddsVersion(uint32_t uiClientID) DWORD dwSize = 0; DWORD dwType = 0; - /* First try the old registry path ... */ - rc = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey); - if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND)) - { - /* Old registry path does not exist -- maybe the new one does? */ - rc = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey); - if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND)) + VBoxServiceVerbose(3, "Guest Additions version lookup: Looking up ...\n"); + + /* Check the new path first. */ + rc = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey); + if (rc != ERROR_SUCCESS) + { + VBoxServiceVerbose(3, "Guest Additions version lookup: Looking in xVM key ...\n"); + + /* New path does not exist, check the old one ... */ + rc = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey); + if (rc != ERROR_SUCCESS) { + /* Nothing seems to exist, print some warning. */ VBoxServiceError("Failed to open registry key (guest additions)! Error: %d\n", rc); return 1; } } + VBoxServiceVerbose(3, "Guest Additions version lookup: Key: 0x%p, RC: %d\n", hKey, rc); + /* Installation directory. */ dwSize = sizeof(szInstDir); rc = RegQueryValueExA (hKey, "InstallDir", NULL, &dwType, (BYTE*)(LPCTSTR)szInstDir, &dwSize); @@ -406,8 +418,13 @@ int VboxServiceWinGetComponentVersions(uint32_t uiClientID) GetSystemDirectory(szSysDir, _MAX_PATH); GetWindowsDirectory(szWinDir, _MAX_PATH); swprintf(szDriversDir, (_MAX_PATH + 32), TEXT("%s\\drivers"), szSysDir); +#ifdef RT_ARCH_AMD64 + TCHAR szSysWowDir[_MAX_PATH + 32] = {0}; + swprintf(szSysWowDir, (_MAX_PATH + 32), TEXT("%s\\SysWow64"), szWinDir); +#endif /* The file information table. */ +#ifndef TARGET_NT4 VBOXSERVICEVMINFOFILE vboxFileInfoTable[] = { { szSysDir, TEXT("VBoxControl.exe"), }, @@ -418,13 +435,25 @@ int VboxServiceWinGetComponentVersions(uint32_t uiClientID) { szSysDir, TEXT("VBoxTray.exe"), }, { szSysDir, TEXT("VBoxGINA.dll"), }, + /* On 64-bit we don't yet have the OpenGL DLLs in native format. + So just enumerate the 32-bit files in the SYSWOW directory. */ + #ifdef RT_ARCH_AMD64 + { szSysWowDir, TEXT("VBoxOGLarrayspu.dll"), }, + { szSysWowDir, TEXT("VBoxOGLcrutil.dll"), }, + { szSysWowDir, TEXT("VBoxOGLerrorspu.dll"), }, + { szSysWowDir, TEXT("VBoxOGLpackspu.dll"), }, + { szSysWowDir, TEXT("VBoxOGLpassthroughspu.dll"), }, + { szSysWowDir, TEXT("VBoxOGLfeedbackspu.dll"), }, + { szSysWowDir, TEXT("VBoxOGL.dll"), }, + #else { szSysDir, TEXT("VBoxOGLarrayspu.dll"), }, { szSysDir, TEXT("VBoxOGLcrutil.dll"), }, { szSysDir, TEXT("VBoxOGLerrorspu.dll"), }, { szSysDir, TEXT("VBoxOGLpackspu.dll"), }, { szSysDir, TEXT("VBoxOGLpassthroughspu.dll"), }, { szSysDir, TEXT("VBoxOGLfeedbackspu.dll"), }, - { szSysDir, TEXT("VBoxOGL.dll"), }, + { szSysDir, TEXT("VBoxOGL.dll"), }, + #endif { szDriversDir, TEXT("VBoxGuest.sys"), }, { szDriversDir, TEXT("VBoxMouse.sys"), }, @@ -435,6 +464,24 @@ int VboxServiceWinGetComponentVersions(uint32_t uiClientID) NULL } }; +#else /* File lookup for NT4. */ + VBOXSERVICEVMINFOFILE vboxFileInfoTable[] = + { + { szSysDir, TEXT("VBoxControl.exe"), }, + { szSysDir, TEXT("VBoxHook.dll"), }, + { szSysDir, TEXT("VBoxDisp.dll"), }, + { szSysDir, TEXT("VBoxService.exe"), }, + { szSysDir, TEXT("VBoxTray.exe"), }, + + { szDriversDir, TEXT("VBoxGuestNT.sys"), }, + { szDriversDir, TEXT("VBoxMouseNT.sys"), }, + { szDriversDir, TEXT("VBoxVideo.sys"), }, + + { + NULL + } + }; +#endif PVBOXSERVICEVMINFOFILE pTable = vboxFileInfoTable; Assert(pTable); diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp index 11419f6d6..1bb9d4aa6 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxServiceVMInfo.cpp 19637 2009-05-12 14:54:10Z vboxsync $ */ +/* $Id: VBoxServiceVMInfo.cpp $ */ /** @file * VBoxVMInfo - Virtual machine (guest) information for the host. */ @@ -185,6 +185,7 @@ DECLCALLBACK(int) VBoxServiceVMInfoWorker(bool volatile *pfShutdown) char szUserList[4096] = {0}; #ifdef RT_OS_WINDOWS + #ifndef TARGET_NT4 PLUID pSessions = NULL; ULONG ulCount = 0; NTSTATUS r = 0; @@ -227,6 +228,7 @@ DECLCALLBACK(int) VBoxServiceVMInfoWorker(bool volatile *pfShutdown) ::LocalFree (pLuid); ::LsaFreeReturnBuffer(pSessions); + #endif /* TARGET_NT4 */ #else utmp* ut_user; rc = utmpname(UTMP_FILE); diff --git a/src/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py b/src/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py index 59af1f49e..c92431650 100644 --- a/src/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py +++ b/src/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py @@ -21,7 +21,6 @@ glx_functions = [ "UseXFont", #"GetDriverConfig", "GetProcAddress", -"FreeMemoryMESA", "QueryExtension", "IsDirect", "DestroyGLXPbufferSGIX", @@ -33,7 +32,6 @@ glx_functions = [ "SwapBuffers", "CreateNewContext", "SelectEventSGIX", -"QueryContextInfoEXT", "GetCurrentDrawable", "ChooseFBConfig", "WaitGL", @@ -41,37 +39,29 @@ glx_functions = [ "CreatePixmap", "GetSelectedEventSGIX", "GetCurrentReadDrawable", -"ImportContextEXT", -"GetContextIDEXT", "GetCurrentDisplay", "QueryServerString", "CreateWindow", "SelectEvent", "GetVisualFromFBConfigSGIX", -"MakeCurrentReadSGI", "GetFBConfigFromVisualSGIX", "QueryDrawable", "CreateContext", "GetConfig", "CreateGLXPbufferSGIX", -"AllocateMemoryMESA", -"GetMemoryOffsetMESA", "CreatePbuffer", "ChooseFBConfigSGIX", "WaitX", "GetVisualFromFBConfig", -"CreateGLXPixmapMESA", #"GetScreenDriver", "GetFBConfigAttrib", "GetCurrentContext", "GetClientString", -"GetCurrentDisplayEXT", "DestroyPixmap", "MakeCurrent", "DestroyContext", "GetProcAddressARB", "GetSelectedEvent", -"FreeContextEXT", "DestroyPbuffer", "DestroyWindow", "DestroyGLXPixmap", @@ -79,7 +69,17 @@ glx_functions = [ "ChooseVisual", "MakeContextCurrent", "QueryExtensionsString", -"GetFBConfigAttribSGIX" +"GetFBConfigAttribSGIX", +"FreeMemoryMESA", +"QueryContextInfoEXT", +"ImportContextEXT", +"GetContextIDEXT", +"MakeCurrentReadSGI", +"AllocateMemoryMESA", +"GetMemoryOffsetMESA", +"CreateGLXPixmapMESA", +"GetCurrentDisplayEXT", +"FreeContextEXT" ]; print '%include "iprt/asmdefs.mac"' diff --git a/src/VBox/Additions/common/crOpenGL/Makefile.kmk b/src/VBox/Additions/common/crOpenGL/Makefile.kmk index 1f161606a..9ad50f256 100644 --- a/src/VBox/Additions/common/crOpenGL/Makefile.kmk +++ b/src/VBox/Additions/common/crOpenGL/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20658 2009-06-17 10:32:00Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VirtualBox Guest OpenGL part # diff --git a/src/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py b/src/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py index ed28e2d1c..80579d278 100644 --- a/src/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py +++ b/src/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py @@ -21,7 +21,6 @@ glx_functions = [ "UseXFont", #"GetDriverConfig", "GetProcAddress", -"FreeMemoryMESA", "QueryExtension", "IsDirect", "DestroyGLXPbufferSGIX", @@ -33,7 +32,6 @@ glx_functions = [ "SwapBuffers", "CreateNewContext", "SelectEventSGIX", -"QueryContextInfoEXT", "GetCurrentDrawable", "ChooseFBConfig", "WaitGL", @@ -41,37 +39,29 @@ glx_functions = [ "CreatePixmap", "GetSelectedEventSGIX", "GetCurrentReadDrawable", -"ImportContextEXT", -"GetContextIDEXT", "GetCurrentDisplay", "QueryServerString", "CreateWindow", "SelectEvent", "GetVisualFromFBConfigSGIX", -"MakeCurrentReadSGI", "GetFBConfigFromVisualSGIX", "QueryDrawable", "CreateContext", "GetConfig", "CreateGLXPbufferSGIX", -"AllocateMemoryMESA", -"GetMemoryOffsetMESA", "CreatePbuffer", "ChooseFBConfigSGIX", "WaitX", "GetVisualFromFBConfig", -"CreateGLXPixmapMESA", #"GetScreenDriver", "GetFBConfigAttrib", "GetCurrentContext", "GetClientString", -"GetCurrentDisplayEXT", "DestroyPixmap", "MakeCurrent", "DestroyContext", "GetProcAddressARB", "GetSelectedEvent", -"FreeContextEXT", "DestroyPbuffer", "DestroyWindow", "DestroyGLXPixmap", @@ -79,7 +69,17 @@ glx_functions = [ "ChooseVisual", "MakeContextCurrent", "QueryExtensionsString", -"GetFBConfigAttribSGIX" +"GetFBConfigAttribSGIX", +"FreeMemoryMESA", +"QueryContextInfoEXT", +"ImportContextEXT", +"GetContextIDEXT", +"MakeCurrentReadSGI", +"AllocateMemoryMESA", +"GetMemoryOffsetMESA", +"CreateGLXPixmapMESA", +"GetCurrentDisplayEXT", +"FreeContextEXT" ]; print '%include "iprt/asmdefs.mac"' diff --git a/src/VBox/Additions/common/crOpenGL/VBoxCROGL.rc b/src/VBox/Additions/common/crOpenGL/VBoxCROGL.rc index a8c7d49f3..281d95bc6 100644 --- a/src/VBox/Additions/common/crOpenGL/VBoxCROGL.rc +++ b/src/VBox/Additions/common/crOpenGL/VBoxCROGL.rc @@ -1,4 +1,4 @@ -/* $Id: VBoxCROGL.rc 17543 2009-03-08 12:00:34Z vboxsync $ */ +/* $Id: VBoxCROGL.rc $ */ /** @file * diff --git a/src/VBox/Additions/common/crOpenGL/array/arrayspu.rc b/src/VBox/Additions/common/crOpenGL/array/arrayspu.rc index 3fd49eebc..7d70f0a35 100644 --- a/src/VBox/Additions/common/crOpenGL/array/arrayspu.rc +++ b/src/VBox/Additions/common/crOpenGL/array/arrayspu.rc @@ -1,4 +1,4 @@ -/* $Id: arrayspu.rc 20658 2009-06-17 10:32:00Z vboxsync $ */ +/* $Id: arrayspu.rc $ */ /** @file * diff --git a/src/VBox/Additions/common/crOpenGL/fakedri_glxfuncsList.h b/src/VBox/Additions/common/crOpenGL/fakedri_glxfuncsList.h index 1fae476e0..31f01b701 100644 --- a/src/VBox/Additions/common/crOpenGL/fakedri_glxfuncsList.h +++ b/src/VBox/Additions/common/crOpenGL/fakedri_glxfuncsList.h @@ -35,7 +35,6 @@ GLXAPI_ENTRY(CopyContext) GLXAPI_ENTRY(UseXFont) /*GLXAPI_ENTRY(GetDriverConfig)*/ GLXAPI_ENTRY(GetProcAddress) -GLXAPI_ENTRY(FreeMemoryMESA) GLXAPI_ENTRY(QueryExtension) GLXAPI_ENTRY(IsDirect) GLXAPI_ENTRY(DestroyGLXPbufferSGIX) @@ -47,7 +46,6 @@ GLXAPI_ENTRY(CreateContextWithConfigSGIX) GLXAPI_ENTRY(SwapBuffers) GLXAPI_ENTRY(CreateNewContext) GLXAPI_ENTRY(SelectEventSGIX) -GLXAPI_ENTRY(QueryContextInfoEXT) GLXAPI_ENTRY(GetCurrentDrawable) GLXAPI_ENTRY(ChooseFBConfig) GLXAPI_ENTRY(WaitGL) @@ -55,37 +53,29 @@ GLXAPI_ENTRY(GetFBConfigs) GLXAPI_ENTRY(CreatePixmap) GLXAPI_ENTRY(GetSelectedEventSGIX) GLXAPI_ENTRY(GetCurrentReadDrawable) -GLXAPI_ENTRY(ImportContextEXT) -GLXAPI_ENTRY(GetContextIDEXT) GLXAPI_ENTRY(GetCurrentDisplay) GLXAPI_ENTRY(QueryServerString) GLXAPI_ENTRY(CreateWindow) GLXAPI_ENTRY(SelectEvent) GLXAPI_ENTRY(GetVisualFromFBConfigSGIX) -GLXAPI_ENTRY(MakeCurrentReadSGI) GLXAPI_ENTRY(GetFBConfigFromVisualSGIX) GLXAPI_ENTRY(QueryDrawable) GLXAPI_ENTRY(CreateContext) GLXAPI_ENTRY(GetConfig) GLXAPI_ENTRY(CreateGLXPbufferSGIX) -GLXAPI_ENTRY(AllocateMemoryMESA) -GLXAPI_ENTRY(GetMemoryOffsetMESA) GLXAPI_ENTRY(CreatePbuffer) GLXAPI_ENTRY(ChooseFBConfigSGIX) GLXAPI_ENTRY(WaitX) GLXAPI_ENTRY(GetVisualFromFBConfig) -GLXAPI_ENTRY(CreateGLXPixmapMESA) /*GLXAPI_ENTRY(GetScreenDriver)*/ GLXAPI_ENTRY(GetFBConfigAttrib) GLXAPI_ENTRY(GetCurrentContext) GLXAPI_ENTRY(GetClientString) -GLXAPI_ENTRY(GetCurrentDisplayEXT) GLXAPI_ENTRY(DestroyPixmap) GLXAPI_ENTRY(MakeCurrent) GLXAPI_ENTRY(DestroyContext) GLXAPI_ENTRY(GetProcAddressARB) GLXAPI_ENTRY(GetSelectedEvent) -GLXAPI_ENTRY(FreeContextEXT) GLXAPI_ENTRY(DestroyPbuffer) GLXAPI_ENTRY(DestroyWindow) GLXAPI_ENTRY(DestroyGLXPixmap) @@ -94,4 +84,16 @@ GLXAPI_ENTRY(ChooseVisual) GLXAPI_ENTRY(MakeContextCurrent) GLXAPI_ENTRY(QueryExtensionsString) GLXAPI_ENTRY(GetFBConfigAttribSGIX) +#ifdef VBOXOGL_FAKEDRI +GLXAPI_ENTRY(FreeMemoryMESA) +GLXAPI_ENTRY(QueryContextInfoEXT) +GLXAPI_ENTRY(ImportContextEXT) +GLXAPI_ENTRY(GetContextIDEXT) +GLXAPI_ENTRY(MakeCurrentReadSGI) +GLXAPI_ENTRY(AllocateMemoryMESA) +GLXAPI_ENTRY(GetMemoryOffsetMESA) +GLXAPI_ENTRY(CreateGLXPixmapMESA) +GLXAPI_ENTRY(GetCurrentDisplayEXT) +GLXAPI_ENTRY(FreeContextEXT) +#endif diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c b/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c index 37e1d4ea1..abd8c81fc 100644 --- a/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c @@ -1,4 +1,4 @@ -/* $Id: feedback_context.c 20509 2009-06-12 12:51:06Z vboxsync $ */ +/* $Id: feedback_context.c $ */ /** @file * VBox feedback spu, context tracking. diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc index 02b539122..aca25d074 100644 --- a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc @@ -1,4 +1,4 @@ -/* $Id: feedbackspu.rc 20658 2009-06-17 10:32:00Z vboxsync $ */ +/* $Id: feedbackspu.rc $ */ /** @file * diff --git a/src/VBox/Additions/common/crOpenGL/glx_c_exports.c b/src/VBox/Additions/common/crOpenGL/glx_c_exports.c index abc347af8..478243b24 100644 --- a/src/VBox/Additions/common/crOpenGL/glx_c_exports.c +++ b/src/VBox/Additions/common/crOpenGL/glx_c_exports.c @@ -1,4 +1,4 @@ -/* $Id: glx_c_exports.c 18549 2009-03-30 14:04:20Z vboxsync $ */ +/* $Id: glx_c_exports.c $ */ /** @file * * VirtualBox guest OpenGL DRI GLX C stubs diff --git a/src/VBox/Additions/common/crOpenGL/glx_proto.h b/src/VBox/Additions/common/crOpenGL/glx_proto.h index cee22c9e3..7b691a4b5 100644 --- a/src/VBox/Additions/common/crOpenGL/glx_proto.h +++ b/src/VBox/Additions/common/crOpenGL/glx_proto.h @@ -1,4 +1,4 @@ -/* $Id: glx_proto.h 18554 2009-03-30 15:24:33Z vboxsync $ */ +/* $Id: glx_proto.h $ */ /** @file * * VirtualBox guest OpenGL DRI GLX header C prototypes diff --git a/src/VBox/Additions/common/crOpenGL/icd_drv.c b/src/VBox/Additions/common/crOpenGL/icd_drv.c index d2813a0d2..af88e3ee9 100644 --- a/src/VBox/Additions/common/crOpenGL/icd_drv.c +++ b/src/VBox/Additions/common/crOpenGL/icd_drv.c @@ -1,4 +1,4 @@ -/* $Id: icd_drv.c 20398 2009-06-08 12:55:54Z vboxsync $ */ +/* $Id: icd_drv.c $ */ /** @file * VBox OpenGL windows ICD driver functions diff --git a/src/VBox/Additions/common/crOpenGL/icd_drv.h b/src/VBox/Additions/common/crOpenGL/icd_drv.h index 0bd604014..fe8d8f3c9 100644 --- a/src/VBox/Additions/common/crOpenGL/icd_drv.h +++ b/src/VBox/Additions/common/crOpenGL/icd_drv.h @@ -1,4 +1,4 @@ -/* $Id: icd_drv.h 15820 2009-01-06 15:37:59Z vboxsync $ */ +/* $Id: icd_drv.h $ */ /** @file * diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu.rc b/src/VBox/Additions/common/crOpenGL/pack/packspu.rc index aca694a89..a786a6092 100644 --- a/src/VBox/Additions/common/crOpenGL/pack/packspu.rc +++ b/src/VBox/Additions/common/crOpenGL/pack/packspu.rc @@ -1,4 +1,4 @@ -/* $Id: packspu.rc 20658 2009-06-17 10:32:00Z vboxsync $ */ +/* $Id: packspu.rc $ */ /** @file * diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c index 0b3b46f81..e6cfdf088 100644 --- a/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c +++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c @@ -81,6 +81,7 @@ ThreadInfo *packspuNewThread( unsigned long id ) GLint PACKSPU_APIENTRY packspu_CreateContext( const char *dpyName, GLint visual, GLint shareCtx ) { + GET_THREAD(thread); int writeback = 1; GLint serverCtx = (GLint) -1; int slot; @@ -89,6 +90,12 @@ packspu_CreateContext( const char *dpyName, GLint visual, GLint shareCtx ) crLockMutex(&_PackMutex); #endif + if (!thread) { + thread = packspuNewThread(crThreadID()); + } + CRASSERT(thread); + CRASSERT(thread->packer); + if (shareCtx > 0) { /* translate to server ctx id */ shareCtx -= MAGIC_OFFSET; @@ -97,7 +104,7 @@ packspu_CreateContext( const char *dpyName, GLint visual, GLint shareCtx ) } } - crPackSetContext( pack_spu.thread[0].packer ); + crPackSetContext( thread->packer ); /* Pack the command */ if (pack_spu.swap) @@ -106,8 +113,8 @@ packspu_CreateContext( const char *dpyName, GLint visual, GLint shareCtx ) crPackCreateContext( dpyName, visual, shareCtx, &serverCtx, &writeback ); /* Flush buffer and get return value */ - packspuFlush( &(pack_spu.thread[0]) ); - if (!(pack_spu.thread[0].netServer.conn->actual_network)) + packspuFlush(thread); + if (!(thread->netServer.conn->actual_network)) { /* HUMUNGOUS HACK TO MATCH SERVER NUMBERING * diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c index 0979faf38..5271f9503 100644 --- a/src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c +++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c @@ -1,4 +1,4 @@ -/* $Id: packspu_getshaders.c 20509 2009-06-12 12:51:06Z vboxsync $ */ +/* $Id: packspu_getshaders.c $ */ /** @file * VBox OpenGL DRI driver functions diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c index 02545ab66..d80bdb41e 100644 --- a/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c +++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c @@ -111,17 +111,18 @@ void PACKSPU_APIENTRY packspu_Flush( void ) GLint PACKSPU_APIENTRY packspu_WindowCreate( const char *dpyName, GLint visBits ) { + GET_THREAD(thread); static int num_calls = 0; int writeback = pack_spu.thread[0].netServer.conn->actual_network; GLint return_val = (GLint) 0; - /* WindowCreate is special - just like CreateContext. - * GET_THREAD(thread) doesn't work as the thread won't have called - * MakeCurrent yet, so we've got to use the first thread's packer - * buffer. - */ + if (!thread) { + thread = packspuNewThread( crThreadID() ); + } + CRASSERT(thread); + CRASSERT(thread->packer); - crPackSetContext( pack_spu.thread[0].packer ); + crPackSetContext(thread->packer); if (pack_spu.swap) { @@ -131,8 +132,8 @@ GLint PACKSPU_APIENTRY packspu_WindowCreate( const char *dpyName, GLint visBits { crPackWindowCreate( dpyName, visBits, &return_val, &writeback ); } - packspuFlush( &pack_spu.thread[0] ); - if (!(pack_spu.thread[0].netServer.conn->actual_network)) + packspuFlush(thread); + if (!(thread->netServer.conn->actual_network)) { return num_calls++; } diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c index 357f0f8db..94dc7b825 100644 --- a/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c +++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c @@ -1,4 +1,4 @@ -/* $Id: packspu_texture.c 20509 2009-06-12 12:51:06Z vboxsync $ */ +/* $Id: packspu_texture.c $ */ /** @file * VBox OpenGL DRI driver functions diff --git a/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu.rc b/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu.rc index fd8a2507f..d3e83359c 100644 --- a/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu.rc +++ b/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu.rc @@ -1,4 +1,4 @@ -/* $Id: passthroughspu.rc 20658 2009-06-17 10:32:00Z vboxsync $ */ +/* $Id: passthroughspu.rc $ */ /** @file * diff --git a/src/VBox/Additions/freebsd/Installer/vboxguest.sh b/src/VBox/Additions/freebsd/Installer/vboxguest.sh index 4a21c548c..4a21c548c 100644..100755 --- a/src/VBox/Additions/freebsd/Installer/vboxguest.sh +++ b/src/VBox/Additions/freebsd/Installer/vboxguest.sh diff --git a/src/VBox/Additions/freebsd/Makefile.kmk b/src/VBox/Additions/freebsd/Makefile.kmk index 7089cd494..f0d766410 100644 --- a/src/VBox/Additions/freebsd/Makefile.kmk +++ b/src/VBox/Additions/freebsd/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 16995 2009-02-23 09:24:17Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the FreeBSD guest additions base directory. # diff --git a/src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk b/src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk index 0e9c429c8..2267096cb 100644 --- a/src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk +++ b/src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 12446 2008-09-14 23:32:31Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the FreeBSD Shared folder kernel module. # diff --git a/src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h b/src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h index 382099fd3..789a31835 100644 --- a/src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h +++ b/src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h @@ -1,4 +1,4 @@ -/* $Id: vboxvfs.h 8250 2008-04-21 18:42:58Z vboxsync $ */ +/* $Id: vboxvfs.h $ */ /** @file * Description. */ diff --git a/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c b/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c index 7853972ba..6ea7d173d 100644 --- a/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c +++ b/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c @@ -1,4 +1,4 @@ -/* $Id: vboxvfs_vfsops.c 13835 2008-11-05 02:34:43Z vboxsync $ */ +/* $Id: vboxvfs_vfsops.c $ */ /** @file * Description. */ diff --git a/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c b/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c index 1cef32fa6..9746382f2 100644 --- a/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c +++ b/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c @@ -1,4 +1,4 @@ -/* $Id: vboxvfs_vnops.c 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: vboxvfs_vnops.c $ */ /** @file * Description. */ diff --git a/src/VBox/Additions/linux/Makefile b/src/VBox/Additions/linux/Makefile index 088eb0849..8245a3942 100644 --- a/src/VBox/Additions/linux/Makefile +++ b/src/VBox/Additions/linux/Makefile @@ -24,7 +24,11 @@ KBUILD_VERBOSE = all: @echo "*** Building 'vboxadd' module ***" @$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxadd - @cp vboxadd/vboxadd.*o . + @if [ -f vboxadd/vboxadd.ko ]; then \ + cp vboxadd/vboxadd.ko .; \ + else \ + cp vboxadd/vboxadd.o .; \ + fi @echo @if [ -d vboxvfs ]; then \ if [ -f vboxadd/Module.symvers ]; then \ @@ -32,7 +36,11 @@ all: fi; \ echo "*** Building 'vboxvfs' module ***"; \ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvfs; \ - cp vboxvfs/vboxvfs.*o .; \ + if [ -f vboxvfs/vboxvfs.ko ]; then \ + cp vboxvfs/vboxvfs.ko .; \ + else \ + cp vboxvfs/vboxvfs.o .; \ + fi; \ fi @@ -47,7 +55,7 @@ clean: @if [ -d vboxvfs ]; then \ $(MAKE) -C vboxvfs clean; \ fi - rm -f vboxadd.ko vboxvfs.ko + rm -f vboxadd.*o vboxvfs.*o load: @/sbin/rmmod vboxvfs || true diff --git a/src/VBox/Additions/linux/Makefile.kmk b/src/VBox/Additions/linux/Makefile.kmk index 67a544900..cdeae507b 100644 --- a/src/VBox/Additions/linux/Makefile.kmk +++ b/src/VBox/Additions/linux/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19517 2009-05-08 11:49:52Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Makefile for the linux guest additions base directory. # diff --git a/src/VBox/Additions/linux/drm/Makefile.kmk b/src/VBox/Additions/linux/drm/Makefile.kmk index 95dd99658..45f5118b3 100644 --- a/src/VBox/Additions/linux/drm/Makefile.kmk +++ b/src/VBox/Additions/linux/drm/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 17415 2009-03-05 16:22:25Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the vboxvideo DRM module (linux kernel OpenGL module). # diff --git a/src/VBox/Additions/linux/drm/files_vboxvideo_drm b/src/VBox/Additions/linux/drm/files_vboxvideo_drm index 8d6c395bf..8d6c395bf 100644..100755 --- a/src/VBox/Additions/linux/drm/files_vboxvideo_drm +++ b/src/VBox/Additions/linux/drm/files_vboxvideo_drm diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drm.c b/src/VBox/Additions/linux/drm/vboxvideo_drm.c index 943ea3983..5cfd08247 100644 --- a/src/VBox/Additions/linux/drm/vboxvideo_drm.c +++ b/src/VBox/Additions/linux/drm/vboxvideo_drm.c @@ -1,4 +1,4 @@ -/** @file $Id: vboxvideo_drm.c 17938 2009-03-16 14:23:42Z vboxsync $ +/** @file $Id: vboxvideo_drm.c $ * * VirtualBox Additions Linux kernel driver, DRM support */ diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drm.h b/src/VBox/Additions/linux/drm/vboxvideo_drm.h index 04cecfe1a..2cbe55d4e 100644 --- a/src/VBox/Additions/linux/drm/vboxvideo_drm.h +++ b/src/VBox/Additions/linux/drm/vboxvideo_drm.h @@ -1,4 +1,4 @@ -/** @file $Id: vboxvideo_drm.h 17449 2009-03-06 10:26:19Z vboxsync $ +/** @file $Id: vboxvideo_drm.h $ * * VirtualBox Additions Linux kernel driver, DRM support */ diff --git a/src/VBox/Additions/linux/installer/90-vboxguest.fdi b/src/VBox/Additions/linux/installer/90-vboxguest.fdi index b50a6e568..514f437a5 100644 --- a/src/VBox/Additions/linux/installer/90-vboxguest.fdi +++ b/src/VBox/Additions/linux/installer/90-vboxguest.fdi @@ -2,7 +2,7 @@ <!-- # Sun VirtualBox # Hal driver description for the vboxmouse driver -# $Id: 90-vboxguest.fdi 18265 2009-03-25 17:09:08Z vboxsync $ +# $Id: 90-vboxguest.fdi $ Copyright (C) 2008-2009 Sun Microsystems, Inc. diff --git a/src/VBox/Additions/linux/installer/autorun.sh b/src/VBox/Additions/linux/installer/autorun.sh index bcd978c22..bcd978c22 100644..100755 --- a/src/VBox/Additions/linux/installer/autorun.sh +++ b/src/VBox/Additions/linux/installer/autorun.sh diff --git a/src/VBox/Additions/linux/installer/vboxadd-service.sh b/src/VBox/Additions/linux/installer/vboxadd-service.sh index 2872d4dac..2872d4dac 100644..100755 --- a/src/VBox/Additions/linux/installer/vboxadd-service.sh +++ b/src/VBox/Additions/linux/installer/vboxadd-service.sh diff --git a/src/VBox/Additions/linux/installer/vboxadd.sh b/src/VBox/Additions/linux/installer/vboxadd.sh index e54d7edc7..e54d7edc7 100644..100755 --- a/src/VBox/Additions/linux/installer/vboxadd.sh +++ b/src/VBox/Additions/linux/installer/vboxadd.sh diff --git a/src/VBox/Additions/linux/module/Makefile.kmk b/src/VBox/Additions/linux/module/Makefile.kmk index 06a1fa9de..e1875f247 100644 --- a/src/VBox/Additions/linux/module/Makefile.kmk +++ b/src/VBox/Additions/linux/module/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 15589 2008-12-16 14:24:08Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VirtualBox Linux Guest Additions Kernel Module. # diff --git a/src/VBox/Additions/linux/module/files_vboxadd b/src/VBox/Additions/linux/module/files_vboxadd index 52e01bfae..52e01bfae 100644..100755 --- a/src/VBox/Additions/linux/module/files_vboxadd +++ b/src/VBox/Additions/linux/module/files_vboxadd diff --git a/src/VBox/Additions/linux/sharedfolders/Makefile.kmk b/src/VBox/Additions/linux/sharedfolders/Makefile.kmk index 1069e647b..7561e86d3 100644 --- a/src/VBox/Additions/linux/sharedfolders/Makefile.kmk +++ b/src/VBox/Additions/linux/sharedfolders/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 15589 2008-12-16 14:24:08Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the vboxvfs (linux shared folders module). # diff --git a/src/VBox/Additions/linux/sharedfolders/files_vboxvfs b/src/VBox/Additions/linux/sharedfolders/files_vboxvfs index f47c2a61c..f47c2a61c 100644..100755 --- a/src/VBox/Additions/linux/sharedfolders/files_vboxvfs +++ b/src/VBox/Additions/linux/sharedfolders/files_vboxvfs diff --git a/src/VBox/Additions/solaris/DRM/Makefile.kmk b/src/VBox/Additions/solaris/DRM/Makefile.kmk index 6e6164e1c..a96a56cbc 100644 --- a/src/VBox/Additions/solaris/DRM/Makefile.kmk +++ b/src/VBox/Additions/solaris/DRM/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18057 2009-03-18 12:31:39Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the vboxvideo DRM module (Solaris kernel OpenGL module). # diff --git a/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c b/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c index 5fca1ae8c..fded9e376 100644 --- a/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c +++ b/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c @@ -1,4 +1,4 @@ -/* $Id: vboxvideo_drm.c 18576 2009-03-31 14:16:38Z vboxsync $ */ +/* $Id: vboxvideo_drm.c $ */ /** @file * vboxvideo_drm - Direct Rendering Module, Solaris Specific Code. */ diff --git a/src/VBox/Additions/solaris/Installer/makepackage.sh b/src/VBox/Additions/solaris/Installer/makepackage.sh index 865b2e38b..19759eab8 100644..100755 --- a/src/VBox/Additions/solaris/Installer/makepackage.sh +++ b/src/VBox/Additions/solaris/Installer/makepackage.sh @@ -62,7 +62,7 @@ echo 'i depend=./vboxguest.depend' >> prototype if test -f "./vboxguest.copyright"; then echo 'i copyright=./vboxguest.copyright' >> prototype fi -find . -print | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.copyright' | pkgproto >> prototype +find . -print | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype # don't grok for the class files filelist_fixup prototype '$2 == "none"' '$5 = "root"; $6 = "bin"' @@ -98,12 +98,12 @@ filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxOGLpackspu.so=VBoxO # crogl 64-bit opengl fixup filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGL.so=amd64/VBoxOGL.so"' '$3 = "usr/lib/amd64/VBoxOGL.so=amd64/VBoxOGL.so"; $6="sys"' -filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLcrutil.so=amd64/VBoxOGLcrutil.so"' '$3 = "usr/lib/amd64//VBoxOGLcrutil.so=amd64/VBoxOGLcrutil.so"; $6="sys"' -filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLfeedbackspu.so=amd64/VBoxOGLfeedbackspu.so"' '$3 = "usr/lib/amd64//VBoxOGLfeedbackspu.so=amd64/VBoxOGLfeedbackspu.so"; $6="sys"' -filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLpassthroughspu.so=amd64/VBoxOGLpassthroughspu.so"' '$3 = "usr/lib/amd64//VBoxOGLpassthroughspu.so=amd64/VBoxOGLpassthroughspu.so"; $6="sys"' -filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLarrayspu.so=amd64/VBoxOGLarrayspu.so"' '$3 = "usr/lib/amd64//VBoxOGLarrayspu.so=amd64/VBoxOGLarrayspu.so"; $6="sys"' -filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLerrorspu.so=amd64/VBoxOGLerrorspu.so"' '$3 = "usr/lib/amd64//VBoxOGLerrorspu.so=amd64/VBoxOGLerrorspu.so"; $6="sys"' -filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLpackspu.so=amd64/VBoxOGLpackspu.so"' '$3 = "usr/lib/amd64//VBoxOGLpackspu.so=amd64/VBoxOGLpackspu.so"; $6="sys"' +filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLcrutil.so=amd64/VBoxOGLcrutil.so"' '$3 = "usr/lib/amd64/VBoxOGLcrutil.so=amd64/VBoxOGLcrutil.so"; $6="sys"' +filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLfeedbackspu.so=amd64/VBoxOGLfeedbackspu.so"' '$3 = "usr/lib/amd64/VBoxOGLfeedbackspu.so=amd64/VBoxOGLfeedbackspu.so"; $6="sys"' +filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLpassthroughspu.so=amd64/VBoxOGLpassthroughspu.so"' '$3 = "usr/lib/amd64/VBoxOGLpassthroughspu.so=amd64/VBoxOGLpassthroughspu.so"; $6="sys"' +filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLarrayspu.so=amd64/VBoxOGLarrayspu.so"' '$3 = "usr/lib/amd64/VBoxOGLarrayspu.so=amd64/VBoxOGLarrayspu.so"; $6="sys"' +filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLerrorspu.so=amd64/VBoxOGLerrorspu.so"' '$3 = "usr/lib/amd64/VBoxOGLerrorspu.so=amd64/VBoxOGLerrorspu.so"; $6="sys"' +filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxOGLpackspu.so=amd64/VBoxOGLpackspu.so"' '$3 = "usr/lib/amd64/VBoxOGLpackspu.so=amd64/VBoxOGLpackspu.so"; $6="sys"' filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/vboxservice.xml=vboxservice.xml"' '$3 = "var/svc/manifest/system/virtualbox/vboxservice.xml=vboxservice.xml"' diff --git a/src/VBox/Additions/solaris/Installer/postinstall.sh b/src/VBox/Additions/solaris/Installer/postinstall.sh index edb0c05ca..5052b5bb9 100644..100755 --- a/src/VBox/Additions/solaris/Installer/postinstall.sh +++ b/src/VBox/Additions/solaris/Installer/postinstall.sh @@ -228,7 +228,7 @@ if test ! -z "$xorgbin"; then 7.1.* | 7.2.* | 6.9.* | 7.0.* | 1.3.* ) $vboxadditions_path/x11config.pl ;; - 1.5.* ) + 1.5.* | 1.6.* ) $vboxadditions_path/x11config15sol.pl ;; esac diff --git a/src/VBox/Additions/solaris/Installer/preremove.sh b/src/VBox/Additions/solaris/Installer/preremove.sh index 212bd1dd1..212bd1dd1 100644..100755 --- a/src/VBox/Additions/solaris/Installer/preremove.sh +++ b/src/VBox/Additions/solaris/Installer/preremove.sh diff --git a/src/VBox/Additions/solaris/Makefile.kmk b/src/VBox/Additions/solaris/Makefile.kmk index e2aaba3aa..f2428e078 100644 --- a/src/VBox/Additions/solaris/Makefile.kmk +++ b/src/VBox/Additions/solaris/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18907 2009-04-15 15:22:27Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Makefile for the Solaris guest additions base directory. # @@ -214,7 +214,7 @@ ifdef VBOX_WITH_COMBINED_SOLARIS_GUEST_PACKAGE $(QUIET)$(INSTALL) -s -m 0755 $(SOLARIS_ADD_BIN_64)/VBoxOGL.so $(SOLARIS_ADD_INST_DIR_64)/VBoxOGL.so $(QUIET)$(INSTALL) -s -m 0755 $(SOLARIS_ADD_BIN_64)/VBoxOGLcrutil.so $(SOLARIS_ADD_INST_DIR_64)/VBoxOGLcrutil.so $(QUIET)$(INSTALL) -s -m 0755 $(SOLARIS_ADD_BIN_64)/VBoxOGLfeedbackspu.so $(SOLARIS_ADD_INST_DIR_64)/VBoxOGLfeedbackspu.so - $(QUIET)$(INSTALL) -s -m 0755 $(SOLARIS_ADD_BIN_32)/VBoxOGLpassthroughspu.so $(SOLARIS_ADD_INST_DIR_64)/VBoxOGLpassthroughspu.so + $(QUIET)$(INSTALL) -s -m 0755 $(SOLARIS_ADD_BIN_64)/VBoxOGLpassthroughspu.so $(SOLARIS_ADD_INST_DIR_64)/VBoxOGLpassthroughspu.so $(QUIET)$(INSTALL) -s -m 0755 $(SOLARIS_ADD_BIN_64)/VBoxOGLarrayspu.so $(SOLARIS_ADD_INST_DIR_64)/VBoxOGLarrayspu.so $(QUIET)$(INSTALL) -s -m 0755 $(SOLARIS_ADD_BIN_64)/VBoxOGLerrorspu.so $(SOLARIS_ADD_INST_DIR_64)/VBoxOGLerrorspu.so $(QUIET)$(INSTALL) -s -m 0755 $(SOLARIS_ADD_BIN_64)/VBoxOGLpackspu.so $(SOLARIS_ADD_INST_DIR_64)/VBoxOGLpackspu.so diff --git a/src/VBox/Additions/solaris/SharedFolders/Makefile.kmk b/src/VBox/Additions/solaris/SharedFolders/Makefile.kmk index 355e6e6eb..793e7b223 100644 --- a/src/VBox/Additions/solaris/SharedFolders/Makefile.kmk +++ b/src/VBox/Additions/solaris/SharedFolders/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 17626 2009-03-10 13:17:19Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Solaris Shared folder kernel module. # diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs.h b/src/VBox/Additions/solaris/SharedFolders/vboxfs.h index aaef7cd73..f94b9ba3f 100644 --- a/src/VBox/Additions/solaris/SharedFolders/vboxfs.h +++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs.h @@ -1,4 +1,4 @@ -/* $Id: vboxfs.h 17626 2009-03-10 13:17:19Z vboxsync $ */ +/* $Id: vboxfs.h $ */ /** @file * VirtualBox File System Driver for Solaris Guests, Internal Header. */ diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c b/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c index 3215c08ca..b36ea348b 100644 --- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c +++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c @@ -1,4 +1,4 @@ -/* $Id: vboxfs_mount.c 17579 2009-03-09 14:47:32Z vboxsync $ */ +/* $Id: vboxfs_mount.c $ */ /** @file * VirtualBox File System Mount Helper, Solaris host. * Userspace mount wrapper that parses mount (or user-specified) options diff --git a/src/VBox/Additions/x11/Installer/98vboxadd-xclient b/src/VBox/Additions/x11/Installer/98vboxadd-xclient index c5530f3c2..c5530f3c2 100644..100755 --- a/src/VBox/Additions/x11/Installer/98vboxadd-xclient +++ b/src/VBox/Additions/x11/Installer/98vboxadd-xclient diff --git a/src/VBox/Additions/x11/Installer/x11config.pl b/src/VBox/Additions/x11/Installer/x11config.pl index a462780c6..a462780c6 100644..100755 --- a/src/VBox/Additions/x11/Installer/x11config.pl +++ b/src/VBox/Additions/x11/Installer/x11config.pl diff --git a/src/VBox/Additions/x11/Installer/x11config15.pl b/src/VBox/Additions/x11/Installer/x11config15.pl index c1df71872..c1df71872 100644..100755 --- a/src/VBox/Additions/x11/Installer/x11config15.pl +++ b/src/VBox/Additions/x11/Installer/x11config15.pl diff --git a/src/VBox/Additions/x11/Installer/x11config15sol.pl b/src/VBox/Additions/x11/Installer/x11config15sol.pl index f9657585f..8a8e93a07 100644..100755 --- a/src/VBox/Additions/x11/Installer/x11config15sol.pl +++ b/src/VBox/Additions/x11/Installer/x11config15sol.pl @@ -76,12 +76,17 @@ foreach $cfg (@cfg_files) $line = ""; } - # Solaris specific: /dev/kdmouse for PS/2 and not /dev/mouse + # Solaris specific: Use /dev/vboxguest for Xorg 1.5.3+ if ($os_type =~ 'SunOS') { if ($line =~ /^\s*option\s+\"(?:device)\"\s+\"(?:\/dev\/kdmouse)\"/i) { - $line = " Option \"Device\" \"\/dev\/mouse\"\n" + $line = " Option \"Device\" \"\/dev\/vboxguest\"\n" + } + + if ($line =~ /^\s*option\s+\"(?:device)\"\s+\"(?:\/dev\/mouse)\"/i) + { + $line = " Option \"Device\" \"\/dev\/vboxguest\"\n" } } @@ -108,7 +113,7 @@ foreach $cfg (@cfg_files) print TMP " Driver \"vboxmouse\"\n"; if ($os_type eq 'SunOS') { - print TMP " Option \"Device\" \"\/dev\/mouse\"\n"; + print TMP " Option \"Device\" \"\/dev\/vboxguest\"\n"; } print TMP " Option \"CorePointer\"\n"; print TMP "EndSection\n"; diff --git a/src/VBox/Additions/x11/Installer/x11config15suse.pl b/src/VBox/Additions/x11/Installer/x11config15suse.pl index 94fd019ea..94fd019ea 100644..100755 --- a/src/VBox/Additions/x11/Installer/x11config15suse.pl +++ b/src/VBox/Additions/x11/Installer/x11config15suse.pl diff --git a/src/VBox/Additions/x11/Installer/x11restore.pl b/src/VBox/Additions/x11/Installer/x11restore.pl index 09b317e80..224d42e72 100644..100755 --- a/src/VBox/Additions/x11/Installer/x11restore.pl +++ b/src/VBox/Additions/x11/Installer/x11restore.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# $Revision: 18265 $ +# $Revision: 45012 $ # # Sun VirtualBox # diff --git a/src/VBox/Additions/x11/Makefile.kmk b/src/VBox/Additions/x11/Makefile.kmk index 8d515b34d..aad27f360 100644 --- a/src/VBox/Additions/x11/Makefile.kmk +++ b/src/VBox/Additions/x11/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 17602 2009-03-10 09:29:54Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the X11 Guest Additions. # diff --git a/src/VBox/Additions/x11/VBoxClient/Makefile.kmk b/src/VBox/Additions/x11/VBoxClient/Makefile.kmk index 47e655e4a..764dec333 100644 --- a/src/VBox/Additions/x11/VBoxClient/Makefile.kmk +++ b/src/VBox/Additions/x11/VBoxClient/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20552 2009-06-14 16:34:30Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VirtualBox Guest Addition X11 Client. # @@ -77,10 +77,29 @@ $$(PATH_VBoxClient)/libstdc++.a: $(QUIET)$(LN_EXT) -sf `$(TOOL_$(VBOX_GCC_TOOL)_CXX) $(TEMPLATE_VBOXGUESTR3CPPEXE_CXXFLAGS.$(KBUILD_TARGET_ARCH)) -print-file-name=libstdc++.a` $@ \ || $(CP_EXT) -f `$(TOOL_$(VBOX_GCC_TOOL)_CXX) $(TEMPLATE_VBOXGUESTR3CPPEXE_CXXFLAGS.$(KBUILD_TARGET_ARCH)) -print-file-name=libstdc++.a` $@ - ifdef VBOX_X11_SEAMLESS_GUEST - ifdef VBOX_WITH_TESTCASES - ifndef VBOX_ONLY_ADDITIONS + if defined(VBOX_WITH_TESTCASES) && !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_SDK) + if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris) + +# Set this in LocalConfig.kmk if you are working on the X11 clipboard service +# to automatically run the unit test at build time. +# OTHERS += $(PATH_tstSeamlessX11-auto)/tstSeamlessX11-auto.run + + PROGRAMS += tstSeamlessX11-auto + tstSeamlessX11-auto_TEMPLATE = VBOXR3TSTEXE + tstSeamlessX11-auto_SOURCES = \ + testcase/tstSeamlessX11-auto.cpp \ + seamless-x11.cpp + tstSeamlessX11-auto_DEFS = TESTCASE + tstSeamlessX11-auto_LIBS = \ + $(LIB_RUNTIME) + + TESTING += $(PATH_tstSeamlessX11-auto)/tstSeamlessX11-auto +$$(PATH_tstSeamlessX11-auto)/tstSeamlessX11-auto.run: \ + $$(INSTARGET_tstSeamlessX11-auto) + export VBOX_LOG_DEST=nofile; $(INSTARGET_tstSeamlessX11-auto) quiet + $(QUIET)$(APPEND) -t "$@" "done" + # # Additional testcase designed to be run manually, which initiates and starts the Linux # guest client part of the seamless additions in the host, faking seamless events from diff --git a/src/VBox/Additions/x11/VBoxClient/clipboard.cpp b/src/VBox/Additions/x11/VBoxClient/clipboard.cpp index 7f92302e0..525bc1acb 100644 --- a/src/VBox/Additions/x11/VBoxClient/clipboard.cpp +++ b/src/VBox/Additions/x11/VBoxClient/clipboard.cpp @@ -1,4 +1,4 @@ -/** $Id: clipboard.cpp 21043 2009-06-29 18:54:53Z vboxsync $ */ +/** $Id: clipboard.cpp $ */ /** @file * Guest Additions - X11 Shared Clipboard. */ diff --git a/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp b/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp index 72f199b53..e88e477ce 100644 --- a/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp +++ b/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp @@ -36,8 +36,10 @@ #include <limits.h> -/* This is defined wrong in my X11 header files! */ -#define VBoxShapeNotify 64 +#ifdef TESTCASE +#undef DefaultRootWindow +#define DefaultRootWindow XDefaultRootWindow +#endif /***************************************************************************** * Static functions * @@ -290,16 +292,17 @@ void VBoxGuestSeamlessX11::nextEvent(void) switch (event.type) { case ConfigureNotify: - doConfigureEvent(&event.xconfigure); + doConfigureEvent(event.xconfigure.window); break; case MapNotify: - doMapEvent(&event.xmap); + doMapEvent(event.xmap.window); break; case VBoxShapeNotify: /* This is defined wrong in my X11 header files! */ - doShapeEvent(reinterpret_cast<XShapeEvent *>(&event)); + /* the window member in xany is in the same place as in the shape event */ + doShapeEvent(event.xany.window); break; case UnmapNotify: - doUnmapEvent(&event.xunmap); + doUnmapEvent(event.xunmap.window); break; default: break; @@ -312,23 +315,33 @@ void VBoxGuestSeamlessX11::nextEvent(void) * * @param event the X11 event structure */ -void VBoxGuestSeamlessX11::doConfigureEvent(const XConfigureEvent *event) +void VBoxGuestSeamlessX11::doConfigureEvent(Window hWin) { LogFlowThisFunc(("\n")); VBoxGuestWindowList::iterator iter; - iter = mGuestWindows.find(event->window); + iter = mGuestWindows.find(hWin); if (iter != mGuestWindows.end()) { XWindowAttributes winAttrib; - if (XGetWindowAttributes(mDisplay, event->window, &winAttrib)) + if (XGetWindowAttributes(mDisplay, hWin, &winAttrib)) { iter->second->mX = winAttrib.x; iter->second->mY = winAttrib.y; iter->second->mWidth = winAttrib.width; iter->second->mHeight = winAttrib.height; } + if (iter->second->mhasShape) + { + VBoxGuestX11Pointer<XRectangle> rects; + int cRects = 0, iOrdering; + + rects = XShapeGetRectangles(mDisplay, hWin, ShapeBounding, + &cRects, &iOrdering); + iter->second->mcRects = cRects; + iter->second->mapRects = rects; + } } LogFlowThisFunc(("returning\n")); } @@ -338,15 +351,15 @@ void VBoxGuestSeamlessX11::doConfigureEvent(const XConfigureEvent *event) * * @param event the X11 event structure */ -void VBoxGuestSeamlessX11::doMapEvent(const XMapEvent *event) +void VBoxGuestSeamlessX11::doMapEvent(Window hWin) { LogFlowThisFunc(("\n")); VBoxGuestWindowList::iterator iter; - iter = mGuestWindows.find(event->window); + iter = mGuestWindows.find(hWin); if (mGuestWindows.end() == iter) { - addClientWindow(event->window); + addClientWindow(hWin); } LogFlowThisFunc(("returning\n")); } @@ -357,18 +370,19 @@ void VBoxGuestSeamlessX11::doMapEvent(const XMapEvent *event) * * @param event the X11 event structure */ -void VBoxGuestSeamlessX11::doShapeEvent(const XShapeEvent *event) +void VBoxGuestSeamlessX11::doShapeEvent(Window hWin) { LogFlowThisFunc(("\n")); VBoxGuestWindowList::iterator iter; - iter = mGuestWindows.find(event->window); + iter = mGuestWindows.find(hWin); if (iter != mGuestWindows.end()) { VBoxGuestX11Pointer<XRectangle> rects; int cRects = 0, iOrdering; - rects = XShapeGetRectangles(mDisplay, event->window, ShapeBounding, &cRects, &iOrdering); + rects = XShapeGetRectangles(mDisplay, hWin, ShapeBounding, &cRects, + &iOrdering); iter->second->mhasShape = true; iter->second->mcRects = cRects; iter->second->mapRects = rects; @@ -381,12 +395,12 @@ void VBoxGuestSeamlessX11::doShapeEvent(const XShapeEvent *event) * * @param event the X11 event structure */ -void VBoxGuestSeamlessX11::doUnmapEvent(const XUnmapEvent *event) +void VBoxGuestSeamlessX11::doUnmapEvent(Window hWin) { LogFlowThisFunc(("\n")); VBoxGuestWindowList::iterator iter; - iter = mGuestWindows.find(event->window); + iter = mGuestWindows.find(hWin); if (mGuestWindows.end() != iter) { mGuestWindows.removeWindow(iter); diff --git a/src/VBox/Additions/x11/VBoxClient/seamless-x11.h b/src/VBox/Additions/x11/VBoxClient/seamless-x11.h index 6857a1a6a..5ed8dcae0 100644 --- a/src/VBox/Additions/x11/VBoxClient/seamless-x11.h +++ b/src/VBox/Additions/x11/VBoxClient/seamless-x11.h @@ -37,6 +37,9 @@ #define WM_TYPE_PROP "_NET_WM_WINDOW_TYPE" #define WM_TYPE_DESKTOP_PROP "_NET_WM_WINDOW_TYPE_DESKTOP" +/* This is defined wrong in my X11 header files! */ +#define VBoxShapeNotify 64 + /** * Wrapper class around the VBoxGuestX11Pointer to provide reference semantics. * See auto_ptr in the C++ <memory> header. @@ -288,12 +291,6 @@ private: // Private methods - // Methods to handle X11 events - void doConfigureEvent(const XConfigureEvent *event); - void doMapEvent(const XMapEvent *event); - void doUnmapEvent(const XUnmapEvent *event); - void doShapeEvent(const XShapeEvent *event); - // Methods to manage guest window information /** * Store information about a desktop window and register for structure events on it. @@ -349,6 +346,13 @@ public: /** Wake up the event thread if it is waiting for an event so that it can exit. */ bool interruptEvent(void); + /* Methods to handle X11 events. These are public so that the unit test + * can call them. */ + void doConfigureEvent(Window hWin); + void doMapEvent(Window hWin); + void doUnmapEvent(Window hWin); + void doShapeEvent(Window hWin); + VBoxGuestSeamlessX11(void) { mObserver = 0; mcRects = 0; mEnabled = false; mSupportsShape = false; diff --git a/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp b/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp new file mode 100644 index 000000000..c4de3bbff --- /dev/null +++ b/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp @@ -0,0 +1,642 @@ +/** @file + * Automated test of the X11 seamless Additions code. + */ + +/* + * Copyright (C) 2007 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +#include <iostream> +#include <stdlib.h> /* exit() */ + +#include <X11/Xatom.h> +#include <X11/Xmu/WinUtil.h> + +#include <iprt/initterm.h> +#include <iprt/mem.h> +#include <iprt/path.h> +#include <iprt/semaphore.h> +#include <iprt/stream.h> +#include <iprt/string.h> +#include <VBox/VBoxGuest.h> + +#include "../seamless.h" + +#undef DefaultRootWindow + +/****************************************************** +* Mock X11 functions needed by the seamless X11 class * +******************************************************/ + +int XFree(void *data) +{ + RTMemFree(data); + return 0; +} + +#define TEST_DISPLAY ((Display *)0xffff) +#define TEST_ROOT ((Window)1) + +extern "C" Display *XOpenDisplay(const char *display_name); +Display *XOpenDisplay(const char *display_name) +{ + return TEST_DISPLAY; +} + +extern "C" int XCloseDisplay(Display *display); +int XCloseDisplay(Display *display) +{ + Assert(display == TEST_DISPLAY); + return 0; +} + +enum +{ + ATOM_PROP = 1, + ATOM_DESKTOP_PROP +}; + +extern "C" Atom XInternAtom(Display *display, const char *atom_name, + Bool only_if_exists); +Atom XInternAtom(Display *display, const char *atom_name, Bool only_if_exists) +{ + if (!RTStrCmp(atom_name, WM_TYPE_PROP)) + return (Atom) ATOM_PROP; + if (!RTStrCmp(atom_name, WM_TYPE_DESKTOP_PROP)) + return (Atom) ATOM_DESKTOP_PROP; + AssertFailed(); + return (Atom)0; +} + +/** The window (if any) on which the WM_TYPE_PROP property is set to the + * WM_TYPE_DESKTOP_PROP atom. */ +static Window g_hSmlsDesktopWindow = 0; + +extern "C" int XGetWindowProperty(Display *display, Window w, Atom property, + long long_offset, long long_length, + Bool delProp, Atom req_type, + Atom *actual_type_return, + int *actual_format_return, + unsigned long *nitems_return, + unsigned long *bytes_after_return, + unsigned char **prop_return); +int XGetWindowProperty(Display *display, Window w, Atom property, + long long_offset, long long_length, Bool delProp, + Atom req_type, Atom *actual_type_return, + int *actual_format_return, + unsigned long *nitems_return, + unsigned long *bytes_after_return, + unsigned char **prop_return) +{ + Atom atomType = XInternAtom (NULL, WM_TYPE_PROP, true); + Atom atomTypeDesktop = XInternAtom (NULL, WM_TYPE_DESKTOP_PROP, true); + /* We only handle things we expect. */ + AssertReturn((req_type == XA_ATOM) || (req_type == AnyPropertyType), + 0xffff); + AssertReturn(property == atomType, 0xffff); + *actual_type_return = XA_ATOM; + *actual_format_return = sizeof(Atom) * 8; + *nitems_return = 0; + *bytes_after_return = sizeof(Atom); + *prop_return = NULL; + if ((w != g_hSmlsDesktopWindow) || (g_hSmlsDesktopWindow == 0)) + return Success; + AssertReturn(long_offset == 0, 0); + AssertReturn(delProp == false, 0); + unsigned char *pProp; + pProp = (unsigned char *)RTMemDup(&atomTypeDesktop, + sizeof(atomTypeDesktop)); + AssertReturn(pProp, 0xffff); + *nitems_return = 1; + *prop_return = pProp; + *bytes_after_return = 0; + return 0; +} + +/** Sets the current set of properties for all mock X11 windows */ +static void smlsSetDesktopWindow(Window hWin) +{ + g_hSmlsDesktopWindow = hWin; +} + +extern "C" Bool XShapeQueryExtension (Display *dpy, int *event_basep, + int *error_basep); +Bool XShapeQueryExtension (Display *dpy, int *event_basep, int *error_basep) +{ + return true; +} + +/* We silently ignore this for now. */ +extern "C" int XSelectInput(Display *display, Window w, long event_mask); +int XSelectInput(Display *display, Window w, long event_mask) +{ + return 0; +} + +/* We silently ignore this for now. */ +extern "C" void XShapeSelectInput(Display *display, Window w, + unsigned long event_mask); +void XShapeSelectInput(Display *display, Window w, unsigned long event_mask) +{} + +extern "C" Window XDefaultRootWindow(Display *display); +Window XDefaultRootWindow(Display *display) +{ + return TEST_ROOT; +} + +static unsigned g_cSmlsWindows = 0; +static Window *g_paSmlsWindows = NULL; +static XWindowAttributes *g_paSmlsWinAttribs = NULL; +static const char **g_papszSmlsWinNames = NULL; + +extern "C" Status XQueryTree(Display *display, Window w, Window *root_return, + Window *parent_return, Window **children_return, + unsigned int *nchildren_return); +Status XQueryTree(Display *display, Window w, Window *root_return, + Window *parent_return, Window **children_return, + unsigned int *nchildren_return) +{ + AssertReturn(w == TEST_ROOT, False); /* We support nothing else */ + AssertPtrReturn(children_return, False); + AssertReturn(g_paSmlsWindows, False); + if (root_return) + *root_return = TEST_ROOT; + if (parent_return) + *parent_return = TEST_ROOT; + *children_return = (Window *)RTMemDup(g_paSmlsWindows, + g_cSmlsWindows * sizeof(Window)); + if (nchildren_return) + *nchildren_return = g_cSmlsWindows; + return (g_cSmlsWindows != 0); +} + +extern "C" Window XmuClientWindow(Display *dpy, Window win); +Window XmuClientWindow(Display *dpy, Window win) +{ + return win; +} + +extern "C" Status XGetWindowAttributes(Display *display, Window w, + XWindowAttributes *window_attributes_return); +Status XGetWindowAttributes(Display *display, Window w, + XWindowAttributes *window_attributes_return) +{ + AssertPtrReturn(window_attributes_return, 1); + for (unsigned i = 0; i < g_cSmlsWindows; ++i) + if (g_paSmlsWindows[i] == w) + { + *window_attributes_return = g_paSmlsWinAttribs[i]; + return 1; + } + return 0; +} + +extern "C" Status XFetchName(Display *display, Window w, + char **window_name_return); +Status XFetchName(Display *display, Window w, char **window_name_return) +{ + AssertPtrReturn(window_name_return, 1); + for (unsigned i = 0; i < g_cSmlsWindows; ++i) + if (g_paSmlsWindows[i] == w) + { + *window_name_return = (char *)RTMemDup(g_papszSmlsWinNames[i], + strlen(g_papszSmlsWinNames[i]) + 1); + return *window_name_return != NULL; + } + return 0; +} + +static void smlsSetWindowAttributes(XWindowAttributes *pAttribs, + Window *pWindows, unsigned cAttribs, + const char **paNames) +{ + g_paSmlsWinAttribs = pAttribs; + g_paSmlsWindows = pWindows; + g_cSmlsWindows = cAttribs; + g_papszSmlsWinNames = paNames; +} + +static Window g_SmlsShapedWindow = 0; +static int g_cSmlsShapeRectangles = 0; +static XRectangle *g_pSmlsShapeRectangles = NULL; + +extern "C" XRectangle *XShapeGetRectangles (Display *dpy, Window window, + int kind, int *count, + int *ordering); +XRectangle *XShapeGetRectangles (Display *dpy, Window window, int kind, + int *count, int *ordering) +{ + if ((window != g_SmlsShapedWindow) || (window == 0)) + return NULL; /* Probably not correct, but works for us. */ + *count = g_cSmlsShapeRectangles; + *ordering = 0; + return (XRectangle *)RTMemDup(g_pSmlsShapeRectangles, + sizeof(XRectangle) + * g_cSmlsShapeRectangles); +} + +static void smlsSetShapeRectangles(Window window, int cRects, + XRectangle *pRects) +{ + g_SmlsShapedWindow = window; + g_cSmlsShapeRectangles = cRects; + g_pSmlsShapeRectangles = pRects; +} + +/* This should not be needed in the bits of the code we test. */ +extern "C" int XNextEvent(Display *display, XEvent *event_return); +int XNextEvent(Display *display, XEvent *event_return) +{ + AssertFailedReturn(0); +} + +/* This should not be needed in the bits of the code we test. */ +extern "C" Status XSendEvent(Display *display, Window w, Bool propagate, + long event_mask, XEvent *event_send); +Status XSendEvent(Display *display, Window w, Bool propagate, + long event_mask, XEvent *event_send) +{ + AssertFailedReturn(0); +} + +/* This should not be needed in the bits of the code we test. */ +extern "C" int XFlush(Display *display); +int XFlush(Display *display) +{ + AssertFailedReturn(0); +} + +/***************************** +* The actual tests to be run * +*****************************/ + +/** The name of the unit test */ +static const char *g_pszTestName = NULL; + +/*** Test fixture data and data structures ***/ + +/** A structure describing a test fixture to be run through. Each fixture + * describes the state of the windows visible (and unmapped) on the X server + * before and after a particular event is delivered, and the expected + * on-screen positions of all interesting visible windows at the end of the + * fixture as reported by the code (currently in the order it is likely to + * report them in, @todo sort this). We expect that the set of visible + * windows will be the same whether we start the code before the event and + * handle it or start the code after the event. + * + * If it is ever needed I could write a small tool to record a fixture on + * a live guest, but I will put that off as long as I can. + */ +struct SMLSFIXTURE +{ + /** The number of windows visible before the event */ + unsigned cWindowsBefore; + /** An array of Window IDs for the visible and unmapped windows before + * the event */ + Window *pahWindowsBefore; + /** The window attributes matching the windows in @a paWindowsBefore */ + XWindowAttributes *paAttribsBefore; + /** The window names matching the windows in @a paWindowsBefore */ + const char **papszNamesBefore; + /** The shaped window before the event - we allow at most one of these. + * Zero for none. */ + Window hShapeWindowBefore; + /** The number of rectangles in the shaped window before the event. */ + int cShapeRectsBefore; + /** The rectangles in the shaped window before the event */ + XRectangle *paShapeRectsBefore; + /** The number of windows visible after the event */ + unsigned cWindowsAfter; + /** An array of Window IDs for the visible and unmapped windows after + * the event */ + Window *pahWindowsAfter; + /** The window attributes matching the windows in @a paWindowsAfter */ + XWindowAttributes *paAttribsAfter; + /** The window names matching the windows in @a paWindowsAfter */ + const char **papszNamesAfter; + /** The shaped window after the event - we allow at most one of these. + * Zero for none. */ + Window hShapeWindowAfter; + /** The number of rectangles in the shaped window after the event. */ + int cShapeRectsAfter; + /** The rectangles in the shaped window after the event */ + XRectangle *paShapeRectsAfter; + /** The event to delivered */ + int x11EventType; + /** The windows for which the event in @enmEvent is delivered */ + Window hEventWindow; + /** The number of windows expected to be reported at the end of the + * fixture */ + unsigned cReportedRects; + /** The onscreen positions of those windows. */ + RTRECT *paReportedRects; +}; + +/*** Test fixture to test the code against X11 configure (move) events ***/ + +static Window g_ahWin1[] = { 20 }; +static XWindowAttributes g_aAttrib1Before[] = +{ { 100, 200, 200, 300, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + IsViewable } +}; +static XRectangle g_aRectangle1[] = +{ + { 0, 0, 50, 50 }, + { 50, 50, 150, 250 } +}; +static XWindowAttributes g_aAttrib1After[] = +{ { 200, 300, 200, 300, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + IsViewable } +}; +static const char *g_apszNames1[] = { "Test Window" }; + +AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib1Before)); +AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib1After)); +AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_apszNames1)); + +static RTRECT g_aRects1[] = +{ + { 200, 300, 250, 350 }, + { 250, 350, 400, 600 } +}; + +static SMLSFIXTURE g_testMove = +{ + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib1Before, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle1), + g_aRectangle1, + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib1After, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle1), + g_aRectangle1, + ConfigureNotify, + 20, + RT_ELEMENTS(g_aRects1), + g_aRects1 +}; + +/*** Test fixture to test the code against X11 configure (resize) events ***/ + +static XWindowAttributes g_aAttrib2Before[] = +{ { 100, 200, 200, 300, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + IsViewable } +}; +static XRectangle g_aRectangle2Before[] = +{ + { 0, 0, 50, 50 }, + { 50, 50, 100, 100 } +}; + +AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib2Before)); + +static SMLSFIXTURE g_testResize = +{ + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib2Before, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle2Before), + g_aRectangle2Before, + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib1After, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle1), + g_aRectangle1, + ConfigureNotify, + 20, + RT_ELEMENTS(g_aRects1), + g_aRects1 +}; + +/*** Test fixture to test the code against X11 map events ***/ + +static XWindowAttributes g_aAttrib3Before[] = +{ { 200, 300, 200, 300, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + IsUnmapped } +}; + +AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib3Before)); + +static SMLSFIXTURE g_testMap = +{ + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib3Before, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle1), + g_aRectangle1, + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib1After, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle1), + g_aRectangle1, + MapNotify, + 20, + RT_ELEMENTS(g_aRects1), + g_aRects1 +}; + +/*** Test fixture to test the code against X11 unmap events ***/ + +static XWindowAttributes g_aAttrib4After[] = +{ { 100, 200, 300, 400, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + IsUnmapped } +}; + +AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib4After)); + +static SMLSFIXTURE g_testUnmap = +{ + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib1Before, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle1), + g_aRectangle1, + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib4After, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle1), + g_aRectangle1, + UnmapNotify, + 20, + 0, + NULL +}; + +/*** Test fixture to test the code against X11 shape events ***/ + +static XRectangle g_aRectangle5Before[] = +{ + { 0, 0, 200, 200 } +}; + +static SMLSFIXTURE g_testShape = +{ + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib1After, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle5Before), + g_aRectangle5Before, + RT_ELEMENTS(g_ahWin1), + g_ahWin1, + g_aAttrib1After, + g_apszNames1, + 20, + RT_ELEMENTS(g_aRectangle1), + g_aRectangle1, + VBoxShapeNotify, + 20, + RT_ELEMENTS(g_aRects1), + g_aRects1 +}; + +/*** And the test code proper ***/ + +/** Compare two RTRECT structures */ +static bool smlsCompRect(RTRECT *pFirst, RTRECT *pSecond) +{ + return ( (pFirst->xLeft == pSecond->xLeft) + && (pFirst->yTop == pSecond->yTop) + && (pFirst->xRight == pSecond->xRight) + && (pFirst->yBottom == pSecond->yBottom)); +} + +static void smlsPrintDiffRects(RTRECT *pExp, RTRECT *pGot) +{ + RTPrintf(" Expected: %d, %d, %d, %d. Got: %d, %d, %d, %d\n", + pExp->xLeft, pExp->yTop, pExp->xRight, pExp->yBottom, + pGot->xLeft, pGot->yTop, pGot->xRight, pGot->yBottom); +} + +/** Run through a test fixture */ +static unsigned smlsDoFixture(SMLSFIXTURE *pFixture, const char *pszDesc) +{ + VBoxGuestSeamlessX11 subject; + unsigned cErrs = 0; + + subject.init(NULL); + smlsSetWindowAttributes(pFixture->paAttribsBefore, + pFixture->pahWindowsBefore, + pFixture->cWindowsBefore, + pFixture->papszNamesBefore); + smlsSetShapeRectangles(pFixture->hShapeWindowBefore, + pFixture->cShapeRectsBefore, + pFixture->paShapeRectsBefore); + subject.start(); + smlsSetWindowAttributes(pFixture->paAttribsAfter, + pFixture->pahWindowsAfter, + pFixture->cWindowsAfter, + pFixture->papszNamesAfter); + smlsSetShapeRectangles(pFixture->hShapeWindowAfter, + pFixture->cShapeRectsAfter, + pFixture->paShapeRectsAfter); + switch(pFixture->x11EventType) + { + case ConfigureNotify: + subject.doConfigureEvent(pFixture->hEventWindow); + break; + case MapNotify: + subject.doMapEvent(pFixture->hEventWindow); + break; + case UnmapNotify: + subject.doUnmapEvent(pFixture->hEventWindow); + break; + case VBoxShapeNotify: + subject.doShapeEvent(pFixture->hEventWindow); + break; + default: + break; + } + std::auto_ptr<std::vector<RTRECT> > rects = subject.getRects(); + if (rects->size() != pFixture->cReportedRects) + { + RTPrintf("%s: fixture: %s. Wrong number of rectangles reported after processing event (expected %u, got %u).\n", + g_pszTestName, pszDesc, pFixture->cReportedRects, + (*rects).size()); + ++cErrs; + } + else + for (unsigned i = 0; i < rects->size(); ++i) + if (!smlsCompRect(&(*rects)[i], &pFixture->paReportedRects[i])) + { + RTPrintf("%s: fixture: %s. Rectangle %u wrong after processing event.\n", + g_pszTestName, pszDesc, i); + smlsPrintDiffRects(&pFixture->paReportedRects[i], + &(*rects)[i]); + ++cErrs; + break; + } + subject.stop(); + subject.start(); + if (rects->size() != pFixture->cReportedRects) + { + RTPrintf("%s: fixture: %s. Wrong number of rectangles reported without processing event (expected %u, got %u).\n", + g_pszTestName, pszDesc, pFixture->cReportedRects, + (*rects).size()); + ++cErrs; + } + else + for (unsigned i = 0; i < rects->size(); ++i) + if (!smlsCompRect(&(*rects)[i], &pFixture->paReportedRects[i])) + { + RTPrintf("%s: fixture: %s. Rectangle %u wrong without processing event.\n", + g_pszTestName, pszDesc, i); + smlsPrintDiffRects(&pFixture->paReportedRects[i], + &(*rects)[i]); + ++cErrs; + break; + } + return cErrs; +} + +int main( int argc, char **argv) +{ + RTR3Init(); + unsigned cErrs = 0; + g_pszTestName = RTPathFilename(argv[0]); + + RTPrintf("%s: TESTING\n", g_pszTestName); + cErrs += smlsDoFixture(&g_testMove, + "ConfigureNotify event (window moved)"); + // Currently not working + cErrs += smlsDoFixture(&g_testResize, + "ConfigureNotify event (window resized)"); + cErrs += smlsDoFixture(&g_testMap, "MapNotify event"); + cErrs += smlsDoFixture(&g_testUnmap, "UnmapNotify event"); + cErrs += smlsDoFixture(&g_testShape, "ShapeNotify event"); + if (cErrs > 0) + RTPrintf("%u errors\n", cErrs); + return cErrs == 0 ? 0 : 1; +} diff --git a/src/VBox/Additions/x11/vboxmouse/Makefile.kmk b/src/VBox/Additions/x11/vboxmouse/Makefile.kmk index b90dd9e3a..29115aa47 100644 --- a/src/VBox/Additions/x11/vboxmouse/Makefile.kmk +++ b/src/VBox/Additions/x11/vboxmouse/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20962 2009-06-26 09:23:18Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VBox Additions XFree86 and X.org mouse drivers. # diff --git a/src/VBox/Additions/x11/vboxmouse/undefined_14 b/src/VBox/Additions/x11/vboxmouse/undefined_14 index 8ea6cd7be..dc36a0694 100644 --- a/src/VBox/Additions/x11/vboxmouse/undefined_14 +++ b/src/VBox/Additions/x11/vboxmouse/undefined_14 @@ -135,3 +135,7 @@ __register_frame_info_bases ___errno strpbrk __iob +__moddi3 +__umoddi3 +__udivdi3 +__divdi3 diff --git a/src/VBox/Additions/x11/vboxmouse/undefined_15 b/src/VBox/Additions/x11/vboxmouse/undefined_15 index 91f34b248..f30b30819 100644 --- a/src/VBox/Additions/x11/vboxmouse/undefined_15 +++ b/src/VBox/Additions/x11/vboxmouse/undefined_15 @@ -81,3 +81,7 @@ ___errno ftruncate strpbrk __iob +__udivdi3 +__umoddi3 +__divdi3 +__moddi3 diff --git a/src/VBox/Additions/x11/vboxmouse/undefined_16 b/src/VBox/Additions/x11/vboxmouse/undefined_16 index aecf4cceb..a2bca9c64 100644 --- a/src/VBox/Additions/x11/vboxmouse/undefined_16 +++ b/src/VBox/Additions/x11/vboxmouse/undefined_16 @@ -80,3 +80,7 @@ ___errno ftruncate strpbrk __iob +__divdi3 +__umoddi3 +__moddi3 +__udivdi3 diff --git a/src/VBox/Additions/x11/vboxmouse/undefined_70 b/src/VBox/Additions/x11/vboxmouse/undefined_70 index a8680aadf..17f60f52c 100644 --- a/src/VBox/Additions/x11/vboxmouse/undefined_70 +++ b/src/VBox/Additions/x11/vboxmouse/undefined_70 @@ -139,3 +139,7 @@ lseek stat strpbrk __iob +__divdi3 +__umoddi3 +__udivdi3 +__moddi3 diff --git a/src/VBox/Additions/x11/vboxmouse/undefined_71 b/src/VBox/Additions/x11/vboxmouse/undefined_71 index 11edf846d..af0f7a6a2 100644 --- a/src/VBox/Additions/x11/vboxmouse/undefined_71 +++ b/src/VBox/Additions/x11/vboxmouse/undefined_71 @@ -137,3 +137,7 @@ fstat ftruncate strpbrk __iob +__moddi3 +__umoddi3 +__udivdi3 +__divdi3 diff --git a/src/VBox/Additions/x11/vboxvideo/Makefile.kmk b/src/VBox/Additions/x11/vboxvideo/Makefile.kmk index f430107bc..17d5a01ec 100644 --- a/src/VBox/Additions/x11/vboxvideo/Makefile.kmk +++ b/src/VBox/Additions/x11/vboxvideo/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20962 2009-06-26 09:23:18Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VBox Linux Additions X.org graphics driver. # diff --git a/src/VBox/Additions/x11/vboxvideo/undefined_13 b/src/VBox/Additions/x11/vboxvideo/undefined_13 index 5e3b26435..a48219305 100644 --- a/src/VBox/Additions/x11/vboxvideo/undefined_13 +++ b/src/VBox/Additions/x11/vboxvideo/undefined_13 @@ -143,3 +143,8 @@ stat nl_langinfo strpbrk __iob +__udivdi3 +__divdi3 +__umoddi3 +__moddi3 + diff --git a/src/VBox/Additions/x11/vboxvideo/undefined_14 b/src/VBox/Additions/x11/vboxvideo/undefined_14 index 5e3b26435..b114494b0 100644 --- a/src/VBox/Additions/x11/vboxvideo/undefined_14 +++ b/src/VBox/Additions/x11/vboxvideo/undefined_14 @@ -143,3 +143,7 @@ stat nl_langinfo strpbrk __iob +__udivdi3 +__divdi3 +__umoddi3 +__moddi3 diff --git a/src/VBox/Additions/x11/vboxvideo/undefined_15 b/src/VBox/Additions/x11/vboxvideo/undefined_15 index 27ea1274a..39c6fa88d 100644 --- a/src/VBox/Additions/x11/vboxvideo/undefined_15 +++ b/src/VBox/Additions/x11/vboxvideo/undefined_15 @@ -155,3 +155,7 @@ nl_langinfo sscanf strpbrk __iob +__divdi3 +__umoddi3 +__moddi3 +__udivdi3 diff --git a/src/VBox/Additions/x11/vboxvideo/undefined_16 b/src/VBox/Additions/x11/vboxvideo/undefined_16 index 27ea1274a..39c6fa88d 100644 --- a/src/VBox/Additions/x11/vboxvideo/undefined_16 +++ b/src/VBox/Additions/x11/vboxvideo/undefined_16 @@ -155,3 +155,7 @@ nl_langinfo sscanf strpbrk __iob +__divdi3 +__umoddi3 +__moddi3 +__udivdi3 diff --git a/src/VBox/Additions/x11/vboxvideo/undefined_70 b/src/VBox/Additions/x11/vboxvideo/undefined_70 index 89f02cc69..6d73dd241 100644 --- a/src/VBox/Additions/x11/vboxvideo/undefined_70 +++ b/src/VBox/Additions/x11/vboxvideo/undefined_70 @@ -137,3 +137,7 @@ open stat strpbrk __iob +__umoddi3 +__udivdi3 +__moddi3 +__divdi3 diff --git a/src/VBox/Additions/x11/vboxvideo/undefined_71 b/src/VBox/Additions/x11/vboxvideo/undefined_71 index 89f02cc69..6d73dd241 100644 --- a/src/VBox/Additions/x11/vboxvideo/undefined_71 +++ b/src/VBox/Additions/x11/vboxvideo/undefined_71 @@ -137,3 +137,7 @@ open stat strpbrk __iob +__umoddi3 +__udivdi3 +__moddi3 +__divdi3 diff --git a/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c b/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c index 24486c78c..9341dcc13 100644 --- a/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c +++ b/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c @@ -1,4 +1,4 @@ -/** @file $Id: vboxvideo_dri.c 20877 2009-06-24 06:23:48Z vboxsync $ +/** @file $Id: vboxvideo_dri.c $ * * VirtualBox X11 Additions graphics driver, DRI support */ diff --git a/src/VBox/Additions/x11/x11include/7.0/X11/XlibConf.h b/src/VBox/Additions/x11/x11include/7.0/X11/XlibConf.h index 22f7eeaa7..1b0d60206 100644 --- a/src/VBox/Additions/x11/x11include/7.0/X11/XlibConf.h +++ b/src/VBox/Additions/x11/x11include/7.0/X11/XlibConf.h @@ -1,6 +1,6 @@ /* include/X11/XlibConf.h. Generated by configure. */ /* - * $Id: XlibConf.h.in,v 1.1 2005/07/08 06:57:07 keithp Exp $ + * $Id: XlibConf.h.in $ * * Copyright © 2005 Keith Packard * diff --git a/src/VBox/Additions/x11/x11include/7.0/X11/extensions/composite.h b/src/VBox/Additions/x11/x11include/7.0/X11/extensions/composite.h index bfdfbee97..e449b2ed8 100644 --- a/src/VBox/Additions/x11/x11include/7.0/X11/extensions/composite.h +++ b/src/VBox/Additions/x11/x11include/7.0/X11/extensions/composite.h @@ -1,5 +1,5 @@ /* - * $Id: composite.h,v 1.2 2004/07/31 06:16:50 anholt Exp $ + * $Id: composite.h $ * * Copyright © 2003 Keith Packard * diff --git a/src/VBox/Additions/x11/x11include/7.0/X11/extensions/compositeproto.h b/src/VBox/Additions/x11/x11include/7.0/X11/extensions/compositeproto.h index 2304e961d..5f9cffef4 100644 --- a/src/VBox/Additions/x11/x11include/7.0/X11/extensions/compositeproto.h +++ b/src/VBox/Additions/x11/x11include/7.0/X11/extensions/compositeproto.h @@ -1,5 +1,5 @@ /* - * $Id: compositeproto.h,v 1.2 2004/07/31 06:16:50 anholt Exp $ + * $Id: compositeproto.h $ * * Copyright © 2003 Keith Packard * diff --git a/src/VBox/Additions/x11/x11include/7.0/X11/extensions/damageproto.h b/src/VBox/Additions/x11/x11include/7.0/X11/extensions/damageproto.h index b190d68c7..833a584f2 100644 --- a/src/VBox/Additions/x11/x11include/7.0/X11/extensions/damageproto.h +++ b/src/VBox/Additions/x11/x11include/7.0/X11/extensions/damageproto.h @@ -1,5 +1,5 @@ /* - * $Id: damageproto.h,v 1.2 2004/07/29 19:29:55 stukreit Exp $ + * $Id: damageproto.h $ * * Copyright © 2003 Keith Packard * diff --git a/src/VBox/Additions/x11/x11include/7.0/X11/extensions/damagewire.h b/src/VBox/Additions/x11/x11include/7.0/X11/extensions/damagewire.h index d523cea98..dc7221ffb 100644 --- a/src/VBox/Additions/x11/x11include/7.0/X11/extensions/damagewire.h +++ b/src/VBox/Additions/x11/x11include/7.0/X11/extensions/damagewire.h @@ -1,5 +1,5 @@ /* - * $Id: damagewire.h,v 1.2 2004/07/29 19:29:55 stukreit Exp $ + * $Id: damagewire.h $ * * Copyright © 2003 Keith Packard * diff --git a/src/VBox/Additions/x11/x11include/7.0/xorg/picturestr.h b/src/VBox/Additions/x11/x11include/7.0/xorg/picturestr.h index 4775793ab..84e5e190b 100644 --- a/src/VBox/Additions/x11/x11include/7.0/xorg/picturestr.h +++ b/src/VBox/Additions/x11/x11include/7.0/xorg/picturestr.h @@ -1,5 +1,5 @@ /* - * $Id: picturestr.h,v 1.15 2005/12/09 18:35:21 ajax Exp $ + * $Id: picturestr.h $ * * Copyright © 2000 SuSE, Inc. * diff --git a/src/VBox/Additions/x11/x11include/7.0/xorg/renderedge.h b/src/VBox/Additions/x11/x11include/7.0/xorg/renderedge.h index bfd19fa93..00013b7af 100644 --- a/src/VBox/Additions/x11/x11include/7.0/xorg/renderedge.h +++ b/src/VBox/Additions/x11/x11include/7.0/xorg/renderedge.h @@ -1,5 +1,5 @@ /* - * $Id: renderedge.h,v 1.4 2005/08/24 11:18:33 daniels Exp $ + * $Id: renderedge.h $ * * Copyright © 2004 Keith Packard * diff --git a/src/VBox/Additions/x11/x11include/7.0/xorg/uda1380.h b/src/VBox/Additions/x11/x11include/7.0/xorg/uda1380.h index 43925f42f..e555855a3 100644 --- a/src/VBox/Additions/x11/x11include/7.0/xorg/uda1380.h +++ b/src/VBox/Additions/x11/x11include/7.0/xorg/uda1380.h @@ -1,5 +1,5 @@ /************************************************************************************* - * $Id: uda1380.h,v 1.3 2005/09/24 21:56:00 bogdand Exp $ + * $Id: uda1380.h $ * * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net * diff --git a/src/VBox/Additions/x11/x11include/7.1/xorg/damage.h b/src/VBox/Additions/x11/x11include/7.1/xorg/damage.h index cfc2b5f07..9b6105032 100644 --- a/src/VBox/Additions/x11/x11include/7.1/xorg/damage.h +++ b/src/VBox/Additions/x11/x11include/7.1/xorg/damage.h @@ -1,5 +1,5 @@ /* - * $Id: damage.h,v 1.3 2005/07/01 22:43:41 daniels Exp $ + * $Id: damage.h $ * * Copyright © 2003 Keith Packard * diff --git a/src/VBox/Additions/x11/x11include/7.1/xorg/damagestr.h b/src/VBox/Additions/x11/x11include/7.1/xorg/damagestr.h index ce11af10c..ed6068bc7 100644 --- a/src/VBox/Additions/x11/x11include/7.1/xorg/damagestr.h +++ b/src/VBox/Additions/x11/x11include/7.1/xorg/damagestr.h @@ -1,5 +1,5 @@ /* - * $Id: damagestr.h,v 1.6 2005/07/03 07:02:01 daniels Exp $ + * $Id: damagestr.h $ * * Copyright © 2003 Keith Packard * diff --git a/src/VBox/Additions/x11/x11include/7.1/xorg/picturestr.h b/src/VBox/Additions/x11/x11include/7.1/xorg/picturestr.h index b9ee6f14d..14d334b54 100644 --- a/src/VBox/Additions/x11/x11include/7.1/xorg/picturestr.h +++ b/src/VBox/Additions/x11/x11include/7.1/xorg/picturestr.h @@ -1,5 +1,5 @@ /* - * $Id: picturestr.h,v 1.14 2005/08/24 11:18:33 daniels Exp $ + * $Id: picturestr.h $ * * Copyright © 2000 SuSE, Inc. * diff --git a/src/VBox/Additions/x11/x11include/compositeproto-0.4/X11/extensions/composite.h b/src/VBox/Additions/x11/x11include/compositeproto-0.4/X11/extensions/composite.h index 30b190fde..6632c1017 100644 --- a/src/VBox/Additions/x11/x11include/compositeproto-0.4/X11/extensions/composite.h +++ b/src/VBox/Additions/x11/x11include/compositeproto-0.4/X11/extensions/composite.h @@ -1,5 +1,5 @@ /* - * $Id: composite.h,v 1.4 2004/07/08 07:20:55 keithp Exp $ + * $Id: composite.h $ * * Copyright © 2006 Sun Microsystems * diff --git a/src/VBox/Additions/x11/x11include/compositeproto-0.4/X11/extensions/compositeproto.h b/src/VBox/Additions/x11/x11include/compositeproto-0.4/X11/extensions/compositeproto.h index c57628c9d..09c90d71b 100644 --- a/src/VBox/Additions/x11/x11include/compositeproto-0.4/X11/extensions/compositeproto.h +++ b/src/VBox/Additions/x11/x11include/compositeproto-0.4/X11/extensions/compositeproto.h @@ -1,5 +1,5 @@ /* - * $Id: compositeproto.h,v 1.4 2004/07/08 07:20:55 keithp Exp $ + * $Id: compositeproto.h $ * * * Copyright © 2006 Sun Microsystems diff --git a/src/VBox/Additions/x11/x11include/damageproto-1.1.0/X11/extensions/damageproto.h b/src/VBox/Additions/x11/x11include/damageproto-1.1.0/X11/extensions/damageproto.h index d3bb04529..68f3f6106 100644 --- a/src/VBox/Additions/x11/x11include/damageproto-1.1.0/X11/extensions/damageproto.h +++ b/src/VBox/Additions/x11/x11include/damageproto-1.1.0/X11/extensions/damageproto.h @@ -1,5 +1,5 @@ /* - * $Id: damageproto.h,v 1.1 2003-10-24 06:16:46 keithp Exp $ + * $Id: damageproto.h $ * * Copyright © 2003 Keith Packard * Copyright © 2007 Eric Anholt diff --git a/src/VBox/Additions/x11/x11include/damageproto-1.1.0/X11/extensions/damagewire.h b/src/VBox/Additions/x11/x11include/damageproto-1.1.0/X11/extensions/damagewire.h index 466f0d0e3..9e64afd5e 100644 --- a/src/VBox/Additions/x11/x11include/damageproto-1.1.0/X11/extensions/damagewire.h +++ b/src/VBox/Additions/x11/x11include/damageproto-1.1.0/X11/extensions/damagewire.h @@ -1,5 +1,5 @@ /* - * $Id: damagewire.h,v 1.1 2003-10-24 06:16:46 keithp Exp $ + * $Id: damagewire.h $ * * Copyright © 2003 Keith Packard * diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/sparc/sparc.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/sparc/sparc.h index 55ab12122..835bdf4b1 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/sparc/sparc.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/sparc/sparc.h @@ -1,4 +1,4 @@ -/* $Id: sparc.h,v 1.3 2001/06/06 22:55:28 davem69 Exp $ */ +/* $Id: sparc.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86-64/x86-64.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86-64/x86-64.h index fdbd154d5..a6b68d527 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86-64/x86-64.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86-64/x86-64.h @@ -1,4 +1,4 @@ -/* $Id: x86-64.h,v 1.1 2005/05/07 16:59:59 brianp Exp $ */ +/* $Id: x86-64.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/3dnow.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/3dnow.h index 1f2fd8e8b..673d45994 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/3dnow.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/3dnow.h @@ -1,4 +1,4 @@ -/* $Id: 3dnow.h,v 1.6 2002/04/09 14:58:03 keithw Exp $ */ +/* $Id: 3dnow.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/clip_args.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/clip_args.h index cccf80198..7540c6a49 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/clip_args.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/clip_args.h @@ -1,4 +1,4 @@ -/* $Id: clip_args.h,v 1.5 2002/10/29 20:28:57 brianp Exp $ */ +/* $Id: clip_args.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_asm.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_asm.h index 997729832..e093b1872 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_asm.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_asm.h @@ -1,4 +1,4 @@ -/* $Id: common_x86_asm.h,v 1.12 2005/07/16 00:56:20 ajax Exp $ */ +/* $Id: common_x86_asm.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_features.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_features.h index 90509775c..9a0cedc99 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_features.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_features.h @@ -1,4 +1,4 @@ -/* $Id: common_x86_features.h,v 1.6 2003/01/21 16:14:00 brianp Exp $ */ +/* $Id: common_x86_features.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_macros.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_macros.h index ba155caae..43033732b 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_macros.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/common_x86_macros.h @@ -1,4 +1,4 @@ -/* $Id: common_x86_macros.h,v 1.3 2002/10/29 20:28:58 brianp Exp $ */ +/* $Id: common_x86_macros.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/norm_args.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/norm_args.h index 1b43d57a2..1e7d79c67 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/norm_args.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/norm_args.h @@ -1,4 +1,4 @@ -/* $Id: norm_args.h,v 1.4 2003/11/26 08:32:36 dborca Exp $ */ +/* $Id: norm_args.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/sse.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/sse.h index 98146a904..fe1233653 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/sse.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/sse.h @@ -1,4 +1,4 @@ -/* $Id: sse.h,v 1.2 2002/04/09 14:58:03 keithw Exp $ */ +/* $Id: sse.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/x86.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/x86.h index a646aff46..8d529110b 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/x86.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/x86.h @@ -1,4 +1,4 @@ -/* $Id: x86.h,v 1.5 2002/04/09 14:58:03 keithw Exp $ */ +/* $Id: x86.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/xform_args.h b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/xform_args.h index 89a04205c..6bc1b8060 100644 --- a/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/xform_args.h +++ b/src/VBox/Additions/x11/x11include/mesa-7.2/src/mesa/x86/xform_args.h @@ -1,4 +1,4 @@ -/* $Id: xform_args.h,v 1.5 2002/10/29 20:28:58 brianp Exp $ */ +/* $Id: xform_args.h $ */ /* * Mesa 3-D graphics library diff --git a/src/VBox/Additions/x11/x11stubs/Makefile.kmk b/src/VBox/Additions/x11/x11stubs/Makefile.kmk index 674951445..7268ac735 100644 --- a/src/VBox/Additions/x11/x11stubs/Makefile.kmk +++ b/src/VBox/Additions/x11/x11stubs/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 43187 2009-02-23 09:24:17Z michael $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the X11 linker stub (import) libraries. # diff --git a/src/VBox/Devices/Audio/DevIchAc97.cpp b/src/VBox/Devices/Audio/DevIchAc97.cpp index 6221098f5..fae06115b 100644 --- a/src/VBox/Devices/Audio/DevIchAc97.cpp +++ b/src/VBox/Devices/Audio/DevIchAc97.cpp @@ -1,4 +1,4 @@ -/* $Id: DevIchAc97.cpp 18645 2009-04-02 15:38:31Z vboxsync $ */ +/* $Id: DevIchAc97.cpp $ */ /** @file * DevIchAc97 - VBox ICH AC97 Audio Controller. */ diff --git a/src/VBox/Devices/Audio/DevSB16.cpp b/src/VBox/Devices/Audio/DevSB16.cpp index 10405cd74..c4532a5f0 100644 --- a/src/VBox/Devices/Audio/DevSB16.cpp +++ b/src/VBox/Devices/Audio/DevSB16.cpp @@ -1,4 +1,4 @@ -/* $Id: DevSB16.cpp 20087 2009-05-27 14:31:18Z vboxsync $ */ +/* $Id: DevSB16.cpp $ */ /** @file * DevSB16 - VBox SB16 Audio Controller. * diff --git a/src/VBox/Devices/Audio/solaudio.c b/src/VBox/Devices/Audio/solaudio.c index a0436e272..350fbab32 100644 --- a/src/VBox/Devices/Audio/solaudio.c +++ b/src/VBox/Devices/Audio/solaudio.c @@ -1,4 +1,4 @@ -/* $Id: solaudio.c 8345 2008-04-24 07:08:53Z vboxsync $ */ +/* $Id: solaudio.c $ */ /** @file * VirtualBox Audio Driver - Solaris host. */ diff --git a/src/VBox/Devices/Builtins.cpp b/src/VBox/Devices/Builtins.cpp index 6d26d6905..776a9976a 100644 --- a/src/VBox/Devices/Builtins.cpp +++ b/src/VBox/Devices/Builtins.cpp @@ -1,4 +1,4 @@ -/* $Id: Builtins.cpp 20167 2009-06-01 20:25:54Z vboxsync $ */ +/* $Id: Builtins.cpp $ */ /** @file * Built-in drivers & devices (part 1) */ diff --git a/src/VBox/Devices/Builtins.h b/src/VBox/Devices/Builtins.h index 41b9cab1f..086e2ded5 100644 --- a/src/VBox/Devices/Builtins.h +++ b/src/VBox/Devices/Builtins.h @@ -1,4 +1,4 @@ -/* $Id: Builtins.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: Builtins.h $ */ /** @file * Built-in drivers & devices (part 1) header. */ diff --git a/src/VBox/Devices/Builtins2.h b/src/VBox/Devices/Builtins2.h index 993ca090a..d8130d505 100644 --- a/src/VBox/Devices/Builtins2.h +++ b/src/VBox/Devices/Builtins2.h @@ -1,4 +1,4 @@ -/* $Id: Builtins2.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: Builtins2.h $ */ /** @file * Built-in drivers & devices (part 2) header. */ diff --git a/src/VBox/Devices/Bus/DevPCI.cpp b/src/VBox/Devices/Bus/DevPCI.cpp index 87f58c696..9012abf8e 100644 --- a/src/VBox/Devices/Bus/DevPCI.cpp +++ b/src/VBox/Devices/Bus/DevPCI.cpp @@ -1,4 +1,4 @@ -/* $Id: DevPCI.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: DevPCI.cpp $ */ /** @file * DevPCI - PCI BUS Device. */ diff --git a/src/VBox/Devices/Bus/PCIInternal.h b/src/VBox/Devices/Bus/PCIInternal.h index e5bbb7ecf..997203138 100644 --- a/src/VBox/Devices/Bus/PCIInternal.h +++ b/src/VBox/Devices/Bus/PCIInternal.h @@ -1,4 +1,4 @@ -/* $Id: PCIInternal.h 13217 2008-10-13 13:40:54Z vboxsync $ */ +/* $Id: PCIInternal.h $ */ /** @file * DevPCI - PCI Internal header - Only for hiding bits of PCIDEVICE. */ diff --git a/src/VBox/Devices/Graphics/BIOS/Makefile.kmk b/src/VBox/Devices/Graphics/BIOS/Makefile.kmk index e39fa1ddb..2953a619a 100644 --- a/src/VBox/Devices/Graphics/BIOS/Makefile.kmk +++ b/src/VBox/Devices/Graphics/BIOS/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 13155 2008-10-10 08:07:41Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # VGA BIOS Sub-Makefile # diff --git a/src/VBox/Devices/Graphics/BIOS/dataseghack b/src/VBox/Devices/Graphics/BIOS/dataseghack index 02a2d4c52..02a2d4c52 100644..100755 --- a/src/VBox/Devices/Graphics/BIOS/dataseghack +++ b/src/VBox/Devices/Graphics/BIOS/dataseghack diff --git a/src/VBox/Devices/Graphics/DevVGA.cpp b/src/VBox/Devices/Graphics/DevVGA.cpp index eb7022c48..99c82344c 100644 --- a/src/VBox/Devices/Graphics/DevVGA.cpp +++ b/src/VBox/Devices/Graphics/DevVGA.cpp @@ -1,5 +1,5 @@ #ifdef VBOX -/* $Id: DevVGA.cpp 20723 2009-06-19 13:14:16Z vboxsync $ */ +/* $Id: DevVGA.cpp $ */ /** @file * DevVGA - VBox VGA/VESA device. */ diff --git a/src/VBox/Devices/Graphics/DevVGA.h b/src/VBox/Devices/Graphics/DevVGA.h index 6bbc8abad..decb127d5 100644 --- a/src/VBox/Devices/Graphics/DevVGA.h +++ b/src/VBox/Devices/Graphics/DevVGA.h @@ -1,4 +1,4 @@ -/* $Id: DevVGA.h 20444 2009-06-09 15:16:41Z vboxsync $ */ +/* $Id: DevVGA.h $ */ /** @file * DevVGA - VBox VGA/VESA device, internal header. */ diff --git a/src/VBox/Devices/Graphics/DevVGAModes.h b/src/VBox/Devices/Graphics/DevVGAModes.h index 8ea9b90ae..e577dbf27 100644 --- a/src/VBox/Devices/Graphics/DevVGAModes.h +++ b/src/VBox/Devices/Graphics/DevVGAModes.h @@ -1,4 +1,4 @@ -/* $Id: DevVGAModes.h 11166 2008-08-06 00:24:37Z vboxsync $ */ +/* $Id: DevVGAModes.h $ */ /** @file * DevVGA - VBox VGA/VESA device, VBE modes. * diff --git a/src/VBox/Devices/Graphics/DevVGATmpl.h b/src/VBox/Devices/Graphics/DevVGATmpl.h index 267ade056..271858fed 100644 --- a/src/VBox/Devices/Graphics/DevVGATmpl.h +++ b/src/VBox/Devices/Graphics/DevVGATmpl.h @@ -1,4 +1,4 @@ -/* $Id: $ */ +/* $Id: $ */ /** @file * DevVGA - VBox VGA/VESA device, code templates. */ diff --git a/src/VBox/Devices/Input/DevPS2.cpp b/src/VBox/Devices/Input/DevPS2.cpp index 5a7fdeb0b..4fc5c7b30 100644 --- a/src/VBox/Devices/Input/DevPS2.cpp +++ b/src/VBox/Devices/Input/DevPS2.cpp @@ -1,5 +1,5 @@ #ifdef VBOX -/* $Id: $ */ +/* $Id: $ */ /** @file * DevPS2 - PS/2 keyboard & mouse controller device. */ diff --git a/src/VBox/Devices/Makefile.kmk b/src/VBox/Devices/Makefile.kmk index b36ade7c5..49495a451 100644 --- a/src/VBox/Devices/Makefile.kmk +++ b/src/VBox/Devices/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20959 2009-06-26 07:50:03Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for the devices, drivers and services. # diff --git a/src/VBox/Devices/Network/DevE1000.cpp b/src/VBox/Devices/Network/DevE1000.cpp index 131143a80..5cfc415f1 100644 --- a/src/VBox/Devices/Network/DevE1000.cpp +++ b/src/VBox/Devices/Network/DevE1000.cpp @@ -1,4 +1,4 @@ -/* $Id: DevE1000.cpp 21020 2009-06-29 11:14:58Z vboxsync $ */ +/* $Id: DevE1000.cpp $ */ /** @file * DevE1000 - Intel 82540EM Ethernet Controller Emulation. * diff --git a/src/VBox/Devices/Network/DevE1000Phy.cpp b/src/VBox/Devices/Network/DevE1000Phy.cpp index aedc9e9d3..155aaa218 100644 --- a/src/VBox/Devices/Network/DevE1000Phy.cpp +++ b/src/VBox/Devices/Network/DevE1000Phy.cpp @@ -1,4 +1,4 @@ -/** $Id: DevE1000Phy.cpp 18438 2009-03-28 02:38:11Z vboxsync $ */ +/** $Id: DevE1000Phy.cpp $ */ /** @file * DevE1000Phy - Intel 82540EM Ethernet Controller Internal PHY Emulation. * diff --git a/src/VBox/Devices/Network/DevE1000Phy.h b/src/VBox/Devices/Network/DevE1000Phy.h index 71bd0efcd..fe4a7a318 100644 --- a/src/VBox/Devices/Network/DevE1000Phy.h +++ b/src/VBox/Devices/Network/DevE1000Phy.h @@ -1,4 +1,4 @@ -/** $Id: DevE1000Phy.h 15955 2009-01-14 20:14:36Z vboxsync $ */ +/** $Id: DevE1000Phy.h $ */ /** @file * DevE1000Phy - Intel 82540EM Ethernet Controller Internal PHY Emulation, Header. */ diff --git a/src/VBox/Devices/Network/DevEEPROM.cpp b/src/VBox/Devices/Network/DevEEPROM.cpp index bce308f96..c72410dc9 100644 --- a/src/VBox/Devices/Network/DevEEPROM.cpp +++ b/src/VBox/Devices/Network/DevEEPROM.cpp @@ -1,4 +1,4 @@ -/* $Id: DevEEPROM.cpp 15955 2009-01-14 20:14:36Z vboxsync $ */ +/* $Id: DevEEPROM.cpp $ */ /** @file * DevEEPROM - Microware-compatible 64x16-bit 93C46 EEPROM Emulation. */ diff --git a/src/VBox/Devices/Network/DevEEPROM.h b/src/VBox/Devices/Network/DevEEPROM.h index 66c0646d1..911601568 100644 --- a/src/VBox/Devices/Network/DevEEPROM.h +++ b/src/VBox/Devices/Network/DevEEPROM.h @@ -1,4 +1,4 @@ -/* $Id: DevEEPROM.h 15955 2009-01-14 20:14:36Z vboxsync $ */ +/* $Id: DevEEPROM.h $ */ /** @file * DevEEPROM - Microware-compatible 64x16-bit 93C46 EEPROM Emulation, Header. */ diff --git a/src/VBox/Devices/Network/DevINIP.cpp b/src/VBox/Devices/Network/DevINIP.cpp index 6d8059cf1..8214d555a 100644 --- a/src/VBox/Devices/Network/DevINIP.cpp +++ b/src/VBox/Devices/Network/DevINIP.cpp @@ -1,4 +1,4 @@ -/* $Id: DevINIP.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: DevINIP.cpp $ */ /** @file * DevINIP - Internal Network IP stack device/service. */ diff --git a/src/VBox/Devices/Network/DevPCNet.cpp b/src/VBox/Devices/Network/DevPCNet.cpp index 6c34045e2..d95eaa3b5 100644 --- a/src/VBox/Devices/Network/DevPCNet.cpp +++ b/src/VBox/Devices/Network/DevPCNet.cpp @@ -1,4 +1,4 @@ -/* $Id: DevPCNet.cpp 20961 2009-06-26 08:45:18Z vboxsync $ */ +/* $Id: DevPCNet.cpp $ */ /** @file * DevPCNet - AMD PCnet-PCI II / PCnet-FAST III (Am79C970A / Am79C973) Ethernet Controller Emulation. * diff --git a/src/VBox/Devices/Network/DrvIntNet.cpp b/src/VBox/Devices/Network/DrvIntNet.cpp index fb26f3b76..cb1f4daad 100644 --- a/src/VBox/Devices/Network/DrvIntNet.cpp +++ b/src/VBox/Devices/Network/DrvIntNet.cpp @@ -1,4 +1,4 @@ -/* $Id: DrvIntNet.cpp 20708 2009-06-19 10:02:27Z vboxsync $ */ +/* $Id: DrvIntNet.cpp $ */ /** @file * DrvIntNet - Internal network transport driver. */ diff --git a/src/VBox/Devices/Network/DrvNAT.cpp b/src/VBox/Devices/Network/DrvNAT.cpp index a9d4c8d6d..16d9cf65b 100644 --- a/src/VBox/Devices/Network/DrvNAT.cpp +++ b/src/VBox/Devices/Network/DrvNAT.cpp @@ -1,4 +1,4 @@ -/* $Id: DrvNAT.cpp 21048 2009-06-30 04:01:35Z vboxsync $ */ +/* $Id: DrvNAT.cpp $ */ /** @file * DrvNAT - NAT network transport driver. */ diff --git a/src/VBox/Devices/Network/DrvTAP.cpp b/src/VBox/Devices/Network/DrvTAP.cpp index accac04c9..3b3364f31 100644 --- a/src/VBox/Devices/Network/DrvTAP.cpp +++ b/src/VBox/Devices/Network/DrvTAP.cpp @@ -1,4 +1,4 @@ -/** $Id: DrvTAP.cpp 20708 2009-06-19 10:02:27Z vboxsync $ */ +/** $Id: DrvTAP.cpp $ */ /** @file * Universial TAP network transport driver. */ diff --git a/src/VBox/Devices/Network/Pcap.cpp b/src/VBox/Devices/Network/Pcap.cpp index 661bf91ff..7f1ecfe49 100644 --- a/src/VBox/Devices/Network/Pcap.cpp +++ b/src/VBox/Devices/Network/Pcap.cpp @@ -1,4 +1,4 @@ -/* $Id: Pcap.cpp 18442 2009-03-28 03:00:16Z vboxsync $ */ +/* $Id: Pcap.cpp $ */ /** @file * Helpers for writing libpcap files. */ diff --git a/src/VBox/Devices/Network/Pcap.h b/src/VBox/Devices/Network/Pcap.h index 2e3015d1d..436b43ae8 100644 --- a/src/VBox/Devices/Network/Pcap.h +++ b/src/VBox/Devices/Network/Pcap.h @@ -1,4 +1,4 @@ -/* $Id: Pcap.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: Pcap.h $ */ /** @file * Helpers for writing libpcap files. */ diff --git a/src/VBox/Devices/Network/SrvIntNetR0.cpp b/src/VBox/Devices/Network/SrvIntNetR0.cpp index 8ee3930ca..a5828256c 100644 --- a/src/VBox/Devices/Network/SrvIntNetR0.cpp +++ b/src/VBox/Devices/Network/SrvIntNetR0.cpp @@ -1,4 +1,4 @@ -/* $Id: SrvIntNetR0.cpp 20715 2009-06-19 11:58:01Z vboxsync $ */ +/* $Id: SrvIntNetR0.cpp $ */ /** @file * Internal networking - The ring 0 service. */ diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.h index 6fd972752..06d1b15f8 100644 --- a/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.h +++ b/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.h @@ -62,7 +62,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chap.h,v 1.1 2003/05/27 14:37:56 jani Exp $ + * $Id: chap.h $ */ #ifndef CHAP_H diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.h index c58447215..cfb20471c 100644 --- a/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.h +++ b/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.h @@ -51,7 +51,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: chpms.h,v 1.3 2004/02/07 00:30:03 likewise Exp $ + * $Id: chpms.h $ */ #ifndef CHPMS_H diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.h index 0e1d9f61a..17bdd4a21 100644 --- a/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.h +++ b/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.h @@ -48,7 +48,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: fsm.h,v 1.1 2003/05/27 14:37:56 jani Exp $ + * $Id: fsm.h $ */ #ifndef FSM_H diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.h index 416aa79a2..d96c02ec8 100644 --- a/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.h +++ b/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.h @@ -48,7 +48,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.h,v 1.1 2003/05/27 14:37:56 jani Exp $ + * $Id: ipcp.h $ */ #ifndef IPCP_H diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.h index 3876d39ae..1decc386b 100644 --- a/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.h +++ b/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.h @@ -48,7 +48,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.h,v 1.1 2003/05/27 14:37:56 jani Exp $ + * $Id: lcp.h $ */ #ifndef LCP_H diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.h index 7574f32b9..54619b7b8 100644 --- a/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.h +++ b/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.h @@ -48,7 +48,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: magic.h,v 1.1 2003/05/27 14:37:56 jani Exp $ + * $Id: magic.h $ */ #ifndef MAGIC_H diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.h index 717208145..b7374b3f0 100644 --- a/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.h +++ b/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.h @@ -1,7 +1,7 @@ /* * Definitions for tcp compression routines. * - * $Id: vj.h,v 1.4 2004/02/07 00:30:03 likewise Exp $ + * $Id: vj.h $ * * Copyright (c) 1989 Regents of the University of California. * All rights reserved. diff --git a/src/VBox/Devices/Network/lwip/vbox/sys_arch.c b/src/VBox/Devices/Network/lwip/vbox/sys_arch.c index d35f69701..14eaf160c 100644 --- a/src/VBox/Devices/Network/lwip/vbox/sys_arch.c +++ b/src/VBox/Devices/Network/lwip/vbox/sys_arch.c @@ -1,4 +1,4 @@ -/** $Id: sys_arch.c 17807 2009-03-13 11:17:54Z vboxsync $ */ +/** $Id: sys_arch.c $ */ /** @file * System dependent parts of lwIP, implemented with IPRT. */ diff --git a/src/VBox/Devices/Network/slirp/counters.h b/src/VBox/Devices/Network/slirp/counters.h index 794c19c59..c236e4010 100644 --- a/src/VBox/Devices/Network/slirp/counters.h +++ b/src/VBox/Devices/Network/slirp/counters.h @@ -1,4 +1,4 @@ -/** $Id: counters.h 20713 2009-06-19 11:43:01Z vboxsync $ */ +/** $Id: counters.h $ */ /** @file * Counters macro invocation template. * diff --git a/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c b/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c index b0ea9e33c..681785ef3 100644 --- a/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c +++ b/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c @@ -1,4 +1,4 @@ -/* $Id: dnsproxy.c 19979 2009-05-25 02:29:12Z vboxsync $ */ +/* $Id: dnsproxy.c $ */ /* * Copyright (c) 2003,2004,2005 Armin Wolfermann * diff --git a/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.h b/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.h index 6304d088d..21db28afb 100644 --- a/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.h +++ b/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.h @@ -1,4 +1,4 @@ -/* $Id: dnsproxy.h 18815 2009-04-07 12:34:27Z vboxsync $ */ +/* $Id: dnsproxy.h $ */ /* * Copyright (c) 2003,2004,2005 Armin Wolfermann * diff --git a/src/VBox/Devices/Network/slirp/dnsproxy/hash.c b/src/VBox/Devices/Network/slirp/dnsproxy/hash.c index f22ad1f9e..0d007d05a 100644 --- a/src/VBox/Devices/Network/slirp/dnsproxy/hash.c +++ b/src/VBox/Devices/Network/slirp/dnsproxy/hash.c @@ -1,4 +1,4 @@ -/* $Id: hash.c 18815 2009-04-07 12:34:27Z vboxsync $ */ +/* $Id: hash.c $ */ /* * Copyright (c) 2003,2004 Armin Wolfermann * diff --git a/src/VBox/Devices/Network/slirp/ip_icmp.c b/src/VBox/Devices/Network/slirp/ip_icmp.c index 4950664f7..0db2842cc 100644 --- a/src/VBox/Devices/Network/slirp/ip_icmp.c +++ b/src/VBox/Devices/Network/slirp/ip_icmp.c @@ -528,7 +528,7 @@ void icmp_error(PNATState pData, struct mbuf *msrc, u_char type, u_char code, in goto end_error; /* get mbuf */ { int new_m_size; - m_adj(m, if_maxlinkhdr); + m->m_data += if_maxlinkhdr; new_m_size = sizeof(struct ip) + ICMP_MINLEN + msrc->m_len + ICMP_MAXDATALEN; if (new_m_size>m->m_size) m_inc(m, new_m_size); diff --git a/src/VBox/Devices/Network/slirp/ip_output.c b/src/VBox/Devices/Network/slirp/ip_output.c index 1db20862a..79437e089 100644 --- a/src/VBox/Devices/Network/slirp/ip_output.c +++ b/src/VBox/Devices/Network/slirp/ip_output.c @@ -200,7 +200,7 @@ ip_output(PNATState pData, struct socket *so, struct mbuf *m0) ipstat.ips_odropped++; goto sendorfree; } - m_adj(m, if_maxlinkhdr); + m->m_data += if_maxlinkhdr; mhip = mtod(m, struct ip *); *mhip = *ip; #ifdef VBOX_WITHOUT_SLIRP_CLIENT_ETHER diff --git a/src/VBox/Devices/Network/slirp/mbuf.c b/src/VBox/Devices/Network/slirp/mbuf.c index 6b8382f30..dc0830114 100644 --- a/src/VBox/Devices/Network/slirp/mbuf.c +++ b/src/VBox/Devices/Network/slirp/mbuf.c @@ -201,6 +201,7 @@ m_adj(struct mbuf *m, int len) len = -len; m->m_len -= len; } + Assert(m->m_len >= 0); } diff --git a/src/VBox/Devices/Network/slirp/socket.c b/src/VBox/Devices/Network/slirp/socket.c index 88b0be4f8..87d28d7e1 100644 --- a/src/VBox/Devices/Network/slirp/socket.c +++ b/src/VBox/Devices/Network/slirp/socket.c @@ -575,7 +575,7 @@ sorecvfrom(PNATState pData, struct socket *so) return; } /* adjust both parameters to maks M_FREEROOM calculate correct */ - m_adj(m, if_maxlinkhdr + sizeof(struct udphdr) + sizeof(struct ip)); + m->m_data += if_maxlinkhdr + sizeof(struct udphdr) + sizeof(struct ip); /* * XXX Shouldn't FIONREAD packets destined for port 53, diff --git a/src/VBox/Devices/Network/solaris/vbox-libdlpi.cpp b/src/VBox/Devices/Network/solaris/vbox-libdlpi.cpp index 2a03468cc..792cfd79f 100644 --- a/src/VBox/Devices/Network/solaris/vbox-libdlpi.cpp +++ b/src/VBox/Devices/Network/solaris/vbox-libdlpi.cpp @@ -1,4 +1,4 @@ -/** $Id: vbox-libdlpi.cpp 9124 2008-05-26 13:48:23Z vboxsync $ */ +/** $Id: vbox-libdlpi.cpp $ */ /** @file * Dynamically load libdpli & symbols on Solaris hosts, Internal header. */ diff --git a/src/VBox/Devices/Network/solaris/vbox-libdlpi.h b/src/VBox/Devices/Network/solaris/vbox-libdlpi.h index 9785e404b..abd0d6719 100644 --- a/src/VBox/Devices/Network/solaris/vbox-libdlpi.h +++ b/src/VBox/Devices/Network/solaris/vbox-libdlpi.h @@ -1,4 +1,4 @@ -/** $Id: vbox-libdlpi.h 8960 2008-05-20 14:49:14Z vboxsync $ */ +/** $Id: vbox-libdlpi.h $ */ /** @file * Dynamically load libdpli & symbols on Solaris hosts, Internal header. */ diff --git a/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp b/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp index acbe29d4b..4e629c1ca 100644 --- a/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp +++ b/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp @@ -1,4 +1,4 @@ -/* $Id: tstIntNet-1.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: tstIntNet-1.cpp $ */ /** @file * VBox - Testcase for internal networking, simple NetFlt trunk creation. */ diff --git a/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp b/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp index 9fb9bd97e..6c4b94ef9 100644 --- a/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp +++ b/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp @@ -1,4 +1,4 @@ -/* $Id: tstIntNetR0.cpp 17091 2009-02-24 19:55:23Z vboxsync $ */ +/* $Id: tstIntNetR0.cpp $ */ /** @file * Internal networking - Usermode testcase for the kernel mode bits. * diff --git a/src/VBox/Devices/Network/win/SrvIntNetR0A-win.asm b/src/VBox/Devices/Network/win/SrvIntNetR0A-win.asm new file mode 100644 index 000000000..fed0f203d --- /dev/null +++ b/src/VBox/Devices/Network/win/SrvIntNetR0A-win.asm @@ -0,0 +1,30 @@ +; $Id: SrvIntNetR0A-win.asm $ */ +;; @file +; Internal networking - The ring 0 service. +; + +; +; Copyright (C) 2006-2008 Sun Microsystems, Inc. +; +; 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. +; +; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa +; Clara, CA 95054 USA or visit http://www.sun.com if you need +; additional information or have any questions. +; + +%define IN_DYNAMICLOAD_CODE + +%include "iprt/ntwrap.mac" + +NtWrapDrv2DynFunctionWithAllRegParams intnetNtWrap, intnetR0TrunkIfPortSetSGPhys +NtWrapDrv2DynFunctionWithAllRegParams intnetNtWrap, intnetR0TrunkIfPortRecv +NtWrapDrv2DynFunctionWithAllRegParams intnetNtWrap, intnetR0TrunkIfPortSGRetain +NtWrapDrv2DynFunctionWithAllRegParams intnetNtWrap, intnetR0TrunkIfPortSGRelease + diff --git a/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp b/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp index d554940b2..c3b658099 100644 --- a/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp +++ b/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxAcpi.cpp 20920 2009-06-25 09:49:04Z vboxsync $ */ +/* $Id: VBoxAcpi.cpp $ */ /** @file * VBoxAcpi - VirtualBox ACPI maniputation functionality. */ diff --git a/src/VBox/Devices/PC/BIOS/Makefile.kmk b/src/VBox/Devices/PC/BIOS/Makefile.kmk index b73fdeb97..65cc663c6 100644 --- a/src/VBox/Devices/PC/BIOS/Makefile.kmk +++ b/src/VBox/Devices/PC/BIOS/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 13155 2008-10-10 08:07:41Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # PC BIOS Sub-Makefile. # diff --git a/src/VBox/Devices/PC/BIOS/logo.c b/src/VBox/Devices/PC/BIOS/logo.c index e8321a29f..689bfd445 100644 --- a/src/VBox/Devices/PC/BIOS/logo.c +++ b/src/VBox/Devices/PC/BIOS/logo.c @@ -1,4 +1,4 @@ -/* $Id: logo.c 18391 2009-03-27 13:30:25Z vboxsync $ */ +/* $Id: logo.c $ */ /** @file * Stuff for drawing the BIOS logo. */ diff --git a/src/VBox/Devices/PC/BIOS/rombios.c b/src/VBox/Devices/PC/BIOS/rombios.c index 99e5278cf..9fee7dea7 100644 --- a/src/VBox/Devices/PC/BIOS/rombios.c +++ b/src/VBox/Devices/PC/BIOS/rombios.c @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: rombios.c,v 1.176 2006/12/30 17:13:17 vruppert Exp $ +// $Id: rombios.c $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -5254,6 +5254,18 @@ int09_function(DI, SI, BP, SP, BX, DX, CX, AX) write_byte(0x0040, 0x18, mf2_flags); break; +#ifdef VBOX + case 0x53: /* Del press */ + if ((shift_flags & 0x0f) == 0x0c) + { +ASM_START + /* Ctrl+Alt+Del => Reboot */ + jmp 0xf000:post +ASM_END + } + /* fall through */ +#endif + default: if (scancode & 0x80) { break; /* toss key releases ... */ diff --git a/src/VBox/Devices/PC/BIOS/scsi.c b/src/VBox/Devices/PC/BIOS/scsi.c new file mode 100644 index 000000000..9fa4a4ac0 --- /dev/null +++ b/src/VBox/Devices/PC/BIOS/scsi.c @@ -0,0 +1,480 @@ +/* $Id: scsi.c $ */ +/** @file + * SCSI host adapter driver to boot from SCSI disks + */ + +/* + * Copyright (C) 2004-2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +/* The I/O port of the BusLogic SCSI adapter. */ +#define BUSLOGIC_ISA_IO_PORT 0x330 +/* The I/O port of the LsiLogic SCSI adapter. */ +#define LSILOGIC_ISA_IO_PORT 0x340 + +#define VBOXSCSI_REGISTER_STATUS 0 +#define VBOXSCSI_REGISTER_COMMAND 0 +#define VBOXSCSI_REGISTER_DATA_IN 1 +#define VBOXSCSI_REGISTER_IDENTIFY 2 + +#define VBOXSCSI_MAX_DEVICES 16 /* Maximum number of devices a SCSI device can have. */ + +/* Command opcodes. */ +#define SCSI_INQUIRY 0x12 +#define SCSI_READ_CAPACITY 0x25 +#define SCSI_READ_10 0x28 +#define SCSI_WRITE_10 0x2a + +/* Data transfer direction. */ +#define SCSI_TXDIR_FROM_DEVICE 0 +#define SCSI_TXDIR_TO_DEVICE 1 + +#define VBOXSCSI_BUSY (1 << 0) + +//#define VBOX_SCSI_DEBUG 1 /* temporary */ + +#ifdef VBOX_SCSI_DEBUG +# define VBOXSCSI_DEBUG(a...) BX_INFO(a) +#else +# define VBOXSCSI_DEBUG(a...) +#endif + +int scsi_cmd_data_in(io_base, device_id, cdb_segment, aCDB, cbCDB, segment, offset, cbBuffer) + Bit16u io_base, aCDB, offset, cbBuffer, segment, cdb_segment; + Bit8u device_id, cbCDB; +{ + /* Check that the adapter is ready. */ + Bit8u status; + Bit16u i; + + do + { + status = inb(io_base+VBOXSCSI_REGISTER_STATUS); + } while (status & VBOXSCSI_BUSY); + + /* Write target ID. */ + outb(io_base+VBOXSCSI_REGISTER_COMMAND, device_id); + /* Write transfer direction. */ + outb(io_base+VBOXSCSI_REGISTER_COMMAND, SCSI_TXDIR_FROM_DEVICE); + /* Write the CDB size. */ + outb(io_base+VBOXSCSI_REGISTER_COMMAND, cbCDB); + /* Write buffer size. */ + outb(io_base+VBOXSCSI_REGISTER_COMMAND, cbBuffer); + outb(io_base+VBOXSCSI_REGISTER_COMMAND, (cbBuffer >> 8)); + /* Write the CDB. */ + for (i = 0; i < cbCDB; i++) + outb(io_base+VBOXSCSI_REGISTER_COMMAND, read_byte(cdb_segment, aCDB + i)); + + /* Now wait for the command to complete. */ + do + { + status = inb(io_base+VBOXSCSI_REGISTER_STATUS); + } while (status & VBOXSCSI_BUSY); + +#if 0 + /* Get the read data. */ + for (i = 0; i < cbBuffer; i++) + { + Bit8u data; + + data = inb(io_base+VBOXSCSI_REGISTER_DATA_IN); + write_byte(segment, offset+i, data); + + VBOXSCSI_DEBUG("buffer[%d]=%x\n", i, data); + } +#else + io_base = io_base + VBOXSCSI_REGISTER_DATA_IN; + +ASM_START + push bp + mov bp, sp + mov di, _scsi_cmd_data_in.offset + 2[bp] + mov ax, _scsi_cmd_data_in.segment + 2[bp] + mov cx, _scsi_cmd_data_in.cbBuffer + 2[bp] + + mov es, ax ;; segment in es + mov dx, _scsi_cmd_data_in.io_base + 2[bp] ;; SCSI data read port + + rep + insb ;; CX dwords transfered from port(DX) to ES:[DI] + + pop bp +ASM_END +#endif + + return 0; +} + +int scsi_cmd_data_out(io_base, device_id, cdb_segment, aCDB, cbCDB, segment, offset, cbBuffer) + Bit16u io_base, aCDB, offset, cbBuffer, segment, cdb_segment; + Bit8u device_id, cbCDB; +{ + /* Check that the adapter is ready. */ + Bit8u status; + Bit16u i; + + do + { + status = inb(io_base+VBOXSCSI_REGISTER_STATUS); + } while (status & VBOXSCSI_BUSY); + + /* Write target ID. */ + outb(io_base+VBOXSCSI_REGISTER_COMMAND, device_id); + /* Write transfer direction. */ + outb(io_base+VBOXSCSI_REGISTER_COMMAND, SCSI_TXDIR_TO_DEVICE); + /* Write the CDB size. */ + outb(io_base+VBOXSCSI_REGISTER_COMMAND, cbCDB); + /* Write buffer size. */ + outb(io_base+VBOXSCSI_REGISTER_COMMAND, cbBuffer); + outb(io_base+VBOXSCSI_REGISTER_COMMAND, (cbBuffer >> 8)); + /* Write the CDB. */ + for (i = 0; i < cbCDB; i++) + outb(io_base+VBOXSCSI_REGISTER_COMMAND, read_byte(cdb_segment, aCDB + i)); + + /* Write data to I/O port. */ + for (i = 0; i < cbBuffer; i++) + { + Bit8u data; + + data = read_byte(segment, offset+i); + outb(io_base+VBOXSCSI_REGISTER_DATA_IN, data); + + VBOXSCSI_DEBUG("buffer[%d]=%x\n", i, data); + } + + /* Now wait for the command to complete. */ + do + { + status = inb(io_base+VBOXSCSI_REGISTER_STATUS); + } while (status & VBOXSCSI_BUSY); + + return 0; +} + + +/** + * Read sectors from an attached scsi device. + * + * @returns status code. + * @param device_id Id of the SCSI device to read from. + * @param count The number of sectors to read. + * @param lba The start sector to read from. + * @param segment The segment the buffer is in. + * @param offset The offset of the buffer. + */ +int scsi_read_sectors(device_id, count, lba, segment, offset) + Bit8u device_id; + Bit16u count, segment, offset; + Bit32u lba; +{ + Bit8u rc; + Bit8u aCDB[10]; + Bit16u io_base, ebda_seg; + Bit8u target_id; + + if (device_id > BX_MAX_SCSI_DEVICES) + BX_PANIC("scsi_read_sectors: device_id out of range %d\n", device_id); + + // Reset count of transferred data + write_word(ebda_seg, &EbdaData->ata.trsfsectors,0); + write_dword(ebda_seg, &EbdaData->ata.trsfbytes,0L); + + /* Prepare CDB */ + write_byte(get_SS(), aCDB + 0, SCSI_READ_10); + write_byte(get_SS(), aCDB + 1, 0); + write_byte(get_SS(), aCDB + 2, (uint8_t)(lba >> 24)); + write_byte(get_SS(), aCDB + 3, (uint8_t)(lba >> 16)); + write_byte(get_SS(), aCDB + 4, (uint8_t)(lba >> 8)); + write_byte(get_SS(), aCDB + 5, (uint8_t)(lba)); + write_byte(get_SS(), aCDB + 6, 0); + write_byte(get_SS(), aCDB + 7, (uint8_t)(count >> 8)); + write_byte(get_SS(), aCDB + 8, (uint8_t)(count)); + write_byte(get_SS(), aCDB + 9, 0); + + ebda_seg = read_word(0x0040, 0x000E); + io_base = read_word(ebda_seg, &EbdaData->scsi.devices[device_id].io_base); + target_id = read_byte(ebda_seg, &EbdaData->scsi.devices[device_id].target_id); + + rc = scsi_cmd_data_in(io_base, target_id, get_SS(), aCDB, 10, segment, offset, (count * 512)); + + if (!rc) + { + write_word(ebda_seg, &EbdaData->ata.trsfsectors, count); + write_dword(ebda_seg, &EbdaData->ata.trsfbytes, (count * 512)); + } + + return rc; +} + +/** + * Write sectors to an attached scsi device. + * + * @returns status code. + * @param device_id Id of the SCSI device to write to. + * @param count The number of sectors to write. + * @param lba The start sector to write to. + * @param segment The segment the buffer is in. + * @param offset The offset of the buffer. + */ +int scsi_write_sectors(device_id, count, lba, segment, offset) + Bit8u device_id; + Bit16u count, segment, offset; + Bit32u lba; +{ + Bit8u rc; + Bit8u aCDB[10]; + Bit16u io_base, ebda_seg; + Bit8u target_id; + + if (device_id > BX_MAX_SCSI_DEVICES) + BX_PANIC("scsi_write_sectors: device_id out of range %d\n", device_id); + + // Reset count of transferred data + write_word(ebda_seg, &EbdaData->ata.trsfsectors,0); + write_dword(ebda_seg, &EbdaData->ata.trsfbytes,0L); + + /* Prepare CDB */ + write_byte(get_SS(), aCDB + 0, SCSI_WRITE_10); + write_byte(get_SS(), aCDB + 1, 0); + write_byte(get_SS(), aCDB + 2, (uint8_t)(lba >> 24)); + write_byte(get_SS(), aCDB + 3, (uint8_t)(lba >> 16)); + write_byte(get_SS(), aCDB + 4, (uint8_t)(lba >> 8)); + write_byte(get_SS(), aCDB + 5, (uint8_t)(lba)); + write_byte(get_SS(), aCDB + 6, 0); + write_byte(get_SS(), aCDB + 7, (uint8_t)(count >> 8)); + write_byte(get_SS(), aCDB + 8, (uint8_t)(count)); + write_byte(get_SS(), aCDB + 9, 0); + + ebda_seg = read_word(0x0040, 0x000E); + io_base = read_word(ebda_seg, &EbdaData->scsi.devices[device_id].io_base); + target_id = read_byte(ebda_seg, &EbdaData->scsi.devices[device_id].target_id); + + rc = scsi_cmd_data_out(io_base, target_id, get_SS(), aCDB, 10, segment, offset, (count * 512)); + + if (!rc) + { + write_word(ebda_seg, &EbdaData->ata.trsfsectors, count); + write_dword(ebda_seg, &EbdaData->ata.trsfbytes, (count * 512)); + } + + return rc; +} + +/** + * Enumerate attached devices. + * + * @returns nothing. + * @param io_base The I/O base port of the controller. + */ +void scsi_enumerate_attached_devices(io_base) + Bit16u io_base; +{ + Bit16u ebda_seg; + Bit8u i; + Bit8u buffer[0x0200]; + + ebda_seg = read_word(0x0040, 0x000E); + + write_byte(ebda_seg, &EbdaData->scsi.hdcount, 0); + + /* Go through target devices. */ + for (i = 0; i < VBOXSCSI_MAX_DEVICES; i++) + { + Bit8u rc; + Bit8u z; + Bit8u aCDB[10]; + + write_byte(get_SS(), aCDB + 0, SCSI_INQUIRY); + write_byte(get_SS(), aCDB + 1, 0); + write_byte(get_SS(), aCDB + 2, 0); + write_byte(get_SS(), aCDB + 3, 0); + write_byte(get_SS(), aCDB + 4, 5); /* Allocation length. */ + write_byte(get_SS(), aCDB + 5, 0); + + rc = scsi_cmd_data_in(io_base, i, get_SS(), aCDB, 6, get_SS(), buffer, 5); + if (rc != 0) + BX_PANIC("scsi_enumerate_attached_devices: SCSI_INQUIRY failed\n"); + + /* Check if there is a disk attached. */ + if ( ((buffer[0] & 0xe0) == 0) + && ((buffer[0] & 0x1f) == 0x00)) + { + VBOXSCSI_DEBUG("scsi_enumerate_attached_devices: Disk detected at %d\n", i); + + /* We add the disk only if the maximum is not reached yet. */ + if (read_byte(ebda_seg, &EbdaData->scsi.hdcount) < BX_MAX_SCSI_DEVICES) + { + Bit32u sectors, sector_size, cylinders; + Bit16u heads, sectors_per_track; + Bit8u hdcount, hdcount_scsi; + + /* Issue a read capacity command now. */ + write_byte(get_SS(), aCDB + 0, SCSI_READ_CAPACITY); + memsetb(get_SS(), aCDB + 1, 0, 9); + + rc = scsi_cmd_data_in(io_base, i, get_SS(), aCDB, 10, get_SS(), buffer, 8); + if (rc != 0) + BX_PANIC("scsi_enumerate_attached_devices: SCSI_READ_CAPACITY failed\n"); + + /* Build sector number and size from the buffer. */ + sectors = ((uint32_t)read_byte(get_SS(), buffer + 0) << 24) + | ((uint32_t)read_byte(get_SS(), buffer + 1) << 16) + | ((uint32_t)read_byte(get_SS(), buffer + 2) << 8) + | ((uint32_t)read_byte(get_SS(), buffer + 3)); + + sector_size = ((uint32_t)read_byte(get_SS(), buffer + 4) << 24) + | ((uint32_t)read_byte(get_SS(), buffer + 5) << 16) + | ((uint32_t)read_byte(get_SS(), buffer + 6) << 8) + | ((uint32_t)read_byte(get_SS(), buffer + 7)); + + /* We only support the disk if sector size is 512 bytes. */ + if (sector_size != 512) + { + /* Leave a log entry. */ + BX_INFO("Disk %d has an unsupported sector size of %u\n", i, sector_size); + continue; + } + + /* We need to calculate the geometry for the disk. */ + if (io_base == BUSLOGIC_ISA_IO_PORT) + { + /* This is from the BusLogic driver in the Linux kernel. */ + if (sectors >= 4 * 1024 * 1024) + { + heads = 255; + sectors_per_track = 63; + } + else if (sectors >= 2 * 1024 * 1024) + { + heads = 128; + sectors_per_track = 32; + } + else + { + heads = 64; + sectors_per_track = 32; + } + cylinders = (uint32_t)(sectors / (heads * sectors_per_track)); + } + else if (io_base == LSILOGIC_ISA_IO_PORT) + { + /* This is from the BusLogic driver in the Linux kernel. */ + if (sectors >= 4 * 1024 * 1024) + { + heads = 255; + sectors_per_track = 63; + } + else if (sectors >= 2 * 1024 * 1024) + { + heads = 128; + sectors_per_track = 32; + } + else + { + heads = 64; + sectors_per_track = 32; + } + cylinders = (uint32_t)(sectors / (heads * sectors_per_track)); + } + hdcount_scsi = read_byte(ebda_seg, &EbdaData->scsi.hdcount); + + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].io_base, io_base); + write_byte(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].target_id, i); + write_byte(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.type, ATA_TYPE_SCSI); + write_byte(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.device, ATA_DEVICE_HD); + write_byte(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.removable, 0); + write_byte(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.lock, 0); + write_byte(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.mode, ATA_MODE_PIO16); + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.blksize, sector_size); + write_byte(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.translation, ATA_TRANSLATION_LBA); + + /* Write lchs values. */ + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.lchs.heads, heads); + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.lchs.spt, sectors_per_track); + if (cylinders > 1024) + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.lchs.cylinders, 1024); + else + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.lchs.cylinders, (Bit16u)cylinders); + + /* Write pchs values. */ + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.pchs.heads, heads); + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.pchs.spt, sectors_per_track); + if (cylinders > 1024) + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.pchs.cylinders, 1024); + else + write_word(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.pchs.cylinders, (Bit16u)cylinders); + + write_dword(ebda_seg, &EbdaData->scsi.devices[hdcount_scsi].device_info.sectors, sectors); + + /* Store the id of the disk in the ata hdidmap. */ + hdcount = read_byte(ebda_seg, &EbdaData->ata.hdcount); + write_byte(ebda_seg, &EbdaData->ata.hdidmap[hdcount], hdcount_scsi + BX_MAX_ATA_DEVICES); + hdcount++; + write_byte(ebda_seg, &EbdaData->ata.hdcount, hdcount); + + hdcount_scsi++; + write_byte(ebda_seg, &EbdaData->scsi.hdcount, hdcount_scsi); + } + else + { + /* We reached the maximum of SCSI disks we can boot from. We can quit detecting. */ + break; + } + } + else + VBOXSCSI_DEBUG("scsi_enumerate_attached_devices: No disk detected at %d\n", i); + } +} + +/** + * Init the SCSI driver and detect attached disks. + */ +void scsi_init( ) +{ + Bit8u identifier; + + identifier = 0; + + /* Detect BusLogic adapter. */ + outb(BUSLOGIC_ISA_IO_PORT+VBOXSCSI_REGISTER_IDENTIFY, 0x55); + identifier = inb(BUSLOGIC_ISA_IO_PORT+VBOXSCSI_REGISTER_IDENTIFY); + + if (identifier == 0x55) + { + /* Detected - Enumerate attached devices. */ + VBOXSCSI_DEBUG("scsi_init: BusLogic SCSI adapter detected\n"); + scsi_enumerate_attached_devices(BUSLOGIC_ISA_IO_PORT); + } + else + { + VBOXSCSI_DEBUG("scsi_init: BusLogic SCSI adapter not detected\n"); + } + + /* Detect LsiLogic adapter. */ + outb(LSILOGIC_ISA_IO_PORT+VBOXSCSI_REGISTER_IDENTIFY, 0x55); + identifier = inb(LSILOGIC_ISA_IO_PORT+VBOXSCSI_REGISTER_IDENTIFY); + + if (identifier == 0x55) + { + /* Detected - Enumerate attached devices. */ + VBOXSCSI_DEBUG("scsi_init: LsiLogic SCSI adapter detected\n"); + scsi_enumerate_attached_devices(LSILOGIC_ISA_IO_PORT); + } + else + { + VBOXSCSI_DEBUG("scsi_init: LsiLogic SCSI adapter not detected\n"); + } +} + diff --git a/src/VBox/Devices/PC/DevACPI.cpp b/src/VBox/Devices/PC/DevACPI.cpp index 812e9b0ea..6b15b9ace 100644 --- a/src/VBox/Devices/PC/DevACPI.cpp +++ b/src/VBox/Devices/PC/DevACPI.cpp @@ -1,4 +1,4 @@ -/* $Id: DevACPI.cpp 20679 2009-06-18 10:38:52Z vboxsync $ */ +/* $Id: DevACPI.cpp $ */ /** @file * DevACPI - Advanced Configuration and Power Interface (ACPI) Device. */ @@ -372,6 +372,8 @@ struct ACPITBLFADT #define FADT_FL_REMOVE_POWER_ON_CAPABLE RT_BIT(17) /**< 1=platform can remote power on */ #define FADT_FL_FORCE_APIC_CLUSTER_MODEL RT_BIT(18) #define FADT_FL_FORCE_APIC_PHYS_DEST_MODE RT_BIT(19) + + /** Start of the ACPI 2.0 extension. */ ACPIGENADDR ResetReg; /**< ext addr of reset register */ uint8_t u8ResetVal; /**< ResetReg value to reset the system */ #define ACPI_RESET_REG_VAL 0x10 @@ -388,6 +390,7 @@ struct ACPITBLFADT ACPIGENADDR X_GPE1BLK; /**< ext addr of GPE1 regs block */ }; AssertCompileSize(ACPITBLFADT, 244); +#define ACPITBLFADT_VERSION1_SIZE RT_OFFSETOF(ACPITBLFADT, ResetReg) /** Firmware ACPI Control Structure */ struct ACPITBLFACS @@ -636,16 +639,17 @@ static void acpiSetupFACS(ACPIState *s, RTGCPHYS32 addr) } /** Fixed ACPI Description Table (FADT aka FACP) */ -static void acpiSetupFADT(ACPIState *s, RTGCPHYS32 addr, uint32_t facs_addr, uint32_t dsdt_addr) +static void acpiSetupFADT(ACPIState *s, RTGCPHYS32 addr_acpi1, RTGCPHYS32 addr_acpi2, uint32_t facs_addr, uint32_t dsdt_addr) { ACPITBLFADT fadt; + /* First the ACPI version 2+ version of the structure. */ memset(&fadt, 0, sizeof(fadt)); acpiPrepareHeader(&fadt.header, "FACP", sizeof(fadt), 4); fadt.u32FACS = RT_H2LE_U32(facs_addr); fadt.u32DSDT = RT_H2LE_U32(dsdt_addr); - fadt.u8IntModel = INT_MODEL_DUAL_PIC; - fadt.u8PreferredPMProfile = 0; /* unspecified */ + fadt.u8IntModel = 0; /* dropped from the ACPI 2.0 spec. */ + fadt.u8PreferredPMProfile = 0; /* unspecified */ fadt.u16SCIInt = RT_H2LE_U16(SCI_INT); fadt.u32SMICmd = RT_H2LE_U32(SMI_CMD); fadt.u8AcpiEnable = ACPI_ENABLE; @@ -695,7 +699,13 @@ static void acpiSetupFADT(ACPIState *s, RTGCPHYS32 addr, uint32_t facs_addr, uin acpiWriteGenericAddr(&fadt.X_GPE0BLK, 1, 16, 0, 1, GPE0_BLK); acpiWriteGenericAddr(&fadt.X_GPE1BLK, 0, 0, 0, 0, GPE1_BLK); fadt.header.u8Checksum = acpiChecksum((uint8_t *)&fadt, sizeof(fadt)); - acpiPhyscpy(s, addr, &fadt, sizeof(fadt)); + acpiPhyscpy(s, addr_acpi2, &fadt, sizeof(fadt)); + + /* Now the ACPI 1.0 version. */ + fadt.header.u32Length = ACPITBLFADT_VERSION1_SIZE; + fadt.u8IntModel = INT_MODEL_DUAL_PIC; + fadt.header.u8Checksum = acpiChecksum((uint8_t *)&fadt, ACPITBLFADT_VERSION1_SIZE); + acpiPhyscpy(s, addr_acpi1, &fadt, ACPITBLFADT_VERSION1_SIZE); } /** @@ -796,6 +806,7 @@ static void acpiSetupMADT(ACPIState *s, RTGCPHYS32 addr) ioapic->u8Type = 1; ioapic->u8Length = sizeof(ACPITBLIOAPIC); + /** @todo is this the right id? */ ioapic->u8IOApicId = cpus; ioapic->u8Reserved = 0; ioapic->u32Address = RT_H2LE_U32(0xfec00000); @@ -1691,9 +1702,10 @@ static DECLCALLBACK(void *) acpiQueryInterface(PPDMIBASE pInterface, PDMINTERFAC static int acpiPlantTables(ACPIState *s) { int rc; - RTGCPHYS32 rsdt_addr, xsdt_addr, fadt_addr, facs_addr, dsdt_addr, last_addr, apic_addr = 0; + RTGCPHYS32 rsdt_addr, xsdt_addr, fadt_acpi1_addr, fadt_acpi2_addr, facs_addr, dsdt_addr, last_addr, apic_addr = 0; uint32_t addend = 0; RTGCPHYS32 rsdt_addrs[4]; + RTGCPHYS32 xsdt_addrs[4]; uint32_t cAddr; size_t rsdt_tbl_len = sizeof(ACPITBLHEADER); size_t xsdt_tbl_len = sizeof(ACPITBLHEADER); @@ -1733,8 +1745,10 @@ static int acpiPlantTables(ACPIState *s) rsdt_addr = 0; xsdt_addr = RT_ALIGN_32(rsdt_addr + rsdt_tbl_len, 16); - fadt_addr = RT_ALIGN_32(xsdt_addr + xsdt_tbl_len, 16); - facs_addr = RT_ALIGN_32(fadt_addr + sizeof(ACPITBLFADT), 16); + fadt_acpi1_addr = RT_ALIGN_32(xsdt_addr + xsdt_tbl_len, 16); + fadt_acpi2_addr = RT_ALIGN_32(fadt_acpi1_addr + ACPITBLFADT_VERSION1_SIZE, 16); + /** @todo ACPI 3.0 doc says it needs to be aligned on a 64 byte boundary. */ + facs_addr = RT_ALIGN_32(fadt_acpi2_addr + sizeof(ACPITBLFADT), 16); if (s->u8UseIOApic) { apic_addr = RT_ALIGN_32(facs_addr + sizeof(ACPITBLFACS), 16); @@ -1763,25 +1777,27 @@ static int acpiPlantTables(ACPIState *s) Log(("RSDP 0x%08X\n", find_rsdp_space())); addend = s->cbRamLow - 0x10000; Log(("RSDT 0x%08X XSDT 0x%08X\n", rsdt_addr + addend, xsdt_addr + addend)); - Log(("FACS 0x%08X FADT 0x%08X\n", facs_addr + addend, fadt_addr + addend)); + Log(("FACS 0x%08X FADT (1.0) 0x%08X, FADT (2+) 0x%08X\n", facs_addr + addend, fadt_acpi1_addr + addend, fadt_acpi2_addr + addend)); Log(("DSDT 0x%08X\n", dsdt_addr + addend)); acpiSetupRSDP((ACPITBLRSDP*)s->au8RSDPPage, rsdt_addr + addend, xsdt_addr + addend); acpiSetupDSDT(s, dsdt_addr + addend, pDsdtCode, uDsdtSize); acpiCleanupDsdt(s->pDevIns, pDsdtCode); acpiSetupFACS(s, facs_addr + addend); - acpiSetupFADT(s, fadt_addr + addend, facs_addr + addend, dsdt_addr + addend); + acpiSetupFADT(s, fadt_acpi1_addr + addend, fadt_acpi2_addr + addend, facs_addr + addend, dsdt_addr + addend); - rsdt_addrs[0] = fadt_addr + addend; + rsdt_addrs[0] = fadt_acpi1_addr + addend; + xsdt_addrs[0] = fadt_acpi2_addr + addend; if (s->u8UseIOApic) { acpiSetupMADT(s, apic_addr + addend); rsdt_addrs[1] = apic_addr + addend; + xsdt_addrs[1] = apic_addr + addend; } rc = acpiSetupRSDT(s, rsdt_addr + addend, cAddr, rsdt_addrs); if (RT_FAILURE(rc)) return rc; - return acpiSetupXSDT(s, xsdt_addr + addend, cAddr, rsdt_addrs); + return acpiSetupXSDT(s, xsdt_addr + addend, cAddr, xsdt_addrs); } /** diff --git a/src/VBox/Devices/PC/DevAPIC.cpp b/src/VBox/Devices/PC/DevAPIC.cpp index a36acb6d5..8e427ca0c 100644 --- a/src/VBox/Devices/PC/DevAPIC.cpp +++ b/src/VBox/Devices/PC/DevAPIC.cpp @@ -1,5 +1,5 @@ #ifdef VBOX -/* $Id: DevAPIC.cpp 20836 2009-06-23 13:55:47Z vboxsync $ */ +/* $Id: DevAPIC.cpp $ */ /** @file * Advanced Programmable Interrupt Controller (APIC) Device and * I/O Advanced Programmable Interrupt Controller (IO-APIC) Device. @@ -1526,7 +1526,7 @@ static DECLCALLBACK(void) apicTimerCallback(PPDMDEVINS pDevIns, PTMTIMER pTimer, if (pThis->lvt[APIC_LVT_TIMER] & APIC_LVT_TIMER_PERIODIC) { /* new interval. */ - pThis->next_time += (uint64_t)pThis->initial_count + 1; + pThis->next_time += (((uint64_t)pThis->initial_count + 1) << pThis->count_shift); TMTimerSet(pThis->CTX_SUFF(pTimer), pThis->next_time); pThis->fTimerArmed = true; } else { diff --git a/src/VBox/Devices/PC/DevDMA.cpp b/src/VBox/Devices/PC/DevDMA.cpp index 2a90db227..2376da859 100644 --- a/src/VBox/Devices/PC/DevDMA.cpp +++ b/src/VBox/Devices/PC/DevDMA.cpp @@ -1,4 +1,4 @@ -/* $Id: DevDMA.cpp 12978 2008-10-03 23:28:44Z vboxsync $ */ +/* $Id: DevDMA.cpp $ */ /** @file * DevDMA - DMA Controller Device. */ diff --git a/src/VBox/Devices/PC/DevPIC.cpp b/src/VBox/Devices/PC/DevPIC.cpp index fb5b83ea9..e36dd7263 100644 --- a/src/VBox/Devices/PC/DevPIC.cpp +++ b/src/VBox/Devices/PC/DevPIC.cpp @@ -1,4 +1,4 @@ -/* $Id: DevPIC.cpp 20572 2009-06-14 21:29:23Z vboxsync $ */ +/* $Id: DevPIC.cpp $ */ /** @file * DevPIC - Intel 8259 Programmable Interrupt Controller (PIC) Device. */ diff --git a/src/VBox/Devices/PC/DevPcArch.c b/src/VBox/Devices/PC/DevPcArch.c index 5bc54992a..6e2f7d48f 100644 --- a/src/VBox/Devices/PC/DevPcArch.c +++ b/src/VBox/Devices/PC/DevPcArch.c @@ -1,4 +1,4 @@ -/* $Id: DevPcArch.c 18663 2009-04-02 19:08:14Z vboxsync $ */ +/* $Id: DevPcArch.c $ */ /** @file * DevPcArch - PC Architechture Device. */ diff --git a/src/VBox/Devices/PC/DevPcBios.cpp b/src/VBox/Devices/PC/DevPcBios.cpp index 3b0059762..b6cc93fbc 100644 --- a/src/VBox/Devices/PC/DevPcBios.cpp +++ b/src/VBox/Devices/PC/DevPcBios.cpp @@ -1,4 +1,4 @@ -/* $Id: DevPcBios.cpp 20924 2009-06-25 11:22:57Z vboxsync $ */ +/* $Id: DevPcBios.cpp $ */ /** @file * PC BIOS Device. */ diff --git a/src/VBox/Devices/PC/DevPcBios.h b/src/VBox/Devices/PC/DevPcBios.h index 1b50ebf72..09b796cb2 100644 --- a/src/VBox/Devices/PC/DevPcBios.h +++ b/src/VBox/Devices/PC/DevPcBios.h @@ -1,4 +1,4 @@ -/* $Id: DevPcBios.h 12653 2008-09-22 16:03:25Z vboxsync $ */ +/* $Id: DevPcBios.h $ */ /** @file * DevPcBios - PC BIOS Device, header shared with the BIOS code. */ diff --git a/src/VBox/Devices/PC/DevPit-i8254.cpp b/src/VBox/Devices/PC/DevPit-i8254.cpp index 15e337e77..dc708793a 100644 --- a/src/VBox/Devices/PC/DevPit-i8254.cpp +++ b/src/VBox/Devices/PC/DevPit-i8254.cpp @@ -1,4 +1,4 @@ -/* $Id: DevPit-i8254.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: DevPit-i8254.cpp $ */ /** @file * DevPIT-i8254 - Intel 8254 Programmable Interval Timer (PIT) And Dummy Speaker Device. */ diff --git a/src/VBox/Devices/PC/DevRTC.cpp b/src/VBox/Devices/PC/DevRTC.cpp index d10f8d896..218833433 100644 --- a/src/VBox/Devices/PC/DevRTC.cpp +++ b/src/VBox/Devices/PC/DevRTC.cpp @@ -1,4 +1,4 @@ -/* $Id: DevRTC.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: DevRTC.cpp $ */ /** @file * Motorola MC146818 RTC/CMOS Device. */ diff --git a/src/VBox/Devices/PC/DrvACPI.cpp b/src/VBox/Devices/PC/DrvACPI.cpp index cca94ce53..3aa10d8b6 100644 --- a/src/VBox/Devices/PC/DrvACPI.cpp +++ b/src/VBox/Devices/PC/DrvACPI.cpp @@ -1,4 +1,4 @@ -/* $Id: DrvACPI.cpp 19967 2009-05-24 12:05:02Z vboxsync $ */ +/* $Id: DrvACPI.cpp $ */ /** @file * DrvACPI - ACPI Host Driver. */ diff --git a/src/VBox/Devices/PC/Etherboot-src/Makefile.kmk b/src/VBox/Devices/PC/Etherboot-src/Makefile.kmk index 829158636..2803bdcde 100644 --- a/src/VBox/Devices/PC/Etherboot-src/Makefile.kmk +++ b/src/VBox/Devices/PC/Etherboot-src/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19279 2009-04-30 19:03:36Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # VBox Etherboot Network boot ROM makefile. # diff --git a/src/VBox/Devices/PC/Etherboot-src/arch/i386/drivers/net/undi.c b/src/VBox/Devices/PC/Etherboot-src/arch/i386/drivers/net/undi.c index ec7c2816f..26786ab29 100644 --- a/src/VBox/Devices/PC/Etherboot-src/arch/i386/drivers/net/undi.c +++ b/src/VBox/Devices/PC/Etherboot-src/arch/i386/drivers/net/undi.c @@ -6,7 +6,7 @@ This file Copyright (C) 2003 Michael Brown <mbrown@fensystems.co.uk> of Fen Systems Ltd. (http://www.fensystems.co.uk/). All rights reserved. -$Id: undi.c 11982 2008-09-02 13:09:44Z vboxsync $ +$Id: undi.c $ ***************************************************************************/ /* diff --git a/src/VBox/Devices/PC/Etherboot-src/arch/i386/drivers/net/undi.h b/src/VBox/Devices/PC/Etherboot-src/arch/i386/drivers/net/undi.h index 470617a29..c20689e0e 100644 --- a/src/VBox/Devices/PC/Etherboot-src/arch/i386/drivers/net/undi.h +++ b/src/VBox/Devices/PC/Etherboot-src/arch/i386/drivers/net/undi.h @@ -6,7 +6,7 @@ This file Copyright (C) 2003 Michael Brown <mbrown@fensystems.co.uk> of Fen Systems Ltd. (http://www.fensystems.co.uk/). All rights reserved. -$Id: undi.h 11982 2008-09-02 13:09:44Z vboxsync $ +$Id: undi.h $ ***************************************************************************/ /* diff --git a/src/VBox/Devices/PC/Etherboot-src/arch/i386/firmware/pcbios/basemem.c b/src/VBox/Devices/PC/Etherboot-src/arch/i386/firmware/pcbios/basemem.c index 8339ee020..5ba665960 100644 --- a/src/VBox/Devices/PC/Etherboot-src/arch/i386/firmware/pcbios/basemem.c +++ b/src/VBox/Devices/PC/Etherboot-src/arch/i386/firmware/pcbios/basemem.c @@ -7,7 +7,7 @@ * updating the Free Base Memory Size counter at 40:13h. * * Michael Brown <mbrown@fensystems.co.uk> (mcb30) - * $Id: basemem.c 1 vboxsync $ + * $Id: basemem.c $ */ #define fbms ( ( uint16_t * ) phys_to_virt ( 0x413 ) ) diff --git a/src/VBox/Devices/PC/Etherboot-src/arch/i386/include/callbacks_arch.h b/src/VBox/Devices/PC/Etherboot-src/arch/i386/include/callbacks_arch.h index 47dbe33c2..1deef4253 100644 --- a/src/VBox/Devices/PC/Etherboot-src/arch/i386/include/callbacks_arch.h +++ b/src/VBox/Devices/PC/Etherboot-src/arch/i386/include/callbacks_arch.h @@ -5,7 +5,7 @@ * * Initial version by Michael Brown <mbrown@fensystems.co.uk>, January 2004. * - * $Id: callbacks_arch.h 1 vboxsync $ + * $Id: callbacks_arch.h $ */ #ifndef CALLBACKS_ARCH_H diff --git a/src/VBox/Devices/PC/Etherboot-src/core/dns_resolver.c b/src/VBox/Devices/PC/Etherboot-src/core/dns_resolver.c index 638308dbf..99676ae9f 100644 --- a/src/VBox/Devices/PC/Etherboot-src/core/dns_resolver.c +++ b/src/VBox/Devices/PC/Etherboot-src/core/dns_resolver.c @@ -22,8 +22,8 @@ * This code is using nuts and bolts from throughout etherboot. * It is a fresh implementation according to the DNS RFC, #1035 * -* $Revision: 11982 $ -* $Author: vboxsync $ +* $Revision: 35885 $ +* $Author: umoeller $ * $Date: 2008-09-02 15:09:44 +0200 (Tue, 02 Sep 2008) $ * * REVISION HISTORY: diff --git a/src/VBox/Devices/PC/Etherboot-src/genrules.pl b/src/VBox/Devices/PC/Etherboot-src/genrules.pl index 3cf9c6d84..3cf9c6d84 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/genrules.pl +++ b/src/VBox/Devices/PC/Etherboot-src/genrules.pl diff --git a/src/VBox/Devices/PC/Etherboot-src/include/callbacks.h b/src/VBox/Devices/PC/Etherboot-src/include/callbacks.h index 2f635f27f..95ba2af9b 100644 --- a/src/VBox/Devices/PC/Etherboot-src/include/callbacks.h +++ b/src/VBox/Devices/PC/Etherboot-src/include/callbacks.h @@ -5,7 +5,7 @@ * * Initial version by Michael Brown <mbrown@fensystems.co.uk>, January 2004. * - * $Id: callbacks.h 1 vboxsync $ + * $Id: callbacks.h $ */ #ifndef CALLBACKS_H diff --git a/src/VBox/Devices/PC/Etherboot-src/include/pxe.h b/src/VBox/Devices/PC/Etherboot-src/include/pxe.h index 396891864..ec12cddce 100644 --- a/src/VBox/Devices/PC/Etherboot-src/include/pxe.h +++ b/src/VBox/Devices/PC/Etherboot-src/include/pxe.h @@ -632,7 +632,7 @@ typedef struct { * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: pxe.h 1 vboxsync $ + * $Id: pxe.h $ */ /* diff --git a/src/VBox/Devices/PC/Etherboot-src/util/catrom.pl b/src/VBox/Devices/PC/Etherboot-src/util/catrom.pl index fe37e6b6e..fe37e6b6e 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/catrom.pl +++ b/src/VBox/Devices/PC/Etherboot-src/util/catrom.pl diff --git a/src/VBox/Devices/PC/Etherboot-src/util/disrom.pl b/src/VBox/Devices/PC/Etherboot-src/util/disrom.pl index 64128698c..64128698c 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/disrom.pl +++ b/src/VBox/Devices/PC/Etherboot-src/util/disrom.pl diff --git a/src/VBox/Devices/PC/Etherboot-src/util/geniso b/src/VBox/Devices/PC/Etherboot-src/util/geniso index cf0469902..cf0469902 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/geniso +++ b/src/VBox/Devices/PC/Etherboot-src/util/geniso diff --git a/src/VBox/Devices/PC/Etherboot-src/util/genliso b/src/VBox/Devices/PC/Etherboot-src/util/genliso index b8d9a11df..b8d9a11df 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/genliso +++ b/src/VBox/Devices/PC/Etherboot-src/util/genliso diff --git a/src/VBox/Devices/PC/Etherboot-src/util/get-pci-ids b/src/VBox/Devices/PC/Etherboot-src/util/get-pci-ids index 6501a7f7c..6501a7f7c 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/get-pci-ids +++ b/src/VBox/Devices/PC/Etherboot-src/util/get-pci-ids diff --git a/src/VBox/Devices/PC/Etherboot-src/util/makelilo.pl b/src/VBox/Devices/PC/Etherboot-src/util/makelilo.pl index 8f995bc46..8f995bc46 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/makelilo.pl +++ b/src/VBox/Devices/PC/Etherboot-src/util/makelilo.pl diff --git a/src/VBox/Devices/PC/Etherboot-src/util/makerom.pl b/src/VBox/Devices/PC/Etherboot-src/util/makerom.pl index 9d751e190..9d751e190 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/makerom.pl +++ b/src/VBox/Devices/PC/Etherboot-src/util/makerom.pl diff --git a/src/VBox/Devices/PC/Etherboot-src/util/modrom.pl b/src/VBox/Devices/PC/Etherboot-src/util/modrom.pl index 695468c26..695468c26 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/modrom.pl +++ b/src/VBox/Devices/PC/Etherboot-src/util/modrom.pl diff --git a/src/VBox/Devices/PC/Etherboot-src/util/swapdevids.pl b/src/VBox/Devices/PC/Etherboot-src/util/swapdevids.pl index c6255ae73..c6255ae73 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/swapdevids.pl +++ b/src/VBox/Devices/PC/Etherboot-src/util/swapdevids.pl diff --git a/src/VBox/Devices/PC/Etherboot-src/util/zfilelen.pl b/src/VBox/Devices/PC/Etherboot-src/util/zfilelen.pl index 1f58ff9ee..1f58ff9ee 100644..100755 --- a/src/VBox/Devices/PC/Etherboot-src/util/zfilelen.pl +++ b/src/VBox/Devices/PC/Etherboot-src/util/zfilelen.pl diff --git a/src/VBox/Devices/PC/vbox.dsl b/src/VBox/Devices/PC/vbox.dsl index f4db45557..07b0365ea 100644 --- a/src/VBox/Devices/PC/vbox.dsl +++ b/src/VBox/Devices/PC/vbox.dsl @@ -1,4 +1,4 @@ -// $Id: vbox.dsl 20679 2009-06-18 10:38:52Z vboxsync $ +// $Id: vbox.dsl $ /// @file // // VirtualBox ACPI diff --git a/src/VBox/Devices/Parallel/DevParallel.cpp b/src/VBox/Devices/Parallel/DevParallel.cpp index f91c729dd..4a05e20e4 100644 --- a/src/VBox/Devices/Parallel/DevParallel.cpp +++ b/src/VBox/Devices/Parallel/DevParallel.cpp @@ -1,4 +1,4 @@ -/* $Id: DevParallel.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: DevParallel.cpp $ */ /** @file * DevParallel - Parallel (Port) Device Emulation. * diff --git a/src/VBox/Devices/Parallel/DrvHostParallel.cpp b/src/VBox/Devices/Parallel/DrvHostParallel.cpp index b7c42ff1d..ded674a2d 100644 --- a/src/VBox/Devices/Parallel/DrvHostParallel.cpp +++ b/src/VBox/Devices/Parallel/DrvHostParallel.cpp @@ -1,4 +1,4 @@ -/* $Id: DrvHostParallel.cpp 20961 2009-06-26 08:45:18Z vboxsync $ */ +/* $Id: DrvHostParallel.cpp $ */ /** @file * VirtualBox Host Parallel Port Driver. * diff --git a/src/VBox/Devices/Serial/DevSerial.cpp b/src/VBox/Devices/Serial/DevSerial.cpp index 47efdfea3..e895ad80e 100644 --- a/src/VBox/Devices/Serial/DevSerial.cpp +++ b/src/VBox/Devices/Serial/DevSerial.cpp @@ -1,4 +1,4 @@ -/* $Id: DevSerial.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: DevSerial.cpp $ */ /** @file * DevSerial - 16450 UART emulation. */ diff --git a/src/VBox/Devices/Serial/DrvHostSerial.cpp b/src/VBox/Devices/Serial/DrvHostSerial.cpp index 4ac91e2c6..8a0b685fe 100644 --- a/src/VBox/Devices/Serial/DrvHostSerial.cpp +++ b/src/VBox/Devices/Serial/DrvHostSerial.cpp @@ -1,4 +1,4 @@ -/* $Id: DrvHostSerial.cpp 19809 2009-05-19 09:32:03Z vboxsync $ */ +/* $Id: DrvHostSerial.cpp $ */ /** @file * VBox stream I/O devices: Host serial driver * diff --git a/src/VBox/Devices/Storage/ATAController.cpp b/src/VBox/Devices/Storage/ATAController.cpp new file mode 100644 index 000000000..2bf9ae04b --- /dev/null +++ b/src/VBox/Devices/Storage/ATAController.cpp @@ -0,0 +1,5560 @@ +/* $Id: ATAController.cpp $ */ +/** @file + * DevATA, DevAHCI - Shared ATA/ATAPI controller code (disk and cdrom). + * + * @todo Actually share this code? + */ + +/* + * Copyright (C) 2006-2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#define LOG_GROUP LOG_GROUP_DEV_IDE +#include <VBox/pdmdev.h> +#include <iprt/assert.h> +#include <iprt/string.h> +#ifdef IN_RING3 +# include <iprt/uuid.h> +# include <iprt/semaphore.h> +# include <iprt/thread.h> +# include <iprt/time.h> +# include <iprt/alloc.h> +#endif /* IN_RING3 */ +#include <iprt/critsect.h> +#include <iprt/asm.h> +#include <VBox/stam.h> +#include <VBox/mm.h> +#include <VBox/pgm.h> + +#include <VBox/scsi.h> + +#include "ATAController.h" +#include "PIIX3ATABmDma.h" +#include "ide.h" + +/** + * The SSM saved state version. + */ +#define ATA_CTL_SAVED_STATE_VERSION 3 +#define ATA_CTL_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE 1 +#define ATA_CTL_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS 2 + +#ifndef VBOX_DEVICE_STRUCT_TESTCASE + +DECLINLINE(void) ataSetStatusValue(AHCIATADevState *s, uint8_t stat) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + + /* Freeze status register contents while processing RESET. */ + if (!pCtl->fReset) + { + s->uATARegStatus = stat; + Log2(("%s: LUN#%d status %#04x\n", __FUNCTION__, s->iLUN, s->uATARegStatus)); + } +} + + +DECLINLINE(void) ataSetStatus(AHCIATADevState *s, uint8_t stat) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + + /* Freeze status register contents while processing RESET. */ + if (!pCtl->fReset) + { + s->uATARegStatus |= stat; + Log2(("%s: LUN#%d status %#04x\n", __FUNCTION__, s->iLUN, s->uATARegStatus)); + } +} + + +DECLINLINE(void) ataUnsetStatus(AHCIATADevState *s, uint8_t stat) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + + /* Freeze status register contents while processing RESET. */ + if (!pCtl->fReset) + { + s->uATARegStatus &= ~stat; + Log2(("%s: LUN#%d status %#04x\n", __FUNCTION__, s->iLUN, s->uATARegStatus)); + } +} + +#ifdef IN_RING3 + +typedef void (*PBeginTransferFunc)(AHCIATADevState *); +typedef bool (*PSourceSinkFunc)(AHCIATADevState *); + +static void ataReadWriteSectorsBT(AHCIATADevState *); +static void ataPacketBT(AHCIATADevState *); +static void atapiCmdBT(AHCIATADevState *); +static void atapiPassthroughCmdBT(AHCIATADevState *); + +static bool ataIdentifySS(AHCIATADevState *); +static bool ataFlushSS(AHCIATADevState *); +static bool ataReadSectorsSS(AHCIATADevState *); +static bool ataWriteSectorsSS(AHCIATADevState *); +static bool ataExecuteDeviceDiagnosticSS(AHCIATADevState *); +static bool ataPacketSS(AHCIATADevState *); +static bool atapiGetConfigurationSS(AHCIATADevState *); +static bool atapiGetEventStatusNotificationSS(AHCIATADevState *); +static bool atapiIdentifySS(AHCIATADevState *); +static bool atapiInquirySS(AHCIATADevState *); +static bool atapiMechanismStatusSS(AHCIATADevState *); +static bool atapiModeSenseErrorRecoverySS(AHCIATADevState *); +static bool atapiModeSenseCDStatusSS(AHCIATADevState *); +static bool atapiReadSS(AHCIATADevState *); +static bool atapiReadCapacitySS(AHCIATADevState *); +static bool atapiReadDiscInformationSS(AHCIATADevState *); +static bool atapiReadTOCNormalSS(AHCIATADevState *); +static bool atapiReadTOCMultiSS(AHCIATADevState *); +static bool atapiReadTOCRawSS(AHCIATADevState *); +static bool atapiReadTrackInformationSS(AHCIATADevState *); +static bool atapiRequestSenseSS(AHCIATADevState *); +static bool atapiPassthroughSS(AHCIATADevState *); + +/** + * Begin of transfer function indexes for g_apfnBeginTransFuncs. + */ +typedef enum ATAFNBT +{ + ATAFN_BT_NULL = 0, + ATAFN_BT_READ_WRITE_SECTORS, + ATAFN_BT_PACKET, + ATAFN_BT_ATAPI_CMD, + ATAFN_BT_ATAPI_PASSTHROUGH_CMD, + ATAFN_BT_MAX +} ATAFNBT; + +/** + * Array of end transfer functions, the index is ATAFNET. + * Make sure ATAFNET and this array match! + */ +static const PBeginTransferFunc g_apfnBeginTransFuncs[ATAFN_BT_MAX] = +{ + NULL, + ataReadWriteSectorsBT, + ataPacketBT, + atapiCmdBT, + atapiPassthroughCmdBT, +}; + +/** + * Source/sink function indexes for g_apfnSourceSinkFuncs. + */ +typedef enum ATAFNSS +{ + ATAFN_SS_NULL = 0, + ATAFN_SS_IDENTIFY, + ATAFN_SS_FLUSH, + ATAFN_SS_READ_SECTORS, + ATAFN_SS_WRITE_SECTORS, + ATAFN_SS_EXECUTE_DEVICE_DIAGNOSTIC, + ATAFN_SS_PACKET, + ATAFN_SS_ATAPI_GET_CONFIGURATION, + ATAFN_SS_ATAPI_GET_EVENT_STATUS_NOTIFICATION, + ATAFN_SS_ATAPI_IDENTIFY, + ATAFN_SS_ATAPI_INQUIRY, + ATAFN_SS_ATAPI_MECHANISM_STATUS, + ATAFN_SS_ATAPI_MODE_SENSE_ERROR_RECOVERY, + ATAFN_SS_ATAPI_MODE_SENSE_CD_STATUS, + ATAFN_SS_ATAPI_READ, + ATAFN_SS_ATAPI_READ_CAPACITY, + ATAFN_SS_ATAPI_READ_DISC_INFORMATION, + ATAFN_SS_ATAPI_READ_TOC_NORMAL, + ATAFN_SS_ATAPI_READ_TOC_MULTI, + ATAFN_SS_ATAPI_READ_TOC_RAW, + ATAFN_SS_ATAPI_READ_TRACK_INFORMATION, + ATAFN_SS_ATAPI_REQUEST_SENSE, + ATAFN_SS_ATAPI_PASSTHROUGH, + ATAFN_SS_MAX +} ATAFNSS; + +/** + * Array of source/sink functions, the index is ATAFNSS. + * Make sure ATAFNSS and this array match! + */ +static const PSourceSinkFunc g_apfnSourceSinkFuncs[ATAFN_SS_MAX] = +{ + NULL, + ataIdentifySS, + ataFlushSS, + ataReadSectorsSS, + ataWriteSectorsSS, + ataExecuteDeviceDiagnosticSS, + ataPacketSS, + atapiGetConfigurationSS, + atapiGetEventStatusNotificationSS, + atapiIdentifySS, + atapiInquirySS, + atapiMechanismStatusSS, + atapiModeSenseErrorRecoverySS, + atapiModeSenseCDStatusSS, + atapiReadSS, + atapiReadCapacitySS, + atapiReadDiscInformationSS, + atapiReadTOCNormalSS, + atapiReadTOCMultiSS, + atapiReadTOCRawSS, + atapiReadTrackInformationSS, + atapiRequestSenseSS, + atapiPassthroughSS +}; + + +static const AHCIATARequest ataDMARequest = { AHCIATA_AIO_DMA, }; +static const AHCIATARequest ataPIORequest = { AHCIATA_AIO_PIO, }; +static const AHCIATARequest ataResetARequest = { AHCIATA_AIO_RESET_ASSERTED, }; +static const AHCIATARequest ataResetCRequest = { AHCIATA_AIO_RESET_CLEARED, }; + + +static void ataAsyncIOClearRequests(PAHCIATACONTROLLER pCtl) +{ + int rc; + + rc = RTSemMutexRequest(pCtl->AsyncIORequestMutex, RT_INDEFINITE_WAIT); + AssertRC(rc); + pCtl->AsyncIOReqHead = 0; + pCtl->AsyncIOReqTail = 0; + rc = RTSemMutexRelease(pCtl->AsyncIORequestMutex); + AssertRC(rc); +} + + +static void ataAsyncIOPutRequest(PAHCIATACONTROLLER pCtl, const AHCIATARequest *pReq) +{ + int rc; + + rc = RTSemMutexRequest(pCtl->AsyncIORequestMutex, RT_INDEFINITE_WAIT); + AssertRC(rc); + Assert((pCtl->AsyncIOReqHead + 1) % RT_ELEMENTS(pCtl->aAsyncIORequests) != pCtl->AsyncIOReqTail); + memcpy(&pCtl->aAsyncIORequests[pCtl->AsyncIOReqHead], pReq, sizeof(*pReq)); + pCtl->AsyncIOReqHead++; + pCtl->AsyncIOReqHead %= RT_ELEMENTS(pCtl->aAsyncIORequests); + rc = RTSemMutexRelease(pCtl->AsyncIORequestMutex); + AssertRC(rc); + LogBird(("ata: %x: signalling\n", pCtl->IOPortBase1)); + rc = PDMR3CritSectScheduleExitEvent(&pCtl->lock, pCtl->AsyncIOSem); + if (RT_FAILURE(rc)) + { + LogBird(("ata: %x: schedule failed, rc=%Rrc\n", pCtl->IOPortBase1, rc)); + rc = RTSemEventSignal(pCtl->AsyncIOSem); + AssertRC(rc); + } +} + + +static const AHCIATARequest *ataAsyncIOGetCurrentRequest(PAHCIATACONTROLLER pCtl) +{ + int rc; + const AHCIATARequest *pReq; + + rc = RTSemMutexRequest(pCtl->AsyncIORequestMutex, RT_INDEFINITE_WAIT); + AssertRC(rc); + if (pCtl->AsyncIOReqHead != pCtl->AsyncIOReqTail) + pReq = &pCtl->aAsyncIORequests[pCtl->AsyncIOReqTail]; + else + pReq = NULL; + rc = RTSemMutexRelease(pCtl->AsyncIORequestMutex); + AssertRC(rc); + return pReq; +} + + +/** + * Remove the request with the given type, as it's finished. The request + * is not removed blindly, as this could mean a RESET request that is not + * yet processed (but has cleared the request queue) is lost. + * + * @param pCtl Controller for which to remove the request. + * @param ReqType Type of the request to remove. + */ +static void ataAsyncIORemoveCurrentRequest(PAHCIATACONTROLLER pCtl, AHCIATAAIO ReqType) +{ + int rc; + + rc = RTSemMutexRequest(pCtl->AsyncIORequestMutex, RT_INDEFINITE_WAIT); + AssertRC(rc); + if (pCtl->AsyncIOReqHead != pCtl->AsyncIOReqTail && pCtl->aAsyncIORequests[pCtl->AsyncIOReqTail].ReqType == ReqType) + { + pCtl->AsyncIOReqTail++; + pCtl->AsyncIOReqTail %= RT_ELEMENTS(pCtl->aAsyncIORequests); + } + rc = RTSemMutexRelease(pCtl->AsyncIORequestMutex); + AssertRC(rc); +} + + +/** + * Dump the request queue for a particular controller. First dump the queue + * contents, then the already processed entries, as long as they haven't been + * overwritten. + * + * @param pCtl Controller for which to dump the queue. + */ +static void ataAsyncIODumpRequests(PAHCIATACONTROLLER pCtl) +{ + int rc; + uint8_t curr; + + rc = RTSemMutexRequest(pCtl->AsyncIORequestMutex, RT_INDEFINITE_WAIT); + AssertRC(rc); + LogRel(("ATA: Ctl: request queue dump (topmost is current):\n")); + curr = pCtl->AsyncIOReqTail; + do + { + if (curr == pCtl->AsyncIOReqHead) + LogRel(("ATA: Ctl: processed requests (topmost is oldest):\n")); + switch (pCtl->aAsyncIORequests[curr].ReqType) + { + case AHCIATA_AIO_NEW: + LogRel(("new transfer request, iIf=%d iBeginTransfer=%d iSourceSink=%d cbTotalTransfer=%d uTxDir=%d\n", pCtl->aAsyncIORequests[curr].u.t.iIf, pCtl->aAsyncIORequests[curr].u.t.iBeginTransfer, pCtl->aAsyncIORequests[curr].u.t.iSourceSink, pCtl->aAsyncIORequests[curr].u.t.cbTotalTransfer, pCtl->aAsyncIORequests[curr].u.t.uTxDir)); + break; + case AHCIATA_AIO_DMA: + LogRel(("dma transfer finished\n")); + break; + case AHCIATA_AIO_PIO: + LogRel(("pio transfer finished\n")); + break; + case AHCIATA_AIO_RESET_ASSERTED: + LogRel(("reset asserted request\n")); + break; + case AHCIATA_AIO_RESET_CLEARED: + LogRel(("reset cleared request\n")); + break; + case AHCIATA_AIO_ABORT: + LogRel(("abort request, iIf=%d fResetDrive=%d\n", pCtl->aAsyncIORequests[curr].u.a.iIf, pCtl->aAsyncIORequests[curr].u.a.fResetDrive)); + break; + default: + LogRel(("unknown request %d\n", pCtl->aAsyncIORequests[curr].ReqType)); + } + curr = (curr + 1) % RT_ELEMENTS(pCtl->aAsyncIORequests); + } while (curr != pCtl->AsyncIOReqTail); + rc = RTSemMutexRelease(pCtl->AsyncIORequestMutex); + AssertRC(rc); +} + + +/** + * Checks whether the request queue for a particular controller is empty + * or whether a particular controller is idle. + * + * @param pCtl Controller for which to check the queue. + * @param fStrict If set then the controller is checked to be idle. + */ +static bool ataAsyncIOIsIdle(PAHCIATACONTROLLER pCtl, bool fStrict) +{ + int rc; + bool fIdle; + + rc = RTSemMutexRequest(pCtl->AsyncIORequestMutex, RT_INDEFINITE_WAIT); + AssertRC(rc); + fIdle = pCtl->fRedoIdle; + if (!fIdle) + fIdle = (pCtl->AsyncIOReqHead == pCtl->AsyncIOReqTail); + if (fStrict) + fIdle &= (pCtl->uAsyncIOState == AHCIATA_AIO_NEW); + rc = RTSemMutexRelease(pCtl->AsyncIORequestMutex); + AssertRC(rc); + return fIdle; +} + + +/** + * Send a transfer request to the async I/O thread. + * + * @param s Pointer to the ATA device state data. + * @param cbTotalTransfer Data transfer size. + * @param uTxDir Data transfer direction. + * @param iBeginTransfer Index of BeginTransfer callback. + * @param iSourceSink Index of SourceSink callback. + * @param fChainedTransfer Whether this is a transfer that is part of the previous command/transfer. + */ +static void ataStartTransfer(AHCIATADevState *s, uint32_t cbTotalTransfer, uint8_t uTxDir, ATAFNBT iBeginTransfer, ATAFNSS iSourceSink, bool fChainedTransfer) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + AHCIATARequest Req; + + Assert(PDMCritSectIsOwner(&pCtl->lock)); + + /* Do not issue new requests while the RESET line is asserted. */ + if (pCtl->fReset) + { + Log2(("%s: Ctl: suppressed new request as RESET is active\n", __FUNCTION__)); + return; + } + + /* If the controller is already doing something else right now, ignore + * the command that is being submitted. Some broken guests issue commands + * twice (e.g. the Linux kernel that comes with Acronis True Image 8). */ + if (!fChainedTransfer && !ataAsyncIOIsIdle(pCtl, true)) + { + Log(("%s: Ctl: ignored command %#04x, controller state %d\n", __FUNCTION__, s->uATARegCommand, pCtl->uAsyncIOState)); + LogRel(("IDE: guest issued command %#04x while controller busy\n", s->uATARegCommand)); + return; + } + + Req.ReqType = AHCIATA_AIO_NEW; + if (fChainedTransfer) + Req.u.t.iIf = pCtl->iAIOIf; + else + Req.u.t.iIf = pCtl->iSelectedIf; + Req.u.t.cbTotalTransfer = cbTotalTransfer; + Req.u.t.uTxDir = uTxDir; + Req.u.t.iBeginTransfer = iBeginTransfer; + Req.u.t.iSourceSink = iSourceSink; + ataSetStatusValue(s, ATA_STAT_BUSY); + pCtl->fChainedTransfer = fChainedTransfer; + + /* + * Kick the worker thread into action. + */ + Log2(("%s: Ctl: message to async I/O thread, new request\n", __FUNCTION__)); + ataAsyncIOPutRequest(pCtl, &Req); +} + + +/** + * Send an abort command request to the async I/O thread. + * + * @param s Pointer to the ATA device state data. + * @param fResetDrive Whether to reset the drive or just abort a command. + */ +static void ataAbortCurrentCommand(AHCIATADevState *s, bool fResetDrive) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + AHCIATARequest Req; + + Assert(PDMCritSectIsOwner(&pCtl->lock)); + + /* Do not issue new requests while the RESET line is asserted. */ + if (pCtl->fReset) + { + Log2(("%s: Ctl: suppressed aborting command as RESET is active\n", __FUNCTION__)); + return; + } + + Req.ReqType = AHCIATA_AIO_ABORT; + Req.u.a.iIf = pCtl->iSelectedIf; + Req.u.a.fResetDrive = fResetDrive; + ataSetStatus(s, ATA_STAT_BUSY); + Log2(("%s: Ctl: message to async I/O thread, abort command on LUN#%d\n", __FUNCTION__, s->iLUN)); + ataAsyncIOPutRequest(pCtl, &Req); +} + + +static void ataSetIRQ(AHCIATADevState *s) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + PPDMDEVINS pDevIns = ATADEVSTATE_2_DEVINS(s); + + if (!(s->uATARegDevCtl & ATA_DEVCTL_DISABLE_IRQ)) + { + Log2(("%s: LUN#%d asserting IRQ\n", __FUNCTION__, s->iLUN)); + /* The BMDMA unit unconditionally sets BM_STATUS_INT if the interrupt + * line is asserted. It monitors the line for a rising edge. */ + if (!s->fIrqPending) + pCtl->BmDma.u8Status |= BM_STATUS_INT; + /* Only actually set the IRQ line if updating the currently selected drive. */ + if (s == &pCtl->aIfs[pCtl->iSelectedIf]) + PDMDevHlpISASetIrqNoWait(pDevIns, pCtl->irq, 1); + } + s->fIrqPending = true; +} + +#endif /* IN_RING3 */ + +static void ataUnsetIRQ(AHCIATADevState *s) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + PPDMDEVINS pDevIns = ATADEVSTATE_2_DEVINS(s); + + if (!(s->uATARegDevCtl & ATA_DEVCTL_DISABLE_IRQ)) + { + Log2(("%s: LUN#%d deasserting IRQ\n", __FUNCTION__, s->iLUN)); + /* Only actually unset the IRQ line if updating the currently selected drive. */ + if (s == &pCtl->aIfs[pCtl->iSelectedIf]) + PDMDevHlpISASetIrqNoWait(pDevIns, pCtl->irq, 0); + } + s->fIrqPending = false; +} + +#ifdef IN_RING3 + +static void ataPIOTransferStart(AHCIATADevState *s, uint32_t start, uint32_t size) +{ + Log2(("%s: LUN#%d start %d size %d\n", __FUNCTION__, s->iLUN, start, size)); + s->iIOBufferPIODataStart = start; + s->iIOBufferPIODataEnd = start + size; + ataSetStatus(s, ATA_STAT_DRQ); +} + + +static void ataPIOTransferStop(AHCIATADevState *s) +{ + Log2(("%s: LUN#%d\n", __FUNCTION__, s->iLUN)); + if (s->fATAPITransfer) + { + s->uATARegNSector = (s->uATARegNSector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; + Log2(("%s: interrupt reason %#04x\n", __FUNCTION__, s->uATARegNSector)); + ataSetIRQ(s); + s->fATAPITransfer = false; + } + s->cbTotalTransfer = 0; + s->cbElementaryTransfer = 0; + s->iIOBufferPIODataStart = 0; + s->iIOBufferPIODataEnd = 0; + s->iBeginTransfer = ATAFN_BT_NULL; + s->iSourceSink = ATAFN_SS_NULL; +} + + +static void ataPIOTransferLimitATAPI(AHCIATADevState *s) +{ + uint32_t cbLimit, cbTransfer; + + cbLimit = s->uATARegLCyl | (s->uATARegHCyl << 8); + /* Use maximum transfer size if the guest requested 0. Avoids a hang. */ + if (cbLimit == 0) + cbLimit = 0xfffe; + Log2(("%s: byte count limit=%d\n", __FUNCTION__, cbLimit)); + if (cbLimit == 0xffff) + cbLimit--; + cbTransfer = RT_MIN(s->cbTotalTransfer, s->iIOBufferEnd - s->iIOBufferCur); + if (cbTransfer > cbLimit) + { + /* Byte count limit for clipping must be even in this case */ + if (cbLimit & 1) + cbLimit--; + cbTransfer = cbLimit; + } + s->uATARegLCyl = cbTransfer; + s->uATARegHCyl = cbTransfer >> 8; + s->cbElementaryTransfer = cbTransfer; +} + + +static uint32_t ataGetNSectors(AHCIATADevState *s) +{ + /* 0 means either 256 (LBA28) or 65536 (LBA48) sectors. */ + if (s->fLBA48) + { + if (!s->uATARegNSector && !s->uATARegNSectorHOB) + return 65536; + else + return s->uATARegNSectorHOB << 8 | s->uATARegNSector; + } + else + { + if (!s->uATARegNSector) + return 256; + else + return s->uATARegNSector; + } +} + + +static void ataPadString(uint8_t *pbDst, const char *pbSrc, uint32_t cbSize) +{ + for (uint32_t i = 0; i < cbSize; i++) + { + if (*pbSrc) + pbDst[i ^ 1] = *pbSrc++; + else + pbDst[i ^ 1] = ' '; + } +} + + +static void ataSCSIPadStr(uint8_t *pbDst, const char *pbSrc, uint32_t cbSize) +{ + for (uint32_t i = 0; i < cbSize; i++) + { + if (*pbSrc) + pbDst[i] = *pbSrc++; + else + pbDst[i] = ' '; + } +} + + +DECLINLINE(void) ataH2BE_U16(uint8_t *pbBuf, uint16_t val) +{ + pbBuf[0] = val >> 8; + pbBuf[1] = val; +} + + +DECLINLINE(void) ataH2BE_U24(uint8_t *pbBuf, uint32_t val) +{ + pbBuf[0] = val >> 16; + pbBuf[1] = val >> 8; + pbBuf[2] = val; +} + + +DECLINLINE(void) ataH2BE_U32(uint8_t *pbBuf, uint32_t val) +{ + pbBuf[0] = val >> 24; + pbBuf[1] = val >> 16; + pbBuf[2] = val >> 8; + pbBuf[3] = val; +} + + +DECLINLINE(uint16_t) ataBE2H_U16(const uint8_t *pbBuf) +{ + return (pbBuf[0] << 8) | pbBuf[1]; +} + + +DECLINLINE(uint32_t) ataBE2H_U24(const uint8_t *pbBuf) +{ + return (pbBuf[0] << 16) | (pbBuf[1] << 8) | pbBuf[2]; +} + + +DECLINLINE(uint32_t) ataBE2H_U32(const uint8_t *pbBuf) +{ + return (pbBuf[0] << 24) | (pbBuf[1] << 16) | (pbBuf[2] << 8) | pbBuf[3]; +} + + +DECLINLINE(void) ataLBA2MSF(uint8_t *pbBuf, uint32_t iATAPILBA) +{ + iATAPILBA += 150; + pbBuf[0] = (iATAPILBA / 75) / 60; + pbBuf[1] = (iATAPILBA / 75) % 60; + pbBuf[2] = iATAPILBA % 75; +} + + +DECLINLINE(uint32_t) ataMSF2LBA(const uint8_t *pbBuf) +{ + return (pbBuf[0] * 60 + pbBuf[1]) * 75 + pbBuf[2]; +} + + +static void ataCmdOK(AHCIATADevState *s, uint8_t status) +{ + s->uATARegError = 0; /* Not needed by ATA spec, but cannot hurt. */ + ataSetStatusValue(s, ATA_STAT_READY | status); +} + + +static void ataCmdError(AHCIATADevState *s, uint8_t uErrorCode) +{ + Log(("%s: code=%#x\n", __FUNCTION__, uErrorCode)); + s->uATARegError = uErrorCode; + ataSetStatusValue(s, ATA_STAT_READY | ATA_STAT_ERR); + s->cbTotalTransfer = 0; + s->cbElementaryTransfer = 0; + s->iIOBufferCur = 0; + s->iIOBufferEnd = 0; + s->uTxDir = PDMBLOCKTXDIR_NONE; + s->iBeginTransfer = ATAFN_BT_NULL; + s->iSourceSink = ATAFN_SS_NULL; +} + + +static bool ataIdentifySS(AHCIATADevState *s) +{ + uint16_t *p; + char aSerial[20]; + int rc; + RTUUID Uuid; + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer == 512); + rc = s->pDrvBlock ? s->pDrvBlock->pfnGetUuid(s->pDrvBlock, &Uuid) : RTUuidClear(&Uuid); + if (RT_FAILURE(rc) || RTUuidIsNull(&Uuid)) + { + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + /* Generate a predictable serial for drives which don't have a UUID. */ + RTStrPrintf(aSerial, sizeof(aSerial), "VB%x-%04x%04x", + s->iLUN + ATADEVSTATE_2_DEVINS(s)->iInstance * 32, + pCtl->IOPortBase1, pCtl->IOPortBase2); + } + else + RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]); + + p = (uint16_t *)s->CTXALLSUFF(pbIOBuffer); + memset(p, 0, 512); + p[0] = RT_H2LE_U16(0x0040); + p[1] = RT_H2LE_U16(RT_MIN(s->PCHSGeometry.cCylinders, 16383)); + p[3] = RT_H2LE_U16(s->PCHSGeometry.cHeads); + /* Block size; obsolete, but required for the BIOS. */ + p[5] = RT_H2LE_U16(512); + p[6] = RT_H2LE_U16(s->PCHSGeometry.cSectors); + ataPadString((uint8_t *)(p + 10), aSerial, 20); /* serial number */ + p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */ + p[21] = RT_H2LE_U16(512); /* XXX: retired, cache size in sectors */ + p[22] = RT_H2LE_U16(0); /* ECC bytes per sector */ + ataPadString((uint8_t *)(p + 23), "1.0", 8); /* firmware version */ + ataPadString((uint8_t *)(p + 27), "VBOX HARDDISK", 40); /* model */ +#if ATA_MAX_MULT_SECTORS > 1 + p[47] = RT_H2LE_U16(0x8000 | ATA_MAX_MULT_SECTORS); +#endif + p[48] = RT_H2LE_U16(1); /* dword I/O, used by the BIOS */ + p[49] = RT_H2LE_U16(1 << 11 | 1 << 9 | 1 << 8); /* DMA and LBA supported */ + p[50] = RT_H2LE_U16(1 << 14); /* No drive specific standby timer minimum */ + p[51] = RT_H2LE_U16(240); /* PIO transfer cycle */ + p[52] = RT_H2LE_U16(240); /* DMA transfer cycle */ + p[53] = RT_H2LE_U16(1 | 1 << 1 | 1 << 2); /* words 54-58,64-70,88 valid */ + p[54] = RT_H2LE_U16(RT_MIN(s->PCHSGeometry.cCylinders, 16383)); + p[55] = RT_H2LE_U16(s->PCHSGeometry.cHeads); + p[56] = RT_H2LE_U16(s->PCHSGeometry.cSectors); + p[57] = RT_H2LE_U16( RT_MIN(s->PCHSGeometry.cCylinders, 16383) + * s->PCHSGeometry.cHeads + * s->PCHSGeometry.cSectors); + p[58] = RT_H2LE_U16( RT_MIN(s->PCHSGeometry.cCylinders, 16383) + * s->PCHSGeometry.cHeads + * s->PCHSGeometry.cSectors >> 16); + if (s->cMultSectors) + p[59] = RT_H2LE_U16(0x100 | s->cMultSectors); + if (s->cTotalSectors <= (1 << 28) - 1) + { + p[60] = RT_H2LE_U16(s->cTotalSectors); + p[61] = RT_H2LE_U16(s->cTotalSectors >> 16); + } + else + { + /* Report maximum number of sectors possible with LBA28 */ + p[60] = RT_H2LE_U16(((1 << 28) - 1) & 0xffff); + p[61] = RT_H2LE_U16(((1 << 28) - 1) >> 16); + } + p[63] = RT_H2LE_U16(ATA_TRANSFER_ID(ATA_MODE_MDMA, ATA_MDMA_MODE_MAX, s->uATATransferMode)); /* MDMA modes supported / mode enabled */ + p[64] = RT_H2LE_U16(ATA_PIO_MODE_MAX > 2 ? (1 << (ATA_PIO_MODE_MAX - 2)) - 1 : 0); /* PIO modes beyond PIO2 supported */ + p[65] = RT_H2LE_U16(120); /* minimum DMA multiword tx cycle time */ + p[66] = RT_H2LE_U16(120); /* recommended DMA multiword tx cycle time */ + p[67] = RT_H2LE_U16(120); /* minimum PIO cycle time without flow control */ + p[68] = RT_H2LE_U16(120); /* minimum PIO cycle time with IORDY flow control */ + p[80] = RT_H2LE_U16(0x7e); /* support everything up to ATA/ATAPI-6 */ + p[81] = RT_H2LE_U16(0x22); /* conforms to ATA/ATAPI-6 */ + p[82] = RT_H2LE_U16(1 << 3 | 1 << 5 | 1 << 6); /* supports power management, write cache and look-ahead */ + if (s->cTotalSectors <= (1 << 28) - 1) + p[83] = RT_H2LE_U16(1 << 14 | 1 << 12); /* supports FLUSH CACHE */ + else + p[83] = RT_H2LE_U16(1 << 14 | 1 << 10 | 1 << 12 | 1 << 13); /* supports LBA48, FLUSH CACHE and FLUSH CACHE EXT */ + p[84] = RT_H2LE_U16(1 << 14); + p[85] = RT_H2LE_U16(1 << 3 | 1 << 5 | 1 << 6); /* enabled power management, write cache and look-ahead */ + if (s->cTotalSectors <= (1 << 28) - 1) + p[86] = RT_H2LE_U16(1 << 12); /* enabled FLUSH CACHE */ + else + p[86] = RT_H2LE_U16(1 << 10 | 1 << 12 | 1 << 13); /* enabled LBA48, FLUSH CACHE and FLUSH CACHE EXT */ + p[87] = RT_H2LE_U16(1 << 14); + p[88] = RT_H2LE_U16(ATA_TRANSFER_ID(ATA_MODE_UDMA, ATA_UDMA_MODE_MAX, s->uATATransferMode)); /* UDMA modes supported / mode enabled */ + p[93] = RT_H2LE_U16((1 | 1 << 1) << ((s->iLUN & 1) == 0 ? 0 : 8) | 1 << 13 | 1 << 14); + if (s->cTotalSectors > (1 << 28) - 1) + { + p[100] = RT_H2LE_U16(s->cTotalSectors); + p[101] = RT_H2LE_U16(s->cTotalSectors >> 16); + p[102] = RT_H2LE_U16(s->cTotalSectors >> 32); + p[103] = RT_H2LE_U16(s->cTotalSectors >> 48); + } + s->iSourceSink = ATAFN_SS_NULL; + ataCmdOK(s, ATA_STAT_SEEK); + return false; +} + + +static bool ataFlushSS(AHCIATADevState *s) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + int rc; + + Assert(s->uTxDir == PDMBLOCKTXDIR_NONE); + Assert(!s->cbElementaryTransfer); + + PDMCritSectLeave(&pCtl->lock); + + STAM_PROFILE_START(&s->StatFlushes, f); + rc = s->pDrvBlock->pfnFlush(s->pDrvBlock); + AssertRC(rc); + STAM_PROFILE_STOP(&s->StatFlushes, f); + + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + ataCmdOK(s, 0); + return false; +} + + +static bool atapiIdentifySS(AHCIATADevState *s) +{ + uint16_t *p; + char aSerial[20]; + RTUUID Uuid; + int rc; + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer == 512); + rc = s->pDrvBlock ? s->pDrvBlock->pfnGetUuid(s->pDrvBlock, &Uuid) : RTUuidClear(&Uuid); + if (RT_FAILURE(rc) || RTUuidIsNull(&Uuid)) + { + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + /* Generate a predictable serial for drives which don't have a UUID. */ + RTStrPrintf(aSerial, sizeof(aSerial), "VB%x-%04x%04x", + s->iLUN + ATADEVSTATE_2_DEVINS(s)->iInstance * 32, + pCtl->IOPortBase1, pCtl->IOPortBase2); + } + else + RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]); + + p = (uint16_t *)s->CTXALLSUFF(pbIOBuffer); + memset(p, 0, 512); + /* Removable CDROM, 50us response, 12 byte packets */ + p[0] = RT_H2LE_U16(2 << 14 | 5 << 8 | 1 << 7 | 2 << 5 | 0 << 0); + ataPadString((uint8_t *)(p + 10), aSerial, 20); /* serial number */ + p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */ + p[21] = RT_H2LE_U16(512); /* XXX: retired, cache size in sectors */ + ataPadString((uint8_t *)(p + 23), "1.0", 8); /* firmware version */ + ataPadString((uint8_t *)(p + 27), "VBOX CD-ROM", 40); /* model */ + p[49] = RT_H2LE_U16(1 << 11 | 1 << 9 | 1 << 8); /* DMA and LBA supported */ + p[50] = RT_H2LE_U16(1 << 14); /* No drive specific standby timer minimum */ + p[51] = RT_H2LE_U16(240); /* PIO transfer cycle */ + p[52] = RT_H2LE_U16(240); /* DMA transfer cycle */ + p[53] = RT_H2LE_U16(1 << 1 | 1 << 2); /* words 64-70,88 are valid */ + p[63] = RT_H2LE_U16(ATA_TRANSFER_ID(ATA_MODE_MDMA, ATA_MDMA_MODE_MAX, s->uATATransferMode)); /* MDMA modes supported / mode enabled */ + p[64] = RT_H2LE_U16(ATA_PIO_MODE_MAX > 2 ? (1 << (ATA_PIO_MODE_MAX - 2)) - 1 : 0); /* PIO modes beyond PIO2 supported */ + p[65] = RT_H2LE_U16(120); /* minimum DMA multiword tx cycle time */ + p[66] = RT_H2LE_U16(120); /* recommended DMA multiword tx cycle time */ + p[67] = RT_H2LE_U16(120); /* minimum PIO cycle time without flow control */ + p[68] = RT_H2LE_U16(120); /* minimum PIO cycle time with IORDY flow control */ + p[73] = RT_H2LE_U16(0x003e); /* ATAPI CDROM major */ + p[74] = RT_H2LE_U16(9); /* ATAPI CDROM minor */ + p[75] = RT_H2LE_U16(1); /* queue depth 1 */ + p[80] = RT_H2LE_U16(0x7e); /* support everything up to ATA/ATAPI-6 */ + p[81] = RT_H2LE_U16(0x22); /* conforms to ATA/ATAPI-6 */ + p[82] = RT_H2LE_U16(1 << 4 | 1 << 9); /* supports packet command set and DEVICE RESET */ + p[83] = RT_H2LE_U16(1 << 14); + p[84] = RT_H2LE_U16(1 << 14); + p[85] = RT_H2LE_U16(1 << 4 | 1 << 9); /* enabled packet command set and DEVICE RESET */ + p[86] = RT_H2LE_U16(0); + p[87] = RT_H2LE_U16(1 << 14); + p[88] = RT_H2LE_U16(ATA_TRANSFER_ID(ATA_MODE_UDMA, ATA_UDMA_MODE_MAX, s->uATATransferMode)); /* UDMA modes supported / mode enabled */ + p[93] = RT_H2LE_U16((1 | 1 << 1) << ((s->iLUN & 1) == 0 ? 0 : 8) | 1 << 13 | 1 << 14); + s->iSourceSink = ATAFN_SS_NULL; + ataCmdOK(s, ATA_STAT_SEEK); + return false; +} + + +static void ataSetSignature(AHCIATADevState *s) +{ + s->uATARegSelect &= 0xf0; /* clear head */ + /* put signature */ + s->uATARegNSector = 1; + s->uATARegSector = 1; + if (s->fATAPI) + { + s->uATARegLCyl = 0x14; + s->uATARegHCyl = 0xeb; + } + else if (s->pDrvBlock) + { + s->uATARegLCyl = 0; + s->uATARegHCyl = 0; + } + else + { + s->uATARegLCyl = 0xff; + s->uATARegHCyl = 0xff; + } +} + + +static uint64_t ataGetSector(AHCIATADevState *s) +{ + uint64_t iLBA; + if (s->uATARegSelect & 0x40) + { + /* any LBA variant */ + if (s->fLBA48) + { + /* LBA48 */ + iLBA = ((uint64_t)s->uATARegHCylHOB << 40) | + ((uint64_t)s->uATARegLCylHOB << 32) | + ((uint64_t)s->uATARegSectorHOB << 24) | + ((uint64_t)s->uATARegHCyl << 16) | + ((uint64_t)s->uATARegLCyl << 8) | + s->uATARegSector; + } + else + { + /* LBA */ + iLBA = ((s->uATARegSelect & 0x0f) << 24) | (s->uATARegHCyl << 16) | + (s->uATARegLCyl << 8) | s->uATARegSector; + } + } + else + { + /* CHS */ + iLBA = ((s->uATARegHCyl << 8) | s->uATARegLCyl) * s->PCHSGeometry.cHeads * s->PCHSGeometry.cSectors + + (s->uATARegSelect & 0x0f) * s->PCHSGeometry.cSectors + + (s->uATARegSector - 1); + } + return iLBA; +} + +static void ataSetSector(AHCIATADevState *s, uint64_t iLBA) +{ + uint32_t cyl, r; + if (s->uATARegSelect & 0x40) + { + /* any LBA variant */ + if (s->fLBA48) + { + /* LBA48 */ + s->uATARegHCylHOB = iLBA >> 40; + s->uATARegLCylHOB = iLBA >> 32; + s->uATARegSectorHOB = iLBA >> 24; + s->uATARegHCyl = iLBA >> 16; + s->uATARegLCyl = iLBA >> 8; + s->uATARegSector = iLBA; + } + else + { + /* LBA */ + s->uATARegSelect = (s->uATARegSelect & 0xf0) | (iLBA >> 24); + s->uATARegHCyl = (iLBA >> 16); + s->uATARegLCyl = (iLBA >> 8); + s->uATARegSector = (iLBA); + } + } + else + { + /* CHS */ + cyl = iLBA / (s->PCHSGeometry.cHeads * s->PCHSGeometry.cSectors); + r = iLBA % (s->PCHSGeometry.cHeads * s->PCHSGeometry.cSectors); + s->uATARegHCyl = cyl >> 8; + s->uATARegLCyl = cyl; + s->uATARegSelect = (s->uATARegSelect & 0xf0) | ((r / s->PCHSGeometry.cSectors) & 0x0f); + s->uATARegSector = (r % s->PCHSGeometry.cSectors) + 1; + } +} + + +static int ataReadSectors(AHCIATADevState *s, uint64_t u64Sector, void *pvBuf, uint32_t cSectors) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + int rc; + + PDMCritSectLeave(&pCtl->lock); + + STAM_PROFILE_ADV_START(&s->StatReads, r); + s->pLed->Asserted.s.fReading = s->pLed->Actual.s.fReading = 1; + rc = s->pDrvBlock->pfnRead(s->pDrvBlock, u64Sector * 512, pvBuf, cSectors * 512); + s->pLed->Actual.s.fReading = 0; + STAM_PROFILE_ADV_STOP(&s->StatReads, r); + + STAM_REL_COUNTER_ADD(s->pStatBytesRead, cSectors * 512); + + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + return rc; +} + + +static int ataWriteSectors(AHCIATADevState *s, uint64_t u64Sector, const void *pvBuf, uint32_t cSectors) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + int rc; + + PDMCritSectLeave(&pCtl->lock); + + STAM_PROFILE_ADV_START(&s->StatWrites, w); + s->pLed->Asserted.s.fWriting = s->pLed->Actual.s.fWriting = 1; + rc = s->pDrvBlock->pfnWrite(s->pDrvBlock, u64Sector * 512, pvBuf, cSectors * 512); + s->pLed->Actual.s.fWriting = 0; + STAM_PROFILE_ADV_STOP(&s->StatWrites, w); + + STAM_REL_COUNTER_ADD(s->pStatBytesWritten, cSectors * 512); + + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + return rc; +} + + +static void ataReadWriteSectorsBT(AHCIATADevState *s) +{ + uint32_t cSectors; + + cSectors = s->cbTotalTransfer / 512; + if (cSectors > s->cSectorsPerIRQ) + s->cbElementaryTransfer = s->cSectorsPerIRQ * 512; + else + s->cbElementaryTransfer = cSectors * 512; + if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE) + ataCmdOK(s, 0); +} + + +static void ataWarningDiskFull(PPDMDEVINS pDevIns) +{ + int rc; + LogRel(("ATA: Host disk full\n")); + rc = PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "DevATA_DISKFULL", + N_("Host system reported disk full. VM execution is suspended. You can resume after freeing some space")); + AssertRC(rc); +} + + +static void ataWarningFileTooBig(PPDMDEVINS pDevIns) +{ + int rc; + LogRel(("ATA: File too big\n")); + rc = PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "DevATA_FILETOOBIG", + N_("Host system reported that the file size limit of the host file system has been exceeded. VM execution is suspended. You need to move your virtual hard disk to a filesystem which allows bigger files")); + AssertRC(rc); +} + + +static void ataWarningISCSI(PPDMDEVINS pDevIns) +{ + int rc; + LogRel(("ATA: iSCSI target unavailable\n")); + rc = PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "DevATA_ISCSIDOWN", + N_("The iSCSI target has stopped responding. VM execution is suspended. You can resume when it is available again")); + AssertRC(rc); +} + + +static bool ataReadSectorsSS(AHCIATADevState *s) +{ + int rc; + uint32_t cSectors; + uint64_t iLBA; + + cSectors = s->cbElementaryTransfer / 512; + Assert(cSectors); + iLBA = ataGetSector(s); + Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA)); + rc = ataReadSectors(s, iLBA, s->CTXALLSUFF(pbIOBuffer), cSectors); + if (RT_SUCCESS(rc)) + { + ataSetSector(s, iLBA + cSectors); + if (s->cbElementaryTransfer == s->cbTotalTransfer) + s->iSourceSink = ATAFN_SS_NULL; + ataCmdOK(s, ATA_STAT_SEEK); + } + else + { + if (rc == VERR_DISK_FULL) + { + ataWarningDiskFull(ATADEVSTATE_2_DEVINS(s)); + return true; + } + if (rc == VERR_FILE_TOO_BIG) + { + ataWarningFileTooBig(ATADEVSTATE_2_DEVINS(s)); + return true; + } + if (rc == VERR_BROKEN_PIPE || rc == VERR_NET_CONNECTION_REFUSED) + { + /* iSCSI connection abort (first error) or failure to reestablish + * connection (second error). Pause VM. On resume we'll retry. */ + ataWarningISCSI(ATADEVSTATE_2_DEVINS(s)); + return true; + } + if (s->cErrors++ < MAX_LOG_REL_ERRORS) + LogRel(("AHCI ATA: LUN#%d: disk read error (rc=%Rrc iSector=%#RX64 cSectors=%#RX32)\n", + s->iLUN, rc, iLBA, cSectors)); + ataCmdError(s, ID_ERR); + } + /** @todo implement redo for iSCSI */ + return false; +} + + +static bool ataWriteSectorsSS(AHCIATADevState *s) +{ + int rc; + uint32_t cSectors; + uint64_t iLBA; + + cSectors = s->cbElementaryTransfer / 512; + Assert(cSectors); + iLBA = ataGetSector(s); + Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA)); + rc = ataWriteSectors(s, iLBA, s->CTXALLSUFF(pbIOBuffer), cSectors); + if (RT_SUCCESS(rc)) + { + ataSetSector(s, iLBA + cSectors); + if (!s->cbTotalTransfer) + s->iSourceSink = ATAFN_SS_NULL; + ataCmdOK(s, ATA_STAT_SEEK); + } + else + { + if (rc == VERR_DISK_FULL) + { + ataWarningDiskFull(ATADEVSTATE_2_DEVINS(s)); + return true; + } + if (rc == VERR_FILE_TOO_BIG) + { + ataWarningFileTooBig(ATADEVSTATE_2_DEVINS(s)); + return true; + } + if (rc == VERR_BROKEN_PIPE || rc == VERR_NET_CONNECTION_REFUSED) + { + /* iSCSI connection abort (first error) or failure to reestablish + * connection (second error). Pause VM. On resume we'll retry. */ + ataWarningISCSI(ATADEVSTATE_2_DEVINS(s)); + return true; + } + if (s->cErrors++ < MAX_LOG_REL_ERRORS) + LogRel(("AHCI ATA: LUN#%d: disk write error (rc=%Rrc iSector=%#RX64 cSectors=%#RX32)\n", + s->iLUN, rc, iLBA, cSectors)); + ataCmdError(s, ID_ERR); + } + /** @todo implement redo for iSCSI */ + return false; +} + + +static void atapiCmdOK(AHCIATADevState *s) +{ + s->uATARegError = 0; + ataSetStatusValue(s, ATA_STAT_READY); + s->uATARegNSector = (s->uATARegNSector & ~7) + | ((s->uTxDir != PDMBLOCKTXDIR_TO_DEVICE) ? ATAPI_INT_REASON_IO : 0) + | (!s->cbTotalTransfer ? ATAPI_INT_REASON_CD : 0); + Log2(("%s: interrupt reason %#04x\n", __FUNCTION__, s->uATARegNSector)); + memset(s->abATAPISense, '\0', sizeof(s->abATAPISense)); + s->abATAPISense[0] = 0x70 | (1 << 7); + s->abATAPISense[7] = 10; +} + + +static void atapiCmdError(AHCIATADevState *s, const uint8_t *pabATAPISense, size_t cbATAPISense) +{ + Log(("%s: sense=%#x (%s) asc=%#x ascq=%#x (%s)\n", __FUNCTION__, pabATAPISense[2] & 0x0f, SCSISenseText(pabATAPISense[2] & 0x0f), + pabATAPISense[12], pabATAPISense[13], SCSISenseExtText(pabATAPISense[12], pabATAPISense[13]))); + s->uATARegError = pabATAPISense[2] << 4; + ataSetStatusValue(s, ATA_STAT_READY | ATA_STAT_ERR); + s->uATARegNSector = (s->uATARegNSector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; + Log2(("%s: interrupt reason %#04x\n", __FUNCTION__, s->uATARegNSector)); + memset(s->abATAPISense, '\0', sizeof(s->abATAPISense)); + memcpy(s->abATAPISense, pabATAPISense, RT_MIN(cbATAPISense, sizeof(s->abATAPISense))); + s->cbTotalTransfer = 0; + s->cbElementaryTransfer = 0; + s->iIOBufferCur = 0; + s->iIOBufferEnd = 0; + s->uTxDir = PDMBLOCKTXDIR_NONE; + s->iBeginTransfer = ATAFN_BT_NULL; + s->iSourceSink = ATAFN_SS_NULL; +} + + +/** @todo deprecated function - doesn't provide enough info. Replace by direct + * calls to atapiCmdError() with full data. */ +static void atapiCmdErrorSimple(AHCIATADevState *s, uint8_t uATAPISenseKey, uint8_t uATAPIASC) +{ + uint8_t abATAPISense[ATAPI_SENSE_SIZE]; + memset(abATAPISense, '\0', sizeof(abATAPISense)); + abATAPISense[0] = 0x70 | (1 << 7); + abATAPISense[2] = uATAPISenseKey & 0x0f; + abATAPISense[7] = 10; + abATAPISense[12] = uATAPIASC; + atapiCmdError(s, abATAPISense, sizeof(abATAPISense)); +} + + +static void atapiCmdBT(AHCIATADevState *s) +{ + s->fATAPITransfer = true; + s->cbElementaryTransfer = s->cbTotalTransfer; + if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE) + atapiCmdOK(s); +} + + +static void atapiPassthroughCmdBT(AHCIATADevState *s) +{ + /* @todo implement an algorithm for correctly determining the read and + * write sector size without sending additional commands to the drive. + * This should be doable by saving processing the configuration requests + * and replies. */ +#if 0 + if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE) + { + uint8_t cmd = s->aATAPICmd[0]; + if (cmd == SCSI_WRITE_10 || cmd == SCSI_WRITE_12 || cmd == SCSI_WRITE_AND_VERIFY_10) + { + uint8_t aModeSenseCmd[10]; + uint8_t aModeSenseResult[16]; + uint8_t uDummySense; + uint32_t cbTransfer; + int rc; + + cbTransfer = sizeof(aModeSenseResult); + aModeSenseCmd[0] = SCSI_MODE_SENSE_10; + aModeSenseCmd[1] = 0x08; /* disable block descriptor = 1 */ + aModeSenseCmd[2] = (SCSI_PAGECONTROL_CURRENT << 6) | SCSI_MODEPAGE_WRITE_PARAMETER; + aModeSenseCmd[3] = 0; /* subpage code */ + aModeSenseCmd[4] = 0; /* reserved */ + aModeSenseCmd[5] = 0; /* reserved */ + aModeSenseCmd[6] = 0; /* reserved */ + aModeSenseCmd[7] = cbTransfer >> 8; + aModeSenseCmd[8] = cbTransfer & 0xff; + aModeSenseCmd[9] = 0; /* control */ + rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, aModeSenseCmd, PDMBLOCKTXDIR_FROM_DEVICE, aModeSenseResult, &cbTransfer, &uDummySense, 500); + if (RT_FAILURE(rc)) + { + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_NONE); + return; + } + /* Select sector size based on the current data block type. */ + switch (aModeSenseResult[12] & 0x0f) + { + case 0: + s->cbATAPISector = 2352; + break; + case 1: + s->cbATAPISector = 2368; + break; + case 2: + case 3: + s->cbATAPISector = 2448; + break; + case 8: + case 10: + s->cbATAPISector = 2048; + break; + case 9: + s->cbATAPISector = 2336; + break; + case 11: + s->cbATAPISector = 2056; + break; + case 12: + s->cbATAPISector = 2324; + break; + case 13: + s->cbATAPISector = 2332; + break; + default: + s->cbATAPISector = 0; + } + Log2(("%s: sector size %d\n", __FUNCTION__, s->cbATAPISector)); + s->cbTotalTransfer *= s->cbATAPISector; + if (s->cbTotalTransfer == 0) + s->uTxDir = PDMBLOCKTXDIR_NONE; + } + } +#endif + atapiCmdBT(s); +} + + +static bool atapiReadSS(AHCIATADevState *s) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + int rc = VINF_SUCCESS; + uint32_t cbTransfer, cSectors; + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + cbTransfer = RT_MIN(s->cbTotalTransfer, s->cbIOBuffer); + cSectors = cbTransfer / s->cbATAPISector; + Assert(cSectors * s->cbATAPISector <= cbTransfer); + Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, s->iATAPILBA)); + + PDMCritSectLeave(&pCtl->lock); + + STAM_PROFILE_ADV_START(&s->StatReads, r); + s->pLed->Asserted.s.fReading = s->pLed->Actual.s.fReading = 1; + switch (s->cbATAPISector) + { + case 2048: + rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)s->iATAPILBA * s->cbATAPISector, s->CTXALLSUFF(pbIOBuffer), s->cbATAPISector * cSectors); + break; + case 2352: + { + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++) + { + /* sync bytes */ + *pbBuf++ = 0x00; + memset(pbBuf, 0xff, 11); + pbBuf += 11; + /* MSF */ + ataLBA2MSF(pbBuf, i); + pbBuf += 3; + *pbBuf++ = 0x01; /* mode 1 data */ + /* data */ + rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)i * 2048, pbBuf, 2048); + if (RT_FAILURE(rc)) + break; + pbBuf += 2048; + /* ECC */ + memset(pbBuf, 0, 288); + pbBuf += 288; + } + } + break; + default: + break; + } + STAM_PROFILE_ADV_STOP(&s->StatReads, r); + + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + + if (RT_SUCCESS(rc)) + { + s->pLed->Actual.s.fReading = 0; + STAM_REL_COUNTER_ADD(s->pStatBytesRead, s->cbATAPISector * cSectors); + + /* The initial buffer end value has been set up based on the total + * transfer size. But the I/O buffer size limits what can actually be + * done in one transfer, so set the actual value of the buffer end. */ + s->cbElementaryTransfer = cbTransfer; + if (cbTransfer >= s->cbTotalTransfer) + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + s->iATAPILBA += cSectors; + } + else + { + if (s->cErrors++ < MAX_LOG_REL_ERRORS) + LogRel(("AHCI ATA: LUN#%d: CD-ROM read error, %d sectors at LBA %d\n", s->iLUN, cSectors, s->iATAPILBA)); + atapiCmdErrorSimple(s, SCSI_SENSE_MEDIUM_ERROR, SCSI_ASC_READ_ERROR); + } + return false; +} + + +static bool atapiPassthroughSS(AHCIATADevState *s) +{ + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + int rc = VINF_SUCCESS; + uint8_t abATAPISense[ATAPI_SENSE_SIZE]; + uint32_t cbTransfer; + PSTAMPROFILEADV pProf = NULL; + + cbTransfer = s->cbElementaryTransfer; + + if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE) + Log3(("ATAPI PT data write (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->CTXALLSUFF(pbIOBuffer))); + + /* Simple heuristics: if there is at least one sector of data + * to transfer, it's worth updating the LEDs. */ + if (cbTransfer >= 2048) + { + if (s->uTxDir != PDMBLOCKTXDIR_TO_DEVICE) + { + s->pLed->Asserted.s.fReading = s->pLed->Actual.s.fReading = 1; + pProf = &s->StatReads; + } + else + { + s->pLed->Asserted.s.fWriting = s->pLed->Actual.s.fWriting = 1; + pProf = &s->StatWrites; + } + } + + PDMCritSectLeave(&pCtl->lock); + + memset(abATAPISense, '\0', sizeof(abATAPISense)); + if (pProf) { STAM_PROFILE_ADV_START(pProf, b); } + if (cbTransfer > 100 * _1K) + { + /* Linux accepts commands with up to 100KB of data, but expects + * us to handle commands with up to 128KB of data. The usual + * imbalance of powers. */ + uint8_t aATAPICmd[ATAPI_PACKET_SIZE]; + uint32_t iATAPILBA, cSectors, cReqSectors, cbCurrTX; + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + switch (s->aATAPICmd[0]) + { + case SCSI_READ_10: + case SCSI_WRITE_10: + case SCSI_WRITE_AND_VERIFY_10: + iATAPILBA = ataBE2H_U32(s->aATAPICmd + 2); + cSectors = ataBE2H_U16(s->aATAPICmd + 7); + break; + case SCSI_READ_12: + case SCSI_WRITE_12: + iATAPILBA = ataBE2H_U32(s->aATAPICmd + 2); + cSectors = ataBE2H_U32(s->aATAPICmd + 6); + break; + case SCSI_READ_CD: + iATAPILBA = ataBE2H_U32(s->aATAPICmd + 2); + cSectors = ataBE2H_U24(s->aATAPICmd + 6) / s->cbATAPISector; + break; + case SCSI_READ_CD_MSF: + iATAPILBA = ataMSF2LBA(s->aATAPICmd + 3); + cSectors = ataMSF2LBA(s->aATAPICmd + 6) - iATAPILBA; + break; + default: + AssertMsgFailed(("Don't know how to split command %#04x\n", s->aATAPICmd[0])); + if (s->cErrors++ < MAX_LOG_REL_ERRORS) + LogRel(("AHCI ATA: LUN#%d: CD-ROM passthrough split error\n", s->iLUN)); + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE); + { + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + } + return false; + } + memcpy(aATAPICmd, s->aATAPICmd, ATAPI_PACKET_SIZE); + cReqSectors = 0; + for (uint32_t i = cSectors; i > 0; i -= cReqSectors) + { + if (i * s->cbATAPISector > 100 * _1K) + cReqSectors = (100 * _1K) / s->cbATAPISector; + else + cReqSectors = i; + cbCurrTX = s->cbATAPISector * cReqSectors; + switch (s->aATAPICmd[0]) + { + case SCSI_READ_10: + case SCSI_WRITE_10: + case SCSI_WRITE_AND_VERIFY_10: + ataH2BE_U32(aATAPICmd + 2, iATAPILBA); + ataH2BE_U16(aATAPICmd + 7, cReqSectors); + break; + case SCSI_READ_12: + case SCSI_WRITE_12: + ataH2BE_U32(aATAPICmd + 2, iATAPILBA); + ataH2BE_U32(aATAPICmd + 6, cReqSectors); + break; + case SCSI_READ_CD: + ataH2BE_U32(s->aATAPICmd + 2, iATAPILBA); + ataH2BE_U24(s->aATAPICmd + 6, cbCurrTX); + break; + case SCSI_READ_CD_MSF: + ataLBA2MSF(aATAPICmd + 3, iATAPILBA); + ataLBA2MSF(aATAPICmd + 6, iATAPILBA + cReqSectors); + break; + } + rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, aATAPICmd, (PDMBLOCKTXDIR)s->uTxDir, pbBuf, &cbCurrTX, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */); + if (rc != VINF_SUCCESS) + break; + iATAPILBA += cReqSectors; + pbBuf += s->cbATAPISector * cReqSectors; + } + } + else + rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, s->aATAPICmd, (PDMBLOCKTXDIR)s->uTxDir, s->CTXALLSUFF(pbIOBuffer), &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */); + if (pProf) { STAM_PROFILE_ADV_STOP(pProf, b); } + + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + + /* Update the LEDs and the read/write statistics. */ + if (cbTransfer >= 2048) + { + if (s->uTxDir != PDMBLOCKTXDIR_TO_DEVICE) + { + s->pLed->Actual.s.fReading = 0; + STAM_REL_COUNTER_ADD(s->pStatBytesRead, cbTransfer); + } + else + { + s->pLed->Actual.s.fWriting = 0; + STAM_REL_COUNTER_ADD(s->pStatBytesWritten, cbTransfer); + } + } + + if (RT_SUCCESS(rc)) + { + if (s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE) + { + Assert(cbTransfer <= s->cbTotalTransfer); + /* Reply with the same amount of data as the real drive. */ + s->cbTotalTransfer = cbTransfer; + /* The initial buffer end value has been set up based on the total + * transfer size. But the I/O buffer size limits what can actually be + * done in one transfer, so set the actual value of the buffer end. */ + s->cbElementaryTransfer = cbTransfer; + if (s->aATAPICmd[0] == SCSI_INQUIRY) + { + /* Make sure that the real drive cannot be identified. + * Motivation: changing the VM configuration should be as + * invisible as possible to the guest. */ + Log3(("ATAPI PT inquiry data before (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->CTXALLSUFF(pbIOBuffer))); + ataSCSIPadStr(s->CTXALLSUFF(pbIOBuffer) + 8, "VBOX", 8); + ataSCSIPadStr(s->CTXALLSUFF(pbIOBuffer) + 16, "CD-ROM", 16); + ataSCSIPadStr(s->CTXALLSUFF(pbIOBuffer) + 32, "1.0", 4); + } + if (cbTransfer) + Log3(("ATAPI PT data read (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->CTXALLSUFF(pbIOBuffer))); + } + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + } + else + { + if (s->cErrors++ < MAX_LOG_REL_ERRORS) + { + uint8_t u8Cmd = s->aATAPICmd[0]; + do + { + /* don't log superflous errors */ + if ( rc == VERR_DEV_IO_ERROR + && ( u8Cmd == SCSI_TEST_UNIT_READY + || u8Cmd == SCSI_READ_CAPACITY + || u8Cmd == SCSI_READ_TOC_PMA_ATIP)) + break; + LogRel(("AHCI ATA: LUN#%d: CD-ROM passthrough command (%#04x) error %d %Rrc\n", s->iLUN, u8Cmd, abATAPISense[0] & 0x0f, rc)); + } while (0); + } + atapiCmdError(s, abATAPISense, sizeof(abATAPISense)); + } + return false; +} + + +static bool atapiReadSectors(AHCIATADevState *s, uint32_t iATAPILBA, uint32_t cSectors, uint32_t cbSector) +{ + Assert(cSectors > 0); + s->iATAPILBA = iATAPILBA; + s->cbATAPISector = cbSector; + ataStartTransfer(s, cSectors * cbSector, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ, true); + return false; +} + + +static bool atapiReadCapacitySS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 8); + ataH2BE_U32(pbBuf, s->cTotalSectors - 1); + ataH2BE_U32(pbBuf + 4, 2048); + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiReadDiscInformationSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 34); + memset(pbBuf, '\0', 34); + ataH2BE_U16(pbBuf, 32); + pbBuf[2] = (0 << 4) | (3 << 2) | (2 << 0); /* not erasable, complete session, complete disc */ + pbBuf[3] = 1; /* number of first track */ + pbBuf[4] = 1; /* number of sessions (LSB) */ + pbBuf[5] = 1; /* first track number in last session (LSB) */ + pbBuf[6] = 1; /* last track number in last session (LSB) */ + pbBuf[7] = (0 << 7) | (0 << 6) | (1 << 5) | (0 << 2) | (0 << 0); /* disc id not valid, disc bar code not valid, unrestricted use, not dirty, not RW medium */ + pbBuf[8] = 0; /* disc type = CD-ROM */ + pbBuf[9] = 0; /* number of sessions (MSB) */ + pbBuf[10] = 0; /* number of sessions (MSB) */ + pbBuf[11] = 0; /* number of sessions (MSB) */ + ataH2BE_U32(pbBuf + 16, 0x00ffffff); /* last session lead-in start time is not available */ + ataH2BE_U32(pbBuf + 20, 0x00ffffff); /* last possible start time for lead-out is not available */ + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiReadTrackInformationSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 36); + /* Accept address/number type of 1 only, and only track 1 exists. */ + if ((s->aATAPICmd[1] & 0x03) != 1 || ataBE2H_U32(&s->aATAPICmd[2]) != 1) + { + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + return false; + } + memset(pbBuf, '\0', 36); + ataH2BE_U16(pbBuf, 34); + pbBuf[2] = 1; /* track number (LSB) */ + pbBuf[3] = 1; /* session number (LSB) */ + pbBuf[5] = (0 << 5) | (0 << 4) | (4 << 0); /* not damaged, primary copy, data track */ + pbBuf[6] = (0 << 7) | (0 << 6) | (0 << 5) | (0 << 6) | (1 << 0); /* not reserved track, not blank, not packet writing, not fixed packet, data mode 1 */ + pbBuf[7] = (0 << 1) | (0 << 0); /* last recorded address not valid, next recordable address not valid */ + ataH2BE_U32(pbBuf + 8, 0); /* track start address is 0 */ + ataH2BE_U32(pbBuf + 24, s->cTotalSectors); /* track size */ + pbBuf[32] = 0; /* track number (MSB) */ + pbBuf[33] = 0; /* session number (MSB) */ + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiGetConfigurationSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + uint16_t u16Sfn = ataBE2H_U16(&s->aATAPICmd[2]); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 32); + /* Accept valid request types only, and only starting feature 0. */ + if ((s->aATAPICmd[1] & 0x03) == 3 || u16Sfn != 0) + { + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + return false; + } + memset(pbBuf, '\0', 32); + ataH2BE_U32(pbBuf, 16); + /** @todo implement switching between CD-ROM and DVD-ROM profile (the only + * way to differentiate them right now is based on the image size). Also + * implement signalling "no current profile" if no medium is loaded. */ + ataH2BE_U16(pbBuf + 6, 0x08); /* current profile: read-only CD */ + + ataH2BE_U16(pbBuf + 8, 0); /* feature 0: list of profiles supported */ + pbBuf[10] = (0 << 2) | (1 << 1) | (1 || 0); /* version 0, persistent, current */ + pbBuf[11] = 8; /* additional bytes for profiles */ + /* The MMC-3 spec says that DVD-ROM read capability should be reported + * before CD-ROM read capability. */ + ataH2BE_U16(pbBuf + 12, 0x10); /* profile: read-only DVD */ + pbBuf[14] = (0 << 0); /* NOT current profile */ + ataH2BE_U16(pbBuf + 16, 0x08); /* profile: read only CD */ + pbBuf[18] = (1 << 0); /* current profile */ + /* Other profiles we might want to add in the future: 0x40 (BD-ROM) and 0x50 (HDDVD-ROM) */ + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiGetEventStatusNotificationSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 8); + + if (!(s->aATAPICmd[1] & 1)) + { + /* no asynchronous operation supported */ + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + return false; + } + + uint32_t OldStatus, NewStatus; + do + { + OldStatus = ASMAtomicReadU32(&s->MediaEventStatus); + NewStatus = ATA_EVENT_STATUS_UNCHANGED; + switch (OldStatus) + { + case ATA_EVENT_STATUS_MEDIA_NEW: + /* mount */ + ataH2BE_U16(pbBuf + 0, 6); + pbBuf[2] = 0x04; + pbBuf[3] = 0x5e; + pbBuf[4] = 0x02; + pbBuf[5] = 0x02; + pbBuf[6] = 0x00; + pbBuf[7] = 0x00; + break; + + case ATA_EVENT_STATUS_MEDIA_CHANGED: + case ATA_EVENT_STATUS_MEDIA_REMOVED: + /* umount */ + ataH2BE_U16(pbBuf + 0, 6); + pbBuf[2] = 0x04; + pbBuf[3] = 0x5e; + pbBuf[4] = 0x03; + pbBuf[5] = 0x00; + pbBuf[6] = 0x00; + pbBuf[7] = 0x00; + if (OldStatus == ATA_EVENT_STATUS_MEDIA_CHANGED) + NewStatus = ATA_EVENT_STATUS_MEDIA_NEW; + break; + + case ATA_EVENT_STATUS_UNCHANGED: + default: + ataH2BE_U16(pbBuf + 0, 6); + pbBuf[2] = 0x01; + pbBuf[3] = 0x5e; + pbBuf[4] = 0x00; + pbBuf[5] = 0x00; + pbBuf[6] = 0x00; + pbBuf[7] = 0x00; + break; + } + } while (!ASMAtomicCmpXchgU32(&s->MediaEventStatus, NewStatus, OldStatus)); + + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiInquirySS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 36); + pbBuf[0] = 0x05; /* CD-ROM */ + pbBuf[1] = 0x80; /* removable */ +#if 1/*ndef VBOX*/ /** @todo implement MESN + AENC. (async notification on removal and stuff.) */ + pbBuf[2] = 0x00; /* ISO */ + pbBuf[3] = 0x21; /* ATAPI-2 (XXX: put ATAPI-4 ?) */ +#else + pbBuf[2] = 0x00; /* ISO */ + pbBuf[3] = 0x91; /* format 1, MESN=1, AENC=9 ??? */ +#endif + pbBuf[4] = 31; /* additional length */ + pbBuf[5] = 0; /* reserved */ + pbBuf[6] = 0; /* reserved */ + pbBuf[7] = 0; /* reserved */ + ataSCSIPadStr(pbBuf + 8, "VBOX", 8); + ataSCSIPadStr(pbBuf + 16, "CD-ROM", 16); + ataSCSIPadStr(pbBuf + 32, "1.0", 4); + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiModeSenseErrorRecoverySS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 16); + ataH2BE_U16(&pbBuf[0], 16 + 6); + pbBuf[2] = 0x70; + pbBuf[3] = 0; + pbBuf[4] = 0; + pbBuf[5] = 0; + pbBuf[6] = 0; + pbBuf[7] = 0; + + pbBuf[8] = 0x01; + pbBuf[9] = 0x06; + pbBuf[10] = 0x00; + pbBuf[11] = 0x05; + pbBuf[12] = 0x00; + pbBuf[13] = 0x00; + pbBuf[14] = 0x00; + pbBuf[15] = 0x00; + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiModeSenseCDStatusSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 40); + ataH2BE_U16(&pbBuf[0], 38); + pbBuf[2] = 0x70; + pbBuf[3] = 0; + pbBuf[4] = 0; + pbBuf[5] = 0; + pbBuf[6] = 0; + pbBuf[7] = 0; + + pbBuf[8] = 0x2a; + pbBuf[9] = 30; /* page length */ + pbBuf[10] = 0x08; /* DVD-ROM read support */ + pbBuf[11] = 0x00; /* no write support */ + /* The following claims we support audio play. This is obviously false, + * but the Linux generic CDROM support makes many features depend on this + * capability. If it's not set, this causes many things to be disabled. */ + pbBuf[12] = 0x71; /* multisession support, mode 2 form 1/2 support, audio play */ + pbBuf[13] = 0x00; /* no subchannel reads supported */ + pbBuf[14] = (1 << 0) | (1 << 3) | (1 << 5); /* lock supported, eject supported, tray type loading mechanism */ + if (s->pDrvMount->pfnIsLocked(s->pDrvMount)) + pbBuf[14] |= 1 << 1; /* report lock state */ + pbBuf[15] = 0; /* no subchannel reads supported, no separate audio volume control, no changer etc. */ + ataH2BE_U16(&pbBuf[16], 5632); /* (obsolete) claim 32x speed support */ + ataH2BE_U16(&pbBuf[18], 2); /* number of audio volume levels */ + ataH2BE_U16(&pbBuf[20], s->cbIOBuffer / _1K); /* buffer size supported in Kbyte */ + ataH2BE_U16(&pbBuf[22], 5632); /* (obsolete) current read speed 32x */ + pbBuf[24] = 0; /* reserved */ + pbBuf[25] = 0; /* reserved for digital audio (see idx 15) */ + ataH2BE_U16(&pbBuf[26], 0); /* (obsolete) maximum write speed */ + ataH2BE_U16(&pbBuf[28], 0); /* (obsolete) current write speed */ + ataH2BE_U16(&pbBuf[30], 0); /* copy management revision supported 0=no CSS */ + pbBuf[32] = 0; /* reserved */ + pbBuf[33] = 0; /* reserved */ + pbBuf[34] = 0; /* reserved */ + pbBuf[35] = 1; /* rotation control CAV */ + ataH2BE_U16(&pbBuf[36], 0); /* current write speed */ + ataH2BE_U16(&pbBuf[38], 0); /* number of write speed performance descriptors */ + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiRequestSenseSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + memset(pbBuf, '\0', s->cbElementaryTransfer); + memcpy(pbBuf, s->abATAPISense, RT_MIN(s->cbElementaryTransfer, sizeof(s->abATAPISense))); + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiMechanismStatusSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 8); + ataH2BE_U16(pbBuf, 0); + /* no current LBA */ + pbBuf[2] = 0; + pbBuf[3] = 0; + pbBuf[4] = 0; + pbBuf[5] = 1; + ataH2BE_U16(pbBuf + 6, 0); + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiReadTOCNormalSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer), *q, iStartTrack; + bool fMSF; + uint32_t cbSize; + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + fMSF = (s->aATAPICmd[1] >> 1) & 1; + iStartTrack = s->aATAPICmd[6]; + if (iStartTrack > 1 && iStartTrack != 0xaa) + { + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + return false; + } + q = pbBuf + 2; + *q++ = 1; /* first session */ + *q++ = 1; /* last session */ + if (iStartTrack <= 1) + { + *q++ = 0; /* reserved */ + *q++ = 0x14; /* ADR, control */ + *q++ = 1; /* track number */ + *q++ = 0; /* reserved */ + if (fMSF) + { + *q++ = 0; /* reserved */ + ataLBA2MSF(q, 0); + q += 3; + } + else + { + /* sector 0 */ + ataH2BE_U32(q, 0); + q += 4; + } + } + /* lead out track */ + *q++ = 0; /* reserved */ + *q++ = 0x14; /* ADR, control */ + *q++ = 0xaa; /* track number */ + *q++ = 0; /* reserved */ + if (fMSF) + { + *q++ = 0; /* reserved */ + ataLBA2MSF(q, s->cTotalSectors); + q += 3; + } + else + { + ataH2BE_U32(q, s->cTotalSectors); + q += 4; + } + cbSize = q - pbBuf; + ataH2BE_U16(pbBuf, cbSize - 2); + if (cbSize < s->cbTotalTransfer) + s->cbTotalTransfer = cbSize; + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiReadTOCMultiSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); + bool fMSF; + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + Assert(s->cbElementaryTransfer <= 12); + fMSF = (s->aATAPICmd[1] >> 1) & 1; + /* multi session: only a single session defined */ +/** @todo double-check this stuff against what a real drive says for a CD-ROM (not a CD-R) with only a single data session. Maybe solve the problem with "cdrdao read-toc" not being able to figure out whether numbers are in BCD or hex. */ + memset(pbBuf, 0, 12); + pbBuf[1] = 0x0a; + pbBuf[2] = 0x01; + pbBuf[3] = 0x01; + pbBuf[5] = 0x14; /* ADR, control */ + pbBuf[6] = 1; /* first track in last complete session */ + if (fMSF) + { + pbBuf[8] = 0; /* reserved */ + ataLBA2MSF(&pbBuf[9], 0); + } + else + { + /* sector 0 */ + ataH2BE_U32(pbBuf + 8, 0); + } + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static bool atapiReadTOCRawSS(AHCIATADevState *s) +{ + uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer), *q, iStartTrack; + bool fMSF; + uint32_t cbSize; + + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + fMSF = (s->aATAPICmd[1] >> 1) & 1; + iStartTrack = s->aATAPICmd[6]; + + q = pbBuf + 2; + *q++ = 1; /* first session */ + *q++ = 1; /* last session */ + + *q++ = 1; /* session number */ + *q++ = 0x14; /* data track */ + *q++ = 0; /* track number */ + *q++ = 0xa0; /* first track in program area */ + *q++ = 0; /* min */ + *q++ = 0; /* sec */ + *q++ = 0; /* frame */ + *q++ = 0; + *q++ = 1; /* first track */ + *q++ = 0x00; /* disk type CD-DA or CD data */ + *q++ = 0; + + *q++ = 1; /* session number */ + *q++ = 0x14; /* data track */ + *q++ = 0; /* track number */ + *q++ = 0xa1; /* last track in program area */ + *q++ = 0; /* min */ + *q++ = 0; /* sec */ + *q++ = 0; /* frame */ + *q++ = 0; + *q++ = 1; /* last track */ + *q++ = 0; + *q++ = 0; + + *q++ = 1; /* session number */ + *q++ = 0x14; /* data track */ + *q++ = 0; /* track number */ + *q++ = 0xa2; /* lead-out */ + *q++ = 0; /* min */ + *q++ = 0; /* sec */ + *q++ = 0; /* frame */ + if (fMSF) + { + *q++ = 0; /* reserved */ + ataLBA2MSF(q, s->cTotalSectors); + q += 3; + } + else + { + ataH2BE_U32(q, s->cTotalSectors); + q += 4; + } + + *q++ = 1; /* session number */ + *q++ = 0x14; /* ADR, control */ + *q++ = 0; /* track number */ + *q++ = 1; /* point */ + *q++ = 0; /* min */ + *q++ = 0; /* sec */ + *q++ = 0; /* frame */ + if (fMSF) + { + *q++ = 0; /* reserved */ + ataLBA2MSF(q, 0); + q += 3; + } + else + { + /* sector 0 */ + ataH2BE_U32(q, 0); + q += 4; + } + + cbSize = q - pbBuf; + ataH2BE_U16(pbBuf, cbSize - 2); + if (cbSize < s->cbTotalTransfer) + s->cbTotalTransfer = cbSize; + s->iSourceSink = ATAFN_SS_NULL; + atapiCmdOK(s); + return false; +} + + +static void atapiParseCmdVirtualATAPI(AHCIATADevState *s) +{ + const uint8_t *pbPacket; + uint8_t *pbBuf; + uint32_t cbMax; + + pbPacket = s->aATAPICmd; + pbBuf = s->CTXALLSUFF(pbIOBuffer); + switch (pbPacket[0]) + { + case SCSI_TEST_UNIT_READY: + if (s->cNotifiedMediaChange > 0) + { + if (s->cNotifiedMediaChange-- > 2) + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + else + atapiCmdErrorSimple(s, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + } + else if (s->pDrvMount->pfnIsMounted(s->pDrvMount)) + atapiCmdOK(s); + else + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + case SCSI_GET_EVENT_STATUS_NOTIFICATION: + cbMax = ataBE2H_U16(pbPacket + 7); + ataStartTransfer(s, RT_MIN(cbMax, 8), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_GET_EVENT_STATUS_NOTIFICATION, true); + break; + case SCSI_MODE_SENSE_10: + { + uint8_t uPageControl, uPageCode; + cbMax = ataBE2H_U16(pbPacket + 7); + uPageControl = pbPacket[2] >> 6; + uPageCode = pbPacket[2] & 0x3f; + switch (uPageControl) + { + case SCSI_PAGECONTROL_CURRENT: + switch (uPageCode) + { + case SCSI_MODEPAGE_ERROR_RECOVERY: + ataStartTransfer(s, RT_MIN(cbMax, 16), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_MODE_SENSE_ERROR_RECOVERY, true); + break; + case SCSI_MODEPAGE_CD_STATUS: + ataStartTransfer(s, RT_MIN(cbMax, 40), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_MODE_SENSE_CD_STATUS, true); + break; + default: + goto error_cmd; + } + break; + case SCSI_PAGECONTROL_CHANGEABLE: + goto error_cmd; + case SCSI_PAGECONTROL_DEFAULT: + goto error_cmd; + default: + case SCSI_PAGECONTROL_SAVED: + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_SAVING_PARAMETERS_NOT_SUPPORTED); + break; + } + } + break; + case SCSI_REQUEST_SENSE: + cbMax = pbPacket[4]; + ataStartTransfer(s, RT_MIN(cbMax, 18), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_REQUEST_SENSE, true); + break; + case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL: + if (s->pDrvMount->pfnIsMounted(s->pDrvMount)) + { + if (pbPacket[4] & 1) + s->pDrvMount->pfnLock(s->pDrvMount); + else + s->pDrvMount->pfnUnlock(s->pDrvMount); + atapiCmdOK(s); + } + else + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + case SCSI_READ_10: + case SCSI_READ_12: + { + uint32_t cSectors, iATAPILBA; + + if (s->cNotifiedMediaChange > 0) + { + s->cNotifiedMediaChange-- ; + atapiCmdErrorSimple(s, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!s->pDrvMount->pfnIsMounted(s->pDrvMount)) + { + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + if (pbPacket[0] == SCSI_READ_10) + cSectors = ataBE2H_U16(pbPacket + 7); + else + cSectors = ataBE2H_U32(pbPacket + 6); + iATAPILBA = ataBE2H_U32(pbPacket + 2); + if (cSectors == 0) + { + atapiCmdOK(s); + break; + } + if ((uint64_t)iATAPILBA + cSectors > s->cTotalSectors) + { + /* Rate limited logging, one log line per second. For + * guests that insist on reading from places outside the + * valid area this often generates too many release log + * entries otherwise. */ + static uint64_t uLastLogTS = 0; + if (RTTimeMilliTS() >= uLastLogTS + 1000) + { + LogRel(("AHCI ATA: LUN#%d: CD-ROM block number %Ld invalid (READ)\n", s->iLUN, (uint64_t)iATAPILBA + cSectors)); + uLastLogTS = RTTimeMilliTS(); + } + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_BLOCK_OOR); + break; + } + atapiReadSectors(s, iATAPILBA, cSectors, 2048); + } + break; + case SCSI_READ_CD: + { + uint32_t cSectors, iATAPILBA; + + if (s->cNotifiedMediaChange > 0) + { + s->cNotifiedMediaChange-- ; + atapiCmdErrorSimple(s, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!s->pDrvMount->pfnIsMounted(s->pDrvMount)) + { + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + cSectors = (pbPacket[6] << 16) | (pbPacket[7] << 8) | pbPacket[8]; + iATAPILBA = ataBE2H_U32(pbPacket + 2); + if (cSectors == 0) + { + atapiCmdOK(s); + break; + } + if ((uint64_t)iATAPILBA + cSectors > s->cTotalSectors) + { + /* Rate limited logging, one log line per second. For + * guests that insist on reading from places outside the + * valid area this often generates too many release log + * entries otherwise. */ + static uint64_t uLastLogTS = 0; + if (RTTimeMilliTS() >= uLastLogTS + 1000) + { + LogRel(("AHCI ATA: LUN#%d: CD-ROM block number %Ld invalid (READ CD)\n", s->iLUN, (uint64_t)iATAPILBA + cSectors)); + uLastLogTS = RTTimeMilliTS(); + } + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_BLOCK_OOR); + break; + } + switch (pbPacket[9] & 0xf8) + { + case 0x00: + /* nothing */ + atapiCmdOK(s); + break; + case 0x10: + /* normal read */ + atapiReadSectors(s, iATAPILBA, cSectors, 2048); + break; + case 0xf8: + /* read all data */ + atapiReadSectors(s, iATAPILBA, cSectors, 2352); + break; + default: + LogRel(("AHCI ATA: LUN#%d: CD-ROM sector format not supported\n", s->iLUN)); + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + break; + } + } + break; + case SCSI_SEEK_10: + { + uint32_t iATAPILBA; + if (s->cNotifiedMediaChange > 0) + { + s->cNotifiedMediaChange-- ; + atapiCmdErrorSimple(s, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!s->pDrvMount->pfnIsMounted(s->pDrvMount)) + { + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + iATAPILBA = ataBE2H_U32(pbPacket + 2); + if (iATAPILBA > s->cTotalSectors) + { + /* Rate limited logging, one log line per second. For + * guests that insist on seeking to places outside the + * valid area this often generates too many release log + * entries otherwise. */ + static uint64_t uLastLogTS = 0; + if (RTTimeMilliTS() >= uLastLogTS + 1000) + { + LogRel(("AHCI ATA: LUN#%d: CD-ROM block number %Ld invalid (SEEK)\n", s->iLUN, (uint64_t)iATAPILBA)); + uLastLogTS = RTTimeMilliTS(); + } + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_BLOCK_OOR); + break; + } + atapiCmdOK(s); + ataSetStatus(s, ATA_STAT_SEEK); /* Linux expects this. */ + } + break; + case SCSI_START_STOP_UNIT: + { + int rc = VINF_SUCCESS; + switch (pbPacket[4] & 3) + { + case 0: /* 00 - Stop motor */ + case 1: /* 01 - Start motor */ + break; + case 2: /* 10 - Eject media */ + /* This must be done from EMT. */ + { + PAHCIATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); + PPDMDEVINS pDevIns = ATADEVSTATE_2_DEVINS(s); + PVMREQ pReq; + + PDMCritSectLeave(&pCtl->lock); + rc = VMR3ReqCall(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, + (PFNRT)s->pDrvMount->pfnUnmount, 2, s->pDrvMount, false); + AssertReleaseRC(rc); + VMR3ReqFree(pReq); + { + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + } + } + break; + case 3: /* 11 - Load media */ + /** @todo rc = s->pDrvMount->pfnLoadMedia(s->pDrvMount) */ + break; + } + if (RT_SUCCESS(rc)) + atapiCmdOK(s); + else + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIA_LOAD_OR_EJECT_FAILED); + } + break; + case SCSI_MECHANISM_STATUS: + { + cbMax = ataBE2H_U16(pbPacket + 8); + ataStartTransfer(s, RT_MIN(cbMax, 8), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_MECHANISM_STATUS, true); + } + break; + case SCSI_READ_TOC_PMA_ATIP: + { + uint8_t format; + + if (s->cNotifiedMediaChange > 0) + { + s->cNotifiedMediaChange-- ; + atapiCmdErrorSimple(s, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!s->pDrvMount->pfnIsMounted(s->pDrvMount)) + { + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + cbMax = ataBE2H_U16(pbPacket + 7); + /* SCSI MMC-3 spec says format is at offset 2 (lower 4 bits), + * but Linux kernel uses offset 9 (topmost 2 bits). Hope that + * the other field is clear... */ + format = (pbPacket[2] & 0xf) | (pbPacket[9] >> 6); + switch (format) + { + case 0: + ataStartTransfer(s, cbMax, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_TOC_NORMAL, true); + break; + case 1: + ataStartTransfer(s, RT_MIN(cbMax, 12), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_TOC_MULTI, true); + break; + case 2: + ataStartTransfer(s, cbMax, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_TOC_RAW, true); + break; + default: + error_cmd: + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + break; + } + } + break; + case SCSI_READ_CAPACITY: + if (s->cNotifiedMediaChange > 0) + { + s->cNotifiedMediaChange-- ; + atapiCmdErrorSimple(s, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!s->pDrvMount->pfnIsMounted(s->pDrvMount)) + { + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + ataStartTransfer(s, 8, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_CAPACITY, true); + break; + case SCSI_READ_DISC_INFORMATION: + if (s->cNotifiedMediaChange > 0) + { + s->cNotifiedMediaChange-- ; + atapiCmdErrorSimple(s, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!s->pDrvMount->pfnIsMounted(s->pDrvMount)) + { + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + cbMax = ataBE2H_U16(pbPacket + 7); + ataStartTransfer(s, RT_MIN(cbMax, 34), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_DISC_INFORMATION, true); + break; + case SCSI_READ_TRACK_INFORMATION: + if (s->cNotifiedMediaChange > 0) + { + s->cNotifiedMediaChange-- ; + atapiCmdErrorSimple(s, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!s->pDrvMount->pfnIsMounted(s->pDrvMount)) + { + atapiCmdErrorSimple(s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + cbMax = ataBE2H_U16(pbPacket + 7); + ataStartTransfer(s, RT_MIN(cbMax, 36), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_TRACK_INFORMATION, true); + break; + case SCSI_GET_CONFIGURATION: + /* No media change stuff here, it can confuse Linux guests. */ + cbMax = ataBE2H_U16(pbPacket + 7); + ataStartTransfer(s, RT_MIN(cbMax, 32), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_GET_CONFIGURATION, true); + break; + case SCSI_INQUIRY: + cbMax = ataBE2H_U16(pbPacket + 3); + ataStartTransfer(s, RT_MIN(cbMax, 36), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_INQUIRY, true); + break; + default: + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE); + break; + } +} + + +/* + * Parse ATAPI commands, passing them directly to the CD/DVD drive. + */ +static void atapiParseCmdPassthrough(AHCIATADevState *s) +{ + const uint8_t *pbPacket; + uint8_t *pbBuf; + uint32_t cSectors, iATAPILBA; + uint32_t cbTransfer = 0; + PDMBLOCKTXDIR uTxDir = PDMBLOCKTXDIR_NONE; + + pbPacket = s->aATAPICmd; + pbBuf = s->CTXALLSUFF(pbIOBuffer); + switch (pbPacket[0]) + { + case SCSI_BLANK: + goto sendcmd; + case SCSI_CLOSE_TRACK_SESSION: + goto sendcmd; + case SCSI_ERASE_10: + iATAPILBA = ataBE2H_U32(pbPacket + 2); + cbTransfer = ataBE2H_U16(pbPacket + 7); + Log2(("ATAPI PT: lba %d\n", iATAPILBA)); + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_FORMAT_UNIT: + cbTransfer = s->uATARegLCyl | (s->uATARegHCyl << 8); /* use ATAPI transfer length */ + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_GET_CONFIGURATION: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_GET_EVENT_STATUS_NOTIFICATION: + cbTransfer = ataBE2H_U16(pbPacket + 7); + if (ASMAtomicReadU32(&s->MediaEventStatus) != ATA_EVENT_STATUS_UNCHANGED) + { + ataStartTransfer(s, RT_MIN(cbTransfer, 8), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_GET_EVENT_STATUS_NOTIFICATION, true); + break; + } + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_GET_PERFORMANCE: + cbTransfer = s->uATARegLCyl | (s->uATARegHCyl << 8); /* use ATAPI transfer length */ + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_INQUIRY: + cbTransfer = ataBE2H_U16(pbPacket + 3); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_LOAD_UNLOAD_MEDIUM: + goto sendcmd; + case SCSI_MECHANISM_STATUS: + cbTransfer = ataBE2H_U16(pbPacket + 8); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_MODE_SELECT_10: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_MODE_SENSE_10: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_PAUSE_RESUME: + goto sendcmd; + case SCSI_PLAY_AUDIO_10: + goto sendcmd; + case SCSI_PLAY_AUDIO_12: + goto sendcmd; + case SCSI_PLAY_AUDIO_MSF: + goto sendcmd; + case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL: + /** @todo do not forget to unlock when a VM is shut down */ + goto sendcmd; + case SCSI_READ_10: + iATAPILBA = ataBE2H_U32(pbPacket + 2); + cSectors = ataBE2H_U16(pbPacket + 7); + Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors)); + s->cbATAPISector = 2048; /**< @todo this size is not always correct */ + cbTransfer = cSectors * s->cbATAPISector; + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_12: + iATAPILBA = ataBE2H_U32(pbPacket + 2); + cSectors = ataBE2H_U32(pbPacket + 6); + Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors)); + s->cbATAPISector = 2048; /**< @todo this size is not always correct */ + cbTransfer = cSectors * s->cbATAPISector; + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_BUFFER: + cbTransfer = ataBE2H_U24(pbPacket + 6); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_BUFFER_CAPACITY: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_CAPACITY: + cbTransfer = 8; + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_CD: + s->cbATAPISector = 2048; /**< @todo this size is not always correct */ + cbTransfer = ataBE2H_U24(pbPacket + 6) / s->cbATAPISector * s->cbATAPISector; + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_CD_MSF: + cSectors = ataMSF2LBA(pbPacket + 6) - ataMSF2LBA(pbPacket + 3); + if (cSectors > 32) + cSectors = 32; /* Limit transfer size to 64~74K. Safety first. In any case this can only harm software doing CDDA extraction. */ + s->cbATAPISector = 2048; /**< @todo this size is not always correct */ + cbTransfer = cSectors * s->cbATAPISector; + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_DISC_INFORMATION: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_DVD_STRUCTURE: + cbTransfer = ataBE2H_U16(pbPacket + 8); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_FORMAT_CAPACITIES: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_SUBCHANNEL: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_TOC_PMA_ATIP: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_READ_TRACK_INFORMATION: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_REPAIR_TRACK: + goto sendcmd; + case SCSI_REPORT_KEY: + cbTransfer = ataBE2H_U16(pbPacket + 8); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_REQUEST_SENSE: + cbTransfer = pbPacket[4]; + if ((s->abATAPISense[2] & 0x0f) != SCSI_SENSE_NONE) + { + ataStartTransfer(s, RT_MIN(cbTransfer, 18), PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_REQUEST_SENSE, true); + break; + } + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_RESERVE_TRACK: + goto sendcmd; + case SCSI_SCAN: + goto sendcmd; + case SCSI_SEEK_10: + goto sendcmd; + case SCSI_SEND_CUE_SHEET: + cbTransfer = ataBE2H_U24(pbPacket + 6); + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_SEND_DVD_STRUCTURE: + cbTransfer = ataBE2H_U16(pbPacket + 8); + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_SEND_EVENT: + cbTransfer = ataBE2H_U16(pbPacket + 8); + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_SEND_KEY: + cbTransfer = ataBE2H_U16(pbPacket + 8); + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_SEND_OPC_INFORMATION: + cbTransfer = ataBE2H_U16(pbPacket + 7); + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_SET_CD_SPEED: + goto sendcmd; + case SCSI_SET_READ_AHEAD: + goto sendcmd; + case SCSI_SET_STREAMING: + cbTransfer = ataBE2H_U16(pbPacket + 9); + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_START_STOP_UNIT: + goto sendcmd; + case SCSI_STOP_PLAY_SCAN: + goto sendcmd; + case SCSI_SYNCHRONIZE_CACHE: + goto sendcmd; + case SCSI_TEST_UNIT_READY: + goto sendcmd; + case SCSI_VERIFY_10: + goto sendcmd; + case SCSI_WRITE_10: + iATAPILBA = ataBE2H_U32(pbPacket + 2); + cSectors = ataBE2H_U16(pbPacket + 7); + Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors)); +#if 0 + /* The sector size is determined by the async I/O thread. */ + s->cbATAPISector = 0; + /* Preliminary, will be corrected once the sector size is known. */ + cbTransfer = cSectors; +#else + s->cbATAPISector = 2048; /**< @todo this size is not always correct */ + cbTransfer = cSectors * s->cbATAPISector; +#endif + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_WRITE_12: + iATAPILBA = ataBE2H_U32(pbPacket + 2); + cSectors = ataBE2H_U32(pbPacket + 6); + Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors)); +#if 0 + /* The sector size is determined by the async I/O thread. */ + s->cbATAPISector = 0; + /* Preliminary, will be corrected once the sector size is known. */ + cbTransfer = cSectors; +#else + s->cbATAPISector = 2048; /**< @todo this size is not always correct */ + cbTransfer = cSectors * s->cbATAPISector; +#endif + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_WRITE_AND_VERIFY_10: + iATAPILBA = ataBE2H_U32(pbPacket + 2); + cSectors = ataBE2H_U16(pbPacket + 7); + Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors)); + /* The sector size is determined by the async I/O thread. */ + s->cbATAPISector = 0; + /* Preliminary, will be corrected once the sector size is known. */ + cbTransfer = cSectors; + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + case SCSI_WRITE_BUFFER: + switch (pbPacket[1] & 0x1f) + { + case 0x04: /* download microcode */ + case 0x05: /* download microcode and save */ + case 0x06: /* download microcode with offsets */ + case 0x07: /* download microcode with offsets and save */ + case 0x0e: /* download microcode with offsets and defer activation */ + case 0x0f: /* activate deferred microcode */ + LogRel(("AHCI ATA: LUN#%d: CD-ROM passthrough command attempted to update firmware, blocked\n", s->iLUN)); + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + break; + default: + cbTransfer = ataBE2H_U16(pbPacket + 6); + uTxDir = PDMBLOCKTXDIR_TO_DEVICE; + goto sendcmd; + } + break; + case SCSI_REPORT_LUNS: /* Not part of MMC-3, but used by Windows. */ + cbTransfer = ataBE2H_U32(pbPacket + 6); + uTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + goto sendcmd; + case SCSI_REZERO_UNIT: + /* Obsolete command used by cdrecord. What else would one expect? + * This command is not sent to the drive, it is handled internally, + * as the Linux kernel doesn't like it (message "scsi: unknown + * opcode 0x01" in syslog) and replies with a sense code of 0, + * which sends cdrecord to an endless loop. */ + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE); + break; + default: + LogRel(("AHCI ATA: LUN#%d: passthrough unimplemented for command %#x\n", s->iLUN, pbPacket[0])); + atapiCmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE); + break; + sendcmd: + /* Send a command to the drive, passing data in/out as required. */ + Log2(("ATAPI PT: max size %d\n", cbTransfer)); + Assert(cbTransfer <= s->cbIOBuffer); + if (cbTransfer == 0) + uTxDir = PDMBLOCKTXDIR_NONE; + ataStartTransfer(s, cbTransfer, uTxDir, ATAFN_BT_ATAPI_PASSTHROUGH_CMD, ATAFN_SS_ATAPI_PASSTHROUGH, true); + } +} + + +static void atapiParseCmd(AHCIATADevState *s) +{ + const uint8_t *pbPacket; + + pbPacket = s->aATAPICmd; +#ifdef DEBUG + Log(("%s: LUN#%d DMA=%d CMD=%#04x \"%s\"\n", __FUNCTION__, s->iLUN, s->fDMA, pbPacket[0], SCSICmdText(pbPacket[0]))); +#else /* !DEBUG */ + Log(("%s: LUN#%d DMA=%d CMD=%#04x\n", __FUNCTION__, s->iLUN, s->fDMA, pbPacket[0])); +#endif /* !DEBUG */ + Log2(("%s: limit=%#x packet: %.*Rhxs\n", __FUNCTION__, s->uATARegLCyl | (s->uATARegHCyl << 8), ATAPI_PACKET_SIZE, pbPacket)); + + if (s->fATAPIPassthrough) + atapiParseCmdPassthrough(s); + else + atapiParseCmdVirtualATAPI(s); +} + + +static bool ataPacketSS(AHCIATADevState *s) +{ + s->fDMA = !!(s->uATARegFeature & 1); + memcpy(s->aATAPICmd, s->CTXALLSUFF(pbIOBuffer), ATAPI_PACKET_SIZE); + s->uTxDir = PDMBLOCKTXDIR_NONE; + s->cbTotalTransfer = 0; + s->cbElementaryTransfer = 0; + atapiParseCmd(s); + return false; +} + +#if 0 + +/** + * SCSI_GET_EVENT_STATUS_NOTIFICATION should return "medium removed" event + * from now on, regardless if there was a medium inserted or not. + */ +static void ataMediumRemoved(AHCIATADevState *s) +{ + ASMAtomicWriteU32(&s->MediaEventStatus, ATA_EVENT_STATUS_MEDIA_REMOVED); +} + + +/** + * SCSI_GET_EVENT_STATUS_NOTIFICATION should return "medium inserted". If + * there was already a medium inserted, don't forget to send the "medium + * removed" event first. + */ +static void ataMediumInserted(AHCIATADevState *s) +{ + uint32_t OldStatus, NewStatus; + do + { + OldStatus = ASMAtomicReadU32(&s->MediaEventStatus); + switch (OldStatus) + { + case ATA_EVENT_STATUS_MEDIA_CHANGED: + case ATA_EVENT_STATUS_MEDIA_REMOVED: + /* no change, we will send "medium removed" + "medium inserted" */ + NewStatus = ATA_EVENT_STATUS_MEDIA_CHANGED; + break; + default: + NewStatus = ATA_EVENT_STATUS_MEDIA_NEW; + break; + } + } while (!ASMAtomicCmpXchgU32(&s->MediaEventStatus, NewStatus, OldStatus)); +} + + +/** + * Called when a media is mounted. + * + * @param pInterface Pointer to the interface structure containing the called function pointer. + */ +static DECLCALLBACK(void) ataMountNotify(PPDMIMOUNTNOTIFY pInterface) +{ + AHCIATADevState *pIf = PDMIMOUNTNOTIFY_2_ATASTATE(pInterface); + Log(("%s: changing LUN#%d\n", __FUNCTION__, pIf->iLUN)); + + /* Ignore the call if we're called while being attached. */ + if (!pIf->pDrvBlock) + return; + + if (pIf->fATAPI) + pIf->cTotalSectors = pIf->pDrvBlock->pfnGetSize(pIf->pDrvBlock) / 2048; + else + pIf->cTotalSectors = pIf->pDrvBlock->pfnGetSize(pIf->pDrvBlock) / 512; + + /* Report media changed in TEST UNIT and other (probably incorrect) places. */ + if (pIf->cNotifiedMediaChange < 2) + pIf->cNotifiedMediaChange = 2; + ataMediumInserted(pIf); +} + +/** + * Called when a media is unmounted + * @param pInterface Pointer to the interface structure containing the called function pointer. + */ +static DECLCALLBACK(void) ataUnmountNotify(PPDMIMOUNTNOTIFY pInterface) +{ + AHCIATADevState *pIf = PDMIMOUNTNOTIFY_2_ATASTATE(pInterface); + Log(("%s:\n", __FUNCTION__)); + pIf->cTotalSectors = 0; + + /* + * Whatever I do, XP will not use the GET MEDIA STATUS nor the EVENT stuff. + * However, it will respond to TEST UNIT with a 0x6 0x28 (media changed) sense code. + * So, we'll give it 4 TEST UNIT command to catch up, two which the media is not + * present and 2 in which it is changed. + */ + pIf->cNotifiedMediaChange = 4; + ataMediumRemoved(pIf); +} +#endif + +static void ataPacketBT(AHCIATADevState *s) +{ + s->cbElementaryTransfer = s->cbTotalTransfer; + s->uATARegNSector = (s->uATARegNSector & ~7) | ATAPI_INT_REASON_CD; + Log2(("%s: interrupt reason %#04x\n", __FUNCTION__, s->uATARegNSector)); + ataSetStatusValue(s, ATA_STAT_READY); +} + + +static void ataResetDevice(AHCIATADevState *s) +{ + s->cMultSectors = ATA_MAX_MULT_SECTORS; + s->cNotifiedMediaChange = 0; + ASMAtomicWriteU32(&s->MediaEventStatus, ATA_EVENT_STATUS_UNCHANGED); + ataUnsetIRQ(s); + + s->uATARegSelect = 0x20; + ataSetStatusValue(s, ATA_STAT_READY); + ataSetSignature(s); + s->cbTotalTransfer = 0; + s->cbElementaryTransfer = 0; + s->iIOBufferPIODataStart = 0; + s->iIOBufferPIODataEnd = 0; + s->iBeginTransfer = ATAFN_BT_NULL; + s->iSourceSink = ATAFN_SS_NULL; + s->fATAPITransfer = false; + s->uATATransferMode = ATA_MODE_UDMA | 2; /* AHCI supports only up to UDMA2 */ + + s->uATARegFeature = 0; +} + + +static bool ataExecuteDeviceDiagnosticSS(AHCIATADevState *s) +{ + ataSetSignature(s); + if (s->fATAPI) + ataSetStatusValue(s, 0); /* NOTE: READY is _not_ set */ + else + ataSetStatusValue(s, ATA_STAT_READY); + s->uATARegError = 0x01; + return false; +} + + +static void ataParseCmd(AHCIATADevState *s, uint8_t cmd) +{ +#ifdef DEBUG + Log(("%s: LUN#%d CMD=%#04x \"%s\"\n", __FUNCTION__, s->iLUN, cmd, ATACmdText(cmd))); +#else /* !DEBUG */ + Log(("%s: LUN#%d CMD=%#04x\n", __FUNCTION__, s->iLUN, cmd)); +#endif /* !DEBUG */ + s->fLBA48 = false; + s->fDMA = false; + if (cmd == ATA_IDLE_IMMEDIATE) + { + /* Detect Linux timeout recovery, first tries IDLE IMMEDIATE (which + * would overwrite the failing command unfortunately), then RESET. */ + int32_t uCmdWait = -1; + uint64_t uNow = RTTimeNanoTS(); + if (s->u64CmdTS) + uCmdWait = (uNow - s->u64CmdTS) / 1000; + LogRel(("AHCI ATA: LUN#%d: IDLE IMMEDIATE, CmdIf=%#04x (%d usec ago)\n", + s->iLUN, s->uATARegCommand, uCmdWait)); + } + s->uATARegCommand = cmd; + switch (cmd) + { + case ATA_IDENTIFY_DEVICE: + if (s->pDrvBlock && !s->fATAPI) + ataStartTransfer(s, 512, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_NULL, ATAFN_SS_IDENTIFY, false); + else + { + if (s->fATAPI) + ataSetSignature(s); + ataCmdError(s, ABRT_ERR); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + } + break; + case ATA_INITIALIZE_DEVICE_PARAMETERS: + case ATA_RECALIBRATE: + ataCmdOK(s, ATA_STAT_SEEK); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case ATA_SET_MULTIPLE_MODE: + if ( s->uATARegNSector != 0 + && ( s->uATARegNSector > ATA_MAX_MULT_SECTORS + || (s->uATARegNSector & (s->uATARegNSector - 1)) != 0)) + { + ataCmdError(s, ABRT_ERR); + } + else + { + Log2(("%s: set multi sector count to %d\n", __FUNCTION__, s->uATARegNSector)); + s->cMultSectors = s->uATARegNSector; + ataCmdOK(s, 0); + } + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case ATA_READ_VERIFY_SECTORS_EXT: + s->fLBA48 = true; + case ATA_READ_VERIFY_SECTORS: + case ATA_READ_VERIFY_SECTORS_WITHOUT_RETRIES: + /* do sector number check ? */ + ataCmdOK(s, 0); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case ATA_READ_SECTORS_EXT: + s->fLBA48 = true; + case ATA_READ_SECTORS: + case ATA_READ_SECTORS_WITHOUT_RETRIES: + if (!s->pDrvBlock) + goto abort_cmd; + s->cSectorsPerIRQ = 1; + ataStartTransfer(s, ataGetNSectors(s) * 512, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_READ_WRITE_SECTORS, ATAFN_SS_READ_SECTORS, false); + break; + case ATA_WRITE_SECTORS_EXT: + s->fLBA48 = true; + case ATA_WRITE_SECTORS: + case ATA_WRITE_SECTORS_WITHOUT_RETRIES: + s->cSectorsPerIRQ = 1; + ataStartTransfer(s, ataGetNSectors(s) * 512, PDMBLOCKTXDIR_TO_DEVICE, ATAFN_BT_READ_WRITE_SECTORS, ATAFN_SS_WRITE_SECTORS, false); + break; + case ATA_READ_MULTIPLE_EXT: + s->fLBA48 = true; + case ATA_READ_MULTIPLE: + if (!s->cMultSectors) + goto abort_cmd; + s->cSectorsPerIRQ = s->cMultSectors; + ataStartTransfer(s, ataGetNSectors(s) * 512, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_READ_WRITE_SECTORS, ATAFN_SS_READ_SECTORS, false); + break; + case ATA_WRITE_MULTIPLE_EXT: + s->fLBA48 = true; + case ATA_WRITE_MULTIPLE: + if (!s->cMultSectors) + goto abort_cmd; + s->cSectorsPerIRQ = s->cMultSectors; + ataStartTransfer(s, ataGetNSectors(s) * 512, PDMBLOCKTXDIR_TO_DEVICE, ATAFN_BT_READ_WRITE_SECTORS, ATAFN_SS_WRITE_SECTORS, false); + break; + case ATA_READ_DMA_EXT: + s->fLBA48 = true; + case ATA_READ_DMA: + case ATA_READ_DMA_WITHOUT_RETRIES: + if (!s->pDrvBlock) + goto abort_cmd; + s->cSectorsPerIRQ = ATA_MAX_MULT_SECTORS; + s->fDMA = true; + ataStartTransfer(s, ataGetNSectors(s) * 512, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_READ_WRITE_SECTORS, ATAFN_SS_READ_SECTORS, false); + break; + case ATA_WRITE_DMA_EXT: + s->fLBA48 = true; + case ATA_WRITE_DMA: + case ATA_WRITE_DMA_WITHOUT_RETRIES: + if (!s->pDrvBlock) + goto abort_cmd; + s->cSectorsPerIRQ = ATA_MAX_MULT_SECTORS; + s->fDMA = true; + ataStartTransfer(s, ataGetNSectors(s) * 512, PDMBLOCKTXDIR_TO_DEVICE, ATAFN_BT_READ_WRITE_SECTORS, ATAFN_SS_WRITE_SECTORS, false); + break; + case ATA_READ_NATIVE_MAX_ADDRESS_EXT: + s->fLBA48 = true; + ataSetSector(s, s->cTotalSectors - 1); + ataCmdOK(s, 0); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case ATA_READ_NATIVE_MAX_ADDRESS: + ataSetSector(s, RT_MIN(s->cTotalSectors, 1 << 28) - 1); + ataCmdOK(s, 0); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case ATA_CHECK_POWER_MODE: + s->uATARegNSector = 0xff; /* drive active or idle */ + ataCmdOK(s, 0); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case ATA_SET_FEATURES: + Log2(("%s: feature=%#x\n", __FUNCTION__, s->uATARegFeature)); + if (!s->pDrvBlock) + goto abort_cmd; + switch (s->uATARegFeature) + { + case 0x02: /* write cache enable */ + Log2(("%s: write cache enable\n", __FUNCTION__)); + ataCmdOK(s, ATA_STAT_SEEK); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case 0xaa: /* read look-ahead enable */ + Log2(("%s: read look-ahead enable\n", __FUNCTION__)); + ataCmdOK(s, ATA_STAT_SEEK); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case 0x55: /* read look-ahead disable */ + Log2(("%s: read look-ahead disable\n", __FUNCTION__)); + ataCmdOK(s, ATA_STAT_SEEK); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case 0xcc: /* reverting to power-on defaults enable */ + Log2(("%s: revert to power-on defaults enable\n", __FUNCTION__)); + ataCmdOK(s, ATA_STAT_SEEK); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case 0x66: /* reverting to power-on defaults disable */ + Log2(("%s: revert to power-on defaults disable\n", __FUNCTION__)); + ataCmdOK(s, ATA_STAT_SEEK); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case 0x82: /* write cache disable */ + Log2(("%s: write cache disable\n", __FUNCTION__)); + /* As per the ATA/ATAPI-6 specs, a write cache disable + * command MUST flush the write buffers to disc. */ + ataStartTransfer(s, 0, PDMBLOCKTXDIR_NONE, ATAFN_BT_NULL, ATAFN_SS_FLUSH, false); + break; + case 0x03: { /* set transfer mode */ + Log2(("%s: transfer mode %#04x\n", __FUNCTION__, s->uATARegNSector)); + switch (s->uATARegNSector & 0xf8) + { + case 0x00: /* PIO default */ + case 0x08: /* PIO mode */ + break; + case ATA_MODE_MDMA: /* MDMA mode */ + s->uATATransferMode = (s->uATARegNSector & 0xf8) | RT_MIN(s->uATARegNSector & 0x07, ATA_MDMA_MODE_MAX); + break; + case ATA_MODE_UDMA: /* UDMA mode */ + s->uATATransferMode = (s->uATARegNSector & 0xf8) | RT_MIN(s->uATARegNSector & 0x07, ATA_UDMA_MODE_MAX); + break; + default: + goto abort_cmd; + } + ataCmdOK(s, ATA_STAT_SEEK); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + } + default: + goto abort_cmd; + } + /* + * OS/2 workarond: + * The OS/2 IDE driver from MCP2 appears to rely on the feature register being + * reset here. According to the specification, this is a driver bug as the register + * contents are undefined after the call. This means we can just as well reset it. + */ + s->uATARegFeature = 0; + break; + case ATA_FLUSH_CACHE_EXT: + case ATA_FLUSH_CACHE: + if (!s->pDrvBlock || s->fATAPI) + goto abort_cmd; + ataStartTransfer(s, 0, PDMBLOCKTXDIR_NONE, ATAFN_BT_NULL, ATAFN_SS_FLUSH, false); + break; + case ATA_STANDBY_IMMEDIATE: + ataCmdOK(s, 0); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + case ATA_IDLE_IMMEDIATE: + LogRel(("AHCI ATA: LUN#%d: aborting current command\n", s->iLUN)); + ataAbortCurrentCommand(s, false); + break; + /* ATAPI commands */ + case ATA_IDENTIFY_PACKET_DEVICE: + if (s->fATAPI) + ataStartTransfer(s, 512, PDMBLOCKTXDIR_FROM_DEVICE, ATAFN_BT_NULL, ATAFN_SS_ATAPI_IDENTIFY, false); + else + { + ataCmdError(s, ABRT_ERR); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + } + break; + case ATA_EXECUTE_DEVICE_DIAGNOSTIC: + ataStartTransfer(s, 0, PDMBLOCKTXDIR_NONE, ATAFN_BT_NULL, ATAFN_SS_EXECUTE_DEVICE_DIAGNOSTIC, false); + break; + case ATA_DEVICE_RESET: + if (!s->fATAPI) + goto abort_cmd; + LogRel(("AHCI ATA: LUN#%d: performing device RESET\n", s->iLUN)); + ataAbortCurrentCommand(s, true); + break; + case ATA_PACKET: + if (!s->fATAPI) + goto abort_cmd; + /* overlapping commands not supported */ + if (s->uATARegFeature & 0x02) + goto abort_cmd; + ataStartTransfer(s, ATAPI_PACKET_SIZE, PDMBLOCKTXDIR_TO_DEVICE, ATAFN_BT_PACKET, ATAFN_SS_PACKET, false); + break; + default: + abort_cmd: + ataCmdError(s, ABRT_ERR); + ataSetIRQ(s); /* Shortcut, do not use AIO thread. */ + break; + } +} + + +/** + * Waits for a particular async I/O thread to complete whatever it + * is doing at the moment. + * + * @returns true on success. + * @returns false when the thread is still processing. + * @param pThis Pointer to the controller data. + * @param cMillies How long to wait (total). + */ +static bool ataWaitForAsyncIOIsIdle(PAHCIATACONTROLLER pCtl, unsigned cMillies) +{ + uint64_t u64Start; + + /* + * Wait for any pending async operation to finish + */ + u64Start = RTTimeMilliTS(); + for (;;) + { + if (ataAsyncIOIsIdle(pCtl, false)) + return true; + if (RTTimeMilliTS() - u64Start >= cMillies) + break; + + /* Sleep for a bit. */ + RTThreadSleep(100); + } + + return false; +} + +#endif /* IN_RING3 */ + +static int ataIOPortWriteU8(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t val) +{ + Log2(("%s: write addr=%#x val=%#04x\n", __FUNCTION__, addr, val)); + addr &= 7; + switch (addr) + { + case 0: + break; + case 1: /* feature register */ + /* NOTE: data is written to the two drives */ + pCtl->aIfs[0].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[1].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[0].uATARegFeatureHOB = pCtl->aIfs[0].uATARegFeature; + pCtl->aIfs[1].uATARegFeatureHOB = pCtl->aIfs[1].uATARegFeature; + pCtl->aIfs[0].uATARegFeature = val; + pCtl->aIfs[1].uATARegFeature = val; + break; + case 2: /* sector count */ + pCtl->aIfs[0].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[1].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[0].uATARegNSectorHOB = pCtl->aIfs[0].uATARegNSector; + pCtl->aIfs[1].uATARegNSectorHOB = pCtl->aIfs[1].uATARegNSector; + pCtl->aIfs[0].uATARegNSector = val; + pCtl->aIfs[1].uATARegNSector = val; + break; + case 3: /* sector number */ + pCtl->aIfs[0].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[1].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[0].uATARegSectorHOB = pCtl->aIfs[0].uATARegSector; + pCtl->aIfs[1].uATARegSectorHOB = pCtl->aIfs[1].uATARegSector; + pCtl->aIfs[0].uATARegSector = val; + pCtl->aIfs[1].uATARegSector = val; + break; + case 4: /* cylinder low */ + pCtl->aIfs[0].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[1].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[0].uATARegLCylHOB = pCtl->aIfs[0].uATARegLCyl; + pCtl->aIfs[1].uATARegLCylHOB = pCtl->aIfs[1].uATARegLCyl; + pCtl->aIfs[0].uATARegLCyl = val; + pCtl->aIfs[1].uATARegLCyl = val; + break; + case 5: /* cylinder high */ + pCtl->aIfs[0].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[1].uATARegDevCtl &= ~ATA_DEVCTL_HOB; + pCtl->aIfs[0].uATARegHCylHOB = pCtl->aIfs[0].uATARegHCyl; + pCtl->aIfs[1].uATARegHCylHOB = pCtl->aIfs[1].uATARegHCyl; + pCtl->aIfs[0].uATARegHCyl = val; + pCtl->aIfs[1].uATARegHCyl = val; + break; + case 6: /* drive/head */ + pCtl->aIfs[0].uATARegSelect = (val & ~0x10) | 0xa0; + pCtl->aIfs[1].uATARegSelect = (val | 0x10) | 0xa0; + if (((val >> 4) & 1) != pCtl->iSelectedIf) + { + PPDMDEVINS pDevIns = CONTROLLER_2_DEVINS(pCtl); + + /* select another drive */ + pCtl->iSelectedIf = (val >> 4) & 1; + /* The IRQ line is multiplexed between the two drives, so + * update the state when switching to another drive. Only need + * to update interrupt line if it is enabled and there is a + * state change. */ + if ( !(pCtl->aIfs[pCtl->iSelectedIf].uATARegDevCtl & ATA_DEVCTL_DISABLE_IRQ) + && ( pCtl->aIfs[pCtl->iSelectedIf].fIrqPending + != pCtl->aIfs[pCtl->iSelectedIf ^ 1].fIrqPending)) + { + if (pCtl->aIfs[pCtl->iSelectedIf].fIrqPending) + { + Log2(("%s: LUN#%d asserting IRQ (drive select change)\n", __FUNCTION__, pCtl->aIfs[pCtl->iSelectedIf].iLUN)); + /* The BMDMA unit unconditionally sets BM_STATUS_INT if + * the interrupt line is asserted. It monitors the line + * for a rising edge. */ + pCtl->BmDma.u8Status |= BM_STATUS_INT; + if (pCtl->irq == 16) + PDMDevHlpPCISetIrqNoWait(pDevIns, 0, 1); + else + PDMDevHlpISASetIrqNoWait(pDevIns, pCtl->irq, 1); + } + else + { + Log2(("%s: LUN#%d deasserting IRQ (drive select change)\n", __FUNCTION__, pCtl->aIfs[pCtl->iSelectedIf].iLUN)); + if (pCtl->irq == 16) + PDMDevHlpPCISetIrqNoWait(pDevIns, 0, 0); + else + PDMDevHlpISASetIrqNoWait(pDevIns, pCtl->irq, 0); + } + } + } + break; + default: + case 7: /* command */ + /* ignore commands to non existant slave */ + if (pCtl->iSelectedIf && !pCtl->aIfs[pCtl->iSelectedIf].pDrvBlock) + break; +#ifndef IN_RING3 + /* Don't do anything complicated in GC */ + return VINF_IOM_HC_IOPORT_WRITE; +#else /* IN_RING3 */ + ataParseCmd(&pCtl->aIfs[pCtl->iSelectedIf], val); +#endif /* !IN_RING3 */ + } + return VINF_SUCCESS; +} + + +static int ataIOPortReadU8(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t *pu32) +{ + AHCIATADevState *s = &pCtl->aIfs[pCtl->iSelectedIf]; + uint32_t val; + bool fHOB; + + fHOB = !!(s->uATARegDevCtl & (1 << 7)); + switch (addr & 7) + { + case 0: /* data register */ + val = 0xff; + break; + case 1: /* error register */ + /* The ATA specification is very terse when it comes to specifying + * the precise effects of reading back the error/feature register. + * The error register (read-only) shares the register number with + * the feature register (write-only), so it seems that it's not + * necessary to support the usual HOB readback here. */ + if (!s->pDrvBlock) + val = 0; + else + val = s->uATARegError; + break; + case 2: /* sector count */ + if (!s->pDrvBlock) + val = 0; + else if (fHOB) + val = s->uATARegNSectorHOB; + else + val = s->uATARegNSector; + break; + case 3: /* sector number */ + if (!s->pDrvBlock) + val = 0; + else if (fHOB) + val = s->uATARegSectorHOB; + else + val = s->uATARegSector; + break; + case 4: /* cylinder low */ + if (!s->pDrvBlock) + val = 0; + else if (fHOB) + val = s->uATARegLCylHOB; + else + val = s->uATARegLCyl; + break; + case 5: /* cylinder high */ + if (!s->pDrvBlock) + val = 0; + else if (fHOB) + val = s->uATARegHCylHOB; + else + val = s->uATARegHCyl; + break; + case 6: /* drive/head */ + /* This register must always work as long as there is at least + * one drive attached to the controller. It is common between + * both drives anyway (completely identical content). */ + if (!pCtl->aIfs[0].pDrvBlock && !pCtl->aIfs[1].pDrvBlock) + val = 0; + else + val = s->uATARegSelect; + break; + default: + case 7: /* primary status */ + { + /* Counter for number of busy status seen in GC in a row. */ + static unsigned cBusy = 0; + + if (!s->pDrvBlock) + val = 0; + else + val = s->uATARegStatus; + + /* Give the async I/O thread an opportunity to make progress, + * don't let it starve by guests polling frequently. EMT has a + * lower priority than the async I/O thread, but sometimes the + * host OS doesn't care. With some guests we are only allowed to + * be busy for about 5 milliseconds in some situations. Note that + * this is no guarantee for any other VBox thread getting + * scheduled, so this just lowers the CPU load a bit when drives + * are busy. It cannot help with timing problems. */ + if (val & ATA_STAT_BUSY) + { +#ifdef IN_RING3 + cBusy = 0; + PDMCritSectLeave(&pCtl->lock); + + RTThreadYield(); + + { + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + } + + val = s->uATARegStatus; +#else /* !IN_RING3 */ + /* Cannot yield CPU in guest context. And switching to host + * context for each and every busy status is too costly, + * especially on SMP systems where we don't gain much by + * yielding the CPU to someone else. */ + if (++cBusy >= 20) + { + cBusy = 0; + return VINF_IOM_HC_IOPORT_READ; + } +#endif /* !IN_RING3 */ + } + else + cBusy = 0; + ataUnsetIRQ(s); + break; + } + } + Log2(("%s: addr=%#x val=%#04x\n", __FUNCTION__, addr, val)); + *pu32 = val; + return VINF_SUCCESS; +} + + +static uint32_t ataStatusRead(PAHCIATACONTROLLER pCtl, uint32_t addr) +{ + AHCIATADevState *s = &pCtl->aIfs[pCtl->iSelectedIf]; + uint32_t val; + + if ((!pCtl->aIfs[0].pDrvBlock && !pCtl->aIfs[1].pDrvBlock) || + (pCtl->iSelectedIf == 1 && !s->pDrvBlock)) + val = 0; + else + val = s->uATARegStatus; + Log2(("%s: addr=%#x val=%#04x\n", __FUNCTION__, addr, val)); + return val; +} + +static int ataControlWrite(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t val) +{ +#ifndef IN_RING3 + if ((val ^ pCtl->aIfs[0].uATARegDevCtl) & ATA_DEVCTL_RESET) + return VINF_IOM_HC_IOPORT_WRITE; /* The RESET stuff is too complicated for GC. */ +#endif /* !IN_RING3 */ + + Log2(("%s: addr=%#x val=%#04x\n", __FUNCTION__, addr, val)); + /* RESET is common for both drives attached to a controller. */ + if (!(pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET) && + (val & ATA_DEVCTL_RESET)) + { +#ifdef IN_RING3 + /* Software RESET low to high */ + int32_t uCmdWait0 = -1, uCmdWait1 = -1; + uint64_t uNow = RTTimeNanoTS(); + if (pCtl->aIfs[0].u64CmdTS) + uCmdWait0 = (uNow - pCtl->aIfs[0].u64CmdTS) / 1000; + if (pCtl->aIfs[1].u64CmdTS) + uCmdWait1 = (uNow - pCtl->aIfs[1].u64CmdTS) / 1000; + LogRel(("ATA: Ctl: RESET, DevSel=%d AIOIf=%d CmdIf0=%#04x (%d usec ago) CmdIf1=%#04x (%d usec ago)\n", + pCtl->iSelectedIf, pCtl->iAIOIf, + pCtl->aIfs[0].uATARegCommand, uCmdWait0, + pCtl->aIfs[1].uATARegCommand, uCmdWait1)); + pCtl->fReset = true; + /* Everything must be done after the reset flag is set, otherwise + * there are unavoidable races with the currently executing request + * (which might just finish in the mean time). */ + pCtl->fChainedTransfer = false; + for (uint32_t i = 0; i < RT_ELEMENTS(pCtl->aIfs); i++) + { + ataResetDevice(&pCtl->aIfs[i]); + /* The following cannot be done using ataSetStatusValue() since the + * reset flag is already set, which suppresses all status changes. */ + pCtl->aIfs[i].uATARegStatus = ATA_STAT_BUSY | ATA_STAT_SEEK; + Log2(("%s: LUN#%d status %#04x\n", __FUNCTION__, pCtl->aIfs[i].iLUN, pCtl->aIfs[i].uATARegStatus)); + pCtl->aIfs[i].uATARegError = 0x01; + } + ataAsyncIOClearRequests(pCtl); + Log2(("%s: Ctl: message to async I/O thread, resetA\n", __FUNCTION__)); + if (val & ATA_DEVCTL_HOB) + { + val &= ~ATA_DEVCTL_HOB; + Log2(("%s: ignored setting HOB\n", __FUNCTION__)); + } + ataAsyncIOPutRequest(pCtl, &ataResetARequest); +#else /* !IN_RING3 */ + AssertMsgFailed(("RESET handling is too complicated for GC\n")); +#endif /* IN_RING3 */ + } + else if ((pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET) && + !(val & ATA_DEVCTL_RESET)) + { +#ifdef IN_RING3 + /* Software RESET high to low */ + Log(("%s: deasserting RESET\n", __FUNCTION__)); + Log2(("%s: Ctl: message to async I/O thread, resetC\n", __FUNCTION__)); + if (val & ATA_DEVCTL_HOB) + { + val &= ~ATA_DEVCTL_HOB; + Log2(("%s: ignored setting HOB\n", __FUNCTION__)); + } + ataAsyncIOPutRequest(pCtl, &ataResetCRequest); +#else /* !IN_RING3 */ + AssertMsgFailed(("RESET handling is too complicated for GC\n")); +#endif /* IN_RING3 */ + } + + /* Change of interrupt disable flag. Update interrupt line if interrupt + * is pending on the current interface. */ + if ((val ^ pCtl->aIfs[0].uATARegDevCtl) & ATA_DEVCTL_DISABLE_IRQ + && pCtl->aIfs[pCtl->iSelectedIf].fIrqPending) + { + if (!(val & ATA_DEVCTL_DISABLE_IRQ)) + { + Log2(("%s: LUN#%d asserting IRQ (interrupt disable change)\n", __FUNCTION__, pCtl->aIfs[pCtl->iSelectedIf].iLUN)); + /* The BMDMA unit unconditionally sets BM_STATUS_INT if the + * interrupt line is asserted. It monitors the line for a rising + * edge. */ + pCtl->BmDma.u8Status |= BM_STATUS_INT; + if (pCtl->irq == 16) + PDMDevHlpPCISetIrqNoWait(CONTROLLER_2_DEVINS(pCtl), 0, 1); + else + PDMDevHlpISASetIrqNoWait(CONTROLLER_2_DEVINS(pCtl), pCtl->irq, 1); + } + else + { + Log2(("%s: LUN#%d deasserting IRQ (interrupt disable change)\n", __FUNCTION__, pCtl->aIfs[pCtl->iSelectedIf].iLUN)); + if (pCtl->irq == 16) + PDMDevHlpPCISetIrqNoWait(CONTROLLER_2_DEVINS(pCtl), 0, 0); + else + PDMDevHlpISASetIrqNoWait(CONTROLLER_2_DEVINS(pCtl), pCtl->irq, 0); + } + } + + if (val & ATA_DEVCTL_HOB) + Log2(("%s: set HOB\n", __FUNCTION__)); + + pCtl->aIfs[0].uATARegDevCtl = val; + pCtl->aIfs[1].uATARegDevCtl = val; + + return VINF_SUCCESS; +} + +#ifdef IN_RING3 + +static void ataPIOTransfer(PAHCIATACONTROLLER pCtl) +{ + AHCIATADevState *s; + + s = &pCtl->aIfs[pCtl->iAIOIf]; + Log3(("%s: if=%p\n", __FUNCTION__, s)); + + if (s->cbTotalTransfer && s->iIOBufferCur > s->iIOBufferEnd) + { + LogRel(("AHCI ATA: LUN#%d: %s data in the middle of a PIO transfer - VERY SLOW\n", s->iLUN, s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE ? "loading" : "storing")); + /* Any guest OS that triggers this case has a pathetic ATA driver. + * In a real system it would block the CPU via IORDY, here we do it + * very similarly by not continuing with the current instruction + * until the transfer to/from the storage medium is completed. */ + if (s->iSourceSink != ATAFN_SS_NULL) + { + bool fRedo; + uint8_t status = s->uATARegStatus; + ataSetStatusValue(s, ATA_STAT_BUSY); + Log2(("%s: calling source/sink function\n", __FUNCTION__)); + fRedo = g_apfnSourceSinkFuncs[s->iSourceSink](s); + pCtl->fRedo = fRedo; + if (RT_UNLIKELY(fRedo)) + return; + ataSetStatusValue(s, status); + s->iIOBufferCur = 0; + s->iIOBufferEnd = s->cbElementaryTransfer; + } + } + if (s->cbTotalTransfer) + { + if (s->fATAPITransfer) + ataPIOTransferLimitATAPI(s); + + if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE && s->cbElementaryTransfer > s->cbTotalTransfer) + s->cbElementaryTransfer = s->cbTotalTransfer; + + Log2(("%s: %s tx_size=%d elem_tx_size=%d index=%d end=%d\n", + __FUNCTION__, s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE ? "T2I" : "I2T", + s->cbTotalTransfer, s->cbElementaryTransfer, + s->iIOBufferCur, s->iIOBufferEnd)); + ataPIOTransferStart(s, s->iIOBufferCur, s->cbElementaryTransfer); + s->cbTotalTransfer -= s->cbElementaryTransfer; + s->iIOBufferCur += s->cbElementaryTransfer; + + if (s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE && s->cbElementaryTransfer > s->cbTotalTransfer) + s->cbElementaryTransfer = s->cbTotalTransfer; + } + else + ataPIOTransferStop(s); +} + + +DECLINLINE(void) ataPIOTransferFinish(PAHCIATACONTROLLER pCtl, AHCIATADevState *s) +{ + /* Do not interfere with RESET processing if the PIO transfer finishes + * while the RESET line is asserted. */ + if (pCtl->fReset) + { + Log2(("%s: Ctl: suppressed continuing PIO transfer as RESET is active\n", __FUNCTION__)); + return; + } + + if ( s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE + || ( s->iSourceSink != ATAFN_SS_NULL + && s->iIOBufferCur >= s->iIOBufferEnd)) + { + /* Need to continue the transfer in the async I/O thread. This is + * the case for write operations or generally for not yet finished + * transfers (some data might need to be read). */ + ataUnsetStatus(s, ATA_STAT_READY | ATA_STAT_DRQ); + ataSetStatus(s, ATA_STAT_BUSY); + + Log2(("%s: Ctl: message to async I/O thread, continuing PIO transfer\n", __FUNCTION__)); + ataAsyncIOPutRequest(pCtl, &ataPIORequest); + } + else + { + /* Either everything finished (though some data might still be pending) + * or some data is pending before the next read is due. */ + + /* Continue a previously started transfer. */ + ataUnsetStatus(s, ATA_STAT_DRQ); + ataSetStatus(s, ATA_STAT_READY); + + if (s->cbTotalTransfer) + { + /* There is more to transfer, happens usually for large ATAPI + * reads - the protocol limits the chunk size to 65534 bytes. */ + ataPIOTransfer(pCtl); + ataSetIRQ(s); + } + else + { + Log2(("%s: Ctl: skipping message to async I/O thread, ending PIO transfer\n", __FUNCTION__)); + /* Finish PIO transfer. */ + ataPIOTransfer(pCtl); + Assert(!pCtl->fRedo); + } + } +} + +#endif /* IN_RING3 */ + +static int ataDataWrite(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t cbSize, const uint8_t *pbBuf) +{ + AHCIATADevState *s = &pCtl->aIfs[pCtl->iSelectedIf]; + uint8_t *p; + + if (s->iIOBufferPIODataStart < s->iIOBufferPIODataEnd) + { + Assert(s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE); + p = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart; +#ifndef IN_RING3 + /* All but the last transfer unit is simple enough for GC, but + * sending a request to the async IO thread is too complicated. */ + if (s->iIOBufferPIODataStart + cbSize < s->iIOBufferPIODataEnd) + { + memcpy(p, pbBuf, cbSize); + s->iIOBufferPIODataStart += cbSize; + } + else + return VINF_IOM_HC_IOPORT_WRITE; +#else /* IN_RING3 */ + memcpy(p, pbBuf, cbSize); + s->iIOBufferPIODataStart += cbSize; + if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd) + ataPIOTransferFinish(pCtl, s); +#endif /* !IN_RING3 */ + } + else + Log2(("%s: DUMMY data\n", __FUNCTION__)); + Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, addr, cbSize, pbBuf)); + return VINF_SUCCESS; +} + +static int ataDataRead(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t cbSize, uint8_t *pbBuf) +{ + AHCIATADevState *s = &pCtl->aIfs[pCtl->iSelectedIf]; + uint8_t *p; + + if (s->iIOBufferPIODataStart < s->iIOBufferPIODataEnd) + { + Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); + p = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart; +#ifndef IN_RING3 + /* All but the last transfer unit is simple enough for GC, but + * sending a request to the async IO thread is too complicated. */ + if (s->iIOBufferPIODataStart + cbSize < s->iIOBufferPIODataEnd) + { + memcpy(pbBuf, p, cbSize); + s->iIOBufferPIODataStart += cbSize; + } + else + return VINF_IOM_HC_IOPORT_READ; +#else /* IN_RING3 */ + memcpy(pbBuf, p, cbSize); + s->iIOBufferPIODataStart += cbSize; + if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd) + ataPIOTransferFinish(pCtl, s); +#endif /* !IN_RING3 */ + } + else + { + Log2(("%s: DUMMY data\n", __FUNCTION__)); + memset(pbBuf, '\xff', cbSize); + } + Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, addr, cbSize, pbBuf)); + return VINF_SUCCESS; +} + +#ifdef IN_RING3 + +static void ataDMATransferStop(AHCIATADevState *s) +{ + s->cbTotalTransfer = 0; + s->cbElementaryTransfer = 0; + s->iBeginTransfer = ATAFN_BT_NULL; + s->iSourceSink = ATAFN_SS_NULL; +} + + +/** + * Perform the entire DMA transfer in one go (unless a source/sink operation + * has to be redone or a RESET comes in between). Unlike the PIO counterpart + * this function cannot handle empty transfers. + * + * @param pCtl Controller for which to perform the transfer. + */ +static void ataDMATransfer(PAHCIATACONTROLLER pCtl) +{ + PPDMDEVINS pDevIns = CONTROLLER_2_DEVINS(pCtl); + AHCIATADevState *s = &pCtl->aIfs[pCtl->iAIOIf]; + bool fRedo; + RTGCPHYS32 pDesc; + uint32_t cbTotalTransfer, cbElementaryTransfer; + uint32_t iIOBufferCur, iIOBufferEnd; + uint32_t dmalen; + PDMBLOCKTXDIR uTxDir; + bool fLastDesc = false; + + Assert(sizeof(BMDMADesc) == 8); + + fRedo = pCtl->fRedo; + if (RT_LIKELY(!fRedo)) + Assert(s->cbTotalTransfer); + uTxDir = (PDMBLOCKTXDIR)s->uTxDir; + cbTotalTransfer = s->cbTotalTransfer; + cbElementaryTransfer = s->cbElementaryTransfer; + iIOBufferCur = s->iIOBufferCur; + iIOBufferEnd = s->iIOBufferEnd; + + /* The DMA loop is designed to hold the lock only when absolutely + * necessary. This avoids long freezes should the guest access the + * ATA registers etc. for some reason. */ + PDMCritSectLeave(&pCtl->lock); + + Log2(("%s: %s tx_size=%d elem_tx_size=%d index=%d end=%d\n", + __FUNCTION__, uTxDir == PDMBLOCKTXDIR_FROM_DEVICE ? "T2I" : "I2T", + cbTotalTransfer, cbElementaryTransfer, + iIOBufferCur, iIOBufferEnd)); + for (pDesc = pCtl->pFirstDMADesc; pDesc <= pCtl->pLastDMADesc; pDesc += sizeof(BMDMADesc)) + { + BMDMADesc DMADesc; + RTGCPHYS32 pBuffer; + uint32_t cbBuffer; + + if (RT_UNLIKELY(fRedo)) + { + pBuffer = pCtl->pRedoDMABuffer; + cbBuffer = pCtl->cbRedoDMABuffer; + fLastDesc = pCtl->fRedoDMALastDesc; + } + else + { + PDMDevHlpPhysRead(pDevIns, pDesc, &DMADesc, sizeof(BMDMADesc)); + pBuffer = RT_LE2H_U32(DMADesc.pBuffer); + cbBuffer = RT_LE2H_U32(DMADesc.cbBuffer); + fLastDesc = !!(cbBuffer & 0x80000000); + cbBuffer &= 0xfffe; + if (cbBuffer == 0) + cbBuffer = 0x10000; + if (cbBuffer > cbTotalTransfer) + cbBuffer = cbTotalTransfer; + } + + while (RT_UNLIKELY(fRedo) || (cbBuffer && cbTotalTransfer)) + { + if (RT_LIKELY(!fRedo)) + { + dmalen = RT_MIN(cbBuffer, iIOBufferEnd - iIOBufferCur); + Log2(("%s: DMA desc %#010x: addr=%#010x size=%#010x\n", __FUNCTION__, + pDesc, pBuffer, cbBuffer)); + if (uTxDir == PDMBLOCKTXDIR_FROM_DEVICE) + PDMDevHlpPhysWrite(pDevIns, pBuffer, s->CTX_SUFF(pbIOBuffer) + iIOBufferCur, dmalen); + else + PDMDevHlpPhysRead(pDevIns, pBuffer, s->CTX_SUFF(pbIOBuffer) + iIOBufferCur, dmalen); + iIOBufferCur += dmalen; + cbTotalTransfer -= dmalen; + cbBuffer -= dmalen; + pBuffer += dmalen; + } + if ( iIOBufferCur == iIOBufferEnd + && (uTxDir == PDMBLOCKTXDIR_TO_DEVICE || cbTotalTransfer)) + { + if (uTxDir == PDMBLOCKTXDIR_FROM_DEVICE && cbElementaryTransfer > cbTotalTransfer) + cbElementaryTransfer = cbTotalTransfer; + + { + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + } + + /* The RESET handler could have cleared the DMA transfer + * state (since we didn't hold the lock until just now + * the guest can continue in parallel). If so, the state + * is already set up so the loop is exited immediately. */ + if (s->iSourceSink != ATAFN_SS_NULL) + { + s->iIOBufferCur = iIOBufferCur; + s->iIOBufferEnd = iIOBufferEnd; + s->cbElementaryTransfer = cbElementaryTransfer; + s->cbTotalTransfer = cbTotalTransfer; + Log2(("%s: calling source/sink function\n", __FUNCTION__)); + fRedo = g_apfnSourceSinkFuncs[s->iSourceSink](s); + if (RT_UNLIKELY(fRedo)) + { + pCtl->pFirstDMADesc = pDesc; + pCtl->pRedoDMABuffer = pBuffer; + pCtl->cbRedoDMABuffer = cbBuffer; + pCtl->fRedoDMALastDesc = fLastDesc; + } + else + { + cbTotalTransfer = s->cbTotalTransfer; + cbElementaryTransfer = s->cbElementaryTransfer; + + if (uTxDir == PDMBLOCKTXDIR_TO_DEVICE && cbElementaryTransfer > cbTotalTransfer) + cbElementaryTransfer = cbTotalTransfer; + iIOBufferCur = 0; + iIOBufferEnd = cbElementaryTransfer; + } + pCtl->fRedo = fRedo; + } + else + { + /* This forces the loop to exit immediately. */ + pDesc = pCtl->pLastDMADesc + 1; + } + + PDMCritSectLeave(&pCtl->lock); + if (RT_UNLIKELY(fRedo)) + break; + } + } + + if (RT_UNLIKELY(fRedo)) + break; + + /* end of transfer */ + if (!cbTotalTransfer || fLastDesc) + break; + + { + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + } + + if (!(pCtl->BmDma.u8Cmd & BM_CMD_START) || pCtl->fReset) + { + LogRel(("ATA: Ctl: ABORT DMA%s\n", pCtl->fReset ? " due to RESET" : "")); + if (!pCtl->fReset) + ataDMATransferStop(s); + /* This forces the loop to exit immediately. */ + pDesc = pCtl->pLastDMADesc + 1; + } + + PDMCritSectLeave(&pCtl->lock); + } + + { + STAM_PROFILE_START(&pCtl->StatLockWait, a); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + } + + if (RT_UNLIKELY(fRedo)) + return; + + if (fLastDesc) + pCtl->BmDma.u8Status &= ~BM_STATUS_DMAING; + s->cbTotalTransfer = cbTotalTransfer; + s->cbElementaryTransfer = cbElementaryTransfer; + s->iIOBufferCur = iIOBufferCur; + s->iIOBufferEnd = iIOBufferEnd; +} + + +/** + * Suspend I/O operations on a controller. Also suspends EMT, because it's + * waiting for I/O to make progress. The next attempt to perform an I/O + * operation will be made when EMT is resumed up again (as the resume + * callback below restarts I/O). + * + * @param pCtl Controller for which to suspend I/O. + */ +static void ataSuspendRedo(PAHCIATACONTROLLER pCtl) +{ + PPDMDEVINS pDevIns = CONTROLLER_2_DEVINS(pCtl); + PVMREQ pReq; + int rc; + + pCtl->fRedoIdle = true; + rc = VMR3ReqCall(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, + (PFNRT)PDMDevHlpVMSuspend, 1, pDevIns); + AssertReleaseRC(rc); + VMR3ReqFree(pReq); +} + +/** Asynch I/O thread for an interface. Once upon a time this was readable + * code with several loops and a different semaphore for each purpose. But + * then came the "how can one save the state in the middle of a PIO transfer" + * question. The solution was to use an ASM, which is what's there now. */ +static DECLCALLBACK(int) ataAsyncIOLoop(RTTHREAD ThreadSelf, void *pvUser) +{ + const AHCIATARequest *pReq; + uint64_t u64TS = 0; /* shut up gcc */ + uint64_t uWait; + int rc = VINF_SUCCESS; + PAHCIATACONTROLLER pCtl = (PAHCIATACONTROLLER)pvUser; + AHCIATADevState *s; + + pReq = NULL; + pCtl->fChainedTransfer = false; + while (!pCtl->fShutdown) + { + /* Keep this thread from doing anything as long as EMT is suspended. */ + while (pCtl->fRedoIdle) + { + rc = RTSemEventWait(pCtl->SuspendIOSem, RT_INDEFINITE_WAIT); + if (RT_FAILURE(rc) || pCtl->fShutdown) + break; + + pCtl->fRedoIdle = false; + } + + /* Wait for work. */ + if (pReq == NULL) + { + LogBird(("ata: %x: going to sleep...\n", pCtl->IOPortBase1)); + rc = RTSemEventWait(pCtl->AsyncIOSem, RT_INDEFINITE_WAIT); + LogBird(("ata: %x: waking up\n", pCtl->IOPortBase1)); + if (RT_FAILURE(rc) || pCtl->fShutdown) + break; + + pReq = ataAsyncIOGetCurrentRequest(pCtl); + } + + if (pReq == NULL) + continue; + + AHCIATAAIO ReqType = pReq->ReqType; + + Log2(("%s: Ctl: state=%d, req=%d\n", __FUNCTION__, pCtl->uAsyncIOState, ReqType)); + if (pCtl->uAsyncIOState != ReqType) + { + /* The new state is not the state that was expected by the normal + * state changes. This is either a RESET/ABORT or there's something + * really strange going on. */ + if ( (pCtl->uAsyncIOState == AHCIATA_AIO_PIO || pCtl->uAsyncIOState == AHCIATA_AIO_DMA) + && (ReqType == AHCIATA_AIO_PIO || ReqType == AHCIATA_AIO_DMA)) + { + /* Incorrect sequence of PIO/DMA states. Dump request queue. */ + ataAsyncIODumpRequests(pCtl); + } + AssertReleaseMsg(ReqType == AHCIATA_AIO_RESET_ASSERTED || ReqType == AHCIATA_AIO_RESET_CLEARED || ReqType == AHCIATA_AIO_ABORT || pCtl->uAsyncIOState == ReqType, ("I/O state inconsistent: state=%d request=%d\n", pCtl->uAsyncIOState, ReqType)); + } + + /* Do our work. */ + { + STAM_PROFILE_START(&pCtl->StatLockWait, a); + LogBird(("ata: %x: entering critsect\n", pCtl->IOPortBase1)); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + LogBird(("ata: %x: entered\n", pCtl->IOPortBase1)); + STAM_PROFILE_STOP(&pCtl->StatLockWait, a); + } + + if (pCtl->uAsyncIOState == AHCIATA_AIO_NEW && !pCtl->fChainedTransfer) + { + u64TS = RTTimeNanoTS(); +#if defined(DEBUG) || defined(VBOX_WITH_STATISTICS) + STAM_PROFILE_ADV_START(&pCtl->StatAsyncTime, a); +#endif /* DEBUG || VBOX_WITH_STATISTICS */ + } + + switch (ReqType) + { + case AHCIATA_AIO_NEW: + + pCtl->iAIOIf = pReq->u.t.iIf; + s = &pCtl->aIfs[pCtl->iAIOIf]; + s->cbTotalTransfer = pReq->u.t.cbTotalTransfer; + s->uTxDir = pReq->u.t.uTxDir; + s->iBeginTransfer = pReq->u.t.iBeginTransfer; + s->iSourceSink = pReq->u.t.iSourceSink; + s->iIOBufferEnd = 0; + s->u64CmdTS = u64TS; + + if (s->fATAPI) + { + if (pCtl->fChainedTransfer) + { + /* Only count the actual transfers, not the PIO + * transfer of the ATAPI command bytes. */ + if (s->fDMA) + STAM_REL_COUNTER_INC(&s->StatATAPIDMA); + else + STAM_REL_COUNTER_INC(&s->StatATAPIPIO); + } + } + else + { + if (s->fDMA) + STAM_REL_COUNTER_INC(&s->StatATADMA); + else + STAM_REL_COUNTER_INC(&s->StatATAPIO); + } + + pCtl->fChainedTransfer = false; + + if (s->iBeginTransfer != ATAFN_BT_NULL) + { + Log2(("%s: Ctl: calling begin transfer function\n", __FUNCTION__)); + g_apfnBeginTransFuncs[s->iBeginTransfer](s); + s->iBeginTransfer = ATAFN_BT_NULL; + if (s->uTxDir != PDMBLOCKTXDIR_FROM_DEVICE) + s->iIOBufferEnd = s->cbElementaryTransfer; + } + else + { + s->cbElementaryTransfer = s->cbTotalTransfer; + s->iIOBufferEnd = s->cbTotalTransfer; + } + s->iIOBufferCur = 0; + + if (s->uTxDir != PDMBLOCKTXDIR_TO_DEVICE) + { + if (s->iSourceSink != ATAFN_SS_NULL) + { + bool fRedo; + Log2(("%s: Ctl: calling source/sink function\n", __FUNCTION__)); + fRedo = g_apfnSourceSinkFuncs[s->iSourceSink](s); + pCtl->fRedo = fRedo; + if (RT_UNLIKELY(fRedo)) + { + /* Operation failed at the initial transfer, restart + * everything from scratch by resending the current + * request. Occurs very rarely, not worth optimizing. */ + LogRel(("%s: Ctl: redo entire operation\n", __FUNCTION__)); + ataAsyncIOPutRequest(pCtl, pReq); + ataSuspendRedo(pCtl); + break; + } + } + else + ataCmdOK(s, 0); + s->iIOBufferEnd = s->cbElementaryTransfer; + + } + + /* Do not go into the transfer phase if RESET is asserted. + * The CritSect is released while waiting for the host OS + * to finish the I/O, thus RESET is possible here. Most + * important: do not change uAsyncIOState. */ + if (pCtl->fReset) + break; + + if (s->fDMA) + { + if (s->cbTotalTransfer) + { + ataSetStatus(s, ATA_STAT_DRQ); + + pCtl->uAsyncIOState = AHCIATA_AIO_DMA; + /* If BMDMA is already started, do the transfer now. */ + if (pCtl->BmDma.u8Cmd & BM_CMD_START) + { + Log2(("%s: Ctl: message to async I/O thread, continuing DMA transfer immediately\n", __FUNCTION__)); + ataAsyncIOPutRequest(pCtl, &ataDMARequest); + } + } + else + { + Assert(s->uTxDir == PDMBLOCKTXDIR_NONE); /* Any transfer which has an initial transfer size of 0 must be marked as such. */ + /* Finish DMA transfer. */ + ataDMATransferStop(s); + ataSetIRQ(s); + pCtl->uAsyncIOState = AHCIATA_AIO_NEW; + } + } + else + { + if (s->cbTotalTransfer) + { + ataPIOTransfer(pCtl); + Assert(!pCtl->fRedo); + if (s->fATAPITransfer || s->uTxDir != PDMBLOCKTXDIR_TO_DEVICE) + ataSetIRQ(s); + + if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE || s->iSourceSink != ATAFN_SS_NULL) + { + /* Write operations and not yet finished transfers + * must be completed in the async I/O thread. */ + pCtl->uAsyncIOState = AHCIATA_AIO_PIO; + } + else + { + /* Finished read operation can be handled inline + * in the end of PIO transfer handling code. Linux + * depends on this, as it waits only briefly for + * devices to become ready after incoming data + * transfer. Cannot find anything in the ATA spec + * that backs this assumption, but as all kernels + * are affected (though most of the time it does + * not cause any harm) this must work. */ + pCtl->uAsyncIOState = AHCIATA_AIO_NEW; + } + } + else + { + Assert(s->uTxDir == PDMBLOCKTXDIR_NONE); /* Any transfer which has an initial transfer size of 0 must be marked as such. */ + /* Finish PIO transfer. */ + ataPIOTransfer(pCtl); + Assert(!pCtl->fRedo); + if (!s->fATAPITransfer) + ataSetIRQ(s); + pCtl->uAsyncIOState = AHCIATA_AIO_NEW; + } + } + break; + + case AHCIATA_AIO_DMA: + { + BMDMAState *bm = &pCtl->BmDma; + s = &pCtl->aIfs[pCtl->iAIOIf]; /* Do not remove or there's an instant crash after loading the saved state */ + ATAFNSS iOriginalSourceSink = (ATAFNSS)s->iSourceSink; /* Used by the hack below, but gets reset by then. */ + + if (s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE) + AssertRelease(bm->u8Cmd & BM_CMD_WRITE); + else + AssertRelease(!(bm->u8Cmd & BM_CMD_WRITE)); + + if (RT_LIKELY(!pCtl->fRedo)) + { + /* The specs say that the descriptor table must not cross a + * 4K boundary. */ + pCtl->pFirstDMADesc = bm->pvAddr; + pCtl->pLastDMADesc = RT_ALIGN_32(bm->pvAddr + 1, _4K) - sizeof(BMDMADesc); + } + ataDMATransfer(pCtl); + + if (RT_UNLIKELY(pCtl->fRedo)) + { + LogRel(("ATA: Ctl: redo DMA operation\n")); + ataAsyncIOPutRequest(pCtl, &ataDMARequest); + ataSuspendRedo(pCtl); + break; + } + + /* The infamous delay IRQ hack. */ + if ( iOriginalSourceSink == ATAFN_SS_WRITE_SECTORS + && s->cbTotalTransfer == 0 + && pCtl->DelayIRQMillies) + { + /* Delay IRQ for writing. Required to get the Win2K + * installation work reliably (otherwise it crashes, + * usually during component install). So far no better + * solution has been found. */ + Log(("%s: delay IRQ hack\n", __FUNCTION__)); + PDMCritSectLeave(&pCtl->lock); + RTThreadSleep(pCtl->DelayIRQMillies); + PDMCritSectEnter(&pCtl->lock, VINF_SUCCESS); + } + + ataUnsetStatus(s, ATA_STAT_DRQ); + Assert(!pCtl->fChainedTransfer); + Assert(s->iSourceSink == ATAFN_SS_NULL); + if (s->fATAPITransfer) + { + s->uATARegNSector = (s->uATARegNSector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; + Log2(("%s: Ctl: interrupt reason %#04x\n", __FUNCTION__, s->uATARegNSector)); + s->fATAPITransfer = false; + } + ataSetIRQ(s); + pCtl->uAsyncIOState = AHCIATA_AIO_NEW; + break; + } + + case AHCIATA_AIO_PIO: + s = &pCtl->aIfs[pCtl->iAIOIf]; /* Do not remove or there's an instant crash after loading the saved state */ + + if (s->iSourceSink != ATAFN_SS_NULL) + { + bool fRedo; + Log2(("%s: Ctl: calling source/sink function\n", __FUNCTION__)); + fRedo = g_apfnSourceSinkFuncs[s->iSourceSink](s); + pCtl->fRedo = fRedo; + if (RT_UNLIKELY(fRedo)) + { + LogRel(("ATA: Ctl#%d: redo PIO operation\n")); + ataAsyncIOPutRequest(pCtl, &ataPIORequest); + ataSuspendRedo(pCtl); + break; + } + s->iIOBufferCur = 0; + s->iIOBufferEnd = s->cbElementaryTransfer; + } + else + { + /* Continue a previously started transfer. */ + ataUnsetStatus(s, ATA_STAT_BUSY); + ataSetStatus(s, ATA_STAT_READY); + } + + /* It is possible that the drives on this controller get RESET + * during the above call to the source/sink function. If that's + * the case, don't restart the transfer and don't finish it the + * usual way. RESET handling took care of all that already. + * Most important: do not change uAsyncIOState. */ + if (pCtl->fReset) + break; + + if (s->cbTotalTransfer) + { + ataPIOTransfer(pCtl); + ataSetIRQ(s); + + if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE || s->iSourceSink != ATAFN_SS_NULL) + { + /* Write operations and not yet finished transfers + * must be completed in the async I/O thread. */ + pCtl->uAsyncIOState = AHCIATA_AIO_PIO; + } + else + { + /* Finished read operation can be handled inline + * in the end of PIO transfer handling code. Linux + * depends on this, as it waits only briefly for + * devices to become ready after incoming data + * transfer. Cannot find anything in the ATA spec + * that backs this assumption, but as all kernels + * are affected (though most of the time it does + * not cause any harm) this must work. */ + pCtl->uAsyncIOState = AHCIATA_AIO_NEW; + } + } + else + { + /* Finish PIO transfer. */ + ataPIOTransfer(pCtl); + if ( !pCtl->fChainedTransfer + && !s->fATAPITransfer + && s->uTxDir != PDMBLOCKTXDIR_FROM_DEVICE) + { + ataSetIRQ(s); + } + pCtl->uAsyncIOState = AHCIATA_AIO_NEW; + } + break; + + case AHCIATA_AIO_RESET_ASSERTED: + pCtl->uAsyncIOState = AHCIATA_AIO_RESET_CLEARED; + ataPIOTransferStop(&pCtl->aIfs[0]); + ataPIOTransferStop(&pCtl->aIfs[1]); + /* Do not change the DMA registers, they are not affected by the + * ATA controller reset logic. It should be sufficient to issue a + * new command, which is now possible as the state is cleared. */ + break; + + case AHCIATA_AIO_RESET_CLEARED: + pCtl->uAsyncIOState = AHCIATA_AIO_NEW; + pCtl->fReset = false; + LogRel(("ATA: Ctl: finished processing RESET\n")); + for (uint32_t i = 0; i < RT_ELEMENTS(pCtl->aIfs); i++) + { + if (pCtl->aIfs[i].fATAPI) + ataSetStatusValue(&pCtl->aIfs[i], 0); /* NOTE: READY is _not_ set */ + else + ataSetStatusValue(&pCtl->aIfs[i], ATA_STAT_READY | ATA_STAT_SEEK); + ataSetSignature(&pCtl->aIfs[i]); + } + break; + + case AHCIATA_AIO_ABORT: + /* Abort the current command only if it operates on the same interface. */ + if (pCtl->iAIOIf == pReq->u.a.iIf) + { + s = &pCtl->aIfs[pCtl->iAIOIf]; + + pCtl->uAsyncIOState = AHCIATA_AIO_NEW; + /* Do not change the DMA registers, they are not affected by the + * ATA controller reset logic. It should be sufficient to issue a + * new command, which is now possible as the state is cleared. */ + if (pReq->u.a.fResetDrive) + { + ataResetDevice(s); + ataExecuteDeviceDiagnosticSS(s); + } + else + { + ataPIOTransferStop(s); + ataUnsetStatus(s, ATA_STAT_BUSY | ATA_STAT_DRQ | ATA_STAT_SEEK | ATA_STAT_ERR); + ataSetStatus(s, ATA_STAT_READY); + ataSetIRQ(s); + } + } + break; + + default: + AssertMsgFailed(("Undefined async I/O state %d\n", pCtl->uAsyncIOState)); + } + + ataAsyncIORemoveCurrentRequest(pCtl, ReqType); + pReq = ataAsyncIOGetCurrentRequest(pCtl); + + if (pCtl->uAsyncIOState == AHCIATA_AIO_NEW && !pCtl->fChainedTransfer) + { +#if defined(DEBUG) || defined(VBOX_WITH_STATISTICS) + STAM_PROFILE_ADV_STOP(&pCtl->StatAsyncTime, a); +#endif /* DEBUG || VBOX_WITH_STATISTICS */ + + u64TS = RTTimeNanoTS() - u64TS; + uWait = u64TS / 1000; + Log(("%s: Ctl: LUN#%d finished I/O transaction in %d microseconds\n", __FUNCTION__, pCtl->aIfs[pCtl->iAIOIf].iLUN, (uint32_t)(uWait))); + /* Mark command as finished. */ + pCtl->aIfs[pCtl->iAIOIf].u64CmdTS = 0; + + /* + * Release logging of command execution times depends on the + * command type. ATAPI commands often take longer (due to CD/DVD + * spin up time etc.) so the threshold is different. + */ + if (pCtl->aIfs[pCtl->iAIOIf].uATARegCommand != ATA_PACKET) + { + if (uWait > 8 * 1000 * 1000) + { + /* + * Command took longer than 8 seconds. This is close + * enough or over the guest's command timeout, so place + * an entry in the release log to allow tracking such + * timing errors (which are often caused by the host). + */ + LogRel(("AHCI ATA: execution time for ATA command %#04x was %d seconds\n", pCtl->aIfs[pCtl->iAIOIf].uATARegCommand, uWait / (1000 * 1000))); + } + } + else + { + if (uWait > 20 * 1000 * 1000) + { + /* + * Command took longer than 20 seconds. This is close + * enough or over the guest's command timeout, so place + * an entry in the release log to allow tracking such + * timing errors (which are often caused by the host). + */ + LogRel(("AHCI ATA: execution time for ATAPI command %#04x was %d seconds\n", pCtl->aIfs[pCtl->iAIOIf].aATAPICmd[0], uWait / (1000 * 1000))); + } + } + +#if defined(DEBUG) || defined(VBOX_WITH_STATISTICS) + if (uWait < pCtl->StatAsyncMinWait || !pCtl->StatAsyncMinWait) + pCtl->StatAsyncMinWait = uWait; + if (uWait > pCtl->StatAsyncMaxWait) + pCtl->StatAsyncMaxWait = uWait; + + STAM_COUNTER_ADD(&pCtl->StatAsyncTimeUS, uWait); + STAM_COUNTER_INC(&pCtl->StatAsyncOps); +#endif /* DEBUG || VBOX_WITH_STATISTICS */ + } + + LogBird(("ata: %x: leaving critsect\n", pCtl->IOPortBase1)); + PDMCritSectLeave(&pCtl->lock); + } + + /* Cleanup the state. */ + if (pCtl->AsyncIOSem) + { + RTSemEventDestroy(pCtl->AsyncIOSem); + pCtl->AsyncIOSem = NIL_RTSEMEVENT; + } + if (pCtl->SuspendIOSem) + { + RTSemEventDestroy(pCtl->SuspendIOSem); + pCtl->SuspendIOSem = NIL_RTSEMEVENT; + } + /* Do not destroy request mutex yet, still needed for proper shutdown. */ + pCtl->fShutdown = false; + /* This must be last, as it also signals thread exit to EMT. */ + pCtl->AsyncIOThread = NIL_RTTHREAD; + + Log2(("%s: Ctl: return %Rrc\n", __FUNCTION__, rc)); + return rc; +} + +#endif /* IN_RING3 */ + +static uint32_t ataBMDMACmdReadB(PAHCIATACONTROLLER pCtl, uint32_t addr) +{ + uint32_t val = pCtl->BmDma.u8Cmd; + Log2(("%s: addr=%#06x val=%#04x\n", __FUNCTION__, addr, val)); + return val; +} + + +static void ataBMDMACmdWriteB(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t val) +{ + Log2(("%s: addr=%#06x val=%#04x\n", __FUNCTION__, addr, val)); + if (!(val & BM_CMD_START)) + { + pCtl->BmDma.u8Status &= ~BM_STATUS_DMAING; + pCtl->BmDma.u8Cmd = val & (BM_CMD_START | BM_CMD_WRITE); + } + else + { +#ifdef IN_RING3 + /* Check whether the guest OS wants to change DMA direction in + * mid-flight. Not allowed, according to the AHCI specs. */ + Assert(!(pCtl->BmDma.u8Status & BM_STATUS_DMAING) || !((val ^ pCtl->BmDma.u8Cmd) & 0x04)); + pCtl->BmDma.u8Status |= BM_STATUS_DMAING; + pCtl->BmDma.u8Cmd = val & (BM_CMD_START | BM_CMD_WRITE); + + /* Do not continue DMA transfers while the RESET line is asserted. */ + if (pCtl->fReset) + { + Log2(("%s: Ctl: suppressed continuing DMA transfer as RESET is active\n", __FUNCTION__)); + return; + } + + /* Do not start DMA transfers if there's a PIO transfer going on. */ + if (!pCtl->aIfs[pCtl->iSelectedIf].fDMA) + return; + + if (pCtl->aIfs[pCtl->iAIOIf].uATARegStatus & ATA_STAT_DRQ) + { + Log2(("%s: Ctl: message to async I/O thread, continuing DMA transfer\n", __FUNCTION__)); + ataAsyncIOPutRequest(pCtl, &ataDMARequest); + } +#else /* !IN_RING3 */ + AssertMsgFailed(("DMA START handling is too complicated for GC\n")); +#endif /* IN_RING3 */ + } +} + +static uint32_t ataBMDMAStatusReadB(PAHCIATACONTROLLER pCtl, uint32_t addr) +{ + uint32_t val = pCtl->BmDma.u8Status; + Log2(("%s: addr=%#06x val=%#04x\n", __FUNCTION__, addr, val)); + return val; +} + +static void ataBMDMAStatusWriteB(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t val) +{ + Log2(("%s: addr=%#06x val=%#04x\n", __FUNCTION__, addr, val)); + pCtl->BmDma.u8Status = (val & (BM_STATUS_D0DMA | BM_STATUS_D1DMA)) + | (pCtl->BmDma.u8Status & BM_STATUS_DMAING) + | (pCtl->BmDma.u8Status & ~val & (BM_STATUS_ERROR | BM_STATUS_INT)); +} + +static uint32_t ataBMDMAAddrReadL(PAHCIATACONTROLLER pCtl, uint32_t addr) +{ + uint32_t val = (uint32_t)pCtl->BmDma.pvAddr; + Log2(("%s: addr=%#06x val=%#010x\n", __FUNCTION__, addr, val)); + return val; +} + +static void ataBMDMAAddrWriteL(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t val) +{ + Log2(("%s: addr=%#06x val=%#010x\n", __FUNCTION__, addr, val)); + pCtl->BmDma.pvAddr = val & ~3; +} + +static void ataBMDMAAddrWriteLowWord(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t val) +{ + Log2(("%s: addr=%#06x val=%#010x\n", __FUNCTION__, addr, val)); + pCtl->BmDma.pvAddr = (pCtl->BmDma.pvAddr & 0xFFFF0000) | RT_LOWORD(val & ~3); + +} + +static void ataBMDMAAddrWriteHighWord(PAHCIATACONTROLLER pCtl, uint32_t addr, uint32_t val) +{ + Log2(("%s: addr=%#06x val=%#010x\n", __FUNCTION__, addr, val)); + pCtl->BmDma.pvAddr = (RT_LOWORD(val) << 16) | RT_LOWORD(pCtl->BmDma.pvAddr); +} + +#define VAL(port, size) ( ((port) & 7) | ((size) << 3) ) + +/** + * Port I/O Handler for bus master DMA IN operations. + * @see FNIOMIOPORTIN for details. + */ +int ataControllerBMDMAIOPortRead(PAHCIATACONTROLLER pCtl, RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + int rc; + + rc = PDMCritSectEnter(&pCtl->lock, VINF_IOM_HC_IOPORT_READ); + if (rc != VINF_SUCCESS) + return rc; + switch (VAL(Port, cb)) + { + case VAL(0, 1): *pu32 = ataBMDMACmdReadB(pCtl, Port); break; + case VAL(0, 2): *pu32 = ataBMDMACmdReadB(pCtl, Port); break; + case VAL(2, 1): *pu32 = ataBMDMAStatusReadB(pCtl, Port); break; + case VAL(2, 2): *pu32 = ataBMDMAStatusReadB(pCtl, Port); break; + case VAL(4, 4): *pu32 = ataBMDMAAddrReadL(pCtl, Port); break; + default: + AssertMsgFailed(("%s: Unsupported read from port %x size=%d\n", __FUNCTION__, Port, cb)); + PDMCritSectLeave(&pCtl->lock); + return VERR_IOM_IOPORT_UNUSED; + } + PDMCritSectLeave(&pCtl->lock); + return rc; +} + +/** + * Port I/O Handler for bus master DMA OUT operations. + * @see FNIOMIOPORTOUT for details. + */ +int ataControllerBMDMAIOPortWrite(PAHCIATACONTROLLER pCtl, RTIOPORT Port, uint32_t u32, unsigned cb) +{ + int rc; + + rc = PDMCritSectEnter(&pCtl->lock, VINF_IOM_HC_IOPORT_WRITE); + if (rc != VINF_SUCCESS) + return rc; + switch (VAL(Port, cb)) + { + case VAL(0, 1): +#ifndef IN_RING3 + if (u32 & BM_CMD_START) + { + rc = VINF_IOM_HC_IOPORT_WRITE; + break; + } +#endif /* !IN_RING3 */ + ataBMDMACmdWriteB(pCtl, Port, u32); + break; + case VAL(2, 1): ataBMDMAStatusWriteB(pCtl, Port, u32); break; + case VAL(4, 4): ataBMDMAAddrWriteL(pCtl, Port, u32); break; + case VAL(4, 2): ataBMDMAAddrWriteLowWord(pCtl, Port, u32); break; + case VAL(6, 2): ataBMDMAAddrWriteHighWord(pCtl, Port, u32); break; + default: AssertMsgFailed(("%s: Unsupported write to port %x size=%d val=%x\n", __FUNCTION__, Port, cb, u32)); break; + } + PDMCritSectLeave(&pCtl->lock); + return rc; +} + +#undef VAL + + +#ifdef IN_RING3 +#if 0 + +/** + * Callback function for mapping an PCI I/O region. + * + * @return VBox status code. + * @param pPciDev Pointer to PCI device. Use pPciDev->pDevIns to get the device instance. + * @param iRegion The region number. + * @param GCPhysAddress Physical address of the region. If iType is PCI_ADDRESS_SPACE_IO, this is an + * I/O port, else it's a physical address. + * This address is *NOT* relative to pci_mem_base like earlier! + * @param enmType One of the PCI_ADDRESS_SPACE_* values. + */ +static DECLCALLBACK(int) ataBMDMAIORangeMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType) +{ + PCIATAState *pThis = PCIDEV_2_PCIATASTATE(pPciDev); + int rc = VINF_SUCCESS; + Assert(enmType == PCI_ADDRESS_SPACE_IO); + Assert(iRegion == 4); + AssertMsg(RT_ALIGN(GCPhysAddress, 8) == GCPhysAddress, ("Expected 8 byte alignment. GCPhysAddress=%#x\n", GCPhysAddress)); + + /* Register the port range. */ + for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCts); i++) + { + int rc2 = PDMDevHlpIOPortRegister(pPciDev->pDevIns, (RTIOPORT)GCPhysAddress + i * 8, 8, + (RTHCPTR)i, ataBMDMAIOPortWrite, ataBMDMAIOPortRead, NULL, NULL, "ATA Bus Master DMA"); + AssertRC(rc2); + if (rc2 < rc) + rc = rc2; + + if (pThis->fGCEnabled) + { + rc2 = PDMDevHlpIOPortRegisterGC(pPciDev->pDevIns, (RTIOPORT)GCPhysAddress + i * 8, 8, + (RTGCPTR)i, "ataBMDMAIOPortWrite", "ataBMDMAIOPortRead", NULL, NULL, "ATA Bus Master DMA"); + AssertRC(rc2); + if (rc2 < rc) + rc = rc2; + } + if (pThis->fR0Enabled) + { + rc2 = PDMDevHlpIOPortRegisterR0(pPciDev->pDevIns, (RTIOPORT)GCPhysAddress + i * 8, 8, + (RTR0PTR)i, "ataBMDMAIOPortWrite", "ataBMDMAIOPortRead", NULL, NULL, "ATA Bus Master DMA"); + AssertRC(rc2); + if (rc2 < rc) + rc = rc2; + } + } + return rc; +} +#endif + +/** + * Reset the controller to an intial state. + * + * @returns VBox status. + * @param pDevIns The device instance data. + */ +void ataControllerReset(PAHCIATACONTROLLER pCtl) +{ + pCtl->iSelectedIf = 0; + pCtl->iAIOIf = 0; + pCtl->BmDma.u8Cmd = 0; + /* Report that both drives present on the bus are in DMA mode. This + * pretends that there is a BIOS that has set it up. Normal reset + * default is 0x00. */ + pCtl->BmDma.u8Status = (pCtl->aIfs[0].pDrvBase != NULL ? BM_STATUS_D0DMA : 0) + | (pCtl->aIfs[1].pDrvBase != NULL ? BM_STATUS_D1DMA : 0); + pCtl->BmDma.pvAddr = 0; + + pCtl->fReset = true; + pCtl->fRedo = false; + pCtl->fRedoIdle = false; + ataAsyncIOClearRequests(pCtl); + Log2(("%s: Ctl: message to async I/O thread, reset controller\n", __FUNCTION__)); + ataAsyncIOPutRequest(pCtl, &ataResetARequest); + ataAsyncIOPutRequest(pCtl, &ataResetCRequest); + if (!ataWaitForAsyncIOIsIdle(pCtl, 30000)) + AssertReleaseMsgFailed(("Async I/O thread busy after reset\n")); + + for (uint32_t i = 0; i < RT_ELEMENTS(pCtl->aIfs); i++) + ataResetDevice(&pCtl->aIfs[i]); +} + +#if 0 +/* -=-=-=-=-=- AHCIATADevState::IBase -=-=-=-=-=- */ + +/** + * Queries an interface to the driver. + * + * @returns Pointer to interface. + * @returns NULL if the interface was not supported by the device. + * @param pInterface Pointer to AHCIATADevState::IBase. + * @param enmInterface The requested interface identification. + */ +static DECLCALLBACK(void *) ataQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) +{ + AHCIATADevState *pIf = PDMIBASE_2_ATASTATE(pInterface); + switch (enmInterface) + { + case PDMINTERFACE_BASE: + return &pIf->IBase; + case PDMINTERFACE_BLOCK_PORT: + return &pIf->IPort; + case PDMINTERFACE_MOUNT_NOTIFY: + return &pIf->IMountNotify; + default: + return NULL; + } +} +#endif +#endif /* IN_RING3 */ + + +/* -=-=-=-=-=- Wrappers -=-=-=-=-=- */ + +/** + * Port I/O Handler for primary port range OUT operations. + * @see FNIOMIOPORTOUT for details. + */ +int ataControllerIOPortWrite1(PAHCIATACONTROLLER pCtl, RTIOPORT Port, uint32_t u32, unsigned cb) +{ + int rc = VINF_SUCCESS; + + rc = PDMCritSectEnter(&pCtl->lock, VINF_IOM_HC_IOPORT_WRITE); + if (rc != VINF_SUCCESS) + return rc; + if (cb == 1) + rc = ataIOPortWriteU8(pCtl, Port, u32); + else if (Port == pCtl->IOPortBase1) + { + Assert(cb == 2 || cb == 4); + rc = ataDataWrite(pCtl, Port, cb, (const uint8_t *)&u32); + } + else + AssertMsgFailed(("ataIOPortWrite1: unsupported write to port %x val=%x size=%d\n", Port, u32, cb)); + LogBird(("ata: leaving critsect\n")); + PDMCritSectLeave(&pCtl->lock); + LogBird(("ata: left critsect\n")); + return rc; +} + + +/** + * Port I/O Handler for primary port range IN operations. + * @see FNIOMIOPORTIN for details. + */ +int ataControllerIOPortRead1(PAHCIATACONTROLLER pCtl, RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + int rc = VINF_SUCCESS; + + rc = PDMCritSectEnter(&pCtl->lock, VINF_IOM_HC_IOPORT_READ); + if (rc != VINF_SUCCESS) + return rc; + if (cb == 1) + { + rc = ataIOPortReadU8(pCtl, Port, pu32); + } + else if (Port == pCtl->IOPortBase1) + { + Assert(cb == 2 || cb == 4); + rc = ataDataRead(pCtl, Port, cb, (uint8_t *)pu32); + if (cb == 2) + *pu32 &= 0xffff; + } + else + { + AssertMsgFailed(("ataIOPortRead1: unsupported read from port %x size=%d\n", Port, cb)); + rc = VERR_IOM_IOPORT_UNUSED; + } + PDMCritSectLeave(&pCtl->lock); + return rc; +} + +#ifndef IN_RING0 /** @todo do this in ring-0 as well. */ +/** + * Port I/O Handler for primary port range IN string operations. + * @see FNIOMIOPORTINSTRING for details. + */ +int ataControllerIOPortReadStr1(PAHCIATACONTROLLER pCtl, RTIOPORT Port, RTGCPTR *pGCPtrDst, PRTGCUINTREG pcTransfer, unsigned cb) +{ + int rc = PDMCritSectEnter(&pCtl->lock, VINF_IOM_HC_IOPORT_READ); + if (rc != VINF_SUCCESS) + return rc; + if (Port == pCtl->IOPortBase1) + { + uint32_t cTransAvailable, cTransfer = *pcTransfer, cbTransfer; + RTGCPTR GCDst = *pGCPtrDst; + AHCIATADevState *s = &pCtl->aIfs[pCtl->iSelectedIf]; + Assert(cb == 2 || cb == 4); + + cTransAvailable = (s->iIOBufferPIODataEnd - s->iIOBufferPIODataStart) / cb; +#ifndef IN_RING3 + /* The last transfer unit cannot be handled in GC, as it involves thread communication. */ + cTransAvailable--; +#endif /* !IN_RING3 */ + /* Do not handle the dummy transfer stuff here, leave it to the single-word transfers. + * They are not performance-critical and generally shouldn't occur at all. */ + if (cTransAvailable > cTransfer) + cTransAvailable = cTransfer; + cbTransfer = cTransAvailable * cb; + + PPDMDEVINS pDevIns = pCtl->CTX_SUFF(pDevIns); + rc = PGMPhysSimpleDirtyWriteGCPtr(PDMDevHlpGetVMCPU(pDevIns), GCDst, s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart, cbTransfer); + Assert(rc == VINF_SUCCESS); + + if (cbTransfer) + Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, Port, cbTransfer, s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart)); + s->iIOBufferPIODataStart += cbTransfer; + *pGCPtrDst = (RTGCPTR)((RTGCUINTPTR)GCDst + cbTransfer); + *pcTransfer = cTransfer - cTransAvailable; +#ifdef IN_RING3 + if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd) + ataPIOTransferFinish(pCtl, s); +#endif /* IN_RING3 */ + } + PDMCritSectLeave(&pCtl->lock); + return rc; +} + + +/** + * Port I/O Handler for primary port range OUT string operations. + * @see FNIOMIOPORTOUTSTRING for details. + */ +int ataControllerIOPortWriteStr1(PAHCIATACONTROLLER pCtl, RTIOPORT Port, RTGCPTR *pGCPtrSrc, PRTGCUINTREG pcTransfer, unsigned cb) +{ + int rc = PDMCritSectEnter(&pCtl->lock, VINF_IOM_HC_IOPORT_WRITE); + if (rc != VINF_SUCCESS) + return rc; + if (Port == pCtl->IOPortBase1) + { + uint32_t cTransAvailable, cTransfer = *pcTransfer, cbTransfer; + RTGCPTR GCSrc = *pGCPtrSrc; + AHCIATADevState *s = &pCtl->aIfs[pCtl->iSelectedIf]; + Assert(cb == 2 || cb == 4); + + cTransAvailable = (s->iIOBufferPIODataEnd - s->iIOBufferPIODataStart) / cb; +#ifndef IN_RING3 + /* The last transfer unit cannot be handled in GC, as it involves thread communication. */ + cTransAvailable--; +#endif /* !IN_RING3 */ + /* Do not handle the dummy transfer stuff here, leave it to the single-word transfers. + * They are not performance-critical and generally shouldn't occur at all. */ + if (cTransAvailable > cTransfer) + cTransAvailable = cTransfer; + cbTransfer = cTransAvailable * cb; + + PPDMDEVINS pDevIns = pCtl->CTX_SUFF(pDevIns); + rc = PGMPhysSimpleReadGCPtr(PDMDevHlpGetVMCPU(pDevIns), s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart, GCSrc, cbTransfer); + Assert(rc == VINF_SUCCESS); + + if (cbTransfer) + Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, Port, cbTransfer, s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart)); + s->iIOBufferPIODataStart += cbTransfer; + *pGCPtrSrc = (RTGCPTR)((RTGCUINTPTR)GCSrc + cbTransfer); + *pcTransfer = cTransfer - cTransAvailable; +#ifdef IN_RING3 + if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd) + ataPIOTransferFinish(pCtl, s); +#endif /* IN_RING3 */ + } + PDMCritSectLeave(&pCtl->lock); + return rc; +} +#endif /* !IN_RING0 */ + +/** + * Port I/O Handler for secondary port range OUT operations. + * @see FNIOMIOPORTOUT for details. + */ +int ataControllerIOPortWrite2(PAHCIATACONTROLLER pCtl, RTIOPORT Port, uint32_t u32, unsigned cb) +{ + int rc; + + if (cb != 1) + return VINF_SUCCESS; + rc = PDMCritSectEnter(&pCtl->lock, VINF_IOM_HC_IOPORT_WRITE); + if (rc != VINF_SUCCESS) + return rc; + rc = ataControlWrite(pCtl, Port, u32); + PDMCritSectLeave(&pCtl->lock); + return rc; +} + + +/** + * Port I/O Handler for secondary port range IN operations. + * @see FNIOMIOPORTIN for details. + */ +int ataControllerIOPortRead2(PAHCIATACONTROLLER pCtl, RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + int rc; + + if (cb != 1) + return VERR_IOM_IOPORT_UNUSED; + + rc = PDMCritSectEnter(&pCtl->lock, VINF_IOM_HC_IOPORT_READ); + if (rc != VINF_SUCCESS) + return rc; + *pu32 = ataStatusRead(pCtl, Port); + PDMCritSectLeave(&pCtl->lock); + return VINF_SUCCESS; +} + +#ifdef IN_RING3 + +/** + * Waits for all async I/O threads to complete whatever they + * are doing at the moment. + * + * @returns true on success. + * @returns false when one or more threads is still processing. + * @param pThis Pointer to the instance data. + * @param cMillies How long to wait (total). + */ +static bool ataWaitForAllAsyncIOIsIdle(PAHCIATACONTROLLER pCtl, unsigned cMillies) +{ + uint64_t u64Start; + PPDMDEVINS pDevIns = pCtl->CTXALLSUFF(pDevIns); + bool fAllIdle = false; + + /* + * Wait for any pending async operation to finish + */ + u64Start = RTTimeMilliTS(); + for (;;) + { + /* Check all async I/O threads. */ + fAllIdle = true; + + fAllIdle &= ataAsyncIOIsIdle(pCtl, false); + if (!fAllIdle) + break; + + if ( fAllIdle + || RTTimeMilliTS() - u64Start >= cMillies) + break; + + /* Sleep for a bit. */ + RTThreadSleep(100); + } + + if (!fAllIdle) + LogRel(("ATA: Ctl is still executing, DevSel=%d AIOIf=%d CmdIf0=%#04x CmdIf1=%#04x\n", + pCtl->iSelectedIf, pCtl->iAIOIf, + pCtl->aIfs[0].uATARegCommand, pCtl->aIfs[1].uATARegCommand)); + + return fAllIdle; +} + + +DECLINLINE(void) ataRelocBuffer(PPDMDEVINS pDevIns, AHCIATADevState *s) +{ + if (s->pbIOBufferR3) + s->pbIOBufferRC = MMHyperR3ToRC(PDMDevHlpGetVM(pDevIns), s->pbIOBufferR3); +} + + +/** + * @copydoc FNPDMDEVRELOCATE + */ +void ataControllerRelocate(PAHCIATACONTROLLER pCtl, RTGCINTPTR offDelta) +{ + PPDMDEVINS pDevIns = pCtl->CTXALLSUFF(pDevIns); + + pCtl->pDevInsRC += offDelta; + pCtl->aIfs[0].pDevInsRC += offDelta; + pCtl->aIfs[0].pControllerRC += offDelta; + ataRelocBuffer(pDevIns, &pCtl->aIfs[0]); + pCtl->aIfs[1].pDevInsRC += offDelta; + pCtl->aIfs[1].pControllerRC += offDelta; + ataRelocBuffer(pDevIns, &pCtl->aIfs[1]); +} + + +/** + * Destroy a controller instance. + * + * Most VM resources are freed by the VM. This callback is provided so that any non-VM + * resources can be freed correctly. + * + * @param pCtl The controller instance. + */ +int ataControllerDestroy(PAHCIATACONTROLLER pCtl) +{ + int rc; + + Log(("%s:\n", __FUNCTION__)); + + /* + * Terminate all async helper threads + */ + if (pCtl->AsyncIOThread != NIL_RTTHREAD) + { + ASMAtomicXchgU32(&pCtl->fShutdown, true); + rc = RTSemEventSignal(pCtl->AsyncIOSem); + AssertRC(rc); + } + + if (pCtl->CTX_SUFF(pDevIns)) + { + /* + * Wait for them to complete whatever they are doing and then + * for them to terminate. + */ + if (ataWaitForAllAsyncIOIsIdle(pCtl, 20000)) + { + uint64_t u64Start = RTTimeMilliTS(); + bool fAllDone; + for (;;) + { + /* check */ + fAllDone = true; + fAllDone &= (pCtl->AsyncIOThread == NIL_RTTHREAD); + + if ( fAllDone + || RTTimeMilliTS() - u64Start >= 500) + break; + + /* Sleep for a bit. */ + RTThreadSleep(100); + } + AssertMsg(fAllDone, ("Some of the async I/O threads are still running!\n")); + } + else + AssertMsgFailed(("Async I/O is still busy!\n")); + } + + /* + * Now the request mutexes are no longer needed. Free resources. + */ + if (pCtl->AsyncIORequestMutex) + { + RTSemMutexDestroy(pCtl->AsyncIORequestMutex); + pCtl->AsyncIORequestMutex = NIL_RTSEMEVENT; + } + + return VINF_SUCCESS; +} + +#if 0 +/** + * Detach notification. + * + * The DVD drive has been unplugged. + * + * @param pDevIns The device instance. + * @param iLUN The logical unit which is being detached. + */ +static DECLCALLBACK(void) ataDetach(PPDMDEVINS pDevIns, unsigned iLUN) +{ + PCIATAState *pThis = PDMINS_2_DATA(pDevIns, PCIATAState *); + PAHCIATACONTROLLER pCtl; + AHCIATADevState *pIf; + unsigned iController; + unsigned iInterface; + + /* + * Locate the controller and stuff. + */ + iController = iLUN / RT_ELEMENTS(pThis->aCts[0].aIfs); + AssertReleaseMsg(iController < RT_ELEMENTS(pThis->aCts), ("iController=%d iLUN=%d\n", iController, iLUN)); + pCtl = &pThis->aCts[iController]; + + iInterface = iLUN % RT_ELEMENTS(pThis->aCts[0].aIfs); + pIf = &pCtl->aIfs[iInterface]; + + /* + * Zero some important members. + */ + pIf->pDrvBase = NULL; + pIf->pDrvBlock = NULL; + pIf->pDrvBlockBios = NULL; + pIf->pDrvMount = NULL; + + /* + * Just in case there was a medium inserted. Only required when attached to a physical drive + * in passthrough mode as in virtual ATAPI mode we've got an unmount notification. + */ + if (pIf->fATAPIPassthrough) + ataMediumRemoved(pIf); + +} +#endif + +/** + * Configure a LUN. + * + * @returns VBox status code. + * @param pDevIns The device instance. + * @param pIf The ATA unit state. + */ +static int ataConfigLun(PPDMDEVINS pDevIns, AHCIATADevState *pIf) +{ + int rc; + PDMBLOCKTYPE enmType; + + /* + * Query Block, Bios and Mount interfaces. + */ + pIf->pDrvBlock = (PDMIBLOCK *)pIf->pDrvBase->pfnQueryInterface(pIf->pDrvBase, PDMINTERFACE_BLOCK); + if (!pIf->pDrvBlock) + { + AssertMsgFailed(("Configuration error: LUN#%d hasn't a block interface!\n", pIf->iLUN)); + return VERR_PDM_MISSING_INTERFACE; + } + + /** @todo implement the BIOS invisible code path. */ + pIf->pDrvBlockBios = (PDMIBLOCKBIOS *)pIf->pDrvBase->pfnQueryInterface(pIf->pDrvBase, PDMINTERFACE_BLOCK_BIOS); + if (!pIf->pDrvBlockBios) + { + AssertMsgFailed(("Configuration error: LUN#%d hasn't a block BIOS interface!\n", pIf->iLUN)); + return VERR_PDM_MISSING_INTERFACE; + } + pIf->pDrvMount = (PDMIMOUNT *)pIf->pDrvBase->pfnQueryInterface(pIf->pDrvBase, PDMINTERFACE_MOUNT); + + /* + * Validate type. + */ + enmType = pIf->pDrvBlock->pfnGetType(pIf->pDrvBlock); + if ( enmType != PDMBLOCKTYPE_CDROM + && enmType != PDMBLOCKTYPE_DVD + && enmType != PDMBLOCKTYPE_HARD_DISK) + { + AssertMsgFailed(("Configuration error: LUN#%d isn't a disk or cd/dvd-rom. enmType=%d\n", pIf->iLUN, enmType)); + return VERR_PDM_UNSUPPORTED_BLOCK_TYPE; + } + if ( ( enmType == PDMBLOCKTYPE_DVD + || enmType == PDMBLOCKTYPE_CDROM) + && !pIf->pDrvMount) + { + AssertMsgFailed(("Internal error: cdrom without a mountable interface, WTF???!\n")); + return VERR_INTERNAL_ERROR; + } + pIf->fATAPI = enmType == PDMBLOCKTYPE_DVD || enmType == PDMBLOCKTYPE_CDROM; + pIf->fATAPIPassthrough = pIf->fATAPI ? (pIf->pDrvBlock->pfnSendCmd != NULL) : false; + + /* + * Allocate I/O buffer. + */ + PVM pVM = PDMDevHlpGetVM(pDevIns); + if (pIf->cbIOBuffer) + { + /* Buffer is (probably) already allocated. Validate the fields, + * because memory corruption can also overwrite pIf->cbIOBuffer. */ + if (pIf->fATAPI) + AssertRelease(pIf->cbIOBuffer == _128K); + else + AssertRelease(pIf->cbIOBuffer == ATA_MAX_MULT_SECTORS * 512); + Assert(pIf->pbIOBufferR3); + Assert(pIf->pbIOBufferR0 == MMHyperR3ToR0(pVM, pIf->pbIOBufferR3)); + Assert(pIf->pbIOBufferRC == MMHyperR3ToRC(pVM, pIf->pbIOBufferR3)); + } + else + { + if (pIf->fATAPI) + pIf->cbIOBuffer = _128K; + else + pIf->cbIOBuffer = ATA_MAX_MULT_SECTORS * 512; + Assert(!pIf->pbIOBufferR3); + rc = MMR3HyperAllocOnceNoRel(pVM, pIf->cbIOBuffer, 0, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBufferR3); + if (RT_FAILURE(rc)) + return VERR_NO_MEMORY; + pIf->pbIOBufferR0 = MMHyperR3ToR0(pVM, pIf->pbIOBufferR3); + pIf->pbIOBufferRC = MMHyperR3ToRC(pVM, pIf->pbIOBufferR3); + } + + /* + * Init geometry (only for non-CD/DVD media). + */ + if (pIf->fATAPI) + { + pIf->cTotalSectors = pIf->pDrvBlock->pfnGetSize(pIf->pDrvBlock) / 2048; + pIf->PCHSGeometry.cCylinders = 0; /* dummy */ + pIf->PCHSGeometry.cHeads = 0; /* dummy */ + pIf->PCHSGeometry.cSectors = 0; /* dummy */ + LogRel(("ATA: LUN#%d: CD/DVD, total number of sectors %Ld, passthrough %s\n", pIf->iLUN, pIf->cTotalSectors, (pIf->fATAPIPassthrough ? "enabled" : "disabled"))); + } + else + { + pIf->cTotalSectors = pIf->pDrvBlock->pfnGetSize(pIf->pDrvBlock) / 512; + rc = pIf->pDrvBlockBios->pfnGetPCHSGeometry(pIf->pDrvBlockBios, + &pIf->PCHSGeometry); + if (rc == VERR_PDM_MEDIA_NOT_MOUNTED) + { + pIf->PCHSGeometry.cCylinders = 0; + pIf->PCHSGeometry.cHeads = 16; /*??*/ + pIf->PCHSGeometry.cSectors = 63; /*??*/ + } + else if (rc == VERR_PDM_GEOMETRY_NOT_SET) + { + pIf->PCHSGeometry.cCylinders = 0; /* autodetect marker */ + rc = VINF_SUCCESS; + } + AssertRC(rc); + + if ( pIf->PCHSGeometry.cCylinders == 0 + || pIf->PCHSGeometry.cHeads == 0 + || pIf->PCHSGeometry.cSectors == 0 + ) + { + uint64_t cCylinders = pIf->cTotalSectors / (16 * 63); + pIf->PCHSGeometry.cCylinders = RT_MAX(RT_MIN(cCylinders, 16383), 1); + pIf->PCHSGeometry.cHeads = 16; + pIf->PCHSGeometry.cSectors = 63; + /* Set the disk geometry information. */ + rc = pIf->pDrvBlockBios->pfnSetPCHSGeometry(pIf->pDrvBlockBios, + &pIf->PCHSGeometry); + } + LogRel(("AHCI ATA: LUN#%d: disk, PCHS=%u/%u/%u, total number of sectors %Ld\n", pIf->iLUN, pIf->PCHSGeometry.cCylinders, pIf->PCHSGeometry.cHeads, pIf->PCHSGeometry.cSectors, pIf->cTotalSectors)); + } + return VINF_SUCCESS; +} + +#if 0 +/** + * Attach command. + * + * This is called when we change block driver for the DVD drive. + * + * @returns VBox status code. + * @param pDevIns The device instance. + * @param iLUN The logical unit which is being detached. + */ +static DECLCALLBACK(int) ataAttach(PPDMDEVINS pDevIns, unsigned iLUN) +{ + PCIATAState *pThis = PDMINS_2_DATA(pDevIns, PCIATAState *); + PAHCIATACONTROLLER pCtl; + AHCIATADevState *pIf; + int rc; + unsigned iController; + unsigned iInterface; + + /* + * Locate the controller and stuff. + */ + iController = iLUN / RT_ELEMENTS(pThis->aCts[0].aIfs); + AssertReleaseMsg(iController < RT_ELEMENTS(pThis->aCts), ("iController=%d iLUN=%d\n", iController, iLUN)); + pCtl = &pThis->aCts[iController]; + + iInterface = iLUN % RT_ELEMENTS(pThis->aCts[0].aIfs); + pIf = &pCtl->aIfs[iInterface]; + + /* the usual paranoia */ + AssertRelease(!pIf->pDrvBase); + AssertRelease(!pIf->pDrvBlock); + Assert(ATADEVSTATE_2_CONTROLLER(pIf) == pCtl); + Assert(pIf->iLUN == iLUN); + + /* + * Try attach the block device and get the interfaces, + * required as well as optional. + */ + rc = PDMDevHlpDriverAttach(pDevIns, pIf->iLUN, &pIf->IBase, &pIf->pDrvBase, NULL); + if (RT_SUCCESS(rc)) + { + rc = ataConfigLun(pDevIns, pIf); + /* + * In case there is a new medium inserted. In virtual ATAPI mode we get an mount + * notification. + */ + if (pIf->fATAPIPassthrough) + ataMediumInserted(pIf); + } + else + AssertMsgFailed(("Failed to attach LUN#%d. rc=%Rrc\n", pIf->iLUN, rc)); + + if (RT_FAILURE(rc)) + { + pIf->pDrvBase = NULL; + pIf->pDrvBlock = NULL; + } + return rc; +} +#endif + +/** + * Suspend notification. + * + * @returns VBox status. + * @param pDevIns The device instance data. + */ +void ataControllerSuspend(PAHCIATACONTROLLER pCtl) +{ + Log(("%s:\n", __FUNCTION__)); + if (!ataWaitForAllAsyncIOIsIdle(pCtl, 20000)) + AssertMsgFailed(("Async I/O didn't stop in 20 seconds!\n")); + return; +} + + +/** + * Resume notification. + * + * @returns VBox status. + * @param pDevIns The device instance data. + */ +void ataControllerResume(PAHCIATACONTROLLER pCtl) +{ + int rc; + + Log(("%s:\n", __FUNCTION__)); + if (pCtl->fRedo && pCtl->fRedoIdle) + { + rc = RTSemEventSignal(pCtl->SuspendIOSem); + AssertRC(rc); + } + + return; +} + + +/** + * Power Off notification. + * + * @returns VBox status. + * @param pCtl The controller instance. + */ +void ataControllerPowerOff(PAHCIATACONTROLLER pCtl) +{ + Log(("%s:\n", __FUNCTION__)); + if (!ataWaitForAllAsyncIOIsIdle(pCtl, 20000)) + AssertMsgFailed(("Async I/O didn't stop in 20 seconds!\n")); + return; +} + +/** + * Prepare state save and load operation. + * + * @returns VBox status code. + * @param pDevIns Device instance of the device which registered the data unit. + * @param pSSM SSM operation handle. + */ +static int ataSaveLoadPrep(PAHCIATACONTROLLER pCtl) +{ + /* sanity - the suspend notification will wait on the async stuff. */ + Assert(ataAsyncIOIsIdle(pCtl, false)); + if (!ataAsyncIOIsIdle(pCtl, false)) + return VERR_SSM_IDE_ASYNC_TIMEOUT; + + return VINF_SUCCESS; +} + +/** + * Prepare state save operation. + * + * @returns VBox status code. + * @param pCtl The controller instance. + * @param pSSM SSM operation handle. + */ +DECLCALLBACK(int) ataControllerSavePrep(PAHCIATACONTROLLER pCtl, PSSMHANDLE pSSM) +{ + return ataSaveLoadPrep(pCtl); +} + +/** + * Prepare state load operation. + * + * @returns VBox status code. + * @param pCtl The controller instance. + * @param pSSM SSM operation handle. + */ +DECLCALLBACK(int) ataControllerLoadPrep(PAHCIATACONTROLLER pCtl, PSSMHANDLE pSSM) +{ + return ataSaveLoadPrep(pCtl); +} + +/** + * Saves a state of the ATA device. + * + * @returns VBox status code. + * @param pCtl Controller instance. + * @param pSSMHandle The handle to save the state to. + */ +int ataControllerSaveExec(PAHCIATACONTROLLER pCtl, PSSMHANDLE pSSMHandle) +{ + SSMR3PutU32(pSSMHandle, ATA_CTL_SAVED_STATE_VERSION); + SSMR3PutU8(pSSMHandle, pCtl->iSelectedIf); + SSMR3PutU8(pSSMHandle, pCtl->iAIOIf); + SSMR3PutU8(pSSMHandle, pCtl->uAsyncIOState); + SSMR3PutBool(pSSMHandle, pCtl->fChainedTransfer); + SSMR3PutBool(pSSMHandle, pCtl->fReset); + SSMR3PutBool(pSSMHandle, pCtl->fRedo); + SSMR3PutBool(pSSMHandle, pCtl->fRedoIdle); + SSMR3PutBool(pSSMHandle, pCtl->fRedoDMALastDesc); + SSMR3PutMem(pSSMHandle, &pCtl->BmDma, sizeof(pCtl->BmDma)); + SSMR3PutGCPhys32(pSSMHandle, pCtl->pFirstDMADesc); + SSMR3PutGCPhys32(pSSMHandle, pCtl->pLastDMADesc); + SSMR3PutGCPhys32(pSSMHandle, pCtl->pRedoDMABuffer); + SSMR3PutU32(pSSMHandle, pCtl->cbRedoDMABuffer); + + for (uint32_t j = 0; j < RT_ELEMENTS(pCtl->aIfs); j++) + { + SSMR3PutBool(pSSMHandle, pCtl->aIfs[j].fLBA48); + SSMR3PutBool(pSSMHandle, pCtl->aIfs[j].fATAPI); + SSMR3PutBool(pSSMHandle, pCtl->aIfs[j].fIrqPending); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].cMultSectors); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].PCHSGeometry.cCylinders); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].PCHSGeometry.cHeads); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].PCHSGeometry.cSectors); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].cSectorsPerIRQ); + SSMR3PutU64(pSSMHandle, pCtl->aIfs[j].cTotalSectors); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegFeature); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegFeatureHOB); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegError); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegNSector); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegNSectorHOB); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegSector); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegSectorHOB); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegLCyl); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegLCylHOB); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegHCyl); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegHCylHOB); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegSelect); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegStatus); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegCommand); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATARegDevCtl); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uATATransferMode); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].uTxDir); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].iBeginTransfer); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].iSourceSink); + SSMR3PutBool(pSSMHandle, pCtl->aIfs[j].fDMA); + SSMR3PutBool(pSSMHandle, pCtl->aIfs[j].fATAPITransfer); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].cbTotalTransfer); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].cbElementaryTransfer); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].iIOBufferCur); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].iIOBufferEnd); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].iIOBufferPIODataStart); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].iIOBufferPIODataEnd); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].iATAPILBA); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].cbATAPISector); + SSMR3PutMem(pSSMHandle, &pCtl->aIfs[j].aATAPICmd, sizeof(pCtl->aIfs[j].aATAPICmd)); + SSMR3PutMem(pSSMHandle, &pCtl->aIfs[j].abATAPISense, sizeof(pCtl->aIfs[j].abATAPISense)); + SSMR3PutU8(pSSMHandle, pCtl->aIfs[j].cNotifiedMediaChange); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].MediaEventStatus); + SSMR3PutMem(pSSMHandle, pCtl->aIfs[j].pLed, sizeof(PDMLED)); + SSMR3PutU32(pSSMHandle, pCtl->aIfs[j].cbIOBuffer); + if (pCtl->aIfs[j].cbIOBuffer) + SSMR3PutMem(pSSMHandle, pCtl->aIfs[j].CTX_SUFF(pbIOBuffer), pCtl->aIfs[j].cbIOBuffer); + else + Assert(pCtl->aIfs[j].CTX_SUFF(pbIOBuffer) == NULL); + } + + return SSMR3PutU32(pSSMHandle, ~0); /* sanity/terminator */ +} + + +/** + * Loads a saved ATA device state. + * + * @returns VBox status code. + * @param pDevIns The device instance. + * @param pSSMHandle The handle to the saved state. + */ +int ataControllerLoadExec(PAHCIATACONTROLLER pCtl, PSSMHANDLE pSSMHandle) +{ + int rc; + uint32_t u32Version; + uint32_t u32; + + /* Test for correct version. */ + rc = SSMR3GetU32(pSSMHandle, &u32Version); + AssertRCReturn(rc, rc); + + if ( u32Version != ATA_CTL_SAVED_STATE_VERSION + && u32Version != ATA_CTL_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE + && u32Version != ATA_CTL_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS) + { + AssertMsgFailed(("u32Version=%d\n", u32Version)); + return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; + } + + /* integrity check */ + if (!ataAsyncIOIsIdle(pCtl, false)) + { + AssertMsgFailed(("Async I/O for controller is active\n")); + return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; + } + + SSMR3GetU8(pSSMHandle, &pCtl->iSelectedIf); + SSMR3GetU8(pSSMHandle, &pCtl->iAIOIf); + SSMR3GetU8(pSSMHandle, &pCtl->uAsyncIOState); + SSMR3GetBool(pSSMHandle, &pCtl->fChainedTransfer); + SSMR3GetBool(pSSMHandle, (bool *)&pCtl->fReset); + SSMR3GetBool(pSSMHandle, (bool *)&pCtl->fRedo); + SSMR3GetBool(pSSMHandle, (bool *)&pCtl->fRedoIdle); + SSMR3GetBool(pSSMHandle, (bool *)&pCtl->fRedoDMALastDesc); + SSMR3GetMem(pSSMHandle, &pCtl->BmDma, sizeof(pCtl->BmDma)); + SSMR3GetGCPhys32(pSSMHandle, &pCtl->pFirstDMADesc); + SSMR3GetGCPhys32(pSSMHandle, &pCtl->pLastDMADesc); + SSMR3GetGCPhys32(pSSMHandle, &pCtl->pRedoDMABuffer); + SSMR3GetU32(pSSMHandle, &pCtl->cbRedoDMABuffer); + + for (uint32_t j = 0; j < RT_ELEMENTS(pCtl->aIfs); j++) + { + SSMR3GetBool(pSSMHandle, &pCtl->aIfs[j].fLBA48); + SSMR3GetBool(pSSMHandle, &pCtl->aIfs[j].fATAPI); + SSMR3GetBool(pSSMHandle, &pCtl->aIfs[j].fIrqPending); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].cMultSectors); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].PCHSGeometry.cCylinders); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].PCHSGeometry.cHeads); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].PCHSGeometry.cSectors); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].cSectorsPerIRQ); + SSMR3GetU64(pSSMHandle, &pCtl->aIfs[j].cTotalSectors); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegFeature); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegFeatureHOB); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegError); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegNSector); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegNSectorHOB); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegSector); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegSectorHOB); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegLCyl); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegLCylHOB); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegHCyl); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegHCylHOB); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegSelect); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegStatus); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegCommand); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATARegDevCtl); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uATATransferMode); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].uTxDir); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].iBeginTransfer); + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].iSourceSink); + SSMR3GetBool(pSSMHandle, &pCtl->aIfs[j].fDMA); + SSMR3GetBool(pSSMHandle, &pCtl->aIfs[j].fATAPITransfer); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].cbTotalTransfer); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].cbElementaryTransfer); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].iIOBufferCur); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].iIOBufferEnd); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].iIOBufferPIODataStart); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].iIOBufferPIODataEnd); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].iATAPILBA); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].cbATAPISector); + SSMR3GetMem(pSSMHandle, &pCtl->aIfs[j].aATAPICmd, sizeof(pCtl->aIfs[j].aATAPICmd)); + if (u32Version > ATA_CTL_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE) + { + SSMR3GetMem(pSSMHandle, &pCtl->aIfs[j].abATAPISense, sizeof(pCtl->aIfs[j].abATAPISense)); + } + else + { + uint8_t uATAPISenseKey, uATAPIASC; + memset(pCtl->aIfs[j].abATAPISense, '\0', sizeof(pCtl->aIfs[j].abATAPISense)); + pCtl->aIfs[j].abATAPISense[0] = 0x70 | (1 << 7); + pCtl->aIfs[j].abATAPISense[7] = 10; + SSMR3GetU8(pSSMHandle, &uATAPISenseKey); + SSMR3GetU8(pSSMHandle, &uATAPIASC); + pCtl->aIfs[j].abATAPISense[2] = uATAPISenseKey & 0x0f; + pCtl->aIfs[j].abATAPISense[12] = uATAPIASC; + } + /** @todo triple-check this hack after passthrough is working */ + SSMR3GetU8(pSSMHandle, &pCtl->aIfs[j].cNotifiedMediaChange); + if (u32Version > ATA_CTL_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS) + SSMR3GetU32(pSSMHandle, (uint32_t*)&pCtl->aIfs[j].MediaEventStatus); + else + pCtl->aIfs[j].MediaEventStatus = ATA_EVENT_STATUS_UNCHANGED; + + PDMLED Led; + SSMR3GetMem(pSSMHandle, &Led, sizeof(PDMLED)); + SSMR3GetU32(pSSMHandle, &pCtl->aIfs[j].cbIOBuffer); + if (pCtl->aIfs[j].cbIOBuffer) + { + if (pCtl->aIfs[j].CTX_SUFF(pbIOBuffer)) + SSMR3GetMem(pSSMHandle, pCtl->aIfs[j].CTX_SUFF(pbIOBuffer), pCtl->aIfs[j].cbIOBuffer); + else + { + LogRel(("ATA: No buffer for %d\n", j)); + if (SSMR3HandleGetAfter(pSSMHandle) != SSMAFTER_DEBUG_IT) + return VERR_SSM_LOAD_CONFIG_MISMATCH; + + /* skip the buffer if we're loading for the debugger / animator. */ + uint8_t u8Ignored; + size_t cbLeft = pCtl->aIfs[j].cbIOBuffer; + while (cbLeft-- > 0) + SSMR3GetU8(pSSMHandle, &u8Ignored); + } + } + else + Assert(pCtl->aIfs[j].CTX_SUFF(pbIOBuffer) == NULL); + } + + rc = SSMR3GetU32(pSSMHandle, &u32); + if (RT_FAILURE(rc)) + return rc; + if (u32 != ~0U) + { + AssertMsgFailed(("u32=%#x expected ~0\n", u32)); + rc = VERR_SSM_DATA_UNIT_FORMAT_CHANGED; + return rc; + } + + return VINF_SUCCESS; +} + +DECLCALLBACK(int) ataControllerInit(PPDMDEVINS pDevIns, PAHCIATACONTROLLER pCtl, PPDMIBASE pDrvBaseMaster, PPDMIBASE pDrvBaseSlave, + uint32_t *pcbSSMState, const char *szName, PPDMLED pLed, + PSTAMCOUNTER pStatBytesRead, PSTAMCOUNTER pStatBytesWritten) +{ + int rc; + + AssertMsg(pcbSSMState, ("pcbSSMState is invalid\n")); + + pCtl->pDevInsR3 = pDevIns; + pCtl->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); + pCtl->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); + + for (uint32_t j = 0; j < RT_ELEMENTS(pCtl->aIfs); j++) + { + pCtl->aIfs[j].iLUN = j; + pCtl->aIfs[j].pDevInsR3 = pDevIns; + pCtl->aIfs[j].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); + pCtl->aIfs[j].pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); + pCtl->aIfs[j].pControllerR3 = pCtl; + pCtl->aIfs[j].pControllerR0 = MMHyperR3ToR0(PDMDevHlpGetVM(pDevIns), pCtl); + pCtl->aIfs[j].pControllerRC = MMHyperR3ToRC(PDMDevHlpGetVM(pDevIns), pCtl); + pCtl->aIfs[j].pLed = pLed; + pCtl->aIfs[j].pStatBytesRead = pStatBytesRead; + pCtl->aIfs[j].pStatBytesWritten = pStatBytesWritten; + } + + /* Initialize per-controller critical section */ + rc = PDMDevHlpCritSectInit(pDevIns, &pCtl->lock, szName); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, N_("AHCI ATA: cannot initialize critical section")); + + /* + * Attach the units. + */ + uint32_t cbTotalBuffer = 0; + + /* + * Start the worker thread. + */ + pCtl->uAsyncIOState = AHCIATA_AIO_NEW; + rc = RTSemEventCreate(&pCtl->AsyncIOSem); + AssertRC(rc); + rc = RTSemEventCreate(&pCtl->SuspendIOSem); + AssertRC(rc); + rc = RTSemMutexCreate(&pCtl->AsyncIORequestMutex); + AssertRC(rc); + ataAsyncIOClearRequests(pCtl); + rc = RTThreadCreate(&pCtl->AsyncIOThread, ataAsyncIOLoop, (void *)pCtl, 128*1024, RTTHREADTYPE_IO, 0, "ATA"); + AssertRC(rc); + Assert(pCtl->AsyncIOThread != NIL_RTTHREAD && pCtl->AsyncIOSem != NIL_RTSEMEVENT && pCtl->SuspendIOSem != NIL_RTSEMEVENT && pCtl->AsyncIORequestMutex != NIL_RTSEMMUTEX); + Log(("%s: controller AIO thread id %#x; sem %p susp_sem %p mutex %p\n", __FUNCTION__, pCtl->AsyncIOThread, pCtl->AsyncIOSem, pCtl->SuspendIOSem, pCtl->AsyncIORequestMutex)); + + for (uint32_t j = 0; j < RT_ELEMENTS(pCtl->aIfs); j++) + { + /* + * Try attach the block device and get the interfaces, + * required as well as optional. + */ + AHCIATADevState *pIf = &pCtl->aIfs[j]; + + pIf->pDrvBase = (j == 0) ? pDrvBaseMaster : pDrvBaseSlave; + +#if 0 + rc = PDMDevHlpDriverAttach(pDevIns, pIf->iLUN, &pIf->IBase, &pIf->pDrvBase, s_apszDescs[j]); + if (RT_SUCCESS(rc)) +#endif + if (pIf->pDrvBase) + rc = ataConfigLun(pDevIns, pIf); + else + { + pIf->pDrvBase = NULL; + pIf->pDrvBlock = NULL; + pIf->cbIOBuffer = 0; + pIf->pbIOBufferR3 = NULL; + pIf->pbIOBufferR0 = NIL_RTR0PTR; + pIf->pbIOBufferRC = NIL_RTRCPTR; + LogRel(("AHCI ATA: LUN#%d: no unit\n", pIf->iLUN)); + } + cbTotalBuffer += pIf->cbIOBuffer; + } + + *pcbSSMState = cbTotalBuffer; + + /* + * Initialize the device state. + */ + ataControllerReset(pCtl); + + return VINF_SUCCESS; +} +#endif /* IN_RING3 */ +#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ + diff --git a/src/VBox/Devices/Storage/ATAController.h b/src/VBox/Devices/Storage/ATAController.h index 0f3a0c8dd..b0415ed06 100644 --- a/src/VBox/Devices/Storage/ATAController.h +++ b/src/VBox/Devices/Storage/ATAController.h @@ -1,4 +1,4 @@ -/* $Id: ATAController.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: ATAController.h $ */ /** @file * DevATA, DevAHCI - Shared ATA/ATAPI controller types. */ diff --git a/src/VBox/Devices/Storage/Debug.cpp b/src/VBox/Devices/Storage/Debug.cpp index c8322554d..09d96fe8f 100644 --- a/src/VBox/Devices/Storage/Debug.cpp +++ b/src/VBox/Devices/Storage/Debug.cpp @@ -1,4 +1,4 @@ -/* $Id: Debug.cpp 12927 2008-10-02 11:34:15Z vboxsync $ */ +/* $Id: Debug.cpp $ */ /** @file * VBox storage devices: debug helpers */ diff --git a/src/VBox/Devices/Storage/DevAHCI.cpp b/src/VBox/Devices/Storage/DevAHCI.cpp new file mode 100644 index 000000000..071afbcdc --- /dev/null +++ b/src/VBox/Devices/Storage/DevAHCI.cpp @@ -0,0 +1,6594 @@ +/* $Id: DevAHCI.cpp $ */ +/** @file + * + * VBox storage devices: + * AHCI controller device (disk). + * Implements the AHCI standard 1.1 + */ + +/* + * Copyright (C) 2006-2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +/** @page pg_dev_ahci AHCI - Advanced Host Controller Interface Emulation. + * + * This component implements an AHCI SATA controller. + * The device is split into two parts. The first part implements the + * register interface for the guest and the second one does the data transfer. + * + * The guest can access the controller in two ways. The first one is the native + * way implementing the registers described in the AHCI specification and is + * the preferred one. + * The second implements the I/O ports used for booting from the hard disk + * and for guests which don't have an AHCI SATA driver. + * + * The data is transfered in an asychronous way using one thread per implemented + * port or using the new async completion interface which is still under development. + * + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +//#define DEBUG +#define LOG_GROUP LOG_GROUP_DEV_AHCI +#include <VBox/pdmdev.h> +#include <VBox/pdmqueue.h> +#include <VBox/pdmthread.h> +#include <VBox/pdmcritsect.h> +#include <VBox/scsi.h> +#include <iprt/assert.h> +#include <iprt/asm.h> +#include <iprt/string.h> +#ifdef IN_RING3 +# include <iprt/param.h> +# include <iprt/thread.h> +# include <iprt/semaphore.h> +# include <iprt/alloc.h> +# include <iprt/uuid.h> +# include <iprt/time.h> +#endif + +#include "ide.h" +#include "ATAController.h" +#include "../Builtins.h" + +#define AHCI_MAX_NR_PORTS_IMPL 30 +#define AHCI_NR_COMMAND_SLOTS 32 +#define AHCI_SAVED_STATE_VERSION 2 +#define AHCI_NR_OF_ALLOWED_BIGGER_LISTS 100 + +/** + * Maximum number of sectors to transfer in a READ/WRITE MULTIPLE request. + * Set to 1 to disable multi-sector read support. According to the ATA + * specification this must be a power of 2 and it must fit in an 8 bit + * value. Thus the only valid values are 1, 2, 4, 8, 16, 32, 64 and 128. + */ +#define ATA_MAX_MULT_SECTORS 128 + +/** + * Fastest PIO mode supported by the drive. + */ +#define ATA_PIO_MODE_MAX 4 +/** + * Fastest MDMA mode supported by the drive. + */ +#define ATA_MDMA_MODE_MAX 2 +/** + * Fastest UDMA mode supported by the drive. + */ +#define ATA_UDMA_MODE_MAX 6 + +/** + * Length of the configurable VPD data (without termination) + */ +#define AHCI_SERIAL_NUMBER_LENGTH 20 +#define AHCI_FIRMWARE_REVISION_LENGTH 8 +#define AHCI_MODEL_NUMBER_LENGTH 40 + +/* Command Header. */ +typedef struct +{ + /** Description Information. */ + uint32_t u32DescInf; + /** Command status. */ + uint32_t u32PRDBC; + /** Command Table Base Address. */ + uint32_t u32CmdTblAddr; + /** Command Table Base Address - upper 32-bits. */ + uint32_t u32CmdTblAddrUp; + /** Reserved */ + uint32_t u32Reserved[4]; +} CmdHdr; +AssertCompileSize(CmdHdr, 32); + +/* Defines for the command header. */ +#define AHCI_CMDHDR_PRDTL_MASK 0xffff0000 +#define AHCI_CMDHDR_PRDTL_ENTRIES(x) ((x & AHCI_CMDHDR_PRDTL_MASK) >> 16) +#define AHCI_CMDHDR_C RT_BIT(10) +#define AHCI_CMDHDR_B RT_BIT(9) +#define AHCI_CMDHDR_R RT_BIT(8) +#define AHCI_CMDHDR_P RT_BIT(7) +#define AHCI_CMDHDR_W RT_BIT(6) +#define AHCI_CMDHDR_A RT_BIT(5) +#define AHCI_CMDHDR_CFL_MASK 0x1f + +#define AHCI_CMDHDR_PRDT_OFFSET 0x80 +#define AHCI_CMDHDR_ACMD_OFFSET 0x40 + +/* Defines for the command FIS. */ +/* Defines that are used in the first double word. */ +#define AHCI_CMDFIS_TYPE 0 /* The first byte. */ +# define AHCI_CMDFIS_TYPE_H2D 0x27 /* Register - Host to Device FIS. */ +# define AHCI_CMDFIS_TYPE_H2D_SIZE 20 /* Five double words. */ +# define AHCI_CMDFIS_TYPE_D2H 0x34 /* Register - Device to Host FIS. */ +# define AHCI_CMDFIS_TYPE_D2H_SIZE 20 /* Five double words. */ +# define AHCI_CMDFIS_TYPE_SETDEVBITS 0xa1 /* Set Device Bits - Device to Host FIS. */ +# define AHCI_CMDFIS_TYPE_SETDEVBITS_SIZE 8 /* Two double words. */ +# define AHCI_CMDFIS_TYPE_DMAACTD2H 0x39 /* DMA Activate - Device to Host FIS. */ +# define AHCI_CMDFIS_TYPE_DMAACTD2H_SIZE 4 /* One double word. */ +# define AHCI_CMDFIS_TYPE_DMASETUP 0x41 /* DMA Setup - Bidirectional FIS. */ +# define AHCI_CMDFIS_TYPE_DMASETUP_SIZE 28 /* Seven double words. */ +# define AHCI_CMDFIS_TYPE_PIOSETUP 0x5f /* PIO Setup - Device to Host FIS. */ +# define AHCI_CMDFIS_TYPE_PIOSETUP_SIZE 20 /* Five double words. */ +# define AHCI_CMDFIS_TYPE_DATA 0x46 /* Data - Bidirectional FIS. */ + +#define AHCI_CMDFIS_BITS 1 /* Interrupt and Update bit. */ +#define AHCI_CMDFIS_C RT_BIT(7) /* Host to device. */ +#define AHCI_CMDFIS_I RT_BIT(6) /* Device to Host. */ + +#define AHCI_CMDFIS_CMD 2 +#define AHCI_CMDFIS_FET 3 + +#define AHCI_CMDFIS_SECTN 4 +#define AHCI_CMDFIS_CYLL 5 +#define AHCI_CMDFIS_CYLH 6 +#define AHCI_CMDFIS_HEAD 7 + +#define AHCI_CMDFIS_SECTNEXP 8 +#define AHCI_CMDFIS_CYLLEXP 9 +#define AHCI_CMDFIS_CYLHEXP 10 +#define AHCI_CMDFIS_FETEXP 11 + +#define AHCI_CMDFIS_SECTC 12 +#define AHCI_CMDFIS_SECTCEXP 13 +#define AHCI_CMDFIS_CTL 15 +# define AHCI_CMDFIS_CTL_SRST RT_BIT(2) /* Reset device. */ +# define AHCI_CMDFIS_CTL_NIEN RT_BIT(1) /* Assert or clear interrupt. */ + +/* For D2H FIS */ +#define AHCI_CMDFIS_STS 2 +#define AHCI_CMDFIS_ERR 3 + +/** + * Scatter gather list entry data. + */ +typedef struct AHCIPORTTASKSTATESGENTRY +{ + /** Flag whether the buffer in the list is from the guest or an + * allocated temporary buffer because the segments in the guest + * are not sector aligned. + */ + bool fGuestMemory; + /** Flag dependent data. */ + union + { + /** Data to handle direct mappings of guest buffers. */ + struct + { + /** The page lock. */ + PGMPAGEMAPLOCK PageLock; + } direct; + /** Data to handle temporary buffers. */ + struct + { + /** The first segment in the guest which is not sector aligned. */ + RTGCPHYS GCPhysAddrBaseFirstUnaligned; + /** Number of unaligned buffers in the guest. */ + uint32_t cUnaligned; + /** Pointer to the start of the buffer. */ + void *pvBuf; + } temp; + } u; +} AHCIPORTTASKSTATESGENTRY, *PAHCIPORTTASKSTATESGENTRY; + +/** Pointer to a pointer of a scatter gather list entry. */ +typedef PAHCIPORTTASKSTATESGENTRY *PPAHCIPORTTASKSTATESGENTRY; + +/** + * A task state. + */ +typedef struct AHCIPORTTASKSTATE +{ + /** Tag of the task. */ + uint32_t uTag; + /** Command is queued. */ + bool fQueued; + /** The command header for this task. */ + CmdHdr cmdHdr; + /** The command Fis for this task. */ + uint8_t cmdFis[AHCI_CMDFIS_TYPE_H2D_SIZE]; + /** The ATAPI comnmand data. */ + uint8_t aATAPICmd[ATAPI_PACKET_SIZE]; + /** Physical address of the command header. - GC */ + RTGCPHYS GCPhysCmdHdrAddr; + /** Data direction. */ + uint8_t uTxDir; + /** Start offset. */ + uint64_t uOffset; + /** Number of bytes to transfer. */ + uint32_t cbTransfer; + /** ATA error register */ + uint8_t uATARegError; + /** ATA status register */ + uint8_t uATARegStatus; + /** Number of scatter gather list entries. */ + uint32_t cSGEntries; + /** How many entries would fit into the sg list. */ + uint32_t cSGListSize; + /** Pointer to the first entry of the scatter gather list. */ + PPDMDATASEG pSGListHead; + /** Pointer to the first mapping information entry. */ + PAHCIPORTTASKSTATESGENTRY paSGEntries; + /** Size of the temporary buffer for unaligned guest segments. */ + uint32_t cbBufferUnaligned; + /** Pointer to the temporary buffer. */ + void *pvBufferUnaligned; + /** Number of times in a row the scatter gather list was too big. */ + uint32_t cSGListTooBig; +} AHCIPORTTASKSTATE, *PAHCIPORTTASKSTATE; + +/** + * Notifier queue item. + */ +typedef struct DEVPORTNOTIFIERQUEUEITEM +{ + /** The core part owned by the queue manager. */ + PDMQUEUEITEMCORE Core; + /** On which port the async io thread should be put into action. */ + uint8_t iPort; + /** Which task to process. */ + uint8_t iTask; + /** Flag whether the task is queued. */ + uint8_t fQueued; +} DEVPORTNOTIFIERQUEUEITEM, *PDEVPORTNOTIFIERQUEUEITEM; + +typedef struct AHCIPort +{ + /** Pointer to the device instance - HC ptr */ + PPDMDEVINSR3 pDevInsR3; + /** Pointer to the device instance - R0 ptr */ + PPDMDEVINSR0 pDevInsR0; + /** Pointer to the device instance - RC ptr. */ + PPDMDEVINSRC pDevInsRC; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment0; +#endif + + /** Pointer to the parent AHCI structure - R3 ptr. */ + R3PTRTYPE(struct AHCI *) pAhciR3; + /** Pointer to the parent AHCI structure - R0 ptr. */ + R0PTRTYPE(struct AHCI *) pAhciR0; + /** Pointer to the parent AHCI structure - RC ptr. */ + RCPTRTYPE(struct AHCI *) pAhciRC; + /** Command List Base Address. */ + uint32_t regCLB; + /** Command List Base Address upper bits. */ + uint32_t regCLBU; + /** FIS Base Address. */ + uint32_t regFB; + /** FIS Base Address upper bits. */ + uint32_t regFBU; + /** Interrupt Status. */ + uint32_t regIS; + /** Interrupt Enable. */ + uint32_t regIE; + /** Command. */ + uint32_t regCMD; + /** Task File Data. */ + uint32_t regTFD; + /** Signature */ + uint32_t regSIG; + /** Serial ATA Status. */ + uint32_t regSSTS; + /** Serial ATA Control. */ + uint32_t regSCTL; + /** Serial ATA Error. */ + uint32_t regSERR; + /** Serial ATA Active. */ + uint32_t regSACT; + /** Command Issue. */ + uint32_t regCI; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment1; +#endif + + /** Command List Base Address */ + volatile RTGCPHYS GCPhysAddrClb; + /** FIS Base Address */ + volatile RTGCPHYS GCPhysAddrFb; + + /** If we use the new async interface. */ + bool fAsyncInterface; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment2; +#endif + + /** Async IO Thread. */ + PPDMTHREAD pAsyncIOThread; + /** Request semaphore. */ + RTSEMEVENT AsyncIORequestSem; + + /** Task queue. */ + volatile uint8_t ahciIOTasks[2*AHCI_NR_COMMAND_SLOTS]; + /** Actual write position. */ + uint8_t uActWritePos; + /** Actual read position. */ + uint8_t uActReadPos; + /** Actual number of active tasks. */ + volatile uint32_t uActTasksActive; + + /** Device is powered on. */ + bool fPoweredOn; + /** Device has spun up. */ + bool fSpunUp; + /** First D2H FIS was send. */ + bool fFirstD2HFisSend; + /** Attached device is a CD/DVD drive. */ + bool fATAPI; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment3; +#endif + + /** Device specific settings. */ + /** Pointer to the attached driver's base interface. */ + R3PTRTYPE(PPDMIBASE) pDrvBase; + /** Pointer to the attached driver's block interface. */ + R3PTRTYPE(PPDMIBLOCK) pDrvBlock; + /** Pointer to the attached driver's async block interface. */ + R3PTRTYPE(PPDMIBLOCKASYNC) pDrvBlockAsync; + /** Pointer to the attached driver's block bios interface. */ + R3PTRTYPE(PPDMIBLOCKBIOS) pDrvBlockBios; + /** Pointer to the attached driver's mount interface. */ + R3PTRTYPE(PPDMIMOUNT) pDrvMount; + /** The base interface. */ + PDMIBASE IBase; + /** The block port interface. */ + PDMIBLOCKPORT IPort; + /** The optional block async port interface. */ + PDMIBLOCKASYNCPORT IPortAsync; + /** The mount notify interface. */ + PDMIMOUNTNOTIFY IMountNotify; + /** Physical geometry of this image. */ + PDMMEDIAGEOMETRY PCHSGeometry; + /** The status LED state for this drive. */ + PDMLED Led; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment4; +#endif + + /** Number of total sectors. */ + uint64_t cTotalSectors; + /** Currently configured number of sectors in a multi-sector transfer. */ + uint32_t cMultSectors; + /** Currently active transfer mode (MDMA/UDMA) and speed. */ + uint8_t uATATransferMode; + /** ATAPI sense key. */ + uint8_t uATAPISenseKey; + /** ATAPI additional sens code. */ + uint8_t uATAPIASC; + /** HACK: Countdown till we report a newly unmounted drive as mounted. */ + uint8_t cNotifiedMediaChange; + + /** The LUN. */ + RTUINT iLUN; + /** Flag if we are in a device reset. */ + bool fResetDevice; + + /** Bitmask for finished tasks. */ + volatile uint32_t u32TasksFinished; + /** Bitmask for finished queued tasks. */ + volatile uint32_t u32QueuedTasksFinished; + + /** + * Array of cached tasks. The tag number is the index value. + * Only used with the async interface. + */ + R3PTRTYPE(PAHCIPORTTASKSTATE) aCachedTasks[AHCI_NR_COMMAND_SLOTS]; + + /** Release statistics: number of DMA commands. */ + STAMCOUNTER StatDMA; + /** Release statistics: number of bytes written. */ + STAMCOUNTER StatBytesWritten; + /** Release statistics: number of bytes read. */ + STAMCOUNTER StatBytesRead; + /** Release statistics: Number of I/O requests processed per second. */ + STAMCOUNTER StatIORequestsPerSecond; +#ifdef VBOX_WITH_STATISTICS + /** Statistics: Time to complete one request. */ + STAMPROFILE StatProfileProcessTime; + /** Statistics: Time to map requests into R3. */ + STAMPROFILE StatProfileMapIntoR3; + /** Statistics: Amount of time to read/write data. */ + STAMPROFILE StatProfileReadWrite; + /** Statistics: Amount of time to destroy a list. */ + STAMPROFILE StatProfileDestroyScatterGatherList; +#endif /* VBOX_WITH_STATISTICS */ + /** Flag whether a notification was already send to R3. */ + volatile bool fNotificationSend; + /** Flag whether this port is in a reset state. */ + volatile bool fPortReset; + /** Flag whether the I/O thread idles. */ + volatile bool fAsyncIOThreadIdle; + + /** The serial numnber to use for IDENTIFY DEVICE commands. */ + char szSerialNumber[AHCI_SERIAL_NUMBER_LENGTH+1]; /** < one extra byte for termination */ + /** The firmware revision to use for IDENTIFY DEVICE commands. */ + char szFirmwareRevision[AHCI_FIRMWARE_REVISION_LENGTH+1]; /** < one extra byte for termination */ + /** The model number to use for IDENTIFY DEVICE commands. */ + char szModelNumber[AHCI_MODEL_NUMBER_LENGTH+1]; /** < one extra byte for termination */ + +#if HC_ARCH_BITS == 64 + uint32_t Alignment5; +#endif + +} AHCIPort, *PAHCIPort; + +/* + * Main AHCI device state. + */ +typedef struct AHCI +{ + /** The PCI device structure. */ + PCIDEVICE dev; + /** 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; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment0; +#endif + + /** The base interface */ + PDMIBASE IBase; + /** Status Port - Leds interface. */ + PDMILEDPORTS ILeds; + /** Partner of ILeds. */ + R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment1[2]; +#endif + + /** Base address of the MMIO region. */ + RTGCPHYS MMIOBase; + + /** Global Host Control register of the HBA */ + + /** HBA Capabilities - Readonly */ + uint32_t regHbaCap; + /** HBA Control */ + uint32_t regHbaCtrl; + /** Interrupt Status */ + uint32_t regHbaIs; + /** Ports Implemented - Readonly */ + uint32_t regHbaPi; + /** AHCI Version - Readonly */ + uint32_t regHbaVs; + /** Command completion coalescing control */ + uint32_t regHbaCccCtl; + /** Command completion coalescing ports */ + uint32_t regHbaCccPorts; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment3; +#endif + + /** Countdown timer for command completion coalescing - R3 ptr */ + PTMTIMERR3 pHbaCccTimerR3; + /** Countdown timer for command completion coalescing - R0 ptr */ + PTMTIMERR0 pHbaCccTimerR0; + /** Countdown timer for command completion coalescing - RC ptr */ + PTMTIMERRC pHbaCccTimerRC; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment4; +#endif + + /** Queue to send tasks to R3. - HC ptr */ + R3PTRTYPE(PPDMQUEUE) pNotifierQueueR3; + /** Queue to send tasks to R3. - HC ptr */ + R0PTRTYPE(PPDMQUEUE) pNotifierQueueR0; + /** Queue to send tasks to R3. - RC ptr */ + RCPTRTYPE(PPDMQUEUE) pNotifierQueueRC; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment5; +#endif + + + /** Which port number is used to mark an CCC interrupt */ + uint8_t uCccPortNr; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment6; +#endif + + /** Timeout value */ + uint64_t uCccTimeout; + /** Number of completions used to assert an interrupt */ + uint32_t uCccNr; + /** Current number of completed commands */ + uint32_t uCccCurrentNr; + + /** Register structure per port */ + AHCIPort ahciPort[AHCI_MAX_NR_PORTS_IMPL]; + + /** Needed values for the emulated ide channels. */ + AHCIATACONTROLLER aCts[2]; + + /** Bitmask of ports which asserted an interrupt. */ + uint32_t u32PortsInterrupted; + /** Device is in a reset state. */ + bool fReset; + /** Supports 64bit addressing */ + bool f64BitAddr; + /** GC enabled. */ + bool fGCEnabled; + /** R0 enabled. */ + bool fR0Enabled; + /** If the new async interface is used if available. */ + bool fUseAsyncInterfaceIfAvailable; + /** The critical section. */ + PDMCRITSECT lock; + + /** Number of usable ports on this controller. */ + uint32_t cPortsImpl; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment7; +#endif + + /** Flag whether we have written the first 4bytes in an 8byte MMIO write successfully. */ + volatile bool f8ByteMMIO4BytesWrittenSuccessfully; + /** At which number of I/O requests per second we consider having high I/O load. */ + uint32_t cHighIOThreshold; + /** How many milliseconds to sleep. */ + uint32_t cMillisToSleep; + +} AHCI, *PAHCI; + +/* Scatter gather list entry. */ +typedef struct +{ + /** Data Base Address. */ + uint32_t u32DBA; + /** Data Base Address - Upper 32-bits. */ + uint32_t u32DBAUp; + /** Reserved */ + uint32_t u32Reserved; + /** Description information. */ + uint32_t u32DescInf; +} SGLEntry; +AssertCompileSize(SGLEntry, 16); + +/** Defines for a scatter gather list entry. */ +#define SGLENTRY_DBA_READONLY ~(RT_BIT(0)) +#define SGLENTRY_DESCINF_I RT_BIT(31) +#define SGLENTRY_DESCINF_DBC 0x3fffff +#define SGLENTRY_DESCINF_READONLY 0x803fffff + +/* Defines for the global host control registers for the HBA. */ + +#define AHCI_HBA_GLOBAL_SIZE 0x100 + +/* Defines for the HBA Capabilities - Readonly */ +#define AHCI_HBA_CAP_S64A RT_BIT(31) +#define AHCI_HBA_CAP_SNCQ RT_BIT(30) +#define AHCI_HBA_CAP_SIS RT_BIT(28) +#define AHCI_HBA_CAP_SSS RT_BIT(27) +#define AHCI_HBA_CAP_SALP RT_BIT(26) +#define AHCI_HBA_CAP_SAL RT_BIT(25) +#define AHCI_HBA_CAP_SCLO RT_BIT(24) +#define AHCI_HBA_CAP_ISS (RT_BIT(23) | RT_BIT(22) | RT_BIT(21) | RT_BIT(20)) +# define AHCI_HBA_CAP_ISS_SHIFT(x) (((x) << 20) & AHCI_HBA_CAP_ISS) +# define AHCI_HBA_CAP_ISS_GEN1 RT_BIT(0) +# define AHCI_HBA_CAP_ISS_GEN2 RT_BIT(1) +#define AHCI_HBA_CAP_SNZO RT_BIT(19) +#define AHCI_HBA_CAP_SAM RT_BIT(18) +#define AHCI_HBA_CAP_SPM RT_BIT(17) +#define AHCI_HBA_CAP_PMD RT_BIT(15) +#define AHCI_HBA_CAP_SSC RT_BIT(14) +#define AHCI_HBA_CAP_PSC RT_BIT(13) +#define AHCI_HBA_CAP_NCS (RT_BIT(12) | RT_BIT(11) | RT_BIT(10) | RT_BIT(9) | RT_BIT(8)) +#define AHCI_HBA_CAP_NCS_SET(x) (((x-1) << 8) & AHCI_HBA_CAP_NCS) /* 0's based */ +#define AHCI_HBA_CAP_CCCS RT_BIT(7) +#define AHCI_HBA_CAP_NP (RT_BIT(4) | RT_BIT(3) | RT_BIT(2) | RT_BIT(1) | RT_BIT(0)) +#define AHCI_HBA_CAP_NP_SET(x) ((x-1) & AHCI_HBA_CAP_NP) /* 0's based */ + +/* Defines for the HBA Control register - Read/Write */ +#define AHCI_HBA_CTRL_AE RT_BIT(31) +#define AHCI_HBA_CTRL_IE RT_BIT(1) +#define AHCI_HBA_CTRL_HR RT_BIT(0) +#define AHCI_HBA_CTRL_RW_MASK (RT_BIT(0) | RT_BIT(1)) /* Mask for the used bits */ + +/* Defines for the HBA Version register - Readonly (We support AHCI 1.0) */ +#define AHCI_HBA_VS_MJR (1 << 16) +#define AHCI_HBA_VS_MNR 0x100 + +/* Defines for the command completion coalescing control register */ +#define AHCI_HBA_CCC_CTL_TV 0xffff0000 +#define AHCI_HBA_CCC_CTL_TV_SET(x) (x << 16) +#define AHCI_HBA_CCC_CTL_TV_GET(x) ((x & AHCI_HBA_CCC_CTL_TV) >> 16) + +#define AHCI_HBA_CCC_CTL_CC 0xff00 +#define AHCI_HBA_CCC_CTL_CC_SET(x) (x << 8) +#define AHCI_HBA_CCC_CTL_CC_GET(x) ((x & AHCI_HBA_CCC_CTL_CC) >> 8) + +#define AHCI_HBA_CCC_CTL_INT 0xf8 +#define AHCI_HBA_CCC_CTL_INT_SET(x) (x << 3) +#define AHCI_HBA_CCC_CTL_INT_GET(x) ((x & AHCI_HBA_CCC_CTL_INT) >> 3) + +#define AHCI_HBA_CCC_CTL_EN RT_BIT(0) + +/* Defines for the port registers. */ + +#define AHCI_PORT_REGISTER_SIZE 0x80 + +#define AHCI_PORT_CLB_RESERVED 0xfffffc00 /* For masking out the reserved bits. */ + +#define AHCI_PORT_FB_RESERVED 0x7fffff00 /* For masking out the reserved bits. */ + +#define AHCI_PORT_IS_CPDS RT_BIT(31) +#define AHCI_PORT_IS_TFES RT_BIT(30) +#define AHCI_PORT_IS_HBFS RT_BIT(29) +#define AHCI_PORT_IS_HBDS RT_BIT(28) +#define AHCI_PORT_IS_IFS RT_BIT(27) +#define AHCI_PORT_IS_INFS RT_BIT(26) +#define AHCI_PORT_IS_OFS RT_BIT(24) +#define AHCI_PORT_IS_IPMS RT_BIT(23) +#define AHCI_PORT_IS_PRCS RT_BIT(22) +#define AHCI_PORT_IS_DIS RT_BIT(7) +#define AHCI_PORT_IS_PCS RT_BIT(6) +#define AHCI_PORT_IS_DPS RT_BIT(5) +#define AHCI_PORT_IS_UFS RT_BIT(4) +#define AHCI_PORT_IS_SDBS RT_BIT(3) +#define AHCI_PORT_IS_DSS RT_BIT(2) +#define AHCI_PORT_IS_PSS RT_BIT(1) +#define AHCI_PORT_IS_DHRS RT_BIT(0) +#define AHCI_PORT_IS_READONLY 0xfd8000af /* Readonly mask including reserved bits. */ + +#define AHCI_PORT_IE_CPDE RT_BIT(31) +#define AHCI_PORT_IE_TFEE RT_BIT(30) +#define AHCI_PORT_IE_HBFE RT_BIT(29) +#define AHCI_PORT_IE_HBDE RT_BIT(28) +#define AHCI_PORT_IE_IFE RT_BIT(27) +#define AHCI_PORT_IE_INFE RT_BIT(26) +#define AHCI_PORT_IE_OFE RT_BIT(24) +#define AHCI_PORT_IE_IPME RT_BIT(23) +#define AHCI_PORT_IE_PRCE RT_BIT(22) +#define AHCI_PORT_IE_DIE RT_BIT(7) /* Not supported for now, readonly. */ +#define AHCI_PORT_IE_PCE RT_BIT(6) +#define AHCI_PORT_IE_DPE RT_BIT(5) +#define AHCI_PORT_IE_UFE RT_BIT(4) +#define AHCI_PORT_IE_SDBE RT_BIT(3) +#define AHCI_PORT_IE_DSE RT_BIT(2) +#define AHCI_PORT_IE_PSE RT_BIT(1) +#define AHCI_PORT_IE_DHRE RT_BIT(0) +#define AHCI_PORT_IE_READONLY (0xfdc000ff) /* Readonly mask including reserved bits. */ + +#define AHCI_PORT_CMD_ICC (RT_BIT(28) | RT_BIT(29) | RT_BIT(30) | RT_BIT(31)) +#define AHCI_PORT_CMD_ICC_SHIFT(x) ((x) << 28) +# define AHCI_PORT_CMD_ICC_IDLE 0x0 +# define AHCI_PORT_CMD_ICC_ACTIVE 0x1 +# define AHCI_PORT_CMD_ICC_PARTIAL 0x2 +# define AHCI_PORT_CMD_ICC_SLUMBER 0x6 +#define AHCI_PORT_CMD_ASP RT_BIT(27) /* Not supported - Readonly */ +#define AHCI_PORT_CMD_ALPE RT_BIT(26) /* Not supported - Readonly */ +#define AHCI_PORT_CMD_DLAE RT_BIT(25) +#define AHCI_PORT_CMD_ATAPI RT_BIT(24) +#define AHCI_PORT_CMD_CPD RT_BIT(20) +#define AHCI_PORT_CMD_ISP RT_BIT(19) /* Readonly */ +#define AHCI_PORT_CMD_HPCP RT_BIT(18) +#define AHCI_PORT_CMD_PMA RT_BIT(17) /* Not supported - Readonly */ +#define AHCI_PORT_CMD_CPS RT_BIT(16) +#define AHCI_PORT_CMD_CR RT_BIT(15) /* Readonly */ +#define AHCI_PORT_CMD_FR RT_BIT(14) /* Readonly */ +#define AHCI_PORT_CMD_ISS RT_BIT(13) /* Readonly */ +#define AHCI_PORT_CMD_CCS (RT_BIT(8) | RT_BIT(9) | RT_BIT(10) | RT_BIT(11) | RT_BIT(12)) +#define AHCI_PORT_CMD_CCS_SHIFT(x) (x << 8) /* Readonly */ +#define AHCI_PORT_CMD_FRE RT_BIT(4) +#define AHCI_PORT_CMD_CLO RT_BIT(3) +#define AHCI_PORT_CMD_POD RT_BIT(2) +#define AHCI_PORT_CMD_SUD RT_BIT(1) +#define AHCI_PORT_CMD_ST RT_BIT(0) +#define AHCI_PORT_CMD_READONLY (0xff02001f & ~(AHCI_PORT_CMD_ASP | AHCI_PORT_CMD_ALPE | AHCI_PORT_CMD_PMA)) + +#define AHCI_PORT_SCTL_IPM (RT_BIT(11) | RT_BIT(10) | RT_BIT(9) | RT_BIT(8)) +#define AHCI_PORT_SCTL_IPM_GET(x) ((x & AHCI_PORT_SCTL_IPM) >> 8) +#define AHCI_PORT_SCTL_SPD (RT_BIT(7) | RT_BIT(6) | RT_BIT(5) | RT_BIT(4)) +#define AHCI_PORT_SCTL_SPD_GET(x) ((x & AHCI_PORT_SCTL_SPD) >> 4) +#define AHCI_PORT_SCTL_DET (RT_BIT(3) | RT_BIT(2) | RT_BIT(1) | RT_BIT(0)) +#define AHCI_PORT_SCTL_DET_GET(x) (x & AHCI_PORT_SCTL_DET) +#define AHCI_PORT_SCTL_DET_NINIT 0 +#define AHCI_PORT_SCTL_DET_INIT 1 +#define AHCI_PORT_SCTL_DET_OFFLINE 4 +#define AHCI_PORT_SCTL_READONLY 0xfff + +#define AHCI_PORT_SSTS_IPM (RT_BIT(11) | RT_BIT(10) | RT_BIT(9) | RT_BIT(8)) +#define AHCI_PORT_SSTS_IPM_GET(x) ((x & AHCI_PORT_SCTL_IPM) >> 8) +#define AHCI_PORT_SSTS_SPD (RT_BIT(7) | RT_BIT(6) | RT_BIT(5) | RT_BIT(4)) +#define AHCI_PORT_SSTS_SPD_GET(x) ((x & AHCI_PORT_SCTL_SPD) >> 4) +#define AHCI_PORT_SSTS_DET (RT_BIT(3) | RT_BIT(2) | RT_BIT(1) | RT_BIT(0)) +#define AHCI_PORT_SSTS_DET_GET(x) (x & AHCI_PORT_SCTL_DET) + +#define AHCI_PORT_TFD_BSY RT_BIT(7) +#define AHCI_PORT_TFD_DRQ RT_BIT(3) +#define AHCI_PORT_TFD_ERR RT_BIT(0) + +#define AHCI_PORT_SERR_X RT_BIT(26) +#define AHCI_PORT_SERR_W RT_BIT(18) +#define AHCI_PORT_SERR_N RT_BIT(16) + +/* Signatures for attached storage devices. */ +#define AHCI_PORT_SIG_DISK 0x00000101 +#define AHCI_PORT_SIG_ATAPI 0xeb140101 + +/* + * The AHCI spec defines an area of memory where the HBA posts received FIS's from the device. + * regFB points to the base of this area. + * Every FIS type has an offset where it is posted in this area. + */ +#define AHCI_RECFIS_DSFIS_OFFSET 0x00 /* DMA Setup FIS */ +#define AHCI_RECFIS_PSFIS_OFFSET 0x20 /* PIO Setup FIS */ +#define AHCI_RECFIS_RFIS_OFFSET 0x40 /* D2H Register FIS */ +#define AHCI_RECFIS_SDBFIS_OFFSET 0x58 /* Set Device Bits FIS */ +#define AHCI_RECFIS_UFIS_OFFSET 0x60 /* Unknown FIS type */ + +#define AHCI_TASK_IS_QUEUED(x) ((x) & 0x1) +#define AHCI_TASK_GET_TAG(x) ((x) >> 1) +#define AHCI_TASK_SET(tag, queued) (((tag) << 1) | (queued)) + +/** + * AHCI register operator. + */ +typedef struct ahci_opreg +{ + const char *pszName; + int (*pfnRead )(PAHCI ahci, uint32_t iReg, uint32_t *pu32Value); + int (*pfnWrite)(PAHCI ahci, uint32_t iReg, uint32_t u32Value); +} AHCIOPREG; + +/** + * AHCI port register operator. + */ +typedef struct pAhciPort_opreg +{ + const char *pszName; + int (*pfnRead )(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value); + int (*pfnWrite)(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value); +} AHCIPORTOPREG; + +#ifndef VBOX_DEVICE_STRUCT_TESTCASE +RT_C_DECLS_BEGIN +PDMBOTHCBDECL(int) ahciMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb); +PDMBOTHCBDECL(int) ahciMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb); +static void ahciHBAReset(PAHCI pThis); +PDMBOTHCBDECL(int) ahciIOPortWrite1(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb); +PDMBOTHCBDECL(int) ahciIOPortRead1(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb); +PDMBOTHCBDECL(int) ahciIOPortWrite2(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb); +PDMBOTHCBDECL(int) ahciIOPortRead2(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb); +PDMBOTHCBDECL(int) ahciLegacyFakeWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb); +PDMBOTHCBDECL(int) ahciLegacyFakeRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb); +#ifdef IN_RING3 +static int ahciPostFisIntoMemory(PAHCIPort pAhciPort, unsigned uFisType, uint8_t *cmdFis); +static void ahciPostFirstD2HFisIntoMemory(PAHCIPort pAhciPort); +static int ahciScatterGatherListCopyFromBuffer(PAHCIPORTTASKSTATE pAhciPortTaskState, void *pvBuf, size_t cbBuf); +static int ahciScatterGatherListCreate(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState, bool fReadonly); +static int ahciScatterGatherListDestroy(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState); +static void ahciCopyFromBufferIntoSGList(PPDMDEVINS pDevIns, PAHCIPORTTASKSTATESGENTRY pSGInfo); +static void ahciCopyFromSGListIntoBuffer(PPDMDEVINS pDevIns, PAHCIPORTTASKSTATESGENTRY pSGInfo); +#endif +RT_C_DECLS_END + +#define PCIDEV_2_PAHCI(pPciDev) ( (PAHCI)(pPciDev) ) +#define PDMIMOUNT_2_PAHCIPORT(pInterface) ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IMount)) ) +#define PDMIMOUNTNOTIFY_2_PAHCIPORT(pInterface) ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IMountNotify)) ) +#define PDMIBASE_2_PAHCIPORT(pInterface) ( (PAHCIPort)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCIPort, IBase)) ) +#define PDMIBASE_2_PAHCI(pInterface) ( (PAHCI)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCI, IBase)) ) +#define PDMILEDPORTS_2_PAHCI(pInterface) ( (PAHCI)((uintptr_t)(pInterface) - RT_OFFSETOF(AHCI, ILeds)) ) + +#if 1 +#define AHCI_RTGCPHYS_FROM_U32(Hi, Lo) ( (RTGCPHYS)RT_MAKE_U64(Lo, Hi) ) +#else +#define AHCI_RTGCPHYS_FROM_U32(Hi, Lo) ( (RTGCPHYS)(Lo) ) +#endif + +#ifdef IN_RING3 + +# ifdef LOG_USE_C99 +# define ahciLog(a) \ + Log(("R3 P%u: %M", pAhciPort->iLUN, _LogRelRemoveParentheseis a)) +# else +# define ahciLog(a) \ + do { Log(("R3 P%u: ", pAhciPort->iLUN)); Log(a); } while(0) +# endif + +#elif IN_RING0 + +# ifdef LOG_USE_C99 +# define ahciLog(a) \ + Log(("R0 P%u: %M", pAhciPort->iLUN, _LogRelRemoveParentheseis a)) +# else +# define ahciLog(a) \ + do { Log(("R0 P%u: ", pAhciPort->iLUN)); Log(a); } while(0) +# endif + +#elif IN_RC + +# ifdef LOG_USE_C99 +# define ahciLog(a) \ + Log(("GC P%u: %M", pAhciPort->iLUN, _LogRelRemoveParentheseis a)) +# else +# define ahciLog(a) \ + do { Log(("GC P%u: ", pAhciPort->iLUN)); Log(a); } while(0) +# endif + +#endif + +/** + * Update PCI IRQ levels + */ +static void ahciHbaClearInterrupt(PAHCI pAhci) +{ + Log(("%s: Clearing interrupt\n", __FUNCTION__)); + PDMDevHlpPCISetIrqNoWait(pAhci->CTX_SUFF(pDevIns), 0, 0); +} + +/** + * Updates the IRQ level and sets port bit in the global interrupt status register of the HBA. + */ +static void ahciHbaSetInterrupt(PAHCI pAhci, uint8_t iPort) +{ + Log(("P%u: %s: Setting interrupt\n", iPort, __FUNCTION__)); + + PDMCritSectEnter(&pAhci->lock, VINF_SUCCESS); + + if (pAhci->regHbaCtrl & AHCI_HBA_CTRL_IE) + { + if ((pAhci->regHbaCccCtl & AHCI_HBA_CCC_CTL_EN) && (pAhci->regHbaCccPorts & (1 << iPort))) + { + pAhci->uCccCurrentNr++; + if (pAhci->uCccCurrentNr >= pAhci->uCccNr) + { + /* Reset command completion coalescing state. */ + TMTimerSetMillies(pAhci->CTX_SUFF(pHbaCccTimer), pAhci->uCccTimeout); + pAhci->uCccCurrentNr = 0; + + pAhci->u32PortsInterrupted |= (1 << pAhci->uCccPortNr); + if (!(pAhci->u32PortsInterrupted & ~(1 << pAhci->uCccPortNr))) + { + Log(("P%u: %s: Fire interrupt\n", iPort, __FUNCTION__)); + PDMDevHlpPCISetIrqNoWait(pAhci->CTX_SUFF(pDevIns), 0, 1); + } + } + } + else + { + /* If only the bit of the actual port is set assert an interrupt + * because the interrupt status register was already read by the guest + * and we need to send a new notification. + * Otherwise an interrupt is still pending. + */ + ASMAtomicOrU32((volatile uint32_t *)&pAhci->u32PortsInterrupted, (1 << iPort)); + if (!(pAhci->u32PortsInterrupted & ~(1 << iPort))) + { + Log(("P%u: %s: Fire interrupt\n", iPort, __FUNCTION__)); + PDMDevHlpPCISetIrqNoWait(pAhci->CTX_SUFF(pDevIns), 0, 1); + } + } + } + + PDMCritSectLeave(&pAhci->lock); +} + +#ifdef IN_RING3 +/* + * Assert irq when an CCC timeout occurs + */ +DECLCALLBACK(void) ahciCccTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) +{ + PAHCI pAhci = (PAHCI)pvUser; + + ahciHbaSetInterrupt(pAhci, pAhci->uCccPortNr); +} +#endif + +static int PortCmdIssue_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + uint32_t uCIValue; + + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + + /* Update the CI register first. */ + uCIValue = ASMAtomicXchgU32(&pAhciPort->u32TasksFinished, 0); + pAhciPort->regCI &= ~uCIValue; + + + if ((pAhciPort->regCMD & AHCI_PORT_CMD_ST) && (u32Value > 0)) + { + PDEVPORTNOTIFIERQUEUEITEM pItem; + + /* Mark the tasks set in the value as used. */ + for (uint8_t i = 0; i < AHCI_NR_COMMAND_SLOTS; i++) + { + /* Queue task if bit is set in written value and not already in progress. */ + if (((u32Value >> i) & 0x01) && !(pAhciPort->regCI & (1 << i))) + { + if (!pAhciPort->fAsyncInterface) + { + /* Put the tag number of the task into the FIFO. */ + uint8_t uTag = AHCI_TASK_SET(i, ((pAhciPort->regSACT & (1 << i)) ? 1 : 0)); + ASMAtomicWriteU8(&pAhciPort->ahciIOTasks[pAhciPort->uActWritePos], uTag); + ahciLog(("%s: Before uActWritePos=%u\n", __FUNCTION__, pAhciPort->uActWritePos)); + pAhciPort->uActWritePos++; + pAhciPort->uActWritePos %= RT_ELEMENTS(pAhciPort->ahciIOTasks); + ahciLog(("%s: After uActWritePos=%u\n", __FUNCTION__, pAhciPort->uActWritePos)); + + ASMAtomicIncU32(&pAhciPort->uActTasksActive); + + bool fNotificationSend = ASMAtomicXchgBool(&pAhciPort->fNotificationSend, true); + if (!fNotificationSend) + { + /* Send new notification. */ + pItem = (PDEVPORTNOTIFIERQUEUEITEM)PDMQueueAlloc(ahci->CTX_SUFF(pNotifierQueue)); + AssertMsg(pItem, ("Allocating item for queue failed\n")); + + pItem->iPort = pAhciPort->iLUN; + PDMQueueInsert(ahci->CTX_SUFF(pNotifierQueue), (PPDMQUEUEITEMCORE)pItem); + } + } + else + { + pItem = (PDEVPORTNOTIFIERQUEUEITEM)PDMQueueAlloc(ahci->CTX_SUFF(pNotifierQueue)); + AssertMsg(pItem, ("Allocating item for queue failed\n")); + + pItem->iPort = pAhciPort->iLUN; + pItem->iTask = i; + pItem->fQueued = !!(pAhciPort->regSACT & (1 << i)); /* Mark if the task is queued. */ + PDMQueueInsert(ahci->CTX_SUFF(pNotifierQueue), (PPDMQUEUEITEMCORE)pItem); + } + } + } + } + + pAhciPort->regCI |= u32Value; + + return VINF_SUCCESS; +} + +static int PortCmdIssue_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + uint32_t uCIValue = 0; + + uCIValue = ASMAtomicXchgU32(&pAhciPort->u32TasksFinished, 0); + + ahciLog(("%s: read regCI=%#010x uCIValue=%#010x\n", __FUNCTION__, pAhciPort->regCI, uCIValue)); + + pAhciPort->regCI &= ~uCIValue; + + *pu32Value = pAhciPort->regCI; + + return VINF_SUCCESS; +} + +static int PortSActive_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + + pAhciPort->regSACT |= u32Value; + + return VINF_SUCCESS; +} + +static int PortSActive_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + uint32_t u32TasksFinished = ASMAtomicXchgU32(&pAhciPort->u32QueuedTasksFinished, 0); + + pAhciPort->regSACT &= ~u32TasksFinished; + + ahciLog(("%s: read regSACT=%#010x regCI=%#010x u32TasksFinished=%#010x\n", + __FUNCTION__, pAhciPort->regSACT, pAhciPort->regCI, u32TasksFinished)); + + *pu32Value = pAhciPort->regSACT; + + return VINF_SUCCESS; +} + +static int PortSError_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + pAhciPort->regSERR &= ~u32Value; + if (u32Value & AHCI_PORT_SERR_X) + { + pAhciPort->regTFD |= ATA_STAT_ERR; + pAhciPort->regTFD &= ~(ATA_STAT_DRQ | ATA_STAT_BUSY); + } + return VINF_SUCCESS; +} + +static int PortSError_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regSERR=%#010x\n", __FUNCTION__, pAhciPort->regSERR)); + *pu32Value = pAhciPort->regSERR; + return VINF_SUCCESS; +} + +static int PortSControl_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + ahciLog(("%s: IPM=%d SPD=%d DET=%d\n", __FUNCTION__, + AHCI_PORT_SCTL_IPM_GET(u32Value), AHCI_PORT_SCTL_SPD_GET(u32Value), AHCI_PORT_SCTL_DET_GET(u32Value))); + + if ((u32Value & AHCI_PORT_SCTL_DET) == AHCI_PORT_SCTL_DET_INIT) + { + ASMAtomicXchgBool(&pAhciPort->fPortReset, true); + pAhciPort->regSSTS = 0; + pAhciPort->regSIG = ~0; + pAhciPort->regTFD = 0x7f; + pAhciPort->fFirstD2HFisSend = false; + } + else if ((u32Value & AHCI_PORT_SCTL_DET) == AHCI_PORT_SCTL_DET_NINIT && pAhciPort->pDrvBase && + (pAhciPort->regSCTL & AHCI_PORT_SCTL_DET) == AHCI_PORT_SCTL_DET_INIT) + { +#ifndef IN_RING3 + return VINF_IOM_HC_MMIO_WRITE; +#else + if (pAhciPort->pDrvBase) + { + /* Reset queue. */ + pAhciPort->uActWritePos = 0; + pAhciPort->uActReadPos = 0; + ASMAtomicXchgBool(&pAhciPort->fPortReset, false); + + /* Signature for SATA device. */ + if (pAhciPort->fATAPI) + pAhciPort->regSIG = AHCI_PORT_SIG_ATAPI; + else + pAhciPort->regSIG = AHCI_PORT_SIG_DISK; + + pAhciPort->regSSTS = (0x01 << 8) | /* Interface is active. */ + (0x03 << 0); /* Device detected and communication established. */ + + /* + * Use the maximum allowed speed. + * (Not that it changes anything really) + */ + switch (AHCI_PORT_SCTL_SPD_GET(pAhciPort->regSCTL)) + { + case 0x01: + pAhciPort->regSSTS |= (0x01 << 4); /* Generation 1 (1.5GBps) speed. */ + break; + case 0x02: + case 0x00: + default: + pAhciPort->regSSTS |= (0x02 << 4); /* Generation 2 (3.0GBps) speed. */ + break; + } + + /* We received a COMINIT from the device. Tell the guest. */ + pAhciPort->regIS |= AHCI_PORT_IS_PCS; + pAhciPort->regSERR |= AHCI_PORT_SERR_X; + pAhciPort->regTFD |= ATA_STAT_BUSY; + + if ((pAhciPort->regCMD & AHCI_PORT_CMD_FRE) && (!pAhciPort->fFirstD2HFisSend)) + { + ahciPostFirstD2HFisIntoMemory(pAhciPort); + pAhciPort->regIS |= AHCI_PORT_IS_DHRS; + + if (pAhciPort->regIE & AHCI_PORT_IE_DHRE) + ahciHbaSetInterrupt(pAhciPort->CTX_SUFF(pAhci), pAhciPort->iLUN); + } + } +#endif + } + + pAhciPort->regSCTL = u32Value; + + return VINF_SUCCESS; +} + +static int PortSControl_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regSCTL=%#010x\n", __FUNCTION__, pAhciPort->regSCTL)); + ahciLog(("%s: IPM=%d SPD=%d DET=%d\n", __FUNCTION__, + AHCI_PORT_SCTL_IPM_GET(pAhciPort->regSCTL), AHCI_PORT_SCTL_SPD_GET(pAhciPort->regSCTL), + AHCI_PORT_SCTL_DET_GET(pAhciPort->regSCTL))); + + *pu32Value = pAhciPort->regSCTL; + return VINF_SUCCESS; +} + +static int PortSStatus_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regSSTS=%#010x\n", __FUNCTION__, pAhciPort->regSSTS)); + ahciLog(("%s: IPM=%d SPD=%d DET=%d\n", __FUNCTION__, + AHCI_PORT_SSTS_IPM_GET(pAhciPort->regSSTS), AHCI_PORT_SSTS_SPD_GET(pAhciPort->regSSTS), + AHCI_PORT_SSTS_DET_GET(pAhciPort->regSSTS))); + + *pu32Value = pAhciPort->regSSTS; + return VINF_SUCCESS; +} + +static int PortSignature_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regSIG=%#010x\n", __FUNCTION__, pAhciPort->regSIG)); + *pu32Value = pAhciPort->regSIG; + return VINF_SUCCESS; +} + +static int PortTaskFileData_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regTFD=%#010x\n", __FUNCTION__, pAhciPort->regTFD)); + ahciLog(("%s: ERR=%x BSY=%d DRQ=%d ERR=%d\n", __FUNCTION__, + (pAhciPort->regTFD >> 8), (pAhciPort->regTFD & AHCI_PORT_TFD_BSY) >> 7, + (pAhciPort->regTFD & AHCI_PORT_TFD_DRQ) >> 3, (pAhciPort->regTFD & AHCI_PORT_TFD_ERR))); + *pu32Value = pAhciPort->regTFD; + return VINF_SUCCESS; +} + +/** + * Read from the port command register. + */ +static int PortCmd_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regCMD=%#010x\n", __FUNCTION__, pAhciPort->regCMD)); + ahciLog(("%s: ICC=%d ASP=%d ALPE=%d DLAE=%d ATAPI=%d CPD=%d ISP=%d HPCP=%d PMA=%d CPS=%d CR=%d FR=%d ISS=%d CCS=%d FRE=%d CLO=%d POD=%d SUD=%d ST=%d\n", + __FUNCTION__, (pAhciPort->regCMD & AHCI_PORT_CMD_ICC) >> 28, (pAhciPort->regCMD & AHCI_PORT_CMD_ASP) >> 27, + (pAhciPort->regCMD & AHCI_PORT_CMD_ALPE) >> 26, (pAhciPort->regCMD & AHCI_PORT_CMD_DLAE) >> 25, + (pAhciPort->regCMD & AHCI_PORT_CMD_ATAPI) >> 24, (pAhciPort->regCMD & AHCI_PORT_CMD_CPD) >> 20, + (pAhciPort->regCMD & AHCI_PORT_CMD_ISP) >> 19, (pAhciPort->regCMD & AHCI_PORT_CMD_HPCP) >> 18, + (pAhciPort->regCMD & AHCI_PORT_CMD_PMA) >> 17, (pAhciPort->regCMD & AHCI_PORT_CMD_CPS) >> 16, + (pAhciPort->regCMD & AHCI_PORT_CMD_CR) >> 15, (pAhciPort->regCMD & AHCI_PORT_CMD_FR) >> 14, + (pAhciPort->regCMD & AHCI_PORT_CMD_ISS) >> 13, (pAhciPort->regCMD & AHCI_PORT_CMD_CCS) >> 8, + (pAhciPort->regCMD & AHCI_PORT_CMD_FRE) >> 4, (pAhciPort->regCMD & AHCI_PORT_CMD_CLO) >> 3, + (pAhciPort->regCMD & AHCI_PORT_CMD_POD) >> 2, (pAhciPort->regCMD & AHCI_PORT_CMD_SUD) >> 1, + (pAhciPort->regCMD & AHCI_PORT_CMD_ST))); + *pu32Value = pAhciPort->regCMD; + return VINF_SUCCESS; +} + +/** + * Write to the port command register. + * This is the register where all the data transfer is started + */ +static int PortCmd_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + int rc = VINF_SUCCESS; + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + ahciLog(("%s: ICC=%d ASP=%d ALPE=%d DLAE=%d ATAPI=%d CPD=%d ISP=%d HPCP=%d PMA=%d CPS=%d CR=%d FR=%d ISS=%d CCS=%d FRE=%d CLO=%d POD=%d SUD=%d ST=%d\n", + __FUNCTION__, (u32Value & AHCI_PORT_CMD_ICC) >> 28, (u32Value & AHCI_PORT_CMD_ASP) >> 27, + (u32Value & AHCI_PORT_CMD_ALPE) >> 26, (u32Value & AHCI_PORT_CMD_DLAE) >> 25, + (u32Value & AHCI_PORT_CMD_ATAPI) >> 24, (u32Value & AHCI_PORT_CMD_CPD) >> 20, + (u32Value & AHCI_PORT_CMD_ISP) >> 19, (u32Value & AHCI_PORT_CMD_HPCP) >> 18, + (u32Value & AHCI_PORT_CMD_PMA) >> 17, (u32Value & AHCI_PORT_CMD_CPS) >> 16, + (u32Value & AHCI_PORT_CMD_CR) >> 15, (u32Value & AHCI_PORT_CMD_FR) >> 14, + (u32Value & AHCI_PORT_CMD_ISS) >> 13, (u32Value & AHCI_PORT_CMD_CCS) >> 8, + (u32Value & AHCI_PORT_CMD_FRE) >> 4, (u32Value & AHCI_PORT_CMD_CLO) >> 3, + (u32Value & AHCI_PORT_CMD_POD) >> 2, (u32Value & AHCI_PORT_CMD_SUD) >> 1, + (u32Value & AHCI_PORT_CMD_ST))); + + if (pAhciPort->fPoweredOn && pAhciPort->fSpunUp) + { + if (u32Value & AHCI_PORT_CMD_CLO) + { + ahciLog(("%s: Command list override requested\n", __FUNCTION__)); + u32Value &= ~(AHCI_PORT_TFD_BSY | AHCI_PORT_TFD_DRQ); + /* Clear the CLO bit. */ + u32Value &= ~(AHCI_PORT_CMD_CLO); + } + + if (u32Value & AHCI_PORT_CMD_ST) + { + ahciLog(("%s: Engine starts\n", __FUNCTION__)); + + /** Set engine state to running. */ + u32Value |= AHCI_PORT_CMD_CR; + } + else + { + ahciLog(("%s: Engine stops\n", __FUNCTION__)); + /* Clear command issue register. */ + pAhciPort->regCI = 0; + /** Clear current command slot. */ + u32Value &= ~(AHCI_PORT_CMD_CCS_SHIFT(0xff)); + u32Value &= ~AHCI_PORT_CMD_CR; + } + } + else if (pAhciPort->pDrvBase) + { + if ((u32Value & AHCI_PORT_CMD_POD) && (pAhciPort->regCMD & AHCI_PORT_CMD_CPS) && !pAhciPort->fPoweredOn) + { + ahciLog(("%s: Power on the device\n", __FUNCTION__)); + pAhciPort->fPoweredOn = true; + + /* + * Set states in the Port Signature and SStatus registers. + */ + pAhciPort->regSIG = 0x101; /* Signature for SATA device. */ + pAhciPort->regSSTS = (0x01 << 8) | /* Interface is active. */ + (0x02 << 4) | /* Generation 2 (3.0GBps) speed. */ + (0x03 << 0); /* Device detected and communication established. */ + + if (pAhciPort->regCMD & AHCI_PORT_CMD_FRE) + { +#ifndef IN_RING3 + return VINF_IOM_HC_MMIO_WRITE; +#else + ahciPostFirstD2HFisIntoMemory(pAhciPort); + pAhciPort->regIS |= AHCI_PORT_IS_DHRS; + + if (pAhciPort->regIE & AHCI_PORT_IE_DHRE) + ahciHbaSetInterrupt(pAhciPort->CTX_SUFF(pAhci), pAhciPort->iLUN); +#endif + } + } + + if ((u32Value & AHCI_PORT_CMD_SUD) && pAhciPort->fPoweredOn && !pAhciPort->fSpunUp) + { + ahciLog(("%s: Spin up the device\n", __FUNCTION__)); + pAhciPort->fSpunUp = true; + } + } + + if (u32Value & AHCI_PORT_CMD_FRE) + { + ahciLog(("%s: FIS receive enabled\n", __FUNCTION__)); + + u32Value |= AHCI_PORT_CMD_FR; + + /* Send the first D2H FIS only if it wasn't already send. */ + if (!pAhciPort->fFirstD2HFisSend) + { +#ifndef IN_RING3 + return VINF_IOM_HC_MMIO_WRITE; +#else + ahciPostFirstD2HFisIntoMemory(pAhciPort); + pAhciPort->fFirstD2HFisSend = true; +#endif + } + } + else if (!(u32Value & AHCI_PORT_CMD_FRE)) + { + ahciLog(("%s: FIS receive disabled\n", __FUNCTION__)); + u32Value &= ~AHCI_PORT_CMD_FR; + } + + pAhciPort->regCMD = u32Value; + + return rc; +} + +/** + * Read from the port interrupt enable register. + */ +static int PortIntrEnable_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regIE=%#010x\n", __FUNCTION__, pAhciPort->regIE)); + ahciLog(("%s: CPDE=%d TFEE=%d HBFE=%d HBDE=%d IFE=%d INFE=%d OFE=%d IPME=%d PRCE=%d DIE=%d PCE=%d DPE=%d UFE=%d SDBE=%d DSE=%d PSE=%d DHRE=%d\n", + __FUNCTION__, (pAhciPort->regIE & AHCI_PORT_IE_CPDE) >> 31, (pAhciPort->regIE & AHCI_PORT_IE_TFEE) >> 30, + (pAhciPort->regIE & AHCI_PORT_IE_HBFE) >> 29, (pAhciPort->regIE & AHCI_PORT_IE_HBDE) >> 28, + (pAhciPort->regIE & AHCI_PORT_IE_IFE) >> 27, (pAhciPort->regIE & AHCI_PORT_IE_INFE) >> 26, + (pAhciPort->regIE & AHCI_PORT_IE_OFE) >> 24, (pAhciPort->regIE & AHCI_PORT_IE_IPME) >> 23, + (pAhciPort->regIE & AHCI_PORT_IE_PRCE) >> 22, (pAhciPort->regIE & AHCI_PORT_IE_DIE) >> 7, + (pAhciPort->regIE & AHCI_PORT_IE_PCE) >> 6, (pAhciPort->regIE & AHCI_PORT_IE_DPE) >> 5, + (pAhciPort->regIE & AHCI_PORT_IE_UFE) >> 4, (pAhciPort->regIE & AHCI_PORT_IE_SDBE) >> 3, + (pAhciPort->regIE & AHCI_PORT_IE_DSE) >> 2, (pAhciPort->regIE & AHCI_PORT_IE_PSE) >> 1, + (pAhciPort->regIE & AHCI_PORT_IE_DHRE))); + *pu32Value = pAhciPort->regIE; + return VINF_SUCCESS; +} + +/** + * Write to the port interrupt enable register. + */ +static int PortIntrEnable_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + ahciLog(("%s: CPDE=%d TFEE=%d HBFE=%d HBDE=%d IFE=%d INFE=%d OFE=%d IPME=%d PRCE=%d DIE=%d PCE=%d DPE=%d UFE=%d SDBE=%d DSE=%d PSE=%d DHRE=%d\n", + __FUNCTION__, (u32Value & AHCI_PORT_IE_CPDE) >> 31, (u32Value & AHCI_PORT_IE_TFEE) >> 30, + (u32Value & AHCI_PORT_IE_HBFE) >> 29, (u32Value & AHCI_PORT_IE_HBDE) >> 28, + (u32Value & AHCI_PORT_IE_IFE) >> 27, (u32Value & AHCI_PORT_IE_INFE) >> 26, + (u32Value & AHCI_PORT_IE_OFE) >> 24, (u32Value & AHCI_PORT_IE_IPME) >> 23, + (u32Value & AHCI_PORT_IE_PRCE) >> 22, (u32Value & AHCI_PORT_IE_DIE) >> 7, + (u32Value & AHCI_PORT_IE_PCE) >> 6, (u32Value & AHCI_PORT_IE_DPE) >> 5, + (u32Value & AHCI_PORT_IE_UFE) >> 4, (u32Value & AHCI_PORT_IE_SDBE) >> 3, + (u32Value & AHCI_PORT_IE_DSE) >> 2, (u32Value & AHCI_PORT_IE_PSE) >> 1, + (u32Value & AHCI_PORT_IE_DHRE))); + + pAhciPort->regIE = (u32Value & AHCI_PORT_IE_READONLY); + + /* Check if some a interrupt status bit changed*/ + uint32_t u32IntrStatus = ASMAtomicReadU32(&pAhciPort->regIS); + + if (pAhciPort->regIE & u32IntrStatus) + ahciHbaSetInterrupt(ahci, pAhciPort->iLUN); + + return VINF_SUCCESS; +} + +/** + * Read from the port interrupt status register. + */ +static int PortIntrSts_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regIS=%#010x\n", __FUNCTION__, pAhciPort->regIS)); + ahciLog(("%s: CPDS=%d TFES=%d HBFS=%d HBDS=%d IFS=%d INFS=%d OFS=%d IPMS=%d PRCS=%d DIS=%d PCS=%d DPS=%d UFS=%d SDBS=%d DSS=%d PSS=%d DHRS=%d\n", + __FUNCTION__, (pAhciPort->regIS & AHCI_PORT_IS_CPDS) >> 31, (pAhciPort->regIS & AHCI_PORT_IS_TFES) >> 30, + (pAhciPort->regIS & AHCI_PORT_IS_HBFS) >> 29, (pAhciPort->regIS & AHCI_PORT_IS_HBDS) >> 28, + (pAhciPort->regIS & AHCI_PORT_IS_IFS) >> 27, (pAhciPort->regIS & AHCI_PORT_IS_INFS) >> 26, + (pAhciPort->regIS & AHCI_PORT_IS_OFS) >> 24, (pAhciPort->regIS & AHCI_PORT_IS_IPMS) >> 23, + (pAhciPort->regIS & AHCI_PORT_IS_PRCS) >> 22, (pAhciPort->regIS & AHCI_PORT_IS_DIS) >> 7, + (pAhciPort->regIS & AHCI_PORT_IS_PCS) >> 6, (pAhciPort->regIS & AHCI_PORT_IS_DPS) >> 5, + (pAhciPort->regIS & AHCI_PORT_IS_UFS) >> 4, (pAhciPort->regIS & AHCI_PORT_IS_SDBS) >> 3, + (pAhciPort->regIS & AHCI_PORT_IS_DSS) >> 2, (pAhciPort->regIS & AHCI_PORT_IS_PSS) >> 1, + (pAhciPort->regIS & AHCI_PORT_IS_DHRS))); + *pu32Value = pAhciPort->regIS; + return VINF_SUCCESS; +} + +/** + * Write to the port interrupt status register. + */ +static int PortIntrSts_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + pAhciPort->regIS &= ~u32Value; + + if (u32Value & AHCI_PORT_IS_PCS) + pAhciPort->regSERR &= ~AHCI_PORT_SERR_X; + return VINF_SUCCESS; +} + +/** + * Read from the port FIS base address upper 32bit register. + */ +static int PortFisAddrUp_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regFBU=%#010x\n", __FUNCTION__, pAhciPort->regFBU)); + *pu32Value = pAhciPort->regFBU; + return VINF_SUCCESS; +} + +/** + * Write to the port FIS base address upper 32bit register. + */ +static int PortFisAddrUp_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + + pAhciPort->regFBU = u32Value; + pAhciPort->GCPhysAddrFb |= ((RTGCPHYS)pAhciPort->regFBU) << 32; + + return VINF_SUCCESS; +} + +/** + * Read from the port FIS base address register. + */ +static int PortFisAddr_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regFB=%#010x\n", __FUNCTION__, pAhciPort->regFB)); + *pu32Value = pAhciPort->regFB; + return VINF_SUCCESS; +} + +/** + * Write to the port FIS base address register. + */ +static int PortFisAddr_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + + pAhciPort->regFB = (u32Value & AHCI_PORT_FB_RESERVED); + pAhciPort->GCPhysAddrFb |= pAhciPort->regFB; + + return VINF_SUCCESS; +} + +/** + * Write to the port command list base address upper 32bit register. + */ +static int PortCmdLstAddrUp_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + + pAhciPort->regCLBU = u32Value; + pAhciPort->GCPhysAddrClb |= ((RTGCPHYS)pAhciPort->regCLBU) << 32; + + return VINF_SUCCESS; +} + +/** + * Read from the port command list base address upper 32bit register. + */ +static int PortCmdLstAddrUp_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regCLBU=%#010x\n", __FUNCTION__, pAhciPort->regCLBU)); + *pu32Value = pAhciPort->regCLBU; + return VINF_SUCCESS; +} + +/** + * Read from the port command list base address register. + */ +static int PortCmdLstAddr_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: read regCLB=%#010x\n", __FUNCTION__, pAhciPort->regCLB)); + *pu32Value = pAhciPort->regCLB; + return VINF_SUCCESS; +} + +/** + * Write to the port command list base address register. + */ +static int PortCmdLstAddr_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + + pAhciPort->regCLB = (u32Value & AHCI_PORT_CLB_RESERVED); + pAhciPort->GCPhysAddrClb |= pAhciPort->regCLB; + + return VINF_SUCCESS; +} + +/** + * Read from the global Version register. + */ +static int HbaVersion_r(PAHCI ahci, uint32_t iReg, uint32_t *pu32Value) +{ + Log(("%s: read regHbaVs=%#010x\n", __FUNCTION__, ahci->regHbaVs)); + *pu32Value = ahci->regHbaVs; + return VINF_SUCCESS; +} + +/** + * Read from the global Ports implemented register. + */ +static int HbaPortsImplemented_r(PAHCI ahci, uint32_t iReg, uint32_t *pu32Value) +{ + Log(("%s: read regHbaPi=%#010x\n", __FUNCTION__, ahci->regHbaPi)); + *pu32Value = ahci->regHbaPi; + return VINF_SUCCESS; +} + +/** + * Write to the global interrupt status register. + */ +static int HbaInterruptStatus_w(PAHCI ahci, uint32_t iReg, uint32_t u32Value) +{ + int rc; + Log(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + + rc = PDMCritSectEnter(&ahci->lock, VINF_IOM_HC_MMIO_WRITE); + if (rc != VINF_SUCCESS) + return rc; + + if (u32Value > 0) + { + /* + * Clear the interrupt only if no port has signalled + * an interrupt and the guest has cleared all set interrupt + * notification bits. + */ + + ahci->regHbaIs &= ~(u32Value); + + if ((!ahci->u32PortsInterrupted) && (!ahci->regHbaIs)) + ahciHbaClearInterrupt(ahci); + else + { + Log(("%s: Not clearing interrupt: u32PortsInterrupted=%#010x\n", __FUNCTION__, ahci->u32PortsInterrupted)); + /* + * We need to set the interrupt again because the I/O APIC does not set it again even if the + * line is still high. + * We need to clear it first because the PCI bus only calls the interrupt controller if the state changes. + */ + PDMDevHlpPCISetIrqNoWait(ahci->CTX_SUFF(pDevIns), 0, 0); + PDMDevHlpPCISetIrqNoWait(ahci->CTX_SUFF(pDevIns), 0, 1); + } + } + + PDMCritSectLeave(&ahci->lock); + return VINF_SUCCESS; +} + +/** + * Read from the global interrupt status register. + */ +static int HbaInterruptStatus_r(PAHCI ahci, uint32_t iReg, uint32_t *pu32Value) +{ + uint32_t u32PortsInterrupted; + int rc; + + rc = PDMCritSectEnter(&ahci->lock, VINF_IOM_HC_MMIO_READ); + if (rc != VINF_SUCCESS) + return rc; + + u32PortsInterrupted = ASMAtomicXchgU32(&ahci->u32PortsInterrupted, 0); + + PDMCritSectLeave(&ahci->lock); + Log(("%s: read regHbaIs=%#010x u32PortsInterrupted=%#010x\n", __FUNCTION__, ahci->regHbaIs, u32PortsInterrupted)); + + ahci->regHbaIs |= u32PortsInterrupted; + +#ifdef LOG_ENABLED + Log(("%s:", __FUNCTION__)); + unsigned i; + for (i = 0; i < ahci->cPortsImpl; i++) + { + if ((ahci->regHbaIs >> i) & 0x01) + Log((" P%d", i)); + } + Log(("\n")); +#endif + + *pu32Value = ahci->regHbaIs; + + return VINF_SUCCESS; +} + +/** + * Write to the global control register. + */ +static int HbaControl_w(PAHCI ahci, uint32_t iReg, uint32_t u32Value) +{ + Log(("%s: write u32Value=%#010x\n" + "%s: AE=%d IE=%d HR=%d\n", + __FUNCTION__, u32Value, + __FUNCTION__, (u32Value & AHCI_HBA_CTRL_AE) >> 31, (u32Value & AHCI_HBA_CTRL_IE) >> 1, + (u32Value & AHCI_HBA_CTRL_HR))); + + ahci->regHbaCtrl = (u32Value & AHCI_HBA_CTRL_RW_MASK) | AHCI_HBA_CTRL_AE; + if (ahci->regHbaCtrl & AHCI_HBA_CTRL_HR) + ahciHBAReset(ahci); + return VINF_SUCCESS; +} + +/** + * Read the global control register. + */ +static int HbaControl_r(PAHCI ahci, uint32_t iReg, uint32_t *pu32Value) +{ + Log(("%s: read regHbaCtrl=%#010x\n" + "%s: AE=%d IE=%d HR=%d\n", + __FUNCTION__, ahci->regHbaCtrl, + __FUNCTION__, (ahci->regHbaCtrl & AHCI_HBA_CTRL_AE) >> 31, (ahci->regHbaCtrl & AHCI_HBA_CTRL_IE) >> 1, + (ahci->regHbaCtrl & AHCI_HBA_CTRL_HR))); + *pu32Value = ahci->regHbaCtrl; + return VINF_SUCCESS; +} + +/** + * Read the global capabilities register. + */ +static int HbaCapabilities_r(PAHCI ahci, uint32_t iReg, uint32_t *pu32Value) +{ + Log(("%s: read regHbaCap=%#010x\n" + "%s: S64A=%d SNCQ=%d SIS=%d SSS=%d SALP=%d SAL=%d SCLO=%d ISS=%d SNZO=%d SAM=%d SPM=%d PMD=%d SSC=%d PSC=%d NCS=%d NP=%d\n", + __FUNCTION__, ahci->regHbaCap, + __FUNCTION__, (ahci->regHbaCap & AHCI_HBA_CAP_S64A) >> 31, (ahci->regHbaCap & AHCI_HBA_CAP_SNCQ) >> 30, + (ahci->regHbaCap & AHCI_HBA_CAP_SIS) >> 28, (ahci->regHbaCap & AHCI_HBA_CAP_SSS) >> 27, + (ahci->regHbaCap & AHCI_HBA_CAP_SALP) >> 26, (ahci->regHbaCap & AHCI_HBA_CAP_SAL) >> 25, + (ahci->regHbaCap & AHCI_HBA_CAP_SCLO) >> 24, (ahci->regHbaCap & AHCI_HBA_CAP_ISS) >> 20, + (ahci->regHbaCap & AHCI_HBA_CAP_SNZO) >> 19, (ahci->regHbaCap & AHCI_HBA_CAP_SAM) >> 18, + (ahci->regHbaCap & AHCI_HBA_CAP_SPM) >> 17, (ahci->regHbaCap & AHCI_HBA_CAP_PMD) >> 15, + (ahci->regHbaCap & AHCI_HBA_CAP_SSC) >> 14, (ahci->regHbaCap & AHCI_HBA_CAP_PSC) >> 13, + (ahci->regHbaCap & AHCI_HBA_CAP_NCS) >> 8, (ahci->regHbaCap & AHCI_HBA_CAP_NP))); + *pu32Value = ahci->regHbaCap; + return VINF_SUCCESS; +} + +/** + * Write to the global command completion coalescing control register. + */ +static int HbaCccCtl_w(PAHCI ahci, uint32_t iReg, uint32_t u32Value) +{ + Log(("%s: write u32Value=%#010x\n" + "%s: TV=%d CC=%d INT=%d EN=%d\n", + __FUNCTION__, u32Value, + __FUNCTION__, AHCI_HBA_CCC_CTL_TV_GET(u32Value), AHCI_HBA_CCC_CTL_CC_GET(u32Value), + AHCI_HBA_CCC_CTL_INT_GET(u32Value), (u32Value & AHCI_HBA_CCC_CTL_EN))); + + ahci->regHbaCccCtl = u32Value; + ahci->uCccTimeout = AHCI_HBA_CCC_CTL_TV_GET(u32Value); + ahci->uCccPortNr = AHCI_HBA_CCC_CTL_INT_GET(u32Value); + ahci->uCccNr = AHCI_HBA_CCC_CTL_CC_GET(u32Value); + + if (u32Value & AHCI_HBA_CCC_CTL_EN) + { + /* Arm the timer */ + TMTimerSetMillies(ahci->CTX_SUFF(pHbaCccTimer), ahci->uCccTimeout); + } + else + { + TMTimerStop(ahci->CTX_SUFF(pHbaCccTimer)); + } + + return VINF_SUCCESS; +} + +/** + * Read the global command completion coalescing control register. + */ +static int HbaCccCtl_r(PAHCI ahci, uint32_t iReg, uint32_t *pu32Value) +{ + Log(("%s: read regHbaCccCtl=%#010x\n" + "%s: TV=%d CC=%d INT=%d EN=%d\n", + __FUNCTION__, ahci->regHbaCccCtl, + __FUNCTION__, AHCI_HBA_CCC_CTL_TV_GET(ahci->regHbaCccCtl), AHCI_HBA_CCC_CTL_CC_GET(ahci->regHbaCccCtl), + AHCI_HBA_CCC_CTL_INT_GET(ahci->regHbaCccCtl), (ahci->regHbaCccCtl & AHCI_HBA_CCC_CTL_EN))); + *pu32Value = ahci->regHbaCccCtl; + return VINF_SUCCESS; +} + +/** + * Write to the global command completion coalescing ports register. + */ +static int HbaCccPorts_w(PAHCI ahci, uint32_t iReg, uint32_t u32Value) +{ + Log(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value)); + + ahci->regHbaCccPorts = u32Value; + + return VINF_SUCCESS; +} + +/** + * Read the global command completion coalescing ports register. + */ +static int HbaCccPorts_r(PAHCI ahci, uint32_t iReg, uint32_t *pu32Value) +{ + Log(("%s: read regHbaCccPorts=%#010x\n", __FUNCTION__, ahci->regHbaCccPorts)); + +#ifdef LOG_ENABLED + Log(("%s:", __FUNCTION__)); + unsigned i; + for (i = 0; i < ahci->cPortsImpl; i++) + { + if ((ahci->regHbaCccPorts >> i) & 0x01) + Log((" P%d", i)); + } + Log(("\n")); +#endif + + *pu32Value = ahci->regHbaCccPorts; + return VINF_SUCCESS; +} + +/** + * Invalid write to global register + */ +static int HbaInvalid_w(PAHCI ahci, uint32_t iReg, uint32_t u32Value) +{ + Log(("%s: Write denied!!! iReg=%u u32Value=%#010x\n", __FUNCTION__, iReg, u32Value)); + return VINF_SUCCESS; +} + +/** + * Invalid Port write. + */ +static int PortInvalid_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t u32Value) +{ + ahciLog(("%s: Write denied!!! iReg=%u u32Value=%#010x\n", __FUNCTION__, iReg, u32Value)); + return VINF_SUCCESS; +} + +/** + * Invalid Port read. + */ +static int PortInvalid_r(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32_t *pu32Value) +{ + ahciLog(("%s: Read denied!!! iReg=%u\n", __FUNCTION__, iReg)); + return VINF_SUCCESS; +} + +/** + * Register descriptor table for global HBA registers + */ +static const AHCIOPREG g_aOpRegs[] = +{ + {"HbaCapabilites", HbaCapabilities_r, HbaInvalid_w}, /* Readonly */ + {"HbaControl" , HbaControl_r, HbaControl_w}, + {"HbaInterruptStatus", HbaInterruptStatus_r, HbaInterruptStatus_w}, + {"HbaPortsImplemented", HbaPortsImplemented_r, HbaInvalid_w}, /* Readonly */ + {"HbaVersion", HbaVersion_r, HbaInvalid_w}, /* ReadOnly */ + {"HbaCccCtl", HbaCccCtl_r, HbaCccCtl_w}, + {"HbaCccPorts", HbaCccPorts_r, HbaCccPorts_w}, +}; + +/** + * Register descriptor table for port registers + */ +static const AHCIPORTOPREG g_aPortOpRegs[] = +{ + {"PortCmdLstAddr", PortCmdLstAddr_r, PortCmdLstAddr_w}, + {"PortCmdLstAddrUp", PortCmdLstAddrUp_r, PortCmdLstAddrUp_w}, + {"PortFisAddr", PortFisAddr_r, PortFisAddr_w}, + {"PortFisAddrUp", PortFisAddrUp_r, PortFisAddrUp_w}, + {"PortIntrSts", PortIntrSts_r, PortIntrSts_w}, + {"PortIntrEnable", PortIntrEnable_r, PortIntrEnable_w}, + {"PortCmd", PortCmd_r, PortCmd_w}, + {"PortReserved1", PortInvalid_r, PortInvalid_w}, /* Not used. */ + {"PortTaskFileData", PortTaskFileData_r, PortInvalid_w}, /* Readonly */ + {"PortSignature", PortSignature_r, PortInvalid_w}, /* Readonly */ + {"PortSStatus", PortSStatus_r, PortInvalid_w}, /* Readonly */ + {"PortSControl", PortSControl_r, PortSControl_w}, + {"PortSError", PortSError_r, PortSError_w}, + {"PortSActive", PortSActive_r, PortSActive_w}, + {"PortCmdIssue", PortCmdIssue_r, PortCmdIssue_w}, + {"PortReserved2", PortInvalid_r, PortInvalid_w}, /* Not used. */ +}; + +/** + * Reset initiated by system software for one port. + * + * @param pAhciPort The port to reset. + */ +static void ahciPortSwReset(PAHCIPort pAhciPort) +{ + pAhciPort->regIS = 0; + pAhciPort->regIE = 0; + pAhciPort->regCMD = AHCI_PORT_CMD_CPD | /* Cold presence detection */ + AHCI_PORT_CMD_ISP | /* Interlock switch attached (for hotplug) */ + AHCI_PORT_CMD_HPCP | /* Hotplug capable port */ + AHCI_PORT_CMD_SUD | /* Device has spun up. */ + AHCI_PORT_CMD_POD; /* Port is powered on. */ + pAhciPort->regTFD = (1 << 8) | ATA_STAT_SEEK | ATA_STAT_WRERR; + pAhciPort->regSIG = ~0; + pAhciPort->regSSTS = 0; + pAhciPort->regSCTL = 0; + pAhciPort->regSERR = 0; + pAhciPort->regSACT = 0; + pAhciPort->regCI = 0; + + pAhciPort->fResetDevice = false; + pAhciPort->fPoweredOn = true; + pAhciPort->fSpunUp = true; + pAhciPort->fNotificationSend = false; + pAhciPort->cMultSectors = ATA_MAX_MULT_SECTORS; + pAhciPort->uATATransferMode = ATA_MODE_UDMA | 6; + + pAhciPort->u32TasksFinished = 0; + pAhciPort->u32QueuedTasksFinished = 0; + + pAhciPort->uActWritePos = 0; + pAhciPort->uActReadPos = 0; + pAhciPort->uActTasksActive = 0; + + if (pAhciPort->pDrvBase) + { + pAhciPort->regCMD |= AHCI_PORT_CMD_CPS; /* Indicate that there is a device on that port */ + /* We received a COMINIT signal */ + pAhciPort->regSERR |= AHCI_PORT_SERR_X; + pAhciPort->regIS |= AHCI_PORT_IS_PCS; + pAhciPort->regTFD |= ATA_STAT_BUSY; + + if (pAhciPort->fPoweredOn) + { + /* + * Set states in the Port Signature and SStatus registers. + */ + pAhciPort->regSIG = 0x101; /* Signature for SATA device. */ + pAhciPort->regSSTS = (0x01 << 8) | /* Interface is active. */ + (0x02 << 4) | /* Generation 2 (3.0GBps) speed. */ + (0x03 << 0); /* Device detected and communication established. */ + } + } +} + +#ifdef IN_RING3 +/** + * Hardware reset used for machine power on and reset. + * + * @param pAhciport The port to reset. + */ +static void ahciPortHwReset(PAHCIPort pAhciPort) +{ + /* Reset the address registers. */ + pAhciPort->regCLB = 0; + pAhciPort->regCLBU = 0; + pAhciPort->regFB = 0; + pAhciPort->regFBU = 0; + + /* Reset calculated addresses. */ + pAhciPort->GCPhysAddrClb = 0; + pAhciPort->GCPhysAddrFb = 0; +} +#endif + +/** + * Create implemented ports bitmap. + * + * @returns 32bit bitmask with a bit set for every implemented port. + * @param cPorts Number of ports. + */ +static uint32_t ahciGetPortsImplemented(unsigned cPorts) +{ + uint32_t uPortsImplemented = 0; + + for (unsigned i = 0; i < cPorts; i++) + uPortsImplemented |= (1 << i); + + return uPortsImplemented; +} + +/** + * Reset the entire HBA. + * + * @param pThis The HBA state. + */ +static void ahciHBAReset(PAHCI pThis) +{ + unsigned i; + int rc = VINF_SUCCESS; + + LogFlow(("Reset the HBA controller\n")); + + /* Stop the CCC timer. */ + if (pThis->regHbaCccCtl & AHCI_HBA_CCC_CTL_EN) + { + rc = TMTimerStop(pThis->CTX_SUFF(pHbaCccTimer)); + if (RT_FAILURE(rc)) + AssertMsgFailed(("%s: Failed to stop timer!\n", __FUNCTION__)); + } + + /** Reset every port */ + for (i = 0; i < pThis->cPortsImpl; i++) + { + PAHCIPort pAhciPort = &pThis->ahciPort[i]; + + pAhciPort->iLUN = i; + ahciPortSwReset(pAhciPort); + } + + /** Init Global registers */ + pThis->regHbaCap = AHCI_HBA_CAP_ISS_SHIFT(AHCI_HBA_CAP_ISS_GEN2) | + AHCI_HBA_CAP_S64A | /* 64bit addressing supported */ + AHCI_HBA_CAP_SAM | /* AHCI mode only */ + AHCI_HBA_CAP_SNCQ | /* Support native command queuing */ + AHCI_HBA_CAP_SIS | /* Interlock switch for hotplug operations */ + AHCI_HBA_CAP_SSS | /* Staggered spin up */ + AHCI_HBA_CAP_CCCS | /* Support command completion coalescing */ + AHCI_HBA_CAP_NCS_SET(AHCI_NR_COMMAND_SLOTS) | /* Number of command slots we support */ + AHCI_HBA_CAP_NP_SET(pThis->cPortsImpl); /* Number of supported ports */ + pThis->regHbaCtrl = AHCI_HBA_CTRL_AE; + pThis->regHbaIs = 0; + pThis->regHbaPi = ahciGetPortsImplemented(pThis->cPortsImpl); + pThis->regHbaVs = AHCI_HBA_VS_MJR | AHCI_HBA_VS_MNR; + pThis->regHbaCccCtl = 0; + pThis->regHbaCccPorts = 0; + pThis->uCccTimeout = 0; + pThis->uCccPortNr = 0; + pThis->uCccNr = 0; + + pThis->f64BitAddr = false; + pThis->u32PortsInterrupted = 0; + pThis->f8ByteMMIO4BytesWrittenSuccessfully = false; + /** Clear the HBA Reset bit */ + pThis->regHbaCtrl &= ~AHCI_HBA_CTRL_HR; +} + +/** + * Memory mapped I/O Handler for read operations. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param GCPhysAddr Physical address (in GC) where the read starts. + * @param pv Where to store the result. + * @param cb Number of bytes read. + */ +PDMBOTHCBDECL(int) ahciMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + int rc = VINF_SUCCESS; + + /* Break up 64 bits reads into two dword reads. */ + if (cb == 8) + { + rc = ahciMMIORead(pDevIns, pvUser, GCPhysAddr, pv, 4); + if (RT_FAILURE(rc)) + return rc; + + return ahciMMIORead(pDevIns, pvUser, GCPhysAddr + 4, (uint8_t *)pv + 4, 4); + } + + Log2(("#%d ahciMMIORead: pvUser=%p:{%.*Rhxs} cb=%d GCPhysAddr=%RGp rc=%Rrc\n", + pDevIns->iInstance, pv, cb, pv, cb, GCPhysAddr, rc)); + + /* + * If the access offset is smaller than AHCI_HBA_GLOBAL_SIZE the guest accesses the global registers. + * Otherwise it accesses the registers of a port. + */ + uint32_t uOffset = (GCPhysAddr - pAhci->MMIOBase); + uint32_t iReg; + + if (uOffset < AHCI_HBA_GLOBAL_SIZE) + { + iReg = uOffset >> 2; + Log3(("%s: Trying to read from global register %u\n", __FUNCTION__, iReg)); + if (iReg < RT_ELEMENTS(g_aOpRegs)) + { + const AHCIOPREG *pReg = &g_aOpRegs[iReg]; + rc = pReg->pfnRead(pAhci, iReg, (uint32_t *)pv); + } + else + { + Log3(("%s: Trying to read global register %u/%u!!!\n", __FUNCTION__, iReg, RT_ELEMENTS(g_aOpRegs))); + *(uint32_t *)pv = 0; + } + } + else + { + uint32_t iRegOffset; + uint32_t iPort; + + /* Calculate accessed port. */ + uOffset -= AHCI_HBA_GLOBAL_SIZE; + iPort = uOffset / AHCI_PORT_REGISTER_SIZE; + iRegOffset = (uOffset % AHCI_PORT_REGISTER_SIZE); + iReg = iRegOffset >> 2; + + Log3(("%s: Trying to read from port %u and register %u\n", __FUNCTION__, iPort, iReg)); + + if (RT_LIKELY( iPort < pAhci->cPortsImpl + && iReg < RT_ELEMENTS(g_aPortOpRegs))) + { + const AHCIPORTOPREG *pPortReg = &g_aPortOpRegs[iReg]; + rc = pPortReg->pfnRead(pAhci, &pAhci->ahciPort[iPort], iReg, (uint32_t *)pv); + } + else + { + Log3(("%s: Trying to read port %u register %u/%u!!!\n", __FUNCTION__, iPort, iReg, RT_ELEMENTS(g_aPortOpRegs))); + rc = VINF_IOM_MMIO_UNUSED_00; + } + + /* + * Windows Vista tries to read one byte from some registers instead of four. + * Correct the value according to the read size. + */ + if (RT_SUCCESS(rc) && cb != sizeof(uint32_t)) + { + switch (cb) + { + case 1: + { + uint8_t uNewValue; + uint8_t *p = (uint8_t *)pv; + + iRegOffset &= 3; + Log3(("%s: iRegOffset=%u\n", __FUNCTION__, iRegOffset)); + uNewValue = p[iRegOffset]; + /* Clear old value */ + *(uint32_t *)pv = 0; + *(uint8_t *)pv = uNewValue; + break; + } + default: + AssertMsgFailed(("%s: unsupported access width cb=%d uOffset=%x iPort=%x iRegOffset=%x iReg=%x!!!\n", __FUNCTION__, cb, uOffset, iPort, iRegOffset, iReg)); + } + } + } + + Log2(("#%d ahciMMIORead: return pvUser=%p:{%.*Rhxs} cb=%d GCPhysAddr=%RGp rc=%Rrc\n", + pDevIns->iInstance, pv, cb, pv, cb, GCPhysAddr, rc)); + return rc; +} + + +/** + * Memory mapped I/O Handler for write operations. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param GCPhysAddr Physical address (in GC) where the read starts. + * @param pv Where to fetch the result. + * @param cb Number of bytes to write. + */ +PDMBOTHCBDECL(int) ahciMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + int rc = VINF_SUCCESS; + + /* Break up 64 bits writes into two dword writes. */ + if (cb == 8) + { + /* + * Only write the first 4 bytes if they weren't already. + * It is possible that the last write to the register caused a world + * switch and we entered this function again. + * Writing the first 4 bytes again could cause indeterminate behavior + * which can cause errors in the guest. + */ + if (!pAhci->f8ByteMMIO4BytesWrittenSuccessfully) + { + rc = ahciMMIOWrite(pDevIns, pvUser, GCPhysAddr, pv, 4); + if (rc != VINF_SUCCESS) + return rc; + + pAhci->f8ByteMMIO4BytesWrittenSuccessfully = true; + } + + rc = ahciMMIOWrite(pDevIns, pvUser, GCPhysAddr + 4, (uint8_t *)pv + 4, 4); + /* + * Reset flag again so that the first 4 bytes are written again on the next + * 8byte MMIO access. + */ + if (rc == VINF_SUCCESS) + pAhci->f8ByteMMIO4BytesWrittenSuccessfully = false; + + return rc; + } + + Log2(("#%d ahciMMIOWrite: pvUser=%p:{%.*Rhxs} cb=%d GCPhysAddr=%RGp\n", + pDevIns->iInstance, pv, cb, pv, cb, GCPhysAddr)); + + /* Validate access. */ + if (cb != sizeof(uint32_t)) + { + Log2(("%s: Bad write size!!! GCPhysAddr=%RGp cb=%d\n", __FUNCTION__, GCPhysAddr, cb)); + return VINF_SUCCESS; + } + if (GCPhysAddr & 0x3) + { + Log2(("%s: Unaligned write!!! GCPhysAddr=%RGp cb=%d\n", __FUNCTION__, GCPhysAddr, cb)); + return VINF_SUCCESS; + } + + /* + * If the access offset is smaller than 100h the guest accesses the global registers. + * Otherwise it accesses the registers of a port. + */ + uint32_t uOffset = (GCPhysAddr - pAhci->MMIOBase); + uint32_t iReg; + if (uOffset < AHCI_HBA_GLOBAL_SIZE) + { + Log3(("Write global HBA register\n")); + iReg = uOffset >> 2; + if (iReg < RT_ELEMENTS(g_aOpRegs)) + { + const AHCIOPREG *pReg = &g_aOpRegs[iReg]; + rc = pReg->pfnWrite(pAhci, iReg, *(uint32_t *)pv); + } + else + { + Log3(("%s: Trying to write global register %u/%u!!!\n", __FUNCTION__, iReg, RT_ELEMENTS(g_aOpRegs))); + rc = VINF_SUCCESS; + } + } + else + { + uint32_t iPort; + Log3(("Write Port register\n")); + /* Calculate accessed port. */ + uOffset -= AHCI_HBA_GLOBAL_SIZE; + iPort = uOffset / AHCI_PORT_REGISTER_SIZE; + iReg = (uOffset % AHCI_PORT_REGISTER_SIZE) >> 2; + Log3(("%s: Trying to write to port %u and register %u\n", __FUNCTION__, iPort, iReg)); + if (RT_LIKELY( iPort < pAhci->cPortsImpl + && iReg < RT_ELEMENTS(g_aPortOpRegs))) + { + const AHCIPORTOPREG *pPortReg = &g_aPortOpRegs[iReg]; + rc = pPortReg->pfnWrite(pAhci, &pAhci->ahciPort[iPort], iReg, *(uint32_t *)pv); + } + else + { + Log3(("%s: Trying to write port %u register %u/%u!!!\n", __FUNCTION__, iPort, iReg, RT_ELEMENTS(g_aPortOpRegs))); + rc = VINF_SUCCESS; + } + } + + return rc; +} + +PDMBOTHCBDECL(int) ahciIOPortWrite1(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) +{ + uint32_t iChannel = (uint32_t)(uintptr_t)pvUser; + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + PAHCIATACONTROLLER pCtl = &pAhci->aCts[iChannel]; + + Assert(iChannel < 2); + + return ataControllerIOPortWrite1(pCtl, Port, u32, cb); +} + +PDMBOTHCBDECL(int) ahciIOPortRead1(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + uint32_t iChannel = (uint32_t)(uintptr_t)pvUser; + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + PAHCIATACONTROLLER pCtl = &pAhci->aCts[iChannel]; + + Assert(iChannel < 2); + + return ataControllerIOPortRead1(pCtl, Port, pu32, cb); +} + +PDMBOTHCBDECL(int) ahciIOPortWrite2(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) +{ + uint32_t iChannel = (uint32_t)(uintptr_t)pvUser; + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + PAHCIATACONTROLLER pCtl = &pAhci->aCts[iChannel]; + + Assert(iChannel < 2); + + return ataControllerIOPortWrite2(pCtl, Port, u32, cb); +} + +PDMBOTHCBDECL(int) ahciIOPortRead2(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + uint32_t iChannel = (uint32_t)(uintptr_t)pvUser; + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + PAHCIATACONTROLLER pCtl = &pAhci->aCts[iChannel]; + + Assert(iChannel < 2); + + return ataControllerIOPortRead2(pCtl, Port, pu32, cb); +} + +PDMBOTHCBDECL(int) ahciLegacyFakeWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) +{ + AssertMsgFailed(("Should not happen\n")); + return VINF_SUCCESS; +} + +PDMBOTHCBDECL(int) ahciLegacyFakeRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + AssertMsgFailed(("Should not happen\n")); + return VINF_SUCCESS; +} + +#ifndef IN_RING0 +/** + * Port I/O Handler for primary port range IN string operations. + * @see FNIOMIOPORTINSTRING for details. + */ +PDMBOTHCBDECL(int) ahciIOPortReadStr1(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrDst, PRTGCUINTREG pcTransfer, unsigned cb) +{ + uint32_t iChannel = (uint32_t)(uintptr_t)pvUser; + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + PAHCIATACONTROLLER pCtl = &pAhci->aCts[iChannel]; + + Assert(iChannel < 2); + + return ataControllerIOPortReadStr1(pCtl, Port, pGCPtrDst, pcTransfer, cb); +} + + +/** + * Port I/O Handler for primary port range OUT string operations. + * @see FNIOMIOPORTOUTSTRING for details. + */ +PDMBOTHCBDECL(int) ahciIOPortWriteStr1(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrSrc, PRTGCUINTREG pcTransfer, unsigned cb) +{ + uint32_t iChannel = (uint32_t)(uintptr_t)pvUser; + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + PAHCIATACONTROLLER pCtl = &pAhci->aCts[iChannel]; + + Assert(iChannel < 2); + + return ataControllerIOPortReadStr1(pCtl, Port, pGCPtrSrc, pcTransfer, cb); +} +#endif /* !IN_RING0 */ + +#ifdef IN_RING3 + +static DECLCALLBACK(int) ahciMMIOMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType) +{ + PAHCI pThis = PCIDEV_2_PAHCI(pPciDev); + PPDMDEVINS pDevIns = pPciDev->pDevIns; + int rc = VINF_SUCCESS; + + Log2(("%s: registering MMIO area at GCPhysAddr=%RGp cb=%u\n", __FUNCTION__, GCPhysAddress, cb)); + + Assert(enmType == PCI_ADDRESS_SPACE_MEM); + Assert(cb >= 4352); + + /* We use the assigned size here, because we currently only support page aligned MMIO ranges. */ + rc = PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, NULL, + ahciMMIOWrite, ahciMMIORead, NULL, "AHCI"); + if (RT_FAILURE(rc)) + return rc; + + if (pThis->fR0Enabled) + { + rc = PDMDevHlpMMIORegisterR0(pDevIns, GCPhysAddress, cb, 0, + "ahciMMIOWrite", "ahciMMIORead", NULL); + if (RT_FAILURE(rc)) + return rc; + } + + if (pThis->fGCEnabled) + { + rc = PDMDevHlpMMIORegisterGC(pDevIns, GCPhysAddress, cb, 0, + "ahciMMIOWrite", "ahciMMIORead", NULL); + if (RT_FAILURE(rc)) + return rc; + } + + pThis->MMIOBase = GCPhysAddress; + return rc; +} + +/** + * Map the legacy I/O port ranges to make Solaris work with the controller. + */ +static DECLCALLBACK(int) ahciLegacyFakeIORangeMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType) +{ + PAHCI pThis = PCIDEV_2_PAHCI(pPciDev); + PPDMDEVINS pDevIns = pPciDev->pDevIns; + int rc = VINF_SUCCESS; + + Log2(("%s: registering fake I/O area at GCPhysAddr=%RGp cb=%u\n", __FUNCTION__, GCPhysAddress, cb)); + + Assert(enmType == PCI_ADDRESS_SPACE_IO); + + /* We use the assigned size here, because we currently only support page aligned MMIO ranges. */ + rc = PDMDevHlpIOPortRegister(pDevIns, (RTIOPORT)GCPhysAddress, cb, NULL, + ahciLegacyFakeWrite, ahciLegacyFakeRead, NULL, NULL, "AHCI Fake"); + if (RT_FAILURE(rc)) + return rc; + + if (pThis->fR0Enabled) + { + rc = PDMDevHlpIOPortRegisterR0(pDevIns, (RTIOPORT)GCPhysAddress, cb, 0, + "ahciLegacyFakeWrite", "ahciLegacyFakeRead", NULL, NULL, "AHCI Fake"); + if (RT_FAILURE(rc)) + return rc; + } + + if (pThis->fGCEnabled) + { + rc = PDMDevHlpIOPortRegisterGC(pDevIns, (RTIOPORT)GCPhysAddress, cb, 0, + "ahciLegacyFakeWrite", "ahciLegacyFakeRead", NULL, NULL, "AHCI Fake"); + if (RT_FAILURE(rc)) + return rc; + } + + return rc; +} + +/* -=-=-=-=-=- PAHCI::ILeds -=-=-=-=-=- */ + +/** + * Gets the pointer to the status LED of a unit. + * + * @returns VBox status code. + * @param pInterface Pointer to the interface structure containing the called function pointer. + * @param iLUN The unit which status LED we desire. + * @param ppLed Where to store the LED pointer. + */ +static DECLCALLBACK(int) ahciStatus_QueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) +{ + PAHCI pAhci = PDMILEDPORTS_2_PAHCI(pInterface); + if (iLUN < AHCI_MAX_NR_PORTS_IMPL) + { + *ppLed = &pAhci->ahciPort[iLUN].Led; + Assert((*ppLed)->u32Magic == PDMLED_MAGIC); + return VINF_SUCCESS; + } + return VERR_PDM_LUN_NOT_FOUND; +} + +/** + * Queries an interface to the driver. + * + * @returns Pointer to interface. + * @returns NULL if the interface was not supported by the device. + * @param pInterface Pointer to ATADevState::IBase. + * @param enmInterface The requested interface identification. + */ +static DECLCALLBACK(void *) ahciStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) +{ + PAHCI pAhci = PDMIBASE_2_PAHCI(pInterface); + switch (enmInterface) + { + case PDMINTERFACE_BASE: + return &pAhci->IBase; + case PDMINTERFACE_LED_PORTS: + return &pAhci->ILeds; + default: + return NULL; + } +} + +/** + * Query interface method for the AHCI port. + */ +static DECLCALLBACK(void *) ahciPortQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) +{ + PAHCIPort pAhciPort = PDMIBASE_2_PAHCIPORT(pInterface); + switch (enmInterface) + { + case PDMINTERFACE_BASE: + return &pAhciPort->IBase; + case PDMINTERFACE_BLOCK_PORT: + return &pAhciPort->IPort; + case PDMINTERFACE_BLOCK_ASYNC_PORT: + return &pAhciPort->IPortAsync; + case PDMINTERFACE_MOUNT_NOTIFY: + return &pAhciPort->IMountNotify; + default: + return NULL; + } +} + +static DECLCALLBACK(void) ahciRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) +{ + uint32_t i; + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + + pAhci->pDevInsRC += offDelta; + pAhci->pHbaCccTimerRC = TMTimerRCPtr(pAhci->pHbaCccTimerR3); + pAhci->pNotifierQueueRC = PDMQueueRCPtr(pAhci->pNotifierQueueR3); + + /* Relocate every port. */ + for (i = 0; i < RT_ELEMENTS(pAhci->ahciPort); i++) + { + PAHCIPort pAhciPort = &pAhci->ahciPort[i]; + pAhciPort->pAhciRC += offDelta; + pAhciPort->pDevInsRC += offDelta; + } + + /* Relocate emulated ATA controllers. */ + for (i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + ataControllerRelocate(&pAhci->aCts[i], offDelta); +} + +#ifdef DEBUG + +/** + * Dump info about the FIS + * + * @returns nothing + * @param pAhciPort The port the command FIS was read from. + * @param cmdFis The FIS to print info from. + */ +static void ahciDumpFisInfo(PAHCIPort pAhciPort, uint8_t *cmdFis) +{ + ahciLog(("%s: *** Begin FIS info dump. ***\n", __FUNCTION__)); + /* Print FIS type. */ + switch (cmdFis[AHCI_CMDFIS_TYPE]) + { + case AHCI_CMDFIS_TYPE_H2D: + { + ahciLog(("%s: Command Fis type: H2D\n", __FUNCTION__)); + ahciLog(("%s: Command Fis size: %d bytes\n", __FUNCTION__, AHCI_CMDFIS_TYPE_H2D_SIZE)); + if (cmdFis[AHCI_CMDFIS_BITS] & AHCI_CMDFIS_C) + { + ahciLog(("%s: Command register update\n", __FUNCTION__)); + } + else + { + ahciLog(("%s: Control register update\n", __FUNCTION__)); + } + ahciLog(("%s: CMD=%#04x \"%s\"\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_CMD], ATACmdText(cmdFis[AHCI_CMDFIS_CMD]))); + ahciLog(("%s: FEAT=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_FET])); + ahciLog(("%s: SECTN=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_SECTN])); + ahciLog(("%s: CYLL=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_CYLL])); + ahciLog(("%s: CYLH=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_CYLH])); + ahciLog(("%s: HEAD=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_HEAD])); + + ahciLog(("%s: SECTNEXP=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_SECTNEXP])); + ahciLog(("%s: CYLLEXP=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_CYLLEXP])); + ahciLog(("%s: CYLHEXP=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_CYLHEXP])); + ahciLog(("%s: FETEXP=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_FETEXP])); + + ahciLog(("%s: SECTC=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_SECTC])); + ahciLog(("%s: SECTCEXP=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_SECTCEXP])); + ahciLog(("%s: CTL=%#04x\n", __FUNCTION__, cmdFis[AHCI_CMDFIS_CTL])); + if (cmdFis[AHCI_CMDFIS_CTL] & AHCI_CMDFIS_CTL_SRST) + { + ahciLog(("%s: Reset bit is set\n", __FUNCTION__)); + } + } + break; + case AHCI_CMDFIS_TYPE_D2H: + { + ahciLog(("%s: Command Fis type D2H\n", __FUNCTION__)); + ahciLog(("%s: Command Fis size: %d\n", __FUNCTION__, AHCI_CMDFIS_TYPE_D2H_SIZE)); + } + break; + case AHCI_CMDFIS_TYPE_SETDEVBITS: + { + ahciLog(("%s: Command Fis type Set Device Bits\n", __FUNCTION__)); + ahciLog(("%s: Command Fis size: %d\n", __FUNCTION__, AHCI_CMDFIS_TYPE_SETDEVBITS_SIZE)); + } + break; + case AHCI_CMDFIS_TYPE_DMAACTD2H: + { + ahciLog(("%s: Command Fis type DMA Activate H2D\n", __FUNCTION__)); + ahciLog(("%s: Command Fis size: %d\n", __FUNCTION__, AHCI_CMDFIS_TYPE_DMAACTD2H_SIZE)); + } + break; + case AHCI_CMDFIS_TYPE_DMASETUP: + { + ahciLog(("%s: Command Fis type DMA Setup\n", __FUNCTION__)); + ahciLog(("%s: Command Fis size: %d\n", __FUNCTION__, AHCI_CMDFIS_TYPE_DMASETUP_SIZE)); + } + break; + case AHCI_CMDFIS_TYPE_PIOSETUP: + { + ahciLog(("%s: Command Fis type PIO Setup\n", __FUNCTION__)); + ahciLog(("%s: Command Fis size: %d\n", __FUNCTION__, AHCI_CMDFIS_TYPE_PIOSETUP_SIZE)); + } + break; + case AHCI_CMDFIS_TYPE_DATA: + { + ahciLog(("%s: Command Fis type Data\n", __FUNCTION__)); + } + break; + default: + ahciLog(("%s: ERROR Unknown command FIS type\n", __FUNCTION__)); + break; + } + ahciLog(("%s: *** End FIS info dump. ***\n", __FUNCTION__)); +} + +/** + * Dump info about the command header + * + * @returns nothing + * @param pAhciPort Poitner to the port the command header was read from. + * @param pCmdHdr The command header to print info from. + */ +static void ahciDumpCmdHdrInfo(PAHCIPort pAhciPort, CmdHdr *pCmdHdr) +{ + ahciLog(("%s: *** Begin command header info dump. ***\n", __FUNCTION__)); + ahciLog(("%s: Number of Scatter/Gatther List entries: %u\n", __FUNCTION__, AHCI_CMDHDR_PRDTL_ENTRIES(pCmdHdr->u32DescInf))); + if (pCmdHdr->u32DescInf & AHCI_CMDHDR_C) + ahciLog(("%s: Clear busy upon R_OK\n", __FUNCTION__)); + if (pCmdHdr->u32DescInf & AHCI_CMDHDR_B) + ahciLog(("%s: BIST Fis\n", __FUNCTION__)); + if (pCmdHdr->u32DescInf & AHCI_CMDHDR_R) + ahciLog(("%s: Device Reset Fis\n", __FUNCTION__)); + if (pCmdHdr->u32DescInf & AHCI_CMDHDR_P) + ahciLog(("%s: Command prefetchable\n", __FUNCTION__)); + if (pCmdHdr->u32DescInf & AHCI_CMDHDR_W) + ahciLog(("%s: Device write\n", __FUNCTION__)); + else + ahciLog(("%s: Device read\n", __FUNCTION__)); + if (pCmdHdr->u32DescInf & AHCI_CMDHDR_A) + ahciLog(("%s: ATAPI command\n", __FUNCTION__)); + else + ahciLog(("%s: ATA command\n", __FUNCTION__)); + + ahciLog(("%s: Command FIS length %u DW\n", __FUNCTION__, (pCmdHdr->u32DescInf & AHCI_CMDHDR_CFL_MASK))); + ahciLog(("%s: *** End command header info dump. ***\n", __FUNCTION__)); +} +#endif /* DEBUG */ + +/** + * Post the first D2H FIS from the device into guest memory. + * + * @returns nothing + * @param pAhciPort Pointer to the port which "receives" the FIS. + */ +static void ahciPostFirstD2HFisIntoMemory(PAHCIPort pAhciPort) +{ + uint8_t d2hFis[AHCI_CMDFIS_TYPE_D2H_SIZE]; + + pAhciPort->fFirstD2HFisSend = true; + + ahciLog(("%s: Sending First D2H FIS from FIFO\n", __FUNCTION__)); + memset(&d2hFis[0], 0, sizeof(d2hFis)); + d2hFis[AHCI_CMDFIS_TYPE] = AHCI_CMDFIS_TYPE_D2H; + d2hFis[AHCI_CMDFIS_ERR] = 0x01; + + d2hFis[AHCI_CMDFIS_STS] = 0x00; + + /* Set the signature based on the device type. */ + if (pAhciPort->fATAPI) + { + d2hFis[AHCI_CMDFIS_CYLL] = 0x14; + d2hFis[AHCI_CMDFIS_CYLH] = 0xeb; + } + else + { + d2hFis[AHCI_CMDFIS_CYLL] = 0x00; + d2hFis[AHCI_CMDFIS_CYLH] = 0x00; + } + + d2hFis[AHCI_CMDFIS_HEAD] = 0x00; + d2hFis[AHCI_CMDFIS_SECTN] = 0x01; + d2hFis[AHCI_CMDFIS_SECTC] = 0x01; + + pAhciPort->regTFD = (1 << 8) | ATA_STAT_SEEK | ATA_STAT_WRERR; + + ahciPostFisIntoMemory(pAhciPort, AHCI_CMDFIS_TYPE_D2H, d2hFis); +} + +/** + * Post the FIS in the memory area allocated by the guest and set interrupt if neccessary. + * + * @returns VBox status code + * @param pAhciPort The port which "receives" the FIS. + * @param uFisType The type of the FIS. + * @param pCmdFis Pointer to the FIS which is to be posted into memory. + */ +static int ahciPostFisIntoMemory(PAHCIPort pAhciPort, unsigned uFisType, uint8_t *pCmdFis) +{ + int rc = VINF_SUCCESS; + RTGCPHYS GCPhysAddrRecFis = pAhciPort->GCPhysAddrFb; + unsigned cbFis = 0; + + ahciLog(("%s: pAhciPort=%p uFisType=%u pCmdFis=%p\n", __FUNCTION__, pAhciPort, uFisType, pCmdFis)); + + if (pAhciPort->regCMD & AHCI_PORT_CMD_FRE) + { + AssertMsg(GCPhysAddrRecFis, ("%s: GCPhysAddrRecFis is 0\n", __FUNCTION__)); + + /* Determine the offset and size of the FIS based on uFisType. */ + switch (uFisType) + { + case AHCI_CMDFIS_TYPE_D2H: + { + GCPhysAddrRecFis += AHCI_RECFIS_RFIS_OFFSET; + cbFis = AHCI_CMDFIS_TYPE_D2H_SIZE; + } + break; + case AHCI_CMDFIS_TYPE_SETDEVBITS: + { + GCPhysAddrRecFis += AHCI_RECFIS_SDBFIS_OFFSET; + cbFis = AHCI_CMDFIS_TYPE_SETDEVBITS_SIZE; + } + break; + case AHCI_CMDFIS_TYPE_DMASETUP: + { + GCPhysAddrRecFis += AHCI_RECFIS_DSFIS_OFFSET; + cbFis = AHCI_CMDFIS_TYPE_DMASETUP_SIZE; + } + break; + case AHCI_CMDFIS_TYPE_PIOSETUP: + { + GCPhysAddrRecFis += AHCI_RECFIS_PSFIS_OFFSET; + cbFis = AHCI_CMDFIS_TYPE_PIOSETUP_SIZE; + } + break; + default: + /* + * We should post the unknown FIS into memory too but this never happens because + * we know which FIS types we generate. ;) + */ + AssertMsgFailed(("%s: Unknown FIS type!\n", __FUNCTION__)); + } + + /* Post the FIS into memory. */ + ahciLog(("%s: PDMDevHlpPhysWrite GCPhysAddrRecFis=%RGp cbFis=%u\n", __FUNCTION__, GCPhysAddrRecFis, cbFis)); + PDMDevHlpPhysWrite(pAhciPort->CTX_SUFF(pDevIns), GCPhysAddrRecFis, pCmdFis, cbFis); + } + + return rc; +} + +DECLINLINE(void) ataH2BE_U16(uint8_t *pbBuf, uint16_t val) +{ + pbBuf[0] = val >> 8; + pbBuf[1] = val; +} + + +DECLINLINE(void) ataH2BE_U24(uint8_t *pbBuf, uint32_t val) +{ + pbBuf[0] = val >> 16; + pbBuf[1] = val >> 8; + pbBuf[2] = val; +} + + +DECLINLINE(void) ataH2BE_U32(uint8_t *pbBuf, uint32_t val) +{ + pbBuf[0] = val >> 24; + pbBuf[1] = val >> 16; + pbBuf[2] = val >> 8; + pbBuf[3] = val; +} + + +DECLINLINE(uint16_t) ataBE2H_U16(const uint8_t *pbBuf) +{ + return (pbBuf[0] << 8) | pbBuf[1]; +} + + +DECLINLINE(uint32_t) ataBE2H_U24(const uint8_t *pbBuf) +{ + return (pbBuf[0] << 16) | (pbBuf[1] << 8) | pbBuf[2]; +} + + +DECLINLINE(uint32_t) ataBE2H_U32(const uint8_t *pbBuf) +{ + return (pbBuf[0] << 24) | (pbBuf[1] << 16) | (pbBuf[2] << 8) | pbBuf[3]; +} + + +DECLINLINE(void) ataLBA2MSF(uint8_t *pbBuf, uint32_t iATAPILBA) +{ + iATAPILBA += 150; + pbBuf[0] = (iATAPILBA / 75) / 60; + pbBuf[1] = (iATAPILBA / 75) % 60; + pbBuf[2] = iATAPILBA % 75; +} + + +DECLINLINE(uint32_t) ataMSF2LBA(const uint8_t *pbBuf) +{ + return (pbBuf[0] * 60 + pbBuf[1]) * 75 + pbBuf[2]; +} + +static void atapiCmdOK(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState) +{ + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + pAhciPortTaskState->cmdFis[AHCI_CMDFIS_SECTN] = (pAhciPortTaskState->cmdFis[AHCI_CMDFIS_SECTN] & ~7) + | ((pAhciPortTaskState->uTxDir != PDMBLOCKTXDIR_TO_DEVICE) ? ATAPI_INT_REASON_IO : 0) + | (!pAhciPortTaskState->cbTransfer ? ATAPI_INT_REASON_CD : 0); + pAhciPort->uATAPISenseKey = SCSI_SENSE_NONE; + pAhciPort->uATAPIASC = SCSI_ASC_NONE; +} + + +static void atapiCmdError(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState, uint8_t uATAPISenseKey, uint8_t uATAPIASC) +{ + pAhciPortTaskState->uATARegError = uATAPISenseKey << 4; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR; + pAhciPortTaskState->cmdFis[AHCI_CMDFIS_SECTN] = (pAhciPortTaskState->cmdFis[AHCI_CMDFIS_SECTN] & ~7) | + ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; + pAhciPort->uATAPISenseKey = uATAPISenseKey; + pAhciPort->uATAPIASC = uATAPIASC; +} + +static void ataSCSIPadStr(uint8_t *pbDst, const char *pbSrc, uint32_t cbSize) +{ + for (uint32_t i = 0; i < cbSize; i++) + { + if (*pbSrc) + pbDst[i] = *pbSrc++; + else + pbDst[i] = ' '; + } +} + +static void ataPadString(uint8_t *pbDst, const char *pbSrc, uint32_t cbSize) +{ + for (uint32_t i = 0; i < cbSize; i++) + { + if (*pbSrc) + pbDst[i ^ 1] = *pbSrc++; + else + pbDst[i ^ 1] = ' '; + } +} + +static int ahciIdentifySS(PAHCIPort pAhciPort, void *pvBuf) +{ + uint16_t *p; + int rc = VINF_SUCCESS; + + p = (uint16_t *)pvBuf; + memset(p, 0, 512); + p[0] = RT_H2LE_U16(0x0040); + p[1] = RT_H2LE_U16(RT_MIN(pAhciPort->PCHSGeometry.cCylinders, 16383)); + p[3] = RT_H2LE_U16(pAhciPort->PCHSGeometry.cHeads); + /* Block size; obsolete, but required for the BIOS. */ + p[5] = RT_H2LE_U16(512); + p[6] = RT_H2LE_U16(pAhciPort->PCHSGeometry.cSectors); + ataPadString((uint8_t *)(p + 10), pAhciPort->szSerialNumber, AHCI_SERIAL_NUMBER_LENGTH); /* serial number */ + p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */ + p[21] = RT_H2LE_U16(512); /* XXX: retired, cache size in sectors */ + p[22] = RT_H2LE_U16(0); /* ECC bytes per sector */ + ataPadString((uint8_t *)(p + 23), pAhciPort->szFirmwareRevision, AHCI_FIRMWARE_REVISION_LENGTH); /* firmware version */ + ataPadString((uint8_t *)(p + 27), pAhciPort->szModelNumber, AHCI_MODEL_NUMBER_LENGTH); /* model */ +#if ATA_MAX_MULT_SECTORS > 1 + p[47] = RT_H2LE_U16(0x8000 | ATA_MAX_MULT_SECTORS); +#endif + p[48] = RT_H2LE_U16(1); /* dword I/O, used by the BIOS */ + p[49] = RT_H2LE_U16(1 << 11 | 1 << 9 | 1 << 8); /* DMA and LBA supported */ + p[50] = RT_H2LE_U16(1 << 14); /* No drive specific standby timer minimum */ + p[51] = RT_H2LE_U16(240); /* PIO transfer cycle */ + p[52] = RT_H2LE_U16(240); /* DMA transfer cycle */ + p[53] = RT_H2LE_U16(1 | 1 << 1 | 1 << 2); /* words 54-58,64-70,88 valid */ + p[54] = RT_H2LE_U16(RT_MIN(pAhciPort->PCHSGeometry.cCylinders, 16383)); + p[55] = RT_H2LE_U16(pAhciPort->PCHSGeometry.cHeads); + p[56] = RT_H2LE_U16(pAhciPort->PCHSGeometry.cSectors); + p[57] = RT_H2LE_U16(RT_MIN(pAhciPort->PCHSGeometry.cCylinders, 16383) * pAhciPort->PCHSGeometry.cHeads * pAhciPort->PCHSGeometry.cSectors); + p[58] = RT_H2LE_U16(RT_MIN(pAhciPort->PCHSGeometry.cCylinders, 16383) * pAhciPort->PCHSGeometry.cHeads * pAhciPort->PCHSGeometry.cSectors >> 16); + if (pAhciPort->cMultSectors) + p[59] = RT_H2LE_U16(0x100 | pAhciPort->cMultSectors); + if (pAhciPort->cTotalSectors <= (1 << 28) - 1) + { + p[60] = RT_H2LE_U16(pAhciPort->cTotalSectors); + p[61] = RT_H2LE_U16(pAhciPort->cTotalSectors >> 16); + } + else + { + /* Report maximum number of sectors possible with LBA28 */ + p[60] = RT_H2LE_U16(((1 << 28) - 1) & 0xffff); + p[61] = RT_H2LE_U16(((1 << 28) - 1) >> 16); + } + p[63] = RT_H2LE_U16(ATA_TRANSFER_ID(ATA_MODE_MDMA, ATA_MDMA_MODE_MAX, pAhciPort->uATATransferMode)); /* MDMA modes supported / mode enabled */ + p[64] = RT_H2LE_U16(ATA_PIO_MODE_MAX > 2 ? (1 << (ATA_PIO_MODE_MAX - 2)) - 1 : 0); /* PIO modes beyond PIO2 supported */ + p[65] = RT_H2LE_U16(120); /* minimum DMA multiword tx cycle time */ + p[66] = RT_H2LE_U16(120); /* recommended DMA multiword tx cycle time */ + p[67] = RT_H2LE_U16(120); /* minimum PIO cycle time without flow control */ + p[68] = RT_H2LE_U16(120); /* minimum PIO cycle time with IORDY flow control */ + p[80] = RT_H2LE_U16(0x7e); /* support everything up to ATA/ATAPI-6 */ + p[81] = RT_H2LE_U16(0x22); /* conforms to ATA/ATAPI-6 */ + p[82] = RT_H2LE_U16(1 << 3 | 1 << 5 | 1 << 6); /* supports power management, write cache and look-ahead */ + p[83] = RT_H2LE_U16(1 << 14 | 1 << 10 | 1 << 12 | 1 << 13); /* supports LBA48, FLUSH CACHE and FLUSH CACHE EXT */ + p[84] = RT_H2LE_U16(1 << 14); + p[85] = RT_H2LE_U16(1 << 3 | 1 << 5 | 1 << 6); /* enabled power management, write cache and look-ahead */ + p[86] = RT_H2LE_U16(1 << 10 | 1 << 12 | 1 << 13); /* enabled LBA48, FLUSH CACHE and FLUSH CACHE EXT */ + p[87] = RT_H2LE_U16(1 << 14); + p[88] = RT_H2LE_U16(ATA_TRANSFER_ID(ATA_MODE_UDMA, ATA_UDMA_MODE_MAX, pAhciPort->uATATransferMode)); /* UDMA modes supported / mode enabled */ + p[93] = RT_H2LE_U16(0x00); + p[100] = RT_H2LE_U16(pAhciPort->cTotalSectors); + p[101] = RT_H2LE_U16(pAhciPort->cTotalSectors >> 16); + p[102] = RT_H2LE_U16(pAhciPort->cTotalSectors >> 32); + p[103] = RT_H2LE_U16(pAhciPort->cTotalSectors >> 48); + + /* The following are SATA specific */ + p[75] = RT_H2LE_U16(31); /* We support 32 commands */ + p[76] = RT_H2LE_U16((1 << 8) | (1 << 2)); /* Native command queuing and Serial ATA Gen2 (3.0 Gbps) speed supported */ + + return VINF_SUCCESS; +} + +typedef int (*PAtapiFunc)(PAHCIPORTTASKSTATE, PAHCIPort, int *); + +static int atapiGetConfigurationSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiIdentifySS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiInquirySS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiMechanismStatusSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiModeSenseErrorRecoverySS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiModeSenseCDStatusSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiReadCapacitySS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiReadDiscInformationSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiReadTOCNormalSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiReadTOCMultiSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiReadTOCRawSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiReadTrackInformationSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +static int atapiRequestSenseSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); +//static int atapiPassthroughSS(PAHCIPORTTASKSTATE, PAHCIPort, int *); + +/** + * Source/sink function indexes for g_apfnAtapiFuncs. + */ +typedef enum ATAPIFN +{ + ATAFN_SS_NULL = 0, + ATAFN_SS_ATAPI_GET_CONFIGURATION, + ATAFN_SS_ATAPI_IDENTIFY, + ATAFN_SS_ATAPI_INQUIRY, + ATAFN_SS_ATAPI_MECHANISM_STATUS, + ATAFN_SS_ATAPI_MODE_SENSE_ERROR_RECOVERY, + ATAFN_SS_ATAPI_MODE_SENSE_CD_STATUS, + ATAFN_SS_ATAPI_READ_CAPACITY, + ATAFN_SS_ATAPI_READ_DISC_INFORMATION, + ATAFN_SS_ATAPI_READ_TOC_NORMAL, + ATAFN_SS_ATAPI_READ_TOC_MULTI, + ATAFN_SS_ATAPI_READ_TOC_RAW, + ATAFN_SS_ATAPI_READ_TRACK_INFORMATION, + ATAFN_SS_ATAPI_REQUEST_SENSE, + //ATAFN_SS_ATAPI_PASSTHROUGH, + ATAFN_SS_MAX +} ATAPIFN; + +/** + * Array of source/sink functions, the index is ATAFNSS. + * Make sure ATAFNSS and this array match! + */ +static const PAtapiFunc g_apfnAtapiFuncs[ATAFN_SS_MAX] = +{ + NULL, + atapiGetConfigurationSS, + atapiIdentifySS, + atapiInquirySS, + atapiMechanismStatusSS, + atapiModeSenseErrorRecoverySS, + atapiModeSenseCDStatusSS, + atapiReadCapacitySS, + atapiReadDiscInformationSS, + atapiReadTOCNormalSS, + atapiReadTOCMultiSS, + atapiReadTOCRawSS, + atapiReadTrackInformationSS, + atapiRequestSenseSS + //atapiPassthroughSS +}; + +static int atapiIdentifySS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint16_t p[256]; + char aSerial[20]; + RTUUID Uuid; + int rc; + + rc = pAhciPort->pDrvBlock ? pAhciPort->pDrvBlock->pfnGetUuid(pAhciPort->pDrvBlock, &Uuid) : RTUuidClear(&Uuid); + if (RT_FAILURE(rc) || RTUuidIsNull(&Uuid)) + { + /* Generate a predictable serial for drives which don't have a UUID. */ + RTStrPrintf(aSerial, sizeof(aSerial), "VB%x-1a2b3c4d", + pAhciPort->iLUN); + } + else + RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]); + + memset(p, 0, 512); + /* Removable CDROM, 50us response, 12 byte packets */ + p[0] = RT_H2LE_U16(2 << 14 | 5 << 8 | 1 << 7 | 2 << 5 | 0 << 0); + ataPadString((uint8_t *)(p + 10), aSerial, 20); /* serial number */ + p[20] = RT_H2LE_U16(3); /* XXX: retired, cache type */ + p[21] = RT_H2LE_U16(512); /* XXX: retired, cache size in sectors */ + ataPadString((uint8_t *)(p + 23), "1.0", 8); /* firmware version */ + ataPadString((uint8_t *)(p + 27), "VBOX CD-ROM", 40); /* model */ + p[49] = RT_H2LE_U16(1 << 11 | 1 << 9 | 1 << 8); /* DMA and LBA supported */ + p[50] = RT_H2LE_U16(1 << 14); /* No drive specific standby timer minimum */ + p[51] = RT_H2LE_U16(240); /* PIO transfer cycle */ + p[52] = RT_H2LE_U16(240); /* DMA transfer cycle */ + p[53] = RT_H2LE_U16(1 << 1 | 1 << 2); /* words 64-70,88 are valid */ + p[63] = RT_H2LE_U16(ATA_TRANSFER_ID(ATA_MODE_MDMA, ATA_MDMA_MODE_MAX, pAhciPort->uATATransferMode)); /* MDMA modes supported / mode enabled */ + p[64] = RT_H2LE_U16(ATA_PIO_MODE_MAX > 2 ? (1 << (ATA_PIO_MODE_MAX - 2)) - 1 : 0); /* PIO modes beyond PIO2 supported */ + p[65] = RT_H2LE_U16(120); /* minimum DMA multiword tx cycle time */ + p[66] = RT_H2LE_U16(120); /* recommended DMA multiword tx cycle time */ + p[67] = RT_H2LE_U16(120); /* minimum PIO cycle time without flow control */ + p[68] = RT_H2LE_U16(120); /* minimum PIO cycle time with IORDY flow control */ + p[73] = RT_H2LE_U16(0x003e); /* ATAPI CDROM major */ + p[74] = RT_H2LE_U16(9); /* ATAPI CDROM minor */ + p[75] = RT_H2LE_U16(1); /* queue depth 1 */ + p[80] = RT_H2LE_U16(0x7e); /* support everything up to ATA/ATAPI-6 */ + p[81] = RT_H2LE_U16(0x22); /* conforms to ATA/ATAPI-6 */ + p[82] = RT_H2LE_U16(1 << 4 | 1 << 9); /* supports packet command set and DEVICE RESET */ + p[83] = RT_H2LE_U16(1 << 14); + p[84] = RT_H2LE_U16(1 << 14); + p[85] = RT_H2LE_U16(1 << 4 | 1 << 9); /* enabled packet command set and DEVICE RESET */ + p[86] = RT_H2LE_U16(0); + p[87] = RT_H2LE_U16(1 << 14); + p[88] = RT_H2LE_U16(ATA_TRANSFER_ID(ATA_MODE_UDMA, ATA_UDMA_MODE_MAX, pAhciPort->uATATransferMode)); /* UDMA modes supported / mode enabled */ + p[93] = RT_H2LE_U16((1 | 1 << 1) << ((pAhciPort->iLUN & 1) == 0 ? 0 : 8) | 1 << 13 | 1 << 14); + + /* The following are SATA specific */ + p[75] = RT_H2LE_U16(31); /* We support 32 commands */ + p[76] = RT_H2LE_U16((1 << 8) | (1 << 2)); /* Native command queuing and Serial ATA Gen2 (3.0 Gbps) speed supported */ + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&p[0], sizeof(p)); + *pcbData = sizeof(p); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + +static int atapiReadCapacitySS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[8]; + + ataH2BE_U32(aBuf, pAhciPort->cTotalSectors - 1); + ataH2BE_U32(aBuf + 4, 2048); + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiReadDiscInformationSS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[34]; + + memset(aBuf, '\0', 34); + ataH2BE_U16(aBuf, 32); + aBuf[2] = (0 << 4) | (3 << 2) | (2 << 0); /* not erasable, complete session, complete disc */ + aBuf[3] = 1; /* number of first track */ + aBuf[4] = 1; /* number of sessions (LSB) */ + aBuf[5] = 1; /* first track number in last session (LSB) */ + aBuf[6] = 1; /* last track number in last session (LSB) */ + aBuf[7] = (0 << 7) | (0 << 6) | (1 << 5) | (0 << 2) | (0 << 0); /* disc id not valid, disc bar code not valid, unrestricted use, not dirty, not RW medium */ + aBuf[8] = 0; /* disc type = CD-ROM */ + aBuf[9] = 0; /* number of sessions (MSB) */ + aBuf[10] = 0; /* number of sessions (MSB) */ + aBuf[11] = 0; /* number of sessions (MSB) */ + ataH2BE_U32(aBuf + 16, 0x00ffffff); /* last session lead-in start time is not available */ + ataH2BE_U32(aBuf + 20, 0x00ffffff); /* last possible start time for lead-out is not available */ + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiReadTrackInformationSS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[36]; + + /* Accept address/number type of 1 only, and only track 1 exists. */ + if ((pAhciPortTaskState->aATAPICmd[1] & 0x03) != 1 || ataBE2H_U32(&pAhciPortTaskState->aATAPICmd[2]) != 1) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + return VINF_SUCCESS; + } + memset(aBuf, '\0', 36); + ataH2BE_U16(aBuf, 34); + aBuf[2] = 1; /* track number (LSB) */ + aBuf[3] = 1; /* session number (LSB) */ + aBuf[5] = (0 << 5) | (0 << 4) | (4 << 0); /* not damaged, primary copy, data track */ + aBuf[6] = (0 << 7) | (0 << 6) | (0 << 5) | (0 << 6) | (1 << 0); /* not reserved track, not blank, not packet writing, not fixed packet, data mode 1 */ + aBuf[7] = (0 << 1) | (0 << 0); /* last recorded address not valid, next recordable address not valid */ + ataH2BE_U32(aBuf + 8, 0); /* track start address is 0 */ + ataH2BE_U32(aBuf + 24, pAhciPort->cTotalSectors); /* track size */ + aBuf[32] = 0; /* track number (MSB) */ + aBuf[33] = 0; /* session number (MSB) */ + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiGetConfigurationSS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[32]; + + /* Accept valid request types only, and only starting feature 0. */ + if ((pAhciPortTaskState->aATAPICmd[1] & 0x03) == 3 || ataBE2H_U16(&pAhciPortTaskState->aATAPICmd[2]) != 0) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + return VINF_SUCCESS; + } + memset(aBuf, '\0', 32); + ataH2BE_U32(aBuf, 16); + /** @todo implement switching between CD-ROM and DVD-ROM profile (the only + * way to differentiate them right now is based on the image size). Also + * implement signalling "no current profile" if no medium is loaded. */ + ataH2BE_U16(aBuf + 6, 0x08); /* current profile: read-only CD */ + + ataH2BE_U16(aBuf + 8, 0); /* feature 0: list of profiles supported */ + aBuf[10] = (0 << 2) | (1 << 1) | (1 || 0); /* version 0, persistent, current */ + aBuf[11] = 8; /* additional bytes for profiles */ + /* The MMC-3 spec says that DVD-ROM read capability should be reported + * before CD-ROM read capability. */ + ataH2BE_U16(aBuf + 12, 0x10); /* profile: read-only DVD */ + aBuf[14] = (0 << 0); /* NOT current profile */ + ataH2BE_U16(aBuf + 16, 0x08); /* profile: read only CD */ + aBuf[18] = (1 << 0); /* current profile */ + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiInquirySS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[36]; + + aBuf[0] = 0x05; /* CD-ROM */ + aBuf[1] = 0x80; /* removable */ + aBuf[2] = 0x00; /* ISO */ + aBuf[3] = 0x21; /* ATAPI-2 (XXX: put ATAPI-4 ?) */ + aBuf[4] = 31; /* additional length */ + aBuf[5] = 0; /* reserved */ + aBuf[6] = 0; /* reserved */ + aBuf[7] = 0; /* reserved */ + ataSCSIPadStr(aBuf + 8, "VBOX", 8); + ataSCSIPadStr(aBuf + 16, "CD-ROM", 16); + ataSCSIPadStr(aBuf + 32, "1.0", 4); + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiModeSenseErrorRecoverySS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[16]; + + ataH2BE_U16(&aBuf[0], 16 + 6); + aBuf[2] = 0x70; + aBuf[3] = 0; + aBuf[4] = 0; + aBuf[5] = 0; + aBuf[6] = 0; + aBuf[7] = 0; + + aBuf[8] = 0x01; + aBuf[9] = 0x06; + aBuf[10] = 0x00; + aBuf[11] = 0x05; + aBuf[12] = 0x00; + aBuf[13] = 0x00; + aBuf[14] = 0x00; + aBuf[15] = 0x00; + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiModeSenseCDStatusSS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[40]; + + ataH2BE_U16(&aBuf[0], 38); + aBuf[2] = 0x70; + aBuf[3] = 0; + aBuf[4] = 0; + aBuf[5] = 0; + aBuf[6] = 0; + aBuf[7] = 0; + + aBuf[8] = 0x2a; + aBuf[9] = 30; /* page length */ + aBuf[10] = 0x08; /* DVD-ROM read support */ + aBuf[11] = 0x00; /* no write support */ + /* The following claims we support audio play. This is obviously false, + * but the Linux generic CDROM support makes many features depend on this + * capability. If it's not set, this causes many things to be disabled. */ + aBuf[12] = 0x71; /* multisession support, mode 2 form 1/2 support, audio play */ + aBuf[13] = 0x00; /* no subchannel reads supported */ + aBuf[14] = (1 << 0) | (1 << 3) | (1 << 5); /* lock supported, eject supported, tray type loading mechanism */ + if (pAhciPort->pDrvMount->pfnIsLocked(pAhciPort->pDrvMount)) + aBuf[14] |= 1 << 1; /* report lock state */ + aBuf[15] = 0; /* no subchannel reads supported, no separate audio volume control, no changer etc. */ + ataH2BE_U16(&aBuf[16], 5632); /* (obsolete) claim 32x speed support */ + ataH2BE_U16(&aBuf[18], 2); /* number of audio volume levels */ + ataH2BE_U16(&aBuf[20], 128); /* buffer size supported in Kbyte - We don't have a buffer because we write directly into guest memory. + Just write the value DevATA is using. */ + ataH2BE_U16(&aBuf[22], 5632); /* (obsolete) current read speed 32x */ + aBuf[24] = 0; /* reserved */ + aBuf[25] = 0; /* reserved for digital audio (see idx 15) */ + ataH2BE_U16(&aBuf[26], 0); /* (obsolete) maximum write speed */ + ataH2BE_U16(&aBuf[28], 0); /* (obsolete) current write speed */ + ataH2BE_U16(&aBuf[30], 0); /* copy management revision supported 0=no CSS */ + aBuf[32] = 0; /* reserved */ + aBuf[33] = 0; /* reserved */ + aBuf[34] = 0; /* reserved */ + aBuf[35] = 1; /* rotation control CAV */ + ataH2BE_U16(&aBuf[36], 0); /* current write speed */ + ataH2BE_U16(&aBuf[38], 0); /* number of write speed performance descriptors */ + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiRequestSenseSS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[18]; + + memset(&aBuf[0], 0, 18); + aBuf[0] = 0x70 | (1 << 7); + aBuf[2] = pAhciPort->uATAPISenseKey; + aBuf[7] = 10; + aBuf[12] = pAhciPort->uATAPIASC; + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiMechanismStatusSS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[8]; + + ataH2BE_U16(&aBuf[0], 0); + /* no current LBA */ + aBuf[2] = 0; + aBuf[3] = 0; + aBuf[4] = 0; + aBuf[5] = 1; + ataH2BE_U16(aBuf + 6, 0); + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiReadTOCNormalSS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[20], *q, iStartTrack; + bool fMSF; + uint32_t cbSize; + + fMSF = (pAhciPortTaskState->aATAPICmd[1] >> 1) & 1; + iStartTrack = pAhciPortTaskState->aATAPICmd[6]; + if (iStartTrack > 1 && iStartTrack != 0xaa) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + return VINF_SUCCESS; + } + q = aBuf + 2; + *q++ = 1; /* first session */ + *q++ = 1; /* last session */ + if (iStartTrack <= 1) + { + *q++ = 0; /* reserved */ + *q++ = 0x14; /* ADR, control */ + *q++ = 1; /* track number */ + *q++ = 0; /* reserved */ + if (fMSF) + { + *q++ = 0; /* reserved */ + ataLBA2MSF(q, 0); + q += 3; + } + else + { + /* sector 0 */ + ataH2BE_U32(q, 0); + q += 4; + } + } + /* lead out track */ + *q++ = 0; /* reserved */ + *q++ = 0x14; /* ADR, control */ + *q++ = 0xaa; /* track number */ + *q++ = 0; /* reserved */ + if (fMSF) + { + *q++ = 0; /* reserved */ + ataLBA2MSF(q, pAhciPort->cTotalSectors); + q += 3; + } + else + { + ataH2BE_U32(q, pAhciPort->cTotalSectors); + q += 4; + } + cbSize = q - aBuf; + ataH2BE_U16(aBuf, cbSize - 2); + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], cbSize); + *pcbData = cbSize; + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiReadTOCMultiSS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[12]; + bool fMSF; + + fMSF = (pAhciPortTaskState->aATAPICmd[1] >> 1) & 1; + /* multi session: only a single session defined */ +/** @todo double-check this stuff against what a real drive says for a CD-ROM (not a CD-R) with only a single data session. Maybe solve the problem with "cdrdao read-toc" not being able to figure out whether numbers are in BCD or hex. */ + memset(aBuf, 0, 12); + aBuf[1] = 0x0a; + aBuf[2] = 0x01; + aBuf[3] = 0x01; + aBuf[5] = 0x14; /* ADR, control */ + aBuf[6] = 1; /* first track in last complete session */ + if (fMSF) + { + aBuf[8] = 0; /* reserved */ + ataLBA2MSF(&aBuf[9], 0); + } + else + { + /* sector 0 */ + ataH2BE_U32(aBuf + 8, 0); + } + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], sizeof(aBuf)); + *pcbData = sizeof(aBuf); + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + + +static int atapiReadTOCRawSS(PAHCIPORTTASKSTATE pAhciPortTaskState, PAHCIPort pAhciPort, int *pcbData) +{ + uint8_t aBuf[50]; /* Counted a maximum of 45 bytes but better be on the safe side. */ + uint8_t *q, iStartTrack; + bool fMSF; + uint32_t cbSize; + + fMSF = (pAhciPortTaskState->aATAPICmd[1] >> 1) & 1; + iStartTrack = pAhciPortTaskState->aATAPICmd[6]; + + q = aBuf + 2; + *q++ = 1; /* first session */ + *q++ = 1; /* last session */ + + *q++ = 1; /* session number */ + *q++ = 0x14; /* data track */ + *q++ = 0; /* track number */ + *q++ = 0xa0; /* first track in program area */ + *q++ = 0; /* min */ + *q++ = 0; /* sec */ + *q++ = 0; /* frame */ + *q++ = 0; + *q++ = 1; /* first track */ + *q++ = 0x00; /* disk type CD-DA or CD data */ + *q++ = 0; + + *q++ = 1; /* session number */ + *q++ = 0x14; /* data track */ + *q++ = 0; /* track number */ + *q++ = 0xa1; /* last track in program area */ + *q++ = 0; /* min */ + *q++ = 0; /* sec */ + *q++ = 0; /* frame */ + *q++ = 0; + *q++ = 1; /* last track */ + *q++ = 0; + *q++ = 0; + + *q++ = 1; /* session number */ + *q++ = 0x14; /* data track */ + *q++ = 0; /* track number */ + *q++ = 0xa2; /* lead-out */ + *q++ = 0; /* min */ + *q++ = 0; /* sec */ + *q++ = 0; /* frame */ + if (fMSF) + { + *q++ = 0; /* reserved */ + ataLBA2MSF(q, pAhciPort->cTotalSectors); + q += 3; + } + else + { + ataH2BE_U32(q, pAhciPort->cTotalSectors); + q += 4; + } + + *q++ = 1; /* session number */ + *q++ = 0x14; /* ADR, control */ + *q++ = 0; /* track number */ + *q++ = 1; /* point */ + *q++ = 0; /* min */ + *q++ = 0; /* sec */ + *q++ = 0; /* frame */ + if (fMSF) + { + *q++ = 0; /* reserved */ + ataLBA2MSF(q, 0); + q += 3; + } + else + { + /* sector 0 */ + ataH2BE_U32(q, 0); + q += 4; + } + + cbSize = q - aBuf; + ataH2BE_U16(aBuf, cbSize - 2); + + /* Copy the buffer in to the scatter gather list. */ + ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, (void *)&aBuf[0], cbSize); + *pcbData = cbSize; + + atapiCmdOK(pAhciPort, pAhciPortTaskState); + return VINF_SUCCESS; +} + +static int atapiDoTransfer(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState, ATAPIFN iSourceSink) +{ + int cbTransfered; + int rc, rcSourceSink; + + /* Create scatter gather list. */ + rc = ahciScatterGatherListCreate(pAhciPort, pAhciPortTaskState, false); + if (RT_FAILURE(rc)) + AssertMsgFailed(("Getting number of list elements failed rc=%Rrc\n", rc)); + + rcSourceSink = g_apfnAtapiFuncs[iSourceSink](pAhciPortTaskState, pAhciPort, &cbTransfered); + + pAhciPortTaskState->cmdHdr.u32PRDBC = cbTransfered; + + rc = ahciScatterGatherListDestroy(pAhciPort, pAhciPortTaskState); + if (RT_FAILURE(rc)) + AssertMsgFailed(("Destroying list failed rc=%Rrc\n", rc)); + + /* Write updated command header into memory of the guest. */ + PDMDevHlpPhysWrite(pAhciPort->CTX_SUFF(pDevIns), pAhciPortTaskState->GCPhysCmdHdrAddr, &pAhciPortTaskState->cmdHdr, sizeof(CmdHdr)); + + return rcSourceSink; +} + +static int atapiReadSectors(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState, uint32_t iATAPILBA, uint32_t cSectors, uint32_t cbSector) +{ + Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iATAPILBA)); + + switch (cbSector) + { + case 2048: + pAhciPortTaskState->uOffset = iATAPILBA * cbSector; + pAhciPortTaskState->cbTransfer = cSectors * cbSector; + break; + case 2352: + { + AssertMsgFailed(("2352 read\n")); + /* @todo: This is quite difficult as the data transfer is not handled here + We need to add the sync bytes etc. here and modify the pointers + and size of the sg entries. */ +#if 0 + uint8_t *pbBuf = s->CTXSUFF(pbIOBuffer); + + for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++) + { + /* sync bytes */ + *pbBuf++ = 0x00; + memset(pbBuf, 0xff, 11); + pbBuf += 11; + /* MSF */ + ataLBA2MSF(pbBuf, i); + pbBuf += 3; + *pbBuf++ = 0x01; /* mode 1 data */ + /* data */ + rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)i * 2048, pbBuf, 2048); + if (RT_FAILURE(rc)) + break; + pbBuf += 2048; + /* ECC */ + memset(pbBuf, 0, 288); + pbBuf += 288; + } +#endif + pAhciPortTaskState->uOffset = iATAPILBA * 2048; + pAhciPortTaskState->cbTransfer = cSectors * 2048; + } + break; + default: + AssertMsgFailed(("Unsupported sectors size\n")); + break; + } + + return VINF_SUCCESS; +} + +static int atapiParseCmdVirtualATAPI(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState) +{ + int rc = PDMBLOCKTXDIR_NONE; + const uint8_t *pbPacket; + uint32_t cbMax; + + pbPacket = pAhciPortTaskState->aATAPICmd; + + ahciLog(("%s: ATAPI CMD=%#04x \"%s\"\n", __FUNCTION__, pbPacket[0], SCSICmdText(pbPacket[0]))); + + switch (pbPacket[0]) + { + case SCSI_TEST_UNIT_READY: + if (pAhciPort->cNotifiedMediaChange > 0) + { + if (pAhciPort->cNotifiedMediaChange-- > 2) + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + else + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + } + else if (pAhciPort->pDrvMount->pfnIsMounted(pAhciPort->pDrvMount)) + atapiCmdOK(pAhciPort, pAhciPortTaskState); + else + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + case SCSI_MODE_SENSE_10: + { + uint8_t uPageControl, uPageCode; + cbMax = ataBE2H_U16(pbPacket + 7); + uPageControl = pbPacket[2] >> 6; + uPageCode = pbPacket[2] & 0x3f; + switch (uPageControl) + { + case SCSI_PAGECONTROL_CURRENT: + switch (uPageCode) + { + case SCSI_MODEPAGE_ERROR_RECOVERY: + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_MODE_SENSE_ERROR_RECOVERY); + break; + case SCSI_MODEPAGE_CD_STATUS: + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_MODE_SENSE_CD_STATUS); + break; + default: + goto error_cmd; + } + break; + case SCSI_PAGECONTROL_CHANGEABLE: + goto error_cmd; + case SCSI_PAGECONTROL_DEFAULT: + goto error_cmd; + default: + case SCSI_PAGECONTROL_SAVED: + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_SAVING_PARAMETERS_NOT_SUPPORTED); + break; + } + } + break; + case SCSI_REQUEST_SENSE: + cbMax = pbPacket[4]; + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_REQUEST_SENSE); + break; + case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL: + if (pAhciPort->pDrvMount->pfnIsMounted(pAhciPort->pDrvMount)) + { + if (pbPacket[4] & 1) + pAhciPort->pDrvMount->pfnLock(pAhciPort->pDrvMount); + else + pAhciPort->pDrvMount->pfnUnlock(pAhciPort->pDrvMount); + atapiCmdOK(pAhciPort, pAhciPortTaskState); + } + else + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + case SCSI_READ_10: + case SCSI_READ_12: + { + uint32_t cSectors, iATAPILBA; + + if (pAhciPort->cNotifiedMediaChange > 0) + { + pAhciPort->cNotifiedMediaChange-- ; + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!pAhciPort->pDrvMount->pfnIsMounted(pAhciPort->pDrvMount)) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + if (pbPacket[0] == SCSI_READ_10) + cSectors = ataBE2H_U16(pbPacket + 7); + else + cSectors = ataBE2H_U32(pbPacket + 6); + iATAPILBA = ataBE2H_U32(pbPacket + 2); + if (cSectors == 0) + { + atapiCmdOK(pAhciPort, pAhciPortTaskState); + break; + } + if ((uint64_t)iATAPILBA + cSectors > pAhciPort->cTotalSectors) + { + /* Rate limited logging, one log line per second. For + * guests that insist on reading from places outside the + * valid area this often generates too many release log + * entries otherwise. */ + static uint64_t uLastLogTS = 0; + if (RTTimeMilliTS() >= uLastLogTS + 1000) + { + LogRel(("AHCI ATAPI: LUN#%d: CD-ROM block number %Ld invalid (READ)\n", pAhciPort->iLUN, (uint64_t)iATAPILBA + cSectors)); + uLastLogTS = RTTimeMilliTS(); + } + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_BLOCK_OOR); + break; + } + atapiReadSectors(pAhciPort, pAhciPortTaskState, iATAPILBA, cSectors, 2048); + rc = PDMBLOCKTXDIR_FROM_DEVICE; + } + break; + case SCSI_READ_CD: + { + uint32_t cSectors, iATAPILBA; + + if (pAhciPort->cNotifiedMediaChange > 0) + { + pAhciPort->cNotifiedMediaChange-- ; + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!pAhciPort->pDrvMount->pfnIsMounted(pAhciPort->pDrvMount)) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + cSectors = (pbPacket[6] << 16) | (pbPacket[7] << 8) | pbPacket[8]; + iATAPILBA = ataBE2H_U32(pbPacket + 2); + if (cSectors == 0) + { + atapiCmdOK(pAhciPort, pAhciPortTaskState); + break; + } + if ((uint64_t)iATAPILBA + cSectors > pAhciPort->cTotalSectors) + { + /* Rate limited logging, one log line per second. For + * guests that insist on reading from places outside the + * valid area this often generates too many release log + * entries otherwise. */ + static uint64_t uLastLogTS = 0; + if (RTTimeMilliTS() >= uLastLogTS + 1000) + { + LogRel(("AHCI ATA: LUN#%d: CD-ROM block number %Ld invalid (READ CD)\n", pAhciPort->iLUN, (uint64_t)iATAPILBA + cSectors)); + uLastLogTS = RTTimeMilliTS(); + } + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_BLOCK_OOR); + break; + } + switch (pbPacket[9] & 0xf8) + { + case 0x00: + /* nothing */ + atapiCmdOK(pAhciPort, pAhciPortTaskState); + break; + case 0x10: + /* normal read */ + atapiReadSectors(pAhciPort, pAhciPortTaskState, iATAPILBA, cSectors, 2048); + rc = PDMBLOCKTXDIR_FROM_DEVICE; + break; + case 0xf8: + /* read all data */ + atapiReadSectors(pAhciPort, pAhciPortTaskState, iATAPILBA, cSectors, 2352); + rc = PDMBLOCKTXDIR_FROM_DEVICE; + break; + default: + LogRel(("AHCI ATAPI: LUN#%d: CD-ROM sector format not supported\n", pAhciPort->iLUN)); + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + break; + } + } + break; + case SCSI_SEEK_10: + { + uint32_t iATAPILBA; + if (pAhciPort->cNotifiedMediaChange > 0) + { + pAhciPort->cNotifiedMediaChange-- ; + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!pAhciPort->pDrvMount->pfnIsMounted(pAhciPort->pDrvMount)) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + iATAPILBA = ataBE2H_U32(pbPacket + 2); + if (iATAPILBA > pAhciPort->cTotalSectors) + { + /* Rate limited logging, one log line per second. For + * guests that insist on seeking to places outside the + * valid area this often generates too many release log + * entries otherwise. */ + static uint64_t uLastLogTS = 0; + if (RTTimeMilliTS() >= uLastLogTS + 1000) + { + LogRel(("AHCI ATAPI: LUN#%d: CD-ROM block number %Ld invalid (SEEK)\n", pAhciPort->iLUN, (uint64_t)iATAPILBA)); + uLastLogTS = RTTimeMilliTS(); + } + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_BLOCK_OOR); + break; + } + atapiCmdOK(pAhciPort, pAhciPortTaskState); + pAhciPortTaskState->uATARegStatus |= ATA_STAT_SEEK; /* Linux expects this. */ + } + break; + case SCSI_START_STOP_UNIT: + { + int rc = VINF_SUCCESS; + switch (pbPacket[4] & 3) + { + case 0: /* 00 - Stop motor */ + case 1: /* 01 - Start motor */ + break; + case 2: /* 10 - Eject media */ + /* This must be done from EMT. */ + { + PAHCI pAhci = pAhciPort->CTX_SUFF(pAhci); + PPDMDEVINS pDevIns = pAhci->CTX_SUFF(pDevIns); + PVMREQ pReq; + + rc = VMR3ReqCall(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, + (PFNRT)pAhciPort->pDrvMount->pfnUnmount, 2, pAhciPort->pDrvMount, false); + AssertReleaseRC(rc); + VMR3ReqFree(pReq); + } + break; + case 3: /* 11 - Load media */ + /** @todo rc = s->pDrvMount->pfnLoadMedia(s->pDrvMount) */ + break; + } + if (RT_SUCCESS(rc)) + atapiCmdOK(pAhciPort, pAhciPortTaskState); + else + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIA_LOAD_OR_EJECT_FAILED); + } + break; + case SCSI_MECHANISM_STATUS: + { + cbMax = ataBE2H_U16(pbPacket + 8); + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_MECHANISM_STATUS); + } + break; + case SCSI_READ_TOC_PMA_ATIP: + { + uint8_t format; + + if (pAhciPort->cNotifiedMediaChange > 0) + { + pAhciPort->cNotifiedMediaChange-- ; + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!pAhciPort->pDrvMount->pfnIsMounted(pAhciPort->pDrvMount)) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + cbMax = ataBE2H_U16(pbPacket + 7); + /* SCSI MMC-3 spec says format is at offset 2 (lower 4 bits), + * but Linux kernel uses offset 9 (topmost 2 bits). Hope that + * the other field is clear... */ + format = (pbPacket[2] & 0xf) | (pbPacket[9] >> 6); + switch (format) + { + case 0: + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_READ_TOC_NORMAL); + break; + case 1: + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_READ_TOC_MULTI); + break; + case 2: + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_READ_TOC_RAW); + break; + default: + error_cmd: + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + break; + } + } + break; + case SCSI_READ_CAPACITY: + if (pAhciPort->cNotifiedMediaChange > 0) + { + pAhciPort->cNotifiedMediaChange-- ; + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!pAhciPort->pDrvMount->pfnIsMounted(pAhciPort->pDrvMount)) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_READ_CAPACITY); + break; + case SCSI_READ_DISC_INFORMATION: + if (pAhciPort->cNotifiedMediaChange > 0) + { + pAhciPort->cNotifiedMediaChange-- ; + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!pAhciPort->pDrvMount->pfnIsMounted(pAhciPort->pDrvMount)) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + cbMax = ataBE2H_U16(pbPacket + 7); + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_READ_DISC_INFORMATION); + break; + case SCSI_READ_TRACK_INFORMATION: + if (pAhciPort->cNotifiedMediaChange > 0) + { + pAhciPort->cNotifiedMediaChange-- ; + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ + break; + } + else if (!pAhciPort->pDrvMount->pfnIsMounted(pAhciPort->pDrvMount)) + { + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); + break; + } + cbMax = ataBE2H_U16(pbPacket + 7); + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_READ_TRACK_INFORMATION); + break; + case SCSI_GET_CONFIGURATION: + /* No media change stuff here, it can confuse Linux guests. */ + cbMax = ataBE2H_U16(pbPacket + 7); + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_GET_CONFIGURATION); + break; + case SCSI_INQUIRY: + cbMax = pbPacket[4]; + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_INQUIRY); + break; + default: + atapiCmdError(pAhciPort, pAhciPortTaskState, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE); + break; + } + + return rc; +} + +/** + * Reset all values after a reset of the attached storage device. + * + * @returns nothing + * @param pAhciPort The port the device is attached to. + * @param pAhciPortTaskState The state to get the tag number from. + */ +static void ahciFinishStorageDeviceReset(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState) +{ + /* Send a status good D2H FIS. */ + pAhciPort->fResetDevice = false; + if (pAhciPort->regCMD & AHCI_PORT_CMD_FRE) + ahciPostFirstD2HFisIntoMemory(pAhciPort); + + /* As this is the first D2H FIS after the reset update the signature in the SIG register of the port. */ + pAhciPort->regSIG = 0x101; + ASMAtomicOrU32(&pAhciPort->u32TasksFinished, (1 << pAhciPortTaskState->uTag)); + + ahciHbaSetInterrupt(pAhciPort->CTX_SUFF(pAhci), pAhciPort->iLUN); +} + +/** + * Build a D2H FIS and post into the memory area of the guest. + * + * @returns Nothing + * @param pAhciPort The port of the SATA controller. + * @param pAhciPortTaskState The state of the task. + * @param pCmdFis Pointer to the command FIS from the guest. + * @param fInterrupt If an interrupt should be send to the guest. + */ +static void ahciSendD2HFis(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState, uint8_t *pCmdFis, bool fInterrupt) +{ + uint8_t d2hFis[20]; + bool fAssertIntr = false; + PAHCI pAhci = pAhciPort->CTX_SUFF(pAhci); + + ahciLog(("%s: building D2H Fis\n", __FUNCTION__)); + + if (pAhciPort->regCMD & AHCI_PORT_CMD_FRE) + { + memset(&d2hFis[0], 0, sizeof(d2hFis)); + d2hFis[AHCI_CMDFIS_TYPE] = AHCI_CMDFIS_TYPE_D2H; + d2hFis[AHCI_CMDFIS_BITS] = (fInterrupt ? AHCI_CMDFIS_I : 0); + d2hFis[AHCI_CMDFIS_STS] = pAhciPortTaskState->uATARegStatus; + d2hFis[AHCI_CMDFIS_ERR] = pAhciPortTaskState->uATARegError; + d2hFis[AHCI_CMDFIS_SECTN] = pCmdFis[AHCI_CMDFIS_SECTN]; + d2hFis[AHCI_CMDFIS_CYLL] = pCmdFis[AHCI_CMDFIS_CYLL]; + d2hFis[AHCI_CMDFIS_CYLH] = pCmdFis[AHCI_CMDFIS_CYLH]; + d2hFis[AHCI_CMDFIS_HEAD] = pCmdFis[AHCI_CMDFIS_HEAD]; + d2hFis[AHCI_CMDFIS_SECTNEXP] = pCmdFis[AHCI_CMDFIS_SECTNEXP]; + d2hFis[AHCI_CMDFIS_CYLLEXP] = pCmdFis[AHCI_CMDFIS_CYLLEXP]; + d2hFis[AHCI_CMDFIS_CYLHEXP] = pCmdFis[AHCI_CMDFIS_CYLHEXP]; + d2hFis[AHCI_CMDFIS_SECTC] = pCmdFis[AHCI_CMDFIS_SECTC]; + d2hFis[AHCI_CMDFIS_SECTCEXP] = pCmdFis[AHCI_CMDFIS_SECTCEXP]; + + /* Update registers. */ + pAhciPort->regTFD = (pAhciPortTaskState->uATARegError << 8) | pAhciPortTaskState->uATARegStatus; + + ahciPostFisIntoMemory(pAhciPort, AHCI_CMDFIS_TYPE_D2H, d2hFis); + + if (pAhciPortTaskState->uATARegStatus & ATA_STAT_ERR) + { + /* Error bit is set. */ + pAhciPort->regIS |= AHCI_PORT_IS_TFES; + if (pAhciPort->regIE & AHCI_PORT_IE_TFEE) + fAssertIntr = true; + } + + if (fInterrupt) + { + pAhciPort->regIS |= AHCI_PORT_IS_DHRS; + /* Check if we should assert an interrupt */ + if (pAhciPort->regIE & AHCI_PORT_IE_DHRE) + fAssertIntr = true; + } + + ASMAtomicOrU32(&pAhciPort->u32TasksFinished, (1 << pAhciPortTaskState->uTag)); + + if (fAssertIntr) + ahciHbaSetInterrupt(pAhci, pAhciPort->iLUN); + } +} + +/** + * Build a SDB Fis and post it into the memory area of the guest. + * + * @returns Nothing + * @param pAhciPort The port for which the SDB Fis is send. + * @param uFinishedTasks Bitmask of finished tasks. + * @param pAhciPortTaskState The state of the last task. + * @param fInterrupt If an interrupt should be asserted. + */ +static void ahciSendSDBFis(PAHCIPort pAhciPort, uint32_t uFinishedTasks, PAHCIPORTTASKSTATE pAhciPortTaskState, bool fInterrupt) +{ + uint32_t sdbFis[2]; + bool fAssertIntr = false; + PAHCI pAhci = pAhciPort->CTX_SUFF(pAhci); + + ahciLog(("%s: Building SDB FIS\n", __FUNCTION__)); + + if (pAhciPort->regCMD & AHCI_PORT_CMD_FRE) + { + memset(&sdbFis[0], 0, sizeof(sdbFis)); + sdbFis[0] = AHCI_CMDFIS_TYPE_SETDEVBITS; + sdbFis[0] |= (fInterrupt ? (1 << 14) : 0); + sdbFis[0] |= pAhciPortTaskState->uATARegError << 24; + sdbFis[0] |= (pAhciPortTaskState->uATARegStatus & 0x77) << 16; /* Some bits are marked as reserved and thus are masked out. */ + sdbFis[1] = uFinishedTasks; + + ahciPostFisIntoMemory(pAhciPort, AHCI_CMDFIS_TYPE_SETDEVBITS, (uint8_t *)sdbFis); + + if (pAhciPortTaskState->uATARegStatus & ATA_STAT_ERR) + { + /* Error bit is set. */ + pAhciPort->regIS |= AHCI_PORT_IS_TFES; + if (pAhciPort->regIE & AHCI_PORT_IE_TFEE) + fAssertIntr = true; + } + + if (fInterrupt) + { + pAhciPort->regIS |= AHCI_PORT_IS_SDBS; + /* Check if we should assert an interrupt */ + if (pAhciPort->regIE & AHCI_PORT_IE_SDBE) + fAssertIntr = true; + } + + /* Update registers. */ + pAhciPort->regTFD = (pAhciPortTaskState->uATARegError << 8) | pAhciPortTaskState->uATARegStatus; + + ASMAtomicOrU32(&pAhciPort->u32QueuedTasksFinished, uFinishedTasks); + + if (fAssertIntr) + ahciHbaSetInterrupt(pAhci, pAhciPort->iLUN); + } +} + +static uint32_t ahciGetNSectors(uint8_t *pCmdFis, bool fLBA48) +{ + /* 0 means either 256 (LBA28) or 65536 (LBA48) sectors. */ + if (fLBA48) + { + if (!pCmdFis[AHCI_CMDFIS_SECTC] && !pCmdFis[AHCI_CMDFIS_SECTCEXP]) + return 65536; + else + return pCmdFis[AHCI_CMDFIS_SECTCEXP] << 8 | pCmdFis[AHCI_CMDFIS_SECTC]; + } + else + { + if (!pCmdFis[AHCI_CMDFIS_SECTC]) + return 256; + else + return pCmdFis[AHCI_CMDFIS_SECTC]; + } +} + +static uint64_t ahciGetSector(PAHCIPort pAhciPort, uint8_t *pCmdFis, bool fLBA48) +{ + uint64_t iLBA; + if (pCmdFis[AHCI_CMDFIS_HEAD] & 0x40) + { + /* any LBA variant */ + if (fLBA48) + { + /* LBA48 */ + iLBA = ((uint64_t)pCmdFis[AHCI_CMDFIS_CYLHEXP] << 40) | + ((uint64_t)pCmdFis[AHCI_CMDFIS_CYLLEXP] << 32) | + ((uint64_t)pCmdFis[AHCI_CMDFIS_SECTNEXP] << 24) | + ((uint64_t)pCmdFis[AHCI_CMDFIS_CYLH] << 16) | + ((uint64_t)pCmdFis[AHCI_CMDFIS_CYLL] << 8) | + pCmdFis[AHCI_CMDFIS_SECTN]; + } + else + { + /* LBA */ + iLBA = ((pCmdFis[AHCI_CMDFIS_HEAD] & 0x0f) << 24) | (pCmdFis[AHCI_CMDFIS_CYLH] << 16) | + (pCmdFis[AHCI_CMDFIS_CYLL] << 8) | pCmdFis[AHCI_CMDFIS_SECTN]; + } + } + else + { + /* CHS */ + iLBA = ((pCmdFis[AHCI_CMDFIS_CYLH] << 8) | pCmdFis[AHCI_CMDFIS_CYLL]) * pAhciPort->PCHSGeometry.cHeads * pAhciPort->PCHSGeometry.cSectors + + (pCmdFis[AHCI_CMDFIS_HEAD] & 0x0f) * pAhciPort->PCHSGeometry.cSectors + + (pCmdFis[AHCI_CMDFIS_SECTN] - 1); + } + return iLBA; +} + +static uint64_t ahciGetSectorQueued(uint8_t *pCmdFis) +{ + uint64_t uLBA; + + uLBA = ((uint64_t)pCmdFis[AHCI_CMDFIS_CYLHEXP] << 40) | + ((uint64_t)pCmdFis[AHCI_CMDFIS_CYLLEXP] << 32) | + ((uint64_t)pCmdFis[AHCI_CMDFIS_SECTNEXP] << 24) | + ((uint64_t)pCmdFis[AHCI_CMDFIS_CYLH] << 16) | + ((uint64_t)pCmdFis[AHCI_CMDFIS_CYLL] << 8) | + pCmdFis[AHCI_CMDFIS_SECTN]; + + return uLBA; +} + +DECLINLINE(uint32_t) ahciGetNSectorsQueued(uint8_t *pCmdFis) +{ + if (!pCmdFis[AHCI_CMDFIS_FETEXP] && !pCmdFis[AHCI_CMDFIS_FET]) + return 65536; + else + return pCmdFis[AHCI_CMDFIS_FETEXP] << 8 | pCmdFis[AHCI_CMDFIS_FET]; +} + +DECLINLINE(uint8_t) ahciGetTagQueued(uint8_t *pCmdFis) +{ + return pCmdFis[AHCI_CMDFIS_SECTC] >> 3; +} + +static int ahciScatterGatherListAllocate(PAHCIPORTTASKSTATE pAhciPortTaskState, uint32_t cSGList, uint32_t cbUnaligned) +{ + if (pAhciPortTaskState->cSGListSize < cSGList) + { + /* The entries are not allocated yet or the number is too small. */ + if (pAhciPortTaskState->cSGListSize) + { + RTMemFree(pAhciPortTaskState->pSGListHead); + RTMemFree(pAhciPortTaskState->paSGEntries); + } + + /* Allocate R3 scatter gather list. */ + pAhciPortTaskState->pSGListHead = (PPDMDATASEG)RTMemAllocZ(cSGList * sizeof(PDMDATASEG)); + if (!pAhciPortTaskState->pSGListHead) + return VERR_NO_MEMORY; + + pAhciPortTaskState->paSGEntries = (PAHCIPORTTASKSTATESGENTRY)RTMemAllocZ(cSGList * sizeof(AHCIPORTTASKSTATESGENTRY)); + if (!pAhciPortTaskState->paSGEntries) + return VERR_NO_MEMORY; + + /* Reset usage statistics. */ + pAhciPortTaskState->cSGListSize = cSGList; + pAhciPortTaskState->cSGListTooBig = 0; + } + else if (pAhciPortTaskState->cSGListSize > cSGList) + { + /* + * The list is too big. Increment counter. + * So that the destroying function can free + * the list if it is too big too many times + * in a row. + */ + pAhciPortTaskState->cSGListTooBig++; + } + else + { + /* + * Needed entries matches current size. + * Reset counter. + */ + pAhciPortTaskState->cSGListTooBig = 0; + } + + pAhciPortTaskState->cSGEntries = cSGList; + + if (pAhciPortTaskState->cbBufferUnaligned < cbUnaligned) + { + if (pAhciPortTaskState->pvBufferUnaligned) + RTMemFree(pAhciPortTaskState->pvBufferUnaligned); + + Log(("%s: Allocating buffer for unaligned segments cbUnaligned=%u\n", __FUNCTION__, cbUnaligned)); + + pAhciPortTaskState->pvBufferUnaligned = RTMemAllocZ(cbUnaligned); + if (!pAhciPortTaskState->pvBufferUnaligned) + return VERR_NO_MEMORY; + + pAhciPortTaskState->cbBufferUnaligned = cbUnaligned; + } + + /* Make debugging easier. */ +#ifdef DEBUG + memset(pAhciPortTaskState->pSGListHead, 0, pAhciPortTaskState->cSGListSize * sizeof(PDMDATASEG)); + memset(pAhciPortTaskState->paSGEntries, 0, pAhciPortTaskState->cSGListSize * sizeof(AHCIPORTTASKSTATESGENTRY)); + if (pAhciPortTaskState->pvBufferUnaligned) + memset(pAhciPortTaskState->pvBufferUnaligned, 0, pAhciPortTaskState->cbBufferUnaligned); +#endif + + return VINF_SUCCESS; +} + +/** + * Create scatter gather list descriptors. + * + * @returns VBox status code. + * @param pAhciPort The ahci port. + * @param pAhciPortTaskState The task state which contains the S/G list entries. + * @param fReadonly If the mappings should be readonly. + * @thread EMT + */ +static int ahciScatterGatherListCreate(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState, bool fReadonly) +{ + int rc = VINF_SUCCESS; + CmdHdr *pCmdHdr = &pAhciPortTaskState->cmdHdr; + PPDMDEVINS pDevIns = pAhciPort->CTX_SUFF(pDevIns); + unsigned cActualSGEntry; + unsigned cSGEntriesR3 = 0; /* Needed scatter gather list entries in R3. */ + SGLEntry aSGLEntry[32]; /* Holds read sg entries from guest. Biggest seen number of entries a guest set up. */ + unsigned cSGLEntriesGCRead; + unsigned cSGLEntriesGCLeft; /* Available scatter gather list entries in GC */ + RTGCPHYS GCPhysAddrPRDTLEntryStart; /* Start address to read the entries from. */ + uint32_t cbSegment; /* Size of the current segments in bytes. */ + bool fUnaligned; /* Flag whether the current buffer is unaligned. */ + uint32_t cbUnaligned; /* Size of the unaligned buffers. */ + uint32_t cUnaligned; + bool fDoMapping = false; + RTGCPHYS GCPhysAddrPRDTLUnalignedStart = NIL_RTGCPHYS; + PAHCIPORTTASKSTATESGENTRY pSGInfoCurr = NULL; + PAHCIPORTTASKSTATESGENTRY pSGInfoPrev = NULL; + PPDMDATASEG pSGEntryCurr = NULL; + PPDMDATASEG pSGEntryPrev = NULL; + RTGCPHYS GCPhysBufferPageAlignedPrev = NIL_RTGCPHYS; + uint8_t *pu8BufferUnalignedPos = NULL; + uint32_t cbUnalignedComplete = 0; + + STAM_PROFILE_START(&pAhciPort->StatProfileMapIntoR3, a); + + /* + * We need to calculate the number of SG list entries in R3 first because the data buffers in the guest don't need to be + * page aligned. Hence the number of SG list entries in the guest can differ from the ones we need + * because PDMDevHlpPhysGCPhys2CCPtr works only on a page base. + * In the first pass we calculate the number of segments in R3 and in the second pass we map the guest segments into R3. + */ + for (int i = 0; i < 2; i++) + { + cSGLEntriesGCLeft = AHCI_CMDHDR_PRDTL_ENTRIES(pCmdHdr->u32DescInf); + ahciLog(("%s: cSGEntriesGC=%u\n", __FUNCTION__, cSGLEntriesGCLeft)); + + /* Set start address of the entries. */ + GCPhysAddrPRDTLEntryStart = AHCI_RTGCPHYS_FROM_U32(pCmdHdr->u32CmdTblAddrUp, pCmdHdr->u32CmdTblAddr) + AHCI_CMDHDR_PRDT_OFFSET; + fUnaligned = false; + cbUnaligned = 0; + cUnaligned = 0; + GCPhysBufferPageAlignedPrev = NIL_RTGCPHYS; + + if (fDoMapping) + { + ahciLog(("%s: cSGEntriesR3=%u\n", __FUNCTION__, cSGEntriesR3)); + /* The number of needed SG entries in R3 is known. Allocate needed memory. */ + rc = ahciScatterGatherListAllocate(pAhciPortTaskState, cSGEntriesR3, cbUnalignedComplete); + AssertMsgRC(rc, ("Failed to allocate scatter gather array rc=%Rrc\n", rc)); + + /* We are now able to map the pages into R3. */ + pSGInfoCurr = pAhciPortTaskState->paSGEntries; + pSGEntryCurr = pAhciPortTaskState->pSGListHead; + pSGEntryPrev = pSGEntryCurr; + pSGInfoPrev = pSGInfoCurr; + /* Initialize first segment to remove the need for additional if checks later in the code. */ + pSGEntryCurr->pvSeg = NULL; + pSGEntryCurr->cbSeg = 0; + pSGInfoCurr->fGuestMemory= false; + pu8BufferUnalignedPos = (uint8_t *)pAhciPortTaskState->pvBufferUnaligned; + } + + do + { + cSGLEntriesGCRead = (cSGLEntriesGCLeft < RT_ELEMENTS(aSGLEntry)) ? cSGLEntriesGCLeft : RT_ELEMENTS(aSGLEntry); + cSGLEntriesGCLeft -= cSGLEntriesGCRead; + + /* Read the SG entries. */ + PDMDevHlpPhysRead(pDevIns, GCPhysAddrPRDTLEntryStart, &aSGLEntry[0], cSGLEntriesGCRead * sizeof(SGLEntry)); + + for (cActualSGEntry = 0; cActualSGEntry < cSGLEntriesGCRead; cActualSGEntry++) + { + RTGCPHYS GCPhysAddrDataBase; + uint32_t cbDataToTransfer; + + ahciLog(("%s: cActualSGEntry=%u cSGEntriesR3=%u\n", __FUNCTION__, cActualSGEntry, cSGEntriesR3)); + + cbDataToTransfer = (aSGLEntry[cActualSGEntry].u32DescInf & SGLENTRY_DESCINF_DBC) + 1; + ahciLog(("%s: cbDataToTransfer=%u\n", __FUNCTION__, cbDataToTransfer)); + + /* Check if the buffer is sector aligned. */ + if (cbDataToTransfer % 512 != 0) + { + if (!fUnaligned) + { + /* We are not in an unaligned buffer but this is the first unaligned one. */ + fUnaligned = true; + cbUnaligned = cbDataToTransfer; + GCPhysAddrPRDTLUnalignedStart = GCPhysAddrPRDTLEntryStart + cActualSGEntry * sizeof(SGLEntry); + cSGEntriesR3++; + cUnaligned = 1; + ahciLog(("%s: Unaligned buffer found cb=%d\n", __FUNCTION__, cbDataToTransfer)); + } + else + { + /* We are already in an unaligned buffer and this one is unaligned too. */ + cbUnaligned += cbDataToTransfer; + cUnaligned++; + } + + cbUnalignedComplete += cbDataToTransfer; + } + else /* Guest segment size is sector aligned. */ + { + if (fUnaligned) + { + if (cbUnaligned % 512 == 0) + { + /* + * The last buffer started at an offset + * not aligned to a sector boundary but this buffer + * is sector aligned. Check if the current size of all + * unaligned segments is a multiple of a sector. + * If that's the case we can now map the segments again into R3. + */ + fUnaligned = false; + + if (fDoMapping) + { + /* Set up the entry. */ + pSGInfoCurr->fGuestMemory = false; + pSGInfoCurr->u.temp.GCPhysAddrBaseFirstUnaligned = GCPhysAddrPRDTLUnalignedStart; + pSGInfoCurr->u.temp.cUnaligned = cUnaligned; + pSGInfoCurr->u.temp.pvBuf = pu8BufferUnalignedPos; + + pSGEntryCurr->pvSeg = pu8BufferUnalignedPos; + pSGEntryCurr->cbSeg = cbUnaligned; + pu8BufferUnalignedPos += cbUnaligned; + + /* + * If the transfer is to the device we need to copy the content of the not mapped guest + * segments into the temporary buffer. + */ + if (pAhciPortTaskState->uTxDir == PDMBLOCKTXDIR_TO_DEVICE) + ahciCopyFromSGListIntoBuffer(pDevIns, pSGInfoCurr); + + /* Advance to next entry saving the pointers to the current ones. */ + pSGEntryPrev = pSGEntryCurr; + pSGInfoPrev = pSGInfoCurr; + pSGInfoCurr++; + pSGEntryCurr++; + } + } + else + { + cbUnaligned += cbDataToTransfer; + cbUnalignedComplete += cbDataToTransfer; + cUnaligned++; + } + } + else + { + /* + * The size of the guest segment is sector aligned but it is possible that the segment crosses + * a page boundary in a way splitting the segment into parts which are not sector aligned. + * We have to treat them like unaligned guest segments then. + */ + GCPhysAddrDataBase = AHCI_RTGCPHYS_FROM_U32(aSGLEntry[cActualSGEntry].u32DBAUp, aSGLEntry[cActualSGEntry].u32DBA); + + ahciLog(("%s: GCPhysAddrDataBase=%RGp\n", __FUNCTION__, GCPhysAddrDataBase)); + + /* + * Check if the physical address is page aligned. + */ + if (GCPhysAddrDataBase & PAGE_OFFSET_MASK) + { + RTGCPHYS GCPhysAddrDataNextPage = PHYS_PAGE_ADDRESS(GCPhysAddrDataBase) + PAGE_SIZE; + /* Difference from the buffer start to the next page boundary. */ + uint32_t u32GCPhysAddrDiff = GCPhysAddrDataNextPage - GCPhysAddrDataBase; + + if (u32GCPhysAddrDiff % 512 != 0) + { + if (!fUnaligned) + { + /* We are not in an unaligned buffer but this is the first unaligned one. */ + fUnaligned = true; + cbUnaligned = cbDataToTransfer; + GCPhysAddrPRDTLUnalignedStart = GCPhysAddrPRDTLEntryStart + cActualSGEntry * sizeof(SGLEntry); + cSGEntriesR3++; + cUnaligned = 1; + ahciLog(("%s: Guest segment is sector aligned but crosses a page boundary cb=%d\n", __FUNCTION__, cbDataToTransfer)); + } + else + { + /* We are already in an unaligned buffer and this one is unaligned too. */ + cbUnaligned += cbDataToTransfer; + cUnaligned++; + } + + cbUnalignedComplete += cbDataToTransfer; + } + else + { + ahciLog(("%s: Align page: GCPhysAddrDataBase=%RGp GCPhysAddrDataNextPage=%RGp\n", + __FUNCTION__, GCPhysAddrDataBase, GCPhysAddrDataNextPage)); + + RTGCPHYS GCPhysBufferPageAligned = PHYS_PAGE_ADDRESS(GCPhysAddrDataBase); + + /* Check if the mapping ends at the page boundary and set segment size accordingly. */ + cbSegment = (cbDataToTransfer < u32GCPhysAddrDiff) + ? cbDataToTransfer + : u32GCPhysAddrDiff; + /* Subtract size of the buffer in the actual page. */ + cbDataToTransfer -= cbSegment; + + if (GCPhysBufferPageAlignedPrev != GCPhysBufferPageAligned) + { + /* We don't need to map the buffer if it is in the same page as the previous one. */ + if (fDoMapping) + { + uint8_t *pbMapping; + + pSGInfoCurr->fGuestMemory = true; + + /* Create the mapping. */ + if (fReadonly) + rc = PDMDevHlpPhysGCPhys2CCPtrReadOnly(pDevIns, GCPhysBufferPageAligned, + 0, (const void **)&pbMapping, + &pSGInfoCurr->u.direct.PageLock); + else + rc = PDMDevHlpPhysGCPhys2CCPtr(pDevIns, GCPhysBufferPageAligned, + 0, (void **)&pbMapping, + &pSGInfoCurr->u.direct.PageLock); + + if (RT_FAILURE(rc)) + AssertMsgFailed(("Creating mapping failed rc=%Rrc\n", rc)); + + if ((pbMapping + (GCPhysAddrDataBase - GCPhysBufferPageAligned) == ((uint8_t *)pSGEntryPrev->pvSeg + pSGEntryCurr->cbSeg))) + { + pSGEntryPrev->cbSeg += cbSegment; + ahciLog(("%s: Merged mapping pbMapping=%#p into current segment pvSeg=%#p. New size is cbSeg=%d\n", + __FUNCTION__, pbMapping, pSGEntryPrev->pvSeg, pSGEntryPrev->cbSeg)); + } + else + { + pSGEntryCurr->cbSeg = cbSegment; + + /* Let pvBuf point to the start of the buffer in the page. */ + pSGEntryCurr->pvSeg = pbMapping + + (GCPhysAddrDataBase - GCPhysBufferPageAligned); + + ahciLog(("%s: pvSegBegin=%#p pvSegEnd=%#p\n", __FUNCTION__, + pSGEntryCurr->pvSeg, + (uint8_t *)pSGEntryCurr->pvSeg + pSGEntryCurr->cbSeg)); + + pSGEntryPrev = pSGEntryCurr; + pSGEntryCurr++; + } + + pSGInfoPrev = pSGInfoCurr; + pSGInfoCurr++; + } + else + cSGEntriesR3++; + } + else if (fDoMapping) + { + pSGEntryPrev->cbSeg += cbSegment; + ahciLog(("%s: Buffer is already in previous mapping pvSeg=%#p. New size is cbSeg=%d\n", + __FUNCTION__, pSGEntryPrev->pvSeg, pSGEntryPrev->cbSeg)); + } + + /* Let physical address point to the next page in the buffer. */ + GCPhysAddrDataBase = GCPhysAddrDataNextPage; + GCPhysBufferPageAlignedPrev = GCPhysBufferPageAligned; + } + } + + if (!fUnaligned) + { + /* The address is now page aligned. */ + while (cbDataToTransfer) + { + ahciLog(("%s: GCPhysAddrDataBase=%RGp cbDataToTransfer=%u cSGEntriesR3=%u\n", + __FUNCTION__, GCPhysAddrDataBase, cbDataToTransfer, cSGEntriesR3)); + + /* Check if this is the last page the buffer is in. */ + cbSegment = (cbDataToTransfer < PAGE_SIZE) ? cbDataToTransfer : PAGE_SIZE; + cbDataToTransfer -= cbSegment; + + if (fDoMapping) + { + void *pvMapping; + + pSGInfoCurr->fGuestMemory = true; + + /* Create the mapping. */ + if (fReadonly) + rc = PDMDevHlpPhysGCPhys2CCPtrReadOnly(pDevIns, GCPhysAddrDataBase, 0, (const void **)&pvMapping, &pSGInfoCurr->u.direct.PageLock); + else + rc = PDMDevHlpPhysGCPhys2CCPtr(pDevIns, GCPhysAddrDataBase, 0, &pvMapping, &pSGInfoCurr->u.direct.PageLock); + + if (RT_FAILURE(rc)) + AssertMsgFailed(("Creating mapping failed rc=%Rrc\n", rc)); + + /* Check for adjacent mappings. */ + if (pvMapping == ((uint8_t *)pSGEntryPrev->pvSeg + pSGEntryPrev->cbSeg) + && (pSGInfoPrev->fGuestMemory == true)) + { + /* Yes they are adjacent. Just add the size of this mapping to the previous segment. */ + pSGEntryPrev->cbSeg += cbSegment; + ahciLog(("%s: Merged mapping pvMapping=%#p into current segment pvSeg=%#p. New size is cbSeg=%d\n", + __FUNCTION__, pvMapping, pSGEntryPrev->pvSeg, pSGEntryPrev->cbSeg)); + } + else + { + /* No they are not. Use a new sg entry. */ + pSGEntryCurr->cbSeg = cbSegment; + pSGEntryCurr->pvSeg = pvMapping; + ahciLog(("%s: pvSegBegin=%#p pvSegEnd=%#p\n", __FUNCTION__, + pSGEntryCurr->pvSeg, + (uint8_t *)pSGEntryCurr->pvSeg + pSGEntryCurr->cbSeg)); + pSGEntryPrev = pSGEntryCurr; + pSGEntryCurr++; + } + + pSGInfoPrev = pSGInfoCurr; + pSGInfoCurr++; + } + else + cSGEntriesR3++; + + GCPhysBufferPageAlignedPrev = GCPhysAddrDataBase; + + /* Go to the next page. */ + GCPhysAddrDataBase += PAGE_SIZE; + } + } /* if (!fUnaligned) */ + } /* if !fUnaligned */ + } /* if guest segment is sector aligned. */ + } /* for SGEntries read */ + + /* Set address to the next entries to read. */ + GCPhysAddrPRDTLEntryStart += cSGLEntriesGCRead * sizeof(SGLEntry); + + } while (cSGLEntriesGCLeft); + + fDoMapping = true; + + } /* for passes */ + + /* Check if the last processed segment was unaligned. We need to add it now. */ + if (fUnaligned) + { + /* Set up the entry. */ + AssertMsg(!(cbUnaligned % 512), ("Buffer is not sector aligned\n")); + pSGInfoCurr->fGuestMemory = false; + pSGInfoCurr->u.temp.GCPhysAddrBaseFirstUnaligned = GCPhysAddrPRDTLUnalignedStart; + pSGInfoCurr->u.temp.cUnaligned = cUnaligned; + pSGInfoCurr->u.temp.pvBuf = pu8BufferUnalignedPos; + + pSGEntryCurr->pvSeg = pu8BufferUnalignedPos; + pSGEntryCurr->cbSeg = cbUnaligned; + + /* + * If the transfer is to the device we need to copy the content of the not mapped guest + * segments into the temporary buffer. + */ + if (pAhciPortTaskState->uTxDir == PDMBLOCKTXDIR_TO_DEVICE) + ahciCopyFromSGListIntoBuffer(pDevIns, pSGInfoCurr); + } + + STAM_PROFILE_STOP(&pAhciPort->StatProfileMapIntoR3, a); + + return rc; +} + +/** + * Destroy a scatter gather list and free all occupied resources (mappings, etc.) + * + * @returns VBox status code. + * @param pAhciPort The ahci port. + * @param pAhciPortTaskState The task state which contains the S/G list entries. + */ +static int ahciScatterGatherListDestroy(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState) +{ + PAHCIPORTTASKSTATESGENTRY pSGInfoCurr = pAhciPortTaskState->paSGEntries; + PPDMDEVINS pDevIns = pAhciPort->CTX_SUFF(pDevIns); + + STAM_PROFILE_START(&pAhciPort->StatProfileDestroyScatterGatherList, a); + + for (unsigned cActualSGEntry = 0; cActualSGEntry < pAhciPortTaskState->cSGEntries; cActualSGEntry++) + { + if (pSGInfoCurr->fGuestMemory) + { + /* Release the lock. */ + PDMDevHlpPhysReleasePageMappingLock(pDevIns, &pSGInfoCurr->u.direct.PageLock); + } + else if (pAhciPortTaskState->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE) + { + /* Copy the data into the guest segments now. */ + ahciCopyFromBufferIntoSGList(pDevIns, pSGInfoCurr); + } + + /* Go to the next entry. */ + pSGInfoCurr++; + } + + /* Free allocated memory if the list was too big too many times. */ + if (pAhciPortTaskState->cSGListTooBig >= AHCI_NR_OF_ALLOWED_BIGGER_LISTS) + { + RTMemFree(pAhciPortTaskState->pSGListHead); + RTMemFree(pAhciPortTaskState->paSGEntries); + if (pAhciPortTaskState->pvBufferUnaligned) + RTMemFree(pAhciPortTaskState->pvBufferUnaligned); + pAhciPortTaskState->cSGListSize = 0; + pAhciPortTaskState->cSGListTooBig = 0; + pAhciPortTaskState->pSGListHead = NULL; + pAhciPortTaskState->paSGEntries = NULL; + pAhciPortTaskState->pvBufferUnaligned = NULL; + pAhciPortTaskState->cbBufferUnaligned = 0; + } + + STAM_PROFILE_STOP(&pAhciPort->StatProfileDestroyScatterGatherList, a); + + return VINF_SUCCESS; +} + +/** + * Copy a temporary buffer into a part of the guest scatter gather list + * described by the given descriptor entry. + * + * @returns nothing. + * @param pDevIns Pointer to the device instance data. + * @param pSGInfo Pointer to the segment info structure which describes the guest segments + * to write to which are unaligned. + */ +static void ahciCopyFromBufferIntoSGList(PPDMDEVINS pDevIns, PAHCIPORTTASKSTATESGENTRY pSGInfo) +{ + uint8_t *pu8Buf = (uint8_t *)pSGInfo->u.temp.pvBuf; + SGLEntry aSGLEntries[5]; + uint32_t cSGEntriesLeft = pSGInfo->u.temp.cUnaligned; + RTGCPHYS GCPhysPRDTLStart = pSGInfo->u.temp.GCPhysAddrBaseFirstUnaligned; + + AssertMsg(!pSGInfo->fGuestMemory, ("This is not possible\n")); + + do + { + uint32_t cSGEntriesRead = (cSGEntriesLeft < RT_ELEMENTS(aSGLEntries)) + ? cSGEntriesLeft + : RT_ELEMENTS(aSGLEntries); + + PDMDevHlpPhysRead(pDevIns, GCPhysPRDTLStart, &aSGLEntries[0], cSGEntriesRead * sizeof(SGLEntry)); + + for (uint32_t i = 0; i < cSGEntriesRead; i++) + { + RTGCPHYS GCPhysAddrDataBase = AHCI_RTGCPHYS_FROM_U32(aSGLEntries[i].u32DBAUp, aSGLEntries[i].u32DBA); + uint32_t cbCopied = (aSGLEntries[i].u32DescInf & SGLENTRY_DESCINF_DBC) + 1; + + /* Copy into SG entry. */ + PDMDevHlpPhysWrite(pDevIns, GCPhysAddrDataBase, pu8Buf, cbCopied); + + pu8Buf += cbCopied; + } + + GCPhysPRDTLStart += cSGEntriesRead * sizeof(SGLEntry); + cSGEntriesLeft -= cSGEntriesRead; + } while (cSGEntriesLeft); +} + +/** + * Copy a part of the guest scatter gather list into a temporary buffer. + * + * @returns nothing. + * @param pDevIns Pointer to the device instance data. + * @param pSGInfo Pointer to the segment info structure which describes the guest segments + * to read from which are unaligned. + */ +static void ahciCopyFromSGListIntoBuffer(PPDMDEVINS pDevIns, PAHCIPORTTASKSTATESGENTRY pSGInfo) +{ + uint8_t *pu8Buf = (uint8_t *)pSGInfo->u.temp.pvBuf; + SGLEntry aSGLEntries[5]; + uint32_t cSGEntriesLeft = pSGInfo->u.temp.cUnaligned; + RTGCPHYS GCPhysPRDTLStart = pSGInfo->u.temp.GCPhysAddrBaseFirstUnaligned; + + AssertMsg(!pSGInfo->fGuestMemory, ("This is not possible\n")); + + do + { + uint32_t cSGEntriesRead = (cSGEntriesLeft < RT_ELEMENTS(aSGLEntries)) + ? cSGEntriesLeft + : RT_ELEMENTS(aSGLEntries); + + PDMDevHlpPhysRead(pDevIns, GCPhysPRDTLStart, &aSGLEntries[0], cSGEntriesRead * sizeof(SGLEntry)); + + for (uint32_t i = 0; i < cSGEntriesRead; i++) + { + RTGCPHYS GCPhysAddrDataBase = AHCI_RTGCPHYS_FROM_U32(aSGLEntries[i].u32DBAUp, aSGLEntries[i].u32DBA); + uint32_t cbCopied = (aSGLEntries[i].u32DescInf & SGLENTRY_DESCINF_DBC) + 1; + + /* Copy into buffer. */ + PDMDevHlpPhysRead(pDevIns, GCPhysAddrDataBase, pu8Buf, cbCopied); + + pu8Buf += cbCopied; + } + + GCPhysPRDTLStart += cSGEntriesRead * sizeof(SGLEntry); + cSGEntriesLeft -= cSGEntriesRead; + } while (cSGEntriesLeft); +} + + +/** + * Copy the content of a buffer to a scatter gather list. + * + * @returns VBox status code. + * @param pAhciPortTaskState The task state which contains the S/G list entries. + * @param pvBuf Pointer to the buffer which should be copied. + * @param cbBuf Size of the buffer. + */ +static int ahciScatterGatherListCopyFromBuffer(PAHCIPORTTASKSTATE pAhciPortTaskState, void *pvBuf, size_t cbBuf) +{ + unsigned cSGEntry = 0; + PPDMDATASEG pSGEntry = &pAhciPortTaskState->pSGListHead[cSGEntry]; + uint8_t *pu8Buf = (uint8_t *)pvBuf; + + while (cSGEntry < pAhciPortTaskState->cSGEntries) + { + size_t cbToCopy = (cbBuf < pSGEntry->cbSeg) ? cbBuf : pSGEntry->cbSeg; + + memcpy(pSGEntry->pvSeg, pu8Buf, cbToCopy); + + cbBuf -= cbToCopy; + /* We finished. */ + if (!cbBuf) + break; + + /* Advance the buffer. */ + pu8Buf += cbToCopy; + + /* Go to the next entry in the list. */ + pSGEntry++; + cSGEntry++; + } + +#if 0 + if (!pAhciPort->fATAPI) + AssertMsg(!cbBuf, ("There is still data in the buffer\n")); +#endif + return VINF_SUCCESS; +} + +/* -=-=-=-=- IBlockAsyncPort -=-=-=-=- */ + +/** Makes a PAHCIPort out of a PPDMIBLOCKASYNCPORT. */ +#define PDMIBLOCKASYNCPORT_2_PAHCIPORT(pInterface) ( (PAHCIPort)((uintptr_t)pInterface - RT_OFFSETOF(AHCIPort, IPortAsync)) ) + +/** + * Complete a data transfer task by freeing all occupied ressources + * and notifying the guest. + * + * @returns VBox status code + * + * @param pAhciPort Pointer to the port where to request completed. + * @param pAhciPortTaskState Pointer to the task which finished. + */ +static int ahciTransferComplete(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState) +{ + /* Free system resources occupied by the scatter gather list. */ + ahciScatterGatherListDestroy(pAhciPort, pAhciPortTaskState); + + pAhciPortTaskState->cmdHdr.u32PRDBC = pAhciPortTaskState->cbTransfer; + + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + /* Write updated command header into memory of the guest. */ + PDMDevHlpPhysWrite(pAhciPort->CTX_SUFF(pDevIns), pAhciPortTaskState->GCPhysCmdHdrAddr, + &pAhciPortTaskState->cmdHdr, sizeof(CmdHdr)); + + if (pAhciPortTaskState->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE) + { + STAM_REL_COUNTER_ADD(&pAhciPort->StatBytesRead, pAhciPortTaskState->cbTransfer); + pAhciPort->Led.Actual.s.fReading = 0; + } + else + { + STAM_REL_COUNTER_ADD(&pAhciPort->StatBytesWritten, pAhciPortTaskState->cbTransfer); + pAhciPort->Led.Actual.s.fWriting = 0; + } + + if (pAhciPortTaskState->fQueued) + { + uint32_t cOutstandingTasks; + + ahciLog(("%s: Before decrement uActTasksActive=%u\n", __FUNCTION__, pAhciPort->uActTasksActive)); + cOutstandingTasks = ASMAtomicDecU32(&pAhciPort->uActTasksActive); + ahciLog(("%s: After decrement uActTasksActive=%u\n", __FUNCTION__, cOutstandingTasks)); + ASMAtomicOrU32(&pAhciPort->u32QueuedTasksFinished, (1 << pAhciPortTaskState->uTag)); + + if (!cOutstandingTasks) + ahciSendSDBFis(pAhciPort, pAhciPort->u32QueuedTasksFinished, pAhciPortTaskState, true); + } + else + ahciSendD2HFis(pAhciPort, pAhciPortTaskState, pAhciPortTaskState->cmdFis, true); + + /* Add the task to the cache. */ + pAhciPort->aCachedTasks[pAhciPortTaskState->uTag] = pAhciPortTaskState; + + return VINF_SUCCESS; +} + +/** + * Notification callback for a completed transfer. + * + * @returns VBox status code. + * @param pInterface Pointer to the interface. + * @param pvUser User data. + */ +static DECLCALLBACK(int) ahciTransferCompleteNotify(PPDMIBLOCKASYNCPORT pInterface, void *pvUser) +{ + PAHCIPort pAhciPort = PDMIBLOCKASYNCPORT_2_PAHCIPORT(pInterface); + PAHCIPORTTASKSTATE pAhciPortTaskState = (PAHCIPORTTASKSTATE)pvUser; + + ahciLog(("%s: pInterface=%p pvUser=%p uTag=%u\n", + __FUNCTION__, pInterface, pvUser, pAhciPortTaskState->uTag)); + + return ahciTransferComplete(pAhciPort, pAhciPortTaskState); +} + +/** + * Process an non read/write ATA command. + * + * @returns The direction of the data transfer + * @param pCmdHdr Pointer to the command header. + */ +static int ahciProcessCmd(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState, uint8_t *pCmdFis) +{ + int rc = PDMBLOCKTXDIR_NONE; + bool fLBA48 = false; + CmdHdr *pCmdHdr = &pAhciPortTaskState->cmdHdr; + + AssertMsg(pCmdFis[AHCI_CMDFIS_TYPE] == AHCI_CMDFIS_TYPE_H2D, ("FIS is not a host to device Fis!!\n")); + + switch (pCmdFis[AHCI_CMDFIS_CMD]) + { + case ATA_IDENTIFY_DEVICE: + { + if (pAhciPort->pDrvBlock && !pAhciPort->fATAPI) + { + uint16_t u16Temp[256]; + + /* Fill the buffer. */ + ahciIdentifySS(pAhciPort, u16Temp); + + /* Create scatter gather list. */ + rc = ahciScatterGatherListCreate(pAhciPort, pAhciPortTaskState, false); + if (RT_FAILURE(rc)) + AssertMsgFailed(("Creating list failed rc=%Rrc\n", rc)); + + /* Copy the buffer. */ + rc = ahciScatterGatherListCopyFromBuffer(pAhciPortTaskState, &u16Temp[0], sizeof(u16Temp)); + if (RT_FAILURE(rc)) + AssertMsgFailed(("Copying failed rc=%Rrc\n", rc)); + + /* Destroy list. */ + rc = ahciScatterGatherListDestroy(pAhciPort, pAhciPortTaskState); + if (RT_FAILURE(rc)) + AssertMsgFailed(("Freeing list failed rc=%Rrc\n", rc)); + + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + pCmdHdr->u32PRDBC = sizeof(u16Temp); + + /* Write updated command header into memory of the guest. */ + PDMDevHlpPhysWrite(pAhciPort->CTX_SUFF(pDevIns), pAhciPortTaskState->GCPhysCmdHdrAddr, pCmdHdr, sizeof(CmdHdr)); + } + else + { + pAhciPortTaskState->uATARegError = ABRT_ERR; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + } + break; + } + case ATA_READ_NATIVE_MAX_ADDRESS_EXT: + case ATA_READ_NATIVE_MAX_ADDRESS: + break; + case ATA_SET_FEATURES: + { + switch (pCmdFis[AHCI_CMDFIS_FET]) + { + case 0x02: /* write cache enable */ + case 0xaa: /* read look-ahead enable */ + case 0x55: /* read look-ahead disable */ + case 0xcc: /* reverting to power-on defaults enable */ + case 0x66: /* reverting to power-on defaults disable */ + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + break; + case 0x82: /* write cache disable */ + rc = pAhciPort->pDrvBlock->pfnFlush(pAhciPort->pDrvBlock); + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + break; + case 0x03: + { /* set transfer mode */ + Log2(("%s: transfer mode %#04x\n", __FUNCTION__, pCmdFis[AHCI_CMDFIS_SECTC])); + switch (pCmdFis[AHCI_CMDFIS_SECTC] & 0xf8) + { + case 0x00: /* PIO default */ + case 0x08: /* PIO mode */ + break; + case ATA_MODE_MDMA: /* MDMA mode */ + pAhciPort->uATATransferMode = (pCmdFis[AHCI_CMDFIS_SECTC] & 0xf8) | RT_MIN(pCmdFis[AHCI_CMDFIS_SECTC] & 0x07, ATA_MDMA_MODE_MAX); + break; + case ATA_MODE_UDMA: /* UDMA mode */ + pAhciPort->uATATransferMode = (pCmdFis[AHCI_CMDFIS_SECTC] & 0xf8) | RT_MIN(pCmdFis[AHCI_CMDFIS_SECTC] & 0x07, ATA_UDMA_MODE_MAX); + break; + } + break; + } + default: + pAhciPortTaskState->uATARegError = ABRT_ERR; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR; + } + break; + } + case ATA_FLUSH_CACHE_EXT: + case ATA_FLUSH_CACHE: + rc = pAhciPort->pDrvBlock->pfnFlush(pAhciPort->pDrvBlock); + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + break; + case ATA_PACKET: + if (!pAhciPort->fATAPI) + { + pAhciPortTaskState->uATARegError = ABRT_ERR; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR; + } + else + { + rc = atapiParseCmdVirtualATAPI(pAhciPort, pAhciPortTaskState); + } + break; + case ATA_IDENTIFY_PACKET_DEVICE: + if (!pAhciPort->fATAPI) + { + pAhciPortTaskState->uATARegError = ABRT_ERR; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR; + } + else + { + atapiDoTransfer(pAhciPort, pAhciPortTaskState, ATAFN_SS_ATAPI_IDENTIFY); + + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + } + break; + case ATA_SET_MULTIPLE_MODE: + if ( pCmdFis[AHCI_CMDFIS_SECTC] != 0 + && ( pCmdFis[AHCI_CMDFIS_SECTC] > ATA_MAX_MULT_SECTORS + || (pCmdFis[AHCI_CMDFIS_SECTC] & (pCmdFis[AHCI_CMDFIS_SECTC] - 1)) != 0)) + { + pAhciPortTaskState->uATARegError = ABRT_ERR; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR; + } + else + { + Log2(("%s: set multi sector count to %d\n", __FUNCTION__, pCmdFis[AHCI_CMDFIS_SECTC])); + pAhciPort->cMultSectors = pCmdFis[AHCI_CMDFIS_SECTC]; + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + } + break; + case ATA_STANDBY_IMMEDIATE: + break; /* Do nothing. */ + case ATA_CHECK_POWER_MODE: + pAhciPortTaskState->cmdFis[AHCI_CMDFIS_SECTC] = 0xff; /* drive active or idle */ + /* fall through */ + case ATA_INITIALIZE_DEVICE_PARAMETERS: + case ATA_IDLE_IMMEDIATE: + case ATA_RECALIBRATE: + case ATA_NOP: + case ATA_READ_VERIFY_SECTORS_EXT: + case ATA_READ_VERIFY_SECTORS: + case ATA_READ_VERIFY_SECTORS_WITHOUT_RETRIES: + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + break; + case ATA_READ_DMA_EXT: + fLBA48 = true; + case ATA_READ_DMA: + { + pAhciPortTaskState->cbTransfer = ahciGetNSectors(pCmdFis, fLBA48) * 512; + pAhciPortTaskState->uOffset = ahciGetSector(pAhciPort, pCmdFis, fLBA48) * 512; + rc = PDMBLOCKTXDIR_FROM_DEVICE; + break; + } + case ATA_WRITE_DMA_EXT: + fLBA48 = true; + case ATA_WRITE_DMA: + { + pAhciPortTaskState->cbTransfer = ahciGetNSectors(pCmdFis, fLBA48) * 512; + pAhciPortTaskState->uOffset = ahciGetSector(pAhciPort, pCmdFis, fLBA48) * 512; + rc = PDMBLOCKTXDIR_TO_DEVICE; + break; + } + case ATA_READ_FPDMA_QUEUED: + { + pAhciPortTaskState->cbTransfer = ahciGetNSectorsQueued(pCmdFis) * 512; + pAhciPortTaskState->uOffset = ahciGetSectorQueued(pCmdFis) * 512; + rc = PDMBLOCKTXDIR_FROM_DEVICE; + break; + } + case ATA_WRITE_FPDMA_QUEUED: + { + pAhciPortTaskState->cbTransfer = ahciGetNSectorsQueued(pCmdFis) * 512; + pAhciPortTaskState->uOffset = ahciGetSectorQueued(pCmdFis) * 512; + rc = PDMBLOCKTXDIR_TO_DEVICE; + break; + } + /* All not implemented commands go below. */ + case ATA_SECURITY_FREEZE_LOCK: + case ATA_SMART: + case ATA_NV_CACHE: + case ATA_SLEEP: /* Powermanagement not supported. */ + pAhciPortTaskState->uATARegError = ABRT_ERR; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR; + break; + default: /* For debugging purposes. */ + AssertMsgFailed(("Unknown command issued\n")); + pAhciPortTaskState->uATARegError = ABRT_ERR; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR; + } + + return rc; +} + +/** + * Retrieve a command FIS from guest memory. + * + * @returns nothing + * @param pAhciPortTaskState The state of the actual task. + */ +static void ahciPortTaskGetCommandFis(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState) +{ + RTGCPHYS GCPhysAddrCmdTbl; + + AssertMsg(pAhciPort->GCPhysAddrClb && pAhciPort->GCPhysAddrFb, ("%s: GCPhysAddrClb and/or GCPhysAddrFb are 0\n", __FUNCTION__)); + + /* + * First we are reading the command header pointed to by regCLB. + * From this we get the address of the command table which we are reading too. + * We can process the Command FIS afterwards. + */ + pAhciPortTaskState->GCPhysCmdHdrAddr = pAhciPort->GCPhysAddrClb + pAhciPortTaskState->uTag * sizeof(CmdHdr); + LogFlow(("%s: PDMDevHlpPhysRead GCPhysAddrCmdLst=%RGp cbCmdHdr=%u\n", __FUNCTION__, + pAhciPortTaskState->GCPhysCmdHdrAddr, sizeof(CmdHdr))); + PDMDevHlpPhysRead(pAhciPort->CTX_SUFF(pDevIns), pAhciPortTaskState->GCPhysCmdHdrAddr, &pAhciPortTaskState->cmdHdr, sizeof(CmdHdr)); + +#ifdef DEBUG + /* Print some infos about the command header. */ + ahciDumpCmdHdrInfo(pAhciPort, &pAhciPortTaskState->cmdHdr); +#endif + + GCPhysAddrCmdTbl = AHCI_RTGCPHYS_FROM_U32(pAhciPortTaskState->cmdHdr.u32CmdTblAddrUp, pAhciPortTaskState->cmdHdr.u32CmdTblAddr); + + AssertMsg((pAhciPortTaskState->cmdHdr.u32DescInf & AHCI_CMDHDR_CFL_MASK) * sizeof(uint32_t) == AHCI_CMDFIS_TYPE_H2D_SIZE, + ("This is not a command FIS!!\n")); + + /* Read the command Fis. */ + LogFlow(("%s: PDMDevHlpPhysRead GCPhysAddrCmdTbl=%RGp cbCmdFis=%u\n", __FUNCTION__, GCPhysAddrCmdTbl, AHCI_CMDFIS_TYPE_H2D_SIZE)); + PDMDevHlpPhysRead(pAhciPort->CTX_SUFF(pDevIns), GCPhysAddrCmdTbl, &pAhciPortTaskState->cmdFis[0], AHCI_CMDFIS_TYPE_H2D_SIZE); + + /* Set transfer direction. */ + pAhciPortTaskState->uTxDir = (pAhciPortTaskState->cmdHdr.u32DescInf & AHCI_CMDHDR_W) ? PDMBLOCKTXDIR_TO_DEVICE : PDMBLOCKTXDIR_FROM_DEVICE; + + /* If this is an ATAPI command read the atapi command. */ + if (pAhciPortTaskState->cmdHdr.u32DescInf & AHCI_CMDHDR_A) + { + GCPhysAddrCmdTbl += AHCI_CMDHDR_ACMD_OFFSET; + PDMDevHlpPhysRead(pAhciPort->CTX_SUFF(pDevIns), GCPhysAddrCmdTbl, &pAhciPortTaskState->aATAPICmd[0], ATAPI_PACKET_SIZE); + } + + /* We "received" the FIS. Clear the BSY bit in regTFD. */ + if ((pAhciPortTaskState->cmdHdr.u32DescInf & AHCI_CMDHDR_C) && (pAhciPortTaskState->fQueued)) + { + /* + * We need to send a FIS which clears the busy bit if this is a queued command so that the guest can queue other commands. + * but this FIS does not assert an interrupt + */ + ahciSendD2HFis(pAhciPort, pAhciPortTaskState, pAhciPortTaskState->cmdFis, false); + pAhciPort->regTFD &= ~AHCI_PORT_TFD_BSY; + } + +#ifdef DEBUG + /* Print some infos about the FIS. */ + ahciDumpFisInfo(pAhciPort, &pAhciPortTaskState->cmdFis[0]); +#endif +} + +/** + * Transmit queue consumer + * Queue a new async task. + * + * @returns Success indicator. + * If false the item will not be removed and the flushing will stop. + * @param pDevIns The device instance. + * @param pItem The item to consume. Upon return this item will be freed. + */ +static DECLCALLBACK(bool) ahciNotifyQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem) +{ + PDEVPORTNOTIFIERQUEUEITEM pNotifierItem = (PDEVPORTNOTIFIERQUEUEITEM)pItem; + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + PAHCIPort pAhciPort = &pAhci->ahciPort[pNotifierItem->iPort]; + int rc = VINF_SUCCESS; + + if (!pAhciPort->fAsyncInterface) + { + ahciLog(("%s: Got notification from GC\n", __FUNCTION__)); + /* Notify the async IO thread. */ + rc = RTSemEventSignal(pAhciPort->AsyncIORequestSem); + AssertRC(rc); + } + else + { + int iTxDir; + PAHCIPORTTASKSTATE pAhciPortTaskState; + + ahciLog(("%s: Processing command at slot %d\n", __FUNCTION__, pNotifierItem->iTask)); + + /* Check if there is already an allocated task struct in the cache. + * Allocate a new task otherwise. + */ + if (!pAhciPort->aCachedTasks[pNotifierItem->iTask]) + { + pAhciPortTaskState = (PAHCIPORTTASKSTATE)RTMemAllocZ(sizeof(AHCIPORTTASKSTATE)); + AssertMsg(pAhciPortTaskState, ("%s: Cannot allocate task state memory!\n")); + } + else + { + pAhciPortTaskState = pAhciPort->aCachedTasks[pNotifierItem->iTask]; + } + + /** Set current command slot */ + pAhciPortTaskState->uTag = pNotifierItem->iTask; + pAhciPort->regCMD |= (AHCI_PORT_CMD_CCS_SHIFT(pAhciPortTaskState->uTag)); + + ahciPortTaskGetCommandFis(pAhciPort, pAhciPortTaskState); + + /* Mark the task as processed by the HBA if this is a queued task so that it doesn't occur in the CI register anymore. */ + if (pNotifierItem->fQueued) + { + pAhciPortTaskState->fQueued = true; + ASMAtomicOrU32(&pAhciPort->u32TasksFinished, (1 << pAhciPortTaskState->uTag)); + } + else + pAhciPortTaskState->fQueued = false; + + if (!(pAhciPortTaskState->cmdFis[AHCI_CMDFIS_BITS] & AHCI_CMDFIS_C)) + { + /* If the reset bit is set put the device into reset state. */ + if (pAhciPortTaskState->cmdFis[AHCI_CMDFIS_CTL] & AHCI_CMDFIS_CTL_SRST) + { + ahciLog(("%s: Setting device into reset state\n", __FUNCTION__)); + pAhciPort->fResetDevice = true; + ahciSendD2HFis(pAhciPort, pAhciPortTaskState, pAhciPortTaskState->cmdFis, true); + pAhciPort->aCachedTasks[pNotifierItem->iTask] = pAhciPortTaskState; + return true; + } + else if (pAhciPort->fResetDevice) /* The bit is not set and we are in a reset state. */ + { + ahciFinishStorageDeviceReset(pAhciPort, pAhciPortTaskState); + pAhciPort->aCachedTasks[pNotifierItem->iTask] = pAhciPortTaskState; + return true; + } + else /* We are not in a reset state update the control registers. */ + { + AssertMsgFailed(("%s: Update the control register\n", __FUNCTION__)); + } + } + + iTxDir = ahciProcessCmd(pAhciPort, pAhciPortTaskState, pAhciPortTaskState->cmdFis); + + if (iTxDir != PDMBLOCKTXDIR_NONE) + { + if (pAhciPortTaskState->fQueued) + { + ahciLog(("%s: Before increment uActTasksActive=%u\n", __FUNCTION__, pAhciPort->uActTasksActive)); + ASMAtomicIncU32(&pAhciPort->uActTasksActive); + ahciLog(("%s: After increment uActTasksActive=%u\n", __FUNCTION__, pAhciPort->uActTasksActive)); + } + + STAM_REL_COUNTER_INC(&pAhciPort->StatDMA); + + rc = ahciScatterGatherListCreate(pAhciPort, pAhciPortTaskState, (iTxDir == PDMBLOCKTXDIR_FROM_DEVICE) ? false : true); + if (RT_FAILURE(rc)) + AssertMsgFailed(("%s: Failed to process command %Rrc\n", __FUNCTION__, rc)); + + if (iTxDir == PDMBLOCKTXDIR_FROM_DEVICE) + { + pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 1; + rc = pAhciPort->pDrvBlockAsync->pfnStartRead(pAhciPort->pDrvBlockAsync, pAhciPortTaskState->uOffset, + pAhciPortTaskState->pSGListHead, pAhciPortTaskState->cSGEntries, + pAhciPortTaskState->cbTransfer, + pAhciPortTaskState); + } + else + { + pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1; + rc = pAhciPort->pDrvBlockAsync->pfnStartWrite(pAhciPort->pDrvBlockAsync, pAhciPortTaskState->uOffset, + pAhciPortTaskState->pSGListHead, pAhciPortTaskState->cSGEntries, + pAhciPortTaskState->cbTransfer, + pAhciPortTaskState); + } + if (rc == VINF_VD_ASYNC_IO_FINISHED) + rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState); + + if (RT_FAILURE(rc)) + AssertMsgFailed(("%s: Failed to enqueue command %Rrc\n", __FUNCTION__, rc)); + } + else + { + /* There is nothing left to do. Notify the guest. */ + ahciSendD2HFis(pAhciPort, pAhciPortTaskState, &pAhciPortTaskState->cmdFis[0], true); + /* Add the task to the cache. */ + pAhciPort->aCachedTasks[pAhciPortTaskState->uTag] = pAhciPortTaskState; + } + } + + return true; +} + +/* The async IO thread for one port. */ +static DECLCALLBACK(int) ahciAsyncIOLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread) +{ + PAHCIPort pAhciPort = (PAHCIPort)pThread->pvUser; + PAHCI pAhci = pAhciPort->CTX_SUFF(pAhci); + PAHCIPORTTASKSTATE pAhciPortTaskState; + int rc = VINF_SUCCESS; + uint64_t u64StartTime = 0; + uint64_t u64StopTime = 0; + uint32_t uIORequestsProcessed = 0; + uint32_t uIOsPerSec = 0; + + ahciLog(("%s: Port %d entering async IO loop.\n", __FUNCTION__, pAhciPort->iLUN)); + + if (pThread->enmState == PDMTHREADSTATE_INITIALIZING) + return VINF_SUCCESS; + + /* We use only one task structure. */ + pAhciPortTaskState = (PAHCIPORTTASKSTATE)RTMemAllocZ(sizeof(AHCIPORTTASKSTATE)); + if (!pAhciPortTaskState) + { + AssertMsgFailed(("Failed to allocate task state memory\n")); + return VERR_NO_MEMORY; + } + + while(pThread->enmState == PDMTHREADSTATE_RUNNING) + { + uint32_t uQueuedTasksFinished = 0; + + /* New run to get number of I/O requests per second?. */ + if (!u64StartTime) + u64StartTime = RTTimeMilliTS(); + + ASMAtomicXchgBool(&pAhciPort->fAsyncIOThreadIdle, true); + + rc = RTSemEventWait(pAhciPort->AsyncIORequestSem, 1000); + if (rc == VERR_TIMEOUT) + { + /* No I/O requests inbetween. Reset statistics and wait again. */ + pAhciPort->StatIORequestsPerSecond.c = 0; + rc = RTSemEventWait(pAhciPort->AsyncIORequestSem, RT_INDEFINITE_WAIT); + } + + if (RT_FAILURE(rc) || (pThread->enmState != PDMTHREADSTATE_RUNNING)) + break; + + AssertMsg(pAhciPort->pDrvBase, ("I/O thread without attached device?!\n")); + + ASMAtomicXchgBool(&pAhciPort->fAsyncIOThreadIdle, false); + + /* + * To maximize the throughput of the controller we try to minimize the + * number of world switches during interrupts by grouping as many + * I/O requests together as possible. + * On the other side we want to get minimal latency if the I/O load is low. + * Thatswhy the number of I/O requests per second is measured and if it is over + * a threshold the thread waits for other requests from the guest. + */ + if (uIOsPerSec >= pAhci->cHighIOThreshold) + { + uint8_t uActWritePosPrev = pAhciPort->uActWritePos; + + Log(("%s: Waiting for more tasks to get queued\n", __FUNCTION__)); + + do + { + /* Sleep some time. */ + RTThreadSleep(pAhci->cMillisToSleep); + /* Check if we got some new requests inbetween. */ + if (uActWritePosPrev != pAhciPort->uActWritePos) + { + uActWritePosPrev = pAhciPort->uActWritePos; + /* + * Check if the queue is full. If that is the case + * there is no point waiting another round. + */ + if ( ( (pAhciPort->uActReadPos < uActWritePosPrev) + && (uActWritePosPrev - pAhciPort->uActReadPos) == AHCI_NR_COMMAND_SLOTS) + || ( (pAhciPort->uActReadPos > uActWritePosPrev) + && (RT_ELEMENTS(pAhciPort->ahciIOTasks) - pAhciPort->uActReadPos + uActWritePosPrev) == AHCI_NR_COMMAND_SLOTS) ) + { + Log(("%s: Queue full -> leaving\n", __FUNCTION__)); + break; + } + Log(("%s: Another round\n", __FUNCTION__)); + } + else /* No change break out of the loop. */ + { +#ifdef DEBUG + uint8_t uQueuedTasks; + if (pAhciPort->uActReadPos < uActWritePosPrev) + uQueuedTasks = uActWritePosPrev - pAhciPort->uActReadPos; + else + uQueuedTasks = RT_ELEMENTS(pAhciPort->ahciIOTasks) - pAhciPort->uActReadPos + uActWritePosPrev; + + Log(("%s: %u Tasks are queued\n", __FUNCTION__, uQueuedTasks)); +#endif + break; + } + } while (true); + } + + ahciLog(("%s: Processing requests\n", __FUNCTION__)); + ASMAtomicXchgBool(&pAhciPort->fNotificationSend, false); + + uint32_t cTasksToProcess = ASMAtomicXchgU32(&pAhciPort->uActTasksActive, 0); + + /* Process commands. */ + while ( (cTasksToProcess > 0) + && RT_LIKELY(!pAhciPort->fPortReset)) + { + int iTxDir; + uint8_t uActTag; + + STAM_PROFILE_START(&pAhciPort->StatProfileProcessTime, a); + + ahciLog(("%s: uActWritePos=%u\n", __FUNCTION__, pAhciPort->uActWritePos)); + ahciLog(("%s: Before uActReadPos=%u\n", __FUNCTION__, pAhciPort->uActReadPos)); + + pAhciPortTaskState->uATARegStatus = 0; + pAhciPortTaskState->uATARegError = 0; + uActTag = pAhciPort->ahciIOTasks[pAhciPort->uActReadPos]; + + pAhciPortTaskState->uTag = AHCI_TASK_GET_TAG(uActTag); + AssertMsg(pAhciPortTaskState->uTag < AHCI_NR_COMMAND_SLOTS, ("%s: Invalid Tag number!!\n", __FUNCTION__)); + + /** Set current command slot */ + pAhciPort->regCMD |= (AHCI_PORT_CMD_CCS_SHIFT(pAhciPortTaskState->uTag)); + + /* Mark the task as processed by the HBA if this is a queued task so that it doesn't occur in the CI register anymore. */ + if (AHCI_TASK_IS_QUEUED(uActTag)) + { + pAhciPortTaskState->fQueued = true; + ASMAtomicOrU32(&pAhciPort->u32TasksFinished, (1 << pAhciPortTaskState->uTag)); + } + else + { + pAhciPortTaskState->fQueued = false; + } + + ahciPortTaskGetCommandFis(pAhciPort, pAhciPortTaskState); + + ahciLog(("%s: Got command at slot %d\n", __FUNCTION__, pAhciPortTaskState->uTag)); + + if (!(pAhciPortTaskState->cmdFis[AHCI_CMDFIS_BITS] & AHCI_CMDFIS_C)) + { + /* If the reset bit is set put the device into reset state. */ + if (pAhciPortTaskState->cmdFis[AHCI_CMDFIS_CTL] & AHCI_CMDFIS_CTL_SRST) + { + ahciLog(("%s: Setting device into reset state\n", __FUNCTION__)); + pAhciPort->fResetDevice = true; + ahciSendD2HFis(pAhciPort, pAhciPortTaskState, &pAhciPortTaskState->cmdFis[0], true); + } + else if (pAhciPort->fResetDevice) /* The bit is not set and we are in a reset state. */ + { + ahciFinishStorageDeviceReset(pAhciPort, pAhciPortTaskState); + } + /* TODO: We are not in a reset state update the control registers. */ + } + else + { + iTxDir = ahciProcessCmd(pAhciPort, pAhciPortTaskState, &pAhciPortTaskState->cmdFis[0]); + + if (iTxDir != PDMBLOCKTXDIR_NONE) + { + uint64_t uOffset; + size_t cbTransfer; + PPDMDATASEG pSegCurr; + PAHCIPORTTASKSTATESGENTRY pSGInfoCurr; + + rc = ahciScatterGatherListCreate(pAhciPort, pAhciPortTaskState, (iTxDir == PDMBLOCKTXDIR_FROM_DEVICE) ? false : true); + if (RT_FAILURE(rc)) + AssertMsgFailed(("%s: Failed to get number of list elments %Rrc\n", __FUNCTION__, rc)); + + STAM_REL_COUNTER_INC(&pAhciPort->StatDMA); + + /* Initialize all values. */ + uOffset = pAhciPortTaskState->uOffset; + cbTransfer = pAhciPortTaskState->cbTransfer; + pSegCurr = &pAhciPortTaskState->pSGListHead[0]; + pSGInfoCurr = pAhciPortTaskState->paSGEntries; + + STAM_PROFILE_START(&pAhciPort->StatProfileReadWrite, a); + + while(cbTransfer) + { + size_t cbProcess = (cbTransfer < pSegCurr->cbSeg) ? cbTransfer : pSegCurr->cbSeg; + + AssertMsg(!(pSegCurr->cbSeg % 512), ("Buffer is not sector aligned cbSeg=%d\n", pSegCurr->cbSeg)); + AssertMsg(!(uOffset % 512), ("Offset is not sector aligned %llu\n", uOffset)); + AssertMsg(!(cbProcess % 512), ("Number of bytes to process is not sector aligned %lu\n", cbProcess)); + + if (iTxDir == PDMBLOCKTXDIR_FROM_DEVICE) + { + pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 1; + rc = pAhciPort->pDrvBlock->pfnRead(pAhciPort->pDrvBlock, uOffset, + pSegCurr->pvSeg, cbProcess); + pAhciPort->Led.Actual.s.fReading = 0; + if (RT_FAILURE(rc)) + AssertMsgFailed(("%s: Failed to read data %Rrc\n", __FUNCTION__, rc)); + + STAM_REL_COUNTER_ADD(&pAhciPort->StatBytesRead, cbProcess); + } + else + { + pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1; + rc = pAhciPort->pDrvBlock->pfnWrite(pAhciPort->pDrvBlock, uOffset, + pSegCurr->pvSeg, cbProcess); + pAhciPort->Led.Actual.s.fWriting = 0; + if (RT_FAILURE(rc)) + AssertMsgFailed(("%s: Failed to write data %Rrc\n", __FUNCTION__, rc)); + + STAM_REL_COUNTER_ADD(&pAhciPort->StatBytesWritten, cbProcess); + } + + /* Go to the next entry. */ + uOffset += cbProcess; + cbTransfer -= cbProcess; + pSegCurr++; + pSGInfoCurr++; + } + + STAM_PROFILE_STOP(&pAhciPort->StatProfileReadWrite, a); + + /* Cleanup. */ + rc = ahciScatterGatherListDestroy(pAhciPort, pAhciPortTaskState); + if (RT_FAILURE(rc)) + AssertMsgFailed(("Destroying task list failed rc=%Rrc\n", rc)); + + if (RT_LIKELY(!pAhciPort->fPortReset)) + { + pAhciPortTaskState->cmdHdr.u32PRDBC = pAhciPortTaskState->cbTransfer; + pAhciPortTaskState->uATARegError = 0; + pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK; + /* Write updated command header into memory of the guest. */ + PDMDevHlpPhysWrite(pAhciPort->CTX_SUFF(pDevIns), pAhciPortTaskState->GCPhysCmdHdrAddr, + &pAhciPortTaskState->cmdHdr, sizeof(CmdHdr)); + + if (pAhciPortTaskState->fQueued) + uQueuedTasksFinished |= (1 << pAhciPortTaskState->uTag); + else + { + /* Task is not queued send D2H FIS */ + ahciSendD2HFis(pAhciPort, pAhciPortTaskState, &pAhciPortTaskState->cmdFis[0], true); + } + + uIORequestsProcessed++; + } + } + else + { + /* Nothing left to do. Notify the guest. */ + ahciSendD2HFis(pAhciPort, pAhciPortTaskState, &pAhciPortTaskState->cmdFis[0], true); + } + + STAM_PROFILE_STOP(&pAhciPort->StatProfileProcessTime, a); + } + +#ifdef DEBUG + /* Be paranoid. */ + memset(&pAhciPortTaskState->cmdHdr, 0, sizeof(CmdHdr)); + memset(&pAhciPortTaskState->cmdFis, 0, AHCI_CMDFIS_TYPE_H2D_SIZE); + pAhciPortTaskState->GCPhysCmdHdrAddr = 0; + pAhciPortTaskState->uOffset = 0; + pAhciPortTaskState->cbTransfer = 0; + /* Make the port number invalid making it easier to track down bugs. */ + pAhciPort->ahciIOTasks[pAhciPort->uActReadPos] = 0xff; +#endif + + pAhciPort->uActReadPos++; + pAhciPort->uActReadPos %= RT_ELEMENTS(pAhciPort->ahciIOTasks); + ahciLog(("%s: After uActReadPos=%u\n", __FUNCTION__, pAhciPort->uActReadPos)); + cTasksToProcess--; + } + + if (uQueuedTasksFinished && RT_LIKELY(!pAhciPort->fPortReset)) + ahciSendSDBFis(pAhciPort, uQueuedTasksFinished, pAhciPortTaskState, true); + + uQueuedTasksFinished = 0; + + u64StopTime = RTTimeMilliTS(); + /* Check if one second has passed. */ + if (u64StopTime - u64StartTime >= 1000) + { + /* Calculate number of I/O requests per second. */ + uIOsPerSec = uIORequestsProcessed / ((u64StopTime - u64StartTime) / 1000); + ahciLog(("%s: Processed %u requests in %llu ms -> %u requests/s\n", __FUNCTION__, uIORequestsProcessed, u64StopTime - u64StartTime, uIOsPerSec)); + u64StartTime = 0; + uIORequestsProcessed = 0; + /* For the release statistics. There is no macro to set the counter to a specific value. */ + pAhciPort->StatIORequestsPerSecond.c = uIOsPerSec; + } + } + + /* Free task state memory */ + if (pAhciPortTaskState->pSGListHead) + RTMemFree(pAhciPortTaskState->pSGListHead); + if (pAhciPortTaskState->paSGEntries) + RTMemFree(pAhciPortTaskState->paSGEntries); + if (pAhciPortTaskState->pvBufferUnaligned) + RTMemFree(pAhciPortTaskState->pvBufferUnaligned); + RTMemFree(pAhciPortTaskState); + + ahciLog(("%s: Port %d async IO thread exiting rc=%Rrc\n", __FUNCTION__, pAhciPort->iLUN, rc)); + return rc; +} + +/** + * Unblock the async I/O thread so it can respond to a state change. + * + * @returns VBox status code. + * @param pDevIns The pcnet device instance. + * @param pThread The send thread. + */ +static DECLCALLBACK(int) ahciAsyncIOLoopWakeUp(PPDMDEVINS pDevIns, PPDMTHREAD pThread) +{ + PAHCIPort pAhciPort = (PAHCIPort)pThread->pvUser; + return RTSemEventSignal(pAhciPort->AsyncIORequestSem); +} + +/** + * Called when a media is mounted. + * + * @param pInterface Pointer to the interface structure containing the called function pointer. + */ +static DECLCALLBACK(void) ahciMountNotify(PPDMIMOUNTNOTIFY pInterface) +{ + PAHCIPort pAhciPort = PDMIMOUNTNOTIFY_2_PAHCIPORT(pInterface); + Log(("%s: changing LUN#%d\n", __FUNCTION__, pAhciPort->iLUN)); + + /* Ignore the call if we're called while being attached. */ + if (!pAhciPort->pDrvBlock) + return; + + pAhciPort->cTotalSectors = pAhciPort->pDrvBlock->pfnGetSize(pAhciPort->pDrvBlock) / 512; + + /* + * Initialize registers + */ + pAhciPort->regCMD |= AHCI_PORT_CMD_CPS; + pAhciPort->regIS |= AHCI_PORT_IS_CPDS | AHCI_PORT_IS_PRCS; + pAhciPort->regSERR |= AHCI_PORT_SERR_N; + if (pAhciPort->regIE & AHCI_PORT_IE_CPDE) + ahciHbaSetInterrupt(pAhciPort->CTX_SUFF(pAhci), pAhciPort->iLUN); +} + +/** + * Called when a media is unmounted + * @param pInterface Pointer to the interface structure containing the called function pointer. + */ +static DECLCALLBACK(void) ahciUnmountNotify(PPDMIMOUNTNOTIFY pInterface) +{ + PAHCIPort pAhciPort = PDMIMOUNTNOTIFY_2_PAHCIPORT(pInterface); + Log(("%s:\n", __FUNCTION__)); + + pAhciPort->cTotalSectors = 0; + + /* + * Inform the guest about the removed device. + */ + pAhciPort->regSSTS = 0; + pAhciPort->regCMD &= ~AHCI_PORT_CMD_CPS; + pAhciPort->regIS |= AHCI_PORT_IS_CPDS | AHCI_PORT_IS_PRCS; + pAhciPort->regSERR |= AHCI_PORT_SERR_N; + if (pAhciPort->regIE & AHCI_PORT_IE_CPDE) + ahciHbaSetInterrupt(pAhciPort->CTX_SUFF(pAhci), pAhciPort->iLUN); +} + +/** + * Destroy a driver instance. + * + * Most VM resources are freed by the VM. This callback is provided so that any non-VM + * resources can be freed correctly. + * + * @param pDevIns The device instance data. + */ +static DECLCALLBACK(int) ahciDestruct(PPDMDEVINS pDevIns) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + int rc = VINF_SUCCESS; + unsigned iActPort = 0; + + /* + * At this point the async I/O thread is suspended and will not enter + * this module again. So, no coordination is needed here and PDM + * will take care of terminating and cleaning up the thread. + */ + if (PDMCritSectIsInitialized(&pAhci->lock)) + { + TMR3TimerDestroy(pAhci->CTX_SUFF(pHbaCccTimer)); + + Log(("%s: Destruct every port\n", __FUNCTION__)); + for (iActPort = 0; iActPort < pAhci->cPortsImpl; iActPort++) + { + PAHCIPort pAhciPort = &pAhci->ahciPort[iActPort]; + + if (pAhciPort->pAsyncIOThread) + { + /* Destroy the event semaphore. */ + rc = RTSemEventDestroy(pAhciPort->AsyncIORequestSem); + if (RT_FAILURE(rc)) + { + Log(("%s: Destroying event semaphore for port %d failed rc=%Rrc\n", __FUNCTION__, iActPort, rc)); + } + } + + /* Free all cached tasks. */ + for (uint32_t i = 0; i < AHCI_NR_COMMAND_SLOTS; i++) + { + if (pAhciPort->aCachedTasks[i]) + { + if (pAhciPort->aCachedTasks[i]->pSGListHead) + RTMemFree(pAhciPort->aCachedTasks[i]->pSGListHead); + if (pAhciPort->aCachedTasks[i]->paSGEntries) + RTMemFree(pAhciPort->aCachedTasks[i]->paSGEntries); + + RTMemFree(pAhciPort->aCachedTasks[i]); + } + } + } + + /* Destroy emulated ATA controllers. */ + for (unsigned i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + ataControllerDestroy(&pAhci->aCts[i]); + + PDMR3CritSectDelete(&pAhci->lock); + } + + return rc; +} + +/** + * Configure the attached device for a port. + * + * @returns VBox status code + * @param pDevIns The device instance data. + * @param pAhciPort The port for which the device is to be configured. + */ +static int ahciConfigureLUN(PPDMDEVINS pDevIns, PAHCIPort pAhciPort) +{ + int rc = VINF_SUCCESS; + PDMBLOCKTYPE enmType; + + /* + * Query the block and blockbios interfaces. + */ + pAhciPort->pDrvBlock = (PDMIBLOCK *)pAhciPort->pDrvBase->pfnQueryInterface(pAhciPort->pDrvBase, PDMINTERFACE_BLOCK); + if (!pAhciPort->pDrvBlock) + { + AssertMsgFailed(("Configuration error: LUN#%d hasn't a block interface!\n", pAhciPort->iLUN)); + return VERR_PDM_MISSING_INTERFACE; + } + pAhciPort->pDrvBlockBios = (PDMIBLOCKBIOS *)pAhciPort->pDrvBase->pfnQueryInterface(pAhciPort->pDrvBase, PDMINTERFACE_BLOCK_BIOS); + if (!pAhciPort->pDrvBlockBios) + { + AssertMsgFailed(("Configuration error: LUN#%d hasn't a block BIOS interface!\n", pAhciPort->iLUN)); + return VERR_PDM_MISSING_INTERFACE; + } + + pAhciPort->pDrvMount = (PDMIMOUNT *)pAhciPort->pDrvBase->pfnQueryInterface(pAhciPort->pDrvBase, PDMINTERFACE_MOUNT); + + /* Try to get the optional async block interface. */ + pAhciPort->pDrvBlockAsync = (PDMIBLOCKASYNC *)pAhciPort->pDrvBase->pfnQueryInterface(pAhciPort->pDrvBase, PDMINTERFACE_BLOCK_ASYNC); + + /* + * Validate type. + */ + enmType = pAhciPort->pDrvBlock->pfnGetType(pAhciPort->pDrvBlock); + + if ( enmType != PDMBLOCKTYPE_HARD_DISK + && enmType != PDMBLOCKTYPE_CDROM + && enmType != PDMBLOCKTYPE_DVD) + { + AssertMsgFailed(("Configuration error: LUN#%d isn't a disk or cd/dvd. enmType=%d\n", pAhciPort->iLUN, enmType)); + return VERR_PDM_UNSUPPORTED_BLOCK_TYPE; + } + + if ( (enmType == PDMBLOCKTYPE_CDROM || enmType == PDMBLOCKTYPE_DVD) + && !pAhciPort->pDrvMount) + { + AssertMsgFailed(("Internal error: CD/DVD-ROM without a mountable interface\n")); + return VERR_INTERNAL_ERROR; + } + pAhciPort->fATAPI = (enmType == PDMBLOCKTYPE_CDROM || enmType == PDMBLOCKTYPE_DVD); + + if (pAhciPort->fATAPI) + { + pAhciPort->cTotalSectors = pAhciPort->pDrvBlock->pfnGetSize(pAhciPort->pDrvBlock) / 2048; + pAhciPort->PCHSGeometry.cCylinders = 0; + pAhciPort->PCHSGeometry.cHeads = 0; + pAhciPort->PCHSGeometry.cSectors = 0; + LogRel(("AHCI LUN#%d: CD/DVD, total number of sectors %Ld\n", pAhciPort->iLUN, pAhciPort->cTotalSectors)); + } + else + { + pAhciPort->cTotalSectors = pAhciPort->pDrvBlock->pfnGetSize(pAhciPort->pDrvBlock) / 512; + rc = pAhciPort->pDrvBlockBios->pfnGetPCHSGeometry(pAhciPort->pDrvBlockBios, + &pAhciPort->PCHSGeometry); + if (rc == VERR_PDM_MEDIA_NOT_MOUNTED) + { + pAhciPort->PCHSGeometry.cCylinders = 0; + pAhciPort->PCHSGeometry.cHeads = 16; /*??*/ + pAhciPort->PCHSGeometry.cSectors = 63; /*??*/ + } + else if (rc == VERR_PDM_GEOMETRY_NOT_SET) + { + pAhciPort->PCHSGeometry.cCylinders = 0; /* autodetect marker */ + rc = VINF_SUCCESS; + } + AssertRC(rc); + + if ( pAhciPort->PCHSGeometry.cCylinders == 0 + || pAhciPort->PCHSGeometry.cHeads == 0 + || pAhciPort->PCHSGeometry.cSectors == 0) + { + uint64_t cCylinders = pAhciPort->cTotalSectors / (16 * 63); + pAhciPort->PCHSGeometry.cCylinders = RT_MAX(RT_MIN(cCylinders, 16383), 1); + pAhciPort->PCHSGeometry.cHeads = 16; + pAhciPort->PCHSGeometry.cSectors = 63; + /* Set the disk geometry information. Ignore errors. */ + pAhciPort->pDrvBlockBios->pfnSetPCHSGeometry(pAhciPort->pDrvBlockBios, + &pAhciPort->PCHSGeometry); + rc = VINF_SUCCESS; + } + LogRel(("AHCI: LUN#%d: disk, PCHS=%u/%u/%u, total number of sectors %Ld\n", + pAhciPort->iLUN, pAhciPort->PCHSGeometry.cCylinders, + pAhciPort->PCHSGeometry.cHeads, pAhciPort->PCHSGeometry.cSectors, + pAhciPort->cTotalSectors)); + } + return rc; +} + +static bool ahciWaitForAllAsyncIOIsFinished(PPDMDEVINS pDevIns, unsigned cMillies) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + uint64_t u64Start; + PAHCIPort pAhciPort; + bool fAllFinished; + + u64Start = RTTimeMilliTS(); + for (;;) + { + fAllFinished = true; + for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->ahciPort); i++) + { + pAhciPort = &pAhci->ahciPort[i]; + + if (pAhciPort->pDrvBase) + { + if (pAhciPort->fAsyncInterface) + fAllFinished &= (pAhciPort->uActTasksActive == 0); + else + fAllFinished &= ((pAhciPort->uActTasksActive == 0) && (pAhciPort->fAsyncIOThreadIdle)); + + if (!fAllFinished) + break; + } + } + if ( fAllFinished + || RTTimeMilliTS() - u64Start >= cMillies) + break; + + /* Sleep a bit. */ + RTThreadSleep(100); + } + return fAllFinished; +} + +static DECLCALLBACK(int) ahciSavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + + if (!ahciWaitForAllAsyncIOIsFinished(pDevIns, 20000)) + AssertMsgFailed(("One port is still active\n")); + + for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + { + int rc; + + rc = ataControllerSavePrep(&pAhci->aCts[i], pSSM); + if (RT_FAILURE(rc)) + return rc; + } + + return VINF_SUCCESS; +} + +static DECLCALLBACK(int) ahciLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + + for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + { + int rc; + + rc = ataControllerLoadPrep(&pAhci->aCts[i], pSSM); + if (RT_FAILURE(rc)) + return rc; + } + + return VINF_SUCCESS; +} + +/** + * Suspend notification. + * + * @returns VBox status. + * @param pDevIns The device instance data. + */ +static DECLCALLBACK(void) ahciSuspend(PPDMDEVINS pDevIns) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + + if (!ahciWaitForAllAsyncIOIsFinished(pDevIns, 20000)) + AssertMsgFailed(("AHCI: One port is still active\n")); + + Log(("%s:\n", __FUNCTION__)); + for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + { + ataControllerSuspend(&pAhci->aCts[i]); + } + return; +} + + +/** + * Resume notification. + * + * @returns VBox status. + * @param pDevIns The device instance data. + */ +static DECLCALLBACK(void) ahciResume(PPDMDEVINS pDevIns) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + + Log(("%s:\n", __FUNCTION__)); + for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + { + ataControllerResume(&pAhci->aCts[i]); + } + return; +} + +/** + * Saves a state of the AHCI device. + * + * @returns VBox status code. + * @param pDevIns The device instance. + * @param pSSMHandle The handle to save the state to. + */ +static DECLCALLBACK(int) ahciSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + uint32_t i; + + Assert(!pAhci->f8ByteMMIO4BytesWrittenSuccessfully); + + /* First the main device structure. */ + SSMR3PutU32(pSSMHandle, pAhci->regHbaCap); + SSMR3PutU32(pSSMHandle, pAhci->regHbaCtrl); + SSMR3PutU32(pSSMHandle, pAhci->regHbaIs); + SSMR3PutU32(pSSMHandle, pAhci->regHbaPi); + SSMR3PutU32(pSSMHandle, pAhci->regHbaVs); + SSMR3PutU32(pSSMHandle, pAhci->regHbaCccCtl); + SSMR3PutU32(pSSMHandle, pAhci->regHbaCccPorts); + SSMR3PutU8(pSSMHandle, pAhci->uCccPortNr); + SSMR3PutU64(pSSMHandle, pAhci->uCccTimeout); + SSMR3PutU32(pSSMHandle, pAhci->uCccNr); + SSMR3PutU32(pSSMHandle, pAhci->uCccCurrentNr); + SSMR3PutU32(pSSMHandle, pAhci->u32PortsInterrupted); + SSMR3PutBool(pSSMHandle, pAhci->fReset); + SSMR3PutBool(pSSMHandle, pAhci->f64BitAddr); + SSMR3PutBool(pSSMHandle, pAhci->fR0Enabled); + SSMR3PutBool(pSSMHandle, pAhci->fGCEnabled); + + /* Now every port. */ + for (i = 0; i < AHCI_MAX_NR_PORTS_IMPL; i++) + { + Assert(pAhci->ahciPort[i].uActTasksActive == 0); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regCLB); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regCLBU); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regFB); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regFBU); + SSMR3PutGCPhys(pSSMHandle, pAhci->ahciPort[i].GCPhysAddrClb); + SSMR3PutGCPhys(pSSMHandle, pAhci->ahciPort[i].GCPhysAddrFb); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regIS); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regIE); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regCMD); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regTFD); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regSIG); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regSSTS); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regSCTL); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regSERR); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regSACT); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].regCI); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].PCHSGeometry.cCylinders); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].PCHSGeometry.cHeads); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].PCHSGeometry.cSectors); + SSMR3PutU64(pSSMHandle, pAhci->ahciPort[i].cTotalSectors); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].cMultSectors); + SSMR3PutU8(pSSMHandle, pAhci->ahciPort[i].uATATransferMode); + SSMR3PutBool(pSSMHandle, pAhci->ahciPort[i].fResetDevice); + + for (uint8_t uActTask = 0; uActTask < AHCI_NR_COMMAND_SLOTS; uActTask++) + SSMR3PutU8(pSSMHandle, pAhci->ahciPort[i].ahciIOTasks[uActTask]); + + SSMR3PutU8(pSSMHandle, pAhci->ahciPort[i].uActWritePos); + SSMR3PutU8(pSSMHandle, pAhci->ahciPort[i].uActReadPos); + SSMR3PutBool(pSSMHandle, pAhci->ahciPort[i].fPoweredOn); + SSMR3PutBool(pSSMHandle, pAhci->ahciPort[i].fSpunUp); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].u32TasksFinished); + SSMR3PutU32(pSSMHandle, pAhci->ahciPort[i].u32QueuedTasksFinished); + } + + /* Now the emulated ata controllers. */ + for (i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + { + int rc; + + rc = ataControllerSaveExec(&pAhci->aCts[i], pSSMHandle); + if (RT_FAILURE(rc)) + return rc; + } + + return SSMR3PutU32(pSSMHandle, ~0); /* sanity/terminator */ +} + +/** + * Loads a saved AHCI device state. + * + * @returns VBox status code. + * @param pDevIns The device instance. + * @param pSSMHandle The handle to the saved state. + * @param u32Version The data unit version number. + */ +static DECLCALLBACK(int) ahciLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + uint32_t u32; + uint32_t i; + int rc = VINF_SUCCESS; + + if (u32Version != AHCI_SAVED_STATE_VERSION) + return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; + + /* Restore data. */ + + /* First the main device structure. */ + SSMR3GetU32(pSSMHandle, &pAhci->regHbaCap); + SSMR3GetU32(pSSMHandle, &pAhci->regHbaCtrl); + SSMR3GetU32(pSSMHandle, &pAhci->regHbaIs); + SSMR3GetU32(pSSMHandle, &pAhci->regHbaPi); + SSMR3GetU32(pSSMHandle, &pAhci->regHbaVs); + SSMR3GetU32(pSSMHandle, &pAhci->regHbaCccCtl); + SSMR3GetU32(pSSMHandle, &pAhci->regHbaCccPorts); + SSMR3GetU8(pSSMHandle, &pAhci->uCccPortNr); + SSMR3GetU64(pSSMHandle, &pAhci->uCccTimeout); + SSMR3GetU32(pSSMHandle, &pAhci->uCccNr); + SSMR3GetU32(pSSMHandle, &pAhci->uCccCurrentNr); + + SSMR3GetU32(pSSMHandle, &pAhci->u32PortsInterrupted); + SSMR3GetBool(pSSMHandle, &pAhci->fReset); + SSMR3GetBool(pSSMHandle, &pAhci->f64BitAddr); + SSMR3GetBool(pSSMHandle, &pAhci->fR0Enabled); + SSMR3GetBool(pSSMHandle, &pAhci->fGCEnabled); + + /* Now every port. */ + for (i = 0; i < AHCI_MAX_NR_PORTS_IMPL; i++) + { + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regCLB); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regCLBU); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regFB); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regFBU); + SSMR3GetGCPhys(pSSMHandle, (RTGCPHYS *)&pAhci->ahciPort[i].GCPhysAddrClb); + SSMR3GetGCPhys(pSSMHandle, (RTGCPHYS *)&pAhci->ahciPort[i].GCPhysAddrFb); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regIS); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regIE); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regCMD); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regTFD); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regSIG); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regSSTS); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regSCTL); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].regSERR); + SSMR3GetU32(pSSMHandle, (uint32_t *)&pAhci->ahciPort[i].regSACT); + SSMR3GetU32(pSSMHandle, (uint32_t *)&pAhci->ahciPort[i].regCI); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].PCHSGeometry.cCylinders); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].PCHSGeometry.cHeads); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].PCHSGeometry.cSectors); + SSMR3GetU64(pSSMHandle, &pAhci->ahciPort[i].cTotalSectors); + SSMR3GetU32(pSSMHandle, &pAhci->ahciPort[i].cMultSectors); + SSMR3GetU8(pSSMHandle, &pAhci->ahciPort[i].uATATransferMode); + SSMR3GetBool(pSSMHandle, &pAhci->ahciPort[i].fResetDevice); + + for (uint8_t uActTask = 0; uActTask < AHCI_NR_COMMAND_SLOTS; uActTask++) + SSMR3GetU8(pSSMHandle, (uint8_t *)&pAhci->ahciPort[i].ahciIOTasks[uActTask]); + + SSMR3GetU8(pSSMHandle, &pAhci->ahciPort[i].uActWritePos); + SSMR3GetU8(pSSMHandle, &pAhci->ahciPort[i].uActReadPos); + SSMR3GetBool(pSSMHandle, &pAhci->ahciPort[i].fPoweredOn); + SSMR3GetBool(pSSMHandle, &pAhci->ahciPort[i].fSpunUp); + SSMR3GetU32(pSSMHandle, (uint32_t *)&pAhci->ahciPort[i].u32TasksFinished); + SSMR3GetU32(pSSMHandle, (uint32_t *)&pAhci->ahciPort[i].u32QueuedTasksFinished); + } + + /* Now the emulated ata controllers. */ + for (i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + { + int rc; + + rc = ataControllerLoadExec(&pAhci->aCts[i], pSSMHandle); + if (RT_FAILURE(rc)) + return rc; + } + + rc = SSMR3GetU32(pSSMHandle, &u32); + if (RT_FAILURE(rc)) + return rc; + if (u32 != ~0U) + { + AssertMsgFailed(("u32=%#x expected ~0\n", u32)); + rc = VERR_SSM_DATA_UNIT_FORMAT_CHANGED; + return rc; + } + + return VINF_SUCCESS; +} + +/** + * Detach notification. + * + * One harddisk at one port has been unplugged. + * The VM is suspended at this point. + * + * @param pDevIns The device instance. + * @param iLUN The logical unit which is being detached. + */ +static DECLCALLBACK(void) ahciDetach(PPDMDEVINS pDevIns, unsigned iLUN) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + PAHCIPort pAhciPort = &pAhci->ahciPort[iLUN]; + int rc = VINF_SUCCESS; + + Log(("%s:\n", __FUNCTION__)); + + AssertMsg(iLUN < pAhci->cPortsImpl, ("iLUN=%u", iLUN)); + + if (!pAhciPort->fAsyncInterface) + { + int rcThread; + /* Destroy the thread. */ + rc = PDMR3ThreadDestroy(pAhciPort->pAsyncIOThread, &rcThread); + if (RT_FAILURE(rc) || RT_FAILURE(rcThread)) + AssertMsgFailed(("%s Failed to destroy async IO thread rc=%Rrc rcThread=%Rrc\n", __FUNCTION__, rc, rcThread)); + + rc = RTSemEventDestroy(pAhciPort->AsyncIORequestSem); + if (RT_FAILURE(rc)) + AssertMsgFailed(("%s: Failed to destroy the event semaphore rc=%Rrc.\n", __FUNCTION__, rc)); + } + + /* + * Zero some important members. + */ + pAhciPort->pDrvBase = NULL; + pAhciPort->pDrvBlock = NULL; + pAhciPort->pDrvBlockAsync = NULL; + pAhciPort->pDrvBlockBios = NULL; +} + +/** + * Attach command. + * + * This is called when we change block driver for one port. + * The VM is suspended at this point. + * + * @returns VBox status code. + * @param pDevIns The device instance. + * @param iLUN The logical unit which is being detached. + */ +static DECLCALLBACK(int) ahciAttach(PPDMDEVINS pDevIns, unsigned iLUN) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + PAHCIPort pAhciPort = &pAhci->ahciPort[iLUN]; + int rc; + + Log(("%s:\n", __FUNCTION__)); + + /* the usual paranoia */ + AssertMsg(iLUN < pAhci->cPortsImpl, ("iLUN=%u", iLUN)); + AssertRelease(!pAhciPort->pDrvBase); + AssertRelease(!pAhciPort->pDrvBlock); + AssertRelease(!pAhciPort->pDrvBlockAsync); + Assert(pAhciPort->iLUN == iLUN); + + /* + * Try attach the block device and get the interfaces, + * required as well as optional. + */ + rc = PDMDevHlpDriverAttach(pDevIns, pAhciPort->iLUN, &pAhciPort->IBase, &pAhciPort->pDrvBase, NULL); + if (RT_SUCCESS(rc)) + rc = ahciConfigureLUN(pDevIns, pAhciPort); + else + AssertMsgFailed(("Failed to attach LUN#%d. rc=%Rrc\n", pAhciPort->iLUN, rc)); + + if (RT_FAILURE(rc)) + { + pAhciPort->pDrvBase = NULL; + pAhciPort->pDrvBlock = NULL; + } + else + { + char szName[24]; + RTStrPrintf(szName, sizeof(szName), "Port%d", iLUN); + + if (pAhciPort->pDrvBlockAsync) + { + pAhciPort->fAsyncInterface = true; + } + else + { + pAhciPort->fAsyncInterface = false; + + /* Create event semaphore. */ + rc = RTSemEventCreate(&pAhciPort->AsyncIORequestSem); + if (RT_FAILURE(rc)) + { + Log(("%s: Failed to create event semaphore for %s.\n", __FUNCTION__, szName)); + return rc; + } + + /* Create the async IO thread. */ + rc = PDMDevHlpPDMThreadCreate(pDevIns, &pAhciPort->pAsyncIOThread, pAhciPort, ahciAsyncIOLoop, ahciAsyncIOLoopWakeUp, 0, + RTTHREADTYPE_IO, szName); + if (RT_FAILURE(rc)) + { + AssertMsgFailed(("%s: Async IO Thread creation for %s failed rc=%d\n", __FUNCTION__, szName, rc)); + return rc; + } + } + } + + return rc; +} + +/** + * Reset notification. + * + * @returns VBox status. + * @param pDevIns The device instance data. + */ +static DECLCALLBACK(void) ahciReset(PPDMDEVINS pDevIns) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + + if (!ahciWaitForAllAsyncIOIsFinished(pDevIns, 20000)) + AssertMsgFailed(("AHCI: One port is still active\n")); + + ahciHBAReset(pAhci); + + /* Hardware reset for the ports. */ + for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->ahciPort); i++) + ahciPortHwReset(&pAhci->ahciPort[i]); + + for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + ataControllerReset(&pAhci->aCts[i]); +} + +/** + * Poweroff notification. + * + * @returns nothing + * @param pDevIns Pointer to the device instance + */ +static DECLCALLBACK(void) ahciPowerOff(PPDMDEVINS pDevIns) +{ + PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); + + if (!ahciWaitForAllAsyncIOIsFinished(pDevIns, 20000)) + AssertMsgFailed(("AHCI: One port is still active\n")); + + for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) + ataControllerPowerOff(&pAhci->aCts[i]); +} + +/** + * Construct a device instance for a VM. + * + * @returns VBox status. + * @param pDevIns The device instance data. + * If the registration structure is needed, pDevIns->pDevReg points to it. + * @param iInstance Instance number. Use this to figure out which registers and such to use. + * The device number is also found in pDevIns->iInstance, but since it's + * likely to be freqently used PDM passes it as parameter. + * @param pCfgHandle Configuration node handle for the device. Use this to obtain the configuration + * of the device instance. It's also found in pDevIns->pCfgHandle, but like + * iInstance it's expected to be used a bit in this function. + */ +static DECLCALLBACK(int) ahciConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle) +{ + PAHCI pThis = PDMINS_2_DATA(pDevIns, PAHCI); + PPDMIBASE pBase; + int rc = VINF_SUCCESS; + unsigned i = 0; + bool fGCEnabled = false; + bool fR0Enabled = false; + uint32_t cbTotalBufferSize = 0; + + /* + * Validate and read configuration. + */ + rc = CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0" + "R0Enabled\0" + "PrimaryMaster\0" + "PrimarySlave\0" + "SecondaryMaster\0" + "SecondarySlave\0" + "PortCount\0" + "UseAsyncInterfaceIfAvailable\0"); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, + N_("AHCI configuration error: unknown option specified")); + + rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &fGCEnabled, true); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read GCEnabled as boolean")); + Log(("%s: fGCEnabled=%d\n", __FUNCTION__, fGCEnabled)); + + rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &fR0Enabled, true); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read R0Enabled as boolean")); + Log(("%s: fR0Enabled=%d\n", __FUNCTION__, fR0Enabled)); + + rc = CFGMR3QueryU32Def(pCfgHandle, "PortCount", &pThis->cPortsImpl, AHCI_MAX_NR_PORTS_IMPL); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read PortCount as integer")); + Log(("%s: cPortsImpl=%u\n", __FUNCTION__, pThis->cPortsImpl)); + if (pThis->cPortsImpl > AHCI_MAX_NR_PORTS_IMPL) + return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS, + N_("AHCI configuration error: PortCount=%u should not exceed %u"), + pThis->cPortsImpl, AHCI_MAX_NR_PORTS_IMPL); + if (pThis->cPortsImpl < 1) + return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS, + N_("AHCI configuration error: PortCount=%u should be at least 1"), + pThis->cPortsImpl); + + rc = CFGMR3QueryBoolDef(pCfgHandle, "UseAsyncInterfaceIfAvailable", &pThis->fUseAsyncInterfaceIfAvailable, true); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read UseAsyncInterfaceIfAvailable as boolean")); + rc = CFGMR3QueryU32Def(pCfgHandle, "HighIOThreshold", &pThis->cHighIOThreshold, ~0); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read HighIOThreshold as integer")); + rc = CFGMR3QueryU32Def(pCfgHandle, "MillisToSleep", &pThis->cMillisToSleep, 0); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read MillisToSleep as integer")); + + pThis->fR0Enabled = fR0Enabled; + pThis->fGCEnabled = fGCEnabled; + pThis->pDevInsR3 = pDevIns; + pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); + pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); + + PCIDevSetVendorId (&pThis->dev, 0x8086); /* Intel */ + PCIDevSetDeviceId (&pThis->dev, 0x2829); /* ICH-8M */ + PCIDevSetCommand (&pThis->dev, 0x0000); + PCIDevSetRevisionId (&pThis->dev, 0x02); + PCIDevSetClassProg (&pThis->dev, 0x01); + PCIDevSetClassSub (&pThis->dev, 0x06); + PCIDevSetClassBase (&pThis->dev, 0x01); + PCIDevSetBaseAddress (&pThis->dev, 5, false, false, false, 0x00000000); + + pThis->dev.config[0x34] = 0x80; /* Capability pointer. */ + + PCIDevSetInterruptLine(&pThis->dev, 0x00); + PCIDevSetInterruptPin (&pThis->dev, 0x01); + + pThis->dev.config[0x70] = 0x01; /* Capability ID: PCI Power Management Interface */ + pThis->dev.config[0x71] = 0x00; + pThis->dev.config[0x72] = 0x03; + + pThis->dev.config[0x80] = 0x05; /* Capability ID: Message Signaled Interrupts. Disabled. */ + pThis->dev.config[0x81] = 0x70; /* next. */ + + pThis->dev.config[0x90] = 0x40; /* AHCI mode. */ + pThis->dev.config[0x92] = 0x3f; + pThis->dev.config[0x94] = 0x80; + pThis->dev.config[0x95] = 0x01; + pThis->dev.config[0x97] = 0x78; + + /* + * Register the PCI device, it's I/O regions. + */ + rc = PDMDevHlpPCIRegister (pDevIns, &pThis->dev); + if (RT_FAILURE(rc)) + return rc; + + /* + * Solaris 10 U5 fails to map the AHCI register space when the sets (0..5) for the legacy + * IDE registers are not available. + * We set up "fake" entries in the PCI configuration register. + * That means they are available but read and writes from/to them have no effect. + * No guest should access them anyway because the controller is marked as AHCI in the Programming interface + * and we don't have an option to change to IDE emulation (real hardware provides an option in the BIOS + * to switch to it which also changes device Id and other things in the PCI configuration space). + */ + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, 8, PCI_ADDRESS_SPACE_IO, ahciLegacyFakeIORangeMap); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI cannot register PCI I/O region")); + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, 1, PCI_ADDRESS_SPACE_IO, ahciLegacyFakeIORangeMap); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI cannot register PCI I/O region")); + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 2, 8, PCI_ADDRESS_SPACE_IO, ahciLegacyFakeIORangeMap); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI cannot register PCI I/O region")); + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 3, 1, PCI_ADDRESS_SPACE_IO, ahciLegacyFakeIORangeMap); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI cannot register PCI I/O region")); + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 4, 0x10, PCI_ADDRESS_SPACE_IO, ahciLegacyFakeIORangeMap); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI cannot register PCI I/O region for BMDMA")); + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 5, 4352, PCI_ADDRESS_SPACE_MEM, ahciMMIOMap); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI cannot register PCI memory region for registers")); + + rc = PDMDevHlpCritSectInit(pDevIns, &pThis->lock, "AHCI"); + if (RT_FAILURE(rc)) + { + Log(("%s: Failed to create critical section.\n", __FUNCTION__)); + return rc; + } + + /* Create the timer for command completion coalescing feature. */ + rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, ahciCccTimer, pThis, + TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "AHCI CCC Timer", &pThis->pHbaCccTimerR3); + if (RT_FAILURE(rc)) + { + AssertMsgFailed(("pfnTMTimerCreate -> %Rrc\n", rc)); + return rc; + } + pThis->pHbaCccTimerR0 = TMTimerR0Ptr(pThis->pHbaCccTimerR3); + pThis->pHbaCccTimerRC = TMTimerRCPtr(pThis->pHbaCccTimerR3); + + /* Status LUN. */ + pThis->IBase.pfnQueryInterface = ahciStatus_QueryInterface; + pThis->ILeds.pfnQueryStatusLed = ahciStatus_QueryStatusLed; + + /* + * Create the transmit queue. + */ + rc = PDMDevHlpPDMQueueCreate(pDevIns, sizeof(DEVPORTNOTIFIERQUEUEITEM), 30*32 /*Maximum of 30 ports multiplied with 32 tasks each port*/, 0, + ahciNotifyQueueConsumer, true, &pThis->pNotifierQueueR3); + if (RT_FAILURE(rc)) + return rc; + pThis->pNotifierQueueR0 = PDMQueueR0Ptr(pThis->pNotifierQueueR3); + pThis->pNotifierQueueRC = PDMQueueRCPtr(pThis->pNotifierQueueR3); + + /* Initialize static members on every port. */ + for (i = 0; i < AHCI_MAX_NR_PORTS_IMPL; i++) + { + /* + * Init members of the port. + */ + PAHCIPort pAhciPort = &pThis->ahciPort[i]; + pAhciPort->pDevInsR3 = pDevIns; + pAhciPort->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); + pAhciPort->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); + pAhciPort->iLUN = i; + pAhciPort->pAhciR3 = pThis; + pAhciPort->pAhciR0 = PDMINS_2_DATA_R0PTR(pDevIns); + pAhciPort->pAhciRC = PDMINS_2_DATA_RCPTR(pDevIns); + pAhciPort->Led.u32Magic = PDMLED_MAGIC; + pAhciPort->pDrvBase = NULL; + + /* Register statistics counter. */ + PDMDevHlpSTAMRegisterF(pDevIns, &pAhciPort->StatDMA, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, + "Number of DMA transfers.", "/Devices/SATA/Port%d/DMA", i); + PDMDevHlpSTAMRegisterF(pDevIns, &pAhciPort->StatBytesRead, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, + "Amount of data read.", "/Devices/SATA/Port%d/ReadBytes", i); + PDMDevHlpSTAMRegisterF(pDevIns, &pAhciPort->StatBytesWritten, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, + "Amount of data written.", "/Devices/SATA/Port%d/WrittenBytes", i); + PDMDevHlpSTAMRegisterF(pDevIns, &pAhciPort->StatIORequestsPerSecond, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, + "Number of processed I/O requests per second.", "/Devices/SATA/Port%d/IORequestsPerSecond", i); +#ifdef VBOX_WITH_STATISTICS + PDMDevHlpSTAMRegisterF(pDevIns, &pAhciPort->StatProfileProcessTime, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_CALL, + "Amount of time to process one request.", "/Devices/SATA/Port%d/ProfileProcessTime", i); + PDMDevHlpSTAMRegisterF(pDevIns, &pAhciPort->StatProfileMapIntoR3, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_CALL, + "Amount of time to map the guest buffers into R3.", "/Devices/SATA/Port%d/ProfileMapIntoR3", i); + PDMDevHlpSTAMRegisterF(pDevIns, &pAhciPort->StatProfileReadWrite, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_CALL, + "Amount of time for the read/write operation to complete.", "/Devices/SATA/Port%d/ProfileReadWrite", i); + PDMDevHlpSTAMRegisterF(pDevIns, &pAhciPort->StatProfileDestroyScatterGatherList, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_NS_PER_CALL, + "Amount of time to destroy the scatter gather list and free associated ressources.", "/Devices/SATA/Port%d/ProfileDestroyScatterGatherList", i); +#endif + + ahciPortHwReset(pAhciPort); + } + + /* Attach drivers to every available port. */ + for (i = 0; i < pThis->cPortsImpl; i++) + { + char szName[24]; + RTStrPrintf(szName, sizeof(szName), "Port%d", i); + + PAHCIPort pAhciPort = &pThis->ahciPort[i]; + /* + * Init interfaces. + */ + pAhciPort->IBase.pfnQueryInterface = ahciPortQueryInterface; + pAhciPort->IPortAsync.pfnTransferCompleteNotify = ahciTransferCompleteNotify; + pAhciPort->IMountNotify.pfnMountNotify = ahciMountNotify; + pAhciPort->IMountNotify.pfnUnmountNotify = ahciUnmountNotify; + pAhciPort->fAsyncIOThreadIdle = true; + + /* + * Attach the block driver + */ + rc = PDMDevHlpDriverAttach(pDevIns, pAhciPort->iLUN, &pAhciPort->IBase, &pAhciPort->pDrvBase, szName); + if (RT_SUCCESS(rc)) + { + rc = ahciConfigureLUN(pDevIns, pAhciPort); + if (RT_FAILURE(rc)) + { + Log(("%s: Failed to configure the %s.\n", __FUNCTION__, szName)); + return rc; + } + + /* Mark that a device is present on that port */ + if (i < 6) + pThis->dev.config[0x93] |= (1 << i); + + /* + * Init vendor product data. + */ + /* Generate a default serial number. */ + char szSerial[AHCI_SERIAL_NUMBER_LENGTH+1]; + RTUUID Uuid; + if (pAhciPort->pDrvBlock) + rc = pAhciPort->pDrvBlock->pfnGetUuid(pAhciPort->pDrvBlock, &Uuid); + else + RTUuidClear(&Uuid); + + if (RT_FAILURE(rc) || RTUuidIsNull(&Uuid)) + { + /* Generate a predictable serial for drives which don't have a UUID. */ + RTStrPrintf(szSerial, sizeof(szSerial), "VB%x-1a2b3c4d", + pAhciPort->iLUN); + } + else + RTStrPrintf(szSerial, sizeof(szSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]); + + /* Get user config if present using defaults otherwise. */ + PCFGMNODE pCfgNode = CFGMR3GetChild(pCfgHandle, szName); + rc = CFGMR3QueryStringDef(pCfgNode, "SerialNumber", pAhciPort->szSerialNumber, sizeof(pAhciPort->szSerialNumber), + szSerial); + if (RT_FAILURE(rc)) + { + if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) + return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, + N_("AHCI configuration error: \"SerialNumber\" is longer than 20 bytes")); + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read \"SerialNumber\" as string")); + } + + rc = CFGMR3QueryStringDef(pCfgNode, "FirmwareRevision", pAhciPort->szFirmwareRevision, sizeof(pAhciPort->szFirmwareRevision), + "1.0"); + if (RT_FAILURE(rc)) + { + if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) + return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, + N_("AHCI configuration error: \"FirmwareRevision\" is longer than 8 bytes")); + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read \"FirmwareRevision\" as string")); + } + + rc = CFGMR3QueryStringDef(pCfgNode, "ModelNumber", pAhciPort->szModelNumber, sizeof(pAhciPort->szModelNumber), + "VBOX HARDDISK"); + if (RT_FAILURE(rc)) + { + if (rc == VERR_CFGM_NOT_ENOUGH_SPACE) + return PDMDEV_SET_ERROR(pDevIns, VERR_INVALID_PARAMETER, + N_("AHCI configuration error: \"ModelNumber\" is longer than 40 bytes")); + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("AHCI configuration error: failed to read \"ModelNumber\" as string")); + } + + /* + * If the new async interface is available we use a PDMQueue to transmit + * the requests into R3. + * Otherwise we use a event semaphore and a async I/O thread which processes them. + */ + if (pAhciPort->pDrvBlockAsync && pThis->fUseAsyncInterfaceIfAvailable) + { + LogRel(("AHCI: LUN#%d: using async I/O\n", pAhciPort->iLUN)); + pAhciPort->fAsyncInterface = true; + } + else + { + LogRel(("AHCI: LUN#%d: using normal I/O\n", pAhciPort->iLUN)); + pAhciPort->fAsyncInterface = false; + + rc = RTSemEventCreate(&pAhciPort->AsyncIORequestSem); + AssertMsgRC(rc, ("Failed to create event semaphore for %s rc=%Rrc.\n", szName, rc)); + + + rc = PDMDevHlpPDMThreadCreate(pDevIns, &pAhciPort->pAsyncIOThread, pAhciPort, ahciAsyncIOLoop, ahciAsyncIOLoopWakeUp, 0, + RTTHREADTYPE_IO, szName); + AssertMsgRC(rc, ("%s: Async IO Thread creation for %s failed rc=%Rrc\n", szName, rc)); + } + } + else if (rc == VERR_PDM_NO_ATTACHED_DRIVER) + { + pAhciPort->pDrvBase = NULL; + rc = VINF_SUCCESS; + LogRel(("%s: no driver attached\n", szName)); + } + else + return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, + N_("AHCI: Failed to attach drive to %s"), szName); + +#ifdef DEBUG + for (uint32_t i = 0; i < AHCI_NR_COMMAND_SLOTS; i++) + pAhciPort->ahciIOTasks[i] = 0xff; +#endif + } + + /* + * Attach status driver (optional). + */ + rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBase, &pBase, "Status Port"); + if (RT_SUCCESS(rc)) + pThis->pLedsConnector = (PDMILEDCONNECTORS *)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS); + else if (rc != VERR_PDM_NO_ATTACHED_DRIVER) + { + AssertMsgFailed(("Failed to attach to status driver. rc=%Rrc\n", rc)); + return PDMDEV_SET_ERROR(pDevIns, rc, N_("AHCI cannot attach to status driver")); + } + + /* + * Setup IDE emulation. + * We only emulate the I/O ports but not bus master DMA. + * If the configuration values are not found the setup of the ports is as follows: + * Primary Master: Port 0 + * Primary Slave: Port 1 + * Secondary Master: Port 2 + * Secondary Slave: Port 3 + */ + + /* + * Setup I/O ports for the PCI device. + */ + pThis->aCts[0].irq = 12; + pThis->aCts[0].IOPortBase1 = 0x1e8; + pThis->aCts[0].IOPortBase2 = 0x3e6; + pThis->aCts[1].irq = 11; + pThis->aCts[1].IOPortBase1 = 0x168; + pThis->aCts[1].IOPortBase2 = 0x366; + + for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCts); i++) + { + PAHCIATACONTROLLER pCtl = &pThis->aCts[i]; + uint32_t iPortMaster, iPortSlave; + uint32_t cbSSMState = 0; + static const char *s_apszDescs[RT_ELEMENTS(pThis->aCts)][RT_ELEMENTS(pCtl->aIfs)] = + { + { "PrimaryMaster", "PrimarySlave" }, + { "SecondaryMaster", "SecondarySlave" } + }; + + rc = CFGMR3QueryU32Def(pCfgHandle, s_apszDescs[i][0], &iPortMaster, 2 * i); + if (RT_FAILURE(rc)) + return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, + N_("AHCI configuration error: failed to read %s as U32"), s_apszDescs[i][0]); + + rc = CFGMR3QueryU32Def(pCfgHandle, s_apszDescs[i][1], &iPortSlave, 2 * i + 1); + if (RT_FAILURE(rc)) + return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, + N_("AHCI configuration error: failed to read %s as U32"), s_apszDescs[i][1]); + + char szName[24]; + RTStrPrintf(szName, sizeof(szName), "EmulatedATA%d", i); + rc = ataControllerInit(pDevIns, pCtl, pThis->ahciPort[iPortMaster].pDrvBase, pThis->ahciPort[iPortSlave].pDrvBase, + &cbSSMState, szName, &pThis->ahciPort[iPortMaster].Led, &pThis->ahciPort[iPortMaster].StatBytesRead, + &pThis->ahciPort[iPortMaster].StatBytesWritten); + if (RT_FAILURE(rc)) + return rc; + + cbTotalBufferSize += cbSSMState; + + rc = PDMDevHlpIOPortRegister(pDevIns, pCtl->IOPortBase1, 8, (RTHCPTR)i, + ahciIOPortWrite1, ahciIOPortRead1, ahciIOPortWriteStr1, ahciIOPortReadStr1, "AHCI"); + if (RT_FAILURE(rc)) + return rc; + + if (pThis->fR0Enabled) + { + rc = PDMDevHlpIOPortRegisterR0(pDevIns, pCtl->IOPortBase1, 8, (RTR0PTR)i, + "ahciIOPortWrite1", "ahciIOPortRead1", NULL, NULL, "AHCI R0"); + if (RT_FAILURE(rc)) + return rc; + } + + if (pThis->fGCEnabled) + { + rc = PDMDevHlpIOPortRegisterGC(pDevIns, pCtl->IOPortBase1, 8, (RTGCPTR)i, + "ahciIOPortWrite1", "ahciIOPortRead1", NULL, NULL, "AHCI GC"); + if (RT_FAILURE(rc)) + return rc; + } + + rc = PDMDevHlpIOPortRegister(pDevIns, pCtl->IOPortBase2, 1, (RTHCPTR)i, + ahciIOPortWrite2, ahciIOPortRead2, NULL, NULL, "AHCI"); + if (RT_FAILURE(rc)) + return rc; + + if (pThis->fR0Enabled) + { + rc = PDMDevHlpIOPortRegisterR0(pDevIns, pCtl->IOPortBase2, 1, (RTR0PTR)i, + "ahciIOPortWrite2", "ahciIOPortRead2", NULL, NULL, "AHCI R0"); + if (RT_FAILURE(rc)) + return rc; + } + + if (pThis->fGCEnabled) + { + rc = PDMDevHlpIOPortRegisterGC(pDevIns, pCtl->IOPortBase2, 1, (RTGCPTR)i, + "ahciIOPortWrite2", "ahciIOPortRead2", NULL, NULL, "AHCI GC"); + if (RT_FAILURE(rc)) + return rc; + } + } + + rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, + AHCI_SAVED_STATE_VERSION, sizeof(*pThis)+cbTotalBufferSize, + ahciSavePrep, ahciSaveExec, NULL, + ahciLoadPrep, ahciLoadExec, NULL); + if (RT_FAILURE(rc)) + return rc; + + ahciReset(pDevIns); + + return rc; +} + +/** + * The device registration structure. + */ +const PDMDEVREG g_DeviceAHCI = +{ + /* u32Version */ + PDM_DEVREG_VERSION, + /* szDeviceName */ + "ahci", + /* szRCMod */ + "VBoxDDGC.gc", + /* szR0Mod */ + "VBoxDDR0.r0", + /* pszDescription */ + "Intel AHCI controller.\n", + /* fFlags */ + PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 | + PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, + /* fClass */ + PDM_DEVREG_CLASS_STORAGE, + /* cMaxInstances */ + ~0, + /* cbInstance */ + sizeof(AHCI), + /* pfnConstruct */ + ahciConstruct, + /* pfnDestruct */ + ahciDestruct, + /* pfnRelocate */ + ahciRelocate, + /* pfnIOCtl */ + NULL, + /* pfnPowerOn */ + NULL, + /* pfnReset */ + ahciReset, + /* pfnSuspend */ + ahciSuspend, + /* pfnResume */ + ahciResume, + /* pfnAttach */ + ahciAttach, + /* pfnDetach */ + ahciDetach, + /* pfnQueryInterface. */ + NULL, + /* pfnInitComplete */ + NULL, + /* pfnPowerOff */ + ahciPowerOff, + /* pfnSoftReset */ + NULL, + /* u32VersionEnd */ + PDM_DEVREG_VERSION +}; + +#endif /* IN_RING3 */ +#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ diff --git a/src/VBox/Devices/Storage/DevATA.cpp b/src/VBox/Devices/Storage/DevATA.cpp index 7ddd61e5f..967442327 100644 --- a/src/VBox/Devices/Storage/DevATA.cpp +++ b/src/VBox/Devices/Storage/DevATA.cpp @@ -1,4 +1,4 @@ -/* $Id: DevATA.cpp 20567 2009-06-14 20:31:54Z vboxsync $ */ +/* $Id: DevATA.cpp $ */ /** @file * VBox storage devices: ATA/ATAPI controller device (disk and cdrom). */ diff --git a/src/VBox/Devices/Storage/DevBusLogic.cpp b/src/VBox/Devices/Storage/DevBusLogic.cpp new file mode 100644 index 000000000..6b0f1b84b --- /dev/null +++ b/src/VBox/Devices/Storage/DevBusLogic.cpp @@ -0,0 +1,2878 @@ +/* $Id: DevBusLogic.cpp $ */ +/** @file + * + * VBox storage devices: + * BusLogic SCSI host adapter BT-958 + */ + +/* + * Copyright (C) 2006-2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +/* Implemented looking at the driver source in the linux kernel (drivers/scsi/BusLogic.[ch]). */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +//#define DEBUG +#define LOG_GROUP LOG_GROUP_DEV_BUSLOGIC +#include <VBox/pdmdev.h> +#include <VBox/pdmifs.h> +#include <VBox/scsi.h> +#include <iprt/assert.h> +#include <iprt/string.h> +#include <iprt/log.h> +#ifdef IN_RING3 +# include <iprt/alloc.h> +# include <iprt/cache.h> +# include <iprt/param.h> +#endif + +#include "VBoxSCSI.h" +#include "../Builtins.h" + +/* Maximum number of attached devices the adapter can handle. */ +#define BUSLOGIC_MAX_DEVICES 16 + +/* Maximum number of scatter gather elements this device can handle. */ +#define BUSLOGIC_MAX_SCATTER_GATHER_LIST_SIZE 128 + +/* Size of the command buffer. */ +#define BUSLOGIC_COMMAND_SIZE_MAX 5 + +/* Size of the reply buffer. */ +#define BUSLOGIC_REPLY_SIZE_MAX 64 + +/* I/O port registered in the ISA compatible range to let the BIOS access + * the controller. + */ +#define BUSLOGIC_ISA_IO_PORT 0x330 + +/** State saved version. */ +#define BUSLOGIC_SAVED_STATE_MINOR_VERSION 1 + +/* + * State of a device attached to the buslogic host adapter. + */ +typedef struct BUSLOGICDEVICE +{ + /** Pointer to the owning buslogic device instance. - R3 pointer */ + R3PTRTYPE(struct BUSLOGIC *) pBusLogicR3; + /** Pointer to the owning buslogic device instance. - R0 pointer */ + R0PTRTYPE(struct BUSLOGIC *) pBusLogicR0; + /** Pointer to the owning buslogic device instance. - RC pointer */ + RCPTRTYPE(struct BUSLOGIC *) pBusLogicRC; + + /** Flag whether device is present. */ + bool fPresent; + /** LUN of the device. */ + RTUINT iLUN; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment0; +#endif + + /** Our base interace. */ + PDMIBASE IBase; + /** SCSI port interface. */ + PDMISCSIPORT ISCSIPort; + /** Led interface. */ + PDMILEDPORTS ILed; + /** Pointer to the attached driver's base interface. */ + R3PTRTYPE(PPDMIBASE) pDrvBase; + /** Pointer to the underlying SCSI connector interface. */ + R3PTRTYPE(PPDMISCSICONNECTOR) pDrvSCSIConnector; + /** The status LED state for this device. */ + PDMLED Led; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment1; +#endif + + /** Number of outstanding tasks on the port. */ + volatile uint32_t cOutstandingRequests; + +} BUSLOGICDEVICE, *PBUSLOGICDEVICE; + +/* + * Commands the BusLogic adapter supports. + */ +enum BUSLOGICCOMMAND +{ + BUSLOGICCOMMAND_TEST_COMMAND_COMPLETE_INTERRUPT = 0x00, + BUSLOGICCOMMAND_INITIALIZE_MAILBOX = 0x01, + BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND = 0x02, + BUSLOGICCOMMAND_EXECUTE_BIOS_COMMAND = 0x03, + BUSLOGICCOMMAND_INQUIRE_BOARD_ID = 0x04, + BUSLOGICCOMMAND_ENABLE_OUTGOING_MAILBOX_AVAILABLE_INTERRUPT = 0x05, + BUSLOGICCOMMAND_SET_SCSI_SELECTION_TIMEOUT = 0x06, + BUSLOGICCOMMAND_SET_PREEMPT_TIME_ON_BUS = 0x07, + BUSLOGICCOMMAND_SET_TIME_OFF_BUS = 0x08, + BUSLOGICCOMMAND_SET_BUS_TRANSFER_RATE = 0x09, + BUSLOGICCOMMAND_INQUIRE_INSTALLED_DEVICES_ID_0_TO_7 = 0x0a, + BUSLOGICCOMMAND_INQUIRE_CONFIGURATION = 0x0b, + BUSLOGICCOMMAND_ENABLE_TARGET_MODE = 0x0c, + BUSLOGICCOMMAND_INQUIRE_SETUP_INFORMATION = 0x0d, + BUSLOGICCOMMAND_WRITE_ADAPTER_LOCAL_RAM = 0x1a, + BUSLOGICCOMMAND_READ_ADAPTER_LOCAL_RAM = 0x1b, + BUSLOGICCOMMAND_WRITE_BUSMASTER_CHIP_FIFO = 0x1c, + BUSLOGICCOMMAND_READ_BUSMASTER_CHIP_FIFO = 0x1d, + BUSLOGICCOMMAND_ECHO_COMMAND_DATA = 0x1f, + BUSLOGICCOMMAND_HOST_ADAPTER_DIAGNOSTIC = 0x20, + BUSLOGICCOMMAND_SET_ADAPTER_OPTIONS = 0x21, + BUSLOGICCOMMAND_INQUIRE_INSTALLED_DEVICES_ID_8_TO_15 = 0x23, + BUSLOGICCOMMAND_INQUIRE_TARGET_DEVICES = 0x24, + BUSLOGICCOMMAND_DISABLE_HOST_ADAPTER_INTERRUPT = 0x25, + BUSLOGICCOMMAND_INITIALIZE_EXTENDED_MAILBOX = 0x81, + BUSLOGICCOMMAND_EXECUTE_SCSI_COMMAND = 0x83, + BUSLOGICCOMMAND_INQUIRE_FIRMWARE_VERSION_3RD_LETTER = 0x84, + BUSLOGICCOMMAND_INQUIRE_FIRMWARE_VERSION_LETTER = 0x85, + BUSLOGICCOMMAND_INQUIRE_PCI_HOST_ADAPTER_INFORMATION = 0x86, + BUSLOGICCOMMAND_INQUIRE_HOST_ADAPTER_MODEL_NUMBER = 0x8b, + BUSLOGICCOMMAND_INQUIRE_SYNCHRONOUS_PERIOD = 0x8c, + BUSLOGICCOMMAND_INQUIRE_EXTENDED_SETUP_INFORMATION = 0x8d, + BUSLOGICCOMMAND_ENABLE_STRICT_ROUND_ROBIN_MODE = 0x8f, + BUSLOGICCOMMAND_STORE_HOST_ADAPTER_LOCAL_RAM = 0x90, + BUSLOGICCOMMAND_FETCH_HOST_ADAPTER_LOCAL_RAM = 0x91, + BUSLOGICCOMMAND_STORE_LOCAL_DATA_IN_EEPROM = 0x92, + BUSLOGICCOMMAND_UPLOAD_AUTO_SCSI_CODE = 0x94, + BUSLOGICCOMMAND_MODIFY_IO_ADDRESS = 0x95, + BUSLOGICCOMMAND_SET_CCB_FORMAT = 0x96, + BUSLOGICCOMMAND_WRITE_INQUIRY_BUFFER = 0x9a, + BUSLOGICCOMMAND_READ_INQUIRY_BUFFER = 0x9b, + BUSLOGICCOMMAND_FLASH_ROM_UPLOAD_DOWNLOAD = 0xa7, + BUSLOGICCOMMAND_READ_SCAM_DATA = 0xa8, + BUSLOGICCOMMAND_WRITE_SCAM_DATA = 0xa9 +} BUSLOGICCOMMAND; + +#pragma pack(1) +/** + * Auto SCSI structure which is located + * in host adapter RAM and contains several + * configuration parameters. + */ +typedef struct AutoSCSIRam +{ + uint8_t aInternalSignature[2]; + uint8_t cbInformation; + uint8_t aHostAdaptertype[6]; + uint8_t uReserved1; + bool fFloppyEnabled: 1; + bool fFloppySecondary: 1; + bool fLevelSensitiveInterrupt: 1; + unsigned char uReserved2: 2; + unsigned char uSystemRAMAreForBIOS: 3; + unsigned char uDMAChannel: 7; + bool fDMAAutoConfiguration: 1; + unsigned char uIrqChannel: 7; + bool fIrqAutoConfiguration: 1; + uint8_t uDMATransferRate; + uint8_t uSCSIId; + bool fLowByteTerminated: 1; + bool fParityCheckingEnabled: 1; + bool fHighByteTerminated: 1; + bool fNoisyCablingEnvironment: 1; + bool fFastSynchronousNeogtiation: 1; + bool fBusResetEnabled: 1; + bool fReserved3: 1; + bool fActiveNegotiationEnabled: 1; + uint8_t uBusOnDelay; + uint8_t uBusOffDelay; + bool fHostAdapterBIOSEnabled: 1; + bool fBIOSRedirectionOfInt19: 1; + bool fExtendedTranslation: 1; + bool fMapRemovableAsFixed: 1; + bool fReserved4: 1; + bool fBIOSSupportsMoreThan2Drives: 1; + bool fBIOSInterruptMode: 1; + bool fFlopticalSupport: 1; + uint16_t u16DeviceEnabledMask; + uint16_t u16WidePermittedMask; + uint16_t u16FastPermittedMask; + uint16_t u16SynchronousPermittedMask; + uint16_t u16DisconnectPermittedMask; + uint16_t u16SendStartUnitCommandMask; + uint16_t u16IgnoreInBIOSScanMask; + unsigned char uPCIInterruptPin: 2; + unsigned char uHostAdapterIoPortAddress: 2; + bool fStrictRoundRobinMode: 1; + bool fVesaBusSpeedGreaterThan33MHz: 1; + bool fVesaBurstWrite: 1; + bool fVesaBurstRead: 1; + uint16_t u16UltraPermittedMask; + uint32_t uReserved5; + uint8_t uReserved6; + uint8_t uAutoSCSIMaximumLUN; + bool fReserved7: 1; + bool fSCAMDominant: 1; + bool fSCAMenabled: 1; + bool fSCAMLevel2: 1; + unsigned char uReserved8: 4; + bool fInt13Extension: 1; + bool fReserved9: 1; + bool fCDROMBoot: 1; + unsigned char uReserved10: 5; + unsigned char uBootTargetId: 4; + unsigned char uBootChannel: 4; + bool fForceBusDeviceScanningOrder: 1; + unsigned char uReserved11: 7; + uint16_t u16NonTaggedToAlternateLunPermittedMask; + uint16_t u16RenegotiateSyncAfterCheckConditionMask; + uint8_t aReserved12[10]; + uint8_t aManufacturingDiagnostic[2]; + uint16_t u16Checksum; +} AutoSCSIRam, *PAutoSCSIRam; +AssertCompileSize(AutoSCSIRam, 64); +#pragma pack() + +#pragma pack(1) +/** + * The local Ram. + */ +typedef union HostAdapterLocalRam +{ + /* Byte view. */ + uint8_t u8View[256]; + /* Structured view. */ + struct + { + /** Offset 0 - 63 is for BIOS. */ + uint8_t u8Bios[64]; + /** Auto SCSI structure. */ + AutoSCSIRam autoSCSIData; + } structured; +} HostAdapterLocalRam, *PHostAdapterLocalRam; +AssertCompileSize(HostAdapterLocalRam, 256); +#pragma pack() + +/* + * Main BusLogic device state. + */ +typedef struct BUSLOGIC +{ + /** The PCI device structure. */ + PCIDEVICE dev; + /** Pointer to the device instance - HC ptr */ + PPDMDEVINSR3 pDevInsR3; + /** Pointer to the device instance - R0 ptr */ + PPDMDEVINSR0 pDevInsR0; + /** Pointer to the device instance - RC ptr. */ + PPDMDEVINSRC pDevInsRC; + + /* Whether R0 is enabled. */ + bool fR0Enabled; + /** Whether GC is enabled. */ + bool fGCEnabled; + + /** Base address of the I/O ports. */ + RTIOPORT IOPortBase; + /** Base address of the memory mapping. */ + RTGCPHYS MMIOBase; + /** Status register - Readonly. */ + volatile uint8_t regStatus; + /** Interrupt register - Readonly. */ + volatile uint8_t regInterrupt; + /** Geometry register - Readonly. */ + volatile uint8_t regGeometry; + + /** Local RAM for the fetch hostadapter local RAM request. + * I don't know how big the buffer really is but the maximum + * seems to be 256 bytes because the offset and count field in the command request + * are only one byte big. + */ + HostAdapterLocalRam LocalRam; + + /** Command code the guest issued. */ + uint8_t uOperationCode; + /** Buffer for the command parameters the adapter is currently receiving from the guest. + * Size of the largest command which is possible. + */ + uint8_t aCommandBuffer[BUSLOGIC_COMMAND_SIZE_MAX]; /* Size of the biggest request. */ + /** Current position in the command buffer. */ + uint8_t iParameter; + /** Parameters left until the command is complete. */ + uint8_t cbCommandParametersLeft; + + /** Whether we are using the RAM or reply buffer. */ + bool fUseLocalRam; + /** Buffer to store reply data from the controller to the guest. */ + uint8_t aReplyBuffer[BUSLOGIC_REPLY_SIZE_MAX]; /* Size of the biggest reply. */ + /** Position in the buffer we are reading next. */ + uint8_t iReply; + /** Bytes left until the reply buffer is empty. */ + uint8_t cbReplyParametersLeft; + + /** Flag whether IRQs are enabled. */ + bool fIRQEnabled; + /** Flag whether the ISA I/O port range is disabled + * to prevent the BIOs to access the device. */ + bool fISAEnabled; + + /** Number of mailboxes the guest set up. */ + uint32_t cMailbox; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment0; +#endif + + /** Physical base address of the outgoing mailboxes. */ + RTGCPHYS GCPhysAddrMailboxOutgoingBase; + /** Current outgoing mailbox position. */ + uint32_t uMailboxOutgoingPositionCurrent; + /** Number of mailboxes ready. */ + volatile uint32_t cMailboxesReady; + /** Whether a notification to R3 was send. */ + volatile bool fNotificationSend; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment1; +#endif + + /** Physical base address of the incoming mailboxes. */ + RTGCPHYS GCPhysAddrMailboxIncomingBase; + /** Current incoming mailbox position. */ + uint32_t uMailboxIncomingPositionCurrent; + + /** Whether strict round robin is enabled. */ + bool fStrictRoundRobinMode; + /** Whether the extended LUN CCB format is enabled for 32 possible logical units. */ + bool fExtendedLunCCBFormat; + + /** Queue to send tasks to R3. - HC ptr */ + R3PTRTYPE(PPDMQUEUE) pNotifierQueueR3; + /** Queue to send tasks to R3. - HC ptr */ + R0PTRTYPE(PPDMQUEUE) pNotifierQueueR0; + /** Queue to send tasks to R3. - RC ptr */ + RCPTRTYPE(PPDMQUEUE) pNotifierQueueRC; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment2; +#endif + + /** Cache for task states. */ + R3PTRTYPE(PRTOBJCACHE) pTaskCache; + + /** Device state for BIOS access. */ + VBOXSCSI VBoxSCSI; + + /** BusLogic device states. */ + BUSLOGICDEVICE aDeviceStates[BUSLOGIC_MAX_DEVICES]; + + /** The base interface */ + PDMIBASE IBase; + /** Status Port - Leds interface. */ + PDMILEDPORTS ILeds; + /** Partner of ILeds. */ + R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; +} BUSLOGIC, *PBUSLOGIC; + +/** Register offsets in the I/O port space. */ +#define BUSLOGIC_REGISTER_CONTROL 0 /* Writeonly */ +/** Fields for the control register. */ +# define BUSLOGIC_REGISTER_CONTROL_SCSI_BUSRESET RT_BIT(4) +# define BUSLOGIC_REGISTER_CONTROL_INTERRUPT_RESET RT_BIT(5) +# define BUSLOGIC_REGISTER_CONTROL_SOFT_RESET RT_BIT(6) +# define BUSLOGIC_REGISTER_CONTROL_HARD_RESET RT_BIT(7) + +#define BUSLOGIC_REGISTER_STATUS 0 /* Readonly */ +/** Fields for the status register. */ +# define BUSLOGIC_REGISTER_STATUS_COMMAND_INVALID RT_BIT(0) +# define BUSLOGIC_REGISTER_STATUS_DATA_IN_REGISTER_READY RT_BIT(2) +# define BUSLOGIC_REGISTER_STATUS_COMMAND_PARAMETER_REGISTER_BUSY RT_BIT(3) +# define BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY RT_BIT(4) +# define BUSLOGIC_REGISTER_STATUS_INITIALIZATION_REQUIRED RT_BIT(5) +# define BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_FAILURE RT_BIT(6) +# define BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_ACTIVE RT_BIT(7) + +#define BUSLOGIC_REGISTER_COMMAND 1 /* Writeonly */ +#define BUSLOGIC_REGISTER_DATAIN 1 /* Readonly */ +#define BUSLOGIC_REGISTER_INTERRUPT 2 /* Readonly */ +/** Fields for the interrupt register. */ +# define BUSLOGIC_REGISTER_INTERRUPT_INCOMING_MAILBOX_LOADED RT_BIT(0) +# define BUSLOGIC_REGISTER_INTERRUPT_OUTCOMING_MAILBOX_AVAILABLE RT_BIT(1) +# define BUSLOGIC_REGISTER_INTERRUPT_COMMAND_COMPLETE RT_BIT(2) +# define BUSLOGIC_REGISTER_INTERRUPT_EXTERNAL_BUS_RESET RT_BIT(3) +# define BUSLOGIC_REGISTER_INTERRUPT_INTERRUPT_VALID RT_BIT(7) + +#define BUSLOGIC_REGISTER_GEOMETRY 3 /* Readonly */ +# define BUSLOGIC_REGISTER_GEOMETRY_EXTENTED_TRANSLATION_ENABLED RT_BIT(7) + +/* Structure for the INQUIRE_PCI_HOST_ADAPTER_INFORMATION reply. */ +#pragma pack(1) +typedef struct ReplyInquirePCIHostAdapterInformation +{ + uint8_t IsaIOPort; + uint8_t IRQ; + unsigned char LowByteTerminated:1; + unsigned char HighByteTerminated:1; + unsigned char uReserved:2; /* Reserved. */ + unsigned char JP1:1; /* Whatever that means. */ + unsigned char JP2:1; /* Whatever that means. */ + unsigned char JP3:1; /* Whatever that means. */ + /** Whether the provided info is valid. */ + unsigned char InformationIsValid: 1; + uint8_t uReserved2; /* Reserved. */ +} ReplyInquirePCIHostAdapterInformation, *PReplyInquirePCIHostAdapterInformation; +AssertCompileSize(ReplyInquirePCIHostAdapterInformation, 4); +#pragma pack() + +/* Structure for the INQUIRE_CONFIGURATION reply. */ +#pragma pack(1) +typedef struct ReplyInquireConfiguration +{ + unsigned char uReserved1: 5; + bool fDmaChannel5: 1; + bool fDmaChannel6: 1; + bool fDmaChannel7: 1; + bool fIrqChannel9: 1; + bool fIrqChannel10: 1; + bool fIrqChannel11: 1; + bool fIrqChannel12: 1; + unsigned char uReserved2: 1; + bool fIrqChannel14: 1; + bool fIrqChannel15: 1; + unsigned char uReserved3: 1; + unsigned char uHostAdapterId: 4; + unsigned char uReserved4: 4; +} ReplyInquireConfiguration, *PReplyInquireConfiguration; +AssertCompileSize(ReplyInquireConfiguration, 3); +#pragma pack() + +/* Structure for the INQUIRE_SETUP_INFORMATION reply. */ +#pragma pack(1) +typedef struct ReplyInquireSetupInformationSynchronousValue +{ + unsigned char uOffset: 4; + unsigned char uTransferPeriod: 3; + bool fSynchronous: 1; +}ReplyInquireSetupInformationSynchronousValue, *PReplyInquireSetupInformationSynchronousValue; +AssertCompileSize(ReplyInquireSetupInformationSynchronousValue, 1); +#pragma pack() + +#pragma pack(1) +typedef struct ReplyInquireSetupInformation +{ + bool fSynchronousInitiationEnabled: 1; + bool fParityCheckingEnabled: 1; + unsigned char uReserved1: 6; + uint8_t uBusTransferRate; + uint8_t uPreemptTimeOnBus; + uint8_t uTimeOffBus; + uint8_t cMailbox; + uint8_t MailboxAddress[3]; + ReplyInquireSetupInformationSynchronousValue SynchronousValuesId0To7[8]; + uint8_t uDisconnectPermittedId0To7; + uint8_t uSignature; + uint8_t uCharacterD; + uint8_t uHostBusType; + uint8_t uWideTransferPermittedId0To7; + uint8_t uWideTransfersActiveId0To7; + ReplyInquireSetupInformationSynchronousValue SynchronousValuesId8To15[8]; + uint8_t uDisconnectPermittedId8To15; + uint8_t uReserved2; + uint8_t uWideTransferPermittedId8To15; + uint8_t uWideTransfersActiveId8To15; +} ReplyInquireSetupInformation, *PReplyInquireSetupInformation; +AssertCompileSize(ReplyInquireSetupInformation, 34); +#pragma pack() + +/* Structure for the INQUIRE_EXTENDED_SETUP_INFORMATION. */ +#pragma pack(1) +typedef struct ReplyInquireExtendedSetupInformation +{ + uint8_t uBusType; + uint8_t uBiosAddress; + uint16_t u16ScatterGatherLimit; + uint8_t cMailbox; + uint32_t uMailboxAddressBase; + unsigned char uReserved1: 2; + bool fFastEISA: 1; + unsigned char uReserved2: 3; + bool fLevelSensitiveInterrupt: 1; + unsigned char uReserved3: 1; + unsigned char aFirmwareRevision[3]; + bool fHostWideSCSI: 1; + bool fHostDifferentialSCSI: 1; + bool fHostSupportsSCAM: 1; + bool fHostUltraSCSI: 1; + bool fHostSmartTermination: 1; + unsigned char uReserved4: 3; +} ReplyInquireExtendedSetupInformation, *PReplyInquireExtendedSetupInformation; +AssertCompileSize(ReplyInquireExtendedSetupInformation, 14); +#pragma pack() + +/* Structure for the INITIALIZE EXTENDED MAILBOX request. */ +#pragma pack(1) +typedef struct RequestInitializeExtendedMailbox +{ + /** Number of mailboxes in guest memory. */ + uint8_t cMailbox; + /** Physical address of the first mailbox. */ + uint32_t uMailboxBaseAddress; +} RequestInitializeExtendedMailbox, *PRequestInitializeExtendedMailbox; +AssertCompileSize(RequestInitializeExtendedMailbox, 5); +#pragma pack() + +/* + * Structure of a mailbox in guest memory. + * The incoming and outgoing mailbox have the same size + * but the incoming one has some more fields defined which + * are marked as reserved in the outgoing one. + * The last field is also different from the type. + * For outgoing mailboxes it is the action and + * for incoming ones the completion status code for the task. + * We use one structure for both types. + */ +#pragma pack(1) +typedef struct Mailbox +{ + /** Physical adress of the CCB structure in the guest memory. */ + uint32_t u32PhysAddrCCB; + /** Type specific data. */ + union + { + /** For outgoing mailboxes. */ + struct + { + /** Reserved */ + uint8_t uReserved[3]; + /** Action code. */ + uint8_t uActionCode; + } out; + /** For incoming mailboxes. */ + struct + { + /** The host adapter status after finishing the request. */ + uint8_t uHostAdapterStatus; + /** The status of the device which executed the request after executing it. */ + uint8_t uTargetDeviceStatus; + /** Reserved. */ + uint8_t uReserved; + /** The completion status code of the request. */ + uint8_t uCompletionCode; + } in; + } u; +} Mailbox, *PMailbox; +AssertCompileSize(Mailbox, 8); +#pragma pack() + +/* + * Action codes for outgoing mailboxes. + */ +enum BUSLOGIC_MAILBOX_OUTGOING_ACTION +{ + BUSLOGIC_MAILBOX_OUTGOING_ACTION_FREE = 0x00, + BUSLOGIC_MAILBOX_OUTGOING_ACTION_START_COMMAND = 0x01, + BUSLOGIC_MAILBOX_OUTGOING_ACTION_ABORT_COMMAND = 0x02 +}; + +/* + * Completion codes for incoming mailboxes. + */ +enum BUSLOGIC_MAILBOX_INCOMING_COMPLETION +{ + BUSLOGIC_MAILBOX_INCOMING_COMPLETION_FREE = 0x00, + BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITHOUT_ERROR = 0x01, + BUSLOGIC_MAILBOX_INCOMING_COMPLETION_ABORTED = 0x02, + BUSLOGIC_MAILBOX_INCOMING_COMPLETION_ABORTED_NOT_FOUND = 0x03, + BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITH_ERROR = 0x04, + BUSLOGIC_MAILBOX_INCOMING_COMPLETION_INVALID_CCB = 0x05 +}; + +/* + * Host adapter status for incoming mailboxes. + */ +enum BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS +{ + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_CMD_COMPLETED = 0x00, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_LINKED_CMD_COMPLETED = 0x0a, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_LINKED_CMD_COMPLETED_WITH_FLAG = 0x0b, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_DATA_UNDERUN = 0x0c, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_SCSI_SELECTION_TIMEOUT = 0x11, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_DATA_OVERRUN = 0x12, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_UNEXPECTED_BUS_FREE = 0x13, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_INVALID_BUS_PHASE_REQUESTED = 0x14, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_INVALID_OUTGOING_MAILBOX_ACTION_CODE = 0x15, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_INVALID_COMMAND_OPERATION_CODE = 0x16, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_LINKED_CCB_HAS_INVALID_LUN = 0x17, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_INVALID_COMMAND_PARAMETER = 0x1a, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_AUTO_REQUEST_SENSE_FAILED = 0x1b, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_TAGGED_QUEUING_MESSAGE_REJECTED = 0x1c, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_UNSUPPORTED_MESSAGE_RECEIVED = 0x1d, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_HARDWARE_FAILED = 0x20, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_TARGET_FAILED_RESPONSE_TO_ATN = 0x21, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_ASSERTED_RST = 0x22, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_OTHER_DEVICE_ASSERTED_RST = 0x23, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_TARGET_DEVICE_RECONNECTED_IMPROPERLY = 0x24, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_ASSERTED_BUS_DEVICE_RESET = 0x25, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_ABORT_QUEUE_GENERATED = 0x26, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_SOFTWARE_ERROR = 0x27, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_HOST_ADAPTER_HARDWARE_TIMEOUT_ERROR = 0x30, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_SCSI_PARITY_ERROR_DETECTED = 0x34 +}; + +/* + * Device status codes for incoming mailboxes. + */ +enum BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS +{ + BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_OPERATION_GOOD = 0x00, + BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_CHECK_CONDITION = 0x02, + BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_DEVICE_BUSY = 0x08 +}; + +/* + * Opcode types for CCB. + */ +enum BUSLOGIC_CCB_OPCODE +{ + BUSLOGIC_CCB_OPCODE_INITIATOR_CCB = 0x00, + BUSLOGIC_CCB_OPCODE_TARGET_CCB = 0x01, + BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_SCATTER_GATHER = 0x02, + BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_RESIDUAL_DATA_LENGTH = 0x03, + BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_RESIDUAL_SCATTER_GATHER = 0x04, + BUSLOGIC_CCB_OPCODE_BUS_DEVICE_RESET = 0x81 +}; + +/* + * Data transfer direction. + */ +enum BUSLOGIC_CCB_DIRECTION +{ + BUSLOGIC_CCB_DIRECTION_UNKNOWN = 0x00, + BUSLOGIC_CCB_DIRECTION_IN = 0x01, + BUSLOGIC_CCB_DIRECTION_OUT = 0x02, + BUSLOGIC_CCB_DIRECTION_NO_DATA = 0x03 +}; + +/* + * The command control block for a SCSI request. + */ +#pragma pack(1) +typedef struct CommandControlBlock +{ + /** Opcode. */ + uint8_t uOpcode; + /** Reserved */ + unsigned char uReserved1: 3; + /** Data direction for the request. */ + unsigned char uDataDirection: 2; + /** Whether the request is tag queued. */ + bool fTagQueued: 1; + /** Queue tag mode. */ + unsigned char uQueueTag: 2; + /** Length of the SCSI CDB. */ + uint8_t cbCDB; + /** Sense data length. */ + uint8_t cbSenseData; + /** Data length. */ + uint32_t cbData; + /** Data pointer. + * This points to the data region or a scatter gather list based on the opcode. + */ + uint32_t u32PhysAddrData; + /** Reserved. */ + uint8_t uReserved2[2]; + /** Host adapter status. */ + uint8_t uHostAdapterStatus; + /** Device adapter status. */ + uint8_t uDeviceStatus; + /** The device the request is send to. */ + uint8_t uTargetId; + /**The LUN in the device. */ + unsigned char uLogicalUnit: 5; + /** Legacy tag. */ + bool fLegacyTagEnable: 1; + /** Legacy queue tag. */ + unsigned char uLegacyQueueTag: 2; + /** The SCSI CDB. */ + uint8_t aCDB[12]; /* A CDB can be 12 bytes long. */ + /** Reserved. */ + uint8_t uReserved3[6]; + /** Sense data pointer. */ + uint32_t u32PhysAddrSenseData; +} CommandControlBlock, *PCommandControlBlock; +AssertCompileSize(CommandControlBlock, 40); +#pragma pack() + +#pragma pack(1) +typedef struct ScatterGatherEntry +{ + uint32_t cbSegment; + uint32_t u32PhysAddrSegmentBase; +} ScatterGatherEntry, *PScatterGatherEntry; +AssertCompileSize(ScatterGatherEntry, 8); +#pragma pack() + +/* + * Task state for a CCB request. + */ +typedef struct BUSLOGICTASKSTATE +{ + /** Device this task is assigned to. */ + R3PTRTYPE(PBUSLOGICDEVICE) pTargetDeviceR3; + /** The command control block from the guest. */ + CommandControlBlock CommandControlBlockGuest; + /** Mailbox read from guest memory. */ + Mailbox MailboxGuest; + /** The SCSI request we pass to the underlying SCSI engine. */ + PDMSCSIREQUEST PDMScsiRequest; + /** Number of bytes in all scatter gather entries. */ + uint32_t cbScatterGather; + /** Number of entries in the scatter gather list. */ + uint32_t cScatterGather; + /** Page map lock array. */ + PPGMPAGEMAPLOCK paPageLock; + /** Pointer to the scatter gather array. */ + PPDMDATASEG paScatterGather; + /** Pointer to the page map lock for the sense buffer. */ + PGMPAGEMAPLOCK pPageLockSense; + /** Pointer to the R3 sense buffer. */ + uint8_t *pu8SenseBuffer; + /** Flag whether this is a request from the BIOS. */ + bool fBIOS; +} BUSLOGICTASKSTATE, *PBUSLOGICTASKSTATE; + +#ifndef VBOX_DEVICE_STRUCT_TESTCASE + +RT_C_DECLS_BEGIN +PDMBOTHCBDECL(int) buslogicIOPortWrite (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t u32, unsigned cb); +PDMBOTHCBDECL(int) buslogicIOPortRead (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t *pu32, unsigned cb); +PDMBOTHCBDECL(int) buslogicMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb); +PDMBOTHCBDECL(int) buslogicMMIORead(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb); +RT_C_DECLS_END + +#define PDMIBASE_2_PBUSLOGICDEVICE(pInterface) ( (PBUSLOGICDEVICE)((uintptr_t)(pInterface) - RT_OFFSETOF(BUSLOGICDEVICE, IBase)) ) +#define PDMISCSIPORT_2_PBUSLOGICDEVICE(pInterface) ( (PBUSLOGICDEVICE)((uintptr_t)(pInterface) - RT_OFFSETOF(BUSLOGICDEVICE, ISCSIPort)) ) +#define PDMILEDPORTS_2_PBUSLOGICDEVICE(pInterface) ( (PBUSLOGICDEVICE)((uintptr_t)(pInterface) - RT_OFFSETOF(BUSLOGICDEVICE, ILed)) ) +#define PDMIBASE_2_PBUSLOGIC(pInterface) ( (PBUSLOGIC)((uintptr_t)(pInterface) - RT_OFFSETOF(BUSLOGIC, IBase)) ) +#define PDMILEDPORTS_2_PBUSLOGIC(pInterface) ( (PBUSLOGIC)((uintptr_t)(pInterface) - RT_OFFSETOF(BUSLOGIC, ILeds)) ) + +/** + * Deasserts the interrupt line of the BusLogic adapter. + * + * @returns nothing + * @param pBuslogic Pointer to the BusLogic device instance. + */ +static void buslogicClearInterrupt(PBUSLOGIC pBusLogic) +{ + LogFlowFunc(("pBusLogic=%#p\n", pBusLogic)); + pBusLogic->regInterrupt = 0; + PDMDevHlpPCISetIrqNoWait(pBusLogic->CTX_SUFF(pDevIns), 0, 0); +} + +/** + * Assert IRQ line of the BusLogic adapter. + * + * @returns nothing. + * @param pBusLogic Pointer to the BusLogic device instance. + */ +static void buslogicSetInterrupt(PBUSLOGIC pBusLogic) +{ + LogFlowFunc(("pBusLogic=%#p\n", pBusLogic)); + pBusLogic->regInterrupt |= BUSLOGIC_REGISTER_INTERRUPT_INTERRUPT_VALID; + PDMDevHlpPCISetIrqNoWait(pBusLogic->CTX_SUFF(pDevIns), 0, 1); +} + +#if defined(IN_RING3) +/** + * Initialize local RAM of host adapter with default values. + * + * @returns nothing. + * @param pBusLogic. + */ +static void buslogicInitializeLocalRam(PBUSLOGIC pBusLogic) +{ + /* + * These values are mostly from what I think is right + * looking at the dmesg output from a Linux guest inside + * a VMware server VM. + * + * So they don't have to be right :) + */ + memset(pBusLogic->LocalRam.u8View, 0, sizeof(HostAdapterLocalRam)); + pBusLogic->LocalRam.structured.autoSCSIData.fLevelSensitiveInterrupt = true; + pBusLogic->LocalRam.structured.autoSCSIData.fParityCheckingEnabled = true; + pBusLogic->LocalRam.structured.autoSCSIData.fExtendedTranslation = true; /* Same as in geometry register. */ + pBusLogic->LocalRam.structured.autoSCSIData.u16DeviceEnabledMask = ~0; /* All enabled. Maybe mask out non present devices? */ + pBusLogic->LocalRam.structured.autoSCSIData.u16WidePermittedMask = ~0; + pBusLogic->LocalRam.structured.autoSCSIData.u16FastPermittedMask = ~0; + pBusLogic->LocalRam.structured.autoSCSIData.u16SynchronousPermittedMask = ~0; + pBusLogic->LocalRam.structured.autoSCSIData.u16DisconnectPermittedMask = ~0; + pBusLogic->LocalRam.structured.autoSCSIData.fStrictRoundRobinMode = pBusLogic->fStrictRoundRobinMode; + pBusLogic->LocalRam.structured.autoSCSIData.u16UltraPermittedMask = ~0; + /* @todo calculate checksum? */ +} + +/** + * Do a hardware reset of the buslogic adapter. + * + * @returns VBox status code. + * @param pBusLogic Pointer to the BusLogic device instance. + */ +static int buslogicHwReset(PBUSLOGIC pBusLogic) +{ + LogFlowFunc(("pBusLogic=%#p\n", pBusLogic)); + + /* Reset registers to default value. */ + pBusLogic->regStatus = BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY; + pBusLogic->regInterrupt = 0; + pBusLogic->regGeometry = BUSLOGIC_REGISTER_GEOMETRY_EXTENTED_TRANSLATION_ENABLED; + pBusLogic->uOperationCode = 0xff; /* No command executing. */ + pBusLogic->iParameter = 0; + pBusLogic->cbCommandParametersLeft = 0; + pBusLogic->fIRQEnabled = true; + pBusLogic->fISAEnabled = true; + pBusLogic->uMailboxOutgoingPositionCurrent = 0; + pBusLogic->uMailboxIncomingPositionCurrent = 0; + + buslogicInitializeLocalRam(pBusLogic); + vboxscsiInitialize(&pBusLogic->VBoxSCSI); + + return VINF_SUCCESS; +} +#endif + +/** + * Resets the command state machine for the next command and notifies the guest. + * + * @returns nothing. + * @param pBusLogic Pointer to the BusLogic device instance + */ +static void buslogicCommandComplete(PBUSLOGIC pBusLogic) +{ + LogFlowFunc(("pBusLogic=%#p\n", pBusLogic)); + + pBusLogic->fUseLocalRam = false; + pBusLogic->regStatus |= BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY; + pBusLogic->iReply = 0; + + /* Modify I/O address does not generate an interrupt. */ + if ( (pBusLogic->uOperationCode != BUSLOGICCOMMAND_MODIFY_IO_ADDRESS) + && (pBusLogic->uOperationCode != BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND)) + { + /* Notify that the command is complete. */ + pBusLogic->regStatus &= ~BUSLOGIC_REGISTER_STATUS_DATA_IN_REGISTER_READY; + pBusLogic->regInterrupt |= BUSLOGIC_REGISTER_INTERRUPT_COMMAND_COMPLETE; + + if (pBusLogic->fIRQEnabled) + buslogicSetInterrupt(pBusLogic); + } + + pBusLogic->uOperationCode = 0xff; + pBusLogic->iParameter = 0; +} + +#if defined(IN_RING3) +/** + * Initiates a hard reset which was issued from the guest. + * + * @returns nothing + * @param pBusLogic Pointer to the BusLogic device instance. + */ +static void buslogicIntiateHardReset(PBUSLOGIC pBusLogic) +{ + LogFlowFunc(("pBusLogic=%#p\n", pBusLogic)); + + buslogicHwReset(pBusLogic); + + /* We set the diagnostic active in the status register. */ + pBusLogic->regStatus |= BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_ACTIVE; +} + +/** + * Send a mailbox with set status codes to the guest. + * + * @returns nothing. + * @param pBusLogicR Pointer to the BubsLogic device instance. + * @param pTaskState Pointer to the task state with the mailbox to send. + * @param uHostAdapterStatus The host adapter status code to set. + * @param uDeviceStatus The target device status to set. + * @param uMailboxCompletionCode Completion status code to set in the mailbox. + */ +static void buslogicSendIncomingMailbox(PBUSLOGIC pBusLogic, PBUSLOGICTASKSTATE pTaskState, + uint8_t uHostAdapterStatus, uint8_t uDeviceStatus, + uint8_t uMailboxCompletionCode) +{ + pTaskState->MailboxGuest.u.in.uHostAdapterStatus = uHostAdapterStatus; + pTaskState->MailboxGuest.u.in.uTargetDeviceStatus = uDeviceStatus; + pTaskState->MailboxGuest.u.in.uCompletionCode = uMailboxCompletionCode; + + RTGCPHYS GCPhysAddrMailboxIncoming = pBusLogic->GCPhysAddrMailboxIncomingBase + (pBusLogic->uMailboxIncomingPositionCurrent * sizeof(Mailbox)); + RTGCPHYS GCPhysAddrCCB = (RTGCPHYS)pTaskState->MailboxGuest.u32PhysAddrCCB; + + /* Update CCB. */ + pTaskState->CommandControlBlockGuest.uHostAdapterStatus = uHostAdapterStatus; + pTaskState->CommandControlBlockGuest.uDeviceStatus = uDeviceStatus; + PDMDevHlpPhysWrite(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrCCB, &pTaskState->CommandControlBlockGuest, sizeof(CommandControlBlock)); + + /* Update mailbox. */ + PDMDevHlpPhysWrite(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrMailboxIncoming, &pTaskState->MailboxGuest, sizeof(Mailbox)); + + /* Advance to next mailbox position. */ + pBusLogic->uMailboxIncomingPositionCurrent++; + if (pBusLogic->uMailboxIncomingPositionCurrent >= pBusLogic->cMailbox) + pBusLogic->uMailboxIncomingPositionCurrent = 0; + + pBusLogic->regInterrupt |= BUSLOGIC_REGISTER_INTERRUPT_INCOMING_MAILBOX_LOADED; + if (pBusLogic->fIRQEnabled) + buslogicSetInterrupt(pBusLogic); +} + +#if defined(DEBUG) +/** + * Dumps the content of a mailbox for debugging purposes. + * + * @return nothing + * @param pMailbox The mialbox to dump. + * @param fOutgoing true if dumping the outgoing state. + * false if dumping the incoming state. + */ +static void buslogicDumpMailboxInfo(PMailbox pMailbox, bool fOutgoing) +{ + Log(("%s: Dump for %s mailbox:\n", __FUNCTION__, fOutgoing ? "outgoing" : "incoming")); + Log(("%s: u32PhysAddrCCB=%#x\n", __FUNCTION__, pMailbox->u32PhysAddrCCB)); + if (fOutgoing) + { + Log(("%s: uActionCode=%u\n", __FUNCTION__, pMailbox->u.out.uActionCode)); + } + else + { + Log(("%s: uHostAdapterStatus=%u\n", __FUNCTION__, pMailbox->u.in.uHostAdapterStatus)); + Log(("%s: uTargetDeviceStatus=%u\n", __FUNCTION__, pMailbox->u.in.uTargetDeviceStatus)); + Log(("%s: uCompletionCode=%u\n", __FUNCTION__, pMailbox->u.in.uCompletionCode)); + } +} + +/** + * Dumps the content of a command control block for debugging purposes. + * + * @returns nothing. + * @param pCCB Pointer to the command control block to dump. + */ +static void buslogicDumpCCBInfo(PCommandControlBlock pCCB) +{ + Log(("%s: Dump for Command Control Block:\n", __FUNCTION__)); + Log(("%s: uOpCode=%#x\n", __FUNCTION__, pCCB->uOpcode)); + Log(("%s: uDataDirection=%u\n", __FUNCTION__, pCCB->uDataDirection)); + Log(("%s: fTagQueued=%d\n", __FUNCTION__, pCCB->fTagQueued)); + Log(("%s: uQueueTag=%u\n", __FUNCTION__, pCCB->uQueueTag)); + Log(("%s: cbCDB=%u\n", __FUNCTION__, pCCB->cbCDB)); + Log(("%s: cbSenseData=%u\n", __FUNCTION__, pCCB->cbSenseData)); + Log(("%s: cbData=%u\n", __FUNCTION__, pCCB->cbData)); + Log(("%s: u32PhysAddrData=%#x\n", __FUNCTION__, pCCB->u32PhysAddrData)); + Log(("%s: uHostAdapterStatus=%u\n", __FUNCTION__, pCCB->uHostAdapterStatus)); + Log(("%s: uDeviceStatus=%u\n", __FUNCTION__, pCCB->uDeviceStatus)); + Log(("%s: uTargetId=%u\n", __FUNCTION__, pCCB->uTargetId)); + Log(("%s: uLogicalUnit=%u\n", __FUNCTION__, pCCB->uLogicalUnit)); + Log(("%s: fLegacyTagEnable=%u\n", __FUNCTION__, pCCB->fLegacyTagEnable)); + Log(("%s: uLegacyQueueTag=%u\n", __FUNCTION__, pCCB->uLegacyQueueTag)); + Log(("%s: uCDB[0]=%#x\n", __FUNCTION__, pCCB->aCDB[0])); + for (int i = 1; i < pCCB->cbCDB; i++) + Log(("%s: uCDB[%d]=%u\n", __FUNCTION__, i, pCCB->aCDB[i])); + Log(("%s: u32PhysAddrSenseData=%#x\n", __FUNCTION__, pCCB->u32PhysAddrSenseData)); +} +#endif + +/** + * Maps the data buffer into R3. + * + * @returns VBox status code. + * @param pTaskState Pointer to the task state. + * @param fReadonly Flag whether the mappings should be readonly. + */ +static int buslogicMapGCDataBufIntoR3(PBUSLOGICTASKSTATE pTaskState, bool fReadonly) +{ + int rc = VINF_SUCCESS; + uint32_t cScatterGatherEntriesR3 = 0; + PPDMDEVINS pDevIns = pTaskState->CTX_SUFF(pTargetDevice)->CTX_SUFF(pBusLogic)->CTX_SUFF(pDevIns); + + /* + * @todo: Check following assumption and what residual means. + * + * The BusLogic adapter can handle two different data buffer formats. + * The first one is that the data pointer entry in the CCB points to + * the buffer directly. In second mode the data pointer points to a + * scatter gather list which describes the buffer. + */ + if ( (pTaskState->CommandControlBlockGuest.uOpcode == BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_SCATTER_GATHER) + || (pTaskState->CommandControlBlockGuest.uOpcode == BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_RESIDUAL_SCATTER_GATHER)) + { + uint32_t cScatterGatherGCRead; + uint32_t iScatterGatherEntry; + ScatterGatherEntry aScatterGatherReadGC[32]; /* Number of scatter gather list entries read from guest memory. */ + uint32_t cScatterGatherGCLeft = pTaskState->CommandControlBlockGuest.cbData / sizeof(ScatterGatherEntry); + RTGCPHYS GCPhysAddrScatterGatherCurrent = (RTGCPHYS)pTaskState->CommandControlBlockGuest.u32PhysAddrData; + + /* First pass - count needed R3 scatter gather list entries. */ + do + { + cScatterGatherGCRead = (cScatterGatherGCLeft < RT_ELEMENTS(aScatterGatherReadGC)) + ? cScatterGatherGCLeft + : RT_ELEMENTS(aScatterGatherReadGC); + cScatterGatherGCLeft -= cScatterGatherGCRead; + + /* Read the SG entries. */ + PDMDevHlpPhysRead(pDevIns, GCPhysAddrScatterGatherCurrent, &aScatterGatherReadGC[0], + cScatterGatherGCRead * sizeof(ScatterGatherEntry)); + + for (iScatterGatherEntry = 0; iScatterGatherEntry < cScatterGatherGCRead; iScatterGatherEntry++) + { + RTGCPHYS GCPhysAddrDataBase; + size_t cbDataToTransfer; + + Log(("%s: iScatterGatherEntry=%u\n", __FUNCTION__, iScatterGatherEntry)); + + GCPhysAddrDataBase = (RTGCPHYS)aScatterGatherReadGC[iScatterGatherEntry].u32PhysAddrSegmentBase; + cbDataToTransfer = aScatterGatherReadGC[iScatterGatherEntry].cbSegment; + + Log(("%s: GCPhysAddrDataBase=%RGp cbDataToTransfer=%u\n", __FUNCTION__, GCPhysAddrDataBase, cbDataToTransfer)); + + /* + * Check if the physical address is page aligned. + */ + if (GCPhysAddrDataBase & PAGE_OFFSET_MASK) + { + RTGCPHYS GCPhysAddrDataNextPage = PAGE_ADDRESS(GCPhysAddrDataBase) + PAGE_SIZE; + uint32_t u32GCPhysAddrDiff = GCPhysAddrDataNextPage - GCPhysAddrDataBase; + + Log(("%s: Align page: GCPhysAddrDataBase=%RGp GCPhysAddrDataNextPage=%RGp\n", + __FUNCTION__, GCPhysAddrDataBase, GCPhysAddrDataNextPage)); + + cScatterGatherEntriesR3++; + /* Subtract size of the buffer in the actual page. */ + if (cbDataToTransfer < u32GCPhysAddrDiff) + cbDataToTransfer = 0; + else + cbDataToTransfer -= u32GCPhysAddrDiff; + } + + /* The address is now page aligned. */ + while (cbDataToTransfer) + { + Log(("%s: GCPhysAddrDataBase=%RGp cbDataToTransfer=%u cScatterGatherEntriesR3=%u\n", + __FUNCTION__, GCPhysAddrDataBase, cbDataToTransfer, cScatterGatherEntriesR3)); + + cScatterGatherEntriesR3++; + + /* Check if this is the last page the buffer is in. */ + if (cbDataToTransfer < PAGE_SIZE) + cbDataToTransfer = 0; + else + cbDataToTransfer -= PAGE_SIZE; + } + } + + /* Set address to the next entries to read. */ + GCPhysAddrScatterGatherCurrent += cScatterGatherGCRead * sizeof(ScatterGatherEntry); + } while (cScatterGatherGCLeft); + + Log(("%s: cScatterGatherEntriesR3=%u\n", __FUNCTION__, cScatterGatherEntriesR3)); + + /* + * Allocate page map lock and scatter gather array. + * @todo: Optimize with caching. + */ + AssertMsg(!pTaskState->paPageLock && !pTaskState->paScatterGather, ("paPageLock or/and paScatterGather are not NULL\n")); + pTaskState->cScatterGather = cScatterGatherEntriesR3; + pTaskState->cbScatterGather = 0; + pTaskState->paPageLock = (PPGMPAGEMAPLOCK)RTMemAllocZ(cScatterGatherEntriesR3 * sizeof(PGMPAGEMAPLOCK)); + AssertMsgReturn(pTaskState->paPageLock, ("Allocating page lock array failed\n"), VERR_NO_MEMORY); + pTaskState->paScatterGather = (PPDMDATASEG)RTMemAllocZ(cScatterGatherEntriesR3 * sizeof(PDMDATASEG)); + AssertMsgReturn(pTaskState->paScatterGather, ("Allocating page lock array failed\n"), VERR_NO_MEMORY); + + /* Second pass - map the elements into R3. **/ + cScatterGatherGCLeft = pTaskState->CommandControlBlockGuest.cbData / sizeof(ScatterGatherEntry); + GCPhysAddrScatterGatherCurrent = (RTGCPHYS)pTaskState->CommandControlBlockGuest.u32PhysAddrData; + PPGMPAGEMAPLOCK pPageLockCurrent = pTaskState->paPageLock; + PPDMDATASEG pScatterGatherCurrent = pTaskState->paScatterGather; + + do + { + cScatterGatherGCRead = (cScatterGatherGCLeft < RT_ELEMENTS(aScatterGatherReadGC)) ? cScatterGatherGCLeft : RT_ELEMENTS(aScatterGatherReadGC); + cScatterGatherGCLeft -= cScatterGatherGCRead; + + /* Read the SG entries. */ + PDMDevHlpPhysRead(pDevIns, GCPhysAddrScatterGatherCurrent, &aScatterGatherReadGC[0], cScatterGatherGCRead * sizeof(ScatterGatherEntry)); + + for (iScatterGatherEntry = 0; iScatterGatherEntry < cScatterGatherGCRead; iScatterGatherEntry++) + { + RTGCPHYS GCPhysAddrDataBase; + uint32_t cbDataToTransfer; + + GCPhysAddrDataBase = (RTGCPHYS)aScatterGatherReadGC[iScatterGatherEntry].u32PhysAddrSegmentBase; + cbDataToTransfer = aScatterGatherReadGC[iScatterGatherEntry].cbSegment; + pTaskState->cbScatterGather += cbDataToTransfer; + + /* + * Check if the physical address is page aligned. + */ + if (GCPhysAddrDataBase & PAGE_OFFSET_MASK) + { + RTGCPHYS GCPhysAddrDataNextPage = PAGE_ADDRESS(GCPhysAddrDataBase) + PAGE_SIZE; + uint32_t u32GCPhysAddrDiff = GCPhysAddrDataNextPage - GCPhysAddrDataBase; /* Difference from the buffer start to the next page boundary. */ + + /* Check if the mapping ends at the page boundary and set segment size accordingly. */ + pScatterGatherCurrent->cbSeg = (cbDataToTransfer < u32GCPhysAddrDiff) ? cbDataToTransfer : u32GCPhysAddrDiff; + + /* Create the mapping. */ + if (fReadonly) + rc = PDMDevHlpPhysGCPhys2CCPtrReadOnly(pDevIns, PAGE_ADDRESS(GCPhysAddrDataBase), 0, (const void **)&pScatterGatherCurrent->pvSeg, pPageLockCurrent); /** @todo r=bird: PAGE_ADDRESS is the wrong macro here as well... */ + else + rc = PDMDevHlpPhysGCPhys2CCPtr(pDevIns, PAGE_ADDRESS(GCPhysAddrDataBase), 0, &pScatterGatherCurrent->pvSeg, pPageLockCurrent); + + if (RT_FAILURE(rc)) + AssertMsgFailed(("Creating mapping failed rc=%Rrc\n", rc)); + + /* Let pvBuf point to the start of the buffer in the page. */ + pScatterGatherCurrent->pvSeg = ((uint8_t *)pScatterGatherCurrent->pvSeg) + (GCPhysAddrDataBase - PAGE_ADDRESS(GCPhysAddrDataBase)); + + /* Subtract size of the buffer in the actual page. */ + cbDataToTransfer -= (uint32_t)pScatterGatherCurrent->cbSeg; + pPageLockCurrent++; + pScatterGatherCurrent++; + /* Let physical address point to the next page in the buffer. */ + GCPhysAddrDataBase = GCPhysAddrDataNextPage; + } + + /* The address is now page aligned. */ + while (cbDataToTransfer) + { + /* Check if this is the last page the buffer is in. */ + if (cbDataToTransfer < PAGE_SIZE) + { + pScatterGatherCurrent->cbSeg = cbDataToTransfer; + cbDataToTransfer = 0; + } + else + { + cbDataToTransfer -= PAGE_SIZE; + pScatterGatherCurrent->cbSeg = PAGE_SIZE; + } + + /* Create the mapping. */ + if (fReadonly) + rc = PDMDevHlpPhysGCPhys2CCPtrReadOnly(pDevIns, GCPhysAddrDataBase, 0, (const void **)&pScatterGatherCurrent->pvSeg, pPageLockCurrent); + else + rc = PDMDevHlpPhysGCPhys2CCPtr(pDevIns, GCPhysAddrDataBase, 0, &pScatterGatherCurrent->pvSeg, pPageLockCurrent); + + if (RT_FAILURE(rc)) + AssertMsgFailed(("Creating mapping failed rc=%Rrc\n", rc)); + + /* Go to the next page. */ + GCPhysAddrDataBase += PAGE_SIZE; + pPageLockCurrent++; + pScatterGatherCurrent++; + } + } + + /* Set address to the next entries to read. */ + GCPhysAddrScatterGatherCurrent += cScatterGatherGCRead * sizeof(ScatterGatherEntry); + + } while (cScatterGatherGCLeft); + + } + else if ( (pTaskState->CommandControlBlockGuest.u32PhysAddrData != 0) + && (pTaskState->CommandControlBlockGuest.cbData != 0)) + { + /* The buffer is not scattered. */ + RTGCPHYS GCPhysAddrDataBase = (RTGCPHYS)PAGE_ADDRESS(pTaskState->CommandControlBlockGuest.u32PhysAddrData); + RTGCPHYS GCPhysAddrDataEnd = (RTGCPHYS)(pTaskState->CommandControlBlockGuest.u32PhysAddrData + pTaskState->CommandControlBlockGuest.cbData); + RTGCPHYS GCPhysAddrDataEndBase = (RTGCPHYS)PAGE_ADDRESS(GCPhysAddrDataEnd); + RTGCPHYS GCPhysAddrDataNext = (RTGCPHYS)PAGE_ADDRESS(GCPhysAddrDataEnd) + PAGE_SIZE; + uint32_t cPages = (GCPhysAddrDataNext - GCPhysAddrDataBase) / PAGE_SIZE; + uint32_t cbOffsetFirstPage = pTaskState->CommandControlBlockGuest.u32PhysAddrData & PAGE_OFFSET_MASK; + + Log(("Non scattered buffer:\n")); + Log(("u32PhysAddrData=%#x\n", pTaskState->CommandControlBlockGuest.u32PhysAddrData)); + Log(("cbData=%u\n", pTaskState->CommandControlBlockGuest.cbData)); + Log(("GCPhysAddrDataBase=0x%RGp\n", GCPhysAddrDataBase)); + Log(("GCPhysAddrDataEnd=0x%RGp\n", GCPhysAddrDataEnd)); + Log(("GCPhysAddrDataEndBase=0x%RGp\n", GCPhysAddrDataEndBase)); + Log(("GCPhysAddrDataNext=0x%RGp\n", GCPhysAddrDataNext)); + Log(("cPages=%u\n", cPages)); + + pTaskState->paPageLock = (PPGMPAGEMAPLOCK)RTMemAllocZ(cPages * sizeof(PGMPAGEMAPLOCK)); + AssertMsgReturn(pTaskState->paPageLock, ("Allocating page lock array failed\n"), VERR_NO_MEMORY); + pTaskState->paScatterGather = (PPDMDATASEG)RTMemAllocZ(cPages * sizeof(PDMDATASEG)); + AssertMsgReturn(pTaskState->paScatterGather, ("Allocating scatter gather list failed\n"), VERR_NO_MEMORY); + + PPGMPAGEMAPLOCK pPageLockCurrent = pTaskState->paPageLock; + PPDMDATASEG pScatterGatherCurrent = pTaskState->paScatterGather; + + for (uint32_t i = 0; i < cPages; i++) + { + if (fReadonly) + rc = PDMDevHlpPhysGCPhys2CCPtrReadOnly(pDevIns, GCPhysAddrDataBase, 0, (const void **)&pScatterGatherCurrent->pvSeg, pPageLockCurrent); + else + rc = PDMDevHlpPhysGCPhys2CCPtr(pDevIns, GCPhysAddrDataBase, 0, &pScatterGatherCurrent->pvSeg, pPageLockCurrent); + + pScatterGatherCurrent->cbSeg = PAGE_SIZE; + + pPageLockCurrent++; + pScatterGatherCurrent++; + GCPhysAddrDataBase += PAGE_SIZE; + } + + /* Correct pointer of the first entry. */ + pTaskState->paScatterGather[0].pvSeg = (uint8_t *)pTaskState->paScatterGather[0].pvSeg + cbOffsetFirstPage; + pTaskState->paScatterGather[0].cbSeg -= cbOffsetFirstPage; + /* Correct size of the last entry. */ + pTaskState->paScatterGather[cPages-1].cbSeg = GCPhysAddrDataEnd - GCPhysAddrDataEndBase; + pTaskState->cScatterGather = cPages; + pTaskState->cbScatterGather = pTaskState->CommandControlBlockGuest.cbData; + } + + return rc; +} + +/** + * Free mapped pages and other allocated resources used for the scatter gather list. + * + * @returns nothing. + * @param pTaskState Pointer to the task state. + */ +static void buslogicFreeGCDataBuffer(PBUSLOGICTASKSTATE pTaskState) +{ + PPGMPAGEMAPLOCK pPageMapLock = pTaskState->paPageLock; + PPDMDEVINS pDevIns = pTaskState->CTX_SUFF(pTargetDevice)->CTX_SUFF(pBusLogic)->CTX_SUFF(pDevIns); + + for (uint32_t iPageLockCurrent = 0; iPageLockCurrent < pTaskState->cScatterGather; iPageLockCurrent++) + { + PDMDevHlpPhysReleasePageMappingLock(pDevIns, pPageMapLock); + pPageMapLock++; + } + + /* @todo: optimize with caching. */ + RTMemFree(pTaskState->paPageLock); + RTMemFree(pTaskState->paScatterGather); + pTaskState->paPageLock = NULL; + pTaskState->paScatterGather = NULL; + pTaskState->cScatterGather = 0; + pTaskState->cbScatterGather = 0; +} + +/** + * Free the sense buffer. + * + * @returns nothing. + * @param pTaskState Pointer to the task state. + */ +static void buslogicFreeGCSenseBuffer(PBUSLOGICTASKSTATE pTaskState) +{ + PPDMDEVINS pDevIns = pTaskState->CTX_SUFF(pTargetDevice)->CTX_SUFF(pBusLogic)->CTX_SUFF(pDevIns); + + PDMDevHlpPhysReleasePageMappingLock(pDevIns, &pTaskState->pPageLockSense); + pTaskState->pu8SenseBuffer = NULL; +} + +/** + * Map the sense buffer into R3. + * + * @returns VBox status code. + * @param pTaskState Pointer to the task state. + * @note Current assumption is that the sense buffer is not scattered and does not cross a page boundary. + */ +static int buslogicMapGCSenseBufferIntoR3(PBUSLOGICTASKSTATE pTaskState) +{ + int rc = VINF_SUCCESS; + PPDMDEVINS pDevIns = pTaskState->CTX_SUFF(pTargetDevice)->CTX_SUFF(pBusLogic)->CTX_SUFF(pDevIns); + RTGCPHYS GCPhysAddrSenseBuffer = (RTGCPHYS)pTaskState->CommandControlBlockGuest.u32PhysAddrSenseData; +#ifdef RT_STRICT + uint32_t cbSenseBuffer = pTaskState->CommandControlBlockGuest.cbSenseData; +#endif + RTGCPHYS GCPhysAddrSenseBufferBase = PAGE_ADDRESS(GCPhysAddrSenseBuffer); + + AssertMsg(GCPhysAddrSenseBuffer >= GCPhysAddrSenseBufferBase, + ("Impossible GCPhysAddrSenseBuffer < GCPhysAddrSenseBufferBase\n")); + + /* Sanity checks for the assumption. */ + AssertMsg(((GCPhysAddrSenseBuffer + cbSenseBuffer) < (GCPhysAddrSenseBufferBase + PAGE_SIZE)), + ("Sense buffer crosses page boundary\n")); + + rc = PDMDevHlpPhysGCPhys2CCPtr(pDevIns, GCPhysAddrSenseBufferBase, 0, (void **)&pTaskState->pu8SenseBuffer, &pTaskState->pPageLockSense); + AssertMsgRC(rc, ("Mapping sense buffer failed rc=%Rrc\n", rc)); + + /* Correct start address of the sense buffer. */ + pTaskState->pu8SenseBuffer += (GCPhysAddrSenseBuffer - GCPhysAddrSenseBufferBase); + + return rc; +} +#endif /* IN_RING3 */ + +/** + * Parses the command buffer and executes it. + * + * @returns VBox status code. + * @param pBusLogic Pointer to the BusLogic device instance. + */ +static int buslogicProcessCommand(PBUSLOGIC pBusLogic) +{ + int rc = VINF_SUCCESS; + + LogFlowFunc(("pBusLogic=%#p\n", pBusLogic)); + AssertMsg(pBusLogic->uOperationCode != 0xff, ("There is no command to execute\n")); + + switch (pBusLogic->uOperationCode) + { + case BUSLOGICCOMMAND_INQUIRE_PCI_HOST_ADAPTER_INFORMATION: + { + PReplyInquirePCIHostAdapterInformation pReply = (PReplyInquirePCIHostAdapterInformation)pBusLogic->aReplyBuffer; + memset(pReply, 0, sizeof(ReplyInquirePCIHostAdapterInformation)); + + /* It seems VMware does not provide valid information here too, lets do the same :) */ + pReply->InformationIsValid = 0; + pReply->IsaIOPort = 0xff; /* Make it invalid. */ + pBusLogic->cbReplyParametersLeft = sizeof(ReplyInquirePCIHostAdapterInformation); + break; + } + case BUSLOGICCOMMAND_MODIFY_IO_ADDRESS: + { + pBusLogic->cbReplyParametersLeft = 0; + if (pBusLogic->aCommandBuffer[0] == 0x06) + { + Log(("Disabling ISA I/O ports.\n")); + pBusLogic->fISAEnabled = false; + } + break; + } + case BUSLOGICCOMMAND_INQUIRE_BOARD_ID: + { + pBusLogic->aReplyBuffer[0] = '0'; /* @todo figure out what to write here. */ + pBusLogic->aReplyBuffer[1] = '0'; /* @todo figure out what to write here. */ + + /* We report version 5.07B. This reply will provide the first two digits. */ + pBusLogic->aReplyBuffer[2] = '5'; /* Major version 5 */ + pBusLogic->aReplyBuffer[3] = '0'; /* Minor version 0 */ + pBusLogic->cbReplyParametersLeft = 4; /* Reply is 4 bytes long */ + break; + } + case BUSLOGICCOMMAND_INQUIRE_FIRMWARE_VERSION_3RD_LETTER: + { + pBusLogic->aReplyBuffer[0] = '7'; + pBusLogic->cbReplyParametersLeft = 1; + break; + } + case BUSLOGICCOMMAND_INQUIRE_FIRMWARE_VERSION_LETTER: + { + pBusLogic->aReplyBuffer[0] = 'B'; + pBusLogic->cbReplyParametersLeft = 1; + break; + } + case BUSLOGICCOMMAND_INQUIRE_HOST_ADAPTER_MODEL_NUMBER: + { + /* The reply length is set by the guest and is found in the first byte of the command buffer. */ + pBusLogic->cbReplyParametersLeft = pBusLogic->aCommandBuffer[0]; + memset(pBusLogic->aReplyBuffer, 0, pBusLogic->cbReplyParametersLeft); + const char aModelName[] = "958"; + int cCharsToTransfer = (pBusLogic->cbReplyParametersLeft <= sizeof(aModelName)) + ? pBusLogic->cbReplyParametersLeft + : sizeof(aModelName); + + for (int i = 0; i < cCharsToTransfer; i++) + pBusLogic->aReplyBuffer[i] = aModelName[i]; + + break; + } + case BUSLOGICCOMMAND_INQUIRE_CONFIGURATION: + { + pBusLogic->cbReplyParametersLeft = sizeof(ReplyInquireConfiguration); + PReplyInquireConfiguration pReply = (PReplyInquireConfiguration)pBusLogic->aReplyBuffer; + memset(pReply, 0, sizeof(ReplyInquireConfiguration)); + + pReply->uHostAdapterId = 7; /* The controller has always 7 as ID. */ + /* + * The rest of this reply only applies for ISA adapters. + * This is a PCI adapter so they are not important and are skipped. + */ + break; + } + case BUSLOGICCOMMAND_INQUIRE_EXTENDED_SETUP_INFORMATION: + { + /* The reply length is set by the guest and is found in the first byte of the command buffer. */ + pBusLogic->cbReplyParametersLeft = pBusLogic->aCommandBuffer[0]; + PReplyInquireExtendedSetupInformation pReply = (PReplyInquireExtendedSetupInformation)pBusLogic->aReplyBuffer; + memset(pReply, 0, sizeof(ReplyInquireExtendedSetupInformation)); + + pReply->fHostWideSCSI = true; + pReply->fHostUltraSCSI = true; + pReply->u16ScatterGatherLimit = 8192; + + break; + } + case BUSLOGICCOMMAND_INQUIRE_SETUP_INFORMATION: + { + /* The reply length is set by the guest and is found in the first byte of the command buffer. */ + pBusLogic->cbReplyParametersLeft = pBusLogic->aCommandBuffer[0]; + PReplyInquireSetupInformation pReply = (PReplyInquireSetupInformation)pBusLogic->aReplyBuffer; + memset(pReply, 0, sizeof(ReplyInquireSetupInformation)); + break; + } + case BUSLOGICCOMMAND_FETCH_HOST_ADAPTER_LOCAL_RAM: + { + /* + * First element in the command buffer contains start offset to read from + * and second one the number of bytes to read. + */ + uint8_t uOffset = pBusLogic->aCommandBuffer[0]; + pBusLogic->cbReplyParametersLeft = pBusLogic->aCommandBuffer[1]; + + pBusLogic->fUseLocalRam = true; + pBusLogic->iReply = uOffset; + break; + } + case BUSLOGICCOMMAND_INITIALIZE_EXTENDED_MAILBOX: + { + PRequestInitializeExtendedMailbox pRequest = (PRequestInitializeExtendedMailbox)pBusLogic->aCommandBuffer; + + pBusLogic->cMailbox = pRequest->cMailbox; + pBusLogic->GCPhysAddrMailboxOutgoingBase = (RTGCPHYS)pRequest->uMailboxBaseAddress; + /* The area for incoming mailboxes is right after the last entry of outgoing mailboxes. */ + pBusLogic->GCPhysAddrMailboxIncomingBase = (RTGCPHYS)pRequest->uMailboxBaseAddress + (pBusLogic->cMailbox * sizeof(Mailbox)); + + Log(("GCPhysAddrMailboxOutgoingBase=%RGp\n", pBusLogic->GCPhysAddrMailboxOutgoingBase)); + Log(("GCPhysAddrMailboxOutgoingBase=%RGp\n", pBusLogic->GCPhysAddrMailboxIncomingBase)); + Log(("cMailboxes=%u\n", pBusLogic->cMailbox)); + + pBusLogic->cbReplyParametersLeft = 0; + break; + } + case BUSLOGICCOMMAND_ENABLE_STRICT_ROUND_ROBIN_MODE: + { + if (pBusLogic->aCommandBuffer[0] == 0) + pBusLogic->fStrictRoundRobinMode = false; + else if (pBusLogic->aCommandBuffer[0] == 1) + pBusLogic->fStrictRoundRobinMode = true; + else + AssertMsgFailed(("Invalid round robin mode %d\n", pBusLogic->aCommandBuffer[0])); + + pBusLogic->cbReplyParametersLeft = 0; + break; + } + case BUSLOGICCOMMAND_SET_CCB_FORMAT: + { + if (pBusLogic->aCommandBuffer[0] == 0) + pBusLogic->fExtendedLunCCBFormat = false; + else if (pBusLogic->aCommandBuffer[0] == 1) + pBusLogic->fExtendedLunCCBFormat = true; + else + AssertMsgFailed(("Invalid CCB format %d\n", pBusLogic->aCommandBuffer[0])); + + pBusLogic->cbReplyParametersLeft = 0; + break; + } + case BUSLOGICCOMMAND_INQUIRE_TARGET_DEVICES: + { + /* Each bit which is set in the 16bit wide variable means a present device. */ + uint16_t u16TargetsPresentMask = 0; + + for (uint8_t i = 0; i < RT_ELEMENTS(pBusLogic->aDeviceStates); i++) + { + if (pBusLogic->aDeviceStates[i].fPresent) + u16TargetsPresentMask |= (1 << i); + } + pBusLogic->aReplyBuffer[0] = (uint8_t)u16TargetsPresentMask; + pBusLogic->aReplyBuffer[1] = (uint8_t)(u16TargetsPresentMask >> 8); + pBusLogic->cbReplyParametersLeft = 2; + break; + } + case BUSLOGICCOMMAND_INQUIRE_SYNCHRONOUS_PERIOD: + { + pBusLogic->cbReplyParametersLeft = pBusLogic->aCommandBuffer[0]; + + for (uint8_t i = 0; i < pBusLogic->cbReplyParametersLeft; i++) + pBusLogic->aReplyBuffer[i] = 0; /* @todo Figure if we need something other here. It's not needed for the linux driver */ + + break; + } + case BUSLOGICCOMMAND_DISABLE_HOST_ADAPTER_INTERRUPT: + { + if (pBusLogic->aCommandBuffer[0] == 0) + pBusLogic->fIRQEnabled = false; + else + pBusLogic->fIRQEnabled = true; + break; + } + case BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND: /* Should be handled already. */ + default: + AssertMsgFailed(("Invalid command %#x\n", pBusLogic->uOperationCode)); + } + + Log(("cbReplyParametersLeft=%d\n", pBusLogic->cbReplyParametersLeft)); + + /* Set the data in ready bit in the status register in case the command has a reply. */ + if (pBusLogic->cbReplyParametersLeft) + pBusLogic->regStatus |= BUSLOGIC_REGISTER_STATUS_DATA_IN_REGISTER_READY; + else + buslogicCommandComplete(pBusLogic); + + return rc; +} + +/** + * Read a register from the BusLogic adapter. + * + * @returns VBox status code. + * @param pBusLogic Pointer to the BusLogic instance data. + * @param iRegister The index of the register to read. + * @param pu32 Where to store the register content. + */ +static int buslogicRegisterRead(PBUSLOGIC pBusLogic, unsigned iRegister, uint32_t *pu32) +{ + int rc = VINF_SUCCESS; + + switch (iRegister) + { + case BUSLOGIC_REGISTER_STATUS: + { + *pu32 = pBusLogic->regStatus; + /* + * If the diagnostic active bit is set we are in a hard reset initiated from the guest. + * The guest reads the status register and waits that the host adapter ready bit is set. + */ + if (pBusLogic->regStatus & BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_ACTIVE) + { + pBusLogic->regStatus &= ~BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_ACTIVE; + pBusLogic->regStatus |= BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY; + } + break; + } + case BUSLOGIC_REGISTER_DATAIN: + { + if (pBusLogic->fUseLocalRam) + *pu32 = pBusLogic->LocalRam.u8View[pBusLogic->iReply]; + else + *pu32 = pBusLogic->aReplyBuffer[pBusLogic->iReply]; + + pBusLogic->iReply++; + pBusLogic->cbReplyParametersLeft--; + + if (!pBusLogic->cbReplyParametersLeft) + { + /* + * Reply finished, set command complete bit, unset data in ready bit and + * interrupt the guest if enabled. + */ + buslogicCommandComplete(pBusLogic); + } + break; + } + case BUSLOGIC_REGISTER_INTERRUPT: + { + *pu32 = pBusLogic->regInterrupt; +#if 0 + if (pBusLogic->uOperationCode == BUSLOGICCOMMAND_DISABLE_HOST_ADAPTER_INTERRUPT) + rc = PDMDeviceDBGFStop(pBusLogic->CTX_SUFF(pDevIns), RT_SRC_POS, "Interrupt disable command\n"); +#endif + break; + } + case BUSLOGIC_REGISTER_GEOMETRY: + { + *pu32 = pBusLogic->regGeometry; + break; + } + default: + AssertMsgFailed(("Register not available\n")); + rc = VERR_IOM_IOPORT_UNUSED; + } + + Log2(("%s: pu32=%p:{%.*Rhxs} iRegister=%d rc=%Rrc\n", + __FUNCTION__, pu32, 1, pu32, iRegister, rc)); + + return rc; +} + +/** + * Write a value to a register. + * + * @returns VBox status code. + * @param pBusLogic Pointer to the BusLogic instance data. + * @param iRegister The index of the register to read. + * @param uVal The value to write. + */ +static int buslogicRegisterWrite(PBUSLOGIC pBusLogic, unsigned iRegister, uint8_t uVal) +{ + int rc = VINF_SUCCESS; + + switch (iRegister) + { + case BUSLOGIC_REGISTER_CONTROL: + { + if (uVal & BUSLOGIC_REGISTER_CONTROL_INTERRUPT_RESET) + buslogicClearInterrupt(pBusLogic); + + if ((uVal & BUSLOGIC_REGISTER_CONTROL_HARD_RESET) || (uVal & BUSLOGIC_REGISTER_CONTROL_SOFT_RESET)) + { +#ifdef IN_RING3 + buslogicIntiateHardReset(pBusLogic); +#else + rc = VINF_IOM_HC_IOPORT_WRITE; +#endif + } + + break; + } + case BUSLOGIC_REGISTER_COMMAND: + { + /* Fast path for mailbox execution command. */ + if ((uVal == BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND) && (pBusLogic->uOperationCode = 0xff)) + { + ASMAtomicIncU32(&pBusLogic->cMailboxesReady); + if (!ASMAtomicXchgBool(&pBusLogic->fNotificationSend, true)) + { + /* Send new notification to the queue. */ + PPDMQUEUEITEMCORE pItem = PDMQueueAlloc(pBusLogic->CTX_SUFF(pNotifierQueue)); + AssertMsg(pItem, ("Allocating item for queue failed\n")); + PDMQueueInsert(pBusLogic->CTX_SUFF(pNotifierQueue), (PPDMQUEUEITEMCORE)pItem); + } + + return rc; + } + + /* + * Check if we are already fetch command parameters from the guest. + * If not we initialize executing a new command. + */ + if (pBusLogic->uOperationCode == 0xff) + { + pBusLogic->uOperationCode = uVal; + pBusLogic->iParameter = 0; + + /* Mark host adapter as busy. */ + pBusLogic->regStatus &= ~BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY; + + /* Get the number of bytes for parameters from the command code. */ + switch (pBusLogic->uOperationCode) + { + case BUSLOGICCOMMAND_INQUIRE_FIRMWARE_VERSION_LETTER: + case BUSLOGICCOMMAND_INQUIRE_BOARD_ID: + case BUSLOGICCOMMAND_INQUIRE_FIRMWARE_VERSION_3RD_LETTER: + case BUSLOGICCOMMAND_INQUIRE_PCI_HOST_ADAPTER_INFORMATION: + case BUSLOGICCOMMAND_INQUIRE_CONFIGURATION: + case BUSLOGICCOMMAND_INQUIRE_TARGET_DEVICES: + pBusLogic->cbCommandParametersLeft = 0; + break; + case BUSLOGICCOMMAND_MODIFY_IO_ADDRESS: + case BUSLOGICCOMMAND_INQUIRE_EXTENDED_SETUP_INFORMATION: + case BUSLOGICCOMMAND_INQUIRE_SETUP_INFORMATION: + case BUSLOGICCOMMAND_INQUIRE_HOST_ADAPTER_MODEL_NUMBER: + case BUSLOGICCOMMAND_ENABLE_STRICT_ROUND_ROBIN_MODE: + case BUSLOGICCOMMAND_SET_CCB_FORMAT: + case BUSLOGICCOMMAND_INQUIRE_SYNCHRONOUS_PERIOD: + case BUSLOGICCOMMAND_DISABLE_HOST_ADAPTER_INTERRUPT: + pBusLogic->cbCommandParametersLeft = 1; + break; + case BUSLOGICCOMMAND_FETCH_HOST_ADAPTER_LOCAL_RAM: + pBusLogic->cbCommandParametersLeft = 2; + break; + case BUSLOGICCOMMAND_INITIALIZE_EXTENDED_MAILBOX: + pBusLogic->cbCommandParametersLeft = sizeof(RequestInitializeExtendedMailbox); + break; + case BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND: /* Should not come here anymore. */ + default: + AssertMsgFailed(("Invalid operation code %#x\n", uVal)); + } + } + else + { + /* + * The real adapter would set the Command register busy bit in the status register. + * The guest has to wait until it is unset. + * We don't need to do it because the guest does not continue execution while we are in this + * function. + */ + pBusLogic->aCommandBuffer[pBusLogic->iParameter] = uVal; + pBusLogic->iParameter++; + pBusLogic->cbCommandParametersLeft--; + } + + /* Start execution of command if there are no parameters left. */ + if (!pBusLogic->cbCommandParametersLeft) + { + rc = buslogicProcessCommand(pBusLogic); + AssertMsgRC(rc, ("Processing command failed rc=%Rrc\n", rc)); + } + break; + } + default: + AssertMsgFailed(("Register not available\n")); + rc = VERR_IOM_IOPORT_UNUSED; + } + + return rc; +} + +/** + * Memory mapped I/O Handler for read operations. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param GCPhysAddr Physical address (in GC) where the read starts. + * @param pv Where to store the result. + * @param cb Number of bytes read. + */ +PDMBOTHCBDECL(int) buslogicMMIORead(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb) +{ + /* the linux driver does not make use of the MMIO area. */ + AssertMsgFailed(("MMIO Read\n")); + return VINF_SUCCESS; +} + +/** + * Memory mapped I/O Handler for write operations. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param GCPhysAddr Physical address (in GC) where the read starts. + * @param pv Where to fetch the result. + * @param cb Number of bytes to write. + */ +PDMBOTHCBDECL(int) buslogicMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb) +{ + /* the linux driver does not make use of the MMIO area. */ + AssertMsgFailed(("MMIO Write\n")); + return VINF_SUCCESS; +} + +/** + * Port I/O Handler for IN operations. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param uPort Port number used for the IN operation. + * @param pu32 Where to store the result. + * @param cb Number of bytes read. + */ +PDMBOTHCBDECL(int) buslogicIOPortRead (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC);; + unsigned iRegister = Port - pBusLogic->IOPortBase; + + Assert(cb == 1); + + return buslogicRegisterRead(pBusLogic, iRegister, pu32); +} + +/** + * Port I/O Handler for OUT operations. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param uPort Port number used for the IN operation. + * @param u32 The value to output. + * @param cb The value size in bytes. + */ +PDMBOTHCBDECL(int) buslogicIOPortWrite (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t u32, unsigned cb) +{ + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + int rc = VINF_SUCCESS; + unsigned iRegister = Port - pBusLogic->IOPortBase; + uint8_t uVal = (uint8_t)u32; + + Assert(cb == 1); + + rc = buslogicRegisterWrite(pBusLogic, iRegister, (uint8_t)uVal); + + Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x Port=%#x rc=%Rrc\n", + pDevIns->iInstance, __FUNCTION__, pvUser, cb, u32, Port, rc)); + + return rc; +} + +#ifdef IN_RING3 +/** + * Port I/O Handler for IN operations - legacy port. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param uPort Port number used for the IN operation. + * @param pu32 Where to store the result. + * @param cb Number of bytes read. + */ +static int buslogicIsaIOPortRead (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + int rc; + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + Assert(cb == 1); + + if (!pBusLogic->fISAEnabled) + return VERR_IOM_IOPORT_UNUSED; + + rc = vboxscsiReadRegister(&pBusLogic->VBoxSCSI, (Port - BUSLOGIC_ISA_IO_PORT), pu32); + + Log2(("%s: pu32=%p:{%.*Rhxs} iRegister=%d rc=%Rrc\n", + __FUNCTION__, pu32, 1, pu32, (Port - BUSLOGIC_ISA_IO_PORT), rc)); + + return rc; +} + +static int buslogicPrepareBIOSSCSIRequest(PBUSLOGIC pBusLogic) +{ + int rc; + PBUSLOGICTASKSTATE pTaskState; + uint32_t uTargetDevice; + + rc = RTCacheRequest(pBusLogic->pTaskCache, (void **)&pTaskState); + AssertMsgRCReturn(rc, ("Getting task from cache failed rc=%Rrc\n", rc), rc); + + pTaskState->fBIOS = true; + + rc = vboxscsiSetupRequest(&pBusLogic->VBoxSCSI, &pTaskState->PDMScsiRequest, &uTargetDevice); + AssertMsgRCReturn(rc, ("Setting up SCSI request failed rc=%Rrc\n", rc), rc); + + pTaskState->PDMScsiRequest.pvUser = pTaskState; + + pTaskState->CTX_SUFF(pTargetDevice) = &pBusLogic->aDeviceStates[uTargetDevice]; + + if (!pTaskState->CTX_SUFF(pTargetDevice)->fPresent) + { + /* Device is not present. */ + AssertMsg(pTaskState->PDMScsiRequest.pbCDB[0] == SCSI_INQUIRY, + ("Device is not present but command is not inquiry\n")); + + SCSIINQUIRYDATA ScsiInquiryData; + + memset(&ScsiInquiryData, 0, sizeof(SCSIINQUIRYDATA)); + ScsiInquiryData.u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_UNKNOWN; + ScsiInquiryData.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_NOT_CONNECTED_NOT_SUPPORTED; + + memcpy(pBusLogic->VBoxSCSI.pBuf, &ScsiInquiryData, 5); + + rc = vboxscsiRequestFinished(&pBusLogic->VBoxSCSI, &pTaskState->PDMScsiRequest); + AssertMsgRCReturn(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc), rc); + + rc = RTCacheInsert(pBusLogic->pTaskCache, pTaskState); + AssertMsgRCReturn(rc, ("Getting task from cache failed rc=%Rrc\n", rc), rc); + } + else + { + LogFlowFunc(("before increment %u\n", pTaskState->CTX_SUFF(pTargetDevice)->cOutstandingRequests)); + ASMAtomicIncU32(&pTaskState->CTX_SUFF(pTargetDevice)->cOutstandingRequests); + LogFlowFunc(("after increment %u\n", pTaskState->CTX_SUFF(pTargetDevice)->cOutstandingRequests)); + + rc = pTaskState->CTX_SUFF(pTargetDevice)->pDrvSCSIConnector->pfnSCSIRequestSend(pTaskState->CTX_SUFF(pTargetDevice)->pDrvSCSIConnector, + &pTaskState->PDMScsiRequest); + AssertMsgRCReturn(rc, ("Sending request to SCSI layer failed rc=%Rrc\n", rc), rc); + } + + return rc; +} + +/** + * Port I/O Handler for OUT operations - legacy port. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param uPort Port number used for the IN operation. + * @param u32 The value to output. + * @param cb The value size in bytes. + */ +static int buslogicIsaIOPortWrite (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t u32, unsigned cb) +{ + int rc; + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x Port=%#x\n", + pDevIns->iInstance, __FUNCTION__, pvUser, cb, u32, Port)); + + Assert(cb == 1); + + if (!pBusLogic->fISAEnabled) + return VERR_IOM_IOPORT_UNUSED; + + rc = vboxscsiWriteRegister(&pBusLogic->VBoxSCSI, (Port - BUSLOGIC_ISA_IO_PORT), (uint8_t)u32); + if (rc == VERR_MORE_DATA) + { + rc = buslogicPrepareBIOSSCSIRequest(pBusLogic); + AssertRC(rc); + } + else if (RT_FAILURE(rc)) + AssertMsgFailed(("Writing BIOS register failed %Rrc\n", rc)); + + return VINF_SUCCESS; +} + +/** + * Port I/O Handler for primary port range OUT string operations. + * @see FNIOMIOPORTOUTSTRING for details. + */ +static DECLCALLBACK(int) buslogicIsaIOPortWriteStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrSrc, PRTGCUINTREG pcTransfer, unsigned cb) +{ + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + int rc; + + Log2(("#%d %s: pvUser=%#p cb=%d Port=%#x\n", + pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port)); + + rc = vboxscsiWriteString(pDevIns, &pBusLogic->VBoxSCSI, (Port - BUSLOGIC_ISA_IO_PORT), + pGCPtrSrc, pcTransfer, cb); + if (rc == VERR_MORE_DATA) + { + rc = buslogicPrepareBIOSSCSIRequest(pBusLogic); + AssertRC(rc); + } + else if (RT_FAILURE(rc)) + AssertMsgFailed(("Writing BIOS register failed %Rrc\n", rc)); + + return rc; +} + +/** + * Port I/O Handler for primary port range IN string operations. + * @see FNIOMIOPORTINSTRING for details. + */ +static DECLCALLBACK(int) buslogicIsaIOPortReadStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrDst, PRTGCUINTREG pcTransfer, unsigned cb) +{ + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + LogFlowFunc(("#%d %s: pvUser=%#p cb=%d Port=%#x\n", + pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port)); + + return vboxscsiReadString(pDevIns, &pBusLogic->VBoxSCSI, (Port - BUSLOGIC_ISA_IO_PORT), + pGCPtrDst, pcTransfer, cb); +} + +static DECLCALLBACK(int) buslogicMMIOMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, + RTGCPHYS GCPhysAddress, uint32_t cb, + PCIADDRESSSPACE enmType) +{ + PPDMDEVINS pDevIns = pPciDev->pDevIns; + PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + int rc = VINF_SUCCESS; + + Log2(("%s: registering MMIO area at GCPhysAddr=%RGp cb=%u\n", __FUNCTION__, GCPhysAddress, cb)); + + Assert(cb >= 32); + + if (enmType == PCI_ADDRESS_SPACE_MEM) + { + /* We use the assigned size here, because we currently only support page aligned MMIO ranges. */ + rc = PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, NULL, + buslogicMMIOWrite, buslogicMMIORead, NULL, "BusLogic"); + if (RT_FAILURE(rc)) + return rc; + + if (pThis->fR0Enabled) + { + rc = PDMDevHlpMMIORegisterR0(pDevIns, GCPhysAddress, cb, 0, + "buslogicMMIOWrite", "buslogicMMIORead", NULL); + if (RT_FAILURE(rc)) + return rc; + } + + if (pThis->fGCEnabled) + { + rc = PDMDevHlpMMIORegisterGC(pDevIns, GCPhysAddress, cb, 0, + "buslogicMMIOWrite", "buslogicMMIORead", NULL); + if (RT_FAILURE(rc)) + return rc; + } + + pThis->MMIOBase = GCPhysAddress; + } + else if (enmType == PCI_ADDRESS_SPACE_IO) + { + rc = PDMDevHlpIOPortRegister(pDevIns, (RTIOPORT)GCPhysAddress, 32, + NULL, buslogicIOPortWrite, buslogicIOPortRead, NULL, NULL, "BusLogic"); + if (RT_FAILURE(rc)) + return rc; + + if (pThis->fR0Enabled) + { + rc = PDMDevHlpIOPortRegisterR0(pDevIns, (RTIOPORT)GCPhysAddress, 32, + 0, "buslogicIOPortWrite", "buslogicIOPortRead", NULL, NULL, "BusLogic"); + if (RT_FAILURE(rc)) + return rc; + } + + if (pThis->fGCEnabled) + { + rc = PDMDevHlpIOPortRegisterGC(pDevIns, (RTIOPORT)GCPhysAddress, 32, + 0, "buslogicIOPortWrite", "buslogicIOPortRead", NULL, NULL, "BusLogic"); + if (RT_FAILURE(rc)) + return rc; + } + + pThis->IOPortBase = (RTIOPORT)GCPhysAddress; + } + else + AssertMsgFailed(("Invalid enmType=%d\n", enmType)); + + return rc; +} + +static DECLCALLBACK(int) buslogicDeviceSCSIRequestCompleted(PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest, int rcCompletion) +{ + int rc; + PBUSLOGICTASKSTATE pTaskState = (PBUSLOGICTASKSTATE)pSCSIRequest->pvUser; + PBUSLOGICDEVICE pBusLogicDevice = pTaskState->CTX_SUFF(pTargetDevice); + PBUSLOGIC pBusLogic = pBusLogicDevice->CTX_SUFF(pBusLogic); + + LogFlowFunc(("before decrement %u\n", pBusLogicDevice->cOutstandingRequests)); + ASMAtomicDecU32(&pBusLogicDevice->cOutstandingRequests); + LogFlowFunc(("after decrement %u\n", pBusLogicDevice->cOutstandingRequests)); + + if (pTaskState->fBIOS) + { + rc = vboxscsiRequestFinished(&pBusLogic->VBoxSCSI, pSCSIRequest); + AssertMsgRC(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc)); + } + else + { + buslogicFreeGCDataBuffer(pTaskState); + + if (pTaskState->pu8SenseBuffer) + buslogicFreeGCSenseBuffer(pTaskState); + + buslogicSendIncomingMailbox(pBusLogic, pTaskState, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_CMD_COMPLETED, + BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_OPERATION_GOOD, + BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITHOUT_ERROR); + } + + /* Add task to the cache. */ + rc = RTCacheInsert(pBusLogic->pTaskCache, pTaskState); + AssertMsgRC(rc, ("Inserting task state into cache failed rc=%Rrc\n", rc)); + + return VINF_SUCCESS; +} + +/** + * Read mailbox from the guest and execute command. + * + * @returns VBox status code. + * @param pBusLogic Pointer to the BusLogic instance data. + */ +static int buslogicProcessMailboxNext(PBUSLOGIC pBusLogic) +{ + PBUSLOGICTASKSTATE pTaskState = NULL; + RTGCPHYS GCPhysAddrMailboxCurrent; + int rc; + + rc = RTCacheRequest(pBusLogic->pTaskCache, (void **)&pTaskState); + AssertMsgReturn(RT_SUCCESS(rc) && (pTaskState != NULL), ("Failed to get task state from cache\n"), rc); + + pTaskState->fBIOS = false; + + if (!pBusLogic->fStrictRoundRobinMode) + { + /* Search for a filled mailbox. */ + do + { + /* Fetch mailbox from guest memory. */ + GCPhysAddrMailboxCurrent = pBusLogic->GCPhysAddrMailboxOutgoingBase + (pBusLogic->uMailboxOutgoingPositionCurrent * sizeof(Mailbox)); + + PDMDevHlpPhysRead(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrMailboxCurrent, + &pTaskState->MailboxGuest, sizeof(Mailbox)); + + pBusLogic->uMailboxOutgoingPositionCurrent++; + + /* Check if we reached the end and start from the beginning if so. */ + if (pBusLogic->uMailboxOutgoingPositionCurrent >= pBusLogic->cMailbox) + pBusLogic->uMailboxOutgoingPositionCurrent = 0; + } while (pTaskState->MailboxGuest.u.out.uActionCode == BUSLOGIC_MAILBOX_OUTGOING_ACTION_FREE); + } + else + { + /* Fetch mailbox from guest memory. */ + GCPhysAddrMailboxCurrent = pBusLogic->GCPhysAddrMailboxOutgoingBase + (pBusLogic->uMailboxOutgoingPositionCurrent * sizeof(Mailbox)); + + PDMDevHlpPhysRead(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrMailboxCurrent, + &pTaskState->MailboxGuest, sizeof(Mailbox)); + } + +#ifdef DEBUG + buslogicDumpMailboxInfo(&pTaskState->MailboxGuest, true); +#endif + + if (pTaskState->MailboxGuest.u.out.uActionCode == BUSLOGIC_MAILBOX_OUTGOING_ACTION_START_COMMAND) + { + bool fReadonly = false; + + /* Fetch CCB now. */ + RTGCPHYS GCPhysAddrCCB = (RTGCPHYS)pTaskState->MailboxGuest.u32PhysAddrCCB; + PDMDevHlpPhysRead(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrCCB, + &pTaskState->CommandControlBlockGuest, sizeof(CommandControlBlock)); + + PBUSLOGICDEVICE pTargetDevice = &pBusLogic->aDeviceStates[pTaskState->CommandControlBlockGuest.uTargetId]; + pTaskState->CTX_SUFF(pTargetDevice) = pTargetDevice; + +#ifdef DEBUG + buslogicDumpCCBInfo(&pTaskState->CommandControlBlockGuest); +#endif + + switch (pTaskState->CommandControlBlockGuest.uDataDirection) + { + case BUSLOGIC_CCB_DIRECTION_UNKNOWN: + case BUSLOGIC_CCB_DIRECTION_IN: + fReadonly = false; + break; + case BUSLOGIC_CCB_DIRECTION_OUT: + case BUSLOGIC_CCB_DIRECTION_NO_DATA: + fReadonly = true; + break; + default: + AssertMsgFailed(("Invalid data transfer direction type %u\n", + pTaskState->CommandControlBlockGuest.uDataDirection)); + } + + /* Map required buffers. */ + rc = buslogicMapGCDataBufIntoR3(pTaskState, fReadonly); + AssertMsgRC(rc, ("Mapping failed rc=%Rrc\n", rc)); + + if (pTaskState->CommandControlBlockGuest.cbSenseData) + { + rc = buslogicMapGCSenseBufferIntoR3(pTaskState); + AssertMsgRC(rc, ("Mapping sense buffer failed rc=%Rrc\n", rc)); + } + + /* Check if device is present on bus. If not return error immediately and don't process this further. */ + if (!pBusLogic->aDeviceStates[pTaskState->CommandControlBlockGuest.uTargetId].fPresent) + { + buslogicFreeGCDataBuffer(pTaskState); + + if (pTaskState->pu8SenseBuffer) + buslogicFreeGCSenseBuffer(pTaskState); + + buslogicSendIncomingMailbox(pBusLogic, pTaskState, + BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_SCSI_SELECTION_TIMEOUT, + BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_OPERATION_GOOD, + BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITH_ERROR); + + rc = RTCacheInsert(pBusLogic->pTaskCache, pTaskState); + AssertMsgRC(rc, ("Failed to insert task state into cache rc=%Rrc\n", rc)); + } + else + { + /* Setup SCSI request. */ + pTaskState->PDMScsiRequest.uLogicalUnit = pTaskState->CommandControlBlockGuest.uLogicalUnit; + + if (pTaskState->CommandControlBlockGuest.uDataDirection == BUSLOGIC_CCB_DIRECTION_UNKNOWN) + pTaskState->PDMScsiRequest.uDataDirection = PDMSCSIREQUESTTXDIR_UNKNOWN; + else if (pTaskState->CommandControlBlockGuest.uDataDirection == BUSLOGIC_CCB_DIRECTION_IN) + pTaskState->PDMScsiRequest.uDataDirection = PDMSCSIREQUESTTXDIR_FROM_DEVICE; + else if (pTaskState->CommandControlBlockGuest.uDataDirection == BUSLOGIC_CCB_DIRECTION_OUT) + pTaskState->PDMScsiRequest.uDataDirection = PDMSCSIREQUESTTXDIR_TO_DEVICE; + else if (pTaskState->CommandControlBlockGuest.uDataDirection == BUSLOGIC_CCB_DIRECTION_NO_DATA) + pTaskState->PDMScsiRequest.uDataDirection = PDMSCSIREQUESTTXDIR_NONE; + else + AssertMsgFailed(("Invalid data direction type %d\n", pTaskState->CommandControlBlockGuest.uDataDirection)); + + pTaskState->PDMScsiRequest.cbCDB = pTaskState->CommandControlBlockGuest.cbCDB; + pTaskState->PDMScsiRequest.pbCDB = pTaskState->CommandControlBlockGuest.aCDB; + pTaskState->PDMScsiRequest.cbScatterGather = pTaskState->cbScatterGather; + pTaskState->PDMScsiRequest.cScatterGatherEntries = pTaskState->cScatterGather; + pTaskState->PDMScsiRequest.paScatterGatherHead = pTaskState->paScatterGather; + pTaskState->PDMScsiRequest.cbSenseBuffer = pTaskState->CommandControlBlockGuest.cbSenseData; + pTaskState->PDMScsiRequest.pbSenseBuffer = pTaskState->pu8SenseBuffer; + pTaskState->PDMScsiRequest.pvUser = pTaskState; + + LogFlowFunc(("before increment %u\n", pTargetDevice->cOutstandingRequests)); + ASMAtomicIncU32(&pTargetDevice->cOutstandingRequests); + LogFlowFunc(("after increment %u\n", pTargetDevice->cOutstandingRequests)); + rc = pTargetDevice->pDrvSCSIConnector->pfnSCSIRequestSend(pTargetDevice->pDrvSCSIConnector, &pTaskState->PDMScsiRequest); + AssertMsgRC(rc, ("Sending request to SCSI layer failed rc=%Rrc\n", rc)); + } + } + else if (pTaskState->MailboxGuest.u.out.uActionCode == BUSLOGIC_MAILBOX_OUTGOING_ACTION_ABORT_COMMAND) + { + AssertMsgFailed(("Not implemented yet\n")); + } + else + AssertMsgFailed(("Invalid outgoing mailbox action code %u\n", pTaskState->MailboxGuest.u.out.uActionCode)); + + /* We got the mailbox, mark it as free in the guest. */ + pTaskState->MailboxGuest.u.out.uActionCode = BUSLOGIC_MAILBOX_OUTGOING_ACTION_FREE; + PDMDevHlpPhysWrite(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrMailboxCurrent, &pTaskState->MailboxGuest, sizeof(Mailbox)); + + if (pBusLogic->fStrictRoundRobinMode) + { + pBusLogic->uMailboxOutgoingPositionCurrent++; + + /* Check if we reached the end and start from the beginning if so. */ + if (pBusLogic->uMailboxOutgoingPositionCurrent >= pBusLogic->cMailbox) + pBusLogic->uMailboxOutgoingPositionCurrent = 0; + } + + return rc; +} + +/** + * Transmit queue consumer + * Queue a new async task. + * + * @returns Success indicator. + * If false the item will not be removed and the flushing will stop. + * @param pDevIns The device instance. + * @param pItem The item to consume. Upon return this item will be freed. + */ +static DECLCALLBACK(bool) buslogicNotifyQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem) +{ + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + AssertMsg(pBusLogic->cMailboxesReady > 0, ("Got notification without any mailboxes ready\n")); + + /* Reset notification send flag now. */ + ASMAtomicXchgBool(&pBusLogic->fNotificationSend, false); + + /* Process mailboxes. */ + do + { + int rc; + + rc = buslogicProcessMailboxNext(pBusLogic); + AssertMsgRC(rc, ("Processing mailbox failed rc=%Rrc\n", rc)); + } while (ASMAtomicDecU32(&pBusLogic->cMailboxesReady) > 0); + + return true; +} + +static bool buslogicWaitForAsyncIOFinished(PBUSLOGIC pBusLogic, unsigned cMillies) +{ + uint64_t u64Start; + bool fIdle; + + /* + * Wait for any pending async operation to finish + */ + u64Start = RTTimeMilliTS(); + do + { + fIdle = true; + + /* Check every port. */ + for (unsigned i = 0; i < RT_ELEMENTS(pBusLogic->aDeviceStates); i++) + { + PBUSLOGICDEVICE pBusLogicDevice = &pBusLogic->aDeviceStates[i]; + if (ASMAtomicReadU32(&pBusLogicDevice->cOutstandingRequests)) + { + fIdle = false; + break; + } + } + if (RTTimeMilliTS() - u64Start >= cMillies) + break; + + /* Sleep for a bit. */ + RTThreadSleep(100); + } while (!fIdle); + + return fIdle; +} + +static DECLCALLBACK(int) buslogicSaveLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) +{ + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + /* Wait that no task is pending on any device. */ + if (!buslogicWaitForAsyncIOFinished(pBusLogic, 20000)) + { + AssertLogRelMsgFailed(("BusLogic: There are still tasks outstanding\n")); + return VERR_TIMEOUT; + } + + return VINF_SUCCESS; +} + +static DECLCALLBACK(int) buslogicSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) +{ + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + /* Every device first. */ + for (unsigned i = 0; i < RT_ELEMENTS(pBusLogic->aDeviceStates); i++) + { + PBUSLOGICDEVICE pDevice = &pBusLogic->aDeviceStates[i]; + + AssertMsg(!pDevice->cOutstandingRequests, + ("There are still outstanding requests on this device\n")); + SSMR3PutBool(pSSM, pDevice->fPresent); + SSMR3PutU32(pSSM, pDevice->cOutstandingRequests); + } + /* Now the main device state. */ + SSMR3PutU8 (pSSM, pBusLogic->regStatus); + SSMR3PutU8 (pSSM, pBusLogic->regInterrupt); + SSMR3PutU8 (pSSM, pBusLogic->regGeometry); + SSMR3PutMem (pSSM, &pBusLogic->LocalRam, sizeof(pBusLogic->LocalRam)); + SSMR3PutU8 (pSSM, pBusLogic->uOperationCode); + SSMR3PutMem (pSSM, &pBusLogic->aCommandBuffer, sizeof(pBusLogic->aCommandBuffer)); + SSMR3PutU8 (pSSM, pBusLogic->iParameter); + SSMR3PutU8 (pSSM, pBusLogic->cbCommandParametersLeft); + SSMR3PutBool (pSSM, pBusLogic->fUseLocalRam); + SSMR3PutMem (pSSM, pBusLogic->aReplyBuffer, sizeof(pBusLogic->aReplyBuffer)); + SSMR3PutU8 (pSSM, pBusLogic->iReply); + SSMR3PutU8 (pSSM, pBusLogic->cbReplyParametersLeft); + SSMR3PutBool (pSSM, pBusLogic->fIRQEnabled); + SSMR3PutBool (pSSM, pBusLogic->fISAEnabled); + SSMR3PutU32 (pSSM, pBusLogic->cMailbox); + SSMR3PutGCPhys(pSSM, pBusLogic->GCPhysAddrMailboxOutgoingBase); + SSMR3PutU32 (pSSM, pBusLogic->uMailboxOutgoingPositionCurrent); + SSMR3PutU32 (pSSM, pBusLogic->cMailboxesReady); + SSMR3PutBool (pSSM, pBusLogic->fNotificationSend); + SSMR3PutGCPhys(pSSM, pBusLogic->GCPhysAddrMailboxIncomingBase); + SSMR3PutU32 (pSSM, pBusLogic->uMailboxIncomingPositionCurrent); + SSMR3PutBool (pSSM, pBusLogic->fStrictRoundRobinMode); + SSMR3PutBool (pSSM, pBusLogic->fExtendedLunCCBFormat); + /* Now the data for the BIOS interface. */ + SSMR3PutU8 (pSSM, pBusLogic->VBoxSCSI.regIdentify); + SSMR3PutU8 (pSSM, pBusLogic->VBoxSCSI.uTargetDevice); + SSMR3PutU8 (pSSM, pBusLogic->VBoxSCSI.uTxDir); + SSMR3PutU8 (pSSM, pBusLogic->VBoxSCSI.cbCDB); + SSMR3PutMem (pSSM, pBusLogic->VBoxSCSI.aCDB, sizeof(pBusLogic->VBoxSCSI.aCDB)); + SSMR3PutU8 (pSSM, pBusLogic->VBoxSCSI.iCDB); + SSMR3PutU32 (pSSM, pBusLogic->VBoxSCSI.cbBuf); + SSMR3PutU32 (pSSM, pBusLogic->VBoxSCSI.iBuf); + SSMR3PutBool (pSSM, pBusLogic->VBoxSCSI.fBusy); + SSMR3PutU8 (pSSM, pBusLogic->VBoxSCSI.enmState); + if (pBusLogic->VBoxSCSI.cbCDB) + SSMR3PutMem(pSSM, pBusLogic->VBoxSCSI.pBuf, pBusLogic->VBoxSCSI.cbBuf); + + return SSMR3PutU32(pSSM, ~0); +} + +static DECLCALLBACK(int) buslogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version) +{ + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + int rc = VINF_SUCCESS; + + /* We support saved states only from this and older versions. */ + if (u32Version > BUSLOGIC_SAVED_STATE_MINOR_VERSION) + return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; + + /* Every device first. */ + for (unsigned i = 0; i < RT_ELEMENTS(pBusLogic->aDeviceStates); i++) + { + PBUSLOGICDEVICE pDevice = &pBusLogic->aDeviceStates[i]; + + AssertMsg(!pDevice->cOutstandingRequests, + ("There are still outstanding requests on this device\n")); + SSMR3GetBool(pSSM, &pDevice->fPresent); + SSMR3GetU32(pSSM, (uint32_t *)&pDevice->cOutstandingRequests); + } + /* Now the main device state. */ + SSMR3GetU8 (pSSM, (uint8_t *)&pBusLogic->regStatus); + SSMR3GetU8 (pSSM, (uint8_t *)&pBusLogic->regInterrupt); + SSMR3GetU8 (pSSM, (uint8_t *)&pBusLogic->regGeometry); + SSMR3GetMem (pSSM, &pBusLogic->LocalRam, sizeof(pBusLogic->LocalRam)); + SSMR3GetU8 (pSSM, &pBusLogic->uOperationCode); + SSMR3GetMem (pSSM, &pBusLogic->aCommandBuffer, sizeof(pBusLogic->aCommandBuffer)); + SSMR3GetU8 (pSSM, &pBusLogic->iParameter); + SSMR3GetU8 (pSSM, &pBusLogic->cbCommandParametersLeft); + SSMR3GetBool (pSSM, &pBusLogic->fUseLocalRam); + SSMR3GetMem (pSSM, pBusLogic->aReplyBuffer, sizeof(pBusLogic->aReplyBuffer)); + SSMR3GetU8 (pSSM, &pBusLogic->iReply); + SSMR3GetU8 (pSSM, &pBusLogic->cbReplyParametersLeft); + SSMR3GetBool (pSSM, &pBusLogic->fIRQEnabled); + SSMR3GetBool (pSSM, &pBusLogic->fISAEnabled); + SSMR3GetU32 (pSSM, &pBusLogic->cMailbox); + SSMR3GetGCPhys(pSSM, &pBusLogic->GCPhysAddrMailboxOutgoingBase); + SSMR3GetU32 (pSSM, &pBusLogic->uMailboxOutgoingPositionCurrent); + SSMR3GetU32 (pSSM, (uint32_t *)&pBusLogic->cMailboxesReady); + SSMR3GetBool (pSSM, (bool *)&pBusLogic->fNotificationSend); + SSMR3GetGCPhys(pSSM, &pBusLogic->GCPhysAddrMailboxIncomingBase); + SSMR3GetU32 (pSSM, &pBusLogic->uMailboxIncomingPositionCurrent); + SSMR3GetBool (pSSM, &pBusLogic->fStrictRoundRobinMode); + SSMR3GetBool (pSSM, &pBusLogic->fExtendedLunCCBFormat); + /* Now the data for the BIOS interface. */ + SSMR3GetU8 (pSSM, &pBusLogic->VBoxSCSI.regIdentify); + SSMR3GetU8 (pSSM, &pBusLogic->VBoxSCSI.uTargetDevice); + SSMR3GetU8 (pSSM, &pBusLogic->VBoxSCSI.uTxDir); + SSMR3GetU8 (pSSM, &pBusLogic->VBoxSCSI.cbCDB); + SSMR3GetMem (pSSM, pBusLogic->VBoxSCSI.aCDB, sizeof(pBusLogic->VBoxSCSI.aCDB)); + SSMR3GetU8 (pSSM, &pBusLogic->VBoxSCSI.iCDB); + SSMR3GetU32 (pSSM, &pBusLogic->VBoxSCSI.cbBuf); + SSMR3GetU32 (pSSM, &pBusLogic->VBoxSCSI.iBuf); + SSMR3GetBool(pSSM, (bool *)&pBusLogic->VBoxSCSI.fBusy); + SSMR3GetU8 (pSSM, (uint8_t *)&pBusLogic->VBoxSCSI.enmState); + if (pBusLogic->VBoxSCSI.cbCDB) + { + pBusLogic->VBoxSCSI.pBuf = (uint8_t *)RTMemAllocZ(pBusLogic->VBoxSCSI.cbCDB); + if (!pBusLogic->VBoxSCSI.pBuf) + { + LogRel(("BusLogic: Out of memory during restore.\n")); + return PDMDEV_SET_ERROR(pDevIns, VERR_NO_MEMORY, + N_("BusLogic: Out of memory during restore\n")); + } + SSMR3GetMem(pSSM, pBusLogic->VBoxSCSI.pBuf, pBusLogic->VBoxSCSI.cbBuf); + } + + uint32_t u32; + SSMR3GetU32(pSSM, &u32); + if (RT_FAILURE(rc)) + return rc; + if (u32 != ~0U) + { + AssertMsgFailed(("u32=%#x expected ~0\n", u32)); + return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; + } + + return VINF_SUCCESS; +} + +/** + * Gets the pointer to the status LED of a device - called from the SCSi driver. + * + * @returns VBox status code. + * @param pInterface Pointer to the interface structure containing the called function pointer. + * @param iLUN The unit which status LED we desire. Always 0 here as the driver + * doesn't know about other LUN's. + * @param ppLed Where to store the LED pointer. + */ +static DECLCALLBACK(int) buslogicDeviceQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) +{ + PBUSLOGICDEVICE pDevice = PDMILEDPORTS_2_PBUSLOGICDEVICE(pInterface); + if (iLUN == 0) + { + *ppLed = &pDevice->Led; + Assert((*ppLed)->u32Magic == PDMLED_MAGIC); + return VINF_SUCCESS; + } + return VERR_PDM_LUN_NOT_FOUND; +} + +/** + * Queries an interface to the driver. + * + * @returns Pointer to interface. + * @returns NULL if the interface was not supported by the device. + * @param pInterface Pointer to BUSLOGICDEVICE::IBase. + * @param enmInterface The requested interface identification. + */ +static DECLCALLBACK(void *) buslogicDeviceQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) +{ + PBUSLOGICDEVICE pDevice = PDMIBASE_2_PBUSLOGICDEVICE(pInterface); + + switch (enmInterface) + { + case PDMINTERFACE_SCSI_PORT: + return &pDevice->ISCSIPort; + case PDMINTERFACE_LED_PORTS: + return &pDevice->ILed; + default: + return NULL; + } +} + +/** + * Gets the pointer to the status LED of a unit. + * + * @returns VBox status code. + * @param pInterface Pointer to the interface structure containing the called function pointer. + * @param iLUN The unit which status LED we desire. + * @param ppLed Where to store the LED pointer. + */ +static DECLCALLBACK(int) buslogicStatusQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) +{ + PBUSLOGIC pBusLogic = PDMILEDPORTS_2_PBUSLOGIC(pInterface); + if (iLUN < BUSLOGIC_MAX_DEVICES) + { + *ppLed = &pBusLogic->aDeviceStates[iLUN].Led; + Assert((*ppLed)->u32Magic == PDMLED_MAGIC); + return VINF_SUCCESS; + } + return VERR_PDM_LUN_NOT_FOUND; +} + +/** + * Queries an interface to the driver. + * + * @returns Pointer to interface. + * @returns NULL if the interface was not supported by the device. + * @param pInterface Pointer to ATADevState::IBase. + * @param enmInterface The requested interface identification. + */ +static DECLCALLBACK(void *) buslogicStatusQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) +{ + PBUSLOGIC pBusLogic = PDMIBASE_2_PBUSLOGIC(pInterface); + switch (enmInterface) + { + case PDMINTERFACE_BASE: + return &pBusLogic->IBase; + case PDMINTERFACE_LED_PORTS: + return &pBusLogic->ILeds; + default: + return NULL; + } +} + +/** + * Detach notification. + * + * One harddisk at one port has been unplugged. + * The VM is suspended at this point. + * + * @param pDevIns The device instance. + * @param iLUN The logical unit which is being detached. + */ +static DECLCALLBACK(void) buslogicDetach(PPDMDEVINS pDevIns, unsigned iLUN) +{ + PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + PBUSLOGICDEVICE pDevice = &pThis->aDeviceStates[iLUN]; + + Log(("%s:\n", __FUNCTION__)); + + /* + * Zero some important members. + */ + pDevice->pDrvBase = NULL; + pDevice->pDrvSCSIConnector = NULL; +} + +/** + * Attach command. + * + * This is called when we change block driver. + * + * @returns VBox status code. + * @param pDevIns The device instance. + * @param iLUN The logical unit which is being detached. + */ +static DECLCALLBACK(int) buslogicAttach(PPDMDEVINS pDevIns, unsigned iLUN) +{ + PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + PBUSLOGICDEVICE pDevice = &pThis->aDeviceStates[iLUN]; + int rc; + + /* the usual paranoia */ + AssertRelease(!pDevice->pDrvBase); + AssertRelease(!pDevice->pDrvSCSIConnector); + Assert(pDevice->iLUN == iLUN); + + /* + * Try attach the block device and get the interfaces, + * required as well as optional. + */ + rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, NULL); + if (RT_SUCCESS(rc)) + { + /* Get SCSI connector interface. */ + pDevice->pDrvSCSIConnector = (PPDMISCSICONNECTOR)pDevice->pDrvBase->pfnQueryInterface(pDevice->pDrvBase, PDMINTERFACE_SCSI_CONNECTOR); + AssertMsgReturn(pDevice->pDrvSCSIConnector, ("Missing SCSI interface below\n"), VERR_PDM_MISSING_INTERFACE); + } + else + AssertMsgFailed(("Failed to attach LUN#%d. rc=%Rrc\n", pDevice->iLUN, rc)); + + if (RT_FAILURE(rc)) + { + pDevice->pDrvBase = NULL; + pDevice->pDrvSCSIConnector = NULL; + } + return rc; +} + +static DECLCALLBACK(void) buslogicSuspend(PPDMDEVINS pDevIns) +{ + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + /* Wait that no task is pending on any device. */ + if (!buslogicWaitForAsyncIOFinished(pBusLogic, 20000)) + AssertLogRelMsgFailed(("BusLogic: There are still tasks outstanding\n")); +} + +static DECLCALLBACK(void) buslogicRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) +{ + uint32_t i; + PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + pBusLogic->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); + pBusLogic->pNotifierQueueRC = PDMQueueRCPtr(pBusLogic->pNotifierQueueR3); + + for (i = 0; i < BUSLOGIC_MAX_DEVICES; i++) + { + PBUSLOGICDEVICE pDevice = &pBusLogic->aDeviceStates[i]; + + pDevice->pBusLogicRC = PDMINS_2_DATA_RCPTR(pDevIns); + } + +} + +/** + * Reset notification. + * + * @returns VBox status. + * @param pDevIns The device instance data. + */ +static DECLCALLBACK(void) buslogicReset(PPDMDEVINS pDevIns) +{ + PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + buslogicHwReset(pThis); +} + +/** + * Destroy a driver instance. + * + * Most VM resources are freed by the VM. This callback is provided so that any non-VM + * resources can be freed correctly. + * + * @param pDevIns The device instance data. + */ +static DECLCALLBACK(int) buslogicDestruct(PPDMDEVINS pDevIns) +{ + int rc = VINF_SUCCESS; + PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + + rc = RTCacheDestroy(pThis->pTaskCache); + AssertMsgRC(rc, ("Destroying task cache failed rc=%Rrc\n", rc)); + + return rc; +} + +/** + * Construct a device instance for a VM. + * + * @returns VBox status. + * @param pDevIns The device instance data. + * If the registration structure is needed, pDevIns->pDevReg points to it. + * @param iInstance Instance number. Use this to figure out which registers and such to use. + * The device number is also found in pDevIns->iInstance, but since it's + * likely to be freqently used PDM passes it as parameter. + * @param pCfgHandle Configuration node handle for the device. Use this to obtain the configuration + * of the device instance. It's also found in pDevIns->pCfgHandle, but like + * iInstance it's expected to be used a bit in this function. + */ +static DECLCALLBACK(int) buslogicConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle) +{ + PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); + int rc = VINF_SUCCESS; + + /* + * Validate and read configuration. + */ + rc = CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0" + "R0Enabled\0"); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, + N_("BusLogic configuration error: unknown option specified")); + + rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &pThis->fGCEnabled, true); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("BusLogic configuration error: failed to read GCEnabled as boolean")); + Log(("%s: fGCEnabled=%d\n", __FUNCTION__, pThis->fGCEnabled)); + + rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &pThis->fR0Enabled, true); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("BusLogic configuration error: failed to read R0Enabled as boolean")); + Log(("%s: fR0Enabled=%d\n", __FUNCTION__, pThis->fR0Enabled)); + + + pThis->pDevInsR3 = pDevIns; + pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); + pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); + pThis->IBase.pfnQueryInterface = buslogicStatusQueryInterface; + pThis->ILeds.pfnQueryStatusLed = buslogicStatusQueryStatusLed; + + PCIDevSetVendorId (&pThis->dev, 0x104b); /* BusLogic */ + PCIDevSetDeviceId (&pThis->dev, 0x1040); /* BT-958 */ + PCIDevSetCommand (&pThis->dev, 0x0003); + PCIDevSetRevisionId (&pThis->dev, 0x01); + PCIDevSetClassProg (&pThis->dev, 0x00); /* SCSI */ + PCIDevSetClassSub (&pThis->dev, 0x00); /* SCSI */ + PCIDevSetClassBase (&pThis->dev, 0x01); /* Mass storage */ + PCIDevSetBaseAddress (&pThis->dev, 0, true, false, false, 0x00000000); + PCIDevSetBaseAddress (&pThis->dev, 1, false, false, false, 0x00000000); + PCIDevSetSubSystemVendorId(&pThis->dev, 0x104b); + PCIDevSetSubSystemId (&pThis->dev, 0x1040); + PCIDevSetInterruptLine (&pThis->dev, 0x00); + PCIDevSetInterruptPin (&pThis->dev, 0x01); + + /* + * Register the PCI device, it's I/O regions. + */ + rc = PDMDevHlpPCIRegister (pDevIns, &pThis->dev); + if (RT_FAILURE(rc)) + return rc; + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, 32, PCI_ADDRESS_SPACE_IO, buslogicMMIOMap); + if (RT_FAILURE(rc)) + return rc; + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, 32, PCI_ADDRESS_SPACE_MEM, buslogicMMIOMap); + if (RT_FAILURE(rc)) + return rc; + + /* Register I/O port space in ISA region for BIOS access. */ + rc = PDMDevHlpIOPortRegister(pDevIns, BUSLOGIC_ISA_IO_PORT, 3, NULL, + buslogicIsaIOPortWrite, buslogicIsaIOPortRead, + buslogicIsaIOPortWriteStr, buslogicIsaIOPortReadStr, + "BusLogic BIOS"); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic cannot register legacy I/O handlers")); + + /* Initialize task cache. */ + rc = RTCacheCreate(&pThis->pTaskCache, 0 /* unlimited */, sizeof(BUSLOGICTASKSTATE), RTOBJCACHE_PROTECT_INSERT); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("BusLogic: Failed to initialize task cache\n")); + + /* Intialize task queue. */ + rc = PDMDevHlpPDMQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 5, 0, + buslogicNotifyQueueConsumer, true, &pThis->pNotifierQueueR3); + if (RT_FAILURE(rc)) + return rc; + pThis->pNotifierQueueR0 = PDMQueueR0Ptr(pThis->pNotifierQueueR3); + pThis->pNotifierQueueRC = PDMQueueRCPtr(pThis->pNotifierQueueR3); + + /* Initialize per device state. */ + for (unsigned i = 0; i < RT_ELEMENTS(pThis->aDeviceStates); i++) + { + char szName[24]; + PBUSLOGICDEVICE pDevice = &pThis->aDeviceStates[i]; + + RTStrPrintf(szName, sizeof(szName), "Device%d", i); + + /* Initialize static parts of the device. */ + pDevice->iLUN = i; + pDevice->pBusLogicR3 = pThis; + pDevice->pBusLogicR0 = PDMINS_2_DATA_R0PTR(pDevIns); + pDevice->pBusLogicRC = PDMINS_2_DATA_RCPTR(pDevIns); + pDevice->Led.u32Magic = PDMLED_MAGIC; + pDevice->IBase.pfnQueryInterface = buslogicDeviceQueryInterface; + pDevice->ISCSIPort.pfnSCSIRequestCompleted = buslogicDeviceSCSIRequestCompleted; + pDevice->ILed.pfnQueryStatusLed = buslogicDeviceQueryStatusLed; + + /* Attach SCSI driver. */ + rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, szName); + if (RT_SUCCESS(rc)) + { + /* Get SCSI connector interface. */ + pDevice->pDrvSCSIConnector = (PPDMISCSICONNECTOR)pDevice->pDrvBase->pfnQueryInterface(pDevice->pDrvBase, PDMINTERFACE_SCSI_CONNECTOR); + AssertMsgReturn(pDevice->pDrvSCSIConnector, ("Missing SCSI interface below\n"), VERR_PDM_MISSING_INTERFACE); + + pDevice->fPresent = true; + } + else if (rc == VERR_PDM_NO_ATTACHED_DRIVER) + { + pDevice->pDrvBase = NULL; + pDevice->fPresent = false; + rc = VINF_SUCCESS; + Log(("BusLogic: no driver attached to device %s\n", szName)); + } + else + { + AssertLogRelMsgFailed(("BusLogic: Failed to attach %s\n", szName)); + return rc; + } + } + + /* + * Attach status driver (optional). + */ + PPDMIBASE pBase; + rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBase, &pBase, "Status Port"); + if (RT_SUCCESS(rc)) + pThis->pLedsConnector = (PDMILEDCONNECTORS *)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS); + else if (rc != VERR_PDM_NO_ATTACHED_DRIVER) + { + AssertMsgFailed(("Failed to attach to status driver. rc=%Rrc\n", rc)); + return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic cannot attach to status driver")); + } + + rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, + BUSLOGIC_SAVED_STATE_MINOR_VERSION, sizeof(*pThis), + buslogicSaveLoadPrep, buslogicSaveExec, NULL, + buslogicSaveLoadPrep, buslogicLoadExec, NULL); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic cannot register save state handlers")); + + rc = buslogicHwReset(pThis); + AssertMsgRC(rc, ("hardware reset of BusLogic host adapter failed rc=%Rrc\n", rc)); + + return rc; +} + +/** + * The device registration structure. + */ +const PDMDEVREG g_DeviceBusLogic = +{ + /* u32Version */ + PDM_DEVREG_VERSION, + /* szDeviceName */ + "buslogic", + /* szRCMod */ + "VBoxDDGC.gc", + /* szR0Mod */ + "VBoxDDR0.r0", + /* pszDescription */ + "BusLogic BT-958 SCSI host adapter.\n", + /* fFlags */ + PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 + | PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION + | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, + /* fClass */ + PDM_DEVREG_CLASS_STORAGE, + /* cMaxInstances */ + ~0, + /* cbInstance */ + sizeof(BUSLOGIC), + /* pfnConstruct */ + buslogicConstruct, + /* pfnDestruct */ + buslogicDestruct, + /* pfnRelocate */ + buslogicRelocate, + /* pfnIOCtl */ + NULL, + /* pfnPowerOn */ + NULL, + /* pfnReset */ + buslogicReset, + /* pfnSuspend */ + buslogicSuspend, + /* pfnResume */ + NULL, + /* pfnAttach */ + buslogicAttach, + /* pfnDetach */ + buslogicDetach, + /* pfnQueryInterface. */ + NULL, + /* pfnInitComplete */ + NULL, + /* pfnPowerOff */ + NULL, + /* pfnSoftReset */ + NULL, + /* u32VersionEnd */ + PDM_DEVREG_VERSION +}; + +#endif /* IN_RING3 */ +#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ diff --git a/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp b/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp new file mode 100644 index 000000000..1ba98bffa --- /dev/null +++ b/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp @@ -0,0 +1,5487 @@ +/* $Id: DevLsiLogicSCSI.cpp $ */ +/** @file + * + * VBox storage devices: + * LsiLogic LSI53c1030 SCSI controller. + */ + +/* + * Copyright (C) 2006-2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +//#define DEBUG +#define LOG_GROUP LOG_GROUP_DEV_LSILOGICSCSI +#include <VBox/pdmdev.h> +#include <VBox/pdmqueue.h> +#include <VBox/pdmcritsect.h> +#include <VBox/scsi.h> +#include <iprt/assert.h> +#include <iprt/asm.h> +#include <iprt/string.h> +#ifdef IN_RING3 +# include <iprt/param.h> +# include <iprt/alloc.h> +# include <iprt/cache.h> +#endif + +#include "VBoxSCSI.h" + +#include "../Builtins.h" + +/* I/O port registered in the ISA compatible range to let the BIOS access + * the controller. + */ +#define LSILOGIC_ISA_IO_PORT 0x340 + +#define LSILOGIC_PORTS_MAX 1 +#define LSILOGIC_BUSES_MAX 1 +#define LSILOGIC_DEVICES_PER_BUS_MAX 16 + +#define LSILOGIC_DEVICES_MAX (LSILOGIC_BUSES_MAX*LSILOGIC_DEVICES_PER_BUS_MAX) + +#define LSILOGICSCSI_REQUEST_QUEUE_DEPTH_DEFAULT 1024 +#define LSILOGICSCSI_REPLY_QUEUE_DEPTH_DEFAULT 128 + +#define LSILOGICSCSI_MAXIMUM_CHAIN_DEPTH 3 + +#define LSILOGIC_NR_OF_ALLOWED_BIGGER_LISTS 100 + +#define LSILOGICSCSI_PCI_VENDOR_ID (0x1000) +#define LSILOGICSCSI_PCI_DEVICE_ID (0x0030) +#define LSILOGICSCSI_PCI_REVISION_ID (0x00) +#define LSILOGICSCSI_PCI_CLASS_CODE (0x01) +#define LSILOGICSCSI_PCI_SUBSYSTEM_VENDOR_ID (0x1000) +#define LSILOGICSCSI_PCI_SUBSYSTEM_ID (0x8000) + +#define LSILOGIC_SAVED_STATE_MINOR_VERSION 1 + +/** + * A simple SG element for a 64bit adress. + */ +#pragma pack(1) +typedef struct MptSGEntrySimple64 +{ + /** Length of the buffer this entry describes. */ + unsigned u24Length: 24; + /** Flag whether this element is the end of the list. */ + unsigned fEndOfList: 1; + /** Flag whether the address is 32bit or 64bits wide. */ + unsigned f64BitAddress: 1; + /** Flag whether this buffer contains data to be transfered or is the destination. */ + unsigned fBufferContainsData: 1; + /** Flag whether this is a local address or a system address. */ + unsigned fLocalAddress: 1; + /** Element type. */ + unsigned u2ElementType: 2; + /** Flag whether this is the last element of the buffer. */ + unsigned fEndOfBuffer: 1; + /** Flag whether this is the last element of the current segment. */ + unsigned fLastElement: 1; + /** Lower 32bits of the address of the data buffer. */ + unsigned u32DataBufferAddressLow: 32; + /** Upper 32bits of the address of the data buffer. */ + unsigned u32DataBufferAddressHigh: 32; +} MptSGEntrySimple64, *PMptSGEntrySimple64; +#pragma pack() +AssertCompileSize(MptSGEntrySimple64, 12); + +/** + * A simple SG element for a 32bit adress. + */ +#pragma pack(1) +typedef struct MptSGEntrySimple32 +{ + /** Length of the buffer this entry describes. */ + unsigned u24Length: 24; + /** Flag whether this element is the end of the list. */ + unsigned fEndOfList: 1; + /** Flag whether the address is 32bit or 64bits wide. */ + unsigned f64BitAddress: 1; + /** Flag whether this buffer contains data to be transfered or is the destination. */ + unsigned fBufferContainsData: 1; + /** Flag whether this is a local address or a system address. */ + unsigned fLocalAddress: 1; + /** Element type. */ + unsigned u2ElementType: 2; + /** Flag whether this is the last element of the buffer. */ + unsigned fEndOfBuffer: 1; + /** Flag whether this is the last element of the current segment. */ + unsigned fLastElement: 1; + /** Lower 32bits of the address of the data buffer. */ + unsigned u32DataBufferAddressLow: 32; +} MptSGEntrySimple32, *PMptSGEntrySimple32; +#pragma pack() +AssertCompileSize(MptSGEntrySimple32, 8); + +/** + * A chain SG element. + */ +#pragma pack(1) +typedef struct MptSGEntryChain +{ + /** Size of the segment. */ + unsigned u16Length: 16; + /** Offset in 32bit words of the next chain element in the segment + * identified by this element. */ + unsigned u8NextChainOffset: 8; + /** Reserved. */ + unsigned fReserved0: 1; + /** Flag whether the address is 32bit or 64bits wide. */ + unsigned f64BitAddress: 1; + /** Reserved. */ + unsigned fReserved1: 1; + /** Flag whether this is a local address or a system address. */ + unsigned fLocalAddress: 1; + /** Element type. */ + unsigned u2ElementType: 2; + /** Flag whether this is the last element of the buffer. */ + unsigned u2Reserved2: 2; + /** Lower 32bits of the address of the data buffer. */ + unsigned u32SegmentAddressLow: 32; + /** Upper 32bits of the address of the data buffer. */ + unsigned u32SegmentAddressHigh: 32; +} MptSGEntryChain, *PMptSGEntryChain; +#pragma pack() +AssertCompileSize(MptSGEntryChain, 12); + +typedef union MptSGEntryUnion +{ + MptSGEntrySimple64 Simple64; + MptSGEntrySimple32 Simple32; + MptSGEntryChain Chain; +} MptSGEntryUnion, *PMptSGEntryUnion; + +/** + * MPT Fusion message header - Common for all message frames. + * This is filled in by the guest. + */ +#pragma pack(1) +typedef struct MptMessageHdr +{ + /** Function dependent data. */ + uint16_t u16FunctionDependent; + /** Chain offset. */ + uint8_t u8ChainOffset; + /** The function code. */ + uint8_t u8Function; + /** Function dependent data. */ + uint8_t au8FunctionDependent[3]; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context - Unique ID from the guest unmodified by the device. */ + uint32_t u32MessageContext; +} MptMessageHdr, *PMptMessageHdr; +#pragma pack() +AssertCompileSize(MptMessageHdr, 12); + +/** Defined function codes found in the message header. */ +#define MPT_MESSAGE_HDR_FUNCTION_SCSI_IO_REQUEST (0x00) +#define MPT_MESSAGE_HDR_FUNCTION_SCSI_TASK_MGMT (0x01) +#define MPT_MESSAGE_HDR_FUNCTION_IOC_INIT (0x02) +#define MPT_MESSAGE_HDR_FUNCTION_IOC_FACTS (0x03) +#define MPT_MESSAGE_HDR_FUNCTION_CONFIG (0x04) +#define MPT_MESSAGE_HDR_FUNCTION_PORT_FACTS (0x05) +#define MPT_MESSAGE_HDR_FUNCTION_PORT_ENABLE (0x06) +#define MPT_MESSAGE_HDR_FUNCTION_EVENT_NOTIFICATION (0x07) +#define MPT_MESSAGE_HDR_FUNCTION_EVENT_ACK (0x08) +#define MPT_MESSAGE_HDR_FUNCTION_FW_DOWNLOAD (0x09) +#define MPT_MESSAGE_HDR_FUNCTION_TARGET_CMD_BUFFER_POST (0x0A) +#define MPT_MESSAGE_HDR_FUNCTION_TARGET_ASSIST (0x0B) +#define MPT_MESSAGE_HDR_FUNCTION_TARGET_STATUS_SEND (0x0C) +#define MPT_MESSAGE_HDR_FUNCTION_TARGET_MODE_ABORT (0x0D) + +#ifdef DEBUG +/** + * Function names + */ +static const char * const g_apszMPTFunctionNames[] = +{ + "SCSI I/O Request", + "SCSI Task Management", + "IOC Init", + "IOC Facts", + "Config", + "Port Facts", + "Port Enable", + "Event Notification", + "Event Ack", + "Firmware Download" +}; +#endif + +/** + * Default reply message. + * Send from the device to the guest upon completion of a request. + */ + #pragma pack(1) +typedef struct MptDefaultReplyMessage +{ + /** Function dependent data. */ + uint16_t u16FunctionDependent; + /** Length of the message in 32bit DWords. */ + uint8_t u8MessageLength; + /** Function which completed. */ + uint8_t u8Function; + /** Function dependent. */ + uint8_t au8FunctionDependent[3]; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context given in the request. */ + uint32_t u32MessageContext; + /** Function dependent status code. */ + uint16_t u16FunctionDependentStatus; + /** Status of the IOC. */ + uint16_t u16IOCStatus; + /** Additional log info. */ + uint32_t u32IOCLogInfo; +} MptDefaultReplyMessage, *PMptDefaultReplyMessage; +#pragma pack() +AssertCompileSize(MptDefaultReplyMessage, 20); + +/** + * IO controller init request. + */ +#pragma pack(1) +typedef struct MptIOCInitRequest +{ + /** Which system send this init request. */ + uint8_t u8WhoInit; + /** Reserved */ + uint8_t u8Reserved; + /** Chain offset in the SG list. */ + uint8_t u8ChainOffset; + /** Function to execute. */ + uint8_t u8Function; + /** Flags */ + uint8_t u8Flags; + /** Maximum number of devices the driver can handle. */ + uint8_t u8MaxDevices; + /** Maximum number of buses the driver can handle. */ + uint8_t u8MaxBuses; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; + /** Reply frame size. */ + uint16_t u16ReplyFrameSize; + /** Reserved */ + uint16_t u16Reserved; + /** Upper 32bit part of the 64bit address the message frames are in. + * That means all frames must be in the same 4GB segment. */ + uint32_t u32HostMfaHighAddr; + /** Upper 32bit of the sense buffer. */ + uint32_t u32SenseBufferHighAddr; +} MptIOCInitRequest, *PMptIOCInitRequest; +#pragma pack() +AssertCompileSize(MptIOCInitRequest, 24); + +/** + * IO controller init reply. + */ +#pragma pack(1) +typedef struct MptIOCInitReply +{ + /** Which subsystem send this init request. */ + uint8_t u8WhoInit; + /** Reserved */ + uint8_t u8Reserved; + /** Message length */ + uint8_t u8MessageLength; + /** Function. */ + uint8_t u8Function; + /** Flags */ + uint8_t u8Flags; + /** Maximum number of devices the driver can handle. */ + uint8_t u8MaxDevices; + /** Maximum number of busses the driver can handle. */ + uint8_t u8MaxBuses; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID */ + uint32_t u32MessageContext; + /** Reserved */ + uint16_t u16Reserved; + /** IO controller status. */ + uint16_t u16IOCStatus; + /** IO controller log information. */ + uint32_t u32IOCLogInfo; +} MptIOCInitReply, *PMptIOCInitReply; +#pragma pack() +AssertCompileSize(MptIOCInitReply, 20); + +/** + * IO controller facts request. + */ +#pragma pack(1) +typedef struct MptIOCFactsRequest +{ + /** Reserved. */ + uint16_t u16Reserved; + /** Chain offset in SG list. */ + uint8_t u8ChainOffset; + /** Function number. */ + uint8_t u8Function; + /** Reserved */ + uint8_t u8Reserved[3]; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; +} MptIOCFactsRequest, *PMptIOCFactsRequest; +#pragma pack() +AssertCompileSize(MptIOCFactsRequest, 12); + +/** + * IO controller facts reply. + */ +#pragma pack(1) +typedef struct MptIOCFactsReply +{ + /** Message version. */ + uint16_t u16MessageVersion; + /** Message length. */ + uint8_t u8MessageLength; + /** Function number. */ + uint8_t u8Function; + /** Reserved */ + uint16_t u16Reserved1; + /** IO controller number */ + uint8_t u8IOCNumber; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; + /** IO controller exceptions */ + uint16_t u16IOCExceptions; + /** IO controller status. */ + uint16_t u16IOCStatus; + /** IO controller log information. */ + uint32_t u32IOCLogInfo; + /** Maximum chain depth. */ + uint8_t u8MaxChainDepth; + /** The current value of the WhoInit field. */ + uint8_t u8WhoInit; + /** Block size. */ + uint8_t u8BlockSize; + /** Flags. */ + uint8_t u8Flags; + /** Depth of the reply queue. */ + uint16_t u16ReplyQueueDepth; + /** Size of a request frame. */ + uint16_t u16RequestFrameSize; + /** Reserved */ + uint16_t u16Reserved2; + /** Product ID. */ + uint16_t u16ProductID; + /** Current value of the high 32bit MFA address. */ + uint32_t u32CurrentHostMFAHighAddr; + /** Global credits - Number of entries allocated to queues */ + uint16_t u16GlobalCredits; + /** Number of ports on the IO controller */ + uint8_t u8NumberOfPorts; + /** Event state. */ + uint8_t u8EventState; + /** Current value of the high 32bit sense buffer address. */ + uint32_t u32CurrentSenseBufferHighAddr; + /** Current reply frame size. */ + uint16_t u16CurReplyFrameSize; + /** Maximum number of devices. */ + uint8_t u8MaxDevices; + /** Maximum number of buses. */ + uint8_t u8MaxBuses; + /** Size of the firmware image. */ + uint32_t u32FwImageSize; + /** Reserved. */ + uint32_t u32Reserved; + /** Firmware version */ + uint32_t u32FWVersion; +} MptIOCFactsReply, *PMptIOCFactsReply; +#pragma pack() +AssertCompileSize(MptIOCFactsReply, 60); + +/** + * Port facts request + */ +#pragma pack(1) +typedef struct MptPortFactsRequest +{ + /** Reserved */ + uint16_t u16Reserved1; + /** Message length. */ + uint8_t u8MessageLength; + /** Function number. */ + uint8_t u8Function; + /** Reserved */ + uint16_t u16Reserved2; + /** Port number to get facts for. */ + uint8_t u8PortNumber; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; +} MptPortFactsRequest, *PMptPortFactsRequest; +#pragma pack() +AssertCompileSize(MptPortFactsRequest, 12); + +/** + * Port facts reply. + */ +#pragma pack(1) +typedef struct MptPortFactsReply +{ + /** Reserved. */ + uint16_t u16Reserved1; + /** Message length. */ + uint8_t u8MessageLength; + /** Function number. */ + uint8_t u8Function; + /** Reserved */ + uint16_t u16Reserved2; + /** Port number the facts are for. */ + uint8_t u8PortNumber; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; + /** Reserved. */ + uint16_t u16Reserved3; + /** IO controller status. */ + uint16_t u16IOCStatus; + /** IO controller log information. */ + uint32_t u32IOCLogInfo; + /** Reserved */ + uint8_t u8Reserved; + /** Port type */ + uint8_t u8PortType; + /** Maximum number of devices on this port. */ + uint16_t u16MaxDevices; + /** SCSI ID of this port on the attached bus. */ + uint16_t u16PortSCSIID; + /** Protocol flags. */ + uint16_t u16ProtocolFlags; + /** Maxmimum number of target command buffers which can be posted to this port at a time. */ + uint16_t u16MaxPostedCmdBuffers; + /** Maximum number of target IDs that remain persistent between power/reset cycles. */ + uint16_t u16MaxPersistentIDs; + /** Maximum number of LAN buckets. */ + uint16_t u16MaxLANBuckets; + /** Reserved. */ + uint16_t u16Reserved4; + /** Reserved. */ + uint32_t u32Reserved; +} MptPortFactsReply, *PMptPortFactsReply; +#pragma pack() +AssertCompileSize(MptPortFactsReply, 40); + +/** + * Port Enable request. + */ +#pragma pack(1) +typedef struct MptPortEnableRequest +{ + /** Reserved. */ + uint16_t u16Reserved1; + /** Message length. */ + uint8_t u8MessageLength; + /** Function number. */ + uint8_t u8Function; + /** Reserved. */ + uint16_t u16Reserved2; + /** Port number to enable. */ + uint8_t u8PortNumber; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; +} MptPortEnableRequest, *PMptPortEnableRequest; +#pragma pack() +AssertCompileSize(MptPortEnableRequest, 12); + +/** + * Port enable reply. + */ +#pragma pack(1) +typedef struct MptPortEnableReply +{ + /** Reserved. */ + uint16_t u16Reserved1; + /** Message length. */ + uint8_t u8MessageLength; + /** Function number. */ + uint8_t u8Function; + /** Reserved */ + uint16_t u16Reserved2; + /** Port number which was enabled. */ + uint8_t u8PortNumber; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; + /** Reserved. */ + uint16_t u16Reserved3; + /** IO controller status */ + uint16_t u16IOCStatus; + /** IO controller log information. */ + uint32_t u32IOCLogInfo; +} MptPortEnableReply, *PMptPortEnableReply; +#pragma pack() +AssertCompileSize(MptPortEnableReply, 20); + +/** + * Event notification request. + */ +#pragma pack(1) +typedef struct MptEventNotificationRequest +{ + /** Switch - Turns event notification on and off. */ + uint8_t u8Switch; + /** Reserved. */ + uint8_t u8Reserved1; + /** Chain offset. */ + uint8_t u8ChainOffset; + /** Function number. */ + uint8_t u8Function; + /** Reserved. */ + uint8_t u8reserved2[3]; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; +} MptEventNotificationRequest, *PMptEventNotificationRequest; +#pragma pack() +AssertCompileSize(MptEventNotificationRequest, 12); + +/** + * Event notification reply. + */ +#pragma pack(1) +typedef struct MptEventNotificationReply +{ + /** Event data length. */ + uint16_t u16EventDataLength; + /** Message length. */ + uint8_t u8MessageLength; + /** Function number. */ + uint8_t u8Function; + /** Reserved. */ + uint16_t u16Reserved1; + /** Ack required. */ + uint8_t u8AckRequired; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; + /** Reserved. */ + uint16_t u16Reserved2; + /** IO controller status. */ + uint16_t u16IOCStatus; + /** IO controller log information. */ + uint32_t u32IOCLogInfo; + /** Notification event. */ + uint32_t u32Event; + /** Event context. */ + uint32_t u32EventContext; + /** Event data. */ + uint32_t u32EventData; +} MptEventNotificationReply, *PMptEventNotificationReply; +#pragma pack() +AssertCompileSize(MptEventNotificationReply, 32); + +#define MPT_EVENT_EVENT_CHANGE (0x0000000a) + +/** + * SCSI IO Request + */ +#pragma pack(1) +typedef struct MptSCSIIORequest +{ + /** Target ID */ + uint8_t u8TargetID; + /** Bus number */ + uint8_t u8Bus; + /** Chain offset */ + uint8_t u8ChainOffset; + /** Function number. */ + uint8_t u8Function; + /** CDB length. */ + uint8_t u8CDBLength; + /** Sense buffer length. */ + uint8_t u8SenseBufferLength; + /** Rserved */ + uint8_t u8Reserved; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; + /** LUN */ + uint8_t au8LUN[8]; + /** Control values. */ + uint32_t u32Control; + /** The CDB. */ + uint8_t au8CDB[16]; + /** Data length. */ + uint32_t u32DataLength; + /** Sense buffer low 32bit address. */ + uint32_t u32SenseBufferLowAddress; +} MptSCSIIORequest, *PMptSCSIIORequest; +#pragma pack() +AssertCompileSize(MptSCSIIORequest, 48); + +#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_GET(x) (((x) & 0x3000000) >> 24) +#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_NONE (0x0) +#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_WRITE (0x1) +#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_READ (0x2) + +/** + * SCSI IO error reply. + */ +#pragma pack(1) +typedef struct MptSCSIIOErrorReply +{ + /** Target ID */ + uint8_t u8TargetID; + /** Bus number */ + uint8_t u8Bus; + /** Message length. */ + uint8_t u8MessageLength; + /** Function number. */ + uint8_t u8Function; + /** CDB length */ + uint8_t u8CDBLength; + /** Sense buffer length */ + uint8_t u8SenseBufferLength; + /** Reserved */ + uint8_t u8Reserved; + /** Message flags */ + uint8_t u8MessageFlags; + /** Message context ID */ + uint32_t u32MessageContext; + /** SCSI status. */ + uint8_t u8SCSIStatus; + /** SCSI state */ + uint8_t u8SCSIState; + /** IO controller status */ + uint16_t u16IOCStatus; + /** IO controller log information */ + uint32_t u32IOCLogInfo; + /** Transfer count */ + uint32_t u32TransferCount; + /** Sense count */ + uint32_t u32SenseCount; + /** Response information */ + uint32_t u32ResponseInfo; +} MptSCSIIOErrorReply, *PMptSCSIIOErrorReply; +#pragma pack() +AssertCompileSize(MptSCSIIOErrorReply, 32); + +#define MPT_SCSI_IO_ERROR_SCSI_STATE_AUTOSENSE_VALID (0x01) +#define MPT_SCSI_IO_ERROR_SCSI_STATE_TERMINATED (0x08) + +/** + * IOC status codes sepcific to the SCSI I/O error reply. + */ +#define MPT_SCSI_IO_ERROR_IOCSTATUS_INVALID_BUS (0x0041) +#define MPT_SCSI_IO_ERROR_IOCSTATUS_INVALID_TARGETID (0x0042) +#define MPT_SCSI_IO_ERROR_IOCSTATUS_DEVICE_NOT_THERE (0x0043) + +/** + * SCSI task management request. + */ +#pragma pack(1) +typedef struct MptSCSITaskManagementRequest +{ + /** Target ID */ + uint8_t u8TargetID; + /** Bus number */ + uint8_t u8Bus; + /** Chain offset */ + uint8_t u8ChainOffset; + /** Function number */ + uint8_t u8Function; + /** Reserved */ + uint8_t u8Reserved1; + /** Task type */ + uint8_t u8TaskType; + /** Reserved */ + uint8_t u8Reserved2; + /** Message flags */ + uint8_t u8MessageFlags; + /** Message context ID */ + uint32_t u32MessageContext; + /** LUN */ + uint8_t au8LUN[8]; + /** Reserved */ + uint8_t auReserved[28]; + /** Task message context ID. */ + uint32_t u32TaskMessageContext; +} MptSCSITaskManagementRequest, *PMptSCSITaskManagementRequest; +#pragma pack() +AssertCompileSize(MptSCSITaskManagementRequest, 52); + +/** + * SCSI task management reply. + */ +#pragma pack(1) +typedef struct MptSCSITaskManagementReply +{ + /** Target ID */ + uint8_t u8TargetID; + /** Bus number */ + uint8_t u8Bus; + /** Message length */ + uint8_t u8MessageLength; + /** Function number */ + uint8_t u8Function; + /** Reserved */ + uint8_t u8Reserved1; + /** Task type */ + uint8_t u8TaskType; + /** Reserved */ + uint8_t u8Reserved2; + /** Message flags */ + uint8_t u8MessageFlags; + /** Message context ID */ + uint32_t u32MessageContext; + /** Reserved */ + uint16_t u16Reserved; + /** IO controller status */ + uint16_t u16IOCStatus; + /** IO controller log information */ + uint32_t u32IOCLogInfo; + /** Termination count */ + uint32_t u32TerminationCount; +} MptSCSITaskManagementReply, *PMptSCSITaskManagementReply; +#pragma pack() +AssertCompileSize(MptSCSITaskManagementReply, 24); + +/** + * Configuration request + */ +#pragma pack(1) +typedef struct MptConfigurationRequest +{ + /** Action code. */ + uint8_t u8Action; + /** Reserved. */ + uint8_t u8Reserved1; + /** Chain offset. */ + uint8_t u8ChainOffset; + /** Function number. */ + uint8_t u8Function; + /** Reserved. */ + uint8_t u8Reserved2[3]; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; + /** Reserved. */ + uint8_t u8Reserved3[8]; + /** Version number of the page. */ + uint8_t u8PageVersion; + /** Length of the page in 32bit Dwords. */ + uint8_t u8PageLength; + /** Page number to access. */ + uint8_t u8PageNumber; + /** Type of the page beeing accessed. */ + uint8_t u8PageType; + /** Page type dependent address. */ + union + { + /** 32bit view. */ + uint32_t u32PageAddress; + struct + { + /** Port number to get the configuration page for. */ + uint8_t u8PortNumber; + /** Reserved. */ + uint8_t u8Reserved[3]; + } MPIPortNumber; + struct + { + /** Target ID to get the configuration page for. */ + uint8_t u8TargetID; + /** Bus number to get the configuration page for. */ + uint8_t u8Bus; + /** Reserved. */ + uint8_t u8Reserved[2]; + } BusAndTargetId; + } u; + MptSGEntrySimple64 SimpleSGElement; +} MptConfigurationRequest, *PMptConfigurationRequest; +#pragma pack() +AssertCompileSize(MptConfigurationRequest, 40); + +/** Possible action codes. */ +#define MPT_CONFIGURATION_REQUEST_ACTION_HEADER (0x00) +#define MPT_CONFIGURATION_REQUEST_ACTION_READ_CURRENT (0x01) +#define MPT_CONFIGURATION_REQUEST_ACTION_WRITE_CURRENT (0x02) +#define MPT_CONFIGURATION_REQUEST_ACTION_READ_DEFAULT (0x03) +#define MPT_CONFIGURATION_REQUEST_ACTION_DEFAULT (0x04) +#define MPT_CONFIGURATION_REQUEST_ACTION_READ_NVRAM (0x05) +#define MPT_CONFIGURATION_REQUEST_ACTION_WRITE_NVRAM (0x06) + +/** Page type codes. */ +#define MPT_CONFIGURATION_REQUEST_PAGE_TYPE_IO_UNIT (0x00) +#define MPT_CONFIGURATION_REQUEST_PAGE_TYPE_IOC (0x01) +#define MPT_CONFIGURATION_REQUEST_PAGE_TYPE_BIOS (0x02) +#define MPT_CONFIGURATION_REQUEST_PAGE_TYPE_SCSI_PORT (0x03) + +/** + * Configuration reply. + */ +#pragma pack(1) +typedef struct MptConfigurationReply +{ + /** Action code. */ + uint8_t u8Action; + /** Reserved. */ + uint8_t u8Reserved; + /** Message length. */ + uint8_t u8MessageLength; + /** Function number. */ + uint8_t u8Function; + /** Reserved. */ + uint8_t u8Reserved2[3]; + /** Message flags. */ + uint8_t u8MessageFlags; + /** Message context ID. */ + uint32_t u32MessageContext; + /** Reserved. */ + uint16_t u16Reserved; + /** I/O controller status. */ + uint16_t u16IOCStatus; + /** I/O controller log information. */ + uint32_t u32IOCLogInfo; + /** Version number of the page. */ + uint8_t u8PageVersion; + /** Length of the page in 32bit Dwords. */ + uint8_t u8PageLength; + /** Page number to access. */ + uint8_t u8PageNumber; + /** Type of the page beeing accessed. */ + uint8_t u8PageType; +} MptConfigurationReply, *PMptConfigurationReply; +#pragma pack() +AssertCompileSize(MptConfigurationReply, 24); + +/** Additional I/O controller status codes for the configuration reply. */ +#define MPT_IOCSTATUS_CONFIG_INVALID_ACTION (0x0020) +#define MPT_IOCSTATUS_CONFIG_INVALID_TYPE (0x0021) +#define MPT_IOCSTATUS_CONFIG_INVALID_PAGE (0x0022) +#define MPT_IOCSTATUS_CONFIG_INVALID_DATA (0x0023) +#define MPT_IOCSTATUS_CONFIG_NO_DEFAULTS (0x0024) +#define MPT_IOCSTATUS_CONFIG_CANT_COMMIT (0x0025) + +/** + * Union of all possible request messages. + */ +typedef union MptRequestUnion +{ + MptMessageHdr Header; + MptIOCInitRequest IOCInit; + MptIOCFactsRequest IOCFacts; + MptPortFactsRequest PortFacts; + MptPortEnableRequest PortEnable; + MptEventNotificationRequest EventNotification; + MptSCSIIORequest SCSIIO; + MptSCSITaskManagementRequest SCSITaskManagement; + MptConfigurationRequest Configuration; +} MptRequestUnion, *PMptRequestUnion; + +/** + * Union of all possible reply messages. + */ +typedef union MptReplyUnion +{ + /** 16bit view. */ + uint16_t au16Reply[30]; + MptDefaultReplyMessage Header; + MptIOCInitReply IOCInit; + MptIOCFactsReply IOCFacts; + MptPortFactsReply PortFacts; + MptPortEnableReply PortEnable; + MptEventNotificationReply EventNotification; + MptSCSIIOErrorReply SCSIIOError; + MptSCSITaskManagementReply SCSITaskManagement; + MptConfigurationReply Configuration; +} MptReplyUnion, *PMptReplyUnion; + + +/** + * Configuration Page attributes. + */ +#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY (0x00) +#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_CHANGEABLE (0x10) +#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT (0x20) +#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT_READONLY (0x30) + +#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_GET(u8PageType) ((u8PageType) & 0xf0) + +/** + * Configuration Page types. + */ +#define MPT_CONFIGURATION_PAGE_TYPE_IO_UNIT (0x00) +#define MPT_CONFIGURATION_PAGE_TYPE_IOC (0x01) +#define MPT_CONFIGURATION_PAGE_TYPE_BIOS (0x02) +#define MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_PORT (0x03) +#define MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_DEVICE (0x04) +#define MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING (0x09) + +#define MPT_CONFIGURATION_PAGE_TYPE_GET(u8PageType) ((u8PageType) & 0x0f) + +/** + * Configuration Page header - Common to all pages. + */ +#pragma pack(1) +typedef struct MptConfigurationPageHeader +{ + /** Version of the page. */ + uint8_t u8PageVersion; + /** The length of the page in 32bit D-Words. */ + uint8_t u8PageLength; + /** Number of the page. */ + uint8_t u8PageNumber; + /** Type of the page. */ + uint8_t u8PageType; +} MptConfigurationPageHeader, *PMptConfigurationPageHeader; +#pragma pack() +AssertCompileSize(MptConfigurationPageHeader, 4); + +/** + * Manufacturing page 0. - Readonly. + */ +#pragma pack(1) +typedef struct MptConfigurationPageManufacturing0 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[76]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Name of the chip. */ + uint8_t abChipName[16]; + /** Chip revision. */ + uint8_t abChipRevision[8]; + /** Board name. */ + uint8_t abBoardName[16]; + /** Board assembly. */ + uint8_t abBoardAssembly[16]; + /** Board tracer number. */ + uint8_t abBoardTracerNumber[16]; + } fields; + } u; +} MptConfigurationPageManufacturing0, *PMptConfigurationPageManufacturing0; +#pragma pack() +AssertCompileSize(MptConfigurationPageManufacturing0, 76); + +/** + * Manufacturing page 1. - Readonly Persistent. + */ +#pragma pack(1) +typedef struct MptConfigurationPageManufacturing1 +{ + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** VPD info - don't know what belongs here so all zero. */ + uint8_t abVPDInfo[256]; +} MptConfigurationPageManufacturing1, *PMptConfigurationPageManufacturing1; +#pragma pack() +AssertCompileSize(MptConfigurationPageManufacturing1, 260); + +/** + * Manufacturing page 2. - Readonly. + */ +#pragma pack(1) +typedef struct MptConfigurationPageManufacturing2 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[8]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** PCI Device ID. */ + uint16_t u16PCIDeviceID; + /** PCI Revision ID. */ + uint8_t u8PCIRevisionID; + /** Reserved. */ + uint8_t u8Reserved; + /** Hardware specific settings... */ + } fields; + } u; +} MptConfigurationPageManufacturing2, *PMptConfigurationPageManufacturing2; +#pragma pack() +AssertCompileSize(MptConfigurationPageManufacturing2, 8); + +/** + * Manufacturing page 3. - Readonly. + */ +#pragma pack(1) +typedef struct MptConfigurationPageManufacturing3 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[8]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** PCI Device ID. */ + uint16_t u16PCIDeviceID; + /** PCI Revision ID. */ + uint8_t u8PCIRevisionID; + /** Reserved. */ + uint8_t u8Reserved; + /** Chip specific settings... */ + } fields; + } u; +} MptConfigurationPageManufacturing3, *PMptConfigurationPageManufacturing3; +#pragma pack() +AssertCompileSize(MptConfigurationPageManufacturing3, 8); + +/** + * Manufacturing page 4. - Readonly. + */ +#pragma pack(1) +typedef struct MptConfigurationPageManufacturing4 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[84]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Reserved. */ + uint32_t u32Reserved; + /** InfoOffset0. */ + uint8_t u8InfoOffset0; + /** Info size. */ + uint8_t u8InfoSize0; + /** InfoOffset1. */ + uint8_t u8InfoOffset1; + /** Info size. */ + uint8_t u8InfoSize1; + /** Size of the inquiry data. */ + uint8_t u8InquirySize; + /** Reserved. */ + uint8_t abReserved[3]; + /** Inquiry data. */ + uint8_t abInquiryData[56]; + /** IS volume settings. */ + uint32_t u32ISVolumeSettings; + /** IME volume settings. */ + uint32_t u32IMEVolumeSettings; + /** IM volume settings. */ + uint32_t u32IMVolumeSettings; + } fields; + } u; +} MptConfigurationPageManufacturing4, *PMptConfigurationPageManufacturing4; +#pragma pack() +AssertCompileSize(MptConfigurationPageManufacturing4, 84); + +/** + * IO Unit page 0. - Readonly. + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOUnit0 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[12]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** A unique identifier. */ + uint64_t u64UniqueIdentifier; + } fields; + } u; +} MptConfigurationPageIOUnit0, *PMptConfigurationPageIOUnit0; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOUnit0, 12); + +/** + * IO Unit page 1. - Read/Write. + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOUnit1 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[8]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Flag whether this is a single function PCI device. */ + unsigned fSingleFunction: 1; + /** Flag whether all possible paths to a device are mapped. */ + unsigned fAllPathsMapped: 1; + /** Reserved. */ + unsigned u4Reserved: 4; + /** Flag whether all RAID functionality is disabled. */ + unsigned fIntegratedRAIDDisabled: 1; + /** Flag whether 32bit PCI accesses are forced. */ + unsigned f32BitAccessForced: 1; + /** Reserved. */ + unsigned abReserved: 24; + } fields; + } u; +} MptConfigurationPageIOUnit1, *PMptConfigurationPageIOUnit1; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOUnit1, 8); + +/** + * Adapter Ordering. + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOUnit2AdapterOrdering +{ + /** PCI bus number. */ + unsigned u8PCIBusNumber: 8; + /** PCI device and function number. */ + unsigned u8PCIDevFn: 8; + /** Flag whether the adapter is embedded. */ + unsigned fAdapterEmbedded: 1; + /** Flag whether the adapter is enabled. */ + unsigned fAdapterEnabled: 1; + /** Reserved. */ + unsigned u6Reserved: 6; + /** Reserved. */ + unsigned u8Reserved: 8; +} MptConfigurationPageIOUnit2AdapterOrdering, *PMptConfigurationPageIOUnit2AdapterOrdering; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOUnit2AdapterOrdering, 4); + +/** + * IO Unit page 2. - Read/Write. + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOUnit2 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[28]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Reserved. */ + unsigned fReserved: 1; + /** Flag whether Pause on error is enabled. */ + unsigned fPauseOnError: 1; + /** Flag whether verbose mode is enabled. */ + unsigned fVerboseModeEnabled: 1; + /** Set to disable color video. */ + unsigned fDisableColorVideo: 1; + /** Flag whether int 40h is hooked. */ + unsigned fNotHookInt40h: 1; + /** Reserved. */ + unsigned u3Reserved: 3; + /** Reserved. */ + unsigned abReserved: 24; + /** BIOS version. */ + uint32_t u32BIOSVersion; + /** Adapter ordering. */ + MptConfigurationPageIOUnit2AdapterOrdering aAdapterOrder[4]; + } fields; + } u; +} MptConfigurationPageIOUnit2, *PMptConfigurationPageIOUnit2; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOUnit2, 28); + +/* + * IO Unit page 3. - Read/Write. + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOUnit3 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[8]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Number of GPIO values. */ + uint8_t u8GPIOCount; + /** Reserved. */ + uint8_t abReserved[3]; + } fields; + } u; +} MptConfigurationPageIOUnit3, *PMptConfigurationPageIOUnit3; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOUnit3, 8); + +/** + * IOC page 0. - Readonly + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOC0 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[28]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Total ammount of NV memory in bytes. */ + uint32_t u32TotalNVStore; + /** Number of free bytes in the NV store. */ + uint32_t u32FreeNVStore; + /** PCI vendor ID. */ + uint16_t u16VendorId; + /** PCI device ID. */ + uint16_t u16DeviceId; + /** PCI revision ID. */ + uint8_t u8RevisionId; + /** Reserved. */ + uint8_t abReserved[3]; + /** PCI class code. */ + uint32_t u32ClassCode; + /** Subsystem vendor Id. */ + uint16_t u16SubsystemVendorId; + /** Subsystem Id. */ + uint16_t u16SubsystemId; + } fields; + } u; +} MptConfigurationPageIOC0, *PMptConfigurationPageIOC0; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOC0, 28); + +/** + * IOC page 1. - Read/Write + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOC1 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[16]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Flag whether reply coalescing is enabled. */ + unsigned fReplyCoalescingEnabled: 1; + /** Reserved. */ + unsigned u31Reserved: 31; + /** Coalescing Timeout in microseconds. */ + unsigned u32CoalescingTimeout: 32; + /** Coalescing depth. */ + unsigned u8CoalescingDepth: 8; + /** Reserved. */ + unsigned u8Reserved0: 8; + unsigned u8Reserved1: 8; + unsigned u8Reserved2: 8; + } fields; + } u; +} MptConfigurationPageIOC1, *PMptConfigurationPageIOC1; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOC1, 16); + +/** + * IOC page 2. - Readonly + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOC2 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[12]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Flag whether striping is supported. */ + unsigned fStripingSupported: 1; + /** Flag whether enhanced mirroring is supported. */ + unsigned fEnhancedMirroringSupported: 1; + /** Flag whether mirroring is supported. */ + unsigned fMirroringSupported: 1; + /** Reserved. */ + unsigned u26Reserved: 26; + /** Flag whether SES is supported. */ + unsigned fSESSupported: 1; + /** Flag whether SAF-TE is supported. */ + unsigned fSAFTESupported: 1; + /** Flag whether cross channel volumes are supported. */ + unsigned fCrossChannelVolumesSupported: 1; + /** Number of active integrated RAID volumes. */ + unsigned u8NumActiveVolumes: 8; + /** Maximum number of integrated RAID volumes supported. */ + unsigned u8MaxVolumes: 8; + /** Number of active integrated RAID physical disks. */ + unsigned u8NumActivePhysDisks: 8; + /** Maximum number of integrated RAID physical disks supported. */ + unsigned u8MaxPhysDisks: 8; + /** RAID volumes... - not supported. */ + } fields; + } u; +} MptConfigurationPageIOC2, *PMptConfigurationPageIOC2; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOC2, 12); + +/** + * IOC page 3. - Readonly + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOC3 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[8]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Number of active integrated RAID physical disks. */ + uint8_t u8NumPhysDisks; + /** Reserved. */ + uint8_t abReserved[3]; + } fields; + } u; +} MptConfigurationPageIOC3, *PMptConfigurationPageIOC3; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOC3, 8); + +/** + * IOC page 4. - Read/Write + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOC4 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[8]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Number of SEP entries in this page. */ + uint8_t u8ActiveSEP; + /** Maximum number of SEp entries supported. */ + uint8_t u8MaxSEP; + /** Reserved. */ + uint16_t u16Reserved; + /** SEP entries... - not supported. */ + } fields; + } u; +} MptConfigurationPageIOC4, *PMptConfigurationPageIOC4; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOC4, 8); + +/** + * IOC page 6. - Read/Write + */ +#pragma pack(1) +typedef struct MptConfigurationPageIOC6 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[60]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + uint32_t u32CapabilitiesFlags; + uint8_t u8MaxDrivesIS; + uint8_t u8MaxDrivesIM; + uint8_t u8MaxDrivesIME; + uint8_t u8Reserved1; + uint8_t u8MinDrivesIS; + uint8_t u8MinDrivesIM; + uint8_t u8MinDrivesIME; + uint8_t u8Reserved2; + uint8_t u8MaxGlobalHotSpares; + uint8_t u8Reserved3; + uint16_t u16Reserved4; + uint32_t u32Reserved5; + uint32_t u32SupportedStripeSizeMapIS; + uint32_t u32SupportedStripeSizeMapIME; + uint32_t u32Reserved6; + uint8_t u8MetadataSize; + uint8_t u8Reserved7; + uint16_t u16Reserved8; + uint16_t u16MaxBadBlockTableEntries; + uint16_t u16Reserved9; + uint16_t u16IRNvsramUsage; + uint16_t u16Reserved10; + uint32_t u32IRNvsramVersion; + uint32_t u32Reserved11; + } fields; + } u; +} MptConfigurationPageIOC6, *PMptConfigurationPageIOC6; +#pragma pack() +AssertCompileSize(MptConfigurationPageIOC6, 60); + +/** + * SCSI-SPI port page 0. - Readonly + */ +#pragma pack(1) +typedef struct MptConfigurationPageSCSISPIPort0 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[12]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Flag whether this port is information unit trnafsers capable. */ + unsigned fInformationUnitTransfersCapable: 1; + /** Flag whether the port is DT (Dual Transfer) capable. */ + unsigned fDTCapable: 1; + /** Flag whether the port is QAS (Quick Arbitrate and Select) capable. */ + unsigned fQASCapable: 1; + /** Reserved. */ + unsigned u5Reserved1: 5; + /** Minimum Synchronous transfer period. */ + unsigned u8MinimumSynchronousTransferPeriod: 8; + /** Maximum synchronous offset. */ + unsigned u8MaximumSynchronousOffset: 8; + /** Reserved. */ + unsigned u5Reserved2: 5; + /** Flag whether indicating the width of the bus - 0 narrow and 1 for wide. */ + unsigned fWide: 1; + /** Reserved */ + unsigned fReserved: 1; + /** Flag whether the port is AIP (Asynchronous Information Protection) capable. */ + unsigned fAIPCapable: 1; + /** Signaling Type. */ + unsigned u2SignalingType: 2; + /** Reserved. */ + unsigned u30Reserved: 30; + } fields; + } u; +} MptConfigurationPageSCSISPIPort0, *PMptConfigurationPageSCSISPIPort0; +#pragma pack() +AssertCompileSize(MptConfigurationPageSCSISPIPort0, 12); + +/** + * SCSI-SPI port page 1. - Read/Write + */ +#pragma pack(1) +typedef struct MptConfigurationPageSCSISPIPort1 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[12]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** The SCSI ID of the port. */ + uint8_t u8SCSIID; + /** Reserved. */ + uint8_t u8Reserved; + /** Port response IDs Bit mask field. */ + uint16_t u16PortResponseIDsBitmask; + /** Value for the on BUS timer. */ + uint32_t u32OnBusTimerValue; + } fields; + } u; +} MptConfigurationPageSCSISPIPort1, *PMptConfigurationPageSCSISPIPort1; +#pragma pack() +AssertCompileSize(MptConfigurationPageSCSISPIPort1, 12); + +/** + * Device settings for one device. + */ +#pragma pack(1) +typedef struct MptDeviceSettings +{ + /** Timeout for I/O in seconds. */ + unsigned u8Timeout: 8; + /** Minimum synchronous factor. */ + unsigned u8SyncFactor: 8; + /** Flag whether disconnect is enabled. */ + unsigned fDisconnectEnable: 1; + /** Flag whether Scan ID is enabled. */ + unsigned fScanIDEnable: 1; + /** Flag whether Scan LUNs is enabled. */ + unsigned fScanLUNEnable: 1; + /** Flag whether tagged queuing is enabled. */ + unsigned fTaggedQueuingEnabled: 1; + /** Flag whether wide is enabled. */ + unsigned fWideDisable: 1; + /** Flag whether this device is bootable. */ + unsigned fBootChoice: 1; + /** Reserved. */ + unsigned u10Reserved: 10; +} MptDeviceSettings, *PMptDeviceSettings; +#pragma pack() +AssertCompileSize(MptDeviceSettings, 4); + +/** + * SCSI-SPI port page 2. - Read/Write for the BIOS + */ +#pragma pack(1) +typedef struct MptConfigurationPageSCSISPIPort2 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[76]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Flag indicating the bus scan order. */ + unsigned fBusScanOrderHighToLow: 1; + /** Reserved. */ + unsigned fReserved: 1; + /** Flag whether SCSI Bus resets are avoided. */ + unsigned fAvoidSCSIBusResets: 1; + /** Flag whether alternate CHS is used. */ + unsigned fAlternateCHS: 1; + /** Flag whether termination is disabled. */ + unsigned fTerminationDisabled: 1; + /** Reserved. */ + unsigned u27Reserved: 27; + /** Host SCSI ID. */ + unsigned u4HostSCSIID: 4; + /** Initialize HBA. */ + unsigned u2InitializeHBA: 2; + /** Removeable media setting. */ + unsigned u2RemovableMediaSetting: 2; + /** Spinup delay. */ + unsigned u4SpinupDelay: 4; + /** Negotiating settings. */ + unsigned u2NegotitatingSettings: 2; + /** Reserved. */ + unsigned u18Reserved: 18; + /** Device Settings. */ + MptDeviceSettings aDeviceSettings[16]; + } fields; + } u; +} MptConfigurationPageSCSISPIPort2, *PMptConfigurationPageSCSISPIPort2; +#pragma pack() +AssertCompileSize(MptConfigurationPageSCSISPIPort2, 76); + +/** + * SCSI-SPI device page 0. - Readonly + */ +#pragma pack(1) +typedef struct MptConfigurationPageSCSISPIDevice0 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[12]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Negotiated Parameters. */ + /** Information Units enabled. */ + unsigned fInformationUnitsEnabled: 1; + /** Dual Transfers Enabled. */ + unsigned fDTEnabled: 1; + /** QAS enabled. */ + unsigned fQASEnabled: 1; + /** Reserved. */ + unsigned u5Reserved1: 5; + /** Synchronous Transfer period. */ + unsigned u8NegotiatedSynchronousTransferPeriod: 8; + /** Synchronous offset. */ + unsigned u8NegotiatedSynchronousOffset: 8; + /** Reserved. */ + unsigned u5Reserved2: 5; + /** Width - 0 for narrow and 1 for wide. */ + unsigned fWide: 1; + /** Reserved. */ + unsigned fReserved: 1; + /** AIP enabled. */ + unsigned fAIPEnabled: 1; + /** Flag whether negotiation occurred. */ + unsigned fNegotationOccured: 1; + /** Flag whether a SDTR message was rejected. */ + unsigned fSDTRRejected: 1; + /** Flag whether a WDTR message was rejected. */ + unsigned fWDTRRejected: 1; + /** Flag whether a PPR message was rejected. */ + unsigned fPPRRejected: 1; + /** Reserved. */ + unsigned u28Reserved: 28; + } fields; + } u; +} MptConfigurationPageSCSISPIDevice0, *PMptConfigurationPageSCSISPIDevice0; +#pragma pack() +AssertCompileSize(MptConfigurationPageSCSISPIDevice0, 12); + +/** + * SCSI-SPI device page 1. - Read/Write + */ +#pragma pack(1) +typedef struct MptConfigurationPageSCSISPIDevice1 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[16]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Requested Parameters. */ + /** Information Units enable. */ + bool fInformationUnitsEnable: 1; + /** Dual Transfers Enable. */ + bool fDTEnable: 1; + /** QAS enable. */ + bool fQASEnable: 1; + /** Reserved. */ + unsigned u5Reserved1: 5; + /** Synchronous Transfer period. */ + unsigned u8NegotiatedSynchronousTransferPeriod: 8; + /** Synchronous offset. */ + unsigned u8NegotiatedSynchronousOffset: 8; + /** Reserved. */ + unsigned u5Reserved2: 5; + /** Width - 0 for narrow and 1 for wide. */ + bool fWide: 1; + /** Reserved. */ + bool fReserved1: 1; + /** AIP enable. */ + bool fAIPEnable: 1; + /** Reserved. */ + bool fReserved2: 1; + /** WDTR disallowed. */ + bool fWDTRDisallowed: 1; + /** SDTR disallowed. */ + bool fSDTRDisallowed: 1; + /** Reserved. */ + unsigned u29Reserved: 29; + } fields; + } u; +} MptConfigurationPageSCSISPIDevice1, *PMptConfigurationPageSCSISPIDevice1; +#pragma pack() +AssertCompileSize(MptConfigurationPageSCSISPIDevice1, 16); + +/** + * SCSI-SPI device page 2. - Read/Write + */ +#pragma pack(1) +typedef struct MptConfigurationPageSCSISPIDevice2 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[16]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Reserved. */ + unsigned u4Reserved: 4; + /** ISI enable. */ + unsigned fISIEnable: 1; + /** Secondary driver enable. */ + unsigned fSecondaryDriverEnable: 1; + /** Reserved. */ + unsigned fReserved: 1; + /** Slew reate controler. */ + unsigned u3SlewRateControler: 3; + /** Primary drive strength controler. */ + unsigned u3PrimaryDriveStrengthControl: 3; + /** Secondary drive strength controler. */ + unsigned u3SecondaryDriveStrengthControl: 3; + /** Reserved. */ + unsigned u12Reserved: 12; + /** XCLKH_ST. */ + unsigned fXCLKH_ST: 1; + /** XCLKS_ST. */ + unsigned fXCLKS_ST: 1; + /** XCLKH_DT. */ + unsigned fXCLKH_DT: 1; + /** XCLKS_DT. */ + unsigned fXCLKS_DT: 1; + /** Parity pipe select. */ + unsigned u2ParityPipeSelect: 2; + /** Reserved. */ + unsigned u30Reserved: 30; + /** Data bit pipeline select. */ + unsigned u32DataPipelineSelect: 32; + } fields; + } u; +} MptConfigurationPageSCSISPIDevice2, *PMptConfigurationPageSCSISPIDevice2; +#pragma pack() +AssertCompileSize(MptConfigurationPageSCSISPIDevice2, 16); + +/** + * SCSI-SPI device page 3 (Revision G). - Readonly + */ +#pragma pack(1) +typedef struct MptConfigurationPageSCSISPIDevice3 +{ + /** Union. */ + union + { + /** Byte view. */ + uint8_t abPageData[12]; + /** Field view. */ + struct + { + /** The omnipresent header. */ + MptConfigurationPageHeader Header; + /** Number of times the IOC rejected a message because it doesn't support the operation. */ + uint16_t u16MsgRejectCount; + /** Number of times the SCSI bus entered an invalid operation state. */ + uint16_t u16PhaseErrorCount; + /** Number of parity errors. */ + uint16_t u16ParityCount; + /** Reserved. */ + uint16_t u16Reserved; + } fields; + } u; +} MptConfigurationPageSCSISPIDevice3, *PMptConfigurationPageSCSISPIDevice3; +#pragma pack() +AssertCompileSize(MptConfigurationPageSCSISPIDevice3, 12); + +/** + * Structure of all supported pages. + */ +typedef struct MptConfigurationPagesSupported +{ + MptConfigurationPageManufacturing0 ManufacturingPage0; + MptConfigurationPageManufacturing1 ManufacturingPage1; + MptConfigurationPageManufacturing2 ManufacturingPage2; + MptConfigurationPageManufacturing3 ManufacturingPage3; + MptConfigurationPageManufacturing4 ManufacturingPage4; + MptConfigurationPageIOUnit0 IOUnitPage0; + MptConfigurationPageIOUnit1 IOUnitPage1; + MptConfigurationPageIOUnit2 IOUnitPage2; + MptConfigurationPageIOUnit3 IOUnitPage3; + MptConfigurationPageIOC0 IOCPage0; + MptConfigurationPageIOC1 IOCPage1; + MptConfigurationPageIOC2 IOCPage2; + MptConfigurationPageIOC3 IOCPage3; + MptConfigurationPageIOC4 IOCPage4; + MptConfigurationPageIOC6 IOCPage6; + struct + { + MptConfigurationPageSCSISPIPort0 SCSISPIPortPage0; + MptConfigurationPageSCSISPIPort1 SCSISPIPortPage1; + MptConfigurationPageSCSISPIPort2 SCSISPIPortPage2; + } aPortPages[1]; /* Currently only one port supported. */ + struct + { + struct + { + MptConfigurationPageSCSISPIDevice0 SCSISPIDevicePage0; + MptConfigurationPageSCSISPIDevice1 SCSISPIDevicePage1; + MptConfigurationPageSCSISPIDevice2 SCSISPIDevicePage2; + MptConfigurationPageSCSISPIDevice3 SCSISPIDevicePage3; + } aDevicePages[LSILOGIC_DEVICES_MAX]; + } aBuses[1]; /* Only one bus at the moment. */ +} MptConfigurationPagesSupported, *PMptConfigurationPagesSupported; + +/** + * Possible SG element types. + */ +enum MPTSGENTRYTYPE +{ + MPTSGENTRYTYPE_TRANSACTION_CONTEXT = 0x00, + MPTSGENTRYTYPE_SIMPLE = 0x01, + MPTSGENTRYTYPE_CHAIN = 0x03 +}; + +/** + * Reply data. + */ +typedef struct LSILOGICSCSIREPLY +{ + /** Lower 32 bits of the reply address in memory. */ + uint32_t u32HostMFALowAddress; + /** Full address of the reply in guest memory. */ + RTGCPHYS GCPhysReplyAddress; + /** Size of the reply. */ + uint32_t cbReply; + /** Different views to the reply depending on the request type. */ + MptReplyUnion Reply; +} LSILOGICSCSIREPLY, *PLSILOGICSCSIREPLY; + +/* + * State of a device attached to the buslogic host adapter. + */ +typedef struct LSILOGICDEVICE +{ + /** Pointer to the owning lsilogic device instance. - R3 pointer */ + R3PTRTYPE(struct LSILOGICSCSI *) pLsiLogicR3; + /** Pointer to the owning lsilogic device instance. - R0 pointer */ + R0PTRTYPE(struct LSILOGICSCSI *) pLsiLogicR0; + /** Pointer to the owning lsilogic device instance. - RC pointer */ + RCPTRTYPE(struct LSILOGICSCSI *) pLsiLogicRC; + + /** LUN of the device. */ + RTUINT iLUN; + /** Number of outstanding tasks on the port. */ + volatile uint32_t cOutstandingRequests; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment0; +#endif + + /** Our base interace. */ + PDMIBASE IBase; + /** SCSI port interface. */ + PDMISCSIPORT ISCSIPort; + /** Led interface. */ + PDMILEDPORTS ILed; + /** Pointer to the attached driver's base interface. */ + R3PTRTYPE(PPDMIBASE) pDrvBase; + /** Pointer to the underlying SCSI connector interface. */ + R3PTRTYPE(PPDMISCSICONNECTOR) pDrvSCSIConnector; + /** The status LED state for this device. */ + PDMLED Led; + +} LSILOGICDEVICE, *PLSILOGICDEVICE; + +/** + * Defined states that the SCSI controller can have. + */ +typedef enum LSILOGICSTATE +{ + /** Reset state. */ + LSILOGICSTATE_RESET = 0x00, + /** Ready state. */ + LSILOGICSTATE_READY = 0x01, + /** Operational state. */ + LSILOGICSTATE_OPERATIONAL = 0x02, + /** Fault state. */ + LSILOGICSTATE_FAULT = 0x04, + /** 32bit size hack */ + LSILOGICSTATE_32BIT_HACK = 0x7fffffff +} LSILOGICSTATE; + +/** + * Which entity needs to initialize the controller + * to get into the operational state. + */ +typedef enum LSILOGICWHOINIT +{ + /** Not initialized. */ + LSILOGICWHOINIT_NOT_INITIALIZED = 0x00, + /** System BIOS. */ + LSILOGICWHOINIT_SYSTEM_BIOS = 0x01, + /** ROM Bios. */ + LSILOGICWHOINIT_ROM_BIOS = 0x02, + /** PCI Peer. */ + LSILOGICWHOINIT_PCI_PEER = 0x03, + /** Host driver. */ + LSILOGICWHOINIT_HOST_DRIVER = 0x04, + /** Manufacturing. */ + LSILOGICWHOINIT_MANUFACTURING = 0x05, + /** 32bit size hack. */ + LSILOGICWHOINIT_32BIT_HACK = 0x7fffffff +} LSILOGICWHOINIT; + + +/** + * IOC status codes. + */ +#define LSILOGIC_IOCSTATUS_SUCCESS 0x0000 +#define LSILOGIC_IOCSTATUS_INVALID_FUNCTION 0x0001 +#define LSILOGIC_IOCSTATUS_BUSY 0x0002 +#define LSILOGIC_IOCSTATUS_INVALID_SGL 0x0003 +#define LSILOGIC_IOCSTATUS_INTERNAL_ERROR 0x0004 +#define LSILOGIC_IOCSTATUS_RESERVED 0x0005 +#define LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES 0x0006 +#define LSILOGIC_IOCSTATUS_INVALID_FIELD 0x0007 +#define LSILOGIC_IOCSTATUS_INVALID_STATE 0x0008 +#define LSILOGIC_IOCSTATUS_OP_STATE_NOT_SUPPOTED 0x0009 + +/** + * Device instance data for the emulated + * SCSI controller. + */ +typedef struct LSILOGICSCSI +{ + /** PCI device structure. */ + 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; + + /** Flag whether the GC part of the device is enabled. */ + bool fGCEnabled; + /** Flag whether the R0 part of the device is enabled. */ + bool fR0Enabled; + + /** The state the controller is currently in. */ + LSILOGICSTATE enmState; + /** Who needs to init the driver to get into operational state. */ + LSILOGICWHOINIT enmWhoInit; + /** Flag whether we are in doorbell function. */ + bool fDoorbellInProgress; + /** Flag whether diagnostic access is enabled. */ + bool fDiagnosticEnabled; + + /** Flag whether a notification was send to R3. */ + bool fNotificationSend; + + /** Flag whether the guest enabled event notification from the IOC. */ + bool fEventNotificationEnabled; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment0; +#endif + + /** Queue to send tasks to R3. - R3 ptr */ + R3PTRTYPE(PPDMQUEUE) pNotificationQueueR3; + /** Queue to send tasks to R3. - R0 ptr */ + R0PTRTYPE(PPDMQUEUE) pNotificationQueueR0; + /** Queue to send tasks to R3. - RC ptr */ + RCPTRTYPE(PPDMQUEUE) pNotificationQueueRC; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment1; +#endif + + /** States for attached devices. */ + LSILOGICDEVICE aDeviceStates[LSILOGIC_DEVICES_MAX]; + + /** MMIO address the device is mapped to. */ + RTGCPHYS GCPhysMMIOBase; + /** I/O port address the device is mapped to. */ + RTIOPORT IOPortBase; + + /** Interrupt mask. */ + volatile uint32_t uInterruptMask; + /** Interrupt status register. */ + volatile uint32_t uInterruptStatus; + + /** Buffer for messages which are passed + * through the doorbell using the + * handshake method. */ + uint32_t aMessage[sizeof(MptConfigurationRequest)]; + /** Actual position in the buffer. */ + uint32_t iMessage; + /** Size of the message which is given in the doorbell message in dwords. */ + uint32_t cMessage; + + /** Reply buffer. */ + MptReplyUnion ReplyBuffer; + /** Next entry to read. */ + uint32_t uNextReplyEntryRead; + /** Size of the reply in the buffer in 16bit words. */ + uint32_t cReplySize; + + /** The fault code of the I/O controller if we are in the fault state. */ + uint16_t u16IOCFaultCode; + + /** Upper 32 bits of the moessage frame address to locate requests in guest memory. */ + uint32_t u32HostMFAHighAddr; + /** Upper 32 bits of the sense buffer address. */ + uint32_t u32SenseBufferHighAddr; + /** Maximum number of devices the driver reported he can handle. */ + uint8_t cMaxDevices; + /** Maximum number of buses the driver reported he can handle. */ + uint8_t cMaxBuses; + /** Current size of reply message frames in the guest. */ + uint16_t cbReplyFrame; + + /** Next key to write in the sequence to get access + * to diagnostic memory. */ + uint32_t iDiagnosticAccess; + + /** Number entries allocated for the reply queue. */ + uint32_t cReplyQueueEntries; + /** Number entries allocated for the outstanding request queue. */ + uint32_t cRequestQueueEntries; + + /** Critical section protecting the reply post queue. */ + PDMCRITSECT ReplyPostQueueCritSect; + /** Critical section protecting the reply free queue. */ + PDMCRITSECT ReplyFreeQueueCritSect; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment2; +#endif + + /** Pointer to the start of the reply free queue - R3. */ + R3PTRTYPE(volatile uint32_t *) pReplyFreeQueueBaseR3; + /** Pointer to the start of the reply post queue - R3. */ + R3PTRTYPE(volatile uint32_t *) pReplyPostQueueBaseR3; + /** Pointer to the start of the request queue - R3. */ + R3PTRTYPE(volatile uint32_t *) pRequestQueueBaseR3; + + /** Pointer to the start of the reply queue - R0. */ + R0PTRTYPE(volatile uint32_t *) pReplyFreeQueueBaseR0; + /** Pointer to the start of the reply queue - R0. */ + R0PTRTYPE(volatile uint32_t *) pReplyPostQueueBaseR0; + /** Pointer to the start of the request queue - R0. */ + R0PTRTYPE(volatile uint32_t *) pRequestQueueBaseR0; + + /** Pointer to the start of the reply queue - RC. */ + RCPTRTYPE(volatile uint32_t *) pReplyFreeQueueBaseRC; + /** Pointer to the start of the reply queue - RC. */ + RCPTRTYPE(volatile uint32_t *) pReplyPostQueueBaseRC; + /** Pointer to the start of the request queue - RC. */ + RCPTRTYPE(volatile uint32_t *) pRequestQueueBaseRC; + + /** Next free entry in the reply queue the guest can write a address to. */ + volatile uint32_t uReplyFreeQueueNextEntryFreeWrite; + /** Next valid entry the controller can read a valid address for reply frames from. */ + volatile uint32_t uReplyFreeQueueNextAddressRead; + + /** Next free entry in the reply queue the guest can write a address to. */ + volatile uint32_t uReplyPostQueueNextEntryFreeWrite; + /** Next valid entry the controller can read a valid address for reply frames from. */ + volatile uint32_t uReplyPostQueueNextAddressRead; + + /** Next free entry the guest can write a address to a request frame to. */ + volatile uint32_t uRequestQueueNextEntryFreeWrite; + /** Next valid entry the controller can read a valid address for request frames from. */ + volatile uint32_t uRequestQueueNextAddressRead; + + /** Configuration pages. */ + MptConfigurationPagesSupported ConfigurationPages; + + /** BIOS emulation. */ + VBOXSCSI VBoxSCSI; + + /** Cache for allocated tasks. */ + R3PTRTYPE(PRTOBJCACHE) pTaskCache; + + /** The base interface */ + PDMIBASE IBase; + /** Status Port - Leds interface. */ + PDMILEDPORTS ILeds; + /** Partner of ILeds. */ + R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; +} LSILOGISCSI, *PLSILOGICSCSI; + +#define LSILOGIC_PCI_SPACE_IO_SIZE 256 +#define LSILOGIC_PCI_SPACE_MEM_SIZE 128 * _1K + +#define LSILOGIC_REG_DOORBELL 0x00 +# define LSILOGIC_REG_DOORBELL_SET_STATE(enmState) (((enmState) & 0x0f) << 28) +# define LSILOGIC_REG_DOORBELL_SET_USED(fUsed) (((fUsed) ? 1 : 0) << 27) +# define LSILOGIC_REG_DOORBELL_SET_WHOINIT(enmWhoInit) (((enmWhoInit) & 0x07) << 24) +# define LSILOGIC_REG_DOORBELL_SET_FAULT_CODE(u16Code) (u16Code) +# define LSILOGIC_REG_DOORBELL_GET_FUNCTION(x) (((x) & 0xff000000) >> 24) +# define LSILOGIC_REG_DOORBELL_GET_SIZE(x) (((x) & 0x00ff0000) >> 16) + +#define LSILOGIC_REG_WRITE_SEQUENCE 0x04 +#define LSILOGIC_REG_HOST_DIAGNOSTIC 0x08 +#define LSILOGIC_REG_TEST_BASE_ADDRESS 0x0c +#define LSILOGIC_REG_DIAG_RW_DATA 0x10 +#define LSILOGIC_REG_DIAG_RW_ADDRESS 0x14 + +#define LSILOGIC_REG_HOST_INTR_STATUS 0x30 +# define LSILOGIC_REG_HOST_INTR_STATUS_W_MASK (RT_BIT(3)) +# define LSILOGIC_REG_HOST_INTR_STATUS_DOORBELL_STS (RT_BIT(31)) +# define LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR (RT_BIT(3)) +# define LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL (RT_BIT(0)) + +#define LSILOGIC_REG_HOST_INTR_MASK 0x34 +# define LSILOGIC_REG_HOST_INTR_MASK_W_MASK (RT_BIT(0) | RT_BIT(3) | RT_BIT(8) | RT_BIT(9)) +# define LSILOGIC_REG_HOST_INTR_MASK_IRQ_ROUTING (RT_BIT(8) | RT_BIT(9)) +# define LSILOGIC_REG_HOST_INTR_MASK_DOORBELL RT_BIT(0) +# define LSILOGIC_REG_HOST_INTR_MASK_REPLY RT_BIT(3) + +#define LSILOGIC_REG_REQUEST_QUEUE 0x40 +#define LSILOGIC_REG_REPLY_QUEUE 0x44 + +/* Functions which can be passed through the system doorbell. */ +#define LSILOGIC_DOORBELL_FUNCTION_IOC_MSG_UNIT_RESET 0x40 +#define LSILOGIC_DOORBELL_FUNCTION_IO_UNIT_RESET 0x41 +#define LSILOGIC_DOORBELL_FUNCTION_HANDSHAKE 0x42 +#define LSILOGIC_DOORBELL_FUNCTION_REPLY_FRAME_REMOVAL 0x43 + +/** + * Scatter gather list entry data. + */ +typedef struct LSILOGICTASKSTATESGENTRY +{ + /** Flag whether the buffer in the list is from the guest or an + * allocated temporary buffer because the segments in the guest + * are not sector aligned. + */ + bool fGuestMemory; + /** Flag whether the buffer contains data or is the destination for the transfer. */ + bool fBufferContainsData; + /** Pointer to the start of the buffer. */ + void *pvBuf; + /** Size of the buffer. */ + uint32_t cbBuf; + /** Flag dependent data. */ + union + { + /** Data to handle direct mappings of guest buffers. */ + PGMPAGEMAPLOCK PageLock; + /** The segment in the guest which is not sector aligned. */ + RTGCPHYS GCPhysAddrBufferUnaligned; + } u; +} LSILOGICTASKSTATESGENTRY, *PLSILOGICTASKSTATESGENTRY; + +/** + * Task state object which holds all neccessary data while + * processing the request from the guest. + */ +typedef struct LSILOGICTASKSTATE +{ + /** Target device. */ + PLSILOGICDEVICE pTargetDevice; + /** The message request from the guest. */ + MptRequestUnion GuestRequest; + /** Reply message if the request produces one. */ + MptReplyUnion IOCReply; + /** SCSI request structure for the SCSI driver. */ + PDMSCSIREQUEST PDMScsiRequest; + /** Address of the message request frame in guests memory. + * Used to read the S/G entries in the second step. */ + RTGCPHYS GCPhysMessageFrameAddr; + /** Number of scatter gather list entries. */ + uint32_t cSGListEntries; + /** How many entries would fit into the sg list. */ + uint32_t cSGListSize; + /** How many times the list was too big. */ + uint32_t cSGListTooBig; + /** Pointer to the first entry of the scatter gather list. */ + PPDMDATASEG pSGListHead; + /** How many entries would fit into the sg info list. */ + uint32_t cSGInfoSize; + /** Number of entries for the information entries. */ + uint32_t cSGInfoEntries; + /** How many times the list was too big. */ + uint32_t cSGInfoTooBig; + /** Pointer to the first mapping information entry. */ + PLSILOGICTASKSTATESGENTRY paSGEntries; + /** Size of the temporary buffer for unaligned guest segments. */ + uint32_t cbBufferUnaligned; + /** Pointer to the temporary buffer. */ + void *pvBufferUnaligned; + /** Pointer to the sense buffer. */ + uint8_t abSenseBuffer[18]; + /** Flag whether the request was issued from the BIOS. */ + bool fBIOS; +} LSILOGICTASKSTATE, *PLSILOGICTASKSTATE; + +#ifndef VBOX_DEVICE_STRUCT_TESTCASE + +RT_C_DECLS_BEGIN +PDMBOTHCBDECL(int) lsilogicIOPortWrite (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t u32, unsigned cb); +PDMBOTHCBDECL(int) lsilogicIOPortRead (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t *pu32, unsigned cb); +PDMBOTHCBDECL(int) lsilogicMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb); +PDMBOTHCBDECL(int) lsilogicMMIORead(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb); +PDMBOTHCBDECL(int) lsilogicDiagnosticWrite(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb); +PDMBOTHCBDECL(int) lsilogicDiagnosticRead(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb); +#ifdef IN_RING3 +static void lsilogicInitializeConfigurationPages(PLSILOGICSCSI pLsiLogic); +static int lsilogicProcessConfigurationRequest(PLSILOGICSCSI pLsiLogic, PMptConfigurationRequest pConfigurationReq, + PMptConfigurationReply pReply); +#endif +RT_C_DECLS_END + +#define PDMIBASE_2_PLSILOGICDEVICE(pInterface) ( (PLSILOGICDEVICE)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICDEVICE, IBase)) ) +#define PDMISCSIPORT_2_PLSILOGICDEVICE(pInterface) ( (PLSILOGICDEVICE)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICDEVICE, ISCSIPort)) ) +#define PDMILEDPORTS_2_PLSILOGICDEVICE(pInterface) ( (PLSILOGICDEVICE)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICDEVICE, ILed)) ) +#define LSILOGIC_RTGCPHYS_FROM_U32(Hi, Lo) ( (RTGCPHYS)RT_MAKE_U64(Lo, Hi) ) +#define PDMIBASE_2_PLSILOGICSCSI(pInterface) ( (PLSILOGICSCSI)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICSCSI, IBase)) ) +#define PDMILEDPORTS_2_PLSILOGICSCSI(pInterface) ( (PLSILOGICSCSI)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICSCSI, ILeds)) ) + +/** Key sequence the guest has to write to enable access + * to diagnostic memory. */ +static const uint8_t g_lsilogicDiagnosticAccess[] = {0x04, 0x0b, 0x02, 0x07, 0x0d}; + +/** + * Updates the status of the interrupt pin of the device. + * + * @returns nothing. + * @param pThis Pointer to the device instance data. + */ +static void lsilogicUpdateInterrupt(PLSILOGICSCSI pThis) +{ + uint32_t uIntSts; + + LogFlowFunc(("Updating interrupts\n")); + + /* Mask out doorbell status so that it does not affect interrupt updating. */ + uIntSts = (ASMAtomicReadU32(&pThis->uInterruptStatus) & ~LSILOGIC_REG_HOST_INTR_STATUS_DOORBELL_STS); + /* Check maskable interrupts. */ + uIntSts &= ~(pThis->uInterruptMask & ~LSILOGIC_REG_HOST_INTR_MASK_IRQ_ROUTING); + + if (uIntSts) + { + LogFlowFunc(("Setting interrupt\n")); + PDMDevHlpPCISetIrq(pThis->CTX_SUFF(pDevIns), 0, 1); + } + else + { + LogFlowFunc(("Clearing interrupt\n")); + PDMDevHlpPCISetIrq(pThis->CTX_SUFF(pDevIns), 0, 0); + } +} + +/** + * Sets a given interrupt status bit in the status register and + * updates the interupt status. + * + * @returns nothing. + * @param pLsiLogic Pointer to the device instance. + * @param uStatus The status bit to set. + */ +DECLINLINE(void) lsilogicSetInterrupt(PLSILOGICSCSI pLsiLogic, uint32_t uStatus) +{ + ASMAtomicOrU32(&pLsiLogic->uInterruptStatus, uStatus); + lsilogicUpdateInterrupt(pLsiLogic); +} + +/** + * Clears a given interrupt status bit in the status register and + * updates the interupt status. + * + * @returns nothing. + * @param pLsiLogic Pointer to the device instance. + * @param uStatus The status bit to set. + */ +DECLINLINE(void) lsilogicClearInterrupt(PLSILOGICSCSI pLsiLogic, uint32_t uStatus) +{ + ASMAtomicAndU32(&pLsiLogic->uInterruptStatus, ~uStatus); + lsilogicUpdateInterrupt(pLsiLogic); +} + +/** + * Sets the I/O controller into fault state and sets the fault code. + * + * @returns nothing + * @param pLsiLogic Pointer to the controller device instance. + * @param uIOCFaultCode Fault code to set. + */ +DECLINLINE(void) lsilogicSetIOCFaultCode(PLSILOGICSCSI pLsiLogic, uint16_t uIOCFaultCode) +{ + if (pLsiLogic->enmState != LSILOGICSTATE_FAULT) + { + Log(("%s: Setting I/O controller into FAULT state: uIOCFaultCode=%u\n", __FUNCTION__, uIOCFaultCode)); + pLsiLogic->enmState = LSILOGICSTATE_FAULT; + pLsiLogic->u16IOCFaultCode = uIOCFaultCode; + } + else + { + Log(("%s: We are already in FAULT state\n")); + } +} + +#ifdef IN_RING3 +/** + * Performs a hard reset on the controller. + * + * @returns VBox status code. + * @param pThis Pointer to the device instance to initialize. + */ +static int lsilogicHardReset(PLSILOGICSCSI pThis) +{ + pThis->enmState = LSILOGICSTATE_RESET; + + /* The interrupts are masked out. */ + pThis->uInterruptMask |= LSILOGIC_REG_HOST_INTR_MASK_DOORBELL | + LSILOGIC_REG_HOST_INTR_MASK_REPLY; + /* Reset interrupt states. */ + pThis->uInterruptStatus = 0; + lsilogicUpdateInterrupt(pThis); + + /* Reset the queues. */ + pThis->uReplyFreeQueueNextEntryFreeWrite = 0; + pThis->uReplyFreeQueueNextAddressRead = 0; + pThis->uReplyPostQueueNextEntryFreeWrite = 0; + pThis->uReplyPostQueueNextAddressRead = 0; + pThis->uRequestQueueNextEntryFreeWrite = 0; + pThis->uRequestQueueNextAddressRead = 0; + + /* Disable diagnostic access. */ + pThis->iDiagnosticAccess = 0; + + /* Set default values. */ + pThis->cMaxDevices = LSILOGIC_DEVICES_MAX; + pThis->cMaxBuses = 1; + pThis->cbReplyFrame = 128; /* @todo Figure out where it is needed. */ + /* @todo: Put stuff to reset here. */ + + lsilogicInitializeConfigurationPages(pThis); + + /* Mark that we finished performing the reset. */ + pThis->enmState = LSILOGICSTATE_READY; + return VINF_SUCCESS; +} + +/** + * Finishes a context reply. + * + * @returns nothing + * @param pLsiLogic Pointer to the device instance + * @param u32MessageContext The message context ID to post. + */ +static void lsilogicFinishContextReply(PLSILOGICSCSI pLsiLogic, uint32_t u32MessageContext) +{ + int rc; + AssertMsg(!pLsiLogic->fDoorbellInProgress, ("We are in a doorbell function\n")); + + /* Write message context ID into reply post queue. */ + rc = PDMCritSectEnter(&pLsiLogic->ReplyPostQueueCritSect, VINF_SUCCESS); + AssertRC(rc); + +#if 0 + /* Check for a entry in the queue. */ + if (RT_UNLIKELY(pLsiLogic->uReplyPostQueueNextAddressRead != pLsiLogic->uReplyPostQueueNextEntryFreeWrite)) + { + /* Set error code. */ + lsilogicSetIOCFaultCode(pLsiLogic, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); + PDMCritSectLeave(&pLsiLogic->ReplyPostQueueCritSect); + return; + } +#endif + + /* We have a context reply. */ + ASMAtomicWriteU32(&pLsiLogic->CTX_SUFF(pReplyPostQueueBase)[pLsiLogic->uReplyPostQueueNextEntryFreeWrite], u32MessageContext); + ASMAtomicIncU32(&pLsiLogic->uReplyPostQueueNextEntryFreeWrite); + pLsiLogic->uReplyPostQueueNextEntryFreeWrite %= pLsiLogic->cReplyQueueEntries; + + PDMCritSectLeave(&pLsiLogic->ReplyPostQueueCritSect); + + /* Set interrupt. */ + lsilogicSetInterrupt(pLsiLogic, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); +} +#endif /* IN_RING3 */ + +/** + * Takes neccessary steps to finish a reply frame. + * + * @returns nothing + * @param pLsiLogic Pointer to the device instance + * @param pReply Pointer to the reply message. + * @param fForceReplyFifo Flag whether the use of the reply post fifo is forced. + */ +static void lsilogicFinishAddressReply(PLSILOGICSCSI pLsiLogic, PMptReplyUnion pReply, bool fForceReplyFifo) +{ + /* + * If we are in a doorbell function we set the reply size now and + * set the system doorbell status interrupt to notify the guest that + * we are ready to send the reply. + */ + if (pLsiLogic->fDoorbellInProgress && !fForceReplyFifo) + { + /* Set size of the reply in 16bit words. The size in the reply is in 32bit dwords. */ + pLsiLogic->cReplySize = pReply->Header.u8MessageLength * 2; + Log(("%s: cReplySize=%u\n", __FUNCTION__, pLsiLogic->cReplySize)); + pLsiLogic->uNextReplyEntryRead = 0; + lsilogicSetInterrupt(pLsiLogic, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); + } + else + { + /* + * The reply queues are only used if the request was fetched from the request queue. + * Requests from the request queue are always transferred to R3. So it is not possible + * that this case happens in R0 or GC. + */ +#ifdef IN_RING3 + int rc; + /* Grab a free reply message from the queue. */ + rc = PDMCritSectEnter(&pLsiLogic->ReplyFreeQueueCritSect, VINF_SUCCESS); + AssertRC(rc); + +#if 0 + /* Check for a free reply frame. */ + if (RT_UNLIKELY(pLsiLogic->uReplyFreeQueueNextAddressRead != pLsiLogic->uReplyFreeQueueNextEntryFreeWrite)) + { + /* Set error code. */ + lsilogicSetIOCFaultCode(pLsiLogic, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); + PDMCritSectLeave(&pLsiLogic->ReplyFreeQueueCritSect); + return; + } +#endif + + uint32_t u32ReplyFrameAddressLow = pLsiLogic->CTX_SUFF(pReplyFreeQueueBase)[pLsiLogic->uReplyFreeQueueNextAddressRead]; + + pLsiLogic->uReplyFreeQueueNextAddressRead++; + pLsiLogic->uReplyFreeQueueNextAddressRead %= pLsiLogic->cReplyQueueEntries; + + PDMCritSectLeave(&pLsiLogic->ReplyFreeQueueCritSect); + + /* Build 64bit physical address. */ + RTGCPHYS GCPhysReplyMessage = LSILOGIC_RTGCPHYS_FROM_U32(pLsiLogic->u32HostMFAHighAddr, u32ReplyFrameAddressLow); + size_t cbReplyCopied = (pLsiLogic->cbReplyFrame < sizeof(MptReplyUnion)) ? pLsiLogic->cbReplyFrame : sizeof(MptReplyUnion); + + /* Write reply to guest memory. */ + PDMDevHlpPhysWrite(pLsiLogic->CTX_SUFF(pDevIns), GCPhysReplyMessage, pReply, cbReplyCopied); + + /* Write low 32bits of reply frame into post reply queue. */ + rc = PDMCritSectEnter(&pLsiLogic->ReplyPostQueueCritSect, VINF_SUCCESS); + AssertRC(rc); + +#if 0 + /* Check for a entry in the queue. */ + if (RT_UNLIKELY(pLsiLogic->uReplyPostQueueNextAddressRead != pLsiLogic->uReplyPostQueueNextEntryFreeWrite)) + { + /* Set error code. */ + lsilogicSetIOCFaultCode(pLsiLogic, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); + PDMCritSectLeave(&pLsiLogic->ReplyPostQueueCritSect); + return; + } +#endif + + /* We have a address reply. Set the 31th bit to indicate that. */ + ASMAtomicWriteU32(&pLsiLogic->CTX_SUFF(pReplyPostQueueBase)[pLsiLogic->uReplyPostQueueNextEntryFreeWrite], + RT_BIT(31) | (u32ReplyFrameAddressLow >> 1)); + ASMAtomicIncU32(&pLsiLogic->uReplyPostQueueNextEntryFreeWrite); + pLsiLogic->uReplyPostQueueNextEntryFreeWrite %= pLsiLogic->cReplyQueueEntries; + + PDMCritSectLeave(&pLsiLogic->ReplyPostQueueCritSect); + + if (fForceReplyFifo) + { + pLsiLogic->fDoorbellInProgress = false; + lsilogicSetInterrupt(pLsiLogic, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); + } + + /* Set interrupt. */ + lsilogicSetInterrupt(pLsiLogic, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); +#else + AssertMsgFailed(("This is not allowed to happen.\n")); +#endif + } +} + +#ifdef IN_RING3 +/** + * Processes a given Request from the guest + * + * @returns VBox status code. + * @param pLsiLogic Pointer to the device instance. + * @param pMessageHdr Pointer to the message header of the request. + * @param pReply Pointer to the reply. + */ +static int lsilogicProcessMessageRequest(PLSILOGICSCSI pLsiLogic, PMptMessageHdr pMessageHdr, PMptReplyUnion pReply) +{ + int rc = VINF_SUCCESS; + bool fForceReplyPostFifo = false; + +#ifdef DEBUG + if (pMessageHdr->u8Function < RT_ELEMENTS(g_apszMPTFunctionNames)) + Log(("Message request function: %s\n", g_apszMPTFunctionNames[pMessageHdr->u8Function])); + else + Log(("Message request function: <unknown>\n")); +#endif + + memset(pReply, 0, sizeof(MptReplyUnion)); + + switch (pMessageHdr->u8Function) + { + case MPT_MESSAGE_HDR_FUNCTION_SCSI_TASK_MGMT: + { + PMptSCSITaskManagementRequest pTaskMgmtReq = (PMptSCSITaskManagementRequest)pMessageHdr; + + pReply->SCSITaskManagement.u8MessageLength = 6; /* 6 32bit dwords. */ + pReply->SCSITaskManagement.u8TaskType = pTaskMgmtReq->u8TaskType; + pReply->SCSITaskManagement.u32TerminationCount = 0; + //AssertMsgFailed(("todo\n")); + fForceReplyPostFifo = true; + break; + } + case MPT_MESSAGE_HDR_FUNCTION_IOC_INIT: + { + /* + * This request sets the I/O controller to the + * operational state. + */ + PMptIOCInitRequest pIOCInitReq = (PMptIOCInitRequest)pMessageHdr; + + /* Update configuration values. */ + pLsiLogic->enmWhoInit = (LSILOGICWHOINIT)pIOCInitReq->u8WhoInit; + pLsiLogic->cbReplyFrame = pIOCInitReq->u16ReplyFrameSize; + pLsiLogic->cMaxBuses = pIOCInitReq->u8MaxBuses; + pLsiLogic->cMaxDevices = pIOCInitReq->u8MaxDevices; + pLsiLogic->u32HostMFAHighAddr = pIOCInitReq->u32HostMfaHighAddr; + pLsiLogic->u32SenseBufferHighAddr = pIOCInitReq->u32SenseBufferHighAddr; + + if (pLsiLogic->enmState == LSILOGICSTATE_READY) + { + pLsiLogic->enmState = LSILOGICSTATE_OPERATIONAL; + } + + /* Return reply. */ + pReply->IOCInit.u8MessageLength = 5; + pReply->IOCInit.u8WhoInit = pLsiLogic->enmWhoInit; + pReply->IOCInit.u8MaxDevices = pLsiLogic->cMaxDevices; + pReply->IOCInit.u8MaxBuses = pLsiLogic->cMaxBuses; + break; + } + case MPT_MESSAGE_HDR_FUNCTION_IOC_FACTS: + { + pReply->IOCFacts.u8MessageLength = 15; /* 15 32bit dwords. */ + pReply->IOCFacts.u16MessageVersion = 0x0102; /* Version from the specification. */ + pReply->IOCFacts.u8IOCNumber = 0; /* PCI function number. */ + pReply->IOCFacts.u16IOCExceptions = 0; + pReply->IOCFacts.u8MaxChainDepth = LSILOGICSCSI_MAXIMUM_CHAIN_DEPTH; + pReply->IOCFacts.u8WhoInit = pLsiLogic->enmWhoInit; + pReply->IOCFacts.u8BlockSize = 12; /* Block size in 32bit dwords. This is the largest request we can get (SCSI I/O). */ + pReply->IOCFacts.u8Flags = 0; /* Bit 0 is set if the guest must upload the FW prior to using the controller. Obviously not needed here. */ + pReply->IOCFacts.u16ReplyQueueDepth = pLsiLogic->cReplyQueueEntries - 1; /* One entry is always free. */ + pReply->IOCFacts.u16RequestFrameSize = 128; /* @todo Figure out where it is needed. */ + pReply->IOCFacts.u16ProductID = 0xcafe; /* Our own product ID :) */ + pReply->IOCFacts.u32CurrentHostMFAHighAddr = pLsiLogic->u32HostMFAHighAddr; + pReply->IOCFacts.u16GlobalCredits = pLsiLogic->cRequestQueueEntries - 1; /* One entry is always free. */ + pReply->IOCFacts.u8NumberOfPorts = 1; + pReply->IOCFacts.u8EventState = 0; /* Event notifications not enabled. */ + pReply->IOCFacts.u32CurrentSenseBufferHighAddr = pLsiLogic->u32SenseBufferHighAddr; + pReply->IOCFacts.u16CurReplyFrameSize = pLsiLogic->cbReplyFrame; + pReply->IOCFacts.u8MaxDevices = pLsiLogic->cMaxDevices; + pReply->IOCFacts.u8MaxBuses = pLsiLogic->cMaxBuses; + pReply->IOCFacts.u32FwImageSize = 0; /* No image needed. */ + pReply->IOCFacts.u32FWVersion = 0; + break; + } + case MPT_MESSAGE_HDR_FUNCTION_PORT_FACTS: + { + PMptPortFactsRequest pPortFactsReq = (PMptPortFactsRequest)pMessageHdr; + + pReply->PortFacts.u8MessageLength = 10; + pReply->PortFacts.u8PortNumber = pPortFactsReq->u8PortNumber; + + /* This controller only supports one bus with bus number 0. */ + if (pPortFactsReq->u8PortNumber != 0) + { + pReply->PortFacts.u8PortType = 0; /* Not existant. */ + } + else + { + pReply->PortFacts.u8PortType = 0x01; /* SCSI Port. */ + pReply->PortFacts.u16MaxDevices = LSILOGIC_DEVICES_MAX; + pReply->PortFacts.u16ProtocolFlags = RT_BIT(3) | RT_BIT(0); /* SCSI initiator and LUN supported. */ + pReply->PortFacts.u16PortSCSIID = 7; /* Default */ + pReply->PortFacts.u16MaxPersistentIDs = 0; + pReply->PortFacts.u16MaxPostedCmdBuffers = 0; /* Only applies for target mode which we dont support. */ + pReply->PortFacts.u16MaxLANBuckets = 0; /* Only for the LAN controller. */ + } + break; + } + case MPT_MESSAGE_HDR_FUNCTION_PORT_ENABLE: + { + /* + * The port enable request notifies the IOC to make the port available and perform + * appropriate discovery on the associated link. + */ + PMptPortEnableRequest pPortEnableReq = (PMptPortEnableRequest)pMessageHdr; + + pReply->PortEnable.u8MessageLength = 5; + pReply->PortEnable.u8PortNumber = pPortEnableReq->u8PortNumber; + break; + } + case MPT_MESSAGE_HDR_FUNCTION_EVENT_NOTIFICATION: + { + PMptEventNotificationRequest pEventNotificationReq = (PMptEventNotificationRequest)pMessageHdr; + + if (pEventNotificationReq->u8Switch) + pLsiLogic->fEventNotificationEnabled = true; + else + pLsiLogic->fEventNotificationEnabled = false; + + pReply->EventNotification.u16EventDataLength = 1; /* 1 32bit D-Word. */ + pReply->EventNotification.u8MessageLength = 8; + pReply->EventNotification.u8MessageFlags = (1 << 7); + pReply->EventNotification.u8AckRequired = 0; + pReply->EventNotification.u32Event = MPT_EVENT_EVENT_CHANGE; + pReply->EventNotification.u32EventContext = 0; + pReply->EventNotification.u32EventData = pLsiLogic->fEventNotificationEnabled ? 1 : 0; + + break; + } + case MPT_MESSAGE_HDR_FUNCTION_EVENT_ACK: + { + AssertMsgFailed(("todo")); + break; + } + case MPT_MESSAGE_HDR_FUNCTION_CONFIG: + { + PMptConfigurationRequest pConfigurationReq = (PMptConfigurationRequest)pMessageHdr; + + rc = lsilogicProcessConfigurationRequest(pLsiLogic, pConfigurationReq, &pReply->Configuration); + AssertRC(rc); + break; + } + case MPT_MESSAGE_HDR_FUNCTION_SCSI_IO_REQUEST: /* Should be handled already. */ + default: + AssertMsgFailed(("Invalid request function %#x\n", pMessageHdr->u8Function)); + } + + /* Copy common bits from request message frame to reply. */ + pReply->Header.u8Function = pMessageHdr->u8Function; + pReply->Header.u32MessageContext = pMessageHdr->u32MessageContext; + + lsilogicFinishAddressReply(pLsiLogic, pReply, fForceReplyPostFifo); + return rc; +} +#endif + +/** + * Writes a value to a register at a given offset. + * + * @returns VBox status code. + * @param pThis Pointer to the LsiLogic SCSI controller instance data. + * @param uOffset Offset of the register to write. + * @param pv Pointer to the value to write + * @param cb Number of bytes to write. + */ +static int lsilogicRegisterWrite(PLSILOGICSCSI pThis, uint32_t uOffset, void *pv, unsigned cb) +{ + uint32_t u32 = *(uint32_t *)pv; + AssertMsg(cb == 4, ("cb != 4 is %d\n", cb)); + + LogFlowFunc(("pThis=%#p uOffset=%#x pv=%#p{%.*Rhxs} cb=%u\n", pThis, uOffset, pv, cb, pv, cb)); + + switch (uOffset) + { + case LSILOGIC_REG_REPLY_QUEUE: + { + /* Add the entry to the reply free queue. */ + ASMAtomicWriteU32(&pThis->CTX_SUFF(pReplyFreeQueueBase)[pThis->uReplyFreeQueueNextEntryFreeWrite], u32); + pThis->uReplyFreeQueueNextEntryFreeWrite++; + pThis->uReplyFreeQueueNextEntryFreeWrite %= pThis->cReplyQueueEntries; + break; + } + case LSILOGIC_REG_REQUEST_QUEUE: + { + ASMAtomicWriteU32(&pThis->CTX_SUFF(pRequestQueueBase)[pThis->uRequestQueueNextEntryFreeWrite], u32); + pThis->uRequestQueueNextEntryFreeWrite++; + pThis->uRequestQueueNextEntryFreeWrite %= pThis->cRequestQueueEntries; + + /* Send notification to R3 if there is not one send already. */ + if (!ASMAtomicXchgBool(&pThis->fNotificationSend, true)) + { + PPDMQUEUEITEMCORE pNotificationItem = PDMQueueAlloc(pThis->CTX_SUFF(pNotificationQueue)); + AssertPtr(pNotificationItem); + + PDMQueueInsert(pThis->CTX_SUFF(pNotificationQueue), pNotificationItem); + } + break; + } + case LSILOGIC_REG_DOORBELL: + { + /* + * When the guest writes to this register a real device would set the + * doorbell status bit in the interrupt status register to indicate that the IOP + * has still to process the message. + * The guest needs to wait with posting new messages here until the bit is cleared. + * Because the guest is not continuing execution while we are here we can skip this. + */ + if (!pThis->fDoorbellInProgress) + { + uint32_t uFunction = LSILOGIC_REG_DOORBELL_GET_FUNCTION(u32); + + switch (uFunction) + { + case LSILOGIC_DOORBELL_FUNCTION_IOC_MSG_UNIT_RESET: + { + pThis->enmState = LSILOGICSTATE_RESET; + + /* Reset interrupt states. */ + pThis->uInterruptMask = 0; + pThis->uInterruptStatus = 0; + lsilogicUpdateInterrupt(pThis); + + /* Reset the queues. */ + pThis->uReplyFreeQueueNextEntryFreeWrite = 0; + pThis->uReplyFreeQueueNextAddressRead = 0; + pThis->uReplyPostQueueNextEntryFreeWrite = 0; + pThis->uReplyPostQueueNextAddressRead = 0; + pThis->uRequestQueueNextEntryFreeWrite = 0; + pThis->uRequestQueueNextAddressRead = 0; + pThis->enmState = LSILOGICSTATE_READY; + break; + } + case LSILOGIC_DOORBELL_FUNCTION_IO_UNIT_RESET: + { + AssertMsgFailed(("todo\n")); + break; + } + case LSILOGIC_DOORBELL_FUNCTION_HANDSHAKE: + { + pThis->cMessage = LSILOGIC_REG_DOORBELL_GET_SIZE(u32); + pThis->iMessage = 0; + AssertMsg(pThis->cMessage <= RT_ELEMENTS(pThis->aMessage), + ("Message doesn't fit into the buffer, cMessage=%u", pThis->cMessage)); + pThis->fDoorbellInProgress = true; + /* Update the interrupt status to notify the guest that a doorbell function was started. */ + lsilogicSetInterrupt(pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); + break; + } + case LSILOGIC_DOORBELL_FUNCTION_REPLY_FRAME_REMOVAL: + { + AssertMsgFailed(("todo\n")); + break; + } + default: + AssertMsgFailed(("Unknown function %u to perform\n", uFunction)); + } + } + else + { + /* + * We are already performing a doorbell function. + * Get the remaining parameters. + */ + AssertMsg(pThis->iMessage < RT_ELEMENTS(pThis->aMessage), ("Message is too big to fit into the buffer\n")); + /* + * If the last byte of the message is written, force a switch to R3 because some requests might force + * a reply through the FIFO which cannot be handled in GC or R0. + */ +#ifndef IN_RING3 + if (pThis->iMessage == pThis->cMessage - 1) + return VINF_IOM_HC_MMIO_WRITE; +#endif + pThis->aMessage[pThis->iMessage++] = u32; +#ifdef IN_RING3 + if (pThis->iMessage == pThis->cMessage) + { + int rc = lsilogicProcessMessageRequest(pThis, (PMptMessageHdr)pThis->aMessage, &pThis->ReplyBuffer); + AssertRC(rc); + } +#endif + } + break; + } + case LSILOGIC_REG_HOST_INTR_STATUS: + { + /* + * Clear the bits the guest wants except the system doorbell interrupt and the IO controller + * status bit. + * The former bit is always cleared no matter what the guest writes to the register and + * the latter one is read only. + */ + pThis->uInterruptStatus = pThis->uInterruptStatus & ~LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL; + + /* + * Check if there is still a doorbell function in progress. Set the + * system doorbell interrupt bit again if it is. + * We do not use lsilogicSetInterrupt here because the interrupt status + * is updated afterwards anyway. + */ + if ( (pThis->fDoorbellInProgress) + && (pThis->cMessage == pThis->iMessage)) + { + if (pThis->uNextReplyEntryRead == pThis->cReplySize) + { + /* Reply finished. Reset doorbell in progress status. */ + Log(("%s: Doorbell function finished\n", __FUNCTION__)); + pThis->fDoorbellInProgress = false; + } + ASMAtomicOrU32(&pThis->uInterruptStatus, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); + } + + lsilogicUpdateInterrupt(pThis); + break; + } + case LSILOGIC_REG_HOST_INTR_MASK: + { + pThis->uInterruptMask = (u32 & LSILOGIC_REG_HOST_INTR_MASK_W_MASK); + lsilogicUpdateInterrupt(pThis); + break; + } + case LSILOGIC_REG_WRITE_SEQUENCE: + { + if (pThis->fDiagnosticEnabled) + { + /* Any value will cause a reset and disabling access. */ + pThis->fDiagnosticEnabled = false; + pThis->iDiagnosticAccess = 0; + } + else if ((u32 & 0xf) == g_lsilogicDiagnosticAccess[pThis->iDiagnosticAccess]) + { + pThis->iDiagnosticAccess++; + if (pThis->iDiagnosticAccess == RT_ELEMENTS(g_lsilogicDiagnosticAccess)) + { + /* + * Key sequence successfully written. Enable access to diagnostic + * memory and register. + */ + pThis->fDiagnosticEnabled = true; + } + } + else + { + /* Wrong value written - reset to beginning. */ + pThis->iDiagnosticAccess = 0; + } + break; + } + default: /* Ignore. */ + { + break; + } + } + return VINF_SUCCESS; +} + +/** + * Reads the content of a register at a given offset. + * + * @returns VBox status code. + * @param pThis Pointer to the LsiLogic SCSI controller instance data. + * @param uOffset Offset of the register to read. + * @param pv Where to store the content of the register. + * @param cb Number of bytes to read. + */ +static int lsilogicRegisterRead(PLSILOGICSCSI pThis, uint32_t uOffset, void *pv, unsigned cb) +{ + uint32_t *pu32 = (uint32_t *)pv; + AssertMsg(cb == 4, ("cb != 4 is %d\n", cb)); + + switch (uOffset) + { + case LSILOGIC_REG_REPLY_QUEUE: + { + if (pThis->uReplyPostQueueNextEntryFreeWrite != pThis->uReplyPostQueueNextAddressRead) + { + *pu32 = pThis->CTX_SUFF(pReplyPostQueueBase)[pThis->uReplyPostQueueNextAddressRead]; + pThis->uReplyPostQueueNextAddressRead++; + pThis->uReplyPostQueueNextAddressRead %= pThis->cReplyQueueEntries; + } + else + { + /* The reply post queue is empty. Reset interrupt. */ + *pu32 = UINT32_C(0xffffffff); + lsilogicClearInterrupt(pThis, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); + } + Log(("%s: Returning address %#x\n", __FUNCTION__, *pu32)); + break; + } + case LSILOGIC_REG_DOORBELL: + { + *pu32 = LSILOGIC_REG_DOORBELL_SET_STATE(pThis->enmState); + *pu32 |= LSILOGIC_REG_DOORBELL_SET_USED(pThis->fDoorbellInProgress); + *pu32 |= LSILOGIC_REG_DOORBELL_SET_WHOINIT(pThis->enmWhoInit); + /* + * If there is a doorbell function in progress we pass the return value + * instead of the status code. We transfer 16bit of the reply + * during one read. + */ + if (pThis->fDoorbellInProgress) + { + /* Return next 16bit value. */ + *pu32 |= pThis->ReplyBuffer.au16Reply[pThis->uNextReplyEntryRead++]; + } + else + { + /* We return the status code of the I/O controller. */ + *pu32 |= pThis->u16IOCFaultCode; + } + break; + } + case LSILOGIC_REG_HOST_INTR_STATUS: + { + *pu32 = pThis->uInterruptStatus; + break; + } + case LSILOGIC_REG_HOST_INTR_MASK: + { + *pu32 = pThis->uInterruptMask; + break; + } + case LSILOGIC_REG_HOST_DIAGNOSTIC: + { + //AssertMsgFailed(("todo\n")); + break; + } + case LSILOGIC_REG_TEST_BASE_ADDRESS: + { + AssertMsgFailed(("todo\n")); + break; + } + case LSILOGIC_REG_DIAG_RW_DATA: + { + AssertMsgFailed(("todo\n")); + break; + } + case LSILOGIC_REG_DIAG_RW_ADDRESS: + { + AssertMsgFailed(("todo\n")); + break; + } + default: /* Ignore. */ + { + break; + } + } + + LogFlowFunc(("pThis=%#p uOffset=%#x pv=%#p{%.*Rhxs} cb=%u\n", pThis, uOffset, pv, cb, pv, cb)); + + return VINF_SUCCESS; +} + +PDMBOTHCBDECL(int) lsilogicIOPortWrite (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t u32, unsigned cb) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + uint32_t uOffset = Port - pThis->IOPortBase; + + Assert(cb <= 4); + + int rc = lsilogicRegisterWrite(pThis, uOffset, &u32, cb); + if (rc == VINF_IOM_HC_MMIO_WRITE) + rc = VINF_IOM_HC_IOPORT_WRITE; + + return rc; +} + +PDMBOTHCBDECL(int) lsilogicIOPortRead (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + uint32_t uOffset = Port - pThis->IOPortBase; + + Assert(cb <= 4); + + return lsilogicRegisterRead(pThis, uOffset, pu32, cb); +} + +PDMBOTHCBDECL(int) lsilogicMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + uint32_t uOffset = GCPhysAddr - pThis->GCPhysMMIOBase; + + return lsilogicRegisterWrite(pThis, uOffset, pv, cb); +} + +PDMBOTHCBDECL(int) lsilogicMMIORead(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + uint32_t uOffset = GCPhysAddr - pThis->GCPhysMMIOBase; + + return lsilogicRegisterRead(pThis, uOffset, pv, cb); +} + +PDMBOTHCBDECL(int) lsilogicDiagnosticWrite(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + LogFlowFunc(("pThis=%#p GCPhysAddr=%RGp pv=%#p{%.*Rhxs} cb=%u\n", pThis, GCPhysAddr, pv, cb, pv, cb)); + + return VINF_SUCCESS; +} + +PDMBOTHCBDECL(int) lsilogicDiagnosticRead(PPDMDEVINS pDevIns, void *pvUser, + RTGCPHYS GCPhysAddr, void *pv, unsigned cb) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + LogFlowFunc(("pThis=%#p GCPhysAddr=%RGp pv=%#p{%.*Rhxs} cb=%u\n", pThis, GCPhysAddr, pv, cb, pv, cb)); + + return VINF_SUCCESS; +} + +#ifdef IN_RING3 + +/** + * Copies a contigous buffer into the scatter gather list provided by the guest. + * + * @returns nothing + * @param pTaskState Pointer to the task state which contains the SGL. + * @param pvBuf Pointer to the buffer to copy. + * @param cbCopy Number of bytes to copy. + */ +static void lsilogicScatterGatherListCopyFromBuffer(PLSILOGICTASKSTATE pTaskState, void *pvBuf, size_t cbCopy) +{ + unsigned cSGEntry = 0; + PPDMDATASEG pSGEntry = &pTaskState->pSGListHead[cSGEntry]; + uint8_t *pu8Buf = (uint8_t *)pvBuf; + + while (cSGEntry < pTaskState->cSGListEntries) + { + size_t cbToCopy = (cbCopy < pSGEntry->cbSeg) ? cbCopy : pSGEntry->cbSeg; + + memcpy(pSGEntry->pvSeg, pu8Buf, cbToCopy); + + cbCopy -= cbToCopy; + /* We finished. */ + if (!cbCopy) + break; + + /* Advance the buffer. */ + pu8Buf += cbToCopy; + + /* Go to the next entry in the list. */ + pSGEntry++; + cSGEntry++; + } +} + +/** + * Copy a temporary buffer into a part of the guest scatter gather list + * described by the given descriptor entry. + * + * @returns nothing. + * @param pDevIns Pointer to the device instance data. + * @param pSGInfo Pointer to the segment info structure which describes the guest segments + * to write to which are unaligned. + */ +static void lsilogicCopyFromBufferIntoSGList(PPDMDEVINS pDevIns, PLSILOGICTASKSTATESGENTRY pSGInfo) +{ + RTGCPHYS GCPhysBuffer = pSGInfo->u.GCPhysAddrBufferUnaligned; + + AssertMsg(!pSGInfo->fGuestMemory, ("This is not possible\n")); + + /* Copy into SG entry. */ + PDMDevHlpPhysWrite(pDevIns, GCPhysBuffer, pSGInfo->pvBuf, pSGInfo->cbBuf); + +} + +/** + * Copy a part of the guest scatter gather list into a temporary buffer. + * + * @returns nothing. + * @param pDevIns Pointer to the device instance data. + * @param pSGInfo Pointer to the segment info structure which describes the guest segments + * to read from which are unaligned. + */ +static void lsilogicCopyFromSGListIntoBuffer(PPDMDEVINS pDevIns, PLSILOGICTASKSTATESGENTRY pSGInfo) +{ + RTGCPHYS GCPhysBuffer = pSGInfo->u.GCPhysAddrBufferUnaligned; + + AssertMsg(!pSGInfo->fGuestMemory, ("This is not possible\n")); + + /* Copy into temporary buffer. */ + PDMDevHlpPhysRead(pDevIns, GCPhysBuffer, pSGInfo->pvBuf, pSGInfo->cbBuf); +} + +static int lsilogicScatterGatherListAllocate(PLSILOGICTASKSTATE pTaskState, uint32_t cSGList, uint32_t cSGInfo, uint32_t cbUnaligned) +{ + if (pTaskState->cSGListSize < cSGList) + { + /* The entries are not allocated yet or the number is too small. */ + if (pTaskState->cSGListSize) + RTMemFree(pTaskState->pSGListHead); + + /* Allocate R3 scatter gather list. */ + pTaskState->pSGListHead = (PPDMDATASEG)RTMemAllocZ(cSGList * sizeof(PDMDATASEG)); + if (!pTaskState->pSGListHead) + return VERR_NO_MEMORY; + + /* Reset usage statistics. */ + pTaskState->cSGListSize = cSGList; + pTaskState->cSGListEntries = cSGList; + pTaskState->cSGListTooBig = 0; + } + else if (pTaskState->cSGListSize > cSGList) + { + /* + * The list is too big. Increment counter. + * So that the destroying function can free + * the list if it is too big too many times + * in a row. + */ + pTaskState->cSGListEntries = cSGList; + pTaskState->cSGListTooBig++; + } + else + { + /* + * Needed entries matches current size. + * Reset counter. + */ + pTaskState->cSGListEntries = cSGList; + pTaskState->cSGListTooBig = 0; + } + + if (pTaskState->cSGInfoSize < cSGInfo) + { + /* The entries are not allocated yet or the number is too small. */ + if (pTaskState->cSGInfoSize) + RTMemFree(pTaskState->paSGEntries); + + pTaskState->paSGEntries = (PLSILOGICTASKSTATESGENTRY)RTMemAllocZ(cSGInfo * sizeof(LSILOGICTASKSTATESGENTRY)); + if (!pTaskState->paSGEntries) + return VERR_NO_MEMORY; + + /* Reset usage statistics. */ + pTaskState->cSGInfoSize = cSGInfo; + pTaskState->cSGInfoEntries = cSGInfo; + pTaskState->cSGInfoTooBig = 0; + } + else if (pTaskState->cSGInfoSize > cSGInfo) + { + /* + * The list is too big. Increment counter. + * So that the destroying function can free + * the list if it is too big too many times + * in a row. + */ + pTaskState->cSGInfoEntries = cSGInfo; + pTaskState->cSGInfoTooBig++; + } + else + { + /* + * Needed entries matches current size. + * Reset counter. + */ + pTaskState->cSGInfoEntries = cSGInfo; + pTaskState->cSGInfoTooBig = 0; + } + + + if (pTaskState->cbBufferUnaligned < cbUnaligned) + { + if (pTaskState->pvBufferUnaligned) + RTMemFree(pTaskState->pvBufferUnaligned); + + Log(("%s: Allocating buffer for unaligned segments cbUnaligned=%u\n", __FUNCTION__, cbUnaligned)); + + pTaskState->pvBufferUnaligned = RTMemAllocZ(cbUnaligned); + if (!pTaskState->pvBufferUnaligned) + return VERR_NO_MEMORY; + + pTaskState->cbBufferUnaligned = cbUnaligned; + } + + /* Make debugging easier. */ +#ifdef DEBUG + memset(pTaskState->pSGListHead, 0, pTaskState->cSGListSize * sizeof(PDMDATASEG)); + memset(pTaskState->paSGEntries, 0, pTaskState->cSGInfoSize * sizeof(LSILOGICTASKSTATESGENTRY)); + if (pTaskState->pvBufferUnaligned) + memset(pTaskState->pvBufferUnaligned, 0, pTaskState->cbBufferUnaligned); +#endif + return VINF_SUCCESS; +} + +/** + * Destroy a scatter gather list. + * + * @returns nothing. + * @param pLsiLogic Pointer to the LsiLogic SCSI controller. + * @param pTaskState Pointer to the task state. + */ +static void lsilogicScatterGatherListDestroy(PLSILOGICSCSI pLsiLogic, PLSILOGICTASKSTATE pTaskState) +{ + PPDMDEVINS pDevIns = pLsiLogic->CTX_SUFF(pDevIns); + PLSILOGICTASKSTATESGENTRY pSGInfoCurr = pTaskState->paSGEntries; + + for (unsigned i = 0; i < pTaskState->cSGInfoEntries; i++) + { + if (pSGInfoCurr->fGuestMemory) + { + /* Release the lock. */ + PDMDevHlpPhysReleasePageMappingLock(pDevIns, &pSGInfoCurr->u.PageLock); + } + else if (!pSGInfoCurr->fBufferContainsData) + { + /* Copy the data into the guest segments now. */ + lsilogicCopyFromBufferIntoSGList(pLsiLogic->CTX_SUFF(pDevIns), pSGInfoCurr); + } + + pSGInfoCurr++; + } + + /* Free allocated memory if the list was too big too many times. */ + if (pTaskState->cSGListTooBig >= LSILOGIC_NR_OF_ALLOWED_BIGGER_LISTS) + { + RTMemFree(pTaskState->pSGListHead); + RTMemFree(pTaskState->paSGEntries); + if (pTaskState->pvBufferUnaligned) + RTMemFree(pTaskState->pvBufferUnaligned); + pTaskState->cSGListSize = 0; + pTaskState->cSGInfoSize = 0; + pTaskState->cSGInfoEntries = 0; + pTaskState->cSGListTooBig = 0; + pTaskState->pSGListHead = NULL; + pTaskState->paSGEntries = NULL; + pTaskState->pvBufferUnaligned = NULL; + pTaskState->cbBufferUnaligned = 0; + } +} + +#ifdef DEBUG +/** + * Dump an SG entry. + * + * @returns nothing. + * @param pSGEntry Pointer to the SG entry to dump + */ +static void lsilogicDumpSGEntry(PMptSGEntryUnion pSGEntry) +{ + switch (pSGEntry->Simple32.u2ElementType) + { + case MPTSGENTRYTYPE_SIMPLE: + { + Log(("%s: Dumping info for SIMPLE SG entry:\n", __FUNCTION__)); + Log(("%s: u24Length=%u\n", __FUNCTION__, pSGEntry->Simple32.u24Length)); + Log(("%s: fEndOfList=%d\n", __FUNCTION__, pSGEntry->Simple32.fEndOfList)); + Log(("%s: f64BitAddress=%d\n", __FUNCTION__, pSGEntry->Simple32.f64BitAddress)); + Log(("%s: fBufferContainsData=%d\n", __FUNCTION__, pSGEntry->Simple32.fBufferContainsData)); + Log(("%s: fLocalAddress=%d\n", __FUNCTION__, pSGEntry->Simple32.fLocalAddress)); + Log(("%s: fEndOfBuffer=%d\n", __FUNCTION__, pSGEntry->Simple32.fEndOfBuffer)); + Log(("%s: fLastElement=%d\n", __FUNCTION__, pSGEntry->Simple32.fLastElement)); + Log(("%s: u32DataBufferAddressLow=%u\n", __FUNCTION__, pSGEntry->Simple32.u32DataBufferAddressLow)); + if (pSGEntry->Simple32.f64BitAddress) + { + Log(("%s: u32DataBufferAddressHigh=%u\n", __FUNCTION__, pSGEntry->Simple64.u32DataBufferAddressHigh)); + Log(("%s: GCDataBufferAddress=%RGp\n", __FUNCTION__, + ((uint64_t)pSGEntry->Simple64.u32DataBufferAddressHigh << 32) | pSGEntry->Simple64.u32DataBufferAddressLow)); + } + else + Log(("%s: GCDataBufferAddress=%RGp\n", __FUNCTION__, pSGEntry->Simple32.u32DataBufferAddressLow)); + + break; + } + case MPTSGENTRYTYPE_CHAIN: + { + Log(("%s: Dumping info for CHAIN SG entry:\n", __FUNCTION__)); + Log(("%s: u16Length=%u\n", __FUNCTION__, pSGEntry->Chain.u16Length)); + Log(("%s: u8NExtChainOffset=%d\n", __FUNCTION__, pSGEntry->Chain.u8NextChainOffset)); + Log(("%s: f64BitAddress=%d\n", __FUNCTION__, pSGEntry->Chain.f64BitAddress)); + Log(("%s: fLocalAddress=%d\n", __FUNCTION__, pSGEntry->Chain.fLocalAddress)); + Log(("%s: u32SegmentAddressLow=%u\n", __FUNCTION__, pSGEntry->Chain.u32SegmentAddressLow)); + Log(("%s: u32SegmentAddressHigh=%u\n", __FUNCTION__, pSGEntry->Chain.u32SegmentAddressHigh)); + if (pSGEntry->Chain.f64BitAddress) + Log(("%s: GCSegmentAddress=%RGp\n", __FUNCTION__, + ((uint64_t)pSGEntry->Chain.u32SegmentAddressHigh << 32) | pSGEntry->Chain.u32SegmentAddressLow)); + else + Log(("%s: GCSegmentAddress=%RGp\n", __FUNCTION__, pSGEntry->Chain.u32SegmentAddressLow)); + break; + } + } +} +#endif + +/** + * Create scatter gather list descriptors. + * + * @returns VBox status code. + * @param pLsiLogic Pointer to the LsiLogic SCSI controller. + * @param pTaskState Pointer to the task state. + * @param GCPhysSGLStart Guest physical address of the first SG entry. + * @param uChainOffset Offset in bytes from the beginning of the SGL segment to the chain element. + * @thread EMT + */ +static int lsilogicScatterGatherListCreate(PLSILOGICSCSI pLsiLogic, PLSILOGICTASKSTATE pTaskState, + RTGCPHYS GCPhysSGLStart, uint32_t uChainOffset) +{ + int rc = VINF_SUCCESS; + PPDMDEVINS pDevIns = pLsiLogic->CTX_SUFF(pDevIns); + PVM pVM = PDMDevHlpGetVM(pDevIns); + bool fUnaligned; /* Flag whether the current buffer is unaligned. */ + uint32_t cbUnaligned; /* Size of the unaligned buffers. */ + uint32_t cSGEntriesR3 = 0; + uint32_t cSGInfo = 0; + uint32_t cbSegment = 0; + PLSILOGICTASKSTATESGENTRY pSGInfoCurr = NULL; + uint8_t *pu8BufferUnalignedPos = NULL; + uint8_t *pbBufferUnalignedSGInfoPos = NULL; + uint32_t cbUnalignedComplete = 0; + bool fDoMapping = false; + bool fEndOfList; + RTGCPHYS GCPhysSGEntryNext; + RTGCPHYS GCPhysSegmentStart; + uint32_t uChainOffsetNext; + + /* + * Two passes - one to count needed scatter gather list entries and needed unaligned + * buffers and one to actually map the SG list into R3. + */ + for (int i = 0; i < 2; i++) + { + fUnaligned = false; + cbUnaligned = 0; + fEndOfList = false; + + GCPhysSGEntryNext = GCPhysSGLStart; + uChainOffsetNext = uChainOffset; + GCPhysSegmentStart = GCPhysSGLStart; + + if (fDoMapping) + { + Log(("%s: cSGInfo=%u\n", __FUNCTION__, cSGInfo)); + + /* The number of needed SG entries in R3 is known. Allocate needed memory. */ + rc = lsilogicScatterGatherListAllocate(pTaskState, cSGInfo, cSGInfo, cbUnalignedComplete); + AssertMsgRC(rc, ("Failed to allocate scatter gather array rc=%Rrc\n", rc)); + + /* We are now able to map the pages into R3. */ + pSGInfoCurr = pTaskState->paSGEntries; + /* Initialize first segment to remove the need for additional if checks later in the code. */ + pSGInfoCurr->fGuestMemory= false; + pu8BufferUnalignedPos = (uint8_t *)pTaskState->pvBufferUnaligned; + pbBufferUnalignedSGInfoPos = pu8BufferUnalignedPos; + } + + /* Go through the list until we reach the end. */ + while (!fEndOfList) + { + bool fEndOfSegment = false; + + while (!fEndOfSegment) + { + MptSGEntryUnion SGEntry; + + Log(("%s: Reading SG entry from %RGp\n", __FUNCTION__, GCPhysSGEntryNext)); + + /* Read the entry. */ + PDMDevHlpPhysRead(pDevIns, GCPhysSGEntryNext, &SGEntry, sizeof(MptSGEntryUnion)); + +#ifdef DEBUG + lsilogicDumpSGEntry(&SGEntry); +#endif + + AssertMsg(SGEntry.Simple32.u2ElementType == MPTSGENTRYTYPE_SIMPLE, ("Invalid SG entry type\n")); + + /* Check if this is a zero element. */ + if ( !SGEntry.Simple32.u24Length + && SGEntry.Simple32.fEndOfList + && SGEntry.Simple32.fEndOfBuffer) + { + pTaskState->cSGListEntries = 0; + pTaskState->cSGInfoEntries = 0; + return VINF_SUCCESS; + } + + uint32_t cbDataToTransfer = SGEntry.Simple32.u24Length; + bool fBufferContainsData = !!SGEntry.Simple32.fBufferContainsData; + RTGCPHYS GCPhysAddrDataBuffer = SGEntry.Simple32.u32DataBufferAddressLow; + + if (SGEntry.Simple32.f64BitAddress) + { + GCPhysAddrDataBuffer |= ((uint64_t)SGEntry.Simple64.u32DataBufferAddressHigh) << 32; + GCPhysSGEntryNext += sizeof(MptSGEntrySimple64); + } + else + GCPhysSGEntryNext += sizeof(MptSGEntrySimple32); + + if (fDoMapping) + { + pSGInfoCurr->fGuestMemory = false; + pSGInfoCurr->fBufferContainsData = fBufferContainsData; + pSGInfoCurr->cbBuf = cbDataToTransfer; + pSGInfoCurr->pvBuf = pbBufferUnalignedSGInfoPos; + pbBufferUnalignedSGInfoPos += cbDataToTransfer; + pSGInfoCurr->u.GCPhysAddrBufferUnaligned = GCPhysAddrDataBuffer; + if (fBufferContainsData) + lsilogicCopyFromSGListIntoBuffer(pDevIns, pSGInfoCurr); + pSGInfoCurr++; + } + else + { + cbUnalignedComplete += cbDataToTransfer; + cSGInfo++; + } + + /* Check if we reached the end of the list. */ + if (SGEntry.Simple32.fEndOfList) + { + /* We finished. */ + fEndOfSegment = true; + fEndOfList = true; + } + else if (SGEntry.Simple32.fLastElement) + { + fEndOfSegment = true; + } + } /* while (!fEndOfSegment) */ + + /* Get next chain element. */ + if (uChainOffsetNext) + { + MptSGEntryChain SGEntryChain; + + PDMDevHlpPhysRead(pDevIns, GCPhysSegmentStart + uChainOffsetNext, &SGEntryChain, sizeof(MptSGEntryChain)); + + AssertMsg(SGEntryChain.u2ElementType == MPTSGENTRYTYPE_CHAIN, ("Invalid SG entry type\n")); + + /* Set the next address now. */ + GCPhysSGEntryNext = SGEntryChain.u32SegmentAddressLow; + if (SGEntryChain.f64BitAddress) + GCPhysSGEntryNext |= ((uint64_t)SGEntryChain.u32SegmentAddressHigh) << 32; + + GCPhysSegmentStart = GCPhysSGEntryNext; + uChainOffsetNext = SGEntryChain.u8NextChainOffset * sizeof(uint32_t); + } + + } /* while (!fEndOfList) */ + + fDoMapping = true; + if (fUnaligned) + cbUnalignedComplete += cbUnaligned; + } + + uint32_t cSGEntries; + PPDMDATASEG pSGEntryCurr = pTaskState->pSGListHead; + pSGInfoCurr = pTaskState->paSGEntries; + + /* Initialize first entry. */ + pSGEntryCurr->pvSeg = pSGInfoCurr->pvBuf; + pSGEntryCurr->cbSeg = pSGInfoCurr->cbBuf; + pSGInfoCurr++; + cSGEntries = 1; + + /* Construct the scatter gather list. */ + for (unsigned i = 0; i < (pTaskState->cSGInfoEntries-1); i++) + { + if (pSGEntryCurr->cbSeg % 512 != 0) + { + AssertMsg((uint8_t *)pSGEntryCurr->pvSeg + pSGEntryCurr->cbSeg == pSGInfoCurr->pvBuf, + ("Buffer ist not sector aligned but the buffer addresses are not adjacent\n")); + + pSGEntryCurr->cbSeg += pSGInfoCurr->cbBuf; + } + else + { + if (((uint8_t *)pSGEntryCurr->pvSeg + pSGEntryCurr->cbSeg) == pSGInfoCurr->pvBuf) + { + pSGEntryCurr->cbSeg += pSGInfoCurr->cbBuf; + } + else + { + pSGEntryCurr++; + cSGEntries++; + pSGEntryCurr->pvSeg = pSGInfoCurr->pvBuf; + pSGEntryCurr->cbSeg = pSGInfoCurr->cbBuf; + } + } + + pSGInfoCurr++; + } + + pTaskState->cSGListEntries = cSGEntries; + + return rc; +} + +/* + * Disabled because the sense buffer provided by the LsiLogic driver for Windows XP + * crosses page boundaries. + */ +#if 0 +/** + * Free the sense buffer. + * + * @returns nothing. + * @param pTaskState Pointer to the task state. + */ +static void lsilogicFreeGCSenseBuffer(PLSILOGICSCSI pLsiLogic, PLSILOGICTASKSTATE pTaskState) +{ + PVM pVM = PDMDevHlpGetVM(pLsiLogic->CTX_SUFF(pDevIns)); + + PGMPhysReleasePageMappingLock(pVM, &pTaskState->PageLockSense); + pTaskState->pbSenseBuffer = NULL; +} + +/** + * Map the sense buffer into R3. + * + * @returns VBox status code. + * @param pTaskState Pointer to the task state. + * @note Current assumption is that the sense buffer is not scattered and does not cross a page boundary. + */ +static int lsilogicMapGCSenseBufferIntoR3(PLSILOGICSCSI pLsiLogic, PLSILOGICTASKSTATE pTaskState) +{ + int rc = VINF_SUCCESS; + PPDMDEVINS pDevIns = pLsiLogic->CTX_SUFF(pDevIns); + RTGCPHYS GCPhysAddrSenseBuffer; + + GCPhysAddrSenseBuffer = pTaskState->GuestRequest.SCSIIO.u32SenseBufferLowAddress; + GCPhysAddrSenseBuffer |= ((uint64_t)pLsiLogic->u32SenseBufferHighAddr << 32); + +#ifdef RT_STRICT + uint32_t cbSenseBuffer = pTaskState->GuestRequest.SCSIIO.u8SenseBufferLength; +#endif + RTGCPHYS GCPhysAddrSenseBufferBase = PAGE_ADDRESS(GCPhysAddrSenseBuffer); + + AssertMsg(GCPhysAddrSenseBuffer >= GCPhysAddrSenseBufferBase, + ("Impossible GCPhysAddrSenseBuffer < GCPhysAddrSenseBufferBase\n")); + + /* Sanity checks for the assumption. */ + AssertMsg(((GCPhysAddrSenseBuffer + cbSenseBuffer) <= (GCPhysAddrSenseBufferBase + PAGE_SIZE)), + ("Sense buffer crosses page boundary\n")); + + rc = PDMDevHlpPhysGCPhys2CCPtr(pDevIns, GCPhysAddrSenseBufferBase, (void **)&pTaskState->pbSenseBuffer, &pTaskState->PageLockSense); + AssertMsgRC(rc, ("Mapping sense buffer failed rc=%Rrc\n", rc)); + + /* Correct start address of the sense buffer. */ + pTaskState->pbSenseBuffer += (GCPhysAddrSenseBuffer - GCPhysAddrSenseBufferBase); + + return rc; +} +#endif + +#ifdef DEBUG +static void lsilogicDumpSCSIIORequest(PMptSCSIIORequest pSCSIIORequest) +{ + Log(("%s: u8TargetID=%d\n", __FUNCTION__, pSCSIIORequest->u8TargetID)); + Log(("%s: u8Bus=%d\n", __FUNCTION__, pSCSIIORequest->u8Bus)); + Log(("%s: u8ChainOffset=%d\n", __FUNCTION__, pSCSIIORequest->u8ChainOffset)); + Log(("%s: u8Function=%d\n", __FUNCTION__, pSCSIIORequest->u8Function)); + Log(("%s: u8CDBLength=%d\n", __FUNCTION__, pSCSIIORequest->u8CDBLength)); + Log(("%s: u8SenseBufferLength=%d\n", __FUNCTION__, pSCSIIORequest->u8SenseBufferLength)); + Log(("%s: u8MessageFlags=%d\n", __FUNCTION__, pSCSIIORequest->u8MessageFlags)); + Log(("%s: u32MessageContext=%#x\n", __FUNCTION__, pSCSIIORequest->u32MessageContext)); + for (unsigned i = 0; i < RT_ELEMENTS(pSCSIIORequest->au8LUN); i++) + Log(("%s: u8LUN[%d]=%d\n", __FUNCTION__, i, pSCSIIORequest->au8LUN[i])); + Log(("%s: u32Control=%#x\n", __FUNCTION__, pSCSIIORequest->u32Control)); + for (unsigned i = 0; i < RT_ELEMENTS(pSCSIIORequest->au8CDB); i++) + Log(("%s: u8CDB[%d]=%d\n", __FUNCTION__, i, pSCSIIORequest->au8CDB[i])); + Log(("%s: u32DataLength=%#x\n", __FUNCTION__, pSCSIIORequest->u32DataLength)); + Log(("%s: u32SenseBufferLowAddress=%#x\n", __FUNCTION__, pSCSIIORequest->u32SenseBufferLowAddress)); +} +#endif + +/** + * Processes a SCSI I/O request by setting up the request + * and sending it to the underlying SCSI driver. + * Steps needed to complete request are done in the + * callback called by the driver below upon completion of + * the request. + * + * @returns VBox status code. + * @param pLsiLogic Pointer to the device instance which sends the request. + * @param pTaskState Pointer to the task state data. + */ +static int lsilogicProcessSCSIIORequest(PLSILOGICSCSI pLsiLogic, PLSILOGICTASKSTATE pTaskState) +{ + int rc = VINF_SUCCESS; + +#ifdef DEBUG + lsilogicDumpSCSIIORequest(&pTaskState->GuestRequest.SCSIIO); +#endif + + pTaskState->fBIOS = false; + + uint32_t uChainOffset = pTaskState->GuestRequest.SCSIIO.u8ChainOffset; + + if (uChainOffset) + uChainOffset = uChainOffset * sizeof(uint32_t) - sizeof(MptSCSIIORequest); + + /* Create Scatter gather list. */ + rc = lsilogicScatterGatherListCreate(pLsiLogic, pTaskState, + pTaskState->GCPhysMessageFrameAddr + sizeof(MptSCSIIORequest), + uChainOffset); + AssertRC(rc); + +#if 0 + /* Map sense buffer. */ + rc = lsilogicMapGCSenseBufferIntoR3(pLsiLogic, pTaskState); + AssertRC(rc); +#endif + + if (RT_LIKELY( (pTaskState->GuestRequest.SCSIIO.u8TargetID < LSILOGIC_DEVICES_MAX) + && (pTaskState->GuestRequest.SCSIIO.u8Bus == 0))) + { + PLSILOGICDEVICE pTargetDevice; + pTargetDevice = &pLsiLogic->aDeviceStates[pTaskState->GuestRequest.SCSIIO.u8TargetID]; + + if (pTargetDevice->pDrvBase) + { + /* Setup the SCSI request. */ + pTaskState->pTargetDevice = pTargetDevice; + pTaskState->PDMScsiRequest.uLogicalUnit = pTaskState->GuestRequest.SCSIIO.au8LUN[1]; + + uint8_t uDataDirection = MPT_SCSIIO_REQUEST_CONTROL_TXDIR_GET(pTaskState->GuestRequest.SCSIIO.u32Control); + + if (uDataDirection == MPT_SCSIIO_REQUEST_CONTROL_TXDIR_NONE) + pTaskState->PDMScsiRequest.uDataDirection = PDMSCSIREQUESTTXDIR_NONE; + else if (uDataDirection == MPT_SCSIIO_REQUEST_CONTROL_TXDIR_WRITE) + pTaskState->PDMScsiRequest.uDataDirection = PDMSCSIREQUESTTXDIR_TO_DEVICE; + else if (uDataDirection == MPT_SCSIIO_REQUEST_CONTROL_TXDIR_READ) + pTaskState->PDMScsiRequest.uDataDirection = PDMSCSIREQUESTTXDIR_FROM_DEVICE; + + pTaskState->PDMScsiRequest.cbCDB = pTaskState->GuestRequest.SCSIIO.u8CDBLength; + pTaskState->PDMScsiRequest.pbCDB = pTaskState->GuestRequest.SCSIIO.au8CDB; + pTaskState->PDMScsiRequest.cbScatterGather = pTaskState->GuestRequest.SCSIIO.u32DataLength; + pTaskState->PDMScsiRequest.cScatterGatherEntries = pTaskState->cSGListEntries; + pTaskState->PDMScsiRequest.paScatterGatherHead = pTaskState->pSGListHead; + pTaskState->PDMScsiRequest.cbSenseBuffer = sizeof(pTaskState->abSenseBuffer); + memset(pTaskState->abSenseBuffer, 0, pTaskState->PDMScsiRequest.cbSenseBuffer); + pTaskState->PDMScsiRequest.pbSenseBuffer = pTaskState->abSenseBuffer; + pTaskState->PDMScsiRequest.pvUser = pTaskState; + + ASMAtomicIncU32(&pTargetDevice->cOutstandingRequests); + rc = pTargetDevice->pDrvSCSIConnector->pfnSCSIRequestSend(pTargetDevice->pDrvSCSIConnector, &pTaskState->PDMScsiRequest); + AssertMsgRC(rc, ("Sending request to SCSI layer failed rc=%Rrc\n", rc)); + return VINF_SUCCESS; + } + else + { + /* Device is not present report SCSI selection timeout. */ + pTaskState->IOCReply.SCSIIOError.u16IOCStatus = MPT_SCSI_IO_ERROR_IOCSTATUS_DEVICE_NOT_THERE; + } + } + else + { + /* Report out of bounds target ID or bus. */ + if (pTaskState->GuestRequest.SCSIIO.u8Bus != 0) + pTaskState->IOCReply.SCSIIOError.u16IOCStatus = MPT_SCSI_IO_ERROR_IOCSTATUS_INVALID_BUS; + else + pTaskState->IOCReply.SCSIIOError.u16IOCStatus = MPT_SCSI_IO_ERROR_IOCSTATUS_INVALID_TARGETID; + } + + /* The rest is equal to both errors. */ + pTaskState->IOCReply.SCSIIOError.u8TargetID = pTaskState->GuestRequest.SCSIIO.u8TargetID; + pTaskState->IOCReply.SCSIIOError.u8Bus = pTaskState->GuestRequest.SCSIIO.u8Bus; + pTaskState->IOCReply.SCSIIOError.u8MessageLength = sizeof(MptSCSIIOErrorReply) / 4; + pTaskState->IOCReply.SCSIIOError.u8Function = pTaskState->GuestRequest.SCSIIO.u8Function; + pTaskState->IOCReply.SCSIIOError.u8CDBLength = pTaskState->GuestRequest.SCSIIO.u8CDBLength; + pTaskState->IOCReply.SCSIIOError.u8SenseBufferLength = pTaskState->GuestRequest.SCSIIO.u8SenseBufferLength; + pTaskState->IOCReply.SCSIIOError.u32MessageContext = pTaskState->GuestRequest.SCSIIO.u32MessageContext; + pTaskState->IOCReply.SCSIIOError.u8SCSIStatus = SCSI_STATUS_OK; + pTaskState->IOCReply.SCSIIOError.u8SCSIState = MPT_SCSI_IO_ERROR_SCSI_STATE_TERMINATED; + pTaskState->IOCReply.SCSIIOError.u32IOCLogInfo = 0; + pTaskState->IOCReply.SCSIIOError.u32TransferCount = 0; + pTaskState->IOCReply.SCSIIOError.u32SenseCount = 0; + pTaskState->IOCReply.SCSIIOError.u32ResponseInfo = 0; + + lsilogicFinishAddressReply(pLsiLogic, &pTaskState->IOCReply, false); + RTCacheInsert(pLsiLogic->pTaskCache, pTaskState); + + return rc; +} + +/** + * Called upon completion of the request from the SCSI driver below. + * This function frees all allocated ressources and notifies the guest + * that the process finished by asserting an interrupt. + * + * @returns VBox status code. + * @param pInterface Pointer to the interface the called funtion belongs to. + * @param pSCSIRequest Pointer to the SCSI request which finished. + */ +static DECLCALLBACK(int) lsilogicDeviceSCSIRequestCompleted(PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest, int rcCompletion) +{ + PLSILOGICTASKSTATE pTaskState = (PLSILOGICTASKSTATE)pSCSIRequest->pvUser; + PLSILOGICDEVICE pLsiLogicDevice = pTaskState->pTargetDevice; + PLSILOGICSCSI pLsiLogic = pLsiLogicDevice->CTX_SUFF(pLsiLogic); + + ASMAtomicDecU32(&pLsiLogicDevice->cOutstandingRequests); + + if (RT_UNLIKELY(pTaskState->fBIOS)) + { + int rc = vboxscsiRequestFinished(&pLsiLogic->VBoxSCSI, pSCSIRequest); + AssertMsgRC(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc)); + } + else + { +#if 0 + lsilogicFreeGCSenseBuffer(pLsiLogic, pTaskState); +#else + RTGCPHYS GCPhysAddrSenseBuffer; + + GCPhysAddrSenseBuffer = pTaskState->GuestRequest.SCSIIO.u32SenseBufferLowAddress; + GCPhysAddrSenseBuffer |= ((uint64_t)pLsiLogic->u32SenseBufferHighAddr << 32); + + /* Copy the sense buffer over. */ + PDMDevHlpPhysWrite(pLsiLogic->CTX_SUFF(pDevIns), GCPhysAddrSenseBuffer, pTaskState->abSenseBuffer, + RT_UNLIKELY(pTaskState->GuestRequest.SCSIIO.u8SenseBufferLength < pTaskState->PDMScsiRequest.cbSenseBuffer) + ? pTaskState->GuestRequest.SCSIIO.u8SenseBufferLength + : pTaskState->PDMScsiRequest.cbSenseBuffer); +#endif + lsilogicScatterGatherListDestroy(pLsiLogic, pTaskState); + + + if (RT_LIKELY(rcCompletion == SCSI_STATUS_OK)) + lsilogicFinishContextReply(pLsiLogic, pTaskState->GuestRequest.SCSIIO.u32MessageContext); + else + { + /* The SCSI target encountered an error during processing post a reply. */ + memset(&pTaskState->IOCReply, 0, sizeof(MptReplyUnion)); + pTaskState->IOCReply.SCSIIOError.u8TargetID = pTaskState->GuestRequest.SCSIIO.u8TargetID; + pTaskState->IOCReply.SCSIIOError.u8Bus = pTaskState->GuestRequest.SCSIIO.u8Bus; + pTaskState->IOCReply.SCSIIOError.u8MessageLength = 8; + pTaskState->IOCReply.SCSIIOError.u8Function = pTaskState->GuestRequest.SCSIIO.u8Function; + pTaskState->IOCReply.SCSIIOError.u8CDBLength = pTaskState->GuestRequest.SCSIIO.u8CDBLength; + pTaskState->IOCReply.SCSIIOError.u8SenseBufferLength = pTaskState->GuestRequest.SCSIIO.u8SenseBufferLength; + pTaskState->IOCReply.SCSIIOError.u8MessageFlags = pTaskState->GuestRequest.SCSIIO.u8MessageFlags; + pTaskState->IOCReply.SCSIIOError.u32MessageContext = pTaskState->GuestRequest.SCSIIO.u32MessageContext; + pTaskState->IOCReply.SCSIIOError.u8SCSIStatus = rcCompletion; + pTaskState->IOCReply.SCSIIOError.u8SCSIState = MPT_SCSI_IO_ERROR_SCSI_STATE_AUTOSENSE_VALID; + pTaskState->IOCReply.SCSIIOError.u16IOCStatus = 0; + pTaskState->IOCReply.SCSIIOError.u32IOCLogInfo = 0; + pTaskState->IOCReply.SCSIIOError.u32TransferCount = 0; + pTaskState->IOCReply.SCSIIOError.u32SenseCount = sizeof(pTaskState->abSenseBuffer); + pTaskState->IOCReply.SCSIIOError.u32ResponseInfo = 0; + + lsilogicFinishAddressReply(pLsiLogic, &pTaskState->IOCReply, true); + } + } + + RTCacheInsert(pLsiLogic->pTaskCache, pTaskState); + + return VINF_SUCCESS; +} + +/** + * Return the configuration page header and data + * which matches the given page type and number. + * + * @returns VINF_SUCCESS if successful + * VERR_NOT_FOUND if the requested page could be found. + * @param u8PageNumber Number of the page to get. + * @param ppPageHeader Where to store the pointer to the page header. + * @param ppbPageData Where to store the pointer to the page data. + */ +static int lsilogicConfigurationIOUnitPageGetFromNumber(PLSILOGICSCSI pLsiLogic, uint8_t u8PageNumber, + PMptConfigurationPageHeader *ppPageHeader, + uint8_t **ppbPageData, size_t *pcbPage) +{ + int rc = VINF_SUCCESS; + + AssertMsg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n")); + + switch(u8PageNumber) + { + case 0: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOUnitPage0.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOUnitPage0.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOUnitPage0); + break; + case 1: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOUnitPage1.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOUnitPage1.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOUnitPage1); + break; + case 2: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOUnitPage2.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOUnitPage2.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOUnitPage2); + break; + case 3: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOUnitPage3.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOUnitPage3.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOUnitPage3); + break; + default: + rc = VERR_NOT_FOUND; + } + + return rc; +} + +/** + * Return the configuration page header and data + * which matches the given page type and number. + * + * @returns VINF_SUCCESS if successful + * VERR_NOT_FOUND if the requested page could be found. + * @param u8PageNumber Number of the page to get. + * @param ppPageHeader Where to store the pointer to the page header. + * @param ppbPageData Where to store the pointer to the page data. + */ +static int lsilogicConfigurationIOCPageGetFromNumber(PLSILOGICSCSI pLsiLogic, uint8_t u8PageNumber, + PMptConfigurationPageHeader *ppPageHeader, + uint8_t **ppbPageData, size_t *pcbPage) +{ + int rc = VINF_SUCCESS; + + AssertMsg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n")); + + switch(u8PageNumber) + { + case 0: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOCPage0.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOCPage0.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOCPage0); + break; + case 1: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOCPage1.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOCPage1.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOCPage1); + break; + case 2: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOCPage2.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOCPage2.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOCPage2); + break; + case 3: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOCPage3.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOCPage3.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOCPage3); + break; + case 4: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOCPage4.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOCPage4.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOCPage4); + break; + case 6: + *ppPageHeader = &pLsiLogic->ConfigurationPages.IOCPage6.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.IOCPage6.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.IOCPage6); + break; + default: + rc = VERR_NOT_FOUND; + } + + return rc; +} + +/** + * Return the configuration page header and data + * which matches the given page type and number. + * + * @returns VINF_SUCCESS if successful + * VERR_NOT_FOUND if the requested page could be found. + * @param u8PageNumber Number of the page to get. + * @param ppPageHeader Where to store the pointer to the page header. + * @param ppbPageData Where to store the pointer to the page data. + */ +static int lsilogicConfigurationManufacturingPageGetFromNumber(PLSILOGICSCSI pLsiLogic, uint8_t u8PageNumber, + PMptConfigurationPageHeader *ppPageHeader, + uint8_t **ppbPageData, size_t *pcbPage) +{ + int rc = VINF_SUCCESS; + + AssertMsg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n")); + + switch(u8PageNumber) + { + case 0: + *ppPageHeader = &pLsiLogic->ConfigurationPages.ManufacturingPage0.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.ManufacturingPage0.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.ManufacturingPage0); + break; + case 1: + *ppPageHeader = &pLsiLogic->ConfigurationPages.ManufacturingPage1.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.ManufacturingPage1.abVPDInfo; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.ManufacturingPage1); + break; + case 2: + *ppPageHeader = &pLsiLogic->ConfigurationPages.ManufacturingPage2.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.ManufacturingPage2.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.ManufacturingPage2); + break; + case 3: + *ppPageHeader = &pLsiLogic->ConfigurationPages.ManufacturingPage3.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.ManufacturingPage3.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.ManufacturingPage3); + break; + case 4: + *ppPageHeader = &pLsiLogic->ConfigurationPages.ManufacturingPage4.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.ManufacturingPage4.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.ManufacturingPage4); + break; + default: + rc = VERR_NOT_FOUND; + } + + return rc; +} + +/** + * Return the configuration page header and data + * which matches the given page type and number. + * + * @returns VINF_SUCCESS if successful + * VERR_NOT_FOUND if the requested page could be found. + * @param u8PageNumber Number of the page to get. + * @param ppPageHeader Where to store the pointer to the page header. + * @param ppbPageData Where to store the pointer to the page data. + */ +static int lsilogicConfigurationSCSISPIPortPageGetFromNumber(PLSILOGICSCSI pLsiLogic, uint8_t u8Port, + uint8_t u8PageNumber, + PMptConfigurationPageHeader *ppPageHeader, + uint8_t **ppbPageData, size_t *pcbPage) +{ + int rc = VINF_SUCCESS; + + AssertMsg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n")); + + if (u8Port >= RT_ELEMENTS(pLsiLogic->ConfigurationPages.aPortPages)) + return VERR_NOT_FOUND; + + switch(u8PageNumber) + { + case 0: + *ppPageHeader = &pLsiLogic->ConfigurationPages.aPortPages[u8Port].SCSISPIPortPage0.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.aPortPages[u8Port].SCSISPIPortPage0.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.aPortPages[u8Port].SCSISPIPortPage0); + break; + case 1: + *ppPageHeader = &pLsiLogic->ConfigurationPages.aPortPages[u8Port].SCSISPIPortPage1.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.aPortPages[u8Port].SCSISPIPortPage1.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.aPortPages[u8Port].SCSISPIPortPage1); + break; + case 2: + *ppPageHeader = &pLsiLogic->ConfigurationPages.aPortPages[u8Port].SCSISPIPortPage2.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.aPortPages[u8Port].SCSISPIPortPage2.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.aPortPages[u8Port].SCSISPIPortPage2); + break; + default: + rc = VERR_NOT_FOUND; + } + + return rc; +} + +/** + * Return the configuration page header and data + * which matches the given page type and number. + * + * @returns VINF_SUCCESS if successful + * VERR_NOT_FOUND if the requested page could be found. + * @param u8PageNumber Number of the page to get. + * @param ppPageHeader Where to store the pointer to the page header. + * @param ppbPageData Where to store the pointer to the page data. + */ +static int lsilogicConfigurationSCSISPIDevicePageGetFromNumber(PLSILOGICSCSI pLsiLogic, uint8_t u8Bus, + uint8_t u8TargetID, uint8_t u8PageNumber, + PMptConfigurationPageHeader *ppPageHeader, + uint8_t **ppbPageData, size_t *pcbPage) +{ + int rc = VINF_SUCCESS; + + AssertMsg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n")); + + if (u8Bus >= RT_ELEMENTS(pLsiLogic->ConfigurationPages.aBuses)) + return VERR_NOT_FOUND; + + if (u8TargetID >= RT_ELEMENTS(pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages)) + return VERR_NOT_FOUND; + + switch(u8PageNumber) + { + case 0: + *ppPageHeader = &pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage0.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage0.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage0); + break; + case 1: + *ppPageHeader = &pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage1.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage1.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage1); + break; + case 2: + *ppPageHeader = &pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage2.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage2.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage2); + break; + case 3: + *ppPageHeader = &pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage3.u.fields.Header; + *ppbPageData = pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage3.u.abPageData; + *pcbPage = sizeof(pLsiLogic->ConfigurationPages.aBuses[u8Bus].aDevicePages[u8TargetID].SCSISPIDevicePage3); + break; + default: + rc = VERR_NOT_FOUND; + } + + return rc; +} + +/** + * Processes a Configuration request. + * + * @returns VBox status code. + * @param pLsiLogic Pointer to the device instance which sends the request. + * @param pConfigurationReq Pointer to the request structure. + * @param pReply Pointer to the reply message frame + */ +static int lsilogicProcessConfigurationRequest(PLSILOGICSCSI pLsiLogic, PMptConfigurationRequest pConfigurationReq, + PMptConfigurationReply pReply) +{ + int rc = VINF_SUCCESS; + uint8_t *pbPageData; + PMptConfigurationPageHeader pPageHeader; + uint8_t u8PageType, u8PageAttribute; + size_t cbPage; + + LogFlowFunc(("pLsiLogic=%#p\n", pLsiLogic)); + + u8PageType = MPT_CONFIGURATION_PAGE_TYPE_GET(pConfigurationReq->u8PageType); + u8PageAttribute = MPT_CONFIGURATION_PAGE_ATTRIBUTE_GET(pConfigurationReq->u8PageType); + + /* Copy common bits from the request into the reply. */ + pReply->u8MessageLength = 6; /* 6 32bit D-Words. */ + pReply->u8Action = pConfigurationReq->u8Action; + pReply->u8Function = pConfigurationReq->u8Function; + pReply->u32MessageContext = pConfigurationReq->u32MessageContext; + + switch (u8PageType) + { + case MPT_CONFIGURATION_PAGE_TYPE_IO_UNIT: + { + /* Get the page data. */ + rc = lsilogicConfigurationIOUnitPageGetFromNumber(pLsiLogic, + pConfigurationReq->u8PageNumber, + &pPageHeader, &pbPageData, &cbPage); + break; + } + case MPT_CONFIGURATION_PAGE_TYPE_IOC: + { + /* Get the page data. */ + rc = lsilogicConfigurationIOCPageGetFromNumber(pLsiLogic, + pConfigurationReq->u8PageNumber, + &pPageHeader, &pbPageData, &cbPage); + break; + } + case MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING: + { + /* Get the page data. */ + rc = lsilogicConfigurationManufacturingPageGetFromNumber(pLsiLogic, + pConfigurationReq->u8PageNumber, + &pPageHeader, &pbPageData, &cbPage); + break; + } + case MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_PORT: + { + /* Get the page data. */ + rc = lsilogicConfigurationSCSISPIPortPageGetFromNumber(pLsiLogic, + pConfigurationReq->u.MPIPortNumber.u8PortNumber, + pConfigurationReq->u8PageNumber, + &pPageHeader, &pbPageData, &cbPage); + break; + } + case MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_DEVICE: + { + /* Get the page data. */ + rc = lsilogicConfigurationSCSISPIDevicePageGetFromNumber(pLsiLogic, + pConfigurationReq->u.BusAndTargetId.u8Bus, + pConfigurationReq->u.BusAndTargetId.u8TargetID, + pConfigurationReq->u8PageNumber, + &pPageHeader, &pbPageData, &cbPage); + break; + } + default: + rc = VERR_NOT_FOUND; + } + + if (rc == VERR_NOT_FOUND) + { + //AssertMsgFailed(("todo\n")); + pReply->u8PageType = pConfigurationReq->u8PageType; + pReply->u8PageNumber = pConfigurationReq->u8PageNumber; + pReply->u8PageLength = pConfigurationReq->u8PageLength; + pReply->u8PageVersion = pConfigurationReq->u8PageVersion; + return VINF_SUCCESS; + } + + pReply->u8PageType = pPageHeader->u8PageType; + pReply->u8PageNumber = pPageHeader->u8PageNumber; + pReply->u8PageLength = pPageHeader->u8PageLength; + pReply->u8PageVersion = pPageHeader->u8PageVersion; + + Log(("GuestRequest u8Action=%d\n", pConfigurationReq->u8Action)); + Log(("u8PageType=%d\n", pPageHeader->u8PageType)); + Log(("u8PageNumber=%d\n", pPageHeader->u8PageNumber)); + Log(("u8PageLength=%d\n", pPageHeader->u8PageLength)); + Log(("u8PageVersion=%d\n", pPageHeader->u8PageVersion)); + + for (int i = 0; i < pReply->u8PageLength; i++) + LogFlowFunc(("PageData[%d]=%#x\n", i, ((uint32_t *)pbPageData)[i])); + + /* + * Don't use the scatter gather handling code as the configuration request always have only one + * simple element. + */ + switch (pConfigurationReq->u8Action) + { + case MPT_CONFIGURATION_REQUEST_ACTION_DEFAULT: /* Nothing to do. We are always using the defaults. */ + case MPT_CONFIGURATION_REQUEST_ACTION_HEADER: + { + /* Already copied above nothing to do. */ + break; + } + case MPT_CONFIGURATION_REQUEST_ACTION_READ_NVRAM: + case MPT_CONFIGURATION_REQUEST_ACTION_READ_CURRENT: + case MPT_CONFIGURATION_REQUEST_ACTION_READ_DEFAULT: + { + uint32_t cbBuffer = pConfigurationReq->SimpleSGElement.u24Length; + if (cbBuffer != 0) + { + RTGCPHYS GCPhysAddrPageBuffer = pConfigurationReq->SimpleSGElement.u32DataBufferAddressLow; + if (pConfigurationReq->SimpleSGElement.f64BitAddress) + GCPhysAddrPageBuffer |= (uint64_t)pConfigurationReq->SimpleSGElement.u32DataBufferAddressHigh << 32; + + PDMDevHlpPhysWrite(pLsiLogic->CTX_SUFF(pDevIns), GCPhysAddrPageBuffer, pbPageData, + cbBuffer < cbPage ? cbBuffer : cbPage); + } + break; + } + case MPT_CONFIGURATION_REQUEST_ACTION_WRITE_CURRENT: + case MPT_CONFIGURATION_REQUEST_ACTION_WRITE_NVRAM: + { + uint32_t cbBuffer = pConfigurationReq->SimpleSGElement.u24Length; + if (cbBuffer != 0) + { + RTGCPHYS GCPhysAddrPageBuffer = pConfigurationReq->SimpleSGElement.u32DataBufferAddressLow; + if (pConfigurationReq->SimpleSGElement.f64BitAddress) + GCPhysAddrPageBuffer |= (uint64_t)pConfigurationReq->SimpleSGElement.u32DataBufferAddressHigh << 32; + + PDMDevHlpPhysRead(pLsiLogic->CTX_SUFF(pDevIns), GCPhysAddrPageBuffer, pbPageData, + cbBuffer < cbPage ? cbBuffer : cbPage); + } + break; + } + default: + AssertMsgFailed(("todo\n")); + } + + return VINF_SUCCESS; +} + +/** + * Initializes the configuration pages. + * + * @returns nothing + * @param pLsiLogic Pointer to the Lsilogic SCSI instance. + */ +static void lsilogicInitializeConfigurationPages(PLSILOGICSCSI pLsiLogic) +{ + PMptConfigurationPagesSupported pPages = &pLsiLogic->ConfigurationPages; + + LogFlowFunc(("pLsiLogic=%#p\n", pLsiLogic)); + + /* Clear everything first. */ + memset(pPages, 0, sizeof(MptConfigurationPagesSupported)); + + /* Manufacturing Page 0. */ + pPages->ManufacturingPage0.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING; + pPages->ManufacturingPage0.u.fields.Header.u8PageNumber = 0; + pPages->ManufacturingPage0.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageManufacturing0) / 4; + strncpy((char *)pPages->ManufacturingPage0.u.fields.abChipName, "VBox MPT Fusion", 16); + strncpy((char *)pPages->ManufacturingPage0.u.fields.abChipRevision, "1.0", 8); + strncpy((char *)pPages->ManufacturingPage0.u.fields.abBoardName, "VBox MPT Fusion", 16); + strncpy((char *)pPages->ManufacturingPage0.u.fields.abBoardAssembly, "SUN", 8); + strncpy((char *)pPages->ManufacturingPage0.u.fields.abBoardTracerNumber, "CAFECAFECAFECAFE", 16); + + /* Manufacturing Page 1 - I don't know what this contains so we leave it 0 for now. */ + pPages->ManufacturingPage1.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING; + pPages->ManufacturingPage1.Header.u8PageNumber = 1; + pPages->ManufacturingPage1.Header.u8PageLength = sizeof(MptConfigurationPageManufacturing1) / 4; + + /* Manufacturing Page 2. */ + pPages->ManufacturingPage2.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING; + pPages->ManufacturingPage2.u.fields.Header.u8PageNumber = 2; + pPages->ManufacturingPage2.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageManufacturing2) / 4; + pPages->ManufacturingPage2.u.fields.u16PCIDeviceID = LSILOGICSCSI_PCI_DEVICE_ID; + pPages->ManufacturingPage2.u.fields.u8PCIRevisionID = LSILOGICSCSI_PCI_REVISION_ID; + /* Hardware specific settings - everything 0 for now. */ + + /* Manufacturing Page 3. */ + pPages->ManufacturingPage3.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING; + pPages->ManufacturingPage3.u.fields.Header.u8PageNumber = 3; + pPages->ManufacturingPage3.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageManufacturing3) / 4; + pPages->ManufacturingPage3.u.fields.u16PCIDeviceID = LSILOGICSCSI_PCI_DEVICE_ID; + pPages->ManufacturingPage3.u.fields.u8PCIRevisionID = LSILOGICSCSI_PCI_REVISION_ID; + /* Chip specific settings - everything 0 for now. */ + + /* Manufacturing Page 4 - I don't know what this contains so we leave it 0 for now. */ + pPages->ManufacturingPage4.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING; + pPages->ManufacturingPage4.u.fields.Header.u8PageNumber = 4; + pPages->ManufacturingPage4.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageManufacturing4) / 4; + + + /* I/O Unit page 0. */ + pPages->IOUnitPage0.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_IO_UNIT; + pPages->IOUnitPage0.u.fields.Header.u8PageNumber = 0; + pPages->IOUnitPage0.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOUnit0) / 4; + pPages->IOUnitPage0.u.fields.u64UniqueIdentifier = 0xcafe; + + /* I/O Unit page 1. */ + pPages->IOUnitPage1.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_IO_UNIT; + pPages->IOUnitPage1.u.fields.Header.u8PageNumber = 1; + pPages->IOUnitPage1.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOUnit1) / 4; + pPages->IOUnitPage1.u.fields.fSingleFunction = true; + pPages->IOUnitPage1.u.fields.fAllPathsMapped = false; + pPages->IOUnitPage1.u.fields.fIntegratedRAIDDisabled = true; + pPages->IOUnitPage1.u.fields.f32BitAccessForced = false; + + /* I/O Unit page 2. */ + pPages->IOUnitPage2.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT + | MPT_CONFIGURATION_PAGE_TYPE_IO_UNIT; + pPages->IOUnitPage2.u.fields.Header.u8PageNumber = 2; + pPages->IOUnitPage2.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOUnit2) / 4; + pPages->IOUnitPage2.u.fields.fPauseOnError = false; + pPages->IOUnitPage2.u.fields.fVerboseModeEnabled = false; + pPages->IOUnitPage2.u.fields.fDisableColorVideo = false; + pPages->IOUnitPage2.u.fields.fNotHookInt40h = false; + pPages->IOUnitPage2.u.fields.u32BIOSVersion = 0xcafecafe; + pPages->IOUnitPage2.u.fields.aAdapterOrder[0].fAdapterEnabled = true; + pPages->IOUnitPage2.u.fields.aAdapterOrder[0].fAdapterEmbedded = true; + pPages->IOUnitPage2.u.fields.aAdapterOrder[0].u8PCIBusNumber = 0; + pPages->IOUnitPage2.u.fields.aAdapterOrder[0].u8PCIDevFn = pLsiLogic->PciDev.devfn; + + /* I/O Unit page 3. */ + pPages->IOUnitPage3.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_CHANGEABLE + | MPT_CONFIGURATION_PAGE_TYPE_IO_UNIT; + pPages->IOUnitPage3.u.fields.Header.u8PageNumber = 3; + pPages->IOUnitPage3.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOUnit3) / 4; + pPages->IOUnitPage3.u.fields.u8GPIOCount = 0; + + /* IOC page 0. */ + pPages->IOCPage0.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_IOC; + pPages->IOCPage0.u.fields.Header.u8PageNumber = 0; + pPages->IOCPage0.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOC0) / 4; + pPages->IOCPage0.u.fields.u32TotalNVStore = 0; + pPages->IOCPage0.u.fields.u32FreeNVStore = 0; + pPages->IOCPage0.u.fields.u16VendorId = LSILOGICSCSI_PCI_VENDOR_ID; + pPages->IOCPage0.u.fields.u16DeviceId = LSILOGICSCSI_PCI_DEVICE_ID; + pPages->IOCPage0.u.fields.u8RevisionId = LSILOGICSCSI_PCI_REVISION_ID; + pPages->IOCPage0.u.fields.u32ClassCode = LSILOGICSCSI_PCI_CLASS_CODE; + pPages->IOCPage0.u.fields.u16SubsystemVendorId = LSILOGICSCSI_PCI_SUBSYSTEM_VENDOR_ID; + pPages->IOCPage0.u.fields.u16SubsystemId = LSILOGICSCSI_PCI_SUBSYSTEM_ID; + + /* IOC page 1. */ + pPages->IOCPage1.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_CHANGEABLE + | MPT_CONFIGURATION_PAGE_TYPE_IOC; + pPages->IOCPage1.u.fields.Header.u8PageNumber = 1; + pPages->IOCPage1.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOC1) / 4; + pPages->IOCPage1.u.fields.fReplyCoalescingEnabled = false; + pPages->IOCPage1.u.fields.u32CoalescingTimeout = 0; + pPages->IOCPage1.u.fields.u8CoalescingDepth = 0; + + /* IOC page 2. */ + pPages->IOCPage2.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_IOC; + pPages->IOCPage2.u.fields.Header.u8PageNumber = 2; + pPages->IOCPage2.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOC2) / 4; + /* Everything else here is 0. */ + + /* IOC page 3. */ + pPages->IOCPage3.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_IOC; + pPages->IOCPage3.u.fields.Header.u8PageNumber = 3; + pPages->IOCPage3.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOC3) / 4; + /* Everything else here is 0. */ + + /* IOC page 4. */ + pPages->IOCPage4.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_IOC; + pPages->IOCPage4.u.fields.Header.u8PageNumber = 4; + pPages->IOCPage4.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOC4) / 4; + /* Everything else here is 0. */ + + /* IOC page 6. */ + pPages->IOCPage6.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_IOC; + pPages->IOCPage6.u.fields.Header.u8PageNumber = 6; + pPages->IOCPage6.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageIOC6) / 4; + /* Everything else here is 0. */ + + for (unsigned i = 0; i < RT_ELEMENTS(pPages->aPortPages); i++) + { + /* SCSI-SPI port page 0. */ + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_PORT; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.Header.u8PageNumber = 0; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageSCSISPIPort0) / 4; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.fInformationUnitTransfersCapable = true; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.fDTCapable = true; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.fQASCapable = true; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.u8MinimumSynchronousTransferPeriod = 0; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.u8MaximumSynchronousOffset = 0xff; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.fWide = true; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.fAIPCapable = true; + pPages->aPortPages[i].SCSISPIPortPage0.u.fields.u2SignalingType = 0x3; /* Single Ended. */ + + /* SCSI-SPI port page 1. */ + pPages->aPortPages[i].SCSISPIPortPage1.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_CHANGEABLE + | MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_PORT; + pPages->aPortPages[i].SCSISPIPortPage1.u.fields.Header.u8PageNumber = 1; + pPages->aPortPages[i].SCSISPIPortPage1.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageSCSISPIPort1) / 4; + pPages->aPortPages[i].SCSISPIPortPage1.u.fields.u8SCSIID = 7; + pPages->aPortPages[i].SCSISPIPortPage1.u.fields.u16PortResponseIDsBitmask = (1 << 7); + pPages->aPortPages[i].SCSISPIPortPage1.u.fields.u32OnBusTimerValue = 0; + + /* SCSI-SPI port page 2. */ + pPages->aPortPages[i].SCSISPIPortPage2.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_CHANGEABLE + | MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_PORT; + pPages->aPortPages[i].SCSISPIPortPage2.u.fields.Header.u8PageNumber = 2; + pPages->aPortPages[i].SCSISPIPortPage2.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageSCSISPIPort2) / 4; + pPages->aPortPages[i].SCSISPIPortPage2.u.fields.u4HostSCSIID = 7; + pPages->aPortPages[i].SCSISPIPortPage2.u.fields.u2InitializeHBA = 0x3; + pPages->aPortPages[i].SCSISPIPortPage2.u.fields.fTerminationDisabled = true; + for (unsigned iDevice = 0; iDevice < RT_ELEMENTS(pPages->aPortPages[i].SCSISPIPortPage2.u.fields.aDeviceSettings); iDevice++) + { + pPages->aPortPages[i].SCSISPIPortPage2.u.fields.aDeviceSettings[iDevice].fBootChoice = true; + } + /* Everything else 0 for now. */ + } + + for (unsigned uBusCurr = 0; uBusCurr < RT_ELEMENTS(pPages->aBuses); uBusCurr++) + { + for (unsigned uDeviceCurr = 0; uDeviceCurr < RT_ELEMENTS(pPages->aBuses[uBusCurr].aDevicePages); uDeviceCurr++) + { + /* SCSI-SPI device page 0. */ + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage0.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_DEVICE; + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage0.u.fields.Header.u8PageNumber = 0; + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage0.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageSCSISPIDevice0) / 4; + /* Everything else 0 for now. */ + + /* SCSI-SPI device page 1. */ + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage1.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_CHANGEABLE + | MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_DEVICE; + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage1.u.fields.Header.u8PageNumber = 1; + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage1.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageSCSISPIDevice1) / 4; + /* Everything else 0 for now. */ + + /* SCSI-SPI device page 2. */ + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage2.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_CHANGEABLE + | MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_DEVICE; + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage2.u.fields.Header.u8PageNumber = 2; + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage2.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageSCSISPIDevice2) / 4; + /* Everything else 0 for now. */ + + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage3.u.fields.Header.u8PageType = MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY + | MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_DEVICE; + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage3.u.fields.Header.u8PageNumber = 3; + pPages->aBuses[uBusCurr].aDevicePages[uDeviceCurr].SCSISPIDevicePage3.u.fields.Header.u8PageLength = sizeof(MptConfigurationPageSCSISPIDevice3) / 4; + /* Everything else 0 for now. */ + } + } +} + +/** + * Transmit queue consumer + * Queue a new async task. + * + * @returns Success indicator. + * If false the item will not be removed and the flushing will stop. + * @param pDevIns The device instance. + * @param pItem The item to consume. Upon return this item will be freed. + */ +static DECLCALLBACK(bool) lsilogicNotifyQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem) +{ + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + int rc = VINF_SUCCESS; + + LogFlowFunc(("pDevIns=%#p pItem=%#p\n", pDevIns, pItem)); + + /* Only process request which arrived before we received the notification. */ + uint32_t uRequestQueueNextEntryWrite = ASMAtomicReadU32(&pLsiLogic->uRequestQueueNextEntryFreeWrite); + + /* Reset notification event. */ + ASMAtomicXchgBool(&pLsiLogic->fNotificationSend, false); + + /* Go through the messages now and process them. */ + while ( RT_LIKELY(pLsiLogic->enmState == LSILOGICSTATE_OPERATIONAL) + && (pLsiLogic->uRequestQueueNextAddressRead != uRequestQueueNextEntryWrite)) + { + uint32_t u32RequestMessageFrameDesc = pLsiLogic->CTX_SUFF(pRequestQueueBase)[pLsiLogic->uRequestQueueNextAddressRead]; + RTGCPHYS GCPhysMessageFrameAddr = LSILOGIC_RTGCPHYS_FROM_U32(pLsiLogic->u32HostMFAHighAddr, + (u32RequestMessageFrameDesc & ~0x07)); + + PLSILOGICTASKSTATE pTaskState; + + /* Get new task state. */ + rc = RTCacheRequest(pLsiLogic->pTaskCache, (void **)&pTaskState); + AssertRC(rc); + + pTaskState->GCPhysMessageFrameAddr = GCPhysMessageFrameAddr; + + /* Read the message header from the guest first. */ + PDMDevHlpPhysRead(pDevIns, GCPhysMessageFrameAddr, &pTaskState->GuestRequest, sizeof(MptMessageHdr)); + + /* Determine the size of the request. */ + uint32_t cbRequest = 0; + + switch (pTaskState->GuestRequest.Header.u8Function) + { + case MPT_MESSAGE_HDR_FUNCTION_SCSI_IO_REQUEST: + cbRequest = sizeof(MptSCSIIORequest); + break; + case MPT_MESSAGE_HDR_FUNCTION_SCSI_TASK_MGMT: + cbRequest = sizeof(MptSCSITaskManagementRequest); + break; + case MPT_MESSAGE_HDR_FUNCTION_IOC_INIT: + cbRequest = sizeof(MptIOCInitRequest); + break; + case MPT_MESSAGE_HDR_FUNCTION_IOC_FACTS: + cbRequest = sizeof(MptIOCFactsRequest); + break; + case MPT_MESSAGE_HDR_FUNCTION_CONFIG: + cbRequest = sizeof(MptConfigurationRequest); + break; + case MPT_MESSAGE_HDR_FUNCTION_PORT_FACTS: + cbRequest = sizeof(MptPortFactsRequest); + break; + case MPT_MESSAGE_HDR_FUNCTION_PORT_ENABLE: + cbRequest = sizeof(MptPortEnableRequest); + break; + case MPT_MESSAGE_HDR_FUNCTION_EVENT_NOTIFICATION: + cbRequest = sizeof(MptEventNotificationRequest); + break; + case MPT_MESSAGE_HDR_FUNCTION_EVENT_ACK: + AssertMsgFailed(("todo\n")); + //cbRequest = sizeof(MptEventAckRequest); + break; + case MPT_MESSAGE_HDR_FUNCTION_FW_DOWNLOAD: + AssertMsgFailed(("todo\n")); + break; + default: + AssertMsgFailed(("Unknown function issued %u\n", pTaskState->GuestRequest.Header.u8Function)); + lsilogicSetIOCFaultCode(pLsiLogic, LSILOGIC_IOCSTATUS_INVALID_FUNCTION); + } + + if (cbRequest != 0) + { + /* Read the complete message frame from guest memory now. */ + PDMDevHlpPhysRead(pDevIns, GCPhysMessageFrameAddr, &pTaskState->GuestRequest, cbRequest); + + /* Handle SCSI I/O requests now. */ + if (pTaskState->GuestRequest.Header.u8Function == MPT_MESSAGE_HDR_FUNCTION_SCSI_IO_REQUEST) + { + rc = lsilogicProcessSCSIIORequest(pLsiLogic, pTaskState); + AssertRC(rc); + } + else + { + MptReplyUnion Reply; + rc = lsilogicProcessMessageRequest(pLsiLogic, &pTaskState->GuestRequest.Header, &Reply); + AssertRC(rc); + RTCacheInsert(pLsiLogic->pTaskCache, pTaskState); + } + + pLsiLogic->uRequestQueueNextAddressRead++; + pLsiLogic->uRequestQueueNextAddressRead %= pLsiLogic->cRequestQueueEntries; + } + } + + return true; +} + +/** + * Port I/O Handler for IN operations - legacy port. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param uPort Port number used for the IN operation. + * @param pu32 Where to store the result. + * @param cb Number of bytes read. + */ +static int lsilogicIsaIOPortRead (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t *pu32, unsigned cb) +{ + int rc; + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + Assert(cb == 1); + + rc = vboxscsiReadRegister(&pLsiLogic->VBoxSCSI, (Port - LSILOGIC_ISA_IO_PORT), pu32); + + Log2(("%s: pu32=%p:{%.*Rhxs} iRegister=%d rc=%Rrc\n", + __FUNCTION__, pu32, 1, pu32, (Port - LSILOGIC_ISA_IO_PORT), rc)); + + return rc; +} + +/** + * Prepares a request from the BIOS. + * + * @returns VBox status code. + * @param pLsiLogic Pointer to the LsiLogic device instance. + */ +static int lsilogicPrepareBIOSSCSIRequest(PLSILOGICSCSI pLsiLogic) +{ + int rc; + PLSILOGICTASKSTATE pTaskState; + uint32_t uTargetDevice; + + rc = RTCacheRequest(pLsiLogic->pTaskCache, (void **)&pTaskState); + AssertMsgRCReturn(rc, ("Getting task from cache failed rc=%Rrc\n", rc), rc); + + pTaskState->fBIOS = true; + + rc = vboxscsiSetupRequest(&pLsiLogic->VBoxSCSI, &pTaskState->PDMScsiRequest, &uTargetDevice); + AssertMsgRCReturn(rc, ("Setting up SCSI request failed rc=%Rrc\n", rc), rc); + + pTaskState->PDMScsiRequest.pvUser = pTaskState; + + pTaskState->pTargetDevice = &pLsiLogic->aDeviceStates[uTargetDevice]; + + if (!pTaskState->pTargetDevice->pDrvBase) + { + /* Device is not present. */ + AssertMsg(pTaskState->PDMScsiRequest.pbCDB[0] == SCSI_INQUIRY, + ("Device is not present but command is not inquiry\n")); + + SCSIINQUIRYDATA ScsiInquiryData; + + memset(&ScsiInquiryData, 0, sizeof(SCSIINQUIRYDATA)); + ScsiInquiryData.u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_UNKNOWN; + ScsiInquiryData.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_NOT_CONNECTED_NOT_SUPPORTED; + + memcpy(pLsiLogic->VBoxSCSI.pBuf, &ScsiInquiryData, 5); + + rc = vboxscsiRequestFinished(&pLsiLogic->VBoxSCSI, &pTaskState->PDMScsiRequest); + AssertMsgRCReturn(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc), rc); + + rc = RTCacheInsert(pLsiLogic->pTaskCache, pTaskState); + AssertMsgRCReturn(rc, ("Getting task from cache failed rc=%Rrc\n", rc), rc); + } + else + { + ASMAtomicIncU32(&pTaskState->pTargetDevice->cOutstandingRequests); + + rc = pTaskState->pTargetDevice->pDrvSCSIConnector->pfnSCSIRequestSend(pTaskState->pTargetDevice->pDrvSCSIConnector, + &pTaskState->PDMScsiRequest); + AssertMsgRCReturn(rc, ("Sending request to SCSI layer failed rc=%Rrc\n", rc), rc); + } + + return rc; +} + +/** + * Port I/O Handler for OUT operations - legacy port. + * + * @returns VBox status code. + * + * @param pDevIns The device instance. + * @param pvUser User argument. + * @param uPort Port number used for the IN operation. + * @param u32 The value to output. + * @param cb The value size in bytes. + */ +static int lsilogicIsaIOPortWrite (PPDMDEVINS pDevIns, void *pvUser, + RTIOPORT Port, uint32_t u32, unsigned cb) +{ + int rc; + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x Port=%#x\n", + pDevIns->iInstance, __FUNCTION__, pvUser, cb, u32, Port)); + + Assert(cb == 1); + + rc = vboxscsiWriteRegister(&pLsiLogic->VBoxSCSI, (Port - LSILOGIC_ISA_IO_PORT), (uint8_t)u32); + if (rc == VERR_MORE_DATA) + { + rc = lsilogicPrepareBIOSSCSIRequest(pLsiLogic); + AssertRC(rc); + } + else if (RT_FAILURE(rc)) + AssertMsgFailed(("Writing BIOS register failed %Rrc\n", rc)); + + return VINF_SUCCESS; +} + +/** + * Port I/O Handler for primary port range OUT string operations. + * @see FNIOMIOPORTOUTSTRING for details. + */ +static DECLCALLBACK(int) lsilogicIsaIOPortWriteStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrSrc, PRTGCUINTREG pcTransfer, unsigned cb) +{ + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + int rc; + + Log2(("#%d %s: pvUser=%#p cb=%d Port=%#x\n", + pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port)); + + rc = vboxscsiWriteString(pDevIns, &pLsiLogic->VBoxSCSI, (Port - LSILOGIC_ISA_IO_PORT), + pGCPtrSrc, pcTransfer, cb); + if (rc == VERR_MORE_DATA) + { + rc = lsilogicPrepareBIOSSCSIRequest(pLsiLogic); + AssertRC(rc); + } + else if (RT_FAILURE(rc)) + AssertMsgFailed(("Writing BIOS register failed %Rrc\n", rc)); + + return rc; +} + +/** + * Port I/O Handler for primary port range IN string operations. + * @see FNIOMIOPORTINSTRING for details. + */ +static DECLCALLBACK(int) lsilogicIsaIOPortReadStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrDst, PRTGCUINTREG pcTransfer, unsigned cb) +{ + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + LogFlowFunc(("#%d %s: pvUser=%#p cb=%d Port=%#x\n", + pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port)); + + return vboxscsiReadString(pDevIns, &pLsiLogic->VBoxSCSI, (Port - LSILOGIC_ISA_IO_PORT), + pGCPtrDst, pcTransfer, cb); +} + +static DECLCALLBACK(int) lsilogicMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, + RTGCPHYS GCPhysAddress, uint32_t cb, + PCIADDRESSSPACE enmType) +{ + PPDMDEVINS pDevIns = pPciDev->pDevIns; + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + int rc = VINF_SUCCESS; + + Log2(("%s: registering area at GCPhysAddr=%RGp cb=%u\n", __FUNCTION__, GCPhysAddress, cb)); + + AssertMsg( (enmType == PCI_ADDRESS_SPACE_MEM && cb >= LSILOGIC_PCI_SPACE_MEM_SIZE) + || (enmType == PCI_ADDRESS_SPACE_IO && cb >= LSILOGIC_PCI_SPACE_IO_SIZE), + ("PCI region type and size do not match\n")); + + if ((enmType == PCI_ADDRESS_SPACE_MEM) && (iRegion == 1)) + { + /* We use the assigned size here, because we currently only support page aligned MMIO ranges. */ + rc = PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, NULL, + lsilogicMMIOWrite, lsilogicMMIORead, NULL, "LsiLogic"); + if (RT_FAILURE(rc)) + return rc; + + if (pThis->fR0Enabled) + { + rc = PDMDevHlpMMIORegisterR0(pDevIns, GCPhysAddress, cb, 0, + "lsilogicMMIOWrite", "lsilogicMMIORead", NULL); + if (RT_FAILURE(rc)) + return rc; + } + + if (pThis->fGCEnabled) + { + rc = PDMDevHlpMMIORegisterGC(pDevIns, GCPhysAddress, cb, 0, + "lsilogicMMIOWrite", "lsilogicMMIORead", NULL); + if (RT_FAILURE(rc)) + return rc; + } + + pThis->GCPhysMMIOBase = GCPhysAddress; + } + else if ((enmType == PCI_ADDRESS_SPACE_MEM) && (iRegion == 2)) + { + /* We use the assigned size here, because we currently only support page aligned MMIO ranges. */ + rc = PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, NULL, + lsilogicDiagnosticWrite, lsilogicDiagnosticRead, NULL, "LsiLogicDiag"); + if (RT_FAILURE(rc)) + return rc; + + if (pThis->fR0Enabled) + { + rc = PDMDevHlpMMIORegisterR0(pDevIns, GCPhysAddress, cb, 0, + "lsilogicDiagnosticWrite", "lsilogicDiagnosticRead", NULL); + if (RT_FAILURE(rc)) + return rc; + } + + if (pThis->fGCEnabled) + { + rc = PDMDevHlpMMIORegisterGC(pDevIns, GCPhysAddress, cb, 0, + "lsilogicDiagnosticWrite", "lsilogicDiagnosticRead", NULL); + if (RT_FAILURE(rc)) + return rc; + } + } + else if (enmType == PCI_ADDRESS_SPACE_IO) + { + rc = PDMDevHlpIOPortRegister(pDevIns, (RTIOPORT)GCPhysAddress, LSILOGIC_PCI_SPACE_IO_SIZE, + NULL, lsilogicIOPortWrite, lsilogicIOPortRead, NULL, NULL, "LsiLogic"); + if (RT_FAILURE(rc)) + return rc; + + if (pThis->fR0Enabled) + { + rc = PDMDevHlpIOPortRegisterR0(pDevIns, (RTIOPORT)GCPhysAddress, LSILOGIC_PCI_SPACE_IO_SIZE, + 0, "lsilogicIOPortWrite", "lsilogicIOPortRead", NULL, NULL, "LsiLogic"); + if (RT_FAILURE(rc)) + return rc; + } + + if (pThis->fGCEnabled) + { + rc = PDMDevHlpIOPortRegisterGC(pDevIns, (RTIOPORT)GCPhysAddress, LSILOGIC_PCI_SPACE_IO_SIZE, + 0, "lsilogicIOPortWrite", "lsilogicIOPortRead", NULL, NULL, "LsiLogic"); + if (RT_FAILURE(rc)) + return rc; + } + + pThis->IOPortBase = (RTIOPORT)GCPhysAddress; + } + else + AssertMsgFailed(("Invalid enmType=%d iRegion=%d\n", enmType, iRegion)); + + return rc; +} + +/** + * Waits until all I/O operations on all devices are complete. + * + * @retruns Flag which indicates if all I/O completed in the given timeout. + * @param pLsiLogic Pointer to the dveice instance to check. + * @param cMillis Timeout in milliseconds to wait. + */ +static bool lsilogicWaitForAsyncIOFinished(PLSILOGICSCSI pLsiLogic, unsigned cMillies) +{ + uint64_t u64Start; + bool fIdle; + + /* + * Wait for any pending async operation to finish + */ + u64Start = RTTimeMilliTS(); + do + { + fIdle = true; + + /* Check every port. */ + for (unsigned i = 0; i < RT_ELEMENTS(pLsiLogic->aDeviceStates); i++) + { + PLSILOGICDEVICE pLsiLogicDevice = &pLsiLogic->aDeviceStates[i]; + if (ASMAtomicReadU32(&pLsiLogicDevice->cOutstandingRequests)) + { + fIdle = false; + break; + } + } + if (RTTimeMilliTS() - u64Start >= cMillies) + break; + + /* Sleep for a bit. */ + RTThreadSleep(100); + } while (!fIdle); + + return fIdle; +} + +static DECLCALLBACK(int) lsilogicSaveLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) +{ + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + /* Wait that no task is pending on any device. */ + if (!lsilogicWaitForAsyncIOFinished(pLsiLogic, 20000)) + { + AssertLogRelMsgFailed(("LsiLogic: There are still tasks outstanding\n")); + return VERR_TIMEOUT; + } + + return VINF_SUCCESS; +} + +static DECLCALLBACK(int) lsilogicSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) +{ + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + /* Every device first. */ + for (unsigned i = 0; i < RT_ELEMENTS(pLsiLogic->aDeviceStates); i++) + { + PLSILOGICDEVICE pDevice = &pLsiLogic->aDeviceStates[i]; + + AssertMsg(!pDevice->cOutstandingRequests, + ("There are still outstanding requests on this device\n")); + SSMR3PutU32(pSSM, pDevice->cOutstandingRequests); + } + /* Now the main device state. */ + SSMR3PutU32 (pSSM, pLsiLogic->enmState); + SSMR3PutU32 (pSSM, pLsiLogic->enmWhoInit); + SSMR3PutBool (pSSM, pLsiLogic->fDoorbellInProgress); + SSMR3PutBool (pSSM, pLsiLogic->fDiagnosticEnabled); + SSMR3PutBool (pSSM, pLsiLogic->fNotificationSend); + SSMR3PutBool (pSSM, pLsiLogic->fEventNotificationEnabled); + SSMR3PutU32 (pSSM, pLsiLogic->uInterruptMask); + SSMR3PutU32 (pSSM, pLsiLogic->uInterruptStatus); + for (unsigned i = 0; i < RT_ELEMENTS(pLsiLogic->aMessage); i++) + SSMR3PutU32 (pSSM, pLsiLogic->aMessage[i]); + SSMR3PutU32 (pSSM, pLsiLogic->iMessage); + SSMR3PutU32 (pSSM, pLsiLogic->cMessage); + SSMR3PutMem (pSSM, &pLsiLogic->ReplyBuffer, sizeof(pLsiLogic->ReplyBuffer)); + SSMR3PutU32 (pSSM, pLsiLogic->uNextReplyEntryRead); + SSMR3PutU32 (pSSM, pLsiLogic->cReplySize); + SSMR3PutU16 (pSSM, pLsiLogic->u16IOCFaultCode); + SSMR3PutU32 (pSSM, pLsiLogic->u32HostMFAHighAddr); + SSMR3PutU32 (pSSM, pLsiLogic->u32SenseBufferHighAddr); + SSMR3PutU8 (pSSM, pLsiLogic->cMaxDevices); + SSMR3PutU8 (pSSM, pLsiLogic->cMaxBuses); + SSMR3PutU16 (pSSM, pLsiLogic->cbReplyFrame); + SSMR3PutU32 (pSSM, pLsiLogic->iDiagnosticAccess); + SSMR3PutU32 (pSSM, pLsiLogic->cReplyQueueEntries); + SSMR3PutU32 (pSSM, pLsiLogic->cRequestQueueEntries); + SSMR3PutU32 (pSSM, pLsiLogic->uReplyFreeQueueNextEntryFreeWrite); + SSMR3PutU32 (pSSM, pLsiLogic->uReplyFreeQueueNextAddressRead); + SSMR3PutU32 (pSSM, pLsiLogic->uReplyPostQueueNextEntryFreeWrite); + SSMR3PutU32 (pSSM, pLsiLogic->uReplyPostQueueNextAddressRead); + SSMR3PutU32 (pSSM, pLsiLogic->uRequestQueueNextEntryFreeWrite); + SSMR3PutU32 (pSSM, pLsiLogic->uRequestQueueNextAddressRead); + SSMR3PutMem (pSSM, &pLsiLogic->ConfigurationPages, sizeof(pLsiLogic->ConfigurationPages)); + /* Now the data for the BIOS interface. */ + SSMR3PutU8 (pSSM, pLsiLogic->VBoxSCSI.regIdentify); + SSMR3PutU8 (pSSM, pLsiLogic->VBoxSCSI.uTargetDevice); + SSMR3PutU8 (pSSM, pLsiLogic->VBoxSCSI.uTxDir); + SSMR3PutU8 (pSSM, pLsiLogic->VBoxSCSI.cbCDB); + SSMR3PutMem (pSSM, pLsiLogic->VBoxSCSI.aCDB, sizeof(pLsiLogic->VBoxSCSI.aCDB)); + SSMR3PutU8 (pSSM, pLsiLogic->VBoxSCSI.iCDB); + SSMR3PutU32 (pSSM, pLsiLogic->VBoxSCSI.cbBuf); + SSMR3PutU32 (pSSM, pLsiLogic->VBoxSCSI.iBuf); + SSMR3PutBool (pSSM, pLsiLogic->VBoxSCSI.fBusy); + SSMR3PutU8 (pSSM, pLsiLogic->VBoxSCSI.enmState); + if (pLsiLogic->VBoxSCSI.cbCDB) + SSMR3PutMem(pSSM, pLsiLogic->VBoxSCSI.pBuf, pLsiLogic->VBoxSCSI.cbBuf); + + return SSMR3PutU32(pSSM, ~0); +} + +static DECLCALLBACK(int) lsilogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version) +{ + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + int rc = VINF_SUCCESS; + + /* We support saved states only from this and older versions. */ + if (u32Version > LSILOGIC_SAVED_STATE_MINOR_VERSION) + return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; + + /* Every device first. */ + for (unsigned i = 0; i < RT_ELEMENTS(pLsiLogic->aDeviceStates); i++) + { + PLSILOGICDEVICE pDevice = &pLsiLogic->aDeviceStates[i]; + + AssertMsg(!pDevice->cOutstandingRequests, + ("There are still outstanding requests on this device\n")); + SSMR3GetU32(pSSM, (uint32_t *)&pDevice->cOutstandingRequests); + } + /* Now the main device state. */ + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->enmState); + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->enmWhoInit); + SSMR3GetBool (pSSM, &pLsiLogic->fDoorbellInProgress); + SSMR3GetBool (pSSM, &pLsiLogic->fDiagnosticEnabled); + SSMR3GetBool (pSSM, &pLsiLogic->fNotificationSend); + SSMR3GetBool (pSSM, &pLsiLogic->fEventNotificationEnabled); + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->uInterruptMask); + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->uInterruptStatus); + for (unsigned i = 0; i < RT_ELEMENTS(pLsiLogic->aMessage); i++) + SSMR3GetU32 (pSSM, &pLsiLogic->aMessage[i]); + SSMR3GetU32 (pSSM, &pLsiLogic->iMessage); + SSMR3GetU32 (pSSM, &pLsiLogic->cMessage); + SSMR3GetMem (pSSM, &pLsiLogic->ReplyBuffer, sizeof(pLsiLogic->ReplyBuffer)); + SSMR3GetU32 (pSSM, &pLsiLogic->uNextReplyEntryRead); + SSMR3GetU32 (pSSM, &pLsiLogic->cReplySize); + SSMR3GetU16 (pSSM, &pLsiLogic->u16IOCFaultCode); + SSMR3GetU32 (pSSM, &pLsiLogic->u32HostMFAHighAddr); + SSMR3GetU32 (pSSM, &pLsiLogic->u32SenseBufferHighAddr); + SSMR3GetU8 (pSSM, &pLsiLogic->cMaxDevices); + SSMR3GetU8 (pSSM, &pLsiLogic->cMaxBuses); + SSMR3GetU16 (pSSM, &pLsiLogic->cbReplyFrame); + SSMR3GetU32 (pSSM, &pLsiLogic->iDiagnosticAccess); + SSMR3GetU32 (pSSM, &pLsiLogic->cReplyQueueEntries); + SSMR3GetU32 (pSSM, &pLsiLogic->cRequestQueueEntries); + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->uReplyFreeQueueNextEntryFreeWrite); + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->uReplyFreeQueueNextAddressRead); + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->uReplyPostQueueNextEntryFreeWrite); + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->uReplyPostQueueNextAddressRead); + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->uRequestQueueNextEntryFreeWrite); + SSMR3GetU32 (pSSM, (uint32_t *)&pLsiLogic->uRequestQueueNextAddressRead); + SSMR3GetMem (pSSM, &pLsiLogic->ConfigurationPages, sizeof(pLsiLogic->ConfigurationPages)); + /* Now the data for the BIOS interface. */ + SSMR3GetU8 (pSSM, &pLsiLogic->VBoxSCSI.regIdentify); + SSMR3GetU8 (pSSM, &pLsiLogic->VBoxSCSI.uTargetDevice); + SSMR3GetU8 (pSSM, &pLsiLogic->VBoxSCSI.uTxDir); + SSMR3GetU8 (pSSM, &pLsiLogic->VBoxSCSI.cbCDB); + SSMR3GetMem (pSSM, pLsiLogic->VBoxSCSI.aCDB, sizeof(pLsiLogic->VBoxSCSI.aCDB)); + SSMR3GetU8 (pSSM, &pLsiLogic->VBoxSCSI.iCDB); + SSMR3GetU32 (pSSM, &pLsiLogic->VBoxSCSI.cbBuf); + SSMR3GetU32 (pSSM, &pLsiLogic->VBoxSCSI.iBuf); + SSMR3GetBool(pSSM, (bool *)&pLsiLogic->VBoxSCSI.fBusy); + SSMR3GetU8 (pSSM, (uint8_t *)&pLsiLogic->VBoxSCSI.enmState); + if (pLsiLogic->VBoxSCSI.cbCDB) + { + pLsiLogic->VBoxSCSI.pBuf = (uint8_t *)RTMemAllocZ(pLsiLogic->VBoxSCSI.cbCDB); + if (!pLsiLogic->VBoxSCSI.pBuf) + { + LogRel(("LsiLogic: Out of memory during restore.\n")); + return PDMDEV_SET_ERROR(pDevIns, VERR_NO_MEMORY, + N_("LsiLogic: Out of memory during restore\n")); + } + SSMR3GetMem(pSSM, pLsiLogic->VBoxSCSI.pBuf, pLsiLogic->VBoxSCSI.cbBuf); + } + + uint32_t u32; + SSMR3GetU32(pSSM, &u32); + if (RT_FAILURE(rc)) + return rc; + if (u32 != ~0U) + { + AssertMsgFailed(("u32=%#x expected ~0\n", u32)); + return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; + } + + return VINF_SUCCESS; +} + +/** + * Gets the pointer to the status LED of a device - called from the SCSi driver. + * + * @returns VBox status code. + * @param pInterface Pointer to the interface structure containing the called function pointer. + * @param iLUN The unit which status LED we desire. Always 0 here as the driver + * doesn't know about other LUN's. + * @param ppLed Where to store the LED pointer. + */ +static DECLCALLBACK(int) lsilogicDeviceQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) +{ + PLSILOGICDEVICE pDevice = PDMILEDPORTS_2_PLSILOGICDEVICE(pInterface); + if (iLUN == 0) + { + *ppLed = &pDevice->Led; + Assert((*ppLed)->u32Magic == PDMLED_MAGIC); + return VINF_SUCCESS; + } + return VERR_PDM_LUN_NOT_FOUND; +} + +/** + * Queries an interface to the driver. + * + * @returns Pointer to interface. + * @returns NULL if the interface was not supported by the device. + * @param pInterface Pointer to LSILOGICDEVICE::IBase. + * @param enmInterface The requested interface identification. + */ +static DECLCALLBACK(void *) lsilogicDeviceQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) +{ + PLSILOGICDEVICE pDevice = PDMIBASE_2_PLSILOGICDEVICE(pInterface); + + switch (enmInterface) + { + case PDMINTERFACE_SCSI_PORT: + return &pDevice->ISCSIPort; + case PDMINTERFACE_LED_PORTS: + return &pDevice->ILed; + default: + return NULL; + } +} + +/** + * Gets the pointer to the status LED of a unit. + * + * @returns VBox status code. + * @param pInterface Pointer to the interface structure containing the called function pointer. + * @param iLUN The unit which status LED we desire. + * @param ppLed Where to store the LED pointer. + */ +static DECLCALLBACK(int) lsilogicStatusQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) +{ + PLSILOGICSCSI pLsiLogic = PDMILEDPORTS_2_PLSILOGICSCSI(pInterface); + if (iLUN < LSILOGIC_DEVICES_MAX) + { + *ppLed = &pLsiLogic->aDeviceStates[iLUN].Led; + Assert((*ppLed)->u32Magic == PDMLED_MAGIC); + return VINF_SUCCESS; + } + return VERR_PDM_LUN_NOT_FOUND; +} + +/** + * Queries an interface to the driver. + * + * @returns Pointer to interface. + * @returns NULL if the interface was not supported by the device. + * @param pInterface Pointer to ATADevState::IBase. + * @param enmInterface The requested interface identification. + */ +static DECLCALLBACK(void *) lsilogicStatusQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) +{ + PLSILOGICSCSI pLsiLogic = PDMIBASE_2_PLSILOGICSCSI(pInterface); + switch (enmInterface) + { + case PDMINTERFACE_BASE: + return &pLsiLogic->IBase; + case PDMINTERFACE_LED_PORTS: + return &pLsiLogic->ILeds; + default: + return NULL; + } +} + +/** + * Detach notification. + * + * One harddisk at one port has been unplugged. + * The VM is suspended at this point. + * + * @param pDevIns The device instance. + * @param iLUN The logical unit which is being detached. + */ +static DECLCALLBACK(void) lsilogicDetach(PPDMDEVINS pDevIns, unsigned iLUN) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + PLSILOGICDEVICE pDevice = &pThis->aDeviceStates[iLUN]; + + Log(("%s:\n", __FUNCTION__)); + + /* + * Zero some important members. + */ + pDevice->pDrvBase = NULL; + pDevice->pDrvSCSIConnector = NULL; +} + +/** + * Attach command. + * + * This is called when we change block driver. + * + * @returns VBox status code. + * @param pDevIns The device instance. + * @param iLUN The logical unit which is being detached. + */ +static DECLCALLBACK(int) lsilogicAttach(PPDMDEVINS pDevIns, unsigned iLUN) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + PLSILOGICDEVICE pDevice = &pThis->aDeviceStates[iLUN]; + int rc; + + /* the usual paranoia */ + AssertRelease(!pDevice->pDrvBase); + AssertRelease(!pDevice->pDrvSCSIConnector); + Assert(pDevice->iLUN == iLUN); + + /* + * Try attach the block device and get the interfaces, + * required as well as optional. + */ + rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, NULL); + if (RT_SUCCESS(rc)) + { + /* Get SCSI connector interface. */ + pDevice->pDrvSCSIConnector = (PPDMISCSICONNECTOR)pDevice->pDrvBase->pfnQueryInterface(pDevice->pDrvBase, PDMINTERFACE_SCSI_CONNECTOR); + AssertMsgReturn(pDevice->pDrvSCSIConnector, ("Missing SCSI interface below\n"), VERR_PDM_MISSING_INTERFACE); + } + else + AssertMsgFailed(("Failed to attach LUN#%d. rc=%Rrc\n", pDevice->iLUN, rc)); + + if (RT_FAILURE(rc)) + { + pDevice->pDrvBase = NULL; + pDevice->pDrvSCSIConnector = NULL; + } + return rc; +} + +/** + * @copydoc FNPDMDEVPOWEROFF + */ +static DECLCALLBACK(void) lsilogicPowerOff(PPDMDEVINS pDevIns) +{ + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + bool fIdle = lsilogicWaitForAsyncIOFinished(pLsiLogic, 20000); + Assert(fIdle); +} + +/** + * @copydoc FNPDMDEVSUSPEND + */ +static DECLCALLBACK(void) lsilogicSuspend(PPDMDEVINS pDevIns) +{ + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + bool fIdle = lsilogicWaitForAsyncIOFinished(pLsiLogic, 20000); + Assert(fIdle); +} + +/** + * @copydoc FNPDMDEVRESET + */ +static DECLCALLBACK(void) lsilogicReset(PPDMDEVINS pDevIns) +{ + PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + int rc; + + bool fIdle = lsilogicWaitForAsyncIOFinished(pLsiLogic, 20000); + Assert(fIdle); + + rc = lsilogicHardReset(pLsiLogic); + AssertRC(rc); + + vboxscsiInitialize(&pLsiLogic->VBoxSCSI); +} + +/** + * @copydoc FNPDMDEVRELOCATE + */ +static DECLCALLBACK(void) lsilogicRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + + pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); + pThis->pNotificationQueueRC = PDMQueueRCPtr(pThis->pNotificationQueueR3); + + /* Relocate queues. */ + pThis->pReplyFreeQueueBaseRC += offDelta; + pThis->pReplyPostQueueBaseRC += offDelta; + pThis->pRequestQueueBaseRC += offDelta; +} + +/** + * @copydoc FNPDMDEVDESTRUCT + */ +static DECLCALLBACK(int) lsilogicDestruct(PPDMDEVINS pDevIns) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + int rc = VINF_SUCCESS; + + PDMR3CritSectDelete(&pThis->ReplyFreeQueueCritSect); + PDMR3CritSectDelete(&pThis->ReplyPostQueueCritSect); + + /* Destroy task cache. */ + if (pThis->pTaskCache) + rc = RTCacheDestroy(pThis->pTaskCache); + + return rc; +} + +/** + * @copydoc FNPDMDEVCONSTRUCT + */ +static DECLCALLBACK(int) lsilogicConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle) +{ + PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); + int rc = VINF_SUCCESS; + PVM pVM = PDMDevHlpGetVM(pDevIns); + + /* + * Validate and read configuration. + */ + rc = CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0" + "R0Enabled\0" + "ReplyQueueDepth\0" + "RequestQueueDepth\0"); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, + N_("LsiLogic configuration error: unknown option specified")); + rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &pThis->fGCEnabled, true); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("LsiLogic configuration error: failed to read GCEnabled as boolean")); + Log(("%s: fGCEnabled=%d\n", __FUNCTION__, pThis->fGCEnabled)); + + rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &pThis->fR0Enabled, true); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("LsiLogic configuration error: failed to read R0Enabled as boolean")); + Log(("%s: fR0Enabled=%d\n", __FUNCTION__, pThis->fR0Enabled)); + + rc = CFGMR3QueryU32Def(pCfgHandle, "ReplyQueueDepth", + &pThis->cReplyQueueEntries, + LSILOGICSCSI_REPLY_QUEUE_DEPTH_DEFAULT); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("LsiLogic configuration error: failed to read ReplyQueue as integer")); + Log(("%s: ReplyQueueDepth=%u\n", __FUNCTION__, pThis->cReplyQueueEntries)); + + rc = CFGMR3QueryU32Def(pCfgHandle, "RequestQueueDepth", + &pThis->cRequestQueueEntries, + LSILOGICSCSI_REQUEST_QUEUE_DEPTH_DEFAULT); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("LsiLogic configuration error: failed to read RequestQueue as integer")); + Log(("%s: RequestQueueDepth=%u\n", __FUNCTION__, pThis->cRequestQueueEntries)); + + + /* Init static parts. */ + PCIDevSetVendorId (&pThis->PciDev, LSILOGICSCSI_PCI_VENDOR_ID); /* LsiLogic */ + PCIDevSetDeviceId (&pThis->PciDev, LSILOGICSCSI_PCI_DEVICE_ID); /* LSI53C1030 */ + PCIDevSetClassProg (&pThis->PciDev, 0x00); /* SCSI */ + PCIDevSetClassSub (&pThis->PciDev, 0x00); /* SCSI */ + PCIDevSetClassBase (&pThis->PciDev, 0x01); /* Mass storage */ + PCIDevSetSubSystemVendorId(&pThis->PciDev, LSILOGICSCSI_PCI_SUBSYSTEM_VENDOR_ID); + PCIDevSetSubSystemId (&pThis->PciDev, LSILOGICSCSI_PCI_SUBSYSTEM_ID); + PCIDevSetInterruptPin (&pThis->PciDev, 0x01); /* Interrupt pin A */ + + pThis->pDevInsR3 = pDevIns; + pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); + pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); + pThis->IBase.pfnQueryInterface = lsilogicStatusQueryInterface; + pThis->ILeds.pfnQueryStatusLed = lsilogicStatusQueryStatusLed; + + /* + * Register the PCI device, it's I/O regions. + */ + rc = PDMDevHlpPCIRegister (pDevIns, &pThis->PciDev); + if (RT_FAILURE(rc)) + return rc; + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, LSILOGIC_PCI_SPACE_IO_SIZE, PCI_ADDRESS_SPACE_IO, lsilogicMap); + if (RT_FAILURE(rc)) + return rc; + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, LSILOGIC_PCI_SPACE_MEM_SIZE, PCI_ADDRESS_SPACE_MEM, lsilogicMap); + if (RT_FAILURE(rc)) + return rc; + + rc = PDMDevHlpPCIIORegionRegister(pDevIns, 2, LSILOGIC_PCI_SPACE_MEM_SIZE, PCI_ADDRESS_SPACE_MEM, lsilogicMap); + if (RT_FAILURE(rc)) + return rc; + + /* Intialize task queue. */ + rc = PDMDevHlpPDMQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 2, 0, + lsilogicNotifyQueueConsumer, true, &pThis->pNotificationQueueR3); + if (RT_FAILURE(rc)) + return rc; + pThis->pNotificationQueueR0 = PDMQueueR0Ptr(pThis->pNotificationQueueR3); + pThis->pNotificationQueueRC = PDMQueueRCPtr(pThis->pNotificationQueueR3); + + /* + * We need one entry free in the queue. + */ + pThis->cReplyQueueEntries++; + pThis->cRequestQueueEntries++; + + /* + * Allocate memory for the queues. + */ + uint32_t cbQueues; + + cbQueues = 2*pThis->cReplyQueueEntries * sizeof(uint32_t); + cbQueues += pThis->cRequestQueueEntries * sizeof(uint32_t); + rc = MMHyperAlloc(pVM, cbQueues, 1, MM_TAG_PDM_DEVICE_USER, + (void **)&pThis->pReplyFreeQueueBaseR3); + if (RT_FAILURE(rc)) + return VERR_NO_MEMORY; + pThis->pReplyFreeQueueBaseR0 = MMHyperR3ToR0(pVM, (void *)pThis->pReplyFreeQueueBaseR3); + pThis->pReplyFreeQueueBaseRC = MMHyperR3ToRC(pVM, (void *)pThis->pReplyFreeQueueBaseR3); + + pThis->pReplyPostQueueBaseR3 = pThis->pReplyFreeQueueBaseR3 + pThis->cReplyQueueEntries; + pThis->pReplyPostQueueBaseR0 = MMHyperR3ToR0(pVM, (void *)pThis->pReplyPostQueueBaseR3); + pThis->pReplyPostQueueBaseRC = MMHyperR3ToRC(pVM, (void *)pThis->pReplyPostQueueBaseR3); + + pThis->pRequestQueueBaseR3 = pThis->pReplyPostQueueBaseR3 + pThis->cReplyQueueEntries; + pThis->pRequestQueueBaseR0 = MMHyperR3ToR0(pVM, (void *)pThis->pRequestQueueBaseR3); + pThis->pRequestQueueBaseRC = MMHyperR3ToRC(pVM, (void *)pThis->pRequestQueueBaseR3); + + /* + * Create critical sections protecting the reply post and free queues. + */ + rc = PDMDevHlpCritSectInit(pDevIns, &pThis->ReplyFreeQueueCritSect, "LsiLogicRFQ"); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("LsiLogic: cannot create critical section for reply free queue")); + + rc = PDMDevHlpCritSectInit(pDevIns, &pThis->ReplyPostQueueCritSect, "LsiLogicRPQ"); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("LsiLogic: cannot create critical section for reply post queue")); + + /* + * Allocate task cache. + */ + rc = RTCacheCreate(&pThis->pTaskCache, 0, sizeof(LSILOGICTASKSTATE), RTOBJCACHE_PROTECT_INSERT); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, + N_("Cannot create task cache")); + + /* Initialize per device state. */ + for (unsigned i = 0; i < RT_ELEMENTS(pThis->aDeviceStates); i++) + { + char szName[24]; + PLSILOGICDEVICE pDevice = &pThis->aDeviceStates[i]; + + RTStrPrintf(szName, sizeof(szName), "Device%d", i); + + /* Initialize static parts of the device. */ + pDevice->iLUN = i; + pDevice->pLsiLogicR3 = pThis; + pDevice->pLsiLogicR0 = PDMINS_2_DATA_R0PTR(pDevIns); + pDevice->pLsiLogicRC = PDMINS_2_DATA_RCPTR(pDevIns); + pDevice->Led.u32Magic = PDMLED_MAGIC; + pDevice->IBase.pfnQueryInterface = lsilogicDeviceQueryInterface; + pDevice->ISCSIPort.pfnSCSIRequestCompleted = lsilogicDeviceSCSIRequestCompleted; + pDevice->ILed.pfnQueryStatusLed = lsilogicDeviceQueryStatusLed; + + /* Attach SCSI driver. */ + rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, szName); + if (RT_SUCCESS(rc)) + { + /* Get SCSI connector interface. */ + pDevice->pDrvSCSIConnector = (PPDMISCSICONNECTOR)pDevice->pDrvBase->pfnQueryInterface(pDevice->pDrvBase, PDMINTERFACE_SCSI_CONNECTOR); + AssertMsgReturn(pDevice->pDrvSCSIConnector, ("Missing SCSI interface below\n"), VERR_PDM_MISSING_INTERFACE); + } + else if (rc == VERR_PDM_NO_ATTACHED_DRIVER) + { + pDevice->pDrvBase = NULL; + rc = VINF_SUCCESS; + Log(("LsiLogic: no driver attached to device %s\n", szName)); + } + else + { + AssertLogRelMsgFailed(("LsiLogic: Failed to attach %s\n", szName)); + return rc; + } + } + + /* + * Attach status driver (optional). + */ + PPDMIBASE pBase; + rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBase, &pBase, "Status Port"); + if (RT_SUCCESS(rc)) + pThis->pLedsConnector = (PDMILEDCONNECTORS *)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS); + else if (rc != VERR_PDM_NO_ATTACHED_DRIVER) + { + AssertMsgFailed(("Failed to attach to status driver. rc=%Rrc\n", rc)); + return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic cannot attach to status driver")); + } + + /* Initialize the SCSI emulation for the BIOS. */ + rc = vboxscsiInitialize(&pThis->VBoxSCSI); + AssertRC(rc); + + /* Register I/O port space in ISA region for BIOS access. */ + rc = PDMDevHlpIOPortRegister(pDevIns, LSILOGIC_ISA_IO_PORT, 3, NULL, + lsilogicIsaIOPortWrite, lsilogicIsaIOPortRead, + lsilogicIsaIOPortWriteStr, lsilogicIsaIOPortReadStr, + "LsiLogic BIOS"); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic cannot register legacy I/O handlers")); + + /* Register save state handlers. */ + rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, + LSILOGIC_SAVED_STATE_MINOR_VERSION, sizeof(*pThis), + lsilogicSaveLoadPrep, lsilogicSaveExec, NULL, + lsilogicSaveLoadPrep, lsilogicLoadExec, NULL); + if (RT_FAILURE(rc)) + return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic cannot register save state handlers")); + + pThis->enmWhoInit = LSILOGICWHOINIT_SYSTEM_BIOS; + + /* Perform hard reset. */ + rc = lsilogicHardReset(pThis); + AssertRC(rc); + + return rc; +} + +/** + * The device registration structure. + */ +const PDMDEVREG g_DeviceLsiLogicSCSI = +{ + /* u32Version */ + PDM_DEVREG_VERSION, + /* szDeviceName */ + "lsilogicscsi", + /* szRCMod */ + "VBoxDDGC.gc", + /* szR0Mod */ + "VBoxDDR0.r0", + /* pszDescription */ + "LSI Logic 53c1030 SCSI controller.\n", + /* fFlags */ + PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 + | PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION + | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, + /* fClass */ + PDM_DEVREG_CLASS_STORAGE, + /* cMaxInstances */ + ~0, + /* cbInstance */ + sizeof(LSILOGICSCSI), + /* pfnConstruct */ + lsilogicConstruct, + /* pfnDestruct */ + lsilogicDestruct, + /* pfnRelocate */ + lsilogicRelocate, + /* pfnIOCtl */ + NULL, + /* pfnPowerOn */ + NULL, + /* pfnReset */ + lsilogicReset, + /* pfnSuspend */ + lsilogicSuspend, + /* pfnResume */ + NULL, + /* pfnAttach */ + lsilogicAttach, + /* pfnDetach */ + lsilogicDetach, + /* pfnQueryInterface. */ + NULL, + /* pfnInitComplete */ + NULL, + /* pfnPowerOff */ + lsilogicPowerOff, + /* pfnSoftReset */ + NULL, + /* u32VersionEnd */ + PDM_DEVREG_VERSION +}; + +#endif /* IN_RING3 */ +#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ diff --git a/src/VBox/Devices/Storage/DrvHostBase.cpp b/src/VBox/Devices/Storage/DrvHostBase.cpp index fda4216ea..bb8186286 100644 --- a/src/VBox/Devices/Storage/DrvHostBase.cpp +++ b/src/VBox/Devices/Storage/DrvHostBase.cpp @@ -1,4 +1,4 @@ -/* $Id: DrvHostBase.cpp 19974 2009-05-24 17:57:46Z vboxsync $ */ +/* $Id: DrvHostBase.cpp $ */ /** @file * DrvHostBase - Host base drive access driver. */ diff --git a/src/VBox/Devices/Storage/DrvHostBase.h b/src/VBox/Devices/Storage/DrvHostBase.h index 8b50c6ced..fc8850e02 100644 --- a/src/VBox/Devices/Storage/DrvHostBase.h +++ b/src/VBox/Devices/Storage/DrvHostBase.h @@ -1,4 +1,4 @@ -/* $Id: DrvHostBase.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: DrvHostBase.h $ */ /** @file * DrvHostBase - Host base drive access driver. */ diff --git a/src/VBox/Devices/Storage/DrvHostDVD.cpp b/src/VBox/Devices/Storage/DrvHostDVD.cpp index 368f33080..464bb7b04 100644 --- a/src/VBox/Devices/Storage/DrvHostDVD.cpp +++ b/src/VBox/Devices/Storage/DrvHostDVD.cpp @@ -1,4 +1,4 @@ -/* $Id: DrvHostDVD.cpp 19968 2009-05-24 12:14:19Z vboxsync $ */ +/* $Id: DrvHostDVD.cpp $ */ /** @file * DrvHostDVD - Host DVD block driver. */ diff --git a/src/VBox/Devices/Storage/DrvSCSI.cpp b/src/VBox/Devices/Storage/DrvSCSI.cpp new file mode 100644 index 000000000..7d0d0f689 --- /dev/null +++ b/src/VBox/Devices/Storage/DrvSCSI.cpp @@ -0,0 +1,883 @@ +/* $Id: DrvSCSI.cpp $ */ +/** @file + * + * VBox storage drivers: + * Generic SCSI command parser and execution driver + */ + +/* + * Copyright (C) 2006-2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +//#define DEBUG +#define LOG_GROUP LOG_GROUP_DRV_SCSI +#include <VBox/pdmdrv.h> +#include <VBox/pdmifs.h> +#include <VBox/pdmthread.h> +#include <VBox/scsi.h> +#include <iprt/assert.h> +#include <iprt/string.h> +#include <iprt/alloc.h> +#include <iprt/req.h> +#include <iprt/semaphore.h> + +#include "Builtins.h" + +/** + * SCSI driver instance data. + */ +typedef struct DRVSCSI +{ + /** Pointer driver instance. */ + PPDMDRVINS pDrvIns; + + /** Pointer to the attached driver's base interface. */ + PPDMIBASE pDrvBase; + /** Pointer to the attached driver's block interface. */ + PPDMIBLOCK pDrvBlock; + /** Pointer to the attached driver's async block interface. */ + PPDMIBLOCKASYNC pDrvBlockAsync; + /** Pointer to the attached driver's block bios interface. */ + PPDMIBLOCKBIOS pDrvBlockBios; + /** Pointer to the attached driver's mount interface. */ + PPDMIMOUNT pDrvMount; + /** Pointer to the SCSI port interface of the device above. */ + PPDMISCSIPORT pDevScsiPort; + /** pointer to the Led port interface of the dveice above. */ + PPDMILEDPORTS pLedPort; + /** The scsi connector interface .*/ + PDMISCSICONNECTOR ISCSIConnector; + /** The block port interface. */ + PDMIBLOCKPORT IPort; + /** The optional block async port interface. */ + PDMIBLOCKASYNCPORT IPortAsync; + /** The mount notify interface. */ + PDMIMOUNTNOTIFY IMountNotify; + /** The status LED state for this drive. + * used in case the device doesn't has a Led interface + * so we can use this to avoid if checks later on. */ + PDMLED Led; + /** pointer to the Led to use. */ + PPDMLED pLed; + + /** Device type. */ + PDMBLOCKTYPE enmType; + /** BIOS PCHS Geometry. */ + PDMMEDIAGEOMETRY PCHSGeometry; + /** BIOS LCHS Geometry. */ + PDMMEDIAGEOMETRY LCHSGeometry; + /** Number of sectors this device has. */ + uint64_t cSectors; + + /** The dedicated I/O thread for the non async approach. */ + PPDMTHREAD pAsyncIOThread; + /** Queue for passing the requests to the thread. */ + PRTREQQUEUE pQueueRequests; + /** Release statistics: number of bytes written. */ + STAMCOUNTER StatBytesWritten; + /** Release statistics: number of bytes read. */ + STAMCOUNTER StatBytesRead; +} DRVSCSI, *PDRVSCSI; + +/** Converts a pointer to DRVSCSI::ISCSIConnecotr to a PDRVSCSI. */ +#define PDMISCSICONNECTOR_2_DRVSCSI(pInterface) ( (PDRVSCSI)((uintptr_t)pInterface - RT_OFFSETOF(DRVSCSI, ISCSIConnector)) ) + +#ifdef DEBUG +/** + * Dumps a SCSI request structure for debugging purposes. + * + * @returns nothing. + * @param pRequest Pointer to the request to dump. + */ +static void drvscsiDumpScsiRequest(PPDMSCSIREQUEST pRequest) +{ + Log(("Dump for pRequest=%#p Command: %s\n", pRequest, SCSICmdText(pRequest->pbCDB[0]))); + Log(("cbCDB=%u\n", pRequest->cbCDB)); + for (uint32_t i = 0; i < pRequest->cbCDB; i++) + Log(("pbCDB[%u]=%#x\n", i, pRequest->pbCDB[i])); + Log(("cbScatterGather=%u\n", pRequest->cbScatterGather)); + Log(("cScatterGatherEntries=%u\n", pRequest->cScatterGatherEntries)); + /* Print all scatter gather entries. */ + for (uint32_t i = 0; i < pRequest->cScatterGatherEntries; i++) + { + Log(("ScatterGatherEntry[%u].cbSeg=%u\n", i, pRequest->paScatterGatherHead[i].cbSeg)); + Log(("ScatterGatherEntry[%u].pvSeg=%#p\n", i, pRequest->paScatterGatherHead[i].pvSeg)); + } + Log(("pvUser=%#p\n", pRequest->pvUser)); +} +#endif + +/** + * Copy the content of a buffer to a scatter gather list only + * copying only the amount of data which fits into the + * scatter gather list. + * + * @returns VBox status code. + * @param pRequest Pointer to the request which contains the S/G list entries. + * @param pvBuf Pointer to the buffer which should be copied. + * @param cbBuf Size of the buffer. + */ +static int drvscsiScatterGatherListCopyFromBuffer(PPDMSCSIREQUEST pRequest, void *pvBuf, size_t cbBuf) +{ + unsigned cSGEntry = 0; + PPDMDATASEG pSGEntry = &pRequest->paScatterGatherHead[cSGEntry]; + uint8_t *pu8Buf = (uint8_t *)pvBuf; + + LogFlowFunc(("pRequest=%#p pvBuf=%#p cbBuf=%u\n", pRequest, pvBuf, cbBuf)); + +#ifdef DEBUG + for (unsigned i = 0; i < cbBuf; i++) + Log(("%s: pvBuf[%u]=%#x\n", __FUNCTION__, i, pu8Buf[i])); +#endif + + while (cSGEntry < pRequest->cScatterGatherEntries) + { + size_t cbToCopy = (cbBuf < pSGEntry->cbSeg) ? cbBuf : pSGEntry->cbSeg; + + memcpy(pSGEntry->pvSeg, pu8Buf, cbToCopy); + + cbBuf -= cbToCopy; + /* We finished. */ + if (!cbBuf) + break; + + /* Advance the buffer. */ + pu8Buf += cbToCopy; + + /* Go to the next entry in the list. */ + pSGEntry++; + cSGEntry++; + } + + return VINF_SUCCESS; +} + +static void drvscsiPadStr(int8_t *pbDst, const char *pbSrc, uint32_t cbSize) +{ + for (uint32_t i = 0; i < cbSize; i++) + { + if (*pbSrc) + pbDst[i] = *pbSrc++; + else + pbDst[i] = ' '; + } +} + +/** + * Set the sense and advanced sense key in the buffer for error conditions. + * + * @returns SCSI status code. + * @param pRequest Pointer to the request which contains the sense buffer. + * @param uSCSISenseKey The sense key to set. + * @param uSCSIASC The advanced sense key to set. + */ +DECLINLINE(int) drvscsiCmdError(PPDMSCSIREQUEST pRequest, uint8_t uSCSISenseKey, uint8_t uSCSIASC) +{ + AssertMsgReturn(pRequest->cbSenseBuffer >= 18, ("Sense buffer is not big enough\n"), SCSI_STATUS_OK); + AssertMsgReturn(pRequest->pbSenseBuffer, ("Sense buffer pointer is NULL\n"), SCSI_STATUS_OK); + memset(pRequest->pbSenseBuffer, 0, pRequest->cbSenseBuffer); + pRequest->pbSenseBuffer[0] = (1 << 7) | SCSI_SENSE_RESPONSE_CODE_CURR_FIXED; /* Fixed format */ + pRequest->pbSenseBuffer[2] = uSCSISenseKey; + pRequest->pbSenseBuffer[7] = 10; + pRequest->pbSenseBuffer[12] = uSCSIASC; + pRequest->pbSenseBuffer[13] = 0x00; /** @todo: Provide more info. */ + return SCSI_STATUS_CHECK_CONDITION; +} + +/** + * Sets the sense key for a status good condition. + * + * @returns SCSI status code. + * @param pRequest Pointer to the request which contains the sense buffer. + */ +DECLINLINE(int) drvscsiCmdOk(PPDMSCSIREQUEST pRequest) +{ + AssertMsgReturn(pRequest->cbSenseBuffer >= 18, ("Sense buffer is not big enough\n"), SCSI_STATUS_OK); + AssertMsgReturn(pRequest->pbSenseBuffer, ("Sense buffer pointer is NULL\n"), SCSI_STATUS_OK); + memset(pRequest->pbSenseBuffer, 0, pRequest->cbSenseBuffer); + /* + * Setting this breaks Linux guests on the BusLogic controller. + * According to the SCSI SPC spec sense data is returned after a + * CHECK CONDITION status or a REQUEST SENSE command. + * Both SCSI controllers have a feature called Auto Sense which + * fetches the sense data automatically from the device + * with REQUEST SENSE. So the SCSI subsystem in Linux should + * find this sense data even if the command finishes successfully + * but if it finds valid sense data it will let the command fail + * and it doesn't detect attached disks anymore. + * Disabling makes it work again and no other guest shows errors + * so I will leave it disabled for now. + * + * On the other hand it is possible that the devices fetch the sense data + * only after a command failed so the content is really invalid if + * the command succeeds. + */ +#if 0 + pRequest->pbSenseBuffer[0] = (1 << 7) | SCSI_SENSE_RESPONSE_CODE_CURR_FIXED; /* Fixed format */ + pRequest->pbSenseBuffer[2] = SCSI_SENSE_NONE; + pRequest->pbSenseBuffer[7] = 10; + pRequest->pbSenseBuffer[12] = SCSI_ASC_NONE; + pRequest->pbSenseBuffer[13] = SCSI_ASC_NONE; /* Should be ASCQ but it has the same value for success. */ +#endif + return SCSI_STATUS_OK; +} + +DECLINLINE(void) drvscsiH2BE_U16(uint8_t *pbBuf, uint16_t val) +{ + pbBuf[0] = val >> 8; + pbBuf[1] = val; +} + + +DECLINLINE(void) drvscsiH2BE_U24(uint8_t *pbBuf, uint32_t val) +{ + pbBuf[0] = val >> 16; + pbBuf[1] = val >> 8; + pbBuf[2] = val; +} + + +DECLINLINE(void) drvscsiH2BE_U32(uint8_t *pbBuf, uint32_t val) +{ + pbBuf[0] = val >> 24; + pbBuf[1] = val >> 16; + pbBuf[2] = val >> 8; + pbBuf[3] = val; +} + + +DECLINLINE(uint16_t) drvscsiBE2H_U16(const uint8_t *pbBuf) +{ + return (pbBuf[0] << 8) | pbBuf[1]; +} + + +DECLINLINE(uint32_t) drvscsiBE2H_U24(const uint8_t *pbBuf) +{ + return (pbBuf[0] << 16) | (pbBuf[1] << 8) | pbBuf[2]; +} + + +DECLINLINE(uint32_t) drvscsiBE2H_U32(const uint8_t *pbBuf) +{ + return (pbBuf[0] << 24) | (pbBuf[1] << 16) | (pbBuf[2] << 8) | pbBuf[3]; +} + +DECLINLINE(uint64_t) drvscsiBE2H_U64(const uint8_t *pbBuf) +{ + return ((uint64_t)pbBuf[0] << 56) + | ((uint64_t)pbBuf[1] << 48) + | ((uint64_t)pbBuf[2] << 40) + | ((uint64_t)pbBuf[3] << 32) + | ((uint64_t)pbBuf[4] << 24) + | ((uint64_t)pbBuf[5] << 16) + | ((uint64_t)pbBuf[6] << 8) + | (uint64_t)pbBuf[7]; +} + +/** + * Parses the CDB of a request and acts accordingly. + * + * @returns transfer direction type. + * @param pThis Pointer to the SCSI driver instance data. + * @param pRequest Pointer to the request to process. + * @param puOffset Where to store the start offset to start data transfer from. + * @param pcbToTransfer Where to store the number of bytes to transfer. + * @param piTxDir Where to store the data transfer direction. + */ +static int drvscsiProcessCDB(PDRVSCSI pThis, PPDMSCSIREQUEST pRequest, uint64_t *puOffset, uint32_t *pcbToTransfer, int *piTxDir) +{ + int iTxDir = PDMBLOCKTXDIR_NONE; + int rc = SCSI_STATUS_OK; + + /* We check for a command which needs to be handled even for non existant LUNs. */ + switch (pRequest->pbCDB[0]) + { + case SCSI_INQUIRY: + { + SCSIINQUIRYDATA ScsiInquiryReply; + + memset(&ScsiInquiryReply, 0, sizeof(ScsiInquiryReply)); + + ScsiInquiryReply.cbAdditional = 31; + + /* We support only one attached device at LUN0 at the moment. */ + if (pRequest->uLogicalUnit != 0) + { + ScsiInquiryReply.u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_UNKNOWN; + ScsiInquiryReply.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_NOT_CONNECTED_NOT_SUPPORTED; + } + else + { + switch (pThis->enmType) + { + case PDMBLOCKTYPE_HARD_DISK: + ScsiInquiryReply.u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS; + break; + default: + AssertMsgFailed(("Device type %u not supported\n", pThis->enmType)); + } + + ScsiInquiryReply.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_CONNECTED; + ScsiInquiryReply.u3AnsiVersion = 0x05; /* SPC-4 compliant */ + drvscsiPadStr(ScsiInquiryReply.achVendorId, "VBOX", 8); + drvscsiPadStr(ScsiInquiryReply.achProductId, "HARDDISK", 16); + drvscsiPadStr(ScsiInquiryReply.achProductLevel, "1.0", 4); + } + + drvscsiScatterGatherListCopyFromBuffer(pRequest, &ScsiInquiryReply, sizeof(SCSIINQUIRYDATA)); + rc = drvscsiCmdOk(pRequest); + break; + } + case SCSI_REPORT_LUNS: + { + /* + * If allocation length is less than 16 bytes SPC compliant devices have + * to return an error. + */ + if (drvscsiBE2H_U32(&pRequest->pbCDB[6]) < 16) + rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + else + { + uint8_t aReply[16]; /* We report only one LUN. */ + + memset(aReply, 0, sizeof(aReply)); + drvscsiH2BE_U32(&aReply[0], 8); /* List length starts at position 0. */ + drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply)); + rc = drvscsiCmdOk(pRequest); + } + break; + } + case SCSI_TEST_UNIT_READY: + { + rc = drvscsiCmdOk(pRequest); + break; + } + default: + { + /* Now for commands which are only implemented for existant LUNs. */ + if (RT_LIKELY(pRequest->uLogicalUnit == 0)) + { + switch(pRequest->pbCDB[0]) + { + case SCSI_READ_CAPACITY: + { + uint8_t aReply[8]; + memset(aReply, 0, sizeof(aReply)); + + /* + * If sector size exceeds the maximum value that is + * able to be stored in 4 bytes return 0xffffffff in this field + */ + if (pThis->cSectors > UINT32_C(0xffffffff)) + drvscsiH2BE_U32(aReply, UINT32_C(0xffffffff)); + else + drvscsiH2BE_U32(aReply, pThis->cSectors - 1); + drvscsiH2BE_U32(&aReply[4], 512); + drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply)); + rc = drvscsiCmdOk(pRequest); + break; + } + case SCSI_SERVICE_ACTION_IN_16: + { + AssertMsgFailed(("Not implemented yet.\n")); + break; + } + case SCSI_MODE_SENSE_6: + { + uint8_t uModePage = pRequest->pbCDB[2] & 0x3f; + uint8_t aReply[24]; + uint8_t *pu8ReplyPos; + + memset(aReply, 0, sizeof(aReply)); + aReply[0] = 4; /* Reply length 4. */ + aReply[1] = 0; /* Default media type. */ + aReply[2] = RT_BIT(4); /* Caching supported. */ + aReply[3] = 0; /* Block descriptor length. */ + + pu8ReplyPos = aReply + 4; + + if ((uModePage == 0x08) || (uModePage == 0x3f)) + { + memset(pu8ReplyPos, 0, 20); + *pu8ReplyPos++ = 0x08; /* Page code. */ + *pu8ReplyPos++ = 0x12; /* Size of the page. */ + *pu8ReplyPos++ = 0x4; /* Write cache enabled. */ + } + + drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply)); + rc = drvscsiCmdOk(pRequest); + break; + } + case SCSI_READ_6: + { + iTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + *puOffset = ((uint64_t) pRequest->pbCDB[3] + | (pRequest->pbCDB[2] << 8) + | ((pRequest->pbCDB[1] & 0x1f) << 16)) * 512; + *pcbToTransfer = ((uint32_t)pRequest->pbCDB[4]) * 512; + break; + } + case SCSI_READ_10: + { + iTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + *puOffset = ((uint64_t)drvscsiBE2H_U32(&pRequest->pbCDB[2])) * 512; + *pcbToTransfer = ((uint32_t)drvscsiBE2H_U16(&pRequest->pbCDB[7])) * 512; + break; + } + case SCSI_READ_12: + { + iTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + *puOffset = ((uint64_t)drvscsiBE2H_U32(&pRequest->pbCDB[2])) * 512; + *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[6])) * 512; + break; + } + case SCSI_READ_16: + { + iTxDir = PDMBLOCKTXDIR_FROM_DEVICE; + *puOffset = drvscsiBE2H_U64(&pRequest->pbCDB[2]) * 512; + *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[6])) * 512; + break; + } + case SCSI_WRITE_6: + { + iTxDir = PDMBLOCKTXDIR_TO_DEVICE; + *puOffset = ((uint64_t) pRequest->pbCDB[3] + | (pRequest->pbCDB[2] << 8) + | ((pRequest->pbCDB[1] & 0x1f) << 16)) * 512; + *pcbToTransfer = ((uint32_t)pRequest->pbCDB[4]) * 512; + break; + } + case SCSI_WRITE_10: + { + iTxDir = PDMBLOCKTXDIR_TO_DEVICE; + *puOffset = ((uint64_t)drvscsiBE2H_U32(&pRequest->pbCDB[2])) * 512; + *pcbToTransfer = ((uint32_t)drvscsiBE2H_U16(&pRequest->pbCDB[7])) * 512; + break; + } + case SCSI_WRITE_12: + { + iTxDir = PDMBLOCKTXDIR_TO_DEVICE; + *puOffset = ((uint64_t)drvscsiBE2H_U32(&pRequest->pbCDB[2])) * 512; + *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[6])) * 512; + break; + } + case SCSI_WRITE_16: + { + iTxDir = PDMBLOCKTXDIR_TO_DEVICE; + *puOffset = drvscsiBE2H_U64(&pRequest->pbCDB[2]) * 512; + *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[6])) * 512; + break; + } + case SCSI_SYNCHRONIZE_CACHE: + { + /* @todo When async mode implemented we have to move this out here. */ + int rc2 = pThis->pDrvBlock->pfnFlush(pThis->pDrvBlock); + AssertMsgRC(rc2, ("Flushing data failed rc=%Rrc\n", rc2)); + break; + } + case SCSI_READ_BUFFER: + { + uint8_t uDataMode = pRequest->pbCDB[1] & 0x1f; + + switch (uDataMode) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x0a: + break; + case 0x0b: + { + uint8_t aReply[4]; + + /* We do not implement an echo buffer. */ + memset(aReply, 0, sizeof(aReply)); + + drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply)); + rc = drvscsiCmdOk(pRequest); + break; + } + case 0x1a: + case 0x1c: + break; + default: + AssertMsgFailed(("Invalid data mode\n")); + } + break; + } + case SCSI_START_STOP_UNIT: + { + /* Nothing to do. */ + break; + } + case SCSI_LOG_SENSE: + { + uint16_t cbMax = drvscsiBE2H_U16(&pRequest->pbCDB[7]); + uint8_t uPageCode = pRequest->pbCDB[2] & 0x3f; + uint8_t uSubPageCode = pRequest->pbCDB[3]; + + switch (uPageCode) + { + case 0x00: + { + if (uSubPageCode == 0) + { + uint8_t aReply[4]; + + aReply[0] = 0; + aReply[1] = 0; + aReply[2] = 0; + aReply[3] = 0; + drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply)); + rc = drvscsiCmdOk(pRequest); + break; + } + } + default: + rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); + } + break; + } + default: + //AssertMsgFailed(("Command %#x [%s] not implemented\n", pRequest->pbCDB[0], SCSICmdText(pRequest->pbCDB[0]))); + rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE); + } + } + else + { + /* Report an error. */ + rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_UNIT_DOES_NOT_RESPOND_TO_SELECTION); + } + break; + } + } + + *piTxDir = iTxDir; + + return rc; +} + +static int drvscsiProcessRequestOne(PDRVSCSI pThis, PPDMSCSIREQUEST pRequest) +{ + int rc = VINF_SUCCESS; + int iTxDir; + int rcCompletion; + uint64_t uOffset; + uint32_t cbToTransfer; + uint32_t cSegmentsLeft; + + LogFlowFunc(("Entered\n")); + +#ifdef DEBUG + drvscsiDumpScsiRequest(pRequest); +#endif + rcCompletion = drvscsiProcessCDB(pThis, pRequest, &uOffset, &cbToTransfer, &iTxDir); + if ((rcCompletion == SCSI_STATUS_OK) && (iTxDir != PDMBLOCKTXDIR_NONE)) + { + PPDMDATASEG pSegActual; + + pSegActual = &pRequest->paScatterGatherHead[0]; + cSegmentsLeft = pRequest->cScatterGatherEntries; + + while(cbToTransfer && cSegmentsLeft) + { + uint32_t cbProcess = (cbToTransfer < pSegActual->cbSeg) ? cbToTransfer : (uint32_t)pSegActual->cbSeg; + + Log(("%s: uOffset=%llu cbToTransfer=%u\n", __FUNCTION__, uOffset, cbToTransfer)); + + if (iTxDir == PDMBLOCKTXDIR_FROM_DEVICE) + { + pThis->pLed->Asserted.s.fReading = pThis->pLed->Actual.s.fReading = 1; + rc = pThis->pDrvBlock->pfnRead(pThis->pDrvBlock, uOffset, + pSegActual->pvSeg, cbProcess); + pThis->pLed->Actual.s.fReading = 0; + if (RT_FAILURE(rc)) + AssertMsgFailed(("%s: Failed to read data %Rrc\n", __FUNCTION__, rc)); + STAM_REL_COUNTER_ADD(&pThis->StatBytesRead, cbProcess); + } + else + { + pThis->pLed->Asserted.s.fWriting = pThis->pLed->Actual.s.fWriting = 1; + rc = pThis->pDrvBlock->pfnWrite(pThis->pDrvBlock, uOffset, + pSegActual->pvSeg, cbProcess); + pThis->pLed->Actual.s.fWriting = 0; + if (RT_FAILURE(rc)) + AssertMsgFailed(("%s: Failed to write data %Rrc\n", __FUNCTION__, rc)); + STAM_REL_COUNTER_ADD(&pThis->StatBytesWritten, cbProcess); + } + + /* Go to the next entry. */ + uOffset += cbProcess; + cbToTransfer -= cbProcess; + pSegActual++; + cSegmentsLeft--; + } + AssertMsg(!cbToTransfer && !cSegmentsLeft, + ("Transfer incomplete cbToTransfer=%u cSegmentsLeft=%u", cbToTransfer, cSegmentsLeft)); + drvscsiCmdOk(pRequest); + } + + /* Notify device. */ + rc = pThis->pDevScsiPort->pfnSCSIRequestCompleted(pThis->pDevScsiPort, pRequest, rcCompletion); + AssertMsgRC(rc, ("Error while notifying device rc=%Rrc\n", rc)); + + return rc; +} + +/** + * Request function to wakeup the thread. + * + * @returns VWRN_STATE_CHANGED. + */ +static int drvscsiAsyncIOLoopWakeupFunc(void) +{ + return VWRN_STATE_CHANGED; +} + +/** + * The thread function which processes the requests asynchronously. + * + * @returns VBox status code. + * @param pDrvIns Pointer to the device instance data. + * @param pThread Pointer to the thread instance data. + */ +static int drvscsiAsyncIOLoop(PPDMDRVINS pDrvIns, PPDMTHREAD pThread) +{ + int rc = VINF_SUCCESS; + PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); + + LogFlowFunc(("Entering async IO loop.\n")); + + if (pThread->enmState == PDMTHREADSTATE_INITIALIZING) + return VINF_SUCCESS; + + while (pThread->enmState == PDMTHREADSTATE_RUNNING) + { + rc = RTReqProcess(pThis->pQueueRequests, RT_INDEFINITE_WAIT); + AssertMsg(rc == VWRN_STATE_CHANGED, ("Left RTReqProcess and error code is not VWRN_STATE_CHANGED rc=%Rrc\n", rc)); + } + + return VINF_SUCCESS; +} + +static int drvscsiAsyncIOLoopWakeup(PPDMDRVINS pDrvIns, PPDMTHREAD pThread) +{ + int rc; + PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); + PRTREQ pReq; + + AssertMsgReturn(pThis->pQueueRequests, ("pQueueRequests is NULL\n"), VERR_INVALID_STATE); + + rc = RTReqCall(pThis->pQueueRequests, &pReq, 10000 /* 10 sec. */, (PFNRT)drvscsiAsyncIOLoopWakeupFunc, 0); + AssertMsgRC(rc, ("Inserting request into queue failed rc=%Rrc\n", rc)); + + return rc; +} + +/* -=-=-=-=- ISCSIConnector -=-=-=-=- */ + +/** @copydoc PDMISCSICONNECTOR::pfnSCSIRequestSend. */ +static DECLCALLBACK(int) drvscsiRequestSend(PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest) +{ + int rc; + PDRVSCSI pThis = PDMISCSICONNECTOR_2_DRVSCSI(pInterface); + PRTREQ pReq; + + AssertMsgReturn(pThis->pQueueRequests, ("pQueueRequests is NULL\n"), VERR_INVALID_STATE); + + rc = RTReqCallEx(pThis->pQueueRequests, &pReq, 0, RTREQFLAGS_NO_WAIT, (PFNRT)drvscsiProcessRequestOne, 2, pThis, pSCSIRequest); + AssertMsgReturn(RT_SUCCESS(rc), ("Inserting request into queue failed rc=%Rrc\n", rc), rc); + + return VINF_SUCCESS; +} + +/* -=-=-=-=- IBase -=-=-=-=- */ + +/** @copydoc PDMIBASE::pfnQueryInterface. */ +static DECLCALLBACK(void *) drvscsiQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) +{ + PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); + PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); + switch (enmInterface) + { + case PDMINTERFACE_BASE: + return &pDrvIns->IBase; + case PDMINTERFACE_SCSI_CONNECTOR: + return &pThis->ISCSIConnector; + case PDMINTERFACE_BLOCK_PORT: + return &pThis->IPort; + default: + return NULL; + } +} + +/** + * Destruct a driver instance. + * + * Most VM resources are freed by the VM. This callback is provided so that any non-VM + * resources can be freed correctly. + * + * @param pDrvIns The driver instance data. + */ +static DECLCALLBACK(void) drvscsiDestruct(PPDMDRVINS pDrvIns) +{ + int rc; + PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); + + if (pThis->pQueueRequests) + { + rc = RTReqDestroyQueue(pThis->pQueueRequests); + AssertMsgRC(rc, ("Failed to destroy queue rc=%Rrc\n", rc)); + } + +} + +/** + * Construct a block driver instance. + * + * @returns VBox status. + * @param pDrvIns The driver instance data. + * If the registration structure is needed, pDrvIns->pDrvReg points to it. + * @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration + * of the driver instance. It's also found in pDrvIns->pCfgHandle, but like + * iInstance it's expected to be used a bit in this function. + */ +static DECLCALLBACK(int) drvscsiConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle) +{ + int rc = VINF_SUCCESS; + PDMBLOCKTYPE enmType; + PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); + + LogFlowFunc(("pDrvIns=%#p pCfgHandle=%#p\n", pDrvIns, pCfgHandle)); + + /* + * Initialize interfaces. + */ + pDrvIns->IBase.pfnQueryInterface = drvscsiQueryInterface; + pThis->ISCSIConnector.pfnSCSIRequestSend = drvscsiRequestSend; + + /* + * Try attach driver below and query it's block interface. + */ + rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pThis->pDrvBase); + AssertMsgReturn(RT_SUCCESS(rc), ("Attaching driver below failed rc=%Rrc\n", rc), rc); + + /* + * Query the block and blockbios interfaces. + */ + pThis->pDrvBlock = (PDMIBLOCK *)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_BLOCK); + if (!pThis->pDrvBlock) + { + AssertMsgFailed(("Configuration error: No block interface!\n")); + return VERR_PDM_MISSING_INTERFACE; + } + pThis->pDrvBlockBios = (PDMIBLOCKBIOS *)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_BLOCK_BIOS); + if (!pThis->pDrvBlockBios) + { + AssertMsgFailed(("Configuration error: No block BIOS interface!\n")); + return VERR_PDM_MISSING_INTERFACE; + } + + /* Query the SCSI port interface above. */ + pThis->pDevScsiPort = (PPDMISCSIPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_SCSI_PORT); + AssertMsgReturn(pThis->pDevScsiPort, ("Missing SCSI port interface above\n"), VERR_PDM_MISSING_INTERFACE); + + pThis->pDrvMount = (PDMIMOUNT *)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_MOUNT); + + /* Query the optional LED interface above. */ + pThis->pLedPort = (PPDMILEDPORTS)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_LED_PORTS); + if (pThis->pLedPort != NULL) + { + /* Get The Led. */ + rc = pThis->pLedPort->pfnQueryStatusLed(pThis->pLedPort, 0, &pThis->pLed); + if (RT_FAILURE(rc)) + pThis->pLed = &pThis->Led; + } + else + pThis->pLed = &pThis->Led; + + /* Try to get the optional async block interface. */ + pThis->pDrvBlockAsync = (PDMIBLOCKASYNC *)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_BLOCK_ASYNC); + + enmType = pThis->pDrvBlock->pfnGetType(pThis->pDrvBlock); + if (enmType != PDMBLOCKTYPE_HARD_DISK) + { + AssertMsgFailed(("Configuration error: Not a disk or cd/dvd-rom. enmType=%d\n", enmType)); + return VERR_PDM_UNSUPPORTED_BLOCK_TYPE; + } + pThis->enmType = enmType; + pThis->cSectors = pThis->pDrvBlock->pfnGetSize(pThis->pDrvBlock) / 512; + + /* Create request queue. */ + rc = RTReqCreateQueue(&pThis->pQueueRequests); + AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create request queue rc=%Rrc\n"), rc); + + /* Register statistics counter. */ + PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesRead, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, + "Amount of data read.", "/Devices/SCSI/%d/ReadBytes", pDrvIns->iInstance); + PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesWritten, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, + "Amount of data written.", "/Devices/SCSI/%d/WrittenBytes", pDrvIns->iInstance); + + /* Create I/O thread. */ + rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pThis->pAsyncIOThread, pThis, drvscsiAsyncIOLoop, + drvscsiAsyncIOLoopWakeup, 0, RTTHREADTYPE_IO, "SCSI async IO"); + AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create async I/O thread rc=%Rrc\n"), rc); + + return VINF_SUCCESS; +} + +/** + * SCSI driver registration record. + */ +const PDMDRVREG g_DrvSCSI = +{ + /* u32Version */ + PDM_DRVREG_VERSION, + /* szDriverName */ + "SCSI", + /* pszDescription */ + "Generic SCSI driver.", + /* fFlags */ + PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT, + /* fClass. */ + PDM_DRVREG_CLASS_SCSI, + /* cMaxInstances */ + ~0, + /* cbInstance */ + sizeof(DRVSCSI), + /* pfnConstruct */ + drvscsiConstruct, + /* pfnDestruct */ + drvscsiDestruct, + /* pfnIOCtl */ + NULL, + /* pfnPowerOn */ + NULL, + /* pfnReset */ + NULL, + /* pfnSuspend */ + NULL, + /* pfnResume */ + NULL, + /* pfnDetach */ + NULL, + /* pfnPowerOff */ + NULL +}; diff --git a/src/VBox/Devices/Storage/DrvSCSIHost.cpp b/src/VBox/Devices/Storage/DrvSCSIHost.cpp new file mode 100644 index 000000000..e9bed6a7c --- /dev/null +++ b/src/VBox/Devices/Storage/DrvSCSIHost.cpp @@ -0,0 +1,534 @@ +/* $Id: DrvSCSIHost.cpp $ */ +/** @file + * + * VBox storage drivers: + * Host SCSI access driver. + */ + +/* + * Copyright (C) 2006-2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +//#define DEBUG +#define LOG_GROUP LOG_GROUP_DRV_SCSIHOST +#include <VBox/pdmdrv.h> +#include <VBox/pdmifs.h> +#include <VBox/pdmthread.h> +#include <VBox/scsi.h> +#include <iprt/assert.h> +#include <iprt/string.h> +#include <iprt/alloc.h> +#include <iprt/req.h> +#include <iprt/file.h> + +#if defined(RT_OS_LINUX) +# include <limits.h> +# include <scsi/sg.h> +# include <sys/ioctl.h> +#endif + +#include "../Builtins.h" + +/** + * SCSI driver instance data. + */ +typedef struct DRVSCSIHOST +{ + /** Pointer driver instance. */ + PPDMDRVINS pDrvIns; + + /** Pointer to the SCSI port interface of the device above. */ + PPDMISCSIPORT pDevScsiPort; + /** The scsi connector interface .*/ + PDMISCSICONNECTOR ISCSIConnector; + + /** PAth to the device file. */ + char *pszDevicePath; + /** Handle to the device. */ + RTFILE DeviceFile; + + /** The dedicated I/O thread. */ + PPDMTHREAD pAsyncIOThread; + /** Queue for passing the requests to the thread. */ + PRTREQQUEUE pQueueRequests; +} DRVSCSIHOST, *PDRVSCSIHOST; + +/** Converts a pointer to DRVSCSIHOST::ISCSIConnecotr to a PDRVSCSIHOST. */ +#define PDMISCSICONNECTOR_2_DRVSCSIHOST(pInterface) ( (PDRVSCSIHOST)((uintptr_t)pInterface - RT_OFFSETOF(DRVSCSIHOST, ISCSIConnector)) ) + +#ifdef DEBUG +/** + * Dumps a SCSI request structure for debugging purposes. + * + * @returns nothing. + * @param pRequest Pointer to the request to dump. + */ +static void drvscsihostDumpScsiRequest(PPDMSCSIREQUEST pRequest) +{ + Log(("Dump for pRequest=%#p Command: %s\n", pRequest, SCSICmdText(pRequest->pbCDB[0]))); + Log(("cbCDB=%u\n", pRequest->cbCDB)); + for (uint32_t i = 0; i < pRequest->cbCDB; i++) + Log(("pbCDB[%u]=%#x\n", i, pRequest->pbCDB[i])); + Log(("cbScatterGather=%u\n", pRequest->cbScatterGather)); + Log(("cScatterGatherEntries=%u\n", pRequest->cScatterGatherEntries)); + /* Print all scatter gather entries. */ + for (uint32_t i = 0; i < pRequest->cScatterGatherEntries; i++) + { + Log(("ScatterGatherEntry[%u].cbSeg=%u\n", i, pRequest->paScatterGatherHead[i].cbSeg)); + Log(("ScatterGatherEntry[%u].pvSeg=%#p\n", i, pRequest->paScatterGatherHead[i].pvSeg)); + } + Log(("pvUser=%#p\n", pRequest->pvUser)); +} +#endif + +/** + * Copy the content of a buffer to a scatter gather list + * copying only the amount of data which fits into the + * scatter gather list. + * + * @returns VBox status code. + * @param pRequest Pointer to the request which contains the S/G list entries. + * @param pvBuf Pointer to the buffer which should be copied. + * @param cbBuf Size of the buffer. + */ +static int drvscsihostScatterGatherListCopyFromBuffer(PPDMSCSIREQUEST pRequest, void *pvBuf, size_t cbBuf) +{ + unsigned cSGEntry = 0; + PPDMDATASEG pSGEntry = &pRequest->paScatterGatherHead[cSGEntry]; + uint8_t *pu8Buf = (uint8_t *)pvBuf; + + while (cSGEntry < pRequest->cScatterGatherEntries) + { + size_t cbToCopy = (cbBuf < pSGEntry->cbSeg) ? cbBuf : pSGEntry->cbSeg; + + memcpy(pSGEntry->pvSeg, pu8Buf, cbToCopy); + + cbBuf -= cbToCopy; + /* We finished. */ + if (!cbBuf) + break; + + /* Advance the buffer. */ + pu8Buf += cbToCopy; + + /* Go to the next entry in the list. */ + pSGEntry++; + cSGEntry++; + } + + return VINF_SUCCESS; +} + +/** + * Set the sense and advanced sense key in the buffer for error conditions. + * + * @returns nothing. + * @param pRequest Pointer to the request which contains the sense buffer. + * @param uSCSISenseKey The sense key to set. + * @param uSCSIASC The advanced sense key to set. + */ +DECLINLINE(void) drvscsiCmdError(PPDMSCSIREQUEST pRequest, uint8_t uSCSISenseKey, uint8_t uSCSIASC) +{ + AssertMsg(pRequest->cbSenseBuffer >= 2, ("Sense buffer is not big enough\n")); + AssertMsg(pRequest->pbSenseBuffer, ("Sense buffer pointer is NULL\n")); + pRequest->pbSenseBuffer[0] = uSCSISenseKey; + pRequest->pbSenseBuffer[1] = uSCSIASC; +} + +/** + * Sets the sense key for a status good condition. + * + * @returns nothing. + * @param pRequest Pointer to the request which contains the sense buffer. + */ +DECLINLINE(void) drvscsihostCmdOk(PPDMSCSIREQUEST pRequest) +{ + AssertMsg(pRequest->cbSenseBuffer >= 2, ("Sense buffer is not big enough\n")); + AssertMsg(pRequest->pbSenseBuffer, ("Sense buffer pointer is NULL\n")); + pRequest->pbSenseBuffer[0] = SCSI_SENSE_NONE; + pRequest->pbSenseBuffer[1] = SCSI_ASC_NONE; +} + +/** + * Returns the transfer direction of the given command + * in case the device does not provide this info. + * + * @returns transfer direction of the command. + * SCSIHOSTTXDIR_NONE if no data is transfered. + * SCSIHOSTTXDIR_FROM_DEVICE if the data is read from the device. + * SCSIHOSTTXDIR_TO_DEVICE if the data is written to the device. + * @param uCommand The command byte. + */ +static unsigned drvscsihostGetTransferDirectionFromCommand(uint8_t uCommand) +{ + switch (uCommand) + { + case SCSI_INQUIRY: + case SCSI_REPORT_LUNS: + case SCSI_MODE_SENSE_6: + case SCSI_READ_TOC_PMA_ATIP: + case SCSI_READ_CAPACITY: + case SCSI_MODE_SENSE_10: + case SCSI_GET_EVENT_STATUS_NOTIFICATION: + case SCSI_GET_CONFIGURATION: + case SCSI_READ_10: + case SCSI_READ_12: + case SCSI_READ_BUFFER: + case SCSI_READ_BUFFER_CAPACITY: + case SCSI_READ_DISC_INFORMATION: + case SCSI_READ_DVD_STRUCTURE: + case SCSI_READ_FORMAT_CAPACITIES: + case SCSI_READ_SUBCHANNEL: + case SCSI_READ_TRACK_INFORMATION: + case SCSI_READ_CD: + case SCSI_READ_CD_MSF: + return PDMSCSIREQUESTTXDIR_FROM_DEVICE; + case SCSI_TEST_UNIT_READY: + case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL: + case SCSI_START_STOP_UNIT: + return PDMSCSIREQUESTTXDIR_NONE; + case SCSI_WRITE_10: + case SCSI_WRITE_12: + case SCSI_WRITE_BUFFER: + return PDMSCSIREQUESTTXDIR_TO_DEVICE; + default: + AssertMsgFailed(("Command not known %#x\n", uCommand)); + } + + /* We should never get here in debug mode. */ + AssertMsgFailed(("Impossible to get here!!!\n")); + return PDMSCSIREQUESTTXDIR_NONE; /* to make compilers happy. */ +} + +static int drvscsihostProcessRequestOne(PDRVSCSIHOST pThis, PPDMSCSIREQUEST pRequest) +{ + int rc = VINF_SUCCESS; + unsigned uTxDir; + + LogFlowFunc(("Entered\n")); + +#ifdef DEBUG + drvscsihostDumpScsiRequest(pRequest); +#endif + + /* We implement only one device. */ + if (pRequest->uLogicalUnit != 0) + { + switch (pRequest->pbCDB[0]) + { + case SCSI_INQUIRY: + { + SCSIINQUIRYDATA ScsiInquiryReply; + + memset(&ScsiInquiryReply, 0, sizeof(ScsiInquiryReply)); + + ScsiInquiryReply.u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_UNKNOWN; + ScsiInquiryReply.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_NOT_CONNECTED_NOT_SUPPORTED; + drvscsihostScatterGatherListCopyFromBuffer(pRequest, &ScsiInquiryReply, sizeof(SCSIINQUIRYDATA)); + drvscsihostCmdOk(pRequest); + break; + } + default: + AssertMsgFailed(("Command not implemented for attached device\n")); + drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_NONE); + } + } + else + { +#if defined(RT_OS_LINUX) + sg_io_hdr_t ScsiIoReq; + sg_iovec_t *paSG = NULL; + + /* Setup SCSI request. */ + memset(&ScsiIoReq, 0, sizeof(sg_io_hdr_t)); + ScsiIoReq.interface_id = 'S'; + + if (pRequest->uDataDirection == PDMSCSIREQUESTTXDIR_UNKNOWN) + uTxDir = drvscsihostGetTransferDirectionFromCommand(pRequest->pbCDB[0]); + else + uTxDir = pRequest->uDataDirection; + + if (uTxDir == PDMSCSIREQUESTTXDIR_NONE) + ScsiIoReq.dxfer_direction = SG_DXFER_NONE; + else if (uTxDir == PDMSCSIREQUESTTXDIR_TO_DEVICE) + ScsiIoReq.dxfer_direction = SG_DXFER_TO_DEV; + else if (uTxDir == PDMSCSIREQUESTTXDIR_FROM_DEVICE) + ScsiIoReq.dxfer_direction = SG_DXFER_FROM_DEV; + else + AssertMsgFailed(("Invalid transfer direction %u\n", uTxDir)); + + ScsiIoReq.cmd_len = pRequest->cbCDB; + ScsiIoReq.mx_sb_len = pRequest->cbSenseBuffer; + ScsiIoReq.dxfer_len = pRequest->cbScatterGather; + + if (pRequest->cScatterGatherEntries > 0) + { + if (pRequest->cScatterGatherEntries == 1) + { + ScsiIoReq.iovec_count = 0; + ScsiIoReq.dxferp = pRequest->paScatterGatherHead[0].pvSeg; + } + else + { + ScsiIoReq.iovec_count = pRequest->cScatterGatherEntries; + + paSG = (sg_iovec_t *)RTMemAllocZ(pRequest->cScatterGatherEntries * sizeof(sg_iovec_t)); + AssertPtrReturn(paSG, VERR_NO_MEMORY); + + for (unsigned i = 0; i < pRequest->cScatterGatherEntries; i++) + { + paSG[i].iov_base = pRequest->paScatterGatherHead[i].pvSeg; + paSG[i].iov_len = pRequest->paScatterGatherHead[i].cbSeg; + } + ScsiIoReq.dxferp = paSG; + } + } + + ScsiIoReq.cmdp = pRequest->pbCDB; + ScsiIoReq.sbp = pRequest->pbSenseBuffer; + ScsiIoReq.timeout = UINT_MAX; + ScsiIoReq.flags |= SG_FLAG_DIRECT_IO; + + /** Issue command. */ + rc = ioctl(pThis->DeviceFile, SG_IO, &ScsiIoReq); + if (rc < 0) + { + AssertMsgFailed(("Ioctl failed with rc=%d\n", rc)); + } + + /* Request processed successfully. */ + Log(("Command successfully processed\n")); + if (ScsiIoReq.iovec_count > 0) + RTMemFree(paSG); +#endif + } + /* Notify device that request finished. */ + rc = pThis->pDevScsiPort->pfnSCSIRequestCompleted(pThis->pDevScsiPort, pRequest, SCSI_STATUS_OK); + AssertMsgRC(rc, ("Notifying device above failed rc=%Rrc\n", rc)); + + return rc; + +} + +/** + * Request function to wakeup the thread. + * + * @returns VWRN_STATE_CHANGED. + */ +static int drvscsihostAsyncIOLoopWakeupFunc(void) +{ + return VWRN_STATE_CHANGED; +} + +/** + * The thread function which processes the requests asynchronously. + * + * @returns VBox status code. + * @param pDrvIns Pointer to the device instance data. + * @param pThread Pointer to the thread instance data. + */ +static int drvscsihostAsyncIOLoop(PPDMDRVINS pDrvIns, PPDMTHREAD pThread) +{ + int rc = VINF_SUCCESS; + PDRVSCSIHOST pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSIHOST); + + LogFlowFunc(("Entering async IO loop.\n")); + + if (pThread->enmState == PDMTHREADSTATE_INITIALIZING) + return VINF_SUCCESS; + + while (pThread->enmState == PDMTHREADSTATE_RUNNING) + { + rc = RTReqProcess(pThis->pQueueRequests, RT_INDEFINITE_WAIT); + AssertMsg(rc == VWRN_STATE_CHANGED, ("Left RTReqProcess and error code is not VWRN_STATE_CHANGED rc=%Rrc\n", rc)); + } + + return VINF_SUCCESS; +} + +static int drvscsihostAsyncIOLoopWakeup(PPDMDRVINS pDrvIns, PPDMTHREAD pThread) +{ + int rc; + PDRVSCSIHOST pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSIHOST); + PRTREQ pReq; + + AssertMsgReturn(pThis->pQueueRequests, ("pQueueRequests is NULL\n"), VERR_INVALID_STATE); + + rc = RTReqCall(pThis->pQueueRequests, &pReq, 10000 /* 10 sec. */, (PFNRT)drvscsihostAsyncIOLoopWakeupFunc, 0); + AssertMsgRC(rc, ("Inserting request into queue failed rc=%Rrc\n")); + + return rc; +} + +/* -=-=-=-=- ISCSIConnector -=-=-=-=- */ + +/** @copydoc PDMISCSICONNECTOR::pfnSCSIRequestSend. */ +static DECLCALLBACK(int) drvscsihostRequestSend(PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest) +{ + int rc; + PDRVSCSIHOST pThis = PDMISCSICONNECTOR_2_DRVSCSIHOST(pInterface); + PRTREQ pReq; + + AssertMsgReturn(pThis->pQueueRequests, ("pQueueRequests is NULL\n"), VERR_INVALID_STATE); + + rc = RTReqCallEx(pThis->pQueueRequests, &pReq, 0, RTREQFLAGS_NO_WAIT, (PFNRT)drvscsihostProcessRequestOne, 2, pThis, pSCSIRequest); + AssertMsgReturn(RT_SUCCESS(rc), ("Inserting request into queue failed rc=%Rrc\n", rc), rc); + + return VINF_SUCCESS; +} + +/* -=-=-=-=- IBase -=-=-=-=- */ + +/** @copydoc PDMIBASE::pfnQueryInterface. */ +static DECLCALLBACK(void *) drvscsihostQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) +{ + PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); + PDRVSCSIHOST pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSIHOST); + switch (enmInterface) + { + case PDMINTERFACE_BASE: + return &pDrvIns->IBase; + case PDMINTERFACE_SCSI_CONNECTOR: + return &pThis->ISCSIConnector; + default: + return NULL; + } +} + +/** + * Destruct a driver instance. + * + * Most VM resources are freed by the VM. This callback is provided so that any non-VM + * resources can be freed correctly. + * + * @param pDrvIns The driver instance data. + */ +static DECLCALLBACK(void) drvscsihostDestruct(PPDMDRVINS pDrvIns) +{ + int rc; + PDRVSCSIHOST pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSIHOST); + + if (pThis->DeviceFile != NIL_RTFILE) + RTFileClose(pThis->DeviceFile); + + if (pThis->pszDevicePath) + MMR3HeapFree(pThis->pszDevicePath); + + if (pThis->pQueueRequests) + { + rc = RTReqDestroyQueue(pThis->pQueueRequests); + AssertMsgRC(rc, ("Failed to destroy queue rc=%Rrc\n", rc)); + } + +} + +/** + * Construct a block driver instance. + * + * @returns VBox status. + * @param pDrvIns The driver instance data. + * If the registration structure is needed, pDrvIns->pDrvReg points to it. + * @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration + * of the driver instance. It's also found in pDrvIns->pCfgHandle, but like + * iInstance it's expected to be used a bit in this function. + */ +static DECLCALLBACK(int) drvscsihostConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle) +{ + int rc = VINF_SUCCESS; + PDRVSCSIHOST pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSIHOST); + + LogFlowFunc(("pDrvIns=%#p pCfgHandle=%#p\n", pDrvIns, pCfgHandle)); + + /* + * Read the configuration. + */ + if (!CFGMR3AreValuesValid(pCfgHandle, "DevicePath\0")) + return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES, + N_("Invalid configuraton for host scsi access driver")); + + /* + * Initialize interfaces. + */ + pDrvIns->IBase.pfnQueryInterface = drvscsihostQueryInterface; + pThis->ISCSIConnector.pfnSCSIRequestSend = drvscsihostRequestSend; + pThis->pDrvIns = pDrvIns; + pThis->DeviceFile = NIL_RTFILE; + + /* Query the SCSI port interface above. */ + pThis->pDevScsiPort = (PPDMISCSIPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_SCSI_PORT); + AssertMsgReturn(pThis->pDevScsiPort, ("Missing SCSI port interface above\n"), VERR_PDM_MISSING_INTERFACE); + + /* Create request queue. */ + rc = RTReqCreateQueue(&pThis->pQueueRequests); + AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create request queue rc=%Rrc\n"), rc); + + /* Open the device. */ + rc = CFGMR3QueryStringAlloc(pCfgHandle, "DevicePath", &pThis->pszDevicePath); + if (RT_FAILURE(rc)) + return PDMDRV_SET_ERROR(pDrvIns, rc, + N_("Configuration error: Failed to get the \"DevicePath\" value")); + + rc = RTFileOpen(&pThis->DeviceFile, pThis->pszDevicePath, RTFILE_O_OPEN | RTFILE_O_READWRITE); + if (RT_FAILURE(rc)) + return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, + N_("DrvSCSIHost#%d: Failed to open device '%s'"), pDrvIns->iInstance, pThis->pszDevicePath); + + /* Create I/O thread. */ + rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pThis->pAsyncIOThread, pThis, drvscsihostAsyncIOLoop, + drvscsihostAsyncIOLoopWakeup, 0, RTTHREADTYPE_IO, "SCSI async IO"); + AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create async I/O thread rc=%Rrc\n"), rc); + + return VINF_SUCCESS; +} + +/** + * SCSI driver registration record. + */ +const PDMDRVREG g_DrvSCSIHost = +{ + /* u32Version */ + PDM_DRVREG_VERSION, + /* szDriverName */ + "SCSIHost", + /* pszDescription */ + "Host SCSI driver.", + /* fFlags */ + PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT, + /* fClass. */ + PDM_DRVREG_CLASS_SCSI, + /* cMaxInstances */ + ~0, + /* cbInstance */ + sizeof(DRVSCSIHOST), + /* pfnConstruct */ + drvscsihostConstruct, + /* pfnDestruct */ + drvscsihostDestruct, + /* pfnIOCtl */ + NULL, + /* pfnPowerOn */ + NULL, + /* pfnReset */ + NULL, + /* pfnSuspend */ + NULL, + /* pfnResume */ + NULL, + /* pfnDetach */ + NULL +}; diff --git a/src/VBox/Devices/Storage/DrvVD.cpp b/src/VBox/Devices/Storage/DrvVD.cpp index 488acf66f..6ea57e4df 100644 --- a/src/VBox/Devices/Storage/DrvVD.cpp +++ b/src/VBox/Devices/Storage/DrvVD.cpp @@ -1,4 +1,4 @@ -/* $Id: DrvVD.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: DrvVD.cpp $ */ /** @file * DrvVD - Generic VBox disk media driver. */ diff --git a/src/VBox/Devices/Storage/RawHDDCore.cpp b/src/VBox/Devices/Storage/RawHDDCore.cpp index acbf98c01..614119fed 100644 --- a/src/VBox/Devices/Storage/RawHDDCore.cpp +++ b/src/VBox/Devices/Storage/RawHDDCore.cpp @@ -1,4 +1,4 @@ -/* $Id: RawHDDCore.cpp 18066 2009-03-18 14:16:06Z vboxsync $ */ +/* $Id: RawHDDCore.cpp $ */ /** @file * RawHDDCore - Raw Disk image, Core Code. */ diff --git a/src/VBox/Devices/Storage/VBoxHDD.cpp b/src/VBox/Devices/Storage/VBoxHDD.cpp index 91b9d0fa1..bcbabc97f 100644 --- a/src/VBox/Devices/Storage/VBoxHDD.cpp +++ b/src/VBox/Devices/Storage/VBoxHDD.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxHDD.cpp 21030 2009-06-29 15:25:03Z vboxsync $ */ +/* $Id: VBoxHDD.cpp $ */ /** @file * VBoxHDD - VBox HDD Container implementation. */ diff --git a/src/VBox/Devices/Storage/VBoxSCSI.cpp b/src/VBox/Devices/Storage/VBoxSCSI.cpp new file mode 100644 index 000000000..ce59a3a18 --- /dev/null +++ b/src/VBox/Devices/Storage/VBoxSCSI.cpp @@ -0,0 +1,359 @@ +/* $Id: VBoxSCSI.cpp $ */ +/** @file + * + * VBox storage devices: + * Simple SCSI interface for BIOS access + */ + +/* + * Copyright (C) 2006-2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +//#define DEBUG +#define LOG_GROUP LOG_GROUP_DEV_BUSLOGIC /* @todo: Create extra group. */ + +#if defined(IN_R0) || defined(IN_RC) +# error This device has no R0 or GC components +#endif + +#include <VBox/pdmdev.h> +#include <VBox/pgm.h> +#include <iprt/asm.h> +#include <iprt/mem.h> +#include <iprt/thread.h> +#include <iprt/string.h> + +#include "VBoxSCSI.h" + +/** + * Initializes the state for the SCSI interface. + * + * @returns VBox status code. + * @param pVBoxSCSI Pointer to the unitialized SCSI state. + */ +int vboxscsiInitialize(PVBOXSCSI pVBoxSCSI) +{ + pVBoxSCSI->regIdentify = 0; + pVBoxSCSI->cbCDB = 0; + memset(pVBoxSCSI->aCDB, 0, sizeof(pVBoxSCSI->aCDB)); + pVBoxSCSI->iCDB = 0; + pVBoxSCSI->fBusy = false; + pVBoxSCSI->cbBuf = 0; + pVBoxSCSI->iBuf = 0; + pVBoxSCSI->pBuf = NULL; + pVBoxSCSI->enmState = VBOXSCSISTATE_NO_COMMAND; + + return VINF_SUCCESS; +} + +/** + * Reads a register value. + * + * @returns VBox status code. + * @param pVBoxSCSI Pointer to the SCSI state. + * @param iRegister Index of the register to read. + * @param pu32Value Where to store the content of the register. + */ +int vboxscsiReadRegister(PVBOXSCSI pVBoxSCSI, uint8_t iRegister, uint32_t *pu32Value) +{ + uint8_t uVal = 0; + + switch (iRegister) + { + case 0: + { + if (ASMAtomicReadBool(&pVBoxSCSI->fBusy) == true) + { + uVal |= VBOX_SCSI_BUSY; + /* There is an I/O operation in progress. + * Yield the execution thread to let the I/O thread make progress. + */ + RTThreadYield(); + } + else + uVal &= ~VBOX_SCSI_BUSY; + break; + } + case 1: + { + if (pVBoxSCSI->cbBuf > 0) + { + AssertMsg(pVBoxSCSI->pBuf, ("pBuf is NULL\n")); + uVal = pVBoxSCSI->pBuf[pVBoxSCSI->iBuf]; + pVBoxSCSI->iBuf++; + pVBoxSCSI->cbBuf--; + if (pVBoxSCSI->cbBuf == 0) + { + /** The guest read the last byte from the data in buffer. + * Clear everything and reset command buffer. + */ + RTMemFree(pVBoxSCSI->pBuf); + pVBoxSCSI->pBuf = NULL; + pVBoxSCSI->cbCDB = 0; + pVBoxSCSI->iCDB = 0; + pVBoxSCSI->iBuf = 0; + pVBoxSCSI->uTargetDevice = 0; + pVBoxSCSI->enmState = VBOXSCSISTATE_NO_COMMAND; + memset(pVBoxSCSI->aCDB, 0, sizeof(pVBoxSCSI->aCDB)); + } + } + break; + } + case 2: + { + uVal = pVBoxSCSI->regIdentify; + break; + } + default: + AssertMsgFailed(("Invalid register to read from %u\n", iRegister)); + } + + *pu32Value = uVal; + + return VINF_SUCCESS; +} + +/** + * Writes to a register. + * + * @returns VBox status code. + * VERR_MORE_DATA if a command is ready to be sent to the SCSI driver. + * @param pVBoxSCSI Pointer to the SCSI state. + * @param iRegister Index of the register to write to. + * @param uVal Value to write. + */ +int vboxscsiWriteRegister(PVBOXSCSI pVBoxSCSI, uint8_t iRegister, uint8_t uVal) +{ + int rc = VINF_SUCCESS; + + switch (iRegister) + { + case 0: + { + if (pVBoxSCSI->enmState == VBOXSCSISTATE_NO_COMMAND) + { + pVBoxSCSI->enmState = VBOXSCSISTATE_READ_TXDIR; + pVBoxSCSI->uTargetDevice = uVal; + } + else if (pVBoxSCSI->enmState == VBOXSCSISTATE_READ_TXDIR) + { + pVBoxSCSI->enmState = VBOXSCSISTATE_READ_CDB_SIZE; + pVBoxSCSI->uTxDir = uVal; + } + else if (pVBoxSCSI->enmState == VBOXSCSISTATE_READ_CDB_SIZE) + { + pVBoxSCSI->enmState = VBOXSCSISTATE_READ_BUFFER_SIZE_LOW; + pVBoxSCSI->cbCDB = uVal; + } + else if (pVBoxSCSI->enmState == VBOXSCSISTATE_READ_BUFFER_SIZE_LOW) + { + pVBoxSCSI->enmState = VBOXSCSISTATE_READ_BUFFER_SIZE_HIGH; + pVBoxSCSI->cbBuf = uVal; + } + else if (pVBoxSCSI->enmState == VBOXSCSISTATE_READ_BUFFER_SIZE_HIGH) + { + pVBoxSCSI->enmState = VBOXSCSISTATE_READ_COMMAND; + pVBoxSCSI->cbBuf |= (((uint16_t)uVal) << 8); + } + else if (pVBoxSCSI->enmState == VBOXSCSISTATE_READ_COMMAND) + { + pVBoxSCSI->aCDB[pVBoxSCSI->iCDB] = uVal; + pVBoxSCSI->iCDB++; + + /* Check if we have all neccessary command data. */ + if (pVBoxSCSI->iCDB == pVBoxSCSI->cbCDB) + { + Log(("%s: Command ready for processing\n", __FUNCTION__)); + pVBoxSCSI->enmState = VBOXSCSISTATE_COMMAND_READY; + if (pVBoxSCSI->uTxDir == VBOXSCSI_TXDIR_TO_DEVICE) + { + /* This is a write allocate buffer. */ + pVBoxSCSI->pBuf = (uint8_t *)RTMemAllocZ(pVBoxSCSI->cbBuf); + if (!pVBoxSCSI->pBuf) + return VERR_NO_MEMORY; + } + else + { + /* This is a read from the device. */ + ASMAtomicXchgBool(&pVBoxSCSI->fBusy, true); + rc = VERR_MORE_DATA; /* @todo: Better return value to indicate ready command? */ + } + } + } + else + AssertMsgFailed(("Invalid state %d\n", pVBoxSCSI->enmState)); + break; + } + case 1: + { + AssertMsg(pVBoxSCSI->enmState == VBOXSCSISTATE_COMMAND_READY, ("Invalid state\n")); + pVBoxSCSI->pBuf[pVBoxSCSI->iBuf++] = uVal; + if (pVBoxSCSI->iBuf == pVBoxSCSI->cbBuf) + { + rc = VERR_MORE_DATA; + ASMAtomicXchgBool(&pVBoxSCSI->fBusy, true); + } + break; + } + case 2: + { + pVBoxSCSI->regIdentify = uVal; + break; + } + default: + AssertMsgFailed(("Invalid register to write to %u\n", iRegister)); + } + + return rc; +} + +/** + * Sets up a SCSI request which the owning SCSI device can process. + * + * @returns VBox status code. + * @param pVBoxSCSI Pointer to the SCSI state. + * @param pScsiRequest Pointer to a scsi request to setup. + * @param puTargetDevice Where to store the target device ID. + */ +int vboxscsiSetupRequest(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest, uint32_t *puTargetDevice) +{ + int rc = VINF_SUCCESS; + + LogFlowFunc(("pVBoxSCSI=%#p pScsiRequest=%#p puTargetDevice=%#p\n", pVBoxSCSI, pScsiRequest, puTargetDevice)); + + AssertMsg(pVBoxSCSI->enmState == VBOXSCSISTATE_COMMAND_READY, ("Invalid state %u\n", pVBoxSCSI->enmState)); + + if (pVBoxSCSI->uTxDir == VBOXSCSI_TXDIR_FROM_DEVICE) + { + Assert(!pVBoxSCSI->pBuf); + pVBoxSCSI->pBuf = (uint8_t *)RTMemAllocZ(pVBoxSCSI->cbBuf); + if (!pVBoxSCSI->pBuf) + return VERR_NO_MEMORY; + } + + /** Allocate scatter gather element. */ + pScsiRequest->paScatterGatherHead = (PPDMDATASEG)RTMemAllocZ(sizeof(PDMDATASEG) * 1); /* Only one element. */ + if (!pScsiRequest->paScatterGatherHead) + { + RTMemFree(pVBoxSCSI->pBuf); + pVBoxSCSI->pBuf = NULL; + return VERR_NO_MEMORY; + } + + /** Allocate sense buffer. */ + pScsiRequest->cbSenseBuffer = 18; + pScsiRequest->pbSenseBuffer = (uint8_t *)RTMemAllocZ(pScsiRequest->cbSenseBuffer); + + pScsiRequest->cbCDB = pVBoxSCSI->cbCDB; + pScsiRequest->pbCDB = pVBoxSCSI->aCDB; + pScsiRequest->uLogicalUnit = 0; + pScsiRequest->cbScatterGather = pVBoxSCSI->cbBuf; + pScsiRequest->cScatterGatherEntries = 1; + + pScsiRequest->paScatterGatherHead[0].cbSeg = pVBoxSCSI->cbBuf; + pScsiRequest->paScatterGatherHead[0].pvSeg = pVBoxSCSI->pBuf; + + *puTargetDevice = pVBoxSCSI->uTargetDevice; + + return rc; +} + +/** + * Notifies the device that a request finished and the incoming data + * is ready at the incoming data port. + */ +int vboxscsiRequestFinished(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest) +{ + LogFlowFunc(("pVBoxSCSI=%#p pScsiRequest=%#p\n", pVBoxSCSI, pScsiRequest)); + RTMemFree(pScsiRequest->paScatterGatherHead); + RTMemFree(pScsiRequest->pbSenseBuffer); + + if (pVBoxSCSI->uTxDir == VBOXSCSI_TXDIR_TO_DEVICE) + { + if (pVBoxSCSI->pBuf) + RTMemFree(pVBoxSCSI->pBuf); + pVBoxSCSI->pBuf = NULL; + pVBoxSCSI->cbBuf = 0; + pVBoxSCSI->cbCDB = 0; + pVBoxSCSI->iCDB = 0; + pVBoxSCSI->iBuf = 0; + pVBoxSCSI->uTargetDevice = 0; + pVBoxSCSI->enmState = VBOXSCSISTATE_NO_COMMAND; + memset(pVBoxSCSI->aCDB, 0, sizeof(pVBoxSCSI->aCDB)); + } + + ASMAtomicXchgBool(&pVBoxSCSI->fBusy, false); + + return VINF_SUCCESS; +} + +int vboxscsiReadString(PPDMDEVINS pDevIns, PVBOXSCSI pVBoxSCSI, uint8_t iRegister, + RTGCPTR *pGCPtrDst, PRTGCUINTREG pcTransfer, unsigned cb) +{ + RTGCPTR GCDst = *pGCPtrDst; + uint32_t cbTransfer = *pcTransfer * cb; + int rc = VINF_SUCCESS; + + LogFlowFunc(("pDevIns=%#p pVBoxSCSI=%#p iRegister=%d cTransfer=%u cb=%u\n", + pDevIns, pVBoxSCSI, iRegister, *pcTransfer, cb)); + + /* Read string only valid for data in register. */ + AssertMsg(iRegister == 1, ("Hey only register 1 can be read from with string\n")); + Assert(pVBoxSCSI->pBuf); + + rc = PGMPhysSimpleDirtyWriteGCPtr(PDMDevHlpGetVMCPU(pDevIns), GCDst, pVBoxSCSI->pBuf, cbTransfer); + AssertRC(rc); + + *pGCPtrDst = (RTGCPTR)((RTGCUINTPTR)GCDst + cbTransfer); + *pcTransfer = 0; + + RTMemFree(pVBoxSCSI->pBuf); + pVBoxSCSI->pBuf = NULL; + pVBoxSCSI->cbBuf = 0; + pVBoxSCSI->cbCDB = 0; + pVBoxSCSI->iCDB = 0; + pVBoxSCSI->iBuf = 0; + pVBoxSCSI->uTargetDevice = 0; + pVBoxSCSI->enmState = VBOXSCSISTATE_NO_COMMAND; + memset(pVBoxSCSI->aCDB, 0, sizeof(pVBoxSCSI->aCDB)); + + return rc; +} + +int vboxscsiWriteString(PPDMDEVINS pDevIns, PVBOXSCSI pVBoxSCSI, uint8_t iRegister, + RTGCPTR *pGCPtrSrc, PRTGCUINTREG pcTransfer, unsigned cb) +{ + RTGCPTR GCSrc = *pGCPtrSrc; + uint32_t cbTransfer = *pcTransfer * cb; + int rc = VINF_SUCCESS; + + /* Read string only valid for data in register. */ + AssertMsg(iRegister == 1, ("Hey only register 1 can be read from with string\n")); + AssertMsg(cbTransfer == 512, ("Only 512 byte transfers are allowed\n")); + + rc = PGMPhysSimpleReadGCPtr(PDMDevHlpGetVMCPU(pDevIns), pVBoxSCSI->pBuf, GCSrc, cbTransfer); + AssertRC(rc); + + *pGCPtrSrc = (RTGCPTR)((RTGCUINTPTR)GCSrc + cbTransfer); + *pcTransfer = 0; + + return VERR_MORE_DATA; +} + + + diff --git a/src/VBox/Devices/Storage/VBoxSCSI.h b/src/VBox/Devices/Storage/VBoxSCSI.h new file mode 100644 index 000000000..4ef3e4fdf --- /dev/null +++ b/src/VBox/Devices/Storage/VBoxSCSI.h @@ -0,0 +1,132 @@ +/* $Id: VBoxSCSI.h $ */ +/** @file + * + * VBox storage devices: + * Simple SCSI interface for BIOS access + */ + +/* + * Copyright (C) 2006-2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +/** + * This is a simple interface to access SCSI devices from the BIOS + * which is shared between the BusLogic and the LsiLogic + * SCSI host adapters to simplify the BIOS part. + * + * The BusLogic interface if available will be starting at port 0x330 + * and the LsiLogic starts at 0x340 and each will have a size of 3 ports. + * The ports are used as described below: + * + * +--------+--------+----------+ + * | Offset | Access | Purpose | + * +--------+--------+----------+ + * | 0 | Write | Command | + * +--------+--------+----------+ + * | 0 | Read | Status | + * +--------+--------+----------+ + * | 1 | Write | Data in | + * +--------+--------+----------+ + * | 1 | Read | Data out | + * +--------+--------+----------+ + * | 2 | R/W | Detect | + * +--------+--------+----------+ + * + * The register at port 0 receives the SCSI CDB issued from the driver when writing to it but + * before writing the actual CDB the first write gives the size of the CDB in bytes. + * + * Reading the port at offset 0 gives status information about the adapter. + * If the busy bit is set the adapter is processing a previous issued request if it is + * cleared the command finished and the adapter can process another request. + * The driver has to poll this bit because the adapter will not assert an IRQ for simplicity reasons. + * + * The register at offset 2 is to detect if a host adapter is available + * If the driver writes a value to this port and gets the same value after reading it + * again the adapter is available. + * + * This part has no R0 or GC components. + */ + +#ifndef ___Storage_VBoxSCSI_h +#define ___Storage_VBoxSCSI_h + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +//#define DEBUG +#include <VBox/pdmdev.h> + +typedef enum VBOXSCSISTATE +{ + VBOXSCSISTATE_NO_COMMAND = 0x00, + VBOXSCSISTATE_READ_TXDIR = 0x01, + VBOXSCSISTATE_READ_CDB_SIZE = 0x02, + VBOXSCSISTATE_READ_BUFFER_SIZE_LOW = 0x03, + VBOXSCSISTATE_READ_BUFFER_SIZE_HIGH = 0x04, + VBOXSCSISTATE_READ_COMMAND = 0x05, + VBOXSCSISTATE_COMMAND_READY = 0x06 +} VBOXSCSISTATE; + +#define VBOXSCSI_TXDIR_FROM_DEVICE 0 +#define VBOXSCSI_TXDIR_TO_DEVICE 1 + +typedef struct VBOXSCSI +{ + /** The identify register. */ + uint8_t regIdentify; + /** The target device. */ + uint8_t uTargetDevice; + /** Transfer direction. */ + uint8_t uTxDir; + /** The size of the CDB we are issuing. */ + uint8_t cbCDB; + /** The command to issue. */ + uint8_t aCDB[12]; + /** Current position in the array. */ + uint8_t iCDB; + +#if HC_ARCH_BITS == 64 + uint32_t Alignment0; +#endif + + /** Pointer to the buffer holding the data. */ + R3PTRTYPE(uint8_t *) pBuf; + /** Size of the buffer in bytes. */ + uint32_t cbBuf; + /** Current position in the buffer. */ + uint32_t iBuf; + /** Flag whether a request is pending. */ + volatile bool fBusy; + /** The state we are in when fetching a command from the BIOS. */ + VBOXSCSISTATE enmState; +} VBOXSCSI, *PVBOXSCSI; + +#define VBOX_SCSI_BUSY RT_BIT(0) + +#ifdef IN_RING3 +RT_C_DECLS_BEGIN +int vboxscsiInitialize(PVBOXSCSI pVBoxSCSI); +int vboxscsiReadRegister(PVBOXSCSI pVBoxSCSI, uint8_t iRegister, uint32_t *pu32Value); +int vboxscsiWriteRegister(PVBOXSCSI pVBoxSCSI, uint8_t iRegister, uint8_t uVal); +int vboxscsiSetupRequest(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest, uint32_t *puTargetDevice); +int vboxscsiRequestFinished(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest); +int vboxscsiWriteString(PPDMDEVINS pDevIns, PVBOXSCSI pVBoxSCSI, uint8_t iRegister, + RTGCPTR *pGCPtrSrc, PRTGCUINTREG pcTransfer, unsigned cb); +int vboxscsiReadString(PPDMDEVINS pDevIns, PVBOXSCSI pVBoxSCSI, uint8_t iRegister, + RTGCPTR *pGCPtrDst, PRTGCUINTREG pcTransfer, unsigned cb); +RT_C_DECLS_END +#endif + +#endif /* ___Storage_VBoxSCSI_h */ diff --git a/src/VBox/Devices/Storage/VDICore.h b/src/VBox/Devices/Storage/VDICore.h index c33c3a8a1..be7c4caa5 100644 --- a/src/VBox/Devices/Storage/VDICore.h +++ b/src/VBox/Devices/Storage/VDICore.h @@ -1,4 +1,4 @@ -/* $Id: VDICore.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VDICore.h $ */ /** @file * Virtual Disk Image (VDI), Core Code Header (internal). */ diff --git a/src/VBox/Devices/Storage/VmdkHDDCore.cpp b/src/VBox/Devices/Storage/VmdkHDDCore.cpp index 1c05293c3..a17ceacf3 100644 --- a/src/VBox/Devices/Storage/VmdkHDDCore.cpp +++ b/src/VBox/Devices/Storage/VmdkHDDCore.cpp @@ -1,4 +1,4 @@ -/* $Id: VmdkHDDCore.cpp 21060 2009-06-30 09:57:42Z vboxsync $ */ +/* $Id: VmdkHDDCore.cpp $ */ /** @file * VMDK Disk image, Core Code. */ diff --git a/src/VBox/Devices/Storage/ide.h b/src/VBox/Devices/Storage/ide.h index b4b234531..ffcacfe43 100644 --- a/src/VBox/Devices/Storage/ide.h +++ b/src/VBox/Devices/Storage/ide.h @@ -1,4 +1,4 @@ -/* $Id: ide.h 12931 2008-10-02 11:46:56Z vboxsync $ */ +/* $Id: ide.h $ */ /** @file * VBox storage devices: ATA/ATAPI declarations */ diff --git a/src/VBox/Devices/Storage/testcase/Makefile.kmk b/src/VBox/Devices/Storage/testcase/Makefile.kmk index 7feb7c953..833de973b 100644 --- a/src/VBox/Devices/Storage/testcase/Makefile.kmk +++ b/src/VBox/Devices/Storage/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20415 2009-06-08 19:56:42Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the storage device & driver testcases. # diff --git a/src/VBox/Devices/VBoxDDUDeps.cpp b/src/VBox/Devices/VBoxDDUDeps.cpp index 41b9e790e..0f60eae8d 100644 --- a/src/VBox/Devices/VBoxDDUDeps.cpp +++ b/src/VBox/Devices/VBoxDDUDeps.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxDDUDeps.cpp 8770 2008-05-12 02:04:54Z vboxsync $ */ +/* $Id: VBoxDDUDeps.cpp $ */ /** @file * VBoxDDU - For dragging in library objects. */ diff --git a/src/VBox/Devices/VMMDev/VBoxDev.cpp b/src/VBox/Devices/VMMDev/VBoxDev.cpp index 4da1b6247..a78b0c5c8 100644 --- a/src/VBox/Devices/VMMDev/VBoxDev.cpp +++ b/src/VBox/Devices/VMMDev/VBoxDev.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxDev.cpp 21062 2009-06-30 10:14:10Z vboxsync $ */ +/* $Id: VBoxDev.cpp $ */ /** @file * VMMDev - Guest <-> VMM/Host communication device. */ diff --git a/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp b/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp index 91e545955..db12035fb 100644 --- a/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp +++ b/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMDevHGCM.cpp 21062 2009-06-30 10:14:10Z vboxsync $ */ +/* $Id: VMMDevHGCM.cpp $ */ /** @file * VMMDev - HGCM - Host-Guest Communication Manager Device. */ diff --git a/src/VBox/Devices/VMMDev/VMMDevState.h b/src/VBox/Devices/VMMDev/VMMDevState.h index 9420a1c8f..21847a232 100644 --- a/src/VBox/Devices/VMMDev/VMMDevState.h +++ b/src/VBox/Devices/VMMDev/VMMDevState.h @@ -1,4 +1,4 @@ -/* $Id: VMMDevState.h 21062 2009-06-30 10:14:10Z vboxsync $ */ +/* $Id: VMMDevState.h $ */ /** @file * VMMDev - Guest <-> VMM/Host communication device, internal header. */ diff --git a/src/VBox/Devices/testcase/Makefile.kmk b/src/VBox/Devices/testcase/Makefile.kmk index 127826250..b75545bb3 100644 --- a/src/VBox/Devices/testcase/Makefile.kmk +++ b/src/VBox/Devices/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 16170 2009-01-22 14:40:08Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Devices testcases. # diff --git a/src/VBox/Devices/testcase/tstDeviceStructSize.cpp b/src/VBox/Devices/testcase/tstDeviceStructSize.cpp index e26f361d7..f51a8d153 100644 --- a/src/VBox/Devices/testcase/tstDeviceStructSize.cpp +++ b/src/VBox/Devices/testcase/tstDeviceStructSize.cpp @@ -1,4 +1,4 @@ -/* $Id: tstDeviceStructSize.cpp 16170 2009-01-22 14:40:08Z vboxsync $ */ +/* $Id: tstDeviceStructSize.cpp $ */ /** @file * tstDeviceStructSize - testcase for check structure sizes/alignment * and to verify that HC and GC uses the same diff --git a/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp b/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp index 62f8d9a64..50288d9da 100644 --- a/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp +++ b/src/VBox/Devices/testcase/tstDeviceStructSizeGC.cpp @@ -1,4 +1,4 @@ -/* $Id: tstDeviceStructSizeGC.cpp 20735 2009-06-20 19:55:07Z vboxsync $ */ +/* $Id: tstDeviceStructSizeGC.cpp $ */ /** @file * tstDeviceStructSizeGC - Generate structure member and size checks from the GC perspective. * diff --git a/src/VBox/Devices/vl_vbox.h b/src/VBox/Devices/vl_vbox.h index d6af43d24..e72ae092f 100644 --- a/src/VBox/Devices/vl_vbox.h +++ b/src/VBox/Devices/vl_vbox.h @@ -1,4 +1,4 @@ -/* $Id: vl_vbox.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: vl_vbox.h $ */ /** @file * VBox vl.h Replacement. * diff --git a/src/VBox/Disassembler/DisasmFormatBytes.cpp b/src/VBox/Disassembler/DisasmFormatBytes.cpp index baba86235..99ae27c61 100644 --- a/src/VBox/Disassembler/DisasmFormatBytes.cpp +++ b/src/VBox/Disassembler/DisasmFormatBytes.cpp @@ -1,4 +1,4 @@ -/* $Id: DisasmFormatBytes.cpp 18449 2009-03-28 03:35:50Z vboxsync $ */ +/* $Id: DisasmFormatBytes.cpp $ */ /** @file * VBox Disassembler - Helper for formatting the opcode bytes. */ diff --git a/src/VBox/Disassembler/DisasmFormatYasm.cpp b/src/VBox/Disassembler/DisasmFormatYasm.cpp index 6f6d8810c..1cdf0fe63 100644 --- a/src/VBox/Disassembler/DisasmFormatYasm.cpp +++ b/src/VBox/Disassembler/DisasmFormatYasm.cpp @@ -1,4 +1,4 @@ -/* $Id: DisasmFormatYasm.cpp 11493 2008-08-19 15:59:34Z vboxsync $ */ +/* $Id: DisasmFormatYasm.cpp $ */ /** @file * VBox Disassembler - Yasm(/Nasm) Style Formatter. */ diff --git a/src/VBox/Disassembler/Makefile.kmk b/src/VBox/Disassembler/Makefile.kmk index fefef5c24..d98dd2500 100644 --- a/src/VBox/Disassembler/Makefile.kmk +++ b/src/VBox/Disassembler/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18422 2009-03-28 00:04:43Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VBox Disassembler. # diff --git a/src/VBox/Disassembler/testcase/Makefile.kmk b/src/VBox/Disassembler/testcase/Makefile.kmk index fc52a5b2e..aa4e22699 100644 --- a/src/VBox/Disassembler/testcase/Makefile.kmk +++ b/src/VBox/Disassembler/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 15302 2008-12-11 12:32:27Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VBox Disassembler. # diff --git a/src/VBox/Disassembler/testcase/tstAsm.mac b/src/VBox/Disassembler/testcase/tstAsm.mac index faf860e93..a2e95722e 100644 --- a/src/VBox/Disassembler/testcase/tstAsm.mac +++ b/src/VBox/Disassembler/testcase/tstAsm.mac @@ -1,4 +1,4 @@ -; $Id: tstAsm.mac 8966 2008-05-20 16:48:02Z vboxsync $ +; $Id: tstAsm.mac $ ;; @file ; Disassembly testcase - Common header for the xREG macros. ; diff --git a/src/VBox/Disassembler/testcase/tstAsmLock-1.asm b/src/VBox/Disassembler/testcase/tstAsmLock-1.asm index eaab68045..274f2daef 100644 --- a/src/VBox/Disassembler/testcase/tstAsmLock-1.asm +++ b/src/VBox/Disassembler/testcase/tstAsmLock-1.asm @@ -1,4 +1,4 @@ -; $Id: tstAsmLock-1.asm 8979 2008-05-20 19:48:26Z vboxsync $ +; $Id: tstAsmLock-1.asm $ ;; @file ; Disassembly testcase - Valid lock sequences and related instructions. ; diff --git a/src/VBox/Disassembler/testcase/tstAsmLock-2.asm b/src/VBox/Disassembler/testcase/tstAsmLock-2.asm index 086c642f0..0ad9db8ba 100644 --- a/src/VBox/Disassembler/testcase/tstAsmLock-2.asm +++ b/src/VBox/Disassembler/testcase/tstAsmLock-2.asm @@ -1,4 +1,4 @@ -; $Id: tstAsmLock-2.asm 8980 2008-05-20 19:50:06Z vboxsync $ +; $Id: tstAsmLock-2.asm $ ;; @file ; Disassembly testcase - Invalid invariants. ; diff --git a/src/VBox/Disassembler/testcase/tstAsmLock-3.asm b/src/VBox/Disassembler/testcase/tstAsmLock-3.asm index c50cbadfe..f9bceda8d 100644 --- a/src/VBox/Disassembler/testcase/tstAsmLock-3.asm +++ b/src/VBox/Disassembler/testcase/tstAsmLock-3.asm @@ -1,4 +1,4 @@ -; $Id: tstAsmLock-3.asm 8966 2008-05-20 16:48:02Z vboxsync $ +; $Id: tstAsmLock-3.asm $ ;; @file ; Disassembly testcase - Invalid lock sequences for non-locking instructions. ; diff --git a/src/VBox/Disassembler/testcase/tstAsmRegs-1.asm b/src/VBox/Disassembler/testcase/tstAsmRegs-1.asm index 47c9c4e1c..a3e2b9e19 100644 --- a/src/VBox/Disassembler/testcase/tstAsmRegs-1.asm +++ b/src/VBox/Disassembler/testcase/tstAsmRegs-1.asm @@ -1,4 +1,4 @@ -; $Id: tstAsmRegs-1.asm 9925 2008-06-25 14:42:31Z vboxsync $ +; $Id: tstAsmRegs-1.asm $ ;; @file ; Disassembly testcase - Accessing all the registers ; diff --git a/src/VBox/Disassembler/testcase/tstDisasm-2.cpp b/src/VBox/Disassembler/testcase/tstDisasm-2.cpp index 66d4b9db1..96d2e76b1 100644 --- a/src/VBox/Disassembler/testcase/tstDisasm-2.cpp +++ b/src/VBox/Disassembler/testcase/tstDisasm-2.cpp @@ -1,4 +1,4 @@ -/* $Id: tstDisasm-2.cpp 19350 2009-05-05 02:44:04Z vboxsync $ */ +/* $Id: tstDisasm-2.cpp $ */ /** @file * Testcase - Generic Disassembler Tool. */ diff --git a/src/VBox/Frontends/Makefile.kmk b/src/VBox/Frontends/Makefile.kmk index cb4bd4330..b8f134238 100644 --- a/src/VBox/Frontends/Makefile.kmk +++ b/src/VBox/Frontends/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19963 2009-05-24 03:18:51Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for the VBox frontends. # diff --git a/src/VBox/Frontends/VBoxBFE/Makefile.kmk b/src/VBox/Frontends/VBoxBFE/Makefile.kmk index 11ffe588f..84dff486c 100644 --- a/src/VBox/Frontends/VBoxBFE/Makefile.kmk +++ b/src/VBox/Frontends/VBoxBFE/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18866 2009-04-10 14:13:10Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for VBoxBFE (a basic frontend which doesn't make use of Main). # diff --git a/src/VBox/Frontends/VBoxBFE/USBProxyServiceLinux.cpp b/src/VBox/Frontends/VBoxBFE/USBProxyServiceLinux.cpp index 9ef1c1de9..2a7c3fab6 100644 --- a/src/VBox/Frontends/VBoxBFE/USBProxyServiceLinux.cpp +++ b/src/VBox/Frontends/VBoxBFE/USBProxyServiceLinux.cpp @@ -1,4 +1,4 @@ -/* $Id: USBProxyServiceLinux.cpp 18866 2009-04-10 14:13:10Z vboxsync $ */ +/* $Id: USBProxyServiceLinux.cpp $ */ /** @file * VBox frontends: Basic Frontend (BFE): * Implementation of USBProxyServiceLinux class diff --git a/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp b/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp index 203339105..56fe86600 100644 --- a/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp +++ b/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxBFE.cpp 20501 2009-06-12 11:31:37Z vboxsync $ */ +/* $Id: VBoxBFE.cpp $ */ /** @file * Basic Frontend (BFE): VBoxBFE main routines. * diff --git a/src/VBox/Frontends/VBoxBFE/VBoxBFEHardened.cpp b/src/VBox/Frontends/VBoxBFE/VBoxBFEHardened.cpp index 59deb3bbe..10d8f87ff 100644 --- a/src/VBox/Frontends/VBoxBFE/VBoxBFEHardened.cpp +++ b/src/VBox/Frontends/VBoxBFE/VBoxBFEHardened.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxBFEHardened.cpp 11725 2008-08-27 22:21:47Z vboxsync $ */ +/* $Id: VBoxBFEHardened.cpp $ */ /** @file * VBoxSDL - Hardened main(). */ diff --git a/src/VBox/Frontends/VBoxFB/Makefile.kmk b/src/VBox/Frontends/VBoxFB/Makefile.kmk index 3519a99b9..caa94c9f4 100644 --- a/src/VBox/Frontends/VBoxFB/Makefile.kmk +++ b/src/VBox/Frontends/VBoxFB/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 12258 2008-09-09 03:01:02Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for VBoxFB. # diff --git a/src/VBox/Frontends/VBoxHeadless/Makefile.kmk b/src/VBox/Frontends/VBoxHeadless/Makefile.kmk index 225d643b2..43848e244 100644 --- a/src/VBox/Frontends/VBoxHeadless/Makefile.kmk +++ b/src/VBox/Frontends/VBoxHeadless/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 12258 2008-09-09 03:01:02Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the headless frontend. # diff --git a/src/VBox/Frontends/VBoxHeadless/VBoxHeadlessHardened.cpp b/src/VBox/Frontends/VBoxHeadless/VBoxHeadlessHardened.cpp index e0fbec133..ece3cc2bc 100644 --- a/src/VBox/Frontends/VBoxHeadless/VBoxHeadlessHardened.cpp +++ b/src/VBox/Frontends/VBoxHeadless/VBoxHeadlessHardened.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxHeadlessHardened.cpp 11725 2008-08-27 22:21:47Z vboxsync $ */ +/* $Id: VBoxHeadlessHardened.cpp $ */ /** @file * VBoxHeadless - Hardened main(). */ diff --git a/src/VBox/Frontends/VBoxHeadless/VideoCapture/Makefile.kmk b/src/VBox/Frontends/VBoxHeadless/VideoCapture/Makefile.kmk index e1332f754..450d44513 100644 --- a/src/VBox/Frontends/VBoxHeadless/VideoCapture/Makefile.kmk +++ b/src/VBox/Frontends/VBoxHeadless/VideoCapture/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 12258 2008-09-09 03:01:02Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the ffmpeg frame buffer module. # diff --git a/src/VBox/Frontends/VBoxHeadless/testcase/Makefile.kmk b/src/VBox/Frontends/VBoxHeadless/testcase/Makefile.kmk index 74ee39fb8..232278309 100644 --- a/src/VBox/Frontends/VBoxHeadless/testcase/Makefile.kmk +++ b/src/VBox/Frontends/VBoxHeadless/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20928 2009-06-25 11:53:37Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VRDP (headless RDP server) frontend testcase. # diff --git a/src/VBox/Frontends/VBoxManage/Makefile.kmk b/src/VBox/Frontends/VBoxManage/Makefile.kmk index d563dbed0..bfc110206 100644 --- a/src/VBox/Frontends/VBoxManage/Makefile.kmk +++ b/src/VBox/Frontends/VBoxManage/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20521 2009-06-12 15:28:26Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for VBoxManage (the cli frontend). # diff --git a/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp b/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp index 8607bc8ee..3cf0c998a 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxInternalManage.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxInternalManage.cpp $ */ /** @file * VBoxManage - The 'internalcommands' command. * diff --git a/src/VBox/Frontends/VBoxManage/VBoxManage.cpp b/src/VBox/Frontends/VBoxManage/VBoxManage.cpp index d8918c5ce..a356b2038 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManage.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManage.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManage.cpp 20977 2009-06-26 14:38:55Z vboxsync $ */ +/* $Id: VBoxManage.cpp $ */ /** @file * VBoxManage - VirtualBox's command-line interface. */ @@ -1412,15 +1412,6 @@ static int handleSetProperty(HandlerArg *a) else CHECK_ERROR(systemProperties, COMSETTER(WebServiceAuthLibrary)(Bstr(a->argv[1]))); } - else if (!strcmp(a->argv[0], "hwvirtexenabled")) - { - if (!strcmp(a->argv[1], "yes")) - CHECK_ERROR(systemProperties, COMSETTER(HWVirtExEnabled)(TRUE)); - else if (!strcmp(a->argv[1], "no")) - CHECK_ERROR(systemProperties, COMSETTER(HWVirtExEnabled)(FALSE)); - else - return errorArgument("Invalid value '%s' for hardware virtualization extension flag", a->argv[1]); - } else if (!strcmp(a->argv[0], "loghistorycount")) { uint32_t uVal; diff --git a/src/VBox/Frontends/VBoxManage/VBoxManage.h b/src/VBox/Frontends/VBoxManage/VBoxManage.h index 24840d905..5b9ab9231 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManage.h +++ b/src/VBox/Frontends/VBoxManage/VBoxManage.h @@ -1,4 +1,4 @@ -/* $Id: VBoxManage.h 18703 2009-04-03 16:19:40Z vboxsync $ */ +/* $Id: VBoxManage.h $ */ /** @file * VBoxManage - VirtualBox command-line interface, internal header file. */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp index b371949aa..b4a13693f 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageDHCPServer.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageDHCPServer.cpp $ */ /** @file * VBoxManage - Implementation of dhcpserver command. */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp index 3f6b8a3d4..09c56e9a8 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageDisk.cpp 21038 2009-06-29 15:57:12Z vboxsync $ */ +/* $Id: VBoxManageDisk.cpp $ */ /** @file * VBoxManage - The disk delated commands. */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp index dd5851502..714cfdbfe 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageGuestProp.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageGuestProp.cpp $ */ /** @file * VBoxManage - The 'guestproperty' command. */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp index e6e0426f0..b6bbc44a7 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageHelp.cpp 21032 2009-06-29 15:27:38Z vboxsync $ */ +/* $Id: VBoxManageHelp.cpp $ */ /** @file * VBoxManage - help and other message output. */ @@ -130,7 +130,7 @@ void printUsage(USAGECATEGORY u64Cmd) " [--acpi on|off]\n" " [--ioapic on|off]\n" " [--pae on|off]\n" - " [--hwvirtex on|off|default]\n" + " [--hwvirtex on|off]\n" " [--nestedpaging on|off]\n" " [--vtxvpid on|off]\n" " [--cpus <number>]\n" @@ -430,7 +430,6 @@ void printUsage(USAGECATEGORY u64Cmd) " machinefolder default|<folder> |\n" " vrdpauthlibrary default|<library> |\n" " websrvauthlibrary default|null|<library> |\n" - " hwvirtexenabled yes|no\n" " loghistorycount <value>\n" "\n"); } diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp index 6bfa1f3c6..3eeb86b1d 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageHostonly.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageHostonly.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageHostonly.cpp $ */ /** @file * VBoxManage - Implementation of hostonlyif command. */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp index 11298200c..e9e85ba25 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageImport.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageImport.cpp $ */ /** @file * VBoxManage - The appliance-related commands. */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp index 14fc1ff2d..cbd23a499 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageInfo.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageInfo.cpp $ */ /** @file * VBoxManage - The 'showvminfo' command and helper routines. */ @@ -342,26 +342,12 @@ HRESULT showVMInfo (ComPtr<IVirtualBox> virtualBox, else RTPrintf("Time offset: %lld ms\n", timeOffset); - TSBool_T hwVirtExEnabled; + BOOL hwVirtExEnabled; machine->COMGETTER(HWVirtExEnabled)(&hwVirtExEnabled); - if (hwVirtExEnabled == TSBool_Default) - { - BOOL fHWVirtExEnabled; - ComPtr<ISystemProperties> systemProperties; - virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); - systemProperties->COMGETTER(HWVirtExEnabled)(&fHWVirtExEnabled); - if (details == VMINFO_MACHINEREADABLE) - RTPrintf("hwvirtex=\"default\"\n"); - else - RTPrintf("Hardw. virt.ext: Default (%s)\n", fHWVirtExEnabled ? "on" : "off"); - } + if (details == VMINFO_MACHINEREADABLE) + RTPrintf("hwvirtex=\"%s\"\n", hwVirtExEnabled ? "on" : "off"); else - { - if (details == VMINFO_MACHINEREADABLE) - RTPrintf("hwvirtex=\"%s\"\n", hwVirtExEnabled == TSBool_True ? "on" : "off"); - else - RTPrintf("Hardw. virt.ext: %s\n", hwVirtExEnabled == TSBool_True ? "on" : "off"); - } + RTPrintf("Hardw. virt.ext: %s\n", hwVirtExEnabled ? "on" : "off"); BOOL HWVirtExNestedPagingEnabled; machine->COMGETTER(HWVirtExNestedPagingEnabled)(&HWVirtExNestedPagingEnabled); if (details == VMINFO_MACHINEREADABLE) diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp index 5227d3975..7da01078f 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageList.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageList.cpp $ */ /** @file * VBoxManage - The 'list' command. */ @@ -762,8 +762,6 @@ int handleList(HandlerArg *a) RTPrintf("VRDP authentication library: %lS\n", str.raw()); systemProperties->COMGETTER(WebServiceAuthLibrary)(str.asOutParam()); RTPrintf("Webservice auth. library: %lS\n", str.raw()); - systemProperties->COMGETTER(HWVirtExEnabled)(&flag); - RTPrintf("Hardware virt. extensions: %s\n", flag ? "yes" : "no"); systemProperties->COMGETTER(LogHistoryCount)(&ulValue); RTPrintf("Log history count: %u\n", ulValue); diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageMetrics.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageMetrics.cpp index b19206b59..c08e9e44c 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageMetrics.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageMetrics.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageMetrics.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageMetrics.cpp $ */ /** @file * VBoxManage - The 'metrics' command. */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp index 0c29a6226..232b7dd87 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageModifyVM.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageModifyVM.cpp $ */ /** @file * VBoxManage - Implementation of modifyvm command. */ @@ -937,15 +937,11 @@ int handleModifyVM(HandlerArg *a) { if (!strcmp(hwvirtex, "on")) { - CHECK_ERROR(machine, COMSETTER(HWVirtExEnabled)(TSBool_True)); + CHECK_ERROR(machine, COMSETTER(HWVirtExEnabled)(TRUE)); } else if (!strcmp(hwvirtex, "off")) { - CHECK_ERROR(machine, COMSETTER(HWVirtExEnabled)(TSBool_False)); - } - else if (!strcmp(hwvirtex, "default")) - { - CHECK_ERROR(machine, COMSETTER(HWVirtExEnabled)(TSBool_Default)); + CHECK_ERROR(machine, COMSETTER(HWVirtExEnabled)(FALSE)); } else { diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageSVN.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageSVN.cpp index 4b79fd499..811b46581 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageSVN.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageSVN.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageSVN.cpp 14732 2008-11-27 18:44:11Z vboxsync $ */ +/* $Id: VBoxManageSVN.cpp $ */ /** @file * VBoxManage - VBoxSVNRev(), separate file to speed up the build. */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp index be6b8a132..e7122f046 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageSnapshot.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageSnapshot.cpp $ */ /** @file * VBoxManage - The 'snapshot' command. */ diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp index 720c081c9..c6a238929 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxManageUSB.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: VBoxManageUSB.cpp $ */ /** @file * VBoxManage - VirtualBox's command-line interface. */ diff --git a/src/VBox/Frontends/VBoxSDL/Makefile.kmk b/src/VBox/Frontends/VBoxSDL/Makefile.kmk index 6171766f9..937d52a6d 100644 --- a/src/VBox/Frontends/VBoxSDL/Makefile.kmk +++ b/src/VBox/Frontends/VBoxSDL/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20433 2009-06-09 12:40:36Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for VBoxSDL (a simple frontend based on SDL). # diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp b/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp index daa92c1ff..7f165fee2 100644 --- a/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp +++ b/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp @@ -1072,7 +1072,7 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) unsigned fRawR3 = ~0U; unsigned fPATM = ~0U; unsigned fCSAM = ~0U; - TSBool_T fHWVirt = TSBool_Default; + unsigned fHWVirt = ~0U; uint32_t u32WarpDrive = 0; #endif #ifdef VBOX_WIN32_UI @@ -1586,10 +1586,10 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) fCSAM = false; else if ( !strcmp(argv[curArg], "--hwvirtex") || !strcmp(argv[curArg], "-hwvirtex")) - fHWVirt = TSBool_True; + fHWVirt = true; else if ( !strcmp(argv[curArg], "--nohwvirtex") || !strcmp(argv[curArg], "-nohwvirtex")) - fHWVirt = TSBool_False; + fHWVirt = false; else if ( !strcmp(argv[curArg], "--warpdrive") || !strcmp(argv[curArg], "-warpdrive")) { @@ -2148,7 +2148,7 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) } gMachineDebugger->COMSETTER(CSAMEnabled)(fCSAM); } - if (fHWVirt != TSBool_Default) + if (fHWVirt != ~0U) { gMachine->COMSETTER(HWVirtExEnabled)(fHWVirt); } diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDLHardened.cpp b/src/VBox/Frontends/VBoxSDL/VBoxSDLHardened.cpp index a4e206b34..ac6fa3a47 100644 --- a/src/VBox/Frontends/VBoxSDL/VBoxSDLHardened.cpp +++ b/src/VBox/Frontends/VBoxSDL/VBoxSDLHardened.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxSDLHardened.cpp 11725 2008-08-27 22:21:47Z vboxsync $ */ +/* $Id: VBoxSDLHardened.cpp $ */ /** @file * VBoxSDL - Hardened main(). */ diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDLMain-darwin.m b/src/VBox/Frontends/VBoxSDL/VBoxSDLMain-darwin.m index 62206c348..62206c348 100755..100644 --- a/src/VBox/Frontends/VBoxSDL/VBoxSDLMain-darwin.m +++ b/src/VBox/Frontends/VBoxSDL/VBoxSDLMain-darwin.m diff --git a/src/VBox/Frontends/VBoxShell/Makefile.kmk b/src/VBox/Frontends/VBoxShell/Makefile.kmk index 40fce0679..3c75b7424 100644 --- a/src/VBox/Frontends/VBoxShell/Makefile.kmk +++ b/src/VBox/Frontends/VBoxShell/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20332 2009-06-05 13:32:27Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the shell frontend. # diff --git a/src/VBox/Frontends/VBoxShell/vboxshell.py b/src/VBox/Frontends/VBoxShell/vboxshell.py index 3b51e98a4..3b51e98a4 100644..100755 --- a/src/VBox/Frontends/VBoxShell/vboxshell.py +++ b/src/VBox/Frontends/VBoxShell/vboxshell.py diff --git a/src/VBox/Frontends/VirtualBox/Makefile.kmk b/src/VBox/Frontends/VirtualBox/Makefile.kmk index 917b4d3fe..4ab60e23d 100644 --- a/src/VBox/Frontends/VirtualBox/Makefile.kmk +++ b/src/VBox/Frontends/VirtualBox/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20501 2009-06-12 11:31:37Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Makefile for the VirtualBox Qt GUI. # diff --git a/src/VBox/Frontends/VirtualBox/include/VBoxAquaStyle.h b/src/VBox/Frontends/VirtualBox/include/VBoxAquaStyle.h index 51e366c61..6d86754eb 100644 --- a/src/VBox/Frontends/VirtualBox/include/VBoxAquaStyle.h +++ b/src/VBox/Frontends/VirtualBox/include/VBoxAquaStyle.h @@ -1,4 +1,4 @@ -/** $Id: $ */ +/** $Id: $ */ /** @file * Qt GUI - VBox Variation on the QAquaStyle. */ diff --git a/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h b/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h index c57dfed80..5405b5ab1 100644 --- a/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h +++ b/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h @@ -265,6 +265,11 @@ public: bool isValid() { return mValid; } + static QString qtRTVersionString(); + static uint qtRTVersion(); + static QString qtCTVersionString(); + static uint qtCTVersion(); + QString versionString() { return mVerString; } CVirtualBox virtualBox() const { return mVBox; } diff --git a/src/VBox/Frontends/VirtualBox/include/VBoxIChatTheaterWrapper.h b/src/VBox/Frontends/VirtualBox/include/VBoxIChatTheaterWrapper.h index 73ad3ed42..c6ebdb50f 100644 --- a/src/VBox/Frontends/VirtualBox/include/VBoxIChatTheaterWrapper.h +++ b/src/VBox/Frontends/VirtualBox/include/VBoxIChatTheaterWrapper.h @@ -1,4 +1,4 @@ -/* $Id: VBoxIChatTheaterWrapper.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxIChatTheaterWrapper.h $ */ /** @file * Qt GUI - iChat Theater cocoa wrapper. */ diff --git a/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk b/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk index 1ea8267b5..9f328d67a 100644 --- a/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk +++ b/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk @@ -1,4 +1,4 @@ -# $Id: ApprovedLanguages.kmk 20761 2009-06-22 10:25:53Z vboxsync $ +# $Id: ApprovedLanguages.kmk $ ## @file # ApprovedLanguages.kmk - List of approved GUI translations # diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_cs.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_cs.ts index bac6fb8e3..866a2068f 100644 --- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_cs.ts +++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_cs.ts @@ -137,11 +137,11 @@ </message> <message> <source>The VirtualBox kernel modules do not fit to this version of VirtualBox. The installation of VirtualBox was apparently not successful. It may help to completely uninstall and re-install VirtualBox.</source> - <translation type="unfinished"></translation> + <translation>Modul jádra pro VirtualBox není shodný s verzí aplikace VirtualBox. Pravděpodobně nebyla úspěšně dokončena instalace VirtualBoxu. Většinou pomůže kompletně vše odinstalovat a nainstalovat znovu.</translation> </message> <message> <source>The VirtualBox kernel modules do not fit to this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing<br/><br/> <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>should fix that problem. Make sure that you don't mix the OSE version and the PUEL version of VirtualBox.</source> - <translation type="unfinished"></translation> + <translation>Modul jádra pro VirtualBox není shodný s verzí aplikace VirtualBox. Pravděpodobně nebyla úspěšně dokončena instalace VirtualBoxu. Spuštěním příkazu<br/><br/> <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>můžete problém vyřešit. Ujistěte se, že nepoužíváte současně OSE a PUEL verzi aplikace Virtualbox.</translation> </message> </context> <context> @@ -159,11 +159,11 @@ <name>QIFileDialog</name> <message> <source>Select a directory</source> - <translation type="unfinished">Vyberte složku</translation> + <translation>Vyberte složku</translation> </message> <message> <source>Select a file</source> - <translation type="unfinished">Vyberte soubor</translation> + <translation>Vyberte soubor</translation> </message> </context> <context> @@ -1311,12 +1311,12 @@ Verze %1</translation> <message> <source>Indicates the status of the hardware virtualization features used by this virtual machine:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></source> <comment>Virtualization Stuff LED</comment> - <translation type="unfinished"></translation> + <translation>Indikuje stav virtualizačních rozšíření použitých tímto virtuálním počítačem:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></translation> </message> <message> <source><br><nobr><b>%1:</b>&nbsp;%2</nobr></source> <comment>Virtualization Stuff LED</comment> - <translation type="unfinished"></translation> + <translation><br><nobr><b>%1:</b>&nbsp;%2</nobr></translation> </message> </context> <context> @@ -1699,59 +1699,59 @@ p, li { white-space: pre-wrap; } </message> <message> <source>Please choose a filename to export the OVF in.</source> - <translation type="unfinished"></translation> + <translation>Zadejte prosím název soubor pro export OVF.</translation> </message> <message> <source>Please complete the additionally fields like the username, password and the bucket. Finally you have to provide a filename for the OVF target.</source> - <translation type="unfinished"></translation> + <translation>Vyplňte prosím následující položky jako je jméno uživatele, jeho heslo a sektor. Nakonec zadejte cíl, kam se bude OVF exportovat.</translation> </message> <message> <source>Please complete the additionally fields like the username, password, hostname and the bucket. Finally you have to provide a filename for the OVF target.</source> - <translation type="unfinished"></translation> + <translation>Vyplňte prosím následující položky jako je jméno uživatele, jeho heslo, název počítače a sektor. Nakonec zadejte cíl, kam se bude OVF exportovat.</translation> </message> <message> <source>Checking files ...</source> - <translation type="unfinished"></translation> + <translation>Kontrola souborů...</translation> </message> <message> <source>Removing files ...</source> - <translation type="unfinished"></translation> + <translation>Odstraňování souborů...</translation> </message> <message> <source>Please specify the target for the OVF export. You can choose between a local file system export, the uploading of the OVF to the Sun Cloud service or an S3 storage server.</source> - <translation type="unfinished"></translation> + <translation>Prosím zadejte cíl pro export OVF. Můžete si vybrat mezi lokálním souborovým systémem, nahráním OVF na Sun Cloud nebo použítím S3 služby pro ukládání.</translation> </message> <message> <source>&Local Filesystem </source> - <translation type="unfinished"></translation> + <translation>&Lokální souborový systém</translation> </message> <message> <source>Sun &Cloud</source> - <translation type="unfinished"></translation> + <translation>Sun &Cloud</translation> </message> <message> <source>&Simple Storage System (S3)</source> - <translation type="unfinished"></translation> + <translation>&Simple Storage System (S3)</translation> </message> <message> <source>&Username:</source> - <translation type="unfinished"></translation> + <translation>&Jméno uživatele:</translation> </message> <message> <source>&Password:</source> - <translation type="unfinished"></translation> + <translation>&Heslo:</translation> </message> <message> <source>&File:</source> - <translation type="unfinished"></translation> + <translation>&Soubor:</translation> </message> <message> <source>&Bucket:</source> - <translation type="unfinished"></translation> + <translation>Se&ktor:</translation> </message> <message> <source>&Hostname:</source> - <translation type="unfinished"></translation> + <translation>&Název počítače:</translation> </message> </context> <context> @@ -3164,47 +3164,47 @@ p, li { white-space: pre-wrap; } <message> <source><nobr>%1 MB</nobr></source> <comment>details report</comment> - <translation type="unfinished"></translation> + <translation><nobr>%1 MB</nobr></translation> </message> <message> <source>Processor(s)</source> <comment>details report</comment> - <translation type="unfinished"></translation> + <translation>Procesor(y)</translation> </message> <message> <source><nobr>%1</nobr></source> <comment>details report</comment> - <translation type="unfinished"></translation> + <translation><nobr>%1</nobr></translation> </message> <message> <source>System</source> <comment>details report</comment> - <translation type="unfinished"></translation> + <translation>Systém</translation> </message> <message> <source>Remote Display Server Port</source> <comment>details report (VRDP Server)</comment> - <translation type="unfinished"></translation> + <translation>Port vzdáleného serveru</translation> </message> <message> <source>Remote Display Server</source> <comment>details report (VRDP Server)</comment> - <translation type="unfinished"></translation> + <translation>Vzdálený server</translation> </message> <message> <source>Disabled</source> <comment>details report (VRDP Server)</comment> - <translation type="unfinished"></translation> + <translation>Zakázán</translation> </message> <message> <source>Display</source> <comment>details report</comment> - <translation type="unfinished"></translation> + <translation>Plocha</translation> </message> <message> <source>Raw File</source> <comment>PortMode</comment> - <translation type="unfinished"></translation> + <translation>Přímý soubor</translation> </message> </context> <context> @@ -3810,15 +3810,15 @@ p, li { white-space: pre-wrap; } <name>VBoxMiniToolBar</name> <message> <source>Always show the toolbar</source> - <translation type="unfinished"></translation> + <translation>Vždy zobrazovat nástrojovou lištu</translation> </message> <message> <source>Exit Full Screen or Seamless Mode</source> - <translation type="unfinished"></translation> + <translation>Opustit celoobrazovkový nebo bezešvý režim</translation> </message> <message> <source>Close VM</source> - <translation type="unfinished">Zavřít virtuální počítač</translation> + <translation>Zavřít virtuální počítač</translation> </message> </context> <context> @@ -4315,7 +4315,7 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g </message> <message> <source>&Version:</source> - <translation type="unfinished"></translation> + <translation>V&erze:</translation> </message> </context> <context> @@ -5243,27 +5243,27 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g </message> <message> <source>A file named <b>%1</b> already exists. Are you sure you want to replace it?<br /><br />Replacing it will overwrite its contents.</source> - <translation type="unfinished"></translation> + <translation>Následující soubor již existuje:<b>%1<b>. Opravdu jej chcete nahradit?<br /><br /> Nahrazením souboru přepíšete jeho obsah.</translation> </message> <message> <source><p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Certain guests (e.g. OS/2 and QNX) require this feature.</p><p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p></source> - <translation type="unfinished"></translation> + <translation><p>Hardwarová akcelerace VT-x/AMD-V byla povolena, ale nefunguje. Některé virtuální počítače (např. OS/2 a QNX) tuto volbu vyžadují.</p><p>Prosím ujistěte se, že jste správně povolili VT-x/AMD-V v BIOSu na vašem hostitelském počítači.</p></translation> </message> <message> <source><p>Invalid e-mail address or password specified.</p></source> - <translation type="unfinished"></translation> + <translation><p>Zadána neplatná e-mailová adresa nebo heslo.</p></translation> </message> <message> <source><p>Failed to register the VirtualBox product.</p><p>%1</p></source> - <translation type="unfinished"></translation> + <translation><p>Nepodařilo se zaregistrovat produkt VirtualBox.</p><p>%1</p></translation> </message> <message> <source>Failed to check files.</source> - <translation type="unfinished"></translation> + <translation>Selhala kontrola souborů.</translation> </message> <message> <source>Failed to remove file.</source> - <translation type="unfinished"></translation> + <translation>Selhalo odstranění souboru.</translation> </message> </context> <context> @@ -5274,7 +5274,7 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g </message> <message> <source>Time remaining: %1</source> - <translation type="unfinished"></translation> + <translation>Zbývající čas: %1</translation> </message> </context> <context> @@ -5345,59 +5345,59 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g </message> <message> <source>Select Country/Territory</source> - <translation type="unfinished"></translation> + <translation>Vyberte zemi/teritorium</translation> </message> <message> <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use the Latin characters to fill the fields below. Please note that Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we use your personal data can be found in the <b>Privacy Policy</b> section of the VirtualBox Manual or on the <a href=http://www.virtualbox.org/wiki/PrivacyPolicy>Privacy Policy</a> page of the VirtualBox web-site.</p></source> - <translation type="unfinished"></translation> + <translation><p>Prosíme vyplňte registrační formulář a dejte nám vědět že používáte VirtualBox a, volitelně, budete informováni o novinkách a aktualizacích VirtualBoxu.</p><p>Vložte vaše celé jméno pomocí latinské abecedy a váš e-mail do políčka níže. Vězte že Sun Microsystems použije tyto informace pouze získávání statistik o používání produktu a pro odesílání novinek o Virtualboxu. Sun Microsystems nikdy nepředá vaše data třetím stranám. Detailní informace o tom, jak používáme vaše osobní data můlžete nalézt v sekci <b>Privacy Policy</b> manuálu VirtualBoxu, nebo na webové stránce <a href=http://www.virtualbox.org/wiki/PrivacyPolicy>Privacy Policy</a> VirtualBoxu.</p></translation> </message> <message> <source>I &have a Sun Online account already:</source> - <translation type="unfinished"></translation> + <translation>Již &mám účet na Sun Online:</translation> </message> <message> <source>&E-mail:</source> - <translation type="unfinished"></translation> + <translation>E-&mail:</translation> </message> <message> <source>&Password:</source> - <translation type="unfinished"></translation> + <translation>&Heslo:</translation> </message> <message> <source>I &would like to register creating a new Sun Online account:</source> - <translation type="unfinished"></translation> + <translation>Chci se re&gistrovat a vytvořit nový účet na Sun Online:</translation> </message> <message> <source>&First Name:</source> - <translation type="unfinished"></translation> + <translation>&Křestní jméno:</translation> </message> <message> <source>&Last Name:</source> - <translation type="unfinished"></translation> + <translation>Pří&jmení:</translation> </message> <message> <source>&Company:</source> - <translation type="unfinished"></translation> + <translation>&Firma:</translation> </message> <message> <source>Co&untry:</source> - <translation type="unfinished"></translation> + <translation>&Země:</translation> </message> <message> <source>E-&mail:</source> - <translation type="unfinished"></translation> + <translation>E-&mail:</translation> </message> <message> <source>P&assword:</source> - <translation type="unfinished"></translation> + <translation>H&eslo:</translation> </message> <message> <source>Co&nfirm Password:</source> - <translation type="unfinished"></translation> + <translation>Po&tvrdit heslo:</translation> </message> <message> <source>&Register</source> - <translation type="unfinished"></translation> + <translation>&Registrovat</translation> </message> </context> <context> @@ -6941,75 +6941,75 @@ p, li { white-space: pre-wrap; } <name>VBoxVMSettingsDisplay</name> <message> <source>you have assigned less than <b>%1</b> for video memory which is the minimum amount required to switch the virtual machine to fullscreen or seamless mode.</source> - <translation type="unfinished">Přiřadili jste méně než <b>%1</b> video paměti pro virtuální počítač, což je méně než potřebné množství pro přepnutí do celoobrazovkého režimu. </translation> + <translation>přiřadili jste méně než <b>%1</b> video paměti pro virtuální počítač, což je méně než potřebné množství pro přepnutí do celoobrazovkého nebo bezešvého režimu.</translation> </message> <message> <source><qt>%1&nbsp;MB</qt></source> - <translation type="unfinished"><qt>%1&nbsp;MB</qt></translation> + <translation><qt>%1&nbsp;MB</qt></translation> </message> <message> <source>&Video</source> - <translation type="unfinished"></translation> + <translation>&Video</translation> </message> <message> <source>Video &Memory:</source> - <translation type="unfinished"></translation> + <translation>Video &paměť:</translation> </message> <message> <source>Controls the amount of video memory provided to the virtual machine.</source> - <translation type="unfinished">Ovládá množství videopaměti poskytnuté virtuálnímu počítači.</translation> + <translation>Ovládá množství videopaměti poskytnuté virtuálnímu počítači.</translation> </message> <message> <source>MB</source> - <translation type="unfinished">MB</translation> + <translation>MB</translation> </message> <message> <source>Extended Features:</source> - <translation type="unfinished">Rozšířené možnosti:</translation> + <translation>Rozšířené možnosti:</translation> </message> <message> <source>When checked, the virtual machine will get access to the 3D graphics capabilities available on the host.</source> - <translation type="unfinished">Je-li zatrženo, bude mít hostovaný operační systém přístup ke schopnostem 3D grafiky na hostitelském počítači.</translation> + <translation>Je-li zatrženo, bude mít hostovaný operační systém přístup ke schopnostem 3D grafiky na hostitelském počítači.</translation> </message> <message> <source>Enable &3D Acceleration</source> - <translation type="unfinished">Povolit &3D akceleraci</translation> + <translation>Povolit &3D akceleraci</translation> </message> <message> <source>&Remote Display</source> - <translation type="unfinished"></translation> + <translation>V&zdálená obrazovka</translation> </message> <message> <source>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</source> - <translation type="unfinished">Je-li zatrženo, virtuální počítač se bude chovat jako Remote Desktop Protocol (RDP) server a umožní vzdáleným klientům připojení a práci s virtuálním počítačem (když běží) použitím standardního RDP klienta.</translation> + <translation>Je-li zatrženo, virtuální počítač se bude chovat jako Remote Desktop Protocol (RDP) server a umožní vzdáleným klientům připojení a práci s virtuálním počítačem (když běží) použitím standardního RDP klienta.</translation> </message> <message> <source>&Enable Server</source> - <translation type="unfinished">Povolit &server</translation> + <translation>Povolit &server</translation> </message> <message> <source>Server &Port:</source> - <translation type="unfinished">Po&rt serveru:</translation> + <translation>Po&rt serveru:</translation> </message> <message> <source>Displays the VRDP Server port number. You may specify <tt>0</tt> (zero) to reset the port to the default value.</source> - <translation type="unfinished">Zobrazuje číslo portu pro VRDP server. Můžete uvést <tt>0</tt> (nulu) pro nastavení čísla portu na standardní hodnotu.</translation> + <translation>Zobrazuje číslo portu pro VRDP server. Můžete uvést <tt>0</tt> (nulu) pro nastavení čísla portu na standardní hodnotu.</translation> </message> <message> <source>Authentication &Method:</source> - <translation type="unfinished">&Metoda autentizace:</translation> + <translation>&Metoda autentizace:</translation> </message> <message> <source>Defines the VRDP authentication method.</source> - <translation type="unfinished"></translation> + <translation>Určuje autentizační metodu VRDP.</translation> </message> <message> <source>Authentication &Timeout:</source> - <translation type="unfinished">Čas vypršení au&tentizace:</translation> + <translation>Čas vypršení au&tentizace:</translation> </message> <message> <source>Specifies the timeout for guest authentication, in milliseconds.</source> - <translation type="unfinished"></translation> + <translation>Určuje čas vypršení autentizace hosta v milisekundách.</translation> </message> </context> <context> @@ -7661,19 +7661,19 @@ ukáže hostovanému OS zvukovou kartu, ale každý přístup bude ignorován.&l </message> <message> <source>System</source> - <translation type="unfinished"></translation> + <translation>Systém</translation> </message> <message> <source>Display</source> - <translation type="unfinished"></translation> + <translation>Obrazovka</translation> </message> <message> <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source> - <translation type="unfinished"></translation> + <translation>zvolili jste 64bitový OS pro tento virtuální počítač. Protože je nutná podpora hardwarové virtualizace (VT-x/AMD-V), byla tato volba automaticky nastavena.</translation> </message> <message> <source>you have selected a 64-bit guest OS type for this VM. VirtualBox does not currently support more than one virtual CPU for 64-bit guests executed on 32-bit hosts.</source> - <translation type="unfinished"></translation> + <translation>zvolili jste 64bitový OS pro tento virtuální počítač. VirtualBox aktuálně nepodporuje více jak jeden virtuální 64bitový CPU na 32bitovém hostitelském počítači.</translation> </message> </context> <context> @@ -7943,23 +7943,23 @@ ukáže hostovanému OS zvukovou kartu, ale každý přístup bude ignorován.&l </message> <message> <source>Removable Media:</source> - <translation type="unfinished"></translation> + <translation>Výjímatelná média:</translation> </message> <message> <source>&Remember Runtime Changes</source> - <translation type="unfinished"></translation> + <translation>Pamatovat si &změny provedené za běhu</translation> </message> <message> <source>Mini ToolBar:</source> - <translation type="unfinished"></translation> + <translation>Mini nástrojová lišta:</translation> </message> <message> <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source> - <translation type="unfinished"></translation> + <translation>Je-li zatrženo, bude se v celoobrazovkovém a bezešvém režimu zobrazovat malá nástrojová lišta.</translation> </message> <message> <source>Show In &Fullscreen/Seamless</source> - <translation type="unfinished"></translation> + <translation>Zobrazit v &celoobrazovkovém/bezešvém režimu</translation> </message> </context> <context> @@ -8026,7 +8026,7 @@ ukáže hostovanému OS zvukovou kartu, ale každý přístup bude ignorován.&l </message> <message> <source>If checked, it will show differencing hard disks actually attached to the slots instead of their base hard disks (shown in case of indirect attachments) and will also let attach other differencing hard disks explicitly. Check this only if you need a complex hard disk setup.</source> - <translation type="unfinished"></translation> + <translation>Je-li zatrženo, zobrazí seznam rozdílových pevných disků připojených ke slotu místo původních pevných disků a umožní připojit explicitně další rozdílové disky. Zvolte pouze pokud potřebujete komplexní přehled o discích.</translation> </message> <message> <source>&Show Differencing Hard Disks</source> @@ -8034,11 +8034,11 @@ ukáže hostovanému OS zvukovou kartu, ale každý přístup bude ignorován.&l </message> <message> <source>IDE &Controller Type</source> - <translation type="unfinished"></translation> + <translation>Typ &IDE řadiče</translation> </message> <message> <source>Defines the type of the virtual IDE controller. Depending on this value, VirtualBox will provide different virtual IDE hardware devices to the guest OS.</source> - <translation type="unfinished">Definuje typy virtuálních IDE řadičů. Na základě této hodnoty VirtualBox poskytne hostovanému OS různé ovladače pro IDE hardware.</translation> + <translation>Definuje typy virtuálních IDE řadičů. Na základě této hodnoty VirtualBox poskytne hostovanému OS různé ovladače pro IDE hardware.</translation> </message> </context> <context> @@ -8552,7 +8552,7 @@ ukáže hostovanému OS zvukovou kartu, ale každý přístup bude ignorován.&l </message> <message> <source>Port/File &Path:</source> - <translation type="unfinished"></translation> + <translation>Port/Cesta k sou&boru:</translation> </message> </context> <context> @@ -8574,145 +8574,145 @@ ukáže hostovanému OS zvukovou kartu, ale každý přístup bude ignorován.&l <name>VBoxVMSettingsSystem</name> <message> <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source> - <translation type="unfinished">přiřadili jste více jak <b>%1%</b> fyzické paměti (<b>%2%</b>) počítače pro virtuální počítač. Pro běh hostujícího operačního systému nezbývá potřebné množství. Zadejte prosím menší hodnotu.</translation> + <translation>přiřadili jste více jak <b>%1%</b> fyzické paměti (<b>%2%</b>) počítače pro virtuální počítač. Pro běh hostujícího operačního systému nezbývá potřebné množství. Zadejte prosím menší hodnotu.</translation> </message> <message> <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory might be left for your host operating system. Continue at your own risk.</source> - <translation type="unfinished">přiřadili jste více jak <b>%1%</b> fyzické paměti (<b>%2%</b>) počítače pro virtuální počítač. Pro běh hostujícího operačního systému nemusí zbýt potřebné množství paměti. Pokračujte na vlastní riziko.</translation> + <translation>přiřadili jste více jak <b>%1%</b> fyzické paměti (<b>%2%</b>) počítače pro virtuální počítač. Pro běh hostujícího operačního systému nemusí zbýt potřebné množství paměti. Pokračujte na vlastní riziko.</translation> </message> <message> <source>for performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source> - <translation type="unfinished"></translation> + <translation>z důvodu rychlosti nemůže být počet virtuálních CPU přiřazených virtuálnímu počítači vyšší než dvojnásobek počtu fyzických CPU hostitelského počítače (<b>%1</b>).Zmenšete prosím počet virtuálních CPU.</translation> </message> <message> <source>you have assigned more virtual CPUs to the virtual machine than the number of physical CPUs on your host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source> - <translation type="unfinished"></translation> + <translation>přiřadili jste více virtuálních CPU pro virtuální počítač než je počet fyzických CPU na hostitelském systému. (<b>%1</b>). To pravděpodobně způsobí degradaci rychlosti virtuálního počítače. Prosím zvažte zmenšení počtu virtuálních CPU.</translation> </message> <message> <source>you have assigned more than one virtual CPU to this VM. This will not work unless the IO-APIC feature is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source> - <translation type="unfinished"></translation> + <translation>přiřadili jste více jak jeden virtuální CPU tomuto virtuálnímu počítači a pro správnou funkci SMP je vyžadována také podpora IO-APIC, která bude automaticky povolena po odsouhlasení nastavení virtuálního počítače klepnutím na tlačítko OK.</translation> </message> <message> <source>you have assigned more than one virtual CPU to this VM. This will not work unless hardware virtualization (VT-x/AMD-V) is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source> - <translation type="unfinished"></translation> + <translation>přiřadili jste více jak jeden virtuální CPU tomuto virtuálnímu počítači a pro správnou funkci SMP je také vyžadována podpora hardwarové virtualizace (VT-x/AMD-V), která bude automaticky povolena po odsouhlasení nastavení virtuálního počítače klepnutím na tlačítko OK.</translation> </message> <message> <source><qt>%1&nbsp;MB</qt></source> - <translation type="unfinished"><qt>%1&nbsp;MB</qt></translation> + <translation><qt>%1&nbsp;MB</qt></translation> </message> <message> <source><qt>%1&nbsp;CPU</qt></source> <comment>%1 is 1 for now</comment> - <translation type="unfinished"></translation> + <translation><qt>%1&nbsp;CPU</qt></translation> </message> <message> <source><qt>%1&nbsp;CPUs</qt></source> <comment>%1 is 32 for now</comment> - <translation type="unfinished"></translation> + <translation><qt>%1&nbsp;CPU</qt></translation> </message> <message> <source>&Motherboard</source> - <translation type="unfinished"></translation> + <translation>&Základní deska</translation> </message> <message> <source>Base &Memory:</source> - <translation type="unfinished"></translation> + <translation>Operační pa&měť</translation> </message> <message> <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source> - <translation type="unfinished">Ovládá množství paměti poskytnuté virtuálnímu počítači. Když přiřadíte příliš, nemusí počítač naběhnout.</translation> + <translation>Ovládá množství paměti poskytnuté virtuálnímu počítači. Když přiřadíte příliš, nemusí počítač naběhnout.</translation> </message> <message> <source>MB</source> - <translation type="unfinished">MB</translation> + <translation>MB</translation> </message> <message> <source>&Boot Order:</source> - <translation type="unfinished"></translation> + <translation>Pořadí &bootování:</translation> </message> <message> <source>Defines the boot device order. Use checkboxes to the left to enable or disable individual boot devices. Move items up and down to change the device order.</source> - <translation type="unfinished"></translation> + <translation>Určuje pořadí pořadí bootovacích zařízení. Použijte zaškrtávací políčka vlevo pro povolení či zakázání jednotlivých bootovacích zařízení. Posuňte položky nahoru a dolů pro změnu pořadí zařízení.</translation> </message> <message> <source>Move Down (Ctrl-Down)</source> - <translation type="unfinished">Posunout dolů (Ctrl-Dolů)</translation> + <translation>Posunout dolů (Ctrl-Dolů)</translation> </message> <message> <source>Moves the selected boot device down.</source> - <translation type="unfinished">Posune vybrané bootovací zařízení dolů.</translation> + <translation>Posune vybrané bootovací zařízení dolů.</translation> </message> <message> <source>Move Up (Ctrl-Up)</source> - <translation type="unfinished">Posunout nahoru (Ctrl-Nahoru)</translation> + <translation>Posunout nahoru (Ctrl-Nahoru)</translation> </message> <message> <source>Moves the selected boot device up.</source> - <translation type="unfinished">Posune vybrané bootovací zařízení nahoru.</translation> + <translation>Posune vybrané bootovací zařízení nahoru.</translation> </message> <message> <source>Extended Features:</source> - <translation type="unfinished">Rozšířené možnosti:</translation> + <translation>Rozšířené možnosti:</translation> </message> <message> <source>When checked, the virtual machine will support the Advanced Configuration and Power Management Interface (ACPI). <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source> - <translation type="unfinished">Je-li zatrženo, virtuální počítač bude podporovat Advanced Configuration and Power Management Interface (ACPI). <b>Poznámka:</b> nevypínejte tuto možnost po nainstalování hostovaného operačního systému Windows!</translation> + <translation>Je-li zatrženo, virtuální počítač bude podporovat Advanced Configuration and Power Management Interface (ACPI). <b>Poznámka:</b> nevypínejte tuto možnost po nainstalování hostovaného operačního systému Windows!</translation> </message> <message> <source>Enable &ACPI</source> - <translation type="unfinished"></translation> + <translation>Povolit A&CPI</translation> </message> <message> <source>When checked, the virtual machine will support the Input Output APIC (IO APIC), which may slightly decrease the VM performance. <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source> - <translation type="unfinished">Je-li zatrženo, virtuální počítač bude podporovat Input Output APIC (IO APIC), což může mírně snížit výkon virtuálního počítače. <b>Poznámka:</b> nevypínejte tuto možnost po nainstalování hostovaného operačního systému Windows!</translation> + <translation>Je-li zatrženo, virtuální počítač bude podporovat Input Output APIC (IO APIC), což může mírně snížit výkon virtuálního počítače. <b>Poznámka:</b> nevypínejte tuto možnost po nainstalování hostovaného operačního systému Windows!</translation> </message> <message> <source>Enable &IO APIC</source> - <translation type="unfinished"></translation> + <translation>Povolit IO A&PIC</translation> </message> <message> <source>&Processor</source> - <translation type="unfinished"></translation> + <translation>Proce&sor</translation> </message> <message> <source>&Processor(s):</source> - <translation type="unfinished"></translation> + <translation>Pro&cessor(y):</translation> </message> <message> <source>Controls the number of virtual CPUs in the virtual machine.</source> - <translation type="unfinished"></translation> + <translation>Nastavení počtu virtuálních CPU pro tento virtuální počítač.</translation> </message> <message> <source>When checked, the Physical Address Extension (PAE) feature of the host CPU will be exposed to the virtual machine.</source> - <translation type="unfinished">Je-li zatrženo, vlastnost Physical Address Extension (PAE) hostitelského CPU bude předána do virtuálního počítače.</translation> + <translation>Je-li zatrženo, vlastnost Physical Address Extension (PAE) hostitelského CPU bude předána do virtuálního počítače.</translation> </message> <message> <source>Enable PA&E/NX</source> - <translation type="unfinished">Povolit PA&E/NX</translation> + <translation>Povolit PA&E/NX</translation> </message> <message> <source>Acce&leration</source> - <translation type="unfinished"></translation> + <translation>Ak&celerace</translation> </message> <message> <source>Hardware Virtualization:</source> - <translation type="unfinished"></translation> + <translation>Hardwarová virtualizace:</translation> </message> <message> <source>When checked, the virtual machine will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V.</source> - <translation type="unfinished">Je-li zatrženo, virtuální počítač se bude standardně snažit využít virtualizační rozšíření hostitelova CPU jako Intel VT-x a AMD-V.</translation> + <translation>Je-li zatrženo, virtuální počítač se bude standardně snažit využít virtualizační rozšíření hostitelova CPU jako Intel VT-x a AMD-V.</translation> </message> <message> <source>Enable &VT-x/AMD-V</source> - <translation type="unfinished">Povolit &VT-x/AMD-V</translation> + <translation>Povolit &VT-x/AMD-V</translation> </message> <message> <source>When checked, the virtual machine will try to make use of the nested paging extension of Intel VT-x and AMD-V.</source> - <translation type="unfinished">Je-li zatrženo, virtuální počítač se bude standardně snažit využít rozšíření Intel VT-x a AMD-V pro přímou komunikaci s hardwarem.</translation> + <translation>Je-li zatrženo, virtuální počítač se bude standardně snažit využít rozšíření Intel VT-x a AMD-V pro přímou komunikaci s hardwarem.</translation> </message> <message> <source>Enable Nested Pa&ging</source> - <translation type="unfinished">Použít přímou &komunikaci s hardware</translation> + <translation>Použít přímou &komunikaci s hardware</translation> </message> </context> <context> diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts index c6a8c98fb..321f74952 100644 --- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts +++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts @@ -7140,11 +7140,11 @@ p, li { white-space: pre-wrap; } </message> <message> <source>&Processor</source> - <translation>&processeur</translation> + <translation>&Processeur</translation> </message> <message> <source>&Processor(s):</source> - <translation>&processeur(s):</translation> + <translation>&Processeur(s):</translation> </message> <message> <source>Controls the number of virtual CPUs in the virtual machine.</source> diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxFBQuartz2D.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxFBQuartz2D.cpp index 67d92a347..06c2663c1 100644 --- a/src/VBox/Frontends/VirtualBox/src/VBoxFBQuartz2D.cpp +++ b/src/VBox/Frontends/VirtualBox/src/VBoxFBQuartz2D.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxFBQuartz2D.cpp 19817 2009-05-19 12:16:28Z vboxsync $ */ +/* $Id: VBoxFBQuartz2D.cpp $ */ /** @file * Qt GUI (aka VirtualBox) - Quartz2D framebuffer implementation. */ diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp index 8e85aad43..771a43f22 100644 --- a/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp +++ b/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp @@ -647,6 +647,36 @@ VBoxGlobal::~VBoxGlobal() qDeleteAll (mVMStateColors); } +/* static */ +QString VBoxGlobal::qtRTVersionString() +{ + return QString::fromLatin1 (qVersion()); +} + +/* static */ +uint VBoxGlobal::qtRTVersion() +{ + QString rt_ver_str = VBoxGlobal::qtRTVersionString(); + return (rt_ver_str.section ('.', 0, 0).toInt() << 16) + + (rt_ver_str.section ('.', 1, 1).toInt() << 8) + + rt_ver_str.section ('.', 2, 2).toInt(); +} + +/* static */ +QString VBoxGlobal::qtCTVersionString() +{ + return QString::fromLatin1 (QT_VERSION_STR); +} + +/* static */ +uint VBoxGlobal::qtCTVersion() +{ + QString ct_ver_str = VBoxGlobal::qtCTVersionString(); + return (ct_ver_str.section ('.', 0, 0).toInt() << 16) + + (ct_ver_str.section ('.', 1, 1).toInt() << 8) + + ct_ver_str.section ('.', 2, 2).toInt(); +} + /** * Sets the new global settings and saves them to the VirtualBox server. */ @@ -1481,9 +1511,9 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks) #endif /* VBOX_WITH_FULL_DETAILS_REPORT */ /* VT-x/AMD-V */ - QString virt = aMachine.GetHWVirtExEnabled() == KTSBool_True ? - tr ("Enabled", "details report (VT-x/AMD-V)") : - tr ("Disabled", "details report (VT-x/AMD-V)"); + QString virt = aMachine.GetHWVirtExEnabled() + ? tr ("Enabled", "details report (VT-x/AMD-V)") + : tr ("Disabled", "details report (VT-x/AMD-V)"); /* Nested Paging */ QString nested = aMachine.GetHWVirtExNestedPagingEnabled() diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.cpp index d0661f316..197d21ceb 100644 --- a/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.cpp +++ b/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.cpp @@ -229,13 +229,15 @@ VBoxRegistrationDlg::VBoxRegistrationDlg (VBoxRegistrationDlg **aSelf, QWidget * QRegExp passwordExp ("[a-zA-Z0-9_\\-\\+=`~!@#$%^&\\*\\(\\)?\\[\\]:;,\\./]+"); mLeOldEmail->setMaxLength (50); - mLeOldEmail->setValidator (new QRegExpValidator (emailExp, this)); + /* New accounts *must* have a valid email as user name. Thats not the case + * for old existing accounts. So we don't force the email format, so that + * old accounts could be used for registration also. */ + mLeOldEmail->setValidator (new QRegExpValidator (nameExp, this)); mLeOldPassword->setMaxLength (20); mLeOldPassword->setValidator (new QRegExpValidator (passwordExp, this)); mLeNewFirstName->setMaxLength (50); - mLeNewFirstName->setValidator (new QRegExpValidator (nameExp, this)); mLeNewLastName->setMaxLength (50); diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialogSpecific.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialogSpecific.cpp index 86af9ffa4..6c8fd929e 100644 --- a/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialogSpecific.cpp +++ b/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialogSpecific.cpp @@ -432,7 +432,7 @@ void VBoxVMSettingsDlg::putBackTo() qobject_cast <VBoxVMSettingsSystem*> (mSelector->idToPage (SystemId)); if (generalPage && systemPage && generalPage->is64BitOSTypeSelected() && !systemPage->isHWVirtExEnabled()) - mMachine.SetHWVirtExEnabled (KTSBool_True); + mMachine.SetHWVirtExEnabled (true); /* Clear the "GUI_FirstRun" extra data key in case if the boot order * and/or disk configuration were changed */ diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSystem.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSystem.cpp index 6086fbc74..47a3f5bbd 100644 --- a/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSystem.cpp +++ b/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSystem.cpp @@ -198,11 +198,11 @@ void VBoxVMSettingsSystem::getFrom (const CMachine &aMachine) /* VT-x/AMD-V */ mCbVirt->setEnabled (fVTxAMDVSupported); - mCbVirt->setChecked (aMachine.GetHWVirtExEnabled() == KTSBool_True); + mCbVirt->setChecked (aMachine.GetHWVirtExEnabled()); /* Nested Paging */ mCbNestedPaging->setEnabled (fVTxAMDVSupported && - aMachine.GetHWVirtExEnabled() == KTSBool_True); + aMachine.GetHWVirtExEnabled()); mCbNestedPaging->setChecked (aMachine.GetHWVirtExNestedPagingEnabled()); if (mValidator) @@ -255,8 +255,7 @@ void VBoxVMSettingsSystem::putBackTo() /* VT-x/AMD-V */ mMachine.SetHWVirtExEnabled (mCbVirt->checkState() == Qt::Checked || - mSlCPU->value() > 1 ? - KTSBool_True : KTSBool_False); + mSlCPU->value() > 1); /* Nested Paging */ mMachine.SetHWVirtExNestedPagingEnabled (mCbNestedPaging->isChecked()); diff --git a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxAquaStyle.cpp b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxAquaStyle.cpp index 0fbbc9d68..b2546f4cd 100644 --- a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxAquaStyle.cpp +++ b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxAquaStyle.cpp @@ -1,4 +1,4 @@ -/** $Id: $ */ +/** $Id: $ */ /** @file * Qt GUI - VBox Variation on the QAquaStyle. */ diff --git a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.h b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.h index b81b8c2e9..44d9f8303 100644 --- a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.h +++ b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.h @@ -1,4 +1,4 @@ -/* $Id: VBoxCocoaApplication.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxCocoaApplication.h $ */ /** @file * VBoxCocoaApplication - NSApplication subclass for handling -sendEvent. */ diff --git a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m index d24c12e30..8394e44e3 100644 --- a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m +++ b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m @@ -1,4 +1,4 @@ -/* $Id: VBoxCocoaApplication.m 17126 2009-02-25 13:03:29Z vboxsync $ */ +/* $Id: VBoxCocoaApplication.m $ */ /** @file * VBoxCocoaApplication - NSApplication subclass for handling -sendEvent. */ diff --git a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxDockIconPreview.cpp b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxDockIconPreview.cpp index fee92c86e..859de2466 100644 --- a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxDockIconPreview.cpp +++ b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxDockIconPreview.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxDockIconPreview.cpp 18689 2009-04-03 13:21:04Z vboxsync $ */ +/* $Id: VBoxDockIconPreview.cpp $ */ /** @file * Qt GUI - Realtime Dock Icon Preview */ diff --git a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxIChatTheaterWrapper.m b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxIChatTheaterWrapper.m index a135022c3..dc4491f92 100644 --- a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxIChatTheaterWrapper.m +++ b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxIChatTheaterWrapper.m @@ -1,4 +1,4 @@ -/* $Id: VBoxIChatTheaterWrapper.m 8170 2008-04-18 17:52:25Z vboxsync $ */ +/* $Id: VBoxIChatTheaterWrapper.m $ */ /** @file * Qt GUI - iChat Theater cocoa wrapper. */ diff --git a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp index b1a2c0a62..fbdbe4909 100644 --- a/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp +++ b/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxUtils-darwin.cpp 21034 2009-06-29 15:36:04Z vboxsync $ */ +/* $Id: VBoxUtils-darwin.cpp $ */ /** @file * Qt GUI - Utility Classes and Functions specific to Darwin. */ diff --git a/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp b/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp index 86bc0a6a2..b5120a7d2 100644 --- a/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp +++ b/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp @@ -1,4 +1,4 @@ -/* $Id: hardenedmain.cpp 18789 2009-04-06 18:08:04Z vboxsync $ */ +/* $Id: hardenedmain.cpp $ */ /** @file * VirtualBox - Hardened main(). */ diff --git a/src/VBox/Frontends/VirtualBox/src/main.cpp b/src/VBox/Frontends/VirtualBox/src/main.cpp index 5571b6158..957ea2f3c 100644 --- a/src/VBox/Frontends/VirtualBox/src/main.cpp +++ b/src/VBox/Frontends/VirtualBox/src/main.cpp @@ -36,6 +36,7 @@ #ifdef Q_WS_X11 #include <QFontDatabase> +#include <iprt/env.h> #endif #include <QCleanlooksStyle> @@ -325,21 +326,51 @@ extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char ** /*envp*/) /* scope the QIApplication variable */ { +#ifdef Q_WS_X11 + /* There are some buggy/strange driver/compiz combinations which lead + * to transparent backgrounds on ARGB visuals. Try to fix it by not + * allowing an ARGB visual with the help of the Xlib. After that we + * restore the original environment, so that others like the OpenGL + * service will proper work. */ + char *pchOldVar = NULL; + bool fHackARGB = !RTEnvExist ("VBOX_NO_ARGB_VISUALS_HACK") && VBoxGlobal::qtRTVersion() >= 0x040500; + if (fHackARGB) + { + const char *pchVar = RTEnvGet ("XLIB_SKIP_ARGB_VISUALS"); + if (pchVar) + pchOldVar = RTStrDup (pchVar); + RTEnvSet ("XLIB_SKIP_ARGB_VISUALS", "1"); + } + /* Now create the application object */ + QIApplication a (argc, argv); + /* Restore previous environment */ + if (fHackARGB) + { + if (pchOldVar) + { + RTEnvSet ("XLIB_SKIP_ARGB_VISUALS", pchOldVar); + RTStrFree (pchOldVar); + } + else + RTEnvUnset ("XLIB_SKIP_ARGB_VISUALS"); + } +#else /* defined(Q_WS_X11) && (QT_VERSION >= 0x040500) */ QIApplication a (argc, argv); +#endif /* defined(Q_WS_X11) && (QT_VERSION >= 0x040500) */ /* Qt4.3 version has the QProcess bug which freezing the application * for 30 seconds. This bug is internally used at initialization of * Cleanlooks style. So we have to change this style to another one. * See http://trolltech.com/developer/task-tracker/index_html?id=179200&method=entry * for details. */ - if (QString (qVersion()).startsWith ("4.3") && + if (VBoxGlobal::qtRTVersionString().startsWith ("4.3") && qobject_cast <QCleanlooksStyle*> (QApplication::style())) QApplication::setStyle (new QPlastiqueStyle); #ifdef Q_OS_SOLARIS /* Solaris have some issue with cleanlooks style which leads to application * crash in case of using it on Qt4.4 version, lets make the same substitute */ - if (QString (qVersion()).startsWith ("4.4") && + if (VBoxGlobal::qtRTVersionString().startsWith ("4.4") && qobject_cast <QCleanlooksStyle*> (QApplication::style())) QApplication::setStyle (new QPlastiqueStyle); #endif @@ -395,24 +426,13 @@ extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char ** /*envp*/) #ifdef Q_WS_X11 /* version check (major.minor are sensitive, fix number is ignored) */ - QString ver_str = QString::fromLatin1 (QT_VERSION_STR); - QString ver_str_base = ver_str.section ('.', 0, 1); - QString rt_ver_str = QString::fromLatin1 (qVersion()); - uint ver = - (ver_str.section ('.', 0, 0).toInt() << 16) + - (ver_str.section ('.', 1, 1).toInt() << 8) + - ver_str.section ('.', 2, 2).toInt(); - uint rt_ver = - (rt_ver_str.section ('.', 0, 0).toInt() << 16) + - (rt_ver_str.section ('.', 1, 1).toInt() << 8) + - rt_ver_str.section ('.', 2, 2).toInt(); - if (rt_ver < (ver & 0xFFFF00)) + if (VBoxGlobal::qtRTVersion() < (VBoxGlobal::qtCTVersion() & 0xFFFF00)) { QString msg = QApplication::tr ("Executable <b>%1</b> requires Qt %2.x, found Qt %3.") .arg (qAppName()) - .arg (ver_str_base) - .arg (rt_ver_str); + .arg (VBoxGlobal::qtCTVersionString().section ('.', 0, 1)) + .arg (VBoxGlobal::qtRTVersionString()); QMessageBox::critical ( 0, QApplication::tr ("Incompatible Qt Library Error"), msg, QMessageBox::Abort, 0); diff --git a/src/VBox/Frontends/VirtualBox/src/os2/VBoxHlp.asm b/src/VBox/Frontends/VirtualBox/src/os2/VBoxHlp.asm index 3dada14c1..cce66e212 100644 --- a/src/VBox/Frontends/VirtualBox/src/os2/VBoxHlp.asm +++ b/src/VBox/Frontends/VirtualBox/src/os2/VBoxHlp.asm @@ -1,4 +1,4 @@ -; $Id: VBoxHlp.asm 8155 2008-04-18 15:16:47Z vboxsync $ +; $Id: VBoxHlp.asm $ ;; @file ; ; VBox frontends: Qt GUI ("VirtualBox"): diff --git a/src/VBox/Frontends/VirtualBox/src/os2/VBoxHlp.cpp b/src/VBox/Frontends/VirtualBox/src/os2/VBoxHlp.cpp index a9e90c8db..8e6ab02ac 100644 --- a/src/VBox/Frontends/VirtualBox/src/os2/VBoxHlp.cpp +++ b/src/VBox/Frontends/VirtualBox/src/os2/VBoxHlp.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxHlp.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: VBoxHlp.cpp $ */ /** @file * VBox frontends: Qt GUI ("VirtualBox"): * Implementation of OS/2-specific helpers that require to reside in a DLL diff --git a/src/VBox/Frontends/VirtualBox/src/win/VirtualBox.rc b/src/VBox/Frontends/VirtualBox/src/win/VirtualBox.rc index c5b02ef74..e0669cf13 100644 --- a/src/VBox/Frontends/VirtualBox/src/win/VirtualBox.rc +++ b/src/VBox/Frontends/VirtualBox/src/win/VirtualBox.rc @@ -1,4 +1,4 @@ -/* $Id: VirtualBox.rc 18524 2009-03-30 11:42:07Z vboxsync $ */ +/* $Id: VirtualBox.rc $ */ /** @file * Windows resource file for VirtualBox.exe. */ diff --git a/src/VBox/GuestHost/Makefile.kmk b/src/VBox/GuestHost/Makefile.kmk index 67024f925..91511d8a8 100644 --- a/src/VBox/GuestHost/Makefile.kmk +++ b/src/VBox/GuestHost/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18890 2009-04-14 14:13:07Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VirtualBox Guest/Host part # diff --git a/src/VBox/GuestHost/OpenGL/Makefile.kmk b/src/VBox/GuestHost/OpenGL/Makefile.kmk index 4836a132a..7c2d16ce7 100644 --- a/src/VBox/GuestHost/OpenGL/Makefile.kmk +++ b/src/VBox/GuestHost/OpenGL/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20658 2009-06-17 10:32:00Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VirtualBox Guest/Host OpenGL part # diff --git a/src/VBox/GuestHost/OpenGL/error/errorspu.rc b/src/VBox/GuestHost/OpenGL/error/errorspu.rc index d0441251c..ec3970ee8 100644 --- a/src/VBox/GuestHost/OpenGL/error/errorspu.rc +++ b/src/VBox/GuestHost/OpenGL/error/errorspu.rc @@ -1,4 +1,4 @@ -/* $Id: errorspu.rc 20658 2009-06-17 10:32:00Z vboxsync $ */ +/* $Id: errorspu.rc $ */ /** @file * diff --git a/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py b/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py index a469047d7..a469047d7 100644..100755 --- a/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py +++ b/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py diff --git a/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c b/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c index 75c3e7770..915756950 100644 --- a/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c +++ b/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c @@ -1,4 +1,4 @@ -/* $Id: pack_shaders.c 20511 2009-06-12 13:00:53Z vboxsync $ */ +/* $Id: pack_shaders.c $ */ /** @file * VBox OpenGL DRI driver functions diff --git a/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c b/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c index f35c1d428..f35c1d428 100755..100644 --- a/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c +++ b/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c diff --git a/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c b/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c index c0507d6a0..787ddea93 100644 --- a/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c +++ b/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c @@ -1,4 +1,4 @@ -/* $Id: state_snapshot.c 16970 2009-02-20 11:29:03Z vboxsync $ */ +/* $Id: state_snapshot.c $ */ /** @file * VBox Context state saving/loading used by VM snapshot diff --git a/src/VBox/GuestHost/OpenGL/util/util.rc b/src/VBox/GuestHost/OpenGL/util/util.rc index ae0bb461a..0720957fe 100644 --- a/src/VBox/GuestHost/OpenGL/util/util.rc +++ b/src/VBox/GuestHost/OpenGL/util/util.rc @@ -1,4 +1,4 @@ -/* $Id: util.rc 20658 2009-06-17 10:32:00Z vboxsync $ */ +/* $Id: util.rc $ */ /** @file * diff --git a/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c b/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c index d5cf460a2..0ac2e605e 100644 --- a/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c +++ b/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c @@ -1,4 +1,4 @@ -/* $Id: vboxhgcm.c 18508 2009-03-29 02:44:49Z vboxsync $ */ +/* $Id: vboxhgcm.c $ */ /** @file * VBox HGCM connection diff --git a/src/VBox/GuestHost/SharedClipboard/Makefile.kmk b/src/VBox/GuestHost/SharedClipboard/Makefile.kmk index 3cb6a0dfe..a752245ac 100644 --- a/src/VBox/GuestHost/SharedClipboard/Makefile.kmk +++ b/src/VBox/GuestHost/SharedClipboard/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19505 2009-05-07 20:04:03Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Guest Properties Host Service testcases. # diff --git a/src/VBox/GuestHost/SharedClipboard/clipboard-helper.cpp b/src/VBox/GuestHost/SharedClipboard/clipboard-helper.cpp index fb2b19e78..7cc25d5ef 100644 --- a/src/VBox/GuestHost/SharedClipboard/clipboard-helper.cpp +++ b/src/VBox/GuestHost/SharedClipboard/clipboard-helper.cpp @@ -1,4 +1,4 @@ -/* $Id: clipboard-helper.cpp 20966 2009-06-26 10:19:23Z vboxsync $ */ +/* $Id: clipboard-helper.cpp $ */ /** @file * Shared Clipboard: Some helper function for converting between the various eol. */ diff --git a/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp b/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp index abd3a1f68..b2cf313e0 100644 --- a/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp +++ b/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp @@ -61,6 +61,7 @@ enum CLIPFORMAT { INVALID = 0, TARGETS, + TEXT, /* Treat this as Utf8, but it may really be ascii */ CTEXT, UTF8 }; @@ -84,9 +85,9 @@ static struct _CLIPFORMATTABLE VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT }, { "text/plain;charset=utf-8", UTF8, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT }, - { "STRING", UTF8, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT }, - { "TEXT", UTF8, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT }, - { "text/plain", UTF8, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT }, + { "STRING", TEXT, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT }, + { "TEXT", TEXT, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT }, + { "text/plain", TEXT, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT }, { "COMPOUND_TEXT", CTEXT, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT } }; @@ -317,26 +318,23 @@ static void clipReportEmptyX11CB(CLIPBACKEND *pCtx) } /** - * Go through an array of X11 clipboard targets to see if we can support any - * of them and if relevant to choose the ones we prefer (e.g. we like Utf8 - * better than compound text). + * Go through an array of X11 clipboard targets to see if they contain a text + * format we can support, and if so choose the ones we prefer (e.g. we like + * Utf8 better than compound text). * @param pCtx the clipboard backend context structure * @param pTargets the list of targets * @param cTargets the size of the list in @a pTargets - * @param pChanged This is set to true if the formats available have changed - * from VBox's point of view, and to false otherwise. - * Somehow this didn't feel right as a return value. */ -void clipGetFormatsFromTargets(CLIPBACKEND *pCtx, Atom *pTargets, - size_t cTargets, bool *pChanged) +static CLIPX11FORMAT clipGetTextFormatFromTargets(CLIPBACKEND *pCtx, + Atom *pTargets, + size_t cTargets) { - bool changed = false; CLIPX11FORMAT bestTextFormat = NIL_CLIPX11FORMAT; - AssertPtrReturnVoid(pCtx); - AssertPtrReturnVoid(pTargets); + CLIPFORMAT enmBestTextTarget = INVALID; + AssertPtrReturn(pCtx, NIL_CLIPX11FORMAT); + AssertReturn(VALID_PTR(pTargets) || cTargets == 0, NIL_CLIPX11FORMAT); for (unsigned i = 0; i < cTargets; ++i) { - CLIPFORMAT enmBestTextTarget = INVALID; CLIPX11FORMAT format = clipFindX11FormatByAtom(pCtx->widget, pTargets[i]); if (format != NIL_CLIPX11FORMAT) @@ -350,10 +348,64 @@ void clipGetFormatsFromTargets(CLIPBACKEND *pCtx, Atom *pTargets, } } } + return bestTextFormat; +} + +#ifdef TESTCASE +static bool clipTestTextFormatConversion(CLIPBACKEND *pCtx) +{ + bool success = true; + Atom targets[3]; + CLIPX11FORMAT x11Format; + targets[0] = clipGetAtom(NULL, "COMPOUND_TEXT"); + targets[1] = clipGetAtom(NULL, "text/plain"); + targets[2] = clipGetAtom(NULL, "TARGETS"); + x11Format = clipGetTextFormatFromTargets(pCtx, targets, 3); + if (clipRealFormatForX11Format(x11Format) != CTEXT) + success = false; + targets[0] = clipGetAtom(NULL, "UTF8_STRING"); + targets[1] = clipGetAtom(NULL, "text/plain"); + targets[2] = clipGetAtom(NULL, "COMPOUND_TEXT"); + x11Format = clipGetTextFormatFromTargets(pCtx, targets, 3); + if (clipRealFormatForX11Format(x11Format) != UTF8) + success = false; + return success; +} +#endif + +/** + * Go through an array of X11 clipboard targets to see if we can support any + * of them and if relevant to choose the ones we prefer (e.g. we like Utf8 + * better than compound text). + * @param pCtx the clipboard backend context structure + * @param pTargets the list of targets + * @param cTargets the size of the list in @a pTargets + * @param pChanged This is set to true if the formats available have changed + * from VBox's point of view, and to false otherwise. + * Somehow this didn't feel right as a return value. + */ +static void clipGetFormatsFromTargets(CLIPBACKEND *pCtx, Atom *pTargets, + size_t cTargets, bool *pChanged) +{ + bool changed = false; + AssertPtrReturnVoid(pCtx); + AssertReturnVoid(VALID_PTR(pTargets) || cTargets == 0); + CLIPX11FORMAT bestTextFormat; + bestTextFormat = clipGetTextFormatFromTargets(pCtx, pTargets, cTargets); if (pCtx->X11TextFormat != bestTextFormat) { changed = true; pCtx->X11TextFormat = bestTextFormat; +#if defined(DEBUG) && !defined(TESTCASE) + for (unsigned i = 0; i < cTargets; ++i) + if (pTargets[i]) + { + char *pszName = XGetAtomName(XtDisplay(pCtx->widget), + pTargets[i]); + Log2(("%s: found target %s\n", __PRETTY_FUNCTION__, pszName)); + XFree(pszName); + } +#endif } pCtx->X11BitmapFormat = INVALID; /* not yet supported */ if (pChanged) @@ -361,6 +413,50 @@ void clipGetFormatsFromTargets(CLIPBACKEND *pCtx, Atom *pTargets, } /** + * Update the context's information about targets currently supported by X11, + * based on an array of X11 atoms. + * @param pCtx the context to be updated + * @param pTargets the array of atoms describing the targets supported + * @param cTargets the size of the array @a pTargets + */ +static void clipUpdateX11Targets(CLIPBACKEND *pCtx, Atom *pTargets, + size_t cTargets) +{ + bool changed = false; + + Log3 (("%s: called\n", __PRETTY_FUNCTION__)); + if (pCtx->fOwnsClipboard) + /* VBox raced us and we lost. So we don't want to report anything. */ + return; + clipGetFormatsFromTargets(pCtx, pTargets, cTargets, &changed); + if (changed) + clipReportFormatsToVBox(pCtx); +} + +#ifdef TESTCASE +static bool clipTestTargetUpdate(CLIPBACKEND *pCtx) +{ + bool success = true; + bool changed = true; + clipGetFormatsFromTargets(pCtx, NULL, 0, &changed); + clipGetFormatsFromTargets(pCtx, NULL, 0, &changed); /* twice */ + if (changed) + success = false; + Atom targets[3]; + targets[0] = clipGetAtom(NULL, "COMPOUND_TEXT"); + targets[1] = clipGetAtom(NULL, "text/plain"); + targets[2] = clipGetAtom(NULL, "TARGETS"); + clipGetFormatsFromTargets(pCtx, targets, RT_ELEMENTS(targets), &changed); + if (!changed) + success = false; + clipGetFormatsFromTargets(pCtx, targets, RT_ELEMENTS(targets), &changed); + if (changed) + success = false; + return success; +} +#endif + +/** * Notify the VBox clipboard about available data formats, based on the * "targets" information obtained from the X11 clipboard. * @note callback for XtGetSelectionValue, called on a polling loop @@ -372,21 +468,10 @@ static void clipConvertX11Targets(Widget, XtPointer pClientData, { CLIPBACKEND *pCtx = reinterpret_cast<CLIPBACKEND *>(pClientData); - Atom *pTargets = reinterpret_cast<Atom *>(pValue); - size_t cTargets = *pcLen; - bool changed = true; - - Log3 (("%s: called\n", __PRETTY_FUNCTION__)); - if (pCtx->fOwnsClipboard) - /* VBox raced us and we lost. So we don't want to report anything. */ - changed = false; - else if ( (*atomType == XT_CONVERT_FAIL) /* timeout */ - || !pTargets /* Conversion failed */) - clipResetX11Formats(pCtx); - else - clipGetFormatsFromTargets(pCtx, pTargets, cTargets, &changed); - if (changed) - clipReportFormatsToVBox(pCtx); + Atom *pTargets = (*atomType == XT_CONVERT_FAIL) ? NULL /* timeout */ + : (Atom *)pValue; + size_t cTargets = pTargets ? *pcLen : 0; + clipUpdateX11Targets(pCtx, pTargets, cTargets); XtFree(reinterpret_cast<char *>(pValue)); } @@ -893,7 +978,7 @@ static int clipWinTxtToCTextForX11CB(Display *pDisplay, PRTUTF16 pwszSrc, unsigned long *pcLenReturn, int *piFormatReturn) { - char *pszTmp = NULL; + char *pszTmp = NULL, *pszTmp2 = NULL; size_t cbTmp = 0, cbActual = 0; XTextProperty property; int rc = VINF_SUCCESS, xrc = 0; @@ -911,22 +996,20 @@ static int clipWinTxtToCTextForX11CB(Display *pDisplay, PRTUTF16 pwszSrc, if (RT_SUCCESS(rc)) rc = clipWinTxtToUtf8(pwszSrc, cbSrc, pszTmp, cbTmp + 1, &cbActual); - /* And finally (!) convert the Utf8 text to compound text. */ -#ifdef X_HAVE_UTF8_STRING + /* Convert the Utf8 text to the current encoding (usually a noop). */ if (RT_SUCCESS(rc)) - xrc = Xutf8TextListToTextProperty(pDisplay, &pszTmp, 1, - XCompoundTextStyle, &property); -#else + rc = RTStrUtf8ToCurrentCP(&pszTmp2, pszTmp); + /* And finally (!) convert the resulting text to compound text. */ if (RT_SUCCESS(rc)) - xrc = XmbTextListToTextProperty(pDisplay, &pszTmp, 1, + xrc = XmbTextListToTextProperty(pDisplay, &pszTmp2, 1, XCompoundTextStyle, &property); -#endif if (RT_SUCCESS(rc) && xrc < 0) rc = ( xrc == XNoMemory ? VERR_NO_MEMORY : xrc == XLocaleNotSupported ? VERR_NOT_SUPPORTED : xrc == XConverterNotFound ? VERR_NOT_SUPPORTED : VERR_UNRESOLVED_ERROR); RTMemFree(pszTmp); + RTStrFree(pszTmp2); *atomTypeReturn = property.encoding; *pValReturn = reinterpret_cast<XtPointer>(property.value); *pcLenReturn = property.nitems + 1; @@ -958,7 +1041,7 @@ static int clipConvertVBoxCBForX11(CLIPBACKEND *pCtx, Atom *atomTarget, CLIPX11FORMAT x11Format = clipFindX11FormatByAtom(pCtx->widget, *atomTarget); CLIPFORMAT format = clipRealFormatForX11Format(x11Format); - if ( ((format == UTF8) || (format == CTEXT)) + if ( ((format == UTF8) || (format == CTEXT) || (format == TEXT)) && (pCtx->vboxFormats & VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT)) { void *pv = NULL; @@ -968,7 +1051,7 @@ static int clipConvertVBoxCBForX11(CLIPBACKEND *pCtx, Atom *atomTarget, &pv, &cb); if (RT_SUCCESS(rc) && (cb == 0)) rc = VERR_NO_DATA; - if (RT_SUCCESS(rc) && (format == UTF8)) + if (RT_SUCCESS(rc) && ((format == UTF8) || (format == TEXT))) rc = clipWinTxtToUtf8ForX11CB(XtDisplay(pCtx->widget), (PRTUTF16)pv, cb, atomTarget, atomTypeReturn, pValReturn, @@ -1014,18 +1097,28 @@ static Boolean clipXtConvertSelectionProc(Widget widget, Atom *atomSelection, } /** + * Notify VBox that we have returned the clipboard to X11. + */ +static void clipReleaseCB(CLIPBACKEND *pCtx) +{ + LogFlowFunc (("\n")); + /* The formats should be set to the right values as soon as we start + * polling */ + clipReportEmptyX11CB(pCtx); + pCtx->fOwnsClipboard = false; +} + +/** * This is called by the X toolkit intrinsics to let us know that another * X11 client has taken the clipboard. In this case we notify VBox that - * we want ownership of the clipboard. + * X11 wants ownership of the clipboard. * @note X11 backend code, callback for XtOwnSelection */ static void clipXtLoseSelectionProc(Widget widget, Atom *) { CLIPBACKEND *pCtx = clipLookupContext(widget); LogFlowFunc (("\n")); - /* These should be set to the right values as soon as we start polling */ - clipResetX11Formats(pCtx); - pCtx->fOwnsClipboard = false; + clipReleaseCB(pCtx); } /** Structure used to pass information about formats that VBox supports */ @@ -1047,17 +1140,6 @@ static void clipInvalidateVBoxCBCache(CLIPBACKEND *pCtx) } } -/** Gives up ownership of the X11 clipboard */ -static void clipGiveUpX11CB(CLIPBACKEND *pCtx) -{ - XtDisownSelection(pCtx->widget, clipGetAtom(pCtx->widget, "CLIPBOARD"), - CurrentTime); - XtDisownSelection(pCtx->widget, clipGetAtom(pCtx->widget, "PRIMARY"), - CurrentTime); - pCtx->fOwnsClipboard = false; - pCtx->vboxFormats = 0; -} - /** * Take possession of the X11 clipboard (and middle-button selection). */ @@ -1094,10 +1176,7 @@ static void clipNewVBoxFormatsWorker(XtPointer pUserData, RTMemFree(pFormats); LogFlowFunc (("u32Formats=%d\n", u32Formats)); clipInvalidateVBoxCBCache(pCtx); - if (u32Formats == 0) - clipGiveUpX11CB(pCtx); - else - clipGrabX11CB(pCtx, u32Formats); + clipGrabX11CB(pCtx, u32Formats); clipResetX11Formats(pCtx); LogFlowFunc(("returning\n")); } @@ -1250,30 +1329,29 @@ static int clipCTextToWinTxt(Widget widget, unsigned char *pcSrc, /* Intermediate conversion to Utf8 */ int rc = VINF_SUCCESS; XTextProperty property; - char **ppcTmp = NULL; + char **ppcTmp = NULL, *pszTmp = NULL; int cProps; property.value = pcSrc; property.encoding = clipGetAtom(widget, "COMPOUND_TEXT"); property.format = 8; property.nitems = cbSrc; -#ifdef X_HAVE_UTF8_STRING - int xrc = Xutf8TextPropertyToTextList(XtDisplay(widget), &property, - &ppcTmp, &cProps); -#else int xrc = XmbTextPropertyToTextList(XtDisplay(widget), &property, &ppcTmp, &cProps); -#endif if (xrc < 0) rc = ( xrc == XNoMemory ? VERR_NO_MEMORY : xrc == XLocaleNotSupported ? VERR_NOT_SUPPORTED : xrc == XConverterNotFound ? VERR_NOT_SUPPORTED : VERR_UNRESOLVED_ERROR); + /* Convert the text returned to UTF8 */ + if (RT_SUCCESS(rc)) + rc = RTStrCurrentCPToUtf8(&pszTmp, *ppcTmp); /* Now convert the UTF8 to UTF16 */ if (RT_SUCCESS(rc)) - rc = clipUtf8ToWinTxt(*ppcTmp, strlen(*ppcTmp), ppwszDest, pcbDest); + rc = clipUtf8ToWinTxt(pszTmp, strlen(pszTmp), ppwszDest, pcbDest); if (ppcTmp != NULL) XFreeStringList(ppcTmp); + RTStrFree(pszTmp); LogFlowFunc(("Returning %Rrc\n", rc)); if (pcbDest) LogFlowFunc(("*pcbDest=%u\n", *pcbDest)); @@ -1394,6 +1472,7 @@ static void clipConvertX11CB(Widget widget, XtPointer pClientData, (PRTUTF16 *) &pvDest, &cbDest); break; case UTF8: + case TEXT: { /* If we are given broken Utf-8, we treat it as Latin1. Is * this acceptable? */ @@ -1422,8 +1501,8 @@ static void clipConvertX11CB(Widget widget, XtPointer pClientData, * data, as we have no way of telling when new data really does * arrive. */ clipReportFormatsToVBox(pCtx); - else - clipReportEmptyX11CB(pCtx); + // else + // clipReportEmptyX11CB(pCtx); LogFlowFunc(("rc=%Rrc\n", rc)); } @@ -1514,6 +1593,12 @@ int ClipRequestDataFromX11(CLIPBACKEND *pCtx, uint32_t u32Format, #ifdef TESTCASE +/** @todo This unit test currently works by emulating the X11 and X toolkit + * APIs to exercise the code, since I didn't want to rewrite the code too much + * when I wrote the tests. However, this makes it rather ugly and hard to + * understand. Anyone doing any work on the code should feel free to + * rewrite the tests and the code to make them cleaner and more readable. */ + #include <iprt/initterm.h> #include <iprt/stream.h> #include <poll.h> @@ -1535,14 +1620,6 @@ void clipSchedulePoller(CLIPBACKEND *pCtx, g_pPollerData = (XtPointer)pCtx; } -static bool clipPollTargets() -{ - if (!g_pfnPoller) - return false; - g_pfnPoller(g_pPollerData, NULL); - return true; -} - /* For the purpose of the test case, we just execute the procedure to be * scheduled, as we are running single threaded. */ void clipQueueToEventThread(XtAppContext app_context, @@ -1754,7 +1831,7 @@ Boolean XtConvertAndStore(Widget widget, _Xconst _XtString from_type, /* The current values of the X selection, which will be returned to the * XtGetSelectionValue callback. */ -static Atom g_selTarget = 0; +static Atom g_selTarget[1] = { 0 }; static Atom g_selType = 0; static const void *g_pSelData = NULL; static unsigned long g_cSelData = 0; @@ -1772,11 +1849,11 @@ void XtGetSelectionValue(Widget widget, Atom selection, Atom target, if ( ( selection != clipGetAtom(NULL, "PRIMARY") && selection != clipGetAtom(NULL, "CLIPBOARD") && selection != clipGetAtom(NULL, "TARGETS")) - || ( target != g_selTarget + || ( target != g_selTarget[0] && target != clipGetAtom(NULL, "TARGETS"))) { /* Otherwise this is probably a caller error. */ - Assert(target != g_selTarget); + Assert(target != g_selTarget[0]); callback(widget, closure, &selection, &type, NULL, &count, &format); /* Could not convert to target. */ return; @@ -1789,7 +1866,7 @@ void XtGetSelectionValue(Widget widget, Atom selection, Atom target, else pValue = (XtPointer) RTMemDup(&g_selTarget, sizeof(g_selTarget)); type = g_fTargetsTimeout ? XT_CONVERT_FAIL : XA_ATOM; - count = g_fTargetsFailure ? 0 : 1; + count = g_fTargetsFailure ? 0 : RT_ELEMENTS(g_selTarget); format = 32; } else @@ -1823,6 +1900,11 @@ static uint32_t clipQueryFormats() return g_fX11Formats; } +static void clipInvalidateFormats() +{ + g_fX11Formats = ~0; +} + /* Does our clipboard code currently own the selection? */ static bool g_ownsSel = false; /* The procedure that is called when we should convert the selection to a @@ -1887,7 +1969,7 @@ static void clipSetSelectionValues(const char *pcszTarget, Atom type, unsigned long count, int format) { Atom clipAtom = clipGetAtom(NULL, "CLIPBOARD"); - g_selTarget = clipGetAtom(NULL, pcszTarget); + g_selTarget[0] = clipGetAtom(NULL, pcszTarget); g_selType = type; g_pSelData = data; g_cSelData = count; @@ -1899,6 +1981,11 @@ static void clipSetSelectionValues(const char *pcszTarget, Atom type, g_fTargetsFailure = false; } +static void clipSendTargetUpdate(CLIPBACKEND *pCtx) +{ + clipUpdateX11Targets(pCtx, g_selTarget, RT_ELEMENTS(g_selTarget)); +} + /* Configure if and how the X11 TARGETS clipboard target will fail */ static void clipSetTargetsFailure(bool fTimeout, bool fFailure) { @@ -1995,9 +2082,8 @@ static bool testStringFromX11(CLIPBACKEND *pCtx, const char *pcszExp, int rcExp) { bool retval = false; - if (!clipPollTargets()) - RTPrintf("Failed to poll for targets\n"); - else if (clipQueryFormats() != VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT) + clipSendTargetUpdate(pCtx); + if (clipQueryFormats() != VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT) RTPrintf("Wrong targets reported: %02X\n", clipQueryFormats()); else { @@ -2054,9 +2140,8 @@ static bool testLatin1FromX11(CLIPBACKEND *pCtx,const char *pcszExp, int rcExp) { bool retval = false; - if (!clipPollTargets()) - RTPrintf("Failed to poll for targets\n"); - else if (clipQueryFormats() != VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT) + clipSendTargetUpdate(pCtx); + if (clipQueryFormats() != VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT) RTPrintf("Wrong targets reported: %02X\n", clipQueryFormats()); else { @@ -2272,6 +2357,17 @@ int main() if (!testLatin1FromX11(pCtx, "Georges Dupr\xEA", VINF_SUCCESS)) ++cErrs; + /*** Unknown X11 format ***/ + RTPrintf(TEST_NAME ": TESTING handling of an unknown X11 format\n"); + clipInvalidateFormats(); + clipSetSelectionValues("CLIPBOARD", XA_STRING, "Test", + sizeof("Test"), 8); + clipSendTargetUpdate(pCtx); + if (clipQueryFormats() != 0) + { + RTPrintf("Failed to send a format update notification\n"); + ++cErrs; + } /*** Timeout from X11 ***/ RTPrintf(TEST_NAME ": TESTING X11 timeout\n"); @@ -2299,6 +2395,16 @@ int main() ++cErrs; } + /*** Ensure that VBox is notified when we return the CB to X11 ***/ + RTPrintf(TEST_NAME ": TESTING notification of switch to X11 clipboard\n"); + clipInvalidateFormats(); + clipReleaseCB(pCtx); + if (clipQueryFormats() != 0) + { + RTPrintf("Failed to send a format update (release) notification\n"); + ++cErrs; + } + /*** request for an invalid VBox format from X11 ***/ RTPrintf(TEST_NAME ": TESTING a request for an invalid VBox format from X11\n"); ClipRequestDataFromX11(pCtx, 0xffff, pReq); @@ -2315,35 +2421,28 @@ int main() ++cErrs; } - /*** Targets timeout from X11 ***/ - RTPrintf(TEST_NAME ": TESTING X11 targets timeout\n"); + /*** Targets failure from X11 ***/ + RTPrintf(TEST_NAME ": TESTING X11 targets conversion failure\n"); clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world", sizeof("hello world"), 8); - clipSetTargetsFailure(true, false); - if (!clipPollTargets()) - { - RTPrintf("Failed to poll for targets\n"); - ++cErrs; - } - else if (clipQueryFormats() != 0) + clipSetTargetsFailure(false, true); + clipUpdateX11Targets(pCtx, NULL, 0); + if (clipQueryFormats() != 0) { RTPrintf("Wrong targets reported: %02X\n", clipQueryFormats()); ++cErrs; } - /*** Targets failure from X11 ***/ - RTPrintf(TEST_NAME ": TESTING X11 targets conversion failure\n"); - clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world", - sizeof("hello world"), 8); - clipSetTargetsFailure(false, true); - if (!clipPollTargets()) + /*** X11 text format conversion ***/ + RTPrintf(TEST_NAME ": TESTING handling of X11 selection targets\n"); + if (!clipTestTextFormatConversion(pCtx)) { - RTPrintf("Failed to poll for targets\n"); + RTPrintf(TEST_NAME ": Failed to select the right X11 text formats\n"); ++cErrs; } - else if (clipQueryFormats() != 0) + if (!clipTestTargetUpdate(pCtx)) { - RTPrintf("Wrong targets reported: %02X\n", clipQueryFormats()); + RTPrintf(TEST_NAME ": Incorrect reporting of new selection targets\n"); ++cErrs; } @@ -2449,8 +2548,13 @@ int main() ++cErrs; /*** No data in VBox clipboard ***/ - RTPrintf(TEST_NAME ": TESTING reading from VBox with no data\n"); + RTPrintf(TEST_NAME ": TESTING an empty VBox clipboard\n"); clipEmptyVBox(pCtx, VINF_SUCCESS); + if (!pCtx->fOwnsClipboard) + { + RTPrintf(TEST_NAME ": VBox grabbed the clipboard with no data and we ignored it\n"); + ++cErrs; + } if (!testStringFromVBoxFailed(pCtx, "UTF8_STRING")) ++cErrs; @@ -2458,6 +2562,11 @@ int main() RTPrintf(TEST_NAME ": TESTING reading an unknown VBox format\n"); clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2); ClipAnnounceFormatToX11(pCtx, 0xa0000); + if (!pCtx->fOwnsClipboard) + { + RTPrintf(TEST_NAME ": VBox grabbed the clipboard with unknown data and we ignored it\n"); + ++cErrs; + } if (!testStringFromVBoxFailed(pCtx, "UTF8_STRING")) ++cErrs; diff --git a/src/VBox/HostDrivers/Makefile.kmk b/src/VBox/HostDrivers/Makefile.kmk index 1a365f297..4b1e2e79b 100644 --- a/src/VBox/HostDrivers/Makefile.kmk +++ b/src/VBox/HostDrivers/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18973 2009-04-17 06:59:16Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for the VBox Host drivers. # diff --git a/src/VBox/HostDrivers/Support/Makefile.kmk b/src/VBox/HostDrivers/Support/Makefile.kmk index e1ba8db78..8da444a5c 100644 --- a/src/VBox/HostDrivers/Support/Makefile.kmk +++ b/src/VBox/HostDrivers/Support/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19957 2009-05-24 02:47:43Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the support library and the drivers/modules/kexts it uses. # diff --git a/src/VBox/HostDrivers/Support/SUPDrv.c b/src/VBox/HostDrivers/Support/SUPDrv.c index f9090e59d..e3121357d 100644 --- a/src/VBox/HostDrivers/Support/SUPDrv.c +++ b/src/VBox/HostDrivers/Support/SUPDrv.c @@ -1,4 +1,4 @@ -/* $Revision: 20982 $ */ +/* $Revision: 49191 $ */ /** @file * VBoxDrv - The VirtualBox Support Driver - Common code. */ diff --git a/src/VBox/HostDrivers/Support/SUPDrvIDC.h b/src/VBox/HostDrivers/Support/SUPDrvIDC.h index 3e34a765f..f2954f374 100644 --- a/src/VBox/HostDrivers/Support/SUPDrvIDC.h +++ b/src/VBox/HostDrivers/Support/SUPDrvIDC.h @@ -1,4 +1,4 @@ -/* $Id: SUPDrvIDC.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: SUPDrvIDC.h $ */ /** @file * VirtualBox Support Driver - Inter-Driver Communciation (IDC) definitions. */ diff --git a/src/VBox/HostDrivers/Support/SUPDrvIOC.h b/src/VBox/HostDrivers/Support/SUPDrvIOC.h index 9daba776a..4bbf04413 100644 --- a/src/VBox/HostDrivers/Support/SUPDrvIOC.h +++ b/src/VBox/HostDrivers/Support/SUPDrvIOC.h @@ -1,4 +1,4 @@ -/* $Revision: 20860 $ */ +/* $Revision: 49004 $ */ /** @file * VirtualBox Support Driver - IOCtl definitions. */ diff --git a/src/VBox/HostDrivers/Support/SUPDrvInternal.h b/src/VBox/HostDrivers/Support/SUPDrvInternal.h index c117af43e..f51717f44 100644 --- a/src/VBox/HostDrivers/Support/SUPDrvInternal.h +++ b/src/VBox/HostDrivers/Support/SUPDrvInternal.h @@ -1,4 +1,4 @@ -/* $Revision: 20954 $ */ +/* $Revision: 49134 $ */ /** @file * VirtualBox Support Driver - Internal header. */ diff --git a/src/VBox/HostDrivers/Support/SUPLib.cpp b/src/VBox/HostDrivers/Support/SUPLib.cpp index 65047197e..fcb3c5d76 100644 --- a/src/VBox/HostDrivers/Support/SUPLib.cpp +++ b/src/VBox/HostDrivers/Support/SUPLib.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPLib.cpp 20866 2009-06-23 19:33:23Z vboxsync $ */ +/* $Id: SUPLib.cpp $ */ /** @file * VirtualBox Support Library - Common code. */ diff --git a/src/VBox/HostDrivers/Support/SUPLibInternal.h b/src/VBox/HostDrivers/Support/SUPLibInternal.h index 5a8326e07..de997a39b 100644 --- a/src/VBox/HostDrivers/Support/SUPLibInternal.h +++ b/src/VBox/HostDrivers/Support/SUPLibInternal.h @@ -1,4 +1,4 @@ -/* $Id: SUPLibInternal.h 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: SUPLibInternal.h $ */ /** @file * VirtualBox Support Library - Internal header. */ diff --git a/src/VBox/HostDrivers/Support/SUPLibSem.cpp b/src/VBox/HostDrivers/Support/SUPLibSem.cpp index f9074c5bf..a60b4c70b 100644 --- a/src/VBox/HostDrivers/Support/SUPLibSem.cpp +++ b/src/VBox/HostDrivers/Support/SUPLibSem.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPLibSem.cpp 19894 2009-05-21 15:52:49Z vboxsync $ */ +/* $Id: SUPLibSem.cpp $ */ /** @file * VirtualBox Support Library - Semaphores, ring-3 implementation. */ diff --git a/src/VBox/HostDrivers/Support/SUPR0.def b/src/VBox/HostDrivers/Support/SUPR0.def index 79925f844..5f890a1f1 100644 --- a/src/VBox/HostDrivers/Support/SUPR0.def +++ b/src/VBox/HostDrivers/Support/SUPR0.def @@ -1,4 +1,4 @@ -; $Id: SUPR0.def 20315 2009-06-05 12:10:39Z vboxsync $ +; $Id: SUPR0.def $ ;; @file ; VirtualBox Support Driver - Built-in exports. ; diff --git a/src/VBox/HostDrivers/Support/SUPR0IdcClient.c b/src/VBox/HostDrivers/Support/SUPR0IdcClient.c index fed29823d..11f668b92 100644 --- a/src/VBox/HostDrivers/Support/SUPR0IdcClient.c +++ b/src/VBox/HostDrivers/Support/SUPR0IdcClient.c @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClient.c 11794 2008-08-29 09:13:37Z vboxsync $ */ +/* $Id: SUPR0IdcClient.c $ */ /** @file * VirtualBox Support Driver - IDC Client Lib, Core. */ diff --git a/src/VBox/HostDrivers/Support/SUPR0IdcClientComponent.c b/src/VBox/HostDrivers/Support/SUPR0IdcClientComponent.c index 523b0c5e5..b88c2c73e 100644 --- a/src/VBox/HostDrivers/Support/SUPR0IdcClientComponent.c +++ b/src/VBox/HostDrivers/Support/SUPR0IdcClientComponent.c @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClientComponent.c 10258 2008-07-04 23:31:26Z vboxsync $ */ +/* $Id: SUPR0IdcClientComponent.c $ */ /** @file * VirtualBox Support Driver - IDC Client Lib, Component APIs. */ diff --git a/src/VBox/HostDrivers/Support/SUPR0IdcClientInternal.h b/src/VBox/HostDrivers/Support/SUPR0IdcClientInternal.h index eeb075bb7..f3bc936b2 100644 --- a/src/VBox/HostDrivers/Support/SUPR0IdcClientInternal.h +++ b/src/VBox/HostDrivers/Support/SUPR0IdcClientInternal.h @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClientInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: SUPR0IdcClientInternal.h $ */ /** @file * VirtualBox Support Driver - Internal header for the IDC client library. */ diff --git a/src/VBox/HostDrivers/Support/SUPR0IdcClientStubs.c b/src/VBox/HostDrivers/Support/SUPR0IdcClientStubs.c index 7a21a84c9..53b48f988 100644 --- a/src/VBox/HostDrivers/Support/SUPR0IdcClientStubs.c +++ b/src/VBox/HostDrivers/Support/SUPR0IdcClientStubs.c @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClientStubs.c 10258 2008-07-04 23:31:26Z vboxsync $ */ +/* $Id: SUPR0IdcClientStubs.c $ */ /** @file * VirtualBox Support Driver - IDC Client Lib, Stubs for SUPR0 APIs. */ diff --git a/src/VBox/HostDrivers/Support/SUPR3HardenedIPRT.cpp b/src/VBox/HostDrivers/Support/SUPR3HardenedIPRT.cpp index 24dd3d70a..3e86a7069 100644 --- a/src/VBox/HostDrivers/Support/SUPR3HardenedIPRT.cpp +++ b/src/VBox/HostDrivers/Support/SUPR3HardenedIPRT.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPR3HardenedIPRT.cpp 19924 2009-05-22 21:52:47Z vboxsync $ */ +/* $Id: SUPR3HardenedIPRT.cpp $ */ /** @file * VirtualBox Support Library - Hardened Support Routines using IPRT. */ diff --git a/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp b/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp index a6e02b520..094e6b577 100644 --- a/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp +++ b/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPR3HardenedMain.cpp 19924 2009-05-22 21:52:47Z vboxsync $ */ +/* $Id: SUPR3HardenedMain.cpp $ */ /** @file * VirtualBox Support Library - Hardened main(). */ diff --git a/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp b/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp index 9aabafdcc..ccf3e0f58 100644 --- a/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp +++ b/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPR3HardenedVerify.cpp 19924 2009-05-22 21:52:47Z vboxsync $ */ +/* $Id: SUPR3HardenedVerify.cpp $ */ /** @file * VirtualBox Support Library - Verification of Hardened Installation. */ diff --git a/src/VBox/HostDrivers/Support/SUPSvc.cpp b/src/VBox/HostDrivers/Support/SUPSvc.cpp index acf7ff293..ef0bd9fc9 100644 --- a/src/VBox/HostDrivers/Support/SUPSvc.cpp +++ b/src/VBox/HostDrivers/Support/SUPSvc.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPSvc.cpp 11725 2008-08-27 22:21:47Z vboxsync $ */ +/* $Id: SUPSvc.cpp $ */ /** @file * VirtualBox Support Service - Common Code. */ diff --git a/src/VBox/HostDrivers/Support/SUPSvcGlobal.cpp b/src/VBox/HostDrivers/Support/SUPSvcGlobal.cpp index 585a29377..2fe724dd1 100644 --- a/src/VBox/HostDrivers/Support/SUPSvcGlobal.cpp +++ b/src/VBox/HostDrivers/Support/SUPSvcGlobal.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPSvcGlobal.cpp 11725 2008-08-27 22:21:47Z vboxsync $ */ +/* $Id: SUPSvcGlobal.cpp $ */ /** @file * VirtualBox Support Service - The Global Service. */ diff --git a/src/VBox/HostDrivers/Support/SUPSvcGrant.cpp b/src/VBox/HostDrivers/Support/SUPSvcGrant.cpp index ed05d64d8..320031714 100644 --- a/src/VBox/HostDrivers/Support/SUPSvcGrant.cpp +++ b/src/VBox/HostDrivers/Support/SUPSvcGrant.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPSvcGrant.cpp 11725 2008-08-27 22:21:47Z vboxsync $ */ +/* $Id: SUPSvcGrant.cpp $ */ /** @file * VirtualBox Support Service - The Grant Service. */ diff --git a/src/VBox/HostDrivers/Support/SUPSvcInternal.h b/src/VBox/HostDrivers/Support/SUPSvcInternal.h index ec3e6fefe..6d4ece07e 100644 --- a/src/VBox/HostDrivers/Support/SUPSvcInternal.h +++ b/src/VBox/HostDrivers/Support/SUPSvcInternal.h @@ -1,4 +1,4 @@ -/* $Id: SUPSvcInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: SUPSvcInternal.h $ */ /** @file * VirtualBox Support Service - Internal header. */ diff --git a/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp b/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp index 13a9c1db8..2f2e404a1 100644 --- a/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp +++ b/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: $ */ +/* $Id: $ */ /** @file * * VBox host drivers - Ring-0 support drivers - Darwin host: diff --git a/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp b/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp index 21b0efef9..3083e6799 100644 --- a/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp +++ b/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: $ */ +/* $Id: $ */ /** @file * VirtualBox Support Library - Darwin specific parts. */ diff --git a/src/VBox/HostDrivers/Support/darwin/SUPR0IdcClient-darwin.c b/src/VBox/HostDrivers/Support/darwin/SUPR0IdcClient-darwin.c index 1351f1cb2..bcb1603e6 100644 --- a/src/VBox/HostDrivers/Support/darwin/SUPR0IdcClient-darwin.c +++ b/src/VBox/HostDrivers/Support/darwin/SUPR0IdcClient-darwin.c @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClient-darwin.c 10262 2008-07-04 23:42:33Z vboxsync $ */ +/* $Id: SUPR0IdcClient-darwin.c $ */ /** @file * VirtualBox Support Driver - IDC Client Lib, Darwin Specific Code. */ diff --git a/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c b/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c index f58bb8b3e..f6413eb11 100644 --- a/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c +++ b/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: SUPDrv-freebsd.c 20106 2009-05-27 19:47:57Z vboxsync $ */ +/* $Id: SUPDrv-freebsd.c $ */ /** @file * VBoxDrv - The VirtualBox Support Driver - FreeBSD specifics. */ diff --git a/src/VBox/HostDrivers/Support/freebsd/SUPLib-freebsd.cpp b/src/VBox/HostDrivers/Support/freebsd/SUPLib-freebsd.cpp index acd3f43b7..b98f963a8 100644 --- a/src/VBox/HostDrivers/Support/freebsd/SUPLib-freebsd.cpp +++ b/src/VBox/HostDrivers/Support/freebsd/SUPLib-freebsd.cpp @@ -1,4 +1,4 @@ -/* $Id: $ */ +/* $Id: $ */ /** @file * VirtualBox Support Library - FreeBSD specific parts. */ diff --git a/src/VBox/HostDrivers/Support/freebsd/SUPR0IdcClient-freebsd.c b/src/VBox/HostDrivers/Support/freebsd/SUPR0IdcClient-freebsd.c index f9d0000eb..307505d6b 100644 --- a/src/VBox/HostDrivers/Support/freebsd/SUPR0IdcClient-freebsd.c +++ b/src/VBox/HostDrivers/Support/freebsd/SUPR0IdcClient-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClient-freebsd.c 10258 2008-07-04 23:31:26Z vboxsync $ */ +/* $Id: SUPR0IdcClient-freebsd.c $ */ /** @file * VirtualBox Support Driver - IDC Client Lib, FreeBSD Specific Code. */ diff --git a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c index ae4cdbb1c..abac70316 100644 --- a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c +++ b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c @@ -1,4 +1,4 @@ -/* $Rev: 17064 $ */ +/* $Rev: 43287 $ */ /** @file * VBoxDrv - The VirtualBox Support Driver - Linux specifics. */ diff --git a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.mod.c b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.mod.c index 40a54909a..1b6094265 100644 --- a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.mod.c +++ b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.mod.c @@ -1,4 +1,4 @@ -/* $Id: SUPDrv-linux.mod.c 10662 2008-07-15 14:36:00Z vboxsync $ */ +/* $Id: SUPDrv-linux.mod.c $ */ /** @file * VBoxDrv - The VirtualBox Support Driver - Autogenerated Linux code. * This is checked in to assist syntax checking the module. diff --git a/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp b/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp index 2995a504c..309fc06d7 100644 --- a/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp +++ b/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPLib-linux.cpp 16446 2009-02-01 21:19:17Z vboxsync $ */ +/* $Id: SUPLib-linux.cpp $ */ /** @file * VirtualBox Support Library - GNU/Linux specific parts. */ diff --git a/src/VBox/HostDrivers/Support/linux/SUPR0IdcClient-linux.c b/src/VBox/HostDrivers/Support/linux/SUPR0IdcClient-linux.c index 90abb0a92..d725cf5fb 100644 --- a/src/VBox/HostDrivers/Support/linux/SUPR0IdcClient-linux.c +++ b/src/VBox/HostDrivers/Support/linux/SUPR0IdcClient-linux.c @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClient-linux.c 10258 2008-07-04 23:31:26Z vboxsync $ */ +/* $Id: SUPR0IdcClient-linux.c $ */ /** @file * VirtualBox Support Driver - IDC Client Lib, Linux Specific Code. */ diff --git a/src/VBox/HostDrivers/Support/linux/files_vboxdrv b/src/VBox/HostDrivers/Support/linux/files_vboxdrv index 82d896703..82d896703 100644..100755 --- a/src/VBox/HostDrivers/Support/linux/files_vboxdrv +++ b/src/VBox/HostDrivers/Support/linux/files_vboxdrv diff --git a/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp b/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp index c97e49120..3de7bdc7a 100644 --- a/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp +++ b/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPDrv-os2.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: SUPDrv-os2.cpp $ */ /** @file * VBoxDrv - The VirtualBox Support Driver - OS/2 specifics. */ diff --git a/src/VBox/HostDrivers/Support/os2/SUPDrvA-os2.asm b/src/VBox/HostDrivers/Support/os2/SUPDrvA-os2.asm index 4498a58df..5992ecd16 100644 --- a/src/VBox/HostDrivers/Support/os2/SUPDrvA-os2.asm +++ b/src/VBox/HostDrivers/Support/os2/SUPDrvA-os2.asm @@ -1,4 +1,4 @@ -; $Id: SUPDrvA-os2.asm 10729 2008-07-17 15:05:47Z vboxsync $ +; $Id: SUPDrvA-os2.asm $ ;; @file ; VBoxDrv - OS/2 assembly file, the first file in the link. ; diff --git a/src/VBox/HostDrivers/Support/os2/SUPLib-os2.cpp b/src/VBox/HostDrivers/Support/os2/SUPLib-os2.cpp index fee169bfc..4c2ddaa34 100644 --- a/src/VBox/HostDrivers/Support/os2/SUPLib-os2.cpp +++ b/src/VBox/HostDrivers/Support/os2/SUPLib-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPLib-os2.cpp 13865 2008-11-05 14:14:11Z vboxsync $ */ +/* $Id: SUPLib-os2.cpp $ */ /** @file * VirtualBox Support Library - OS/2 specific parts. */ diff --git a/src/VBox/HostDrivers/Support/os2/SUPR0IdcClient-os2.c b/src/VBox/HostDrivers/Support/os2/SUPR0IdcClient-os2.c index ef05452ec..304bff00b 100644 --- a/src/VBox/HostDrivers/Support/os2/SUPR0IdcClient-os2.c +++ b/src/VBox/HostDrivers/Support/os2/SUPR0IdcClient-os2.c @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClient-os2.c 10258 2008-07-04 23:31:26Z vboxsync $ */ +/* $Id: SUPR0IdcClient-os2.c $ */ /** @file * VirtualBox Support Driver - IDC Client Lib, OS/2 Specific Code. */ diff --git a/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c b/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c index ff6c0c130..a8fcb26a0 100644 --- a/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c +++ b/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: SUPDrv-solaris.c 19271 2009-04-30 10:13:02Z vboxsync $ */ +/* $Id: SUPDrv-solaris.c $ */ /** @file * VBoxDrv - The VirtualBox Support Driver - Solaris specifics. */ diff --git a/src/VBox/HostDrivers/Support/solaris/SUPLib-solaris.cpp b/src/VBox/HostDrivers/Support/solaris/SUPLib-solaris.cpp index b4dbdd82f..8db0c8c62 100644 --- a/src/VBox/HostDrivers/Support/solaris/SUPLib-solaris.cpp +++ b/src/VBox/HostDrivers/Support/solaris/SUPLib-solaris.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPLib-solaris.cpp 13865 2008-11-05 14:14:11Z vboxsync $ */ +/* $Id: SUPLib-solaris.cpp $ */ /** @file * VirtualBox Support Library - Solaris specific parts. */ diff --git a/src/VBox/HostDrivers/Support/solaris/SUPR0IdcClient-solaris.c b/src/VBox/HostDrivers/Support/solaris/SUPR0IdcClient-solaris.c index f6dd151e0..c0fd3496d 100644 --- a/src/VBox/HostDrivers/Support/solaris/SUPR0IdcClient-solaris.c +++ b/src/VBox/HostDrivers/Support/solaris/SUPR0IdcClient-solaris.c @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClient-solaris.c 10258 2008-07-04 23:31:26Z vboxsync $ */ +/* $Id: SUPR0IdcClient-solaris.c $ */ /** @file * VirtualBox Support Driver - IDC Client Lib, Solaris Specific Code. */ diff --git a/src/VBox/HostDrivers/Support/testcase/Makefile.kmk b/src/VBox/HostDrivers/Support/testcase/Makefile.kmk index 7cea17c7c..e47ff04c5 100644 --- a/src/VBox/HostDrivers/Support/testcase/Makefile.kmk +++ b/src/VBox/HostDrivers/Support/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20903 2009-06-24 19:32:12Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the SUPLib testcases. # diff --git a/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp b/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp index 2ff87bcef..ca8aee79a 100644 --- a/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp +++ b/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPLoggerCtl.cpp 18246 2009-03-25 11:36:34Z vboxsync $ */ +/* $Id: SUPLoggerCtl.cpp $ */ /** @file * SUPLoggerCtl - Support Driver Logger Control. */ diff --git a/src/VBox/HostDrivers/Support/testcase/tstContiguous.cpp b/src/VBox/HostDrivers/Support/testcase/tstContiguous.cpp index c5dbdeabd..21ed81489 100644 --- a/src/VBox/HostDrivers/Support/testcase/tstContiguous.cpp +++ b/src/VBox/HostDrivers/Support/testcase/tstContiguous.cpp @@ -1,4 +1,4 @@ -/* $Id: tstContiguous.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: tstContiguous.cpp $ */ /** @file * VBox Support Driver - Contiguous Memory Testcase (ring-3). */ diff --git a/src/VBox/HostDrivers/Support/testcase/tstInt.cpp b/src/VBox/HostDrivers/Support/testcase/tstInt.cpp index fc2374800..4bedcad47 100644 --- a/src/VBox/HostDrivers/Support/testcase/tstInt.cpp +++ b/src/VBox/HostDrivers/Support/testcase/tstInt.cpp @@ -1,4 +1,4 @@ -/** $Id: tstInt.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/** $Id: tstInt.cpp $ */ /** @file * Testcase: Test the interrupt gate feature of the support library. */ diff --git a/src/VBox/HostDrivers/Support/testcase/tstPage.cpp b/src/VBox/HostDrivers/Support/testcase/tstPage.cpp index 5a12a948d..461e40d51 100644 --- a/src/VBox/HostDrivers/Support/testcase/tstPage.cpp +++ b/src/VBox/HostDrivers/Support/testcase/tstPage.cpp @@ -1,4 +1,4 @@ -/* $Id: tstPage.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: tstPage.cpp $ */ /** @file * SUP Testcase - Page allocation interface (ring 3). */ diff --git a/src/VBox/HostDrivers/Support/testcase/tstSupSem-Zombie.cpp b/src/VBox/HostDrivers/Support/testcase/tstSupSem-Zombie.cpp index b4e5d7c13..b1cfee66a 100644 --- a/src/VBox/HostDrivers/Support/testcase/tstSupSem-Zombie.cpp +++ b/src/VBox/HostDrivers/Support/testcase/tstSupSem-Zombie.cpp @@ -1,4 +1,4 @@ -/* $Id: tstSupSem-Zombie.cpp 20905 2009-06-24 21:38:42Z vboxsync $ */ +/* $Id: tstSupSem-Zombie.cpp $ */ /** @file * Support Library Testcase - Ring-3 Semaphore interface - Zombie bugs. */ diff --git a/src/VBox/HostDrivers/Support/testcase/tstSupSem.cpp b/src/VBox/HostDrivers/Support/testcase/tstSupSem.cpp index b43e026bd..130409794 100644 --- a/src/VBox/HostDrivers/Support/testcase/tstSupSem.cpp +++ b/src/VBox/HostDrivers/Support/testcase/tstSupSem.cpp @@ -1,4 +1,4 @@ -/* $Id: tstSupSem.cpp 20903 2009-06-24 19:32:12Z vboxsync $ */ +/* $Id: tstSupSem.cpp $ */ /** @file * Support Library Testcase - Ring-3 Semaphore interface. */ diff --git a/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp b/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp index 84e6bf0ee..f4f14d995 100644 --- a/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp +++ b/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPDrv-win.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: SUPDrv-win.cpp $ */ /** @file * VBoxDrv - The VirtualBox Support Driver - Windows NT specifics. */ diff --git a/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp b/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp index 8301c4529..913f1b291 100644 --- a/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp +++ b/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPLib-win.cpp 19924 2009-05-22 21:52:47Z vboxsync $ */ +/* $Id: SUPLib-win.cpp $ */ /** @file * VirtualBox Support Library - Windows NT specific parts. */ diff --git a/src/VBox/HostDrivers/Support/win/SUPR0IdcClient-win.c b/src/VBox/HostDrivers/Support/win/SUPR0IdcClient-win.c index 6021ecdd6..8703a8abc 100644 --- a/src/VBox/HostDrivers/Support/win/SUPR0IdcClient-win.c +++ b/src/VBox/HostDrivers/Support/win/SUPR0IdcClient-win.c @@ -1,4 +1,4 @@ -/* $Id: SUPR0IdcClient-win.c 10263 2008-07-05 00:26:17Z vboxsync $ */ +/* $Id: SUPR0IdcClient-win.c $ */ /** @file * VirtualBox Support Driver - IDC Client Lib, Windows Specific Code. */ diff --git a/src/VBox/HostDrivers/Support/win/SUPSvc-win.cpp b/src/VBox/HostDrivers/Support/win/SUPSvc-win.cpp index 4713f355b..5e1f054b9 100644 --- a/src/VBox/HostDrivers/Support/win/SUPSvc-win.cpp +++ b/src/VBox/HostDrivers/Support/win/SUPSvc-win.cpp @@ -1,4 +1,4 @@ -/* $Id: SUPSvc-win.cpp 17091 2009-02-24 19:55:23Z vboxsync $ */ +/* $Id: SUPSvc-win.cpp $ */ /** @file * VirtualBox Support Service - Windows Specific Code. */ diff --git a/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk b/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk index d05427859..6765d83e4 100644 --- a/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk +++ b/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18973 2009-04-17 06:59:16Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Network Adapter Driver (VBoxNetAdp). # diff --git a/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c b/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c index cb0ec6345..d35bf96f1 100644 --- a/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c +++ b/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c @@ -1,4 +1,4 @@ -/* $Id: VBoxNetAdp.c 18973 2009-04-17 06:59:16Z vboxsync $ */ +/* $Id: VBoxNetAdp.c $ */ /** @file * VBoxNetAdp - Virtual Network Adapter Driver (Host), Common Code. */ diff --git a/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdpInternal.h b/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdpInternal.h index 661cd738f..2c54135e6 100644 --- a/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdpInternal.h +++ b/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdpInternal.h @@ -1,4 +1,4 @@ -/* $Id: VBoxNetAdpInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxNetAdpInternal.h $ */ /** @file * VBoxNetAdp - Network Filter Driver (Host), Internal Header. */ diff --git a/src/VBox/HostDrivers/VBoxNetAdp/darwin/VBoxNetAdp-darwin.cpp b/src/VBox/HostDrivers/VBoxNetAdp/darwin/VBoxNetAdp-darwin.cpp index eaeaf0a68..e21a9ea66 100644 --- a/src/VBox/HostDrivers/VBoxNetAdp/darwin/VBoxNetAdp-darwin.cpp +++ b/src/VBox/HostDrivers/VBoxNetAdp/darwin/VBoxNetAdp-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxNetAdp-darwin.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxNetAdp-darwin.cpp $ */ /** @file * VBoxNetAdp - Virtual Network Adapter Driver (Host), Darwin Specific Code. */ diff --git a/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c b/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c index c6881172c..6471e3f8c 100644 --- a/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c +++ b/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c @@ -1,4 +1,4 @@ -/* $Id: VBoxNetAdp-linux.c 20802 2009-06-23 06:32:16Z vboxsync $ */ +/* $Id: VBoxNetAdp-linux.c $ */ /** @file * VBoxNetAdp - Virtual Network Adapter Driver (Host), Linux Specific Code. */ diff --git a/src/VBox/HostDrivers/VBoxNetAdp/linux/dkms.conf b/src/VBox/HostDrivers/VBoxNetAdp/linux/dkms.conf index 6b83a7225..b3fc058f4 100644 --- a/src/VBox/HostDrivers/VBoxNetAdp/linux/dkms.conf +++ b/src/VBox/HostDrivers/VBoxNetAdp/linux/dkms.conf @@ -4,4 +4,4 @@ PACKAGE_NAME=vboxnetadp PACKAGE_VERSION=_VERSION_ AUTOINSTALL=yes CLEAN="make -C $dkms_tree/$module/$module_version/build clean" -PRE_BUILD="do_Module.symvers restore $dkms_tree/$module/$module_version/build/Module.symvers" +PRE_BUILD="do_Module.symvers vboxdrv restore $dkms_tree/$module/$module_version/build/Module.symvers" diff --git a/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp b/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp index 54456dd77..54456dd77 100644..100755 --- a/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp +++ b/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp diff --git a/src/VBox/HostDrivers/VBoxNetAdp/solaris/VBoxNetAdp-solaris.c b/src/VBox/HostDrivers/VBoxNetAdp/solaris/VBoxNetAdp-solaris.c index 804e02c49..e9a916995 100644 --- a/src/VBox/HostDrivers/VBoxNetAdp/solaris/VBoxNetAdp-solaris.c +++ b/src/VBox/HostDrivers/VBoxNetAdp/solaris/VBoxNetAdp-solaris.c @@ -1,4 +1,4 @@ -/* $Id: VBoxNetAdp-solaris.c 17803 2009-03-13 10:39:08Z vboxsync $ */ +/* $Id: VBoxNetAdp-solaris.c $ */ /** @file * VBoxNetAdapter - Network Adapter Driver (Host), Solaris Specific Code. */ diff --git a/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk b/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk index 57fa3545e..8b1474dc1 100644 --- a/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk +++ b/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20732 2009-06-19 23:29:12Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Network Filter Driver (VBoxNetFlt). # diff --git a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c index 7f23b296b..2e94197e0 100644 --- a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c +++ b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c @@ -1,4 +1,4 @@ -/* $Id: VBoxNetFlt.c 18064 2009-03-18 12:52:38Z vboxsync $ */ +/* $Id: VBoxNetFlt.c $ */ /** @file * VBoxNetFlt - Network Filter Driver (Host), Common Code. */ diff --git a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h index 87930c9fe..5ef086824 100644 --- a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h +++ b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h @@ -1,4 +1,4 @@ -/* $Id: VBoxNetFltInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxNetFltInternal.h $ */ /** @file * VBoxNetFlt - Network Filter Driver (Host), Internal Header. */ diff --git a/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp b/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp index 340a8674c..fecb5d249 100644 --- a/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp +++ b/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxNetFlt-darwin.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxNetFlt-darwin.cpp $ */ /** @file * VBoxNetFlt - Network Filter Driver (Host), Darwin Specific Code. */ diff --git a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c index 85c65c354..a0a590384 100644 --- a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c +++ b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c @@ -1,4 +1,4 @@ -/* $Id: VBoxNetFlt-linux.c 20414 2009-06-08 19:46:24Z vboxsync $ */ +/* $Id: VBoxNetFlt-linux.c $ */ /** @file * VBoxNetFlt - Network Filter Driver (Host), Linux Specific Code. */ diff --git a/src/VBox/HostDrivers/VBoxNetFlt/linux/files_vboxnetflt b/src/VBox/HostDrivers/VBoxNetFlt/linux/files_vboxnetflt index 95819176e..95819176e 100644..100755 --- a/src/VBox/HostDrivers/VBoxNetFlt/linux/files_vboxnetflt +++ b/src/VBox/HostDrivers/VBoxNetFlt/linux/files_vboxnetflt diff --git a/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c b/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c index 062b30e3d..8c4652f33 100644 --- a/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c +++ b/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c @@ -1,4 +1,4 @@ -/* $Id: VBoxNetFlt-solaris.c 19884 2009-05-21 15:03:12Z vboxsync $ */ +/* $Id: VBoxNetFlt-solaris.c $ */ /** @file * VBoxNetFlt - Network Filter Driver (Host), Solaris Specific Code. */ diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/Makefile.kup b/src/VBox/HostDrivers/VBoxNetFlt/win/Makefile.kup new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/Makefile.kup diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/NetAdpInstall.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/NetAdpInstall.cpp new file mode 100644 index 000000000..6c870b5aa --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/NetAdpInstall.cpp @@ -0,0 +1,93 @@ +/* $Id: NetAdpInstall.cpp $ */ +/** @file + * NetAdpInstall - VBoxNetAdp installer command line tool + */ + +/* + * Copyright (C) 2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +#include <vbox/WinNetConfig.h> +#include <stdio.h> + +static VOID winNetCfgLogger (LPCWSTR szString) +{ + wprintf(L"%s", szString); +} + +static int InstallNetAdp() +{ + int r = 0; + VBoxNetCfgWinSetLogging(winNetCfgLogger); + + HRESULT hr = CoInitialize(NULL); + if(hr == S_OK) + { +#ifndef DEBUG_misha + printf("not implemented yet, please use device manager for Host-Only net interface installation.. sorry :( \n"); +#else + /* this installs the Net Adp from the pre-installed driver package, + * it does NOT install the new driver package, so the installation might use old drivers + * or fail in case no NetAdp package is currently installed + * the code is here for debugging NetAdp installation only */ + GUID guid; + BSTR name, errMsg; + printf("adding host-only interface..\n"); + hr = VBoxNetCfgWinCreateHostOnlyNetworkInterface (&guid, &name, &errMsg); + if(hr == S_OK) + { + ULONG ip, mask; + hr = VBoxNetCfgWinGenHostOnlyNetworkNetworkIp(&ip, &mask); + if(hr == S_OK) + { + /* ip returned by VBoxNetCfgWinGenHostOnlyNetworkNetworkIp is a network ip, + * i.e. 192.168.xxx.0, assign 192.168.xxx.1 for the hostonly adapter */ + ip = ip | (1 << 24); + hr = VBoxNetCfgWinEnableStaticIpConfig(&guid, ip, mask); + if(hr != S_OK) + { + printf("VBoxNetCfgWinEnableStaticIpConfig failed: hr = 0x%x\n", hr); + } + } + else + { + printf("VBoxNetCfgWinGenHostOnlyNetworkNetworkIp failed: hr = 0x%x\n", hr); + } + } + else + { + printf("VBoxNetCfgWinCreateHostOnlyNetworkInterface failed: hr = 0x%x\n", hr); + } +#endif + + r = 1; + + CoUninitialize(); + } + else + { + wprintf(L"Error initializing COM (0x%x)\n", hr); + r = 1; + } + + VBoxNetCfgWinSetLogging(NULL); + + return r; +} + +int __cdecl main(int argc, char **argv) +{ + return InstallNetAdp(); +} diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/NetAdpUninstall.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/NetAdpUninstall.cpp new file mode 100644 index 000000000..5c9628980 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/NetAdpUninstall.cpp @@ -0,0 +1,66 @@ +/* $Id: NetAdpUninstall.cpp $ */ +/** @file + * NetAdpUninstall - VBoxNetAdp uninstaller command line tool + */ + +/* + * Copyright (C) 2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +#include <vbox/WinNetConfig.h> +#include <stdio.h> + +static VOID winNetCfgLogger (LPCWSTR szString) +{ + wprintf(L"%s", szString); +} + +static int UninstallNetAdp() +{ + int r = 0; + VBoxNetCfgWinSetLogging(winNetCfgLogger); + + printf("uninstalling all Host-Only interfaces..\n"); + + HRESULT hr = CoInitialize(NULL); + if(hr == S_OK) + { + hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(L"sun_VBoxNetAdp"); + if(hr == S_OK) + { + printf("uninstalled successfully\n"); + } + else + { + printf("uninstall failed, hr = 0x%x\n", hr); + } + + CoUninitialize(); + } + else + { + wprintf(L"Error initializing COM (0x%x)\n", hr); + r = 1; + } + + VBoxNetCfgWinSetLogging(NULL); + + return r; +} + +int __cdecl main(int argc, char **argv) +{ + return UninstallNetAdp(); +} diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/NetFltInstall.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/NetFltInstall.cpp new file mode 100644 index 000000000..3f028adf0 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/NetFltInstall.cpp @@ -0,0 +1,133 @@ +/* $Id: NetFltInstall.cpp $ */ +/** @file + * NetFltInstall - VBoxNetFlt installer command line tool + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +#include <vbox/WinNetConfig.h> +#include <devguid.h> +#include <stdio.h> + +#define NETFLT_ID L"sun_VBoxNetFlt" +#define VBOX_NETCFG_APP_NAME L"NetFltInstall" +#define VBOX_NETFLT_PT_INF L".\\VBoxNetFlt.inf" +#define VBOX_NETFLT_MP_INF L".\\VBoxNetFlt_m.inf" +#define VBOX_NETFLT_RETRIES 10 + + +static VOID winNetCfgLogger (LPCWSTR szString) +{ + wprintf(L"%s", szString); +} + +static int InstallNetFlt() +{ + WCHAR PtInf[MAX_PATH]; + WCHAR MpInf[MAX_PATH]; + INetCfg *pnc; + LPWSTR lpszLockedBy = NULL; + int r = 1; + + VBoxNetCfgWinSetLogging(winNetCfgLogger); + + HRESULT hr = CoInitialize(NULL); + if(hr == S_OK) + { + int i = 0; + do + { + hr = VBoxNetCfgWinQueryINetCfg(TRUE, VBOX_NETCFG_APP_NAME, &pnc, &lpszLockedBy); + if(hr == S_OK) + { + DWORD WinEr; + GetFullPathNameW(VBOX_NETFLT_PT_INF, sizeof(PtInf)/sizeof(PtInf[0]), PtInf, NULL); + WinEr = GetLastError(); + if(WinEr == ERROR_SUCCESS) + { + GetFullPathNameW(VBOX_NETFLT_MP_INF, sizeof(MpInf)/sizeof(MpInf[0]), MpInf, NULL); + WinEr = GetLastError(); + if(WinEr == ERROR_SUCCESS) + { + LPCWSTR aInfs[] = {PtInf, MpInf}; + hr = VBoxNetCfgWinNetFltInstall(pnc, aInfs, 2); + if(hr == S_OK) + { + wprintf(L"installed successfully\n"); + r = 0; + } + else + { + wprintf(L"error installing VBoxNetFlt (0x%x)\n", hr); + } + } + else + { + hr = HRESULT_FROM_WIN32(WinEr); + wprintf(L"error getting full inf path for VBoxNetFlt_m.inf (0x%x)\n", hr); + } + } + else + { + hr = HRESULT_FROM_WIN32(WinEr); + wprintf(L"error getting full inf path for VBoxNetFlt.inf (0x%x)\n", hr); + } + + + VBoxNetCfgWinReleaseINetCfg(pnc, TRUE); + break; + } + else if(hr == NETCFG_E_NO_WRITE_LOCK && lpszLockedBy) + { + if(i < VBOX_NETFLT_RETRIES && !wcscmp(lpszLockedBy, L"6to4svc.dll")) + { + wprintf(L"6to4svc.dll is holding the lock, retrying %d out of %d\n", ++i, VBOX_NETFLT_RETRIES); + CoTaskMemFree(lpszLockedBy); + } + else + { + wprintf(L"Error: write lock is owned by another application (%s), close the application and retry installing\n", lpszLockedBy); + r = 1; + CoTaskMemFree(lpszLockedBy); + break; + } + } + else + { + wprintf(L"Error getting the INetCfg interface (0x%x)\n", hr); + r = 1; + break; + } + } while(true); + + CoUninitialize(); + } + else + { + wprintf(L"Error initializing COM (0x%x)\n", hr); + r = 1; + } + + VBoxNetCfgWinSetLogging(NULL); + + return r; +} + +int __cdecl main(int argc, char **argv) +{ + return InstallNetFlt(); +} diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/NetFltUninstall.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/NetFltUninstall.cpp new file mode 100644 index 000000000..a40f9edc5 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/NetFltUninstall.cpp @@ -0,0 +1,107 @@ +/* $Id: NetFltUninstall.cpp $ */ +/** @file + * NetFltUninstall - VBoxNetFlt uninstaller command line tool + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +#include <vbox/WinNetConfig.h> +#include <stdio.h> + +#define NETFLT_ID L"sun_VBoxNetFlt" +#define VBOX_NETCFG_APP_NAME L"NetFltUninstall" +#define VBOX_NETFLT_PT_INF L".\\VBoxNetFlt.inf" +#define VBOX_NETFLT_MP_INF L".\\VBoxNetFlt_m.inf" +#define VBOX_NETFLT_RETRIES 10 + +static VOID winNetCfgLogger (LPCWSTR szString) +{ + wprintf(L"%s", szString); +} + +static int UninstallNetFlt() +{ + INetCfg *pnc; + LPWSTR lpszLockedBy = NULL; + int r; + + VBoxNetCfgWinSetLogging(winNetCfgLogger); + + HRESULT hr = CoInitialize(NULL); + if(hr == S_OK) + { + int i = 0; + do + { + hr = VBoxNetCfgWinQueryINetCfg(TRUE, VBOX_NETCFG_APP_NAME, &pnc, &lpszLockedBy); + if(hr == S_OK) + { + hr = VBoxNetCfgWinNetFltUninstall(pnc); + if(hr != S_OK) + { + wprintf(L"error uninstalling VBoxNetFlt (0x%x)\n", hr); + r = 1; + } + else + { + wprintf(L"uninstalled successfully\n"); + r = 0; + } + + VBoxNetCfgWinReleaseINetCfg(pnc, TRUE); + break; + } + else if(hr == NETCFG_E_NO_WRITE_LOCK && lpszLockedBy) + { + if(i < VBOX_NETFLT_RETRIES && !wcscmp(lpszLockedBy, L"6to4svc.dll")) + { + wprintf(L"6to4svc.dll is holding the lock, retrying %d out of %d\n", ++i, VBOX_NETFLT_RETRIES); + CoTaskMemFree(lpszLockedBy); + } + else + { + wprintf(L"Error: write lock is owned by another application (%s), close the application and retry uninstalling\n", lpszLockedBy); + r = 1; + CoTaskMemFree(lpszLockedBy); + break; + } + } + else + { + wprintf(L"Error getting the INetCfg interface (0x%x)\n", hr); + r = 1; + break; + } + } while(true); + + CoUninitialize(); + } + else + { + wprintf(L"Error initializing COM (0x%x)\n", hr); + r = 1; + } + + VBoxNetCfgWinSetLogging(NULL); + + return r; +} + +int __cdecl main(int argc, char **argv) +{ + return UninstallNetFlt(); +} diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetAdp.inf b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetAdp.inf new file mode 100644 index 000000000..6907c1e89 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetAdp.inf @@ -0,0 +1,107 @@ +; +; VirtualBox Network Adapter +; + +; +; Copyright (C) 2008 Sun Microsystems, Inc. +; +; 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. +; +; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa +; Clara, CA 95054 USA or visit http://www.sun.com if you need +; additional information or have any questions. +; + +; +; Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. +; Copyright (c) 1993-1999, Microsoft Corporation +; + +[Version] +signature = "$Windows NT$" +;cat CatalogFile = VBoxNetAdp.cat +Class = Net +ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} +Provider = %Provider% +; DriverPackageType=Network +; DriverPackageDisplayName=%VBoxNetAdp_Desc% +;edit-DriverVer=08/13/2008,1.1.0.1 + +[ControlFlags] +;ExcludeFromSelect = sun_VBoxNetAdp + +[SourceDisksNames] +1=%DiskDescription%,"",, + +[SourceDisksFiles] +VBoxNetAdp.sys=1 + +[DestinationDirs] +DefaultDestDir = 12 +VBoxNetAdp.Files.Sys = 12 ; %windir%\System32\drivers + +[Manufacturer] +%Provider% = VBox,NTx86,NTia64,NTamd64 + +; For Win2K +[VBox] +%VBoxNetAdp_Desc% = VBoxNetAdp.ndi, sun_VBoxNetAdp + +; For XP and later +[VBox.NTx86] +%VBoxNetAdp_Desc% = VBoxNetAdp.ndi, sun_VBoxNetAdp + +[VBox.NTia64] +%VBoxNetAdp_Desc% = VBoxNetAdp.ndi, sun_VBoxNetAdp + +[VBox.NTamd64] +%VBoxNetAdp_Desc% = VBoxNetAdp.ndi, sun_VBoxNetAdp + +[VBoxNetAdp.ndi] +Characteristics = 0x4 ; NCF_PHYSICAL +CopyFiles = VBoxNetAdp.Files.Sys +AddReg = VBoxNetAdp.AddReg +BusType = 1 + +[VBoxNetAdp.Files.Sys] +VBoxNetAdp.sys,,,2 + +[VBoxNetAdp.ndi.Services] +AddService = VBoxNetAdp,0x2, VBoxNetAdp.AddService + + +[VBoxNetAdp.AddService] +DisplayName = %VBoxNetAdp_Desc% +ServiceType = 1 ;SERVICE_KERNEL_DRIVER +StartType = 3 ;SERVICE_DEMAND_START +ErrorControl = 1 ;SERVICE_ERROR_NORMAL +ServiceBinary = %12%\VBoxNetAdp.sys +LoadOrderGroup = NDIS + +[VBoxNetAdp.AddReg] +;HKR, , BusNumber, 0, "0" +HKR, Ndi, Service, 0, "VBoxNetAdp" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" + +[VBoxNetAdp.AddService] +; ---------------------------------------------------------------------- +; Add any miniport-specific parameters here. These are params that your +; [filter] device is going to use. +; +;HKR, Parameters, ParameterName, 0x10000, "MultiSz", "Parameter", "Value" +;HKR, Parameters, ParameterName2, 0x10001, 4 + +[Strings] +Provider = "Sun Microsystems, Inc." +VBoxNetAdp_Desc = "VirtualBox Host-Only Ethernet Adapter" +DiskDescription = "VirtualBox Host-Only Ethernet Adapter" + + + diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.c b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.c new file mode 100644 index 000000000..84ccfde7b --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.c @@ -0,0 +1,3680 @@ +/* $Id: VBoxNetFlt-win.c $ */ +/** @file + * VBoxNetFlt - Network Filter Driver (Host), Windows Specific Code. Integration with IntNet/NetFlt + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. + * Copyright (c) 1993-1999, Microsoft Corporation + */ + +#include "VBoxNetFltCommon-win.h" +#include <iprt/thread.h> + +/** represents the job element of the job queue + * see comments for JOB_QUEUE */ +typedef struct _JOB +{ + /** link in the job queue */ + LIST_ENTRY ListEntry; + /** job function to be executed */ + JOB_ROUTINE pRoutine; + /** parameter to be passed to the job function */ + PVOID pContext; + /** event that will be fired on job completion */ + KEVENT CompletionEvent; + /** true if the job manager should use the completion even for completion indication, false-otherwise*/ + bool bUseCompletionEvent; +} JOB, *PJOB; + +/** + * represents the queue of jobs processed by the worker thred + * + * we use the thread to process tasks which are required to be done at passive level + * our callbacks may be called at APC level by IntNet, there are some tasks that we can not create at APC, + * e.g. thread creation. This is why we schedule such jobs to the worker thread working at passive level + */ +typedef struct _JOB_QUEUE +{ + /* jobs */ + LIST_ENTRY Jobs; + /* we are using ExInterlocked..List functions to access the jobs list */ + KSPIN_LOCK Lock; + /** this event is used to initiate a job worker thread kill */ + KEVENT KillEvent; + /** this event is used to notify a worker thread that jobs are added to the queue */ + KEVENT NotifyEvent; + /** worker thread */ + PKTHREAD pThread; +} JOB_QUEUE, *PJOB_QUEUE; + +typedef struct _CREATE_INSTANCE_CONTEXT +{ +#ifndef VBOXNETADP + PNDIS_STRING pOurName; + PNDIS_STRING pBindToName; +#else + NDIS_HANDLE hMiniportAdapter; + NDIS_HANDLE hWrapperConfigurationContext; +#endif + NDIS_STATUS Status; +}CREATE_INSTANCE_CONTEXT, *PCREATE_INSTANCE_CONTEXT; + +/*contexts used for our jobs */ +/* Attach context */ +typedef struct _ATTACH_INFO +{ + PVBOXNETFLTINS pNetFltIf; + PCREATE_INSTANCE_CONTEXT pCreateContext; + bool fRediscovery; + int Status; +}ATTACH_INFO, *PATTACH_INFO; + +/* general worker context */ +typedef struct _WORKER_INFO +{ + PVBOXNETFLTINS pNetFltIf; + int Status; +}WORKER_INFO, *PWORKER_INFO; + +/* idc initialization */ +typedef struct _INIT_IDC_INFO +{ + JOB Job; + bool bInitialized; + volatile bool bStop; + volatile int rc; + KEVENT hCompletionEvent; +}INIT_IDC_INFO, *PINIT_IDC_INFO; + + +/** globals */ + +/** global lock */ +NDIS_SPIN_LOCK g_GlobalLock; +/** global job queue. some operations are required to be done at passive level, e.g. thread creation, adapter bind/unbind initiation, + * while IntNet typically calls us APC_LEVEL, so we just create a system thread in our DriverEntry and enqueue the jobs to that thread */ +static JOB_QUEUE g_JobQueue; +/** + * The (common) global data. + */ +static VBOXNETFLTGLOBALS g_VBoxNetFltGlobals; +volatile static bool g_bIdcInitialized; +INIT_IDC_INFO g_InitIdcInfo; + +UINT g_fPacketDontLoopBack; +UINT g_fPacketIsLoopedBack; + +#define LIST_ENTRY_2_JOB(pListEntry) \ + ( (PJOB)((uint8_t *)(pListEntry) - RT_OFFSETOF(JOB, ListEntry)) ) + +static int vboxNetFltWinAttachToInterface(PVBOXNETFLTINS pThis, void * pContext, bool fRediscovery); +static int vboxNetFltWinConnectIt(PVBOXNETFLTINS pThis); +static int vboxNetFltWinTryFiniIdc(); +static void vboxNetFltWinFiniNetFltBase(); +static int vboxNetFltWinInitNetFltBase(); +static int vboxNetFltWinFiniNetFlt(); +static int vboxNetFltWinStartInitIdcProbing(); +static int vboxNetFltWinStopInitIdcProbing(); + +/** makes the current thread to sleep for the given number of miliseconds */ +DECLHIDDEN(void) vboxNetFltWinSleep(ULONG milis) +{ + RTThreadSleep(milis); +} + +/** wait for the given device to be dereferenced */ +DECLHIDDEN(void) vboxNetFltWinWaitDereference(PADAPT_DEVICE pState) +{ +#ifdef DEBUG + uint64_t StartNanoTS = RTTimeSystemNanoTS(); + uint64_t CurNanoTS; +#endif + Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); + + while (ASMAtomicUoReadU32((volatile uint32_t *)&pState->cReferences)) + { + vboxNetFltWinSleep(2); +#ifdef DEBUG + CurNanoTS = RTTimeSystemNanoTS(); + if(CurNanoTS - StartNanoTS > 20000000) + { + DBGPRINT(("device not idle")); + Assert(0); + break; + } +#endif + } +} + +/** + * mem functions + */ +/* allocates and zeroes the nonpaged memory of a given size */ +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMemAlloc(PVOID* ppMemBuf, UINT cbLength) +{ + NDIS_STATUS fStatus = NdisAllocateMemoryWithTag(ppMemBuf, cbLength, MEM_TAG); + if(fStatus == NDIS_STATUS_SUCCESS) + { + NdisZeroMemory(*ppMemBuf, cbLength); + } + return fStatus; +} + +/* frees memory allocated with vboxNetFltWinMemAlloc */ +DECLHIDDEN(void) vboxNetFltWinMemFree(PVOID pMemBuf) +{ + NdisFreeMemory(pMemBuf, 0, 0); +} + +/* frees ndis buffers used on send/receive */ +static VOID vboxNetFltWinFiniBuffers(PADAPT pAdapt) +{ + /* NOTE: don't check for NULL since NULL is a valid handle */ +#ifndef VBOXNETADP + NdisFreeBufferPool(pAdapt->hSendBufferPoolHandle); +#endif +#ifndef VBOX_NETFLT_ONDEMAND_BIND + NdisFreeBufferPool(pAdapt->hRecvBufferPoolHandle); +#endif +} + +/* initializes ndis buffers used on send/receive */ +static NDIS_STATUS vboxNetFltWinInitBuffers(PADAPT pAdapt) +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + + do + { + /* NOTE: NULL is a valid handle !!! */ +#ifndef VBOXNETADP + NdisAllocateBufferPool(&Status, + &pAdapt->hSendBufferPoolHandle, + TX_BUFFER_POOL_SIZE); + Assert(Status == NDIS_STATUS_SUCCESS); + if (Status != NDIS_STATUS_SUCCESS) + { + break; + } +#endif + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + /* NOTE: NULL is a valid handle !!! */ + NdisAllocateBufferPool(&Status, + &pAdapt->hRecvBufferPoolHandle, + RX_BUFFER_POOL_SIZE); + Assert(Status == NDIS_STATUS_SUCCESS); + if (Status != NDIS_STATUS_SUCCESS) + { +#ifndef VBOXNETADP + NdisFreeBufferPool(pAdapt->hSendBufferPoolHandle); +#endif + break; + } +#endif + } while (FALSE); + + return Status; +} + +/* initializes packet info pool and allocates the cSize packet infos for the pool */ +static NDIS_STATUS vboxNetFltWinPpAllocatePacketInfoPool(PPACKET_INFO_POOL pPool, UINT cSize) +{ + UINT cbBufSize = sizeof(PACKET_INFO)*cSize; + PACKET_INFO * pPacketInfos; + NDIS_STATUS fStatus; + UINT i; + + Assert(cSize > 0); + + INIT_INTERLOCKED_PACKET_QUEUE(&pPool->Queue); + + fStatus = vboxNetFltWinMemAlloc((PVOID*)&pPacketInfos, cbBufSize); + + if(fStatus == NDIS_STATUS_SUCCESS) + { + PPACKET_INFO pInfo; + pPool->pBuffer = pPacketInfos; + + for(i = 0; i < cSize; i++) + { + pInfo = &pPacketInfos[i]; + vboxNetFltWinQuEnqueueTail(&pPool->Queue.Queue, pInfo); + pInfo->pPool = pPool; + } + } + else + { + Assert(0); + } + + return fStatus; +} + +/* frees the packet info pool */ +VOID vboxNetFltWinPpFreePacketInfoPool(PPACKET_INFO_POOL pPool) +{ + vboxNetFltWinMemFree(pPool->pBuffer); + + FINI_INTERLOCKED_PACKET_QUEUE(&pPool->Queue) +} + +/** + * copies one string to another. in case the destination string size is not enough to hold the complete source string + * does nothing and returns NDIS_STATUS_RESOURCES . + */ +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinCopyString(PNDIS_STRING pDst, PNDIS_STRING pSrc) +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + + if(pDst != pSrc) + { + if(pDst->MaximumLength < pSrc->Length) + { + Assert(0); + Status = NDIS_STATUS_RESOURCES; + } + else + { + pDst->Length = pSrc->Length; + + if(pDst->Buffer != pSrc->Buffer) + { + NdisMoveMemory(pDst->Buffer, pSrc->Buffer, pSrc->Length); + } + } + } + return Status; +} + +/************************************************************************************ + * PINTNETSG pSG manipulation functions + ************************************************************************************/ +static void vboxNetFltWinReinitSG(PINTNETSG pSG) +{ + pSG->pvOwnerData = NULL; + pSG->pvUserData = NULL; + pSG->pvUserData2 = NULL; + pSG->cUsers = 1; + pSG->fFlags = INTNETSG_FLAGS_TEMP; + pSG->cSegsUsed = 0; + pSG->cbTotal = 0; +} + +static void vboxNetFltWinInitSG(PINTNETSG pSG, UINT cBufferCount) +{ + pSG->pvOwnerData = NULL; + pSG->pvUserData = NULL; + pSG->pvUserData2 = NULL; + pSG->cUsers = 1; + pSG->fFlags = INTNETSG_FLAGS_TEMP; + pSG->cSegsAlloc = cBufferCount; + pSG->cSegsUsed = 0; + pSG->cbTotal = 0; +} + +/* moves the contents of the given NDIS_BUFFER and all other buffers chained to it to the PINTNETSG + * the PINTNETSG is expected to contain one segment whose bugger is large enough to maintain + * the contents of the given NDIS_BUFFER and all other buffers chained to it */ +static NDIS_STATUS vboxNetFltWinNdisBufferMoveToSG0(PNDIS_BUFFER pBuffer, PINTNETSG pSG) +{ + UINT cbSeg = 0; + PINTNETSEG paSeg; + uint8_t * ptr; + PVOID pVirtualAddress; + UINT cbCurrentLength; + NDIS_STATUS fStatus = NDIS_STATUS_SUCCESS; + + Assert(pSG->cSegsAlloc == 1); + + paSeg = pSG->aSegs; + ptr = (uint8_t*)paSeg->pv; + paSeg->cb = 0; + paSeg->Phys = NIL_RTHCPHYS; + pSG->cbTotal = 0; + + Assert(paSeg->pv); + + while(pBuffer) + { + NdisQueryBufferSafe( + pBuffer, + &pVirtualAddress, + &cbCurrentLength, + NormalPagePriority); + + if(!pVirtualAddress) + { + fStatus = NDIS_STATUS_FAILURE; + break; + } + + pSG->cbTotal += cbCurrentLength; + paSeg->cb += cbCurrentLength; + NdisMoveMemory(ptr, pVirtualAddress, cbCurrentLength); + ptr += cbCurrentLength; + + NdisGetNextBuffer( + pBuffer, + &pBuffer); + } + + if(fStatus == NDIS_STATUS_SUCCESS) + { + pSG->cSegsUsed = 1; + Assert(pSG->cbTotal == paSeg->cb); + } + return fStatus; +} + +/* converts the PNDIS_BUFFER to PINTNETSG by making the PINTNETSG segments to point to the memory buffers the + * ndis buffer(s) point to (as opposed to vboxNetFltWinNdisBufferMoveToSG0 which copies the memory from ndis buffers(s) to PINTNETSG) */ +static NDIS_STATUS vboxNetFltWinNdisBuffersToSG(PNDIS_BUFFER pBuffer, PINTNETSG pSG) +{ + UINT cbSeg = 0; + NDIS_STATUS fStatus = NDIS_STATUS_SUCCESS; + PVOID pVirtualAddress; + UINT cbCurrentLength; + + while(pBuffer) + { + NdisQueryBufferSafe( + pBuffer, + &pVirtualAddress, + &cbCurrentLength, + NormalPagePriority); + + if(!pVirtualAddress) { + fStatus = NDIS_STATUS_FAILURE; + break; + } + + pSG->cbTotal += cbCurrentLength; + pSG->aSegs[cbSeg].cb = cbCurrentLength; + pSG->aSegs[cbSeg].pv = pVirtualAddress; + pSG->aSegs[cbSeg].Phys = NIL_RTHCPHYS; + cbSeg++; + + NdisGetNextBuffer( + pBuffer, + &pBuffer); + } + + AssertFatal(cbSeg <= pSG->cSegsAlloc); + + if(fStatus == NDIS_STATUS_SUCCESS) + { + pSG->cSegsUsed = cbSeg; + } + + return fStatus; +} + +static void vboxNetFltWinDeleteSG(PINTNETSG pSG) +{ + vboxNetFltWinMemFree(pSG); +} + +static PINTNETSG vboxNetFltWinCreateSG(uint32_t cSize) +{ + PINTNETSG pSG; + NTSTATUS Status = vboxNetFltWinMemAlloc((PVOID*)&pSG, RT_OFFSETOF(INTNETSG, aSegs[cSize])); + if(Status == STATUS_SUCCESS) + { + vboxNetFltWinInitSG(pSG, cSize); + return pSG; + } + + return NULL; +} + +/************************************************************************************ + * packet queue functions + ************************************************************************************/ + +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(VBOXNETADP) +static NDIS_STATUS vboxNetFltWinQuPostPacket(PADAPT pAdapt, PNDIS_PACKET pPacket, PINTNETSG pSG, uint32_t fFlags +# ifdef DEBUG_NETFLT_PACKETS + , PNDIS_PACKET pTmpPacket +# endif + ) +{ + NDIS_STATUS fStatus; + PNDIS_PACKET pMyPacket; + bool bSrcHost = fFlags & PACKET_SRC_HOST; + + LogFlow(("posting packet back to driver stack..\n")); + + if(!pPacket) + { + /* INTNETSG was in the packet queue, create a new NdisPacket from INTNETSG*/ + pMyPacket = vboxNetFltWinNdisPacketFromSG(pAdapt, /* PADAPT */ + pSG, /* PINTNETSG */ + pSG, /* PVOID pBufToFree */ + bSrcHost, /* bool bToWire */ + false); /* bool bCopyMemory */ + + Assert(pMyPacket); + + NDIS_SET_PACKET_STATUS(pMyPacket, NDIS_STATUS_SUCCESS); + + DBG_CHECK_PACKET_AND_SG(pMyPacket, pSG); + +#ifdef DEBUG_NETFLT_PACKETS + Assert(pTmpPacket); + + DBG_CHECK_PACKET_AND_SG(pTmpPacket, pSG); + + DBG_CHECK_PACKETS(pTmpPacket, pMyPacket); +#endif + + LogFlow(("non-ndis packet info, packet created (%p)\n", pMyPacket)); + } + else + { + /* NDIS_PACKET was in the packet queue */ + DBG_CHECK_PACKET_AND_SG(pPacket, pSG); + + if(!(fFlags & PACKET_MINE)) + { + /* the packet is the one that was passed to us in send/receive callback + * According to the DDK, we can not post it further, + * instead we should allocate our own packet. + * So, allocate our own packet (pMyPacket) and copy the packet info there */ + if(bSrcHost) + { + fStatus = vboxNetFltWinPrepareSendPacket(pAdapt, pPacket, &pMyPacket/*, true*/); + LogFlow(("packet from wire, packet created (%p)\n", pMyPacket)); + } + else + { + fStatus = vboxNetFltWinPrepareRecvPacket(pAdapt, pPacket, &pMyPacket, false); + LogFlow(("packet from wire, packet created (%p)\n", pMyPacket)); + } + } + else + { + /* the packet enqueued is ours, simply assign pMyPacket and zero pPacket */ + pMyPacket = pPacket; + pPacket = NULL; + } + Assert(pMyPacket); + } + + if (pMyPacket) + { + /* we have successfuly initialized our packet, post it to the host or to the wire */ + if(bSrcHost) + { +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// SET_PACKET_TO_INFO(pInfo, pMyPacket); +// /* we are not using flags here, so they are not valid here */ +// /* SET_FLAGS_TO_INFO(pInfo, 0); */ +// LogFlow(("sending packet (%p)\n", pMyPacket)); +// vboxNetFltWinDoSendViaInfo(&fStatus, pAdapt, pInfo); +// LogFlow(("done sending packet (%p), status (%d)\n", pMyPacket, fStatus)); +#else + NdisSend(&fStatus, pAdapt->hBindingHandle, pMyPacket); +#endif + + if (fStatus != NDIS_STATUS_PENDING) + { + /* the status is NOT pending, complete the packet */ +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// vboxNetFltWinDoCompleteSendViaInfo(pAdapt, pInfo); +#endif + if(pPacket) + { + LogFlow(("status is not pending, completing packet (%p)\n", pPacket)); +#ifndef WIN9X + NdisIMCopySendCompletePerPacketInfo (pPacket, pMyPacket); +#endif + NdisFreePacket(pMyPacket); + } + else + { + /* should never be here since the PINTNETSG is stored only when the underlying miniport + * indicates NDIS_STATUS_RESOURCES, we should never have this when processing + * the "from-host" packets */ + Assert(0); + LogFlow(("status is not pending, freeing myPacket (%p)\n", pMyPacket)); + vboxNetFltWinFreeSGNdisPacket(pMyPacket, false); + } + } + } + else + { +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// SET_PACKET_TO_INFO(pInfo, pMyPacket); +// /* we are not using flags here, so they are not valid here */ +// /* SET_FLAGS_TO_INFO(pInfo, 0); */ +// +// LogFlow(("indicating receive packet (%p)\n", pMyPacket)); +// vboxNetFltWinDoIndicateReceiveViaInfo(pAdapt, pInfo); +// /* the packet return will be processed in the vboxNetFltWinMpReturnPacket call-back unless +// * we specify NDIS_STATUS_RESOURCES as the packet status, which we are NOT doing currently */ +// LogFlow(("done indicating receive packet (%p)\n", pMyPacket)); +#else + NdisMIndicateReceivePacket(pAdapt->hMiniportHandle, &pMyPacket, 1); +#endif + + fStatus = NDIS_STATUS_PENDING; + /* the packet receive completion is always indicated via MiniportReturnPacket */ + } + } + else + { + /*we failed to create our packet */ + Assert(0); + fStatus = NDIS_STATUS_FAILURE; + } + + return fStatus; +} +#endif + +static bool vboxNetFltWinQuProcessInfo(PVBOXNETFLTINS pNetFltIf, PPACKET_QUEUE_WORKER pWorker, PPACKET_INFO pInfo) +{ + PNDIS_PACKET pPacket = NULL; + PINTNETSG pSG = NULL; + PADAPT pAdapt = PVBOXNETFLTINS_2_PADAPT(pNetFltIf); + UINT fFlags; + NDIS_STATUS Status; +#ifndef VBOXNETADP + bool bSrcHost; + bool bPending; + bool bDropIt; +#endif +#ifdef DEBUG_NETFLT_PACKETS + /* packet used for matching */ + PNDIS_PACKET pTmpPacket = NULL; +#endif + + fFlags = GET_FLAGS_FROM_INFO(pInfo); +#ifndef VBOXNETADP + bSrcHost = (fFlags & PACKET_SRC_HOST) != 0; +#endif + + /* we first need to obtain the INTNETSG to be passed to intnet */ + + /* the queue may contain two "types" of packets: + * the NDIS_PACKET and the INTNETSG. + * I.e. on send/receive we typically enqueue the NDIS_PACKET passed to us by ndis, + * however in case our ProtocolReceive is called or the packet's status is set to NDIS_STSTUS_RESOURCES + * in ProtocolReceivePacket, we must return the packet immediately on ProtocolReceive*** exit + * In this case we allocate the INTNETSG, copy the ndis packet data there and enqueue it. + * In this case the packet info flags has the PACKET_SG fag set + * + * Besides that the NDIS_PACKET contained in the queue could be either the one passed to us in our send/receive callback + * or the one created by us. The latter is possible in case our ProtocolReceive callback is called and we call NdisTransferData + * in this case we need to allocate the packet the data to be transfered to. + * If the enqueued packet is the one allocated by us the PACKET_MINE flag is set + * */ + if((fFlags & PACKET_SG) == 0) + { + /* we have NDIS_PACKET enqueued, we need to convert it to INTNETSG to be passed to intnet */ + PNDIS_BUFFER pCurrentBuffer = NULL; + UINT cBufferCount; + UINT uBytesCopied = 0; + UINT cbPacketLength; + + pPacket = (PNDIS_PACKET)GET_PACKET_FROM_INFO(pInfo); + LogFlow(("ndis packet info, packet (%p)\n", pPacket)); + + LogFlow(("preparing pSG")); + NdisQueryPacket(pPacket, + NULL, + &cBufferCount, + &pCurrentBuffer, + &cbPacketLength); + + + Assert(cBufferCount); + + /* we can not allocate the INTNETSG on stack since in this case we may get stack overflow + * somewhere outside of our driver (3 pages of system thread stack does not seem to be enough) + * + * since we have a "serialized" packet processing, i.e. all packets are being processed and passed + * to intnet by this thread, we just use one previously allocated INTNETSG which is stored in PADAPT */ + pSG = pWorker->pSG; + + if(cBufferCount > pSG->cSegsAlloc) + { + pSG = vboxNetFltWinCreateSG(cBufferCount + 2); + if(pSG) + { + vboxNetFltWinDeleteSG(pWorker->pSG); + pWorker->pSG = pSG; + } + else + { + LogRel(("Failed to reallocate the pSG\n")); + } + } + + if(pSG) + { + /* reinitialize */ + vboxNetFltWinReinitSG(pSG); + + /* convert the ndis buffers to INTNETSG */ + Status = vboxNetFltWinNdisBuffersToSG(pCurrentBuffer, pSG); + if(Status != NDIS_STATUS_SUCCESS) + { + pSG = NULL; + } + else + { + DBG_CHECK_PACKET_AND_SG(pPacket, pSG); + } + } + } + else + { + /* we have the INTNETSG enqueued. (see the above comment explaining why/when this may happen) + * just use the INTNETSG to pass it to intnet */ +#ifndef VBOX_NETFLT_ONDEMAND_BIND + #ifndef VBOXNETADP + /* the PINTNETSG is stored only when the underlying miniport + * indicates NDIS_STATUS_RESOURCES, we should never have this when processing + * the "from-host" packedts */ + Assert(!bSrcHost); + #endif +#else + /* we have both host and wire in ProtocolReceive */ +#endif + pSG = (PINTNETSG)GET_PACKET_FROM_INFO(pInfo); + + LogFlow(("not ndis packet info, pSG (%p)\n", pSG)); + } + +#ifdef DEBUG_NETFLT_PACKETS + if(!pPacket && !pTmpPacket) + { + /* create tmp packet that woud be used for matching */ + pTmpPacket = vboxNetFltWinNdisPacketFromSG(pAdapt, /* PADAPT */ + pSG, /* PINTNETSG */ + pSG, /* PVOID pBufToFree */ + bSrcHost, /* bool bToWire */ + true); /* bool bCopyMemory */ + + NDIS_SET_PACKET_STATUS(pTmpPacket, NDIS_STATUS_SUCCESS); + + DBG_CHECK_PACKET_AND_SG(pTmpPacket, pSG); + + Assert(pTmpPacket); + } +#endif + do + { +#ifndef VBOXNETADP + /* the pSG was successfully initialized, post it to the netFlt*/ +#ifndef VBOX_NETFLT_ONDEMAND_BIND + bDropIt = +#endif + pSG ? pNetFltIf->pSwitchPort->pfnRecv(pNetFltIf->pSwitchPort, pSG, + bSrcHost ? INTNETTRUNKDIR_HOST : INTNETTRUNKDIR_WIRE + ) + : false; +#else + if(pSG) + { + pNetFltIf->pSwitchPort->pfnRecv(pNetFltIf->pSwitchPort, pSG, INTNETTRUNKDIR_HOST); + STATISTIC_INCREASE(pAdapt->cTxSuccess); + } + else + { + STATISTIC_INCREASE(pAdapt->cTxError); + } +#endif + +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(VBOXNETADP) + if(!bDropIt) + { + Status = vboxNetFltWinQuPostPacket(pAdapt, pPacket, pSG, fFlags +# ifdef DEBUG_NETFLT_PACKETS + , pTmpPacket +# endif + ); + + if(Status == NDIS_STATUS_PENDING) + { + /* we will process packet completion in the completion routine */ + bPending = true; + break; + } + } + else +#endif + { + Status = NDIS_STATUS_SUCCESS; + } + + /* drop it */ + if(pPacket) + { + if(!(fFlags & PACKET_MINE)) + { +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(VBOXNETADP) + /* complete the packets */ + if(fFlags & PACKET_SRC_HOST) + { +#endif +#ifndef VBOX_NETFLT_ONDEMAND_BIND +/* NDIS_SET_PACKET_STATUS(pPacket, Status); */ + NdisMSendComplete(pAdapt->hMiniportHandle, pPacket, Status); +#endif +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(VBOXNETADP) + } + else + { +#endif +#ifndef VBOXNETADP + NdisReturnPackets(&pPacket, 1); +#endif +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(VBOXNETADP) + } +#endif + } + else + { +#ifndef VBOX_NETFLT_ONDEMAND_BIND + Assert(!(fFlags & PACKET_SRC_HOST)); +#endif + vboxNetFltWinFreeSGNdisPacket(pPacket, true); + } + } + else + { + Assert(pSG); + vboxNetFltWinMemFree(pSG); + } +#ifndef VBOXNETADP + bPending = false; +#endif + } while(0); + +#ifdef DEBUG_NETFLT_PACKETS + if(pTmpPacket) + { + vboxNetFltWinFreeSGNdisPacket(pTmpPacket, true); + } +#endif + +#ifndef VBOXNETADP + return bPending; +#else + return false; +#endif +} +/* + * thread start function for the thread which processes the packets enqueued in our send and receive callbacks called by ndis + * + * ndis calls us at DISPATCH_LEVEL, while IntNet is using kernel functions which require Irql<DISPATCH_LEVEL + * this is why we can not immediately post packets to IntNet from our sen/receive callbacks + * instead we put the incoming packets to the queue and maintain the system thread running at passive level + * which processes the queue and posts the packets to IntNet, and further to the host or to the wire. + */ +static VOID vboxNetFltWinQuPacketQueueWorkerThreadProc(PVBOXNETFLTINS pNetFltIf) +{ + bool fResume = true; + NTSTATUS fStatus; + PADAPT pAdapt = PVBOXNETFLTINS_2_PADAPT(pNetFltIf); + PPACKET_QUEUE_WORKER pWorker = &pNetFltIf->u.s.PacketQueueWorker; + + /* two events we're waiting is "kill" and "notify" events + * the former is used for the thread termination + * the latter gets fired each time the packet is added to the queue */ + PVOID pEvents[] = { + (PVOID) &pWorker->KillEvent, + (PVOID) &pWorker->NotifyEvent, + }; + + while(fResume) + { + uint32_t cNumProcessed; + uint32_t cNumPostedToHostWire; + + fStatus = KeWaitForMultipleObjects(2, pEvents, WaitAny, Executive, KernelMode, FALSE, + NULL, NULL); + if(!NT_SUCCESS(fStatus) || fStatus == STATUS_WAIT_0) + { + /* "kill" event was set + * will process queued packets and exit */ + fResume = false; + } + + LogFlow(("==> processing vboxNetFltWinQuPacketQueueWorkerThreadProc\n")); + + cNumProcessed = 0; + cNumPostedToHostWire = 0; + + do + { + PPACKET_INFO pInfo; + +#ifdef DEBUG_NETFLT_PACKETS + /* packet used for matching */ + PNDIS_PACKET pTmpPacket = NULL; +#endif + + /*TODO: FIXME: !!! the better approach for performance would be to dequeue all packets at once + * and then go through all dequeued packets + * the same should be done for enqueue !!! */ + pInfo = vboxNetFltWinQuInterlockedDequeueHead(&pWorker->PacketQueue); + + if(!pInfo) + { + break; + } + + LogFlow(("==> found info (%p)\n", pInfo)); + + if(vboxNetFltWinQuProcessInfo(pNetFltIf, pWorker, pInfo)) + { + cNumPostedToHostWire++; + } + + vboxNetFltWinPpFreePacketInfo(pInfo); + + cNumProcessed++; + } while(TRUE); + + if(cNumProcessed) + { + vboxNetFltWinDecReferenceNetFlt(pNetFltIf, cNumProcessed); + + Assert(cNumProcessed >= cNumPostedToHostWire); + + if(cNumProcessed != cNumPostedToHostWire) + { + vboxNetFltWinDecReferenceAdapt(pAdapt, cNumProcessed - cNumPostedToHostWire); + } + } + } + + PsTerminateSystemThread(STATUS_SUCCESS); +} + +/** + * thread start function for the job processing thread + * + * see comments for PJOB_QUEUE + */ +static VOID vboxNetFltWinJobWorkerThreadProc(PJOB_QUEUE pQueue) +{ + bool fResume = true; + NTSTATUS Status; + + PVOID pEvents[] = { + (PVOID) &pQueue->KillEvent, + (PVOID) &pQueue->NotifyEvent, + }; + + do + { + Status = KeWaitForMultipleObjects(2, pEvents, WaitAny, Executive, KernelMode, FALSE, + NULL, NULL); + Assert(NT_SUCCESS(Status)); + if(!NT_SUCCESS(Status) || Status == STATUS_WAIT_0) + { + /* will process queued jobs and exit */ + Assert(Status == STATUS_WAIT_0); + fResume = false; + } + + do + { + PLIST_ENTRY pJobEntry = ExInterlockedRemoveHeadList(&pQueue->Jobs, &pQueue->Lock); + PJOB pJob; + + if(!pJobEntry) + break; + + pJob = LIST_ENTRY_2_JOB(pJobEntry); + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + pJob->pRoutine(pJob->pContext); + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + if(pJob->bUseCompletionEvent) + { + KeSetEvent(&pJob->CompletionEvent, 1, FALSE); + } + } while(TRUE); + } while(fResume); + + Assert(Status == STATUS_WAIT_0); + + PsTerminateSystemThread(STATUS_SUCCESS); +} + +/** + * enqueues the job to the job queue to be processed by the job worker thread + * see comments for PJOB_QUEUE + */ +static VOID vboxNetFltWinJobEnqueueJob(PJOB_QUEUE pQueue, PJOB pJob, bool bEnqueueHead) +{ + if(bEnqueueHead) + { + ExInterlockedInsertHeadList(&pQueue->Jobs, &pJob->ListEntry, &pQueue->Lock); + } + else + { + ExInterlockedInsertTailList(&pQueue->Jobs, &pJob->ListEntry, &pQueue->Lock); + } + + KeSetEvent(&pQueue->NotifyEvent, 1, FALSE); +} + +DECLINLINE(VOID) vboxNetFltWinJobInit(PJOB pJob, JOB_ROUTINE pRoutine, PVOID pContext, bool bUseEvent) +{ + pJob->pRoutine = pRoutine; + pJob->pContext = pContext; + pJob->bUseCompletionEvent = bUseEvent; + if(bUseEvent) + KeInitializeEvent(&pJob->CompletionEvent, NotificationEvent, FALSE); +} + +/** + * enqueues the job to the job queue to be processed by the job worker thread and + * blocks until the job is done + * see comments for PJOB_QUEUE + */ +static VOID vboxNetFltWinJobSynchExec(PJOB_QUEUE pQueue, JOB_ROUTINE pRoutine, PVOID pContext) +{ + JOB Job; + + Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); + + vboxNetFltWinJobInit(&Job, pRoutine, pContext, true); + + vboxNetFltWinJobEnqueueJob(pQueue, &Job, false); + + KeWaitForSingleObject(&Job.CompletionEvent, Executive, KernelMode, FALSE, NULL); +} + +/** + * enqueues the job to be processed by the job worker thread at passive level and + * blocks until the job is done + */ +DECLHIDDEN(VOID) vboxNetFltWinJobSynchExecAtPassive(JOB_ROUTINE pRoutine, PVOID pContext) +{ + vboxNetFltWinJobSynchExec(&g_JobQueue, pRoutine, pContext); +} + +/** + * helper function used for system thread creation + */ +static NTSTATUS vboxNetFltWinQuCreateSystemThread(PKTHREAD * ppThread, PKSTART_ROUTINE pStartRoutine, PVOID pStartContext) +{ + NTSTATUS fStatus; + HANDLE hThread; + OBJECT_ATTRIBUTES fObjectAttributes; + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + InitializeObjectAttributes(&fObjectAttributes, NULL, OBJ_KERNEL_HANDLE, + NULL, NULL); + + fStatus = PsCreateSystemThread(&hThread, THREAD_ALL_ACCESS, + &fObjectAttributes, NULL, NULL, + (PKSTART_ROUTINE) pStartRoutine, pStartContext); + if (!NT_SUCCESS(fStatus)) + return fStatus; + + ObReferenceObjectByHandle(hThread, THREAD_ALL_ACCESS, NULL, + KernelMode, (PVOID*) ppThread, NULL); + ZwClose(hThread); + return STATUS_SUCCESS; +} + +/** + * initialize the job queue + * see comments for PJOB_QUEUE + */ +static NTSTATUS vboxNetFltWinJobInitQueue(PJOB_QUEUE pQueue) +{ + NTSTATUS fStatus; + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + NdisZeroMemory(pQueue, sizeof(JOB_QUEUE)); + + KeInitializeEvent(&pQueue->KillEvent, NotificationEvent, FALSE); + + KeInitializeEvent(&pQueue->NotifyEvent, SynchronizationEvent, FALSE); + + InitializeListHead(&pQueue->Jobs); + + fStatus = vboxNetFltWinQuCreateSystemThread(&pQueue->pThread, (PKSTART_ROUTINE)vboxNetFltWinJobWorkerThreadProc, pQueue); + if(fStatus != STATUS_SUCCESS) + { + pQueue->pThread = NULL; + } + else + { + Assert(pQueue->pThread); + } + + return fStatus; +} + +/** + * deinitialize the job queue + * see comments for PJOB_QUEUE + */ +static void vboxNetFltWinJobFiniQueue(PJOB_QUEUE pQueue) +{ + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + if(pQueue->pThread) + { + KeSetEvent(&pQueue->KillEvent, 0, FALSE); + + KeWaitForSingleObject(pQueue->pThread, Executive, + KernelMode, FALSE, NULL); + } +} + +/** + * initializes the packet queue + * */ +DECLHIDDEN(NTSTATUS) vboxNetFltWinQuInitPacketQueue(PVBOXNETFLTINS pInstance) +{ + NTSTATUS Status; + PPACKET_QUEUE_WORKER pWorker = &pInstance->u.s.PacketQueueWorker; + + AssertFatal(!pWorker->pSG); + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + KeInitializeEvent(&pWorker->KillEvent, NotificationEvent, FALSE); + + KeInitializeEvent(&pWorker->NotifyEvent, SynchronizationEvent, FALSE); + + INIT_INTERLOCKED_PACKET_QUEUE(&pWorker->PacketQueue); + + do + { + Status = vboxNetFltWinPpAllocatePacketInfoPool(&pWorker->PacketInfoPool, PACKET_INFO_POOL_SIZE); + + if(Status == NDIS_STATUS_SUCCESS) + { + pWorker->pSG = vboxNetFltWinCreateSG(PACKET_QUEUE_SG_SEGS_ALLOC); + if(!pWorker->pSG) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + Status = vboxNetFltWinQuCreateSystemThread(&pWorker->pThread, (PKSTART_ROUTINE)vboxNetFltWinQuPacketQueueWorkerThreadProc, pInstance); + if(Status != STATUS_SUCCESS) + { + vboxNetFltWinPpFreePacketInfoPool(&pWorker->PacketInfoPool); + vboxNetFltWinMemFree(pWorker->pSG); + pWorker->pSG = NULL; + break; + } + } + + } while(0); + + return Status; +} + +/* + * deletes the packet queue + */ +DECLHIDDEN(void) vboxNetFltWinQuFiniPacketQueue(PVBOXNETFLTINS pInstance) +{ + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + PINTNETSG pSG; + PPACKET_QUEUE_WORKER pWorker = &pInstance->u.s.PacketQueueWorker; + Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); + +// Assert(pAdapt->pPacketQueueSG); + + /* using the pPacketQueueSG as an indicator that the packet queue is initialized */ + RTSpinlockAcquire((pInstance)->hSpinlock, &Tmp); + if(pWorker->pSG) + { + pSG = pWorker->pSG; + pWorker->pSG = NULL; + RTSpinlockRelease((pInstance)->hSpinlock, &Tmp); + KeSetEvent(&pWorker->KillEvent, 0, FALSE); + + KeWaitForSingleObject(pWorker->pThread, Executive, + KernelMode, FALSE, NULL); + + vboxNetFltWinPpFreePacketInfoPool(&pWorker->PacketInfoPool); + + vboxNetFltWinDeleteSG(pSG); + + FINI_INTERLOCKED_PACKET_QUEUE(&pWorker->PacketQueue); + } + else + { + RTSpinlockRelease((pInstance)->hSpinlock, &Tmp); + } +} + +/* + * creates the INTNETSG containing one segment pointing to the buffer of size cbBufSize + * the INTNETSG created should be cleaned with vboxNetFltWinMemFree + */ +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinAllocSG(UINT cbBufSize, PINTNETSG *ppSG) +{ + UINT cbBufferOffset; + UINT cbMemSize; + NDIS_STATUS Status; + PINTNETSG pSG; + + /* allocation: + * 1. SG_PACKET - with one aSegs pointing to + * 2. buffer of cbPacketLength containing the entire packet */ + cbBufferOffset = sizeof(INTNETSG); + /* make sure the buffer is aligned */ + if((cbBufferOffset & (sizeof(PVOID) - 1)) != 0) + { + cbBufferOffset += sizeof(PVOID); + cbBufferOffset &= ~(sizeof(PVOID) - 1); + } + + cbMemSize = cbBufferOffset + cbBufSize; + Status = vboxNetFltWinMemAlloc((PVOID*)&pSG, cbMemSize); + if(Status == NDIS_STATUS_SUCCESS) + { + vboxNetFltWinInitSG(pSG, 1); + pSG->aSegs[0].pv = (uint8_t *)pSG + cbBufferOffset; + pSG->aSegs[0].Phys = NIL_RTHCPHYS; + pSG->aSegs[0].cb = cbBufSize; + pSG->cbTotal = cbBufSize; + pSG->cSegsUsed = 1; + + LogFlow(("pSG created (%p)\n", pSG)); + + *ppSG = pSG; + } + return Status; +} + +/** + * put the packet info to the queue + */ +DECLINLINE(void) vboxNetFltWinQuEnqueueInfo(PPACKET_QUEUE_WORKER pWorker, PPACKET_INFO pInfo) +{ + vboxNetFltWinQuInterlockedEnqueueTail(&pWorker->PacketQueue, pInfo); + + KeSetEvent(&pWorker->NotifyEvent, IO_NETWORK_INCREMENT, FALSE); +} + + +/** + * puts the packet to the queue + * + * @return NDIST_STATUS_SUCCESS iff the packet was enqueued successfully + * and error status otherwise. + * NOTE: that the success status does NOT mean that the packet processing is completed, but only that it was enqueued successfully + * the packet can be returned to the caller protocol/moniport only in case the bReleasePacket was set to true (in this case the copy of the packet was enqueued) + * or if vboxNetFltWinQuEnqueuePacket failed, i.e. the packet was NOT enqueued + */ +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinQuEnqueuePacket(PVBOXNETFLTINS pInstance, PVOID pPacket, const UINT fPacketFlags) +{ + PPACKET_INFO pInfo; + PPACKET_QUEUE_WORKER pWorker = &pInstance->u.s.PacketQueueWorker; + NDIS_STATUS fStatus = NDIS_STATUS_SUCCESS; + + do + { + if(fPacketFlags & PACKET_COPY) + { + PNDIS_BUFFER pBuffer = NULL; + UINT cBufferCount; + UINT uBytesCopied = 0; + UINT cbPacketLength; + PINTNETSG pSG; + + /* the packet is Ndis packet */ + Assert(!(fPacketFlags & PACKET_SG)); + Assert(!(fPacketFlags & PACKET_MINE)); + + NdisQueryPacket((PNDIS_PACKET)pPacket, + NULL, + &cBufferCount, + &pBuffer, + &cbPacketLength); + + + Assert(cBufferCount); + + fStatus = vboxNetFltWinAllocSG(cbPacketLength, &pSG); + if(fStatus != NDIS_STATUS_SUCCESS) + { + Assert(0); + break; + } + + pInfo = vboxNetFltWinPpAllocPacketInfo(&pWorker->PacketInfoPool); + + if(!pInfo) + { + Assert(0); + /* TODO: what status to set? */ + fStatus = NDIS_STATUS_FAILURE; + vboxNetFltWinMemFree(pSG); + break; + } + + Assert(pInfo->pPool); + + /* the packet we are queueing is SG, add PACKET_SG to flags */ + SET_FLAGS_TO_INFO(pInfo, fPacketFlags | PACKET_SG); + SET_PACKET_TO_INFO(pInfo, pSG); + + fStatus = vboxNetFltWinNdisBufferMoveToSG0(pBuffer, pSG); + if(fStatus != NDIS_STATUS_SUCCESS) + { + Assert(0); + vboxNetFltWinPpFreePacketInfo(pInfo); + vboxNetFltWinMemFree(pSG); + break; + } + + DBG_CHECK_PACKET_AND_SG((PNDIS_PACKET)pPacket, pSG); + } + else + { + pInfo = vboxNetFltWinPpAllocPacketInfo(&pWorker->PacketInfoPool); + + if(!pInfo) + { + Assert(0); + /* TODO: what status to set? */ + fStatus = NDIS_STATUS_FAILURE; + break; + } + + Assert(pInfo->pPool); + + SET_FLAGS_TO_INFO(pInfo, fPacketFlags); + SET_PACKET_TO_INFO(pInfo, pPacket); + } + + vboxNetFltWinQuEnqueueInfo(pWorker, pInfo); + + } while(0); + + return fStatus; +} + +#ifndef VBOX_NETFLT_ONDEMAND_BIND +/* + * ioctl i/f + */ +static NTSTATUS +vboxNetFltWinPtDispatchIoctl( + IN PDEVICE_OBJECT pDeviceObject, + IN PIO_STACK_LOCATION pIrpStack) +{ +#if 0 + ULONG CtlCode = pIrpStack->Parameters.DeviceIoControl.IoControlCode; + NTSTATUS Status = STATUS_SUCCESS; + int rc; + + switch(CtlCode) + { + + case VBOXNETFLT_WIN_IOCTL_INIT: + rc = vboxNetFltWinInitIdc(); + if(!RT_SUCCESS(rc)) + { + Status = STATUS_UNSUCCESSFUL; + } + break; + case VBOXNETFLT_WIN_IOCTL_FINI: + /* we are finalizing during unload */ + /* TODO: FIXME: need to prevent driver unload that can occur in case IntNet is connected to us, + * but we are not bound to any adapters */ +/* rc = vboxNetFltWinTryFiniIdc(); + if(!RT_SUCCESS(rc)) + { + Status = STATUS_UNSUCCESSFUL; + } + */ + break; + + default: + Status = STATUS_NOT_SUPPORTED; + break; + } + + return Status; +#else + return STATUS_NOT_SUPPORTED; +#endif +} + +/* +Routine Description: + + Process IRPs sent to this device. + +Arguments: + + DeviceObject - pointer to a device object + Irp - pointer to an I/O Request Packet + +Return Value: + + NTSTATUS - STATUS_SUCCESS always - change this when adding + real code to handle ioctls. + +*/ +DECLHIDDEN(NTSTATUS) +vboxNetFltWinPtDispatch( + IN PDEVICE_OBJECT pDeviceObject, + IN PIRP pIrp + ) +{ + PIO_STACK_LOCATION pIrpStack; + NTSTATUS Status = STATUS_SUCCESS; + + LogFlow(("==>Pt Dispatch\n")); + pIrpStack = IoGetCurrentIrpStackLocation(pIrp); + + + switch (pIrpStack->MajorFunction) + { + case IRP_MJ_CREATE: + break; + + case IRP_MJ_CLEANUP: + break; + + case IRP_MJ_CLOSE: + break; + + case IRP_MJ_DEVICE_CONTROL: + Status = vboxNetFltWinPtDispatchIoctl(pDeviceObject, pIrpStack); + break; + default: + break; + } + + pIrp->IoStatus.Status = Status; + IoCompleteRequest(pIrp, IO_NO_INCREMENT); + + LogFlow(("<== Pt Dispatch\n")); + + return Status; + +} +#endif + +/* + * netflt + */ +#ifndef VBOXNETADP +/* + * NOTE! the routine is NOT re-enterable for the given pAdapt + * the serialization is not implemented for performance reasons + * since we are assuming the caller serializes the requests as IntNet does + */ +static NDIS_STATUS vboxNetFltWinSynchNdisRequest(PADAPT pAdapt, PNDIS_REQUEST pRequest) +{ + int rc; + + Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); + + /* 1. serialize */ + rc = RTSemFastMutexRequest(pAdapt->hSynchRequestMutex); AssertRC(rc); + if(RT_SUCCESS(rc)) + { + NDIS_STATUS fRequestStatus = NDIS_STATUS_SUCCESS; + + /* 2. set pAdapt->pSynchRequest */ + Assert(!pAdapt->pSynchRequest); + pAdapt->pSynchRequest = pRequest; + + /* 3. call NdisRequest */ + NdisRequest(&fRequestStatus, pAdapt->hBindingHandle, pRequest); + + if(fRequestStatus == NDIS_STATUS_PENDING) + { + /* 3.1 if pending wait and assign the resulting status */ + KeWaitForSingleObject(&pAdapt->hSynchCompletionEvent, Executive, + KernelMode, FALSE, NULL); + + fRequestStatus = pAdapt->fSynchCompletionStatus; + } + + /* 4. clear the pAdapt->pSynchRequest */ + pAdapt->pSynchRequest = NULL; + + RTSemFastMutexRelease(pAdapt->hSynchRequestMutex); AssertRC(rc); + return fRequestStatus; + } + return NDIS_STATUS_FAILURE; +} + + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinGetMacAddress(PADAPT pAdapt, PRTMAC pMac) +{ + NDIS_REQUEST request; + NDIS_STATUS status; + request.RequestType = NdisRequestQueryInformation; + request.DATA.QUERY_INFORMATION.InformationBuffer = pMac; + request.DATA.QUERY_INFORMATION.InformationBufferLength = sizeof(RTMAC); + request.DATA.QUERY_INFORMATION.Oid = OID_802_3_CURRENT_ADDRESS; + status = vboxNetFltWinSynchNdisRequest(pAdapt, &request); + if(status != NDIS_STATUS_SUCCESS) + { + /* TODO */ + Assert(0); + } + + return status; + +} + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinQueryPhysicalMedium(PADAPT pAdapt, NDIS_PHYSICAL_MEDIUM * pMedium) +{ + NDIS_REQUEST Request; + NDIS_STATUS Status; + Request.RequestType = NdisRequestQueryInformation; + Request.DATA.QUERY_INFORMATION.InformationBuffer = pMedium; + Request.DATA.QUERY_INFORMATION.InformationBufferLength = sizeof(NDIS_PHYSICAL_MEDIUM); + Request.DATA.QUERY_INFORMATION.Oid = OID_GEN_PHYSICAL_MEDIUM; + Status = vboxNetFltWinSynchNdisRequest(pAdapt, &Request); + if(Status != NDIS_STATUS_SUCCESS) + { + if(Status == NDIS_STATUS_NOT_SUPPORTED || Status == NDIS_STATUS_NOT_RECOGNIZED || Status == NDIS_STATUS_INVALID_OID) + { + Status = NDIS_STATUS_NOT_SUPPORTED; + } + else + { + LogRel(("OID_GEN_PHYSICAL_MEDIUM failed: Status (0x%x)", Status)); + Assert(0); + } + } + return Status; +} + +DECLHIDDEN(bool) vboxNetFltWinIsPromiscuous(PADAPT pAdapt) +{ + /** @todo r=bird: This is too slow and is probably returning the wrong + * information. What we're interested in is whether someone besides us + * has put the interface into promiscuous mode. */ + NDIS_REQUEST request; + NDIS_STATUS status; + ULONG filter; + Assert(VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)); + request.RequestType = NdisRequestQueryInformation; + request.DATA.QUERY_INFORMATION.InformationBuffer = &filter; + request.DATA.QUERY_INFORMATION.InformationBufferLength = sizeof(filter); + request.DATA.QUERY_INFORMATION.Oid = OID_GEN_CURRENT_PACKET_FILTER; + status = vboxNetFltWinSynchNdisRequest(pAdapt, &request); + if(status != NDIS_STATUS_SUCCESS) + { + /* TODO */ + Assert(0); + return false; + } + return (filter & NDIS_PACKET_TYPE_PROMISCUOUS) != 0; +} + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinSetPromiscuous(PADAPT pAdapt, bool bYes) +{ + Assert(VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)); + if(VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)) + { + NDIS_REQUEST Request; + NDIS_STATUS fStatus; + ULONG fFilter; + ULONG fExpectedFilter; + ULONG fOurFilter; + Request.RequestType = NdisRequestQueryInformation; + Request.DATA.QUERY_INFORMATION.InformationBuffer = &fFilter; + Request.DATA.QUERY_INFORMATION.InformationBufferLength = sizeof(fFilter); + Request.DATA.QUERY_INFORMATION.Oid = OID_GEN_CURRENT_PACKET_FILTER; + fStatus = vboxNetFltWinSynchNdisRequest(pAdapt, &Request); + if(fStatus != NDIS_STATUS_SUCCESS) + { + /* TODO: */ + Assert(0); + return fStatus; + } + + if(!pAdapt->bUpperProtSetFilterInitialized) + { + /* the cache was not initialized yet, initiate it with the current filter value */ + pAdapt->fUpperProtocolSetFilter = fFilter; + pAdapt->bUpperProtSetFilterInitialized = true; + } + + + if(bYes) + { + fExpectedFilter = NDIS_PACKET_TYPE_PROMISCUOUS; + fOurFilter = NDIS_PACKET_TYPE_PROMISCUOUS; + } + else + { + fExpectedFilter = pAdapt->fUpperProtocolSetFilter; + fOurFilter = 0; + } + + if(fExpectedFilter != fFilter) + { + Request.RequestType = NdisRequestSetInformation; + Request.DATA.SET_INFORMATION.InformationBuffer = &fExpectedFilter; + Request.DATA.SET_INFORMATION.InformationBufferLength = sizeof(fExpectedFilter); + Request.DATA.SET_INFORMATION.Oid = OID_GEN_CURRENT_PACKET_FILTER; + fStatus = vboxNetFltWinSynchNdisRequest(pAdapt, &Request); + if(fStatus != NDIS_STATUS_SUCCESS) + { + /* TODO */ + Assert(0); + return fStatus; + } + } + pAdapt->fOurSetFilter = fOurFilter; + return fStatus; + } + return NDIS_STATUS_NOT_SUPPORTED; +} +#else /* if defined VBOXNETADP */ + +/** + * Generates a new unique MAC address based on our vendor ID + */ +DECLHIDDEN(void) vboxNetFltWinGenerateMACAddress(RTMAC *pMac) +{ + /* temporary use a time info */ + uint64_t NanoTS = RTTimeSystemNanoTS(); + pMac->au8[0] = (uint8_t)((VBOXNETADP_VENDOR_ID >> 16) & 0xff); + pMac->au8[1] = (uint8_t)((VBOXNETADP_VENDOR_ID >> 8) & 0xff); + pMac->au8[2] = (uint8_t)(VBOXNETADP_VENDOR_ID & 0xff); + pMac->au8[3] = (uint8_t)(NanoTS & 0xff0000); + pMac->au16[2] = (uint16_t)(NanoTS & 0xffff); +} + +DECLHIDDEN(int) vboxNetFltWinMAC2NdisString(RTMAC *pMac, PNDIS_STRING pNdisString) +{ + static const char s_achDigits[17] = "0123456789abcdef"; + uint8_t u8; + int i; + PWSTR pString; + + /* validate parameters */ + AssertPtrReturn(pMac, VERR_INVALID_PARAMETER); + AssertPtrReturn(pNdisString, VERR_INVALID_PARAMETER); + AssertReturn(pNdisString->MaximumLength >= 13*sizeof(pNdisString->Buffer[0]), VERR_INVALID_PARAMETER); + + pString = pNdisString->Buffer; + + for( i = 0; i < 6; i++) + { + u8 = pMac->au8[i]; + pString[ 0] = s_achDigits[(u8 >> 4) & 0xf]; + pString[ 1] = s_achDigits[(u8/*>>0*/)& 0xf]; + pString += 2; + } + + pNdisString->Length = 12*sizeof(pNdisString->Buffer[0]); + + *pString = L'\0'; + + return VINF_SUCCESS; +} + +static int vboxNetFltWinWchar2Int(WCHAR c, uint8_t * pv) +{ + if(c >= L'A' && c <= L'F') + { + *pv = (c - L'A') + 10; + } + else if(c >= L'a' && c <= L'f') + { + *pv = (c - L'a') + 10; + } + else if(c >= L'0' && c <= L'9') + { + *pv = (c - L'0'); + } + else + { + return VERR_INVALID_PARAMETER; + } + return VINF_SUCCESS; +} + +DECLHIDDEN(int) vboxNetFltWinMACFromNdisString(RTMAC *pMac, PNDIS_STRING pNdisString) +{ + int i, rc; + PWSTR pString; + + /* validate parameters */ + AssertPtrReturn(pMac, VERR_INVALID_PARAMETER); + AssertPtrReturn(pNdisString, VERR_INVALID_PARAMETER); + AssertReturn(pNdisString->Length >= 12*sizeof(pNdisString->Buffer[0]), VERR_INVALID_PARAMETER); + + pString = pNdisString->Buffer; + + for(i = 0; i < 6; i++) + { + uint8_t v1, v2; + rc = vboxNetFltWinWchar2Int(pString[0], &v1); + if(RT_FAILURE(rc)) + { + break; + } + + rc = vboxNetFltWinWchar2Int(pString[1], &v2); + if(RT_FAILURE(rc)) + { + break; + } + + pMac->au8[i] = (v1 << 4) | v2; + + pString += 2; + } + + return rc; +} + +#endif +/** + * creates a NDIS_PACKET from the PINTNETSG + */ +#ifdef VBOX_NETFLT_ONDEMAND_BIND +/* TODO: the bToWire parameter seems to be unneeded here, remove them*/ +#endif +DECLHIDDEN(PNDIS_PACKET) vboxNetFltWinNdisPacketFromSG(PADAPT pAdapt, PINTNETSG pSG, PVOID pBufToFree, bool bToWire, bool bCopyMemory) +{ + NDIS_STATUS fStatus; + PNDIS_PACKET pPacket; + + Assert(pSG->cSegsUsed == 1); + Assert(pSG->cbTotal == pSG->aSegs[0].cb); + Assert(pSG->aSegs[0].pv); + Assert(pSG->cbTotal >= sizeof(ETH_HEADER_SIZE)); + +#ifdef VBOX_NETFLT_ONDEMAND_BIND + NdisAllocatePacket(&fStatus, &pPacket, pAdapt->hSendPacketPoolHandle); +#elif defined(VBOXNETADP) + NdisAllocatePacket(&fStatus, &pPacket, pAdapt->hRecvPacketPoolHandle); +#else + NdisAllocatePacket(&fStatus, &pPacket, bToWire ? pAdapt->hSendPacketPoolHandle : pAdapt->hRecvPacketPoolHandle); +#endif + if(fStatus == NDIS_STATUS_SUCCESS) + { + PNDIS_BUFFER pBuffer; + PVOID pMemBuf; + + if(bCopyMemory) + { + fStatus = vboxNetFltWinMemAlloc(&pMemBuf, pSG->cbTotal); + if(fStatus == NDIS_STATUS_SUCCESS) + { + NdisMoveMemory(pMemBuf, pSG->aSegs[0].pv, pSG->cbTotal); + } + else + { + Assert(0); + NdisFreePacket(pPacket); + pPacket = NULL; + } + } + else + { + pMemBuf = pSG->aSegs[0].pv; + } + if(fStatus == NDIS_STATUS_SUCCESS) + { +#ifdef VBOX_NETFLT_ONDEMAND_BIND + NdisAllocateBuffer(&fStatus, &pBuffer, + pAdapt->hSendBufferPoolHandle, + pMemBuf, + pSG->cbTotal); +#elif defined(VBOXNETADP) + NdisAllocateBuffer(&fStatus, &pBuffer, + pAdapt->hRecvBufferPoolHandle, + pMemBuf, + pSG->cbTotal); +#else + NdisAllocateBuffer(&fStatus, &pBuffer, + bToWire ? pAdapt->hSendBufferPoolHandle : pAdapt->hRecvBufferPoolHandle, + pMemBuf, + pSG->cbTotal); +#endif + + if(fStatus == NDIS_STATUS_SUCCESS) + { + NdisChainBufferAtBack(pPacket, pBuffer); + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + if(bToWire) +#endif + { + PSEND_RSVD pSendRsvd; + pSendRsvd = (PSEND_RSVD)(pPacket->ProtocolReserved); + pSendRsvd->pOriginalPkt = NULL; + pSendRsvd->pBufToFree = pBufToFree; + + /* set "don't loopback" flags */ + NdisSetPacketFlags(pPacket, g_fPacketDontLoopBack); + } +#ifndef VBOX_NETFLT_ONDEMAND_BIND + else + { + PRECV_RSVD pRecvRsvd; + pRecvRsvd = (PRECV_RSVD)(pPacket->MiniportReserved); + pRecvRsvd->pOriginalPkt = NULL; + pRecvRsvd->pBufToFree = pBufToFree; + + /* me must set the header size on receive */ + NDIS_SET_PACKET_HEADER_SIZE(pPacket, ETH_HEADER_SIZE); + /* NdisAllocatePacket zero-initializes the OOB data, + * but keeps the packet flags, clean them here */ + NdisSetPacketFlags(pPacket, 0); + } +#endif + /* TODO: set out of bound data */ + } + else + { + Assert(0); + if(bCopyMemory) + { + vboxNetFltWinMemFree(pMemBuf); + } + NdisFreePacket(pPacket); + pPacket = NULL; + } + } + else + { + Assert(0); + NdisFreePacket(pPacket); + pPacket = NULL; + } + } + else + { + pPacket = NULL; + } + + DBG_CHECK_PACKET_AND_SG(pPacket, pSG); + + return pPacket; +} + +/* + * frees NDIS_PACKET creaed with vboxNetFltWinNdisPacketFromSG + */ +DECLHIDDEN(void) vboxNetFltWinFreeSGNdisPacket(PNDIS_PACKET pPacket, bool bFreeMem) +{ + UINT cBufCount; + PNDIS_BUFFER pFirstBuffer; + UINT uTotalPacketLength; + PNDIS_BUFFER pBuffer; + + NdisQueryPacket(pPacket, NULL, &cBufCount, &pFirstBuffer, &uTotalPacketLength); + + Assert(cBufCount == 1); + + do + { + NdisUnchainBufferAtBack(pPacket, &pBuffer); + if(pBuffer != NULL) + { + PVOID pMemBuf; + UINT cbLength; + + NdisQueryBufferSafe(pBuffer, &pMemBuf, &cbLength, NormalPagePriority); + NdisFreeBuffer(pBuffer); + if(bFreeMem) + { + vboxNetFltWinMemFree(pMemBuf); + } + } + else + { + break; + } + } while(true); + + NdisFreePacket(pPacket); +} + +/* + * Free all packet pools on the specified adapter. + * @param pAdapt - pointer to ADAPT structure + */ +static VOID +vboxNetFltWinPtFreeAllPacketPools( + IN PADAPT pAdapt + ) +{ +#ifndef VBOX_NETFLT_ONDEMAND_BIND + if (pAdapt->hRecvPacketPoolHandle != NULL) + { + /* + * Free the packet pool that is used to indicate receives + */ + NdisFreePacketPool(pAdapt->hRecvPacketPoolHandle); + + pAdapt->hRecvPacketPoolHandle = NULL; + } +#endif /* #ifndef VBOX_NETFLT_ONDEMAND_BIND*/ +#ifndef VBOXNETADP + if (pAdapt->hSendPacketPoolHandle != NULL) + { + + /* + * Free the packet pool that is used to send packets below + */ + + NdisFreePacketPool(pAdapt->hSendPacketPoolHandle); + + pAdapt->hSendPacketPoolHandle = NULL; + + } +#endif +} +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(VBOXNETADP) +static void vboxNetFltWinAssociateMiniportProtocol() +{ + NdisIMAssociateMiniport(vboxNetFltWinMpGetHandle(), vboxNetFltWinPtGetHandle()); +} +#endif + +/* + * NetFlt driver unload function + */ +DECLHIDDEN(VOID) +vboxNetFltWinUnload( + IN PDRIVER_OBJECT DriverObject + ) +{ + int rc; + UNREFERENCED_PARAMETER(DriverObject); + + LogFlow(("vboxNetFltWinUnload: entered\n")); + + rc = vboxNetFltWinTryFiniIdc(); + if (RT_FAILURE(rc)) + { + /* TODO: we can not prevent driver unload here */ + Assert(0); + + Log(("vboxNetFltWinTryFiniIdc - failed, busy.\n")); + } + + vboxNetFltWinJobFiniQueue(&g_JobQueue); +#ifndef VBOXNETADP + vboxNetFltWinPtDeregister(); +#endif +#ifndef VBOX_NETFLT_ONDEMAND_BIND + vboxNetFltWinMpDeregister(); +#endif + + vboxNetFltWinFiniNetFltBase(); + /* don't use logging or any RT after de-init */ + + NdisFreeSpinLock(&g_GlobalLock); +} + +RT_C_DECLS_BEGIN + +NTSTATUS +DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath + ); + +RT_C_DECLS_END +/* + * First entry point to be called, when this driver is loaded. + * Register with NDIS as an intermediate driver. + * @return STATUS_SUCCESS if all initialization is successful, STATUS_XXX + * error code if not. + */ +NTSTATUS +DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath + ) +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + int rc; + + NdisAllocateSpinLock(&g_GlobalLock); + + do + { + ULONG MjVersion; + ULONG MnVersion; + +#ifdef VBOX_NETFLT_ONDEMAND_BIND + /* we are registering in the DriverEntry only when we are working as a protocol + * since in this case our driver is loaded after the VBoxDrv*/ + rc = vboxNetFltWinInitNetFlt(); +#else + /* the idc registration is initiated via IOCTL since our driver + * can be loaded when the VBoxDrv is not in case we are a Ndis IM driver */ + rc = vboxNetFltWinInitNetFltBase(); +#endif + if(!RT_SUCCESS(rc)) + { + Status = NDIS_STATUS_FAILURE; + break; + } + + PsGetVersion(&MjVersion, &MnVersion, + NULL, /* PULONG BuildNumber OPTIONAL */ + NULL /* PUNICODE_STRING CSDVersion OPTIONAL */ + ); + + g_fPacketDontLoopBack = NDIS_FLAGS_DONT_LOOPBACK; + + if(MjVersion == 5 && MnVersion == 0) + { + /* this is Win2k*/ + g_fPacketDontLoopBack |= NDIS_FLAGS_SKIP_LOOPBACK_W2K; + } + + g_fPacketIsLoopedBack = NDIS_FLAGS_IS_LOOPBACK_PACKET; + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + Status = vboxNetFltWinMpRegister(DriverObject, RegistryPath); + if (Status != NDIS_STATUS_SUCCESS) + { + vboxNetFltWinFiniNetFlt(); + break; + } +#endif +#ifndef VBOXNETADP + Status = vboxNetFltWinPtRegister(DriverObject, RegistryPath); + if (Status != NDIS_STATUS_SUCCESS) + { +#ifndef VBOX_NETFLT_ONDEMAND_BIND + vboxNetFltWinMpDeregister(); +#endif + vboxNetFltWinFiniNetFlt(); + break; + } +#endif + + Status = vboxNetFltWinJobInitQueue(&g_JobQueue); + if(Status != STATUS_SUCCESS) + { +#ifndef VBOXNETADP + vboxNetFltWinPtDeregister(); +#endif +#ifndef VBOX_NETFLT_ONDEMAND_BIND + vboxNetFltWinMpDeregister(); +#endif + vboxNetFltWinFiniNetFlt(); + break; + } + + /* note: we do it after we initialize the Job Queue */ + vboxNetFltWinStartInitIdcProbing(); + +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(VBOXNETADP) + vboxNetFltWinAssociateMiniportProtocol(); +#endif + } while (FALSE); + + return(Status); +} + +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(VBOXNETADP) +/** + * creates and initializes the packet to be sent to the underlying miniport given a packet posted to our miniport edge + * according to DDK docs we must create our own packet rather than posting the one passed to us + */ +DECLHIDDEN(NDIS_STATUS) +vboxNetFltWinPrepareSendPacket( + IN PADAPT pAdapt, + IN PNDIS_PACKET pPacket, + OUT PNDIS_PACKET *ppMyPacket + /*, IN bool bNetFltActive */ + ) +{ + NDIS_STATUS fStatus; + + NdisAllocatePacket(&fStatus, + ppMyPacket, + pAdapt->hSendPacketPoolHandle); + + if (fStatus == NDIS_STATUS_SUCCESS) + { + PSEND_RSVD pSendRsvd; + + pSendRsvd = (PSEND_RSVD)((*ppMyPacket)->ProtocolReserved); + pSendRsvd->pOriginalPkt = pPacket; + pSendRsvd->pBufToFree = NULL; + + NDIS_PACKET_FIRST_NDIS_BUFFER(*ppMyPacket) = NDIS_PACKET_FIRST_NDIS_BUFFER(pPacket); + NDIS_PACKET_LAST_NDIS_BUFFER(*ppMyPacket) = NDIS_PACKET_LAST_NDIS_BUFFER(pPacket); + + vboxNetFltWinCopyPacketInfoOnSend(*ppMyPacket, pPacket); + +// if(bNetFltActive) +// { + NdisGetPacketFlags(*ppMyPacket) |= g_fPacketDontLoopBack; +// } + } + else + { + *ppMyPacket = NULL; + } + + return fStatus; +} + +/** + * creates and initializes the packet to be sent to the upperlying protocol given a packet indicated to our protocol edge + * according to DDK docs we must create our own packet rather than posting the one passed to us + */ +DECLHIDDEN(NDIS_STATUS) +vboxNetFltWinPrepareRecvPacket( + IN PADAPT pAdapt, + IN PNDIS_PACKET pPacket, + OUT PNDIS_PACKET *ppMyPacket, + IN bool bDpr + ) +{ + NDIS_STATUS fStatus; + + /* + * Get a packet off the pool and indicate that up + */ + if(bDpr) + { + Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); + + NdisDprAllocatePacket(&fStatus, + ppMyPacket, + pAdapt->hRecvPacketPoolHandle); + } + else + { + NdisAllocatePacket(&fStatus, + ppMyPacket, + pAdapt->hRecvPacketPoolHandle); + } + + if (fStatus == NDIS_STATUS_SUCCESS) + { + PRECV_RSVD pRecvRsvd; + + pRecvRsvd = (PRECV_RSVD)((*ppMyPacket)->MiniportReserved); + pRecvRsvd->pOriginalPkt = pPacket; + pRecvRsvd->pBufToFree = NULL; + + NDIS_PACKET_FIRST_NDIS_BUFFER(*ppMyPacket) = NDIS_PACKET_FIRST_NDIS_BUFFER(pPacket); + NDIS_PACKET_LAST_NDIS_BUFFER(*ppMyPacket) = NDIS_PACKET_LAST_NDIS_BUFFER(pPacket); + + fStatus = vboxNetFltWinCopyPacketInfoOnRecv(*ppMyPacket, pPacket); + } + else + { + *ppMyPacket = NULL; + } + return fStatus; +} +#endif + +/** + * initializes the ADAPT (our context structure) and binds to the given adapter + */ +#if defined(VBOX_NETFLT_ONDEMAND_BIND) +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitBind(PADAPT pAdapt) +#elif defined(VBOXNETADP) +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitBind(PADAPT *ppAdapt, NDIS_HANDLE hMiniportAdapter, PNDIS_STRING pBindToMiniportName /* actually this is our miniport name*/, NDIS_HANDLE hWrapperConfigurationContext) +#else +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitBind(PADAPT *ppAdapt, PNDIS_STRING pOurMiniportName, PNDIS_STRING pBindToMiniportName) +#endif +{ + NDIS_STATUS Status; + do + { +#ifndef VBOX_NETFLT_ONDEMAND_BIND + ANSI_STRING AnsiString; + int rc; + PVBOXNETFLTINS pInstance; + USHORT cbAnsiName = pBindToMiniportName->Length;/* the lenght is is bytes ; *2 ;RtlUnicodeStringToAnsiSize(pBindToMiniportName)*/ + char* pAnsiName = alloca(cbAnsiName); + CREATE_INSTANCE_CONTEXT Context; + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + +# ifndef VBOXNETADP + Context.pOurName = pOurMiniportName; + Context.pBindToName = pBindToMiniportName; +# else + Context.hMiniportAdapter = hMiniportAdapter; + Context.hWrapperConfigurationContext = hWrapperConfigurationContext; +# endif + Context.Status = NDIS_STATUS_SUCCESS; + + AnsiString.Buffer = pAnsiName; + AnsiString.Length = 0; + AnsiString.MaximumLength = cbAnsiName; + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + Status = RtlUnicodeStringToAnsiString(&AnsiString, pBindToMiniportName, false); + + if(Status != STATUS_SUCCESS) + { + break; + } + + rc = vboxNetFltSearchCreateInstance(&g_VBoxNetFltGlobals, pAnsiName, &pInstance, &Context); + if(RT_FAILURE(rc)) + { + Assert(0); + Status = Context.Status != NDIS_STATUS_SUCCESS ? Context.Status : NDIS_STATUS_FAILURE; + break; + } + + Assert(pInstance); + + if(rc == VINF_ALREADY_INITIALIZED) + { + PADAPT pAdapt = PVBOXNETFLTINS_2_PADAPT(pInstance); + /* the case when our adapter was unbound while IntNet was connected to it */ + /* the instance remains valid until intNet disconnects from it, we simply search and re-use it*/ + + /* re-initialize PADAPT */ + rc = vboxNetFltWinAttachToInterface(pInstance, &Context, true); + if(RT_FAILURE(rc)) + { + Assert(0); + Status = Context.Status != NDIS_STATUS_SUCCESS ? Context.Status : NDIS_STATUS_FAILURE; + /* release netflt */ + vboxNetFltRelease(pInstance, false); + + break; + } + } + + *ppAdapt = PVBOXNETFLTINS_2_PADAPT(pInstance); +#else + Status = vboxNetFltWinPtAllocInitPADAPT(pAdapt); + if (Status != NDIS_STATUS_SUCCESS) + { + break; + } + + Status = vboxNetFltWinPtDoBinding(pAdapt); + if (Status != NDIS_STATUS_SUCCESS) + { + vboxNetFltWinPtFiniPADAPT(pAdapt); + break; + } +#endif + }while(FALSE); + + return Status; +} + +/** + * initializes the ADAPT + */ +#ifdef VBOX_NETFLT_ONDEMAND_BIND +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtAllocInitPADAPT(PADAPT pAdapt) +{ + NDIS_STATUS Status; + + do + { + Status = vboxNetFltWinPtInitPADAPT(pAdapt); + if (Status != NDIS_STATUS_SUCCESS) + { + break; + } + Status = NDIS_STATUS_SUCCESS; + } while(0); + + return Status; +} + +/** + * unbinds from the adapter we are bound to and deinitializes the ADAPT + */ +static NDIS_STATUS vboxNetFltWinPtFiniUnbind(PADAPT pAdapt) +{ + NDIS_STATUS Status; + + LogFlow(("==> vboxNetFltWinPtFiniUnbind: Adapt %p\n", pAdapt)); + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + do + { + Status = vboxNetFltWinPtDoUnbinding(pAdapt, true); + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + /* TODO: should we break ? */ + /* break; */ + } + + vboxNetFltWinPtFiniPADAPT(pAdapt); + } while(0); + LogFlow(("<== vboxNetFltWinPtFiniUnbind: Adapt %p\n", pAdapt)); + + return Status; +} +#endif + +/* + * deinitializes the ADAPT + */ +DECLHIDDEN(VOID) vboxNetFltWinPtFiniPADAPT(PADAPT pAdapt) +{ +#ifndef VBOXNETADP + int rc; +#endif + + LogFlow(("<== vboxNetFltWinPtFiniPADAPT : pAdapt %p\n", pAdapt)); + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); +#ifndef VBOXNETADP + if(pAdapt->DeviceName.Buffer) + { + vboxNetFltWinMemFree(pAdapt->DeviceName.Buffer); + } + + + FINI_INTERLOCKED_SINGLE_LIST(&pAdapt->TransferDataList); +#endif +#ifdef DEBUG_NETFLT_LOOPBACK +# error "add list cleaning code here" +#endif + + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + /* moved to vboxNetFltWinDetachFromInterfaceWorker */ +#else + vboxNetFltWinQuFiniPacketQueue(pAdapt); +#endif + + vboxNetFltWinFiniBuffers(pAdapt); + + /* + * Free the memory here, if was not released earlier(by calling the HaltHandler) + */ + vboxNetFltWinPtFreeAllPacketPools (pAdapt); +#ifndef VBOXNETADP + rc = RTSemFastMutexDestroy(pAdapt->hSynchRequestMutex); AssertRC(rc); +#endif + + LogFlow(("<== vboxNetFltWinPtFiniPADAPT : pAdapt %p\n", pAdapt)); +} + +DECLHIDDEN(VOID) vboxNetFltWinPtFiniPADAPT(PADAPT pAdapt); +#ifndef VBOXNETADP +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitPADAPT(IN PADAPT pAdapt, IN PNDIS_STRING pOurDeviceName) +#else +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitPADAPT(IN PADAPT pAdapt) +#endif +{ + NDIS_STATUS Status; +#ifndef VBOXNETADP + int rc; +#endif + BOOLEAN bCallFiniOnFail = FALSE; + + LogFlow(("==> vboxNetFltWinPtInitPADAPT : pAdapt %p\n", pAdapt)); + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + do + { + NdisZeroMemory(pAdapt, sizeof(ADAPT)); +#ifndef VBOXNETADP + NdisInitializeEvent(&pAdapt->hEvent); + + KeInitializeEvent(&pAdapt->hSynchCompletionEvent, SynchronizationEvent, FALSE); + + /* + * Allocate a packet pool for sends. We need this to pass sends down. + * We cannot use the same packet descriptor that came down to our send + * handler (see also NDIS 5.1 packet stacking). + */ + NdisAllocatePacketPoolEx(&Status, + &pAdapt->hSendPacketPoolHandle, + MIN_PACKET_POOL_SIZE, + MAX_PACKET_POOL_SIZE - MIN_PACKET_POOL_SIZE, + sizeof(PT_RSVD)); + + if (Status != NDIS_STATUS_SUCCESS) + { + pAdapt->hSendPacketPoolHandle = NULL; + break; + } +#else +#endif + + Status = vboxNetFltWinInitBuffers(pAdapt); + if (Status != NDIS_STATUS_SUCCESS) + { + break; + } + + bCallFiniOnFail = TRUE; +#ifndef VBOXNETADP + rc = RTSemFastMutexCreate(&pAdapt->hSynchRequestMutex); + if(RT_FAILURE(rc)) + { + Status = NDIS_STATUS_FAILURE; + break; + } +#endif + +#ifndef VBOX_NETFLT_ONDEMAND_BIND +# ifndef VBOXNETADP + Status = vboxNetFltWinMemAlloc((PVOID*)&pAdapt->DeviceName.Buffer, pOurDeviceName->Length); + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + pAdapt->DeviceName.Buffer = NULL; + break; + } + pAdapt->DeviceName.MaximumLength = pOurDeviceName->Length; + pAdapt->DeviceName.Length = 0; + Status = vboxNetFltWinCopyString(&pAdapt->DeviceName, pOurDeviceName); + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + break; + } +# endif + + /* + * Allocate a packet pool for receives. We need this to indicate receives. + * Same consideration as sends (see also NDIS 5.1 packet stacking). + */ + NdisAllocatePacketPoolEx(&Status, + &pAdapt->hRecvPacketPoolHandle, + MIN_PACKET_POOL_SIZE, + MAX_PACKET_POOL_SIZE - MIN_PACKET_POOL_SIZE, + PROTOCOL_RESERVED_SIZE_IN_PACKET); + + if (Status != NDIS_STATUS_SUCCESS) + { + pAdapt->hRecvPacketPoolHandle = NULL; + break; + } +#ifndef VBOXNETADP + NdisInitializeEvent(&pAdapt->MiniportInitEvent); +#endif +#endif +#ifndef VBOXNETADP + pAdapt->PTState.PowerState = NdisDeviceStateD3; + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitialized); + + INIT_INTERLOCKED_SINGLE_LIST(&pAdapt->TransferDataList); +#endif + /* TODO: do we need it here ?? */ + pAdapt->MPState.PowerState = NdisDeviceStateD3; + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + +#ifdef DEBUG_NETFLT_LOOPBACK +# error "add list initialization code here" +#endif + +#ifdef VBOX_NETFLT_ONDEMAND_BIND + { + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + rc = vboxNetFltWinConnectIt(pNetFlt); + if(RT_FAILURE(rc)) + { + Assert(0); + Status = NDIS_STATUS_FAILURE; + break; + } + } +#endif + + /* moved to vboxNetFltOsInitInstance */ + } while(0); + + if (Status != NDIS_STATUS_SUCCESS) + { + if(bCallFiniOnFail) + { + vboxNetFltWinPtFiniPADAPT(pAdapt); + } + } + + LogFlow(("<== vboxNetFltWinPtInitPADAPT : pAdapt %p, Status %x\n", pAdapt, Status)); + + return Status; +} + +/** + * match packets + */ +#define NEXT_LIST_ENTRY(_Entry) ((_Entry)->Flink) +#define PREV_LIST_ENTRY(_Entry) ((_Entry)->Blink) +#define FIRST_LIST_ENTRY NEXT_LIST_ENTRY +#define LAST_LIST_ENTRY PREV_LIST_ENTRY + +#define MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b)) + +#ifdef DEBUG_NETFLT_PACKETS + +/* + * answers whether the two given packets match based on the packet length and the first cbMatch bytes of the packets + * if cbMatch < 0 matches complete packets. + */ +DECLHIDDEN(bool) vboxNetFltWinMatchPackets(PNDIS_PACKET pPacket1, PNDIS_PACKET pPacket2, const INT cbMatch) +{ + UINT cBufCount1; + PNDIS_BUFFER pBuffer1; + UINT uTotalPacketLength1; + PVOID pMemBuf1; + UINT cbLength1 = 0; + + UINT cBufCount2; + PNDIS_BUFFER pBuffer2; + UINT uTotalPacketLength2; + PVOID pMemBuf2; + UINT cbLength2 = 0; + bool bMatch = true; + +#ifdef DEBUG_NETFLT_PACKETS + bool bCompleteMatch = false; +#endif + + NdisQueryPacket(pPacket1, NULL, &cBufCount1, &pBuffer1, &uTotalPacketLength1); + NdisQueryPacket(pPacket2, NULL, &cBufCount2, &pBuffer2, &uTotalPacketLength2); + + Assert(pBuffer1); + Assert(pBuffer2); + + if(uTotalPacketLength1 != uTotalPacketLength2) + { + bMatch = false; + } + else + { + UINT ucbMatch; + if(cbMatch < 0 || (UINT)cbMatch > uTotalPacketLength1) + { + /* NOTE: assuming uTotalPacketLength1 == uTotalPacketLength2*/ + ucbMatch = uTotalPacketLength1; +#ifdef DEBUG_NETFLT_PACKETS + bCompleteMatch = true; +#endif + } + else + { + ucbMatch = (UINT)cbMatch; + } + + do + { + UINT ucbLength2Match; + if(!cbLength1) + { + NdisQueryBufferSafe(pBuffer1, &pMemBuf1, &cbLength1, NormalPagePriority); + NdisGetNextBuffer(pBuffer1, &pBuffer1); + } + + if(!cbLength2) + { + NdisQueryBufferSafe(pBuffer2, &pMemBuf2, &cbLength2, NormalPagePriority); + NdisGetNextBuffer(pBuffer2, &pBuffer2); + } + + ucbLength2Match = MIN(ucbMatch, cbLength1); + ucbLength2Match = MIN(ucbMatch, cbLength2); + + if(memcmp(pMemBuf1, pMemBuf2, ucbLength2Match)) + { + bMatch = false; + break; + } + ucbMatch -= ucbLength2Match; + cbLength1 -= ucbLength2Match; + cbLength2 -= ucbLength2Match; + } while (ucbMatch); + } + +#ifdef DEBUG_NETFLT_PACKETS + if(bMatch && !bCompleteMatch) + { + /* check that the packets fully match */ + DBG_CHECK_PACKETS(pPacket1, pPacket2); + } +#endif + + return bMatch; +} + +/* + * answers whether the ndis packet and PINTNETSG match based on the packet length and the first cbMatch bytes of the packet and PINTNETSG + * if cbMatch < 0 matches complete packets. + */ +DECLHIDDEN(bool) vboxNetFltWinMatchPacketAndSG(PNDIS_PACKET pPacket, PINTNETSG pSG, const INT cbMatch) +{ + UINT cBufCount1; + PNDIS_BUFFER pBuffer1; + UINT uTotalPacketLength1; + PVOID pMemBuf1; + UINT cbLength1 = 0; + UINT uTotalPacketLength2 = pSG->cbTotal; + PVOID pMemBuf2; + UINT cbLength2 = 0; + bool bMatch = true; + bool bCompleteMatch = false; + UINT i = 0; + + NdisQueryPacket(pPacket, NULL, &cBufCount1, &pBuffer1, &uTotalPacketLength1); + + Assert(pBuffer1); + Assert(pSG->cSegsUsed); + Assert(pSG->cSegsAlloc >= pSG->cSegsUsed); + + if(uTotalPacketLength1 != uTotalPacketLength2) + { + Assert(0); + bMatch = false; + } + else + { + UINT ucbMatch; + if(cbMatch < 0 || (UINT)cbMatch > uTotalPacketLength1) + { + /* NOTE: assuming uTotalPacketLength1 == uTotalPacketLength2*/ + ucbMatch = uTotalPacketLength1; + bCompleteMatch = true; + } + else + { + ucbMatch = (UINT)cbMatch; + } + + do + { + UINT ucbLength2Match; + if(!cbLength1) + { + NdisQueryBufferSafe(pBuffer1, &pMemBuf1, &cbLength1, NormalPagePriority); + NdisGetNextBuffer(pBuffer1, &pBuffer1); + } + + if(!cbLength2) + { + Assert(i < pSG->cSegsUsed); + pMemBuf2 = pSG->aSegs[i].pv; + cbLength2 = pSG->aSegs[i].cb; + i++; + } + + ucbLength2Match = MIN(ucbMatch, cbLength1); + ucbLength2Match = MIN(ucbMatch, cbLength2); + + if(memcmp(pMemBuf1, pMemBuf2, ucbLength2Match)) + { + bMatch = false; + Assert(0); + break; + } + ucbMatch -= ucbLength2Match; + cbLength1 -= ucbLength2Match; + cbLength2 -= ucbLength2Match; + } while (ucbMatch); + } + + if(bMatch && !bCompleteMatch) + { + /* check that the packets fully match */ + DBG_CHECK_PACKET_AND_SG(pPacket, pSG); + } + return bMatch; +} + +/* + * answers whether the two PINTNETSGs match based on the packet length and the first cbMatch bytes of the PINTNETSG + * if cbMatch < 0 matches complete packets. + */ +static bool vboxNetFltWinMatchSGs(PINTNETSG pSG1, PINTNETSG pSG2, const INT cbMatch) +{ + UINT uTotalPacketLength1 = pSG1->cbTotal; + PVOID pMemBuf1; + UINT cbLength1 = 0; + UINT i1 = 0; + UINT uTotalPacketLength2 = pSG2->cbTotal; + PVOID pMemBuf2; + UINT cbLength2 = 0; + + bool bMatch = true; + bool bCompleteMatch = false; + UINT i2 = 0; + + Assert(pSG1->cSegsUsed); + Assert(pSG2->cSegsUsed); + Assert(pSG1->cSegsAlloc >= pSG1->cSegsUsed); + Assert(pSG2->cSegsAlloc >= pSG2->cSegsUsed); + + if(uTotalPacketLength1 != uTotalPacketLength2) + { + Assert(0); + bMatch = false; + } + else + { + UINT ucbMatch; + if(cbMatch < 0 || (UINT)cbMatch > uTotalPacketLength1) + { + /* NOTE: assuming uTotalPacketLength1 == uTotalPacketLength2*/ + ucbMatch = uTotalPacketLength1; + bCompleteMatch = true; + } + else + { + ucbMatch = (UINT)cbMatch; + } + + do + { + UINT ucbLength2Match; + if(!cbLength1) + { + Assert(i1 < pSG1->cSegsUsed); + pMemBuf1 = pSG1->aSegs[i1].pv; + cbLength1 = pSG1->aSegs[i1].cb; + i1++; + } + + if(!cbLength2) + { + Assert(i2 < pSG2->cSegsUsed); + pMemBuf2 = pSG2->aSegs[i2].pv; + cbLength2 = pSG2->aSegs[i2].cb; + i2++; + } + + ucbLength2Match = MIN(ucbMatch, cbLength1); + ucbLength2Match = MIN(ucbMatch, cbLength2); + + if(memcmp(pMemBuf1, pMemBuf2, ucbLength2Match)) + { + bMatch = false; + Assert(0); + break; + } + ucbMatch -= ucbLength2Match; + cbLength1 -= ucbLength2Match; + cbLength2 -= ucbLength2Match; + } while (ucbMatch); + } + + if(bMatch && !bCompleteMatch) + { + /* check that the packets fully match */ + DBG_CHECK_SGS(pSG1, pSG2); + } + return bMatch; +} +#endif + +static void vboxNetFltWinFiniNetFltBase() +{ + do + { + vboxNetFltDeleteGlobals(&g_VBoxNetFltGlobals); + + /* + * Undo the work done during start (in reverse order). + */ + memset(&g_VBoxNetFltGlobals, 0, sizeof(g_VBoxNetFltGlobals)); + + RTLogDestroy(RTLogRelSetDefaultInstance(NULL)); + RTLogDestroy(RTLogSetDefaultInstance(NULL)); + + RTR0Term(); + } while (0); +} + +static int vboxNetFltWinTryFiniIdc() +{ + int rc; + + vboxNetFltWinStopInitIdcProbing(); + + if(g_bIdcInitialized) + { + rc = vboxNetFltTryDeleteIdc(&g_VBoxNetFltGlobals); + if(RT_SUCCESS(rc)) + { + g_bIdcInitialized = false; + } + } + else + { + rc = VINF_SUCCESS; + } + return rc; + +} + +static int vboxNetFltWinFiniNetFlt() +{ + int rc = vboxNetFltWinTryFiniIdc(); + if(RT_SUCCESS(rc)) + { + vboxNetFltWinFiniNetFltBase(); + } + return rc; +} + +/** + * base netflt initialization + */ +static int vboxNetFltWinInitNetFltBase() +{ + int rc; + + do + { + Assert(!g_bIdcInitialized); + + rc = RTR0Init(0); + if (!RT_SUCCESS(rc)) + { + break; + } + + memset(&g_VBoxNetFltGlobals, 0, sizeof(g_VBoxNetFltGlobals)); + rc = vboxNetFltInitGlobals(&g_VBoxNetFltGlobals); + if (!RT_SUCCESS(rc)) + { + RTR0Term(); + break; + } + }while(0); + + return rc; +} + +/** + * initialize IDC + */ +static int vboxNetFltWinInitIdc() +{ + int rc; + + do + { + if(g_bIdcInitialized) + { +#ifdef VBOX_NETFLT_ONDEMAND_BIND + Assert(0); +#endif + rc = VINF_ALREADY_INITIALIZED; + break; + } + + /* + * connect to the support driver. + * + * This will call back vboxNetFltOsOpenSupDrv (and maybe vboxNetFltOsCloseSupDrv) + * for establishing the connect to the support driver. + */ + rc = vboxNetFltInitIdc(&g_VBoxNetFltGlobals); + if (!RT_SUCCESS(rc)) + { + break; + } + + g_bIdcInitialized = true; + } while (0); + + return rc; +} + +static void vboxNetFltWinInitIdcProbingWorker(PINIT_IDC_INFO pInitIdcInfo) +{ + int rc = vboxNetFltWinInitIdc(); + if(RT_FAILURE(rc)) + { + bool bInterupted = ASMAtomicUoReadBool(&pInitIdcInfo->bStop); + if(!bInterupted) + { + RTThreadSleep(1000); /* 1 s */ + bInterupted = ASMAtomicUoReadBool(&pInitIdcInfo->bStop); + if(!bInterupted) + { + vboxNetFltWinJobEnqueueJob(&g_JobQueue, &pInitIdcInfo->Job, false); + return; + } + } + + /* it's interupted */ + rc = VERR_INTERRUPTED; + } + + ASMAtomicUoWriteU32(&pInitIdcInfo->rc, rc); + KeSetEvent(&pInitIdcInfo->hCompletionEvent, 0, FALSE); +} + +static int vboxNetFltWinStopInitIdcProbing() +{ + if(!g_InitIdcInfo.bInitialized) + return VERR_INVALID_STATE; + + ASMAtomicUoWriteBool(&g_InitIdcInfo.bStop, true); + KeWaitForSingleObject(&g_InitIdcInfo.hCompletionEvent, Executive, KernelMode, FALSE, NULL); + + return g_InitIdcInfo.rc; +} + +static int vboxNetFltWinStartInitIdcProbing() +{ + Assert(!g_bIdcInitialized); + KeInitializeEvent(&g_InitIdcInfo.hCompletionEvent, NotificationEvent, FALSE); + g_InitIdcInfo.bStop = false; + g_InitIdcInfo.bInitialized = true; + vboxNetFltWinJobInit(&g_InitIdcInfo.Job, vboxNetFltWinInitIdcProbingWorker, &g_InitIdcInfo, false); + vboxNetFltWinJobEnqueueJob(&g_JobQueue, &g_InitIdcInfo.Job, false); + return VINF_SUCCESS; +} + +static int vboxNetFltWinInitNetFlt() +{ + int rc; + + do + { + rc = vboxNetFltWinInitNetFltBase(); + if(RT_FAILURE(rc)) + { + Assert(0); + break; + } + + /* + * connect to the support driver. + * + * This will call back vboxNetFltOsOpenSupDrv (and maybe vboxNetFltOsCloseSupDrv) + * for establishing the connect to the support driver. + */ + rc = vboxNetFltWinInitIdc(); + if (RT_FAILURE(rc)) + { + Assert(0); + vboxNetFltWinFiniNetFltBase(); + break; + } + } while (0); + + return rc; +} + +/* detach*/ +static int vboxNetFltWinDeleteInstance(PVBOXNETFLTINS pThis) +{ + PADAPT pAdapt = PVBOXNETFLTINS_2_PADAPT(pThis); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + NDIS_STATUS Status; + LogFlow(("vboxNetFltWinDeleteInstance: pThis=%p \n", pThis)); + + Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); + Assert(pAdapt); + Assert(pThis); + Assert(pThis->fDisconnectedFromHost); + Assert(!pThis->fRediscoveryPending); + Assert(!pThis->fActive); +#ifndef VBOXNETADP + Assert(pAdapt->PTState.OpState == kVBoxNetDevOpState_Deinitialized); + Assert(!pAdapt->hBindingHandle); +#endif + Assert(pAdapt->MPState.OpState == kVBoxNetDevOpState_Deinitialized); + Assert(!pThis->u.s.PacketQueueWorker.pSG); +// Assert(!pAdapt->hMiniportHandle); + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + Status = vboxNetFltWinMpDereferenceControlDevice(); + Assert(Status == NDIS_STATUS_SUCCESS); +#else + Status = vboxNetFltWinPtFiniUnbind(pAdapt); + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + /* pDetachInfo->Status = VERR_GENERAL_FAILURE; */ + } +#endif + + RTSemMutexDestroy(pThis->u.s.hAdaptMutex); + + return VINF_SUCCESS; +} + +static NDIS_STATUS vboxNetFltWinDisconnectIt(PVBOXNETFLTINS pInstance) +{ + vboxNetFltWinQuFiniPacketQueue(pInstance); + return NDIS_STATUS_SUCCESS; +} + +/* detach*/ +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinDetachFromInterface(PADAPT pAdapt, bool bOnUnbind) +{ + PVBOXNETFLTINS pThis = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + NDIS_STATUS Status; + int rc; + LogFlow(("vboxNetFltWinDetachFromInterface: pThis=%p\n", pThis)); + + Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); + Assert(pAdapt); + Assert(pThis); +/* Assert(!pThis->fActive); */ + + /* paranoya to ensyre the instance is not removed while we're waiting on the mutex + * in case ndis does something unpredictable, e.g. calls our miniport halt independently + * from protocol unbind and concurrently with it*/ + vboxNetFltRetain(pThis, false); + + rc = RTSemMutexRequest(pThis->u.s.hAdaptMutex, RT_INDEFINITE_WAIT); + if(RT_SUCCESS(rc)) + { +#ifndef VBOX_NETFLT_ONDEMAND_BIND + Assert(vboxNetFltWinGetAdaptState(pAdapt) == kVBoxAdaptState_Connected); + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initialized); +#ifndef VBOXNETADP + Assert(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Initialized); +#endif +// if( +//#ifdef VBOXNETADP +// vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initialized +//#else +// vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Initialized +//// && vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initialized +//#endif +// ) + if(vboxNetFltWinGetAdaptState(pAdapt) == kVBoxAdaptState_Connected) + { + vboxNetFltWinSetAdaptState(pAdapt, kVBoxAdaptState_Disconnecting); +#ifndef VBOXNETADP + Status = vboxNetFltWinPtDoUnbinding(pAdapt, bOnUnbind); +#else + Status = vboxNetFltWinMpDoDeinitialization(pAdapt); +#endif + Assert(Status == NDIS_STATUS_SUCCESS); + + vboxNetFltWinSetAdaptState(pAdapt, kVBoxAdaptState_Disconnected); + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); +#ifndef VBOXNETADP + Assert(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Deinitialized); +#endif +// /* paranoya */ +// vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); +//#ifndef VBOXNETADP +// vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitialized); +//#endif + + vboxNetFltWinPtFiniPADAPT(pAdapt); + + /* we're unbinding, make an unbind-related release */ + vboxNetFltRelease(pThis, false); +#else + Status = vboxNetFltWinPtFiniUnbind(pAdapt); + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + /* pDetachInfo->Status = VERR_GENERAL_FAILURE; */ + } +#endif + } + else + { + AssertBreakpoint(); +#ifndef VBOXNETADP + pAdapt->Status = NDIS_STATUS_FAILURE; +#endif + if(!bOnUnbind) + { + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + } + Status = NDIS_STATUS_FAILURE; + } + RTSemMutexRelease(pThis->u.s.hAdaptMutex); + } + else + { + AssertBreakpoint(); + Status = NDIS_STATUS_FAILURE; + } + + /* release for the retain we made before waining on the mutex */ + vboxNetFltRelease(pThis, false); + + return Status; +} + +/** + * Worker for vboxNetFltWinAttachToInterface. + * + * @param pAttachInfo Structure for communicating with + * vboxNetFltWinAttachToInterface. + */ +static void vboxNetFltWinAttachToInterfaceWorker(PATTACH_INFO pAttachInfo) +{ + PVBOXNETFLTINS pThis = pAttachInfo->pNetFltIf; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + int rc; + PADAPT pAdapt = PVBOXNETFLTINS_2_PADAPT(pThis); + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + /* to ensure we're not removed while we're here */ + vboxNetFltRetain(pThis, false); + + rc = RTSemMutexRequest(pThis->u.s.hAdaptMutex, RT_INDEFINITE_WAIT); + if(RT_SUCCESS(rc)) + { + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + Assert(vboxNetFltWinGetAdaptState(pAdapt) == kVBoxAdaptState_Disconnected); + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); +#ifndef VBOXNETADP + Assert(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Deinitialized); +#endif +// if(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized +//#ifndef VBOXNETADP +// && vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized +//#endif +// ) + if(vboxNetFltWinGetAdaptState(pAdapt) == kVBoxAdaptState_Disconnected) + { + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + if(pAttachInfo->fRediscovery) + { + /* rediscovery means adaptor bind is performed while intnet is already using it + * i.e. adaptor was unbound while being used by intnet and now being bound back again */ + Assert(((VBOXNETFTLINSSTATE)ASMAtomicUoReadU32((uint32_t volatile *)&pThis->enmState)) == kVBoxNetFltInsState_Connected); + } +#ifndef VBOXNETADP + Status = vboxNetFltWinPtInitPADAPT(pAdapt, pAttachInfo->pCreateContext->pOurName); +#else + Status = vboxNetFltWinPtInitPADAPT(pAdapt); +#endif + if(Status == NDIS_STATUS_SUCCESS) + { + vboxNetFltWinSetAdaptState(pAdapt, kVBoxAdaptState_Connecting); + +#ifndef VBOXNETADP + Status = vboxNetFltWinPtDoBinding(pAdapt, pAttachInfo->pCreateContext->pOurName, pAttachInfo->pCreateContext->pBindToName); +#else + Status = vboxNetFltWinMpDoInitialization(pAdapt, pAttachInfo->pCreateContext->hMiniportAdapter, pAttachInfo->pCreateContext->hWrapperConfigurationContext); +#endif + if (Status == NDIS_STATUS_SUCCESS) + { + if(pAttachInfo->fRediscovery || (Status = vboxNetFltWinMpReferenceControlDevice()) == NDIS_STATUS_SUCCESS) + { +#ifndef VBOXNETADP + if(pAdapt->Status == NDIS_STATUS_SUCCESS) +#endif + { + vboxNetFltWinSetAdaptState(pAdapt, kVBoxAdaptState_Connected); +// Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initialized); +#ifndef VBOXNETADP + Assert(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Initialized); +#endif +// /* paranoya */ +//// vboxNetFltWinSetAdaptState(&pAdapt->MPState, kVBoxNetDevOpState_Initialized); +//#ifndef VBOXNETADP +// vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Initialized); +//#endif + + RTSpinlockAcquire(pThis->hSpinlock, &Tmp); + + /* 4. mark as connected */ + ASMAtomicUoWriteBool(&pThis->fDisconnectedFromHost, false); + + RTSpinlockRelease(pThis->hSpinlock, &Tmp); + + pAttachInfo->Status = VINF_SUCCESS; + pAttachInfo->pCreateContext->Status = NDIS_STATUS_SUCCESS; + + RTSemMutexRelease(pThis->u.s.hAdaptMutex); + + vboxNetFltRelease(pThis, false); + + return; + } + AssertBreakpoint(); + + if(!pAttachInfo->fRediscovery) + { + vboxNetFltWinMpDereferenceControlDevice(); + } + } + AssertBreakpoint(); +#ifndef VBOXNETADP + vboxNetFltWinPtDoUnbinding(pAdapt, true); +#else + vboxNetFltWinMpDoDeinitialization(pAdapt); +#endif + } + AssertBreakpoint(); + vboxNetFltWinPtFiniPADAPT(pAdapt); + } + AssertBreakpoint(); + vboxNetFltWinSetAdaptState(pAdapt, kVBoxAdaptState_Disconnected); + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); +#ifndef VBOXNETADP + Assert(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Deinitialized); +#endif +// /* paranoya */ +// vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); +//#ifndef VBOXNETADP +// vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitialized); +//#endif + } + AssertBreakpoint(); + +#else /* VBOX_NETFLT_ONDEMAND_BIND */ + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + Status = vboxNetFltWinPtInitBind(pAdapt); + if (Status != NDIS_STATUS_SUCCESS) + { + pAttachInfo->Status = VERR_GENERAL_FAILURE; + break; + } + + Status = vboxNetFltWinGetMacAddress(pAdapt, &pThis->u.s.Mac); + if (Status != NDIS_STATUS_SUCCESS) + { + vboxNetFltWinPtFiniUnbind(pAdapt); + pAttachInfo->Status = VERR_GENERAL_FAILURE; + break; + } +#endif /* VBOX_NETFLT_ONDEMAND_BIND */ + + + pAttachInfo->Status = VERR_GENERAL_FAILURE; + pAttachInfo->pCreateContext->Status = Status; + RTSemMutexRelease(pThis->u.s.hAdaptMutex); + } + else + { + AssertBreakpoint(); + pAttachInfo->Status = rc; + } + + vboxNetFltRelease(pThis, false); + + return; +} + +/** + * Common code for vboxNetFltOsInitInstance and + * vboxNetFltOsMaybeRediscovered. + * + * @returns IPRT status code. + * @param pThis The instance. + * @param fRediscovery True if vboxNetFltOsMaybeRediscovered is calling, + * false if it's vboxNetFltOsInitInstance. + */ +static int vboxNetFltWinAttachToInterface(PVBOXNETFLTINS pThis, void * pContext, bool fRediscovery) +{ + ATTACH_INFO Info; + Info.pNetFltIf = pThis; + Info.fRediscovery = fRediscovery; + Info.pCreateContext = (PCREATE_INSTANCE_CONTEXT)pContext; + + +#ifdef VBOX_NETFLT_ONDEMAND_BIND + /* packet queue worker thread gets created on attach interface, need to do it via job at passive level */ + vboxNetFltWinJobSynchExecAtPassive((JOB_ROUTINE)vboxNetFltWinAttachToInterfaceWorker, &Info); +#else + vboxNetFltWinAttachToInterfaceWorker(&Info); +#endif + return Info.Status; +} + +/* + * + * The OS specific interface definition + * + */ + + +bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThis) +{ + /* AttachToInterface true if disconnected */ + return !ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost); +} + +int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, PINTNETSG pSG, uint32_t fDst) +{ + int rc = VINF_SUCCESS; + uint32_t cRefs = 0; + PADAPT pAdapt; +#if !defined(VBOXNETADP) && !defined(VBOX_NETFLT_ONDEMAND_BIND) + if(fDst & INTNETTRUNKDIR_WIRE) + { + cRefs++; + } + if(fDst & INTNETTRUNKDIR_HOST) + { + cRefs++; + } +#else + if(fDst & INTNETTRUNKDIR_WIRE || fDst & INTNETTRUNKDIR_HOST) + { + cRefs = 1; + } +#endif + + AssertReturn(cRefs, VINF_SUCCESS); + + pAdapt = PVBOXNETFLTINS_2_PADAPT(pThis); + + if(!vboxNetFltWinIncReferenceAdapt(pAdapt, cRefs)) + { + return VERR_GENERAL_FAILURE; + } +#ifndef VBOXNETADP + if ((fDst & INTNETTRUNKDIR_WIRE) +# ifdef VBOX_NETFLT_ONDEMAND_BIND + || (fDst & INTNETTRUNKDIR_HOST) +# endif + ) + { + PNDIS_PACKET pPacket; + + pPacket = vboxNetFltWinNdisPacketFromSG(pAdapt, pSG, NULL /*pBufToFree*/, + true /*fToWire*/, true /*fCopyMemory*/); + + if (pPacket) + { + NDIS_STATUS fStatus; +# ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// PPACKET_INFO pInfo = vboxNetFltWinDoSend(&fStatus, pAdapt, pPacket); +# else + NdisSend(&fStatus, pAdapt->hBindingHandle, pPacket); +# endif + if (fStatus != NDIS_STATUS_PENDING) + { + if(!NT_SUCCESS(fStatus)) + { + /* TODO: convert status to VERR_xxx */ + rc = VERR_GENERAL_FAILURE; + } +# ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// if(pInfo) +// { +// /* TODO: FIXME: remove this assert */ +// Assert(fStatus == NDIS_STATUS_SUCCESS); +// +// vboxNetFltWinDoCompleteSendViaInfo(pAdapt, pInfo); +// vboxNetFltWinPpFreePacketInfo(pInfo); +// } +// else +// { +// Assert(0); +// } +# endif + vboxNetFltWinFreeSGNdisPacket(pPacket, true); + } + else + { + /* pending, dereference on packet complete */ + cRefs--; + } + } + else + { + Assert(0); + rc = VERR_NO_MEMORY; + } + } +#endif +#ifndef VBOX_NETFLT_ONDEMAND_BIND +#ifndef VBOXNETADP + if (fDst & INTNETTRUNKDIR_HOST) +#else + if(cRefs) +#endif + { + PNDIS_PACKET pPacket = vboxNetFltWinNdisPacketFromSG(pAdapt, pSG, NULL /*pBufToFree*/, + false /*fToWire*/, true /*fCopyMemory*/); + if (pPacket) + { +# ifndef DEBUG_NETFLT_LOOPBACK + NdisMIndicateReceivePacket(pAdapt->hMiniportHandle, &pPacket, 1); +# else +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// PPACKET_INFO pInfo = vboxNetFltWinDoIndicateReceive(pAdapt, pPacket); +// if(!pInfo) +// { +// Assert(0); +// vboxNetFltWinFreeSGNdisPacket(pPacket, true); +// rc = VERR_NO_MEMORY; +// } +// else +# endif + { + cRefs--; + } +#ifdef VBOXNETADP + STATISTIC_INCREASE(pAdapt->cRxSuccess); +#endif + } + else + { + Assert(0); +#ifdef VBOXNETADP + STATISTIC_INCREASE(pAdapt->cRxError); +#endif + rc = VERR_NO_MEMORY; + } + } + + Assert(cRefs <= 2); + + if(cRefs) + { + vboxNetFltWinDecReferenceAdapt(pAdapt, cRefs); + } +#endif + + return rc; +} + +bool vboxNetFltPortOsIsPromiscuous(PVBOXNETFLTINS pThis) +{ +#ifndef VBOXNETADP + PADAPT pAdapt = PVBOXNETFLTINS_2_PADAPT(pThis); + if(VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)) + { + bool bPromiscuous; + if(!vboxNetFltWinReferenceAdapt(pAdapt)) + return false; + + bPromiscuous = (pAdapt->fOurSetFilter & NDIS_PACKET_TYPE_PROMISCUOUS) == NDIS_PACKET_TYPE_PROMISCUOUS; + /*vboxNetFltWinIsPromiscuous(pAdapt);*/ + + vboxNetFltWinDereferenceAdapt(pAdapt); + return bPromiscuous; + } + return false; +#else + return true; +#endif +} + +void vboxNetFltPortOsGetMacAddress(PVBOXNETFLTINS pThis, PRTMAC pMac) +{ + *pMac = pThis->u.s.Mac; +} + +bool vboxNetFltPortOsIsHostMac(PVBOXNETFLTINS pThis, PCRTMAC pMac) +{ + /* ASSUMES that the MAC address never changes. */ + return pThis->u.s.Mac.au16[0] == pMac->au16[0] + && pThis->u.s.Mac.au16[1] == pMac->au16[1] + && pThis->u.s.Mac.au16[2] == pMac->au16[2]; +} + +void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive) +{ +#ifndef VBOXNETADP + NDIS_STATUS Status; +#endif + PADAPT pAdapt = PVBOXNETFLTINS_2_PADAPT(pThis); + if(!vboxNetFltWinReferenceAdapt(pAdapt)) + return; + +#ifndef VBOXNETADP +# ifndef VBOX_NETFLT_ONDEMAND_BIND + if(fActive) + { + /* + * flush any pass-thru receive-queued packets + */ + vboxNetFltWinPtFlushReceiveQueue(pAdapt, false /*fReturn*/); + } +# endif + + + if(fActive) + { +#ifdef DEBUG_misha + NDIS_PHYSICAL_MEDIUM PhMedium; + bool bPromiscSupported; + + Status = vboxNetFltWinQueryPhysicalMedium(pAdapt, &PhMedium); + if(Status != NDIS_STATUS_SUCCESS) + { + + DBGPRINT(("vboxNetFltWinQueryPhysicalMedium failed, Status (0x%x), setting medium to NdisPhysicalMediumUnspecified\n", Status)); + Assert(Status == NDIS_STATUS_NOT_SUPPORTED); + if(Status != NDIS_STATUS_NOT_SUPPORTED) + { + LogRel(("vboxNetFltWinQueryPhysicalMedium failed, Status (0x%x), setting medium to NdisPhysicalMediumUnspecified\n", Status)); + } + PhMedium = NdisPhysicalMediumUnspecified; + } + else + { + DBGPRINT(("(SUCCESS) vboxNetFltWinQueryPhysicalMedium SUCCESS\n")); + } + + bPromiscSupported = (!(PhMedium == NdisPhysicalMediumWirelessWan + || PhMedium == NdisPhysicalMediumWirelessLan + || PhMedium == NdisPhysicalMediumNative802_11 + || PhMedium == NdisPhysicalMediumBluetooth + /*|| PhMedium == NdisPhysicalMediumWiMax */ + )); + + Assert(bPromiscSupported == VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)); +#endif + } + + if(VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)) + { + Status = vboxNetFltWinSetPromiscuous(pAdapt, fActive); + if(Status != NDIS_STATUS_SUCCESS) + { + DBGPRINT(("vboxNetFltWinSetPromiscuous failed, Status (0x%x), fActive (%d)\n", Status, fActive)); + Assert(0); + LogRel(("vboxNetFltWinSetPromiscuous failed, Status (0x%x), fActive (%d)\n", Status, fActive)); + } + } +#else +# ifdef VBOXNETADP_REPORT_DISCONNECTED + if(fActive) + { + NdisMIndicateStatus(pAdapt->hMiniportHandle, + NDIS_STATUS_MEDIA_CONNECT, + (PVOID)NULL, + 0); + } + else + { + NdisMIndicateStatus(pAdapt->hMiniportHandle, + NDIS_STATUS_MEDIA_DISCONNECT, + (PVOID)NULL, + 0); + } +#else + if(fActive) + { + /* indicate status change to make the ip settings be re-picked for dhcp */ + NdisMIndicateStatus(pAdapt->hMiniportHandle, + NDIS_STATUS_MEDIA_DISCONNECT, + (PVOID)NULL, + 0); + + NdisMIndicateStatus(pAdapt->hMiniportHandle, + NDIS_STATUS_MEDIA_CONNECT, + (PVOID)NULL, + 0); + } +# endif +#endif + vboxNetFltWinDereferenceAdapt(pAdapt); + + return; +} + +int vboxNetFltOsDisconnectIt(PVBOXNETFLTINS pThis) +{ + NDIS_STATUS Status = vboxNetFltWinDisconnectIt(pThis); + return Status == NDIS_STATUS_SUCCESS ? VINF_SUCCESS : VERR_GENERAL_FAILURE; +} + +static void vboxNetFltWinConnectItWorker(PWORKER_INFO pInfo) +{ + NDIS_STATUS Status; + PVBOXNETFLTINS pInstance = pInfo->pNetFltIf; + PADAPT pAdapt = PVBOXNETFLTINS_2_PADAPT(pInstance); + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + /* this is not a rediscovery, initialize Mac cache */ + if(vboxNetFltWinReferenceAdapt(pAdapt)) + { +#ifndef VBOXNETADP + Status = vboxNetFltWinGetMacAddress(pAdapt, &pInstance->u.s.Mac); + if (Status == NDIS_STATUS_SUCCESS) +#endif + { + Status = vboxNetFltWinQuInitPacketQueue(pInstance); + if(Status == NDIS_STATUS_SUCCESS) + { + pInfo->Status = VINF_SUCCESS; + } + else + { + pInfo->Status = VERR_GENERAL_FAILURE; + } + } +#ifndef VBOXNETADP + else + { + pInfo->Status = VERR_INTNET_FLT_IF_FAILED; + } +#endif + + vboxNetFltWinDereferenceAdapt(pAdapt); + } + else + { + pInfo->Status = VERR_INTNET_FLT_IF_NOT_FOUND; + } +} + +static int vboxNetFltWinConnectIt(PVBOXNETFLTINS pThis) +{ + WORKER_INFO Info; + Info.pNetFltIf = pThis; + + vboxNetFltWinJobSynchExecAtPassive(vboxNetFltWinConnectItWorker, &Info); + + return Info.Status; +} + +int vboxNetFltOsConnectIt(PVBOXNETFLTINS pThis) +{ + return vboxNetFltWinConnectIt(pThis); +} + +void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis) +{ + vboxNetFltWinDeleteInstance(pThis); +} + +int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext) +{ + int rc = RTSemMutexCreate(&pThis->u.s.hAdaptMutex); + if (RT_SUCCESS(rc)) + { + rc = vboxNetFltWinAttachToInterface(pThis, pvContext, false /*fRediscovery*/ ); + if (RT_SUCCESS(rc)) + { + return rc; + } + RTSemMutexDestroy(pThis->u.s.hAdaptMutex); + } + return rc; +} + +int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis) +{ + PADAPT pAdapt = PVBOXNETFLTINS_2_PADAPT(pThis); + vboxNetFltWinSetAdaptState(pAdapt, kVBoxAdaptState_Disconnected); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); +#ifndef VBOXNETADP + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitialized); +#endif + return VINF_SUCCESS; +} + diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.h b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.h new file mode 100644 index 000000000..6fb1832a3 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.h @@ -0,0 +1,944 @@ +/* $Id: VBoxNetFlt-win.h $ */ +/** @file + * VBoxNetFlt - Network Filter Driver (Host), Windows Specific Code. Integration with IntNet/NetFlt + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. + * Copyright (c) 1993-1999, Microsoft Corporation + */ + +#ifndef ___VBoxNetFlt_win_h___ +#define ___VBoxNetFlt_win_h___ + +/* + * globals + */ + +/** global lock */ +extern NDIS_SPIN_LOCK g_GlobalLock; + +extern UINT g_fPacketDontLoopBack; +extern UINT g_fPacketIsLoopedBack; + +/* + * Debug Print API + */ +#ifdef DEBUG + +#define DBGPRINT(Fmt) DbgPrint Fmt + +#else /* if DBG */ + +#define DBGPRINT(Fmt) + +#endif /* if DBG */ + + +DECLHIDDEN(NTSTATUS) vboxNetFltWinPtDispatch(IN PDEVICE_OBJECT pDeviceObject, IN PIRP pIrp); +DECLHIDDEN(VOID) vboxNetFltWinUnload(IN PDRIVER_OBJECT DriverObject); + +/************************* + * packet queue API * + *************************/ + + +#define LIST_ENTRY_2_PACKET_INFO(pListEntry) \ + ( (PPACKET_INFO)((uint8_t *)(pListEntry) - RT_OFFSETOF(PACKET_INFO, ListEntry)) ) + +/** + * enqueus the packet info to the tail of the queue + */ +DECLINLINE(void) vboxNetFltWinQuEnqueueTail(PPACKET_QUEUE pQueue, PPACKET_INFO pPacketInfo) +{ + InsertTailList(pQueue, &pPacketInfo->ListEntry); +} + +DECLINLINE(void) vboxNetFltWinQuEnqueueHead(PPACKET_QUEUE pQueue, PPACKET_INFO pPacketInfo) +{ + Assert(pPacketInfo->pPool); + InsertHeadList(pQueue, &pPacketInfo->ListEntry); +} + +/** + * enqueus the packet info to the tail of the queue + */ +DECLINLINE(void) vboxNetFltWinQuInterlockedEnqueueTail(PINTERLOCKED_PACKET_QUEUE pQueue, PPACKET_INFO pPacketInfo) +{ + Assert(pPacketInfo->pPool); + NdisAcquireSpinLock(&pQueue->Lock); + vboxNetFltWinQuEnqueueTail(&pQueue->Queue, pPacketInfo); + NdisReleaseSpinLock(&pQueue->Lock); +} + +DECLINLINE(void) vboxNetFltWinQuInterlockedEnqueueHead(PINTERLOCKED_PACKET_QUEUE pQueue, PPACKET_INFO pPacketInfo) +{ + NdisAcquireSpinLock(&pQueue->Lock); + vboxNetFltWinQuEnqueueHead(&pQueue->Queue, pPacketInfo); + NdisReleaseSpinLock(&pQueue->Lock); +} + +/** + * dequeus the packet info from the head of the queue + */ +DECLINLINE(PPACKET_INFO) vboxNetFltWinQuDequeueHead(PPACKET_QUEUE pQueue) +{ + PLIST_ENTRY pListEntry = RemoveHeadList(pQueue); + if(pListEntry != pQueue) + { + PPACKET_INFO pInfo = LIST_ENTRY_2_PACKET_INFO(pListEntry); + Assert(pInfo->pPool); + return pInfo; + } + return NULL; +} + +DECLINLINE(PPACKET_INFO) vboxNetFltWinQuDequeueTail(PPACKET_QUEUE pQueue) +{ + PLIST_ENTRY pListEntry = RemoveTailList(pQueue); + if(pListEntry != pQueue) + { + PPACKET_INFO pInfo = LIST_ENTRY_2_PACKET_INFO(pListEntry); + Assert(pInfo->pPool); + return pInfo; + } + return NULL; +} + +DECLINLINE(PPACKET_INFO) vboxNetFltWinQuInterlockedDequeueHead(PINTERLOCKED_PACKET_QUEUE pInterlockedQueue) +{ + PPACKET_INFO pInfo; + NdisAcquireSpinLock(&pInterlockedQueue->Lock); + pInfo = vboxNetFltWinQuDequeueHead(&pInterlockedQueue->Queue); + NdisReleaseSpinLock(&pInterlockedQueue->Lock); + return pInfo; +} + +DECLINLINE(PPACKET_INFO) vboxNetFltWinQuInterlockedDequeueTail(PINTERLOCKED_PACKET_QUEUE pInterlockedQueue) +{ + PPACKET_INFO pInfo; + NdisAcquireSpinLock(&pInterlockedQueue->Lock); + pInfo = vboxNetFltWinQuDequeueTail(&pInterlockedQueue->Queue); + NdisReleaseSpinLock(&pInterlockedQueue->Lock); + return pInfo; +} + +DECLINLINE(void) vboxNetFltWinQuDequeue(PPACKET_INFO pInfo) +{ + RemoveEntryList(&pInfo->ListEntry); +} + +DECLINLINE(void) vboxNetFltWinQuInterlockedDequeue(PINTERLOCKED_PACKET_QUEUE pInterlockedQueue, PPACKET_INFO pInfo) +{ + NdisAcquireSpinLock(&pInterlockedQueue->Lock); + vboxNetFltWinQuDequeue(pInfo); + NdisReleaseSpinLock(&pInterlockedQueue->Lock); +} + +/** + * allocates the packet info from the pool + */ +DECLINLINE(PPACKET_INFO) vboxNetFltWinPpAllocPacketInfo(PPACKET_INFO_POOL pPool) +{ + return vboxNetFltWinQuInterlockedDequeueHead(&pPool->Queue); +} + +/** + * returns the packet info to the pool + */ +DECLINLINE(void) vboxNetFltWinPpFreePacketInfo(PPACKET_INFO pInfo) +{ + PPACKET_INFO_POOL pPool = pInfo->pPool; + vboxNetFltWinQuInterlockedEnqueueHead(&pPool->Queue, pInfo); +} + +/** initializes the packet queue */ +#define INIT_PACKET_QUEUE(_pQueue) InitializeListHead((_pQueue)) + +/** initializes the packet queue */ +#define INIT_INTERLOCKED_PACKET_QUEUE(_pQueue) \ + { \ + INIT_PACKET_QUEUE(&(_pQueue)->Queue); \ + NdisAllocateSpinLock(&(_pQueue)->Lock); \ + } + +/** delete the packet queue */ +#define FINI_INTERLOCKED_PACKET_QUEUE(_pQueue) NdisFreeSpinLock(&(_pQueue)->Lock) + +/** returns the packet the packet info contains */ +#define GET_PACKET_FROM_INFO(_pPacketInfo) (ASMAtomicUoReadPtr((void * volatile *)&(_pPacketInfo)->pPacket)) + +/** assignes the packet to the packet info */ +#define SET_PACKET_TO_INFO(_pPacketInfo, _pPacket) (ASMAtomicUoWritePtr((void * volatile *)&(_pPacketInfo)->pPacket, (_pPacket))) + +/** returns the flags the packet info contains */ +#define GET_FLAGS_FROM_INFO(_pPacketInfo) (ASMAtomicUoReadU32((volatile uint32_t *)&(_pPacketInfo)->fFlags)) + +/** sets flags to the packet info */ +#define SET_FLAGS_TO_INFO(_pPacketInfo, _fFlags) (ASMAtomicUoWriteU32((volatile uint32_t *)&(_pPacketInfo)->fFlags, (_fFlags))) + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinQuEnqueuePacket(PVBOXNETFLTINS pInstance, PVOID pPacket, const UINT fPacketFlags); + +#ifndef VBOX_NETFLT_ONDEMAND_BIND +DECLHIDDEN(void) vboxNetFltWinQuFiniPacketQueue(PVBOXNETFLTINS pInstance); + +DECLHIDDEN(NTSTATUS) vboxNetFltWinQuInitPacketQueue(PVBOXNETFLTINS pInstance); +#endif + + +/** + * searches the list entry in a single-linked list + */ +DECLINLINE(bool) vboxNetFltWinSearchListEntry(PSINGLE_LIST pList, PSINGLE_LIST_ENTRY pEntry2Search, bool bRemove) +{ + PSINGLE_LIST_ENTRY pHead = &pList->Head; + PSINGLE_LIST_ENTRY pCur; + PSINGLE_LIST_ENTRY pPrev; + for(pCur = pHead->Next, pPrev = pHead; pCur; pPrev = pCur, pCur = pCur->Next) + { + if(pEntry2Search == pCur) + { + if(bRemove) + { + pPrev->Next = pCur->Next; + if(pCur == pList->pTail) + { + pList->pTail = pPrev; + } + } + return true; + } + } + return false; +} + +DECLINLINE(void) vboxNetFltWinPutTail(PSINGLE_LIST pList, PSINGLE_LIST_ENTRY pEntry) +{ + pList->pTail->Next = pEntry; + pList->pTail = pEntry; +} + +DECLINLINE(PSINGLE_LIST_ENTRY) vboxNetFltWinGetHead(PSINGLE_LIST pList) +{ + PSINGLE_LIST_ENTRY pEntry = pList->Head.Next; + if(pEntry && pEntry == pList->pTail) + { + pList->pTail = &pList->Head; + } + return pEntry; +} + +DECLINLINE(bool) vboxNetFltWinInterlockedSearchListEntry(PINTERLOCKED_SINGLE_LIST pList, PSINGLE_LIST_ENTRY pEntry2Search, bool bRemove) +{ + bool bFound; + NdisAcquireSpinLock(&pList->Lock); + bFound = vboxNetFltWinSearchListEntry(&pList->List, pEntry2Search, bRemove); + NdisReleaseSpinLock(&pList->Lock); + return bFound; +} + +DECLINLINE(void) vboxNetFltWinInterlockedPutTail(PINTERLOCKED_SINGLE_LIST pList, PSINGLE_LIST_ENTRY pEntry) +{ + NdisAcquireSpinLock(&pList->Lock); + vboxNetFltWinPutTail(&pList->List, pEntry); + NdisReleaseSpinLock(&pList->Lock); +} + +DECLINLINE(PSINGLE_LIST_ENTRY) vboxNetFltWinInterlockedGetHead(PINTERLOCKED_SINGLE_LIST pList) +{ + PSINGLE_LIST_ENTRY pEntry; + NdisAcquireSpinLock(&pList->Lock); + pEntry = vboxNetFltWinGetHead(&pList->List); + NdisReleaseSpinLock(&pList->Lock); + return pEntry; +} + +/** initializes the list */ +#define INIT_SINGLE_LIST(_pList) \ + { \ + (_pList)->Head.Next = NULL; \ + (_pList)->pTail = &(_pList)->Head; \ + } + +/** initializes the list */ +#define INIT_INTERLOCKED_SINGLE_LIST(_pList) \ + { \ + INIT_SINGLE_LIST(&(_pList)->List); \ + NdisAllocateSpinLock(&(_pList)->Lock); \ + } + +/** delete the packet queue */ +#define FINI_INTERLOCKED_SINGLE_LIST(_pList) NdisFreeSpinLock(&(_pList)->Lock) + +/** obtains the PTRANSFERDATA_RSVD given a single list entry it contains */ +#define PT_SLE_2_TRANSFERDATA_RSVD(_pl) \ + ( (PTRANSFERDATA_RSVD)((uint8_t *)(_pl) - RT_OFFSETOF(TRANSFERDATA_RSVD, ListEntry))) + +/** obtains the ndis packet given a single list entry assuming it is stored in ProtocolReserved field of the packet */ +#define PT_SLE_2_NDIS_PACKET(_pl) \ + ( (PNDIS_PACKET)((uint8_t *)PT_SLE_2_TRANSFERDATA_RSVD(_pl) - RT_OFFSETOF(NDIS_PACKET, ProtocolReserved))) + +/************************************************************************** + * PADAPT, PVBOXNETFLTINS reference/dereference (i.e. retain/release) API * + **************************************************************************/ + +/** get the PVBOXNETFLTINS from PADAPT */ +#define PADAPT_2_PVBOXNETFLTINS(_pAdapt) ( (PVBOXNETFLTINS)((uint8_t *)(_pAdapt) - RT_OFFSETOF(VBOXNETFLTINS, u.s.IfAdaptor)) ) +/** get the PADAPT from PVBOXNETFLTINS */ +#define PVBOXNETFLTINS_2_PADAPT(_pNetFlt) ( &(_pNetFlt)->u.s.IfAdaptor ) + +DECLHIDDEN(void) vboxNetFltWinWaitDereference(PADAPT_DEVICE pState); + +DECLINLINE(void) vboxNetFltWinSetPowerState(PADAPT_DEVICE pState, NDIS_DEVICE_POWER_STATE State) +{ + ASMAtomicUoWriteU32((volatile uint32_t *)&pState->PowerState, State); +} + +DECLINLINE(NDIS_DEVICE_POWER_STATE) vboxNetFltWinGetPowerState(PADAPT_DEVICE pState) +{ + return (NDIS_DEVICE_POWER_STATE)ASMAtomicUoReadU32((volatile uint32_t *)&pState->PowerState); +} + +DECLINLINE(void) vboxNetFltWinSetOpState(PADAPT_DEVICE pState, VBOXNETDEVOPSTATE State) +{ + ASMAtomicUoWriteU32((volatile uint32_t *)&pState->OpState, State); +} + +DECLINLINE(VBOXNETDEVOPSTATE) vboxNetFltWinGetOpState(PADAPT_DEVICE pState) +{ + return (VBOXNETDEVOPSTATE)ASMAtomicUoReadU32((volatile uint32_t *)&pState->OpState); +} + +DECLINLINE(bool) vboxNetFltWinDoReferenceDevice(PADAPT pAdapt, PADAPT_DEVICE pState) +{ + if (vboxNetFltWinGetPowerState(pState) == NdisDeviceStateD0 && vboxNetFltWinGetOpState(pState) == kVBoxNetDevOpState_Initialized) + { + /** @todo r=bird: Since this is a volatile member, why don't you declare it as + * such and save yourself all the casting? */ + ASMAtomicIncU32((uint32_t volatile *)&pState->cReferences); + return true; + } + return false; +} + +#ifndef VBOXNETADP +DECLINLINE(bool) vboxNetFltWinDoReferenceDevices(PADAPT pAdapt, PADAPT_DEVICE pState1, PADAPT_DEVICE pState2) +{ + if (vboxNetFltWinGetPowerState(pState1) == NdisDeviceStateD0 + && vboxNetFltWinGetOpState(pState1) == kVBoxNetDevOpState_Initialized + && vboxNetFltWinGetPowerState(pState2) == NdisDeviceStateD0 + && vboxNetFltWinGetOpState(pState2) == kVBoxNetDevOpState_Initialized) + { + ASMAtomicIncU32((uint32_t volatile *)&pState1->cReferences); + ASMAtomicIncU32((uint32_t volatile *)&pState2->cReferences); + return true; + } + return false; +} +#endif + +DECLINLINE(void) vboxNetFltWinDereferenceDevice(PADAPT pAdapt, PADAPT_DEVICE pState) +{ +/* NdisAcquireSpinLock(&pAdapt->Lock); */ + ASMAtomicDecU32((uint32_t volatile *)&pState->cReferences); + /** @todo r=bird: Add comment explaining why these cannot hit 0 or why + * reference are counted */ +/* NdisReleaseSpinLock(&pAdapt->Lock); */ +} + +#ifndef VBOXNETADP +DECLINLINE(void) vboxNetFltWinDereferenceDevices(PADAPT pAdapt, PADAPT_DEVICE pState1, PADAPT_DEVICE pState2) +{ +/* NdisAcquireSpinLock(&pAdapt->Lock); */ + ASMAtomicDecU32((uint32_t volatile *)&pState1->cReferences); + ASMAtomicDecU32((uint32_t volatile *)&pState2->cReferences); +/* NdisReleaseSpinLock(&pAdapt->Lock); */ +} +#endif + +DECLINLINE(void) vboxNetFltWinDecReferenceDevice(PADAPT pAdapt, PADAPT_DEVICE pState, uint32_t v) +{ + ASMAtomicAddU32((uint32_t volatile *)&pState->cReferences, (uint32_t)(-((int32_t)v))); +} + +#ifndef VBOXNETADP +DECLINLINE(void) vboxNetFltWinDecReferenceDevices(PADAPT pAdapt, PADAPT_DEVICE pState1, PADAPT_DEVICE pState2, uint32_t v) +{ + ASMAtomicAddU32((uint32_t volatile *)&pState1->cReferences, (uint32_t)(-((int32_t)v))); + ASMAtomicAddU32((uint32_t volatile *)&pState2->cReferences, (uint32_t)(-((int32_t)v))); +} +#endif + +DECLINLINE(bool) vboxNetFltWinDoIncReferenceDevice(PADAPT pAdapt, PADAPT_DEVICE pState, uint32_t v) +{ + if (vboxNetFltWinGetPowerState(pState) == NdisDeviceStateD0 && vboxNetFltWinGetOpState(pState) == kVBoxNetDevOpState_Initialized) + { + ASMAtomicAddU32((uint32_t volatile *)&pState->cReferences, v); + return true; + } + return false; +} + +#ifndef VBOXNETADP +DECLINLINE(bool) vboxNetFltWinDoIncReferenceDevices(PADAPT pAdapt, PADAPT_DEVICE pState1, PADAPT_DEVICE pState2, uint32_t v) +{ + if (vboxNetFltWinGetPowerState(pState1) == NdisDeviceStateD0 + && vboxNetFltWinGetOpState(pState1) == kVBoxNetDevOpState_Initialized + && vboxNetFltWinGetPowerState(pState2) == NdisDeviceStateD0 + && vboxNetFltWinGetOpState(pState2) == kVBoxNetDevOpState_Initialized) + { + ASMAtomicAddU32((uint32_t volatile *)&pState1->cReferences, v); + ASMAtomicAddU32((uint32_t volatile *)&pState2->cReferences, v); + return true; + } + return false; +} +#endif + +#ifdef VBOX_NETFLT_ONDEMAND_BIND +DECLINLINE(PVBOXNETFLTINS) vboxNetFltWinReferenceAdaptNetFltFromAdapt(PADAPT pAdapt) +{ + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + PVBOXNETFLTINS pNetFlt; + + pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + + RTSpinlockAcquire((pNetFlt)->hSpinlock, &Tmp); + if(!ASMAtomicUoReadBool(&(pNetFlt)->fActive)) + { + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + return NULL; + } + + if(!vboxNetFltWinDoReferenceDevice(pAdapt, &pAdapt->PTState)) + { + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + return NULL; + } + + vboxNetFltRetain((pNetFlt), true /* fBusy */); + + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + + return pNetFlt; +} +#else +DECLINLINE(bool) vboxNetFltWinReferenceAdaptNetFltFromAdapt(PADAPT pAdapt, PVBOXNETFLTINS *ppNetFlt) +{ + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + + RTSpinlockAcquire((pNetFlt)->hSpinlock, &Tmp); +#ifndef VBOXNETADP + if(!vboxNetFltWinDoReferenceDevices(pAdapt, &pAdapt->MPState, &pAdapt->PTState)) +#else + if(!vboxNetFltWinDoReferenceDevice(pAdapt, &pAdapt->MPState)) +#endif + { + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + *ppNetFlt = NULL; + return false; + } + + if(!ASMAtomicUoReadBool(&(pNetFlt)->fActive)) + { + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + *ppNetFlt = NULL; + return true; + } + + vboxNetFltRetain((pNetFlt), true /* fBusy */); + + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + + *ppNetFlt = pNetFlt; + return true; +} +#endif + +#ifdef VBOX_NETFLT_ONDEMAND_BIND +DECLINLINE(PVBOXNETFLTINS) vboxNetFltWinIncReferenceAdaptNetFltFromAdapt(PADAPT pAdapt, uint32_t v) +{ + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + PVBOXNETFLTINS pNetFlt; + uint32_t i; + + Assert(v); + if(!v) + { + return NULL; + } + + pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + + RTSpinlockAcquire((pNetFlt)->hSpinlock, &Tmp); + if(!ASMAtomicUoReadBool(&(pNetFlt)->fActive)) + { + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + return NULL; + } + + if(!vboxNetFltWinDoIncReferenceDevice(pAdapt, &pAdapt->PTState, v)) + { + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + return NULL; + } + + vboxNetFltRetain((pNetFlt), true /* fBusy */); + + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + + /* we have marked it as busy, so can do the res references outside the lock */ + for(i = 0; i < v-1; i++) + { + vboxNetFltRetain((pNetFlt), true /* fBusy */); + } + + return pNetFlt; +} +#else +DECLINLINE(bool) vboxNetFltWinIncReferenceAdaptNetFltFromAdapt(PADAPT pAdapt, PVBOXNETFLTINS *ppNetFlt, uint32_t v) +{ + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + uint32_t i; + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + + Assert(v); + if(!v) + { + *ppNetFlt = NULL; + return false; + } + + RTSpinlockAcquire((pNetFlt)->hSpinlock, &Tmp); +#ifndef VBOXNETADP + if(!vboxNetFltWinDoIncReferenceDevices(pAdapt, &pAdapt->MPState, &pAdapt->PTState, v)) +#else + if(!vboxNetFltWinDoIncReferenceDevice(pAdapt, &pAdapt->MPState, v)) +#endif + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + *ppNetFlt = NULL; + return false; + } + + if(!ASMAtomicUoReadBool(&(pNetFlt)->fActive)) + { + RTSpinlockRelease((pNetFlt)->hSpinlock, &Tmp); + *ppNetFlt = NULL; + return true; + } + + vboxNetFltRetain(pNetFlt, true /* fBusy */); + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + + /* we have marked it as busy, so can do the res references outside the lock */ + for(i = 0; i < v-1; i++) + { + vboxNetFltRetain(pNetFlt, true /* fBusy */); + } + + *ppNetFlt = pNetFlt; + + return true; +} + +#endif + +DECLINLINE(void) vboxNetFltWinDecReferenceNetFlt(PVBOXNETFLTINS pNetFlt, uint32_t n) +{ + uint32_t i; + for(i = 0; i < n; i++) + { + vboxNetFltRelease(pNetFlt, true); + } +} + +DECLINLINE(void) vboxNetFltWinDereferenceNetFlt(PVBOXNETFLTINS pNetFlt) +{ + vboxNetFltRelease(pNetFlt, true); +} + +DECLINLINE(void) vboxNetFltWinDecReferenceAdapt(PADAPT pAdapt, uint32_t v) +{ +#ifdef VBOX_NETFLT_ONDEMAND_BIND + vboxNetFltWinDecReferenceDevice(pAdapt, &pAdapt->PTState, v); +#elif defined(VBOXNETADP) + vboxNetFltWinDecReferenceDevice(pAdapt, &pAdapt->MPState, v); +#else + vboxNetFltWinDecReferenceDevices(pAdapt, &pAdapt->MPState, &pAdapt->PTState, v); +#endif +} + +DECLINLINE(void) vboxNetFltWinDereferenceAdapt(PADAPT pAdapt) +{ +#ifdef VBOX_NETFLT_ONDEMAND_BIND + vboxNetFltWinDereferenceDevice(pAdapt, &pAdapt->PTState); +#elif defined(VBOXNETADP) + vboxNetFltWinDereferenceDevice(pAdapt, &pAdapt->MPState); +#else + vboxNetFltWinDereferenceDevices(pAdapt, &pAdapt->MPState, &pAdapt->PTState); +#endif +} + +DECLINLINE(bool) vboxNetFltWinIncReferenceAdapt(PADAPT pAdapt, uint32_t v) +{ + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + + Assert(v); + if(!v) + { + return false; + } + + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); +#ifdef VBOX_NETFLT_ONDEMAND_BIND + if(vboxNetFltWinDoIncReferenceDevice(pAdapt, &pAdapt->PTState)) +#elif defined(VBOXNETADP) + if(vboxNetFltWinDoIncReferenceDevice(pAdapt, &pAdapt->MPState, v)) +#else + if(vboxNetFltWinDoIncReferenceDevices(pAdapt, &pAdapt->MPState, &pAdapt->PTState, v)) +#endif + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + return true; + } + + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + return false; +} + +DECLINLINE(bool) vboxNetFltWinReferenceAdapt(PADAPT pAdapt) +{ + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); +#ifdef VBOX_NETFLT_ONDEMAND_BIND + if(vboxNetFltWinDoReferenceDevice(pAdapt, &pAdapt->PTState)) +#elif defined(VBOXNETADP) + if(vboxNetFltWinDoReferenceDevice(pAdapt, &pAdapt->MPState)) +#else + if(vboxNetFltWinDoReferenceDevices(pAdapt, &pAdapt->MPState, &pAdapt->PTState)) +#endif + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + return true; + } + + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + return false; +} + +/*********************************************** + * methods for accessing the network card info * + ***********************************************/ + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinGetMacAddress(PADAPT pAdapt, PRTMAC pMac); +DECLHIDDEN(bool) vboxNetFltWinIsPromiscuous(PADAPT pAdapt); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinSetPromiscuous(PADAPT pAdapt, bool bYes); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinQueryPhysicalMedium(PADAPT pAdapt, NDIS_PHYSICAL_MEDIUM * pMedium); + +/********************* + * mem alloc API * + *********************/ + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMemAlloc(PVOID* ppMemBuf, UINT cbLength); + +DECLHIDDEN(void) vboxNetFltWinMemFree(PVOID pMemBuf); + +/* convenience method used which allocates and initializes the PINTNETSG containing one + * segment refering the buffer of size cbBufSize + * the allocated PINTNETSG should be freed with the vboxNetFltWinMemFree. + * + * This is used when our ProtocolReceive callback is called and we have to return the indicated NDIS_PACKET + * on a callback exit. This is why we allocate the PINTNETSG and put the packet info there and enqueue it + * for the packet queue */ +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinAllocSG(UINT cbBufSize, PINTNETSG *ppSG); + +/************************ + * PADAPT init/fini API * + ************************/ + +#if defined(VBOX_NETFLT_ONDEMAND_BIND) +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitBind(PADAPT pAdapt); +#elif defined(VBOXNETADP) +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitBind(PADAPT *ppAdapt, NDIS_HANDLE hMiniportAdapter, PNDIS_STRING pBindToMiniportName /* actually this is our miniport name*/, NDIS_HANDLE hWrapperConfigurationContext); +#else +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitBind(PADAPT *ppAdapt, PNDIS_STRING pOurMiniportName, PNDIS_STRING pBindToMiniportName); +#endif + +#ifdef VBOX_NETFLT_ONDEMAND_BIND +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtAllocInitPADAPT(PADAPT pAdapt); +#else +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtAllocInitPADAPT(PADAPT *ppAdapt, PNDIS_STRING pOurMiniportName, PNDIS_STRING pBindToMiniportName); +#endif + +DECLHIDDEN(VOID) vboxNetFltWinPtFiniPADAPT(PADAPT pAdapt); +#ifndef VBOXNETADP +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitPADAPT(IN PADAPT pAdapt, IN PNDIS_STRING pOurDeviceName); +#else +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtInitPADAPT(IN PADAPT pAdapt); +#endif + +/************************************ + * Execute Job at passive level API * + ************************************/ + +typedef VOID (*JOB_ROUTINE) (PVOID pContext); + +DECLHIDDEN(VOID) vboxNetFltWinJobSynchExecAtPassive(JOB_ROUTINE pRoutine, PVOID pContext); + +/******************************* + * Ndis Packets processing API * + *******************************/ + +#ifndef NDIS_PACKET_FIRST_NDIS_BUFFER +#define NDIS_PACKET_FIRST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Head) +#endif + +#ifndef NDIS_PACKET_LAST_NDIS_BUFFER +#define NDIS_PACKET_LAST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Tail) +#endif + +#ifndef NDIS_PACKET_VALID_COUNTS +#define NDIS_PACKET_VALID_COUNTS(_Packet) ((_Packet)->Private.ValidCounts) +#endif + + +DECLHIDDEN(PNDIS_PACKET) vboxNetFltWinNdisPacketFromSG(PADAPT pAdapt, PINTNETSG pSG, PVOID pBufToFree, bool bToWire, bool bCopyMemory); + +DECLHIDDEN(void) vboxNetFltWinFreeSGNdisPacket(PNDIS_PACKET pPacket, bool bFreeMem); + +#ifdef DEBUG_NETFLT_PACKETS +DECLHIDDEN(bool) vboxNetFltWinMatchPacketAndSG(PNDIS_PACKET pPacket, PINTNETSG pSG, const INT cbMatch); + +DECLHIDDEN(bool) vboxNetFltWinMatchPackets(PNDIS_PACKET pPacket1, PNDIS_PACKET pPacket2, const INT cbMatch); + +#endif + +#ifdef DEBUG_NETFLT_PACKETS +#define DBG_CHECK_PACKETS(_p1, _p2) \ + { \ + bool _b = vboxNetFltWinMatchPackets(_p1, _p2, -1); \ + Assert(_b); \ + } + +#define DBG_CHECK_PACKET_AND_SG(_p, _sg) \ + { \ + bool _b = vboxNetFltWinMatchPacketAndSG(_p, _sg, -1); \ + Assert(_b); \ + } + +#define DBG_CHECK_SGS(_sg1, _sg2) \ + { \ + bool _b = vboxNetFltWinMatchSGs(_sg1, _sg2, -1); \ + Assert(_b); \ + } + +#else +#define DBG_CHECK_PACKETS(_p1, _p2) +#define DBG_CHECK_PACKET_AND_SG(_p, _sg) +#define DBG_CHECK_SGS(_sg1, _sg2) +#endif + +/** + * Ndis loops back broadcast packets posted to the wire by IntNet + * This routine is used in the mechanism of preventing this looping + * + * @param pAdapt + * @param pPacket + * @param bOnRecv true is we are receiving the packet from the wire + * false otherwise (i.e. the packet is from the host) + * + * @return true if the packet is a looped back one, false otherwise + */ +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +//#ifdef VBOX_NETFLT_ONDEMAND_BIND +//DECLHIDDEN(bool) vboxNetFltWinIsLoopedBackPacket(PADAPT pAdapt, PNDIS_PACKET pPacket); +//#else +//DECLHIDDEN(bool) vboxNetFltWinIsLoopedBackPacket(PADAPT pAdapt, PNDIS_PACKET pPacket, bool bOnRecv); +//#endif +// +//#ifdef VBOX_NETFLT_ONDEMAND_BIND +//DECLHIDDEN(bool) vboxNetFltWinIsLoopedBackPacketSG(PADAPT pAdapt, PINTNETSG pSG); +//#else +//DECLHIDDEN(bool) vboxNetFltWinIsLoopedBackPacketSG(PADAPT pAdapt, PINTNETSG pSG, bool bOnRecv); +//#endif +#else +DECLINLINE(bool) vboxNetFltWinIsLoopedBackPacket(PNDIS_PACKET pPacket) +{ + return (NdisGetPacketFlags(pPacket) & g_fPacketIsLoopedBack) == g_fPacketIsLoopedBack; +} +#endif + +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(VBOXNETADP) + +/************************************************************** + * utility methofs for ndis packet creation/initialization * + **************************************************************/ +DECLINLINE(NDIS_STATUS) vboxNetFltWinCopyPacketInfoOnRecv(PNDIS_PACKET pDstPacket, PNDIS_PACKET pSrcPacket) +{ + NDIS_STATUS fStatus; + + /* + * Get the original packet (it could be the same packet as the one + * received or a different one based on the number of layered miniports + * below) and set it on the indicated packet so the OOB data is visible + * correctly to protocols above us. + */ + NDIS_SET_ORIGINAL_PACKET(pDstPacket, NDIS_GET_ORIGINAL_PACKET(pSrcPacket)); + + /* + * Set Packet Flags + */ + NdisGetPacketFlags(pDstPacket) = NdisGetPacketFlags(pSrcPacket); + + fStatus = NDIS_GET_PACKET_STATUS(pSrcPacket); + + NDIS_SET_PACKET_STATUS(pDstPacket, fStatus); + NDIS_SET_PACKET_HEADER_SIZE(pDstPacket, NDIS_GET_PACKET_HEADER_SIZE(pSrcPacket)); + + return fStatus; +} + +DECLINLINE(void) vboxNetFltWinCopyPacketInfoOnSend(PNDIS_PACKET pDstPacket, PNDIS_PACKET pSrcPacket) +{ + PVOID pMediaSpecificInfo = NULL; + UINT fMediaSpecificInfoSize = 0; + + NdisGetPacketFlags(pDstPacket) = NdisGetPacketFlags(pSrcPacket); + +#ifdef WIN9X + /* + * Work around the fact that NDIS does not initialize this + * to FALSE on Win9x. + */ + NDIS_PACKET_VALID_COUNTS(pDstPacket) = FALSE; +#endif /* WIN9X */ + + /* + * Copy the OOB data from the original packet to the new + * packet. + */ + NdisMoveMemory(NDIS_OOB_DATA_FROM_PACKET(pDstPacket), + NDIS_OOB_DATA_FROM_PACKET(pSrcPacket), + sizeof(NDIS_PACKET_OOB_DATA)); + /* + * Copy relevant parts of the per packet info into the new packet + */ +#ifndef WIN9X + NdisIMCopySendPerPacketInfo(pDstPacket, pSrcPacket); +#endif + + /* + * Copy the Media specific information + */ + NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(pSrcPacket, + &pMediaSpecificInfo, + &fMediaSpecificInfoSize); + + if (pMediaSpecificInfo || fMediaSpecificInfoSize) + { + NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(pDstPacket, + pMediaSpecificInfo, + fMediaSpecificInfoSize); + } +} + +DECLHIDDEN(NDIS_STATUS) +vboxNetFltWinPrepareSendPacket( + IN PADAPT pAdapt, + IN PNDIS_PACKET pPacket, + OUT PNDIS_PACKET *ppMyPacket + /*, IN bool bNetFltActive*/ + ); + + +DECLHIDDEN(NDIS_STATUS) +vboxNetFltWinPrepareRecvPacket( + IN PADAPT pAdapt, + IN PNDIS_PACKET pPacket, + OUT PNDIS_PACKET *ppMyPacket, + IN bool bDpr + ); +#endif + +DECLHIDDEN(void) vboxNetFltWinSleep(ULONG milis); + +#define MACS_EQUAL(_m1, _m2) \ + ((_m1).au16[0] == (_m2).au16[0] \ + && (_m1).au16[1] == (_m2).au16[1] \ + && (_m1).au16[2] == (_m2).au16[2]) + + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinDetachFromInterface(PADAPT pAdapt, bool bOnUnbind); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinCopyString(PNDIS_STRING pDst, PNDIS_STRING pSrc); + + +/** + * Sets the enmState member atomically. + * + * Used for all updates. + * + * @param pThis The instance. + * @param enmNewState The new value. + */ +DECLINLINE(void) vboxNetFltWinSetAdaptState(PADAPT pAdapt, VBOXADAPTSTATE enmNewState) +{ + ASMAtomicWriteU32((uint32_t volatile *)&pAdapt->enmState, enmNewState); +} + +/** + * Gets the enmState member atomically. + * + * Used for all reads. + * + * @returns The enmState value. + * @param pThis The instance. + */ +DECLINLINE(VBOXADAPTSTATE) vboxNetFltWinGetAdaptState(PADAPT pAdapt) +{ + return (VBOXADAPTSTATE)ASMAtomicUoReadU32((uint32_t volatile *)&pAdapt->enmState); +} + + +#ifndef VBOXNETADP +# define VBOXNETFLT_PROMISCUOUS_SUPPORTED(_pAdapt) \ + (!PADAPT_2_PVBOXNETFLTINS(_pAdapt)->fDisablePromiscuous) +// (!((_pAdapt)->PhMedium == NdisPhysicalMediumWirelessWan \ +// || (_pAdapt)->PhMedium == NdisPhysicalMediumWirelessLan \ +// || (_pAdapt)->PhMedium == NdisPhysicalMediumNative802_11 \ +// || (_pAdapt)->PhMedium == NdisPhysicalMediumBluetooth \ +// /*|| (_pAdapt)->PhMedium == NdisPhysicalMediumWiMax */ \ +// )) +#else +# define STATISTIC_INCREASE(_s) ASMAtomicIncU32((uint32_t volatile *)&(_s)); + +DECLHIDDEN(void) vboxNetFltWinGenerateMACAddress(RTMAC *pMac); +DECLHIDDEN(int) vboxNetFltWinMAC2NdisString(RTMAC *pMac, PNDIS_STRING pNdisString); +DECLHIDDEN(int) vboxNetFltWinMACFromNdisString(RTMAC *pMac, PNDIS_STRING pNdisString); + +#endif +#endif diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.rc b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.rc new file mode 100644 index 000000000..cad268553 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.rc @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ + +#include <windows.h> +#include <VBox/version.h> + +#ifndef VBOXNETADP +# define DESCRIPTION_STR "VirtualBox Bridged Networking Driver\0" +# define FILENAME_STR "VBoxNetFlt.sys\0" +#else +# define DESCRIPTION_STR "VirtualBox Host-Only Network Adapter Driver\0" +# define FILENAME_STR "VBoxNetAdp.sys\0" +#endif + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0 + PRODUCTVERSION VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0x0L + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DRV + FILESUBTYPE VFT2_DRV_NETWORK +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", VBOX_RC_COMPANY_NAME + VALUE "FileDescription", DESCRIPTION_STR + VALUE "FileVersion", VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0" + VALUE "InternalName", FILENAME_STR + VALUE "LegalCopyright", VBOX_RC_LEGAL_COPYRIGHT + VALUE "OriginalFilename", FILENAME_STR + VALUE "ProductName", "Sun VirtualBox\0" + VALUE "ProductVersion", VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt.inf b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt.inf new file mode 100644 index 000000000..288ec6e4d --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt.inf @@ -0,0 +1,155 @@ +; +; VirtualBox Bridged Networking Driver +; + +; +; Copyright (C) 2008 Sun Microsystems, Inc. +; +; 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. +; +; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa +; Clara, CA 95054 USA or visit http://www.sun.com if you need +; additional information or have any questions. +; + +; +; Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. +; Copyright (c) 1993-1999, Microsoft Corporation +; + +[Version] +Signature = "$Windows NT$" +;cat CatalogFile = VBoxNetFlt.cat +Class = NetService +ClassGUID = {4D36E974-E325-11CE-BFC1-08002BE10318} +Provider = %Provider% +;DriverPackageType=Network +;DriverPackageDisplayName=%VBoxNetFlt_Desc% +;edit-DriverVer=08/13/2008,1.1.0.1 + + +[Manufacturer] +%Provider% = VBox,NTx86,NTia64,NTamd64 + +[ControlFlags] + +;========================================================================= +; +;========================================================================= + +; For Win2K +[VBox] +%VBoxNetFlt_Desc% = VBoxNetFlt.ndi, sun_VBoxNetFlt + +; For XP and later +[VBox.NTx86] +%VBoxNetFlt_Desc% = VBoxNetFlt.ndi, sun_VBoxNetFlt + +[VBox.NTia64] +%VBoxNetFlt_Desc% = VBoxNetFlt.ndi, sun_VBoxNetFlt + +[VBox.NTamd64] +%VBoxNetFlt_Desc% = VBoxNetFlt.ndi, sun_VBoxNetFlt + +[VBoxNetFlt.ndi] +AddReg = VBoxNetFlt.ndi.AddReg, VBoxNetFlt.AddReg +Characteristics = 0x4410 ; NCF_FILTER | NCF_NDIS_PROTOCOL !--Filter Specific--!! +CopyFiles = VBoxNetFlt.Files.DLL, VBoxNetFlt.Files.Sys +CopyInf = VBoxNetFlt_m.inf + +[VBoxNetFlt.ndi.Remove] +DelFiles = VBoxNetFlt.Files.DLL, VBoxNetFlt.Files.Sys + +[VBoxNetFlt.ndi.Services] +AddService = VBoxNetFlt,, VBoxNetFlt.AddService + +[VBoxNetFlt.AddService] +DisplayName = %VBoxNetFltService_Desc% +ServiceType = 1 ;SERVICE_KERNEL_DRIVER +StartType = 3 ;SERVICE_DEMAND_START +ErrorControl = 1 ;SERVICE_ERROR_NORMAL +ServiceBinary = %12%\VBoxNetFlt.sys +LoadOrderGroup = PNP_TDI +AddReg = VBoxNetFlt.AddService.AddReg + + +[VBoxNetFlt.AddService.AddReg] +; ---------------------------------------------------------------------- +; Add any miniport-specific parameters here. These are params that your +; filter device is going to use. +; +;HKR, Parameters, ParameterName, 0x10000, "MultiSz", "Parameter", "Value" +;HKR, Parameters, ParameterName2, 0x10001, 4 + + +; ---------------------------------------------------------------------- +; File copy +; +[SourceDisksNames] +1=%DiskDescription%,"",, + +[SourceDisksFiles] +VBoxNetFlt.sys=1 +VBoxNetFltNotify.dll=1 + +[DestinationDirs] +DefaultDestDir = 12 +VBoxNetFlt.Files.DLL = 11 ; %windir%\System32 +VBoxNetFlt.Files.Sys = 12 ; %windir%\System32\drivers + +[VBoxNetFlt.Files.Sys] +VBoxNetFlt.sys,,,2 + +[VBoxNetFlt.Files.DLL] +VBoxNetFltNotify.dll,,,2 + +; ---------------------------------------------------------------------- +; Filter Install +; + +[VBoxNetFlt.ndi.AddReg] +HKR, Ndi, HelpText, , %VBoxNetFlt_HELP% + +; ---------------------------------------------------------------------- +; !!--Filter Specific--!! +; +; Note: +; 1. Other components may also have UpperRange/LowerRange but for filters +; the value of both of them must be noupper/nolower +; 2. The value FilterClass is required. +; 3. The value Service is required +; 4. FilterDeviceInfId is the InfId of the filter device (miniport) that will +; be installed for each filtered adapter. +; In this case this is sun_VBoxNetFltmp (refer to VBoxNetFlt_m.inf) +; +HKR, Ndi, ClsID, 0, {c631480a-acbe-4add-bb1d-3ed8aa52b5d9} +HKR, Ndi, ComponentDll, , VBoxNetFltNotify.dll +HKR, Ndi, FilterClass, , failover +HKR, Ndi, FilterDeviceInfId, , sun_VBoxNetFltmp +HKR, Ndi, Service, , VBoxNetFlt +HKR, Ndi\Interfaces, UpperRange, , noupper +HKR, Ndi\Interfaces, LowerRange, , nolower +HKR, Ndi\Interfaces, FilterMediaTypes, , "ethernet, wan, nolower" + +[VBoxNetFlt.AddReg] +; The following key is Required +; The following key is VBoxNetFlt specific +HKR, Parameters, Param1, 0, 4 + +; ---------------------------------------------------------------------- +[Strings] +Provider = "Sun Microsystems, Inc." +DiskDescription = "VirtualBox Bridged Networking Driver" + +VBoxNetFlt_Desc = "VirtualBox Bridged Networking Driver" +VBoxNetFlt_HELP = "VBoxNetFlt Driver" +VBoxNetFltService_Desc = "VBoxNetFlt Service" + + + diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltA-win.asm b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltA-win.asm new file mode 100644 index 000000000..af47abbd7 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltA-win.asm @@ -0,0 +1,33 @@ +; $Id: VBoxNetFltA-win.asm $ +;; @file +; VBoxNetFlt - Unwind Wrappers for 64-bit NT. +; + +; +; Copyright (C) 2008 Sun Microsystems, Inc. +; +; 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. +; +; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa +; Clara, CA 95054 USA or visit http://www.sun.com if you need +; additional information or have any questions. +; + +%include "iprt/ntwrap.mac" + +NtWrapDyn2DrvFunctionWithAllRegParams netfltNtWrap, vboxNetFltPortRetain +NtWrapDyn2DrvFunctionWithAllRegParams netfltNtWrap, vboxNetFltPortRelease +NtWrapDyn2DrvFunctionWithAllRegParams netfltNtWrap, vboxNetFltPortDisconnectAndRelease +NtWrapDyn2DrvFunctionWithAllRegParams netfltNtWrap, vboxNetFltPortSetActive +NtWrapDyn2DrvFunctionWithAllRegParams netfltNtWrap, vboxNetFltPortWaitForIdle +NtWrapDyn2DrvFunctionWithAllRegParams netfltNtWrap, vboxNetFltPortGetMacAddress +NtWrapDyn2DrvFunctionWithAllRegParams netfltNtWrap, vboxNetFltPortIsHostMac +NtWrapDyn2DrvFunctionWithAllRegParams netfltNtWrap, vboxNetFltPortIsPromiscuous +NtWrapDyn2DrvFunctionWithAllRegParams netfltNtWrap, vboxNetFltPortXmit + diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltCommon-win.h b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltCommon-win.h new file mode 100644 index 000000000..b970a5cfc --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltCommon-win.h @@ -0,0 +1,516 @@ +/* $Id: VBoxNetFltCommon-win.h $ */ +/** @file + * VBoxNetFltCommon.h - Network Filter Driver (Host), Windows Specific Code. Common headeer with commonly used defines and decls + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. + * Copyright (c) 1993-1999, Microsoft Corporation + */ + +#ifndef ___VBoxNetFltCommon_win_h___ +#define ___VBoxNetFltCommon_win_h___ + +#ifndef VBOX_NETFLT_ONDEMAND_BIND +# define NDIS_MINIPORT_DRIVER +# define NDIS50_MINIPORT 1 +#endif + +#define BINARY_COMPATIBLE 0 +#define NDIS_WDM 0 +#define NDIS50 1 +#define NTSTRSAFE_LIB + +#ifdef DEBUG +//# define DEBUG_NETFLT_PACKETS +# ifndef DEBUG_misha +# define DEBUG_NETFLT_NOASSERT +# endif +/* # define DEBUG_NETFLT_LOOPBACK */ + +/* receive logic has several branches */ +/* the DEBUG_NETFLT_RECV* macros used to debug the ProtocolReceive callback + * which is typically not used in case the underlying miniport indicates the packets with NdisMIndicateReceivePacket + * the best way to debug the ProtocolReceive (which in turn has several branches) is to enable the DEBUG_NETFLT_RECV + * one by one in the below order, i.e. + * first DEBUG_NETFLT_RECV + * then DEBUG_NETFLT_RECV + DEBUG_NETFLT_RECV_NOPACKET */ +//# define DEBUG_NETFLT_RECV +//# define DEBUG_NETFLT_RECV_NOPACKET +//# define DEBUG_NETFLT_RECV_TRANSFERDATA +#endif + +#define LOG_GROUP LOG_GROUP_NET_FLT_DRV + +#include <VBox/intnet.h> +#include <VBox/log.h> +#include <VBox/err.h> +#include <VBox/version.h> +#include <iprt/initterm.h> +#include <iprt/assert.h> +#include <iprt/spinlock.h> +#include <iprt/semaphore.h> +#include <iprt/process.h> +#include <iprt/alloc.h> +#include <iprt/alloca.h> +#include <iprt/time.h> +#include <iprt/net.h> + +RT_C_DECLS_BEGIN +#include <ndis.h> +RT_C_DECLS_END + + + +#define VBOXNETFLT_OS_SPECFIC 1 + +#ifdef VBOX_NETFLT_ONDEMAND_BIND +# define VBOXNETFLT_PROTOCOL_NAME L"VBoxNetFltPt" +#else +# ifndef VBOXNETADP +# define VBOXNETFLT_PROTOCOL_NAME L"VBoxNetFlt" + +/** this is to support ioctl interface */ +# define LINKNAME_STRING L"\\DosDevices\\Global\\VBoxNetFlt" +# define NTDEVICE_STRING L"\\Device\\VBoxNetFlt" +# else +# define LINKNAME_STRING L"\\DosDevices\\Global\\VBoxNetAdp" +# define NTDEVICE_STRING L"\\Device\\VBoxNetAdp" +# endif +//# define VBOXNETFLT_WIN_IOCTL_INIT CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_NEITHER, FILE_WRITE_ACCESS) +//# define VBOXNETFLT_WIN_IOCTL_FINI CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_NEITHER, FILE_WRITE_ACCESS) +#endif + +/** version + * NOTE: we are NOT using NDIS 5.1 features now, the code under "#ifdef NDIS51xxx" is not tested and may not work and should be removed soon */ +#ifdef NDIS51_MINIPORT +# define VBOXNETFLT_MAJOR_NDIS_VERSION 5 +# define VBOXNETFLT_MINOR_NDIS_VERSION 1 +#else +# define VBOXNETFLT_MAJOR_NDIS_VERSION 5 +# define VBOXNETFLT_MINOR_NDIS_VERSION 0 +#endif + +#ifdef NDIS51 +# define VBOXNETFLT_PROT_MAJOR_NDIS_VERSION 5 +# define VBOXNETFLT_PROT_MINOR_NDIS_VERSION 0 +#else +# define VBOXNETFLT_PROT_MAJOR_NDIS_VERSION 5 +# define VBOXNETFLT_PROT_MINOR_NDIS_VERSION 0 +#endif + +/** advance declaration */ +typedef struct _ADAPT ADAPT, *PADAPT; + +typedef struct VBOXNETFLTINS *PVBOXNETFLTINS; + +/** configuration */ + +/** received packets queue size. the queue is used when the driver is working in a pass-thru mode */ +#define MAX_RECEIVE_PACKET_ARRAY_SIZE 40 + +/** Ndis Packet pool settings + * these are applied to both receive and send packet pools */ +#define MAX_PACKET_POOL_SIZE 0x0000FFFF +#define MIN_PACKET_POOL_SIZE 0x000000FF + +/** packet queue size used when the driver is working in the "active" mode */ +#define PACKET_INFO_POOL_SIZE 0x0000FFFF + +#ifndef VBOXNETADP +/** memory tag used for memory allocations + * (VBNF stands for VBox NetFlt) */ +# define MEM_TAG 'FNBV' +#else +/** memory tag used for memory allocations + * (VBNA stands for VBox NetAdp) */ +# define MEM_TAG 'ANBV' +#endif + +/** receive and transmit Ndis buffer pool size */ +#define TX_BUFFER_POOL_SIZE 128 +#define RX_BUFFER_POOL_SIZE 128 + +#define ETH_HEADER_SIZE 14 + +#define PACKET_QUEUE_SG_SEGS_ALLOC 32 + +#define VBOX_NETFLT_PACKET_HEADER_MATCH_SIZE 24 + +#ifdef VBOXNETADP +#define VBOXNETADP_HEADER_SIZE 14 +#define VBOXNETADP_MAX_DATA_SIZE 1500 +#define VBOXNETADP_MAX_PACKET_SIZE VBOXNETADP_HEADER_SIZE + VBOXNETADP_MAX_DATA_SIZE +#define VBOXNETADP_MIN_PACKET_SIZE 60 +#define VBOXNETADP_LINK_SPEED 1000000 //The unit of measurement is 100 bps, 100Mbps +#define VBOXNETADP_MAX_LOOKAHEAD_SIZE VBOXNETADP_MAX_DATA_SIZE +#define VBOXNETADP_VENDOR_ID 0x080027 +#define VBOXNETADP_VENDOR_DRIVER_VERSION 0x00010000 +#define VBOXNETADP_VENDOR_DESC "Sun" +#define VBOXNETADP_MAX_MCAST_LIST 32 +#define VBOXNETADP_ETH_ADDRESS_LENGTH 6 + +//#define VBOXNETADP_REPORT_DISCONNECTED +#endif +/* type defs */ + +/** Flag specifying that the type of enqueued packet + * if set the info contains the PINTNETSG packet + * if clear the packet info contains the PNDIS_PACKET packet + * Typically the packet queue we are maintaining contains PNDIS_PACKETs only, + * however in case the underlying miniport indicates a packet with the NDIS_STATUS_RESOURCES status + * we MUST return the packet back to the miniport immediately + * this is why we are creating the INTNETSG, copying the ndis packet info there and enqueueing it */ +#define PACKET_SG 0x00000001 + +/** the flag specifying that the packet source + * if set the packet comes from the host (upperlying protocol) + * if clear the packet comes from the wire (underlying miniport) */ +#define PACKET_SRC_HOST 0x00000002 + +/** flag specifying the packet was originated by our driver + * i.e. we could use it on our needs and should not return it + * we are enqueueing "our" packets on ProtocolReceive call-back when + * Ndis does not give us a receive acket (the driver below us has called NdisM..IndicateReceive) + * this is supported for Ndis Packet only */ +#define PACKET_MINE 0x00000004 + +/** flag passed to vboxNetFltWinQuEnqueuePacket specifying that the packet should be copied + * this is supported for Ndis Packet only */ +#define PACKET_COPY 0x00000008 + +/** packet queue element containing the packet info */ +typedef struct _PACKET_INFO +{ + /** list entry used for enqueueing the info */ + LIST_ENTRY ListEntry; + /** pointer to the pool containing this packet info */ + struct _PACKET_INFO_POOL * pPool; + /** flags describing the referenced packet. Contains PACKET_xxx flags (i.e. PACKET_SG, PACKET_SRC_HOST) */ + uint32_t fFlags; + /** pointer to the packet this info represents */ + PVOID pPacket; +}PACKET_INFO, *PPACKET_INFO; + +/* paranoid check to make sure the elements in the packet info array are properly aligned */ +C_ASSERT((sizeof(PACKET_INFO) & (sizeof(PVOID) - 1)) == 0); + +/** represents the packet queue */ +typedef LIST_ENTRY PACKET_QUEUE, *PPACKET_QUEUE; + +/* + * we are using non-interlocked versions of LIST_ENTRY-related operations macros and synchronize + * access to the queue and its elements by aquiring/releasing a spinlock using Ndis[Acquire,Release]Spinlock + * + * we are NOT using interlocked versions of insert/remove head/tail list functions because we need to iterate though + * the queue elements as well as remove elements from the midle of the queue + * + * * @todo: it seems that we can switch to using interlocked versions of list-entry functions + * since we have removed all functionality (mentioned above, i.e. queue elements iteration, etc.) that might prevent us from doing this + */ +typedef struct _INTERLOCKED_PACKET_QUEUE +{ + /** queue */ + PACKET_QUEUE Queue; + /** queue lock */ + NDIS_SPIN_LOCK Lock; +}INTERLOCKED_PACKET_QUEUE, *PINTERLOCKED_PACKET_QUEUE; + +typedef struct _SINGLE_LIST +{ + /** queue */ + SINGLE_LIST_ENTRY Head; + /** pointer to the list tail. used to enqueue elements to the tail of the list */ + PSINGLE_LIST_ENTRY pTail; +} SINGLE_LIST, *PSINGLE_LIST; + +typedef struct _INTERLOCKED_SINGLE_LIST +{ + /** queue */ + SINGLE_LIST List; + /** queue lock */ + NDIS_SPIN_LOCK Lock; +} INTERLOCKED_SINGLE_LIST, *PINTERLOCKED_SINGLE_LIST; + +/** packet info pool contains free packet info elements to be used for the packet queue + * we are using the pool mechanism to allocate packet queue elements + * the pool mechanism is pretty simple now, we are allocating a bunch of memory + * for maintaining PACKET_INFO_POOL_SIZE queue elements and just returning null when the pool is exhausted + * This mechanism seems to be enough for now since we are using PACKET_INFO_POOL_SIZE = 0xffff which is + * the maximum size of packets the ndis packet pool supports */ +typedef struct _PACKET_INFO_POOL +{ + /** free packet info queue */ + INTERLOCKED_PACKET_QUEUE Queue; + /** memory bugger used by the pool */ + PVOID pBuffer; +}PACKET_INFO_POOL, *PPACKET_INFO_POOL; + +typedef enum VBOXNETDEVOPSTATE +{ + kVBoxNetDevOpState_InvalidValue = 0, + kVBoxNetDevOpState_Initializing, + kVBoxNetDevOpState_Initialized, + kVBoxNetDevOpState_Deinitializing, + kVBoxNetDevOpState_Deinitialized, + +} VBOXNETDEVOPSTATE; + +typedef enum VBOXADAPTSTATE +{ + /** The usual invalid state. */ + kVBoxAdaptState_Invalid = 0, + /** Initialization. */ + kVBoxAdaptState_Connecting, + /** Connected fuly functional state */ + kVBoxAdaptState_Connected, + /** Disconnecting */ + kVBoxAdaptState_Disconnecting, + /** Disconnected */ + kVBoxAdaptState_Disconnected, +} VBOXADAPTSTATE; + +/** structure used to maintain the state and reference count of the miniport and protocol */ +typedef struct _ADAPT_DEVICE +{ + /** initialize state */ + VBOXNETDEVOPSTATE OpState; + /** ndis power state */ + NDIS_DEVICE_POWER_STATE PowerState; + /** reference count */ + uint32_t cReferences; +/* NDIS_HANDLE hHandle; */ +} ADAPT_DEVICE, *PADAPT_DEVICE; + +/** represents filter driver device context*/ +typedef struct _ADAPT +{ +#ifndef VBOXNETADP + /** handle the lower miniport */ + NDIS_HANDLE hBindingHandle; + /** Protocol's Device state */ + ADAPT_DEVICE PTState; +#endif +#ifndef VBOX_NETFLT_ONDEMAND_BIND + /** NDIS Handle to for miniport up-calls */ + NDIS_HANDLE hMiniportHandle; + /** miniport device state */ + ADAPT_DEVICE MPState; +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + /** Pending receive packet queue (i.e. packets that were indicated to the upperlying protocols, but not completed yet)*/ +// INTERLOCKED_PACKET_QUEUE RecvPacketQueue; +#endif + /** ndis packet pool used for receives */ + NDIS_HANDLE hRecvPacketPoolHandle; + /** ndis buffer pool used for receives */ + NDIS_HANDLE hRecvBufferPoolHandle; +#ifndef VBOXNETADP + /** This is used to wrap a request coming down to us. + * This exploits the fact that requests are serialized down to us.*/ + NDIS_REQUEST Request; + /** Ndis Request Bytes needed */ + PULONG BytesNeeded; + /** Ndis Request Bytes Read or Written */ + PULONG BytesReadOrWritten; +#else + volatile ULONG cTxSuccess; + volatile ULONG cRxSuccess; + volatile ULONG cTxError; + volatile ULONG cRxError; +#endif + /** driver bind adapter state. */ + VBOXADAPTSTATE enmState; +#ifndef VBOXNETADP + /** true if we should indicate the receive complete used by the ProtocolReceeive mechanism */ + bool bIndicateRcvComplete; + + /** TRUE iff a request is pending at the miniport below */ + bool bOutstandingRequests; + /** TRUE iff a request is queued at this IM miniport*/ + bool bQueuedRequest; + /** @todo join all boolean states to one field treated as flags bitmap */ + /** true iff we are processing Set packet filter OID */ + bool bProcessingPacketFilter; + /** true iff the upper protocol filter cache was initialized */ + bool bUpperProtSetFilterInitialized; + /** trus if the adapter is closing */ + bool bClosingAdapter; + /** Pending transfer data packet queue (i.e. packets that were indicated as pending on NdisTransferData call */ + INTERLOCKED_SINGLE_LIST TransferDataList; + /* mac options initialized on OID_GEN_MAC_OPTIONS */ + ULONG fMacOptions; + /** For initializing the miniport edge */ + NDIS_STRING DeviceName; + /** For blocking UnbindAdapter while an IM Init is in progress.*/ + NDIS_EVENT MiniportInitEvent; + /** The last indicated media status */ + NDIS_STATUS LastIndicatedStatus; + /** The latest suppressed media status */ + NDIS_STATUS LatestUnIndicateStatus; + /** when working in the passthru mode the driver puts the received packets to this array + * instead of passing them up immediately + * we are flushing the packets on ProtocolReceiveComplete or when the underlying miniport + * indicates NDIS_STATUS_RESOURCES or when this array is full */ + PNDIS_PACKET aReceivedPackets[MAX_RECEIVE_PACKET_ARRAY_SIZE]; + /** number of packets in the aReceivedPackets array*/ + ULONG cReceivedPacketCount; + /** packet filter flags set by the upper protocols */ + ULONG fUpperProtocolSetFilter; + /** packet filter flags set by the upper protocols */ + ULONG fSetFilterBuffer; + /** packet filter flags set by us */ + ULONG fOurSetFilter; +#endif /* !VBOXNETADP */ +#endif /* !VBOX_NETFLT_ONDEMAND_BIND */ + +#ifndef VBOXNETADP + /** used for serializing calls to the NdisRequest in the vboxNetFltWinSynchNdisRequest */ + RTSEMFASTMUTEX hSynchRequestMutex; + + /** event used to synchronize with the Ndis Request completion in the vboxNetFltWinSynchNdisRequest */ + KEVENT hSynchCompletionEvent; + /** status of the Ndis Request initiated by the vboxNetFltWinSynchNdisRequest */ + NDIS_STATUS volatile fSynchCompletionStatus; + /** pointer to the Ndis Request being executed by the vboxNetFltWinSynchNdisRequest */ + PNDIS_REQUEST volatile pSynchRequest; +#endif +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + /** Pending send packet queue (i.e. packets that were sent to the underlying miniport, but not completed yet)*/ + + INTERLOCKED_PACKET_QUEUE SendPacketQueue; + /** Packet info pool, i.e. the pool for the packet queue elements */ +#endif +#ifndef VBOXNETADP + /** ndis packet pool used for sends */ + NDIS_HANDLE hSendPacketPoolHandle; + /** ndis buffer pool used for sends */ + NDIS_HANDLE hSendBufferPoolHandle; + /** open/close adapter status. + * Since ndis adapter open and close requests may complete assynchronously, + * we are using event mechanism to wait for open/close completion + * the status field is being set by the completion call-back */ + NDIS_STATUS Status; + /** open/close adaptor completion event */ + NDIS_EVENT hEvent; + /** medium we are attached to */ + NDIS_MEDIUM Medium; +// /** physical medium we are attached to */ +// NDIS_PHYSICAL_MEDIUM PhMedium; + /** True - When the miniport or protocol is transitioning from a D0 to Standby (>D0) State + * False - At all other times, - Flag is cleared after a transition to D0 */ + BOOLEAN bStandingBy; +#endif +} ADAPT, *PADAPT; + +typedef struct _PACKET_QUEUE_WORKER +{ + /** this event is used to initiate a packet queue worker thread kill */ + KEVENT KillEvent; + /** this event is used to notify a worker thread that the packets are added to the queue */ + KEVENT NotifyEvent; + /** pointer to the packet queue worker thread object */ + PKTHREAD pThread; + /** pointer to the SG used by the packet queue for IntNet receive notifications */ + PINTNETSG pSG; + /** Packet queue */ + INTERLOCKED_PACKET_QUEUE PacketQueue; + /** Packet info pool, i.e. the pool for the packet queue elements */ + PACKET_INFO_POOL PacketInfoPool; +} PACKET_QUEUE_WORKER, *PPACKET_QUEUE_WORKER; + +/** Protocol reserved part of a sent packet that is allocated by us. */ +typedef struct _SEND_RSVD +{ + /** original packet receiver from the upperlying protocol + * can be null if the packet was originated by intnet */ + PNDIS_PACKET pOriginalPkt; + + /** pointer to the buffer to be freed on send completion + * can be null if no buffer is to be freed */ + PVOID pBufToFree; +} SEND_RSVD, *PSEND_RSVD; + +/** represents the data stored in the protocol recerved field of ndis packet on NdisTransferData processing*/ +typedef struct _TRANSFERDATA_RSVD +{ + /** next packet in a list */ + SINGLE_LIST_ENTRY ListEntry; + /* packet buffer start */ + PNDIS_BUFFER pOriginalBuffer; +} TRANSFERDATA_RSVD, *PTRANSFERDATA_RSVD; + +typedef struct _PT_RSVD +{ + union + { + SEND_RSVD SendRsvd; + TRANSFERDATA_RSVD TransferDataRsvd; + }; +} PT_RSVD, *PPT_RSVD; + + +#ifndef VBOX_NETFLT_ONDEMAND_BIND +/** Miniport reserved part of a received packet that is allocated by + * us. Note that this should fit into the MiniportReserved space + * in an NDIS_PACKET. */ +typedef struct _RECV_RSVD +{ + /** original packet receiver from the underling miniport + * can be null if the packet was originated by intnet */ + PNDIS_PACKET pOriginalPkt; + /** pointer to the buffer to be freed on receive completion + * can be null if no buffer is to be freed */ + PVOID pBufToFree; +} RECV_RSVD, *PRECV_RSVD; + +C_ASSERT(sizeof(RECV_RSVD) <= sizeof(((PNDIS_PACKET)0)->MiniportReserved)); +#endif + +C_ASSERT(sizeof(NDIS_DEVICE_POWER_STATE) == sizeof(uint32_t)); +C_ASSERT(sizeof(UINT) == sizeof(uint32_t)); + +#define NDIS_FLAGS_SKIP_LOOPBACK_W2K 0x400 + +#include "../VBoxNetFltInternal.h" +#include "VBoxNetFlt-win.h" +#ifndef VBOXNETADP +#include "VBoxNetFltPt-win.h" +#endif +#ifndef VBOX_NETFLT_ONDEMAND_BIND +# include "VBoxNetFltMp-win.h" +#endif + +#ifdef DEBUG_NETFLT_NOASSERT +# ifdef Assert +# undef Assert +# endif + +# define Assert(_expr) do {} while (0) +#endif /* #ifdef DEBUG_NETFLT_NOASSERT */ + +#endif diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltMp-win.c b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltMp-win.c new file mode 100644 index 000000000..0ef32feea --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltMp-win.c @@ -0,0 +1,2802 @@ +/* $Id: VBoxNetFltMp-win.c $ */ +/** @file + * VBoxNetFlt - Network Filter Driver (Host), Windows Specific Code. Miniport edge of ndis filter driver + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. + * Copyright (c) 1993-1999, Microsoft Corporation + */ + +#include "VBoxNetFltCommon-win.h" + +#ifdef VBOX_NETFLT_ONDEMAND_BIND +# error "unsupported (VBOX_NETFLT_ONDEMAND_BIND)" +#else + +/** driver handle */ +static NDIS_HANDLE g_hDriverHandle = NULL; +/** Ndis wrapper handle */ +static NDIS_HANDLE g_hNdisWrapperHandle; +/** device handle for ioctl interface this is not used currently and should be removed soon */ +static NDIS_HANDLE g_hNdisDeviceHandle = NULL; +/** device object used for ioctl interface this is not used currently and should be removed soon */ +static PDEVICE_OBJECT g_pControlDeviceObject = NULL; +/** ioctl device ref count */ +static LONG g_cControlDeviceRefs = 0; +/** true if control device needs to be dereferenced before destroying */ +static bool g_bControlDeviceReferenced = false; + +enum _DEVICE_STATE +{ + /** ready for create/delete */ + PS_DEVICE_STATE_READY = 0, + /** create operation in progress */ + PS_DEVICE_STATE_CREATING, + /** delete operation in progress */ + PS_DEVICE_STATE_DELETING +} g_eControlDeviceState = PS_DEVICE_STATE_READY; + +/* + * miniport + */ +typedef struct { + PVOID aBuffer[8]; +}OUR_SECURITY_DESCRIPTOR_BUFFER; + +static PUCHAR vboxNetFltWinMpDbgGetOidName(ULONG oid); + +NTSYSAPI +NTSTATUS +NTAPI +ZwSetSecurityObject(IN HANDLE hHandle, + IN SECURITY_INFORMATION SInfo, + IN PSECURITY_DESCRIPTOR pSDescriptor); +/* + * makes our device object usable/accessible for non-privileged users + */ +static NTSTATUS vboxNetFltWinSetSecurity(PNDIS_STRING pDevName) +{ + NTSTATUS Status; + OBJECT_ATTRIBUTES ObjAttr; + IO_STATUS_BLOCK IoStatus; + HANDLE hFile; + OUR_SECURITY_DESCRIPTOR_BUFFER SecurityDes; + + /*obtain the handle first*/ + NdisZeroMemory(&ObjAttr, sizeof(ObjAttr)); + InitializeObjectAttributes(&ObjAttr, pDevName, + OBJ_KERNEL_HANDLE /* ULONG Attributes */, + NULL /*HANDLE RootDirectory*/, + NULL /*PSECURITY_DESCRIPTOR SecurityDescriptor */ + ); + + NdisZeroMemory(&IoStatus, sizeof(IoStatus)); + Status = ZwOpenFile(&hFile /* PHANDLE FileHandle*/, + WRITE_DAC /*ACCESS_MASK DesiredAccess - we want to change the ACL */, + &ObjAttr /*POBJECT_ATTRIBUTES */, + &IoStatus /*PIO_STATUS_BLOCK */, + 0 /*ULONG ShareAccess*/, + 0 /*ULONG OpenOptions*/ + ); + Assert(Status == STATUS_SUCCESS); + if(Status == STATUS_SUCCESS) + { + /* create and set security descriptor */ + NdisZeroMemory(&SecurityDes, sizeof(SecurityDes)); + Status = RtlCreateSecurityDescriptor(&SecurityDes, SECURITY_DESCRIPTOR_REVISION); + Assert(Status == STATUS_SUCCESS); + if(Status == STATUS_SUCCESS) + { + Status = ZwSetSecurityObject(hFile, DACL_SECURITY_INFORMATION, &SecurityDes); + Assert(Status == STATUS_SUCCESS); + if(Status != STATUS_SUCCESS) + { + LogRel(("ZwSetSecurityObject error: Status (0x%x)\n", Status)); + DBGPRINT(("ZwSetSecurityObject error: Status (0x%x)\n", Status)); + } + } + else + { + LogRel(("RtlCreateSecurityDescriptor error: Status (0x%x)\n", Status)); + DBGPRINT(("RtlCreateSecurityDescriptor error: Status (0x%x)\n", Status)); + } + + { + NTSTATUS Tmp = ZwClose(hFile); + Assert(Tmp == STATUS_SUCCESS); + if(Tmp != STATUS_SUCCESS) + { + LogRel(("ZwClose error: Status (0x%x), ignoring\n", Status)); + DBGPRINT(("ZwClose error: Status (0x%x), ignoring\n", Status)); + } + } + } + else + { + LogRel(("ZwOpenFile error: Status (0x%x)\n", Status)); + DBGPRINT(("ZwOpenFile error: Status (0x%x)\n", Status)); + } + + return Status; +} +/** + * Register an ioctl interface - a device object to be used for this + * purpose is created by NDIS when we call NdisMRegisterDevice. + * + * This routine is called whenever a new miniport instance is + * initialized. However, we only create one global device object, + * when the first miniport instance is initialized. This routine + * handles potential race conditions with vboxNetFltWinPtDeregisterDevice via + * the g_eControlDeviceState and g_cControlDeviceRefs variables. + * + * NOTE: do not call this from DriverEntry; it will prevent the driver + * from being unloaded (e.g. on uninstall). + * + * @return NDIS_STATUS_SUCCESS if we successfully register a device object. */ +static NDIS_STATUS +vboxNetFltWinPtRegisterDevice( + VOID + ) +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + UNICODE_STRING DeviceName; + UNICODE_STRING DeviceLinkUnicodeString; + PDRIVER_DISPATCH DispatchTable[IRP_MJ_MAXIMUM_FUNCTION+1]; + + LogFlow(("==>vboxNetFltWinPtRegisterDevice\n")); + + NdisAcquireSpinLock(&g_GlobalLock); + + ++g_cControlDeviceRefs; + + if (1 == g_cControlDeviceRefs) + { + Assert(g_eControlDeviceState != PS_DEVICE_STATE_CREATING); + + /* Another thread could be running vboxNetFltWinPtDeregisterDevice on + * behalf of another miniport instance. If so, wait for + * it to exit. */ + while (g_eControlDeviceState != PS_DEVICE_STATE_READY) + { + NdisReleaseSpinLock(&g_GlobalLock); + NdisMSleep(1); + NdisAcquireSpinLock(&g_GlobalLock); + } + + g_eControlDeviceState = PS_DEVICE_STATE_CREATING; + + NdisReleaseSpinLock(&g_GlobalLock); + + + NdisZeroMemory(DispatchTable, (IRP_MJ_MAXIMUM_FUNCTION+1) * sizeof(PDRIVER_DISPATCH)); + + DispatchTable[IRP_MJ_CREATE] = vboxNetFltWinPtDispatch; + DispatchTable[IRP_MJ_CLEANUP] = vboxNetFltWinPtDispatch; + DispatchTable[IRP_MJ_CLOSE] = vboxNetFltWinPtDispatch; + DispatchTable[IRP_MJ_DEVICE_CONTROL] = vboxNetFltWinPtDispatch; + + + NdisInitUnicodeString(&DeviceName, NTDEVICE_STRING); + NdisInitUnicodeString(&DeviceLinkUnicodeString, LINKNAME_STRING); + + /* Create a device object and register our dispatch handlers */ + + Status = NdisMRegisterDevice( + g_hNdisWrapperHandle, + &DeviceName, + &DeviceLinkUnicodeString, + &DispatchTable[0], + &g_pControlDeviceObject, + &g_hNdisDeviceHandle + ); + + Assert(Status == NDIS_STATUS_SUCCESS); + if(Status == NDIS_STATUS_SUCCESS) + { + /* NdisMRegisterDevice does not offers us the ability to set security attributes */ + /* need to do this "manualy" for the device to be accessible by the non-privileged users */ + Status = vboxNetFltWinSetSecurity(&DeviceLinkUnicodeString); + Assert(Status == STATUS_SUCCESS); + if(Status != STATUS_SUCCESS) + { + LogRel(("Failed to set security attributes for netflt control device, status (0x%x), ignoring\n", Status)); + /* ignore the failure */ + Status = NDIS_STATUS_SUCCESS; + } + + Status = ObReferenceObjectByPointer(g_pControlDeviceObject, FILE_READ_DATA, *IoFileObjectType, KernelMode); + Assert(Status == NDIS_STATUS_SUCCESS); + if(Status == NDIS_STATUS_SUCCESS) + { + g_bControlDeviceReferenced = true; + } + else + { + LogRel(("Failed to reference netflt control device, status (0x%x), ignoring\n", Status)); + /* ignore the failure */ + Status = NDIS_STATUS_SUCCESS; + g_bControlDeviceReferenced = false; + } + } + + NdisAcquireSpinLock(&g_GlobalLock); + + g_eControlDeviceState = PS_DEVICE_STATE_READY; + } + + NdisReleaseSpinLock(&g_GlobalLock); + + LogFlow(("<==vboxNetFltWinPtRegisterDevice: %x\n", Status)); + + return (Status); +} + +/** + * Deregister the ioctl interface. This is called whenever a miniport + * instance is halted. When the last miniport instance is halted, we + * request NDIS to delete the device object + * + * @return NDIS_STATUS_SUCCESS if everything worked ok + * */ +static NDIS_STATUS +vboxNetFltWinPtDeregisterDevice( + VOID + ) +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + + LogFlow(("==>NetFltDeregisterDevice\n")); + + NdisAcquireSpinLock(&g_GlobalLock); + + Assert(g_cControlDeviceRefs > 0); + + --g_cControlDeviceRefs; + + if (0 == g_cControlDeviceRefs) + { + /* All miniport instances have been halted. Deregister + * the control device. */ + + Assert(g_eControlDeviceState == PS_DEVICE_STATE_READY); + + /* Block vboxNetFltWinPtRegisterDevice() while we release the control + * device lock and deregister the device. */ + + g_eControlDeviceState = PS_DEVICE_STATE_DELETING; + + NdisReleaseSpinLock(&g_GlobalLock); + + if (g_hNdisDeviceHandle != NULL) + { + if(g_bControlDeviceReferenced) + { + g_bControlDeviceReferenced = false; + ObDereferenceObject(g_pControlDeviceObject); + } + + Status = NdisMDeregisterDevice(g_hNdisDeviceHandle); + g_hNdisDeviceHandle = NULL; + } + + NdisAcquireSpinLock(&g_GlobalLock); + g_eControlDeviceState = PS_DEVICE_STATE_READY; + } + + NdisReleaseSpinLock(&g_GlobalLock); + + LogFlow(("<== NetFltDeregisterDevice: %x\n", Status)); + return Status; + +} +#ifndef VBOXNETADP +/** + * This is the initialize handler which gets called as a result of + * the BindAdapter handler calling NdisIMInitializeDeviceInstanceEx. + * The context parameter which we pass there is the adapter structure + * which we retrieve here. + * + * @param OpenErrorStatus Not used by us. + * @param SelectedMediumIndex Place-holder for what media we are using + * @param MediumArray Array of ndis media passed down to us to pick from + * @param MediumArraySize Size of the array + * @param MiniportAdapterHandle The handle NDIS uses to refer to us + * @param WrapperConfigurationContext For use by NdisOpenConfiguration + * @return NDIS_STATUS_SUCCESS unless something goes wrong + * */ +static NDIS_STATUS vboxNetFltWinMpInitialize( + OUT PNDIS_STATUS OpenErrorStatus, + OUT PUINT SelectedMediumIndex, + IN PNDIS_MEDIUM MediumArray, + IN UINT MediumArraySize, + IN NDIS_HANDLE MiniportAdapterHandle, + IN NDIS_HANDLE WrapperConfigurationContext + ) +{ + UINT i; + PADAPT pAdapt; + NDIS_STATUS Status = NDIS_STATUS_FAILURE; + NDIS_MEDIUM Medium; + + UNREFERENCED_PARAMETER(WrapperConfigurationContext); + + do + { + /* + * Start off by retrieving our adapter context and storing + * the Miniport handle in it. + */ + pAdapt = (PADAPT)NdisIMGetDeviceContext(MiniportAdapterHandle); + pAdapt->hMiniportHandle = MiniportAdapterHandle; + + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initializing); + /* the MP state should be already set to kVBoxNetDevOpState_Initializing, just a paranoya + * in case NDIS for some reason calls us in some unregular way */ + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Initializing); + + LogFlow(("==> Miniport Initialize: Adapt %p\n", pAdapt)); + + /* + * Usually we export the medium type of the adapter below as our + * virtual miniport's medium type. However if the adapter below us + * is a WAN device, then we claim to be of medium type 802.3. + */ + Medium = pAdapt->Medium; + + if (Medium == NdisMediumWan) + { + Medium = NdisMedium802_3; + } + + for (i = 0; i < MediumArraySize; i++) + { + if (MediumArray[i] == Medium) + { + *SelectedMediumIndex = i; + break; + } + } + + if (i == MediumArraySize) + { + Status = NDIS_STATUS_UNSUPPORTED_MEDIA; + break; + } + + + /* + * Set the attributes now. NDIS_ATTRIBUTE_DESERIALIZE enables us + * to make up-calls to NDIS without having to call NdisIMSwitchToMiniport + * or NdisIMQueueCallBack. This also forces us to protect our data using + * spinlocks where appropriate. Also in this case NDIS does not queue + * packets on our behalf. Since this is a very simple pass-thru + * miniport, we do not have a need to protect anything. However in + * a general case there will be a need to use per-adapter spin-locks + * for the packet queues at the very least. + */ + NdisMSetAttributesEx(MiniportAdapterHandle, + pAdapt, + 0, /* CheckForHangTimeInSeconds */ + NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT | + NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT| + NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER | + NDIS_ATTRIBUTE_DESERIALIZE | + NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND, + (NDIS_INTERFACE_TYPE)0); + + /* + * Initialize LastIndicatedStatus to be NDIS_STATUS_MEDIA_CONNECT + */ + pAdapt->LastIndicatedStatus = NDIS_STATUS_MEDIA_CONNECT; + + /* + * Initialize the power states for both the lower binding (PTDeviceState) + * and our miniport edge to Powered On. + */ + Assert(vboxNetFltWinGetPowerState(&pAdapt->MPState) == NdisDeviceStateD3); + vboxNetFltWinSetPowerState(&pAdapt->MPState, NdisDeviceStateD0); + Assert(pAdapt->MPState.OpState == kVBoxNetDevOpState_Initializing); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Initialized); + + Status = NDIS_STATUS_SUCCESS; + } + while (FALSE); + + /* + * If we had received an UnbindAdapter notification on the underlying + * adapter, we would have blocked that thread waiting for the IM Init + * process to complete. Wake up any such thread. + */ + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(vboxNetFltWinGetPowerState(&pAdapt->MPState) == NdisDeviceStateD3); + Assert(pAdapt->MPState.OpState == kVBoxNetDevOpState_Initializing); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + } + NdisSetEvent(&pAdapt->MiniportInitEvent); + + LogFlow(("<== Miniport Initialize: Adapt %p, Status %x\n", pAdapt, Status)); + + *OpenErrorStatus = Status; + + return Status; +} + +/** + * process the packet send in a "passthru" mode + */ +static NDIS_STATUS +vboxNetFltWinSendPassThru( + IN PADAPT pAdapt, + IN PNDIS_PACKET pPacket + ) +{ + PNDIS_PACKET pMyPacket; + NDIS_STATUS fStatus; + + fStatus = vboxNetFltWinPrepareSendPacket(pAdapt, pPacket, &pMyPacket/*, false*/); + + Assert(fStatus == NDIS_STATUS_SUCCESS); + if (fStatus == NDIS_STATUS_SUCCESS) + { +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ +// /* need to enqueue to enable callback discarding +// * since we now always discard all callbacks */ +// PPACKET_INFO pInfo = vboxNetFltWinDoSend(&fStatus, pAdapt, pMyPacket); +// +// Assert(pInfo); +#else + NdisSend(&fStatus, + pAdapt->hBindingHandle, + pMyPacket); +#endif + if (fStatus != NDIS_STATUS_PENDING) + { +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// vboxNetFltWinDoCompleteSendViaInfo(pAdapt, pInfo); +// vboxNetFltWinPpFreePacketInfo(pInfo); +#endif + +#ifndef WIN9X + NdisIMCopySendCompletePerPacketInfo (pPacket, pMyPacket); +#endif + NdisFreePacket(pMyPacket); + } + } + return fStatus; +} + +#else /* defined VBOXNETADP */ +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDoDeinitialization(PADAPT pAdapt) +{ + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + uint64_t NanoTS = RTTimeSystemNanoTS(); + + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initialized); + /* + * Set the flag that the miniport below is unbinding, so the request handlers will + * fail any request comming later + */ + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + + ASMAtomicUoWriteBool(&pNetFlt->fDisconnectedFromHost, true); + ASMAtomicUoWriteBool(&pNetFlt->fRediscoveryPending, false); + ASMAtomicUoWriteU64(&pNetFlt->NanoTSLastRediscovery, NanoTS); + + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitializing); + + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + + vboxNetFltWinWaitDereference(&pAdapt->MPState); + + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + +// pAdapt->hMiniportHandle = NULL; + + return NDIS_STATUS_SUCCESS; +} + +static NDIS_STATUS vboxNetFltWinMpReadApplyConfig(PADAPT pAdapt, NDIS_HANDLE hMiniportAdapter, NDIS_HANDLE hWrapperConfigurationContext) +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + NDIS_HANDLE hConfiguration; + PNDIS_CONFIGURATION_PARAMETER pParameterValue; + NDIS_STRING strMAC = NDIS_STRING_CONST("MAC"); + PVBOXNETFLTINS pThis = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTMAC mac; + + // + // Open the registry for this adapter to read advanced + // configuration parameters stored by the INF file. + // + NdisOpenConfiguration( + &Status, + &hConfiguration, + hWrapperConfigurationContext); + Assert(Status == NDIS_STATUS_SUCCESS); + if(Status == NDIS_STATUS_SUCCESS) + { + do + { + int rc; + NDIS_CONFIGURATION_PARAMETER param; + WCHAR MacBuf[13]; + + + NdisReadConfiguration(&Status, + &pParameterValue, + hConfiguration, + &strMAC, + NdisParameterString); +// Assert(Status == NDIS_STATUS_SUCCESS); + if(Status == NDIS_STATUS_SUCCESS) + { + + rc = vboxNetFltWinMACFromNdisString(&mac, &pParameterValue->ParameterData.StringData); + Assert(RT_SUCCESS(rc)); + if(RT_SUCCESS(rc)) + { + break; + } + } + + vboxNetFltWinGenerateMACAddress(&mac); + param.ParameterType = NdisParameterString; + param.ParameterData.StringData.Buffer = MacBuf; + param.ParameterData.StringData.MaximumLength = sizeof(MacBuf); + + rc = vboxNetFltWinMAC2NdisString(&mac, ¶m.ParameterData.StringData); + Assert(RT_SUCCESS(rc)); + if(RT_SUCCESS(rc)) + { + NdisWriteConfiguration(&Status, + hConfiguration, + &strMAC, + ¶m); + Assert(Status == NDIS_STATUS_SUCCESS); + if(Status != NDIS_STATUS_SUCCESS) + { + /* ignore the failure */ + Status = NDIS_STATUS_SUCCESS; + } + } + }while(0); + + NdisCloseConfiguration(hConfiguration); + } + else + { + vboxNetFltWinGenerateMACAddress(&mac); + } + + pThis->u.s.Mac = mac; + + return NDIS_STATUS_SUCCESS; +} + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDoInitialization(PADAPT pAdapt, NDIS_HANDLE hMiniportAdapter, NDIS_HANDLE hWrapperConfigurationContext) +{ + NDIS_STATUS Status; + pAdapt->hMiniportHandle = hMiniportAdapter; + + LogFlow(("==> vboxNetFltWinMpDoInitialization: Adapt %p\n", pAdapt)); + + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Initializing); + + vboxNetFltWinMpReadApplyConfig(pAdapt, hMiniportAdapter, hWrapperConfigurationContext); + + NdisMSetAttributesEx(hMiniportAdapter, + pAdapt, + 0, /* CheckForHangTimeInSeconds */ + NDIS_ATTRIBUTE_DESERIALIZE | + NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND, + NdisInterfaceInternal/*(NDIS_INTERFACE_TYPE)0*/); + + /* + * Initialize the power states for both the lower binding (PTDeviceState) + * and our miniport edge to Powered On. + */ + Assert(vboxNetFltWinGetPowerState(&pAdapt->MPState) == NdisDeviceStateD3); + vboxNetFltWinSetPowerState(&pAdapt->MPState, NdisDeviceStateD0); + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initializing); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Initialized); + + Status = NDIS_STATUS_SUCCESS; + + +// *OpenErrorStatus = Status; + + LogFlow(("<== vboxNetFltWinMpDoInitialization: Adapt %p, Status %x\n", pAdapt, Status)); + + return Status; +} + +/** + * This is the initialize handler which gets called as a result of + * the BindAdapter handler calling NdisIMInitializeDeviceInstanceEx. + * The context parameter which we pass there is the adapter structure + * which we retrieve here. + * + * @param OpenErrorStatus Not used by us. + * @param SelectedMediumIndex Place-holder for what media we are using + * @param MediumArray Array of ndis media passed down to us to pick from + * @param MediumArraySize Size of the array + * @param MiniportAdapterHandle The handle NDIS uses to refer to us + * @param WrapperConfigurationContext For use by NdisOpenConfiguration + * @return NDIS_STATUS_SUCCESS unless something goes wrong + * */ +static NDIS_STATUS vboxNetFltWinMpInitialize( + OUT PNDIS_STATUS OpenErrorStatus, + OUT PUINT SelectedMediumIndex, + IN PNDIS_MEDIUM MediumArray, + IN UINT MediumArraySize, + IN NDIS_HANDLE MiniportAdapterHandle, + IN NDIS_HANDLE WrapperConfigurationContext + ) +{ + UINT i; + PADAPT pAdapt; + NDIS_STATUS Status = NDIS_STATUS_FAILURE; + NDIS_MEDIUM Medium; + + UNREFERENCED_PARAMETER(WrapperConfigurationContext); + + Medium = NdisMedium802_3; + + if (Medium == NdisMediumWan) + { + Medium = NdisMedium802_3; + } + + for (i = 0; i < MediumArraySize; i++) + { + if (MediumArray[i] == Medium) + { + *SelectedMediumIndex = i; + break; + } + } + + if (i != MediumArraySize) + { + PDEVICE_OBJECT pPdo, pFdo; +#define KEY_PREFIX L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\" + UCHAR Buf[512]; + PUCHAR pSuffix; + ULONG cbBuf; + NDIS_STRING RtlStr; + + wcscpy((WCHAR*)Buf, KEY_PREFIX); + pSuffix = Buf + (sizeof(KEY_PREFIX)-2); + + NdisMGetDeviceProperty(MiniportAdapterHandle, + &pPdo, + &pFdo, + NULL, //Next Device Object + NULL, + NULL); + + Status = IoGetDeviceProperty (pPdo, + DevicePropertyDriverKeyName, + sizeof(Buf) - (sizeof(KEY_PREFIX)-2), + pSuffix, + &cbBuf); + if(Status == STATUS_SUCCESS) + { + OBJECT_ATTRIBUTES ObjAttr; + HANDLE hDrvKey; + RtlStr.Buffer=(WCHAR*)Buf; + RtlStr.Length=(USHORT)cbBuf - 2 + sizeof(KEY_PREFIX) - 2; + RtlStr.MaximumLength=sizeof(Buf); + + InitializeObjectAttributes(&ObjAttr, &RtlStr, OBJ_CASE_INSENSITIVE, NULL, NULL); + + Status = ZwOpenKey(&hDrvKey, KEY_READ, &ObjAttr); + if(Status == STATUS_SUCCESS) + { + static UNICODE_STRING NetCfgInstanceIdValue = NDIS_STRING_CONST("NetCfgInstanceId"); +// UCHAR valBuf[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + RTUUID_STR_LENGTH*2 + 10]; +// ULONG cLength = sizeof(valBuf); +#define NAME_PREFIX L"\\DEVICE\\" + PKEY_VALUE_PARTIAL_INFORMATION pInfo = (PKEY_VALUE_PARTIAL_INFORMATION)Buf; + Status = ZwQueryValueKey(hDrvKey, + &NetCfgInstanceIdValue, + KeyValuePartialInformation, + pInfo, + sizeof(Buf), + &cbBuf); + if(Status == STATUS_SUCCESS) + { + if(pInfo->Type == REG_SZ && pInfo->DataLength > 2) + { + WCHAR *pName; + Status = vboxNetFltWinMemAlloc(&pName, pInfo->DataLength + sizeof(NAME_PREFIX)); + if(Status == STATUS_SUCCESS) + { + wcscpy(pName, NAME_PREFIX); + wcscpy(pName+(sizeof(NAME_PREFIX)-2)/2, (WCHAR*)pInfo->Data); + RtlStr.Buffer=pName; + RtlStr.Length = (USHORT)pInfo->DataLength - 2 + sizeof(NAME_PREFIX) - 2; + RtlStr.MaximumLength = (USHORT)pInfo->DataLength + sizeof(NAME_PREFIX); + + Status = vboxNetFltWinPtInitBind(&pAdapt, MiniportAdapterHandle, &RtlStr, WrapperConfigurationContext); + + if(Status == STATUS_SUCCESS) + { + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initialized); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Initialized); + + NdisMIndicateStatus(pAdapt->hMiniportHandle, + NDIS_STATUS_MEDIA_CONNECT, + (PVOID)NULL, + 0); + } + else + { + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + } + + vboxNetFltWinMemFree(pName); + + } + } + else + { + Status = NDIS_STATUS_FAILURE; + } + } + } + } + } + else + { + Status = NDIS_STATUS_UNSUPPORTED_MEDIA; + } + + if(Status != NDIS_STATUS_SUCCESS) + { + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + } + + /* TODO: */ + *OpenErrorStatus = Status; + + return Status; +} +#endif + + +/** + * Send Packet Array handler. Either this or our SendPacket handler is called + * based on which one is enabled in our Miniport Characteristics. + * + * @param MiniportAdapterContext Pointer to our adapter + * @param PacketArray Set of packets to send + * @param NumberOfPackets Self-explanatory + * @return none */ +static VOID +vboxNetFltWinMpSendPackets( + IN NDIS_HANDLE fMiniportAdapterContext, + IN PPNDIS_PACKET pPacketArray, + IN UINT cNumberOfPackets + ) +{ + PADAPT pAdapt = (PADAPT)fMiniportAdapterContext; + NDIS_STATUS fStatus; + UINT i; + PVBOXNETFLTINS pNetFltIf; + + Assert(cNumberOfPackets); + + if(vboxNetFltWinIncReferenceAdaptNetFltFromAdapt(pAdapt, &pNetFltIf, cNumberOfPackets)) + { + uint32_t cAdaptRefs = cNumberOfPackets; + uint32_t cNetFltRefs = pNetFltIf ? cNumberOfPackets : 0; + + for (i = 0; i < cNumberOfPackets; i++) + { + PNDIS_PACKET pPacket; + + pPacket = pPacketArray[i]; + +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// if(vboxNetFltWinIsLoopedBackPacket(pAdapt, pPacket, false)) +#else + if(vboxNetFltWinIsLoopedBackPacket(pPacket)) +#endif + + { + /* we should not have loopbacks on send */ + Assert(0); + + NdisMSendComplete(pAdapt->hMiniportHandle, + pPacket, + NDIS_STATUS_SUCCESS); + } + else + { + if(!cNetFltRefs + || (fStatus = vboxNetFltWinQuEnqueuePacket(pNetFltIf, pPacket, PACKET_SRC_HOST)) != NDIS_STATUS_SUCCESS) + { +#ifndef VBOXNETADP + fStatus = vboxNetFltWinSendPassThru(pAdapt, pPacket); +#else + if(!cNetFltRefs) + { +# ifdef VBOXNETADP_REPORT_DISCONNECTED + fStatus = NDIS_STATUS_MEDIA_DISCONNECT; + STATISTIC_INCREASE(pAdapt->cTxError); +# else + fStatus = NDIS_STATUS_SUCCESS; +# endif + } +#endif + + if (fStatus != NDIS_STATUS_PENDING) + { + NdisMSendComplete(pAdapt->hMiniportHandle, + pPacket, + fStatus); + } + else + { + cAdaptRefs--; + } + } + else + { + cAdaptRefs--; + cNetFltRefs--; + } + } + } + + if(cNetFltRefs) + vboxNetFltWinDecReferenceNetFlt(pNetFltIf, cNetFltRefs); + if(cAdaptRefs) + vboxNetFltWinDecReferenceAdapt(pAdapt, cAdaptRefs); + } + else + { + NDIS_HANDLE h = pAdapt->hMiniportHandle; + Assert(0); + if(h) + { + for (i = 0; i < cNumberOfPackets; i++) + { + PNDIS_PACKET pPacket; + pPacket = pPacketArray[i]; + NdisMSendComplete(h, + pPacket, + NDIS_STATUS_FAILURE); + } + } + } +} +#ifndef VBOXNETADP +/** + * Entry point called by NDIS to query for the value of the specified OID. + * Typical processing is to forward the query down to the underlying miniport. + * + * The following OIDs are filtered here: + * OID_PNP_QUERY_POWER - return success right here + * OID_GEN_SUPPORTED_GUIDS - do not forward, otherwise we will show up + * multiple instances of private GUIDs supported by the underlying miniport. + * OID_PNP_CAPABILITIES - we do send this down to the lower miniport, but + * the values returned are postprocessed before we complete this request; + * see vboxNetFltWinPtRequestComplete. + * + * NOTE on OID_TCP_TASK_OFFLOAD - if this IM driver modifies the contents + * of data it passes through such that a lower miniport may not be able + * to perform TCP task offload, then it should not forward this OID down, + * but fail it here with the status NDIS_STATUS_NOT_SUPPORTED. This is to + * avoid performing incorrect transformations on data. + * + * If our miniport edge (upper edge) is at a low-power state, fail the request. + * If our protocol edge (lower edge) has been notified of a low-power state, + * we pend this request until the miniport below has been set to D0. Since + * requests to miniports are serialized always, at most a single request will + * be pended. + * + * @param MiniportAdapterContext Pointer to the adapter structure + * @param Oid Oid for this query + * @param InformationBuffer Buffer for information + * @param InformationBufferLength Size of this buffer + * @param BytesWritten Specifies how much info is written + * @param BytesNeeded In case the buffer is smaller than what we need, tell them how much is needed + * @return Return code from the NdisRequest below. + * */ +static NDIS_STATUS +vboxNetFltWinMpQueryInformation( + IN NDIS_HANDLE MiniportAdapterContext, + IN NDIS_OID Oid, + IN PVOID InformationBuffer, + IN ULONG InformationBufferLength, + OUT PULONG BytesWritten, + OUT PULONG BytesNeeded + ) +{ + PADAPT pAdapt = (PADAPT)MiniportAdapterContext; + NDIS_STATUS Status = NDIS_STATUS_FAILURE; + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + + do + { + if (Oid == OID_PNP_QUERY_POWER) + { + /* + * Do not forward this. + */ + Status = NDIS_STATUS_SUCCESS; + break; + } + + if (Oid == OID_GEN_SUPPORTED_GUIDS) + { + /* + * Do not forward this, otherwise we will end up with multiple + * instances of private GUIDs that the underlying miniport + * supports. + */ + Status = NDIS_STATUS_NOT_SUPPORTED; + break; + } + + if (Oid == OID_TCP_TASK_OFFLOAD) + { + /* we want to receive packets with checksums calculated + * since we are passing them to IntNet + */ + Status = NDIS_STATUS_NOT_SUPPORTED; + break; + } + + /* + * If the miniport below is unbinding, just fail any request + */ + if (vboxNetFltWinGetOpState(&pAdapt->PTState) > kVBoxNetDevOpState_Initialized) /* protocol unbind in progress */ + { + Status = NDIS_STATUS_FAILURE; + break; + } + + /* + * All other queries are failed, if the miniport is not at D0, + */ + if (vboxNetFltWinGetPowerState(&pAdapt->MPState) > NdisDeviceStateD0) + { + Status = NDIS_STATUS_FAILURE; + break; + } + + pAdapt->Request.RequestType = NdisRequestQueryInformation; + pAdapt->Request.DATA.QUERY_INFORMATION.Oid = Oid; + pAdapt->Request.DATA.QUERY_INFORMATION.InformationBuffer = InformationBuffer; + pAdapt->Request.DATA.QUERY_INFORMATION.InformationBufferLength = InformationBufferLength; + pAdapt->BytesNeeded = BytesNeeded; + pAdapt->BytesReadOrWritten = BytesWritten; + + /* + * If the miniport below is binding, fail the request + */ + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + + if (vboxNetFltWinGetOpState(&pAdapt->PTState) > kVBoxNetDevOpState_Initialized) + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + Status = NDIS_STATUS_FAILURE; + break; + } + /* + * If the Protocol device state is OFF, mark this request as being + * pended. We queue this until the device state is back to D0. + */ + if ((vboxNetFltWinGetPowerState(&pAdapt->PTState) > NdisDeviceStateD0) + && (pAdapt->bStandingBy == FALSE)) + { + pAdapt->bQueuedRequest = TRUE; + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + Status = NDIS_STATUS_PENDING; + break; + } + /* + * This is in the process of powering down the system, always fail the request + */ + if (pAdapt->bStandingBy == TRUE) + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + Status = NDIS_STATUS_FAILURE; + break; + } + pAdapt->bOutstandingRequests = TRUE; + + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + if(Oid == OID_GEN_CURRENT_PACKET_FILTER && VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)) + { + PVBOXNETFLTINS pNetFltIf; + const bool fAdaptActive = vboxNetFltWinReferenceAdaptNetFltFromAdapt(pAdapt, &pNetFltIf); + + Assert(InformationBuffer); + Assert(!pAdapt->bProcessingPacketFilter); + + if(pNetFltIf) + { + /* netflt is active, simply return the cached value */ + *((PULONG)InformationBuffer) = pAdapt->fUpperProtocolSetFilter; + + Status = NDIS_STATUS_SUCCESS; + vboxNetFltWinDereferenceNetFlt(pNetFltIf); + vboxNetFltWinDereferenceAdapt(pAdapt); + + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + pAdapt->bOutstandingRequests = FALSE; + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + break; + } + else if(fAdaptActive) + { + vboxNetFltWinDereferenceAdapt(pAdapt); + } + } + + /* + * default case, most requests will be passed to the miniport below + */ + NdisRequest(&Status, + pAdapt->hBindingHandle, + &pAdapt->Request); + + + if (Status != NDIS_STATUS_PENDING) + { + vboxNetFltWinPtRequestComplete(pAdapt, &pAdapt->Request, Status); + Status = NDIS_STATUS_PENDING; + } + + } while (FALSE); + + return(Status); + +} +/** + * Postprocess a request for OID_PNP_CAPABILITIES that was forwarded + * down to the underlying miniport, and has been completed by it. + * + * @param pAdapt - Pointer to the adapter structure + * @param pStatus - Place to return final status + * @return None. */ +DECLHIDDEN(VOID) +vboxNetFltWinMpQueryPNPCapabilities( + IN OUT PADAPT pAdapt, + OUT PNDIS_STATUS pStatus + ) +{ + PNDIS_PNP_CAPABILITIES pPNPCapabilities; + PNDIS_PM_WAKE_UP_CAPABILITIES pPMstruct; + + if (pAdapt->Request.DATA.QUERY_INFORMATION.InformationBufferLength >= sizeof(NDIS_PNP_CAPABILITIES)) + { + pPNPCapabilities = (PNDIS_PNP_CAPABILITIES)(pAdapt->Request.DATA.QUERY_INFORMATION.InformationBuffer); + + /* + * The following fields must be overwritten by an IM driver. + */ + pPMstruct= & pPNPCapabilities->WakeUpCapabilities; + pPMstruct->MinMagicPacketWakeUp = NdisDeviceStateUnspecified; + pPMstruct->MinPatternWakeUp = NdisDeviceStateUnspecified; + pPMstruct->MinLinkChangeWakeUp = NdisDeviceStateUnspecified; + *pAdapt->BytesReadOrWritten = sizeof(NDIS_PNP_CAPABILITIES); + *pAdapt->BytesNeeded = 0; + + + *pStatus = NDIS_STATUS_SUCCESS; + } + else + { + *pAdapt->BytesNeeded= sizeof(NDIS_PNP_CAPABILITIES); + *pStatus = NDIS_STATUS_RESOURCES; + } +} + +#endif /* ifndef VBOXNETADP*/ + +/** + * This routine does all the procssing for a request with a SetPower Oid + * The miniport shoud accept the Set Power and transition to the new state + * + * The Set Power should not be passed to the miniport below + * + * If the IM miniport is going into a low power state, then there is no guarantee if it will ever + * be asked go back to D0, before getting halted. No requests should be pended or queued. + * + * @param pNdisStatus - Status of the operation + * @param pAdapt - The Adapter structure + * @param InformationBuffer - The New DeviceState + * @param InformationBufferLength + * @param BytesRead - No of bytes read + * @param BytesNeeded - No of bytes needed + * @return Status - NDIS_STATUS_SUCCESS if all the wait events succeed. */ +static VOID +vboxNetFltWinMpProcessSetPowerOid( + IN OUT PNDIS_STATUS pNdisStatus, + IN PADAPT pAdapt, + IN PVOID InformationBuffer, + IN ULONG InformationBufferLength, + OUT PULONG BytesRead, + OUT PULONG BytesNeeded + ) +{ + + + NDIS_DEVICE_POWER_STATE NewDeviceState; + + LogFlow(("==>vboxNetFltWinMpProcessSetPowerOid: Adapt %p\n", pAdapt)); + + Assert (InformationBuffer != NULL); + + *pNdisStatus = NDIS_STATUS_FAILURE; + + do + { + /* + * Check for invalid length + */ + if (InformationBufferLength < sizeof(NDIS_DEVICE_POWER_STATE)) + { + *pNdisStatus = NDIS_STATUS_INVALID_LENGTH; + break; + } + + NewDeviceState = (*(PNDIS_DEVICE_POWER_STATE)InformationBuffer); + + /* + * Check for invalid device state + */ + if ((vboxNetFltWinGetPowerState(&pAdapt->MPState) > NdisDeviceStateD0) && (NewDeviceState != NdisDeviceStateD0)) + { + /* + * If the miniport is in a non-D0 state, the miniport can only receive a Set Power to D0 + */ + Assert (!(vboxNetFltWinGetPowerState(&pAdapt->MPState) > NdisDeviceStateD0) && (NewDeviceState != NdisDeviceStateD0)); + + *pNdisStatus = NDIS_STATUS_FAILURE; + break; + } + +#ifndef VBOXNETADP + /* + * Is the miniport transitioning from an On (D0) state to an Low Power State (>D0) + * If so, then set the bStandingBy Flag - (Block all incoming requests) + */ + if (vboxNetFltWinGetPowerState(&pAdapt->MPState) == NdisDeviceStateD0 && NewDeviceState > NdisDeviceStateD0) + { + pAdapt->bStandingBy = TRUE; + } + + /* + * If the miniport is transitioning from a low power state to ON (D0), then clear the bStandingBy flag + * All incoming requests will be pended until the physical miniport turns ON. + */ + if (vboxNetFltWinGetPowerState(&pAdapt->MPState) > NdisDeviceStateD0 && NewDeviceState == NdisDeviceStateD0) + { + pAdapt->bStandingBy = FALSE; + } +#endif + /* + * Now update the state in the pAdapt structure; + */ + vboxNetFltWinSetPowerState(&pAdapt->MPState, NewDeviceState); +#ifndef VBOXNETADP + if(NewDeviceState != NdisDeviceStateD0) + { + vboxNetFltWinPtFlushReceiveQueue(pAdapt, + true ); /* just return */ + } +#endif + *pNdisStatus = NDIS_STATUS_SUCCESS; + + + } while (FALSE); + + if (*pNdisStatus == NDIS_STATUS_SUCCESS) + { +#ifndef VBOXNETADP + /* + * The miniport resume from low power state + */ + if (pAdapt->bStandingBy == FALSE) + { + /* + * If we need to indicate the media connect state + */ + if (pAdapt->LastIndicatedStatus != pAdapt->LatestUnIndicateStatus) + { + NdisMIndicateStatus(pAdapt->hMiniportHandle, + pAdapt->LatestUnIndicateStatus, + (PVOID)NULL, + 0); + NdisMIndicateStatusComplete(pAdapt->hMiniportHandle); + pAdapt->LastIndicatedStatus = pAdapt->LatestUnIndicateStatus; + } + } + else + { + /* + * Initialize LatestUnIndicatedStatus + */ + pAdapt->LatestUnIndicateStatus = pAdapt->LastIndicatedStatus; + } +#endif + *BytesRead = sizeof(NDIS_DEVICE_POWER_STATE); + *BytesNeeded = 0; + } + else + { + *BytesRead = 0; + *BytesNeeded = sizeof (NDIS_DEVICE_POWER_STATE); + } + + LogFlow(("<==vboxNetFltWinMpProcessSetPowerOid: Adapt %p\n", pAdapt)); +} +#ifndef VBOXNETADP +/** + * Miniport SetInfo handler. + * + * In the case of OID_PNP_SET_POWER, record the power state and return the OID. + * Do not pass below + * If the device is suspended, do not block the SET_POWER_OID + * as it is used to reactivate the NetFlt miniport + * + * PM- If the MP is not ON (DeviceState > D0) return immediately (except for 'query power' and 'set power') + * If MP is ON, but the PT is not at D0, then queue the queue the request for later processing + * + * Requests to miniports are always serialized + * + * @param MiniportAdapterContext Pointer to the adapter structure + * @param Oid Oid for this query + * @param InformationBuffer Buffer for information + * @param InformationBufferLength Size of this buffer + * @param BytesRead Specifies how much info is read + * @param BytesNeeded In case the buffer is smaller than what we need, tell them how much is needed + * @return Return code from the NdisRequest below. */ +static NDIS_STATUS +vboxNetFltWinMpSetInformation( + IN NDIS_HANDLE MiniportAdapterContext, + IN NDIS_OID Oid, + IN PVOID InformationBuffer, + IN ULONG InformationBufferLength, + OUT PULONG BytesRead, + OUT PULONG BytesNeeded + ) +{ + PADAPT pAdapt = (PADAPT)MiniportAdapterContext; + NDIS_STATUS Status; + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + + Status = NDIS_STATUS_FAILURE; + + do + { + /* + * The Set Power should not be sent to the miniport below the NetFlt, but is handled internally + */ + if (Oid == OID_PNP_SET_POWER) + { + vboxNetFltWinMpProcessSetPowerOid(&Status, + pAdapt, + InformationBuffer, + InformationBufferLength, + BytesRead, + BytesNeeded); + break; + + } + + /* + * If the miniport below is unbinding, fail the request + */ + if (vboxNetFltWinGetOpState(&pAdapt->PTState) > kVBoxNetDevOpState_Initialized) + { + Status = NDIS_STATUS_FAILURE; + break; + } + + /* + * All other Set Information requests are failed, if the miniport is + * not at D0 or is transitioning to a device state greater than D0. + */ + if (vboxNetFltWinGetPowerState(&pAdapt->MPState) > NdisDeviceStateD0) + { + Status = NDIS_STATUS_FAILURE; + break; + } + + /* Set up the Request and return the result */ + pAdapt->Request.RequestType = NdisRequestSetInformation; + pAdapt->Request.DATA.SET_INFORMATION.Oid = Oid; + pAdapt->Request.DATA.SET_INFORMATION.InformationBuffer = InformationBuffer; + pAdapt->Request.DATA.SET_INFORMATION.InformationBufferLength = InformationBufferLength; + pAdapt->BytesNeeded = BytesNeeded; + pAdapt->BytesReadOrWritten = BytesRead; + + /* + * If the miniport below is unbinding, fail the request + */ + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + if (vboxNetFltWinGetOpState(&pAdapt->PTState) > kVBoxNetDevOpState_Initialized) + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + Status = NDIS_STATUS_FAILURE; + break; + } + + /* + * If the device below is at a low power state, we cannot send it the + * request now, and must pend it. + */ + if ((vboxNetFltWinGetPowerState(&pAdapt->PTState) > NdisDeviceStateD0) + && (pAdapt->bStandingBy == FALSE)) + { + pAdapt->bQueuedRequest = TRUE; + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + Status = NDIS_STATUS_PENDING; + break; + } + /* + * This is in the process of powering down the system, always fail the request + */ + if (pAdapt->bStandingBy == TRUE) + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + Status = NDIS_STATUS_FAILURE; + break; + } + pAdapt->bOutstandingRequests = TRUE; + + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + + if(Oid == OID_GEN_CURRENT_PACKET_FILTER && VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)) + { + /* need to disable cleaning promiscuous here ?? */ + PVBOXNETFLTINS pNetFltIf; + const bool fAdaptActive = vboxNetFltWinReferenceAdaptNetFltFromAdapt(pAdapt, &pNetFltIf); + + Assert(InformationBuffer); + Assert(!pAdapt->bProcessingPacketFilter); + + if(pNetFltIf) + { + Assert(fAdaptActive); + + /* netflt is active, update the cached value */ + /* TODO: in case we are are not in promiscuous now, we are issuing a request. + * what should we do in case of a failure? + * i.e. should we update the fUpperProtocolSetFilter in completion routine in this case? etc. */ + pAdapt->fUpperProtocolSetFilter = *((PULONG)InformationBuffer); + pAdapt->bUpperProtSetFilterInitialized = true; + + if(!(pAdapt->fOurSetFilter & NDIS_PACKET_TYPE_PROMISCUOUS)) + { + pAdapt->fSetFilterBuffer = NDIS_PACKET_TYPE_PROMISCUOUS; + pAdapt->Request.DATA.SET_INFORMATION.InformationBuffer = &pAdapt->fSetFilterBuffer; + pAdapt->Request.DATA.SET_INFORMATION.InformationBufferLength = sizeof(pAdapt->fSetFilterBuffer); + pAdapt->bProcessingPacketFilter = true; + /* we'll do dereferencing in request complete */ + } + else + { + Status = NDIS_STATUS_SUCCESS; + vboxNetFltWinDereferenceNetFlt(pNetFltIf); + vboxNetFltWinDereferenceAdapt(pAdapt); + + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + pAdapt->bOutstandingRequests = FALSE; + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + break; + } + } + else if(fAdaptActive) + { + vboxNetFltWinDereferenceAdapt(pAdapt); + } + } + + /* + * Forward the request to the device below. + */ + NdisRequest(&Status, + pAdapt->hBindingHandle, + &pAdapt->Request); + + if (Status != NDIS_STATUS_PENDING) + { + vboxNetFltWinPtRequestComplete(pAdapt, &pAdapt->Request, Status); + } + + } while (FALSE); + + return(Status); +} +#else +static NDIS_OID g_vboxNetFltWinMpSupportedOids[] = +{ + OID_GEN_SUPPORTED_LIST, + OID_GEN_HARDWARE_STATUS, + OID_GEN_MEDIA_SUPPORTED, + OID_GEN_MEDIA_IN_USE, + OID_GEN_MAXIMUM_LOOKAHEAD, + OID_GEN_MAXIMUM_FRAME_SIZE, + OID_GEN_LINK_SPEED, + OID_GEN_TRANSMIT_BUFFER_SPACE, + OID_GEN_RECEIVE_BUFFER_SPACE, + OID_GEN_TRANSMIT_BLOCK_SIZE, + OID_GEN_RECEIVE_BLOCK_SIZE, + OID_GEN_VENDOR_ID, + OID_GEN_VENDOR_DESCRIPTION, + OID_GEN_VENDOR_DRIVER_VERSION, + OID_GEN_CURRENT_PACKET_FILTER, + OID_GEN_CURRENT_LOOKAHEAD, + OID_GEN_DRIVER_VERSION, + OID_GEN_MAXIMUM_TOTAL_SIZE, + OID_GEN_PROTOCOL_OPTIONS, + OID_GEN_MAC_OPTIONS, + OID_GEN_MEDIA_CONNECT_STATUS, + OID_GEN_MAXIMUM_SEND_PACKETS, + OID_GEN_XMIT_OK, + OID_GEN_RCV_OK, + OID_GEN_XMIT_ERROR, + OID_GEN_RCV_ERROR, + OID_GEN_RCV_NO_BUFFER, + OID_GEN_RCV_CRC_ERROR, + OID_GEN_TRANSMIT_QUEUE_LENGTH, + OID_802_3_PERMANENT_ADDRESS, + OID_802_3_CURRENT_ADDRESS, + OID_802_3_MULTICAST_LIST, + OID_802_3_MAC_OPTIONS, + OID_802_3_MAXIMUM_LIST_SIZE, + OID_802_3_RCV_ERROR_ALIGNMENT, + OID_802_3_XMIT_ONE_COLLISION, + OID_802_3_XMIT_MORE_COLLISIONS, + OID_802_3_XMIT_DEFERRED, + OID_802_3_XMIT_MAX_COLLISIONS, + OID_802_3_RCV_OVERRUN, + OID_802_3_XMIT_UNDERRUN, + OID_802_3_XMIT_HEARTBEAT_FAILURE, + OID_802_3_XMIT_TIMES_CRS_LOST, + OID_802_3_XMIT_LATE_COLLISIONS +#ifndef INTERFACE_WITH_NDISPROT + , + OID_PNP_CAPABILITIES, + OID_PNP_SET_POWER, + OID_PNP_QUERY_POWER +# if 0 + , + OID_PNP_ADD_WAKE_UP_PATTERN, + OID_PNP_REMOVE_WAKE_UP_PATTERN, + OID_PNP_ENABLE_WAKE_UP +# endif +#endif +}; + +static NDIS_STATUS +vboxNetFltWinMpQueryInformation( + IN NDIS_HANDLE MiniportAdapterContext, + IN NDIS_OID Oid, + IN PVOID InformationBuffer, + IN ULONG InformationBufferLength, + OUT PULONG BytesWritten, + OUT PULONG BytesNeeded) +/*++ + +Routine Description: + + Entry point called by NDIS to query for the value of the specified OID. + MiniportQueryInformation runs at IRQL = DISPATCH_LEVEL. + +Arguments: + + MiniportAdapterContext Pointer to the adapter structure + Oid Oid for this query + InformationBuffer Buffer for information + InformationBufferLength Size of this buffer + BytesWritten Specifies how much info is written + BytesNeeded In case the buffer is smaller than + what we need, tell them how much is needed + + +Return Value: + + Return code from the NdisRequest below. + +Notes: Read "Minimizing Miniport Driver Initialization Time" in the DDK + for more info on how to handle certain OIDs that affect the init of + a miniport. + +--*/ +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + PADAPT pAdapt = (PADAPT)MiniportAdapterContext; + NDIS_HARDWARE_STATUS HardwareStatus = NdisHardwareStatusReady; + NDIS_MEDIUM Medium = NdisMedium802_3; + UCHAR VendorDesc[] = VBOXNETADP_VENDOR_DESC; + ULONG ulInfo = 0; + USHORT usInfo = 0; + ULONG64 ulInfo64 = 0; + PVOID pInfo = (PVOID) &ulInfo; + ULONG ulInfoLen = sizeof(ulInfo); + NDIS_PNP_CAPABILITIES PMCaps; + + LogFlow(("==> vboxNetFltWinMpQueryInformation %s\n", vboxNetFltWinMpDbgGetOidName(Oid))); + + // Initialize the result + *BytesWritten = 0; + *BytesNeeded = 0; + + switch(Oid) + { + case OID_GEN_SUPPORTED_LIST: + // + // The OID_GEN_SUPPORTED_LIST OID specifies an array of OIDs + // for objects that the underlying driver or its NIC supports. + // Objects include general, media-specific, and implementation- + // specific objects. NDIS forwards a subset of the returned + // list to protocols that make this query. That is, NDIS filters + // any supported statistics OIDs out of the list because + // protocols never make statistics queries. + // + pInfo = (PVOID) g_vboxNetFltWinMpSupportedOids; + ulInfoLen = sizeof(g_vboxNetFltWinMpSupportedOids); + break; + + case OID_GEN_HARDWARE_STATUS: + // + // Specify the current hardware status of the underlying NIC as + // one of the following NDIS_HARDWARE_STATUS-type values. + // + pInfo = (PVOID) &HardwareStatus; + ulInfoLen = sizeof(NDIS_HARDWARE_STATUS); + break; + + case OID_GEN_MEDIA_SUPPORTED: + // + // Specify the media types that the NIC can support but not + // necessarily the media types that the NIC currently uses. + // fallthrough: + case OID_GEN_MEDIA_IN_USE: + // + // Specifiy a complete list of the media types that the NIC + // currently uses. + // + pInfo = (PVOID) &Medium; + ulInfoLen = sizeof(NDIS_MEDIUM); + break; + + case OID_GEN_CURRENT_LOOKAHEAD: + case OID_GEN_MAXIMUM_LOOKAHEAD: + // + // If the miniport driver indicates received data by calling + // NdisXxxIndicateReceive, it should respond to OID_GEN_MAXIMUM_LOOKAHEAD + // with the maximum number of bytes the NIC can provide as + // lookahead data. If that value is different from the size of the + // lookahead buffer supported by bound protocols, NDIS will call + // MiniportSetInformation to set the size of the lookahead buffer + // provided by the miniport driver to the minimum of the miniport + // driver and protocol(s) values. If the driver always indicates + // up full packets with NdisMIndicateReceivePacket, it should + // set this value to the maximum total packet size, which + // excludes the header. + // Upper-layer drivers examine lookahead data to determine whether + // a packet that is associated with the lookahead data is intended + // for one or more of their clients. If the underlying driver + // supports multipacket receive indications, bound protocols are + // given full net packets on every indication. Consequently, + // this value is identical to that returned for + // OID_GEN_RECEIVE_BLOCK_SIZE. + // + ulInfo = VBOXNETADP_MAX_LOOKAHEAD_SIZE; + break; + + case OID_GEN_MAXIMUM_FRAME_SIZE: + // + // Specifiy the maximum network packet size, in bytes, that the + // NIC supports excluding the header. A NIC driver that emulates + // another medium type for binding to a transport must ensure that + // the maximum frame size for a protocol-supplied net packet does + // not exceed the size limitations for the true network medium. + // + ulInfo = VBOXNETADP_MAX_PACKET_SIZE - VBOXNETADP_HEADER_SIZE; + break; + + case OID_GEN_MAXIMUM_TOTAL_SIZE: + // + // Specify the maximum total packet length, in bytes, the NIC + // supports including the header. A protocol driver might use + // this returned length as a gauge to determine the maximum + // size packet that a NIC driver could forward to the + // protocol driver. The miniport driver must never indicate + // up to the bound protocol driver packets received over the + // network that are longer than the packet size specified by + // OID_GEN_MAXIMUM_TOTAL_SIZE. + // + case OID_GEN_TRANSMIT_BLOCK_SIZE: + // + // The OID_GEN_TRANSMIT_BLOCK_SIZE OID specifies the minimum + // number of bytes that a single net packet occupies in the + // transmit buffer space of the NIC. For example, a NIC that + // has a transmit space divided into 256-byte pieces would have + // a transmit block size of 256 bytes. To calculate the total + // transmit buffer space on such a NIC, its driver multiplies + // the number of transmit buffers on the NIC by its transmit + // block size. In our case, the transmit block size is + // identical to its maximum packet size. + + case OID_GEN_RECEIVE_BLOCK_SIZE: + // + // The OID_GEN_RECEIVE_BLOCK_SIZE OID specifies the amount of + // storage, in bytes, that a single packet occupies in the receive + // buffer space of the NIC. + // + ulInfo = (ULONG) VBOXNETADP_MAX_PACKET_SIZE; + break; + + case OID_GEN_MAC_OPTIONS: + // + // Specify a bitmask that defines optional properties of the NIC. + // This miniport indicates receive with NdisMIndicateReceivePacket + // function. It has no MiniportTransferData function. Such a driver + // should set this NDIS_MAC_OPTION_TRANSFERS_NOT_PEND flag. + // + // NDIS_MAC_OPTION_NO_LOOPBACK tells NDIS that NIC has no internal + // loopback support so NDIS will manage loopbacks on behalf of + // this driver. + // + // NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA tells the protocol that + // our receive buffer is not on a device-specific card. If + // NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA is not set, multi-buffer + // indications are copied to a single flat buffer. + // + ulInfo = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | + NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | + NDIS_MAC_OPTION_NO_LOOPBACK; + break; + + case OID_GEN_LINK_SPEED: + // + // Specify the maximum speed of the NIC in kbps. + // The unit of measurement is 100 bps + // + ulInfo = VBOXNETADP_LINK_SPEED; + break; + + case OID_GEN_TRANSMIT_BUFFER_SPACE: + // + // Specify the amount of memory, in bytes, on the NIC that + // is available for buffering transmit data. A protocol can + // use this OID as a guide for sizing the amount of transmit + // data per send. + // + ulInfo = VBOXNETADP_MAX_PACKET_SIZE * PACKET_INFO_POOL_SIZE; + break; + + case OID_GEN_RECEIVE_BUFFER_SPACE: + // + // Specify the amount of memory on the NIC that is available + // for buffering receive data. A protocol driver can use this + // OID as a guide for advertising its receive window after it + // establishes sessions with remote nodes. + // + + ulInfo = VBOXNETADP_MAX_PACKET_SIZE * PACKET_INFO_POOL_SIZE; + break; + + case OID_GEN_VENDOR_ID: + // + // Specify a three-byte IEEE-registered vendor code, followed + // by a single byte that the vendor assigns to identify a + // particular NIC. The IEEE code uniquely identifies the vendor + // and is the same as the three bytes appearing at the beginning + // of the NIC hardware address. Vendors without an IEEE-registered + // code should use the value 0xFFFFFF. + // + ulInfo = VBOXNETADP_VENDOR_ID; + break; + + case OID_GEN_VENDOR_DESCRIPTION: + // + // Specify a zero-terminated string describing the NIC vendor. + // + pInfo = VendorDesc; + ulInfoLen = sizeof(VendorDesc); + break; + + case OID_GEN_VENDOR_DRIVER_VERSION: + // + // Specify the vendor-assigned version number of the NIC driver. + // The low-order half of the return value specifies the minor + // version; the high-order half specifies the major version. + // + ulInfo = VBOXNETADP_VENDOR_DRIVER_VERSION; + break; + + case OID_GEN_DRIVER_VERSION: + // + // Specify the NDIS version in use by the NIC driver. The high + // byte is the major version number; the low byte is the minor + // version number. + // + usInfo = (USHORT) (VBOXNETFLT_MAJOR_NDIS_VERSION<<8) + VBOXNETFLT_MINOR_NDIS_VERSION; + pInfo = (PVOID) &usInfo; + ulInfoLen = sizeof(USHORT); + break; + + case OID_GEN_MAXIMUM_SEND_PACKETS: + // + // If a miniport driver registers a MiniportSendPackets function, + // MiniportQueryInformation will be called with the + // OID_GEN_MAXIMUM_SEND_PACKETS request. The miniport driver must + // respond with the maximum number of packets it is prepared to + // handle on a single send request. The miniport driver should + // pick a maximum that minimizes the number of packets that it + // has to queue internally because it has no resources + // (its device is full). A miniport driver for a bus-master DMA + // NIC should attempt to pick a value that keeps its NIC filled + // under anticipated loads. + // + ulInfo = PACKET_INFO_POOL_SIZE; + break; + + case OID_GEN_MEDIA_CONNECT_STATUS: + // + // Return the connection status of the NIC on the network as one + // of the following system-defined values: NdisMediaStateConnected + // or NdisMediaStateDisconnected. + // +#ifdef VBOXNETADP_REPORT_DISCONNECTED + { + PVBOXNETFLTINS pNetFltIf = NULL; + bool bActive = vboxNetFltWinReferenceAdaptNetFltFromAdapt(pAdapt, &pNetFltIf); + if(bActive && pNetFltIf) + { + ulInfo = NdisMediaStateConnected; + } + else + { + ulInfo = NdisMediaStateDisconnected; + } + + if(bActive) + { + vboxNetFltWinDereferenceAdapt(pAdapt); + } + if(pNetFltIf) + { + vboxNetFltWinDereferenceNetFlt(pNetFltIf); + } + } +#else + ulInfo = NdisMediaStateConnected; +#endif + break; + + case OID_GEN_CURRENT_PACKET_FILTER: + // + // Specifiy the types of net packets such as directed, broadcast + // multicast, for which a protocol receives indications from a + // NIC driver. After NIC is initialized, a protocol driver + // can send a set OID_GEN_CURRENT_PACKET_FILTER to a non-zero value, + // thereby enabling the miniport driver to indicate receive packets + // to that protocol. + // + ulInfo = ( + NDIS_PACKET_TYPE_BROADCAST + | NDIS_PACKET_TYPE_DIRECTED + | NDIS_PACKET_TYPE_ALL_FUNCTIONAL + | NDIS_PACKET_TYPE_ALL_LOCAL + | NDIS_PACKET_TYPE_GROUP + | NDIS_PACKET_TYPE_MULTICAST + ); + break; + + case OID_PNP_CAPABILITIES: + // + // Return the wake-up capabilities of its NIC. If you return + // NDIS_STATUS_NOT_SUPPORTED, NDIS considers the miniport driver + // to be not Power management aware and doesn't send any power + // or wake-up related queries such as + // OID_PNP_SET_POWER, OID_PNP_QUERY_POWER, + // OID_PNP_ADD_WAKE_UP_PATTERN, OID_PNP_REMOVE_WAKE_UP_PATTERN, + // OID_PNP_ENABLE_WAKE_UP. Here, we are expecting the driver below + // us to do the right thing. + // + RtlZeroMemory (&PMCaps, sizeof(NDIS_PNP_CAPABILITIES)); + ulInfoLen = sizeof (NDIS_PNP_CAPABILITIES); + pInfo = (PVOID) &PMCaps; + PMCaps.WakeUpCapabilities.MinMagicPacketWakeUp = NdisDeviceStateUnspecified; + PMCaps.WakeUpCapabilities.MinPatternWakeUp = NdisDeviceStateUnspecified; + break; + + case OID_PNP_QUERY_POWER: + Status = NDIS_STATUS_SUCCESS; + break; + + // + // Following 4 OIDs are for querying Ethernet Operational + // Characteristics. + // + case OID_802_3_PERMANENT_ADDRESS: + // + // Return the MAC address of the NIC burnt in the hardware. + // + { + PVBOXNETFLTINS pNetFlt = (PADAPT_2_PVBOXNETFLTINS(pAdapt)); + pInfo = &pNetFlt->u.s.Mac; + ulInfoLen = VBOXNETADP_ETH_ADDRESS_LENGTH; + } + break; + + case OID_802_3_CURRENT_ADDRESS: + // + // Return the MAC address the NIC is currently programmed to + // use. Note that this address could be different from the + // permananent address as the user can override using + // registry. Read NdisReadNetworkAddress doc for more info. + // + { + PVBOXNETFLTINS pNetFlt = (PADAPT_2_PVBOXNETFLTINS(pAdapt)); + pInfo = &pNetFlt->u.s.Mac; + ulInfoLen = VBOXNETADP_ETH_ADDRESS_LENGTH; + } + break; + + case OID_802_3_MAXIMUM_LIST_SIZE: + // + // The maximum number of multicast addresses the NIC driver + // can manage. This list is global for all protocols bound + // to (or above) the NIC. Consequently, a protocol can receive + // NDIS_STATUS_MULTICAST_FULL from the NIC driver when + // attempting to set the multicast address list, even if + // the number of elements in the given list is less than + // the number originally returned for this query. + // + ulInfo = VBOXNETADP_MAX_MCAST_LIST; + break; + + case OID_802_3_MAC_OPTIONS: + // + // A protocol can use this OID to determine features supported + // by the underlying driver such as NDIS_802_3_MAC_OPTION_PRIORITY. + // Return zero indicating that it supports no options. + // + ulInfo = 0; + break; + + // + // Following list consists of both general and Ethernet + // specific statistical OIDs. + // + + case OID_GEN_XMIT_OK: + ulInfo64 = pAdapt->cTxSuccess; + pInfo = &ulInfo64; + if (InformationBufferLength >= sizeof(ULONG64) || + InformationBufferLength == 0) + { + ulInfoLen = sizeof(ULONG64); + } + else + { + ulInfoLen = sizeof(ULONG); + } + // We should always report that 8 bytes are required to keep ndistest happy + *BytesNeeded = sizeof(ULONG64); + break; + + case OID_GEN_RCV_OK: + ulInfo64 = pAdapt->cRxSuccess; + pInfo = &ulInfo64; + if (InformationBufferLength >= sizeof(ULONG64) || + InformationBufferLength == 0) + { + ulInfoLen = sizeof(ULONG64); + } + else + { + ulInfoLen = sizeof(ULONG); + } + // We should always report that 8 bytes are required to keep ndistest happy + *BytesNeeded = sizeof(ULONG64); + break; + + case OID_GEN_XMIT_ERROR: + + ulInfo = pAdapt->cTxError; + break; + + case OID_GEN_RCV_ERROR: + ulInfo = pAdapt->cRxError; + break; + + case OID_GEN_RCV_NO_BUFFER: + ulInfo = 0; + break; + + case OID_GEN_RCV_CRC_ERROR: + ulInfo = 0; + break; + + case OID_GEN_TRANSMIT_QUEUE_LENGTH: + ulInfo = PACKET_INFO_POOL_SIZE; + break; + + case OID_802_3_RCV_ERROR_ALIGNMENT: + ulInfo = 0; + break; + + case OID_802_3_XMIT_ONE_COLLISION: + ulInfo = 0; + break; + + case OID_802_3_XMIT_MORE_COLLISIONS: + ulInfo = 0; + break; + + case OID_802_3_XMIT_DEFERRED: + ulInfo = 0; + break; + + case OID_802_3_XMIT_MAX_COLLISIONS: + ulInfo = 0; + break; + + case OID_802_3_RCV_OVERRUN: + ulInfo = 0; + break; + + case OID_802_3_XMIT_UNDERRUN: + ulInfo = 0; + break; + + case OID_802_3_XMIT_HEARTBEAT_FAILURE: + ulInfo = 0; + break; + + case OID_802_3_XMIT_TIMES_CRS_LOST: + ulInfo = 0; + break; + + case OID_802_3_XMIT_LATE_COLLISIONS: + ulInfo = 0; + break; + + default: + Status = NDIS_STATUS_NOT_SUPPORTED; + break; + } + + if(Status == NDIS_STATUS_SUCCESS) + { + if(ulInfoLen <= InformationBufferLength) + { + // Copy result into InformationBuffer + *BytesWritten = ulInfoLen; + if(ulInfoLen) + { + NdisMoveMemory(InformationBuffer, pInfo, ulInfoLen); + } + } + else + { + // too short + *BytesNeeded = ulInfoLen; + Status = NDIS_STATUS_BUFFER_TOO_SHORT; + } + } + + + LogFlow(("<== vboxNetFltWinMpQueryInformation Status = 0x%08x\n", + Status)); + + return(Status); +} + +NDIS_STATUS +vboxNetFltWinMpSetMulticastList( + IN PADAPT pAdapt, + IN PVOID InformationBuffer, + IN ULONG InformationBufferLength, + OUT PULONG pBytesRead, + OUT PULONG pBytesNeeded + ) +/*++ +Routine Description: + This routine will set up the adapter for a specified multicast + address list. + +Arguments: + IN PMP_ADAPTER Adapter - Pointer to adapter block + InformationBuffer - Buffer for information + InformationBufferLength Size of this buffer + pBytesRead Specifies how much info is read + BytesNeeded In case the buffer is smaller than + +Return Value: + + NDIS_STATUS + +--*/ +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; +#if 0 + ULONG index; +#endif + + LogFlow(("==> vboxNetFltWinMpSetMulticastList\n")); + + // + // Initialize. + // + *pBytesNeeded = 0; + *pBytesRead = InformationBufferLength; + + do + { + if (InformationBufferLength % VBOXNETADP_ETH_ADDRESS_LENGTH) + { + Status = NDIS_STATUS_INVALID_LENGTH; + break; + } + + if (InformationBufferLength > (VBOXNETADP_MAX_MCAST_LIST * VBOXNETADP_ETH_ADDRESS_LENGTH)) + { + Status = NDIS_STATUS_MULTICAST_FULL; + *pBytesNeeded = VBOXNETADP_MAX_MCAST_LIST * VBOXNETADP_ETH_ADDRESS_LENGTH; + break; + } +#if 0 + // + // Protect the list update with a lock if it can be updated by + // another thread simultaneously. + // + + NdisZeroMemory(pAdapt->aMCList, + sizeof(pAdapt->aMCList)); + + NdisMoveMemory(pAdapt->aMCList, + InformationBuffer, + InformationBufferLength); + + pAdapt->cMCList = InformationBufferLength / ETH_LENGTH_OF_ADDRESS; +#endif + + } + while (FALSE); + + // + // Program the hardware to add suport for these muticast addresses + // + + LogFlow(("<== vboxNetFltWinMpSetMulticastList\n")); + + return(Status); + +} + + +static NDIS_STATUS +vboxNetFltWinMpSetInformation( + IN NDIS_HANDLE MiniportAdapterContext, + IN NDIS_OID Oid, + IN PVOID InformationBuffer, + IN ULONG InformationBufferLength, + OUT PULONG BytesRead, + OUT PULONG BytesNeeded) +/*++ + +Routine Description: + + This is the handler for an OID set operation. + MiniportSetInformation runs at IRQL = DISPATCH_LEVEL. + +Arguments: + + MiniportAdapterContext Pointer to the adapter structure + Oid Oid for this query + InformationBuffer Buffer for information + InformationBufferLength Size of this buffer + BytesRead Specifies how much info is read + BytesNeeded In case the buffer is smaller than what + we need, tell them how much is needed + +Return Value: + + Return code from the NdisRequest below. + +--*/ +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + PADAPT pAdapt = (PADAPT) MiniportAdapterContext; + PNDIS_PM_PACKET_PATTERN pPmPattern = NULL; + + LogFlow(("==> vboxNetFltWinMpSetInformation %s\n", vboxNetFltWinMpDbgGetOidName(Oid))); + + *BytesRead = 0; + *BytesNeeded = 0; + + switch(Oid) + { + case OID_802_3_MULTICAST_LIST: + // + // Set the multicast address list on the NIC for packet reception. + // The NIC driver can set a limit on the number of multicast + // addresses bound protocol drivers can enable simultaneously. + // NDIS returns NDIS_STATUS_MULTICAST_FULL if a protocol driver + // exceeds this limit or if it specifies an invalid multicast + // address. + // + Status = vboxNetFltWinMpSetMulticastList( + pAdapt, + InformationBuffer, + InformationBufferLength, + BytesRead, + BytesNeeded); + break; + + case OID_GEN_CURRENT_PACKET_FILTER: + // + // Program the hardware to indicate the packets + // of certain filter types. + // + if(InformationBufferLength != sizeof(ULONG)) + { + *BytesNeeded = sizeof(ULONG); + Status = NDIS_STATUS_INVALID_LENGTH; + break; + } + + *BytesRead = InformationBufferLength; + + break; + + case OID_GEN_CURRENT_LOOKAHEAD: + // + // A protocol driver can set a suggested value for the number + // of bytes to be used in its binding; however, the underlying + // NIC driver is never required to limit its indications to + // the value set. + // + if(InformationBufferLength != sizeof(ULONG)){ + *BytesNeeded = sizeof(ULONG); + Status = NDIS_STATUS_INVALID_LENGTH; + break; + } + + break; + + case OID_PNP_SET_POWER: + // + // This OID notifies a miniport driver that its NIC will be + // transitioning to the device power state specified in the + // InformationBuffer. The miniport driver must always return + // NDIS_STATUS_SUCCESS to an OID_PNP_SET_POWER request. An + // OID_PNP_SET_POWER request may or may not be preceded by an + // OID_PNP_QUERY_POWER request. + // + if (InformationBufferLength != sizeof(NDIS_DEVICE_POWER_STATE )) + { + Status = NDIS_STATUS_INVALID_LENGTH; + break; + } + + vboxNetFltWinMpProcessSetPowerOid(&Status, pAdapt, InformationBuffer, InformationBufferLength, BytesRead, BytesNeeded); + break; +/* + case OID_PNP_ADD_WAKE_UP_PATTERN: + // + // This OID is sent by a protocol driver to a miniport driver to + // specify a wake-up pattern. The wake-up pattern, along with its mask, + // is described by an NDIS_PM_PACKET_PATTERN structure. + // + pPmPattern = (PNDIS_PM_PACKET_PATTERN) InformationBuffer; + if (InformationBufferLength < sizeof(NDIS_PM_PACKET_PATTERN)) + { + Status = NDIS_STATUS_BUFFER_TOO_SHORT; + + *BytesNeeded = sizeof(NDIS_PM_PACKET_PATTERN); + break; + } + if (InformationBufferLength < pPmPattern->PatternOffset + pPmPattern->PatternSize) + { + Status = NDIS_STATUS_BUFFER_TOO_SHORT; + + *BytesNeeded = pPmPattern->PatternOffset + pPmPattern->PatternSize; + break; + } + *BytesRead = pPmPattern->PatternOffset + pPmPattern->PatternSize; + Status = NDIS_STATUS_SUCCESS; + bForwardRequest = TRUE; + break; + + case OID_PNP_REMOVE_WAKE_UP_PATTERN: + // + // This OID requests the miniport driver to delete a wake-up pattern + // that it previously received in an OID_PNP_ADD_WAKE_UP_PATTERN request. + // The wake-up pattern, along with its mask, is described by an + // NDIS_PM_PACKET_PATTERN structure. + // + pPmPattern = (PNDIS_PM_PACKET_PATTERN) InformationBuffer; + if (InformationBufferLength < sizeof(NDIS_PM_PACKET_PATTERN)) + { + Status = NDIS_STATUS_BUFFER_TOO_SHORT; + + *BytesNeeded = sizeof(NDIS_PM_PACKET_PATTERN); + break; + } + if (InformationBufferLength < pPmPattern->PatternOffset + pPmPattern->PatternSize) + { + Status = NDIS_STATUS_BUFFER_TOO_SHORT; + + *BytesNeeded = pPmPattern->PatternOffset + pPmPattern->PatternSize; + break; + } + *BytesRead = pPmPattern->PatternOffset + pPmPattern->PatternSize; + Status = NDIS_STATUS_SUCCESS; + bForwardRequest = TRUE; + + break; + + case OID_PNP_ENABLE_WAKE_UP: + // + // This OID specifies which wake-up capabilities a miniport + // driver should enable in its NIC. Before the miniport + // transitions to a low-power state (that is, before NDIS + // sends the miniport driver an OID_PNP_SET_POWER request), + // NDIS sends the miniport an OID_PNP_ENABLE_WAKE_UP request to + // enable the appropriate wake-up capabilities. + // + DEBUGP(MP_INFO, ("--> OID_PNP_ENABLE_WAKE_UP\n")); + if(InformationBufferLength != sizeof(ULONG)) + { + *BytesNeeded = sizeof(ULONG); + Status = NDIS_STATUS_INVALID_LENGTH; + break; + } + *BytesRead = sizeof(ULONG); + Status = NDIS_STATUS_SUCCESS; + bForwardRequest = TRUE; + break; +*/ + default: + Status = NDIS_STATUS_INVALID_OID; + break; + + } + + + LogFlow(("<== vboxNetFltWinMpSetInformation Status = 0x%08x\n", Status)); + + return(Status); +} + +static PUCHAR vboxNetFltWinMpDbgGetOidName(ULONG oid) +{ + PCHAR oidName; + + switch (oid){ + + #undef MAKECASE + #define MAKECASE(oidx) case oidx: oidName = #oidx; break; + + MAKECASE(OID_GEN_SUPPORTED_LIST) + MAKECASE(OID_GEN_HARDWARE_STATUS) + MAKECASE(OID_GEN_MEDIA_SUPPORTED) + MAKECASE(OID_GEN_MEDIA_IN_USE) + MAKECASE(OID_GEN_MAXIMUM_LOOKAHEAD) + MAKECASE(OID_GEN_MAXIMUM_FRAME_SIZE) + MAKECASE(OID_GEN_LINK_SPEED) + MAKECASE(OID_GEN_TRANSMIT_BUFFER_SPACE) + MAKECASE(OID_GEN_RECEIVE_BUFFER_SPACE) + MAKECASE(OID_GEN_TRANSMIT_BLOCK_SIZE) + MAKECASE(OID_GEN_RECEIVE_BLOCK_SIZE) + MAKECASE(OID_GEN_VENDOR_ID) + MAKECASE(OID_GEN_VENDOR_DESCRIPTION) + MAKECASE(OID_GEN_CURRENT_PACKET_FILTER) + MAKECASE(OID_GEN_CURRENT_LOOKAHEAD) + MAKECASE(OID_GEN_DRIVER_VERSION) + MAKECASE(OID_GEN_MAXIMUM_TOTAL_SIZE) + MAKECASE(OID_GEN_PROTOCOL_OPTIONS) + MAKECASE(OID_GEN_MAC_OPTIONS) + MAKECASE(OID_GEN_MEDIA_CONNECT_STATUS) + MAKECASE(OID_GEN_MAXIMUM_SEND_PACKETS) + MAKECASE(OID_GEN_VENDOR_DRIVER_VERSION) + MAKECASE(OID_GEN_SUPPORTED_GUIDS) + MAKECASE(OID_GEN_NETWORK_LAYER_ADDRESSES) + MAKECASE(OID_GEN_TRANSPORT_HEADER_OFFSET) + MAKECASE(OID_GEN_MEDIA_CAPABILITIES) + MAKECASE(OID_GEN_PHYSICAL_MEDIUM) + MAKECASE(OID_GEN_XMIT_OK) + MAKECASE(OID_GEN_RCV_OK) + MAKECASE(OID_GEN_XMIT_ERROR) + MAKECASE(OID_GEN_RCV_ERROR) + MAKECASE(OID_GEN_RCV_NO_BUFFER) + MAKECASE(OID_GEN_DIRECTED_BYTES_XMIT) + MAKECASE(OID_GEN_DIRECTED_FRAMES_XMIT) + MAKECASE(OID_GEN_MULTICAST_BYTES_XMIT) + MAKECASE(OID_GEN_MULTICAST_FRAMES_XMIT) + MAKECASE(OID_GEN_BROADCAST_BYTES_XMIT) + MAKECASE(OID_GEN_BROADCAST_FRAMES_XMIT) + MAKECASE(OID_GEN_DIRECTED_BYTES_RCV) + MAKECASE(OID_GEN_DIRECTED_FRAMES_RCV) + MAKECASE(OID_GEN_MULTICAST_BYTES_RCV) + MAKECASE(OID_GEN_MULTICAST_FRAMES_RCV) + MAKECASE(OID_GEN_BROADCAST_BYTES_RCV) + MAKECASE(OID_GEN_BROADCAST_FRAMES_RCV) + MAKECASE(OID_GEN_RCV_CRC_ERROR) + MAKECASE(OID_GEN_TRANSMIT_QUEUE_LENGTH) + MAKECASE(OID_GEN_GET_TIME_CAPS) + MAKECASE(OID_GEN_GET_NETCARD_TIME) + MAKECASE(OID_GEN_NETCARD_LOAD) + MAKECASE(OID_GEN_DEVICE_PROFILE) + MAKECASE(OID_GEN_INIT_TIME_MS) + MAKECASE(OID_GEN_RESET_COUNTS) + MAKECASE(OID_GEN_MEDIA_SENSE_COUNTS) + MAKECASE(OID_PNP_CAPABILITIES) + MAKECASE(OID_PNP_SET_POWER) + MAKECASE(OID_PNP_QUERY_POWER) + MAKECASE(OID_PNP_ADD_WAKE_UP_PATTERN) + MAKECASE(OID_PNP_REMOVE_WAKE_UP_PATTERN) + MAKECASE(OID_PNP_ENABLE_WAKE_UP) + MAKECASE(OID_802_3_PERMANENT_ADDRESS) + MAKECASE(OID_802_3_CURRENT_ADDRESS) + MAKECASE(OID_802_3_MULTICAST_LIST) + MAKECASE(OID_802_3_MAXIMUM_LIST_SIZE) + MAKECASE(OID_802_3_MAC_OPTIONS) + MAKECASE(OID_802_3_RCV_ERROR_ALIGNMENT) + MAKECASE(OID_802_3_XMIT_ONE_COLLISION) + MAKECASE(OID_802_3_XMIT_MORE_COLLISIONS) + MAKECASE(OID_802_3_XMIT_DEFERRED) + MAKECASE(OID_802_3_XMIT_MAX_COLLISIONS) + MAKECASE(OID_802_3_RCV_OVERRUN) + MAKECASE(OID_802_3_XMIT_UNDERRUN) + MAKECASE(OID_802_3_XMIT_HEARTBEAT_FAILURE) + MAKECASE(OID_802_3_XMIT_TIMES_CRS_LOST) + MAKECASE(OID_802_3_XMIT_LATE_COLLISIONS) + + default: + oidName = "<** UNKNOWN OID **>"; + break; + } + + return oidName; +} +#endif + +/** + * NDIS Miniport entry point called whenever protocols are done with + * a packet that we had indicated up and they had queued up for returning + * later. + * + * @param MiniportAdapterContext - pointer to ADAPT structure + * @param Packet - packet being returned. + * @return None. */ +DECLHIDDEN(VOID) +vboxNetFltWinMpReturnPacket( + IN NDIS_HANDLE MiniportAdapterContext, + IN PNDIS_PACKET Packet + ) +{ + PADAPT pAdapt = (PADAPT)MiniportAdapterContext; + + { + /* + * This is a packet allocated from this IM's receive packet pool. + * Reclaim our packet, and return the original to the driver below. + */ + + PNDIS_PACKET MyPacket; + PRECV_RSVD RecvRsvd; +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// PPACKET_INFO pInfo = vboxNetFltWinDoCompleteIndicateReceive(pAdapt, Packet); +// +// if(pInfo) +// { +// vboxNetFltWinPpFreePacketInfo(pInfo); +// } +#endif + RecvRsvd = (PRECV_RSVD)(Packet->MiniportReserved); + MyPacket = RecvRsvd->pOriginalPkt; + + if(MyPacket) + { + /* the packet was sent from underlying miniport */ + NdisFreePacket(Packet); + NdisReturnPackets(&MyPacket, 1); + } + else + { + PVOID pBufToFree = RecvRsvd->pBufToFree; + + /* the packet was sent from NetFlt */ + vboxNetFltWinFreeSGNdisPacket(Packet, !pBufToFree); + if(pBufToFree) + { + vboxNetFltWinMemFree(pBufToFree); + } + } + + vboxNetFltWinDereferenceAdapt(pAdapt); + } +} + +/** Miniport's transfer data handler. + * + * @param Packet Destination packet + * @param BytesTransferred Place-holder for how much data was copied + * @param MiniportAdapterContext Pointer to the adapter structure + * @param MiniportReceiveContext Context + * @param ByteOffset Offset into the packet for copying data + * @param BytesToTransfer How much to copy. + * @return Status of transfer */ +static NDIS_STATUS +vboxNetFltWinMpTransferData( + OUT PNDIS_PACKET Packet, + OUT PUINT BytesTransferred, + IN NDIS_HANDLE MiniportAdapterContext, + IN NDIS_HANDLE MiniportReceiveContext, + IN UINT ByteOffset, + IN UINT BytesToTransfer + ) +{ +#ifndef VBOXNETADP + + PADAPT pAdapt = (PADAPT)MiniportAdapterContext; + NDIS_STATUS Status; + + /* + * Return, if the device is OFF + */ + if (vboxNetFltWinGetPowerState(&pAdapt->PTState) != NdisDeviceStateD0 + || vboxNetFltWinGetPowerState(&pAdapt->MPState) != NdisDeviceStateD0) + { + return NDIS_STATUS_FAILURE; + } + + NdisTransferData(&Status, + pAdapt->hBindingHandle, + MiniportReceiveContext, + ByteOffset, + BytesToTransfer, + Packet, + BytesTransferred); + + return(Status); +#else + /* should never be here */ + Assert(0); + return NDIS_STATUS_FAILURE; +#endif +} + +/** + * Halt handler. All the hard-work for clean-up is done here. + * + * @param MiniportAdapterContext Pointer to the Adapter + * @return None. */ +static VOID +vboxNetFltWinMpHalt( + IN NDIS_HANDLE MiniportAdapterContext + ) +{ + PADAPT pAdapt = (PADAPT)MiniportAdapterContext; +#ifndef VBOXNETADP + NDIS_STATUS Status; +#endif + + LogFlow(("==>MiniportHalt: Adapt %p\n", pAdapt)); + +#ifndef VBOXNETADP +// Assert(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Deinitializing); +// if(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Deinitializing) + if(vboxNetFltWinGetAdaptState(pAdapt) == kVBoxAdaptState_Disconnecting) + { + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitializing); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitializing); + /* we're called from protocolUnbinAdapter, do our job */ + /* + * If we have a valid bind, close the miniport below the protocol + */ + vboxNetFltWinPtCloseAdapter(pAdapt, &Status); + + Assert(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Deinitializing); + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitialized); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + } + else +#endif + { + /* we're NOT called from protocolUnbinAdapter, perform a full disconnect */ + NDIS_STATUS Status; + + Assert(/*vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initializing + ||*/ vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initialized); +#ifndef VBOXNETADP + AssertBreakpoint(); +#endif + Status = vboxNetFltWinDetachFromInterface(pAdapt, false); + Assert(Status == NDIS_STATUS_SUCCESS); +/* you can not access the pAdapt after closure + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); +#ifndef VBOXNETADP + Assert(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Deinitialized); + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitialized); +#endif +*/ + } + + LogFlow(("<== MiniportHalt: pAdapt %p\n", pAdapt)); +} + +/** + * register the miniport edge + */ +DECLHIDDEN(NDIS_STATUS) +vboxNetFltWinMpRegister( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath + ) +{ + NDIS_MINIPORT_CHARACTERISTICS MChars; + NDIS_STATUS Status; + + NdisMInitializeWrapper(&g_hNdisWrapperHandle, DriverObject, RegistryPath, NULL); + + /* + * Register the miniport with NDIS. Note that it is the miniport + * which was started as a driver and not the protocol. Also the miniport + * must be registered prior to the protocol since the protocol's BindAdapter + * handler can be initiated anytime and when it is, it must be ready to + * start driver instances. + */ + + NdisZeroMemory(&MChars, sizeof(NDIS_MINIPORT_CHARACTERISTICS)); + + MChars.MajorNdisVersion = VBOXNETFLT_MAJOR_NDIS_VERSION; + MChars.MinorNdisVersion = VBOXNETFLT_MINOR_NDIS_VERSION; + + MChars.InitializeHandler = vboxNetFltWinMpInitialize; + MChars.QueryInformationHandler = vboxNetFltWinMpQueryInformation; + MChars.SetInformationHandler = vboxNetFltWinMpSetInformation; + MChars.ResetHandler = NULL; + MChars.TransferDataHandler = vboxNetFltWinMpTransferData; + MChars.HaltHandler = vboxNetFltWinMpHalt; + + /* + * We will disable the check for hang timeout so we do not + * need a check for hang handler! + */ + MChars.CheckForHangHandler = NULL; + MChars.ReturnPacketHandler = vboxNetFltWinMpReturnPacket; + + /* + * Either the Send or the SendPackets handler should be specified. + * If SendPackets handler is specified, SendHandler is ignored + */ + MChars.SendHandler = NULL; /* vboxNetFltWinMpSend; */ + MChars.SendPacketsHandler = vboxNetFltWinMpSendPackets; + +#ifndef VBOXNETADP + Status = NdisIMRegisterLayeredMiniport(g_hNdisWrapperHandle, + &MChars, + sizeof(MChars), + &g_hDriverHandle); +#else + Status = NdisMRegisterMiniport( + g_hNdisWrapperHandle, + &MChars, + sizeof(MChars)); +#endif + if(Status == NDIS_STATUS_SUCCESS) + { +# ifndef WIN9X + NdisMRegisterUnloadHandler(g_hNdisWrapperHandle, vboxNetFltWinUnload); +# endif + } + + return Status; +} + +/** + * deregister the miniport edge + */ +DECLHIDDEN(NDIS_STATUS) +vboxNetFltWinMpDeregister() +{ +#ifndef VBOXNETADP + NdisIMDeregisterLayeredMiniport(g_hDriverHandle); +#else + /* don't need to do anything here */ +#endif + NdisTerminateWrapper(g_hNdisWrapperHandle, NULL); + return NDIS_STATUS_SUCCESS; +} + +#ifndef VBOXNETADP +/** + * return the miniport edge handle + */ +DECLHIDDEN(NDIS_HANDLE) vboxNetFltWinMpGetHandle() +{ + return g_hDriverHandle; +} + +/** + * initialize the instance of a device used for ioctl handling + */ +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpInitializeDevideInstance(PADAPT pAdapt) +{ + NDIS_STATUS Status; + /* + * Now ask NDIS to initialize our miniport (upper) edge. + * Set the flag below to synchronize with a possible call + * to our protocol Unbind handler that may come in before + * our miniport initialization happens. + */ + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Initializing); + /* this is doe in vboxNetFltWinPtInitPADAPT*/ + /* NdisInitializeEvent(&pAdapt->MiniportInitEvent); */ + + Status = NdisIMInitializeDeviceInstanceEx(g_hDriverHandle, + &pAdapt->DeviceName, + pAdapt); + /* ensure we're taking into account the pAdapt->Status if our miniport halt handler was called */ + if(Status == NDIS_STATUS_SUCCESS) + { + if(pAdapt->Status == NDIS_STATUS_SUCCESS) + { +// Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initialized); +// vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Initialized); + return NDIS_STATUS_SUCCESS; + } + AssertBreakpoint(); + vboxNetFltWinMpDeInitializeDevideInstance(pAdapt, &Status); + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + return pAdapt->Status; + } + else + { + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + } + return Status; +} + +/** + * deinitialize the instance of a device used for ioctl handling + */ +DECLHIDDEN(bool) vboxNetFltWinMpDeInitializeDevideInstance(PADAPT pAdapt, PNDIS_STATUS pStatus) +{ +# ifndef WIN9X + NDIS_STATUS LocalStatus; + /* + * Check if we had called NdisIMInitializeDeviceInstanceEx and + * we are awaiting a call to MiniportInitialize. + */ + if (vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initializing) + { + /* + * Try to cancel the pending IMInit process. + */ + LocalStatus = NdisIMCancelInitializeDeviceInstance( + g_hDriverHandle, + &pAdapt->DeviceName); + + if (LocalStatus == NDIS_STATUS_SUCCESS) + { + /* + * Successfully cancelled IM Initialization; our + * Miniport Initialize routine will not be called + * for this device. + */ + Assert(pAdapt->hMiniportHandle == NULL); + } + else + { + /* + * Our Miniport Initialize routine will be called + * (may be running on another thread at this time). + * Wait for it to finish. + */ + NdisWaitEvent(&pAdapt->MiniportInitEvent, 0); + } + + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + } +#endif + + /* + * Call NDIS to remove our device-instance. We do most of the work + * inside the HaltHandler. + * + * The Handle will be NULL if our miniport Halt Handler has been called or + * if the IM device was never initialized + */ + + if (vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Initialized) + { + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitializing); + + *pStatus = NdisIMDeInitializeDeviceInstance(pAdapt->hMiniportHandle); + + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + + if (*pStatus != NDIS_STATUS_SUCCESS) + { + *pStatus = NDIS_STATUS_FAILURE; + } + + return true; + } + + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + + return false; +} +#endif + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpReferenceControlDevice() +{ + return vboxNetFltWinPtRegisterDevice(); +} + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDereferenceControlDevice() +{ + return vboxNetFltWinPtDeregisterDevice(); +} + +#endif /* #ifndef VBOX_NETFLT_ONDEMAND_BIND*/ diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltMp-win.h b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltMp-win.h new file mode 100644 index 000000000..82de0714a --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltMp-win.h @@ -0,0 +1,50 @@ +/* $Id: VBoxNetFltMp-win.h $ */ +/** @file + * VBoxNetFlt - Network Filter Driver (Host), Windows Specific Code. Miniport edge of ndis filter driver + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. + * Copyright (c) 1993-1999, Microsoft Corporation + */ + +#ifndef ___VBoxNetFltMp_win_h___ +#define ___VBoxNetFltMp_win_h___ + + #ifdef VBOX_NETFLT_ONDEMAND_BIND + # error "unsupported (VBOX_NETFLT_ONDEMAND_BIND)" + #else + +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpRegister(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDeregister(); +DECLHIDDEN(NDIS_HANDLE) vboxNetFltWinMpGetHandle(); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpInitializeDevideInstance(PADAPT pAdapt); +DECLHIDDEN(VOID) vboxNetFltWinMpReturnPacket(IN NDIS_HANDLE MiniportAdapterContext, IN PNDIS_PACKET Packet); +DECLHIDDEN(bool) vboxNetFltWinMpDeInitializeDevideInstance(PADAPT pAdapt, PNDIS_STATUS pStatus); +DECLHIDDEN(VOID) vboxNetFltWinMpQueryPNPCapabilities(IN OUT PADAPT pAdapt, OUT PNDIS_STATUS pStatus); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpReferenceControlDevice(); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDereferenceControlDevice(); + + #ifdef VBOXNETADP +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDoInitialization(PADAPT pAdapt, NDIS_HANDLE hMiniportAdapter, NDIS_HANDLE hWrapperConfigurationContext); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDoDeinitialization(PADAPT pAdapt); + #endif + + #endif + +#endif diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltPt-win.c b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltPt-win.c new file mode 100644 index 000000000..04904e229 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltPt-win.c @@ -0,0 +1,2289 @@ +/* $Id: VBoxNetFltPt-win.c $ */ +/** @file + * VBoxNetFlt - Network Filter Driver (Host), Windows Specific Code. Protocol edge of ndis filter driver + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. + * Copyright (c) 1993-1999, Microsoft Corporation + */ + +#include "VBoxNetFltCommon-win.h" + +#ifdef VBOXNETADP +# error "No protocol edge" +#endif + +/** protocol handle */ +static NDIS_HANDLE g_hProtHandle = NULL; +/** medium array used while opening underlying adaprot + * we are actually binding to NdisMedium802_3 and NdisMediumWan + * as specified in VBoxNetFlt.inf: + * HKR, Ndi\Interfaces, FilterMediaTypes, , "ethernet, wan" */ +static NDIS_MEDIUM g_aMediumArray[] = + { + /* Ethernet */ + NdisMedium802_3, + /* Wan */ + NdisMediumWan + }; + +/** + * performs binding to the given adapter + */ +#ifdef VBOX_NETFLT_ONDEMAND_BIND +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtDoBinding(IN PADAPT pAdapt) +#else +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtDoBinding(IN PADAPT pAdapt, IN PNDIS_STRING pOurDeviceName, IN PNDIS_STRING pBindToDeviceName) +#endif +{ + UINT MediumIndex; + NDIS_STATUS Status, Sts; + + Assert(pAdapt->PTState.PowerState == NdisDeviceStateD3); + Assert(pAdapt->PTState.OpState == kVBoxNetDevOpState_Deinitialized); + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Initializing); + + do + { +// NDIS_STATUS TmpStatus; + /* copy the bind to dev name to our buffer */ +#ifdef VBOX_NETFLT_ONDEMAND_BIND + NDIS_STRING BindToDeviceName; + PNDIS_STRING pBindToDeviceName; + PVBOXNETFLTINS pThis = PADAPT_2_PVBOXNETFLTINS(pAdapt); + PWSTR pUnicode; + ULONG cbUnicode; + ANSI_STRING AnsiStr; + + /* most Rtlxx functions we are using here require this */ + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + + RtlInitAnsiString(&AnsiStr, pThis->szName); + cbUnicode = RtlAnsiStringToUnicodeSize(&AnsiStr); + + pUnicode = alloca(cbUnicode); + BindToDeviceName.Buffer = pUnicode; + BindToDeviceName.MaximumLength = (USHORT)cbUnicode; + + Status = RtlAnsiStringToUnicodeString(&BindToDeviceName, &AnsiStr, FALSE); + if(!NT_SUCCESS(Status)) + { + Assert(0); + break; + } + + pBindToDeviceName = &BindToDeviceName; +#else + Status = vboxNetFltWinCopyString(&pAdapt->DeviceName, pOurDeviceName); + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + break; + } +#endif + + vboxNetFltWinSetPowerState(&pAdapt->PTState, NdisDeviceStateD0); + pAdapt->Status = NDIS_STATUS_SUCCESS; + + NdisResetEvent(&pAdapt->hEvent); + + /* + * Now open the adapter below and complete the initialization + */ + NdisOpenAdapter(&Status, + &Sts, + &pAdapt->hBindingHandle, + &MediumIndex, + g_aMediumArray, + sizeof(g_aMediumArray)/sizeof(NDIS_MEDIUM), + g_hProtHandle, + pAdapt, + pBindToDeviceName, + 0, + NULL); + + if (Status == NDIS_STATUS_PENDING) + { + NdisWaitEvent(&pAdapt->hEvent, 0); + Status = pAdapt->Status; + } + + Assert(Status == NDIS_STATUS_SUCCESS); + if(Status != NDIS_STATUS_SUCCESS) + { + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitialized); + pAdapt->hBindingHandle = NULL; + LogRel(("NdisOpenAdapter failed, Status (0c%x)", Status)); + break; + } + + Assert(pAdapt->hBindingHandle); + + pAdapt->Medium = g_aMediumArray[MediumIndex]; + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Initialized); + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + Status = vboxNetFltWinMpInitializeDevideInstance(pAdapt); + if (Status != NDIS_STATUS_SUCCESS) + { + Log(("BindAdapter: Adapt %p, IMInitializeDeviceInstance error %x\n", + pAdapt, Status)); + + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitializing); + vboxNetFltWinPtCloseAdapter(pAdapt, &Sts); + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitialized); + break; + } +#endif + } while(0); + + return Status; +} + +/** + * Called by NDIS to bind to a miniport below. + * @param Status - Return status of bind here. + * @param BindContext - Can be passed to NdisCompleteBindAdapter if this call is pended. + * @param DeviceName - Device name to bind to. This is passed to NdisOpenAdapter. + * @param SystemSpecific1 - Can be passed to NdisOpenProtocolConfiguration to read per-binding information + * @paran SystemSpecific2 - Unused + * @return NDIS_STATUS_PENDING if this call is pended. In this case call NdisCompleteBindAdapter to complete. + * Anything else Completes this call synchronously */ +static VOID +vboxNetFltWinPtBindAdapter( + OUT PNDIS_STATUS pStatus, + IN NDIS_HANDLE BindContext, + IN PNDIS_STRING pDeviceName, + IN PVOID SystemSpecific1, + IN PVOID SystemSpecific2 + ) +{ +#ifdef VBOX_NETFLT_ONDEMAND_BIND + /* we initiate the binding ourselves by calling NdisOpenAdapter */ + LogFlow(("==> Protocol BindAdapter\n")); + Assert(0); + *pStatus = NDIS_STATUS_OPEN_FAILED; + LogFlow(("<== Protocol BindAdapter\n")); + return; +#else + NDIS_HANDLE ConfigHandle = NULL; + PNDIS_CONFIGURATION_PARAMETER Param; + NDIS_STRING DeviceStr = NDIS_STRING_CONST("UpperBindings"); + PADAPT pAdapt = NULL; + + UNREFERENCED_PARAMETER(BindContext); + UNREFERENCED_PARAMETER(SystemSpecific2); + + LogFlow(("==> Protocol BindAdapter\n")); + + do + { + /* Access the configuration section for our binding-specific + * parameters. */ + + NdisOpenProtocolConfiguration(pStatus, + &ConfigHandle, + (PNDIS_STRING)SystemSpecific1); + + if (*pStatus != NDIS_STATUS_SUCCESS) + { + break; + } + + /* Read the "UpperBindings" reserved key that contains a list + * of device names representing our miniport instances corresponding + * to this lower binding. Since this is a 1:1 IM driver, this key + * contains exactly one name. + * + * If we want to implement a N:1 mux driver (N adapter instances + * over a single lower binding), then UpperBindings will be a + * MULTI_SZ containing a list of device names - we would loop through + * this list, calling NdisIMInitializeDeviceInstanceEx once for + * each name in it. */ + + NdisReadConfiguration(pStatus, + &Param, + ConfigHandle, + &DeviceStr, + NdisParameterString); + if (*pStatus != NDIS_STATUS_SUCCESS) + { + break; + } + + *pStatus = vboxNetFltWinPtInitBind(&pAdapt, &Param->ParameterData.StringData, pDeviceName); + if (*pStatus != NDIS_STATUS_SUCCESS) + { + break; + } + } while(FALSE); + + /* + * Close the configuration handle now - see comments above with + * the call to NdisIMInitializeDeviceInstanceEx. + */ + if (ConfigHandle != NULL) + { + NdisCloseConfiguration(ConfigHandle); + } + + LogFlow(("<== Protocol BindAdapter: pAdapt %p, Status %x\n", pAdapt, *pStatus)); +#endif +} + +/** + * Completion routine for NdisOpenAdapter issued from within the vboxNetFltWinPtBindAdapter. Simply + * unblock the caller. + * + * @param ProtocolBindingContext Pointer to the adapter + * @param Status Status of the NdisOpenAdapter call + * @param OpenErrorStatus Secondary status(ignored by us). + * @return None + * */ +static VOID +vboxNetFltWinPtOpenAdapterComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS Status, + IN NDIS_STATUS OpenErrorStatus + ) +{ + PADAPT pAdapt =(PADAPT)ProtocolBindingContext; + + UNREFERENCED_PARAMETER(OpenErrorStatus); + + LogFlow(("==> vboxNetFltWinPtOpenAdapterComplete: Adapt %p, Status %x\n", pAdapt, Status)); + if(pAdapt->Status == NDIS_STATUS_SUCCESS) + { + pAdapt->Status = Status; + } + NdisSetEvent(&pAdapt->hEvent); +} + +DECLHIDDEN(NDIS_STATUS) +vboxNetFltWinPtDoUnbinding(PADAPT pAdapt, bool bOnUnbind) +{ + NDIS_STATUS Status; +#ifndef VBOX_NETFLT_ONDEMAND_BIND + PNDIS_PACKET PacketArray[MAX_RECEIVE_PACKET_ARRAY_SIZE]; + ULONG NumberOfPackets = 0, i; + BOOLEAN CompleteRequest = FALSE; + BOOLEAN ReturnPackets = FALSE; + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + uint64_t NanoTS = RTTimeSystemNanoTS(); +#endif + + LogFlow(("==> vboxNetFltWinPtDoUnbinding: Adapt %p\n", pAdapt)); + + Assert(KeGetCurrentIrql() == PASSIVE_LEVEL); + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + Assert(vboxNetFltWinGetOpState(&pAdapt->PTState) == kVBoxNetDevOpState_Initialized); + /* + * Set the flag that the miniport below is unbinding, so the request handlers will + * fail any request comming later + */ + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + + ASMAtomicUoWriteBool(&pNetFlt->fDisconnectedFromHost, true); + ASMAtomicUoWriteBool(&pNetFlt->fRediscoveryPending, false); + ASMAtomicUoWriteU64(&pNetFlt->NanoTSLastRediscovery, NanoTS); + +// pAdapt->PTState.DeviceState = NdisDeviceStateD3; +// pAdapt->MPState.DeviceState = NdisDeviceStateD3; + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitializing); + if(!bOnUnbind) + { + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitializing); + } + + if (pAdapt->bQueuedRequest == TRUE) + { + pAdapt->bQueuedRequest = FALSE; + CompleteRequest = TRUE; + } + if (pAdapt->cReceivedPacketCount > 0) + { + + NdisMoveMemory(PacketArray, + pAdapt->aReceivedPackets, + pAdapt->cReceivedPacketCount * sizeof(PNDIS_PACKET)); + + NumberOfPackets = pAdapt->cReceivedPacketCount; + + pAdapt->cReceivedPacketCount = 0; + ReturnPackets = TRUE; + } + + + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + + if (CompleteRequest == TRUE) + { + vboxNetFltWinPtRequestComplete(pAdapt, + &pAdapt->Request, + NDIS_STATUS_FAILURE ); + + } + if (ReturnPackets == TRUE) + { + for (i = 0; i < NumberOfPackets; i++) + { + vboxNetFltWinMpReturnPacket(pAdapt, PacketArray[i]); + } + } + + vboxNetFltWinWaitDereference(&pAdapt->MPState); + + vboxNetFltWinWaitDereference(&pAdapt->PTState); + + while (ASMAtomicUoReadBool((volatile bool *)&pAdapt->bOutstandingRequests)) + { + /* + * sleep till outstanding requests complete + */ + vboxNetFltWinSleep(2); + } + + if(!bOnUnbind || !vboxNetFltWinMpDeInitializeDevideInstance(pAdapt, &Status)) +#endif /* #ifndef VBOX_NETFLT_ONDEMAND_BIND */ + { + /* + * We need to do some work here. + * Close the binding below us + * and release the memory allocated. + */ + vboxNetFltWinPtCloseAdapter(pAdapt, &Status); + vboxNetFltWinSetOpState(&pAdapt->PTState, kVBoxNetDevOpState_Deinitialized); + + if(!bOnUnbind) + { + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitializing); + vboxNetFltWinSetOpState(&pAdapt->MPState, kVBoxNetDevOpState_Deinitialized); + } + else + { + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); + } + } + else + { + Assert(vboxNetFltWinGetOpState(&pAdapt->MPState) == kVBoxNetDevOpState_Deinitialized); + } + + LogFlow(("<== vboxNetFltWinPtDoUnbinding: Adapt %p\n", pAdapt)); + + return Status; +} + +/** + * Called by NDIS when we are required to unbind to the adapter below. + * This functions shares functionality with the miniport's HaltHandler. + * The code should ensure that NdisCloseAdapter and NdisFreeMemory is called + * only once between the two functions + * + * @param Status Placeholder for return status + * @param ProtocolBindingContext Pointer to the adapter structure + * @param UnbindContext Context for NdisUnbindComplete() if this pends + * @return NONE */ +static VOID +vboxNetFltWinPtUnbindAdapter( + OUT PNDIS_STATUS pStatus, + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_HANDLE UnbindContext + ) +{ + PADAPT pAdapt =(PADAPT)ProtocolBindingContext; + PVBOXNETFLTINS pNetFltIf = PADAPT_2_PVBOXNETFLTINS(pAdapt); + + LogFlow(("==> vboxNetFltWinPtUnbindAdapter: Adapt %p\n", pAdapt)); + + *pStatus = vboxNetFltWinDetachFromInterface(pAdapt, true); + Assert(*pStatus == NDIS_STATUS_SUCCESS); + + LogFlow(("<== vboxNetFltWinPtUnbindAdapter: Adapt %p\n", pAdapt)); +} + +/** + * protocol unload handler + */ +static VOID +vboxNetFltWinPtUnloadProtocol( + VOID +) +{ + vboxNetFltWinPtDeregister(); + LogFlow(("vboxNetFltWinPtUnloadProtocol: done!\n")); +} + + +/** + * Completion for the CloseAdapter call. + * + * @param ProtocolBindingContext Pointer to the adapter structure + * @param Status Completion status + * @return None */ +static VOID +vboxNetFltWinPtCloseAdapterComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS Status + ) +{ + PADAPT pAdapt =(PADAPT)ProtocolBindingContext; + + LogFlow(("CloseAdapterComplete: Adapt %p, Status %x\n", pAdapt, Status)); + if(pAdapt->Status == NDIS_STATUS_SUCCESS) + { + pAdapt->Status = Status; + } + NdisSetEvent(&pAdapt->hEvent); +} + + +/** + * Completion for the reset. + * + * @param ProtocolBindingContext Pointer to the adapter structure + * @param Status Completion status + * @return None */ +static VOID +vboxNetFltWinPtResetComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS Status + ) +{ + + UNREFERENCED_PARAMETER(ProtocolBindingContext); + UNREFERENCED_PARAMETER(Status); + /* + * We never issue a reset, so we should not be here. + */ + Assert(0); +} + +/** + * Completion handler for the previously posted request. All OIDS + * are completed by and sent to the same miniport that they were requested for. + * If Oid == OID_PNP_QUERY_POWER then the data structure needs to returned with all entries = + * NdisDeviceStateUnspecified + * @param ProtocolBindingContext Pointer to the adapter structure + * @param NdisRequest The posted request + * @param Status Completion status + * @return None + * + */ +DECLHIDDEN(VOID) +vboxNetFltWinPtRequestComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNDIS_REQUEST NdisRequest, + IN NDIS_STATUS Status + ) +{ + PADAPT pAdapt = (PADAPT)ProtocolBindingContext; + PNDIS_REQUEST pSynchRequest = pAdapt->pSynchRequest; +#ifndef VBOX_NETFLT_ONDEMAND_BIND + NDIS_OID Oid = pAdapt->Request.DATA.SET_INFORMATION.Oid ; +#endif + + if(pSynchRequest == NdisRequest) + { + /* assynchronous completion of our synch request */ + + /*1.set the status */ + pAdapt->fSynchCompletionStatus = Status; + + /* 2. set event */ + KeSetEvent(&pAdapt->hSynchCompletionEvent, 0, FALSE); + + /* 3. return; */ + return; + } +#ifdef VBOX_NETFLT_ONDEMAND_BIND + Assert(0); + return; +#else + + /* + * Since our request is not outstanding anymore + */ + Assert(pAdapt->bOutstandingRequests == TRUE); + + pAdapt->bOutstandingRequests = FALSE; + + /* + * Complete the Set or Query, and fill in the buffer for OID_PNP_CAPABILITIES, if need be. + */ + switch (NdisRequest->RequestType) + { + case NdisRequestQueryInformation: + + /* + * We never pass OID_PNP_QUERY_POWER down. + */ + Assert(Oid != OID_PNP_QUERY_POWER); + + if ((Oid == OID_PNP_CAPABILITIES) && (Status == NDIS_STATUS_SUCCESS)) + { + vboxNetFltWinMpQueryPNPCapabilities(pAdapt, &Status); + } + *pAdapt->BytesReadOrWritten = NdisRequest->DATA.QUERY_INFORMATION.BytesWritten; + *pAdapt->BytesNeeded = NdisRequest->DATA.QUERY_INFORMATION.BytesNeeded; + + if ((Oid == OID_GEN_MAC_OPTIONS) && (Status == NDIS_STATUS_SUCCESS)) + { + /* save mac options for adaptor below us to use it with the NdisCopyLookaheadData when our ProtocolReceive is called */ + pAdapt->fMacOptions = *(PULONG)NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer; + + /* we have to catch loopbacks from the underlying driver, so no duplications will occur, + * just indicate NDIS to handle loopbacks for the packets coming from the protocol */ + *(PULONG)NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer |= NDIS_MAC_OPTION_NO_LOOPBACK; + } + if(Oid == OID_GEN_CURRENT_PACKET_FILTER && VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)) + { + if(Status == NDIS_STATUS_SUCCESS) + { + /* the filter request is issued below only in case netflt is not active, + * simply update the cache here */ + /* cache the filter used by upper protocols */ + pAdapt->fUpperProtocolSetFilter = *(PULONG)NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer; + pAdapt->bUpperProtSetFilterInitialized = true; + } + } + + + NdisMQueryInformationComplete(pAdapt->hMiniportHandle, + Status); + break; + + case NdisRequestSetInformation: + + Assert( Oid != OID_PNP_SET_POWER); + + if(Oid == OID_GEN_CURRENT_PACKET_FILTER && VBOXNETFLT_PROMISCUOUS_SUPPORTED(pAdapt)) + { + PVBOXNETFLTINS pNetFltIf = PADAPT_2_PVBOXNETFLTINS(pAdapt); + Assert(Status == NDIS_STATUS_SUCCESS); + if(pAdapt->bProcessingPacketFilter) + { + if(Status == NDIS_STATUS_SUCCESS) + { + pAdapt->fOurSetFilter = *((PULONG)pAdapt->Request.DATA.SET_INFORMATION.InformationBuffer); + Assert(pAdapt->fOurSetFilter == NDIS_PACKET_TYPE_PROMISCUOUS); + } + vboxNetFltWinDereferenceNetFlt(pNetFltIf); + vboxNetFltWinDereferenceAdapt(pAdapt); + pAdapt->bProcessingPacketFilter = false; + } + else + { + if(Status == NDIS_STATUS_SUCCESS) + { + /* the request was issued when the netflt was not active, simply update the cache here */ + pAdapt->fUpperProtocolSetFilter = *((PULONG)pAdapt->Request.DATA.SET_INFORMATION.InformationBuffer); + pAdapt->bUpperProtSetFilterInitialized = true; + } + } + } + + + *pAdapt->BytesReadOrWritten = NdisRequest->DATA.SET_INFORMATION.BytesRead; + *pAdapt->BytesNeeded = NdisRequest->DATA.SET_INFORMATION.BytesNeeded; + NdisMSetInformationComplete(pAdapt->hMiniportHandle, + Status); + break; + + default: + Assert(0); + break; + } +#endif +} + +/** + * Status handler for the lower-edge(protocol). + * + * @param ProtocolBindingContext Pointer to the adapter structure + * @param GeneralStatus Status code + * @param StatusBuffer Status buffer + * @param StatusBufferSize Size of the status buffer + * @return None + */ +static VOID +vboxNetFltWinPtStatus( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS GeneralStatus, + IN PVOID StatusBuffer, + IN UINT StatusBufferSize + ) +{ +#ifndef VBOX_NETFLT_ONDEMAND_BIND + PADAPT pAdapt = (PADAPT)ProtocolBindingContext; + + /* + * Pass up this indication only if the upper edge miniport is initialized + * and powered on. Also ignore indications that might be sent by the lower + * miniport when it isn't at D0. + */ + if (vboxNetFltWinReferenceAdapt(pAdapt)) + { + Assert(pAdapt->hMiniportHandle); + + if ((GeneralStatus == NDIS_STATUS_MEDIA_CONNECT) || + (GeneralStatus == NDIS_STATUS_MEDIA_DISCONNECT)) + { + + pAdapt->LastIndicatedStatus = GeneralStatus; + } + NdisMIndicateStatus(pAdapt->hMiniportHandle, + GeneralStatus, + StatusBuffer, + StatusBufferSize); + + vboxNetFltWinDereferenceAdapt(pAdapt); + } + /* + * Save the last indicated media status + */ + else + { + if ((pAdapt->hMiniportHandle != NULL) && + ((GeneralStatus == NDIS_STATUS_MEDIA_CONNECT) || + (GeneralStatus == NDIS_STATUS_MEDIA_DISCONNECT))) + { + pAdapt->LatestUnIndicateStatus = GeneralStatus; + } + } +#endif +} + +/** + * status complete handler + */ +static VOID +vboxNetFltWinPtStatusComplete( + IN NDIS_HANDLE ProtocolBindingContext + ) +{ +#ifndef VBOX_NETFLT_ONDEMAND_BIND + PADAPT pAdapt = (PADAPT)ProtocolBindingContext; + + /* + * Pass up this indication only if the upper edge miniport is initialized + * and powered on. Also ignore indications that might be sent by the lower + * miniport when it isn't at D0. + */ + if (vboxNetFltWinReferenceAdapt(pAdapt)) + { + NdisMIndicateStatusComplete(pAdapt->hMiniportHandle); + + vboxNetFltWinDereferenceAdapt(pAdapt); + } +#endif +} + +/** + * Called by NDIS when the miniport below had completed a send. We should + * complete the corresponding upper-edge send this represents. + * + * @param ProtocolBindingContext - Points to ADAPT structure + * @param Packet - Low level packet being completed + * @param Status - status of send + * @return None + */ +static VOID +vboxNetFltWinPtSendComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNDIS_PACKET Packet, + IN NDIS_STATUS Status + ) +{ + PADAPT pAdapt = (PADAPT)ProtocolBindingContext; + PNDIS_PACKET Pkt; + + { + PSEND_RSVD SendRsvd; +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// PPACKET_INFO pInfo = vboxNetFltWinDoCompleteSend(pAdapt, Packet); +// +// if(pInfo) +// { +// vboxNetFltWinPpFreePacketInfo(pInfo); +// } +#endif +// Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); + + SendRsvd = (PSEND_RSVD)(Packet->ProtocolReserved); + Pkt = SendRsvd->pOriginalPkt; + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + if(Pkt) + { +#ifndef WIN9X + NdisIMCopySendCompletePerPacketInfo (Pkt, Packet); +#endif + NdisFreePacket(Packet); + + /* the ptk was posted from the upperlying protocol */ + NdisMSendComplete(pAdapt->hMiniportHandle, + Pkt, + Status); + } + else +#else + /* TODO: should change the PSEND_RSVD structure as we no nolnger need to handle original packets + * because all packets are originated by us */ + Assert(!Pkt); +#endif + { + /* if the ptk is zerro - the ptk was originated by netFlt send/receive + * need to free packet buffers */ + PVOID pBufToFree = SendRsvd->pBufToFree; + + vboxNetFltWinFreeSGNdisPacket(Packet, !pBufToFree); + if(pBufToFree) + { + vboxNetFltWinMemFree(pBufToFree); + } + } + } + + vboxNetFltWinDereferenceAdapt(pAdapt); +} + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + +/** + * removes searches for the packet in the list and removes it if found + * @return true if the packet was found and removed, false - otherwise + */ +static bool vboxNetFltWinRemovePacketFromList(PINTERLOCKED_SINGLE_LIST pList, PNDIS_PACKET pPacket) +{ + PTRANSFERDATA_RSVD pTDR = &((PPT_RSVD)pPacket->ProtocolReserved)->TransferDataRsvd; + return vboxNetFltWinInterlockedSearchListEntry(pList, &pTDR->ListEntry, + true /* remove*/); +} + +/** + * puts the packet to the tail of the list + */ +static void vboxNetFltWinPutPacketToList(PINTERLOCKED_SINGLE_LIST pList, PNDIS_PACKET pPacket, PNDIS_BUFFER pOrigBuffer) +{ + PTRANSFERDATA_RSVD pTDR = &((PPT_RSVD)pPacket->ProtocolReserved)->TransferDataRsvd; + pTDR->pOriginalBuffer = pOrigBuffer; + vboxNetFltWinInterlockedPutTail(pList, &pTDR->ListEntry); +} + +#endif + +static bool vboxNetFltWinPtTransferDataCompleteActive(IN PADAPT pAdapt, + IN PNDIS_PACKET pPacket, + IN NDIS_STATUS Status) +{ + PVBOXNETFLTINS pNetFltIf = PADAPT_2_PVBOXNETFLTINS(pAdapt); + PNDIS_BUFFER pBuffer; + PTRANSFERDATA_RSVD pTDR; + + if(!vboxNetFltWinRemovePacketFromList(&pAdapt->TransferDataList, pPacket)) + return false; + + pTDR = &((PPT_RSVD)pPacket->ProtocolReserved)->TransferDataRsvd; + Assert(pTDR); + Assert(pTDR->pOriginalBuffer); + + do + { + NdisUnchainBufferAtFront(pPacket, &pBuffer); + + Assert(pBuffer); + + NdisFreeBuffer(pBuffer); + + pBuffer = pTDR->pOriginalBuffer; + + NdisChainBufferAtBack(pPacket, pBuffer); + + /* data transfer was initiated when the netFlt was active + * the netFlt is still retained by us + * 1. check if loopback + * 2. enqueue packet + * 3. release netFlt */ + + if(Status == NDIS_STATUS_SUCCESS) + { + +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// /* 1. if loopback then quit with NDIS_STATUS_NOT_ACCEPTED */ +//#ifdef VBOX_NETFLT_ONDEMAND_BIND +// if(vboxNetFltWinIsLoopedBackPacket(pAdapt, pPacket)) +//#else +// if(vboxNetFltWinIsLoopedBackPacket(pAdapt, pPacket, true)) +//#endif +#else + if(vboxNetFltWinIsLoopedBackPacket(pPacket)) +#endif + { + Assert(0); + } + else + { + PRECV_RSVD pRecvRsvd; + /* 2. enqueue */ + /* use the same packet info to put the packet in the processing packet queue */ +#ifdef VBOX_NETFLT_ONDEMAND_BIND + PNDIS_BUFFER pBuffer; + PVOID pVA; + UINT cbLength; + uint32_t fFlags; + + NdisQueryPacket(pPacket, NULL, NULL, &pBuffer, NULL); + NdisQueryBufferSafe(pBuffer, &pVA, &cbLength, NormalPagePriority); + + fFlags = MACS_EQUAL(((PRTNETETHERHDR)pVA)->SrcMac, pNetFltIf->u.s.Mac) ? + PACKET_MINE | PACKET_SRC_HOST : PACKET_MINE; + SET_FLAGS_TO_INFO(pInfo, fFlags); + + pRecvRsvd = (PRECV_RSVD)(pPacket->MiniportReserved); + pRecvRsvd->pOriginalPkt = NULL; + pRecvRsvd->pBufToFree = NULL; + + NdisSetPacketFlags(pPacket, 0); + + Status = vboxNetFltWinQuEnqueuePacket(pNetFltIf, pPacket, fFlags); +#else + pRecvRsvd = (PRECV_RSVD)(pPacket->MiniportReserved); + pRecvRsvd->pOriginalPkt = NULL; + pRecvRsvd->pBufToFree = NULL; + + NdisSetPacketFlags(pPacket, 0); + + Status = vboxNetFltWinQuEnqueuePacket(pNetFltIf, pPacket, PACKET_MINE); +#endif + if(Status == NDIS_STATUS_SUCCESS) + { + break; + } + Assert(0); + } + } + else + { + Assert(0); + } + /* we are here because of error either in data transfer or in enqueueing the packet */ + vboxNetFltWinFreeSGNdisPacket(pPacket, true); + vboxNetFltWinDereferenceNetFlt(pNetFltIf); + vboxNetFltWinDereferenceAdapt(pAdapt); + } while(0); + + return true; +} + +/** + * Entry point called by NDIS to indicate completion of a call by us + * to NdisTransferData. + * + * See notes under SendComplete. + */ +static VOID +vboxNetFltWinPtTransferDataComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNDIS_PACKET pPacket, + IN NDIS_STATUS Status, + IN UINT BytesTransferred + ) +{ + PADAPT pAdapt =(PADAPT)ProtocolBindingContext; + if(!vboxNetFltWinPtTransferDataCompleteActive(pAdapt, pPacket, Status)) + { +#ifndef VBOX_NETFLT_ONDEMAND_BIND + if(pAdapt->hMiniportHandle) + { + NdisMTransferDataComplete(pAdapt->hMiniportHandle, + pPacket, + Status, + BytesTransferred); + } + + vboxNetFltWinDereferenceAdapt(pAdapt); +#else + /* we are here because we've failed to allocate packet info */ + Assert(0); +#endif + } +} +#ifndef VBOX_NETFLT_ONDEMAND_BIND + +/** + * This is to queue the received packets and indicates them up if the given Packet + * status is NDIS_STATUS_RESOURCES, or the array is full. + * + * @param pAdapt - Pointer to the adpater structure. + * @param Packet - Pointer to the indicated packet. + * @param Indicate - Do the indication now. + * @return NONE + */ +static VOID +vboxNetFltWinPtQueueReceivedPacket( + IN PADAPT pAdapt, + IN PNDIS_PACKET Packet, + IN BOOLEAN DoIndicate + ) +{ + PNDIS_PACKET PacketArray[MAX_RECEIVE_PACKET_ARRAY_SIZE]; + ULONG NumberOfPackets = 0, i; + bool bReturn = false; + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + + Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); + do{ + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + + if(vboxNetFltWinGetPowerState(&pAdapt->PTState) != NdisDeviceStateD0 + || vboxNetFltWinGetPowerState(&pAdapt->MPState) != NdisDeviceStateD0 + || vboxNetFltWinGetOpState(&pAdapt->PTState) > kVBoxNetDevOpState_Initialized + || vboxNetFltWinGetOpState(&pAdapt->MPState) > kVBoxNetDevOpState_Initialized) + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + bReturn = true; + break; + } + + Assert(pAdapt->cReceivedPacketCount < MAX_RECEIVE_PACKET_ARRAY_SIZE); + + /* + * pAdapt->ReceviePacketCount must be less than MAX_RECEIVE_PACKET_ARRAY_SIZE because + * the thread which held the pVElan->Lock before should already indicate the packet(s) + * up if pAdapt->ReceviePacketCount == MAX_RECEIVE_PACKET_ARRAY_SIZE. + */ + pAdapt->aReceivedPackets[pAdapt->cReceivedPacketCount] = Packet; + pAdapt->cReceivedPacketCount++; + + /* + * If our receive packet array is full, or the miniport below indicated the packets + * with resources, do the indicatin now. + */ + + if ((pAdapt->cReceivedPacketCount == MAX_RECEIVE_PACKET_ARRAY_SIZE) || DoIndicate) + { + NdisMoveMemory(PacketArray, + pAdapt->aReceivedPackets, + pAdapt->cReceivedPacketCount * sizeof(PNDIS_PACKET)); + + NumberOfPackets = pAdapt->cReceivedPacketCount; + /* + * So other thread can queue the received packets + */ + pAdapt->cReceivedPacketCount = 0; + DoIndicate = TRUE; + } + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + } while(0); + + if(!bReturn) + { + if(DoIndicate) + { + NdisMIndicateReceivePacket(pAdapt->hMiniportHandle, PacketArray, NumberOfPackets); + } + } + else + { + if (DoIndicate) + { + NumberOfPackets -= 1; + } + for (i = 0; i < NumberOfPackets; i++) + { + vboxNetFltWinMpReturnPacket(pAdapt, PacketArray[i]); + } + } +} + +/** + * This routine process the queued the packet, if anything is fine, indicate the packet + * up, otherwise, return the packet to the underlying miniports. + * + * @param pAdapt - Pointer to the adpater structure. + * @param bReturn - if true the packets should be returned without indication to the upper protocol + * @return None. */ +DECLHIDDEN(VOID) +vboxNetFltWinPtFlushReceiveQueue( + IN PADAPT pAdapt, + IN bool bReturn + ) +{ + + PNDIS_PACKET PacketArray[MAX_RECEIVE_PACKET_ARRAY_SIZE]; + ULONG NumberOfPackets = 0, i; + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + + do + { + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + + if (pAdapt->cReceivedPacketCount > 0) + { + NdisMoveMemory(PacketArray, + pAdapt->aReceivedPackets, + pAdapt->cReceivedPacketCount * sizeof(PNDIS_PACKET)); + + NumberOfPackets = pAdapt->cReceivedPacketCount; + /* + * So other thread can queue the received packets + */ + pAdapt->cReceivedPacketCount = 0; + + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + + if(!bReturn) + { + if(NumberOfPackets > 0) + { + Assert(pAdapt->hMiniportHandle); + + /* we are here because the NetFlt is NOT active, + * so no need for packet queueing here, simply indicate */ + NdisMIndicateReceivePacket(pAdapt->hMiniportHandle, + PacketArray, + NumberOfPackets); + } + break; + } + /* + * We need return the packet here + */ + for (i = 0; i < NumberOfPackets; i ++) + { + vboxNetFltWinMpReturnPacket(pAdapt, PacketArray[i]); + } + + /* break to ensure we do not call RTSpinlockRelease extra time */ + break; + } + + /* we are here only in case pAdapt->cReceivedPacketCount == 0 */ + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + } while (FALSE); +} + +/** + * ReceivePacket handler. Called by NDIS if the miniport below supports + * NDIS 4.0 style receives. Re-package the buffer chain in a new packet + * and indicate the new packet to protocols above us. Any context for + * packets indicated up must be kept in the MiniportReserved field. + * + * @param ProtocolBindingContext - Pointer to our adapter structure. + * @param Packet - Pointer to the packet + * @return INT == 0 -> We are done with the packet + * != 0 -> We will keep the packet and call NdisReturnPackets() this + * many times when done. */ +static INT +vboxNetFltWinRecvPacketPassThru( + IN PADAPT pAdapt, + IN PNDIS_PACKET pPacket + ) +{ + NDIS_STATUS fStatus; + PNDIS_PACKET pMyPacket; + + Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); + + fStatus = vboxNetFltWinPrepareRecvPacket(pAdapt, pPacket, &pMyPacket, true); + + Assert(pMyPacket); + + if(pMyPacket != NULL) + { + if (fStatus == NDIS_STATUS_RESOURCES) + { + vboxNetFltWinPtQueueReceivedPacket(pAdapt, pMyPacket, TRUE); + + /* + * Our ReturnPackets handler will not be called for this packet. + * We should reclaim it right here. + */ + NdisDprFreePacket(pMyPacket); + + return 0; + } + + vboxNetFltWinPtQueueReceivedPacket(pAdapt, pMyPacket, FALSE); + + return 1; + } + + return 0; +} + +/** + * process the packet receive in a "passthru" mode + */ +static NDIS_STATUS +vboxNetFltWinRecvPassThru( + IN PADAPT pAdapt, + IN PNDIS_PACKET pPacket) +{ + + NDIS_STATUS fStatus; + PNDIS_PACKET pMyPacket; + /* + * The miniport below did indicate up a packet. Use information + * from that packet to construct a new packet to indicate up. + */ + + Assert(KeGetCurrentIrql() == DISPATCH_LEVEL); + + /* + * Get a packet off the pool and indicate that up + */ + NdisDprAllocatePacket(&fStatus, + &pMyPacket, + pAdapt->hRecvPacketPoolHandle); + Assert(fStatus == NDIS_STATUS_SUCCESS); + if (fStatus == NDIS_STATUS_SUCCESS) + { + /* + * Make our packet point to data from the original + * packet. NOTE: this works only because we are + * indicating a receive directly from the context of + * our receive indication. If we need to queue this + * packet and indicate it from another thread context, + * we will also have to allocate a new buffer and copy + * over the packet contents, OOB data and per-packet + * information. This is because the packet data + * is available only for the duration of this + * receive indication call. + */ + NDIS_PACKET_FIRST_NDIS_BUFFER(pMyPacket) = NDIS_PACKET_FIRST_NDIS_BUFFER(pPacket); + NDIS_PACKET_LAST_NDIS_BUFFER(pMyPacket) = NDIS_PACKET_LAST_NDIS_BUFFER(pPacket); + + /* + * Get the original packet (it could be the same packet as the + * one received or a different one based on the number of layered + * miniports below) and set it on the indicated packet so the OOB + * data is visible correctly at protocols above. + */ + NDIS_SET_ORIGINAL_PACKET(pMyPacket, NDIS_GET_ORIGINAL_PACKET(pPacket)); + NDIS_SET_PACKET_HEADER_SIZE(pMyPacket, NDIS_GET_PACKET_HEADER_SIZE(pPacket)); + + /* + * Copy packet flags. + */ + NdisGetPacketFlags(pMyPacket) = NdisGetPacketFlags(pPacket); + + /* + * Force protocols above to make a copy if they want to hang + * on to data in this packet. This is because we are in our + * Receive handler (not ReceivePacket) and we can't return a + * ref count from here. + */ + NDIS_SET_PACKET_STATUS(pMyPacket, NDIS_STATUS_RESOURCES); + + /* + * By setting NDIS_STATUS_RESOURCES, we also know that we can reclaim + * this packet as soon as the call to NdisMIndicateReceivePacket + * returns. + * + * NOTE: we queue the packet and indicate this packet immediately with + * the already queued packets together. We have to the queue the packet + * first because some versions of NDIS might call protocols' + * ReceiveHandler(not ReceivePacketHandler) if the packet indicate status + * is NDIS_STATUS_RESOURCES. If the miniport below indicates an array of + * packets, some of them with status NDIS_STATUS_SUCCESS, some of them + * with status NDIS_STATUS_RESOURCES, vboxNetFltWinPtReceive might be called, by + * doing this way, we preserve the receive order of packets. + */ + vboxNetFltWinPtQueueReceivedPacket(pAdapt, pMyPacket, TRUE); + /* + * Reclaim the indicated packet. Since we had set its status + * to NDIS_STATUS_RESOURCES, we are guaranteed that protocols + * above are done with it. + */ + NdisDprFreePacket(pMyPacket); + + } + return fStatus; +} + +#endif /* #ifndef VBOX_NETFLT_ONDEMAND_BIND */ + + + + +/** + * process the ProtocolReceive in an "active" mode + * + * @return NDIS_STATUS_SUCCESS - the packet is processed + * NDIS_STATUS_PENDING - the packet is being processed, we are waiting for the ProtocolTransferDataComplete to be called + * NDIS_STATUS_NOT_ACCEPTED - the packet is not needed - typically this is because this is a loopback packet + * NDIS_STATUS_FAILURE - packet processing failed + */ +static NDIS_STATUS +vboxNetFltWinPtReceiveActive( + IN PADAPT pAdapt, + IN NDIS_HANDLE MacReceiveContext, + IN PVOID pHeaderBuffer, + IN UINT cbHeaderBuffer, + IN PVOID pLookaheadBuffer, + IN UINT cbLookaheadBuffer, + IN UINT cbPacket + ) +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + + do + { + if (cbHeaderBuffer != ETH_HEADER_SIZE) + { + Status = NDIS_STATUS_NOT_ACCEPTED; + break; + } + +#ifndef DEBUG_NETFLT_RECV_TRANSFERDATA + /* can check for loopback? check it*/ + if (cbPacket == cbLookaheadBuffer) + { + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + PINTNETSG pSG; + PUCHAR pRcvData; + +#ifdef DEBUG_NETFLT_LOOPBACK + /* TODO: can we check for loopback here ? + * for now just get the complete SG and then decide if it is a loopback one */ + /* if loopback then quit */ +#endif + /* allocate SG buffer */ + Status = vboxNetFltWinAllocSG(cbPacket + cbHeaderBuffer, &pSG); + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + break; + } + + pRcvData = (PUCHAR)pSG->aSegs[0].pv; + + NdisMoveMappedMemory(pRcvData, pHeaderBuffer, cbHeaderBuffer); + + NdisCopyLookaheadData(pRcvData+cbHeaderBuffer, + pLookaheadBuffer, + cbLookaheadBuffer, + pAdapt->fMacOptions); +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// /* check if it is a loopback */ +//# ifdef VBOX_NETFLT_ONDEMAND_BIND +// if(vboxNetFltWinIsLoopedBackPacketSG(pAdapt, pSG)) +//# else +// if(vboxNetFltWinIsLoopedBackPacketSG(pAdapt, pSG, true)) +//# endif +// { +// Assert(0); +// vboxNetFltWinMemFree(pSG); +// Status = NDIS_STATUS_NOT_ACCEPTED; +// break; +// } +#endif + /* enqueue SG */ +#ifdef VBOX_NETFLT_ONDEMAND_BIND + { + uint32_t fFlags = MACS_EQUAL(((PRTNETETHERHDR)pRcvData)->SrcMac, pNetFlt->u.s.Mac) ? + PACKET_SG | PACKET_MINE | PACKET_SRC_HOST : PACKET_SG | PACKET_MINE; + Status = vboxNetFltWinQuEnqueuePacket(pNetFlt, pSG, fFlags); + } +#else + Status = vboxNetFltWinQuEnqueuePacket(pNetFlt, pSG, PACKET_SG | PACKET_MINE); +#endif + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + vboxNetFltWinMemFree(pSG); + break; + } + } + else +#endif /* #ifndef DEBUG_NETFLT_RECV_TRANSFERDATA */ + { + PNDIS_PACKET pPacket; + PNDIS_BUFFER pTransferBuffer; + PNDIS_BUFFER pOrigBuffer; + PUCHAR pMemBuf; + UINT cbBuf = cbPacket + cbHeaderBuffer; +// PPACKET_INFO pInfo; + UINT BytesTransferred; + /* TODO: can check for loopback here ? */ + /* for now just get the complete complete packet and then decide if it is a looped back one */ + /* if loopback then quit with NDIS_STATUS_NOT_ACCEPTED + * { + * Status = NDIS_STATUS_NOT_ACCEPTED; + * break; + * } + * */ + + /* allocate NDIS Packet buffer */ +#ifdef VBOX_NETFLT_ONDEMAND_BIND + /* use the Send packet pool for packet allocation */ + NdisAllocatePacket(&Status, &pPacket, pAdapt->hSendPacketPoolHandle); +#else + NdisAllocatePacket(&Status, &pPacket, pAdapt->hRecvPacketPoolHandle); +#endif + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + break; + } + + /* set "don't loopback" flags */ + NdisSetPacketFlags(pPacket, g_fPacketDontLoopBack); + + Status = vboxNetFltWinMemAlloc(&pMemBuf, cbBuf); + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + NdisFreePacket(pPacket); + break; + } +#ifdef VBOX_NETFLT_ONDEMAND_BIND + /* use the Send buffer pool for buffer allocation */ + NdisAllocateBuffer(&Status, &pTransferBuffer, pAdapt->hSendBufferPoolHandle, pMemBuf + cbHeaderBuffer, cbPacket); +#else + NdisAllocateBuffer(&Status, &pTransferBuffer, pAdapt->hRecvBufferPoolHandle, pMemBuf + cbHeaderBuffer, cbPacket); +#endif + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + Status = NDIS_STATUS_FAILURE; + NdisFreePacket(pPacket); + vboxNetFltWinMemFree(pMemBuf); + break; + } + +#ifdef VBOX_NETFLT_ONDEMAND_BIND + /* use the Send buffer pool for buffer allocation */ + NdisAllocateBuffer(&Status, &pOrigBuffer, pAdapt->hSendBufferPoolHandle, pMemBuf, cbBuf); +#else + NdisAllocateBuffer(&Status, &pOrigBuffer, pAdapt->hRecvBufferPoolHandle, pMemBuf, cbBuf); +#endif + if(Status != NDIS_STATUS_SUCCESS) + { + Assert(0); + Status = NDIS_STATUS_FAILURE; + NdisFreeBuffer(pTransferBuffer); + NdisFreePacket(pPacket); + vboxNetFltWinMemFree(pMemBuf); + break; + } + + NdisChainBufferAtBack(pPacket, pTransferBuffer); + + NdisMoveMappedMemory(pMemBuf, pHeaderBuffer, cbHeaderBuffer); + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + vboxNetFltWinPutPacketToList(&pAdapt->TransferDataList, pPacket, pOrigBuffer); +#endif + +#ifdef DEBUG_NETFLT_RECV_TRANSFERDATA + if(cbPacket == cbLookaheadBuffer) + { + NdisCopyLookaheadData(pMemBuf+cbHeaderBuffer, + pLookaheadBuffer, + cbLookaheadBuffer, + pAdapt->fMacOptions); + } + else +#endif + { + Assert(cbPacket > cbLookaheadBuffer); + + NdisTransferData( + &Status, + pAdapt->hBindingHandle, + MacReceiveContext, + 0, /* ByteOffset */ + cbPacket, + pPacket, + &BytesTransferred); + } + if(Status != NDIS_STATUS_PENDING) + { + vboxNetFltWinPtTransferDataComplete(pAdapt, pPacket, Status, BytesTransferred); + } + } + } while(0); + + return Status; +} + + +/** + * Handle receive data indicated up by the miniport below. We pass + * it along to the protocol above us. + * + * If the miniport below indicates packets, NDIS would more + * likely call us at our ReceivePacket handler. However we + * might be called here in certain situations even though + * the miniport below has indicated a receive packet, e.g. + * if the miniport had set packet status to NDIS_STATUS_RESOURCES. + * + * @param ProtocolBindingContext + * @param MacReceiveContext + * @param pHeaderBuffer + * @param cbHeaderBuffer + * @param pLookAheadBuffer + * @param cbLookAheadBuffer + * @param cbPacket + * @return NDIS_STATUS_SUCCESS if we processed the receive successfully, + * NDIS_STATUS_XXX error code if we discarded it. */ +static NDIS_STATUS +vboxNetFltWinPtReceive( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_HANDLE MacReceiveContext, + IN PVOID pHeaderBuffer, + IN UINT cbHeaderBuffer, + IN PVOID pLookAheadBuffer, + IN UINT cbLookAheadBuffer, + IN UINT cbPacket + ) +{ + PADAPT pAdapt = (PADAPT)ProtocolBindingContext; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + PVBOXNETFLTINS pNetFltIf; +#ifdef VBOX_NETFLT_ONDEMAND_BIND +#if 0 + uint32_t fFlags; +#endif + + pNetFltIf = vboxNetFltWinReferenceAdaptNetFltFromAdapt(pAdapt); + if(pNetFltIf) + { + do + { +#if 0 + pPacket = NdisGetReceivedPacket(pAdapt->hBindingHandle, MacReceiveContext); + if(pPacket) + { +# ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// if(vboxNetFltWinIsLoopedBackPacket(pAdapt, pPacket)) +# else + if(vboxNetFltWinIsLoopedBackPacket(pPacket) || cbHeaderBuffer != ETH_HEADER_SIZE) +# endif + + { +// Assert(0); + /* nothing else to do here, just return the packet */ +// NdisReturnPackets(&pPacket, 1); +// break; + } + + fFlags = MACS_EQUAL(((PRTNETETHERHDR)pHeaderBuffer)->SrcMac, pNetFltIf->u.s.Mac) ? + PACKET_COPY | PACKET_SRC_HOST : PACKET_COPY; + Status = vboxNetFltWinQuEnqueuePacket(pNetFltIf, pPacket, fFlags); + if(Status == NDIS_STATUS_SUCCESS) + { + NdisReturnPackets(&pPacket, 1); + pAdapt = NULL; + pNetFltIf = NULL; + break; + } + } +#endif + Status = vboxNetFltWinPtReceiveActive(pAdapt, MacReceiveContext, pHeaderBuffer, cbHeaderBuffer, + pLookAheadBuffer, cbLookAheadBuffer, cbPacket); + if(NT_SUCCESS(Status)) + { + if(Status != NDIS_STATUS_NOT_ACCEPTED) + { + pAdapt = NULL; + pNetFltIf = NULL; + } + else + { + /* this is a looopback packet, nothing to do here */ + } + break; + } + } while(0); + + if(pNetFltIf) + vboxNetFltWinDereferenceNetFlt(pNetFltIf); + if(pAdapt) + vboxNetFltWinDereferenceAdapt(pAdapt); + + +#if 0 + if(pPacket) + { + NdisReturnPackets(&pPacket, 1); + } +#endif + /* we are here because the vboxNetFltWinPtReceiveActive returned pending, + * which means our ProtocolDataTransferComplete we will called, + * so return SUCCESS instead of NOT_ACCEPTED ?? */ +// return NDIS_STATUS_SUCCESS; + } + return NDIS_STATUS_NOT_ACCEPTED; +#else /* if NOT defined VBOX_NETFLT_ONDEMAND_BIND */ + PNDIS_PACKET pPacket = NULL; + bool fAdaptActive = vboxNetFltWinReferenceAdaptNetFltFromAdapt(pAdapt, &pNetFltIf); + if(fAdaptActive) + { + do + { +#ifndef DEBUG_NETFLT_RECV_NOPACKET + /* + * Get at the packet, if any, indicated up by the miniport below. + */ + pPacket = NdisGetReceivedPacket(pAdapt->hBindingHandle, MacReceiveContext); + if (pPacket != NULL) + { + do + { +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// if(vboxNetFltWinIsLoopedBackPacket(pAdapt, pPacket, true)) +#else + if(vboxNetFltWinIsLoopedBackPacket(pPacket)) +#endif + + { + Assert(0); + /* nothing else to do here, just return the packet */ + //NdisReturnPackets(&pPacket, 1); + Status = NDIS_STATUS_NOT_ACCEPTED; + break; + } + + if(pNetFltIf) + { + Status = vboxNetFltWinQuEnqueuePacket(pNetFltIf, pPacket, PACKET_COPY); + if(Status == NDIS_STATUS_SUCCESS) + { + //NdisReturnPackets(&pPacket, 1); + fAdaptActive = false; + pNetFltIf = NULL; + break; + } + } + + Status = vboxNetFltWinRecvPassThru(pAdapt, pPacket); + /* we are done with packet processing, and we will + * not receive packet return event for this packet, + * fAdaptActive should be true to ensure we release adapt*/ + Assert(fAdaptActive); + } while(FALSE); + + if(Status == NDIS_STATUS_SUCCESS || Status == NDIS_STATUS_NOT_ACCEPTED) + { + break; + } + } +#endif /* todo: remove */ + if(pNetFltIf) + { + Status = vboxNetFltWinPtReceiveActive(pAdapt, MacReceiveContext, pHeaderBuffer, cbHeaderBuffer, + pLookAheadBuffer, cbLookAheadBuffer, cbPacket); + if(NT_SUCCESS(Status)) + { + if(Status != NDIS_STATUS_NOT_ACCEPTED) + { + fAdaptActive = false; + pNetFltIf = NULL; + } + else + { + /* this is a loopback packet, nothing to do here */ + } + break; + } + } + + /* Fall through if the miniport below us has either not + * indicated a packet or we could not allocate one */ + if(pPacket != NULL) + { + /* + * We are here because we failed to allocate packet + */ + vboxNetFltWinPtFlushReceiveQueue(pAdapt, false); + } + + /* we are done with packet processing, and we will + * not receive packet return event for this packet, + * fAdaptActive should be true to ensure we release adapt*/ + Assert(fAdaptActive); + + pAdapt->bIndicateRcvComplete = TRUE; + switch (pAdapt->Medium) + { + case NdisMedium802_3: + case NdisMediumWan: + NdisMEthIndicateReceive(pAdapt->hMiniportHandle, + MacReceiveContext, + (PCHAR)pHeaderBuffer, + cbHeaderBuffer, + pLookAheadBuffer, + cbLookAheadBuffer, + cbPacket); + break; + default: + Assert(FALSE); + break; + } + } while(0); + + if(pNetFltIf) + vboxNetFltWinDereferenceNetFlt(pNetFltIf); + if(fAdaptActive) + vboxNetFltWinDereferenceAdapt(pAdapt); + } + else + { + Status = NDIS_STATUS_FAILURE; + } + + return Status; +#endif +} + +/** + * Called by the adapter below us when it is done indicating a batch of + * received packets. + * + * @param ProtocolBindingContext Pointer to our adapter structure. + * @return None */ +static VOID +vboxNetFltWinPtReceiveComplete( + IN NDIS_HANDLE ProtocolBindingContext + ) +{ +#ifndef VBOX_NETFLT_ONDEMAND_BIND + PADAPT pAdapt =(PADAPT)ProtocolBindingContext; + ULONG NumberOfPackets = 0; + + vboxNetFltWinPtFlushReceiveQueue(pAdapt, false); + + if ((pAdapt->hMiniportHandle != NULL) + /* && (pAdapt->MPDeviceState == NdisDeviceStateD0) */ + && (pAdapt->bIndicateRcvComplete == TRUE)) + { + switch (pAdapt->Medium) + { + case NdisMedium802_3: + case NdisMediumWan: + NdisMEthIndicateReceiveComplete(pAdapt->hMiniportHandle); + break; + default: + Assert(FALSE); + break; + } + } + + pAdapt->bIndicateRcvComplete = FALSE; +#endif +} + +/** + * ReceivePacket handler. Called by NDIS if the miniport below supports + * NDIS 4.0 style receives. Re-package the buffer chain in a new packet + * and indicate the new packet to protocols above us. Any context for + * packets indicated up must be kept in the MiniportReserved field. + * + * @param ProtocolBindingContext - Pointer to our adapter structure. + * @param Packet - Pointer to the packet + * @return == 0 -> We are done with the packet, + * != 0 -> We will keep the packet and call NdisReturnPackets() this many times when done. + */ +static INT +vboxNetFltWinPtReceivePacket( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNDIS_PACKET pPacket + ) +{ + PADAPT pAdapt =(PADAPT)ProtocolBindingContext; + INT cRefCount = 0; + PVBOXNETFLTINS pNetFltIf; +#ifdef VBOX_NETFLT_ONDEMAND_BIND + PNDIS_BUFFER pBuffer; + PVOID pVA; + UINT cbLength; + uint32_t fFlags; + + pNetFltIf = vboxNetFltWinReferenceAdaptNetFltFromAdapt(pAdapt); + + if(pNetFltIf) + { + NDIS_STATUS Status; + bool bResources; + do + { +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// if(vboxNetFltWinIsLoopedBackPacket(pAdapt, pPacket)) +#else + if(vboxNetFltWinIsLoopedBackPacket(pPacket)) +#endif + + { + Assert(0); + NdisReturnPackets(&pPacket, 1); + break; + } + bResources = NDIS_GET_PACKET_STATUS(pPacket) == NDIS_STATUS_RESOURCES; + + NdisQueryPacket(pPacket, NULL, NULL, &pBuffer, NULL); + if(!pBuffer) + { + Assert(0); + NdisReturnPackets(&pPacket, 1); + cRefCount = 0; + break; + } + + NdisQueryBufferSafe(pBuffer, &pVA, &cbLength, NormalPagePriority); + if(!pVA || !cbLength) + { + Assert(0); + NdisReturnPackets(&pPacket, 1); + cRefCount = 0; + break; + } + + fFlags = MACS_EQUAL(((PRTNETETHERHDR)pVA)->SrcMac, pNetFltIf->u.s.Mac) ? PACKET_SRC_HOST : 0; + + Status = vboxNetFltWinQuEnqueuePacket(pNetFltIf, pPacket, bResources ? fFlags | PACKET_COPY : fFlags); + if(Status == NDIS_STATUS_SUCCESS) + { + if(bResources) + { + cRefCount = 0; + NdisReturnPackets(&pPacket, 1); + } + else + { + cRefCount = 1; + } + pNetFltIf = NULL; + pAdapt = NULL; + break; + } + else + { + Assert(0); + NdisReturnPackets(&pPacket, 1); + cRefCount = 0; + break; + } + } while (0); + + if(pNetFltIf) + vboxNetFltWinDereferenceNetFlt(pNetFltIf); + if(pAdapt) + vboxNetFltWinDereferenceAdapt(pAdapt); + return cRefCount; + } + /* we are here because we are inactive, simply return the packet */ + NdisReturnPackets(&pPacket, 1); + return 0; +#else + bool fAdaptActive = vboxNetFltWinReferenceAdaptNetFltFromAdapt(pAdapt, &pNetFltIf); + if(fAdaptActive) + { + do + { +#ifdef DEBUG_NETFLT_LOOPBACK +# error "implement (see comments in the sources below this #error:)" + /* @todo FIXME no need for the PPACKET_INFO mechanism here; + instead the the NDIS_PACKET.ProtocolReserved + INTERLOCKED_SINGLE_LIST mechanism \ + similar to that used in TrasferData handling should be used; + */ + +// if(vboxNetFltWinIsLoopedBackPacket(pAdapt, pPacket, true)) +#else + if(vboxNetFltWinIsLoopedBackPacket(pPacket)) +#endif + + { + Assert(0); + Log(("lb_rp")); + + /* nothing else to do here, just return the packet */ + cRefCount = 0; + //NdisReturnPackets(&pPacket, 1); + break; + } + + if(pNetFltIf) + { + bool bResources = NDIS_GET_PACKET_STATUS(pPacket) == NDIS_STATUS_RESOURCES; + NDIS_STATUS fStatus; + + /*TODO: remove this assert. + * this is a temporary assert for debugging purposes: + * we're probably doing something wrong with the packets if the miniport reports NDIS_STATUS_RESOURCES */ + Assert(!bResources); + + fStatus = vboxNetFltWinQuEnqueuePacket(pNetFltIf, pPacket, bResources ? PACKET_COPY : 0); + if(fStatus == NDIS_STATUS_SUCCESS) + { + pNetFltIf = NULL; + fAdaptActive = false; + if(bResources) + { + cRefCount = 0; + //NdisReturnPackets(&pPacket, 1); + } + else + { + cRefCount = 1; + } + break; + } + else + { + Assert(0); + } + } + + cRefCount = vboxNetFltWinRecvPacketPassThru(pAdapt, pPacket); + if(cRefCount) + { + Assert(cRefCount == 1); + fAdaptActive = false; + } + + } while(FALSE); + + if(pNetFltIf) + vboxNetFltWinDereferenceNetFlt(pNetFltIf); + if(fAdaptActive) + vboxNetFltWinDereferenceAdapt(pAdapt); + } + else + { + cRefCount = 0; + //NdisReturnPackets(&pPacket, 1); + } + + return cRefCount; +#endif +} + +/** + * This routine is called from NDIS to notify our protocol edge of a + * reconfiguration of parameters for either a specific binding (pAdapt + * is not NULL), or global parameters if any (pAdapt is NULL). + * + * @param pAdapt - Pointer to our adapter structure. + * @param pNetPnPEvent - the reconfigure event + * @return NDIS_STATUS_SUCCESS */ +static NDIS_STATUS +vboxNetFltWinPtPnPNetEventReconfigure( + IN PADAPT pAdapt, + IN PNET_PNP_EVENT pNetPnPEvent + ) +{ + NDIS_STATUS ReconfigStatus = NDIS_STATUS_SUCCESS; + NDIS_STATUS ReturnStatus = NDIS_STATUS_SUCCESS; + + do + { + /* + * Is this is a global reconfiguration notification ? + */ + if (pAdapt == NULL) + { + /* + * An important event that causes this notification to us is if + * one of our upper-edge miniport instances was enabled after being + * disabled earlier, e.g. from Device Manager in Win2000. Note that + * NDIS calls this because we had set up an association between our + * miniport and protocol entities by calling NdisIMAssociateMiniport. + * + * Since we would have torn down the lower binding for that miniport, + * we need NDIS' assistance to re-bind to the lower miniport. The + * call to NdisReEnumerateProtocolBindings does exactly that. + */ + NdisReEnumerateProtocolBindings (g_hProtHandle); + break; + } + + ReconfigStatus = NDIS_STATUS_SUCCESS; + + } while(FALSE); + + LogFlow(("<==PtPNPNetEventReconfigure: pAdapt %p\n", pAdapt)); + + return ReconfigStatus; +} + +static NDIS_STATUS +vboxNetFltWinPtPnPNetEventBindsComplete( + IN PADAPT pAdapt, + IN PNET_PNP_EVENT pNetPnPEvent + ) +{ + return NDIS_STATUS_SUCCESS; +} + +DECLHIDDEN(bool) vboxNetFltWinPtCloseAdapter(PADAPT pAdapt, PNDIS_STATUS pStatus) +{ + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + + if(pAdapt->bClosingAdapter) + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + Assert(0); + return false; + } + if (pAdapt->hBindingHandle == NULL) + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + Assert(0); + return false; + } + + pAdapt->bClosingAdapter = true; + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + + /* + * Close the binding below. and wait for it to complete + */ + NdisResetEvent(&pAdapt->hEvent); + + NdisCloseAdapter(pStatus, pAdapt->hBindingHandle); + + if (*pStatus == NDIS_STATUS_PENDING) + { + NdisWaitEvent(&pAdapt->hEvent, 0); + *pStatus = pAdapt->Status; + } + + Assert (*pStatus == NDIS_STATUS_SUCCESS); + + pAdapt->hBindingHandle = NULL; + + return true; +} + +/** + * This is a notification to our protocol edge of the power state + * of the lower miniport. If it is going to a low-power state, we must + * wait here for all outstanding sends and requests to complete. + * + * @param pAdapt - Pointer to the adpater structure + * @param pNetPnPEvent - The Net Pnp Event. this contains the new device state + * @return NDIS_STATUS_SUCCESS or the status returned by upper-layer protocols. + * */ +static NDIS_STATUS +vboxNetFltWinPtPnPNetEventSetPower( + IN PADAPT pAdapt, + IN PNET_PNP_EVENT pNetPnPEvent + ) +{ + PNDIS_DEVICE_POWER_STATE pDeviceState =(PNDIS_DEVICE_POWER_STATE)(pNetPnPEvent->Buffer); + NDIS_DEVICE_POWER_STATE PrevDeviceState = vboxNetFltWinGetPowerState(&pAdapt->PTState); + NDIS_STATUS ReturnStatus; + PVBOXNETFLTINS pNetFlt = PADAPT_2_PVBOXNETFLTINS(pAdapt); + RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; + + ReturnStatus = NDIS_STATUS_SUCCESS; + + /* + * Set the Internal Device State, this blocks all new sends or receives + */ + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + + vboxNetFltWinSetPowerState(&pAdapt->PTState, *pDeviceState); + + /* + * Check if the miniport below is going to a low power state. + */ + if (vboxNetFltWinGetPowerState(&pAdapt->PTState) > NdisDeviceStateD0) + { + /* + * If the miniport below is going to standby, fail all incoming requests + */ + if (PrevDeviceState == NdisDeviceStateD0) + { + pAdapt->bStandingBy = TRUE; + } + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); +#ifndef VBOX_NETFLT_ONDEMAND_BIND + + vboxNetFltWinPtFlushReceiveQueue(pAdapt, false); + + vboxNetFltWinWaitDereference(&pAdapt->MPState); +#endif + + /* + * Wait for outstanding sends and requests to complete. + */ + vboxNetFltWinWaitDereference(&pAdapt->PTState); + +#ifndef VBOX_NETFLT_ONDEMAND_BIND + while (ASMAtomicUoReadBool((volatile bool *)&pAdapt->bOutstandingRequests)) + { + /* + * sleep till outstanding requests complete + */ + vboxNetFltWinSleep(2); + } + + /* + * If the below miniport is going to low power state, complete the queued request + */ + RTSpinlockAcquire(pNetFlt->hSpinlock, &Tmp); + if (pAdapt->bQueuedRequest) + { + pAdapt->bQueuedRequest = FALSE; + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + vboxNetFltWinPtRequestComplete(pAdapt, &pAdapt->Request, NDIS_STATUS_FAILURE); + } + else + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + } +#endif + + Assert(NdisPacketPoolUsage(pAdapt->hSendPacketPoolHandle) == 0); +#ifndef VBOX_NETFLT_ONDEMAND_BIND + Assert(NdisPacketPoolUsage(pAdapt->hRecvPacketPoolHandle) == 0); + Assert(pAdapt->bOutstandingRequests == FALSE); +#endif + } + else + { + /* + * If the physical miniport is powering up (from Low power state to D0), + * clear the flag + */ + if (PrevDeviceState > NdisDeviceStateD0) + { + pAdapt->bStandingBy = FALSE; + } + +#ifdef VBOX_NETFLT_ONDEMAND_BIND + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); +#else + /* + * The device below is being turned on. If we had a request + * pending, send it down now. + */ + if (pAdapt->bQueuedRequest == TRUE) + { + NDIS_STATUS Status; + + pAdapt->bQueuedRequest = FALSE; + + pAdapt->bOutstandingRequests = TRUE; + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + + NdisRequest(&Status, + pAdapt->hBindingHandle, + &pAdapt->Request); + + if (Status != NDIS_STATUS_PENDING) + { + vboxNetFltWinPtRequestComplete(pAdapt, + &pAdapt->Request, + Status); + + } + } + else + { + RTSpinlockRelease(pNetFlt->hSpinlock, &Tmp); + } + +#endif /* #ifndef VBOX_NETFLT_ONDEMAND_BIND */ + + } + + return ReturnStatus; +} + +/** + * This is called by NDIS to notify us of a PNP event related to a lower + * binding. Based on the event, this dispatches to other helper routines. + * + * @param ProtocolBindingContext - Pointer to our adapter structure. Can be NULL + * for "global" notifications + * @param pNetPnPEvent - Pointer to the PNP event to be processed. + * @return NDIS_STATUS code indicating status of event processing. + * */ +static NDIS_STATUS +vboxNetFltWinPtPnPHandler( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNET_PNP_EVENT pNetPnPEvent + ) +{ + PADAPT pAdapt =(PADAPT)ProtocolBindingContext; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + + LogFlow(("vboxNetFltWinPtPnPHandler: Adapt %p, Event %d\n", pAdapt, pNetPnPEvent->NetEvent)); + + switch (pNetPnPEvent->NetEvent) + { + case NetEventSetPower: + Status = vboxNetFltWinPtPnPNetEventSetPower(pAdapt, pNetPnPEvent); + break; + + case NetEventReconfigure: + DBGPRINT(("NetEventReconfigure, pAdapt(%p)", pAdapt)); + Status = vboxNetFltWinPtPnPNetEventReconfigure(pAdapt, pNetPnPEvent); + break; + case NetEventBindsComplete: + DBGPRINT(("NetEventBindsComplete")); + Status = vboxNetFltWinPtPnPNetEventBindsComplete(pAdapt, pNetPnPEvent); + break; + default: + Status = NDIS_STATUS_SUCCESS; + break; + } + + return Status; +} +#ifdef __cplusplus +# define PTCHARS_40(_p) ((_p).Ndis40Chars) +#else +# define PTCHARS_40(_p) (_p) +#endif + +/** + * register the protocol edge + */ +DECLHIDDEN(NDIS_STATUS) +vboxNetFltWinPtRegister( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath + ) +{ + NDIS_STATUS Status; + NDIS_PROTOCOL_CHARACTERISTICS PChars; + NDIS_STRING Name; + + /* + * Now register the protocol. + */ + NdisZeroMemory(&PChars, sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); + PTCHARS_40(PChars).MajorNdisVersion = VBOXNETFLT_PROT_MAJOR_NDIS_VERSION; + PTCHARS_40(PChars).MinorNdisVersion = VBOXNETFLT_PROT_MINOR_NDIS_VERSION; + + /* + * Make sure the protocol-name matches the service-name + * (from the INF) under which this protocol is installed. + * This is needed to ensure that NDIS can correctly determine + * the binding and call us to bind to miniports below. + */ + NdisInitUnicodeString(&Name, VBOXNETFLT_PROTOCOL_NAME); /* Protocol name */ + PTCHARS_40(PChars).Name = Name; + PTCHARS_40(PChars).OpenAdapterCompleteHandler = vboxNetFltWinPtOpenAdapterComplete; + PTCHARS_40(PChars).CloseAdapterCompleteHandler = vboxNetFltWinPtCloseAdapterComplete; + PTCHARS_40(PChars).SendCompleteHandler = vboxNetFltWinPtSendComplete; + PTCHARS_40(PChars).TransferDataCompleteHandler = vboxNetFltWinPtTransferDataComplete; + + PTCHARS_40(PChars).ResetCompleteHandler = vboxNetFltWinPtResetComplete; + PTCHARS_40(PChars).RequestCompleteHandler = vboxNetFltWinPtRequestComplete; + PTCHARS_40(PChars).ReceiveHandler = vboxNetFltWinPtReceive; + PTCHARS_40(PChars).ReceiveCompleteHandler = vboxNetFltWinPtReceiveComplete; + PTCHARS_40(PChars).StatusHandler = vboxNetFltWinPtStatus; + PTCHARS_40(PChars).StatusCompleteHandler = vboxNetFltWinPtStatusComplete; + PTCHARS_40(PChars).BindAdapterHandler = vboxNetFltWinPtBindAdapter; + PTCHARS_40(PChars).UnbindAdapterHandler = vboxNetFltWinPtUnbindAdapter; + PTCHARS_40(PChars).UnloadHandler = vboxNetFltWinPtUnloadProtocol; +#if !defined(VBOX_NETFLT_ONDEMAND_BIND) && !defined(DEBUG_NETFLT_RECV) + PTCHARS_40(PChars).ReceivePacketHandler = vboxNetFltWinPtReceivePacket; +#else + PTCHARS_40(PChars).ReceivePacketHandler = NULL; +#endif + PTCHARS_40(PChars).PnPEventHandler= vboxNetFltWinPtPnPHandler; + + NdisRegisterProtocol(&Status, + &g_hProtHandle, + &PChars, + sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); + + return Status; +} + +/** + * deregister the protocol edge + */ +DECLHIDDEN(NDIS_STATUS) +vboxNetFltWinPtDeregister() +{ + NDIS_STATUS Status; + + if (g_hProtHandle != NULL) + { + NdisDeregisterProtocol(&Status, g_hProtHandle); + g_hProtHandle = NULL; + } + + return Status; +} + +#ifndef VBOX_NETFLT_ONDEMAND_BIND +/** + * returns the protocol handle + */ +DECLHIDDEN(NDIS_HANDLE) vboxNetFltWinPtGetHandle() +{ + return g_hProtHandle; +} +#endif diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltPt-win.h b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltPt-win.h new file mode 100644 index 000000000..7958f683b --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFltPt-win.h @@ -0,0 +1,46 @@ +/* $Id: VBoxNetFltPt-win.h $ */ +/** @file + * VBoxNetFlt - Network Filter Driver (Host), Windows Specific Code. Protocol edge of ndis filter driver + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. + * Copyright (c) 1993-1999, Microsoft Corporation + */ + +#ifndef ___VBoxNetFltPt_win_h___ +#define ___VBoxNetFltPt_win_h___ + +#ifdef VBOXNETADP +# error "No protocol edge" +#endif +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtRegister(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtDeregister(); +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtDoUnbinding(PADAPT pAdapt, bool bOnUnbind); +DECLHIDDEN(VOID) vboxNetFltWinPtFlushReceiveQueue(IN PADAPT pAdapt, IN bool bReturn); +DECLHIDDEN(VOID) vboxNetFltWinPtRequestComplete(IN NDIS_HANDLE ProtocolBindingContext, IN PNDIS_REQUEST NdisRequest, IN NDIS_STATUS Status); +DECLHIDDEN(bool) vboxNetFltWinPtCloseAdapter(PADAPT pAdapt, PNDIS_STATUS pStatus); + +#ifdef VBOX_NETFLT_ONDEMAND_BIND +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtDoBinding(IN PADAPT pAdapt); +#else +DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtDoBinding(IN PADAPT pAdapt, IN PNDIS_STRING pOurDeviceName, IN PNDIS_STRING pBindToDeviceName); +DECLHIDDEN(NDIS_HANDLE) vboxNetFltWinPtGetHandle(); +#endif + +#endif diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt_m.inf b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt_m.inf new file mode 100644 index 000000000..9e06cba75 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt_m.inf @@ -0,0 +1,94 @@ +; +; VirtualBox Bridged Networking Driver +; + +; +; Copyright (C) 2008 Sun Microsystems, Inc. +; +; 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. +; +; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa +; Clara, CA 95054 USA or visit http://www.sun.com if you need +; additional information or have any questions. +; + +; +; Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. +; Copyright (c) 1993-1999, Microsoft Corporation +; + +[Version] +signature = "$Windows NT$" +;cat CatalogFile = VBoxNetFlt.cat +Class = Net +ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} +Provider = %Provider% +;DriverPackageType=NdisImMiniport +;DriverPackageDisplayName=%VBoxNetFltMP_Desc% +;edit-DriverVer=08/13/2008,1.1.0.1 + +[ControlFlags] +ExcludeFromSelect = sun_VBoxNetFltmp + +[DestinationDirs] +DefaultDestDir=12 +; No files to copy + +[Manufacturer] +%Provider% = VBox,NTx86,NTia64,NTamd64 + +; For Win2K +[VBox] +%VBoxNetFltMP_Desc% = VBoxNetFltMP.ndi, sun_VBoxNetFltmp + +; For XP and later +[VBox.NTx86] +%VBoxNetFltMP_Desc% = VBoxNetFltMP.ndi, sun_VBoxNetFltmp + +[VBox.NTia64] +%VBoxNetFltMP_Desc% = VBoxNetFltMP.ndi, sun_VBoxNetFltmp + +[VBox.NTamd64] +%VBoxNetFltMP_Desc% = VBoxNetFltMP.ndi, sun_VBoxNetFltmp + +[VBoxNetFltMP.ndi] +Characteristics = 0x29 ;NCF_NOT_USER_REMOVABLE | NCF_VIRTUAL | NCF_HIDDEN +CopyFiles = + +[VBoxNetFltMP.ndi.Services] +AddService = VBoxNetFlt,0x2, VBoxNetFltMP.AddService + + +[VBoxNetFltMP.AddService] +ServiceType = 1 ;SERVICE_KERNEL_DRIVER +StartType = 3 ;SERVICE_DEMAND_START +ErrorControl = 1 ;SERVICE_ERROR_NORMAL +ServiceBinary = %12%\VBoxNetFlt.sys + + +[VBoxNetFltMP.AddService.AddReg] +; ---------------------------------------------------------------------- +; Add any miniport-specific parameters here. These are params that your +; filter device is going to use. +; +;HKR, Parameters, ParameterName, 0x10000, "MultiSz", "Parameter", "Value" +;HKR, Parameters, ParameterName2, 0x10001, 4 + +[Strings] +Provider = "Sun Microsystems, Inc." +VBoxNetFltMP_Desc = "VirtualBox Bridged Networking Driver Miniport" + +[SourceDisksNames] +;None + +[SourceDisksFiles] +;None + + + diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/WinNetConfig.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/WinNetConfig.cpp new file mode 100644 index 000000000..25d3f379a --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/WinNetConfig.cpp @@ -0,0 +1,3994 @@ +/* $Id: WinNetConfig.cpp $ */ +/** @file + * VBoxNetCfgWin - Briefly describe this file, optionally with a longer description in a separate paragraph. + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Ndis Intermediate Miniport passthru driver sample. + *+--------------------------------------------------------------------------- + * + * Microsoft Windows + * Copyright (C) Microsoft Corporation, 2001. + * + * Author: Alok Sinha 15-May-01 + * + *---------------------------------------------------------------------------- + */ +#include "VBox/WinNetConfig.h" + +#define _WIN32_DCOM + + +#include <iphlpapi.h> + +#include <devguid.h> +#include <stdio.h> +#include <regstr.h> +//#define INITGUID +//#include <guiddef.h> +//#include <devguid.h> +//#include <objbase.h> +//#include <setupapi.h> +#include <shlobj.h> +#include <cfgmgr32.h> +#include <tchar.h> +//#include <VBox/com/Guid.h> +//#include <VBox/com/String.h> +//#include <wtypes.h> +#include <objbase.h> + +#include <crtdbg.h> +#include <stdlib.h> + +#include <Wbemidl.h> +#include <comdef.h> + +//#include <Winsock2.h> + +//using namespace com; + +#ifndef Assert +//# ifdef DEBUG +//# define Assert(_expr) assert(_expr) +//# else +//# define Assert(_expr) do{ }while(0) +//# endif +# define Assert _ASSERT +# define AssertMsg(expr, msg) do{}while(0) +#endif +static LOG_ROUTINE g_Logger = NULL; + +static VOID DoLogging(LPCWSTR szString, ...); +#define Log DoLogging + +#define DbgLog + +#define VBOX_NETCFG_LOCK_TIME_OUT 5000 + +typedef bool (*ENUMERATION_CALLBACK) (LPWSTR pFileName, PVOID pContext); + +static HRESULT vboxNetCfgWinCollectInfs(LPCWSTR pPnPId) +{ + DWORD winEr = ERROR_SUCCESS; + HDEVINFO hDevInfo = SetupDiCreateDeviceInfoList( + &GUID_DEVCLASS_NETSERVICE, /* IN LPGUID ClassGuid, OPTIONAL */ + NULL /*IN HWND hwndParent OPTIONAL */ + ); + if(hDevInfo != INVALID_HANDLE_VALUE) + { + if(SetupDiBuildDriverInfoList(hDevInfo, + NULL, /*IN OUT PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL*/ + SPDIT_CLASSDRIVER /*IN DWORD DriverType*/ + )) + { + SP_DRVINFO_DATA DrvInfo; + DrvInfo.cbSize = sizeof(SP_DRVINFO_DATA); + char DetailBuf[16384]; + PSP_DRVINFO_DETAIL_DATA pDrvDetail = (PSP_DRVINFO_DETAIL_DATA)DetailBuf; + + for(DWORD i = 0;;i++) + { + if(SetupDiEnumDriverInfo(hDevInfo, + NULL, /* IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL*/ + SPDIT_CLASSDRIVER , /*IN DWORD DriverType,*/ + i, /*IN DWORD MemberIndex,*/ + &DrvInfo /*OUT PSP_DRVINFO_DATA DriverInfoData*/ + )) + { + DWORD dwReq; + pDrvDetail->cbSize = sizeof(SP_DRVINFO_DETAIL_DATA); + if(SetupDiGetDriverInfoDetail( + hDevInfo, /*IN HDEVINFO DeviceInfoSet,*/ + NULL, /*IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL*/ + &DrvInfo, /*IN PSP_DRVINFO_DATA DriverInfoData,*/ + pDrvDetail, /*OUT PSP_DRVINFO_DETAIL_DATA DriverInfoDetailData, OPTIONAL*/ + sizeof(DetailBuf), /*IN DWORD DriverInfoDetailDataSize,*/ + &dwReq /*OUT PDWORD RequiredSize OPTIONAL*/ + )) + { + for(WCHAR * pHwId = pDrvDetail->HardwareID; pHwId && *pHwId && pHwId < (TCHAR*)(DetailBuf + sizeof(DetailBuf)/sizeof(DetailBuf[0])) ;pHwId += _tcslen(pHwId) + 1) + { + //TODO: + } + } + else + { + DWORD winEr = GetLastError(); + Log(L"Err SetupDiGetDriverInfoDetail (%d), req = %d", winEr, dwReq); +// Assert(0); + } + + } + else + { + DWORD winEr = GetLastError(); + if(winEr == ERROR_NO_MORE_ITEMS) + { + break; + } + + Assert(0); + } + } + + SetupDiDestroyDriverInfoList(hDevInfo, + NULL, /*IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL*/ + SPDIT_CLASSDRIVER/*IN DWORD DriverType*/ + ); + } + else + { + winEr = GetLastError(); + Assert(0); + } + + SetupDiDestroyDeviceInfoList(hDevInfo); + } + else + { + winEr = GetLastError(); + Assert(0); + } + + return HRESULT_FROM_WIN32(winEr); +} + +// +// Function: GetKeyValue +// +// Purpose: Retrieve the value of a key from the inf file. +// +// Arguments: +// hInf [in] Inf file handle. +// lpszSection [in] Section name. +// lpszKey [in] Key name. +// dwIndex [in] Key index. +// lppszValue [out] Key value. +// +// Returns: S_OK on success, otherwise and error code. +// +// Notes: +// + +static HRESULT vboxNetCfgWinGetKeyValue (HINF hInf, + LPCWSTR lpszSection, + LPCWSTR lpszKey, + DWORD dwIndex, + LPWSTR *lppszValue) +{ + INFCONTEXT infCtx; + DWORD dwSizeNeeded; + HRESULT hr; + + *lppszValue = NULL; + + if ( SetupFindFirstLineW(hInf, + lpszSection, + lpszKey, + &infCtx) == FALSE ) + { + DWORD winEr = GetLastError(); + DbgLog(L"vboxNetCfgWinGetKeyValue: SetupFindFirstLineW failed, winEr = (%d)\n", winEr); + //Assert(0); + return HRESULT_FROM_WIN32(winEr); + } + + SetupGetStringFieldW( &infCtx, + dwIndex, + NULL, + 0, + &dwSizeNeeded ); + + *lppszValue = (LPWSTR)CoTaskMemAlloc( sizeof(WCHAR) * dwSizeNeeded ); + + if ( !*lppszValue ) + { + Log(L"vboxNetCfgWinGetKeyValue: CoTaskMemAlloc failed\n"); + Assert(0); + return HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); + } + + if ( SetupGetStringFieldW(&infCtx, + dwIndex, + *lppszValue, + dwSizeNeeded, + NULL) == FALSE ) + { + DWORD winEr = GetLastError(); + DbgLog(L"vboxNetCfgWinGetKeyValue: SetupGetStringFieldW failed, winEr = (%d)\n", winEr); + hr = HRESULT_FROM_WIN32(winEr); + //Assert(0); + CoTaskMemFree( *lppszValue ); + *lppszValue = NULL; + } + else + { + hr = S_OK; + } + + return hr; +} + +// +// Function: GetPnpID +// +// Purpose: Retrieve PnpID from an inf file. +// +// Arguments: +// lpszInfFile [in] Inf file to search. +// lppszPnpID [out] PnpID found. +// +// Returns: TRUE on success. +// +// Notes: +// + +static HRESULT vboxNetCfgWinGetPnpID (LPCWSTR lpszInfFile, + LPWSTR *lppszPnpID) +{ + HINF hInf; + LPWSTR lpszModelSection; + HRESULT hr; + + *lppszPnpID = NULL; + + hInf = SetupOpenInfFileW( lpszInfFile, + NULL, + INF_STYLE_WIN4, + NULL ); + + if ( hInf == INVALID_HANDLE_VALUE ) + { + DWORD winEr = GetLastError(); + DbgLog(L"vboxNetCfgWinGetPnpID: SetupOpenInfFileW failed, winEr = (%d), for file (%s)\n", winEr, lpszInfFile); + //Assert(0); + return HRESULT_FROM_WIN32(winEr); + } + + // + // Read the Model section name from Manufacturer section. + // + + hr = vboxNetCfgWinGetKeyValue( hInf, + L"Manufacturer", + NULL, + 1, + &lpszModelSection ); + //Assert(hr == S_OK); + if ( hr == S_OK ) + { + + // + // Read PnpID from the Model section. + // + + hr = vboxNetCfgWinGetKeyValue( hInf, + lpszModelSection, + NULL, + 2, + lppszPnpID ); + //Assert(hr == S_OK); + if ( hr != S_OK ) + { + DbgLog(L"vboxNetCfgWinGetPnpID: vboxNetCfgWinGetKeyValue lpszModelSection failed, hr = (0x%x), for file (%s)\n", hr, lpszInfFile); + } + + CoTaskMemFree( lpszModelSection ); + } + else + { + DbgLog(L"vboxNetCfgWinGetPnpID: vboxNetCfgWinGetKeyValue Manufacturer failed, hr = (0x%x), for file (%s)\n", hr, lpszInfFile); + } + + SetupCloseInfFile( hInf ); + + return hr; +} + +//VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinUninstallInfs (LPCWSTR pPnPId) +//{ +// std::list<std::wstring> InfList; +// HRESULT hr = vboxNetCfgWinCollectInfs(pPnPId, &InfList); +// if(hr == S_OK) +// { +// std::list <std::wstring>::iterator it; +// for (it = InfList.begin(); it != InfList.end(); ++it) +// { +// Log(L"inf : %s\n", (*it).c_str()); +// } +// } +// return hr; +//} + +static HRESULT vboxNetCfgWinEnumFiles(LPCWSTR pPattern, ENUMERATION_CALLBACK pCallback, PVOID pContext) +{ + WIN32_FIND_DATA Data; + memset(&Data, 0, sizeof(Data)); + HRESULT hr = S_OK; + + HANDLE hEnum = FindFirstFile(pPattern,&Data); + if(hEnum != INVALID_HANDLE_VALUE) + { + + do + { + if(!pCallback(Data.cFileName, pContext)) + { + break; + } + + /* next iteration */ + memset(&Data, 0, sizeof(Data)); + BOOL bNext = FindNextFile(hEnum,&Data); + if(!bNext) + { + int winEr = GetLastError(); + if(winEr != ERROR_NO_MORE_FILES) + { + Log(L"vboxNetCfgWinEnumFiles: FindNextFile err winEr (%d)\n", winEr); + Assert(0); + hr = HRESULT_FROM_WIN32(winEr); + } + break; + } + }while(true); + FindClose(hEnum); + } + else + { + int winEr = GetLastError(); + if(winEr != ERROR_NO_MORE_FILES) + { + Log(L"vboxNetCfgWinEnumFiles: FindFirstFile err winEr (%d)\n", winEr); + Assert(0); + hr = HRESULT_FROM_WIN32(winEr); + } + } + + return hr; +} + +typedef struct _INF_INFO +{ + LPCWSTR pPnPId; +}INF_INFO, *PINF_INFO; + +typedef struct _INFENUM_CONTEXT +{ + INF_INFO InfInfo; + DWORD Flags; + HRESULT hr; +} INFENUM_CONTEXT, *PINFENUM_CONTEXT; + +static bool vboxNetCfgWinInfEnumerationCallback(LPCWSTR pFileName, PINFENUM_CONTEXT pContext) +{ +// Log(L"vboxNetCfgWinInfEnumerationCallback: pFileName (%s)\n", pFileName); + + LPWSTR lpszPnpID; + HRESULT hr = vboxNetCfgWinGetPnpID (pFileName, + &lpszPnpID); +// Assert(hr == S_OK); + if(hr == S_OK) + { + if(!wcsicmp(pContext->InfInfo.pPnPId, lpszPnpID)) + { + if(!SetupUninstallOEMInfW(pFileName, + pContext->Flags, /*DWORD Flags could be SUOI_FORCEDELETE */ + NULL /*__in PVOID Reserved == NULL */ + )) + { + DWORD dwError = GetLastError(); + + Log(L"vboxNetCfgWinInfEnumerationCallback: SetupUninstallOEMInf failed for file (%s), r (%d)\n", pFileName, dwError); + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + } + CoTaskMemFree(lpszPnpID); + } + else + { + DbgLog(L"vboxNetCfgWinInfEnumerationCallback: vboxNetCfgWinGetPnpID failed, hr = (0x%x)\n", hr); + } + + return true; +} + + +static HRESULT VBoxNetCfgWinUninstallInfs(LPCWSTR pPnPId, DWORD Flags) +{ + WCHAR InfDirPath[MAX_PATH]; + HRESULT hr = SHGetFolderPathW(NULL, /* HWND hwndOwner*/ + CSIDL_WINDOWS, /* int nFolder*/ + NULL, /*HANDLE hToken*/ + SHGFP_TYPE_CURRENT, /*DWORD dwFlags*/ + InfDirPath); + Assert(hr == S_OK); + if(hr == S_OK) + { + wcscat(InfDirPath, L"\\inf\\oem*.inf"); + + INFENUM_CONTEXT Context; + Context.InfInfo.pPnPId = pPnPId; + Context.Flags = Flags; + Context.hr = S_OK; + hr = vboxNetCfgWinEnumFiles(InfDirPath, (ENUMERATION_CALLBACK)vboxNetCfgWinInfEnumerationCallback, (PVOID)&Context); + Assert(hr == S_OK); + if(hr == S_OK) + { + hr = Context.hr; + } + else + { + Log(L"VBoxNetCfgWinUninstallInfs: vboxNetCfgWinEnumFiles failed, hr = (0x%x)\n", hr); + } +// +// HANDLE hInfDir = CreateFileW(InfDirPath, +// FILE_READ_DATA, /* DWORD dwDesiredAccess*/ +// FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, /* DWORD dwShareMode */ +// NULL, /* LPSECURITY_ATTRIBUTES lpSecurityAttributes */ +// OPEN_EXISTING, /* DWORD dwCreationDisposition */ +// 0, /* DWORD dwFlagsAndAttributes */ +// NULL); +// if(hInfDir != INVALID_HANDLE_VALUE) +// { +// +// CloseHandle(hInfDir); +// } +// else +// { +// int winEr = GetLastError(); +// hr = HRESULT_FROM_WIN32(winEr); +// } + } + else + { + Log(L"VBoxNetCfgWinUninstallInfs: SHGetFolderPathW failed, hr = (0x%x)\n", hr); + } + + return hr; + +} + + + +/** + * Release reference + * + * @param punk Pointer to the interface to release reference to. + */ +VBOXNETCFGWIN_DECL(VOID) +VBoxNetCfgWinReleaseRef(IN IUnknown* punk) +{ + if(punk) + { + punk->Release(); + } + + return; +} + +/** + * Get a reference to INetCfg. + * + * @return HRESULT S_OK on success, otherwise an error code + * @param fGetWriteLock If TRUE, Write lock requested + * @param lpszAppName Application name requesting the reference. + * @param ppnc pointer the Reference to INetCfg to be stored to + * @param lpszLockedBy pointer the Application name who holds the write lock to be stored to, optional + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinQueryINetCfgEx(IN BOOL fGetWriteLock, + IN LPCWSTR lpszAppName, + IN DWORD cmsTimeout, + OUT INetCfg **ppnc, + OUT LPWSTR *lpszLockedBy) +{ + INetCfg *pnc = NULL; + INetCfgLock *pncLock = NULL; + HRESULT hr = S_OK; + + /* + * Initialize the output parameters. + */ + *ppnc = NULL; + + if ( lpszLockedBy ) + { + *lpszLockedBy = NULL; + } +// COM should be initialized before using the NetConfig API +// /* +// * Initialize COM +// */ +// hr = CoInitialize( NULL ); + + if ( hr == S_OK ) + { + + /* + * Create the object implementing INetCfg. + */ + hr = CoCreateInstance( CLSID_CNetCfg, + NULL, CLSCTX_INPROC_SERVER, + IID_INetCfg, + (void**)&pnc ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + + if ( fGetWriteLock ) + { + + /* + * Get the locking reference + */ + hr = pnc->QueryInterface( IID_INetCfgLock, + (LPVOID *)&pncLock ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + + /* + * Attempt to lock the INetCfg for read/write + */ + hr = pncLock->AcquireWriteLock( cmsTimeout, + lpszAppName, + lpszLockedBy); + if (hr == S_FALSE ) + { + Log(L"VBoxNetCfgWinQueryINetCfg: WriteLock busy\n"); + hr = NETCFG_E_NO_WRITE_LOCK; + } + else if (hr != S_OK) + { + Log(L"VBoxNetCfgWinQueryINetCfg: AcquireWriteLock failed, hr (0x%x)\n", hr); + } + } + else + { + Log(L"VBoxNetCfgWinQueryINetCfg: QueryInterface for IID_INetCfgLock failed, hr (0x%x)\n", hr); + } + } + + if ( hr == S_OK ) + { + + /* + * Initialize the INetCfg object. + */ + hr = pnc->Initialize( NULL ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + *ppnc = pnc; + pnc->AddRef(); + } + else + { + Log(L"VBoxNetCfgWinQueryINetCfg: Initialize failed, hr (0x%x)\n", hr); + + /* + * Initialize failed, if obtained lock, release it + */ + if ( pncLock ) + { + pncLock->ReleaseWriteLock(); + } + } + } + + VBoxNetCfgWinReleaseRef( pncLock ); + VBoxNetCfgWinReleaseRef( pnc ); + } + else + { + Log(L"VBoxNetCfgWinQueryINetCfg: CoCreateInstance for CLSID_CNetCfg failed, hr (0x%x)\n", hr); + } + +// COM should be initialized before using the NetConfig API +// /* +// * In case of error, uninitialize COM. +// */ +// if ( hr != S_OK ) +// { +// CoUninitialize(); +// } + } + + return hr; +} + +/** + * Get a reference to INetCfg. + * + * @return HRESULT S_OK on success, otherwise an error code + * @param fGetWriteLock If TRUE, Write lock requested + * @param lpszAppName Application name requesting the reference. + * @param ppnc pointer the Reference to INetCfg to be stored to + * @param lpszLockedBy pointer the Application name who holds the write lock to be stored to, optional + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinQueryINetCfg(IN BOOL fGetWriteLock, + IN LPCWSTR lpszAppName, + OUT INetCfg **ppnc, + OUT LPWSTR *lpszLockedBy) +{ + return VBoxNetCfgWinQueryINetCfgEx(fGetWriteLock, + lpszAppName, + VBOX_NETCFG_LOCK_TIME_OUT, + ppnc, + lpszLockedBy); +} +/** + * Release a reference to INetCfg. + * + * @param pnc Reference to INetCfg to release. + * @param fHasWriteLock If TRUE, reference was held with write lock. + * @return S_OK on success, otherwise an error code. + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinReleaseINetCfg(IN INetCfg *pnc, + IN BOOL fHasWriteLock) +{ + INetCfgLock *pncLock = NULL; + HRESULT hr = S_OK; + + /* + * Uninitialize INetCfg + */ + hr = pnc->Uninitialize(); + Assert(hr == S_OK); + /* + * If write lock is present, unlock it + */ + if ( hr == S_OK && fHasWriteLock ) + { + + /* + * Get the locking reference + */ + hr = pnc->QueryInterface( IID_INetCfgLock, + (LPVOID *)&pncLock); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + hr = pncLock->ReleaseWriteLock(); + VBoxNetCfgWinReleaseRef( pncLock ); + } + } + else if(hr != S_OK) + { + Log(L"VBoxNetCfgWinReleaseINetCfg: Uninitialize failed, hr (0x%x)\n", hr); + } + + VBoxNetCfgWinReleaseRef( pnc ); + +// COM should be initialized before using the NetConfig API +// /* +// * Uninitialize COM. +// */ +// CoUninitialize(); + + return hr; +} + +/** + * Get network component enumerator reference. + * + * @param pnc Reference to INetCfg. + * @param pguidClass Class GUID of the network component. + * @param ppencc address the Enumerator reference to be stored to. + * @return S_OK on success, otherwise an error code. + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetComponentEnum(INetCfg *pnc, + IN const GUID *pguidClass, + OUT IEnumNetCfgComponent **ppencc) +{ + INetCfgClass *pncclass; + HRESULT hr; + + *ppencc = NULL; + + /* + * Get the class reference. + */ + hr = pnc->QueryNetCfgClass( pguidClass, + IID_INetCfgClass, + (PVOID *)&pncclass ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + + /* + * Get the enumerator reference. + */ + hr = pncclass->EnumComponents( ppencc ); + + /* + * We don't need the class reference any more. + */ + VBoxNetCfgWinReleaseRef( pncclass ); + } + else + { + Log(L"VBoxNetCfgWinGetComponentEnum: QueryNetCfgClass for IID_INetCfgClass failed, hr (0x%x)\n", hr); + } + + return hr; +} + +/** + * Enumerates the first network component. + * + * @param pencc Component enumerator reference. + * @param ppncc address the Network component reference to be stored to + * @return S_OK on success, otherwise an error code. + */ +/** + * Enumerate the next network component. + * The function behaves just like VBoxNetCfgWinGetFirstComponent if + * it is called right after VBoxNetCfgWinGetComponentEnum. + * + * @param pencc Component enumerator reference. + * @param ppncc address the Network component reference to be stored to. + * @return S_OK on success, otherwise an error code. + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetNextComponent(IN IEnumNetCfgComponent *pencc, + OUT INetCfgComponent **ppncc) +{ + HRESULT hr; + ULONG ulCount; + + *ppncc = NULL; + + hr = pencc->Next( 1, + ppncc, + &ulCount ); + Assert(hr == S_OK || hr == S_FALSE); + if(hr != S_OK && hr != S_FALSE) + { + Log(L"VBoxNetCfgWinGetNextComponent: Next failed, hr (0x%x)\n", hr); + } + return hr; +} + +/** + * Install a network component(protocols, clients and services) + * given its INF file. + * @param pnc Reference to INetCfg. + * @param lpszComponentId PnpID of the network component. + * @param pguidClass Class GUID of the network component. + * @return S_OK on success, otherwise an error code. + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinInstallComponent(IN INetCfg *pnc, + IN LPCWSTR szComponentId, + IN const GUID *pguidClass) +{ + INetCfgClassSetup *pncClassSetup = NULL; + INetCfgComponent *pncc = NULL; + OBO_TOKEN OboToken; + HRESULT hr = S_OK; + + /* + * OBO_TOKEN specifies on whose behalf this + * component is being installed. + * Set it to OBO_USER so that szComponentId will be installed + * on behalf of the user. + */ + + ZeroMemory( &OboToken, + sizeof(OboToken) ); + OboToken.Type = OBO_USER; + + /* + * Get component's setup class reference. + */ + hr = pnc->QueryNetCfgClass ( pguidClass, + IID_INetCfgClassSetup, + (void**)&pncClassSetup ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + + hr = pncClassSetup->Install( szComponentId, + &OboToken, + 0, + 0, /* Upgrade from build number. */ + NULL, /* Answerfile name */ + NULL, /* Answerfile section name */ + &pncc ); /* Reference after the component */ + /* is installed. */ + Assert(hr == S_OK); + if ( S_OK == hr ) + { + + /* + * we don't need to use pncc (INetCfgComponent), release it + */ + VBoxNetCfgWinReleaseRef( pncc ); + } + else + { + Log(L"VBoxNetCfgWinInstallComponent: Install failed, hr (0x%x)\n", hr); + } + + VBoxNetCfgWinReleaseRef( pncClassSetup ); + } + else + { + Log(L"VBoxNetCfgWinInstallComponent: QueryNetCfgClass for IID_INetCfgClassSetup failed, hr (0x%x)\n", hr); + } + + return hr; +} + +static HRESULT vboxNetCfgWinRemoveInf(IN LPCWSTR pInfFullPath, DWORD Flags) +{ + DWORD dwError; + HRESULT hr = S_OK; + WCHAR Drive[_MAX_DRIVE]; + WCHAR Dir[_MAX_DIR]; + WCHAR DirWithDrive[_MAX_DRIVE+_MAX_DIR]; + WCHAR OemInfFullPath[MAX_PATH]; + PWCHAR pOemInfName; + + /* + * Get the path where the INF file is. + */ + _wsplitpath( pInfFullPath, Drive, Dir, NULL, NULL ); + + wcscpy( DirWithDrive, Drive ); + wcscat( DirWithDrive, Dir ); + + /* + * get the oem file name. + */ + if (SetupCopyOEMInfW( pInfFullPath, + DirWithDrive, /* Other files are in the */ + /* same dir. as primary INF */ + SPOST_PATH, /* First param is path to INF */ + SP_COPY_REPLACEONLY, /* we want to get the inf file name */ + OemInfFullPath, /* Name of the INF after */ + /* it's copied to %windir%\inf */ + sizeof(OemInfFullPath) / sizeof(OemInfFullPath[0]), /* Max buf. size for the above */ + NULL, /* Required size if non-null */ + &pOemInfName ) ) /* Optionally get the filename */ + { + Log(L"vboxNetCfgWinRemoveInf: found inf file (%s) for (%s)\n", OemInfFullPath, pInfFullPath); + + if(!SetupUninstallOEMInfW(pOemInfName, + Flags, /*DWORD Flags could be SUOI_FORCEDELETE */ + NULL /*__in PVOID Reserved == NULL */ + )) + { + dwError = GetLastError(); + + Log(L"vboxNetCfgWinRemoveInf: SetupUninstallOEMInf failed for file (%s), r (%d)\n", pInfFullPath, dwError); + Log(L"vboxNetCfgWinRemoveInf: DirWithDrive (%s)\n", DirWithDrive); + + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + } + else + { + dwError = GetLastError(); + + Log(L"vboxNetCfgWinRemoveInf: SetupCopyOEMInfW failed for file (%s), r (%d)\n", pInfFullPath, dwError); + Log(L"vboxNetCfgWinRemoveInf: DirWithDrive (%s)\n", DirWithDrive); + + + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + return hr; +} + +static HRESULT vboxNetCfgWinCopyInf(IN LPCWSTR pInfFullPath) +{ + DWORD dwError; + HRESULT hr = S_OK; + WCHAR Drive[_MAX_DRIVE]; + WCHAR Dir[_MAX_DIR]; + WCHAR DirWithDrive[_MAX_DRIVE+_MAX_DIR]; + WCHAR DirDestInf[_MAX_PATH] = { 0 }; + + /* + * Get the path where the INF file is. + */ + _wsplitpath( pInfFullPath, Drive, Dir, NULL, NULL ); + + wcscpy( DirWithDrive, Drive ); + wcscat( DirWithDrive, Dir ); + + /* + * Copy the INF file and other files referenced in the INF file. + */ + if ( !SetupCopyOEMInfW( pInfFullPath, + DirWithDrive, /* Other files are in the */ + /* same dir. as primary INF */ + SPOST_PATH, /* First param is path to INF */ + 0, /* Default copy style */ + DirDestInf, /* Name of the INF after */ + /* it's copied to %windir%\inf */ + sizeof(DirDestInf), /* Max buf. size for the above */ + NULL, /* Required size if non-null */ + NULL ) ) /* Optionally get the filename */ + { + dwError = GetLastError(); + + Log(L"vboxNetCfgWinCopyInf: SetupCopyOEMInfW failed for file (%s), r (%d)\n", pInfFullPath, dwError); + Log(L"vboxNetCfgWinCopyInf: DirWithDrive (%s), DirDestInf(%s)\n", DirWithDrive, DirDestInf); + + Assert(0); + + hr = HRESULT_FROM_WIN32( dwError ); + } + + return hr; +} + +/** + * Install a network component(protocols, clients and services) + * given its INF file. + * + * @param pnc Reference to INetCfg. + * @param lpszComponentId PnpID of the network component. + * @param pguidClass Class GUID of the network component. + * @param lpszInfFullPath INF file to install from. + * @return S_OK on success, otherwise an error code. + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinInstallNetComponent(IN INetCfg *pnc, + IN LPCWSTR lpszComponentId, + IN const GUID *pguidClass, + IN LPCWSTR * apInfFullPaths, + IN UINT cInfFullPaths) +{ + HRESULT hr = S_OK; + + /* + * If full path to INF has been specified, the INF + * needs to be copied using Setup API to ensure that any other files + * that the primary INF copies will be correctly found by Setup API + */ + for(UINT i = 0; i < cInfFullPaths; i++) + { + hr = vboxNetCfgWinCopyInf(apInfFullPaths[i]); + Assert(hr == S_OK); + if(hr != S_OK) + { + Log(L"VBoxNetCfgWinInstallNetComponent: vboxNetCfgWinCopyInf failed, hr (0x%x)\n", hr); + if(i != 0) + { + /* remove infs already installed */ + for(UINT j = i-1; j != 0; j--) + { + vboxNetCfgWinRemoveInf(apInfFullPaths[j], 0); + } + } + + break; + } + } + + if (S_OK == hr) + { + /* + * Install the network component. + */ + hr = VBoxNetCfgWinInstallComponent( pnc, + lpszComponentId, + pguidClass ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + /* + * On success, apply the changes + */ + HRESULT tmpHr = pnc->Apply(); + Assert(tmpHr == S_OK); + if(tmpHr != S_OK) + { + Log(L"VBoxNetCfgWinInstallNetComponent: Apply failed, hr (0x%x)\n", tmpHr); + } + } + else + { + Log(L"VBoxNetCfgWinInstallNetComponent: VBoxNetCfgWinInstallComponent failed, hr (0x%x)\n", hr); + } + } + + return hr; +} + +/** + * Uninstall a network component. + * + * @param pnc Reference to INetCfg. + * @param lpszInfId PnpID of the network component to uninstall + * @param apInfFiles array of null-terminated strings containing the inf file names describing drivers to be removed from the system + * @param cInfFiles the size of apInfFiles array + * @return S_OK on success, otherwise an error code. + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinUninstallComponent(IN INetCfg *pnc, + IN INetCfgComponent *pncc) +{ + INetCfgClass *pncClass; + INetCfgClassSetup *pncClassSetup; + GUID guidClass; + OBO_TOKEN obo; + HRESULT hr; + + /* + * Get the class GUID. + */ + hr = pncc->GetClassGuid( &guidClass ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + + /* + * Get a reference to component's class. + */ + hr = pnc->QueryNetCfgClass( &guidClass, + IID_INetCfgClass, + (PVOID *)&pncClass ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + + /* + * Get the setup interface. + */ + hr = pncClass->QueryInterface( IID_INetCfgClassSetup, + (LPVOID *)&pncClassSetup ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + + /* + * Uninstall the component. + */ + ZeroMemory( &obo, + sizeof(OBO_TOKEN) ); + + obo.Type = OBO_USER; + + hr = pncClassSetup->DeInstall( pncc, + &obo, + NULL ); + Assert(hr == S_OK); + if ( (hr == S_OK) || (hr == NETCFG_S_REBOOT) ) + { + HRESULT tmpHr = pnc->Apply(); + /* we ignore apply failures since they might occur on misconfigured systems*/ + Assert(tmpHr == S_OK); + if ( (tmpHr != S_OK) ) + { + Log(L"VBoxNetCfgWinUninstallComponent: Apply failed, hr (0x%x), ignoring\n", tmpHr); + } + } + else + { + Log(L"VBoxNetCfgWinUninstallComponent: DeInstall failed, hr (0x%x)\n", hr); + } + + VBoxNetCfgWinReleaseRef( pncClassSetup ); + } + else + { + Log(L"VBoxNetCfgWinUninstallComponent: QueryInterface for IID_INetCfgClassSetup failed, hr (0x%x)\n", hr); + } + + VBoxNetCfgWinReleaseRef( pncClass ); + } + else + { + Log(L"VBoxNetCfgWinUninstallComponent: QueryNetCfgClass failed, hr (0x%x)\n", hr); + } + } + else + { + Log(L"VBoxNetCfgWinUninstallComponent: GetClassGuid failed, hr (0x%x)\n", hr); + } + + return hr; +} + +#define VBOXNETCFGWIN_NETFLT_ID L"sun_VBoxNetFlt" +#define VBOXNETCFGWIN_NETFLT_MP_ID L"sun_VBoxNetFltmp" + +static HRESULT vboxNetCfgWinNetFltUninstall(IN INetCfg *pNc, DWORD InfRmFlags) +{ + INetCfgComponent * pNcc = NULL; + HRESULT hr = pNc->FindComponent(VBOXNETCFGWIN_NETFLT_ID, &pNcc); + if(hr == S_OK) + { + Log(L"NetFlt Is Installed currently\n"); + + hr = VBoxNetCfgWinUninstallComponent(pNc, pNcc); + + VBoxNetCfgWinReleaseRef(pNcc); + } + else if(hr == S_FALSE) + { + Log(L"NetFlt Is Not Installed currently\n"); + hr = S_OK; + } + else + { + Log(L"vboxNetCfgWinNetFltUninstall: FindComponent for NetFlt failed, hr (0x%x)\n", hr); + hr = S_OK; + } + + VBoxNetCfgWinUninstallInfs(VBOXNETCFGWIN_NETFLT_ID, InfRmFlags); + VBoxNetCfgWinUninstallInfs(VBOXNETCFGWIN_NETFLT_MP_ID, InfRmFlags); + + return hr; +} + +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinNetFltUninstall(IN INetCfg *pNc) +{ + return vboxNetCfgWinNetFltUninstall(pNc, 0); +} + +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinNetFltInstall(IN INetCfg *pNc, IN LPCWSTR * apInfFullPaths, IN UINT cInfFullPaths) +{ + HRESULT hr = vboxNetCfgWinNetFltUninstall(pNc, SUOI_FORCEDELETE); + + hr = VBoxNetCfgWinInstallNetComponent(pNc, VBOXNETCFGWIN_NETFLT_ID, + &GUID_DEVCLASS_NETSERVICE, + apInfFullPaths, + cInfFullPaths); + + return hr; +} + + +/** + * Get network component's binding path enumerator reference. + * + * @param pncc Network component reference. + * @param dwBindingType EBP_ABOVE or EBP_BELOW. + * @param ppencbp address the Enumerator reference to be stored to + * @return S_OK on success, otherwise an error code. + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetBindingPathEnum(IN INetCfgComponent *pncc, + IN DWORD dwBindingType, + OUT IEnumNetCfgBindingPath **ppencbp) +{ + INetCfgComponentBindings *pnccb = NULL; + HRESULT hr; + + *ppencbp = NULL; + + /* Get component's binding. */ + hr = pncc->QueryInterface( IID_INetCfgComponentBindings, + (PVOID *)&pnccb ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + + /* Get binding path enumerator reference. */ + hr = pnccb->EnumBindingPaths( dwBindingType, + ppencbp ); + if(hr != S_OK) + { + Log(L"VBoxNetCfgWinGetBindingPathEnum: EnumBindingPaths failed, hr (0x%x)\n", hr); + } + + VBoxNetCfgWinReleaseRef( pnccb ); + } + else + { + Log(L"VBoxNetCfgWinGetBindingPathEnum: QueryInterface for IID_INetCfgComponentBindings failed, hr (0x%x)\n", hr); + } + + return hr; +} + +/** + * Enumerates the first binding path. + * + * @param pencc Binding path enumerator reference. + * @param ppncc address the Binding path reference to be stored to + * @return S_OK on success, otherwise an error code. + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetFirstComponent(IN IEnumNetCfgComponent *pencc, + OUT INetCfgComponent **ppncc) +{ + HRESULT hr; + ULONG ulCount; + + *ppncc = NULL; + + pencc->Reset(); + + hr = pencc->Next( 1, + ppncc, + &ulCount ); + Assert(hr == S_OK || hr == S_FALSE); + if(hr != S_OK && hr != S_FALSE) + { + Log(L"VBoxNetCfgWinGetFirstComponent: Next failed, hr (0x%x)\n", hr); + } + return hr; +} + +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetFirstBindingPath(IN IEnumNetCfgBindingPath *pencbp, + OUT INetCfgBindingPath **ppncbp) +{ + ULONG ulCount; + HRESULT hr; + + *ppncbp = NULL; + + pencbp->Reset(); + + hr = pencbp->Next( 1, + ppncbp, + &ulCount ); + Assert(hr == S_OK || hr == S_FALSE); + if(hr != S_OK && hr != S_FALSE) + { + Log(L"VBoxNetCfgWinGetFirstBindingPath: Next failed, hr (0x%x)\n", hr); + } + + return hr; +} + +/** + * Get binding interface enumerator reference. + * + * @param pncbp Binding path reference. + * @param ppencbp address the Enumerator reference to be stored to + * @return S_OK on success, otherwise an error code + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetBindingInterfaceEnum(IN INetCfgBindingPath *pncbp, + OUT IEnumNetCfgBindingInterface **ppencbi) +{ + HRESULT hr; + + *ppencbi = NULL; + + hr = pncbp->EnumBindingInterfaces( ppencbi ); + Assert(hr == S_OK); + if(hr != S_OK) + { + Log(L"VBoxNetCfgWinGetBindingInterfaceEnum: EnumBindingInterfaces failed, hr (0x%x)\n", hr); + } + + return hr; +} + +/** + * Enumerates the first binding interface. + * + * @param pencbi Binding interface enumerator reference. + * @param ppncbi address the Binding interface reference to be stored to + * @return S_OK on success, otherwise an error code + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetFirstBindingInterface(IN IEnumNetCfgBindingInterface *pencbi, + OUT INetCfgBindingInterface **ppncbi) +{ + ULONG ulCount; + HRESULT hr; + + *ppncbi = NULL; + + pencbi->Reset(); + + hr = pencbi->Next( 1, + ppncbi, + &ulCount ); + Assert(hr == S_OK || hr == S_FALSE); + if(hr != S_OK && hr != S_FALSE) + { + Log(L"VBoxNetCfgWinGetFirstBindingInterface: Next failed, hr (0x%x)\n", hr); + } + + return hr; +} + +/*@ + * Enumerate the next binding interface. + * The function behaves just like VBoxNetCfgWinGetFirstBindingInterface if + * it is called right after VBoxNetCfgWinGetBindingInterfaceEnum. + * + * @param pencbi Binding interface enumerator reference. + * @param ppncbi address the Binding interface reference t be stored to + * @return S_OK on success, otherwise an error code + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetNextBindingInterface(IN IEnumNetCfgBindingInterface *pencbi, + OUT INetCfgBindingInterface **ppncbi) +{ + ULONG ulCount; + HRESULT hr; + + *ppncbi = NULL; + + hr = pencbi->Next( 1, + ppncbi, + &ulCount ); + Assert(hr == S_OK || hr == S_FALSE); + if(hr != S_OK && hr != S_FALSE) + { + Log(L"VBoxNetCfgWinGetNextBindingInterface: Next failed, hr (0x%x)\n", hr); + } + + return hr; +} + +/** + * Enumerate the next binding path. + * The function behaves just like VBoxNetCfgWinGetFirstBindingPath if + * it is called right after VBoxNetCfgWinGetBindingPathEnum. + * + * @param pencbp Binding path enumerator reference. + * @param ppncbp Address the Binding path reference to be stored to + * @return S_OK on sucess, otherwise an error code. + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetNextBindingPath(IN IEnumNetCfgBindingPath *pencbp, + OUT INetCfgBindingPath **ppncbp) +{ + ULONG ulCount; + HRESULT hr; + + *ppncbp = NULL; + + hr = pencbp->Next( 1, + ppncbp, + &ulCount ); + Assert(hr == S_OK || hr == S_FALSE); + if(hr != S_OK && hr != S_FALSE) + { + Log(L"VBoxNetCfgWinGetNextBindingPath: Next failed, hr (0x%x)\n", hr); + } + + return hr; +} + +/* + * helper function to get the component by its guid given enum interface + */ +static HRESULT vboxNetCfgWinGetComponentByGuidEnum(IEnumNetCfgComponent *pEnumNcc, IN const GUID * pGuid, OUT INetCfgComponent ** ppNcc) +{ + INetCfgComponent * pNcc; + GUID NccGuid; + HRESULT hr; + + hr = VBoxNetCfgWinGetFirstComponent( pEnumNcc, &pNcc ); + Assert(hr == S_OK || hr == S_FALSE); + while(hr == S_OK) + { + ULONG uComponentStatus; + hr = pNcc->GetDeviceStatus(&uComponentStatus); + if(hr == S_OK) + { + if(uComponentStatus == 0) + { + hr = pNcc->GetInstanceGuid(&NccGuid); + Assert(hr == S_OK); + if(hr == S_OK) + { + if(NccGuid == *pGuid) + { + /* found the needed device */ + *ppNcc = pNcc; + break; + } + } + else + { + Log(L"vboxNetCfgWinGetComponentByGuidEnum: GetInstanceGuid failed, hr (0x%x)\n", hr); + } + } + } + + VBoxNetCfgWinReleaseRef(pNcc); + + hr = VBoxNetCfgWinGetNextComponent( pEnumNcc, &pNcc ); + } + + return hr; +} + +/** + * get the component by its guid + */ +VBOXNETCFGWIN_DECL(HRESULT) +VBoxNetCfgWinGetComponentByGuid(IN INetCfg *pNc, + IN const GUID *pguidClass, + IN const GUID * pComponentGuid, + OUT INetCfgComponent **ppncc) +{ + IEnumNetCfgComponent *pEnumNcc; + HRESULT hr = VBoxNetCfgWinGetComponentEnum( pNc, pguidClass, &pEnumNcc ); + Assert(hr == S_OK); + if(hr == S_OK) + { + hr = vboxNetCfgWinGetComponentByGuidEnum(pEnumNcc, pComponentGuid, ppncc); + Assert(hr == S_OK || hr == S_FALSE); + if(hr == S_FALSE) + { + Log(L"VBoxNetCfgWinGetComponentByGuid: component not found \n"); + } + else if(hr != S_OK) + { + Log(L"VBoxNetCfgWinGetComponentByGuid: vboxNetCfgWinGetComponentByGuidEnum failed, hr (0x%x)\n", hr); + } + VBoxNetCfgWinReleaseRef(pEnumNcc); + } + else + { + Log(L"VBoxNetCfgWinGetComponentByGuid: VBoxNetCfgWinGetComponentEnum failed, hr (0x%x)\n", hr); + } + return hr; +} + +typedef BOOL (*VBOXNETCFGWIN_NETCFGENUM_CALLBACK) (IN INetCfg *pNc, IN INetCfgComponent *pNcc, PVOID pContext); + +static HRESULT vboxNetCfgWinEnumNetCfgComponents(IN INetCfg *pNc, + IN const GUID *pguidClass, + VBOXNETCFGWIN_NETCFGENUM_CALLBACK callback, + PVOID pContext) +{ + IEnumNetCfgComponent *pEnumComponent; + HRESULT hr = pNc->EnumComponents(pguidClass, &pEnumComponent); + bool bBreak = false; + Assert(hr == S_OK); + if(hr == S_OK) + { + INetCfgComponent *pNcc; + hr = pEnumComponent->Reset(); + Assert(hr == S_OK); + do + { + hr = VBoxNetCfgWinGetNextComponent(pEnumComponent, &pNcc); + Assert(hr == S_OK || hr == S_FALSE); + if(hr == S_OK) + { + /* this is E_NOTIMPL for all components other than NET */ +// ULONG uComponentStatus; +// hr = pNcc->GetDeviceStatus(&uComponentStatus); +// if(hr == S_OK) + { + if(!callback(pNc, pNcc, pContext)) + { + bBreak = true; + } + } + VBoxNetCfgWinReleaseRef(pNcc); + } + else + { + if(hr ==S_FALSE) + { + hr = S_OK; + } + else + { + Log(L"vboxNetCfgWinEnumNetCfgComponents: VBoxNetCfgWinGetNextComponent failed, hr (0x%x)\n", hr); + } + break; + } + } while(!bBreak); + + VBoxNetCfgWinReleaseRef(pEnumComponent); + } + return hr; +} + +static VOID DoLogging(LPCWSTR szString, ...) +{ + LOG_ROUTINE pRoutine = (LOG_ROUTINE)(*((void * volatile *)&g_Logger)); + if(pRoutine) + { + WCHAR szBuffer[1024] = {0}; + va_list pArgList; + va_start(pArgList, szString); + _vsnwprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), szString, pArgList); + va_end(pArgList); + + pRoutine(szBuffer); + } +} + +VBOXNETCFGWIN_DECL(VOID) VBoxNetCfgWinSetLogging(LOG_ROUTINE Log) +{ + *((void * volatile *)&g_Logger) = Log; +} + +static BOOL vboxNetCfgWinRemoveAllNetDevicesOfIdCallback(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDev, PVOID pContext) +{ + DWORD winEr; + HRESULT hr = S_OK; + SP_REMOVEDEVICE_PARAMS rmdParams; + SP_DEVINSTALL_PARAMS devParams; + rmdParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); + rmdParams.ClassInstallHeader.InstallFunction = DIF_REMOVE; + rmdParams.Scope = DI_REMOVEDEVICE_GLOBAL; + rmdParams.HwProfile = 0; + if(SetupDiSetClassInstallParams(hDevInfo,pDev,&rmdParams.ClassInstallHeader,sizeof(rmdParams))) + { + if(SetupDiCallClassInstaller(DIF_REMOVE,hDevInfo,pDev)) + { + /* + * see if device needs reboot + */ + devParams.cbSize = sizeof(devParams); + if(SetupDiGetDeviceInstallParams(hDevInfo,pDev,&devParams)) + { + if(devParams.Flags & (DI_NEEDRESTART|DI_NEEDREBOOT)) + { + // + // reboot required + // + hr = S_FALSE; + } + } + else + { + // + // appears to have succeeded + // + } + } + else + { + winEr = GetLastError(); + hr = HRESULT_FROM_WIN32(winEr); + } + } + else + { + winEr = GetLastError(); + hr = HRESULT_FROM_WIN32(winEr); + } + + return TRUE; +} + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRemoveAllNetDevicesOfId(LPWSTR pPnPId) +{ + return VBoxNetCfgWinEnumNetDevices(pPnPId, vboxNetCfgWinRemoveAllNetDevicesOfIdCallback, NULL); +} + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnumNetDevices(LPWSTR pPnPId, VBOXNETCFGWIN_NETENUM_CALLBACK callback, PVOID pContext) +{ + DWORD winEr; + HRESULT hr = S_OK; + + HDEVINFO hDevInfo = SetupDiGetClassDevsExW( + &GUID_DEVCLASS_NET, + NULL, /* IN PCTSTR Enumerator, OPTIONAL*/ + NULL, /*IN HWND hwndParent, OPTIONAL*/ + DIGCF_PRESENT, /*IN DWORD Flags,*/ + NULL, /*IN HDEVINFO DeviceInfoSet, OPTIONAL*/ + NULL, /*IN PCTSTR MachineName, OPTIONAL*/ + NULL /*IN PVOID Reserved*/ + ); + if(hDevInfo != INVALID_HANDLE_VALUE) + { + DWORD iDev = 0; + SP_DEVINFO_DATA Dev; + PBYTE pBuffer = NULL; + DWORD cbBuffer = 0; + DWORD cbRequired = 0; + BOOL bEnumCompleted; + size_t cPnPId = wcslen(pPnPId); + + Dev.cbSize = sizeof(Dev); + + for(; bEnumCompleted = SetupDiEnumDeviceInfo(hDevInfo, iDev, &Dev); iDev++) + { + if(!SetupDiGetDeviceRegistryPropertyW(hDevInfo,&Dev, + SPDRP_HARDWAREID, /* IN DWORD Property,*/ + NULL, /*OUT PDWORD PropertyRegDataType, OPTIONAL*/ + pBuffer, /*OUT PBYTE PropertyBuffer,*/ + cbBuffer, /* IN DWORD PropertyBufferSize,*/ + &cbRequired /*OUT PDWORD RequiredSize OPTIONAL*/ + )) + { + winEr = GetLastError(); + if(winEr != ERROR_INSUFFICIENT_BUFFER) + { + hr = HRESULT_FROM_WIN32(winEr); + break; + } + + if(pBuffer) + { + free(pBuffer); + } + + pBuffer = (PBYTE)malloc(cbRequired); + cbBuffer = cbRequired; + + if(!SetupDiGetDeviceRegistryPropertyW(hDevInfo,&Dev, + SPDRP_HARDWAREID, /* IN DWORD Property,*/ + NULL, /*OUT PDWORD PropertyRegDataType, OPTIONAL*/ + pBuffer, /*OUT PBYTE PropertyBuffer,*/ + cbBuffer, /* IN DWORD PropertyBufferSize,*/ + &cbRequired /*OUT PDWORD RequiredSize OPTIONAL*/ + )) + { + winEr = GetLastError(); + hr = HRESULT_FROM_WIN32(winEr); + break; + } + } + + PWCHAR pCurId = (PWCHAR)pBuffer; + size_t cCurId = wcslen(pCurId); + if(cCurId >= cPnPId) + { + pCurId += cCurId - cPnPId; + if(!wcsnicmp(pCurId, pPnPId, cPnPId)) + { + if(!callback(hDevInfo,&Dev,pContext)) + break; + } + } + + } + + if(pBuffer) + free(pBuffer); + + if(bEnumCompleted) + { + winEr = GetLastError(); + hr = winEr == ERROR_NO_MORE_ITEMS ? S_OK : HRESULT_FROM_WIN32(winEr); + } + + SetupDiDestroyDeviceInfoList(hDevInfo); + } + return hr; +} + + + +/* The original source of the VBoxNetAdp adapter creation/destruction code has the following copyright */ +/* + Copyright 2004 by the Massachusetts Institute of Technology + + All rights reserved. + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of the Massachusetts + Institute of Technology (M.I.T.) not be used in advertising or publicity + pertaining to distribution of the software without specific, written + prior permission. + + M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. +*/ + + +#define NETSHELL_LIBRARY _T("netshell.dll") + +/** + * Use the IShellFolder API to rename the connection. + */ +static HRESULT rename_shellfolder (PCWSTR wGuid, PCWSTR wNewName) +{ + /* This is the GUID for the network connections folder. It is constant. + * {7007ACC7-3202-11D1-AAD2-00805FC1270E} */ + const GUID CLSID_NetworkConnections = { + 0x7007ACC7, 0x3202, 0x11D1, { + 0xAA, 0xD2, 0x00, 0x80, 0x5F, 0xC1, 0x27, 0x0E + } + }; + + LPITEMIDLIST pidl = NULL; + IShellFolder *pShellFolder = NULL; + HRESULT hr; + + /* Build the display name in the form "::{GUID}". */ + if (wcslen (wGuid) >= MAX_PATH) + return E_INVALIDARG; + WCHAR szAdapterGuid[MAX_PATH + 2] = {0}; + swprintf (szAdapterGuid, L"::%ls", wGuid); + + /* Create an instance of the network connections folder. */ + hr = CoCreateInstance (CLSID_NetworkConnections, NULL, + CLSCTX_INPROC_SERVER, IID_IShellFolder, + reinterpret_cast <LPVOID *> (&pShellFolder)); + /* Parse the display name. */ + if (SUCCEEDED (hr)) + { + hr = pShellFolder->ParseDisplayName (NULL, NULL, szAdapterGuid, NULL, + &pidl, NULL); + } + if (SUCCEEDED (hr)) + { + hr = pShellFolder->SetNameOf (NULL, pidl, wNewName, SHGDN_NORMAL, + &pidl); + } + + CoTaskMemFree (pidl); + + if (pShellFolder) + pShellFolder->Release(); + + return hr; +} + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRenameConnection (LPWSTR pGuid, PCWSTR NewName) +{ + typedef HRESULT (WINAPI *lpHrRenameConnection) (const GUID *, PCWSTR); + lpHrRenameConnection RenameConnectionFunc = NULL; + HRESULT status; +// Guid guid(*pDevInstanceGuid); +// Bstr bstr(guid.toString()); +// BSTR GuidString = bstr.mutableRaw(); +// WCHAR GuidString[50]; +// +// int length = StringFromGUID2(*pDevInstanceGuid, GuidString, sizeof(GuidString)/sizeof(GuidString[0])); +// if(!length) +// return E_FAIL; + +// strString[wcslen(strString) - 1] = L'\0'; +// +// WCHAR * GuidString = strString + 1; + + /* First try the IShellFolder interface, which was unimplemented + * for the network connections folder before XP. */ + status = rename_shellfolder (pGuid, NewName); + if (status == E_NOTIMPL) + { +/** @todo that code doesn't seem to work! */ + /* The IShellFolder interface is not implemented on this platform. + * Try the (undocumented) HrRenameConnection API in the netshell + * library. */ + CLSID clsid; + HINSTANCE hNetShell; + status = CLSIDFromString ((LPOLESTR) pGuid, &clsid); + if (FAILED(status)) + return E_FAIL; + hNetShell = LoadLibrary (NETSHELL_LIBRARY); + if (hNetShell == NULL) + return E_FAIL; + RenameConnectionFunc = + (lpHrRenameConnection) GetProcAddress (hNetShell, + "HrRenameConnection"); + if (RenameConnectionFunc == NULL) + { + FreeLibrary (hNetShell); + return E_FAIL; + } + status = RenameConnectionFunc (&clsid, NewName); + FreeLibrary (hNetShell); + } + if (FAILED (status)) + return status; + + return S_OK; +} + +#define DRIVERHWID _T("sun_VBoxNetAdp") + +#define SetErrBreak(strAndArgs) \ + if (1) { \ + hrc = E_FAIL; \ + Log strAndArgs; \ + Assert(0); \ + break; \ + } else do {} while (0) + + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRemoveHostOnlyNetworkInterface (const GUID *pGUID, BSTR *pErrMsg) +{ +// LogFlowFuncEnter(); +// LogFlowFunc (("Network connection GUID = {%RTuuid}\n", aGUID.raw())); + +// AssertReturn (aClient, VERR_INVALID_POINTER); +// AssertReturn (!aGUID.isEmpty(), VERR_INVALID_PARAMETER); + + HRESULT hrc = S_OK; + + do + { + TCHAR lszPnPInstanceId [512] = {0}; + + /* We have to find the device instance ID through a registry search */ + + HKEY hkeyNetwork = 0; + HKEY hkeyConnection = 0; + + do + { + WCHAR strRegLocation [256]; + WCHAR GuidString[50]; + + int length = StringFromGUID2(*pGUID, GuidString, sizeof(GuidString)/sizeof(GuidString[0])); + if(!length) + SetErrBreak((L"Failed to create a Guid string")); + + swprintf (strRegLocation, + L"SYSTEM\\CurrentControlSet\\Control\\Network\\" + L"{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s", + GuidString); + + LONG status; + status = RegOpenKeyExW (HKEY_LOCAL_MACHINE, strRegLocation, 0, + KEY_READ, &hkeyNetwork); + if ((status != ERROR_SUCCESS) || !hkeyNetwork) + SetErrBreak (( + L"Host interface network is not found in registry (%s) [1]", + strRegLocation)); + + status = RegOpenKeyExW (hkeyNetwork, L"Connection", 0, + KEY_READ, &hkeyConnection); + if ((status != ERROR_SUCCESS) || !hkeyConnection) + SetErrBreak (( + L"Host interface network is not found in registry (%s) [2]", + strRegLocation)); + + DWORD len = sizeof (lszPnPInstanceId); + DWORD dwKeyType; + status = RegQueryValueExW (hkeyConnection, L"PnPInstanceID", NULL, + &dwKeyType, (LPBYTE) lszPnPInstanceId, &len); + if ((status != ERROR_SUCCESS) || (dwKeyType != REG_SZ)) + SetErrBreak (( + L"Host interface network is not found in registry (%s) [3]", + strRegLocation)); + } + while (0); + + if (hkeyConnection) + RegCloseKey (hkeyConnection); + if (hkeyNetwork) + RegCloseKey (hkeyNetwork); + + if (FAILED (hrc)) + break; + + /* + * Now we are going to enumerate all network devices and + * wait until we encounter the right device instance ID + */ + + HDEVINFO hDeviceInfo = INVALID_HANDLE_VALUE; + + do + { + BOOL ok; + DWORD ret = 0; + GUID netGuid; + SP_DEVINFO_DATA DeviceInfoData; + DWORD index = 0; + BOOL found = FALSE; + DWORD size = 0; + + /* initialize the structure size */ + DeviceInfoData.cbSize = sizeof (SP_DEVINFO_DATA); + + /* copy the net class GUID */ + memcpy (&netGuid, &GUID_DEVCLASS_NET, sizeof (GUID_DEVCLASS_NET)); + + /* return a device info set contains all installed devices of the Net class */ + hDeviceInfo = SetupDiGetClassDevs (&netGuid, NULL, NULL, DIGCF_PRESENT); + + if (hDeviceInfo == INVALID_HANDLE_VALUE) + SetErrBreak ((L"SetupDiGetClassDevs failed (0x%08X)", GetLastError())); + + /* enumerate the driver info list */ + while (TRUE) + { + TCHAR *deviceHwid; + + ok = SetupDiEnumDeviceInfo (hDeviceInfo, index, &DeviceInfoData); + + if (!ok) + { + if (GetLastError() == ERROR_NO_MORE_ITEMS) + break; + else + { + index++; + continue; + } + } + + /* try to get the hardware ID registry property */ + ok = SetupDiGetDeviceRegistryProperty (hDeviceInfo, + &DeviceInfoData, + SPDRP_HARDWAREID, + NULL, + NULL, + 0, + &size); + if (!ok) + { + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + { + index++; + continue; + } + + deviceHwid = (TCHAR *) malloc (size); + ok = SetupDiGetDeviceRegistryProperty (hDeviceInfo, + &DeviceInfoData, + SPDRP_HARDWAREID, + NULL, + (PBYTE)deviceHwid, + size, + NULL); + if (!ok) + { + free (deviceHwid); + deviceHwid = NULL; + index++; + continue; + } + } + else + { + /* something is wrong. This shouldn't have worked with a NULL buffer */ + index++; + continue; + } + + for (TCHAR *t = deviceHwid; + t && *t && t < &deviceHwid[size / sizeof(TCHAR)]; + t += _tcslen (t) + 1) + { + if (!_tcsicmp (DRIVERHWID, t)) + { + /* get the device instance ID */ + TCHAR devID [MAX_DEVICE_ID_LEN]; + if (CM_Get_Device_ID(DeviceInfoData.DevInst, + devID, MAX_DEVICE_ID_LEN, 0) == CR_SUCCESS) + { + /* compare to what we determined before */ + if (wcscmp(devID, lszPnPInstanceId) == 0) + { + found = TRUE; + break; + } + } + } + } + + if (deviceHwid) + { + free (deviceHwid); + deviceHwid = NULL; + } + + if (found) + break; + + index++; + } + + if (found == FALSE) + SetErrBreak ((L"Host Interface Network driver not found (0x%08X)", + GetLastError())); + + ok = SetupDiSetSelectedDevice (hDeviceInfo, &DeviceInfoData); + if (!ok) + SetErrBreak ((L"SetupDiSetSelectedDevice failed (0x%08X)", + GetLastError())); + + ok = SetupDiCallClassInstaller (DIF_REMOVE, hDeviceInfo, &DeviceInfoData); + if (!ok) + SetErrBreak ((L"SetupDiCallClassInstaller (DIF_REMOVE) failed (0x%08X)", + GetLastError())); + } + while (0); + + /* clean up the device info set */ + if (hDeviceInfo != INVALID_HANDLE_VALUE) + SetupDiDestroyDeviceInfoList (hDeviceInfo); + + if (FAILED (hrc)) + break; + } + while (0); + +// LogFlowFunc (("vrc=%Rrc\n", vrc)); +// LogFlowFuncLeave(); + return hrc; +} + +static UINT WINAPI vboxNetCfgWinPspFileCallback( + PVOID Context, + UINT Notification, + UINT_PTR Param1, + UINT_PTR Param2 + ) +{ + switch(Notification) + { + case SPFILENOTIFY_TARGETNEWER: + case SPFILENOTIFY_TARGETEXISTS: + return TRUE; + } + return SetupDefaultQueueCallback(Context, Notification, Param1, Param2); +} + +static BOOL vboxNetCfgWinAdjustHostOnlyNetworkInterfacePriority (IN INetCfg *pNc, IN INetCfgComponent *pNcc, PVOID pContext) +{ + INetCfgComponentBindings *pNccb = NULL; + IEnumNetCfgBindingPath *pEnumNccbp; + GUID *pGuid = (GUID*)pContext; + HRESULT hr; + bool bFound = false; + + /* Get component's binding. */ + hr = pNcc->QueryInterface( IID_INetCfgComponentBindings, + (PVOID *)&pNccb ); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + /* Get binding path enumerator reference. */ + hr = pNccb->EnumBindingPaths(EBP_BELOW, &pEnumNccbp); + Assert(hr == S_OK); + if(hr == S_OK) + { + INetCfgBindingPath *pNccbp; + hr = pEnumNccbp->Reset(); + Assert(hr == S_OK); + do + { + hr = VBoxNetCfgWinGetNextBindingPath(pEnumNccbp, &pNccbp); + Assert(hr == S_OK || hr == S_FALSE); + if(hr == S_OK) + { +// if(pNccbp->IsEnabled() == S_OK) + { + IEnumNetCfgBindingInterface *pEnumNcbi; + hr = VBoxNetCfgWinGetBindingInterfaceEnum(pNccbp, &pEnumNcbi); + Assert(hr == S_OK); + if ( hr == S_OK ) + { + INetCfgBindingInterface *pNcbi; + hr = pEnumNcbi->Reset(); + Assert(hr == S_OK); + do + { + hr = VBoxNetCfgWinGetNextBindingInterface(pEnumNcbi, &pNcbi); + Assert(hr == S_OK || hr == S_FALSE); + if(hr == S_OK) + { + INetCfgComponent * pNccBoud; + hr = pNcbi->GetLowerComponent(&pNccBoud); + Assert(hr == S_OK); + if(hr == S_OK) + { + ULONG uComponentStatus; + hr = pNccBoud->GetDeviceStatus(&uComponentStatus); + if(hr == S_OK) + { +// if(uComponentStatus == 0) + { + GUID guid; + hr = pNccBoud->GetInstanceGuid(&guid); + if(guid == *pGuid) + { + hr = pNccb->MoveAfter(pNccbp, NULL); + Assert(hr == S_OK); + bFound = true; + } + } + } + VBoxNetCfgWinReleaseRef(pNccBoud); + } + VBoxNetCfgWinReleaseRef(pNcbi); + } + else + { + if(hr == S_FALSE) + { + hr = S_OK; + } + else + { + Log(L"vboxNetCfgWinAdjustHostOnlyNetworkInterfacePriority: VBoxNetCfgWinGetNextBindingInterface failed, hr (0x%x)\n", hr); + } + break; + } + } while(!bFound); + VBoxNetCfgWinReleaseRef(pEnumNcbi); + } + else + { + Log(L"vboxNetCfgWinAdjustHostOnlyNetworkInterfacePriority: VBoxNetCfgWinGetBindingInterfaceEnum failed, hr (0x%x)\n", hr); + } + } + + VBoxNetCfgWinReleaseRef(pNccbp); + } + else + { + if(hr = S_FALSE) + { + hr = S_OK; + } + else + { + Log(L"vboxNetCfgWinAdjustHostOnlyNetworkInterfacePriority: VBoxNetCfgWinGetNextBindingPath failed, hr (0x%x)\n", hr); + } + break; + } + } while(!bFound); + + VBoxNetCfgWinReleaseRef(pEnumNccbp); + } + else + { + Log(L"vboxNetCfgWinAdjustHostOnlyNetworkInterfacePriority: EnumBindingPaths failed, hr (0x%x)\n", hr); + } + + VBoxNetCfgWinReleaseRef( pNccb ); + } + else + { + Log(L"vboxNetCfgWinAdjustHostOnlyNetworkInterfacePriority: QueryInterface for IID_INetCfgComponentBindings failed, hr (0x%x)\n", hr); + } + + return true; +} + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinCreateHostOnlyNetworkInterface (GUID *pGuid, BSTR *lppszName, BSTR *pErrMsg) +{ + HRESULT hrc = S_OK; + + HDEVINFO hDeviceInfo = INVALID_HANDLE_VALUE; + SP_DEVINFO_DATA DeviceInfoData; + PVOID pQueueCallbackContext = NULL; + DWORD ret = 0; + BOOL found = FALSE; + BOOL registered = FALSE; + BOOL destroyList = FALSE; + WCHAR pWCfgGuidString [50]; + WCHAR DevName[256]; + + do + { + BOOL ok; + GUID netGuid; + SP_DRVINFO_DATA DriverInfoData; + SP_DEVINSTALL_PARAMS DeviceInstallParams; + TCHAR className [MAX_PATH]; + DWORD index = 0; + PSP_DRVINFO_DETAIL_DATA pDriverInfoDetail; + /* for our purposes, 2k buffer is more + * than enough to obtain the hardware ID + * of the VBoxNetAdp driver. */ + DWORD detailBuf [2048]; + + HKEY hkey = NULL; + DWORD cbSize; + DWORD dwValueType; + + /* initialize the structure size */ + DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA); + + /* copy the net class GUID */ + memcpy(&netGuid, &GUID_DEVCLASS_NET, sizeof(GUID_DEVCLASS_NET)); + + /* create an empty device info set associated with the net class GUID */ + hDeviceInfo = SetupDiCreateDeviceInfoList (&netGuid, NULL); + if (hDeviceInfo == INVALID_HANDLE_VALUE) + SetErrBreak ((L"SetupDiCreateDeviceInfoList failed (0x%08X)", + GetLastError())); + + /* get the class name from GUID */ + ok = SetupDiClassNameFromGuid (&netGuid, className, MAX_PATH, NULL); + if (!ok) + SetErrBreak ((L"SetupDiClassNameFromGuid failed (0x%08X)", + GetLastError())); + + /* create a device info element and add the new device instance + * key to registry */ + ok = SetupDiCreateDeviceInfo (hDeviceInfo, className, &netGuid, NULL, NULL, + DICD_GENERATE_ID, &DeviceInfoData); + if (!ok) + SetErrBreak ((L"SetupDiCreateDeviceInfo failed (0x%08X)", + GetLastError())); + + /* select the newly created device info to be the currently + selected member */ + ok = SetupDiSetSelectedDevice (hDeviceInfo, &DeviceInfoData); + if (!ok) + SetErrBreak ((L"SetupDiSetSelectedDevice failed (0x%08X)", + GetLastError())); + + /* build a list of class drivers */ + ok = SetupDiBuildDriverInfoList (hDeviceInfo, &DeviceInfoData, + SPDIT_CLASSDRIVER); + if (!ok) + SetErrBreak ((L"SetupDiBuildDriverInfoList failed (0x%08X)", + GetLastError())); + + destroyList = TRUE; + + /* enumerate the driver info list */ + while (TRUE) + { + BOOL ret; + + ret = SetupDiEnumDriverInfo (hDeviceInfo, &DeviceInfoData, + SPDIT_CLASSDRIVER, index, &DriverInfoData); + + /* if the function failed and GetLastError() returned + * ERROR_NO_MORE_ITEMS, then we have reached the end of the + * list. Othewise there was something wrong with this + * particular driver. */ + if (!ret) + { + if(GetLastError() == ERROR_NO_MORE_ITEMS) + break; + else + { + index++; + continue; + } + } + + pDriverInfoDetail = (PSP_DRVINFO_DETAIL_DATA) detailBuf; + pDriverInfoDetail->cbSize = sizeof(SP_DRVINFO_DETAIL_DATA); + + /* if we successfully find the hardware ID and it turns out to + * be the one for the loopback driver, then we are done. */ + if (SetupDiGetDriverInfoDetail (hDeviceInfo, + &DeviceInfoData, + &DriverInfoData, + pDriverInfoDetail, + sizeof (detailBuf), + NULL)) + { + TCHAR * t; + + /* pDriverInfoDetail->HardwareID is a MULTISZ string. Go through the + * whole list and see if there is a match somewhere. */ + t = pDriverInfoDetail->HardwareID; + while (t && *t && t < (TCHAR *) &detailBuf [RT_ELEMENTS(detailBuf)]) + { + if (!_tcsicmp(t, DRIVERHWID)) + break; + + t += _tcslen(t) + 1; + } + + if (t && *t && t < (TCHAR *) &detailBuf [RT_ELEMENTS(detailBuf)]) + { + found = TRUE; + break; + } + } + + index ++; + } + + if (!found) + SetErrBreak ((L"Could not find Host Interface Networking driver! " + L"Please reinstall")); + + /* set the loopback driver to be the currently selected */ + ok = SetupDiSetSelectedDriver (hDeviceInfo, &DeviceInfoData, + &DriverInfoData); + if (!ok) + SetErrBreak ((L"SetupDiSetSelectedDriver failed (0x%08X)", + GetLastError())); + + /* register the phantom device to prepare for install */ + ok = SetupDiCallClassInstaller (DIF_REGISTERDEVICE, hDeviceInfo, + &DeviceInfoData); + if (!ok) + { + DWORD err = GetLastError(); + SetErrBreak ((L"SetupDiCallClassInstaller failed (0x%08X)", + err)); + } + + /* registered, but remove if errors occur in the following code */ + registered = TRUE; + + /* ask the installer if we can install the device */ + ok = SetupDiCallClassInstaller (DIF_ALLOW_INSTALL, hDeviceInfo, + &DeviceInfoData); + if (!ok) + { + if (GetLastError() != ERROR_DI_DO_DEFAULT) + SetErrBreak ((L"SetupDiCallClassInstaller (DIF_ALLOW_INSTALL) failed (0x%08X)", + GetLastError())); + /* that's fine */ + } + + /* get the device install parameters and disable filecopy */ + DeviceInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); + ok = SetupDiGetDeviceInstallParams (hDeviceInfo, &DeviceInfoData, + &DeviceInstallParams); + if (ok) + { + pQueueCallbackContext = SetupInitDefaultQueueCallback(NULL); + if(pQueueCallbackContext) + { + DeviceInstallParams.InstallMsgHandlerContext = pQueueCallbackContext; + DeviceInstallParams.InstallMsgHandler = (PSP_FILE_CALLBACK)vboxNetCfgWinPspFileCallback; + ok = SetupDiSetDeviceInstallParams (hDeviceInfo, &DeviceInfoData, + &DeviceInstallParams); + if(!ok) + { + DWORD winEr = GetLastError(); + Assert(0); + Log(L"SetupDiSetDeviceInstallParams: SetupDiSetDeviceInstallParams failed, winEr (%d)\n", winEr); + } + Assert(ok); + } + else + { + DWORD winEr = GetLastError(); + Assert(0); + Log(L"VBoxNetCfgWinCreateHostOnlyNetworkInterface: SetupInitDefaultQueueCallback failed, winEr (%d)\n", winEr); + } + } + else + { + DWORD winEr = GetLastError(); + Assert(0); + Log(L"VBoxNetCfgWinCreateHostOnlyNetworkInterface: SetupDiGetDeviceInstallParams failed, winEr (%d)\n", winEr); + } + + /* install the files first */ + ok = SetupDiCallClassInstaller (DIF_INSTALLDEVICEFILES, hDeviceInfo, + &DeviceInfoData); + if (!ok) + SetErrBreak ((L"SetupDiCallClassInstaller (DIF_INSTALLDEVICEFILES) failed (0x%08X)", + GetLastError())); + + /* get the device install parameters and disable filecopy */ + DeviceInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); + ok = SetupDiGetDeviceInstallParams (hDeviceInfo, &DeviceInfoData, + &DeviceInstallParams); + if (ok) + { + DeviceInstallParams.Flags |= DI_NOFILECOPY; + ok = SetupDiSetDeviceInstallParams (hDeviceInfo, &DeviceInfoData, + &DeviceInstallParams); + if (!ok) + SetErrBreak ((L"SetupDiSetDeviceInstallParams failed (0x%08X)", + GetLastError())); + } + + /* + * Register any device-specific co-installers for this device, + */ + + ok = SetupDiCallClassInstaller (DIF_REGISTER_COINSTALLERS, + hDeviceInfo, + &DeviceInfoData); + if (!ok) + SetErrBreak ((L"SetupDiCallClassInstaller (DIF_REGISTER_COINSTALLERS) failed (0x%08X)", + GetLastError())); + + /* + * install any installer-specified interfaces. + * and then do the real install + */ + ok = SetupDiCallClassInstaller (DIF_INSTALLINTERFACES, + hDeviceInfo, + &DeviceInfoData); + if (!ok) + SetErrBreak ((L"SetupDiCallClassInstaller (DIF_INSTALLINTERFACES) failed (0x%08X)", + GetLastError())); + + ok = SetupDiCallClassInstaller (DIF_INSTALLDEVICE, + hDeviceInfo, + &DeviceInfoData); + if (!ok) + SetErrBreak ((L"SetupDiCallClassInstaller (DIF_INSTALLDEVICE) failed (0x%08X)", + GetLastError())); + + /* Figure out NetCfgInstanceId */ + hkey = SetupDiOpenDevRegKey (hDeviceInfo, + &DeviceInfoData, + DICS_FLAG_GLOBAL, + 0, + DIREG_DRV, + KEY_READ); + if (hkey == INVALID_HANDLE_VALUE) + SetErrBreak ((L"SetupDiOpenDevRegKey failed (0x%08X)", + GetLastError())); + + cbSize = sizeof (pWCfgGuidString); + DWORD ret; + ret = RegQueryValueExW (hkey, L"NetCfgInstanceId", NULL, + &dwValueType, (LPBYTE) pWCfgGuidString, &cbSize); + + RegCloseKey (hkey); + + if(!SetupDiGetDeviceRegistryPropertyW(hDeviceInfo, &DeviceInfoData, + SPDRP_FRIENDLYNAME , /* IN DWORD Property,*/ + NULL, /*OUT PDWORD PropertyRegDataType, OPTIONAL*/ + (PBYTE)DevName, /*OUT PBYTE PropertyBuffer,*/ + sizeof(DevName), /* IN DWORD PropertyBufferSize,*/ + NULL /*OUT PDWORD RequiredSize OPTIONAL*/ + )) + { + int err = GetLastError(); + if(err != ERROR_INVALID_DATA) + { + SetErrBreak ((L"SetupDiGetDeviceRegistryProperty failed (0x%08X)", + err)); + } + + if(!SetupDiGetDeviceRegistryPropertyW(hDeviceInfo, &DeviceInfoData, + SPDRP_DEVICEDESC , /* IN DWORD Property,*/ + NULL, /*OUT PDWORD PropertyRegDataType, OPTIONAL*/ + (PBYTE)DevName, /*OUT PBYTE PropertyBuffer,*/ + sizeof(DevName), /* IN DWORD PropertyBufferSize,*/ + NULL /*OUT PDWORD RequiredSize OPTIONAL*/ + )) + { + err = GetLastError(); + SetErrBreak ((L"SetupDiGetDeviceRegistryProperty failed (0x%08X)", + err)); + } + } + } + while (0); + + /* + * cleanup + */ + if(pQueueCallbackContext) + { + SetupTermDefaultQueueCallback(pQueueCallbackContext); + } + + if (hDeviceInfo != INVALID_HANDLE_VALUE) + { + /* an error has occurred, but the device is registered, we must remove it */ + if (ret != 0 && registered) + SetupDiCallClassInstaller (DIF_REMOVE, hDeviceInfo, &DeviceInfoData); + + found = SetupDiDeleteDeviceInfo (hDeviceInfo, &DeviceInfoData); + + /* destroy the driver info list */ + if (destroyList) + SetupDiDestroyDriverInfoList (hDeviceInfo, &DeviceInfoData, + SPDIT_CLASSDRIVER); + /* clean up the device info set */ + SetupDiDestroyDeviceInfoList (hDeviceInfo); + } + + /* return the network connection GUID on success */ + if (SUCCEEDED(hrc)) + { +// Bstr str(DevName); +// str.detachTo(pName); + WCHAR ConnectoinName[128]; + ULONG cbName = sizeof(ConnectoinName); + + HRESULT hr = VBoxNetCfgWinGenHostonlyConnectionName (DevName, ConnectoinName, &cbName); + if(hr == S_OK) + { + hr = VBoxNetCfgWinRenameConnection (pWCfgGuidString, ConnectoinName); + } + + if(lppszName) + { + *lppszName = ::SysAllocString ((const OLECHAR *) DevName); + if ( !*lppszName ) + { + Log(L"VBoxNetCfgWinCreateHostOnlyNetworkInterface: SysAllocString failed\n"); + Assert(0); + hrc = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); + } + } + + if(pGuid) + { + hrc = CLSIDFromString(pWCfgGuidString, (LPCLSID) pGuid); + if(hrc != S_OK) + { + Log(L"VBoxNetCfgWinCreateHostOnlyNetworkInterface: CLSIDFromString failed, hrc (0x%x)\n", hrc); + Assert(0); + } + } + + INetCfg *pNc; + LPWSTR lpszApp = NULL; + + + + hr = VBoxNetCfgWinQueryINetCfgEx( TRUE, + L"VirtualBox Host-Only Creation", + 30000, /* on Vista we often get 6to4svc.dll holding the lock, wait for 30 sec, */ + &pNc, /* TODO: special handling for 6to4svc.dll ???, i.e. several retrieves */ + &lpszApp ); + Assert(hr == S_OK); + if(hr == S_OK) + { + hr = vboxNetCfgWinEnumNetCfgComponents(pNc, + &GUID_DEVCLASS_NETSERVICE, + vboxNetCfgWinAdjustHostOnlyNetworkInterfacePriority, + pGuid); + Assert(hr == S_OK); + + hr = vboxNetCfgWinEnumNetCfgComponents(pNc, + &GUID_DEVCLASS_NETTRANS, + vboxNetCfgWinAdjustHostOnlyNetworkInterfacePriority, + pGuid); + Assert(hr == S_OK); + + hr = vboxNetCfgWinEnumNetCfgComponents(pNc, + &GUID_DEVCLASS_NETCLIENT, + vboxNetCfgWinAdjustHostOnlyNetworkInterfacePriority, + pGuid); + Assert(hr == S_OK); + + if(hr == S_OK) + { + hr = pNc->Apply(); + Assert(hr == S_OK); + } + + VBoxNetCfgWinReleaseINetCfg(pNc, TRUE); + } + else if(hr == NETCFG_E_NO_WRITE_LOCK && lpszApp) + { + Log(L"VBoxNetCfgWinCreateHostOnlyNetworkInterface: app %s is holding the lock, failed\n", lpszApp); + CoTaskMemFree(lpszApp); + } + else + { + Log(L"VBoxNetCfgWinCreateHostOnlyNetworkInterface: VBoxNetCfgWinQueryINetCfgEx failed, hr 0x%x\n", hr); + } + } + + return hrc; +} + +#undef SetErrBreak + +#define VBOX_CONNECTION_NAME L"VirtualBox Host-Only Network" +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGenHostonlyConnectionName (PCWSTR DevName, WCHAR *pBuf, PULONG pcbBuf) +{ + const WCHAR * pSuffix = wcsrchr( DevName, L'#' ); + ULONG cbSize = sizeof(VBOX_CONNECTION_NAME); + ULONG cbSufSize = 0; + + if(pSuffix) + { + cbSize += (ULONG)wcslen(pSuffix) * 2; + cbSize += 2; /* for space */ + } + + if(*pcbBuf < cbSize) + { + *pcbBuf = cbSize; + return E_FAIL; + } + + wcscpy(pBuf, VBOX_CONNECTION_NAME); + if(pSuffix) + { + wcscat(pBuf, L" "); + wcscat(pBuf, pSuffix); + } + + return S_OK; +} + +/* network settings config */ +/** + * Strong referencing operators. Used as a second argument to ComPtr<>/ComObjPtr<>. + */ +template <class C> +class ComStrongRef +{ +protected: + + static void addref (C *p) { p->AddRef(); } + static void release (C *p) { p->Release(); } +}; + +/** + * Weak referencing operators. Used as a second argument to ComPtr<>/ComObjPtr<>. + */ +template <class C> +class ComWeakRef +{ +protected: + + static void addref (C * /* p */) {} + static void release (C * /* p */) {} +}; + +/** + * Base template for smart COM pointers. Not intended to be used directly. + */ +template <class C, template <class> class RefOps = ComStrongRef> +class ComPtrBase : protected RefOps <C> +{ +public: + + /* special template to disable AddRef()/Release() */ + template <class I> + class NoAddRefRelease : public I + { + private: +#if !defined (VBOX_WITH_XPCOM) + STDMETHOD_(ULONG, AddRef)() = 0; + STDMETHOD_(ULONG, Release)() = 0; +#else /* !defined (VBOX_WITH_XPCOM) */ + NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; + NS_IMETHOD_(nsrefcnt) Release(void) = 0; +#endif /* !defined (VBOX_WITH_XPCOM) */ + }; + +protected: + + ComPtrBase () : p (NULL) {} + ComPtrBase (const ComPtrBase &that) : p (that.p) { addref(); } + ComPtrBase (C *that_p) : p (that_p) { addref(); } + + ~ComPtrBase() { release(); } + + ComPtrBase &operator= (const ComPtrBase &that) + { + safe_assign (that.p); + return *this; + } + + ComPtrBase &operator= (C *that_p) + { + safe_assign (that_p); + return *this; + } + +public: + + void setNull() + { + release(); + p = NULL; + } + + bool isNull() const + { + return (p == NULL); + } + + bool operator! () const { return isNull(); } + + bool operator< (C* that_p) const { return p < that_p; } + bool operator== (C* that_p) const { return p == that_p; } + + template <class I> + bool equalsTo (I *aThat) const + { + return ComPtrEquals (p, aThat); + } + + template <class OC> + bool equalsTo (const ComPtrBase <OC> &oc) const + { + return equalsTo ((OC *) oc); + } + + /** Intended to pass instances as in parameters to interface methods */ + operator C* () const { return p; } + + /** + * Dereferences the instance (redirects the -> operator to the managed + * pointer). + */ + NoAddRefRelease <C> *operator-> () const + { + AssertMsg (p, ("Managed pointer must not be null\n")); + return (NoAddRefRelease <C> *) p; + } + + template <class I> + HRESULT queryInterfaceTo (I **pp) const + { + if (pp) + { + if (p) + { + return p->QueryInterface (COM_IIDOF (I), (void **) pp); + } + else + { + *pp = NULL; + return S_OK; + } + } + + return E_INVALIDARG; + } + + /** Intended to pass instances as out parameters to interface methods */ + C **asOutParam() + { + setNull(); + return &p; + } + +private: + + void addref() + { + if (p) + RefOps <C>::addref (p); + } + + void release() + { + if (p) + RefOps <C>::release (p); + } + + void safe_assign (C *that_p) + { + /* be aware of self-assignment */ + if (that_p) + RefOps <C>::addref (that_p); + release(); + p = that_p; + } + + C *p; +}; + +/** + * Smart COM pointer wrapper that automatically manages refcounting of + * interface pointers. + * + * @param I COM interface class + */ +template <class I, template <class> class RefOps = ComStrongRef> +class ComPtr : public ComPtrBase <I, RefOps> +{ + typedef ComPtrBase <I, RefOps> Base; + +public: + + ComPtr () : Base() {} + ComPtr (const ComPtr &that) : Base (that) {} + ComPtr &operator= (const ComPtr &that) + { + Base::operator= (that); + return *this; + } + + template <class OI> + ComPtr (OI *that_p) : Base () { operator= (that_p); } + + /* specialization for I */ + ComPtr (I *that_p) : Base (that_p) {} + + template <class OC> + ComPtr (const ComPtr <OC, RefOps> &oc) : Base () { operator= ((OC *) oc); } + + template <class OI> + ComPtr &operator= (OI *that_p) + { + if (that_p) + that_p->QueryInterface (COM_IIDOF (I), (void **) Base::asOutParam()); + else + Base::setNull(); + return *this; + } + + /* specialization for I */ + ComPtr &operator=(I *that_p) + { + Base::operator= (that_p); + return *this; + } + + template <class OC> + ComPtr &operator= (const ComPtr <OC, RefOps> &oc) + { + return operator= ((OC *) oc); + } +}; + +static HRESULT netIfWinFindAdapterClassById(IWbemServices * pSvc, const GUID * pGuid, IWbemClassObject **pAdapterConfig) +{ + HRESULT hres; + WCHAR aQueryString[256]; + WCHAR GuidString[50]; + + int length = StringFromGUID2(*pGuid, GuidString, sizeof(GuidString)/sizeof(GuidString[0])); + if(length) + { + swprintf(aQueryString, L"SELECT * FROM Win32_NetworkAdapterConfiguration WHERE SettingID = \"%s\"", GuidString); + // Step 6: -------------------------------------------------- + // Use the IWbemServices pointer to make requests of WMI ---- + + IEnumWbemClassObject* pEnumerator = NULL; + hres = pSvc->ExecQuery( + bstr_t("WQL"), + bstr_t(aQueryString), + WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, + NULL, + &pEnumerator); + if(SUCCEEDED(hres)) + { + // Step 7: ------------------------------------------------- + // Get the data from the query in step 6 ------------------- + + IWbemClassObject *pclsObj; + ULONG uReturn = 0; + + if (pEnumerator) + { + HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, + &pclsObj, &uReturn); + + if(SUCCEEDED(hres)) + { + if(uReturn) + { + pEnumerator->Release(); + *pAdapterConfig = pclsObj; + hres = S_OK; + return hres; + } + else + { + hres = S_FALSE; + } + } + + pEnumerator->Release(); + } + } + else + { + Log(L"Query for operating system name failed. Error code = 0x%x\n", hres); + } + } + else + { + DWORD winEr = GetLastError(); + Log(L"Failed to create guid string from guid, winEr (%d)\n", winEr); + hres = HRESULT_FROM_WIN32( winEr ); + } + + return hres; +} + +static HRESULT netIfWinIsHostOnly(IWbemClassObject * pAdapterConfig, BOOL * pbIsHostOnly) +{ + VARIANT vtServiceName; + BOOL bIsHostOnly = FALSE; + VariantInit(&vtServiceName); + + HRESULT hr = pAdapterConfig->Get(L"ServiceName", 0, &vtServiceName, 0, 0); + if(SUCCEEDED(hr)) + { + *pbIsHostOnly = (bstr_t(vtServiceName.bstrVal) == bstr_t("VBoxNetAdp")); + + VariantClear(&vtServiceName); + } + + return hr; +} + +static HRESULT netIfWinGetIpSettings(IWbemClassObject * pAdapterConfig, ULONG *pIpv4, ULONG *pMaskv4) +{ + VARIANT vtIp; + HRESULT hr; + VariantInit(&vtIp); + + *pIpv4 = 0; + *pMaskv4 = 0; + + hr = pAdapterConfig->Get(L"IPAddress", 0, &vtIp, 0, 0); + if(SUCCEEDED(hr)) + { + if(vtIp.vt == (VT_ARRAY | VT_BSTR)) + { + VARIANT vtMask; + VariantInit(&vtMask); + hr = pAdapterConfig->Get(L"IPSubnet", 0, &vtMask, 0, 0); + if(SUCCEEDED(hr)) + { + if(vtMask.vt == (VT_ARRAY | VT_BSTR)) + { + SAFEARRAY * pIpArray = vtIp.parray; + SAFEARRAY * pMaskArray = vtMask.parray; + if(pIpArray && pMaskArray) + { + BSTR pCurIp; + BSTR pCurMask; + for(long index = 0; + SafeArrayGetElement(pIpArray, &index, (PVOID)&pCurIp) == S_OK + && SafeArrayGetElement(pMaskArray, &index, (PVOID)&pCurMask) == S_OK; + index++) + { + _bstr_t ip(pCurIp); + + ULONG Ipv4 = inet_addr((char*)(ip)); + if(Ipv4 != INADDR_NONE) + { + *pIpv4 = Ipv4; + _bstr_t mask(pCurMask); + *pMaskv4 = inet_addr((char*)(mask)); + break; + } + } + } + } + else + { + *pIpv4 = 0; + *pMaskv4 = 0; + } + + VariantClear(&vtMask); + } + } + else + { + *pIpv4 = 0; + *pMaskv4 = 0; + } + + VariantClear(&vtIp); + } + + return hr; +} + + +static HRESULT netIfWinHasIpSettings(IWbemClassObject * pAdapterConfig, SAFEARRAY * pCheckIp, SAFEARRAY * pCheckMask, bool *pFound) +{ + VARIANT vtIp; + HRESULT hr; + VariantInit(&vtIp); + + *pFound = false; + + hr = pAdapterConfig->Get(L"IPAddress", 0, &vtIp, 0, 0); + if(SUCCEEDED(hr)) + { + VARIANT vtMask; + VariantInit(&vtMask); + hr = pAdapterConfig->Get(L"IPSubnet", 0, &vtMask, 0, 0); + if(SUCCEEDED(hr)) + { + SAFEARRAY * pIpArray = vtIp.parray; + SAFEARRAY * pMaskArray = vtMask.parray; + if(pIpArray && pMaskArray) + { + BSTR pIp, pMask; + for(long k = 0; + SafeArrayGetElement(pCheckIp, &k, (PVOID)&pIp) == S_OK + && SafeArrayGetElement(pCheckMask, &k, (PVOID)&pMask) == S_OK; + k++) + { + BSTR pCurIp; + BSTR pCurMask; + for(long index = 0; + SafeArrayGetElement(pIpArray, &index, (PVOID)&pCurIp) == S_OK + && SafeArrayGetElement(pMaskArray, &index, (PVOID)&pCurMask) == S_OK; + index++) + { + if(!wcsicmp(pCurIp, pIp)) + { + if(!wcsicmp(pCurMask, pMask)) + { + *pFound = true; + } + break; + } + } + } + } + + + VariantClear(&vtMask); + } + + VariantClear(&vtIp); + } + + return hr; +} + +static HRESULT netIfWinWaitIpSettings(IWbemServices *pSvc, const GUID * pGuid, SAFEARRAY * pCheckIp, SAFEARRAY * pCheckMask, ULONG sec2Wait, bool *pFound) +{ + /* on Vista we need to wait for the address to get applied */ + /* wait for the address to appear in the list */ + HRESULT hr = S_OK; + ULONG i; + *pFound = false; + ComPtr <IWbemClassObject> pAdapterConfig; + for(i = 0; + (hr = netIfWinFindAdapterClassById(pSvc, pGuid, pAdapterConfig.asOutParam())) == S_OK + && (hr = netIfWinHasIpSettings(pAdapterConfig, pCheckIp, pCheckMask, pFound)) == S_OK + && !(*pFound) + && i < sec2Wait/6; + i++) + { + Sleep(6000); + } + + return hr; +} + +static HRESULT netIfWinCreateIWbemServices(IWbemServices ** ppSvc) +{ + HRESULT hres; + + // Step 3: --------------------------------------------------- + // Obtain the initial locator to WMI ------------------------- + + IWbemLocator *pLoc = NULL; + + hres = CoCreateInstance( + CLSID_WbemLocator, + 0, + CLSCTX_INPROC_SERVER, + IID_IWbemLocator, (LPVOID *) &pLoc); + if(SUCCEEDED(hres)) + { + // Step 4: ----------------------------------------------------- + // Connect to WMI through the IWbemLocator::ConnectServer method + + IWbemServices *pSvc = NULL; + + // Connect to the root\cimv2 namespace with + // the current user and obtain pointer pSvc + // to make IWbemServices calls. + hres = pLoc->ConnectServer( + _bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace + NULL, // User name. NULL = current user + NULL, // User password. NULL = current + 0, // Locale. NULL indicates current + NULL, // Security flags. + 0, // Authority (e.g. Kerberos) + 0, // Context object + &pSvc // pointer to IWbemServices proxy + ); + if(SUCCEEDED(hres)) + { + Log(L"Connected to ROOT\\CIMV2 WMI namespace\n"); + + // Step 5: -------------------------------------------------- + // Set security levels on the proxy ------------------------- + + hres = CoSetProxyBlanket( + pSvc, // Indicates the proxy to set + RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx + RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx + NULL, // Server principal name + RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx + RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx + NULL, // client identity + EOAC_NONE // proxy capabilities + ); + if(SUCCEEDED(hres)) + { + *ppSvc = pSvc; + /* do not need it any more */ + pLoc->Release(); + return hres; + } + else + { + Log(L"Could not set proxy blanket. Error code = 0x%x\n", hres); + } + + pSvc->Release(); + } + else + { + Log(L"Could not connect. Error code = 0x%x\n", hres); + } + + pLoc->Release(); + } + else + { + Log(L"Failed to create IWbemLocator object. Err code = 0x%x\n", hres); +// CoUninitialize(); + } + + return hres; +} + +static HRESULT netIfWinAdapterConfigPath(IWbemClassObject *pObj, BSTR * pStr) +{ + VARIANT index; + + // Get the value of the key property + HRESULT hr = pObj->Get(L"Index", 0, &index, 0, 0); + if(SUCCEEDED(hr)) + { + WCHAR strIndex[8]; + swprintf(strIndex, L"%u", index.uintVal); + *pStr = (bstr_t(L"Win32_NetworkAdapterConfiguration.Index='") + strIndex + "'").copy(); + } + else + { + DWORD dwError = GetLastError(); + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + return hr; +} + +static HRESULT netIfExecMethod(IWbemServices * pSvc, IWbemClassObject *pClass, BSTR ObjPath, + BSTR MethodName, LPWSTR *pArgNames, LPVARIANT *pArgs, UINT cArgs, + IWbemClassObject** ppOutParams + ) +{ + HRESULT hres = S_OK; + // Step 6: -------------------------------------------------- + // Use the IWbemServices pointer to make requests of WMI ---- + + ComPtr<IWbemClassObject> pInParamsDefinition; + ComPtr<IWbemClassObject> pClassInstance; + + if(cArgs) + { + hres = pClass->GetMethod(MethodName, 0, + pInParamsDefinition.asOutParam(), NULL); + if(SUCCEEDED(hres)) + { + hres = pInParamsDefinition->SpawnInstance(0, pClassInstance.asOutParam()); + + if(SUCCEEDED(hres)) + { + for(UINT i = 0; i < cArgs; i++) + { + // Store the value for the in parameters + hres = pClassInstance->Put(pArgNames[i], 0, + pArgs[i], 0); + if(FAILED(hres)) + { + break; + } + } + } + } + } + + if(SUCCEEDED(hres)) + { + IWbemClassObject* pOutParams = NULL; + hres = pSvc->ExecMethod(ObjPath, MethodName, 0, + NULL, pClassInstance, &pOutParams, NULL); + if(SUCCEEDED(hres)) + { + *ppOutParams = pOutParams; + } + } + + return hres; +} + +static HRESULT netIfWinCreateIpArray(SAFEARRAY **ppArray, in_addr* aIp, UINT cIp) +{ + HRESULT hr; + SAFEARRAY * pIpArray = SafeArrayCreateVector(VT_BSTR, 0, cIp); + if(pIpArray) + { + for(UINT i = 0; i < cIp; i++) + { + char* addr = inet_ntoa(aIp[i]); + BSTR val = bstr_t(addr).copy(); + long aIndex[1]; + aIndex[0] = i; + hr = SafeArrayPutElement(pIpArray, aIndex, val); + if(FAILED(hr)) + { + SysFreeString(val); + SafeArrayDestroy(pIpArray); + break; + } + } + + if(SUCCEEDED(hr)) + { + *ppArray = pIpArray; + } + } + else + { + DWORD dwError = GetLastError(); + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + + return hr; +} + +static HRESULT netIfWinCreateIpArrayV4V6(SAFEARRAY **ppArray, BSTR Ip) +{ + HRESULT hr; + SAFEARRAY * pIpArray = SafeArrayCreateVector(VT_BSTR, 0, 1); + if(pIpArray) + { + BSTR val = bstr_t(Ip, false).copy(); + long aIndex[1]; + aIndex[0] = 0; + hr = SafeArrayPutElement(pIpArray, aIndex, val); + if(FAILED(hr)) + { + SysFreeString(val); + SafeArrayDestroy(pIpArray); + } + + if(SUCCEEDED(hr)) + { + *ppArray = pIpArray; + } + } + else + { + DWORD dwError = GetLastError(); + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + + return hr; +} + + +static HRESULT netIfWinCreateIpArrayVariantV4(VARIANT * pIpAddresses, in_addr* aIp, UINT cIp) +{ + HRESULT hr; + VariantInit(pIpAddresses); + pIpAddresses->vt = VT_ARRAY | VT_BSTR; + SAFEARRAY *pIpArray; + hr = netIfWinCreateIpArray(&pIpArray, aIp, cIp); + if(SUCCEEDED(hr)) + { + pIpAddresses->parray = pIpArray; + } + return hr; +} + +static HRESULT netIfWinCreateIpArrayVariantV4V6(VARIANT * pIpAddresses, BSTR Ip) +{ + HRESULT hr; + VariantInit(pIpAddresses); + pIpAddresses->vt = VT_ARRAY | VT_BSTR; + SAFEARRAY *pIpArray; + hr = netIfWinCreateIpArrayV4V6(&pIpArray, Ip); + if(SUCCEEDED(hr)) + { + pIpAddresses->parray = pIpArray; + } + return hr; +} + +static HRESULT netIfWinEnableStatic(IWbemServices * pSvc, const GUID * pGuid, BSTR ObjPath, VARIANT * pIp, VARIANT * pMask) +{ + ComPtr<IWbemClassObject> pClass; + BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration"); + HRESULT hr; + if(ClassName) + { + hr = pSvc->GetObject(ClassName, 0, NULL, pClass.asOutParam(), NULL); + if(SUCCEEDED(hr)) + { + LPWSTR argNames[] = {L"IPAddress", L"SubnetMask"}; + LPVARIANT args[] = {pIp, pMask}; + ComPtr<IWbemClassObject> pOutParams; + + hr = netIfExecMethod(pSvc, pClass, ObjPath, + bstr_t(L"EnableStatic"), argNames, args, 2, pOutParams.asOutParam()); + if(SUCCEEDED(hr)) + { + VARIANT varReturnValue; + hr = pOutParams->Get(bstr_t(L"ReturnValue"), 0, + &varReturnValue, NULL, 0); + Assert(SUCCEEDED(hr)); + if(SUCCEEDED(hr)) + { +// Assert(varReturnValue.vt == VT_UINT); + int winEr = varReturnValue.uintVal; + switch(winEr) + { + case 0: + { + hr = S_OK; +// bool bFound; +// HRESULT tmpHr = netIfWinWaitIpSettings(pSvc, pGuid, pIp->parray, pMask->parray, 180, &bFound); + } + break; + default: + hr = HRESULT_FROM_WIN32( winEr ); + break; + } + } + } + } + SysFreeString(ClassName); + } + else + { + DWORD dwError = GetLastError(); + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + + return hr; +} + + +static HRESULT netIfWinEnableStaticV4(IWbemServices * pSvc, const GUID * pGuid, BSTR ObjPath, in_addr* aIp, in_addr * aMask, UINT cIp) +{ + VARIANT ipAddresses; + HRESULT hr = netIfWinCreateIpArrayVariantV4(&ipAddresses, aIp, cIp); + if(SUCCEEDED(hr)) + { + VARIANT ipMasks; + hr = netIfWinCreateIpArrayVariantV4(&ipMasks, aMask, cIp); + if(SUCCEEDED(hr)) + { + hr = netIfWinEnableStatic(pSvc, pGuid, ObjPath, &ipAddresses, &ipMasks); + VariantClear(&ipMasks); + } + VariantClear(&ipAddresses); + } + return hr; +} + +static HRESULT netIfWinEnableStaticV4V6(IWbemServices * pSvc, const GUID * pGuid, BSTR ObjPath, BSTR Ip, BSTR Mask) +{ + VARIANT ipAddresses; + HRESULT hr = netIfWinCreateIpArrayVariantV4V6(&ipAddresses, Ip); + if(SUCCEEDED(hr)) + { + VARIANT ipMasks; + hr = netIfWinCreateIpArrayVariantV4V6(&ipMasks, Mask); + if(SUCCEEDED(hr)) + { + hr = netIfWinEnableStatic(pSvc, pGuid, ObjPath, &ipAddresses, &ipMasks); + VariantClear(&ipMasks); + } + VariantClear(&ipAddresses); + } + return hr; +} + +/* win API allows to set gw metrics as well, we are not setting them */ +static HRESULT netIfWinSetGateways(IWbemServices * pSvc, BSTR ObjPath, VARIANT * pGw) +{ + ComPtr<IWbemClassObject> pClass; + BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration"); + HRESULT hr; + if(ClassName) + { + hr = pSvc->GetObject(ClassName, 0, NULL, pClass.asOutParam(), NULL); + if(SUCCEEDED(hr)) + { + LPWSTR argNames[] = {L"DefaultIPGateway"}; + LPVARIANT args[] = {pGw}; + ComPtr<IWbemClassObject> pOutParams; + + hr = netIfExecMethod(pSvc, pClass, ObjPath, + bstr_t(L"SetGateways"), argNames, args, 1, pOutParams.asOutParam()); + if(SUCCEEDED(hr)) + { + VARIANT varReturnValue; + hr = pOutParams->Get(bstr_t(L"ReturnValue"), 0, + &varReturnValue, NULL, 0); + Assert(SUCCEEDED(hr)); + if(SUCCEEDED(hr)) + { +// Assert(varReturnValue.vt == VT_UINT); + int winEr = varReturnValue.uintVal; + switch(winEr) + { + case 0: + hr = S_OK; + break; + default: + hr = HRESULT_FROM_WIN32( winEr ); + break; + } + } + } } + SysFreeString(ClassName); + } + else + { + DWORD dwError = GetLastError(); + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + + return hr; +} + +/* win API allows to set gw metrics as well, we are not setting them */ +static HRESULT netIfWinSetGatewaysV4(IWbemServices * pSvc, BSTR ObjPath, in_addr* aGw, UINT cGw) +{ + VARIANT gwais; + HRESULT hr = netIfWinCreateIpArrayVariantV4(&gwais, aGw, cGw); + if(SUCCEEDED(hr)) + { + netIfWinSetGateways(pSvc, ObjPath, &gwais); + VariantClear(&gwais); + } + return hr; +} + +/* win API allows to set gw metrics as well, we are not setting them */ +static HRESULT netIfWinSetGatewaysV4V6(IWbemServices * pSvc, BSTR ObjPath, BSTR Gw) +{ + VARIANT vGw; + HRESULT hr = netIfWinCreateIpArrayVariantV4V6(&vGw, Gw); + if(SUCCEEDED(hr)) + { + netIfWinSetGateways(pSvc, ObjPath, &vGw); + VariantClear(&vGw); + } + return hr; +} + +static HRESULT netIfWinEnableDHCP(IWbemServices * pSvc, BSTR ObjPath) +{ + ComPtr<IWbemClassObject> pClass; + BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration"); + HRESULT hr; + if(ClassName) + { + hr = pSvc->GetObject(ClassName, 0, NULL, pClass.asOutParam(), NULL); + if(SUCCEEDED(hr)) + { + ComPtr<IWbemClassObject> pOutParams; + + hr = netIfExecMethod(pSvc, pClass, ObjPath, + bstr_t(L"EnableDHCP"), NULL, NULL, 0, pOutParams.asOutParam()); + if(SUCCEEDED(hr)) + { + VARIANT varReturnValue; + hr = pOutParams->Get(bstr_t(L"ReturnValue"), 0, + &varReturnValue, NULL, 0); + Assert(SUCCEEDED(hr)); + if(SUCCEEDED(hr)) + { +// Assert(varReturnValue.vt == VT_UINT); + int winEr = varReturnValue.uintVal; + switch(winEr) + { + case 0: + hr = S_OK; + break; + default: + hr = HRESULT_FROM_WIN32( winEr ); + break; + } + } + } + } + SysFreeString(ClassName); + } + else + { + DWORD dwError = GetLastError(); + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + + return hr; +} + +static HRESULT netIfWinDhcpRediscover(IWbemServices * pSvc, BSTR ObjPath) +{ + ComPtr<IWbemClassObject> pClass; + BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration"); + HRESULT hr; + if(ClassName) + { + hr = pSvc->GetObject(ClassName, 0, NULL, pClass.asOutParam(), NULL); + if(SUCCEEDED(hr)) + { + ComPtr<IWbemClassObject> pOutParams; + + hr = netIfExecMethod(pSvc, pClass, ObjPath, + bstr_t(L"ReleaseDHCPLease"), NULL, NULL, 0, pOutParams.asOutParam()); + if(SUCCEEDED(hr)) + { + VARIANT varReturnValue; + hr = pOutParams->Get(bstr_t(L"ReturnValue"), 0, + &varReturnValue, NULL, 0); + Assert(SUCCEEDED(hr)); + if(SUCCEEDED(hr)) + { +// Assert(varReturnValue.vt == VT_UINT); + int winEr = varReturnValue.uintVal; + if(winEr == 0) + { + hr = netIfExecMethod(pSvc, pClass, ObjPath, + bstr_t(L"RenewDHCPLease"), NULL, NULL, 0, pOutParams.asOutParam()); + if(SUCCEEDED(hr)) + { + VARIANT varReturnValue; + hr = pOutParams->Get(bstr_t(L"ReturnValue"), 0, + &varReturnValue, NULL, 0); + Assert(SUCCEEDED(hr)); + if(SUCCEEDED(hr)) + { + // Assert(varReturnValue.vt == VT_UINT); + int winEr = varReturnValue.uintVal; + if(winEr == 0) + { + hr = S_OK; + } + else + { + hr = HRESULT_FROM_WIN32( winEr ); + } + } + } + } + else + { + hr = HRESULT_FROM_WIN32( winEr ); + } + } + } + } + SysFreeString(ClassName); + } + else + { + DWORD dwError = GetLastError(); + Assert(0); + hr = HRESULT_FROM_WIN32( dwError ); + } + + return hr; +} + +static HRESULT vboxNetCfgWinIsDhcpEnabled(IWbemClassObject * pAdapterConfig, BOOL *pEnabled) +{ + VARIANT vtEnabled; + HRESULT hr = pAdapterConfig->Get(L"DHCPEnabled", 0, &vtEnabled, 0, 0); + if(SUCCEEDED(hr)) + { + *pEnabled = vtEnabled.boolVal; + } + return hr; +} + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetAdapterSettings(const GUID * pGuid, PADAPTER_SETTINGS pSettings) +{ + HRESULT hr; + ComPtr <IWbemServices> pSvc; + hr = netIfWinCreateIWbemServices(pSvc.asOutParam()); + if(SUCCEEDED(hr)) + { + ComPtr <IWbemClassObject> pAdapterConfig; + hr = netIfWinFindAdapterClassById(pSvc, pGuid, pAdapterConfig.asOutParam()); + if(hr == S_OK) + { + hr = vboxNetCfgWinIsDhcpEnabled(pAdapterConfig, &pSettings->bDhcp); + if(SUCCEEDED(hr)) + { + hr = netIfWinGetIpSettings(pAdapterConfig, &pSettings->ip, &pSettings->mask); + } + } + } + + return hr; +} + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinIsDhcpEnabled(const GUID * pGuid, BOOL *pEnabled) +{ + HRESULT hr; + ComPtr <IWbemServices> pSvc; + hr = netIfWinCreateIWbemServices(pSvc.asOutParam()); + if(SUCCEEDED(hr)) + { + ComPtr <IWbemClassObject> pAdapterConfig; + hr = netIfWinFindAdapterClassById(pSvc, pGuid, pAdapterConfig.asOutParam()); + if(hr == S_OK) + { + VARIANT vtEnabled; + hr = pAdapterConfig->Get(L"DHCPEnabled", 0, &vtEnabled, 0, 0); + if(SUCCEEDED(hr)) + { + *pEnabled = vtEnabled.boolVal; + } + } + } + + return hr; +} + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnableStaticIpConfig(const GUID *pGuid, ULONG ip, ULONG mask) +{ + HRESULT hr; + ComPtr <IWbemServices> pSvc; + hr = netIfWinCreateIWbemServices(pSvc.asOutParam()); + if(SUCCEEDED(hr)) + { + ComPtr <IWbemClassObject> pAdapterConfig; + hr = netIfWinFindAdapterClassById(pSvc, pGuid, pAdapterConfig.asOutParam()); + if(hr == S_OK) + { + BOOL bIsHostOnly; + hr = netIfWinIsHostOnly(pAdapterConfig, &bIsHostOnly); + if(SUCCEEDED(hr)) + { + if(bIsHostOnly) + { + in_addr aIp[1]; + in_addr aMask[1]; + aIp[0].S_un.S_addr = ip; + aMask[0].S_un.S_addr = mask; + + BSTR ObjPath; + hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath); + if(SUCCEEDED(hr)) + { + hr = netIfWinEnableStaticV4(pSvc, pGuid, ObjPath, aIp, aMask, ip != 0 ? 1 : 0); + if(SUCCEEDED(hr)) + { +#if 0 + in_addr aGw[1]; + aGw[0].S_un.S_addr = gw; + hr = netIfWinSetGatewaysV4(pSvc, ObjPath, aGw, 1); + if(SUCCEEDED(hr)) +#endif + { + } + } + SysFreeString(ObjPath); + } + } + else + { + hr = E_FAIL; + } + } + } + } + + return hr; +} + +#if 0 +static HRESULT netIfEnableStaticIpConfigV6(const GUID *pGuid, IN_BSTR aIPV6Address, IN_BSTR aIPV6Mask, IN_BSTR aIPV6DefaultGateway) +{ + HRESULT hr; + ComPtr <IWbemServices> pSvc; + hr = netIfWinCreateIWbemServices(pSvc.asOutParam()); + if(SUCCEEDED(hr)) + { + ComPtr <IWbemClassObject> pAdapterConfig; + hr = netIfWinFindAdapterClassById(pSvc, pGuid, pAdapterConfig.asOutParam()); + if(hr == S_OK) + { + BSTR ObjPath; + hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath); + if(SUCCEEDED(hr)) + { + hr = netIfWinEnableStaticV4V6(pSvc, pAdapterConfig, ObjPath, aIPV6Address, aIPV6Mask); + if(SUCCEEDED(hr)) + { + if(aIPV6DefaultGateway) + { + hr = netIfWinSetGatewaysV4V6(pSvc, ObjPath, aIPV6DefaultGateway); + } + if(SUCCEEDED(hr)) + { +// hr = netIfWinUpdateConfig(pIf); + } + } + SysFreeString(ObjPath); + } + } + } + + return SUCCEEDED(hr) ? VINF_SUCCESS : VERR_GENERAL_FAILURE; +} + +static HRESULT netIfEnableStaticIpConfigV6(const GUID *pGuid, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength) +{ + RTNETADDRIPV6 Mask; + int rc = prefixLength2IPv6Address(aIPV6MaskPrefixLength, &Mask); + if(RT_SUCCESS(rc)) + { + Bstr maskStr = composeIPv6Address(&Mask); + rc = netIfEnableStaticIpConfigV6(pGuid, aIPV6Address, maskStr, NULL); + } + return rc; +} +#endif + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnableDynamicIpConfig(const GUID *pGuid) +{ + HRESULT hr; + ComPtr <IWbemServices> pSvc; + hr = netIfWinCreateIWbemServices(pSvc.asOutParam()); + if(SUCCEEDED(hr)) + { + ComPtr <IWbemClassObject> pAdapterConfig; + hr = netIfWinFindAdapterClassById(pSvc, pGuid, pAdapterConfig.asOutParam()); + if(hr == S_OK) + { + BOOL bIsHostOnly; + hr = netIfWinIsHostOnly(pAdapterConfig, &bIsHostOnly); + if(SUCCEEDED(hr)) + { + if(bIsHostOnly) + { + BSTR ObjPath; + hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath); + if(SUCCEEDED(hr)) + { + hr = netIfWinEnableDHCP(pSvc, ObjPath); + if(SUCCEEDED(hr)) + { +// hr = netIfWinUpdateConfig(pIf); + } + SysFreeString(ObjPath); + } + } + else + { + hr = E_FAIL; + } + } + } + } + + + return hr; +} + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinDhcpRediscover(const GUID *pGuid) +{ + HRESULT hr; + ComPtr <IWbemServices> pSvc; + hr = netIfWinCreateIWbemServices(pSvc.asOutParam()); + if(SUCCEEDED(hr)) + { + ComPtr <IWbemClassObject> pAdapterConfig; + hr = netIfWinFindAdapterClassById(pSvc, pGuid, pAdapterConfig.asOutParam()); + if(hr == S_OK) + { + BOOL bIsHostOnly; + hr = netIfWinIsHostOnly(pAdapterConfig, &bIsHostOnly); + if(SUCCEEDED(hr)) + { + if(bIsHostOnly) + { + BSTR ObjPath; + hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath); + if(SUCCEEDED(hr)) + { + hr = netIfWinDhcpRediscover(pSvc, ObjPath); + if(SUCCEEDED(hr)) + { +// hr = netIfWinUpdateConfig(pIf); + } + SysFreeString(ObjPath); + } + } + else + { + hr = E_FAIL; + } + } + } + } + + + return hr; +} + +typedef bool (*IPSETTINGS_CALLBACK) (ULONG ip, ULONG mask, PVOID pContext); + +static void vboxNetCfgWinEnumIpConfig(PIP_ADAPTER_ADDRESSES pAddresses, IPSETTINGS_CALLBACK pCallback, PVOID pContext) +{ + PIP_ADAPTER_ADDRESSES pAdapter; + for (pAdapter = pAddresses; pAdapter; pAdapter = pAdapter->Next) + { + PIP_ADAPTER_UNICAST_ADDRESS pAddr = pAdapter->FirstUnicastAddress; + PIP_ADAPTER_PREFIX pPrefix = pAdapter->FirstPrefix; + + if(pAddr && pPrefix) + { + do + { + bool fIPFound, fMaskFound; + fIPFound = fMaskFound = false; + ULONG ip, mask; + for (; pAddr && !fIPFound; pAddr = pAddr->Next) + { + switch (pAddr->Address.lpSockaddr->sa_family) + { + case AF_INET: + fIPFound = true; + memcpy(&ip, + &((struct sockaddr_in *)pAddr->Address.lpSockaddr)->sin_addr.s_addr, + sizeof(ip)); + break; +// case AF_INET6: +// break; + } + } + + for (; pPrefix && !fMaskFound; pPrefix = pPrefix->Next) + { + switch (pPrefix->Address.lpSockaddr->sa_family) + { + case AF_INET: + if(!pPrefix->PrefixLength || pPrefix->PrefixLength > 31) /* in case the ip helper API is queried while NetCfg write lock is held */ + break; /* the address values can contain illegal values */ + fMaskFound = true; + mask = (~(((ULONG)~0) >> pPrefix->PrefixLength)); + mask = htonl(mask); + break; +// case AF_INET6: +// break; + } + } + + if(!fIPFound || !fMaskFound) + break; + + if(!pCallback(ip, mask, pContext)) + return; + }while(true); + } + } +} + +typedef struct _IPPROBE_CONTEXT +{ + ULONG Prefix; + bool bConflict; +}IPPROBE_CONTEXT, *PIPPROBE_CONTEXT; + +#define IPPROBE_INIT(_pContext, _addr) \ + ((_pContext)->bConflict = false, \ + (_pContext)->Prefix = _addr) + +#define IPPROBE_INIT_STR(_pContext, _straddr) \ + IPROBE_INIT(_pContext, inet_addr(_straddr)) + +static bool vboxNetCfgWinIpProbeCallback (ULONG ip, ULONG mask, PVOID pContext) +{ + PIPPROBE_CONTEXT pProbe = (PIPPROBE_CONTEXT)pContext; + + if((ip & mask) == (pProbe->Prefix & mask)) + { + pProbe->bConflict = true; + return false; + } + + return true; +} + +VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGenHostOnlyNetworkNetworkIp(PULONG pNetIp, PULONG pNetMask) +{ + DWORD dwRc; + HRESULT hr = S_OK; + /* + * Most of the hosts probably have less than 10 adapters, + * so we'll mostly succeed from the first attempt. + */ + ULONG uBufLen = sizeof(IP_ADAPTER_ADDRESSES) * 10; + PIP_ADAPTER_ADDRESSES pAddresses = (PIP_ADAPTER_ADDRESSES)malloc(uBufLen); + if (!pAddresses) + return HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); + dwRc = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, pAddresses, &uBufLen); + if (dwRc == ERROR_BUFFER_OVERFLOW) + { + /* Impressive! More than 10 adapters! Get more memory and try again. */ + free(pAddresses); + pAddresses = (PIP_ADAPTER_ADDRESSES)malloc(uBufLen); + if (!pAddresses) + return HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); + dwRc = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, pAddresses, &uBufLen); + } + if (dwRc == NO_ERROR) + { + IPPROBE_CONTEXT Context; + const ULONG ip192168 = inet_addr("192.168.0.0"); + srand(GetTickCount()); + + *pNetIp = 0; + *pNetMask = 0; + + for(int i = 0; i < 255; i++) + { + ULONG ipProbe = rand()*255/RAND_MAX; + ipProbe = ip192168 | (ipProbe << 16); + IPPROBE_INIT(&Context, ipProbe); + vboxNetCfgWinEnumIpConfig(pAddresses, vboxNetCfgWinIpProbeCallback, &Context); + if(!Context.bConflict) + { + *pNetIp = ipProbe; + *pNetMask = inet_addr("255.255.255.0"); + break; + } + } + if(*pNetIp == 0) + dwRc = ERROR_DHCP_ADDRESS_CONFLICT; + } + else + { + Log(L"VBoxNetCfgWinGenHostOnlyNetworkNetworkIp: GetAdaptersAddresses err (%d)\n", dwRc); + } + free(pAddresses); + + if(dwRc != NO_ERROR) + { + hr = HRESULT_FROM_WIN32(dwRc); + } + + return hr; +} diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/Makefile.kup b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/Makefile.kup new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/Makefile.kup diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.cpp new file mode 100644 index 000000000..07d7890e8 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.cpp @@ -0,0 +1,775 @@ +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Sample Notify Object + *+--------------------------------------------------------------------------- + * + * Microsoft Windows + * Copyright (C) Microsoft Corporation, 1992-2001. + * + * Author: Alok Sinha + * + *---------------------------------------------------------------------------- + */ +#include "VBoxNetFltNotify.h" +#include <Ntddndis.h> +#include <assert.h> +#include <stdio.h> + +#include <VBoxNetFltNotifyn_i.c> + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) + OBJECT_ENTRY(CLSID_VBoxNetFltNotify, VBoxNetFltNotify) +END_OBJECT_MAP() + +#define ReleaseObj( x ) if ( x ) \ + ((IUnknown*)(x))->Release(); + +//# define VBOXNETFLTNOTIFY_DEBUG_BIND true + +#ifdef DEBUG +# define Assert(a) assert(a) +# define AssertBreakpoint() assert(0) + +# define TraceMsg DbgTraceMsg +#else +# define Assert(a) do{}while(0) +# define AssertBreakpoint() do{}while(0) + +# define TraceMsg +#endif + + +static void DbgTraceMsg (LPWSTR szFormat, ...) +{ + static WCHAR szTempBuf[4096]; + + va_list arglist; + + va_start(arglist, szFormat); + + vswprintf( szTempBuf, szFormat, arglist ); + + OutputDebugStringW( szTempBuf ); + + va_end(arglist); +} + +VBoxNetFltNotify::VBoxNetFltNotify (VOID) : m_pncc (NULL), + m_pnc(NULL) + /*, + m_eApplyAction(eActUnknown), + m_pUnkContext(NULL)*/ +{ + TraceMsg(L"VBoxNetFltNotify\n"); +} + +VBoxNetFltNotify::~VBoxNetFltNotify (VOID) +{ + TraceMsg(L"-->~VBoxNetFltNotify (destructor)\n"); + ReleaseObj( m_pncc ); + ReleaseObj( m_pnc ); + TraceMsg(L"<--~VBoxNetFltNotify (destructor)\n"); +} + +/* + * NOTIFY OBJECT FUNCTIONS + */ + +/* + * INetCfgComponentControl + * + * The following functions provide the INetCfgComponentControl interface. + */ + +/** + * Initialize the notify object + * + * @param pnccItem Pointer to INetCfgComponent object + * @param pnc Pointer to INetCfg object + * @param fInstalling TRUE if we are being installed + * @return S_OK on success, otherwise an error code + */ +STDMETHODIMP VBoxNetFltNotify::Initialize (INetCfgComponent* pncc, + INetCfg* pnc, + BOOL fInstalling) +{ + HRESULT hr = S_OK; + + TraceMsg(L"-->Initialize\n"); + + m_pncc = pncc; + m_pnc = pnc; + + if (m_pncc) + { + m_pncc->AddRef(); + } + + if (m_pnc) + { + m_pnc->AddRef(); + } + + TraceMsg(L"<--Initialize\n"); + + return hr; +} + +/** + * Cancel any changes made to internal data + * @return S_OK on success, otherwise an error code + */ +STDMETHODIMP VBoxNetFltNotify::CancelChanges (VOID) +{ + TraceMsg(L"CancelChanges\n"); + return S_OK; +} + +/* + * Apply changes. We can make changes to registry etc. here. + * @return S_OK on success, otherwise an error code + */ +STDMETHODIMP VBoxNetFltNotify::ApplyRegistryChanges(VOID) +{ + TraceMsg(L"ApplyRegistryChanges\n"); + return S_OK; +} + +/** + * Apply changes. + * @param pfCallback PnPConfigCallback interface. + * @return S_OK on success, otherwise an error code + */ +STDMETHODIMP VBoxNetFltNotify::ApplyPnpChanges ( + INetCfgPnpReconfigCallback* pfCallback) +{ + TraceMsg(L"ApplyPnpChanges\n"); + return S_OK; +} + +static HRESULT vboxNetFltWinQueryInstanceKey(IN INetCfgComponent *pComponent, OUT PHKEY phKey) +{ + LPWSTR pPnpId; + HRESULT hr = pComponent->GetPnpDevNodeId(&pPnpId); + if(hr == S_OK) + { + WCHAR KeyName[MAX_PATH]; + wcscpy(KeyName, L"SYSTEM\\CurrentControlSet\\Enum\\"); + wcscat(KeyName,pPnpId); + + LONG winEr = RegOpenKeyExW(HKEY_LOCAL_MACHINE, KeyName, + 0, /*__reserved DWORD ulOptions*/ + KEY_READ, /*__in REGSAM samDesired*/ + phKey); + + if(winEr != ERROR_SUCCESS) + { + hr = HRESULT_FROM_WIN32(winEr); + TraceMsg(L"vboxNetFltWinQueryInstanceKey: RegOpenKeyExW error, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + CoTaskMemFree(pPnpId); + } + else + { + TraceMsg(L"vboxNetFltWinQueryInstanceKey: GetPnpDevNodeId error, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + return hr; +} + +static HRESULT vboxNetFltWinQueryDriverKey(IN HKEY InstanceKey, OUT PHKEY phKey) +{ + DWORD Type = REG_SZ; + WCHAR Value[MAX_PATH]; + DWORD cbValue = sizeof(Value); + HRESULT hr = S_OK; + LONG winEr = RegQueryValueExW(InstanceKey, + L"Driver", /*__in_opt LPCTSTR lpValueName*/ + 0, /*__reserved LPDWORD lpReserved*/ + &Type, /*__out_opt LPDWORD lpType*/ + (LPBYTE)Value, /*__out_opt LPBYTE lpData*/ + &cbValue/*__inout_opt LPDWORD lpcbData*/ + ); + + if(winEr == ERROR_SUCCESS) + { + WCHAR KeyName[MAX_PATH]; + wcscpy(KeyName, L"SYSTEM\\CurrentControlSet\\Control\\Class\\"); + wcscat(KeyName,Value); + + winEr = RegOpenKeyExW(HKEY_LOCAL_MACHINE, KeyName, + 0, /*__reserved DWORD ulOptions*/ + KEY_READ, /*__in REGSAM samDesired*/ + phKey); + + if(winEr != ERROR_SUCCESS) + { + hr = HRESULT_FROM_WIN32(winEr); + TraceMsg(L"vboxNetFltWinQueryDriverKey from instance key: RegOpenKeyExW error, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + } + else + { + hr = HRESULT_FROM_WIN32(winEr); + TraceMsg(L"vboxNetFltWinQueryDriverKey from instance key: RegQueryValueExW error, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + return hr; +} + +static HRESULT vboxNetFltWinQueryDriverKey(IN INetCfgComponent *pComponent, OUT PHKEY phKey) +{ + HKEY InstanceKey; + HRESULT hr = vboxNetFltWinQueryInstanceKey(pComponent, &InstanceKey); + if(hr == S_OK) + { + hr = vboxNetFltWinQueryDriverKey(InstanceKey, phKey); + if(hr != S_OK) + { + TraceMsg(L"vboxNetFltWinQueryDriverKey from Component: vboxNetFltWinQueryDriverKey error, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + RegCloseKey(InstanceKey); + } + else + { + TraceMsg(L"vboxNetFltWinQueryDriverKey from Component: vboxNetFltWinQueryInstanceKey error, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + return hr; +} + +static HRESULT vboxNetFltWinNotifyCheckNetAdp(IN INetCfgComponent *pComponent, OUT bool * pbShouldBind) +{ + HRESULT hr; + LPWSTR pDevId; + hr = pComponent->GetId(&pDevId); + if(hr == S_OK) + { + if(!_wcsnicmp(pDevId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2)) + { + *pbShouldBind = false; + } + else + { + hr = S_FALSE; + } + CoTaskMemFree(pDevId); + } + else + { + TraceMsg(L"vboxNetFltWinNotifyCheckNetAdp: GetId failed, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + return hr; +} + +static HRESULT vboxNetFltWinNotifyCheckMsLoop(IN INetCfgComponent *pComponent, OUT bool * pbShouldBind) +{ + HRESULT hr; + LPWSTR pDevId; + hr = pComponent->GetId(&pDevId); + if(hr == S_OK) + { + if(!_wcsnicmp(pDevId, L"*msloop", sizeof(L"*msloop")/2)) + { + /* we need to detect the medium the adapter is presenting + * to do that we could examine in the registry the *msloop params */ + HKEY DriverKey; + hr = vboxNetFltWinQueryDriverKey(pComponent, &DriverKey); + if(hr == S_OK) + { + DWORD Type = REG_SZ; + WCHAR Value[64]; /* 2 should be enough actually, paranoid check for extra spaces */ + DWORD cbValue = sizeof(Value); + LONG winEr = RegQueryValueExW(DriverKey, + L"Medium", /*__in_opt LPCTSTR lpValueName*/ + 0, /*__reserved LPDWORD lpReserved*/ + &Type, /*__out_opt LPDWORD lpType*/ + (LPBYTE)Value, /*__out_opt LPBYTE lpData*/ + &cbValue/*__inout_opt LPDWORD lpcbData*/ + ); + if(winEr == ERROR_SUCCESS) + { + PWCHAR endPrt; + ULONG enmMedium = wcstoul(Value, + &endPrt, + 0 /* base*/); + + winEr = errno; + if(winEr == ERROR_SUCCESS) + { + if(enmMedium == 0) /* 0 is Ethernet */ + { + TraceMsg(L"vboxNetFltWinNotifyCheckMsLoop: loopback is configured as ethernet, binding\n", winEr); + *pbShouldBind = true; + } + else + { + TraceMsg(L"vboxNetFltWinNotifyCheckMsLoop: loopback is configured as NOT ethernet, NOT binding\n", winEr); + *pbShouldBind = false; + } + } + else + { + TraceMsg(L"vboxNetFltWinNotifyCheckMsLoop: wcstoul error, winEr (%d), ignoring and binding\n", winEr); + AssertBreakpoint(); + *pbShouldBind = true; + } + } + else + { + TraceMsg(L"vboxNetFltWinNotifyCheckMsLoop: RegQueryValueExW failed, winEr (%d), ignoring, binding\n", hr); + /* TODO: we should check the default medium in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\<driver_id>\Ndi\Params\Medium, REG_SZ "Default" value */ + AssertBreakpoint(); + *pbShouldBind = true; + } + + RegCloseKey(DriverKey); + } + else + { + TraceMsg(L"vboxNetFltWinNotifyCheckMsLoop: vboxNetFltWinQueryDriverKey for msloop failed, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + } + else + { + hr = S_FALSE; + } + CoTaskMemFree(pDevId); + } + else + { + TraceMsg(L"vboxNetFltWinNotifyCheckMsLoop: GetId failed, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + return hr; +} + +static HRESULT vboxNetFltWinNotifyCheckLowerRange(IN INetCfgComponent *pComponent, OUT bool * pbShouldBind) +{ + HKEY DriverKey; + HKEY InterfacesKey; + HRESULT hr = vboxNetFltWinQueryDriverKey(pComponent, &DriverKey); + if(hr == S_OK) + { + LONG winEr = RegOpenKeyExW(DriverKey, L"Ndi\\Interfaces", + 0, /*__reserved DWORD ulOptions*/ + KEY_READ, /*__in REGSAM samDesired*/ + &InterfacesKey); + if(winEr == ERROR_SUCCESS) + { + DWORD Type = REG_SZ; + WCHAR Value[MAX_PATH]; + DWORD cbValue = sizeof(Value); + winEr = RegQueryValueExW(InterfacesKey, + L"LowerRange", /*__in_opt LPCTSTR lpValueName*/ + 0, /*__reserved LPDWORD lpReserved*/ + &Type, /*__out_opt LPDWORD lpType*/ + (LPBYTE)Value, /*__out_opt LPBYTE lpData*/ + &cbValue/*__inout_opt LPDWORD lpcbData*/ + ); + if(winEr == ERROR_SUCCESS) + { + if(wcsstr(Value,L"ethernet") || wcsstr(Value, L"wan")) + { + *pbShouldBind = true; + } + else + { + *pbShouldBind = false; + } + } + else + { + /* do not set err status to it */ + *pbShouldBind = false; + TraceMsg(L"vboxNetFltWinNotifyCheckLowerRange: RegQueryValueExW for LowerRange error, winEr (%d), not binding\n", winEr); + AssertBreakpoint(); + } + + RegCloseKey(InterfacesKey); + } + else + { + hr = HRESULT_FROM_WIN32(winEr); + TraceMsg(L"vboxNetFltWinNotifyCheckLowerRange: RegOpenKeyExW error, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + RegCloseKey(DriverKey); + } + else + { + TraceMsg(L"vboxNetFltWinNotifyShouldBind for INetCfgComponen: vboxNetFltWinQueryDriverKey failed, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + return hr; +} + +static HRESULT vboxNetFltWinNotifyShouldBind(IN INetCfgComponent *pComponent, OUT bool *pbShouldBind) +{ + TraceMsg(L"-->vboxNetFltWinNotifyShouldBind for INetCfgComponent\n"); + DWORD fCharacteristics; + HRESULT hr; + + do + { + /* filter out only physical adapters */ + hr = pComponent->GetCharacteristics(&fCharacteristics); + if(hr != S_OK) + { + TraceMsg(L"vboxNetFltWinNotifyShouldBind for INetCfgComponen: GetCharacteristics failed, hr (0x%x)\n", hr); + AssertBreakpoint(); + break; + } + + + if(fCharacteristics & NCF_HIDDEN) + { + /* we are not binding to hidden adapters */ + *pbShouldBind = false; + break; + } + + hr = vboxNetFltWinNotifyCheckMsLoop(pComponent, pbShouldBind); + if(hr == S_OK) + { + /* this is a loopback adapter, + * the pbShouldBind already contains the result */ + break; + } + else if(hr != S_FALSE) + { + /* error occurred */ + break; + } + + hr = vboxNetFltWinNotifyCheckNetAdp(pComponent, pbShouldBind); + if(hr == S_OK) + { + /* this is a VBoxNetAdp adapter, + * the pbShouldBind already contains the result */ + break; + } + else if(hr != S_FALSE) + { + /* error occurred */ + break; + } + + /* hr == S_FALSE means this is not a loopback adpater, set it to S_OK */ + hr = S_OK; + +// if(!(fCharacteristics & NCF_PHYSICAL)) +// { +// /* we are binding to physical adapters only */ +// *pbShouldBind = false; +// break; +// } + + hr = vboxNetFltWinNotifyCheckLowerRange(pComponent, pbShouldBind); + if(hr == S_OK) + { + /* the vboxNetFltWinNotifyCheckLowerRange ccucceeded, + * the pbShouldBind already contains the result */ + break; + } + /* we are here because of the fail, nothing else to do */ + } while(0); + + TraceMsg(L"<--vboxNetFltWinNotifyShouldBind for INetCfgComponent, hr (0x%x)\n", hr); + + return hr; +} + + +static HRESULT vboxNetFltWinNotifyShouldBind(IN INetCfgBindingInterface *pIf, OUT bool *pbShouldBind) +{ + TraceMsg(L"-->vboxNetFltWinNotifyShouldBind for INetCfgBindingInterface\n"); + + INetCfgComponent * pAdapterComponent; + HRESULT hr = pIf->GetLowerComponent(&pAdapterComponent); + if(hr == S_OK) + { + hr = vboxNetFltWinNotifyShouldBind(pAdapterComponent, pbShouldBind); + + pAdapterComponent->Release(); + } + else + { + TraceMsg(L"vboxNetFltWinNotifyShouldBind: GetLowerComponent failed, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + TraceMsg(L"<--vboxNetFltWinNotifyShouldBind for INetCfgBindingInterface, hr (0x%x)\n", hr); + return hr; +} + +static HRESULT vboxNetFltWinNotifyShouldBind(IN INetCfgBindingPath *pPath, OUT bool * pbDoBind) +{ + TraceMsg(L"-->vboxNetFltWinNotifyShouldBind for INetCfgBindingPath\n"); + IEnumNetCfgBindingInterface *pEnumBindingIf; + HRESULT hr = pPath->EnumBindingInterfaces(&pEnumBindingIf); + + if(hr == S_OK) + { + hr = pEnumBindingIf->Reset(); + if(hr == S_OK) + { + ULONG ulCount; + INetCfgBindingInterface *pBindingIf; + + do + { + hr = pEnumBindingIf->Next( 1, + &pBindingIf, + &ulCount ); + if(hr == S_OK) + { + hr = vboxNetFltWinNotifyShouldBind(pBindingIf, pbDoBind); + + pBindingIf->Release(); + + if(hr == S_OK) + { + if(!(*pbDoBind)) + { + break; + } + } + else + { + /* break on failure */ + break; + } + } + else if(hr == S_FALSE) + { + /* no more elements */ + hr = S_OK; + break; + } + else + { + TraceMsg(L"vboxNetFltWinNotifyShouldBind: Next failed, hr (0x%x)\n", hr); + AssertBreakpoint(); + /* break on falure */ + break; + } + } while(true); + } + else + { + TraceMsg(L"vboxNetFltWinNotifyShouldBind: Reset failed, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + pEnumBindingIf->Release(); + } + else + { + TraceMsg(L"vboxNetFltWinNotifyShouldBind: EnumBindingInterfaces failed, hr (0x%x)\n", hr); + AssertBreakpoint(); + } + + TraceMsg(L"<--vboxNetFltWinNotifyShouldBind for INetCfgBindingPath, hr (0x%x)\n", hr); + return hr; +} + +static bool vboxNetFltWinNotifyShouldBind(IN INetCfgBindingPath *pPath) +{ +#ifdef VBOXNETFLTNOTIFY_DEBUG_BIND + return VBOXNETFLTNOTIFY_DEBUG_BIND; +#else + HRESULT hr; + bool bShouldBind; + + TraceMsg( L"-->vboxNetFltWinNotifyShouldBind\n"); + + hr = vboxNetFltWinNotifyShouldBind(pPath, &bShouldBind) ; + if(hr != S_OK) + { + TraceMsg( L"vboxNetFltWinNotifyShouldBind: vboxNetFltWinNotifyShouldBind failed, hr (0x%x)\n", hr ); + bShouldBind = VBOXNETFLTNOTIFY_ONFAIL_BINDDEFAULT; + } + + + TraceMsg( L"<--vboxNetFltWinNotifyShouldBind, bShouldBind (%d)\n", bShouldBind); + return bShouldBind; +#endif +} + +/* + * INetCfgComponentNotifyBinding + * The following functions provide the INetCfgComponentNotifyBinding interface. + */ + +/** + * This is specific to the component being installed. This will + * ask us if we want to bind to the Item being passed into + * this routine. We can disable the binding by returning + * NETCFG_S_DISABLE_QUERY + * + * @param dwChangeFlag Type of binding change + * @param pncbpItem Pointer to INetCfgBindingPath object + * @return S_OK on success, otherwise an error code. + */ +STDMETHODIMP VBoxNetFltNotify::QueryBindingPath (IN DWORD dwChangeFlag, + IN INetCfgBindingPath *pPath) +{ + HRESULT hr = S_OK; + TraceMsg( L"-->QueryBindingPath, flags (0x%x)\n", dwChangeFlag ); + + if(!vboxNetFltWinNotifyShouldBind(pPath)) + { + TraceMsg( L"QueryBindingPath: we are NOT supporting the current component\n"); + hr = NETCFG_S_DISABLE_QUERY; + } + else + { + TraceMsg( L"QueryBindingPath: we are supporting the current component\n"); + } + TraceMsg( L"<--QueryBindingPath, hr (0x%x)\n", hr); + return hr; +} + +/** + * bind to the component passed to us. + * @param dwChangeFlag Type of system change + * @param pncc Pointer to INetCfgComponent object + * @return S_OK on success, otherwise an error code + */ +STDMETHODIMP VBoxNetFltNotify::NotifyBindingPath (IN DWORD dwChangeFlag, + IN INetCfgBindingPath *pPath) +{ + HRESULT hr = S_OK; + + TraceMsg( L"-->NotifyBindingPath, flags (0x%x)\n", dwChangeFlag ); + /* NCN_ADD | NCN_ENABLE + * NCN_REMOVE | NCN_ENABLE + * NCN_ADD | NCN_DISABLE + * NCN_REMOVE | NCN_DISABLE + * */ + if ( (dwChangeFlag & NCN_ENABLE) && !(dwChangeFlag & NCN_REMOVE)) + { + if(!vboxNetFltWinNotifyShouldBind(pPath)) + { + TraceMsg( L"NotifyBindingPath: binding enabled for the component we are not supporting\n"); + AssertBreakpoint(); + hr = NETCFG_S_DISABLE_QUERY; + } + } + + TraceMsg( L"<--NotifyBindingPath, hr (0x%x)\n", hr); + + return hr; +} + +/* + * DLL Entry Point + */ +extern "C" +BOOL WINAPI DllMain (HINSTANCE hInstance, + DWORD dwReason, + LPVOID /*lpReserved*/) +{ + TraceMsg( L"-->DllMain.\n"); + + if (dwReason == DLL_PROCESS_ATTACH) { + + TraceMsg( L" Reason: Attach.\n"); + + _Module.Init(ObjectMap, hInstance); + + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) { + + TraceMsg( L" Reason: Detach.\n"); + + _Module.Term(); + } + + TraceMsg( L"<--DllMain.\n"); + + return TRUE; +} + +/* + * Used to determine whether the DLL can be unloaded by OLE + */ +STDAPI DllCanUnloadNow(void) +{ + HRESULT hr; + + TraceMsg( L"-->DllCanUnloadNow.\n"); + + hr = (_Module.GetLockCount() == 0) ? S_OK : S_FALSE; + + TraceMsg( L"<--DllCanUnloadNow, hr (0x%x).\n", + hr ); + + return hr; +} + +/* + * Returns a class factory to create an object of the requested type + */ +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + TraceMsg( L"DllGetClassObject.\n"); + + return _Module.GetClassObject(rclsid, riid, ppv); +} + + +/* + * DllRegisterServer - Adds entries to the system registry + */ +STDAPI DllRegisterServer(void) +{ + /* Registers object, typelib and all interfaces in typelib */ + + TraceMsg( L"DllRegisterServer.\n"); + + return _Module.RegisterServer(TRUE); +} + +/* + * DllUnregisterServer - Removes entries from the system registry + */ +STDAPI DllUnregisterServer(void) +{ + TraceMsg( L"DllUnregisterServer.\n"); + + _Module.UnregisterServer(); + + return S_OK; +} diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.def b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.def new file mode 100644 index 000000000..a45750ce7 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.def @@ -0,0 +1,6 @@ +LIBRARY VBOXNETFLTNOTIFY +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.h b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.h new file mode 100644 index 000000000..36815dea8 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.h @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +/* + * Based in part on Microsoft DDK sample code for Sample Notify Object + *+--------------------------------------------------------------------------- + * + * Microsoft Windows + * Copyright (C) Microsoft Corporation, 1992-2001. + * + * Author: Alok Sinha + * + *---------------------------------------------------------------------------- + */ +#ifndef ___VboxNetFltNotify_h___ +#define ___VboxNetFltNotify_h___ + +#include <windows.h> +#include <atlbase.h> +extern CComModule _Module; // required by atlcom.h +#include <atlcom.h> +#include <VBoxNetFltNotifyn.h> +//#include <Netcfgx.h> + +#include "VBoxNetFltNotifyRc.h" + +#define VBOXNETFLTNOTIFY_ONFAIL_BINDDEFAULT false + +/* + * VboxNetFlt Notify Object used to control bindings + */ +class VBoxNetFltNotify : + + /* + * Must inherit from CComObjectRoot(Ex) for reference count + * management and default threading model. + */ + public CComObjectRoot, + + /* + * Define the default class factory and aggregation model. + */ + public CComCoClass<VBoxNetFltNotify, &CLSID_VBoxNetFltNotify>, + + /* + * Notify Object's interfaces. + */ + public INetCfgComponentControl, + public INetCfgComponentNotifyBinding +{ + + /* + * Public members. + */ + public: + + /* + * Constructor + */ + VBoxNetFltNotify(VOID); + + /* + * Destructors. + */ + ~VBoxNetFltNotify(VOID); + + /* + * Notify Object's interfaces. + */ + BEGIN_COM_MAP(VBoxNetFltNotify) + COM_INTERFACE_ENTRY(INetCfgComponentControl) +// COM_INTERFACE_ENTRY(INetCfgComponentSetup) +// COM_INTERFACE_ENTRY(INetCfgComponentPropertyUi) + COM_INTERFACE_ENTRY(INetCfgComponentNotifyBinding) +// COM_INTERFACE_ENTRY(INetCfgComponentNotifyGlobal) + END_COM_MAP() + + /* + * Uncomment the the line below if you don't want your object to + * support aggregation. The default is to support it + * + * DECLARE_NOT_AGGREGATABLE(CMuxNotify) + */ + + DECLARE_REGISTRY_RESOURCEID(IDR_REG_VBOXNETFLT_NOTIFY) + + /* + * INetCfgComponentControl + */ + STDMETHOD (Initialize) ( + IN INetCfgComponent *pIComp, + IN INetCfg *pINetCfg, + IN BOOL fInstalling); + + STDMETHOD (CancelChanges) (); + + STDMETHOD (ApplyRegistryChanges) (); + + STDMETHOD (ApplyPnpChanges) ( + IN INetCfgPnpReconfigCallback* pICallback); + + /* + * INetCfgNotifyBinding + */ + STDMETHOD (QueryBindingPath) ( + IN DWORD dwChangeFlag, + IN INetCfgBindingPath* pncbp); + + STDMETHOD (NotifyBindingPath) ( + IN DWORD dwChangeFlag, + IN INetCfgBindingPath* pncbp); + + /* + * Private members. + */ + private: + + /* + * Private member variables. + */ + INetCfgComponent *m_pncc; /* Our Protocol's Net Config component */ + INetCfg *m_pnc; +}; + +#endif diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.rc b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.rc new file mode 100644 index 000000000..862e52d41 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.rc @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Sun Microsystems, Inc. + * + * 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. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa + * Clara, CA 95054 USA or visit http://www.sun.com if you need + * additional information or have any questions. + */ +#include <windows.h> +#include <VBox/version.h> + +#include "VBoxNetFltNotifyRc.h" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0 + PRODUCTVERSION VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE +#else + FILEFLAGS 0 // final version +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual + BEGIN + VALUE "CompanyName", VBOX_RC_COMPANY_NAME + VALUE "FileDescription", "VirtualBox Bridged Networking Driver Notify Object\0" + VALUE "FileVersion", VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0" + VALUE "InternalName", "VBoxNetFltNotify.dll\0" + VALUE "LegalCopyright", VBOX_RC_LEGAL_COPYRIGHT + VALUE "OriginalFilename","VBoxNetFltNotify.dll\0" + VALUE "ProductName", "Sun VirtualBox\0" + VALUE "ProductVersion", VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_REG_VBOXNETFLT_NOTIFY REGISTRY "VBoxNetFltNotify.rgs" + +1 TYPELIB "VBoxNetFltNotifyn.tlb" + diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.rgs b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.rgs new file mode 100644 index 000000000..2cc93c88d --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotify.rgs @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {c631480a-acbe-4add-bb1d-3ed8aa52b5d9} = s 'VirtualBox Bridged Networking Driver Notify Object' + { + InProcServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + } + } +}
\ No newline at end of file diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotifyRc.h b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotifyRc.h new file mode 100644 index 000000000..1703bbe6a --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotifyRc.h @@ -0,0 +1,6 @@ +#ifndef ___VboxNetFltNotifyRc_h___ +#define ___VboxNetFltNotifyRc_h___ + +#define IDR_REG_VBOXNETFLT_NOTIFY 40001 + +#endif diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotifyn.idl b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotifyn.idl new file mode 100644 index 000000000..6b9e9a115 --- /dev/null +++ b/src/VBox/HostDrivers/VBoxNetFlt/win/notifyobj/VBoxNetFltNotifyn.idl @@ -0,0 +1,39 @@ +/* $Id: VBoxNetFltNotifyn.idl $ */ +/** @file + * VBoxNetFltNotify.idl - Network Filter Driver (Host), Windows Specific Code. Integration with IntNet/NetFlt + */ + +/* + * Copyright (C) 2008 Sun Microsystems, Inc. + * + * Sun Microsystems, Inc. confidential + * All rights reserved + */ +/* + * Based in part on Microsoft DDK sample code for Sample Notify Object + *+--------------------------------------------------------------------------- + * + * Microsoft Windows + * Copyright (C) Microsoft Corporation, 1992-2001. + * + *---------------------------------------------------------------------------- + */ +#include <netcfgn.idl> + +[ + uuid(1ea703af-a150-4fdd-83dc-c07a7a460c7e), + version(1.0), + helpstring("VirtualBox Bridged Networking Driver Notify Object 1.0 Type Library") +] +library VBoxNetFltNotifyLib +{ + [ + uuid(c631480a-acbe-4add-bb1d-3ed8aa52b5d9), + helpstring("VirtualBox Bridged Networking Driver Notify Object Class") + ] + coclass VBoxNetFltNotify + { + [restricted] interface INetCfgComponentControl; + [restricted] interface INetCfgComponentNotifyBinding; + }; +};
\ No newline at end of file diff --git a/src/VBox/HostServices/GuestProperties/Makefile.kmk b/src/VBox/HostServices/GuestProperties/Makefile.kmk index 5d07a8304..6f993f83f 100644 --- a/src/VBox/HostServices/GuestProperties/Makefile.kmk +++ b/src/VBox/HostServices/GuestProperties/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18422 2009-03-28 00:04:43Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Shared Info Services Host Service. # diff --git a/src/VBox/HostServices/GuestProperties/testcase/Makefile.kmk b/src/VBox/HostServices/GuestProperties/testcase/Makefile.kmk index f57d6ba98..cf7a5b6fd 100644 --- a/src/VBox/HostServices/GuestProperties/testcase/Makefile.kmk +++ b/src/VBox/HostServices/GuestProperties/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18422 2009-03-28 00:04:43Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Guest Properties Host Service testcases. # diff --git a/src/VBox/HostServices/GuestProperties/testcase/tstGuestPropSvc.cpp b/src/VBox/HostServices/GuestProperties/testcase/tstGuestPropSvc.cpp index 3ab6f17b6..887063231 100644 --- a/src/VBox/HostServices/GuestProperties/testcase/tstGuestPropSvc.cpp +++ b/src/VBox/HostServices/GuestProperties/testcase/tstGuestPropSvc.cpp @@ -1,4 +1,4 @@ -/* $Id: tstGuestPropSvc.cpp 16337 2009-01-28 21:03:49Z vboxsync $ */ +/* $Id: tstGuestPropSvc.cpp $ */ /** @file * * Testcase for the guest property service. diff --git a/src/VBox/HostServices/Makefile.kmk b/src/VBox/HostServices/Makefile.kmk index 24c9fffba..74fa26fbd 100644 --- a/src/VBox/HostServices/Makefile.kmk +++ b/src/VBox/HostServices/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20451 2009-06-09 23:25:48Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for the VBox Host Services. # diff --git a/src/VBox/HostServices/SharedClipboard/Makefile.kmk b/src/VBox/HostServices/SharedClipboard/Makefile.kmk index 959411536..31f294c9e 100644 --- a/src/VBox/HostServices/SharedClipboard/Makefile.kmk +++ b/src/VBox/HostServices/SharedClipboard/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20450 2009-06-09 23:06:02Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Shared Clipboard Host Service. # diff --git a/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.cpp b/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.cpp index 978a68bfd..3a25b7d1d 100644 --- a/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.cpp +++ b/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.cpp @@ -1,4 +1,4 @@ -/* $Id: darwin-pasteboard.cpp 18398 2009-03-27 14:21:19Z vboxsync $ */ +/* $Id: darwin-pasteboard.cpp $ */ /** @file * Shared Clipboard: Mac OS X host implementation. */ diff --git a/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.h b/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.h index 0fbba2443..c6bdb969c 100644 --- a/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.h +++ b/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.h @@ -1,4 +1,4 @@ -/* $Id: darwin-pasteboard.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: darwin-pasteboard.h $ */ /** @file * Shared Clipboard: Mac OS X host implementation. */ diff --git a/src/VBox/HostServices/SharedClipboard/darwin.cpp b/src/VBox/HostServices/SharedClipboard/darwin.cpp index 82c6cdb59..af3839356 100644 --- a/src/VBox/HostServices/SharedClipboard/darwin.cpp +++ b/src/VBox/HostServices/SharedClipboard/darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: darwin.cpp 14303 2008-11-18 13:45:38Z vboxsync $ */ +/* $Id: darwin.cpp $ */ /** @file * Shared Clipboard: Mac OS X host. */ diff --git a/src/VBox/HostServices/SharedFolders/Makefile.kmk b/src/VBox/HostServices/SharedFolders/Makefile.kmk index 992b8d5db..0421167d6 100644 --- a/src/VBox/HostServices/SharedFolders/Makefile.kmk +++ b/src/VBox/HostServices/SharedFolders/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 12250 2008-09-09 01:34:00Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Shared Folders Host Service. # diff --git a/src/VBox/HostServices/SharedFolders/mappings.cpp b/src/VBox/HostServices/SharedFolders/mappings.cpp index 97bdec2bf..d0ee144f0 100644 --- a/src/VBox/HostServices/SharedFolders/mappings.cpp +++ b/src/VBox/HostServices/SharedFolders/mappings.cpp @@ -23,7 +23,154 @@ #include <iprt/assert.h> #include <iprt/string.h> -MAPPING FolderMapping[SHFL_MAX_MAPPINGS]; +/* Shared folders order in the saved state and in the FolderMapping can differ. + * So a translation array of root handle is needed. + */ + +static MAPPING FolderMapping[SHFL_MAX_MAPPINGS]; +static SHFLROOT aIndexFromRoot[SHFL_MAX_MAPPINGS]; + +void vbsfMappingInit(void) +{ + unsigned root; + + for (root = 0; root < RT_ELEMENTS(aIndexFromRoot); root++) + { + aIndexFromRoot[root] = SHFL_ROOT_NIL; + } +} + +int vbsfMappingLoaded (const MAPPING *pLoadedMapping, SHFLROOT root) +{ + /* Mapping loaded from the saved state with the index. Which means + * the guest uses the iMapping as root handle for this folder. + * Check whether there is the same mapping in FolderMapping and + * update the aIndexFromRoot. + * + * Also update the mapping properties, which were lost: cMappings. + */ + if (root >= SHFL_MAX_MAPPINGS) + { + return VERR_INVALID_PARAMETER; + } + + SHFLROOT i; + for (i = 0; i < RT_ELEMENTS(FolderMapping); i++) + { + MAPPING *pMapping = &FolderMapping[i]; + + /* Equal? */ + if ( pLoadedMapping->fValid == pMapping->fValid + && ShflStringSizeOfBuffer(pLoadedMapping->pMapName) == ShflStringSizeOfBuffer(pMapping->pMapName) + && memcmp(pLoadedMapping->pMapName, pMapping->pMapName, ShflStringSizeOfBuffer(pMapping->pMapName)) == 0) + { + /* Actual index is i. */ + aIndexFromRoot[root] = i; + + /* Update the mapping properties. */ + pMapping->cMappings = pLoadedMapping->cMappings; + + return VINF_SUCCESS; + } + } + + return VERR_INVALID_PARAMETER; +} + +MAPPING *vbsfMappingGetByRoot(SHFLROOT root) +{ + if (root < RT_ELEMENTS(aIndexFromRoot)) + { + SHFLROOT iMapping = aIndexFromRoot[root]; + + if ( iMapping != SHFL_ROOT_NIL + && iMapping < RT_ELEMENTS(FolderMapping)) + { + return &FolderMapping[iMapping]; + } + } + + return NULL; +} + +static SHFLROOT vbsfMappingGetRootFromIndex(SHFLROOT iMapping) +{ + unsigned root; + + for (root = 0; root < RT_ELEMENTS(aIndexFromRoot); root++) + { + if (iMapping == aIndexFromRoot[root]) + { + return root; + } + } + + return SHFL_ROOT_NIL; +} + +static MAPPING *vbsfMappingGetByName (PRTUTF16 utf16Name, SHFLROOT *pRoot) +{ + unsigned i; + + for (i=0; i<SHFL_MAX_MAPPINGS; i++) + { + if (FolderMapping[i].fValid == true) + { + if (!RTUtf16LocaleICmp(FolderMapping[i].pMapName->String.ucs2, utf16Name)) + { + SHFLROOT root = vbsfMappingGetRootFromIndex(i); + + if (root != SHFL_ROOT_NIL) + { + if (pRoot) + { + *pRoot = root; + } + return &FolderMapping[i]; + } + else + { + AssertFailed(); + } + } + } + } + + return NULL; +} + +static void vbsfRootHandleAdd(SHFLROOT iMapping) +{ + unsigned root; + + for (root = 0; root < RT_ELEMENTS(aIndexFromRoot); root++) + { + if (aIndexFromRoot[root] == SHFL_ROOT_NIL) + { + aIndexFromRoot[root] = iMapping; + return; + } + } + + AssertFailed(); +} + +static void vbsfRootHandleRemove(SHFLROOT iMapping) +{ + unsigned root; + + for (root = 0; root < RT_ELEMENTS(aIndexFromRoot); root++) + { + if (aIndexFromRoot[root] == iMapping) + { + aIndexFromRoot[root] = SHFL_ROOT_NIL; + return; + } + } + + AssertFailed(); +} + /* @@ -33,14 +180,14 @@ MAPPING FolderMapping[SHFL_MAX_MAPPINGS]; */ int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable) { - int i; + unsigned i; Assert(pFolderName && pMapName); Log(("vbsfMappingsAdd %ls\n", pMapName->String.ucs2)); /* check for duplicates */ - for (i=0;i<SHFL_MAX_MAPPINGS;i++) + for (i=0; i<SHFL_MAX_MAPPINGS; i++) { if (FolderMapping[i].fValid == true) { @@ -52,7 +199,7 @@ int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWr } } - for (i=0;i<SHFL_MAX_MAPPINGS;i++) + for (i=0; i<SHFL_MAX_MAPPINGS; i++) { if (FolderMapping[i].fValid == false) { @@ -97,6 +244,7 @@ int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWr RTStrFree(utf8Root); } FolderMapping[i].fHostCaseSensitive = RT_SUCCESS(rc) ? prop.fCaseSensitive : false; + vbsfRootHandleAdd(i); break; } } @@ -112,12 +260,12 @@ int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWr int vbsfMappingsRemove (PSHFLSTRING pMapName) { - int i; + unsigned i; Assert(pMapName); Log(("vbsfMappingsRemove %ls\n", pMapName->String.ucs2)); - for (i=0;i<SHFL_MAX_MAPPINGS;i++) + for (i=0; i<SHFL_MAX_MAPPINGS; i++) { if (FolderMapping[i].fValid == true) { @@ -134,6 +282,7 @@ int vbsfMappingsRemove (PSHFLSTRING pMapName) FolderMapping[i].pFolderName = NULL; FolderMapping[i].pMapName = NULL; FolderMapping[i].fValid = false; + vbsfRootHandleRemove(i); break; } } @@ -150,36 +299,39 @@ int vbsfMappingsRemove (PSHFLSTRING pMapName) PCRTUTF16 vbsfMappingsQueryHostRoot (SHFLROOT root, uint32_t *pcbRoot) { - if (root > SHFL_MAX_MAPPINGS) + MAPPING *pFolderMapping = vbsfMappingGetByRoot(root); + if (pFolderMapping == NULL) { AssertFailed(); return NULL; } - *pcbRoot = FolderMapping[root].pFolderName->u16Size; - return &FolderMapping[root].pFolderName->String.ucs2[0]; + *pcbRoot = pFolderMapping->pFolderName->u16Size; + return &pFolderMapping->pFolderName->String.ucs2[0]; } bool vbsfIsGuestMappingCaseSensitive (SHFLROOT root) { - if (root > SHFL_MAX_MAPPINGS) + MAPPING *pFolderMapping = vbsfMappingGetByRoot(root); + if (pFolderMapping == NULL) { AssertFailed(); return false; } - return FolderMapping[root].fGuestCaseSensitive; + return pFolderMapping->fGuestCaseSensitive; } bool vbsfIsHostMappingCaseSensitive (SHFLROOT root) { - if (root > SHFL_MAX_MAPPINGS) + MAPPING *pFolderMapping = vbsfMappingGetByRoot(root); + if (pFolderMapping == NULL) { AssertFailed(); return false; } - return FolderMapping[root].fHostCaseSensitive; + return pFolderMapping->fHostCaseSensitive; } int vbsfMappingsQuery (SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings) @@ -193,7 +345,8 @@ int vbsfMappingsQuery (SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings = 0; for (uint32_t i=0;i<cMaxMappings;i++) { - if (FolderMapping[i].fValid == true) + MAPPING *pFolderMapping = vbsfMappingGetByRoot(i); + if (pFolderMapping != NULL && pFolderMapping->fValid == true) { pMappings[*pcMappings].u32Status = SHFL_MS_NEW; pMappings[*pcMappings].root = i; @@ -213,8 +366,11 @@ int vbsfMappingsQueryName (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *p LogFlow(("vbsfMappingsQuery: pClient = %p, root = %d, *pString = %p\n", pClient, root, pString)); - if (root >= SHFL_MAX_MAPPINGS) + MAPPING *pFolderMapping = vbsfMappingGetByRoot(root); + if (pFolderMapping == NULL) + { return VERR_INVALID_PARAMETER; + } if (BIT_FLAG(pClient->fu32Flags, SHFL_CF_UTF8)) { @@ -223,10 +379,10 @@ int vbsfMappingsQueryName (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *p return VERR_INVALID_PARAMETER; } - if (FolderMapping[root].fValid == true) + if (pFolderMapping->fValid == true) { - pString->u16Length = FolderMapping[root].pMapName->u16Length; - memcpy(pString->String.ucs2, FolderMapping[root].pMapName->String.ucs2, pString->u16Size); + pString->u16Length = pFolderMapping->pMapName->u16Length; + memcpy(pString->String.ucs2, pFolderMapping->pMapName->String.ucs2, pString->u16Size); } else rc = VERR_FILE_NOT_FOUND; @@ -243,11 +399,14 @@ int vbsfMappingsQueryWritable (SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fWr LogFlow(("vbsfMappingsQueryWritable: pClient = %p, root = %d\n", pClient, root)); - if (root >= SHFL_MAX_MAPPINGS) + MAPPING *pFolderMapping = vbsfMappingGetByRoot(root); + if (pFolderMapping == NULL) + { return VERR_INVALID_PARAMETER; + } - if (FolderMapping[root].fValid == true) - *fWritable = FolderMapping[root].fWritable; + if (pFolderMapping->fValid == true) + *fWritable = pFolderMapping->fWritable; else rc = VERR_FILE_NOT_FOUND; @@ -256,27 +415,9 @@ int vbsfMappingsQueryWritable (SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fWr return rc; } -static int vbsfQueryMappingIndex (PRTUTF16 utf16Name, size_t *pIndex) -{ - size_t i; - - for (i=0;i<SHFL_MAX_MAPPINGS;i++) - { - if (FolderMapping[i].fValid == true) - { - if (!RTUtf16LocaleICmp(FolderMapping[i].pMapName->String.ucs2, utf16Name)) - { - *pIndex = i; - return 0; - } - } - } - return -1; -} - int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot) { - size_t index; + MAPPING *pFolderMapping = NULL; if (BIT_FLAG(pClient->fu32Flags, SHFL_CF_UTF8)) { @@ -305,30 +446,22 @@ int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUTF16 deli if (RT_FAILURE (rc)) return rc; - rc = vbsfQueryMappingIndex (utf16Name, &index); + pFolderMapping = vbsfMappingGetByName(utf16Name, pRoot); RTUtf16Free (utf16Name); - - if (rc) - { - // AssertMsgFailed(("vbsfMapFolder: map %s not found!!\n", - // pszMapName->String.utf8)); - return VERR_FILE_NOT_FOUND; - } } else { - if (vbsfQueryMappingIndex (pszMapName->String.ucs2, &index)) - { - // AssertMsgFailed(("vbsfMapFolder: map %ls not found!!\n", - // pszMapName->String.ucs2)); - return VERR_FILE_NOT_FOUND; - } + pFolderMapping = vbsfMappingGetByName(pszMapName->String.ucs2, pRoot); + } + + if (!pFolderMapping) + { + return VERR_FILE_NOT_FOUND; } - FolderMapping[index].cMappings++; - Assert(FolderMapping[index].cMappings == 1 || FolderMapping[index].fGuestCaseSensitive == fCaseSensitive); - FolderMapping[index].fGuestCaseSensitive = fCaseSensitive; - *pRoot = (SHFLROOT)index; + pFolderMapping->cMappings++; + Assert(pFolderMapping->cMappings == 1 || pFolderMapping->fGuestCaseSensitive == fCaseSensitive); + pFolderMapping->fGuestCaseSensitive = fCaseSensitive; return VINF_SUCCESS; } @@ -336,15 +469,16 @@ int vbsfUnmapFolder (SHFLCLIENTDATA *pClient, SHFLROOT root) { int rc = VINF_SUCCESS; - if (root > SHFL_MAX_MAPPINGS) + MAPPING *pFolderMapping = vbsfMappingGetByRoot(root); + if (pFolderMapping == NULL) { AssertFailed(); return VERR_FILE_NOT_FOUND; } - Assert(FolderMapping[root].fValid == true && FolderMapping[root].cMappings > 0); - if (FolderMapping[root].cMappings > 0) - FolderMapping[root].cMappings--; + Assert(pFolderMapping->fValid == true && pFolderMapping->cMappings > 0); + if (pFolderMapping->cMappings > 0) + pFolderMapping->cMappings--; Log(("vbsfUnmapFolder\n")); return rc; diff --git a/src/VBox/HostServices/SharedFolders/mappings.h b/src/VBox/HostServices/SharedFolders/mappings.h index 463e07b4a..9ee5679d1 100644 --- a/src/VBox/HostServices/SharedFolders/mappings.h +++ b/src/VBox/HostServices/SharedFolders/mappings.h @@ -35,7 +35,7 @@ typedef struct bool fWritable; } MAPPING, *PMAPPING; -extern MAPPING FolderMapping[SHFL_MAX_MAPPINGS]; +void vbsfMappingInit(void); bool vbsfMappingQuery(uint32_t iMapping, PMAPPING *pMapping); @@ -53,5 +53,8 @@ PCRTUTF16 vbsfMappingsQueryHostRoot (SHFLROOT root, uint32_t *pcbRoot); bool vbsfIsGuestMappingCaseSensitive (SHFLROOT root); bool vbsfIsHostMappingCaseSensitive (SHFLROOT root); +int vbsfMappingLoaded (const MAPPING *pLoadedMapping, SHFLROOT root); +MAPPING *vbsfMappingGetByRoot(SHFLROOT root); + #endif /* !___MAPPINGS_H */ diff --git a/src/VBox/HostServices/SharedFolders/service.cpp b/src/VBox/HostServices/SharedFolders/service.cpp index 042a11ff8..27aae9c9d 100644 --- a/src/VBox/HostServices/SharedFolders/service.cpp +++ b/src/VBox/HostServices/SharedFolders/service.cpp @@ -135,34 +135,37 @@ static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClie /* Save all the active mappings. */ for (int i=0;i<SHFL_MAX_MAPPINGS;i++) { - rc = SSMR3PutU32(pSSM, FolderMapping[i].cMappings); + /* Mapping are saved in the order of increasing root handle values. */ + MAPPING *pFolderMapping = vbsfMappingGetByRoot(i); + + rc = SSMR3PutU32(pSSM, pFolderMapping? pFolderMapping->cMappings: 0); AssertRCReturn(rc, rc); - rc = SSMR3PutBool(pSSM, FolderMapping[i].fValid); + rc = SSMR3PutBool(pSSM, pFolderMapping? pFolderMapping->fValid: false); AssertRCReturn(rc, rc); - if (FolderMapping[i].fValid) + if (pFolderMapping && pFolderMapping->fValid) { uint32_t len; - len = ShflStringSizeOfBuffer(FolderMapping[i].pFolderName); + len = ShflStringSizeOfBuffer(pFolderMapping->pFolderName); rc = SSMR3PutU32(pSSM, len); AssertRCReturn(rc, rc); - rc = SSMR3PutMem(pSSM, FolderMapping[i].pFolderName, len); + rc = SSMR3PutMem(pSSM, pFolderMapping->pFolderName, len); AssertRCReturn(rc, rc); - len = ShflStringSizeOfBuffer(FolderMapping[i].pMapName); + len = ShflStringSizeOfBuffer(pFolderMapping->pMapName); rc = SSMR3PutU32(pSSM, len); AssertRCReturn(rc, rc); - rc = SSMR3PutMem(pSSM, FolderMapping[i].pMapName, len); + rc = SSMR3PutMem(pSSM, pFolderMapping->pMapName, len); AssertRCReturn(rc, rc); - rc = SSMR3PutBool(pSSM, FolderMapping[i].fHostCaseSensitive); + rc = SSMR3PutBool(pSSM, pFolderMapping->fHostCaseSensitive); AssertRCReturn(rc, rc); - rc = SSMR3PutBool(pSSM, FolderMapping[i].fGuestCaseSensitive); + rc = SSMR3PutBool(pSSM, pFolderMapping->fGuestCaseSensitive); AssertRCReturn(rc, rc); } } @@ -202,100 +205,60 @@ static DECLCALLBACK(int) svcLoadState(void *, uint32_t u32ClientID, void *pvClie /* We don't actually (fully) restore the state; we simply check if the current state is as we it expect it to be. */ for (int i=0;i<SHFL_MAX_MAPPINGS;i++) { - if (FolderMapping[i].pFolderName) - { - LogRel(("SharedFolders host service: loading folder [%ls]\n", - FolderMapping[i].pFolderName->String.ucs2)); - } - - bool fValid; - + /* Load the saved mapping description and try to find it in the mappings. */ + MAPPING mapping; + memset (&mapping, 0, sizeof (mapping)); + /* restore the folder mapping counter. */ - rc = SSMR3GetU32(pSSM, &FolderMapping[i].cMappings); + rc = SSMR3GetU32(pSSM, &mapping.cMappings); AssertRCReturn(rc, rc); - rc = SSMR3GetBool(pSSM, &fValid); + rc = SSMR3GetBool(pSSM, &mapping.fValid); AssertRCReturn(rc, rc); - if (fValid != FolderMapping[i].fValid) + if (mapping.fValid) { - LogRel(("SharedFolders host service: unexpected saved state %d, should be %d\n", - fValid, FolderMapping[i].fValid)); - return VERR_SSM_UNEXPECTED_DATA; - } + uint32_t cbFolderName; + PSHFLSTRING pFolderName; - if (FolderMapping[i].fValid) - { - PSHFLSTRING pName; + uint32_t cbMapName; + PSHFLSTRING pMapName; - /* Check the host path name. */ - rc = SSMR3GetU32(pSSM, &len); + /* Load the host path name. */ + rc = SSMR3GetU32(pSSM, &cbFolderName); AssertRCReturn(rc, rc); - if (len != ShflStringSizeOfBuffer(FolderMapping[i].pFolderName)) - { - LogRel(("SharedFolders host service: unexpected saved name length %d, should be %d\n", - len, ShflStringSizeOfBuffer(FolderMapping[i].pFolderName))); - return VERR_SSM_UNEXPECTED_DATA; - } + pFolderName = (PSHFLSTRING)RTMemAlloc(cbFolderName); + AssertReturn(pFolderName != NULL, VERR_NO_MEMORY); - pName = (PSHFLSTRING)RTMemAlloc(len); - Assert(pName); - if (pName == NULL) - return VERR_NO_MEMORY; + rc = SSMR3GetMem(pSSM, pFolderName, cbFolderName); + AssertRCReturn(rc, rc); - rc = SSMR3GetMem(pSSM, pName, len); + /* Load the map name. */ + rc = SSMR3GetU32(pSSM, &cbMapName); AssertRCReturn(rc, rc); - if (memcmp(FolderMapping[i].pFolderName, pName, len)) - { - LogRel(("SharedFolders host service: unexpected saved name\n%.*Rhxd\nshould be\n%.*Rhxd\n", - len, pName, len, FolderMapping[i].pFolderName)); - RTMemFree(pName); - return VERR_SSM_UNEXPECTED_DATA; - } - RTMemFree(pName); + pMapName = (PSHFLSTRING)RTMemAlloc(cbMapName); + AssertReturn(pMapName != NULL, VERR_NO_MEMORY); - /* Check the map name. */ - rc = SSMR3GetU32(pSSM, &len); + rc = SSMR3GetMem(pSSM, pMapName, cbMapName); AssertRCReturn(rc, rc); - if (len != ShflStringSizeOfBuffer(FolderMapping[i].pMapName)) - { - LogRel(("SharedFolders host service: unexpected saved map length %d, should be %d\n", - len, ShflStringSizeOfBuffer(FolderMapping[i].pMapName))); - return VERR_SSM_UNEXPECTED_DATA; - } - - pName = (PSHFLSTRING)RTMemAlloc(len); - Assert(pName); - if (pName == NULL) - return VERR_NO_MEMORY; + rc = SSMR3GetBool(pSSM, &mapping.fHostCaseSensitive); + AssertRCReturn(rc, rc); - rc = SSMR3GetMem(pSSM, pName, len); + rc = SSMR3GetBool(pSSM, &mapping.fGuestCaseSensitive); AssertRCReturn(rc, rc); - if (memcmp(FolderMapping[i].pMapName, pName, len)) - { - LogRel(("SharedFolders host service: unexpected saved map\n%.*Rhxd\nshould be\n%.*Rhxd\n", - len, pName, len, FolderMapping[i].pMapName)); - RTMemFree(pName); - return VERR_SSM_UNEXPECTED_DATA; - } - RTMemFree(pName); + mapping.pFolderName = pFolderName; + mapping.pMapName = pMapName; - bool fCaseSensitive; + /* 'i' is the root handle of the saved mapping. */ + rc = vbsfMappingLoaded (&mapping, i); - rc = SSMR3GetBool(pSSM, &fCaseSensitive); - AssertRCReturn(rc, rc); - if (FolderMapping[i].fHostCaseSensitive != fCaseSensitive) - { - LogRel(("SharedFolders host service: unexpected saved case %d, should be %d\n", - fCaseSensitive, FolderMapping[i].fHostCaseSensitive)); - return VERR_SSM_UNEXPECTED_DATA; - } + RTMemFree(pMapName); + RTMemFree(pFolderName); - rc = SSMR3GetBool(pSSM, &FolderMapping[i].fGuestCaseSensitive); AssertRCReturn(rc, rc); } } @@ -1352,6 +1315,8 @@ extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *pt /* Init handle table */ rc = vbsfInitHandleTable(); AssertRC(rc); + + vbsfMappingInit(); } return rc; diff --git a/src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk b/src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk index bb5161fa5..fb3f2c4ba 100644 --- a/src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk +++ b/src/VBox/HostServices/SharedFolders/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18461 2009-03-28 04:57:23Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Shared Folders Host Service testcases. # diff --git a/src/VBox/HostServices/SharedFolders/vbsf.cpp b/src/VBox/HostServices/SharedFolders/vbsf.cpp index 151a6b6fc..3f48e2756 100644 --- a/src/VBox/HostServices/SharedFolders/vbsf.cpp +++ b/src/VBox/HostServices/SharedFolders/vbsf.cpp @@ -1742,9 +1742,9 @@ static int vbsfSetFileInfo(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLHANDLE Ha RTFMODE fMode = pSFDEntry->Attr.fMode; #ifndef RT_OS_WINDOWS - /* don't allow to clear the own bit, otherwise the guest wouldn't be - * able to access this file anymore */ - if (fMode) + /* Don't allow the guest to clear the own bit, otherwise the guest wouldn't be + * able to access this file anymore. Only for guests, which set the UNIX mode. */ + if (fMode & RTFS_UNIX_MASK) fMode |= RTFS_UNIX_IRUSR; #endif diff --git a/src/VBox/HostServices/SharedOpenGL/Makefile.kmk b/src/VBox/HostServices/SharedOpenGL/Makefile.kmk index b4649ef63..4637dacf7 100644 --- a/src/VBox/HostServices/SharedOpenGL/Makefile.kmk +++ b/src/VBox/HostServices/SharedOpenGL/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20451 2009-06-09 23:25:48Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VirtualBox HGCM Service. # diff --git a/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp b/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp index 1f05bfdd3..2d2cf3fac 100644 --- a/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp +++ b/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp @@ -1,4 +1,4 @@ -/* $Id: crservice.cpp 18637 2009-04-02 13:49:59Z vboxsync $ */ +/* $Id: crservice.cpp $ */ /** @file * VBox crOpenGL: Host service entry points. diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c index 6a4f76ff9..a7267323c 100644 --- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c +++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c @@ -139,7 +139,11 @@ crServerDispatchDestroyContext( GLint ctx ) for (pos = 0; pos < CR_MAX_CONTEXTS; ++pos) if (cr_server.curClient->contextList[pos] == ctx) + { cr_server.curClient->contextList[pos] = 0; + break; + } + CRASSERT(pos<CR_MAX_CONTEXTS); } } diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c index d04a7cc9e..65deb0589 100644 --- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c +++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c @@ -1,4 +1,4 @@ -/* $Id: server_getshaders.c 20511 2009-06-12 13:00:53Z vboxsync $ */ +/* $Id: server_getshaders.c $ */ /** @file * VBox OpenGL DRI driver functions diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_stream.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_stream.c index b3af1cf27..091b4b8ca 100644 --- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_stream.c +++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_stream.c @@ -115,9 +115,9 @@ crServerDeleteClient( CRClient *client ) { int i, j; int32_t pos; + CRClient *oldclient = cr_server.curClient; - crDebug("Deleting client %p (%d msgs left)", client, - crNetNumMessages(client->conn)); + crDebug("Deleting client %p (%d msgs left)", client, crNetNumMessages(client->conn)); #if 0 if (crNetNumMessages(client->conn) > 0) { @@ -142,6 +142,22 @@ crServerDeleteClient( CRClient *client ) } } + cr_server.curClient = client; + + /* Destroy any windows created by the client */ + for (pos = 0; pos<CR_MAX_WINDOWS && client->windowList[pos]; pos++) + { + cr_server.dispatch.WindowDestroy(client->windowList[pos]); + } + + /* Check if we have context(s) made by this client left, could happen if client side code is lazy */ + for (pos = 0; pos<CR_MAX_CONTEXTS && client->contextList[pos]; pos++) + { + cr_server.dispatch.DestroyContext(client->contextList[pos]); + } + + cr_server.curClient = oldclient; + /* remove from the run queue */ if (cr_server.run_queue) { @@ -179,18 +195,6 @@ crServerDeleteClient( CRClient *client ) crNetFreeConnection(client->conn); - /* Destroy any windows created by the client */ - for (pos = 0; pos<CR_MAX_WINDOWS && client->windowList[pos]; pos++) - { - cr_server.dispatch.WindowDestroy(client->windowList[pos]); - } - - /* Check if we have context(s) made by this client left, could happen if client side code is lazy */ - for (pos = 0; pos<CR_MAX_CONTEXTS && client->contextList[pos]; pos++) - { - cr_server.dispatch.DestroyContext(client->contextList[pos]); - } - crFree(client); } diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c index 02601b59e..6e837ab95 100644 --- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c +++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c @@ -118,8 +118,13 @@ crServerDispatchWindowCreateEx(const char *dpyName, GLint visBits, GLint preload return windowID; } +void crServerCheckCurrentCtxWindowCB(unsigned long key, void *data1, void *data2) +{ + CRContext *crCtx = (CRContext *) data1; + GLint window = *(GLint*)data2; -#define EXTRA_WARN 0 + (void) key; +} void SERVER_DISPATCH_APIENTRY crServerDispatchWindowDestroy( GLint window ) @@ -129,9 +134,7 @@ crServerDispatchWindowDestroy( GLint window ) mural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, window); if (!mural) { -#if EXTRA_WARN crWarning("CRServer: invalid window %d passed to WindowDestroy()", window); -#endif return; } @@ -142,7 +145,11 @@ crServerDispatchWindowDestroy( GLint window ) { for (pos = 0; pos < CR_MAX_WINDOWS; ++pos) if (cr_server.curClient->windowList[pos] == window) + { cr_server.curClient->windowList[pos] = 0; + break; + } + CRASSERT(pos<CR_MAX_WINDOWS); if (cr_server.curClient->currentMural == mural) { @@ -151,9 +158,14 @@ crServerDispatchWindowDestroy( GLint window ) } } + if (cr_server.currentWindow == window) + { + cr_server.currentWindow = -1; + } + + crHashtableWalk(cr_server.contextTable, crServerCheckCurrentCtxWindowCB, &window); crHashtableDelete(cr_server.pWindowCreateInfoTable, window, crServerCreateInfoDeleteCB); - /* @todo, can't issue it cause we could have context(s) referencing this one left */ - /*crHashtableDelete(cr_server.muralTable, window, crFree);*/ + crHashtableDelete(cr_server.muralTable, window, crFree); } diff --git a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c index 0cf304c66..ebd589875 100644 --- a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c +++ b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c @@ -1,4 +1,4 @@ -/* $Id: unpack_shaders.c 20511 2009-06-12 13:00:53Z vboxsync $ */ +/* $Id: unpack_shaders.c $ */ /** @file * VBox OpenGL DRI driver functions diff --git a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_visibleregion.c b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_visibleregion.c index ff4cee7bb..6c6eefb96 100755..100644 --- a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_visibleregion.c +++ b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_visibleregion.c @@ -1,4 +1,4 @@ -/* $Id: unpack_visibleregion.c 15532 2008-12-15 18:53:11Z vboxsync $ */ +/* $Id: unpack_visibleregion.c $ */ /** @file * VBox Packing VisibleRegion information diff --git a/src/VBox/Installer/Makefile.kmk b/src/VBox/Installer/Makefile.kmk index baf32ab1e..fa53f7c52 100644 --- a/src/VBox/Installer/Makefile.kmk +++ b/src/VBox/Installer/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20488 2009-06-12 09:09:32Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Install misc stuff and create dist packages. # diff --git a/src/VBox/Installer/common/Makefile.kmk b/src/VBox/Installer/common/Makefile.kmk index 2b0eda2f8..fa16f1c3d 100644 --- a/src/VBox/Installer/common/Makefile.kmk +++ b/src/VBox/Installer/common/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20510 2009-06-12 12:53:43Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Common installer stuff. # diff --git a/src/VBox/Installer/linux/Makefile.kmk b/src/VBox/Installer/linux/Makefile.kmk index 229fb8df1..9c6132fbe 100644 --- a/src/VBox/Installer/linux/Makefile.kmk +++ b/src/VBox/Installer/linux/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20946 2009-06-25 15:09:03Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Makefile for the Linux installer. # @@ -253,6 +253,7 @@ $(PATH_BIN)/$(VBOX_LNX_PACKAGE_NAME): \ $(if $(VBOX_OSE),,$(VBOX_BRAND_LICENSE_TXT)) \ $(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh \ $(VBOX_LNX_INST_OUT_DIR)/install.sh \ + $(VBOX_PATH_LNX_INST_SRC)/vboxdrv-pardus.py \ $(VBOX_PATH_LNX_INST_SRC)/uninstall.sh \ $(wildcard $(PATH_BIN)/src/*) \ $(wildcard $(PATH_BIN)/src/*/*) \ @@ -264,6 +265,7 @@ $(PATH_BIN)/$(VBOX_LNX_PACKAGE_NAME): \ $(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_LNX_INST_SRC)/deffiles $(VBOX_LNX_INST_STAGE_DIR)/ $(QUIET)$(if $(VBOX_OSE),,$(INSTALL) -m 0644 $(VBOX_BRAND_LICENSE_TXT) $(VBOX_LNX_INST_STAGE_DIR)/LICENSE) $(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/vboxdrv.sh $(VBOX_LNX_INST_STAGE_DIR)/ + $(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_LNX_INST_SRC)/vboxdrv-pardus.py $(VBOX_LNX_INST_STAGE_DIR)/ $(QUIET)$(INSTALL) -m 0755 $(VBOX_LNX_INST_OUT_DIR)/install.sh $(VBOX_LNX_INST_STAGE_DIR)/ $(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_LNX_INST_SRC)/uninstall.sh $(VBOX_LNX_INST_STAGE_DIR)/ $(QUIET)$(RM) -f $@ diff --git a/src/VBox/Installer/linux/VBox.sh b/src/VBox/Installer/linux/VBox.sh index 688e89a84..688e89a84 100644..100755 --- a/src/VBox/Installer/linux/VBox.sh +++ b/src/VBox/Installer/linux/VBox.sh diff --git a/src/VBox/Installer/linux/VBoxSysInfo.sh b/src/VBox/Installer/linux/VBoxSysInfo.sh index f07a91821..f07a91821 100644..100755 --- a/src/VBox/Installer/linux/VBoxSysInfo.sh +++ b/src/VBox/Installer/linux/VBoxSysInfo.sh diff --git a/src/VBox/Installer/linux/vboxdrv.sh.in b/src/VBox/Installer/linux/vboxdrv.sh.in index 853338e1b..a5ec9415a 100644..100755 --- a/src/VBox/Installer/linux/vboxdrv.sh.in +++ b/src/VBox/Installer/linux/vboxdrv.sh.in @@ -232,7 +232,7 @@ stop_vms() # don't create the ipcd directory with wrong permissions! if [ -d /tmp/.vbox-$i-ipc ]; then export VBOX_IPC_SOCKETID="$i" - VMS=`$VBOXMANAGE --nologo list runningvms | sed -e 's/^".*.*"{\(.*\)}/\1/' 2>/dev/null` + VMS=`$VBOXMANAGE --nologo list runningvms | sed -e 's/^".*".*{\(.*\)}/\1/' 2>/dev/null` if [ -n "$VMS" ]; then if [ "$SHUTDOWN" = "poweroff" ]; then begin_msg "Powering off remaining VMs" diff --git a/src/VBox/Installer/solaris/Makefile.kmk b/src/VBox/Installer/solaris/Makefile.kmk index 8fcb32c55..459b72197 100644 --- a/src/VBox/Installer/solaris/Makefile.kmk +++ b/src/VBox/Installer/solaris/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20585 2009-06-15 10:13:55Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the Solaris installer. # diff --git a/src/VBox/Installer/solaris/VBoxISAExec.c b/src/VBox/Installer/solaris/VBoxISAExec.c index 9d1dc32f2..3d28f4aa4 100644 --- a/src/VBox/Installer/solaris/VBoxISAExec.c +++ b/src/VBox/Installer/solaris/VBoxISAExec.c @@ -1,4 +1,4 @@ -/* $Id: VBoxISAExec.c 15912 2009-01-13 12:39:05Z vboxsync $ */ +/* $Id: VBoxISAExec.c $ */ /** @file * VBoxISAExec, ISA exec wrapper, Solaris hosts. */ diff --git a/src/VBox/Installer/solaris/VBoxZoneAccess.c b/src/VBox/Installer/solaris/VBoxZoneAccess.c index 13d1bb3c9..803720e14 100644 --- a/src/VBox/Installer/solaris/VBoxZoneAccess.c +++ b/src/VBox/Installer/solaris/VBoxZoneAccess.c @@ -1,4 +1,4 @@ -/* $Id: VBoxZoneAccess.c 17324 2009-03-04 08:09:59Z vboxsync $ */ +/* $Id: VBoxZoneAccess.c $ */ /** @file * VBoxZoneAccess - Hack that keeps vboxdrv referenced for granting zone access, Solaris hosts. */ diff --git a/src/VBox/Installer/solaris/checkinstall.sh b/src/VBox/Installer/solaris/checkinstall.sh index 11ec545ad..11ec545ad 100644..100755 --- a/src/VBox/Installer/solaris/checkinstall.sh +++ b/src/VBox/Installer/solaris/checkinstall.sh diff --git a/src/VBox/Installer/solaris/ipsinstall.sh b/src/VBox/Installer/solaris/ipsinstall.sh index 982bad6a6..982bad6a6 100644..100755 --- a/src/VBox/Installer/solaris/ipsinstall.sh +++ b/src/VBox/Installer/solaris/ipsinstall.sh diff --git a/src/VBox/Installer/solaris/makepackage.sh b/src/VBox/Installer/solaris/makepackage.sh index 2084b6ae2..37e5111f1 100644..100755 --- a/src/VBox/Installer/solaris/makepackage.sh +++ b/src/VBox/Installer/solaris/makepackage.sh @@ -132,6 +132,9 @@ fi cd "$PKG_BASE_DIR" find . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vbox.pkginfo|postinstall.sh|preremove.sh|ReadMe.txt|vbox.space|vbox.copyright|VirtualBoxKern' | pkgproto >> prototype +# Include only opt/VirtualBox and subdirectories as we want uninstall to clean up directory structure as well +find . -type d | $VBOX_GGREP -E 'opt/VirtualBox' | pkgproto >> prototype + # fix up file permissions (owner/group) # don't grok for class-specific files (like sed, if any) filelist_fixup prototype '$2 == "none"' '$5 = "root"; $6 = "bin"' diff --git a/src/VBox/Installer/solaris/postinstall.sh b/src/VBox/Installer/solaris/postinstall.sh index 21c8ad45d..21c8ad45d 100644..100755 --- a/src/VBox/Installer/solaris/postinstall.sh +++ b/src/VBox/Installer/solaris/postinstall.sh diff --git a/src/VBox/Installer/solaris/preremove.sh b/src/VBox/Installer/solaris/preremove.sh index 024d44506..024d44506 100644..100755 --- a/src/VBox/Installer/solaris/preremove.sh +++ b/src/VBox/Installer/solaris/preremove.sh diff --git a/src/VBox/Installer/solaris/smf-vboxwebsrv.sh b/src/VBox/Installer/solaris/smf-vboxwebsrv.sh index d5b804f2a..beb700626 100755 --- a/src/VBox/Installer/solaris/smf-vboxwebsrv.sh +++ b/src/VBox/Installer/solaris/smf-vboxwebsrv.sh @@ -1,5 +1,5 @@ #!/sbin/sh -# $Id: smf-vboxwebsrv.sh 20405 2009-06-08 13:37:56Z vboxsync $ +# $Id: smf-vboxwebsrv.sh $ # Copyright (C) 2008 Sun Microsystems, Inc. # diff --git a/src/VBox/Installer/solaris/vbi/makepackage.sh b/src/VBox/Installer/solaris/vbi/makepackage.sh index b48027b2f..b48027b2f 100644..100755 --- a/src/VBox/Installer/solaris/vbi/makepackage.sh +++ b/src/VBox/Installer/solaris/vbi/makepackage.sh diff --git a/src/VBox/Installer/solaris/vbi/preremove.sh b/src/VBox/Installer/solaris/vbi/preremove.sh index c4ee53b80..c4ee53b80 100644..100755 --- a/src/VBox/Installer/solaris/vbi/preremove.sh +++ b/src/VBox/Installer/solaris/vbi/preremove.sh diff --git a/src/VBox/Installer/solaris/virtualbox-webservice.xml b/src/VBox/Installer/solaris/virtualbox-webservice.xml index 24462502b..6603d0c30 100644 --- a/src/VBox/Installer/solaris/virtualbox-webservice.xml +++ b/src/VBox/Installer/solaris/virtualbox-webservice.xml @@ -65,7 +65,7 @@ <exec_method type='method' name='start' - exec='/opt/VirtualBox/smf-vboxwebsrv %m' + exec='/opt/VirtualBox/smf-vboxwebsrv.sh %m' timeout_seconds='15'> <method_context> <method_credential user='root' group='root' /> diff --git a/src/VBox/Installer/solaris/zoneaccess.sh b/src/VBox/Installer/solaris/zoneaccess.sh index fd5ec48a3..fd5ec48a3 100644..100755 --- a/src/VBox/Installer/solaris/zoneaccess.sh +++ b/src/VBox/Installer/solaris/zoneaccess.sh diff --git a/src/VBox/Main/ApplianceImpl.cpp b/src/VBox/Main/ApplianceImpl.cpp index 45a4f8a50..6e2b6fb44 100644 --- a/src/VBox/Main/ApplianceImpl.cpp +++ b/src/VBox/Main/ApplianceImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: ApplianceImpl.cpp 20930 2009-06-25 12:01:24Z vboxsync $ */ +/* $Id: ApplianceImpl.cpp $ */ /** @file * * IAppliance and IVirtualSystem COM class implementations. @@ -1105,6 +1105,8 @@ HRESULT Appliance::HandleVirtualSystemContent(const char *pcszPath, // 123456789012345 if (i.strHostResource.substr(0, 11) == "ovf://disk/") vd.strDiskId = i.strHostResource.substr(11); + else if (i.strHostResource.substr(0, 10) == "ovf:/disk/") + vd.strDiskId = i.strHostResource.substr(10); else if (i.strHostResource.substr(0, 6) == "/disk/") vd.strDiskId = i.strHostResource.substr(6); @@ -1945,7 +1947,7 @@ DECLCALLBACK(int) Appliance::taskThreadImportMachines(RTTHREAD /* aThread */, vo /* We need HWVirt & IO-APIC if more than one CPU is requested */ if (tmpCount > 1) { - rc = pNewMachine->COMSETTER(HWVirtExEnabled)(TSBool_True); + rc = pNewMachine->COMSETTER(HWVirtExEnabled)(TRUE); if (FAILED(rc)) throw rc; fEnableIOApic = true; @@ -3985,7 +3987,7 @@ HRESULT Appliance::setUpProgressUpload(ComObjPtr<Progress> &pProgress, const Bst ulTotalOperationsWeight = 1; m->ulWeightPerOperation = 1; } - ULONG ulOVFCreationWeight = ((double)ulTotalOperationsWeight * 50.0 / 100.0); /* Use 50% for the creation of the OVF & the disks */ + ULONG ulOVFCreationWeight = (ULONG)((double)ulTotalOperationsWeight * 50.0 / 100.0); /* Use 50% for the creation of the OVF & the disks */ ulTotalOperationsWeight += ulOVFCreationWeight; Log(("Setting up progress object: ulTotalMB = %d, cDisks = %d, => cOperations = %d, ulTotalOperationsWeight = %d, m->ulWeightPerOperation = %d\n", @@ -4375,6 +4377,7 @@ STDMETHODIMP VirtualSystemDescription::AddDescription(VirtualSystemDescriptionTy * @param strRef Reference item; only used with hard disk controllers. * @param aOrigValue Corresponding original value from OVF. * @param aAutoValue Initial configuration value (can be overridden by caller with setFinalValues). + * @param ulSizeMB Weight for IProgress * @param strExtraConfig Extra configuration; meaning dependent on type. */ void VirtualSystemDescription::addEntry(VirtualSystemDescriptionType_T aType, @@ -4807,6 +4810,7 @@ STDMETHODIMP Machine::Export(IAppliance *aAppliance, IVirtualSystemDescription * "", // ref strAttachmentType, // orig Utf8StrFmt("%RI32", (uint32_t)adapterType), // conf + 0, Utf8StrFmt("type=%s", strAttachmentType.c_str())); // extra conf } } diff --git a/src/VBox/Main/ConsoleImpl.cpp b/src/VBox/Main/ConsoleImpl.cpp index 6a2a8bd2c..35175cfad 100644 --- a/src/VBox/Main/ConsoleImpl.cpp +++ b/src/VBox/Main/ConsoleImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: ConsoleImpl.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: ConsoleImpl.cpp $ */ /** @file * @@ -851,7 +851,7 @@ HRESULT Console::loadDataFromSavedState() if (SSM_VERSION_MAJOR(version) == SSM_VERSION_MAJOR(sSSMConsoleVer)) { if (VBOX_SUCCESS (vrc)) - vrc = loadStateFileExec (ssm, this, 0); + vrc = loadStateFileExecInternal (ssm, version); else if (vrc == VERR_SSM_UNIT_NOT_FOUND) vrc = VINF_SUCCESS; } @@ -925,14 +925,13 @@ Console::saveStateFileExec (PSSMHANDLE pSSM, void *pvUser) /** * Callback handler to load various console data from the state file. - * When \a u32Version is 0, this method is called from #loadDataFromSavedState, - * otherwise it is called when the VM is being restored from the saved state. + * Called when the VM is being restored from the saved state. * * @param pvUser pointer to Console * @param u32Version Console unit version. - * When not 0, should match sSSMConsoleVer. + * Should match sSSMConsoleVer. * - * @note Locks the Console object for writing. + * @note Should locks the Console object for writing, if necessary. */ //static DECLCALLBACK(int) @@ -940,24 +939,36 @@ Console::loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version) { LogFlowFunc (("\n")); - if (u32Version != 0 && SSM_VERSION_MAJOR_CHANGED(u32Version, sSSMConsoleVer)) + if (SSM_VERSION_MAJOR_CHANGED(u32Version, sSSMConsoleVer)) return VERR_VERSION_MISMATCH; - if (u32Version != 0) - { - /* currently, nothing to do when we've been called from VMR3Load */ - return VINF_SUCCESS; - } - Console *that = static_cast <Console *> (pvUser); AssertReturn (that, VERR_INVALID_PARAMETER); - AutoCaller autoCaller (that); + /* Currently, nothing to do when we've been called from VMR3Load. */ + + return VINF_SUCCESS; +} + +/** + * Method to load various console data from the state file. + * Called from #loadDataFromSavedState. + * + * @param pvUser pointer to Console + * @param u32Version Console unit version. + * Should match sSSMConsoleVer. + * + * @note Locks the Console object for writing. + */ +int +Console::loadStateFileExecInternal (PSSMHANDLE pSSM, uint32_t u32Version) +{ + AutoCaller autoCaller (this); AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED); - AutoWriteLock alock (that); + AutoWriteLock alock (this); - AssertReturn (that->mSharedFolders.size() == 0, VERR_INTERNAL_ERROR); + AssertReturn (mSharedFolders.size() == 0, VERR_INTERNAL_ERROR); uint32_t size = 0; int vrc = SSMR3GetU32 (pSSM, &size); @@ -993,10 +1004,10 @@ Console::loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version) ComObjPtr <SharedFolder> sharedFolder; sharedFolder.createObject(); - HRESULT rc = sharedFolder->init (that, name, hostPath, writable); + HRESULT rc = sharedFolder->init (this, name, hostPath, writable); AssertComRCReturn (rc, VERR_INTERNAL_ERROR); - that->mSharedFolders.insert (std::make_pair (name, sharedFolder)); + mSharedFolders.insert (std::make_pair (name, sharedFolder)); } return VINF_SUCCESS; diff --git a/src/VBox/Main/ConsoleImpl2.cpp b/src/VBox/Main/ConsoleImpl2.cpp index c7e15ec4d..5fbc7578a 100644 --- a/src/VBox/Main/ConsoleImpl2.cpp +++ b/src/VBox/Main/ConsoleImpl2.cpp @@ -1,4 +1,4 @@ -/* $Id: ConsoleImpl2.cpp 20995 2009-06-26 21:49:23Z vboxsync $ */ +/* $Id: ConsoleImpl2.cpp $ */ /** @file * VBox Console COM Class implementation * @@ -160,6 +160,9 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole) /* lock the console because we widely use internal fields and methods */ AutoWriteLock alock (pConsole); + /* Save the VM pointer in the machine object */ + pConsole->mpVM = pVM; + ComPtr <IMachine> pMachine = pConsole->machine(); int rc; @@ -233,18 +236,10 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole) rc = CFGMR3InsertInteger(pRoot, "CSAMEnabled", 1); /* boolean */ RC_CHECK(); /* hardware virtualization extensions */ - TSBool_T hwVirtExEnabled; BOOL fHWVirtExEnabled; - hrc = pMachine->COMGETTER(HWVirtExEnabled)(&hwVirtExEnabled); H(); - if (hwVirtExEnabled == TSBool_Default) - { - /* check the default value */ - hrc = systemProperties->COMGETTER(HWVirtExEnabled)(&fHWVirtExEnabled); H(); - } - else - fHWVirtExEnabled = (hwVirtExEnabled == TSBool_True); + hrc = pMachine->COMGETTER(HWVirtExEnabled)(&fHWVirtExEnabled); H(); if (cCpus > 1) /** @todo SMP: This isn't nice, but things won't work on mac otherwise. */ - fHWVirtExEnabled = TSBool_True; + fHWVirtExEnabled = TRUE; #ifdef RT_OS_DARWIN rc = CFGMR3InsertInteger(pRoot, "HwVirtExtForced", fHWVirtExEnabled); RC_CHECK(); @@ -1112,8 +1107,8 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole) SafeArray <BSTR> names; SafeArray <BSTR> values; hrc = hardDisk->GetProperties (NULL, - ComSafeArrayAsOutParam (names), - ComSafeArrayAsOutParam (values)); H(); + ComSafeArrayAsOutParam (names), + ComSafeArrayAsOutParam (values)); H(); if (names.size() != 0) { @@ -1121,7 +1116,7 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole) rc = CFGMR3InsertNode (pCfg, "VDConfig", &pVDC); RC_CHECK(); for (size_t ii = 0; ii < names.size(); ++ ii) { - if (values [ii]) + if (values[ii] && *values[ii]) { Utf8Str name = names [ii]; Utf8Str value = values [ii]; @@ -2031,9 +2026,6 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvConsole) if (RT_SUCCESS (rc)) rc = rc2; - /* Save the VM pointer in the machine object */ - pConsole->mpVM = pVM; - LogFlowFunc (("vrc = %Rrc\n", rc)); LogFlowFuncLeave(); diff --git a/src/VBox/Main/ConsoleVRDPServer.cpp b/src/VBox/Main/ConsoleVRDPServer.cpp index 7a2ce9b30..6615bc039 100644 --- a/src/VBox/Main/ConsoleVRDPServer.cpp +++ b/src/VBox/Main/ConsoleVRDPServer.cpp @@ -1,4 +1,4 @@ -/* $Id: ConsoleVRDPServer.cpp 19134 2009-04-23 09:21:43Z vboxsync $ */ +/* $Id: ConsoleVRDPServer.cpp $ */ /** @file * diff --git a/src/VBox/Main/DHCPServerImpl.cpp b/src/VBox/Main/DHCPServerImpl.cpp index ab44b3cb3..2a25770d0 100644 --- a/src/VBox/Main/DHCPServerImpl.cpp +++ b/src/VBox/Main/DHCPServerImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: DHCPServerImpl.cpp 20596 2009-06-15 17:45:17Z vboxsync $ */ +/* $Id: DHCPServerImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/DHCPServerRunner.cpp b/src/VBox/Main/DHCPServerRunner.cpp index fb24a452c..d208c9713 100644 --- a/src/VBox/Main/DHCPServerRunner.cpp +++ b/src/VBox/Main/DHCPServerRunner.cpp @@ -1,4 +1,4 @@ -/* $Id: DHCPServerRunner.cpp 19510 2009-05-08 07:02:22Z vboxsync $ */ +/* $Id: DHCPServerRunner.cpp $ */ /** @file * VirtualBox Main - interface for VBox DHCP server */ diff --git a/src/VBox/Main/DVDDriveImpl.cpp b/src/VBox/Main/DVDDriveImpl.cpp index d1867a4f9..b49388c61 100644 --- a/src/VBox/Main/DVDDriveImpl.cpp +++ b/src/VBox/Main/DVDDriveImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: DVDDriveImpl.cpp 19511 2009-05-08 07:02:41Z vboxsync $ */ +/* $Id: DVDDriveImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/DisplayImpl.cpp b/src/VBox/Main/DisplayImpl.cpp index 64ac8fa9e..a57ade53b 100644 --- a/src/VBox/Main/DisplayImpl.cpp +++ b/src/VBox/Main/DisplayImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: DisplayImpl.cpp 20814 2009-06-23 10:40:53Z vboxsync $ */ +/* $Id: DisplayImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/FloppyDriveImpl.cpp b/src/VBox/Main/FloppyDriveImpl.cpp index 058e0e354..bbf4c9d82 100644 --- a/src/VBox/Main/FloppyDriveImpl.cpp +++ b/src/VBox/Main/FloppyDriveImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: FloppyDriveImpl.cpp 19511 2009-05-08 07:02:41Z vboxsync $ */ +/* $Id: FloppyDriveImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/Global.cpp b/src/VBox/Main/Global.cpp index 699e88384..ce1a9b06a 100644 --- a/src/VBox/Main/Global.cpp +++ b/src/VBox/Main/Global.cpp @@ -1,4 +1,4 @@ -/* $Id: Global.cpp 19811 2009-05-19 10:10:12Z vboxsync $ */ +/* $Id: Global.cpp $ */ /** @file * diff --git a/src/VBox/Main/GuestImpl.cpp b/src/VBox/Main/GuestImpl.cpp index ad69af39d..6365b7f10 100644 --- a/src/VBox/Main/GuestImpl.cpp +++ b/src/VBox/Main/GuestImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: GuestImpl.cpp 18113 2009-03-20 12:54:04Z vboxsync $ */ +/* $Id: GuestImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/HardDiskFormatImpl.cpp b/src/VBox/Main/HardDiskFormatImpl.cpp index 76917d9dc..370f9b522 100644 --- a/src/VBox/Main/HardDiskFormatImpl.cpp +++ b/src/VBox/Main/HardDiskFormatImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: HardDiskFormatImpl.cpp 16873 2009-02-17 19:07:37Z vboxsync $ */ +/* $Id: HardDiskFormatImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/HardDiskImpl.cpp b/src/VBox/Main/HardDiskImpl.cpp index a360c2d9d..b81672010 100644 --- a/src/VBox/Main/HardDiskImpl.cpp +++ b/src/VBox/Main/HardDiskImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: HardDiskImpl.cpp 21031 2009-06-29 15:26:13Z vboxsync $ */ +/* $Id: HardDiskImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/HostImpl.cpp b/src/VBox/Main/HostImpl.cpp index 4e8a26e78..46d2402ce 100644 --- a/src/VBox/Main/HostImpl.cpp +++ b/src/VBox/Main/HostImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: HostImpl.cpp 20977 2009-06-26 14:38:55Z vboxsync $ */ +/* $Id: HostImpl.cpp $ */ /** @file * VirtualBox COM class implementation: Host */ diff --git a/src/VBox/Main/HostNetworkInterfaceImpl.cpp b/src/VBox/Main/HostNetworkInterfaceImpl.cpp index b38ea077e..e9e1eb1d3 100644 --- a/src/VBox/Main/HostNetworkInterfaceImpl.cpp +++ b/src/VBox/Main/HostNetworkInterfaceImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: HostNetworkInterfaceImpl.cpp 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: HostNetworkInterfaceImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/HostPower.cpp b/src/VBox/Main/HostPower.cpp index b1206783c..48cc72207 100644 --- a/src/VBox/Main/HostPower.cpp +++ b/src/VBox/Main/HostPower.cpp @@ -54,6 +54,13 @@ void HostPowerService::notify (HostPowerEvent aEvent) { LogFunc (("SUSPEND\n")); +#ifdef VBOX_WITH_RESOURCE_USAGE_API + /* Suspend performance sampling to avoid unnecessary callbacks due to jumps in time. */ + PerformanceCollector *perfcollector = mVirtualBox->performanceCollector(); + + if (perfcollector) + perfcollector->suspendSampling(); +#endif mVirtualBox->getOpenedMachinesAndControls (machines, controls); /* pause running VMs */ @@ -103,6 +110,14 @@ void HostPowerService::notify (HostPowerEvent aEvent) LogFunc (("Resumed %d VMs\n", resumed)); +#ifdef VBOX_WITH_RESOURCE_USAGE_API + /* Resume the performance sampling. */ + PerformanceCollector *perfcollector = mVirtualBox->performanceCollector(); + + if (perfcollector) + perfcollector->resumeSampling(); +#endif + mConsoles.clear(); break; diff --git a/src/VBox/Main/KeyboardImpl.cpp b/src/VBox/Main/KeyboardImpl.cpp index fa12c5524..f1bf5f1fb 100644 --- a/src/VBox/Main/KeyboardImpl.cpp +++ b/src/VBox/Main/KeyboardImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: KeyboardImpl.cpp 15715 2008-12-22 13:15:30Z vboxsync $ */ +/* $Id: KeyboardImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/MachineDebuggerImpl.cpp b/src/VBox/Main/MachineDebuggerImpl.cpp index ba2da68a7..184a0b04a 100644 --- a/src/VBox/Main/MachineDebuggerImpl.cpp +++ b/src/VBox/Main/MachineDebuggerImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: MachineDebuggerImpl.cpp 19500 2009-05-07 18:23:22Z vboxsync $ */ +/* $Id: MachineDebuggerImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/MachineImpl.cpp b/src/VBox/Main/MachineImpl.cpp index 55f6ae177..6153763a2 100644 --- a/src/VBox/Main/MachineImpl.cpp +++ b/src/VBox/Main/MachineImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: MachineImpl.cpp 21002 2009-06-26 23:38:15Z vboxsync $ */ +/* $Id: MachineImpl.cpp $ */ /** @file * Implementation of IMachine in VBoxSVC. @@ -193,7 +193,7 @@ Machine::HWData::HWData() mVRAMSize = 8; mAccelerate3DEnabled = false; mMonitorCount = 1; - mHWVirtExEnabled = TSBool_False; + mHWVirtExEnabled = true; mHWVirtExNestedPagingEnabled = false; mHWVirtExVPIDEnabled = false; mPAEEnabled = false; @@ -500,9 +500,6 @@ HRESULT Machine::init (VirtualBox *aParent, CBSTR aConfigFile, /* Store OS type */ mUserData->mOSTypeId = aOsType->id(); - /* Apply HWVirtEx default; always true (used to rely on aOsType->recommendedVirtEx()) */ - mHWData->mHWVirtExEnabled = TSBool_True; - /* Apply BIOS defaults */ mBIOSSettings->applyDefaults (aOsType); @@ -1236,7 +1233,7 @@ STDMETHODIMP Machine::COMGETTER(BIOSSettings)(IBIOSSettings **biosSettings) return S_OK; } -STDMETHODIMP Machine::COMGETTER(HWVirtExEnabled)(TSBool_T *enabled) +STDMETHODIMP Machine::COMGETTER(HWVirtExEnabled)(BOOL *enabled) { if (!enabled) return E_POINTER; @@ -1251,7 +1248,7 @@ STDMETHODIMP Machine::COMGETTER(HWVirtExEnabled)(TSBool_T *enabled) return S_OK; } -STDMETHODIMP Machine::COMSETTER(HWVirtExEnabled)(TSBool_T enable) +STDMETHODIMP Machine::COMSETTER(HWVirtExEnabled)(BOOL enable) { AutoCaller autoCaller (this); CheckComRCReturnRC (autoCaller.rc()); @@ -5162,7 +5159,7 @@ HRESULT Machine::loadHardware (const settings::Key &aNode) /* CPU node (currently not required) */ { /* default value in case the node is not there */ - mHWData->mHWVirtExEnabled = TSBool_Default; + mHWData->mHWVirtExEnabled = true; mHWData->mHWVirtExNestedPagingEnabled = false; mHWData->mHWVirtExVPIDEnabled = false; mHWData->mPAEEnabled = false; @@ -5174,12 +5171,10 @@ HRESULT Machine::loadHardware (const settings::Key &aNode) if (!hwVirtExNode.isNull()) { const char *enabled = hwVirtExNode.stringValue ("enabled"); - if (strcmp (enabled, "false") == 0) - mHWData->mHWVirtExEnabled = TSBool_False; - else if (strcmp (enabled, "true") == 0) - mHWData->mHWVirtExEnabled = TSBool_True; + if (strcmp (enabled, "true") == 0) + mHWData->mHWVirtExEnabled = true; else - mHWData->mHWVirtExEnabled = TSBool_Default; + mHWData->mHWVirtExEnabled = false; } /* HardwareVirtExNestedPaging (optional, default is false) */ Key HWVirtExNestedPagingNode = cpuNode.findKey ("HardwareVirtExNestedPaging"); @@ -6718,18 +6713,10 @@ HRESULT Machine::saveHardware (settings::Key &aNode) Key cpuNode = aNode.createKey ("CPU"); Key hwVirtExNode = cpuNode.createKey ("HardwareVirtEx"); const char *value = NULL; - switch (mHWData->mHWVirtExEnabled) - { - case TSBool_False: - value = "false"; - break; - case TSBool_True: - value = "true"; - break; - case TSBool_Default: - value = "default"; - break; - } + if (mHWData->mHWVirtExEnabled) + value = "true"; + else + value = "false"; hwVirtExNode.setStringValue ("enabled", value); /* Nested paging (optional, default is false) */ diff --git a/src/VBox/Main/Makefile.kmk b/src/VBox/Main/Makefile.kmk index 8884060ca..6e0ee8913 100644 --- a/src/VBox/Main/Makefile.kmk +++ b/src/VBox/Main/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20932 2009-06-25 12:27:02Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Makefile for the VBox Main module. # @@ -485,6 +485,9 @@ ifdef VBOX_WITH_XPCOM DLLS += VBoxSVCM VBoxSVCM_TEMPLATE = VBOXMAINCOMP VBoxSVCM_DEFS = IN_RING3 $(VBOX_MAIN_DEFS) +ifdef VBOX_WITH_HARDENING + VBoxSVCM_DEFS += VBOX_WITH_HARDENING +endif VBoxSVCM_INCS = \ include \ $(PATH_VBoxC) \ diff --git a/src/VBox/Main/MediumImpl.cpp b/src/VBox/Main/MediumImpl.cpp index cbffecc87..8e4e3fc1f 100644 --- a/src/VBox/Main/MediumImpl.cpp +++ b/src/VBox/Main/MediumImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: MediumImpl.cpp 20977 2009-06-26 14:38:55Z vboxsync $ */ +/* $Id: MediumImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/MouseImpl.cpp b/src/VBox/Main/MouseImpl.cpp index 3f59716d9..2623585bc 100644 --- a/src/VBox/Main/MouseImpl.cpp +++ b/src/VBox/Main/MouseImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: MouseImpl.cpp 20990 2009-06-26 17:08:47Z vboxsync $ */ +/* $Id: MouseImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/NetworkAdapterImpl.cpp b/src/VBox/Main/NetworkAdapterImpl.cpp index 577737914..fd62b3313 100644 --- a/src/VBox/Main/NetworkAdapterImpl.cpp +++ b/src/VBox/Main/NetworkAdapterImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: NetworkAdapterImpl.cpp 20977 2009-06-26 14:38:55Z vboxsync $ */ +/* $Id: NetworkAdapterImpl.cpp $ */ /** @file * Implementation of INetworkAdaptor in VBoxSVC. */ diff --git a/src/VBox/Main/ParallelPortImpl.cpp b/src/VBox/Main/ParallelPortImpl.cpp index ca7b671a5..b0430e3ba 100644 --- a/src/VBox/Main/ParallelPortImpl.cpp +++ b/src/VBox/Main/ParallelPortImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: ParallelPortImpl.cpp 16560 2009-02-06 18:06:04Z vboxsync $ */ +/* $Id: ParallelPortImpl.cpp $ */ /** @file * VirtualBox COM class implementation */ diff --git a/src/VBox/Main/Performance.cpp b/src/VBox/Main/Performance.cpp index 708355744..a35688fa6 100644 --- a/src/VBox/Main/Performance.cpp +++ b/src/VBox/Main/Performance.cpp @@ -1,4 +1,4 @@ -/* $Id: Performance.cpp 17911 2009-03-16 10:30:55Z vboxsync $ */ +/* $Id: Performance.cpp $ */ /** @file * diff --git a/src/VBox/Main/PerformanceImpl.cpp b/src/VBox/Main/PerformanceImpl.cpp index 4c3f405b1..49b036987 100644 --- a/src/VBox/Main/PerformanceImpl.cpp +++ b/src/VBox/Main/PerformanceImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: PerformanceImpl.cpp 20826 2009-06-23 12:58:13Z vboxsync $ */ +/* $Id: PerformanceImpl.cpp $ */ /** @file * @@ -521,6 +521,25 @@ void PerformanceCollector::unregisterMetricsFor (const ComPtr <IUnknown> &aObjec //LogFlowThisFuncLeave(); } +void PerformanceCollector::suspendSampling() +{ + AutoCaller autoCaller (this); + if (!SUCCEEDED (autoCaller.rc())) return; + + int rc = RTTimerLRStop(m.sampler); + AssertRC(rc); +} + +void PerformanceCollector::resumeSampling() +{ + AutoCaller autoCaller (this); + if (!SUCCEEDED (autoCaller.rc())) return; + + int rc = RTTimerLRStart(m.sampler, 0); + AssertRC(rc); +} + + // private methods /////////////////////////////////////////////////////////////////////////////// diff --git a/src/VBox/Main/ProgressImpl.cpp b/src/VBox/Main/ProgressImpl.cpp index 060825c4a..f14a48bb9 100644 --- a/src/VBox/Main/ProgressImpl.cpp +++ b/src/VBox/Main/ProgressImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: ProgressImpl.cpp 20220 2009-06-03 08:40:29Z vboxsync $ */ +/* $Id: ProgressImpl.cpp $ */ /** @file * * VirtualBox Progress COM class implementation diff --git a/src/VBox/Main/RemoteUSBDeviceImpl.cpp b/src/VBox/Main/RemoteUSBDeviceImpl.cpp index 1037b1488..bc7c842cf 100644 --- a/src/VBox/Main/RemoteUSBDeviceImpl.cpp +++ b/src/VBox/Main/RemoteUSBDeviceImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: RemoteUSBDeviceImpl.cpp 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: RemoteUSBDeviceImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/StorageControllerImpl.cpp b/src/VBox/Main/StorageControllerImpl.cpp index 815456f39..21104a131 100644 --- a/src/VBox/Main/StorageControllerImpl.cpp +++ b/src/VBox/Main/StorageControllerImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: StorageControllerImpl.cpp 17768 2009-03-12 17:49:08Z vboxsync $ */ +/* $Id: StorageControllerImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/SystemPropertiesImpl.cpp b/src/VBox/Main/SystemPropertiesImpl.cpp index fbfc03bd0..9f1f1e642 100644 --- a/src/VBox/Main/SystemPropertiesImpl.cpp +++ b/src/VBox/Main/SystemPropertiesImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: SystemPropertiesImpl.cpp 20262 2009-06-04 10:21:46Z vboxsync $ */ +/* $Id: SystemPropertiesImpl.cpp $ */ /** @file * @@ -82,7 +82,6 @@ HRESULT SystemProperties::init (VirtualBox *aParent) setRemoteDisplayAuthLibrary (NULL); - mHWVirtExEnabled = false; mLogHistoryCount = 3; HRESULT rc = S_OK; @@ -200,7 +199,16 @@ STDMETHODIMP SystemProperties::COMGETTER(MaxGuestRAM)(ULONG *maxRAM) /* no need to lock, this is const */ AssertCompile(MM_RAM_MAX_IN_MB <= SchemaDefs::MaxGuestRAM); - *maxRAM = MM_RAM_MAX_IN_MB; + ULONG maxRAMSys = MM_RAM_MAX_IN_MB; + ULONG maxRAMArch = maxRAMSys; +#if HC_ARCH_BITS == 32 && !defined(RT_OS_DARWIN) +# ifdef RT_OS_WINDOWS + maxRAMArch = UINT32_C(2048); +# else + maxRAMArch = UINT32_C(2560); +# endif +#endif + *maxRAM = RT_MIN(maxRAMSys, maxRAMArch); return S_OK; } @@ -515,36 +523,6 @@ STDMETHODIMP SystemProperties::COMSETTER(WebServiceAuthLibrary) (IN_BSTR aWebSer return rc; } -STDMETHODIMP SystemProperties::COMGETTER(HWVirtExEnabled) (BOOL *enabled) -{ - if (!enabled) - return E_POINTER; - - AutoCaller autoCaller (this); - CheckComRCReturnRC (autoCaller.rc()); - - AutoReadLock alock (this); - - *enabled = mHWVirtExEnabled; - - return S_OK; -} - -STDMETHODIMP SystemProperties::COMSETTER(HWVirtExEnabled) (BOOL enabled) -{ - AutoCaller autoCaller (this); - CheckComRCReturnRC (autoCaller.rc()); - - /* VirtualBox::saveSettings() needs a write lock */ - AutoMultiWriteLock2 alock (mParent, this); - - mHWVirtExEnabled = enabled; - - HRESULT rc = mParent->saveSettings(); - - return rc; -} - STDMETHODIMP SystemProperties::COMGETTER(LogHistoryCount) (ULONG *count) { if (!count) @@ -630,9 +608,6 @@ HRESULT SystemProperties::loadSettings (const settings::Key &aGlobal) rc = setWebServiceAuthLibrary (bstr); CheckComRCReturnRC (rc); - /* Note: not <BOOL> because Win32 defines BOOL as int */ - mHWVirtExEnabled = properties.valueOr <bool> ("HWVirtExEnabled", false); - mLogHistoryCount = properties.valueOr <ULONG> ("LogHistoryCount", 3); return S_OK; @@ -671,8 +646,6 @@ HRESULT SystemProperties::saveSettings (settings::Key &aGlobal) if (mWebServiceAuthLibrary) properties.setValue <Bstr> ("webServiceAuthLibrary", mWebServiceAuthLibrary); - properties.setValue <bool> ("HWVirtExEnabled", !!mHWVirtExEnabled); - properties.setValue <ULONG> ("LogHistoryCount", mLogHistoryCount); return S_OK; diff --git a/src/VBox/Main/USBControllerImpl.cpp b/src/VBox/Main/USBControllerImpl.cpp index ee02c959b..7fab71e98 100644 --- a/src/VBox/Main/USBControllerImpl.cpp +++ b/src/VBox/Main/USBControllerImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: USBControllerImpl.cpp 20976 2009-06-26 14:17:49Z vboxsync $ */ +/* $Id: USBControllerImpl.cpp $ */ /** @file * Implementation of IUSBController. */ diff --git a/src/VBox/Main/USBDeviceImpl.cpp b/src/VBox/Main/USBDeviceImpl.cpp index 373b7cb3e..531692272 100644 --- a/src/VBox/Main/USBDeviceImpl.cpp +++ b/src/VBox/Main/USBDeviceImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: USBDeviceImpl.cpp 20976 2009-06-26 14:17:49Z vboxsync $ */ +/* $Id: USBDeviceImpl.cpp $ */ /** @file * diff --git a/src/VBox/Main/VFSExplorerImpl.cpp b/src/VBox/Main/VFSExplorerImpl.cpp index 53870c8d4..f69ef49ff 100644 --- a/src/VBox/Main/VFSExplorerImpl.cpp +++ b/src/VBox/Main/VFSExplorerImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: VFSExplorerImpl.cpp 20963 2009-06-26 09:35:27Z vboxsync $ */ +/* $Id: VFSExplorerImpl.cpp $ */ /** @file * * IVFSExplorer COM class implementations. @@ -362,7 +362,7 @@ HRESULT VFSExplorer::deleteFS(TaskVFSExplorer *aTask) if (RT_FAILURE(vrc)) throw setError(VBOX_E_FILE_ERROR, tr ("Can't delete file '%s' (%Rrc)"), szPath, vrc); if(aTask->progress) - aTask->progress->setCurrentOperationProgress(fPercentStep * i); + aTask->progress->setCurrentOperationProgress((ULONG)(fPercentStep * i)); } } catch(HRESULT aRC) @@ -488,7 +488,7 @@ HRESULT VFSExplorer::deleteS3(TaskVFSExplorer *aTask) if (RT_FAILURE(vrc)) throw setError(VBOX_E_FILE_ERROR, tr ("Can't delete file '%s' (%Rrc)"), (*it).c_str(), vrc); if(aTask->progress) - aTask->progress->setCurrentOperationProgress(fPercentStep * i); + aTask->progress->setCurrentOperationProgress((ULONG)(fPercentStep * i)); } } catch(HRESULT aRC) diff --git a/src/VBox/Main/VirtualBoxBase.cpp b/src/VBox/Main/VirtualBoxBase.cpp index 47a8536b7..6e3432a6f 100644 --- a/src/VBox/Main/VirtualBoxBase.cpp +++ b/src/VBox/Main/VirtualBoxBase.cpp @@ -1,4 +1,4 @@ -/* $Id: VirtualBoxBase.cpp 17911 2009-03-16 10:30:55Z vboxsync $ */ +/* $Id: VirtualBoxBase.cpp $ */ /** @file * diff --git a/src/VBox/Main/VirtualBoxImpl.cpp b/src/VBox/Main/VirtualBoxImpl.cpp index 892f39933..29778646b 100644 --- a/src/VBox/Main/VirtualBoxImpl.cpp +++ b/src/VBox/Main/VirtualBoxImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: VirtualBoxImpl.cpp 20978 2009-06-26 14:52:36Z vboxsync $ */ +/* $Id: VirtualBoxImpl.cpp $ */ /** @file * Implementation of IVirtualBox in VBoxSVC. diff --git a/src/VBox/Main/cbinding/Makefile.kmk b/src/VBox/Main/cbinding/Makefile.kmk index 8f48dc5d8..fa6bb0e7a 100644 --- a/src/VBox/Main/cbinding/Makefile.kmk +++ b/src/VBox/Main/cbinding/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20223 2009-06-03 09:05:39Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VBox C Binding. # diff --git a/src/VBox/Main/cbinding/VBoxXPCOMC.cpp b/src/VBox/Main/cbinding/VBoxXPCOMC.cpp index 0ecf1e7e5..ef958c534 100644 --- a/src/VBox/Main/cbinding/VBoxXPCOMC.cpp +++ b/src/VBox/Main/cbinding/VBoxXPCOMC.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxXPCOMC.cpp 20223 2009-06-03 09:05:39Z vboxsync $ */ +/* $Id: VBoxXPCOMC.cpp $ */ /** @file VBoxXPCOMC.cpp * Utility functions to use with the C binding for XPCOM. */ diff --git a/src/VBox/Main/cbinding/VBoxXPCOMCGlue.c b/src/VBox/Main/cbinding/VBoxXPCOMCGlue.c index c2be0aa8c..cef657254 100644 --- a/src/VBox/Main/cbinding/VBoxXPCOMCGlue.c +++ b/src/VBox/Main/cbinding/VBoxXPCOMCGlue.c @@ -1,4 +1,4 @@ -/* $Revision: 19052 $ */ +/* $Revision: 46177 $ */ /** @file * Glue code for dynamically linking to VBoxXPCOMC. */ diff --git a/src/VBox/Main/cbinding/VBoxXPCOMCGlue.h b/src/VBox/Main/cbinding/VBoxXPCOMCGlue.h index f99dc6990..e9cd05129 100644 --- a/src/VBox/Main/cbinding/VBoxXPCOMCGlue.h +++ b/src/VBox/Main/cbinding/VBoxXPCOMCGlue.h @@ -1,4 +1,4 @@ -/* $Revision: 20223 $ */ +/* $Revision: 48067 $ */ /** @file VBoxXPCOMCGlue.h * Glue for dynamically linking with VBoxXPCOMC. */ diff --git a/src/VBox/Main/cbinding/makefile.tstXPCOMCGlue b/src/VBox/Main/cbinding/makefile.tstXPCOMCGlue index d65aee844..2829d820b 100644 --- a/src/VBox/Main/cbinding/makefile.tstXPCOMCGlue +++ b/src/VBox/Main/cbinding/makefile.tstXPCOMCGlue @@ -1,4 +1,4 @@ -# $Revision: 18998 $ +# $Revision: 46090 $ ## @file makefile.tstLinuxC # Makefile for sample program illustrating use of C binding for XPCOM. # diff --git a/src/VBox/Main/cbinding/tstXPCOMCCall.c b/src/VBox/Main/cbinding/tstXPCOMCCall.c index 3f9337a5c..ecf0155c0 100644 --- a/src/VBox/Main/cbinding/tstXPCOMCCall.c +++ b/src/VBox/Main/cbinding/tstXPCOMCCall.c @@ -1,4 +1,4 @@ -/* $Revision: 20220 $ */ +/* $Revision: 48062 $ */ /** @file tstXPCOMCGlue.c * Demonstrator program to illustrate use of C bindings of Main API. * diff --git a/src/VBox/Main/cbinding/tstXPCOMCGlue.c b/src/VBox/Main/cbinding/tstXPCOMCGlue.c index efc5aa9d6..cda25208f 100644 --- a/src/VBox/Main/cbinding/tstXPCOMCGlue.c +++ b/src/VBox/Main/cbinding/tstXPCOMCGlue.c @@ -1,4 +1,4 @@ -/* $Revision: 20220 $ */ +/* $Revision: 48062 $ */ /** @file tstXPCOMCGlue.c * Demonstrator program to illustrate use of C bindings of Main API. * diff --git a/src/VBox/Main/cbinding/xpcidl.xsl b/src/VBox/Main/cbinding/xpcidl.xsl index 430a4e58d..f762c03a7 100644 --- a/src/VBox/Main/cbinding/xpcidl.xsl +++ b/src/VBox/Main/cbinding/xpcidl.xsl @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<!-- $Id: xpidl.xsl 39869 2008-11-25 13:37:40Z dmik $ --> +<!-- $Id: xpidl.xsl $ --> <!-- * A template to generate a XPCOM IDL compatible interface definition file diff --git a/src/VBox/Main/darwin/NetIf-darwin.cpp b/src/VBox/Main/darwin/NetIf-darwin.cpp index c244835c2..045cbf04f 100644 --- a/src/VBox/Main/darwin/NetIf-darwin.cpp +++ b/src/VBox/Main/darwin/NetIf-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: NetIf-darwin.cpp 20475 2009-06-11 13:30:26Z vboxsync $ */ +/* $Id: NetIf-darwin.cpp $ */ /** @file * Main - NetIfList, Darwin implementation. */ diff --git a/src/VBox/Main/darwin/OpenGLTestDarwin.cpp b/src/VBox/Main/darwin/OpenGLTestDarwin.cpp index 82fde4f6d..6da86d461 100644 --- a/src/VBox/Main/darwin/OpenGLTestDarwin.cpp +++ b/src/VBox/Main/darwin/OpenGLTestDarwin.cpp @@ -1,4 +1,4 @@ -/* $Id: OpenGLTestDarwin.cpp 20512 2009-06-12 13:02:29Z vboxsync $ */ +/* $Id: OpenGLTestDarwin.cpp $ */ /** @file * VBox host opengl support test diff --git a/src/VBox/Main/darwin/PerformanceDarwin.cpp b/src/VBox/Main/darwin/PerformanceDarwin.cpp index dc273cd5a..1cde14bf2 100644 --- a/src/VBox/Main/darwin/PerformanceDarwin.cpp +++ b/src/VBox/Main/darwin/PerformanceDarwin.cpp @@ -1,4 +1,4 @@ -/* $Id: PerformanceDarwin.cpp 14944 2008-12-03 14:09:42Z vboxsync $ */ +/* $Id: PerformanceDarwin.cpp $ */ /** @file * diff --git a/src/VBox/Main/darwin/iokit.cpp b/src/VBox/Main/darwin/iokit.cpp index 0410b82c1..01a28cb8a 100644 --- a/src/VBox/Main/darwin/iokit.cpp +++ b/src/VBox/Main/darwin/iokit.cpp @@ -1,4 +1,4 @@ -/* $Id: iokit.cpp 18260 2009-03-25 14:04:13Z vboxsync $ */ +/* $Id: iokit.cpp $ */ /** @file * Main - Darwin IOKit Routines. * diff --git a/src/VBox/Main/darwin/iokit.h b/src/VBox/Main/darwin/iokit.h index d6877361e..c3c8ac096 100644 --- a/src/VBox/Main/darwin/iokit.h +++ b/src/VBox/Main/darwin/iokit.h @@ -1,4 +1,4 @@ -/* $Id: iokit.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: iokit.h $ */ /** @file * Main - Darwin IOKit Routines. */ diff --git a/src/VBox/Main/freebsd/NetIf-freebsd.cpp b/src/VBox/Main/freebsd/NetIf-freebsd.cpp index f5f9136f5..99e6e5688 100644 --- a/src/VBox/Main/freebsd/NetIf-freebsd.cpp +++ b/src/VBox/Main/freebsd/NetIf-freebsd.cpp @@ -1,4 +1,4 @@ -/* $Id: NetIf-freebsd.cpp 18971 2009-04-16 23:41:48Z vboxsync $ */ +/* $Id: NetIf-freebsd.cpp $ */ /** @file * Main - NetIfList, FreeBSD implementation. */ diff --git a/src/VBox/Main/freebsd/PerformanceFreeBSD.cpp b/src/VBox/Main/freebsd/PerformanceFreeBSD.cpp index 75eaf0729..e17b5c6a5 100644 --- a/src/VBox/Main/freebsd/PerformanceFreeBSD.cpp +++ b/src/VBox/Main/freebsd/PerformanceFreeBSD.cpp @@ -1,4 +1,4 @@ -/* $Id: PerformanceFreeBSD.cpp 19067 2009-04-21 11:43:22Z vboxsync $ */ +/* $Id: PerformanceFreeBSD.cpp $ */ /** @file * VirtualBox Performance Collector, FreeBSD Specialization. */ diff --git a/src/VBox/Main/generic/NetIf-generic.cpp b/src/VBox/Main/generic/NetIf-generic.cpp index 398905d38..a0c31be16 100644 --- a/src/VBox/Main/generic/NetIf-generic.cpp +++ b/src/VBox/Main/generic/NetIf-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: NetIf-generic.cpp 19924 2009-05-22 21:52:47Z vboxsync $ */ +/* $Id: NetIf-generic.cpp $ */ /** @file * VirtualBox Main - Generic NetIf implementation. */ diff --git a/src/VBox/Main/generic/OpenGLTest.cpp b/src/VBox/Main/generic/OpenGLTest.cpp index 1e195f81a..b5b505eab 100644 --- a/src/VBox/Main/generic/OpenGLTest.cpp +++ b/src/VBox/Main/generic/OpenGLTest.cpp @@ -1,4 +1,4 @@ -/* $Id: OpenGLTest.cpp 20515 2009-06-12 13:36:57Z vboxsync $ */ +/* $Id: OpenGLTest.cpp $ */ /** @file * VBox host opengl support test - generic implementation. */ diff --git a/src/VBox/Main/generic/OpenGLTestApp.cpp b/src/VBox/Main/generic/OpenGLTestApp.cpp index 2fb5cd7e1..e73dd3bd6 100644 --- a/src/VBox/Main/generic/OpenGLTestApp.cpp +++ b/src/VBox/Main/generic/OpenGLTestApp.cpp @@ -1,4 +1,4 @@ -/* $Id: OpenGLTestApp.cpp 20500 2009-06-12 11:30:19Z vboxsync $ */ +/* $Id: OpenGLTestApp.cpp $ */ /** @file * VBox host opengl support test application. */ diff --git a/src/VBox/Main/glue/ErrorInfo.cpp b/src/VBox/Main/glue/ErrorInfo.cpp index c4fe0d6bf..11d568268 100644 --- a/src/VBox/Main/glue/ErrorInfo.cpp +++ b/src/VBox/Main/glue/ErrorInfo.cpp @@ -1,4 +1,4 @@ -/* $Id: ErrorInfo.cpp 20267 2009-06-04 11:27:27Z vboxsync $ */ +/* $Id: ErrorInfo.cpp $ */ /** @file * diff --git a/src/VBox/Main/glue/EventQueue.cpp b/src/VBox/Main/glue/EventQueue.cpp index 33b967f2f..8ae0f46e9 100644 --- a/src/VBox/Main/glue/EventQueue.cpp +++ b/src/VBox/Main/glue/EventQueue.cpp @@ -1,4 +1,4 @@ -/* $Id: EventQueue.cpp 16555 2009-02-06 16:21:41Z vboxsync $ */ +/* $Id: EventQueue.cpp $ */ /** @file * diff --git a/src/VBox/Main/glue/SupportErrorInfo.cpp b/src/VBox/Main/glue/SupportErrorInfo.cpp index 20e4fbb8b..9c9d4ba6c 100644 --- a/src/VBox/Main/glue/SupportErrorInfo.cpp +++ b/src/VBox/Main/glue/SupportErrorInfo.cpp @@ -1,4 +1,4 @@ -/* $Id: SupportErrorInfo.cpp 20267 2009-06-04 11:27:27Z vboxsync $ */ +/* $Id: SupportErrorInfo.cpp $ */ /** @file * MS COM / XPCOM Abstraction Layer: diff --git a/src/VBox/Main/glue/VirtualBoxErrorInfo.cpp b/src/VBox/Main/glue/VirtualBoxErrorInfo.cpp index 09466a717..e2e32ad5d 100644 --- a/src/VBox/Main/glue/VirtualBoxErrorInfo.cpp +++ b/src/VBox/Main/glue/VirtualBoxErrorInfo.cpp @@ -1,4 +1,4 @@ -/* $Id: VirtualBoxErrorInfo.cpp 20267 2009-06-04 11:27:27Z vboxsync $ */ +/* $Id: VirtualBoxErrorInfo.cpp $ */ /** @file * MS COM / XPCOM Abstraction Layer: diff --git a/src/VBox/Main/glue/com.cpp b/src/VBox/Main/glue/com.cpp index 021e02ae1..a18ce24f6 100644 --- a/src/VBox/Main/glue/com.cpp +++ b/src/VBox/Main/glue/com.cpp @@ -1,4 +1,4 @@ -/* $Id: com.cpp 13908 2008-11-06 11:53:47Z vboxsync $ */ +/* $Id: com.cpp $ */ /** @file * MS COM / XPCOM Abstraction Layer diff --git a/src/VBox/Main/glue/errorprint.cpp b/src/VBox/Main/glue/errorprint.cpp index 3432e3a60..0e621f94a 100644 --- a/src/VBox/Main/glue/errorprint.cpp +++ b/src/VBox/Main/glue/errorprint.cpp @@ -1,4 +1,4 @@ -/* $Id: errorprint.cpp 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: errorprint.cpp $ */ /** @file * MS COM / XPCOM Abstraction Layer: diff --git a/src/VBox/Main/glue/initterm.cpp b/src/VBox/Main/glue/initterm.cpp index 9a150a1f4..06fb34ab6 100644 --- a/src/VBox/Main/glue/initterm.cpp +++ b/src/VBox/Main/glue/initterm.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm.cpp 18831 2009-04-07 15:45:35Z vboxsync $ */ +/* $Id: initterm.cpp $ */ /** @file * MS COM / XPCOM Abstraction Layer - Initialization and Termination. diff --git a/src/VBox/Main/glue/string.cpp b/src/VBox/Main/glue/string.cpp index fafc863d5..56092a7ba 100644 --- a/src/VBox/Main/glue/string.cpp +++ b/src/VBox/Main/glue/string.cpp @@ -1,4 +1,4 @@ -/* $Id: string.cpp 17634 2009-03-10 15:01:07Z vboxsync $ */ +/* $Id: string.cpp $ */ /** @file * diff --git a/src/VBox/Main/idl/VirtualBox.xidl b/src/VBox/Main/idl/VirtualBox.xidl index 1f7c20576..cf5595325 100644 --- a/src/VBox/Main/idl/VirtualBox.xidl +++ b/src/VBox/Main/idl/VirtualBox.xidl @@ -346,19 +346,6 @@ --> <enum - name="TSBool" - uuid="523ff64d-842a-4b1a-80e7-c311b028cb3a" - > - <desc> - Boolean variable having a third state, default. - </desc> - - <const name="False" value="0"/> - <const name="True" value="1"/> - <const name="Default" value="2"/> - </enum> - - <enum name="AccessMode" uuid="1da0007c-ddf7-4be8-bcac-d84a1558785f" > @@ -4159,7 +4146,7 @@ <interface name="IMachine" extends="$unknown" - uuid="4d1df26d-d9c1-4c7e-b689-15e85ecf8ffc" + uuid="540dcfda-3df2-49c6-88fa-033a28c2ff85" wsmap="managed" > <desc> @@ -4388,7 +4375,7 @@ <desc>Object containing all BIOS settings.</desc> </attribute> - <attribute name="HWVirtExEnabled" type="TSBool"> + <attribute name="HWVirtExEnabled" type="boolean"> <desc> This setting determines whether VirtualBox will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x @@ -7532,7 +7519,7 @@ <interface name="ISystemProperties" extends="$unknown" - uuid="63bfd184-df69-4949-9159-a923cf7b1207" + uuid="9ca0f712-83f3-4631-b143-b75ef6568332" wsmap="managed" > <desc> @@ -7787,16 +7774,6 @@ </desc> </attribute> - <attribute name="HWVirtExEnabled" type="boolean"> - <desc> - This specifies the default value for hardware virtualization - extensions. If enabled, virtual machines will make use of - hardware virtualization extensions such as Intel VT-x and - AMD-V by default. This value can be overridden by each VM - using their <link to="IMachine::HWVirtExEnabled" /> property. - </desc> - </attribute> - <attribute name="LogHistoryCount" type="unsigned long"> <desc> This value specifies how many old release log files are kept. diff --git a/src/VBox/Main/idl/midl.xsl b/src/VBox/Main/idl/midl.xsl index ed51382a4..5cf2136c3 100644 --- a/src/VBox/Main/idl/midl.xsl +++ b/src/VBox/Main/idl/midl.xsl @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<!-- $Id: midl.xsl 19134 2009-04-23 09:21:43Z vboxsync $ --> +<!-- $Id: midl.xsl $ --> <!-- * A template to generate a MS IDL compatible interface definition file diff --git a/src/VBox/Main/idl/xpidl.xsl b/src/VBox/Main/idl/xpidl.xsl index 85b9cc4d8..70b1c1cc8 100644 --- a/src/VBox/Main/idl/xpidl.xsl +++ b/src/VBox/Main/idl/xpidl.xsl @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<!-- $Id: xpidl.xsl 14572 2008-11-25 13:37:40Z vboxsync $ --> +<!-- $Id: xpidl.xsl $ --> <!-- * A template to generate a XPCOM IDL compatible interface definition file diff --git a/src/VBox/Main/include/ApplianceImpl.h b/src/VBox/Main/include/ApplianceImpl.h index 4e9c84086..19d3ecb93 100644 --- a/src/VBox/Main/include/ApplianceImpl.h +++ b/src/VBox/Main/include/ApplianceImpl.h @@ -1,4 +1,4 @@ -/* $Id: ApplianceImpl.h 20082 2009-05-27 13:01:06Z vboxsync $ */ +/* $Id: ApplianceImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/AudioAdapterImpl.h b/src/VBox/Main/include/AudioAdapterImpl.h index 835ba3ac0..667eb680b 100644 --- a/src/VBox/Main/include/AudioAdapterImpl.h +++ b/src/VBox/Main/include/AudioAdapterImpl.h @@ -1,4 +1,4 @@ -/* $Id: AudioAdapterImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: AudioAdapterImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/ConsoleImpl.h b/src/VBox/Main/include/ConsoleImpl.h index bebaf3b73..9c73dccb6 100644 --- a/src/VBox/Main/include/ConsoleImpl.h +++ b/src/VBox/Main/include/ConsoleImpl.h @@ -1,4 +1,4 @@ -/* $Id: ConsoleImpl.h 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: ConsoleImpl.h $ */ /** @file * @@ -494,6 +494,7 @@ private: static uint32_t sSSMConsoleVer; HRESULT loadDataFromSavedState(); + int loadStateFileExecInternal (PSSMHANDLE pSSM, uint32_t u32Version); static DECLCALLBACK(void) saveStateFileExec (PSSMHANDLE pSSM, void *pvUser); static DECLCALLBACK(int) loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version); diff --git a/src/VBox/Main/include/ConsoleVRDPServer.h b/src/VBox/Main/include/ConsoleVRDPServer.h index 01720e450..f29e706e3 100644 --- a/src/VBox/Main/include/ConsoleVRDPServer.h +++ b/src/VBox/Main/include/ConsoleVRDPServer.h @@ -1,4 +1,4 @@ -/* $Id: ConsoleVRDPServer.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: ConsoleVRDPServer.h $ */ /** @file * diff --git a/src/VBox/Main/include/DHCPServerImpl.h b/src/VBox/Main/include/DHCPServerImpl.h index b4b5063b7..ba4f8b8e1 100644 --- a/src/VBox/Main/include/DHCPServerImpl.h +++ b/src/VBox/Main/include/DHCPServerImpl.h @@ -1,4 +1,4 @@ -/* $Id: DHCPServerImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: DHCPServerImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/DHCPServerRunner.h b/src/VBox/Main/include/DHCPServerRunner.h index c1ccb8916..374a51453 100644 --- a/src/VBox/Main/include/DHCPServerRunner.h +++ b/src/VBox/Main/include/DHCPServerRunner.h @@ -1,4 +1,4 @@ -/* $Id: DHCPServerRunner.h 18208 2009-03-24 17:01:32Z vboxsync $ */ +/* $Id: DHCPServerRunner.h $ */ /** @file * VirtualBox Main - interface for VBox DHCP server */ @@ -63,14 +63,14 @@ public: return VERR_INVALID_STATE; #ifdef RT_OS_WINDOWS - if(val && strlen(val)) + if (val && *val) { mOptions[opt] = "\""; mOptions[opt].append(val); mOptions[opt].append("\""); } -#endif else +#endif { mOptions[opt] = val; } diff --git a/src/VBox/Main/include/DVDDriveImpl.h b/src/VBox/Main/include/DVDDriveImpl.h index d81693197..657f6a238 100644 --- a/src/VBox/Main/include/DVDDriveImpl.h +++ b/src/VBox/Main/include/DVDDriveImpl.h @@ -1,4 +1,4 @@ -/* $Id: DVDDriveImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: DVDDriveImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/DisplayImpl.h b/src/VBox/Main/include/DisplayImpl.h index 5caf1acea..25831ead3 100644 --- a/src/VBox/Main/include/DisplayImpl.h +++ b/src/VBox/Main/include/DisplayImpl.h @@ -1,4 +1,4 @@ -/* $Id: DisplayImpl.h 20814 2009-06-23 10:40:53Z vboxsync $ */ +/* $Id: DisplayImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/FloppyDriveImpl.h b/src/VBox/Main/include/FloppyDriveImpl.h index c8ea5c842..5aec39999 100644 --- a/src/VBox/Main/include/FloppyDriveImpl.h +++ b/src/VBox/Main/include/FloppyDriveImpl.h @@ -1,4 +1,4 @@ -/* $Id: FloppyDriveImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: FloppyDriveImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/Global.h b/src/VBox/Main/include/Global.h index 4f2261ce7..969b18117 100644 --- a/src/VBox/Main/include/Global.h +++ b/src/VBox/Main/include/Global.h @@ -1,4 +1,4 @@ -/* $Id: Global.h 15762 2008-12-25 23:53:50Z vboxsync $ */ +/* $Id: Global.h $ */ /** @file * diff --git a/src/VBox/Main/include/HardDiskFormatImpl.h b/src/VBox/Main/include/HardDiskFormatImpl.h index bd3c7ed6a..6dbcf8762 100644 --- a/src/VBox/Main/include/HardDiskFormatImpl.h +++ b/src/VBox/Main/include/HardDiskFormatImpl.h @@ -1,4 +1,4 @@ -/* $Id: HardDiskFormatImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: HardDiskFormatImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/HardDiskImpl.h b/src/VBox/Main/include/HardDiskImpl.h index a89b7d431..e36c8b958 100644 --- a/src/VBox/Main/include/HardDiskImpl.h +++ b/src/VBox/Main/include/HardDiskImpl.h @@ -1,4 +1,4 @@ -/* $Id: HardDiskImpl.h 20842 2009-06-23 14:48:10Z vboxsync $ */ +/* $Id: HardDiskImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/HostHardwareLinux.h b/src/VBox/Main/include/HostHardwareLinux.h index be7591430..6e0dce18e 100644 --- a/src/VBox/Main/include/HostHardwareLinux.h +++ b/src/VBox/Main/include/HostHardwareLinux.h @@ -1,4 +1,4 @@ -/* $Id: HostHardwareLinux.h 17688 2009-03-11 12:38:18Z vboxsync $ */ +/* $Id: HostHardwareLinux.h $ */ /** @file * Classes for handling hardware detection under Linux. Please feel free to * expand these to work for other systems (Solaris!) or to add new ones for diff --git a/src/VBox/Main/include/HostImpl.h b/src/VBox/Main/include/HostImpl.h index 0798f41a7..e1dea9f87 100644 --- a/src/VBox/Main/include/HostImpl.h +++ b/src/VBox/Main/include/HostImpl.h @@ -1,4 +1,4 @@ -/* $Id: HostImpl.h 20042 2009-05-26 14:49:55Z vboxsync $ */ +/* $Id: HostImpl.h $ */ /** @file * Implemenation of IHost. */ diff --git a/src/VBox/Main/include/HostNetworkInterfaceImpl.h b/src/VBox/Main/include/HostNetworkInterfaceImpl.h index 43f5686b8..646a3ef15 100644 --- a/src/VBox/Main/include/HostNetworkInterfaceImpl.h +++ b/src/VBox/Main/include/HostNetworkInterfaceImpl.h @@ -1,4 +1,4 @@ -/* $Id: HostNetworkInterfaceImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: HostNetworkInterfaceImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/KeyboardImpl.h b/src/VBox/Main/include/KeyboardImpl.h index dfa64ab13..799734d57 100644 --- a/src/VBox/Main/include/KeyboardImpl.h +++ b/src/VBox/Main/include/KeyboardImpl.h @@ -1,4 +1,4 @@ -/* $Id: KeyboardImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: KeyboardImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/MachineDebuggerImpl.h b/src/VBox/Main/include/MachineDebuggerImpl.h index 60392dca8..255620be8 100644 --- a/src/VBox/Main/include/MachineDebuggerImpl.h +++ b/src/VBox/Main/include/MachineDebuggerImpl.h @@ -1,4 +1,4 @@ -/* $Id: MachineDebuggerImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: MachineDebuggerImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/MachineImpl.h b/src/VBox/Main/include/MachineImpl.h index 861776eaf..fa074bc04 100644 --- a/src/VBox/Main/include/MachineImpl.h +++ b/src/VBox/Main/include/MachineImpl.h @@ -1,4 +1,4 @@ -/* $Id: MachineImpl.h 20928 2009-06-25 11:53:37Z vboxsync $ */ +/* $Id: MachineImpl.h $ */ /** @file * @@ -264,7 +264,7 @@ public: ULONG mStatisticsUpdateInterval; ULONG mVRAMSize; ULONG mMonitorCount; - TSBool_T mHWVirtExEnabled; + BOOL mHWVirtExEnabled; BOOL mHWVirtExNestedPagingEnabled; BOOL mHWVirtExVPIDEnabled; BOOL mAccelerate3DEnabled; @@ -502,8 +502,8 @@ public: STDMETHOD(COMGETTER(Accelerate3DEnabled))(BOOL *enabled); STDMETHOD(COMSETTER(Accelerate3DEnabled))(BOOL enabled); STDMETHOD(COMGETTER(BIOSSettings))(IBIOSSettings **biosSettings); - STDMETHOD(COMGETTER(HWVirtExEnabled))(TSBool_T *enabled); - STDMETHOD(COMSETTER(HWVirtExEnabled))(TSBool_T enabled); + STDMETHOD(COMGETTER(HWVirtExEnabled))(BOOL *enabled); + STDMETHOD(COMSETTER(HWVirtExEnabled))(BOOL enabled); STDMETHOD(COMGETTER(HWVirtExNestedPagingEnabled))(BOOL *enabled); STDMETHOD(COMSETTER(HWVirtExNestedPagingEnabled))(BOOL enabled); STDMETHOD(COMGETTER(HWVirtExVPIDEnabled))(BOOL *enabled); diff --git a/src/VBox/Main/include/MediumImpl.h b/src/VBox/Main/include/MediumImpl.h index 9d051acdb..3ef82e3c2 100644 --- a/src/VBox/Main/include/MediumImpl.h +++ b/src/VBox/Main/include/MediumImpl.h @@ -1,4 +1,4 @@ -/* $Id: MediumImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: MediumImpl.h $ */ /** @file * * VirtualBox COM class implementation diff --git a/src/VBox/Main/include/MouseImpl.h b/src/VBox/Main/include/MouseImpl.h index 2bd935a3e..cfe6cde55 100644 --- a/src/VBox/Main/include/MouseImpl.h +++ b/src/VBox/Main/include/MouseImpl.h @@ -1,4 +1,4 @@ -/* $Id: MouseImpl.h 19614 2009-05-12 12:27:21Z vboxsync $ */ +/* $Id: MouseImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/NetworkAdapterImpl.h b/src/VBox/Main/include/NetworkAdapterImpl.h index 07ef5fafe..b55a09a04 100644 --- a/src/VBox/Main/include/NetworkAdapterImpl.h +++ b/src/VBox/Main/include/NetworkAdapterImpl.h @@ -1,4 +1,4 @@ -/* $Id: NetworkAdapterImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: NetworkAdapterImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/ParallelPortImpl.h b/src/VBox/Main/include/ParallelPortImpl.h index 79a0847dd..b2ed14fac 100644 --- a/src/VBox/Main/include/ParallelPortImpl.h +++ b/src/VBox/Main/include/ParallelPortImpl.h @@ -1,4 +1,4 @@ -/* $Id: ParallelPortImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: ParallelPortImpl.h $ */ /** @file * VirtualBox COM class implementation. diff --git a/src/VBox/Main/include/Performance.h b/src/VBox/Main/include/Performance.h index 53c986749..6caef8137 100644 --- a/src/VBox/Main/include/Performance.h +++ b/src/VBox/Main/include/Performance.h @@ -1,4 +1,4 @@ -/* $Id: Performance.h 19270 2009-04-29 20:40:33Z vboxsync $ */ +/* $Id: Performance.h $ */ /** @file * diff --git a/src/VBox/Main/include/PerformanceImpl.h b/src/VBox/Main/include/PerformanceImpl.h index 15e7176fa..b14b25f11 100644 --- a/src/VBox/Main/include/PerformanceImpl.h +++ b/src/VBox/Main/include/PerformanceImpl.h @@ -1,4 +1,4 @@ -/* $Id: PerformanceImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: PerformanceImpl.h $ */ /** @file * @@ -188,6 +188,9 @@ public: void unregisterBaseMetricsFor (const ComPtr <IUnknown> &object); void unregisterMetricsFor (const ComPtr <IUnknown> &object); + void suspendSampling(); + void resumeSampling(); + // public methods for internal purposes only // (ensure there is a caller and a read lock before calling them!) diff --git a/src/VBox/Main/include/ProgressImpl.h b/src/VBox/Main/include/ProgressImpl.h index 99bebd3e5..f0a42b832 100644 --- a/src/VBox/Main/include/ProgressImpl.h +++ b/src/VBox/Main/include/ProgressImpl.h @@ -1,4 +1,4 @@ -/* $Id: ProgressImpl.h 20220 2009-06-03 08:40:29Z vboxsync $ */ +/* $Id: ProgressImpl.h $ */ /** @file * * VirtualBox COM class implementation diff --git a/src/VBox/Main/include/RemoteUSBDeviceImpl.h b/src/VBox/Main/include/RemoteUSBDeviceImpl.h index 15d726384..eac72aada 100644 --- a/src/VBox/Main/include/RemoteUSBDeviceImpl.h +++ b/src/VBox/Main/include/RemoteUSBDeviceImpl.h @@ -1,4 +1,4 @@ -/* $Id: RemoteUSBDeviceImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: RemoteUSBDeviceImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/StorageControllerImpl.h b/src/VBox/Main/include/StorageControllerImpl.h index 6c35a7a47..bc29b825b 100644 --- a/src/VBox/Main/include/StorageControllerImpl.h +++ b/src/VBox/Main/include/StorageControllerImpl.h @@ -1,4 +1,4 @@ -/* $Id: StorageControllerImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: StorageControllerImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/SystemPropertiesImpl.h b/src/VBox/Main/include/SystemPropertiesImpl.h index 18cfbb7f4..76dc974c2 100644 --- a/src/VBox/Main/include/SystemPropertiesImpl.h +++ b/src/VBox/Main/include/SystemPropertiesImpl.h @@ -1,4 +1,4 @@ -/* $Id: SystemPropertiesImpl.h 20260 2009-06-04 10:12:12Z vboxsync $ */ +/* $Id: SystemPropertiesImpl.h $ */ /** @file * @@ -88,8 +88,6 @@ public: STDMETHOD(COMSETTER(RemoteDisplayAuthLibrary)) (IN_BSTR aRemoteDisplayAuthLibrary); STDMETHOD(COMGETTER(WebServiceAuthLibrary)) (BSTR *aWebServiceAuthLibrary); STDMETHOD(COMSETTER(WebServiceAuthLibrary)) (IN_BSTR aWebServiceAuthLibrary); - STDMETHOD(COMGETTER(HWVirtExEnabled)) (BOOL *enabled); - STDMETHOD(COMSETTER(HWVirtExEnabled)) (BOOL enabled); STDMETHOD(COMGETTER(LogHistoryCount)) (ULONG *count); STDMETHOD(COMSETTER(LogHistoryCount)) (ULONG count); STDMETHOD(COMGETTER(DefaultAudioDriver)) (AudioDriverType_T *aAudioDriver); @@ -142,7 +140,6 @@ private: Bstr mRemoteDisplayAuthLibrary; Bstr mWebServiceAuthLibrary; - BOOL mHWVirtExEnabled; ULONG mLogHistoryCount; AudioDriverType_T mDefaultAudioDriver; }; diff --git a/src/VBox/Main/include/USBControllerImpl.h b/src/VBox/Main/include/USBControllerImpl.h index de164bbd3..3550ded2f 100644 --- a/src/VBox/Main/include/USBControllerImpl.h +++ b/src/VBox/Main/include/USBControllerImpl.h @@ -1,4 +1,4 @@ -/* $Id: USBControllerImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: USBControllerImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/USBDeviceImpl.h b/src/VBox/Main/include/USBDeviceImpl.h index 967c125f0..cc8b7fe14 100644 --- a/src/VBox/Main/include/USBDeviceImpl.h +++ b/src/VBox/Main/include/USBDeviceImpl.h @@ -1,4 +1,4 @@ -/* $Id: USBDeviceImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: USBDeviceImpl.h $ */ /** @file * Header file for the OUSBDevice (IUSBDevice) class, VBoxC. diff --git a/src/VBox/Main/include/VFSExplorerImpl.h b/src/VBox/Main/include/VFSExplorerImpl.h index f38c46f2d..be273c219 100644 --- a/src/VBox/Main/include/VFSExplorerImpl.h +++ b/src/VBox/Main/include/VFSExplorerImpl.h @@ -1,4 +1,4 @@ -/* $Id: VFSExplorerImpl.h 20963 2009-06-26 09:35:27Z vboxsync $ */ +/* $Id: VFSExplorerImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/VRDPServerImpl.h b/src/VBox/Main/include/VRDPServerImpl.h index 0abfb884a..e03471136 100644 --- a/src/VBox/Main/include/VRDPServerImpl.h +++ b/src/VBox/Main/include/VRDPServerImpl.h @@ -1,4 +1,4 @@ -/* $Id: VRDPServerImpl.h 19239 2009-04-28 13:19:14Z vboxsync $ */ +/* $Id: VRDPServerImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/VirtualBoxImpl.h b/src/VBox/Main/include/VirtualBoxImpl.h index 3793d20a7..c9e17166a 100644 --- a/src/VBox/Main/include/VirtualBoxImpl.h +++ b/src/VBox/Main/include/VirtualBoxImpl.h @@ -1,4 +1,4 @@ -/* $Id: VirtualBoxImpl.h 20842 2009-06-23 14:48:10Z vboxsync $ */ +/* $Id: VirtualBoxImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/VirtualBoxImplExtra.h b/src/VBox/Main/include/VirtualBoxImplExtra.h index 6f029ff10..267f2c9d2 100644 --- a/src/VBox/Main/include/VirtualBoxImplExtra.h +++ b/src/VBox/Main/include/VirtualBoxImplExtra.h @@ -1,4 +1,4 @@ -/* $Id: VirtualBoxImpl.h 41951 2009-01-22 21:23:10Z bird $ */ +/* $Id: VirtualBoxImpl.h $ */ /** @file * diff --git a/src/VBox/Main/include/VirtualBoxXMLUtil.h b/src/VBox/Main/include/VirtualBoxXMLUtil.h index b02945583..87928b13a 100644 --- a/src/VBox/Main/include/VirtualBoxXMLUtil.h +++ b/src/VBox/Main/include/VirtualBoxXMLUtil.h @@ -1,4 +1,4 @@ -/* $Id: VirtualBoxXMLUtil.h 17669 2009-03-11 09:56:29Z vboxsync $ */ +/* $Id: VirtualBoxXMLUtil.h $ */ /** @file * diff --git a/src/VBox/Main/linux/HostHardwareLinux.cpp b/src/VBox/Main/linux/HostHardwareLinux.cpp index e62f2fec5..20c777b3f 100644 --- a/src/VBox/Main/linux/HostHardwareLinux.cpp +++ b/src/VBox/Main/linux/HostHardwareLinux.cpp @@ -1,4 +1,4 @@ -/* $Id: HostHardwareLinux.cpp 19094 2009-04-22 06:25:55Z vboxsync $ */ +/* $Id: HostHardwareLinux.cpp $ */ /** @file * Classes for handling hardware detection under Linux. Please feel free to * expand these to work for other systems (Solaris!) or to add new ones for diff --git a/src/VBox/Main/linux/NetIf-linux.cpp b/src/VBox/Main/linux/NetIf-linux.cpp index 52c63484a..2b145e9b7 100644 --- a/src/VBox/Main/linux/NetIf-linux.cpp +++ b/src/VBox/Main/linux/NetIf-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: NetIf-linux.cpp 20481 2009-06-11 19:30:12Z vboxsync $ */ +/* $Id: NetIf-linux.cpp $ */ /** @file * Main - NetIfList, Linux implementation. */ diff --git a/src/VBox/Main/linux/PerformanceLinux.cpp b/src/VBox/Main/linux/PerformanceLinux.cpp index 4373680de..0741179e9 100644 --- a/src/VBox/Main/linux/PerformanceLinux.cpp +++ b/src/VBox/Main/linux/PerformanceLinux.cpp @@ -1,4 +1,4 @@ -/* $Id: PerformanceLinux.cpp 12546 2008-09-17 17:11:15Z vboxsync $ */ +/* $Id: PerformanceLinux.cpp $ */ /** @file * diff --git a/src/VBox/Main/os2/NetIf-os2.cpp b/src/VBox/Main/os2/NetIf-os2.cpp index 8083699f6..2307b5bc8 100644 --- a/src/VBox/Main/os2/NetIf-os2.cpp +++ b/src/VBox/Main/os2/NetIf-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: NetIf-os2.cpp 18732 2009-04-06 09:01:53Z vboxsync $ */ +/* $Id: NetIf-os2.cpp $ */ /** @file * Main - NetIfList, OS/2 implementation. */ diff --git a/src/VBox/Main/os2/PerformanceOs2.cpp b/src/VBox/Main/os2/PerformanceOs2.cpp index fc13dc398..e5f57f559 100644 --- a/src/VBox/Main/os2/PerformanceOs2.cpp +++ b/src/VBox/Main/os2/PerformanceOs2.cpp @@ -1,4 +1,4 @@ -/* $Id: PerformanceOs2.cpp 12400 2008-09-11 10:34:58Z vboxsync $ */ +/* $Id: PerformanceOs2.cpp $ */ /** @file * diff --git a/src/VBox/Main/solaris/DynLoadLibSolaris.cpp b/src/VBox/Main/solaris/DynLoadLibSolaris.cpp index 2be48bead..3d8c15ae6 100644 --- a/src/VBox/Main/solaris/DynLoadLibSolaris.cpp +++ b/src/VBox/Main/solaris/DynLoadLibSolaris.cpp @@ -1,4 +1,4 @@ -/* $Id: DynLoadLibSolaris.cpp 12866 2008-10-01 13:50:12Z vboxsync $ */ +/* $Id: DynLoadLibSolaris.cpp $ */ /** @file * Dynamically load libraries for Solaris hosts. */ diff --git a/src/VBox/Main/solaris/DynLoadLibSolaris.h b/src/VBox/Main/solaris/DynLoadLibSolaris.h index 96c54f2e4..a221bacf6 100644 --- a/src/VBox/Main/solaris/DynLoadLibSolaris.h +++ b/src/VBox/Main/solaris/DynLoadLibSolaris.h @@ -1,4 +1,4 @@ -/* $Id: DynLoadLibSolaris.h 15753 2008-12-24 19:08:24Z vboxsync $ */ +/* $Id: DynLoadLibSolaris.h $ */ /** @file * Dynamically loaded libraries for Solaris hosts, Internal header. */ diff --git a/src/VBox/Main/solaris/NetIf-solaris.cpp b/src/VBox/Main/solaris/NetIf-solaris.cpp index 4cf5293a0..c8e1b51a6 100644 --- a/src/VBox/Main/solaris/NetIf-solaris.cpp +++ b/src/VBox/Main/solaris/NetIf-solaris.cpp @@ -1,4 +1,4 @@ -/* $Id: NetIf-solaris.cpp 19433 2009-05-06 13:26:13Z vboxsync $ */ +/* $Id: NetIf-solaris.cpp $ */ /** @file * Main - NetIfList, Solaris implementation. */ diff --git a/src/VBox/Main/solaris/PerformanceSolaris.cpp b/src/VBox/Main/solaris/PerformanceSolaris.cpp index af3a8e975..faebe6f6f 100644 --- a/src/VBox/Main/solaris/PerformanceSolaris.cpp +++ b/src/VBox/Main/solaris/PerformanceSolaris.cpp @@ -1,4 +1,4 @@ -/* $Id: PerformanceSolaris.cpp 14948 2008-12-03 15:06:30Z vboxsync $ */ +/* $Id: PerformanceSolaris.cpp $ */ /** @file * diff --git a/src/VBox/Main/testcase/Makefile.kmk b/src/VBox/Main/testcase/Makefile.kmk index 2759e29d8..653de4ff5 100644 --- a/src/VBox/Main/testcase/Makefile.kmk +++ b/src/VBox/Main/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 18866 2009-04-10 14:13:10Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VBox API testcases. # diff --git a/src/VBox/Main/testcase/tstCollector.cpp b/src/VBox/Main/testcase/tstCollector.cpp index fb0958503..6df067a3d 100644 --- a/src/VBox/Main/testcase/tstCollector.cpp +++ b/src/VBox/Main/testcase/tstCollector.cpp @@ -1,4 +1,4 @@ -/* $Id: tstCollector.cpp 16018 2009-01-18 00:30:41Z vboxsync $ */ +/* $Id: tstCollector.cpp $ */ /** @file * diff --git a/src/VBox/Main/testcase/tstHostHardwareLinux.cpp b/src/VBox/Main/testcase/tstHostHardwareLinux.cpp index e4aed5956..b735ddada 100644 --- a/src/VBox/Main/testcase/tstHostHardwareLinux.cpp +++ b/src/VBox/Main/testcase/tstHostHardwareLinux.cpp @@ -1,4 +1,4 @@ -/* $Id: tstHostHardwareLinux.cpp 16178 2009-01-22 15:39:48Z vboxsync $ */ +/* $Id: tstHostHardwareLinux.cpp $ */ /** @file * * Test executable for quickly excercising/debugging the Linux host hardware diff --git a/src/VBox/Main/webservice/Makefile.kmk b/src/VBox/Main/webservice/Makefile.kmk index 953abf424..9ba3dcccf 100644 --- a/src/VBox/Main/webservice/Makefile.kmk +++ b/src/VBox/Main/webservice/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20036 2009-05-26 13:21:41Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VBox web service. # diff --git a/src/VBox/Main/webservice/samples/perl/clienttest.pl b/src/VBox/Main/webservice/samples/perl/clienttest.pl index 30e1a9eb6..30e1a9eb6 100644..100755 --- a/src/VBox/Main/webservice/samples/perl/clienttest.pl +++ b/src/VBox/Main/webservice/samples/perl/clienttest.pl diff --git a/src/VBox/Main/webservice/split-soapC.sed b/src/VBox/Main/webservice/split-soapC.sed index d2d731415..2b8b5cdef 100644 --- a/src/VBox/Main/webservice/split-soapC.sed +++ b/src/VBox/Main/webservice/split-soapC.sed @@ -1,4 +1,4 @@ -# $Id: split-soapC.sed 20267 2009-06-04 11:27:27Z vboxsync $ +# $Id: split-soapC.sed $ ## @file # Sed script for splitting up the monsterous soapC.cpp # diff --git a/src/VBox/Main/win/HostPowerWin.cpp b/src/VBox/Main/win/HostPowerWin.cpp index e038af8cf..8d9575ec0 100644 --- a/src/VBox/Main/win/HostPowerWin.cpp +++ b/src/VBox/Main/win/HostPowerWin.cpp @@ -40,7 +40,7 @@ HostPowerServiceWin::HostPowerServiceWin(VirtualBox *aVirtualBox) : HostPowerSer mHwnd = 0; int rc = RTThreadCreate (&mThread, HostPowerServiceWin::NotificationThread, this, 65536, - RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "MainPower"); + RTTHREADTYPE_GUI, RTTHREADFLAGS_WAITABLE, "MainPower"); if (RT_FAILURE (rc)) { @@ -194,6 +194,8 @@ LRESULT CALLBACK HostPowerServiceWin::WndProc(HWND hwnd, UINT msg, WPARAM wParam } break; } + default: + return DefWindowProc (hwnd, msg, wParam, lParam); } } return TRUE; diff --git a/src/VBox/Main/win/NetIf-win.cpp b/src/VBox/Main/win/NetIf-win.cpp index 7acb8711e..0c8e3f094 100644 --- a/src/VBox/Main/win/NetIf-win.cpp +++ b/src/VBox/Main/win/NetIf-win.cpp @@ -1,4 +1,4 @@ -/* $Id: NetIf-win.cpp 19598 2009-05-12 09:27:18Z vboxsync $ */ +/* $Id: NetIf-win.cpp $ */ /** @file * Main - NetIfList, Windows implementation. */ diff --git a/src/VBox/Main/win/PerformanceWin.cpp b/src/VBox/Main/win/PerformanceWin.cpp index 913bb3d06..545b45401 100644 --- a/src/VBox/Main/win/PerformanceWin.cpp +++ b/src/VBox/Main/win/PerformanceWin.cpp @@ -1,4 +1,4 @@ -/* $Id: PerformanceWin.cpp 14948 2008-12-03 15:06:30Z vboxsync $ */ +/* $Id: PerformanceWin.cpp $ */ /** @file * diff --git a/src/VBox/Main/xpcom/server.cpp b/src/VBox/Main/xpcom/server.cpp index b28872499..0db6aab20 100644 --- a/src/VBox/Main/xpcom/server.cpp +++ b/src/VBox/Main/xpcom/server.cpp @@ -1,4 +1,4 @@ -/* $Id: server.cpp 20630 2009-06-16 13:55:38Z vboxsync $ */ +/* $Id: server.cpp $ */ /** @file * XPCOM server process (VBoxSVC) start point. */ diff --git a/src/VBox/Main/xpcom/server_module.cpp b/src/VBox/Main/xpcom/server_module.cpp index 7c6c88f08..a5a976bbc 100644 --- a/src/VBox/Main/xpcom/server_module.cpp +++ b/src/VBox/Main/xpcom/server_module.cpp @@ -57,6 +57,9 @@ #include <string.h> +#if defined(RT_OS_SOLARIS) +# include <sys/systeminfo.h> +#endif /// @todo move this to RT headers (and use them in MachineImpl.cpp as well) #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) @@ -137,11 +140,23 @@ VirtualBoxConstructor (nsISupports *aOuter, REFNSIID aIID, AssertBreakStmt (path.Length() + strlen (VBoxSVC_exe) < RTPATH_MAX, rc = NS_ERROR_FAILURE); +#if defined(RT_OS_SOLARIS) && defined(VBOX_WITH_HARDENING) + char achKernArch[128]; + int cbKernArch = sysinfo (SI_ARCHITECTURE_K, achKernArch, sizeof(achKernArch)); + if (cbKernArch > 0) + { + sprintf(VBoxSVCPath, "/opt/VirtualBox/%s%s", achKernArch, VBoxSVC_exe); + IsVBoxSVCPathSet = true; + } + else + rc = NS_ERROR_UNEXPECTED; +#else strcpy (VBoxSVCPath, path.get()); RTPathStripFilename (VBoxSVCPath); strcat (VBoxSVCPath, VBoxSVC_exe); IsVBoxSVCPathSet = true; +#endif } } if (NS_FAILED (rc)) diff --git a/src/VBox/Makefile.kmk b/src/VBox/Makefile.kmk index 947e338e3..9831b23de 100644 --- a/src/VBox/Makefile.kmk +++ b/src/VBox/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19862 2009-05-20 12:01:55Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for src/VBox. # diff --git a/src/VBox/NetworkServices/DHCP/Makefile.kmk b/src/VBox/NetworkServices/DHCP/Makefile.kmk index 0e885e9a0..8107b4456 100644 --- a/src/VBox/NetworkServices/DHCP/Makefile.kmk +++ b/src/VBox/NetworkServices/DHCP/Makefile.kmk @@ -1,4 +1,4 @@ - # $Id: Makefile.kmk 18514 2009-03-29 03:29:50Z vboxsync $ + # $Id: Makefile.kmk $ ## @file # Sub-Makefile for VBoxNetDHCP. # diff --git a/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp b/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp index 80497140c..67cc746ee 100644 --- a/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp +++ b/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxNetDHCP.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: VBoxNetDHCP.cpp $ */ /** @file * VBoxNetDHCP - DHCP Service for connecting to IntNet. */ diff --git a/src/VBox/NetworkServices/DHCP/VBoxNetDHCPHardened.cpp b/src/VBox/NetworkServices/DHCP/VBoxNetDHCPHardened.cpp index 0d5b14cb3..4117ac01e 100644 --- a/src/VBox/NetworkServices/DHCP/VBoxNetDHCPHardened.cpp +++ b/src/VBox/NetworkServices/DHCP/VBoxNetDHCPHardened.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxNetDHCPHardened.cpp 18010 2009-03-17 10:21:49Z vboxsync $ */ +/* $Id: VBoxNetDHCPHardened.cpp $ */ /** @file * VBoxNetDHCP - Hardened main(). */ diff --git a/src/VBox/NetworkServices/Makefile.kmk b/src/VBox/NetworkServices/Makefile.kmk index 0026aa852..8d6808ed1 100644 --- a/src/VBox/NetworkServices/Makefile.kmk +++ b/src/VBox/NetworkServices/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19316 2009-05-04 03:34:58Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for the VBox Network Services. # diff --git a/src/VBox/NetworkServices/NetLib/VBoxNetARP.cpp b/src/VBox/NetworkServices/NetLib/VBoxNetARP.cpp index 032f221e5..08b30a091 100644 --- a/src/VBox/NetworkServices/NetLib/VBoxNetARP.cpp +++ b/src/VBox/NetworkServices/NetLib/VBoxNetARP.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxNetARP.cpp 17783 2009-03-12 23:59:57Z vboxsync $ */ +/* $Id: VBoxNetARP.cpp $ */ /** @file * VBoxNetARP - IntNet ARP Client Routines. */ diff --git a/src/VBox/NetworkServices/NetLib/VBoxNetIntIf.cpp b/src/VBox/NetworkServices/NetLib/VBoxNetIntIf.cpp index b92a5d237..a63a1a445 100644 --- a/src/VBox/NetworkServices/NetLib/VBoxNetIntIf.cpp +++ b/src/VBox/NetworkServices/NetLib/VBoxNetIntIf.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxNetIntIf.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: VBoxNetIntIf.cpp $ */ /** @file * VBoxNetIntIf - IntNet Interface Client Routines. */ diff --git a/src/VBox/NetworkServices/NetLib/VBoxNetLib.h b/src/VBox/NetworkServices/NetLib/VBoxNetLib.h index 0d098a3ad..0a2758695 100644 --- a/src/VBox/NetworkServices/NetLib/VBoxNetLib.h +++ b/src/VBox/NetworkServices/NetLib/VBoxNetLib.h @@ -1,4 +1,4 @@ -/* $Id: VBoxNetLib.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VBoxNetLib.h $ */ /** @file * VBoxNetUDP - IntNet Client Library. */ diff --git a/src/VBox/NetworkServices/NetLib/VBoxNetUDP.cpp b/src/VBox/NetworkServices/NetLib/VBoxNetUDP.cpp index 8a21b6c53..0f2f90eca 100644 --- a/src/VBox/NetworkServices/NetLib/VBoxNetUDP.cpp +++ b/src/VBox/NetworkServices/NetLib/VBoxNetUDP.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxNetUDP.cpp 18463 2009-03-28 05:14:31Z vboxsync $ */ +/* $Id: VBoxNetUDP.cpp $ */ /** @file * VBoxNetUDP - IntNet UDP Client Routines. */ diff --git a/src/VBox/RDP/client/Makefile.kmk b/src/VBox/RDP/client/Makefile.kmk index d24be64be..0ebadd724 100644 --- a/src/VBox/RDP/client/Makefile.kmk +++ b/src/VBox/RDP/client/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 21064 2009-06-30 10:50:58Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # VBox - rdesktop with VRDP enhancements sub-makefile. # diff --git a/src/VBox/Runtime/Makefile.kmk b/src/VBox/Runtime/Makefile.kmk index d6e2b80d9..727138b91 100644 --- a/src/VBox/Runtime/Makefile.kmk +++ b/src/VBox/Runtime/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 21046 2009-06-30 01:11:28Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the IPRT (IPRT). # diff --git a/src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp b/src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp index d685d74f4..c86c9687e 100644 --- a/src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp +++ b/src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp @@ -1,4 +1,4 @@ -/* $Id: RTAssertShouldPanic-vbox.cpp 18371 2009-03-27 05:05:52Z vboxsync $ */ +/* $Id: RTAssertShouldPanic-vbox.cpp $ */ /** @file * IPRT - Assertions, generic RTAssertShouldPanic. */ diff --git a/src/VBox/Runtime/VBox/VBoxRTDeps.cpp b/src/VBox/Runtime/VBox/VBoxRTDeps.cpp index 5ef7b98fc..37e166ff6 100644 --- a/src/VBox/Runtime/VBox/VBoxRTDeps.cpp +++ b/src/VBox/Runtime/VBox/VBoxRTDeps.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxRTDeps.cpp 20862 2009-06-23 18:25:31Z vboxsync $ */ +/* $Id: VBoxRTDeps.cpp $ */ /** @file * IPRT - VBoxRT.dll/so dependencies. */ diff --git a/src/VBox/Runtime/VBox/log-vbox.cpp b/src/VBox/Runtime/VBox/log-vbox.cpp index 9afed44db..7b7b99347 100644 --- a/src/VBox/Runtime/VBox/log-vbox.cpp +++ b/src/VBox/Runtime/VBox/log-vbox.cpp @@ -1,4 +1,4 @@ -/* $Id: log-vbox.cpp 19315 2009-05-04 03:29:02Z vboxsync $ */ +/* $Id: log-vbox.cpp $ */ /** @file * VirtualBox Runtime - Logging configuration. */ diff --git a/src/VBox/Runtime/VBox/logbackdoor-redirect.cpp b/src/VBox/Runtime/VBox/logbackdoor-redirect.cpp index 1ab2b688e..b4b7ae834 100644 --- a/src/VBox/Runtime/VBox/logbackdoor-redirect.cpp +++ b/src/VBox/Runtime/VBox/logbackdoor-redirect.cpp @@ -1,4 +1,4 @@ -/* $Id: logbackdoor-redirect.cpp 19120 2009-04-22 20:34:12Z vboxsync $ */ +/* $Id: logbackdoor-redirect.cpp $ */ /** @file * VirtualBox Runtime - RTLog stubs for the stripped down IPRT used by * RuntimeGuestR3Shared (X11), output is redirected diff --git a/src/VBox/Runtime/VBox/logbackdoor.cpp b/src/VBox/Runtime/VBox/logbackdoor.cpp index 29d2c0930..3cff4eedc 100644 --- a/src/VBox/Runtime/VBox/logbackdoor.cpp +++ b/src/VBox/Runtime/VBox/logbackdoor.cpp @@ -1,4 +1,4 @@ -/* $Id: logbackdoor.cpp 19120 2009-04-22 20:34:12Z vboxsync $ */ +/* $Id: logbackdoor.cpp $ */ /** @file * VirtualBox Runtime - Guest Backdoor Logging. */ diff --git a/src/VBox/Runtime/VBox/strformat-vbox.cpp b/src/VBox/Runtime/VBox/strformat-vbox.cpp index 0058e9f1f..b073ed4d3 100644 --- a/src/VBox/Runtime/VBox/strformat-vbox.cpp +++ b/src/VBox/Runtime/VBox/strformat-vbox.cpp @@ -1,4 +1,4 @@ -/* $Id: strformat-vbox.cpp 14061 2008-11-10 23:12:54Z vboxsync $ */ +/* $Id: strformat-vbox.cpp $ */ /** @file * IPRT - VBox String Formatter extensions. */ diff --git a/src/VBox/Runtime/common/alloc/alloc.cpp b/src/VBox/Runtime/common/alloc/alloc.cpp index a5ceea270..b84986696 100644 --- a/src/VBox/Runtime/common/alloc/alloc.cpp +++ b/src/VBox/Runtime/common/alloc/alloc.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc.cpp 11019 2008-07-30 22:47:04Z vboxsync $ */ +/* $Id: alloc.cpp $ */ /** @file * IPRT - Memory Allocation. */ diff --git a/src/VBox/Runtime/common/alloc/heapsimple.cpp b/src/VBox/Runtime/common/alloc/heapsimple.cpp index 61bd47535..8c7aeeaa1 100644 --- a/src/VBox/Runtime/common/alloc/heapsimple.cpp +++ b/src/VBox/Runtime/common/alloc/heapsimple.cpp @@ -1,4 +1,4 @@ -/* $Id: heapsimple.cpp 18603 2009-04-01 15:44:08Z vboxsync $ */ +/* $Id: heapsimple.cpp $ */ /** @file * IPRT - A Simple Heap. */ diff --git a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm index b5720d654..51eecc4d6 100644 --- a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm +++ b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm @@ -1,4 +1,4 @@ -; $Id: ASMAtomicCmpXchgU64.asm 19605 2009-05-12 11:06:40Z vboxsync $ +; $Id: ASMAtomicCmpXchgU64.asm $ ;; @file ; IPRT - ASMAtomicCmpXchgU64(). ; diff --git a/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm index 6fe360c3e..2f34952ef 100644 --- a/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm +++ b/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm @@ -1,4 +1,4 @@ -; $Id: ASMAtomicReadU64.asm 19605 2009-05-12 11:06:40Z vboxsync $ +; $Id: ASMAtomicReadU64.asm $ ;; @file ; IPRT - ASMAtomicReadU64(). ; diff --git a/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm b/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm index f555bb0b4..c00277da4 100644 --- a/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm +++ b/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm @@ -1,4 +1,4 @@ -; $Id: ASMMultU64ByU32DivByU32.asm 8256 2008-04-21 20:53:28Z vboxsync $ +; $Id: ASMMultU64ByU32DivByU32.asm $ ;; @file ; IPRT - Assembly Functions, ASMMultU64ByU32DivByU32. ; diff --git a/src/VBox/Runtime/common/checksum/crc32.cpp b/src/VBox/Runtime/common/checksum/crc32.cpp index a69d076b1..3b389010c 100644 --- a/src/VBox/Runtime/common/checksum/crc32.cpp +++ b/src/VBox/Runtime/common/checksum/crc32.cpp @@ -1,4 +1,4 @@ -/* $Id: crc32.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: crc32.cpp $ */ /** @file * IPRT - CRC32. */ diff --git a/src/VBox/Runtime/common/checksum/crc64.cpp b/src/VBox/Runtime/common/checksum/crc64.cpp index 25502bd48..308a79cea 100644 --- a/src/VBox/Runtime/common/checksum/crc64.cpp +++ b/src/VBox/Runtime/common/checksum/crc64.cpp @@ -1,4 +1,4 @@ -/* $Id: crc64.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: crc64.cpp $ */ /** @file * IPRT - CRC64. * diff --git a/src/VBox/Runtime/common/checksum/ipv4.cpp b/src/VBox/Runtime/common/checksum/ipv4.cpp index 84785af7f..992b0ab92 100644 --- a/src/VBox/Runtime/common/checksum/ipv4.cpp +++ b/src/VBox/Runtime/common/checksum/ipv4.cpp @@ -1,4 +1,4 @@ -/* $Id: ipv4.cpp 12821 2008-09-30 07:30:01Z vboxsync $ */ +/* $Id: ipv4.cpp $ */ /** @file * IPRT - IPv4 Checksum calculation and validation. */ diff --git a/src/VBox/Runtime/common/checksum/md5.cpp b/src/VBox/Runtime/common/checksum/md5.cpp index d47f984eb..ddefcff53 100644 --- a/src/VBox/Runtime/common/checksum/md5.cpp +++ b/src/VBox/Runtime/common/checksum/md5.cpp @@ -1,4 +1,4 @@ -/* $Id: md5.cpp 14048 2008-11-10 22:43:16Z vboxsync $ */ +/* $Id: md5.cpp $ */ /** @file * MD5 message digest functions */ diff --git a/src/VBox/Runtime/common/dbg/dbg.cpp b/src/VBox/Runtime/common/dbg/dbg.cpp index 30a9bc731..1289bf33f 100644 --- a/src/VBox/Runtime/common/dbg/dbg.cpp +++ b/src/VBox/Runtime/common/dbg/dbg.cpp @@ -1,4 +1,4 @@ -/* $Id: dbg.cpp 20800 2009-06-22 23:47:37Z vboxsync $ */ +/* $Id: dbg.cpp $ */ /** @file * IPRT - Debug Misc. */ diff --git a/src/VBox/Runtime/common/dbg/dbgas.cpp b/src/VBox/Runtime/common/dbg/dbgas.cpp index 1867c672b..273c7dde4 100644 --- a/src/VBox/Runtime/common/dbg/dbgas.cpp +++ b/src/VBox/Runtime/common/dbg/dbgas.cpp @@ -1,4 +1,4 @@ -/* $Id: dbgas.cpp 20744 2009-06-21 15:43:57Z vboxsync $ */ +/* $Id: dbgas.cpp $ */ /** @file * IPRT - Debug Address Space. */ diff --git a/src/VBox/Runtime/common/dbg/dbgmod.cpp b/src/VBox/Runtime/common/dbg/dbgmod.cpp index a2acc2fde..c02e572f4 100644 --- a/src/VBox/Runtime/common/dbg/dbgmod.cpp +++ b/src/VBox/Runtime/common/dbg/dbgmod.cpp @@ -1,4 +1,4 @@ -/* $Id: dbgmod.cpp 21046 2009-06-30 01:11:28Z vboxsync $ */ +/* $Id: dbgmod.cpp $ */ /** @file * IPRT - Debug Module Interpreter. */ diff --git a/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp b/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp index b81003e70..2e2e3e6d3 100644 --- a/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp +++ b/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp @@ -1,4 +1,4 @@ -/* $Id: dbgmodcontainer.cpp 21046 2009-06-30 01:11:28Z vboxsync $ */ +/* $Id: dbgmodcontainer.cpp $ */ /** @file * IPRT - Debug Info Container. */ diff --git a/src/VBox/Runtime/common/dbg/dbgmodnm.cpp b/src/VBox/Runtime/common/dbg/dbgmodnm.cpp index b4b93ad21..d2b642efd 100644 --- a/src/VBox/Runtime/common/dbg/dbgmodnm.cpp +++ b/src/VBox/Runtime/common/dbg/dbgmodnm.cpp @@ -1,4 +1,4 @@ -/* $Id: dbgmodnm.cpp 21047 2009-06-30 01:15:41Z vboxsync $ */ +/* $Id: dbgmodnm.cpp $ */ /** @file * IPRT - Debug Map Reader For NM Like Mapfiles. */ diff --git a/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp b/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp index c899a5c60..45978191a 100644 --- a/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp +++ b/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp @@ -1,4 +1,4 @@ -/* $Id: RTErrConvertFromErrno.cpp 18329 2009-03-26 17:20:09Z vboxsync $ */ +/* $Id: RTErrConvertFromErrno.cpp $ */ /** @file * IPRT - Convert errno to iprt status codes. */ diff --git a/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp b/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp index 26c5515b0..0c5f54159 100644 --- a/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp +++ b/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp @@ -1,4 +1,4 @@ -/* $Rev: 18329 $ */ +/* $Rev: 45104 $ */ /** @file * IPRT - Convert iprt status codes to errno. */ diff --git a/src/VBox/Runtime/common/err/errmsg.cpp b/src/VBox/Runtime/common/err/errmsg.cpp index f4069f466..dc3844b6d 100644 --- a/src/VBox/Runtime/common/err/errmsg.cpp +++ b/src/VBox/Runtime/common/err/errmsg.cpp @@ -1,4 +1,4 @@ -/* $Id: errmsg.cpp 13836 2008-11-05 02:42:54Z vboxsync $ */ +/* $Id: errmsg.cpp $ */ /** @file * IPRT - Status code messages. */ diff --git a/src/VBox/Runtime/common/err/errmsg.sed b/src/VBox/Runtime/common/err/errmsg.sed index d1b8c22cc..12003a2e9 100644 --- a/src/VBox/Runtime/common/err/errmsg.sed +++ b/src/VBox/Runtime/common/err/errmsg.sed @@ -1,4 +1,4 @@ -# $Id: errmsg.sed 18117 2009-03-20 13:33:58Z vboxsync $ +# $Id: errmsg.sed $ ## @file # IPRT - SED script for converting */err.h. # diff --git a/src/VBox/Runtime/common/err/errmsgcom.sed b/src/VBox/Runtime/common/err/errmsgcom.sed index 624d1c012..967a6119c 100644 --- a/src/VBox/Runtime/common/err/errmsgcom.sed +++ b/src/VBox/Runtime/common/err/errmsgcom.sed @@ -1,4 +1,4 @@ -# $Id: errmsgcom.sed 18117 2009-03-20 13:33:58Z vboxsync $ +# $Id: errmsgcom.sed $ ## @file # IPRT - SED script for converting COM errors # diff --git a/src/VBox/Runtime/common/err/errmsgxpcom.cpp b/src/VBox/Runtime/common/err/errmsgxpcom.cpp index 69f7fe017..a16476883 100644 --- a/src/VBox/Runtime/common/err/errmsgxpcom.cpp +++ b/src/VBox/Runtime/common/err/errmsgxpcom.cpp @@ -1,4 +1,4 @@ -/* $Id: errmsgxpcom.cpp 14626 2008-11-26 10:01:53Z vboxsync $ */ +/* $Id: errmsgxpcom.cpp $ */ /** @file * IPRT - Status code messages for XPCOM. */ diff --git a/src/VBox/Runtime/common/ldr/ldr.cpp b/src/VBox/Runtime/common/ldr/ldr.cpp index cbc2f3d44..501afafd6 100644 --- a/src/VBox/Runtime/common/ldr/ldr.cpp +++ b/src/VBox/Runtime/common/ldr/ldr.cpp @@ -1,4 +1,4 @@ -/* $Id: ldr.cpp 17019 2009-02-23 13:34:39Z vboxsync $ */ +/* $Id: ldr.cpp $ */ /** @file * IPRT - Binary Image Loader. */ diff --git a/src/VBox/Runtime/common/ldr/ldrELF.cpp b/src/VBox/Runtime/common/ldr/ldrELF.cpp index 04583c290..1a547f626 100644 --- a/src/VBox/Runtime/common/ldr/ldrELF.cpp +++ b/src/VBox/Runtime/common/ldr/ldrELF.cpp @@ -1,4 +1,4 @@ -/* $Id: ldrELF.cpp 16933 2009-02-18 23:42:57Z vboxsync $ */ +/* $Id: ldrELF.cpp $ */ /** @file * IPRT - Binary Image Loader, Executable and Linker Format (ELF). */ diff --git a/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h b/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h index 5c0487e9f..59fbe805f 100644 --- a/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h +++ b/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h @@ -1,4 +1,4 @@ -/* $Id: ldrELFRelocatable.cpp.h 19167 2009-04-24 12:15:18Z vboxsync $ */ +/* $Id: ldrELFRelocatable.cpp.h $ */ /** @file * IPRT - Binary Image Loader, Template for ELF Relocatable Images. */ diff --git a/src/VBox/Runtime/common/ldr/ldrEx.cpp b/src/VBox/Runtime/common/ldr/ldrEx.cpp index 1ebd496e9..5cac4f7fa 100644 --- a/src/VBox/Runtime/common/ldr/ldrEx.cpp +++ b/src/VBox/Runtime/common/ldr/ldrEx.cpp @@ -1,4 +1,4 @@ -/* $Id: ldrEx.cpp 16933 2009-02-18 23:42:57Z vboxsync $ */ +/* $Id: ldrEx.cpp $ */ /** @file * IPRT - Binary Image Loader, Extended Features. */ diff --git a/src/VBox/Runtime/common/ldr/ldrFile.cpp b/src/VBox/Runtime/common/ldr/ldrFile.cpp index 7c0ae7856..8b43518df 100644 --- a/src/VBox/Runtime/common/ldr/ldrFile.cpp +++ b/src/VBox/Runtime/common/ldr/ldrFile.cpp @@ -1,4 +1,4 @@ -/* $Id: ldrFile.cpp 16933 2009-02-18 23:42:57Z vboxsync $ */ +/* $Id: ldrFile.cpp $ */ /** @file * IPRT - Binary Image Loader, The File Oriented Parts. */ diff --git a/src/VBox/Runtime/common/ldr/ldrNative.cpp b/src/VBox/Runtime/common/ldr/ldrNative.cpp index a4b5e2de6..a7fe37d17 100644 --- a/src/VBox/Runtime/common/ldr/ldrNative.cpp +++ b/src/VBox/Runtime/common/ldr/ldrNative.cpp @@ -1,4 +1,4 @@ -/* $Id: ldrNative.cpp 12423 2008-09-12 14:42:49Z vboxsync $ */ +/* $Id: ldrNative.cpp $ */ /** @file * IPRT - Binary Image Loader, Native interface. */ diff --git a/src/VBox/Runtime/common/ldr/ldrPE.cpp b/src/VBox/Runtime/common/ldr/ldrPE.cpp index eb5c7b672..6dccf518c 100644 --- a/src/VBox/Runtime/common/ldr/ldrPE.cpp +++ b/src/VBox/Runtime/common/ldr/ldrPE.cpp @@ -1,4 +1,4 @@ -/* $Id: ldrPE.cpp 16933 2009-02-18 23:42:57Z vboxsync $ */ +/* $Id: ldrPE.cpp $ */ /** @file * IPRT - Binary Image Loader, Portable Executable (PE). */ diff --git a/src/VBox/Runtime/common/ldr/ldrkStuff.cpp b/src/VBox/Runtime/common/ldr/ldrkStuff.cpp index 7444b1703..98d841f30 100644 --- a/src/VBox/Runtime/common/ldr/ldrkStuff.cpp +++ b/src/VBox/Runtime/common/ldr/ldrkStuff.cpp @@ -1,4 +1,4 @@ -/* $Id: ldrkStuff.cpp 16935 2009-02-19 01:59:26Z vboxsync $ */ +/* $Id: ldrkStuff.cpp $ */ /** @file * IPRT - Binary Image Loader, kLdr Interface. */ diff --git a/src/VBox/Runtime/common/log/log.cpp b/src/VBox/Runtime/common/log/log.cpp index 1b4624323..04836b7c3 100644 --- a/src/VBox/Runtime/common/log/log.cpp +++ b/src/VBox/Runtime/common/log/log.cpp @@ -1,4 +1,4 @@ -/* $Id: log.cpp 20859 2009-06-23 17:29:34Z vboxsync $ */ +/* $Id: log.cpp $ */ /** @file * Runtime VBox - Logger. */ @@ -574,7 +574,7 @@ RTDECL(int) RTLogDestroy(PRTLOGGER pLogger) * Acquire logger instance sem and disable all logging. (paranoia) */ rc = rtlogLock(pLogger); - AssertRCReturn(rc, rc); + AssertMsgReturn(RT_SUCCESS(rc) || rc == VERR_PREEMPT_DISABLED, ("%Rrc\n", rc), rc); pLogger->fFlags |= RTLOGFLAGS_DISABLED; iGroup = pLogger->cGroups; @@ -584,7 +584,7 @@ RTDECL(int) RTLogDestroy(PRTLOGGER pLogger) /* * Flush it. */ - RTLogFlush(pLogger); + rtlogFlush(pLogger); /* * Close output stuffs. diff --git a/src/VBox/Runtime/common/log/logcom.cpp b/src/VBox/Runtime/common/log/logcom.cpp index 585e7f514..df29e4136 100644 --- a/src/VBox/Runtime/common/log/logcom.cpp +++ b/src/VBox/Runtime/common/log/logcom.cpp @@ -1,4 +1,4 @@ -/* $Id: logcom.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: logcom.cpp $ */ /** @file * IPRT - Logging to Serial Port. */ diff --git a/src/VBox/Runtime/common/log/logellipsis.cpp b/src/VBox/Runtime/common/log/logellipsis.cpp index 88bcfeee7..b2fd8501a 100644 --- a/src/VBox/Runtime/common/log/logellipsis.cpp +++ b/src/VBox/Runtime/common/log/logellipsis.cpp @@ -1,4 +1,4 @@ -/* $Id: logellipsis.cpp 12099 2008-09-04 17:54:01Z vboxsync $ */ +/* $Id: logellipsis.cpp $ */ /** @file * Runtime VBox - Logger, the ellipsis variants. */ diff --git a/src/VBox/Runtime/common/log/logformat.cpp b/src/VBox/Runtime/common/log/logformat.cpp index 1102def5a..8bbcb836f 100644 --- a/src/VBox/Runtime/common/log/logformat.cpp +++ b/src/VBox/Runtime/common/log/logformat.cpp @@ -1,4 +1,4 @@ -/* $Id: logformat.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: logformat.cpp $ */ /** @file * IPRT - Log Formatter. */ diff --git a/src/VBox/Runtime/common/log/logrel.cpp b/src/VBox/Runtime/common/log/logrel.cpp index 279c878f0..d984218ee 100644 --- a/src/VBox/Runtime/common/log/logrel.cpp +++ b/src/VBox/Runtime/common/log/logrel.cpp @@ -1,4 +1,4 @@ -/* $Id: logrel.cpp 13832 2008-11-05 02:01:12Z vboxsync $ */ +/* $Id: logrel.cpp $ */ /** @file * Runtime VBox - Logger. */ diff --git a/src/VBox/Runtime/common/log/logrelellipsis.cpp b/src/VBox/Runtime/common/log/logrelellipsis.cpp index d4668a737..969a75139 100644 --- a/src/VBox/Runtime/common/log/logrelellipsis.cpp +++ b/src/VBox/Runtime/common/log/logrelellipsis.cpp @@ -1,4 +1,4 @@ -/* $Id: logrelellipsis.cpp 12099 2008-09-04 17:54:01Z vboxsync $ */ +/* $Id: logrelellipsis.cpp $ */ /** @file * Runtime VBox - Logger, the release ellipsis variants. */ diff --git a/src/VBox/Runtime/common/math/ceill.asm b/src/VBox/Runtime/common/math/ceill.asm index 1846cc39c..8ab5cdeca 100644 --- a/src/VBox/Runtime/common/math/ceill.asm +++ b/src/VBox/Runtime/common/math/ceill.asm @@ -1,4 +1,4 @@ -; $Id: ceill.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: ceill.asm $ ;; @file ; IPRT - No-CRT ceill - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/cosl.asm b/src/VBox/Runtime/common/math/cosl.asm index c557bb126..34cf96bc5 100644 --- a/src/VBox/Runtime/common/math/cosl.asm +++ b/src/VBox/Runtime/common/math/cosl.asm @@ -1,4 +1,4 @@ -; $Id: cosl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: cosl.asm $ ;; @file ; IPRT - No-CRT cosl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/fabs.asm b/src/VBox/Runtime/common/math/fabs.asm index 568e96558..23878bfe5 100644 --- a/src/VBox/Runtime/common/math/fabs.asm +++ b/src/VBox/Runtime/common/math/fabs.asm @@ -1,4 +1,4 @@ -; $Id: fabs.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: fabs.asm $ ;; @file ; IPRT - No-CRT fabs - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/fabsf.asm b/src/VBox/Runtime/common/math/fabsf.asm index 13a2dcfa5..3ab9111ce 100644 --- a/src/VBox/Runtime/common/math/fabsf.asm +++ b/src/VBox/Runtime/common/math/fabsf.asm @@ -1,4 +1,4 @@ -; $Id: fabsf.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: fabsf.asm $ ;; @file ; IPRT - No-CRT fabsf - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/fabsl.asm b/src/VBox/Runtime/common/math/fabsl.asm index 8bf1e2d50..8a11144e2 100644 --- a/src/VBox/Runtime/common/math/fabsl.asm +++ b/src/VBox/Runtime/common/math/fabsl.asm @@ -1,4 +1,4 @@ -; $Id: fabsl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: fabsl.asm $ ;; @file ; IPRT - No-CRT fabsl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/floor.asm b/src/VBox/Runtime/common/math/floor.asm index f49b18915..77d29c717 100644 --- a/src/VBox/Runtime/common/math/floor.asm +++ b/src/VBox/Runtime/common/math/floor.asm @@ -1,4 +1,4 @@ -; $Id: floor.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: floor.asm $ ;; @file ; IPRT - No-CRT floor - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/floorf.asm b/src/VBox/Runtime/common/math/floorf.asm index 2dd7a6606..310ef51b7 100644 --- a/src/VBox/Runtime/common/math/floorf.asm +++ b/src/VBox/Runtime/common/math/floorf.asm @@ -1,4 +1,4 @@ -; $Id: floorf.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: floorf.asm $ ;; @file ; IPRT - No-CRT floorf - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/floorl.asm b/src/VBox/Runtime/common/math/floorl.asm index af52a2fae..b7de82681 100644 --- a/src/VBox/Runtime/common/math/floorl.asm +++ b/src/VBox/Runtime/common/math/floorl.asm @@ -1,4 +1,4 @@ -; $Id: floorl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: floorl.asm $ ;; @file ; IPRT - No-CRT floorl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/ldexpl.asm b/src/VBox/Runtime/common/math/ldexpl.asm index ca1698136..0b4301a58 100644 --- a/src/VBox/Runtime/common/math/ldexpl.asm +++ b/src/VBox/Runtime/common/math/ldexpl.asm @@ -1,4 +1,4 @@ -; $Id: ldexpl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: ldexpl.asm $ ;; @file ; IPRT - No-CRT ldexpl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/llrint.asm b/src/VBox/Runtime/common/math/llrint.asm index 1287b97a0..cb94f3f09 100644 --- a/src/VBox/Runtime/common/math/llrint.asm +++ b/src/VBox/Runtime/common/math/llrint.asm @@ -1,4 +1,4 @@ -; $Id: llrint.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: llrint.asm $ ;; @file ; IPRT - No-CRT llrint - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/llrintf.asm b/src/VBox/Runtime/common/math/llrintf.asm index 52cffd307..7231535ff 100644 --- a/src/VBox/Runtime/common/math/llrintf.asm +++ b/src/VBox/Runtime/common/math/llrintf.asm @@ -1,4 +1,4 @@ -; $Id: llrintf.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: llrintf.asm $ ;; @file ; IPRT - No-CRT llrintf - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/llrintl.asm b/src/VBox/Runtime/common/math/llrintl.asm index 92083fb22..259c8d7b2 100644 --- a/src/VBox/Runtime/common/math/llrintl.asm +++ b/src/VBox/Runtime/common/math/llrintl.asm @@ -1,4 +1,4 @@ -; $Id: llrintl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: llrintl.asm $ ;; @file ; IPRT - No-CRT llrintl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/logl.asm b/src/VBox/Runtime/common/math/logl.asm index 51796d5c3..1f4c2d9c8 100644 --- a/src/VBox/Runtime/common/math/logl.asm +++ b/src/VBox/Runtime/common/math/logl.asm @@ -1,4 +1,4 @@ -; $Id: logl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: logl.asm $ ;; @file ; IPRT - No-CRT logl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/lrint.asm b/src/VBox/Runtime/common/math/lrint.asm index 2133cc364..f61766527 100644 --- a/src/VBox/Runtime/common/math/lrint.asm +++ b/src/VBox/Runtime/common/math/lrint.asm @@ -1,4 +1,4 @@ -; $Id: lrint.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: lrint.asm $ ;; @file ; IPRT - No-CRT lrint - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/lrintf.asm b/src/VBox/Runtime/common/math/lrintf.asm index 8bde4cef5..67c3cce4e 100644 --- a/src/VBox/Runtime/common/math/lrintf.asm +++ b/src/VBox/Runtime/common/math/lrintf.asm @@ -1,4 +1,4 @@ -; $Id: lrintf.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: lrintf.asm $ ;; @file ; IPRT - No-CRT lrintf - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/lrintl.asm b/src/VBox/Runtime/common/math/lrintl.asm index d043453c9..aa9de5fb2 100644 --- a/src/VBox/Runtime/common/math/lrintl.asm +++ b/src/VBox/Runtime/common/math/lrintl.asm @@ -1,4 +1,4 @@ -; $Id: lrintl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: lrintl.asm $ ;; @file ; IPRT - No-CRT lrintl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/remainder.asm b/src/VBox/Runtime/common/math/remainder.asm index b39b75b8b..e0626ce53 100644 --- a/src/VBox/Runtime/common/math/remainder.asm +++ b/src/VBox/Runtime/common/math/remainder.asm @@ -1,4 +1,4 @@ -; $Id: remainder.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: remainder.asm $ ;; @file ; IPRT - No-CRT remainder - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/remainderf.asm b/src/VBox/Runtime/common/math/remainderf.asm index a3d0715dd..09d3568c2 100644 --- a/src/VBox/Runtime/common/math/remainderf.asm +++ b/src/VBox/Runtime/common/math/remainderf.asm @@ -1,4 +1,4 @@ -; $Id: remainderf.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: remainderf.asm $ ;; @file ; IPRT - No-CRT remainderf - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/remainderl.asm b/src/VBox/Runtime/common/math/remainderl.asm index 2e540b5f9..011bafeb5 100644 --- a/src/VBox/Runtime/common/math/remainderl.asm +++ b/src/VBox/Runtime/common/math/remainderl.asm @@ -1,4 +1,4 @@ -; $Id: remainderl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: remainderl.asm $ ;; @file ; IPRT - No-CRT remainderl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/sinl.asm b/src/VBox/Runtime/common/math/sinl.asm index e5e733023..878dea18e 100644 --- a/src/VBox/Runtime/common/math/sinl.asm +++ b/src/VBox/Runtime/common/math/sinl.asm @@ -1,4 +1,4 @@ -; $Id: sinl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: sinl.asm $ ;; @file ; IPRT - No-CRT sinl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/tanl.asm b/src/VBox/Runtime/common/math/tanl.asm index d87313d90..e9803dd3d 100644 --- a/src/VBox/Runtime/common/math/tanl.asm +++ b/src/VBox/Runtime/common/math/tanl.asm @@ -1,4 +1,4 @@ -; $Id: tanl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: tanl.asm $ ;; @file ; IPRT - No-CRT tanl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/trunc.asm b/src/VBox/Runtime/common/math/trunc.asm index fbf6db924..71cf1ee88 100644 --- a/src/VBox/Runtime/common/math/trunc.asm +++ b/src/VBox/Runtime/common/math/trunc.asm @@ -1,4 +1,4 @@ -; $Id: trunc.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: trunc.asm $ ;; @file ; IPRT - No-CRT trunc - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/truncf.asm b/src/VBox/Runtime/common/math/truncf.asm index 0a0174650..0fdd360ab 100644 --- a/src/VBox/Runtime/common/math/truncf.asm +++ b/src/VBox/Runtime/common/math/truncf.asm @@ -1,4 +1,4 @@ -; $Id: truncf.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: truncf.asm $ ;; @file ; IPRT - No-CRT truncf - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/math/truncl.asm b/src/VBox/Runtime/common/math/truncl.asm index d792dc293..c44577308 100644 --- a/src/VBox/Runtime/common/math/truncl.asm +++ b/src/VBox/Runtime/common/math/truncl.asm @@ -1,4 +1,4 @@ -; $Id: truncl.asm 16316 2009-01-28 14:26:48Z vboxsync $ +; $Id: truncl.asm $ ;; @file ; IPRT - No-CRT truncl - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp index 5271b053e..fc7ad69e8 100644 --- a/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp +++ b/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp @@ -1,4 +1,4 @@ -/* $Id: RTAssertMsg1Weak.cpp 14500 2008-11-24 02:22:08Z vboxsync $ */ +/* $Id: RTAssertMsg1Weak.cpp $ */ /** @file * IPRT - RTAssertMsg1Weak. */ diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp index c2d1191ca..c39caa505 100644 --- a/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp +++ b/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp @@ -1,4 +1,4 @@ -/* $Id: RTAssertMsg2.cpp 14500 2008-11-24 02:22:08Z vboxsync $ */ +/* $Id: RTAssertMsg2.cpp $ */ /** @file * IPRT - RTAssertMsg2. */ diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg2Weak.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg2Weak.cpp index 74f3a4530..e42d8e960 100644 --- a/src/VBox/Runtime/common/misc/RTAssertMsg2Weak.cpp +++ b/src/VBox/Runtime/common/misc/RTAssertMsg2Weak.cpp @@ -1,4 +1,4 @@ -/* $Id: RTAssertMsg2Weak.cpp 14500 2008-11-24 02:22:08Z vboxsync $ */ +/* $Id: RTAssertMsg2Weak.cpp $ */ /** @file * IPRT - RTAssertMsg2Weak. */ diff --git a/src/VBox/Runtime/common/misc/assert.cpp b/src/VBox/Runtime/common/misc/assert.cpp index 5ff9b2757..7457ff06f 100644 --- a/src/VBox/Runtime/common/misc/assert.cpp +++ b/src/VBox/Runtime/common/misc/assert.cpp @@ -1,4 +1,4 @@ -/* $Id: assert.cpp 17410 2009-03-05 15:15:04Z vboxsync $ */ +/* $Id: assert.cpp $ */ /** @file * IPRT - Assertion Workers. */ diff --git a/src/VBox/Runtime/common/misc/cache.cpp b/src/VBox/Runtime/common/misc/cache.cpp index 82361f44d..80ac47daa 100644 --- a/src/VBox/Runtime/common/misc/cache.cpp +++ b/src/VBox/Runtime/common/misc/cache.cpp @@ -1,4 +1,4 @@ -/* $Id: cache.cpp 10848 2008-07-24 09:11:00Z vboxsync $ */ +/* $Id: cache.cpp $ */ /** @file * IPRT - Object cache */ diff --git a/src/VBox/Runtime/common/misc/cidr.cpp b/src/VBox/Runtime/common/misc/cidr.cpp index c395a2125..2ac877b25 100644 --- a/src/VBox/Runtime/common/misc/cidr.cpp +++ b/src/VBox/Runtime/common/misc/cidr.cpp @@ -1,4 +1,4 @@ -/* $Id: cidr.cpp 8359 2008-04-24 13:46:45Z vboxsync $ */ +/* $Id: cidr.cpp $ */ /** @file * IPRT - IPv4 address parsing. */ diff --git a/src/VBox/Runtime/common/misc/getopt.cpp b/src/VBox/Runtime/common/misc/getopt.cpp index 6367c6fa3..cff3e6901 100644 --- a/src/VBox/Runtime/common/misc/getopt.cpp +++ b/src/VBox/Runtime/common/misc/getopt.cpp @@ -1,4 +1,4 @@ -/* $Id: getopt.cpp 20809 2009-06-23 09:08:20Z vboxsync $ */ +/* $Id: getopt.cpp $ */ /** @file * IPRT - Command Line Parsing */ diff --git a/src/VBox/Runtime/common/misc/handletable.cpp b/src/VBox/Runtime/common/misc/handletable.cpp index 339c2cb25..7a3ae8682 100644 --- a/src/VBox/Runtime/common/misc/handletable.cpp +++ b/src/VBox/Runtime/common/misc/handletable.cpp @@ -1,4 +1,4 @@ -/* $Id: handletable.cpp 19865 2009-05-20 13:33:14Z vboxsync $ */ +/* $Id: handletable.cpp $ */ /** @file * IPRT - Handle Tables. */ diff --git a/src/VBox/Runtime/common/misc/handletable.h b/src/VBox/Runtime/common/misc/handletable.h index 4e63f89ca..550c70691 100644 --- a/src/VBox/Runtime/common/misc/handletable.h +++ b/src/VBox/Runtime/common/misc/handletable.h @@ -1,4 +1,4 @@ -/* $Id: handletable.h 10789 2008-07-21 17:22:32Z vboxsync $ */ +/* $Id: handletable.h $ */ /** @file * IPRT - Handle Tables, internal header. */ diff --git a/src/VBox/Runtime/common/misc/handletablectx.cpp b/src/VBox/Runtime/common/misc/handletablectx.cpp index 6c22a0a15..4925aeffe 100644 --- a/src/VBox/Runtime/common/misc/handletablectx.cpp +++ b/src/VBox/Runtime/common/misc/handletablectx.cpp @@ -1,4 +1,4 @@ -/* $Id: handletablectx.cpp 19865 2009-05-20 13:33:14Z vboxsync $ */ +/* $Id: handletablectx.cpp $ */ /** @file * IPRT - Handle Tables. */ diff --git a/src/VBox/Runtime/common/misc/handletablesimple.cpp b/src/VBox/Runtime/common/misc/handletablesimple.cpp index 702a32329..a64682900 100644 --- a/src/VBox/Runtime/common/misc/handletablesimple.cpp +++ b/src/VBox/Runtime/common/misc/handletablesimple.cpp @@ -1,4 +1,4 @@ -/* $Id: handletablesimple.cpp 10790 2008-07-21 18:43:39Z vboxsync $ */ +/* $Id: handletablesimple.cpp $ */ /** @file * IPRT - Handle Tables. */ diff --git a/src/VBox/Runtime/common/misc/once.cpp b/src/VBox/Runtime/common/misc/once.cpp index 6ee7093b4..0bec32d84 100644 --- a/src/VBox/Runtime/common/misc/once.cpp +++ b/src/VBox/Runtime/common/misc/once.cpp @@ -1,4 +1,4 @@ -/* $Id: once.cpp 19896 2009-05-21 21:35:42Z vboxsync $ */ +/* $Id: once.cpp $ */ /** @file * IPRT - Execute Once. */ diff --git a/src/VBox/Runtime/common/misc/req.cpp b/src/VBox/Runtime/common/misc/req.cpp index 10605f821..7da304598 100644 --- a/src/VBox/Runtime/common/misc/req.cpp +++ b/src/VBox/Runtime/common/misc/req.cpp @@ -1,4 +1,4 @@ -/* $Id: VMReq.cpp 17451 2007-01-15 14:08:28Z bird $ */ +/* $Id: VMReq.cpp $ */ /** @file * IPRT - Request packets */ diff --git a/src/VBox/Runtime/common/misc/s3.cpp b/src/VBox/Runtime/common/misc/s3.cpp index e92f857fd..4e2249d5d 100644 --- a/src/VBox/Runtime/common/misc/s3.cpp +++ b/src/VBox/Runtime/common/misc/s3.cpp @@ -1,4 +1,4 @@ -/* $Id: s3.cpp 20293 2009-06-04 16:21:32Z vboxsync $ */ +/* $Id: s3.cpp $ */ /** @file * S3 communication API. */ diff --git a/src/VBox/Runtime/common/misc/sanity-c.c b/src/VBox/Runtime/common/misc/sanity-c.c index e5214aade..3f3158862 100644 --- a/src/VBox/Runtime/common/misc/sanity-c.c +++ b/src/VBox/Runtime/common/misc/sanity-c.c @@ -1,4 +1,4 @@ -/* $Id: sanity-c.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: sanity-c.c $ */ /** @file * IPRT - Setup Sanity Checks, C. */ diff --git a/src/VBox/Runtime/common/misc/sanity-cpp.cpp b/src/VBox/Runtime/common/misc/sanity-cpp.cpp index a7755678b..2eda1c497 100644 --- a/src/VBox/Runtime/common/misc/sanity-cpp.cpp +++ b/src/VBox/Runtime/common/misc/sanity-cpp.cpp @@ -1,4 +1,4 @@ -/* $Id: sanity-cpp.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: sanity-cpp.cpp $ */ /** @file * IPRT - Setup Sanity Checks, C++. */ diff --git a/src/VBox/Runtime/common/misc/sanity.h b/src/VBox/Runtime/common/misc/sanity.h index 2302dde50..4a02bbde0 100644 --- a/src/VBox/Runtime/common/misc/sanity.h +++ b/src/VBox/Runtime/common/misc/sanity.h @@ -1,4 +1,4 @@ -/* $Id: sanity.h 16383 2009-01-29 17:35:12Z vboxsync $ */ +/* $Id: sanity.h $ */ /** @file * IPRT - Setup Sanity Checks, C and C++. */ diff --git a/src/VBox/Runtime/common/misc/semspingpong.cpp b/src/VBox/Runtime/common/misc/semspingpong.cpp index 00f8db7e4..597bbf95a 100644 --- a/src/VBox/Runtime/common/misc/semspingpong.cpp +++ b/src/VBox/Runtime/common/misc/semspingpong.cpp @@ -1,4 +1,4 @@ -/* $Id: semspingpong.cpp 14057 2008-11-10 23:00:21Z vboxsync $ */ +/* $Id: semspingpong.cpp $ */ /** @file * IPRT - Thread Ping-Pong Construct. */ diff --git a/src/VBox/Runtime/common/misc/setjmp.asm b/src/VBox/Runtime/common/misc/setjmp.asm index a12e25486..f318613df 100644 --- a/src/VBox/Runtime/common/misc/setjmp.asm +++ b/src/VBox/Runtime/common/misc/setjmp.asm @@ -1,4 +1,4 @@ -; $Id: setjmp.asm 8259 2008-04-21 21:01:41Z vboxsync $ +; $Id: setjmp.asm $ ;; @file ; IPRT - No-CRT setjmp & longjmp - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/misc/term.cpp b/src/VBox/Runtime/common/misc/term.cpp index 5a06d6a7a..b8380410a 100644 --- a/src/VBox/Runtime/common/misc/term.cpp +++ b/src/VBox/Runtime/common/misc/term.cpp @@ -1,4 +1,4 @@ -/* $Id: term.cpp 19898 2009-05-21 22:24:26Z vboxsync $ */ +/* $Id: term.cpp $ */ /** @file * IPRT - Common Termination Code. */ diff --git a/src/VBox/Runtime/common/misc/thread.cpp b/src/VBox/Runtime/common/misc/thread.cpp index 4be043cda..d3d31d843 100644 --- a/src/VBox/Runtime/common/misc/thread.cpp +++ b/src/VBox/Runtime/common/misc/thread.cpp @@ -1,4 +1,4 @@ -/* $Id: thread.cpp 20273 2009-06-04 12:16:28Z vboxsync $ */ +/* $Id: thread.cpp $ */ /** @file * IPRT - Threads, common routines. */ diff --git a/src/VBox/Runtime/common/misc/zip.cpp b/src/VBox/Runtime/common/misc/zip.cpp index 5ae7673e4..c24a5f20a 100644 --- a/src/VBox/Runtime/common/misc/zip.cpp +++ b/src/VBox/Runtime/common/misc/zip.cpp @@ -1,4 +1,4 @@ -/* $Id: zip.cpp 19863 2009-05-20 12:31:49Z vboxsync $ */ +/* $Id: zip.cpp $ */ /** @file * IPRT - Compression. */ diff --git a/src/VBox/Runtime/common/rand/rand.cpp b/src/VBox/Runtime/common/rand/rand.cpp index acab004c7..70aa40230 100644 --- a/src/VBox/Runtime/common/rand/rand.cpp +++ b/src/VBox/Runtime/common/rand/rand.cpp @@ -1,4 +1,4 @@ -/* $Id: rand.cpp 11557 2008-08-21 21:47:31Z vboxsync $ */ +/* $Id: rand.cpp $ */ /** @file * IPRT - Random Numbers. */ diff --git a/src/VBox/Runtime/common/rand/randadv.cpp b/src/VBox/Runtime/common/rand/randadv.cpp index 2f87d7a94..4053b0e54 100644 --- a/src/VBox/Runtime/common/rand/randadv.cpp +++ b/src/VBox/Runtime/common/rand/randadv.cpp @@ -1,4 +1,4 @@ -/* $Id: randadv.cpp 20256 2009-06-04 08:55:28Z vboxsync $ */ +/* $Id: randadv.cpp $ */ /** @file * IPRT - Random Numbers, Generic Glue. */ diff --git a/src/VBox/Runtime/common/rand/randparkmiller.cpp b/src/VBox/Runtime/common/rand/randparkmiller.cpp index 2c2b0fb0b..88bff9c5c 100644 --- a/src/VBox/Runtime/common/rand/randparkmiller.cpp +++ b/src/VBox/Runtime/common/rand/randparkmiller.cpp @@ -1,4 +1,4 @@ -/* $Id: randparkmiller.cpp 20256 2009-06-04 08:55:28Z vboxsync $ */ +/* $Id: randparkmiller.cpp $ */ /** @file * IPRT - Random Numbers, Park-Miller Pseudo Random. */ diff --git a/src/VBox/Runtime/common/string/RTStrNLen.cpp b/src/VBox/Runtime/common/string/RTStrNLen.cpp index 48ef626a9..bac035bc7 100644 --- a/src/VBox/Runtime/common/string/RTStrNLen.cpp +++ b/src/VBox/Runtime/common/string/RTStrNLen.cpp @@ -1,4 +1,4 @@ -/* $Id: RTStrNLen.cpp 10949 2008-07-29 18:56:03Z vboxsync $ */ +/* $Id: RTStrNLen.cpp $ */ /** @file * IPRT - RTStrNLen. */ diff --git a/src/VBox/Runtime/common/string/RTStrNLenEx.cpp b/src/VBox/Runtime/common/string/RTStrNLenEx.cpp index 382f15645..9fdba1256 100644 --- a/src/VBox/Runtime/common/string/RTStrNLenEx.cpp +++ b/src/VBox/Runtime/common/string/RTStrNLenEx.cpp @@ -1,4 +1,4 @@ -/* $Id: RTStrNLenEx.cpp 10949 2008-07-29 18:56:03Z vboxsync $ */ +/* $Id: RTStrNLenEx.cpp $ */ /** @file * IPRT - RTStrNLenEx. */ diff --git a/src/VBox/Runtime/common/string/base64.cpp b/src/VBox/Runtime/common/string/base64.cpp index 03fd9ef85..e6b4df9a6 100644 --- a/src/VBox/Runtime/common/string/base64.cpp +++ b/src/VBox/Runtime/common/string/base64.cpp @@ -1,4 +1,4 @@ -/* $Id: base64.cpp 16774 2009-02-15 04:23:47Z vboxsync $ */ +/* $Id: base64.cpp $ */ /** @file * IPRT - Base64, MIME content transfer encoding. */ diff --git a/src/VBox/Runtime/common/string/memchr.asm b/src/VBox/Runtime/common/string/memchr.asm index df5939be9..17ac3b949 100644 --- a/src/VBox/Runtime/common/string/memchr.asm +++ b/src/VBox/Runtime/common/string/memchr.asm @@ -1,4 +1,4 @@ -; $Id: memchr.asm 14021 2008-11-10 16:31:22Z vboxsync $ +; $Id: memchr.asm $ ;; @file ; IPRT - No-CRT memchr - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/memchr.cpp b/src/VBox/Runtime/common/string/memchr.cpp index 642bf4ed2..97ad18294 100644 --- a/src/VBox/Runtime/common/string/memchr.cpp +++ b/src/VBox/Runtime/common/string/memchr.cpp @@ -1,4 +1,4 @@ -/* $Id: memchr.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: memchr.cpp $ */ /** @file * IPRT - CRT Strings, memcpy(). */ diff --git a/src/VBox/Runtime/common/string/memchr_alias.c b/src/VBox/Runtime/common/string/memchr_alias.c index 09c8a0461..ce07090df 100644 --- a/src/VBox/Runtime/common/string/memchr_alias.c +++ b/src/VBox/Runtime/common/string/memchr_alias.c @@ -1,4 +1,4 @@ -/* $Id: memchr_alias.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: memchr_alias.c $ */ /** @file * IPRT - No-CRT memchr() alias for gcc. */ diff --git a/src/VBox/Runtime/common/string/memcmp.asm b/src/VBox/Runtime/common/string/memcmp.asm index df5cff5f6..8e28d0b5c 100644 --- a/src/VBox/Runtime/common/string/memcmp.asm +++ b/src/VBox/Runtime/common/string/memcmp.asm @@ -1,4 +1,4 @@ -; $Id: memcmp.asm 14021 2008-11-10 16:31:22Z vboxsync $ +; $Id: memcmp.asm $ ;; @file ; IPRT - No-CRT memcmp - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/memcmp.cpp b/src/VBox/Runtime/common/string/memcmp.cpp index 581bf83c0..d80cf6d49 100644 --- a/src/VBox/Runtime/common/string/memcmp.cpp +++ b/src/VBox/Runtime/common/string/memcmp.cpp @@ -1,4 +1,4 @@ -/* $Id: memcmp.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: memcmp.cpp $ */ /** @file * IPRT - CRT Strings, memcmp(). */ diff --git a/src/VBox/Runtime/common/string/memcmp_alias.c b/src/VBox/Runtime/common/string/memcmp_alias.c index 1c9f36779..6324caf0b 100644 --- a/src/VBox/Runtime/common/string/memcmp_alias.c +++ b/src/VBox/Runtime/common/string/memcmp_alias.c @@ -1,4 +1,4 @@ -/* $Id: memcmp_alias.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: memcmp_alias.c $ */ /** @file * IPRT - No-CRT memcmp() alias for gcc. */ diff --git a/src/VBox/Runtime/common/string/memcpy.asm b/src/VBox/Runtime/common/string/memcpy.asm index af5553797..7d3594f07 100644 --- a/src/VBox/Runtime/common/string/memcpy.asm +++ b/src/VBox/Runtime/common/string/memcpy.asm @@ -1,4 +1,4 @@ -; $Id: memcpy.asm 14021 2008-11-10 16:31:22Z vboxsync $ +; $Id: memcpy.asm $ ;; @file ; IPRT - No-CRT memcpy - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/memcpy.cpp b/src/VBox/Runtime/common/string/memcpy.cpp index 895eb6b43..e4d7d538b 100644 --- a/src/VBox/Runtime/common/string/memcpy.cpp +++ b/src/VBox/Runtime/common/string/memcpy.cpp @@ -1,4 +1,4 @@ -/* $Id: memcpy.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: memcpy.cpp $ */ /** @file * IPRT - CRT Strings, memcpy(). */ diff --git a/src/VBox/Runtime/common/string/memcpy_alias.c b/src/VBox/Runtime/common/string/memcpy_alias.c index b4528d0bd..087edd801 100644 --- a/src/VBox/Runtime/common/string/memcpy_alias.c +++ b/src/VBox/Runtime/common/string/memcpy_alias.c @@ -1,4 +1,4 @@ -/* $Id: memcpy_alias.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: memcpy_alias.c $ */ /** @file * IPRT - No-CRT memcpy() alias for gcc. */ diff --git a/src/VBox/Runtime/common/string/memmove.asm b/src/VBox/Runtime/common/string/memmove.asm index c364bae57..8c7e70039 100644 --- a/src/VBox/Runtime/common/string/memmove.asm +++ b/src/VBox/Runtime/common/string/memmove.asm @@ -1,4 +1,4 @@ -; $Id: memmove.asm 14021 2008-11-10 16:31:22Z vboxsync $ +; $Id: memmove.asm $ ;; @file ; IPRT - No-CRT memmove - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/memmove_alias.c b/src/VBox/Runtime/common/string/memmove_alias.c index 952624e75..60b509c57 100644 --- a/src/VBox/Runtime/common/string/memmove_alias.c +++ b/src/VBox/Runtime/common/string/memmove_alias.c @@ -1,4 +1,4 @@ -/* $Id: memmove_alias.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: memmove_alias.c $ */ /** @file * IPRT - No-CRT memmove() alias for gcc. */ diff --git a/src/VBox/Runtime/common/string/mempcpy.asm b/src/VBox/Runtime/common/string/mempcpy.asm index e35cbc1be..718626a49 100644 --- a/src/VBox/Runtime/common/string/mempcpy.asm +++ b/src/VBox/Runtime/common/string/mempcpy.asm @@ -1,4 +1,4 @@ -; $Id: mempcpy.asm 14021 2008-11-10 16:31:22Z vboxsync $ +; $Id: mempcpy.asm $ ;; @file ; IPRT - No-CRT mempcpy - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/memset.asm b/src/VBox/Runtime/common/string/memset.asm index 545733b8d..a9cdfc832 100644 --- a/src/VBox/Runtime/common/string/memset.asm +++ b/src/VBox/Runtime/common/string/memset.asm @@ -1,4 +1,4 @@ -; $Id: memset.asm 14021 2008-11-10 16:31:22Z vboxsync $ +; $Id: memset.asm $ ;; @file ; IPRT - No-CRT memset - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/memset.cpp b/src/VBox/Runtime/common/string/memset.cpp index 198b2787e..bb5763e54 100644 --- a/src/VBox/Runtime/common/string/memset.cpp +++ b/src/VBox/Runtime/common/string/memset.cpp @@ -1,4 +1,4 @@ -/* $Id: memset.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: memset.cpp $ */ /** @file * IPRT - CRT Strings, memset(). */ diff --git a/src/VBox/Runtime/common/string/memset_alias.c b/src/VBox/Runtime/common/string/memset_alias.c index ddaa5d83a..7ce4ad7b2 100644 --- a/src/VBox/Runtime/common/string/memset_alias.c +++ b/src/VBox/Runtime/common/string/memset_alias.c @@ -1,4 +1,4 @@ -/* $Id: memset_alias.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: memset_alias.c $ */ /** @file * IPRT - No-CRT memset() alias for gcc. */ diff --git a/src/VBox/Runtime/common/string/simplepattern.cpp b/src/VBox/Runtime/common/string/simplepattern.cpp index 3a0cb9752..9efd7b41c 100644 --- a/src/VBox/Runtime/common/string/simplepattern.cpp +++ b/src/VBox/Runtime/common/string/simplepattern.cpp @@ -1,4 +1,4 @@ -/* $Id: simplepattern.cpp 13549 2008-10-24 11:31:40Z vboxsync $ */ +/* $Id: simplepattern.cpp $ */ /** @file * IPRT - RTStrSimplePattern. */ diff --git a/src/VBox/Runtime/common/string/straprintf.cpp b/src/VBox/Runtime/common/string/straprintf.cpp index c63b745a1..5e05e6520 100644 --- a/src/VBox/Runtime/common/string/straprintf.cpp +++ b/src/VBox/Runtime/common/string/straprintf.cpp @@ -1,4 +1,4 @@ -/* $Id: straprintf.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: straprintf.cpp $ */ /** @file * IPRT - Allocating String Formatters. */ diff --git a/src/VBox/Runtime/common/string/strchr.asm b/src/VBox/Runtime/common/string/strchr.asm index bbd915cfd..a56d70bb9 100644 --- a/src/VBox/Runtime/common/string/strchr.asm +++ b/src/VBox/Runtime/common/string/strchr.asm @@ -1,4 +1,4 @@ -; $Id: strchr.asm 14021 2008-11-10 16:31:22Z vboxsync $ +; $Id: strchr.asm $ ;; @file ; IPRT - No-CRT strchr - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/strchr_alias.c b/src/VBox/Runtime/common/string/strchr_alias.c index 348741eb9..72a0100db 100644 --- a/src/VBox/Runtime/common/string/strchr_alias.c +++ b/src/VBox/Runtime/common/string/strchr_alias.c @@ -1,4 +1,4 @@ -/* $Id: strchr_alias.c 9503 2008-06-08 03:04:08Z vboxsync $ */ +/* $Id: strchr_alias.c $ */ /** @file * IPRT - No-CRT strchr() alias for gcc. */ diff --git a/src/VBox/Runtime/common/string/strcmp.asm b/src/VBox/Runtime/common/string/strcmp.asm index e617b1a9d..194562a4d 100644 --- a/src/VBox/Runtime/common/string/strcmp.asm +++ b/src/VBox/Runtime/common/string/strcmp.asm @@ -1,4 +1,4 @@ -; $Id: strcmp.asm 14021 2008-11-10 16:31:22Z vboxsync $ +; $Id: strcmp.asm $ ;; @file ; IPRT - No-CRT strcmp - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/strcmp_alias.c b/src/VBox/Runtime/common/string/strcmp_alias.c index 0591941e3..60fda92c8 100644 --- a/src/VBox/Runtime/common/string/strcmp_alias.c +++ b/src/VBox/Runtime/common/string/strcmp_alias.c @@ -1,4 +1,4 @@ -/* $Id: strcmp_alias.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: strcmp_alias.c $ */ /** @file * IPRT - No-CRT strcmp() alias for gcc. */ diff --git a/src/VBox/Runtime/common/string/strcpy.asm b/src/VBox/Runtime/common/string/strcpy.asm index ba79a0a11..ecba50c53 100644 --- a/src/VBox/Runtime/common/string/strcpy.asm +++ b/src/VBox/Runtime/common/string/strcpy.asm @@ -1,4 +1,4 @@ -; $Id: strcpy.asm 14024 2008-11-10 17:07:24Z vboxsync $ +; $Id: strcpy.asm $ ;; @file ; IPRT - No-CRT strcpy - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/strcpy.cpp b/src/VBox/Runtime/common/string/strcpy.cpp index 65868236f..31e05f2f5 100644 --- a/src/VBox/Runtime/common/string/strcpy.cpp +++ b/src/VBox/Runtime/common/string/strcpy.cpp @@ -1,4 +1,4 @@ -/* $Id: strcpy.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: strcpy.cpp $ */ /** @file * IPRT - CRT Strings, strcpy(). */ diff --git a/src/VBox/Runtime/common/string/strcpy_alias.c b/src/VBox/Runtime/common/string/strcpy_alias.c index 239503188..0bb870c47 100644 --- a/src/VBox/Runtime/common/string/strcpy_alias.c +++ b/src/VBox/Runtime/common/string/strcpy_alias.c @@ -1,4 +1,4 @@ -/* $Id: strcpy_alias.c 14021 2008-11-10 16:31:22Z vboxsync $ */ +/* $Id: strcpy_alias.c $ */ /** @file * IPRT - No-CRT strcpy() alias for gcc. */ diff --git a/src/VBox/Runtime/common/string/strformat.cpp b/src/VBox/Runtime/common/string/strformat.cpp index e2f9a02aa..d459cd345 100644 --- a/src/VBox/Runtime/common/string/strformat.cpp +++ b/src/VBox/Runtime/common/string/strformat.cpp @@ -1,4 +1,4 @@ -/* $Id: strformat.cpp 19942 2009-05-23 15:42:57Z vboxsync $ */ +/* $Id: strformat.cpp $ */ /** @file * IPRT - String Formatter. */ diff --git a/src/VBox/Runtime/common/string/strformatrt.cpp b/src/VBox/Runtime/common/string/strformatrt.cpp index 793a9cc33..9ed838aae 100644 --- a/src/VBox/Runtime/common/string/strformatrt.cpp +++ b/src/VBox/Runtime/common/string/strformatrt.cpp @@ -1,4 +1,4 @@ -/* $Id: strformatrt.cpp 19942 2009-05-23 15:42:57Z vboxsync $ */ +/* $Id: strformatrt.cpp $ */ /** @file * IPRT - IPRT String Formatter Extensions. */ diff --git a/src/VBox/Runtime/common/string/strformattype.cpp b/src/VBox/Runtime/common/string/strformattype.cpp index 64afd1803..417c9455d 100644 --- a/src/VBox/Runtime/common/string/strformattype.cpp +++ b/src/VBox/Runtime/common/string/strformattype.cpp @@ -1,4 +1,4 @@ -/* $Id: strformattype.cpp 17522 2009-03-07 06:50:52Z vboxsync $ */ +/* $Id: strformattype.cpp $ */ /** @file * IPRT - IPRT String Formatter Extensions, Dynamic Types. */ diff --git a/src/VBox/Runtime/common/string/string.cpp b/src/VBox/Runtime/common/string/string.cpp index db6949b40..37bf04cda 100644 --- a/src/VBox/Runtime/common/string/string.cpp +++ b/src/VBox/Runtime/common/string/string.cpp @@ -1,4 +1,4 @@ -/* $Id: string.cpp 19384 2009-05-05 15:24:54Z vboxsync $ */ +/* $Id: string.cpp $ */ /** @file * IPRT - String Manipulation. */ diff --git a/src/VBox/Runtime/common/string/strlen.asm b/src/VBox/Runtime/common/string/strlen.asm index adff3ba51..272e5e70d 100644 --- a/src/VBox/Runtime/common/string/strlen.asm +++ b/src/VBox/Runtime/common/string/strlen.asm @@ -1,4 +1,4 @@ -; $Id: strlen.asm 14021 2008-11-10 16:31:22Z vboxsync $ +; $Id: strlen.asm $ ;; @file ; IPRT - No-CRT strlen - AMD64 & X86. ; diff --git a/src/VBox/Runtime/common/string/strlen.cpp b/src/VBox/Runtime/common/string/strlen.cpp index bfc84b731..455f9346b 100644 --- a/src/VBox/Runtime/common/string/strlen.cpp +++ b/src/VBox/Runtime/common/string/strlen.cpp @@ -1,4 +1,4 @@ -/* $Id: strlen.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: strlen.cpp $ */ /** @file * IPRT - CRT Strings, strlen(). */ diff --git a/src/VBox/Runtime/common/string/strlen_alias.c b/src/VBox/Runtime/common/string/strlen_alias.c index 945090308..60f39b04a 100644 --- a/src/VBox/Runtime/common/string/strlen_alias.c +++ b/src/VBox/Runtime/common/string/strlen_alias.c @@ -1,4 +1,4 @@ -/* $Id: strlen_alias.c 10137 2008-07-03 04:12:26Z vboxsync $ */ +/* $Id: strlen_alias.c $ */ /** @file * IPRT - No-CRT strlen() alias for gcc. */ diff --git a/src/VBox/Runtime/common/string/strncmp.cpp b/src/VBox/Runtime/common/string/strncmp.cpp index a582b2a0c..d3643848e 100644 --- a/src/VBox/Runtime/common/string/strncmp.cpp +++ b/src/VBox/Runtime/common/string/strncmp.cpp @@ -1,4 +1,4 @@ -/* $Id: strncmp.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: strncmp.cpp $ */ /** @file * IPRT - CRT Strings, strncmp(). */ diff --git a/src/VBox/Runtime/common/string/strpbrk.cpp b/src/VBox/Runtime/common/string/strpbrk.cpp index effa820cf..c582153b7 100644 --- a/src/VBox/Runtime/common/string/strpbrk.cpp +++ b/src/VBox/Runtime/common/string/strpbrk.cpp @@ -1,4 +1,4 @@ -/* $Id: strpbrk.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: strpbrk.cpp $ */ /** @file * IPRT - strpbrk(). */ diff --git a/src/VBox/Runtime/common/string/strprintf.cpp b/src/VBox/Runtime/common/string/strprintf.cpp index b0715703a..8a7e629bb 100644 --- a/src/VBox/Runtime/common/string/strprintf.cpp +++ b/src/VBox/Runtime/common/string/strprintf.cpp @@ -1,4 +1,4 @@ -/* $Id: strprintf.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: strprintf.cpp $ */ /** @file * IPRT - String Formatters. */ diff --git a/src/VBox/Runtime/common/string/strspace.cpp b/src/VBox/Runtime/common/string/strspace.cpp index d8ce1b8ea..98ee4368b 100644 --- a/src/VBox/Runtime/common/string/strspace.cpp +++ b/src/VBox/Runtime/common/string/strspace.cpp @@ -1,4 +1,4 @@ -/* $Id: strspace.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: strspace.cpp $ */ /** @file * IPRT - Unique String Spaces. */ diff --git a/src/VBox/Runtime/common/string/strstrip.cpp b/src/VBox/Runtime/common/string/strstrip.cpp index b2d4691e5..34896ae54 100644 --- a/src/VBox/Runtime/common/string/strstrip.cpp +++ b/src/VBox/Runtime/common/string/strstrip.cpp @@ -1,4 +1,4 @@ -/* $Id: strstrip.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: strstrip.cpp $ */ /** @file * IPRT - String Stripping and Trimming. */ diff --git a/src/VBox/Runtime/common/string/strtonum.cpp b/src/VBox/Runtime/common/string/strtonum.cpp index 31ac198f4..b78e7fbc7 100644 --- a/src/VBox/Runtime/common/string/strtonum.cpp +++ b/src/VBox/Runtime/common/string/strtonum.cpp @@ -1,4 +1,4 @@ -/* $Id: strtonum.cpp 8279 2008-04-22 12:13:16Z vboxsync $ */ +/* $Id: strtonum.cpp $ */ /** @file * IPRT - String To Number Convertion. */ diff --git a/src/VBox/Runtime/common/string/uni.cpp b/src/VBox/Runtime/common/string/uni.cpp index 05837206b..94e450798 100644 --- a/src/VBox/Runtime/common/string/uni.cpp +++ b/src/VBox/Runtime/common/string/uni.cpp @@ -1,4 +1,4 @@ -/* $Id: uni.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: uni.cpp $ */ /** @file * IPRT - Unicode. */ diff --git a/src/VBox/Runtime/common/string/unidata.cpp b/src/VBox/Runtime/common/string/unidata.cpp index 5c3792445..e379f7bf0 100644 --- a/src/VBox/Runtime/common/string/unidata.cpp +++ b/src/VBox/Runtime/common/string/unidata.cpp @@ -1,4 +1,4 @@ -/* $Id: unidata.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: unidata.cpp $ */ /** @file * IPRT - Unicode Tables * diff --git a/src/VBox/Runtime/common/string/uniread.cpp b/src/VBox/Runtime/common/string/uniread.cpp index 66e1c9a29..01b00087e 100644 --- a/src/VBox/Runtime/common/string/uniread.cpp +++ b/src/VBox/Runtime/common/string/uniread.cpp @@ -1,4 +1,4 @@ -/* $Id: uniread.cpp 13836 2008-11-05 02:42:54Z vboxsync $ */ +/* $Id: uniread.cpp $ */ /** @file * IPRT - Unicode Specification Reader. */ diff --git a/src/VBox/Runtime/common/string/utf-16.cpp b/src/VBox/Runtime/common/string/utf-16.cpp index 47efb32b7..cd72cdc25 100644 --- a/src/VBox/Runtime/common/string/utf-16.cpp +++ b/src/VBox/Runtime/common/string/utf-16.cpp @@ -1,4 +1,4 @@ -/* $Id: utf-16.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: utf-16.cpp $ */ /** @file * IPRT - UTF-16 */ diff --git a/src/VBox/Runtime/common/string/utf-8.cpp b/src/VBox/Runtime/common/string/utf-8.cpp index d0b47b399..036ffbc81 100644 --- a/src/VBox/Runtime/common/string/utf-8.cpp +++ b/src/VBox/Runtime/common/string/utf-8.cpp @@ -1,4 +1,4 @@ -/* $Id: utf-8.cpp 18570 2009-03-31 13:07:44Z vboxsync $ */ +/* $Id: utf-8.cpp $ */ /** @file * IPRT - UTF-8 Decoding. */ diff --git a/src/VBox/Runtime/common/table/avl_Base.cpp.h b/src/VBox/Runtime/common/table/avl_Base.cpp.h index 79e1403c4..32d6e1117 100644 --- a/src/VBox/Runtime/common/table/avl_Base.cpp.h +++ b/src/VBox/Runtime/common/table/avl_Base.cpp.h @@ -1,4 +1,4 @@ -/* $Id: avl_Base.cpp.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: avl_Base.cpp.h $ */ /** @file * kAVLBase - basic routines for all AVL trees. */ diff --git a/src/VBox/Runtime/common/table/avl_Destroy.cpp.h b/src/VBox/Runtime/common/table/avl_Destroy.cpp.h index 9074abab5..3db25a220 100644 --- a/src/VBox/Runtime/common/table/avl_Destroy.cpp.h +++ b/src/VBox/Runtime/common/table/avl_Destroy.cpp.h @@ -1,4 +1,4 @@ -/* $Id: avl_Destroy.cpp.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: avl_Destroy.cpp.h $ */ /** @file * kAVLDestroy - Walk the tree calling a callback to destroy all the nodes. */ diff --git a/src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h b/src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h index 21a559518..784f710fd 100644 --- a/src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h +++ b/src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h @@ -1,4 +1,4 @@ -/* $Id: avl_DoWithAll.cpp.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: avl_DoWithAll.cpp.h $ */ /** @file * kAVLDoWithAll - Do with all nodes routine for AVL trees. */ diff --git a/src/VBox/Runtime/common/table/avl_Enum.cpp.h b/src/VBox/Runtime/common/table/avl_Enum.cpp.h index 5612cf189..de7d94d84 100644 --- a/src/VBox/Runtime/common/table/avl_Enum.cpp.h +++ b/src/VBox/Runtime/common/table/avl_Enum.cpp.h @@ -1,4 +1,4 @@ -/* $Id: avl_Enum.cpp.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: avl_Enum.cpp.h $ */ /** @file * Enumeration routines for AVL trees. */ diff --git a/src/VBox/Runtime/common/table/avl_Get.cpp.h b/src/VBox/Runtime/common/table/avl_Get.cpp.h index 1975a3ea6..6f1756f8d 100644 --- a/src/VBox/Runtime/common/table/avl_Get.cpp.h +++ b/src/VBox/Runtime/common/table/avl_Get.cpp.h @@ -1,4 +1,4 @@ -/* $Id: avl_Get.cpp.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: avl_Get.cpp.h $ */ /** @file * kAVLGet - get routine for AVL trees. */ diff --git a/src/VBox/Runtime/common/table/avl_GetBestFit.cpp.h b/src/VBox/Runtime/common/table/avl_GetBestFit.cpp.h index 15d42bc96..7a489e6fd 100644 --- a/src/VBox/Runtime/common/table/avl_GetBestFit.cpp.h +++ b/src/VBox/Runtime/common/table/avl_GetBestFit.cpp.h @@ -1,4 +1,4 @@ -/* $Id: avl_GetBestFit.cpp.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: avl_GetBestFit.cpp.h $ */ /** @file * kAVLGetBestFit - Get Best Fit routine for AVL trees. * Intended specially on heaps. The tree should allow duplicate keys. diff --git a/src/VBox/Runtime/common/table/avl_Range.cpp.h b/src/VBox/Runtime/common/table/avl_Range.cpp.h index e2603de10..d1d2b90dd 100644 --- a/src/VBox/Runtime/common/table/avl_Range.cpp.h +++ b/src/VBox/Runtime/common/table/avl_Range.cpp.h @@ -1,4 +1,4 @@ -/* $Id: avl_Range.cpp.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: avl_Range.cpp.h $ */ /** @file * kAVLRange - Range routines for AVL trees. */ diff --git a/src/VBox/Runtime/common/table/avl_RemoveBestFit.cpp.h b/src/VBox/Runtime/common/table/avl_RemoveBestFit.cpp.h index 06c974964..bbd6322db 100644 --- a/src/VBox/Runtime/common/table/avl_RemoveBestFit.cpp.h +++ b/src/VBox/Runtime/common/table/avl_RemoveBestFit.cpp.h @@ -1,4 +1,4 @@ -/* $Id: avl_RemoveBestFit.cpp.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: avl_RemoveBestFit.cpp.h $ */ /** @file * kAVLRemoveBestFit - Remove Best Fit routine for AVL trees. * Intended specially on heaps. The tree should allow duplicate keys. diff --git a/src/VBox/Runtime/common/table/avlgcptr.cpp b/src/VBox/Runtime/common/table/avlgcptr.cpp index 1cedafdc3..08b6dbf3c 100644 --- a/src/VBox/Runtime/common/table/avlgcptr.cpp +++ b/src/VBox/Runtime/common/table/avlgcptr.cpp @@ -1,4 +1,4 @@ -/* $Id: avlgcptr.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlgcptr.cpp $ */ /** @file * IPRT - AVL tree, RTGCPTR, unique keys. */ diff --git a/src/VBox/Runtime/common/table/avlhcphys.cpp b/src/VBox/Runtime/common/table/avlhcphys.cpp index 98371f9db..6e18fd1a1 100644 --- a/src/VBox/Runtime/common/table/avlhcphys.cpp +++ b/src/VBox/Runtime/common/table/avlhcphys.cpp @@ -1,4 +1,4 @@ -/* $Id: avlhcphys.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlhcphys.cpp $ */ /** @file * IPRT - AVL tree, RTHCPHYS, unique keys. */ diff --git a/src/VBox/Runtime/common/table/avllu32.cpp b/src/VBox/Runtime/common/table/avllu32.cpp index cf3133a0e..cf80cad1a 100644 --- a/src/VBox/Runtime/common/table/avllu32.cpp +++ b/src/VBox/Runtime/common/table/avllu32.cpp @@ -1,4 +1,4 @@ -/* $Id: avllu32.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avllu32.cpp $ */ /** @file * IPRT - AVL tree, uint32_t, unique keys. */ diff --git a/src/VBox/Runtime/common/table/avlogcphys.cpp b/src/VBox/Runtime/common/table/avlogcphys.cpp index 3d326a44e..439856af0 100644 --- a/src/VBox/Runtime/common/table/avlogcphys.cpp +++ b/src/VBox/Runtime/common/table/avlogcphys.cpp @@ -1,4 +1,4 @@ -/* $Id: avlogcphys.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlogcphys.cpp $ */ /** @file * IPRT - AVL tree, RTGCPHYS, unique keys, offset pointers. */ diff --git a/src/VBox/Runtime/common/table/avlogcptr.cpp b/src/VBox/Runtime/common/table/avlogcptr.cpp index 06c4b679f..865e9bb7a 100644 --- a/src/VBox/Runtime/common/table/avlogcptr.cpp +++ b/src/VBox/Runtime/common/table/avlogcptr.cpp @@ -1,4 +1,4 @@ -/* $Id: avlogcptr.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlogcptr.cpp $ */ /** @file * IPRT - AVL tree, RTGCPTR, unique keys, offset pointers. */ diff --git a/src/VBox/Runtime/common/table/avlohcphys.cpp b/src/VBox/Runtime/common/table/avlohcphys.cpp index 54cfcf1e0..355717d4e 100644 --- a/src/VBox/Runtime/common/table/avlohcphys.cpp +++ b/src/VBox/Runtime/common/table/avlohcphys.cpp @@ -1,4 +1,4 @@ -/* $Id: avlohcphys.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlohcphys.cpp $ */ /** @file * IPRT - AVL tree, RTHCPHYS, unique keys, offset pointers. */ diff --git a/src/VBox/Runtime/common/table/avloioport.cpp b/src/VBox/Runtime/common/table/avloioport.cpp index e33494968..123ad8e35 100644 --- a/src/VBox/Runtime/common/table/avloioport.cpp +++ b/src/VBox/Runtime/common/table/avloioport.cpp @@ -1,4 +1,4 @@ -/* $Id: avloioport.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avloioport.cpp $ */ /** @file * IPRT - AVL tree, RTIOPORT, unique keys, offset pointers. */ diff --git a/src/VBox/Runtime/common/table/avlou32.cpp b/src/VBox/Runtime/common/table/avlou32.cpp index b261d9b44..8a3e4f9f0 100644 --- a/src/VBox/Runtime/common/table/avlou32.cpp +++ b/src/VBox/Runtime/common/table/avlou32.cpp @@ -1,4 +1,4 @@ -/* $Id: avlou32.cpp 9230 2008-05-29 15:30:59Z vboxsync $ */ +/* $Id: avlou32.cpp $ */ /** @file * IPRT - AVL tree, uint_32, unique keys, offset pointers. */ diff --git a/src/VBox/Runtime/common/table/avlpv.cpp b/src/VBox/Runtime/common/table/avlpv.cpp index 2ca018e0b..cf265769c 100644 --- a/src/VBox/Runtime/common/table/avlpv.cpp +++ b/src/VBox/Runtime/common/table/avlpv.cpp @@ -1,4 +1,4 @@ -/* $Id: avlpv.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlpv.cpp $ */ /** @file * IPRT - AVL tree, void *, unique keys. */ diff --git a/src/VBox/Runtime/common/table/avlrgcptr.cpp b/src/VBox/Runtime/common/table/avlrgcptr.cpp index 9a4438b1f..0aacc968f 100644 --- a/src/VBox/Runtime/common/table/avlrgcptr.cpp +++ b/src/VBox/Runtime/common/table/avlrgcptr.cpp @@ -1,4 +1,4 @@ -/* $Id: avlrgcptr.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlrgcptr.cpp $ */ /** @file * IPRT - AVL tree, RTGCPTR, range, unique keys. */ diff --git a/src/VBox/Runtime/common/table/avlrogcphys.cpp b/src/VBox/Runtime/common/table/avlrogcphys.cpp index e723c6b1d..53026808a 100644 --- a/src/VBox/Runtime/common/table/avlrogcphys.cpp +++ b/src/VBox/Runtime/common/table/avlrogcphys.cpp @@ -1,4 +1,4 @@ -/* $Id: avlrogcphys.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlrogcphys.cpp $ */ /** @file * IPRT - AVL tree, RTGCPHYS, range, unique keys, offset pointers. */ diff --git a/src/VBox/Runtime/common/table/avlrogcptr.cpp b/src/VBox/Runtime/common/table/avlrogcptr.cpp index 1c777597f..f6863023f 100644 --- a/src/VBox/Runtime/common/table/avlrogcptr.cpp +++ b/src/VBox/Runtime/common/table/avlrogcptr.cpp @@ -1,4 +1,4 @@ -/* $Id: avlrogcptr.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlrogcptr.cpp $ */ /** @file * IPRT - AVL tree, RTGCPTR, range, unique keys, offset pointers. */ diff --git a/src/VBox/Runtime/common/table/avlroioport.cpp b/src/VBox/Runtime/common/table/avlroioport.cpp index 4f5cc5cdc..459b23df4 100644 --- a/src/VBox/Runtime/common/table/avlroioport.cpp +++ b/src/VBox/Runtime/common/table/avlroioport.cpp @@ -1,4 +1,4 @@ -/* $Id: avlroioport.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlroioport.cpp $ */ /** @file * IPRT - AVL tree, RTIOPORT, range, unique keys, offset pointers. */ diff --git a/src/VBox/Runtime/common/table/avlroogcptr.cpp b/src/VBox/Runtime/common/table/avlroogcptr.cpp index cfb0805da..d13c13d43 100644 --- a/src/VBox/Runtime/common/table/avlroogcptr.cpp +++ b/src/VBox/Runtime/common/table/avlroogcptr.cpp @@ -1,4 +1,4 @@ -/* $Id: avlroogcptr.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlroogcptr.cpp $ */ /** @file * IPRT - AVL tree, RTGCPTR, range, unique keys, overlapping ranges, offset pointers. */ diff --git a/src/VBox/Runtime/common/table/avlruintptr.cpp b/src/VBox/Runtime/common/table/avlruintptr.cpp index de8399259..0529865d6 100644 --- a/src/VBox/Runtime/common/table/avlruintptr.cpp +++ b/src/VBox/Runtime/common/table/avlruintptr.cpp @@ -1,4 +1,4 @@ -/* $Id: avlruintptr.cpp 19559 2009-05-10 04:36:23Z vboxsync $ */ +/* $Id: avlruintptr.cpp $ */ /** @file * IPRT - AVL tree, RTUINTPTR, range, unique keys. */ diff --git a/src/VBox/Runtime/common/table/avlu32.cpp b/src/VBox/Runtime/common/table/avlu32.cpp index 890774bd7..425387155 100644 --- a/src/VBox/Runtime/common/table/avlu32.cpp +++ b/src/VBox/Runtime/common/table/avlu32.cpp @@ -1,4 +1,4 @@ -/* $Id: avlu32.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlu32.cpp $ */ /** @file * IPRT - AVL tree, uint32_t, unique keys. */ diff --git a/src/VBox/Runtime/common/table/avluintptr.cpp b/src/VBox/Runtime/common/table/avluintptr.cpp index e0fc6078d..efae5ff56 100644 --- a/src/VBox/Runtime/common/table/avluintptr.cpp +++ b/src/VBox/Runtime/common/table/avluintptr.cpp @@ -1,4 +1,4 @@ -/* $Id: avluintptr.cpp 20740 2009-06-21 02:09:28Z vboxsync $ */ +/* $Id: avluintptr.cpp $ */ /** @file * IPRT - AVL tree, RTUINTPTR, unique keys. */ diff --git a/src/VBox/Runtime/common/table/avlul.cpp b/src/VBox/Runtime/common/table/avlul.cpp index ce5a17f04..13e908a1d 100644 --- a/src/VBox/Runtime/common/table/avlul.cpp +++ b/src/VBox/Runtime/common/table/avlul.cpp @@ -1,4 +1,4 @@ -/* $Id: avlul.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: avlul.cpp $ */ /** @file * IPRT - AVL tree, unsigned long, unique keys. */ diff --git a/src/VBox/Runtime/common/table/table.cpp b/src/VBox/Runtime/common/table/table.cpp index 9efde85d5..a09953f93 100644 --- a/src/VBox/Runtime/common/table/table.cpp +++ b/src/VBox/Runtime/common/table/table.cpp @@ -1,4 +1,4 @@ -/* $Id: table.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: table.cpp $ */ /** @file * IPRT - AVL tree, RTHCPHYS, unique keys. */ diff --git a/src/VBox/Runtime/common/time/time.cpp b/src/VBox/Runtime/common/time/time.cpp index 2d9f74a00..fa783c634 100644 --- a/src/VBox/Runtime/common/time/time.cpp +++ b/src/VBox/Runtime/common/time/time.cpp @@ -1,4 +1,4 @@ -/* $Id: time.cpp 19546 2009-05-08 20:39:07Z vboxsync $ */ +/* $Id: time.cpp $ */ /** @file * IPRT - Time. */ diff --git a/src/VBox/Runtime/common/time/timeprog.cpp b/src/VBox/Runtime/common/time/timeprog.cpp index 9af9aa45c..15108867e 100644 --- a/src/VBox/Runtime/common/time/timeprog.cpp +++ b/src/VBox/Runtime/common/time/timeprog.cpp @@ -1,4 +1,4 @@ -/* $Id: timeprog.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: timeprog.cpp $ */ /** @file * IPRT - Time Relative to Program Start. */ diff --git a/src/VBox/Runtime/common/time/timesup.cpp b/src/VBox/Runtime/common/time/timesup.cpp index 7358f4731..c0722fbf6 100644 --- a/src/VBox/Runtime/common/time/timesup.cpp +++ b/src/VBox/Runtime/common/time/timesup.cpp @@ -1,4 +1,4 @@ -/* $Id: timesup.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: timesup.cpp $ */ /** @file * IPRT - Time using SUPLib. */ diff --git a/src/VBox/Runtime/common/time/timesupA.asm b/src/VBox/Runtime/common/time/timesupA.asm index 4f268a4c9..c92f84b28 100644 --- a/src/VBox/Runtime/common/time/timesupA.asm +++ b/src/VBox/Runtime/common/time/timesupA.asm @@ -1,4 +1,4 @@ -; $Id: timesupA.asm 13832 2008-11-05 02:01:12Z vboxsync $ +; $Id: timesupA.asm $ ;; @file ; IPRT - Time using SUPLib, the Assembly Implementation. ; diff --git a/src/VBox/Runtime/common/time/timesupA.mac b/src/VBox/Runtime/common/time/timesupA.mac index 32f08a888..ab268557c 100644 --- a/src/VBox/Runtime/common/time/timesupA.mac +++ b/src/VBox/Runtime/common/time/timesupA.mac @@ -1,4 +1,4 @@ -; $Id: timesupA.mac 8272 2008-04-22 11:18:25Z vboxsync $ +; $Id: timesupA.mac $ ;; @file ; IPRT - Time using SUPLib, the Assembly Code Template. ; diff --git a/src/VBox/Runtime/common/time/timesupref.cpp b/src/VBox/Runtime/common/time/timesupref.cpp index cfb55289e..d11d92be5 100644 --- a/src/VBox/Runtime/common/time/timesupref.cpp +++ b/src/VBox/Runtime/common/time/timesupref.cpp @@ -1,4 +1,4 @@ -/* $Id: timesupref.cpp 13832 2008-11-05 02:01:12Z vboxsync $ */ +/* $Id: timesupref.cpp $ */ /** @file * IPRT - Time using SUPLib, the C Implementation. */ diff --git a/src/VBox/Runtime/common/time/timesupref.h b/src/VBox/Runtime/common/time/timesupref.h index 6d2182015..e745a2727 100644 --- a/src/VBox/Runtime/common/time/timesupref.h +++ b/src/VBox/Runtime/common/time/timesupref.h @@ -1,4 +1,4 @@ -/* $Id: timesupref.h 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: timesupref.h $ */ /** @file * IPRT - Time using SUPLib, the C Code Template. */ diff --git a/src/VBox/Runtime/common/time/timesysalias.cpp b/src/VBox/Runtime/common/time/timesysalias.cpp index 87491e912..e101cea51 100644 --- a/src/VBox/Runtime/common/time/timesysalias.cpp +++ b/src/VBox/Runtime/common/time/timesysalias.cpp @@ -1,4 +1,4 @@ -/* $Id: timesysalias.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: timesysalias.cpp $ */ /** @file * IPRT - Time using RTTimeSystem*. */ diff --git a/src/VBox/Runtime/darwin/RTErrConvertFromDarwin.cpp b/src/VBox/Runtime/darwin/RTErrConvertFromDarwin.cpp index 99ecfda9a..3c03ab868 100644 --- a/src/VBox/Runtime/darwin/RTErrConvertFromDarwin.cpp +++ b/src/VBox/Runtime/darwin/RTErrConvertFromDarwin.cpp @@ -1,4 +1,4 @@ -/* $Id: RTErrConvertFromDarwin.cpp 10136 2008-07-03 04:09:28Z vboxsync $ */ +/* $Id: RTErrConvertFromDarwin.cpp $ */ /** @file * IPRT - Convert Darwin Mach returns codes to iprt status codes. */ diff --git a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinCOM.cpp b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinCOM.cpp index 1e19ee3e0..5cb0d4609 100644 --- a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinCOM.cpp +++ b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinCOM.cpp @@ -1,4 +1,4 @@ -/* $Id: RTErrConvertFromDarwinCOM.cpp 15459 2008-12-14 11:23:14Z vboxsync $ */ +/* $Id: RTErrConvertFromDarwinCOM.cpp $ */ /** @file * IPRT - Convert Darwin COM returns codes to iprt status codes. */ diff --git a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinIO.cpp b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinIO.cpp index a302d91c4..00c5d4694 100644 --- a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinIO.cpp +++ b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinIO.cpp @@ -1,4 +1,4 @@ -/* $Id: RTErrConvertFromDarwinIO.cpp 15459 2008-12-14 11:23:14Z vboxsync $ */ +/* $Id: RTErrConvertFromDarwinIO.cpp $ */ /** @file * IPRT - Convert Darwin IOKit returns codes to iprt status codes. */ diff --git a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp index fcfcce262..b93b92807 100644 --- a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp +++ b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp @@ -1,4 +1,4 @@ -/* $Id: RTErrConvertFromDarwinKern.cpp 15459 2008-12-14 11:23:14Z vboxsync $ */ +/* $Id: RTErrConvertFromDarwinKern.cpp $ */ /** @file * IPRT - Convert Darwin Mach returns codes to iprt status codes. */ diff --git a/src/VBox/Runtime/gc/initterm-gc.cpp b/src/VBox/Runtime/gc/initterm-gc.cpp index 6731f571f..591a38f54 100644 --- a/src/VBox/Runtime/gc/initterm-gc.cpp +++ b/src/VBox/Runtime/gc/initterm-gc.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm-gc.cpp 13813 2008-11-04 21:55:34Z vboxsync $ */ +/* $Id: initterm-gc.cpp $ */ /** @file * IPRT - Init Raw-mode Context. */ diff --git a/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp b/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp index a2ac412f1..5f09f18f2 100644 --- a/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp +++ b/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTAssertShouldPanic-generic.cpp 13319 2008-10-16 08:23:23Z vboxsync $ */ +/* $Id: RTAssertShouldPanic-generic.cpp $ */ /** @file * IPRT - Assertions, generic RTAssertShouldPanic. */ diff --git a/src/VBox/Runtime/generic/RTDirCreateTemp-generic.cpp b/src/VBox/Runtime/generic/RTDirCreateTemp-generic.cpp index 353a72167..33a3e94ab 100644 --- a/src/VBox/Runtime/generic/RTDirCreateTemp-generic.cpp +++ b/src/VBox/Runtime/generic/RTDirCreateTemp-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTDirCreateTemp-generic.cpp 20111 2009-05-28 00:34:52Z vboxsync $ */ +/* $Id: RTDirCreateTemp-generic.cpp $ */ /** @file * IPRT - RTDirCreateTemp, generic implementation. */ diff --git a/src/VBox/Runtime/generic/RTDirQueryInfo-generic.cpp b/src/VBox/Runtime/generic/RTDirQueryInfo-generic.cpp index 9538472ce..d36b2c2e3 100644 --- a/src/VBox/Runtime/generic/RTDirQueryInfo-generic.cpp +++ b/src/VBox/Runtime/generic/RTDirQueryInfo-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTDirQueryInfo-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTDirQueryInfo-generic.cpp $ */ /** @file * IPRT - RTDirQueryInfo, generic implementation. */ diff --git a/src/VBox/Runtime/generic/RTDirSetTimes-generic.cpp b/src/VBox/Runtime/generic/RTDirSetTimes-generic.cpp index 5b1610307..8030fa1b2 100644 --- a/src/VBox/Runtime/generic/RTDirSetTimes-generic.cpp +++ b/src/VBox/Runtime/generic/RTDirSetTimes-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTDirSetTimes-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTDirSetTimes-generic.cpp $ */ /** @file * IPRT - RTDirSetTimes, generic implementation. */ diff --git a/src/VBox/Runtime/generic/RTFileCopy-generic.cpp b/src/VBox/Runtime/generic/RTFileCopy-generic.cpp index a065045b5..598511398 100644 --- a/src/VBox/Runtime/generic/RTFileCopy-generic.cpp +++ b/src/VBox/Runtime/generic/RTFileCopy-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTFileCopy-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTFileCopy-generic.cpp $ */ /** @file * IPRT - RTFileCopy, generic implementation. */ diff --git a/src/VBox/Runtime/generic/RTFileMove-generic.cpp b/src/VBox/Runtime/generic/RTFileMove-generic.cpp index e154d17d1..ff26f811f 100644 --- a/src/VBox/Runtime/generic/RTFileMove-generic.cpp +++ b/src/VBox/Runtime/generic/RTFileMove-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTFileMove-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTFileMove-generic.cpp $ */ /** @file * IPRT - RTFileMove, Generic. */ diff --git a/src/VBox/Runtime/generic/RTFileReadAll-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAll-generic.cpp index 0fa6480af..f801c32ea 100644 --- a/src/VBox/Runtime/generic/RTFileReadAll-generic.cpp +++ b/src/VBox/Runtime/generic/RTFileReadAll-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTFileReadAll-generic.cpp 18805 2009-04-07 11:38:27Z vboxsync $ */ +/* $Id: RTFileReadAll-generic.cpp $ */ /** @file * IPRT - RTFileReadAll, generic implementation. */ diff --git a/src/VBox/Runtime/generic/RTFileReadAllByHandle-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAllByHandle-generic.cpp index e8cae0460..43f21423c 100644 --- a/src/VBox/Runtime/generic/RTFileReadAllByHandle-generic.cpp +++ b/src/VBox/Runtime/generic/RTFileReadAllByHandle-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTFileReadAllByHandle-generic.cpp 8925 2008-05-19 16:59:11Z vboxsync $ */ +/* $Id: RTFileReadAllByHandle-generic.cpp $ */ /** @file * IPRT - RTFileReadAllByHandle, generic implementation. */ diff --git a/src/VBox/Runtime/generic/RTFileReadAllByHandleEx-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAllByHandleEx-generic.cpp index 9e7e199db..401946e93 100644 --- a/src/VBox/Runtime/generic/RTFileReadAllByHandleEx-generic.cpp +++ b/src/VBox/Runtime/generic/RTFileReadAllByHandleEx-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTFileReadAllByHandleEx-generic.cpp 19350 2009-05-05 02:44:04Z vboxsync $ */ +/* $Id: RTFileReadAllByHandleEx-generic.cpp $ */ /** @file * IPRT - RTFileReadAllByHandleEx, generic implementation. */ diff --git a/src/VBox/Runtime/generic/RTFileReadAllEx-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAllEx-generic.cpp index 1669ba3be..8cbf7afc8 100644 --- a/src/VBox/Runtime/generic/RTFileReadAllEx-generic.cpp +++ b/src/VBox/Runtime/generic/RTFileReadAllEx-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTFileReadAllEx-generic.cpp 19350 2009-05-05 02:44:04Z vboxsync $ */ +/* $Id: RTFileReadAllEx-generic.cpp $ */ /** @file * IPRT - RTFileReadAllEx, generic implementation. */ diff --git a/src/VBox/Runtime/generic/RTFileReadAllFree-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAllFree-generic.cpp index acdb11ade..600910bf7 100644 --- a/src/VBox/Runtime/generic/RTFileReadAllFree-generic.cpp +++ b/src/VBox/Runtime/generic/RTFileReadAllFree-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTFileReadAllFree-generic.cpp 8925 2008-05-19 16:59:11Z vboxsync $ */ +/* $Id: RTFileReadAllFree-generic.cpp $ */ /** @file * IPRT - RTFileReadAllFree, generic implementation. */ diff --git a/src/VBox/Runtime/generic/RTLogDefaultInit-generic.cpp b/src/VBox/Runtime/generic/RTLogDefaultInit-generic.cpp index 83ea574ca..d9f91b1f9 100644 --- a/src/VBox/Runtime/generic/RTLogDefaultInit-generic.cpp +++ b/src/VBox/Runtime/generic/RTLogDefaultInit-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogDefaultInit-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogDefaultInit-generic.cpp $ */ /** @file * IPRT - Default Log Init, Generic Dummy. */ diff --git a/src/VBox/Runtime/generic/RTLogWriteDebugger-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteDebugger-generic.cpp index c1ddac49b..9db6e8fe7 100644 --- a/src/VBox/Runtime/generic/RTLogWriteDebugger-generic.cpp +++ b/src/VBox/Runtime/generic/RTLogWriteDebugger-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteDebugger-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteDebugger-generic.cpp $ */ /** @file * IPRT - Log To Debugger, Generic Dummy. */ diff --git a/src/VBox/Runtime/generic/RTLogWriteStdErr-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteStdErr-generic.cpp index 076ccaba9..dc4035591 100644 --- a/src/VBox/Runtime/generic/RTLogWriteStdErr-generic.cpp +++ b/src/VBox/Runtime/generic/RTLogWriteStdErr-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteStdErr-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteStdErr-generic.cpp $ */ /** @file * IPRT - Log To StdErr, Generic. */ diff --git a/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp index 7a1fef742..3e2e5af61 100644 --- a/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp +++ b/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteStdErr-stub-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteStdErr-stub-generic.cpp $ */ /** @file * IPRT - Log To StdErr, Generic Dummy. */ diff --git a/src/VBox/Runtime/generic/RTLogWriteStdOut-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteStdOut-generic.cpp index 2e06f3699..166a9ca9d 100644 --- a/src/VBox/Runtime/generic/RTLogWriteStdOut-generic.cpp +++ b/src/VBox/Runtime/generic/RTLogWriteStdOut-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteStdOut-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteStdOut-generic.cpp $ */ /** @file * IPRT - Log To StdOut, Generic. */ diff --git a/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp index 648ad81f2..d8ae088e7 100644 --- a/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp +++ b/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteStdOut-stub-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteStdOut-stub-generic.cpp $ */ /** @file * IPRT - Log To StdOut, Generic Dummy. */ diff --git a/src/VBox/Runtime/generic/RTLogWriteUser-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteUser-generic.cpp index 4e719c4ce..ed057b934 100644 --- a/src/VBox/Runtime/generic/RTLogWriteUser-generic.cpp +++ b/src/VBox/Runtime/generic/RTLogWriteUser-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteUser-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteUser-generic.cpp $ */ /** @file * IPRT - Log User Specific Output, Generic Dummy. */ diff --git a/src/VBox/Runtime/generic/RTMpCpuId-generic.cpp b/src/VBox/Runtime/generic/RTMpCpuId-generic.cpp index 580ec9ea9..b13a95f08 100644 --- a/src/VBox/Runtime/generic/RTMpCpuId-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpCpuId-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpCpuId-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTMpCpuId-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpCpuId. */ diff --git a/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp b/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp index 19bc0e910..c7e1d6c2b 100644 --- a/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpCpuIdFromSetIndex-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTMpCpuIdFromSetIndex-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpCpuIdFromSetIndex. */ diff --git a/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp b/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp index 4f2fe695a..05f36a3cd 100644 --- a/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpCpuIdToSetIndex-generic.cpp 13908 2008-11-06 11:53:47Z vboxsync $ */ +/* $Id: RTMpCpuIdToSetIndex-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpCpuIdToSetIndex. */ diff --git a/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp b/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp index a4c21fa75..56ccf7022 100644 --- a/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpGetCount-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTMpGetCount-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpGetCount. */ diff --git a/src/VBox/Runtime/generic/RTMpGetCurFrequency-generic.cpp b/src/VBox/Runtime/generic/RTMpGetCurFrequency-generic.cpp index a9c185c2a..1de4355d6 100644 --- a/src/VBox/Runtime/generic/RTMpGetCurFrequency-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpGetCurFrequency-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpGetCurFrequency-generic.cpp 10425 2008-07-09 14:08:23Z vboxsync $ */ +/* $Id: RTMpGetCurFrequency-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpGetCurFrequency. */ diff --git a/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp b/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp index 8f8b5d1b7..e805b6733 100644 --- a/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpGetMaxCpuId-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTMpGetMaxCpuId-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpGetMaxCpuId. */ diff --git a/src/VBox/Runtime/generic/RTMpGetMaxFrequency-generic.cpp b/src/VBox/Runtime/generic/RTMpGetMaxFrequency-generic.cpp index d83839834..c19a8b1f0 100644 --- a/src/VBox/Runtime/generic/RTMpGetMaxFrequency-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpGetMaxFrequency-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpGetMaxFrequency-generic.cpp 10425 2008-07-09 14:08:23Z vboxsync $ */ +/* $Id: RTMpGetMaxFrequency-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpGetMaxFrequency. */ diff --git a/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp b/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp index 9fa4e31a5..9f117adf2 100644 --- a/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpGetOnlineCount-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTMpGetOnlineCount-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpGetOnlineCount. */ diff --git a/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp b/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp index ba7e8f252..5bf698e58 100644 --- a/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpGetOnlineSet-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTMpGetOnlineSet-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpGetOnlineSet. */ diff --git a/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp b/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp index 85518f571..6ec549800 100644 --- a/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpGetSet-generic.cpp 9429 2008-06-05 15:22:37Z vboxsync $ */ +/* $Id: RTMpGetSet-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpGetSet. */ diff --git a/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp b/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp index 865171481..4e1a27cc1 100644 --- a/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpIsCpuOnline-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTMpIsCpuOnline-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpIsCpuOnline. */ diff --git a/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp b/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp index f33c29f5e..b20f435df 100644 --- a/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp +++ b/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpIsCpuPossible-generic.cpp 9429 2008-06-05 15:22:37Z vboxsync $ */ +/* $Id: RTMpIsCpuPossible-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Generic RTMpIsCpuPossible. */ diff --git a/src/VBox/Runtime/generic/RTProcIsRunningByName-generic.cpp b/src/VBox/Runtime/generic/RTProcIsRunningByName-generic.cpp index a6bf61141..0bc26f036 100644 --- a/src/VBox/Runtime/generic/RTProcIsRunningByName-generic.cpp +++ b/src/VBox/Runtime/generic/RTProcIsRunningByName-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTProcIsRunningByName-generic.cpp 17011 2009-02-23 12:27:38Z vboxsync $ */ +/* $Id: RTProcIsRunningByName-generic.cpp $ */ /** @file * IPRT - RTProcIsRunningByName, generic stub. */ diff --git a/src/VBox/Runtime/generic/RTRandAdvCreateSystemFaster-generic.cpp b/src/VBox/Runtime/generic/RTRandAdvCreateSystemFaster-generic.cpp index d8c312457..9e59998a0 100644 --- a/src/VBox/Runtime/generic/RTRandAdvCreateSystemFaster-generic.cpp +++ b/src/VBox/Runtime/generic/RTRandAdvCreateSystemFaster-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTRandAdvCreateSystemFaster-generic.cpp 13908 2008-11-06 11:53:47Z vboxsync $ */ +/* $Id: RTRandAdvCreateSystemFaster-generic.cpp $ */ /** @file * IPRT - Random Numbers, generic RTRandAdvCreateSystemFaster. */ diff --git a/src/VBox/Runtime/generic/RTRandAdvCreateSystemTruer-generic.cpp b/src/VBox/Runtime/generic/RTRandAdvCreateSystemTruer-generic.cpp index 66977ce90..fa641a06c 100644 --- a/src/VBox/Runtime/generic/RTRandAdvCreateSystemTruer-generic.cpp +++ b/src/VBox/Runtime/generic/RTRandAdvCreateSystemTruer-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTRandAdvCreateSystemTruer-generic.cpp 13908 2008-11-06 11:53:47Z vboxsync $ */ +/* $Id: RTRandAdvCreateSystemTruer-generic.cpp $ */ /** @file * IPRT - Random Numbers, generic RTRandAdvCreateSystemTruer. */ diff --git a/src/VBox/Runtime/generic/RTSystemQueryOSInfo-generic.cpp b/src/VBox/Runtime/generic/RTSystemQueryOSInfo-generic.cpp index a195ac653..62edce543 100644 --- a/src/VBox/Runtime/generic/RTSystemQueryOSInfo-generic.cpp +++ b/src/VBox/Runtime/generic/RTSystemQueryOSInfo-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTSystemQueryOSInfo-generic.cpp 11350 2008-08-12 11:25:18Z vboxsync $ */ +/* $Id: RTSystemQueryOSInfo-generic.cpp $ */ /** @file * IPRT - RTSystemQueryOSInfo, generic stub. */ diff --git a/src/VBox/Runtime/generic/RTTimeLocalDeltaNano-generic.cpp b/src/VBox/Runtime/generic/RTTimeLocalDeltaNano-generic.cpp index bd5ec04e2..d63ce4da1 100644 --- a/src/VBox/Runtime/generic/RTTimeLocalDeltaNano-generic.cpp +++ b/src/VBox/Runtime/generic/RTTimeLocalDeltaNano-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTTimeLocalDeltaNano-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTTimeLocalDeltaNano-generic.cpp $ */ /** @file * IPRT - Time, generic RTTimeLocalDeltaNano. */ diff --git a/src/VBox/Runtime/generic/RTTimeLocalExplode-generic.cpp b/src/VBox/Runtime/generic/RTTimeLocalExplode-generic.cpp index cc5a0ed6b..93f528123 100644 --- a/src/VBox/Runtime/generic/RTTimeLocalExplode-generic.cpp +++ b/src/VBox/Runtime/generic/RTTimeLocalExplode-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: $ */ +/* $Id: $ */ /** @file * IPRT - Time, generic RTTimeLocalExplode. */ diff --git a/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp b/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp index 14cd236f1..2cd63ab49 100644 --- a/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp +++ b/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp @@ -1,4 +1,4 @@ -/** $Id: RTTimerCreate-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/** $Id: RTTimerCreate-generic.cpp $ */ /** @file * IPRT - Timers, Generic RTTimerCreate() Implementation. */ diff --git a/src/VBox/Runtime/generic/RTTimerLRCreate-generic.cpp b/src/VBox/Runtime/generic/RTTimerLRCreate-generic.cpp index 5cc97983a..31bb9bd28 100644 --- a/src/VBox/Runtime/generic/RTTimerLRCreate-generic.cpp +++ b/src/VBox/Runtime/generic/RTTimerLRCreate-generic.cpp @@ -1,4 +1,4 @@ -/** $Id: RTTimerLRCreate-generic.cpp 10944 2008-07-29 18:08:58Z vboxsync $ */ +/** $Id: RTTimerLRCreate-generic.cpp $ */ /** @file * IPRT - Low Resolution Timers, Generic RTTimerLRCreate() Implementation. */ diff --git a/src/VBox/Runtime/generic/RTUuidCreate-generic.cpp b/src/VBox/Runtime/generic/RTUuidCreate-generic.cpp index 4d44333c3..4cf60a4f1 100644 --- a/src/VBox/Runtime/generic/RTUuidCreate-generic.cpp +++ b/src/VBox/Runtime/generic/RTUuidCreate-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTUuidCreate-generic.cpp 11413 2008-08-14 08:03:03Z vboxsync $ */ +/* $Id: RTUuidCreate-generic.cpp $ */ /** @file * IPRT - UUID, Generic RTUuidCreate implementation. */ diff --git a/src/VBox/Runtime/generic/critsect-generic.cpp b/src/VBox/Runtime/generic/critsect-generic.cpp index 5cda13370..1c3a09648 100644 --- a/src/VBox/Runtime/generic/critsect-generic.cpp +++ b/src/VBox/Runtime/generic/critsect-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: critsect-generic.cpp 20008 2009-05-25 18:34:43Z vboxsync $ */ +/* $Id: critsect-generic.cpp $ */ /** @file * IPRT - Critical Section, Generic. */ diff --git a/src/VBox/Runtime/generic/env-generic.cpp b/src/VBox/Runtime/generic/env-generic.cpp index 9c1e3ed28..9963cde69 100644 --- a/src/VBox/Runtime/generic/env-generic.cpp +++ b/src/VBox/Runtime/generic/env-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: env-generic.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: env-generic.cpp $ */ /** @file * IPRT - Environment, Generic. */ diff --git a/src/VBox/Runtime/generic/fs-stubs-generic.cpp b/src/VBox/Runtime/generic/fs-stubs-generic.cpp index fcc0fdca6..468d3f67f 100644 --- a/src/VBox/Runtime/generic/fs-stubs-generic.cpp +++ b/src/VBox/Runtime/generic/fs-stubs-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: fs-stubs-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: fs-stubs-generic.cpp $ */ /** @file * IPRT - File System, Generic Stubs. */ diff --git a/src/VBox/Runtime/generic/mempool-generic.cpp b/src/VBox/Runtime/generic/mempool-generic.cpp index 054725ab6..810555e3d 100644 --- a/src/VBox/Runtime/generic/mempool-generic.cpp +++ b/src/VBox/Runtime/generic/mempool-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: mempool-generic.cpp 20575 2009-06-15 01:52:07Z vboxsync $ */ +/* $Id: mempool-generic.cpp $ */ /** @file * IPRT - Memory Allocation Pool. */ diff --git a/src/VBox/Runtime/generic/mppresent-generic.cpp b/src/VBox/Runtime/generic/mppresent-generic.cpp index fb5992b70..6dad88b00 100644 --- a/src/VBox/Runtime/generic/mppresent-generic.cpp +++ b/src/VBox/Runtime/generic/mppresent-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: mppresent-generic.cpp 12104 2008-09-04 19:33:44Z vboxsync $ */ +/* $Id: mppresent-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Stubs for the RTMp*Present* API. */ diff --git a/src/VBox/Runtime/generic/pathhost-generic.cpp b/src/VBox/Runtime/generic/pathhost-generic.cpp index 5ac72c125..52e4efd16 100644 --- a/src/VBox/Runtime/generic/pathhost-generic.cpp +++ b/src/VBox/Runtime/generic/pathhost-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: pathhost-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: pathhost-generic.cpp $ */ /** @file * IPRT - Path Convertions, generic. */ diff --git a/src/VBox/Runtime/generic/sched-generic.cpp b/src/VBox/Runtime/generic/sched-generic.cpp index cd8158b99..f1842e600 100644 --- a/src/VBox/Runtime/generic/sched-generic.cpp +++ b/src/VBox/Runtime/generic/sched-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: sched-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: sched-generic.cpp $ */ /** @file * IPRT - Scheduling, generic stubs. */ diff --git a/src/VBox/Runtime/generic/semfastmutex-generic.cpp b/src/VBox/Runtime/generic/semfastmutex-generic.cpp index 556334db0..e7a7448f3 100644 --- a/src/VBox/Runtime/generic/semfastmutex-generic.cpp +++ b/src/VBox/Runtime/generic/semfastmutex-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: semfastmutex-generic.cpp $ */ /** @file * IPRT - Fast Mutex, Generic. */ diff --git a/src/VBox/Runtime/generic/semnoint-generic.cpp b/src/VBox/Runtime/generic/semnoint-generic.cpp index a4b34e597..a908f3efc 100644 --- a/src/VBox/Runtime/generic/semnoint-generic.cpp +++ b/src/VBox/Runtime/generic/semnoint-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: semnoint-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: semnoint-generic.cpp $ */ /** @file * IPRT - Generic Non-Interruptable Wait and Request Functions. */ diff --git a/src/VBox/Runtime/generic/semrw-generic.cpp b/src/VBox/Runtime/generic/semrw-generic.cpp index 5ad2bfed0..be056c034 100644 --- a/src/VBox/Runtime/generic/semrw-generic.cpp +++ b/src/VBox/Runtime/generic/semrw-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: semrw-generic.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: semrw-generic.cpp $ */ /** @file * Excerpt from kProfileR3.cpp. */ diff --git a/src/VBox/Runtime/generic/semsrw-generic.cpp b/src/VBox/Runtime/generic/semsrw-generic.cpp index fab201f61..88cf34295 100644 --- a/src/VBox/Runtime/generic/semsrw-generic.cpp +++ b/src/VBox/Runtime/generic/semsrw-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: semsrw-generic.cpp 20603 2009-06-15 19:14:51Z vboxsync $ */ +/* $Id: semsrw-generic.cpp $ */ /** @file * IPRT - Read-Write Semaphore, Generic. * diff --git a/src/VBox/Runtime/generic/spinlock-generic.cpp b/src/VBox/Runtime/generic/spinlock-generic.cpp index c80a65821..1515c6187 100644 --- a/src/VBox/Runtime/generic/spinlock-generic.cpp +++ b/src/VBox/Runtime/generic/spinlock-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: spinlock-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: spinlock-generic.cpp $ */ /** @file * IPRT - Spinlock, generic implementation. */ diff --git a/src/VBox/Runtime/generic/strcache-stubs-generic.cpp b/src/VBox/Runtime/generic/strcache-stubs-generic.cpp index 1cf8a32d1..1b83ef2ab 100644 --- a/src/VBox/Runtime/generic/strcache-stubs-generic.cpp +++ b/src/VBox/Runtime/generic/strcache-stubs-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: strcache-stubs-generic.cpp 20647 2009-06-16 21:58:09Z vboxsync $ */ +/* $Id: strcache-stubs-generic.cpp $ */ /** @file * IPRT - String Cache, stub implementation. */ diff --git a/src/VBox/Runtime/generic/timer-generic.cpp b/src/VBox/Runtime/generic/timer-generic.cpp index 0a8f64043..66144af5f 100644 --- a/src/VBox/Runtime/generic/timer-generic.cpp +++ b/src/VBox/Runtime/generic/timer-generic.cpp @@ -1,4 +1,4 @@ -/** $Id: timer-generic.cpp 14298 2008-11-18 12:47:26Z vboxsync $ */ +/** $Id: timer-generic.cpp $ */ /** @file * IPRT - Timers, Generic. */ diff --git a/src/VBox/Runtime/generic/timerlr-generic.cpp b/src/VBox/Runtime/generic/timerlr-generic.cpp index 2d0273163..d7037d73e 100644 --- a/src/VBox/Runtime/generic/timerlr-generic.cpp +++ b/src/VBox/Runtime/generic/timerlr-generic.cpp @@ -1,4 +1,4 @@ -/** $Id: timerlr-generic.cpp 14298 2008-11-18 12:47:26Z vboxsync $ */ +/** $Id: timerlr-generic.cpp $ */ /** @file * IPRT - Low Resolution Timers, Generic. * @@ -254,7 +254,8 @@ static DECLCALLBACK(int) rtTimerLRThread(RTTHREAD hThread, void *pvUser) } else { - const uint64_t u64NanoTS = RTTimeNanoTS(); + uint64_t cNanoSeconds; + const uint64_t u64NanoTS = RTTimeNanoTS(); if (u64NanoTS >= pThis->u64NextTS) { pThis->iTick++; @@ -272,28 +273,40 @@ static DECLCALLBACK(int) rtTimerLRThread(RTTHREAD hThread, void *pvUser) continue; } - /* calc the next time we should fire. */ + /* + * Calc the next time we should fire. + * + * If we're more than 60 intervals behind, just skip ahead. We + * don't want the timer thread running wild just because the + * clock changed in an unexpected way. As seen in #3611 this + * does happen during suspend/resume, but it may also happen + * if we're using a non-monotonic clock as time source. + */ pThis->u64NextTS = pThis->u64StartTS + pThis->iTick * pThis->u64NanoInterval; - if (pThis->u64NextTS < u64NanoTS) -#ifdef IN_RING3 /* In ring-3 we'll catch up lost ticks immediately. */ - pThis->u64NextTS = u64NanoTS + 1; + if (RT_LIKELY(pThis->u64NextTS > u64NanoTS)) + cNanoSeconds = pThis->u64NextTS - u64NanoTS; + else + { + uint64_t iActualTick = (u64NanoTS - pThis->u64StartTS) / pThis->u64NanoInterval; + if (iActualTick - pThis->iTick > 60) + pThis->iTick = iActualTick - 1; +#ifdef IN_RING0 + cNanoSeconds = RTTimerGetSystemGranularity() / 2; #else - pThis->u64NextTS = u64NanoTS + RTTimerGetSystemGranularity() / 2; + cNanoSeconds = 1000000; /* 1ms */ #endif + pThis->u64NextTS = u64NanoTS + cNanoSeconds; + } } + else + cNanoSeconds = pThis->u64NextTS - u64NanoTS; /* block. */ - uint64_t cNanoSeconds = pThis->u64NextTS - u64NanoTS; -#ifdef IN_RING3 /* In ring-3 we'll catch up lost ticks immediately. */ - if (cNanoSeconds > 10) -#endif + int rc = RTSemEventWait(pThis->hEvent, cNanoSeconds < 1000000 ? 1 : cNanoSeconds / 1000000); + if (RT_FAILURE(rc) && rc != VERR_INTERRUPTED && rc != VERR_TIMEOUT) { - int rc = RTSemEventWait(pThis->hEvent, cNanoSeconds < 1000000 ? 1 : cNanoSeconds / 1000000); - if (RT_FAILURE(rc) && rc != VERR_INTERRUPTED && rc != VERR_TIMEOUT) - { - AssertRC(rc); - RTThreadSleep(1000); /* Don't cause trouble! */ - } + AssertRC(rc); + RTThreadSleep(1000); /* Don't cause trouble! */ } } } diff --git a/src/VBox/Runtime/generic/tls-generic.cpp b/src/VBox/Runtime/generic/tls-generic.cpp index 213c4fa3a..dad23bcea 100644 --- a/src/VBox/Runtime/generic/tls-generic.cpp +++ b/src/VBox/Runtime/generic/tls-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: tls-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: tls-generic.cpp $ */ /** @file * IPRT - Thread Local Storage (TSL), Generic Implementation. */ diff --git a/src/VBox/Runtime/generic/utf16locale-generic.cpp b/src/VBox/Runtime/generic/utf16locale-generic.cpp index 98b037f21..15ba03a55 100644 --- a/src/VBox/Runtime/generic/utf16locale-generic.cpp +++ b/src/VBox/Runtime/generic/utf16locale-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: utf16locale-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: utf16locale-generic.cpp $ */ /** @file * IPRT - UTF-16 Locale Specific Manipulation, Generic. */ diff --git a/src/VBox/Runtime/generic/uuid-generic.cpp b/src/VBox/Runtime/generic/uuid-generic.cpp index f6bfe1e53..310b81ae7 100644 --- a/src/VBox/Runtime/generic/uuid-generic.cpp +++ b/src/VBox/Runtime/generic/uuid-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: uuid-generic.cpp 19198 2009-04-27 09:25:37Z vboxsync $ */ +/* $Id: uuid-generic.cpp $ */ /** @file * IPRT - UUID, Generic. */ diff --git a/src/VBox/Runtime/include/internal/alignmentchecks.h b/src/VBox/Runtime/include/internal/alignmentchecks.h index 0afce27e6..1b3391f3d 100644 --- a/src/VBox/Runtime/include/internal/alignmentchecks.h +++ b/src/VBox/Runtime/include/internal/alignmentchecks.h @@ -1,4 +1,4 @@ -/* $Id: alignmentchecks.h 20911 2009-06-24 23:46:10Z vboxsync $ */ +/* $Id: alignmentchecks.h $ */ /** @file * IPRT - Internal header for hacking alignment checks on x86 and AMD64. */ diff --git a/src/VBox/Runtime/include/internal/dbgmod.h b/src/VBox/Runtime/include/internal/dbgmod.h index 27b886655..cb92e9ea3 100644 --- a/src/VBox/Runtime/include/internal/dbgmod.h +++ b/src/VBox/Runtime/include/internal/dbgmod.h @@ -1,4 +1,4 @@ -/* $Id: dbgmod.h 21046 2009-06-30 01:11:28Z vboxsync $ */ +/* $Id: dbgmod.h $ */ /** @file * IPRT - Internal Header for RTDbgMod and the associated interpreters. */ diff --git a/src/VBox/Runtime/include/internal/dir.h b/src/VBox/Runtime/include/internal/dir.h index c53696ec8..0d9c3449d 100644 --- a/src/VBox/Runtime/include/internal/dir.h +++ b/src/VBox/Runtime/include/internal/dir.h @@ -1,4 +1,4 @@ -/* $Id: dir.h 14059 2008-11-10 23:05:44Z vboxsync $ */ +/* $Id: dir.h $ */ /** @file * IPRT - Internal Header for RTDir. */ diff --git a/src/VBox/Runtime/include/internal/file.h b/src/VBox/Runtime/include/internal/file.h index f4ca12843..ef4f46919 100644 --- a/src/VBox/Runtime/include/internal/file.h +++ b/src/VBox/Runtime/include/internal/file.h @@ -1,4 +1,4 @@ -/* $Id: file.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: file.h $ */ /** @file * IPRT - Internal RTFile header. */ diff --git a/src/VBox/Runtime/include/internal/fileaio.h b/src/VBox/Runtime/include/internal/fileaio.h index a70b251e6..c9909c954 100644 --- a/src/VBox/Runtime/include/internal/fileaio.h +++ b/src/VBox/Runtime/include/internal/fileaio.h @@ -1,4 +1,4 @@ -/* $Id: fileaio.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: fileaio.h $ */ /** @file * IPRT - Internal RTFileAio header. */ diff --git a/src/VBox/Runtime/include/internal/fs.h b/src/VBox/Runtime/include/internal/fs.h index 2ee4e2358..f91d36b96 100644 --- a/src/VBox/Runtime/include/internal/fs.h +++ b/src/VBox/Runtime/include/internal/fs.h @@ -1,4 +1,4 @@ -/* $Id: fs.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: fs.h $ */ /** @file * IPRT - Internal RTFs header. */ diff --git a/src/VBox/Runtime/include/internal/initterm.h b/src/VBox/Runtime/include/internal/initterm.h index 9eaf9f221..9a9dbd3e3 100644 --- a/src/VBox/Runtime/include/internal/initterm.h +++ b/src/VBox/Runtime/include/internal/initterm.h @@ -1,4 +1,4 @@ -/* $Id: initterm.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: initterm.h $ */ /** @file * IPRT - Initialization & Termination. */ diff --git a/src/VBox/Runtime/include/internal/ldr.h b/src/VBox/Runtime/include/internal/ldr.h index aaba39f77..5b7c6b61c 100644 --- a/src/VBox/Runtime/include/internal/ldr.h +++ b/src/VBox/Runtime/include/internal/ldr.h @@ -1,4 +1,4 @@ -/* $Id: ldr.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: ldr.h $ */ /** @file * IPRT - Loader Internals. */ diff --git a/src/VBox/Runtime/include/internal/ldrMZ.h b/src/VBox/Runtime/include/internal/ldrMZ.h index 5e1b7a456..9ad8f2b58 100644 --- a/src/VBox/Runtime/include/internal/ldrMZ.h +++ b/src/VBox/Runtime/include/internal/ldrMZ.h @@ -1,4 +1,4 @@ -/* $Id: ldrMZ.h 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: ldrMZ.h $ */ /** @file * IPRT, MZ header. */ diff --git a/src/VBox/Runtime/include/internal/ldrPE.h b/src/VBox/Runtime/include/internal/ldrPE.h index df54e32e9..a48b16536 100644 --- a/src/VBox/Runtime/include/internal/ldrPE.h +++ b/src/VBox/Runtime/include/internal/ldrPE.h @@ -1,4 +1,4 @@ -/* $Id: ldrPE.h 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: ldrPE.h $ */ /** @file * IPRT - Windows NT PE Structures and Constants. */ diff --git a/src/VBox/Runtime/include/internal/magics.h b/src/VBox/Runtime/include/internal/magics.h index dee64fd3c..f5b09dce0 100644 --- a/src/VBox/Runtime/include/internal/magics.h +++ b/src/VBox/Runtime/include/internal/magics.h @@ -1,4 +1,4 @@ -/* $Id: magics.h 20360 2009-06-08 00:04:31Z vboxsync $ */ +/* $Id: magics.h $ */ /** @file * IPRT - Internal header defining The Magic Numbers. */ diff --git a/src/VBox/Runtime/include/internal/memobj.h b/src/VBox/Runtime/include/internal/memobj.h index 57e7db8c6..96ecd8d72 100644 --- a/src/VBox/Runtime/include/internal/memobj.h +++ b/src/VBox/Runtime/include/internal/memobj.h @@ -1,4 +1,4 @@ -/* $Revision: 20525 $ */ +/* $Revision: 48527 $ */ /** @file * IPRT - Ring-0 Memory Objects. */ diff --git a/src/VBox/Runtime/include/internal/path.h b/src/VBox/Runtime/include/internal/path.h index b40e7e461..00b688a3c 100644 --- a/src/VBox/Runtime/include/internal/path.h +++ b/src/VBox/Runtime/include/internal/path.h @@ -1,4 +1,4 @@ -/* $Id: path.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: path.h $ */ /** @file * IPRT - RTPath Internal header. */ diff --git a/src/VBox/Runtime/include/internal/process.h b/src/VBox/Runtime/include/internal/process.h index e4ca16ea7..231b45cb0 100644 --- a/src/VBox/Runtime/include/internal/process.h +++ b/src/VBox/Runtime/include/internal/process.h @@ -1,4 +1,4 @@ -/* $Id: process.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: process.h $ */ /** @file * IPRT - Internal RTProc header. */ diff --git a/src/VBox/Runtime/include/internal/rand.h b/src/VBox/Runtime/include/internal/rand.h index 935f6bf01..5c01e3e4b 100644 --- a/src/VBox/Runtime/include/internal/rand.h +++ b/src/VBox/Runtime/include/internal/rand.h @@ -1,4 +1,4 @@ -/* $Id: rand.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: rand.h $ */ /** @file * IPRT - Internal RTRand header */ diff --git a/src/VBox/Runtime/include/internal/sched.h b/src/VBox/Runtime/include/internal/sched.h index 818ceaa6d..3c90f6dfd 100644 --- a/src/VBox/Runtime/include/internal/sched.h +++ b/src/VBox/Runtime/include/internal/sched.h @@ -1,4 +1,4 @@ -/* $Id: sched.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: sched.h $ */ /** @file * IPRT - Internal RTSched header. */ diff --git a/src/VBox/Runtime/include/internal/strict.h b/src/VBox/Runtime/include/internal/strict.h index 3691e93e6..e12bcdd39 100644 --- a/src/VBox/Runtime/include/internal/strict.h +++ b/src/VBox/Runtime/include/internal/strict.h @@ -1,4 +1,4 @@ -/* $Id: strict.h 8651 2008-05-07 12:16:29Z vboxsync $ */ +/* $Id: strict.h $ */ /** @file * IPRT - Internal Header Defining Strictness Indicators. */ diff --git a/src/VBox/Runtime/include/internal/string.h b/src/VBox/Runtime/include/internal/string.h index 78eef164e..3cc5dda75 100644 --- a/src/VBox/Runtime/include/internal/string.h +++ b/src/VBox/Runtime/include/internal/string.h @@ -1,4 +1,4 @@ -/* $Id: string.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: string.h $ */ /** @file * IPRT - Internal RTStr header. */ diff --git a/src/VBox/Runtime/include/internal/thread.h b/src/VBox/Runtime/include/internal/thread.h index 10893ba9a..71e98c8a4 100644 --- a/src/VBox/Runtime/include/internal/thread.h +++ b/src/VBox/Runtime/include/internal/thread.h @@ -1,4 +1,4 @@ -/* $Id: thread.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: thread.h $ */ /** @file * IPRT - Internal RTThread header. */ diff --git a/src/VBox/Runtime/include/internal/time.h b/src/VBox/Runtime/include/internal/time.h index 80cf63794..f36b55bea 100644 --- a/src/VBox/Runtime/include/internal/time.h +++ b/src/VBox/Runtime/include/internal/time.h @@ -1,4 +1,4 @@ -/* $Id: time.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: time.h $ */ /** @file * IPRT - Internal RTTime header */ diff --git a/src/VBox/Runtime/nt/NtProcessStartup-stub.cpp b/src/VBox/Runtime/nt/NtProcessStartup-stub.cpp index 61173f257..dc2ae640b 100644 --- a/src/VBox/Runtime/nt/NtProcessStartup-stub.cpp +++ b/src/VBox/Runtime/nt/NtProcessStartup-stub.cpp @@ -1,4 +1,4 @@ -/* $Id: NtProcessStartup-stub.cpp 19931 2009-05-23 00:26:15Z vboxsync $ */ +/* $Id: NtProcessStartup-stub.cpp $ */ /** @file * IPRT - NtProcessStartup stub to make the link happy. */ diff --git a/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp b/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp index 9e3c253d8..401c4c87b 100644 --- a/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp +++ b/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp @@ -1,4 +1,4 @@ -/* $Id: RTErrConvertFromNtStatus.cpp 18323 2009-03-26 15:29:16Z vboxsync $ */ +/* $Id: RTErrConvertFromNtStatus.cpp $ */ /** @file * IPRT - Convert NT status codes to iprt status codes. */ diff --git a/src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp b/src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp index 484919c47..8bffb9ee9 100644 --- a/src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp +++ b/src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp @@ -1,4 +1,4 @@ -/* $Id: RTErrConvertFromOS2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTErrConvertFromOS2.cpp $ */ /** @file * IPRT - Convert OS/2 error codes to iprt status codes. */ diff --git a/src/VBox/Runtime/r0drv/alloc-r0drv.cpp b/src/VBox/Runtime/r0drv/alloc-r0drv.cpp index 7d6a36bfc..ad747c915 100644 --- a/src/VBox/Runtime/r0drv/alloc-r0drv.cpp +++ b/src/VBox/Runtime/r0drv/alloc-r0drv.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv.cpp 14743 2008-11-27 21:17:06Z vboxsync $ */ +/* $Id: alloc-r0drv.cpp $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver. */ diff --git a/src/VBox/Runtime/r0drv/alloc-r0drv.h b/src/VBox/Runtime/r0drv/alloc-r0drv.h index 49ff74864..c2b5126e7 100644 --- a/src/VBox/Runtime/r0drv/alloc-r0drv.h +++ b/src/VBox/Runtime/r0drv/alloc-r0drv.h @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: alloc-r0drv.h $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver. */ diff --git a/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp index c6a7af318..39569ede0 100644 --- a/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteDebugger-r0drv-darwin.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteDebugger-r0drv-darwin.cpp $ */ /** @file * IPRT - Log To Debugger, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp index eb768e739..4af33a943 100644 --- a/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteStdOut-r0drv-darwin.cpp 10608 2008-07-14 16:21:07Z vboxsync $ */ +/* $Id: RTLogWriteStdOut-r0drv-darwin.cpp $ */ /** @file * IPRT - Log To StdOut, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp index 38075ee40..4be5e2582 100644 --- a/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-darwin.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: alloc-r0drv-darwin.cpp $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp index 2293d6f61..c0184edcc 100644 --- a/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-darwin.cpp 14500 2008-11-24 02:22:08Z vboxsync $ */ +/* $Id: assert-r0drv-darwin.cpp $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp index 2db955c45..c0bc0f200 100644 --- a/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-darwin.cpp 19919 2009-05-22 17:02:55Z vboxsync $ */ +/* $Id: initterm-r0drv-darwin.cpp $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp index 15389556a..06399e76b 100644 --- a/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-darwin.cpp 20525 2009-06-13 20:13:33Z vboxsync $ */ +/* $Id: memobj-r0drv-darwin.cpp $ */ /** @file * IPRT - Ring-0 Memory Objects, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp index 4888c3413..502bee09c 100644 --- a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-darwin.cpp 19389 2009-05-05 17:12:48Z vboxsync $ */ +/* $Id: mp-r0drv-darwin.cpp $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp index 7f2b50022..26d7ad7e2 100644 --- a/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-darwin.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: process-r0drv-darwin.cpp $ */ /** @file * IPRT - Process, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/semaphore-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semaphore-r0drv-darwin.cpp index 47b3a45ca..d822a3778 100644 --- a/src/VBox/Runtime/r0drv/darwin/semaphore-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/semaphore-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: semaphore-r0drv-darwin.cpp 20355 2009-06-07 09:11:41Z vboxsync $ */ +/* $Id: semaphore-r0drv-darwin.cpp $ */ /** @file * IPRT - Semaphores, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp index 1f140a01a..6757ee45d 100644 --- a/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-darwin.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: spinlock-r0drv-darwin.cpp $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h b/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h index 0d62ddf75..d5f500c8c 100644 --- a/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h +++ b/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-darwin-kernel.h 20525 2009-06-13 20:13:33Z vboxsync $ */ +/* $Id: the-darwin-kernel.h $ */ /** @file * IPRT - Include all necessary headers for the Darwing kernel. */ diff --git a/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp index a15273fce..b15ea018d 100644 --- a/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-darwin.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: thread-r0drv-darwin.cpp $ */ /** @file * IPRT - Threads, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp index 1ffb77942..82c69651e 100644 --- a/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-darwin.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: thread2-r0drv-darwin.cpp $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp index 7064c390a..1579de224 100644 --- a/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: threadpreempt-r0drv-darwin.cpp 20124 2009-05-28 15:40:06Z vboxsync $ */ +/* $Id: threadpreempt-r0drv-darwin.cpp $ */ /** @file * IPRT - Thread Preemption, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp index c30549506..f0c98d48e 100644 --- a/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-darwin.cpp 16332 2009-01-28 20:27:46Z vboxsync $ */ +/* $Id: time-r0drv-darwin.cpp $ */ /** @file * IPRT - Time, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c index 36acb1278..c617efeb5 100644 --- a/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-freebsd.c 19761 2009-05-17 19:30:52Z vboxsync $ */ +/* $Id: alloc-r0drv-freebsd.c $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c index 8f20e1dbd..d8e01f4cc 100644 --- a/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-freebsd.c 18972 2009-04-16 23:43:08Z vboxsync $ */ +/* $Id: assert-r0drv-freebsd.c $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c index 901547c49..591b77973 100644 --- a/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-freebsd.c 18972 2009-04-16 23:43:08Z vboxsync $ */ +/* $Id: initterm-r0drv-freebsd.c $ */ /** @file * IPRT - Initialization & Termination, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c index 441e7b95c..6e5b796fe 100644 --- a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-freebsd.c 20525 2009-06-13 20:13:33Z vboxsync $ */ +/* $Id: memobj-r0drv-freebsd.c $ */ /** @file * IPRT - Ring-0 Memory Objects, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c index 20385ba81..040d0bdc9 100644 --- a/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-freebsd.c 19389 2009-05-05 17:12:48Z vboxsync $ */ +/* $Id: mp-r0drv-freebsd.c $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c index ac08c3e94..96af287aa 100644 --- a/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-freebsd.c 18972 2009-04-16 23:43:08Z vboxsync $ */ +/* $Id: process-r0drv-freebsd.c $ */ /** @file * IPRT - Process Management, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c index a007d38db..6b6f3d024 100644 --- a/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-freebsd.c 20448 2009-06-09 22:21:09Z vboxsync $ */ +/* $Id: semevent-r0drv-freebsd.c $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c index 1e8a6626d..5d8251b24 100644 --- a/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-freebsd.c 19565 2009-05-10 22:32:03Z vboxsync $ */ +/* $Id: semeventmulti-r0drv-freebsd.c $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c index 511325561..dba0eeb90 100644 --- a/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-freebsd.c 19565 2009-05-10 22:32:03Z vboxsync $ */ +/* $Id: semfastmutex-r0drv-freebsd.c $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c index 9848cb556..22c716e7e 100644 --- a/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-freebsd.c 19565 2009-05-10 22:32:03Z vboxsync $ */ +/* $Id: spinlock-r0drv-freebsd.c $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h b/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h index 578ae1e28..9dc08f615 100644 --- a/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h +++ b/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-freebsd-kernel.h 18918 2009-04-15 20:54:38Z vboxsync $ */ +/* $Id: the-freebsd-kernel.h $ */ /** @file * IPRT - Ring-0 Driver, The FreeBSD Kernel Headers. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c index 05a9d5262..35686190a 100644 --- a/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-freebsd.c 20554 2009-06-14 17:22:59Z vboxsync $ */ +/* $Id: thread-r0drv-freebsd.c $ */ /** @file * IPRT - Threads (Part 1), Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c index 6e736bb3d..2fb9276af 100644 --- a/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-freebsd.c 19341 2009-05-04 21:25:26Z vboxsync $ */ +/* $Id: thread2-r0drv-freebsd.c $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c index 3d1ff7e78..7f356a10c 100644 --- a/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-freebsd.c 18972 2009-04-16 23:43:08Z vboxsync $ */ +/* $Id: time-r0drv-freebsd.c $ */ /** @file * IPRT - Time, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c index 2ba296027..5573b3b40 100644 --- a/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: timer-r0drv-freebsd.c 18972 2009-04-16 23:43:08Z vboxsync $ */ +/* $Id: timer-r0drv-freebsd.c $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp index 1896c2bc4..9c6570012 100644 --- a/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpIsCpuWorkPending-r0drv-generic.cpp 15843 2009-01-07 18:35:24Z vboxsync $ */ +/* $Id: RTMpIsCpuWorkPending-r0drv-generic.cpp $ */ /** @file * IPRT - RTMpIsCpuWorkPending, Generic. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp index 7baec28f0..bd4f39ca6 100644 --- a/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpOn-r0drv-generic.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTMpOn-r0drv-generic.cpp $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Generic Stubs. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp index 1c924581f..6eecdcd54 100644 --- a/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpPokeCpu-r0drv-generic.cpp 19389 2009-05-05 17:12:48Z vboxsync $ */ +/* $Id: RTMpPokeCpu-r0drv-generic.cpp $ */ /** @file * IPRT - RTMpPokeCpu, Generic Implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp index daaec9619..2b98f8f97 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptDisable-r0drv-generic.cpp 13254 2008-10-14 12:35:50Z vboxsync $ */ +/* $Id: RTThreadPreemptDisable-r0drv-generic.cpp $ */ /** @file * IPRT - RTThreadPreemptDisable, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp index 4449e055c..0dce5464b 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptIsEnabled-r0drv-generic.cpp 13254 2008-10-14 12:35:50Z vboxsync $ */ +/* $Id: RTThreadPreemptIsEnabled-r0drv-generic.cpp $ */ /** @file * IPRT - RTThreadPreemptIsEnabled, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp index d4d527825..944ed7145 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptIsPending-r0drv-generic.cpp 19918 2009-05-22 17:00:28Z vboxsync $ */ +/* $Id: RTThreadPreemptIsPending-r0drv-generic.cpp $ */ /** @file * IPRT - RTThreadPreemptIsPending, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp index 1fbe7e28a..ec1d7d540 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp 20124 2009-05-28 15:40:06Z vboxsync $ */ +/* $Id: RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp $ */ /** @file * IPRT - RTThreadPreemptIsPendingTrusty, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp index 9edc35d82..d02196769 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptRestore-r0drv-generic.cpp 13275 2008-10-15 08:48:31Z vboxsync $ */ +/* $Id: RTThreadPreemptRestore-r0drv-generic.cpp $ */ /** @file * IPRT - RTThreadPreemptRestore, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp index 1ccd55b93..7060b8510 100644 --- a/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv-generic.cpp 9619 2008-06-11 15:02:41Z vboxsync $ */ +/* $Id: mpnotification-r0drv-generic.cpp $ */ /** @file * IPRT - Multiprocessor Notifications, Ring-0 Driver, Generic Stubs. */ diff --git a/src/VBox/Runtime/r0drv/initterm-r0drv.cpp b/src/VBox/Runtime/r0drv/initterm-r0drv.cpp index 1a6cb7ab6..0e25a72c0 100644 --- a/src/VBox/Runtime/r0drv/initterm-r0drv.cpp +++ b/src/VBox/Runtime/r0drv/initterm-r0drv.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv.cpp 20909 2009-06-24 23:01:08Z vboxsync $ */ +/* $Id: initterm-r0drv.cpp $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, Common. */ diff --git a/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c index 61b64a297..1c988774e 100644 --- a/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteDebugger-r0drv-linux.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteDebugger-r0drv-linux.c $ */ /** @file * IPRT - Log To Debugger, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c index f1c50e121..a71ce6059 100644 --- a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-linux.c 13665 2008-10-29 17:42:51Z vboxsync $ */ +/* $Id: alloc-r0drv-linux.c $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c index 0f36f7e15..61d674168 100644 --- a/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-linux.c 13512 2008-10-23 07:21:59Z vboxsync $ */ +/* $Id: assert-r0drv-linux.c $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c index 7a8a6109b..c3b0b4d8b 100644 --- a/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-linux.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: initterm-r0drv-linux.c $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c index fbf0c44aa..93644756b 100644 --- a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Revision: 20525 $ */ +/* $Revision: 48527 $ */ /** @file * IPRT - Ring-0 Memory Objects, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c index bd3695561..d723bd258 100644 --- a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-linux.c 19389 2009-05-05 17:12:48Z vboxsync $ */ +/* $Id: mp-r0drv-linux.c $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c index 3e4ee4fdf..dfe740aa9 100644 --- a/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv-linux.c 12029 2008-09-03 12:15:34Z vboxsync $ */ +/* $Id: mpnotification-r0drv-linux.c $ */ /** @file * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c index 09c892efe..d33496a79 100644 --- a/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-linux.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: process-r0drv-linux.c $ */ /** @file * IPRT - Process, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c index 40fe2610d..bcf4b8637 100644 --- a/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-linux.c 19888 2009-05-21 15:25:42Z vboxsync $ */ +/* $Id: semevent-r0drv-linux.c $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c index d8c3fd085..480205aa1 100644 --- a/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-linux.c 19886 2009-05-21 15:19:38Z vboxsync $ */ +/* $Id: semeventmulti-r0drv-linux.c $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c index f1981c5f9..0dcd2fee1 100644 --- a/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-linux.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: semfastmutex-r0drv-linux.c $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c index e85393a21..268ca5fa6 100644 --- a/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: semmutex-r0drv-linux.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: semmutex-r0drv-linux.c $ */ /** @file * IPRT - Mutex Semaphores, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c index fd7503a26..e43f76d8b 100644 --- a/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-linux.c 13770 2008-11-03 19:18:27Z vboxsync $ */ +/* $Id: spinlock-r0drv-linux.c $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/string.h b/src/VBox/Runtime/r0drv/linux/string.h index eeda0210c..4c8dabec5 100644 --- a/src/VBox/Runtime/r0drv/linux/string.h +++ b/src/VBox/Runtime/r0drv/linux/string.h @@ -1,4 +1,4 @@ -/* $Id: string.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: string.h $ */ /** @file * IPRT - wrapper for the linux kernel asm/string.h. */ diff --git a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h index b6ea5f23f..8d15808b4 100644 --- a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h +++ b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-linux-kernel.h 15851 2009-01-08 10:30:27Z vboxsync $ */ +/* $Id: the-linux-kernel.h $ */ /** @file * IPRT - Include all necessary headers for the Linux kernel. */ diff --git a/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c index 8d328df83..2a9f02ce4 100644 --- a/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-linux.c 20124 2009-05-28 15:40:06Z vboxsync $ */ +/* $Id: thread-r0drv-linux.c $ */ /** @file * IPRT - Threads, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c index 0d4f4c24d..4fcad6b29 100644 --- a/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-linux.c 19937 2009-05-23 12:43:34Z vboxsync $ */ +/* $Id: thread2-r0drv-linux.c $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c index 3ccaa3725..d9d58d8aa 100644 --- a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-linux.c 9369 2008-06-03 22:30:19Z vboxsync $ */ +/* $Id: time-r0drv-linux.c $ */ /** @file * IPRT - Time, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c index 141ac21a5..8bc7ffaf4 100644 --- a/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: timer-r0drv-linux.c 14318 2008-11-18 16:56:53Z vboxsync $ */ +/* $Id: timer-r0drv-linux.c $ */ /** @file * IPRT - Timers, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/memobj-r0drv.cpp b/src/VBox/Runtime/r0drv/memobj-r0drv.cpp index f87bd8aa5..004ae4cb5 100644 --- a/src/VBox/Runtime/r0drv/memobj-r0drv.cpp +++ b/src/VBox/Runtime/r0drv/memobj-r0drv.cpp @@ -1,4 +1,4 @@ -/* $Revision: 20525 $ */ +/* $Revision: 48527 $ */ /** @file * IPRT - Ring-0 Memory Objects, Common Code. */ diff --git a/src/VBox/Runtime/r0drv/mp-r0drv.h b/src/VBox/Runtime/r0drv/mp-r0drv.h index 1097f7306..dcc93cc52 100644 --- a/src/VBox/Runtime/r0drv/mp-r0drv.h +++ b/src/VBox/Runtime/r0drv/mp-r0drv.h @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: mp-r0drv.h $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Internal Header. */ diff --git a/src/VBox/Runtime/r0drv/mpnotification-r0drv.c b/src/VBox/Runtime/r0drv/mpnotification-r0drv.c index f581edc13..1db075fc3 100644 --- a/src/VBox/Runtime/r0drv/mpnotification-r0drv.c +++ b/src/VBox/Runtime/r0drv/mpnotification-r0drv.c @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv.c 12292 2008-09-09 13:16:16Z vboxsync $ */ +/* $Id: mpnotification-r0drv.c $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Event Notifications. */ diff --git a/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp index fd14b021a..fa7748210 100644 --- a/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteDebugger-r0drv-nt.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteDebugger-r0drv-nt.cpp $ */ /** @file * IPRT - Log To Debugger, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp index 765ef0e95..850c9e00d 100644 --- a/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-nt.cpp 14069 2008-11-10 23:39:34Z vboxsync $ */ +/* $Id: alloc-r0drv-nt.cpp $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp index 57a5813f9..880b31d46 100644 --- a/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-nt.cpp 11917 2008-09-01 12:55:38Z vboxsync $ */ +/* $Id: assert-r0drv-nt.cpp $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp index b00d58ee2..4a07367aa 100644 --- a/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-nt.cpp 19990 2009-05-25 10:40:06Z vboxsync $ */ +/* $Id: initterm-r0drv-nt.cpp $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h b/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h index 96f578862..38733cbbf 100644 --- a/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h +++ b/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h @@ -1,4 +1,4 @@ -/* $Id: internal-r0drv-nt.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: internal-r0drv-nt.h $ */ /** @file * IPRT - Internal Header for the NT Ring-0 Driver Code. */ diff --git a/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp index f28597357..e81b352cf 100644 --- a/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-nt.cpp 20525 2009-06-13 20:13:33Z vboxsync $ */ +/* $Id: memobj-r0drv-nt.cpp $ */ /** @file * IPRT - Ring-0 Memory Objects, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp index 8a2599351..db3f5274c 100644 --- a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-nt.cpp 19911 2009-05-22 12:46:46Z vboxsync $ */ +/* $Id: mp-r0drv-nt.cpp $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp index 935f91d28..6b1ded3d4 100644 --- a/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv-nt.cpp 11982 2008-09-02 13:09:44Z vboxsync $ */ +/* $Id: mpnotification-r0drv-nt.cpp $ */ /** @file * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp index 2de16ddf6..92540ca4c 100644 --- a/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-nt.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: process-r0drv-nt.cpp $ */ /** @file * IPRT - Process, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp index 542c581dc..cf990da45 100644 --- a/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-nt.cpp 20929 2009-06-25 11:54:56Z vboxsync $ */ +/* $Id: semevent-r0drv-nt.cpp $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp index 0d7ac9281..93e94a455 100644 --- a/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-nt.cpp 20923 2009-06-25 11:21:35Z vboxsync $ */ +/* $Id: semeventmulti-r0drv-nt.cpp $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp index 803cedd49..05f00c3ba 100644 --- a/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-nt.cpp 12160 2008-09-05 23:23:14Z vboxsync $ */ +/* $Id: semfastmutex-r0drv-nt.cpp $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp index 5d2f8b06a..46449c703 100644 --- a/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: semmutex-r0drv-nt.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: semmutex-r0drv-nt.cpp $ */ /** @file * IPRT - Mutex Semaphores, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp index 47a7ca3ac..eb7851b51 100644 --- a/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-nt.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: spinlock-r0drv-nt.cpp $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h b/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h index 988831ad4..f57cf879d 100644 --- a/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h +++ b/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-nt-kernel.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: the-nt-kernel.h $ */ /** @file * IPRT - Include all necessary headers for the NT kernel. */ diff --git a/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp index 3e4420d23..52e16cc65 100644 --- a/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-nt.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: thread-r0drv-nt.cpp $ */ /** @file * IPRT - Threads, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp index f5c92fc12..994399df0 100644 --- a/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-nt.cpp 19711 2009-05-14 21:24:28Z vboxsync $ */ +/* $Id: thread2-r0drv-nt.cpp $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp index d6259d23d..17ff2c364 100644 --- a/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-nt.cpp 9958 2008-06-26 14:25:49Z vboxsync $ */ +/* $Id: time-r0drv-nt.cpp $ */ /** @file * IPRT - Time, Ring-0 Driver, Nt. */ diff --git a/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp index 99a834d95..22fb3c5c4 100644 --- a/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: timer-r0drv-nt.cpp 18988 2009-04-17 13:00:59Z vboxsync $ */ +/* $Id: timer-r0drv-nt.cpp $ */ /** @file * IPRT - Timers, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm b/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm index dedefeb81..17e370520 100644 --- a/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm +++ b/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm @@ -1,4 +1,4 @@ -; $Id: RTR0AssertPanicSystem-r0drv-os2.asm 13306 2008-10-15 21:17:04Z vboxsync $ +; $Id: RTR0AssertPanicSystem-r0drv-os2.asm $ ;; @file ; IPRT - RTR0AssertPanicSystem, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm index 2ad429f45..e0c94b7f2 100644 --- a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm +++ b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm @@ -1,4 +1,4 @@ -; $Id: RTR0Os2DHQueryDOSVar.asm 8256 2008-04-21 20:53:28Z vboxsync $ +; $Id: RTR0Os2DHQueryDOSVar.asm $ ;; @file ; IPRT - DevHelp_GetDOSVar, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm index 82e221123..e1b44d42b 100644 --- a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm +++ b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm @@ -1,4 +1,4 @@ -; $Id: RTR0Os2DHVMGlobalToProcess.asm 8256 2008-04-21 20:53:28Z vboxsync $ +; $Id: RTR0Os2DHVMGlobalToProcess.asm $ ;; @file ; IPRT - DevHelp_VMGlobalToProcess, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp index 4602890a6..e33b3af08 100644 --- a/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: alloc-r0drv-os2.cpp $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp index 33c222ee7..1bf907d49 100644 --- a/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: assert-r0drv-os2.cpp $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm b/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm index 4da5eea74..0e0808aab 100644 --- a/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm +++ b/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm @@ -1,4 +1,4 @@ -; $Id: assertA-r0drv-os2.asm 8256 2008-04-21 20:53:28Z vboxsync $ +; $Id: assertA-r0drv-os2.asm $ ;; @file ; IPRT - DevHelp_GetDOSVar, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp index 55d491a93..9a1872a81 100644 --- a/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: initterm-r0drv-os2.cpp $ */ /** @file * IPRT - Initialization & Termination, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp index 6874f1abd..019e1933a 100644 --- a/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-os2.cpp 20525 2009-06-13 20:13:33Z vboxsync $ */ +/* $Id: memobj-r0drv-os2.cpp $ */ /** @file * IPRT - Ring-0 Memory Objects, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp index eac1e4624..a05d0617e 100644 --- a/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: process-r0drv-os2.cpp $ */ /** @file * IPRT - Process Management, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp index cb326e452..8e31e33c7 100644 --- a/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: semevent-r0drv-os2.cpp $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp index 29063eac3..2e2842f5a 100644 --- a/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: semeventmulti-r0drv-os2.cpp $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp index e8d33cfef..523007cf4 100644 --- a/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: semfastmutex-r0drv-os2.cpp $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp index d2b7b5fc2..e239f766a 100644 --- a/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: spinlock-r0drv-os2.cpp $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h b/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h index f08bd11bf..2057b50bb 100644 --- a/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h +++ b/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-os2-kernel.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: the-os2-kernel.h $ */ /** @file * IPRT - Ring-0 Driver, The OS/2 Kernel Headers. */ diff --git a/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp index 00d32374b..1ad25cdd5 100644 --- a/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-os2.cpp 20124 2009-05-28 15:40:06Z vboxsync $ */ +/* $Id: thread-r0drv-os2.cpp $ */ /** @file * IPRT - Threads (Part 1), Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp index e13d305f8..77f4cbc56 100644 --- a/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: thread2-r0drv-os2.cpp $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, Generic Stubs. */ diff --git a/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp index ab4bf1b9a..778ee2b0a 100644 --- a/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: time-r0drv-os2.cpp $ */ /** @file * IPRT - Time, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp index 2f20b6b0a..bdb9f5818 100644 --- a/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: timer-r0drv-os2.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: timer-r0drv-os2.cpp $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm b/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm index 788bcc907..474f85767 100644 --- a/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm +++ b/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm @@ -1,4 +1,4 @@ -; $Id: timerA-r0drv-os2.asm 8256 2008-04-21 20:53:28Z vboxsync $ +; $Id: timerA-r0drv-os2.asm $ ;; @file ; IPRT - DevHelp_VMGlobalToProcess, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/power-r0drv.h b/src/VBox/Runtime/r0drv/power-r0drv.h index 261b585b7..7f24bb507 100644 --- a/src/VBox/Runtime/r0drv/power-r0drv.h +++ b/src/VBox/Runtime/r0drv/power-r0drv.h @@ -1,4 +1,4 @@ -/* $Id: power-r0drv.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: power-r0drv.h $ */ /** @file * IPRT - Power Management, Ring-0 Driver, Internal Header. */ diff --git a/src/VBox/Runtime/r0drv/powernotification-r0drv.c b/src/VBox/Runtime/r0drv/powernotification-r0drv.c index 85fe3f69e..fdd4f1812 100644 --- a/src/VBox/Runtime/r0drv/powernotification-r0drv.c +++ b/src/VBox/Runtime/r0drv/powernotification-r0drv.c @@ -1,4 +1,4 @@ -/* $Id: powernotification-r0drv.c 13908 2008-11-06 11:53:47Z vboxsync $ */ +/* $Id: powernotification-r0drv.c $ */ /** @file * IPRT - Power Management, Ring-0 Driver, Event Notifications. */ diff --git a/src/VBox/Runtime/r0drv/solaris/RTMpPokeCpu-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/RTMpPokeCpu-r0drv-solaris.c index 34ec13772..869e0e2d5 100644 --- a/src/VBox/Runtime/r0drv/solaris/RTMpPokeCpu-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/RTMpPokeCpu-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: RTMpPokeCpu-r0drv-solaris.c 19501 2009-05-07 18:30:22Z vboxsync $ */ +/* $Id: RTMpPokeCpu-r0drv-solaris.c $ */ /** @file * IPRT - RTMpPokeCpu, Solaris Implementation. */ diff --git a/src/VBox/Runtime/r0drv/solaris/alloc-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/alloc-r0drv-solaris.c index 046e8d235..df0fae836 100644 --- a/src/VBox/Runtime/r0drv/solaris/alloc-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/alloc-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-solaris.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: alloc-r0drv-solaris.c $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c index b927cd633..5665e3736 100644 --- a/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-solaris.c 13314 2008-10-15 22:46:08Z vboxsync $ */ +/* $Id: assert-r0drv-solaris.c $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c index c6d905e42..279a8e5e5 100644 --- a/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-solaris.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: initterm-r0drv-solaris.c $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c index d436df3bc..a73bc53f5 100644 --- a/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-solaris.c 20525 2009-06-13 20:13:33Z vboxsync $ */ +/* $Id: memobj-r0drv-solaris.c $ */ /** @file * IPRT - Ring-0 Memory Objects, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c index bc2b20d55..70b53b157 100644 --- a/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-solaris.c 19391 2009-05-05 17:26:18Z vboxsync $ */ +/* $Id: mp-r0drv-solaris.c $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c index 4d7d1ecc9..37e38e8ba 100644 --- a/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv-solaris.c 11982 2008-09-02 13:09:44Z vboxsync $ */ +/* $Id: mpnotification-r0drv-solaris.c $ */ /** @file * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/process-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/process-r0drv-solaris.c index 40665046e..f5dfefd8a 100644 --- a/src/VBox/Runtime/r0drv/solaris/process-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/process-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-solaris.c 19338 2009-05-04 16:48:14Z vboxsync $ */ +/* $Id: process-r0drv-solaris.c $ */ /** @file * IPRT - Process Management, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c index fe6b82c45..dcd76a497 100644 --- a/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-solaris.c 20793 2009-06-22 17:05:03Z vboxsync $ */ +/* $Id: semevent-r0drv-solaris.c $ */ /** @file * IPRT - Semaphores, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c index 15c1ac7f2..d3020d940 100644 --- a/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-solaris.c 20793 2009-06-22 17:05:03Z vboxsync $ */ +/* $Id: semeventmulti-r0drv-solaris.c $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c index dc1bf69cc..07f6b26b9 100644 --- a/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-solaris.c 16200 2009-01-23 15:26:36Z vboxsync $ */ +/* $Id: semfastmutex-r0drv-solaris.c $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c index 041d1d308..c56f990d7 100644 --- a/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-solaris.c 20793 2009-06-22 17:05:03Z vboxsync $ */ +/* $Id: spinlock-r0drv-solaris.c $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h b/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h index 3146eaf96..2a3bfd4cc 100644 --- a/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h +++ b/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-solaris-kernel.h 20793 2009-06-22 17:05:03Z vboxsync $ */ +/* $Id: the-solaris-kernel.h $ */ /** @file * IPRT - Include all necessary headers for the Solaris kernel. */ diff --git a/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c index 90992f228..bd7b6aa3d 100644 --- a/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-solaris.c 20124 2009-05-28 15:40:06Z vboxsync $ */ +/* $Id: thread-r0drv-solaris.c $ */ /** @file * IPRT - Threads, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c index 64b0ea536..734ce7c1d 100644 --- a/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-solaris.c 19355 2009-05-05 08:59:24Z vboxsync $ */ +/* $Id: thread2-r0drv-solaris.c $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c index c7c0a5214..073a500fc 100644 --- a/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-solaris.c 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: time-r0drv-solaris.c $ */ /** @file * IPRT - Time, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c index 98c300434..7491b9079 100644 --- a/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c @@ -1,4 +1,4 @@ -/** $Id: timer-r0drv-solaris.c 9557 2008-06-09 18:19:26Z vboxsync $ */ +/** $Id: timer-r0drv-solaris.c $ */ /** @file * IPRT - Timer, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/32/vbi b/src/VBox/Runtime/r0drv/solaris/vbi/32/vbi Binary files differindex a6b73d730..9e1e3ed41 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/32/vbi +++ b/src/VBox/Runtime/r0drv/solaris/vbi/32/vbi diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/64/vbi b/src/VBox/Runtime/r0drv/solaris/vbi/64/vbi Binary files differindex 139af63b7..00eedd954 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/64/vbi +++ b/src/VBox/Runtime/r0drv/solaris/vbi/64/vbi diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c index f7a0e7290..d9a8be30a 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: RTMpPokeCpu-r0drv-solaris.c 19501 2009-05-07 18:30:22Z vboxsync $ */ +/* $Id: RTMpPokeCpu-r0drv-solaris.c $ */ /** @file * IPRT - RTMpPokeCpu, Solaris Implementation. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c index c36a3a1cd..72dc4f8a7 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-solaris.c 9149 2008-05-27 09:27:29Z vboxsync $ */ +/* $Id: alloc-r0drv-solaris.c $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c index c8a77230d..36f53bda8 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c @@ -55,6 +55,7 @@ #include <sys/sunddi.h> #include <sys/modctl.h> #include <sys/machparam.h> +#include <sys/utsname.h> #include "vbi.h" @@ -110,7 +111,7 @@ typedef struct vbi_cpuset { * module linkage stuff */ static struct modlmisc vbi_modlmisc = { - &mod_miscops, "VirtualBox Interfaces V5" + &mod_miscops, "VirtualBox Interfaces V6" }; static struct modlinkage vbi_modlinkage = { @@ -124,6 +125,68 @@ static int vbi_verbose = 0; #define VBI_VERBOSE(msg) {if (vbi_verbose) cmn_err(CE_WARN, msg);} +/* Introduced in v6 */ +static int vbi_is_nevada = 0; + +#ifdef _LP64 +/* 64-bit Solaris 10 offsets */ +/* CPU */ +static int off_s10_cpu_runrun = 232; +static int off_s10_cpu_kprunrun = 233; +/* kthread_t */ +static int off_s10_t_preempt = 42; + +/* 64-bit Solaris 11 (Nevada/OpenSolaris) offsets */ +/* CPU */ +static int off_s11_cpu_runrun = 216; +static int off_s11_cpu_kprunrun = 217; +/* kthread_t */ +static int off_s11_t_preempt = 42; +#else +/* 32-bit Solaris 10 offsets */ +/* CPU */ +static int off_s10_cpu_runrun = 124; +static int off_s10_cpu_kprunrun = 125; +/* kthread_t */ +static int off_s10_t_preempt = 26; + +/* 32-bit Solaris 11 (Nevada/OpenSolaris) offsets */ +/* CPU */ +static int off_s11_cpu_runrun = 112; +static int off_s11_cpu_kprunrun = 113; +/* kthread_t */ +static int off_s11_t_preempt = 26; +#endif + + +/* Which offsets will be used */ +static int off_cpu_runrun = -1; +static int off_cpu_kprunrun = -1; +static int off_t_preempt = -1; + +#define VBI_T_PREEMPT (*((char *)curthread + off_t_preempt)) +#define VBI_CPU_KPRUNRUN (*((char *)CPU + off_cpu_kprunrun)) +#define VBI_CPU_RUNRUN (*((char *)CPU + off_cpu_runrun)) + +#undef kpreempt_disable +#undef kpreempt_enable + +#define VBI_PREEMPT_DISABLE() \ + { \ + VBI_T_PREEMPT++; \ + ASSERT(VBI_T_PREEMPT >= 1); \ + } +#define VBI_PREEMPT_ENABLE() \ + { \ + ASSERT(VBI_T_PREEMPT >= 1); \ + if (--VBI_T_PREEMPT == 0 && \ + VBI_CPU_RUNRUN) \ + kpreempt(KPREEMPT_SYNC); \ + } + +/* End of v6 intro */ + + int _init(void) { @@ -160,6 +223,49 @@ _init(void) } } + /* + * Check if this is S10 or Nevada + */ + if (!strncmp(utsname.release, "5.11", sizeof("5.11") - 1)) + { + /* Nevada detected... */ + vbi_is_nevada = 1; + + off_cpu_runrun = off_s11_cpu_runrun; + off_cpu_kprunrun = off_s11_cpu_kprunrun; + off_t_preempt = off_s11_t_preempt; + } + else + { + /* Solaris 10 detected... */ + vbi_is_nevada = 0; + + off_cpu_runrun = off_s10_cpu_runrun; + off_cpu_kprunrun = off_s10_cpu_kprunrun; + off_t_preempt = off_s10_t_preempt; + } + + /* + * Sanity checking... + */ + /* CPU */ + char crr = VBI_CPU_RUNRUN; + char krr = VBI_CPU_KPRUNRUN; + if ( (crr < 0 || crr > 1) + || (krr < 0 || krr > 1)) + { + cmn_err(CE_NOTE, ":CPU structure sanity check failed! OS version mismatch.\n"); + return EINVAL; + } + + /* Thread */ + char t_preempt = VBI_T_PREEMPT; + if (t_preempt < 0 || t_preempt > 32) + { + cmn_err(CE_NOTE, ":Thread structure sanity check failed! OS version mismatch.\n"); + return EINVAL; + } + err = mod_install(&vbi_modlinkage); if (err != 0) return (err); @@ -286,10 +392,14 @@ vbi_yield(void) { int rv = 0; - kpreempt_disable(); - if (curthread->t_preempt == 1 && CPU->cpu_kprunrun) + vbi_preempt_disable(); + + char tpr = VBI_T_PREEMPT; + char kpr = VBI_CPU_KPRUNRUN; + if (tpr == 1 && kpr) rv = 1; - kpreempt_enable(); + + vbi_preempt_enable(); return (rv); } @@ -473,13 +583,13 @@ vbi_cpu_online(int c) void vbi_preempt_disable(void) { - kpreempt_disable(); + VBI_PREEMPT_DISABLE(); } void vbi_preempt_enable(void) { - kpreempt_enable(); + VBI_PREEMPT_ENABLE(); } void @@ -1068,7 +1178,8 @@ vbi_gtimer_end(vbi_gtimer_t *t) int vbi_is_preempt_enabled(void) { - return (curthread->t_preempt == 0); + char tpr = VBI_T_PREEMPT; + return (tpr == 0); } void @@ -1083,7 +1194,7 @@ vbi_poke_cpu(int c) * they should go after this point in the file and the revision level * increased. Also change vbi_modlmisc at the top of the file. */ -uint_t vbi_revision_level = 5; +uint_t vbi_revision_level = 6; void * vbi_lowmem_alloc(uint64_t phys, size_t size) @@ -1096,3 +1207,16 @@ vbi_lowmem_free(void *va, size_t size) { p_contig_free(va, size); } + +/* + * This is revision 6 of the interface. + */ + +int +vbi_is_preempt_pending(void) +{ + char crr = VBI_CPU_RUNRUN; + char krr = VBI_CPU_KPRUNRUN; + return crr != 0 || krr != 0; +} + diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h index ba2f8803c..4620bd18d 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h +++ b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h @@ -330,6 +330,11 @@ extern void *vbi_lowmem_alloc(uint64_t phys, size_t size); extern void vbi_lowmem_free(void *va, size_t size); /* end of interfaces defined for version 5 */ +/* begin interfaces defined for version 6 */ +extern int vbi_is_preempt_pending(void); + +/* end of interfaces defined for version 6 */ + #ifdef __cplusplus } #endif diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c index 141bec589..90598bf70 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-solaris.c 20526 2009-06-13 20:18:20Z vboxsync $ */ +/* $Id: memobj-r0drv-solaris.c $ */ /** @file * IPRT - Ring-0 Memory Objects, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c index 2bb304df9..669465ae5 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-solaris.c 19391 2009-05-05 17:26:18Z vboxsync $ */ +/* $Id: mp-r0drv-solaris.c $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c index 5d81a3bb3..704570b60 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv-solaris.c 11982 2008-09-02 13:09:44Z vboxsync $ */ +/* $Id: mpnotification-r0drv-solaris.c $ */ /** @file * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c index 52ad88ce7..672f0763a 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-solaris.c 9149 2008-05-27 09:27:29Z vboxsync $ */ +/* $Id: process-r0drv-solaris.c $ */ /** @file * IPRT - Process Management, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/the-solaris-kernel.h b/src/VBox/Runtime/r0drv/solaris/vbi/the-solaris-kernel.h index 023e1268f..0cd447e75 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/the-solaris-kernel.h +++ b/src/VBox/Runtime/r0drv/solaris/vbi/the-solaris-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-solaris-kernel.h 9149 2008-05-27 09:27:29Z vboxsync $ */ +/* $Id: the-solaris-kernel.h $ */ /** @file * IPRT - Include all necessary headers for the Solaris kernel. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c index 2981e64fd..f0715992b 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-solaris.c 20124 2009-05-28 15:40:06Z vboxsync $ */ +/* $Id: thread-r0drv-solaris.c $ */ /** @file * IPRT - Threads, Ring-0 Driver, Solaris. */ @@ -107,8 +107,7 @@ RTDECL(bool) RTThreadPreemptIsPending(RTTHREAD hThread) { Assert(hThread == NIL_RTTHREAD); /** @todo Review this! */ - return CPU->cpu_runrun != 0 - || CPU->cpu_kprunrun != 0; + return !!vbi_is_preempt_pending(); } diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c index 333f19608..b401405bc 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-solaris.c 9149 2008-05-27 09:27:29Z vboxsync $ */ +/* $Id: thread2-r0drv-solaris.c $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c index 23c30e8da..1606f9243 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-solaris.c 9149 2008-05-27 09:27:29Z vboxsync $ */ +/* $Id: time-r0drv-solaris.c $ */ /** @file * IPRT - Time, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c index 71834af40..f89b52f22 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c @@ -1,4 +1,4 @@ -/** $Id: timer-r0drv-solaris.c 14318 2008-11-18 16:56:53Z vboxsync $ */ +/** $Id: timer-r0drv-solaris.c $ */ /** @file * IPRT - Timer, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r3/alloc-ef-cpp.cpp b/src/VBox/Runtime/r3/alloc-ef-cpp.cpp index bb8e0e667..481cc9ba5 100644 --- a/src/VBox/Runtime/r3/alloc-ef-cpp.cpp +++ b/src/VBox/Runtime/r3/alloc-ef-cpp.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-ef-cpp.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: alloc-ef-cpp.cpp $ */ /** @file * IPRT - Memory Allocation, C++ electric fence. */ diff --git a/src/VBox/Runtime/r3/alloc-ef.cpp b/src/VBox/Runtime/r3/alloc-ef.cpp index 760ee43b2..af115fcae 100644 --- a/src/VBox/Runtime/r3/alloc-ef.cpp +++ b/src/VBox/Runtime/r3/alloc-ef.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-ef.cpp 19547 2009-05-08 20:39:39Z vboxsync $ */ +/* $Id: alloc-ef.cpp $ */ /** @file * IPRT - Memory Allocation, electric fence. */ diff --git a/src/VBox/Runtime/r3/alloc-ef.h b/src/VBox/Runtime/r3/alloc-ef.h index fa0ff03b1..83e0d47c0 100644 --- a/src/VBox/Runtime/r3/alloc-ef.h +++ b/src/VBox/Runtime/r3/alloc-ef.h @@ -1,4 +1,4 @@ -/* $Id: alloc-ef.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: alloc-ef.h $ */ /** @file * IPRT - Memory Allocation, electric fence. */ diff --git a/src/VBox/Runtime/r3/alloc.cpp b/src/VBox/Runtime/r3/alloc.cpp index 43b48f4bb..40d85813f 100644 --- a/src/VBox/Runtime/r3/alloc.cpp +++ b/src/VBox/Runtime/r3/alloc.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc.cpp 11019 2008-07-30 22:47:04Z vboxsync $ */ +/* $Id: alloc.cpp $ */ /** @file * IPRT - Memory Allocation. */ diff --git a/src/VBox/Runtime/r3/darwin/alloc-darwin.cpp b/src/VBox/Runtime/r3/darwin/alloc-darwin.cpp index b3c691a64..3343146fa 100644 --- a/src/VBox/Runtime/r3/darwin/alloc-darwin.cpp +++ b/src/VBox/Runtime/r3/darwin/alloc-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-darwin.cpp 11019 2008-07-30 22:47:04Z vboxsync $ */ +/* $Id: alloc-darwin.cpp $ */ /** @file * IPRT - Memory Allocation, POSIX. */ diff --git a/src/VBox/Runtime/r3/darwin/filelock-darwin.cpp b/src/VBox/Runtime/r3/darwin/filelock-darwin.cpp index bfe5be0db..05ecbbd62 100644 --- a/src/VBox/Runtime/r3/darwin/filelock-darwin.cpp +++ b/src/VBox/Runtime/r3/darwin/filelock-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: filelock-darwin.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: filelock-darwin.cpp $ */ /** @file * IPRT - File Locking, POSIX. */ diff --git a/src/VBox/Runtime/r3/darwin/mp-darwin.cpp b/src/VBox/Runtime/r3/darwin/mp-darwin.cpp index fe083c4de..67e0a2a6b 100644 --- a/src/VBox/Runtime/r3/darwin/mp-darwin.cpp +++ b/src/VBox/Runtime/r3/darwin/mp-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-darwin.cpp 13836 2008-11-05 02:42:54Z vboxsync $ */ +/* $Id: mp-darwin.cpp $ */ /** @file * IPRT - Multiprocessor, Darwin. */ diff --git a/src/VBox/Runtime/r3/darwin/rtProcInitExePath-darwin.cpp b/src/VBox/Runtime/r3/darwin/rtProcInitExePath-darwin.cpp index f6259aade..9835384b9 100644 --- a/src/VBox/Runtime/r3/darwin/rtProcInitExePath-darwin.cpp +++ b/src/VBox/Runtime/r3/darwin/rtProcInitExePath-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: rtProcInitExePath-darwin.cpp 11838 2008-08-29 17:14:02Z vboxsync $ */ +/* $Id: rtProcInitExePath-darwin.cpp $ */ /** @file * IPRT - rtProcInitName, Darwin. */ diff --git a/src/VBox/Runtime/r3/darwin/sched-darwin.cpp b/src/VBox/Runtime/r3/darwin/sched-darwin.cpp index cf9275570..e48089642 100644 --- a/src/VBox/Runtime/r3/darwin/sched-darwin.cpp +++ b/src/VBox/Runtime/r3/darwin/sched-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: sched-darwin.cpp 15881 2009-01-08 18:46:52Z vboxsync $ */ +/* $Id: sched-darwin.cpp $ */ /** @file * IPRT - Scheduling, Darwin. */ diff --git a/src/VBox/Runtime/r3/darwin/time-darwin.cpp b/src/VBox/Runtime/r3/darwin/time-darwin.cpp index 3fab3ea6c..6fcfbb57c 100644 --- a/src/VBox/Runtime/r3/darwin/time-darwin.cpp +++ b/src/VBox/Runtime/r3/darwin/time-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: time-darwin.cpp 15870 2009-01-08 15:08:24Z vboxsync $ */ +/* $Id: time-darwin.cpp $ */ /** @file * IPRT - Time, Darwin. */ diff --git a/src/VBox/Runtime/r3/dir.cpp b/src/VBox/Runtime/r3/dir.cpp index 81644f080..893a6f4fb 100644 --- a/src/VBox/Runtime/r3/dir.cpp +++ b/src/VBox/Runtime/r3/dir.cpp @@ -1,4 +1,4 @@ -/* $Id: dir.cpp 19212 2009-04-27 13:56:45Z vboxsync $ */ +/* $Id: dir.cpp $ */ /** @file * IPRT - Directory Manipulation. */ diff --git a/src/VBox/Runtime/r3/fileio.cpp b/src/VBox/Runtime/r3/fileio.cpp index 99798c445..aeaed6df8 100644 --- a/src/VBox/Runtime/r3/fileio.cpp +++ b/src/VBox/Runtime/r3/fileio.cpp @@ -1,4 +1,4 @@ -/* $Id: fileio.cpp 8913 2008-05-19 11:34:46Z vboxsync $ */ +/* $Id: fileio.cpp $ */ /** @file * IPRT - File I/O. */ diff --git a/src/VBox/Runtime/r3/freebsd/alloc-freebsd.cpp b/src/VBox/Runtime/r3/freebsd/alloc-freebsd.cpp index 8409fce3e..aca20a43d 100644 --- a/src/VBox/Runtime/r3/freebsd/alloc-freebsd.cpp +++ b/src/VBox/Runtime/r3/freebsd/alloc-freebsd.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-freebsd.cpp 11020 2008-07-30 22:48:35Z vboxsync $ */ +/* $Id: alloc-freebsd.cpp $ */ /** @file * IPRT - Memory Allocation, POSIX. */ diff --git a/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp b/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp index 03e9170c7..8040b3e37 100644 --- a/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp +++ b/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp @@ -1,4 +1,4 @@ -/* $Id: fileaio-freebsd.cpp 19562 2009-05-10 21:44:16Z vboxsync $ */ +/* $Id: fileaio-freebsd.cpp $ */ /** @file * IPRT - File async I/O, native implementation for the FreeBSD host platform. */ diff --git a/src/VBox/Runtime/r3/freebsd/mp-freebsd.cpp b/src/VBox/Runtime/r3/freebsd/mp-freebsd.cpp index 7e413299c..3796f3926 100644 --- a/src/VBox/Runtime/r3/freebsd/mp-freebsd.cpp +++ b/src/VBox/Runtime/r3/freebsd/mp-freebsd.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-freebsd.cpp 20449 2009-06-09 22:23:42Z vboxsync $ */ +/* $Id: mp-freebsd.cpp $ */ /** @file * IPRT - Multiprocessor, FreeBSD. */ diff --git a/src/VBox/Runtime/r3/freebsd/rtProcInitExePath-freebsd.cpp b/src/VBox/Runtime/r3/freebsd/rtProcInitExePath-freebsd.cpp index 84eb0700f..602f284aa 100644 --- a/src/VBox/Runtime/r3/freebsd/rtProcInitExePath-freebsd.cpp +++ b/src/VBox/Runtime/r3/freebsd/rtProcInitExePath-freebsd.cpp @@ -1,4 +1,4 @@ -/* $Id: rtProcInitExePath-freebsd.cpp 16024 2009-01-19 04:45:55Z vboxsync $ */ +/* $Id: rtProcInitExePath-freebsd.cpp $ */ /** @file * IPRT - rtProcInitName, FreeBSD. */ diff --git a/src/VBox/Runtime/r3/fs.cpp b/src/VBox/Runtime/r3/fs.cpp index d26ae5f3e..74a9d64f1 100644 --- a/src/VBox/Runtime/r3/fs.cpp +++ b/src/VBox/Runtime/r3/fs.cpp @@ -1,4 +1,4 @@ -/* $Id: fs.cpp 19171 2009-04-24 15:35:54Z vboxsync $ */ +/* $Id: fs.cpp $ */ /** @file * IPRT - File System. */ diff --git a/src/VBox/Runtime/r3/init.cpp b/src/VBox/Runtime/r3/init.cpp index 4d5f88d65..e66f4f1c4 100644 --- a/src/VBox/Runtime/r3/init.cpp +++ b/src/VBox/Runtime/r3/init.cpp @@ -1,4 +1,4 @@ -/* $Id: init.cpp 20911 2009-06-24 23:46:10Z vboxsync $ */ +/* $Id: init.cpp $ */ /** @file * IPRT - Init Ring-3. */ diff --git a/src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp b/src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp index 2ab4cd69f..b0b2cd89a 100644 --- a/src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp +++ b/src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: RTProcIsRunningByName-linux.cpp 17018 2009-02-23 13:27:43Z vboxsync $ */ +/* $Id: RTProcIsRunningByName-linux.cpp $ */ /** @file * IPRT - RTProcIsRunningByName, Linux implementation. */ diff --git a/src/VBox/Runtime/r3/linux/fileaio-linux.cpp b/src/VBox/Runtime/r3/linux/fileaio-linux.cpp index 37f783383..6db26eda1 100644 --- a/src/VBox/Runtime/r3/linux/fileaio-linux.cpp +++ b/src/VBox/Runtime/r3/linux/fileaio-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: fileaio-linux.cpp 19562 2009-05-10 21:44:16Z vboxsync $ */ +/* $Id: fileaio-linux.cpp $ */ /** @file * IPRT - File async I/O, native implementation for the Linux host platform. */ diff --git a/src/VBox/Runtime/r3/linux/mp-linux.cpp b/src/VBox/Runtime/r3/linux/mp-linux.cpp index 6eed83dff..7fcc9b73a 100644 --- a/src/VBox/Runtime/r3/linux/mp-linux.cpp +++ b/src/VBox/Runtime/r3/linux/mp-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-linux.cpp 15399 2008-12-12 22:02:14Z vboxsync $ */ +/* $Id: mp-linux.cpp $ */ /** @file * IPRT - Multiprocessor, Linux. */ diff --git a/src/VBox/Runtime/r3/linux/rtProcInitExePath-linux.cpp b/src/VBox/Runtime/r3/linux/rtProcInitExePath-linux.cpp index 22b254d59..36a145a97 100644 --- a/src/VBox/Runtime/r3/linux/rtProcInitExePath-linux.cpp +++ b/src/VBox/Runtime/r3/linux/rtProcInitExePath-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: rtProcInitExePath-linux.cpp 11838 2008-08-29 17:14:02Z vboxsync $ */ +/* $Id: rtProcInitExePath-linux.cpp $ */ /** @file * IPRT - rtProcInitName, Linux. */ diff --git a/src/VBox/Runtime/r3/linux/sched-linux.cpp b/src/VBox/Runtime/r3/linux/sched-linux.cpp index d4e2957a8..ffaf7caf6 100644 --- a/src/VBox/Runtime/r3/linux/sched-linux.cpp +++ b/src/VBox/Runtime/r3/linux/sched-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: sched-linux.cpp 13837 2008-11-05 02:54:02Z vboxsync $ */ +/* $Id: sched-linux.cpp $ */ /** @file * IPRT - Scheduling, POSIX. */ diff --git a/src/VBox/Runtime/r3/linux/semevent-linux.cpp b/src/VBox/Runtime/r3/linux/semevent-linux.cpp index 556715746..f1595c436 100644 --- a/src/VBox/Runtime/r3/linux/semevent-linux.cpp +++ b/src/VBox/Runtime/r3/linux/semevent-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: semevent-linux.cpp 14468 2008-11-21 15:44:27Z vboxsync $ */ +/* $Id: semevent-linux.cpp $ */ /** @file * IPRT - Event Semaphore, Linux (2.6.x+). */ diff --git a/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp b/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp index 3464c90a8..b7e883a0b 100644 --- a/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp +++ b/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-linux.cpp 14468 2008-11-21 15:44:27Z vboxsync $ */ +/* $Id: semeventmulti-linux.cpp $ */ /** @file * IPRT - Multiple Release Event Semaphore, Linux (2.6.x+). */ diff --git a/src/VBox/Runtime/r3/linux/semmutex-linux.cpp b/src/VBox/Runtime/r3/linux/semmutex-linux.cpp index 271f77b9d..003789398 100644 --- a/src/VBox/Runtime/r3/linux/semmutex-linux.cpp +++ b/src/VBox/Runtime/r3/linux/semmutex-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: semmutex-linux.cpp 8651 2008-05-07 12:16:29Z vboxsync $ */ +/* $Id: semmutex-linux.cpp $ */ /** @file * IPRT - Mutex Semaphore, Linux (2.6.x+). */ diff --git a/src/VBox/Runtime/r3/linux/sysfs.cpp b/src/VBox/Runtime/r3/linux/sysfs.cpp index 526a89227..6d0fd58c4 100644 --- a/src/VBox/Runtime/r3/linux/sysfs.cpp +++ b/src/VBox/Runtime/r3/linux/sysfs.cpp @@ -1,4 +1,4 @@ -/* $Id: sysfs.cpp 15644 2008-12-18 11:16:58Z vboxsync $ */ +/* $Id: sysfs.cpp $ */ /** @file * IPRT - Linux sysfs access. */ diff --git a/src/VBox/Runtime/r3/linux/time-linux.cpp b/src/VBox/Runtime/r3/linux/time-linux.cpp index 102e500b0..8dfe73d5c 100644 --- a/src/VBox/Runtime/r3/linux/time-linux.cpp +++ b/src/VBox/Runtime/r3/linux/time-linux.cpp @@ -1,4 +1,4 @@ -/* $Id: time-linux.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: time-linux.cpp $ */ /** @file * IPRT - Time, POSIX. */ diff --git a/src/VBox/Runtime/r3/os2/filelock-os2.cpp b/src/VBox/Runtime/r3/os2/filelock-os2.cpp index b6e33cfce..63930a9d3 100644 --- a/src/VBox/Runtime/r3/os2/filelock-os2.cpp +++ b/src/VBox/Runtime/r3/os2/filelock-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: filelock-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: filelock-os2.cpp $ */ /** @file * IPRT - File Locking, OS/2. */ diff --git a/src/VBox/Runtime/r3/os2/mp-os2.cpp b/src/VBox/Runtime/r3/os2/mp-os2.cpp index f3a12a5d0..15569b465 100644 --- a/src/VBox/Runtime/r3/os2/mp-os2.cpp +++ b/src/VBox/Runtime/r3/os2/mp-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-os2.cpp 13908 2008-11-06 11:53:47Z vboxsync $ */ +/* $Id: mp-os2.cpp $ */ /** @file * IPRT - Multiprocessor, OS/2. */ diff --git a/src/VBox/Runtime/r3/os2/rtProcInitExePath-os2.cpp b/src/VBox/Runtime/r3/os2/rtProcInitExePath-os2.cpp index 16064dfde..32332b190 100644 --- a/src/VBox/Runtime/r3/os2/rtProcInitExePath-os2.cpp +++ b/src/VBox/Runtime/r3/os2/rtProcInitExePath-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: rtProcInitExePath-os2.cpp 13908 2008-11-06 11:53:47Z vboxsync $ */ +/* $Id: rtProcInitExePath-os2.cpp $ */ /** @file * IPRT - rtProcInitName, OS/2. */ diff --git a/src/VBox/Runtime/r3/os2/sched-os2.cpp b/src/VBox/Runtime/r3/os2/sched-os2.cpp index ea64a4135..c826d53a0 100644 --- a/src/VBox/Runtime/r3/os2/sched-os2.cpp +++ b/src/VBox/Runtime/r3/os2/sched-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: sched-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: sched-os2.cpp $ */ /** @file * IPRT - Scheduling, OS/2 */ diff --git a/src/VBox/Runtime/r3/os2/sems-os2.cpp b/src/VBox/Runtime/r3/os2/sems-os2.cpp index a08d68b2c..57b27ae2f 100644 --- a/src/VBox/Runtime/r3/os2/sems-os2.cpp +++ b/src/VBox/Runtime/r3/os2/sems-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: sems-os2.cpp 10839 2008-07-23 19:48:51Z vboxsync $ */ +/* $Id: sems-os2.cpp $ */ /** @file * IPRT - Semaphores, OS/2. */ diff --git a/src/VBox/Runtime/r3/os2/thread-os2.cpp b/src/VBox/Runtime/r3/os2/thread-os2.cpp index 5228fd751..8567638b4 100644 --- a/src/VBox/Runtime/r3/os2/thread-os2.cpp +++ b/src/VBox/Runtime/r3/os2/thread-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: thread-os2.cpp 16311 2009-01-28 13:46:41Z vboxsync $ */ +/* $Id: thread-os2.cpp $ */ /** @file * IPRT - Threads, OS/2. */ diff --git a/src/VBox/Runtime/r3/os2/time-os2.cpp b/src/VBox/Runtime/r3/os2/time-os2.cpp index d39e1fc24..13fcad048 100644 --- a/src/VBox/Runtime/r3/os2/time-os2.cpp +++ b/src/VBox/Runtime/r3/os2/time-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: time-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: time-os2.cpp $ */ /** @file * IPRT - Time, POSIX. */ diff --git a/src/VBox/Runtime/r3/path.cpp b/src/VBox/Runtime/r3/path.cpp index 71f61a70b..7a4cf074b 100644 --- a/src/VBox/Runtime/r3/path.cpp +++ b/src/VBox/Runtime/r3/path.cpp @@ -1,4 +1,4 @@ -/* $Id: path.cpp 20101 2009-05-27 16:43:08Z vboxsync $ */ +/* $Id: path.cpp $ */ /** @file * IPRT - Path Manipulation. */ diff --git a/src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp b/src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp index 9beb4446e..6518ef890 100644 --- a/src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp +++ b/src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpGetCount-posix.cpp 11243 2008-08-08 13:19:14Z vboxsync $ */ +/* $Id: RTMpGetCount-posix.cpp $ */ /** @file * IPRT - RTMpGetCount, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/RTSystemQueryOSInfo-posix.cpp b/src/VBox/Runtime/r3/posix/RTSystemQueryOSInfo-posix.cpp index 2e2d501f6..8ff6ead0e 100644 --- a/src/VBox/Runtime/r3/posix/RTSystemQueryOSInfo-posix.cpp +++ b/src/VBox/Runtime/r3/posix/RTSystemQueryOSInfo-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: RTSystemQueryOSInfo-posix.cpp 15850 2009-01-08 10:16:09Z vboxsync $ */ +/* $Id: RTSystemQueryOSInfo-posix.cpp $ */ /** @file * IPRT - RTSystemQueryOSInfo, POSIX implementation. */ diff --git a/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp b/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp index 74ee305cf..7c5e9acc2 100644 --- a/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp +++ b/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: RTTimeNow-posix.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTTimeNow-posix.cpp $ */ /** @file * IPRT - RTTimeNow, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/alloc-posix.cpp b/src/VBox/Runtime/r3/posix/alloc-posix.cpp index be5efcc1b..3e18b4ec5 100644 --- a/src/VBox/Runtime/r3/posix/alloc-posix.cpp +++ b/src/VBox/Runtime/r3/posix/alloc-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-posix.cpp 11020 2008-07-30 22:48:35Z vboxsync $ */ +/* $Id: alloc-posix.cpp $ */ /** @file * IPRT - Memory Allocation, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/dir-posix.cpp b/src/VBox/Runtime/r3/posix/dir-posix.cpp index 4ecfcdd3a..9ffd82225 100644 --- a/src/VBox/Runtime/r3/posix/dir-posix.cpp +++ b/src/VBox/Runtime/r3/posix/dir-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: dir-posix.cpp 20111 2009-05-28 00:34:52Z vboxsync $ */ +/* $Id: dir-posix.cpp $ */ /** @file * IPRT - Directory manipulation, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/env-posix.cpp b/src/VBox/Runtime/r3/posix/env-posix.cpp index 75e7a9a83..b720c3c71 100644 --- a/src/VBox/Runtime/r3/posix/env-posix.cpp +++ b/src/VBox/Runtime/r3/posix/env-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: env-posix.cpp 20821 2009-06-23 12:42:19Z vboxsync $ */ +/* $Id: env-posix.cpp $ */ /** @file * IPRT - Environment, Posix. */ diff --git a/src/VBox/Runtime/r3/posix/fileaio-posix.cpp b/src/VBox/Runtime/r3/posix/fileaio-posix.cpp index 655685991..e254f552d 100644 --- a/src/VBox/Runtime/r3/posix/fileaio-posix.cpp +++ b/src/VBox/Runtime/r3/posix/fileaio-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: fileaio-posix.cpp 20961 2009-06-26 08:45:18Z vboxsync $ */ +/* $Id: fileaio-posix.cpp $ */ /** @file * IPRT - File async I/O, native implementation for POSIX compliant host platforms. */ diff --git a/src/VBox/Runtime/r3/posix/fileio-posix.cpp b/src/VBox/Runtime/r3/posix/fileio-posix.cpp index 51857dadb..80d0099cd 100644 --- a/src/VBox/Runtime/r3/posix/fileio-posix.cpp +++ b/src/VBox/Runtime/r3/posix/fileio-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: fileio-posix.cpp 19346 2009-05-05 00:39:14Z vboxsync $ */ +/* $Id: fileio-posix.cpp $ */ /** @file * IPRT - File I/O, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/filelock-posix.cpp b/src/VBox/Runtime/r3/posix/filelock-posix.cpp index 41c7cfcb3..17bcb97c3 100644 --- a/src/VBox/Runtime/r3/posix/filelock-posix.cpp +++ b/src/VBox/Runtime/r3/posix/filelock-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: filelock-posix.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: filelock-posix.cpp $ */ /** @file * IPRT - File Locking, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/fs-posix.cpp b/src/VBox/Runtime/r3/posix/fs-posix.cpp index 0dbdc93d0..c1e20287c 100644 --- a/src/VBox/Runtime/r3/posix/fs-posix.cpp +++ b/src/VBox/Runtime/r3/posix/fs-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: fs-posix.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: fs-posix.cpp $ */ /** @file * IPRT - File System, Linux. */ diff --git a/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp b/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp index b879eef7b..9e9739f49 100644 --- a/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp +++ b/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: ldrNative-posix.cpp 12146 2008-09-05 16:27:28Z vboxsync $ */ +/* $Id: ldrNative-posix.cpp $ */ /** @file * IPRT - Binary Image Loader, POSIX native. */ diff --git a/src/VBox/Runtime/r3/posix/path-posix.cpp b/src/VBox/Runtime/r3/posix/path-posix.cpp index abcfde53c..a99bd5d0b 100644 --- a/src/VBox/Runtime/r3/posix/path-posix.cpp +++ b/src/VBox/Runtime/r3/posix/path-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: path-posix.cpp 20819 2009-06-23 12:15:07Z vboxsync $ */ +/* $Id: path-posix.cpp $ */ /** @file * IPRT - Path Manipulation, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/process-posix.cpp b/src/VBox/Runtime/r3/posix/process-posix.cpp index 777a4ebb3..8e6ba66a9 100644 --- a/src/VBox/Runtime/r3/posix/process-posix.cpp +++ b/src/VBox/Runtime/r3/posix/process-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: process-posix.cpp 20498 2009-06-12 11:05:46Z vboxsync $ */ +/* $Id: process-posix.cpp $ */ /** @file * IPRT - Process, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/rand-posix.cpp b/src/VBox/Runtime/r3/posix/rand-posix.cpp index b53c5957e..ac706d689 100644 --- a/src/VBox/Runtime/r3/posix/rand-posix.cpp +++ b/src/VBox/Runtime/r3/posix/rand-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: rand-posix.cpp 11557 2008-08-21 21:47:31Z vboxsync $ */ +/* $Id: rand-posix.cpp $ */ /** @file * IPRT - Random Numbers and Byte Streams, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/sched-posix.cpp b/src/VBox/Runtime/r3/posix/sched-posix.cpp index 86f67e381..e8f90e864 100644 --- a/src/VBox/Runtime/r3/posix/sched-posix.cpp +++ b/src/VBox/Runtime/r3/posix/sched-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: sched-posix.cpp 13837 2008-11-05 02:54:02Z vboxsync $ */ +/* $Id: sched-posix.cpp $ */ /** @file * IPRT - Scheduling, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/semevent-posix.cpp b/src/VBox/Runtime/r3/posix/semevent-posix.cpp index c2789133b..c89b90280 100644 --- a/src/VBox/Runtime/r3/posix/semevent-posix.cpp +++ b/src/VBox/Runtime/r3/posix/semevent-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: semevent-posix.cpp 14318 2008-11-18 16:56:53Z vboxsync $ */ +/* $Id: semevent-posix.cpp $ */ /** @file * IPRT - Event Semaphore, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp b/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp index d2df8af2f..cf446f83c 100644 --- a/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp +++ b/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-posix.cpp 14318 2008-11-18 16:56:53Z vboxsync $ */ +/* $Id: semeventmulti-posix.cpp $ */ /** @file * IPRT - Multiple Release Event Semaphore, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/semmutex-posix.cpp b/src/VBox/Runtime/r3/posix/semmutex-posix.cpp index 217dee87e..9050f9496 100644 --- a/src/VBox/Runtime/r3/posix/semmutex-posix.cpp +++ b/src/VBox/Runtime/r3/posix/semmutex-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: semmutex-posix.cpp 8651 2008-05-07 12:16:29Z vboxsync $ */ +/* $Id: semmutex-posix.cpp $ */ /** @file * IPRT - Mutex Semaphore, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/semrw-posix.cpp b/src/VBox/Runtime/r3/posix/semrw-posix.cpp index bbd4da38c..03336d346 100644 --- a/src/VBox/Runtime/r3/posix/semrw-posix.cpp +++ b/src/VBox/Runtime/r3/posix/semrw-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: semrw-posix.cpp 8653 2008-05-07 12:31:30Z vboxsync $ */ +/* $Id: semrw-posix.cpp $ */ /** @file * IPRT - Read-Write Semaphore, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/thread-posix.cpp b/src/VBox/Runtime/r3/posix/thread-posix.cpp index de36ed092..d76682db9 100644 --- a/src/VBox/Runtime/r3/posix/thread-posix.cpp +++ b/src/VBox/Runtime/r3/posix/thread-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: thread-posix.cpp 13837 2008-11-05 02:54:02Z vboxsync $ */ +/* $Id: thread-posix.cpp $ */ /** @file * IPRT - Threads, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/time-posix.cpp b/src/VBox/Runtime/r3/posix/time-posix.cpp index 7191e4966..34f538a20 100644 --- a/src/VBox/Runtime/r3/posix/time-posix.cpp +++ b/src/VBox/Runtime/r3/posix/time-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: time-posix.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: time-posix.cpp $ */ /** @file * IPRT - Time, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/timer-posix.cpp b/src/VBox/Runtime/r3/posix/timer-posix.cpp index 2393aeb9f..92cb17e19 100644 --- a/src/VBox/Runtime/r3/posix/timer-posix.cpp +++ b/src/VBox/Runtime/r3/posix/timer-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: timer-posix.cpp 14298 2008-11-18 12:47:26Z vboxsync $ */ +/* $Id: timer-posix.cpp $ */ /** @file * IPRT - Timer, POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/tls-posix.cpp b/src/VBox/Runtime/r3/posix/tls-posix.cpp index a32140540..4a6ab3a38 100644 --- a/src/VBox/Runtime/r3/posix/tls-posix.cpp +++ b/src/VBox/Runtime/r3/posix/tls-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: tls-posix.cpp 16311 2009-01-28 13:46:41Z vboxsync $ */ +/* $Id: tls-posix.cpp $ */ /** @file * IPRT - Thread Local Storage (TLS), POSIX. */ diff --git a/src/VBox/Runtime/r3/posix/utf8-posix.cpp b/src/VBox/Runtime/r3/posix/utf8-posix.cpp index a0b1d10e1..82042faa4 100644 --- a/src/VBox/Runtime/r3/posix/utf8-posix.cpp +++ b/src/VBox/Runtime/r3/posix/utf8-posix.cpp @@ -1,4 +1,4 @@ -/* $Id: utf8-posix.cpp 20822 2009-06-23 12:44:05Z vboxsync $ */ +/* $Id: utf8-posix.cpp $ */ /** @file * IPRT - UTF-8 helpers, POSIX. */ diff --git a/src/VBox/Runtime/r3/process.cpp b/src/VBox/Runtime/r3/process.cpp index 59ba81e9f..d7c2fee58 100644 --- a/src/VBox/Runtime/r3/process.cpp +++ b/src/VBox/Runtime/r3/process.cpp @@ -1,4 +1,4 @@ -/* $Id: process.cpp 18997 2009-04-17 15:22:25Z vboxsync $ */ +/* $Id: process.cpp $ */ /** @file * IPRT - Process, Common. */ diff --git a/src/VBox/Runtime/r3/solaris/alloc-solaris.cpp b/src/VBox/Runtime/r3/solaris/alloc-solaris.cpp index 0293f8c9f..ee97b8309 100644 --- a/src/VBox/Runtime/r3/solaris/alloc-solaris.cpp +++ b/src/VBox/Runtime/r3/solaris/alloc-solaris.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-solaris.cpp 11020 2008-07-30 22:48:35Z vboxsync $ */ +/* $Id: alloc-solaris.cpp $ */ /** @file * IPRT - Memory Allocation, POSIX. */ diff --git a/src/VBox/Runtime/r3/solaris/mp-solaris.cpp b/src/VBox/Runtime/r3/solaris/mp-solaris.cpp index 282509712..f6bf56e13 100644 --- a/src/VBox/Runtime/r3/solaris/mp-solaris.cpp +++ b/src/VBox/Runtime/r3/solaris/mp-solaris.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-solaris.cpp 12108 2008-09-04 20:17:24Z vboxsync $ */ +/* $Id: mp-solaris.cpp $ */ /** @file * IPRT - Multiprocessor, Solaris. */ diff --git a/src/VBox/Runtime/r3/solaris/rtProcInitExePath-solaris.cpp b/src/VBox/Runtime/r3/solaris/rtProcInitExePath-solaris.cpp index 49813cf04..d154b361e 100644 --- a/src/VBox/Runtime/r3/solaris/rtProcInitExePath-solaris.cpp +++ b/src/VBox/Runtime/r3/solaris/rtProcInitExePath-solaris.cpp @@ -1,4 +1,4 @@ -/* $Id: rtProcInitExePath-solaris.cpp 11840 2008-08-29 17:49:10Z vboxsync $ */ +/* $Id: rtProcInitExePath-solaris.cpp $ */ /** @file * IPRT - rtProcInitName, Solaris. */ diff --git a/src/VBox/Runtime/r3/stream.cpp b/src/VBox/Runtime/r3/stream.cpp index b96a8e78f..50d8ec9a7 100644 --- a/src/VBox/Runtime/r3/stream.cpp +++ b/src/VBox/Runtime/r3/stream.cpp @@ -1,4 +1,4 @@ -/* $Id: stream.cpp 21045 2009-06-30 01:09:19Z vboxsync $ */ +/* $Id: stream.cpp $ */ /** @file * IPRT - I/O Stream. */ diff --git a/src/VBox/Runtime/r3/tcp.cpp b/src/VBox/Runtime/r3/tcp.cpp index 27313bf86..af3d23af1 100644 --- a/src/VBox/Runtime/r3/tcp.cpp +++ b/src/VBox/Runtime/r3/tcp.cpp @@ -1,4 +1,4 @@ -/* $Id: tcp.cpp 15655 2008-12-18 13:28:02Z vboxsync $ */ +/* $Id: tcp.cpp $ */ /** @file * IPRT - TCP/IP. */ diff --git a/src/VBox/Runtime/r3/test.cpp b/src/VBox/Runtime/r3/test.cpp index c165148b9..a3e853979 100644 --- a/src/VBox/Runtime/r3/test.cpp +++ b/src/VBox/Runtime/r3/test.cpp @@ -1,4 +1,4 @@ -/* $Id: test.cpp 20605 2009-06-15 20:49:41Z vboxsync $ */ +/* $Id: test.cpp $ */ /** @file * IPRT - Testcase Framework. */ diff --git a/src/VBox/Runtime/r3/testi.cpp b/src/VBox/Runtime/r3/testi.cpp index 8fc2de346..e1bc7e0eb 100644 --- a/src/VBox/Runtime/r3/testi.cpp +++ b/src/VBox/Runtime/r3/testi.cpp @@ -1,4 +1,4 @@ -/* $Id: testi.cpp 19944 2009-05-23 21:48:08Z vboxsync $ */ +/* $Id: testi.cpp $ */ /** @file * IPRT - Testcase Framework, the implicit test handle API variation. */ diff --git a/src/VBox/Runtime/r3/win/RTLogWriteDebugger-win.cpp b/src/VBox/Runtime/r3/win/RTLogWriteDebugger-win.cpp index 216a40891..34dec02cb 100644 --- a/src/VBox/Runtime/r3/win/RTLogWriteDebugger-win.cpp +++ b/src/VBox/Runtime/r3/win/RTLogWriteDebugger-win.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteDebugger-win.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTLogWriteDebugger-win.cpp $ */ /** @file * IPRT - Log To Debugger, Win32. */ diff --git a/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp b/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp index be558cd85..3cf4ff980 100644 --- a/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp +++ b/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp @@ -1,4 +1,4 @@ -/* $Id: RTSystemQueryOSInfo-win.cpp 15954 2009-01-14 19:46:17Z vboxsync $ */ +/* $Id: RTSystemQueryOSInfo-win.cpp $ */ /** @file * IPRT - RTSystemQueryOSInfo, generic stub. */ diff --git a/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp b/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp index 4690203be..ba4f9722e 100644 --- a/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp +++ b/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp @@ -1,4 +1,4 @@ -/* $Id: RTUuidCreate-win.cpp 9749 2008-06-17 08:42:50Z vboxsync $ */ +/* $Id: RTUuidCreate-win.cpp $ */ /** @file * IPRT - UUID, Windows RTUuidCreate implementation. */ diff --git a/src/VBox/Runtime/r3/win/VBoxRT-openssl-ose.def b/src/VBox/Runtime/r3/win/VBoxRT-openssl-ose.def index dfcfdcb92..24d534e32 100644 --- a/src/VBox/Runtime/r3/win/VBoxRT-openssl-ose.def +++ b/src/VBox/Runtime/r3/win/VBoxRT-openssl-ose.def @@ -1,4 +1,4 @@ -; $Id: VBoxRT-openssl-ose.def 20238 2009-06-03 17:05:51Z vboxsync $ +; $Id: VBoxRT-openssl-ose.def $ ;; @file ; IPRT - Windows OpenSSL exports. ; diff --git a/src/VBox/Runtime/r3/win/VBoxRT-openssl.def b/src/VBox/Runtime/r3/win/VBoxRT-openssl.def index f6c2a8960..31301156a 100644 --- a/src/VBox/Runtime/r3/win/VBoxRT-openssl.def +++ b/src/VBox/Runtime/r3/win/VBoxRT-openssl.def @@ -1,4 +1,4 @@ -; $Id: VBoxRT-openssl.def 19554 2009-05-08 22:10:24Z vboxsync $ +; $Id: VBoxRT-openssl.def $ ;; @file ; IPRT - Windows OpenSSL exports. ; diff --git a/src/VBox/Runtime/r3/win/VBoxRT-win32.def b/src/VBox/Runtime/r3/win/VBoxRT-win32.def index 01e105ea3..71168dcb4 100644 --- a/src/VBox/Runtime/r3/win/VBoxRT-win32.def +++ b/src/VBox/Runtime/r3/win/VBoxRT-win32.def @@ -1,4 +1,4 @@ -; $Id: $
+; $Id: $
;; @file
; IPRT - Win32 ASM exports.
;
diff --git a/src/VBox/Runtime/r3/win/VBoxRT-win64.def b/src/VBox/Runtime/r3/win/VBoxRT-win64.def index 3ea841b6d..0db5426e8 100644 --- a/src/VBox/Runtime/r3/win/VBoxRT-win64.def +++ b/src/VBox/Runtime/r3/win/VBoxRT-win64.def @@ -1,4 +1,4 @@ -; $Id: $
+; $Id: $
;; @file
; IPRT - Win64 ASM exports.
;
diff --git a/src/VBox/Runtime/r3/win/alloc-win.cpp b/src/VBox/Runtime/r3/win/alloc-win.cpp index 28169107e..96fa83420 100644 --- a/src/VBox/Runtime/r3/win/alloc-win.cpp +++ b/src/VBox/Runtime/r3/win/alloc-win.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-win.cpp 11020 2008-07-30 22:48:35Z vboxsync $ */ +/* $Id: alloc-win.cpp $ */ /** @file * IPRT - Memory Allocation, Win32. */ diff --git a/src/VBox/Runtime/r3/win/dir-win.cpp b/src/VBox/Runtime/r3/win/dir-win.cpp index 7f32f4d31..646da5c45 100644 --- a/src/VBox/Runtime/r3/win/dir-win.cpp +++ b/src/VBox/Runtime/r3/win/dir-win.cpp @@ -1,4 +1,4 @@ -/* $Id: dir-win.cpp 20111 2009-05-28 00:34:52Z vboxsync $ */ +/* $Id: dir-win.cpp $ */ /** @file * IPRT - Directory, win32. */ diff --git a/src/VBox/Runtime/r3/win/dllmain-win.cpp b/src/VBox/Runtime/r3/win/dllmain-win.cpp index 841b33fef..9ae8ee197 100644 --- a/src/VBox/Runtime/r3/win/dllmain-win.cpp +++ b/src/VBox/Runtime/r3/win/dllmain-win.cpp @@ -1,4 +1,4 @@ -/* $Id: dllmain-win.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: dllmain-win.cpp $ */ /** @file * IPRT - Win32 DllMain (Ring-3). */ diff --git a/src/VBox/Runtime/r3/win/fileaio-win.cpp b/src/VBox/Runtime/r3/win/fileaio-win.cpp index 6d7399be0..10c757f1a 100644 --- a/src/VBox/Runtime/r3/win/fileaio-win.cpp +++ b/src/VBox/Runtime/r3/win/fileaio-win.cpp @@ -1,4 +1,4 @@ -/* $Id: fileaio-win.cpp 19562 2009-05-10 21:44:16Z vboxsync $ */ +/* $Id: fileaio-win.cpp $ */ /** @file * IPRT - File async I/O, native implementation for the Windows host platform. */ diff --git a/src/VBox/Runtime/r3/win/fileio-win.cpp b/src/VBox/Runtime/r3/win/fileio-win.cpp index d0d3ae209..575f4173b 100644 --- a/src/VBox/Runtime/r3/win/fileio-win.cpp +++ b/src/VBox/Runtime/r3/win/fileio-win.cpp @@ -1,4 +1,4 @@ -/* $Id: fileio-win.cpp 19186 2009-04-26 09:05:32Z vboxsync $ */ +/* $Id: fileio-win.cpp $ */ /** @file * IPRT - File I/O, native implementation for the Windows host platform. */ diff --git a/src/VBox/Runtime/r3/win/fs-win.cpp b/src/VBox/Runtime/r3/win/fs-win.cpp index 7c267d07e..174a66ef3 100644 --- a/src/VBox/Runtime/r3/win/fs-win.cpp +++ b/src/VBox/Runtime/r3/win/fs-win.cpp @@ -1,4 +1,4 @@ -/* $Id: fs-win.cpp 13837 2008-11-05 02:54:02Z vboxsync $ */ +/* $Id: fs-win.cpp $ */ /** @file * IPRT - File System, Win32. */ diff --git a/src/VBox/Runtime/r3/win/ldrNative-win.cpp b/src/VBox/Runtime/r3/win/ldrNative-win.cpp index 4722b0348..b596c6792 100644 --- a/src/VBox/Runtime/r3/win/ldrNative-win.cpp +++ b/src/VBox/Runtime/r3/win/ldrNative-win.cpp @@ -1,4 +1,4 @@ -/* $Id: ldrNative-win.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: ldrNative-win.cpp $ */ /** @file * IPRT - Binary Image Loader, Win32 native. */ diff --git a/src/VBox/Runtime/r3/win/localipc-win.cpp b/src/VBox/Runtime/r3/win/localipc-win.cpp index e5270e116..27afa7c3c 100644 --- a/src/VBox/Runtime/r3/win/localipc-win.cpp +++ b/src/VBox/Runtime/r3/win/localipc-win.cpp @@ -1,4 +1,4 @@ -/* $Id: localipc-win.cpp 11725 2008-08-27 22:21:47Z vboxsync $ */ +/* $Id: localipc-win.cpp $ */ /** @file * IPRT - Local IPC, Windows Implementation Using Named Pipes. */ diff --git a/src/VBox/Runtime/r3/win/mp-win.cpp b/src/VBox/Runtime/r3/win/mp-win.cpp index ffb3884ec..48e05a19f 100644 --- a/src/VBox/Runtime/r3/win/mp-win.cpp +++ b/src/VBox/Runtime/r3/win/mp-win.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-win.cpp 9429 2008-06-05 15:22:37Z vboxsync $ */ +/* $Id: mp-win.cpp $ */ /** @file * IPRT - Multiprocessor, Windows. */ diff --git a/src/VBox/Runtime/r3/win/path-win.cpp b/src/VBox/Runtime/r3/win/path-win.cpp index a84082543..6413cc961 100644 --- a/src/VBox/Runtime/r3/win/path-win.cpp +++ b/src/VBox/Runtime/r3/win/path-win.cpp @@ -1,4 +1,4 @@ -/* $Id: path-win.cpp 15813 2009-01-05 16:06:55Z vboxsync $ */ +/* $Id: path-win.cpp $ */ /** @file * IPRT - Path manipulation. */ diff --git a/src/VBox/Runtime/r3/win/process-win.cpp b/src/VBox/Runtime/r3/win/process-win.cpp index 862c63b72..9697b8d85 100644 --- a/src/VBox/Runtime/r3/win/process-win.cpp +++ b/src/VBox/Runtime/r3/win/process-win.cpp @@ -1,4 +1,4 @@ -/* $Id: process-win.cpp 20497 2009-06-12 11:01:30Z vboxsync $ */ +/* $Id: process-win.cpp $ */ /** @file * IPRT - Process, Win32. */ diff --git a/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp b/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp index 08f323fa5..1bc78292c 100644 --- a/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp +++ b/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp @@ -1,4 +1,4 @@ -/* $Id: rtFileNativeSetAttributes-win.cpp 17357 2009-03-04 17:41:31Z vboxsync $ */ +/* $Id: rtFileNativeSetAttributes-win.cpp $ */ /** @file * IPRT - NtSetInformationFile wrapper. */ diff --git a/src/VBox/Runtime/r3/win/rtProcInitExePath-win.cpp b/src/VBox/Runtime/r3/win/rtProcInitExePath-win.cpp index 3d0f2c21a..fa2f6d485 100644 --- a/src/VBox/Runtime/r3/win/rtProcInitExePath-win.cpp +++ b/src/VBox/Runtime/r3/win/rtProcInitExePath-win.cpp @@ -1,4 +1,4 @@ -/* $Id: rtProcInitExePath-win.cpp 11838 2008-08-29 17:14:02Z vboxsync $ */ +/* $Id: rtProcInitExePath-win.cpp $ */ /** @file * IPRT - rtProcInitName, Windows. */ diff --git a/src/VBox/Runtime/r3/win/sched-win.cpp b/src/VBox/Runtime/r3/win/sched-win.cpp index 1697f7736..7a2f7878b 100644 --- a/src/VBox/Runtime/r3/win/sched-win.cpp +++ b/src/VBox/Runtime/r3/win/sched-win.cpp @@ -1,4 +1,4 @@ -/* $Id: sched-win.cpp 13837 2008-11-05 02:54:02Z vboxsync $ */ +/* $Id: sched-win.cpp $ */ /** @file * IPRT - Scheduling, Win32. */ diff --git a/src/VBox/Runtime/r3/win/sems-win.cpp b/src/VBox/Runtime/r3/win/sems-win.cpp index 5560d1596..46c871749 100644 --- a/src/VBox/Runtime/r3/win/sems-win.cpp +++ b/src/VBox/Runtime/r3/win/sems-win.cpp @@ -1,4 +1,4 @@ -/* $Id: sems-win.cpp 10839 2008-07-23 19:48:51Z vboxsync $ */ +/* $Id: sems-win.cpp $ */ /** @file * IPRT - Semaphores, implementation for Windows host platform. */ diff --git a/src/VBox/Runtime/r3/win/thread-win.cpp b/src/VBox/Runtime/r3/win/thread-win.cpp index eb24437f7..6ad8f8146 100644 --- a/src/VBox/Runtime/r3/win/thread-win.cpp +++ b/src/VBox/Runtime/r3/win/thread-win.cpp @@ -1,4 +1,4 @@ -/* $Id: thread-win.cpp 13837 2008-11-05 02:54:02Z vboxsync $ */ +/* $Id: thread-win.cpp $ */ /** @file * IPRT - Threads, Win32. */ diff --git a/src/VBox/Runtime/r3/win/time-win.cpp b/src/VBox/Runtime/r3/win/time-win.cpp index df71c5cd1..facef8dc9 100644 --- a/src/VBox/Runtime/r3/win/time-win.cpp +++ b/src/VBox/Runtime/r3/win/time-win.cpp @@ -1,4 +1,4 @@ -/* $Id: time-win.cpp 20736 2009-06-20 20:49:09Z vboxsync $ */ +/* $Id: time-win.cpp $ */ /** @file * IPRT - Time, win32. */ diff --git a/src/VBox/Runtime/r3/win/timer-win.cpp b/src/VBox/Runtime/r3/win/timer-win.cpp index a73f88a7b..9044f4c5b 100644 --- a/src/VBox/Runtime/r3/win/timer-win.cpp +++ b/src/VBox/Runtime/r3/win/timer-win.cpp @@ -1,4 +1,4 @@ -/* $Id: timer-win.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: timer-win.cpp $ */ /** @file * IPRT - Timer. */ diff --git a/src/VBox/Runtime/r3/win/tls-win.cpp b/src/VBox/Runtime/r3/win/tls-win.cpp index df74e2fe5..801798704 100644 --- a/src/VBox/Runtime/r3/win/tls-win.cpp +++ b/src/VBox/Runtime/r3/win/tls-win.cpp @@ -1,4 +1,4 @@ -/* $Id: tls-win.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: tls-win.cpp $ */ /** @file * IPRT - Thread Local Storage (TLS), Win32. */ diff --git a/src/VBox/Runtime/r3/win/utf16locale-win.cpp b/src/VBox/Runtime/r3/win/utf16locale-win.cpp index cb75099f8..01d630471 100644 --- a/src/VBox/Runtime/r3/win/utf16locale-win.cpp +++ b/src/VBox/Runtime/r3/win/utf16locale-win.cpp @@ -1,4 +1,4 @@ -/* $Id: utf16locale-win.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: utf16locale-win.cpp $ */ /** @file * IPRT - UTF-16 Locale Specific Manipulation, Win32. */ diff --git a/src/VBox/Runtime/r3/win/utf8-win.cpp b/src/VBox/Runtime/r3/win/utf8-win.cpp index 90faed767..eab3af0b0 100644 --- a/src/VBox/Runtime/r3/win/utf8-win.cpp +++ b/src/VBox/Runtime/r3/win/utf8-win.cpp @@ -1,4 +1,4 @@ -/* $Id: utf8-win.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: utf8-win.cpp $ */ /** @file * IPRT - UTF8 helpers. */ diff --git a/src/VBox/Runtime/r3/win/uuid-win.cpp b/src/VBox/Runtime/r3/win/uuid-win.cpp index 1e3eba31d..266a11087 100644 --- a/src/VBox/Runtime/r3/win/uuid-win.cpp +++ b/src/VBox/Runtime/r3/win/uuid-win.cpp @@ -1,4 +1,4 @@ -/* $Id: uuid-win.cpp 9743 2008-06-16 22:53:02Z vboxsync $ */ +/* $Id: uuid-win.cpp $ */ /** @file * IPRT - UUID, Windows implementation. */ diff --git a/src/VBox/Runtime/testcase/Makefile.kmk b/src/VBox/Runtime/testcase/Makefile.kmk index de254f89b..312d0692e 100644 --- a/src/VBox/Runtime/testcase/Makefile.kmk +++ b/src/VBox/Runtime/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20647 2009-06-16 21:58:09Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the IPRT testcases. # diff --git a/src/VBox/Runtime/testcase/ioctl.h b/src/VBox/Runtime/testcase/ioctl.h index da61f2ff3..48d5c490a 100644 --- a/src/VBox/Runtime/testcase/ioctl.h +++ b/src/VBox/Runtime/testcase/ioctl.h @@ -1,4 +1,4 @@ -/* $Id: ioctl.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: ioctl.h $ */ /** @file * VBox L4/OSS audio - header for Linux IoCtls. */ diff --git a/src/VBox/Runtime/testcase/ntGetTimerResolution.cpp b/src/VBox/Runtime/testcase/ntGetTimerResolution.cpp index 5157b6f2b..bd09bf315 100644 --- a/src/VBox/Runtime/testcase/ntGetTimerResolution.cpp +++ b/src/VBox/Runtime/testcase/ntGetTimerResolution.cpp @@ -1,4 +1,4 @@ -/* $Id: ntGetTimerResolution.cpp 9963 2008-06-26 14:41:05Z vboxsync $ */ +/* $Id: ntGetTimerResolution.cpp $ */ /** @file * IPRT - Win32 (NT) testcase for getting the timer resolution. */ diff --git a/src/VBox/Runtime/testcase/tstDeadlock.cpp b/src/VBox/Runtime/testcase/tstDeadlock.cpp index a2e98abc1..70528b915 100644 --- a/src/VBox/Runtime/testcase/tstDeadlock.cpp +++ b/src/VBox/Runtime/testcase/tstDeadlock.cpp @@ -1,4 +1,4 @@ -/* $Id: tstDeadlock.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstDeadlock.cpp $ */ /** @file * IPRT Testcase - deadlock detection. Will never really "work". */ diff --git a/src/VBox/Runtime/testcase/tstDir-2.cpp b/src/VBox/Runtime/testcase/tstDir-2.cpp index f1671c4f2..8db2c5dac 100644 --- a/src/VBox/Runtime/testcase/tstDir-2.cpp +++ b/src/VBox/Runtime/testcase/tstDir-2.cpp @@ -1,4 +1,4 @@ -/* $Id: tstDir-2.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstDir-2.cpp $ */ /** @file * IPRT Testcase - Directory listing & filtering . */ diff --git a/src/VBox/Runtime/testcase/tstDir-3.cpp b/src/VBox/Runtime/testcase/tstDir-3.cpp index 554f8ab84..00ed35130 100644 --- a/src/VBox/Runtime/testcase/tstDir-3.cpp +++ b/src/VBox/Runtime/testcase/tstDir-3.cpp @@ -1,4 +1,4 @@ -/* $Id: tstDir-3.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstDir-3.cpp $ */ /** @file * IPRT Testcase - Directory listing & filtering (no parameters needed). */ diff --git a/src/VBox/Runtime/testcase/tstDir.cpp b/src/VBox/Runtime/testcase/tstDir.cpp index 64b182570..ec69e1272 100644 --- a/src/VBox/Runtime/testcase/tstDir.cpp +++ b/src/VBox/Runtime/testcase/tstDir.cpp @@ -1,4 +1,4 @@ -/* $Id: tstDir.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstDir.cpp $ */ /** @file * IPRT Testcase - Directory listing. */ diff --git a/src/VBox/Runtime/testcase/tstEnv.cpp b/src/VBox/Runtime/testcase/tstEnv.cpp index eff54f03a..25e8b64f6 100644 --- a/src/VBox/Runtime/testcase/tstEnv.cpp +++ b/src/VBox/Runtime/testcase/tstEnv.cpp @@ -1,4 +1,4 @@ -/* $Id: tstEnv.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstEnv.cpp $ */ /** @file * IPRT Testcase - Environment. */ diff --git a/src/VBox/Runtime/testcase/tstErrUnique.cpp b/src/VBox/Runtime/testcase/tstErrUnique.cpp index d050d0b52..4e551b07d 100644 --- a/src/VBox/Runtime/testcase/tstErrUnique.cpp +++ b/src/VBox/Runtime/testcase/tstErrUnique.cpp @@ -1,4 +1,4 @@ -/* $Id: tstErrUnique.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstErrUnique.cpp $ */ /** @file * IPRT Testcase - Error Messages. */ diff --git a/src/VBox/Runtime/testcase/tstFile.cpp b/src/VBox/Runtime/testcase/tstFile.cpp index 444359c21..557843de5 100644 --- a/src/VBox/Runtime/testcase/tstFile.cpp +++ b/src/VBox/Runtime/testcase/tstFile.cpp @@ -1,4 +1,4 @@ -/* $Id: tstFile.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstFile.cpp $ */ /** @file * IPRT Testcase - File I/O. */ diff --git a/src/VBox/Runtime/testcase/tstFileAio.cpp b/src/VBox/Runtime/testcase/tstFileAio.cpp index 61123b600..13d5174e9 100644 --- a/src/VBox/Runtime/testcase/tstFileAio.cpp +++ b/src/VBox/Runtime/testcase/tstFileAio.cpp @@ -1,4 +1,4 @@ -/* $Id: tstFileAio.cpp 19562 2009-05-10 21:44:16Z vboxsync $ */ +/* $Id: tstFileAio.cpp $ */ /** @file * IPRT Testcase - File Async I/O. */ diff --git a/src/VBox/Runtime/testcase/tstFileAppendWin-1.cpp b/src/VBox/Runtime/testcase/tstFileAppendWin-1.cpp index 143c7149d..84b0d8d5a 100644 --- a/src/VBox/Runtime/testcase/tstFileAppendWin-1.cpp +++ b/src/VBox/Runtime/testcase/tstFileAppendWin-1.cpp @@ -1,4 +1,4 @@ -/* $Id: tstFileAppendWin-1.cpp 9138 2008-05-26 22:26:10Z vboxsync $ */ +/* $Id: tstFileAppendWin-1.cpp $ */ /** @file * IPRT Testcase - Exploration of File Appending on Windows. */ diff --git a/src/VBox/Runtime/testcase/tstFileLock.cpp b/src/VBox/Runtime/testcase/tstFileLock.cpp index a746c49c2..f6bfecdbe 100644 --- a/src/VBox/Runtime/testcase/tstFileLock.cpp +++ b/src/VBox/Runtime/testcase/tstFileLock.cpp @@ -1,4 +1,4 @@ -/* $Id: tstFileLock.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstFileLock.cpp $ */ /** @file * IPRT Testcase - File Locks. */ diff --git a/src/VBox/Runtime/testcase/tstFork.cpp b/src/VBox/Runtime/testcase/tstFork.cpp index 720962e9b..ace5d4dc8 100644 --- a/src/VBox/Runtime/testcase/tstFork.cpp +++ b/src/VBox/Runtime/testcase/tstFork.cpp @@ -1,4 +1,4 @@ -/* $Id: tstFork.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstFork.cpp $ */ /** @file * IPRT Testcase - fork() issues. */ diff --git a/src/VBox/Runtime/testcase/tstGetOpt.cpp b/src/VBox/Runtime/testcase/tstGetOpt.cpp index a8947f8a9..98c2d5419 100644 --- a/src/VBox/Runtime/testcase/tstGetOpt.cpp +++ b/src/VBox/Runtime/testcase/tstGetOpt.cpp @@ -1,4 +1,4 @@ -/* $Id: tstGetOpt.cpp 18318 2009-03-26 14:43:40Z vboxsync $ */ +/* $Id: tstGetOpt.cpp $ */ /** @file * IPRT Testcase - RTGetOpt */ diff --git a/src/VBox/Runtime/testcase/tstHandleTable.cpp b/src/VBox/Runtime/testcase/tstHandleTable.cpp index c021fb24e..852e7b81f 100644 --- a/src/VBox/Runtime/testcase/tstHandleTable.cpp +++ b/src/VBox/Runtime/testcase/tstHandleTable.cpp @@ -1,4 +1,4 @@ -/* $Id: tstHandleTable.cpp 17093 2009-02-24 19:58:09Z vboxsync $ */ +/* $Id: tstHandleTable.cpp $ */ /** @file * IPRT Testcase - Handle Tables. */ diff --git a/src/VBox/Runtime/testcase/tstInlineAsm.cpp b/src/VBox/Runtime/testcase/tstInlineAsm.cpp index 8a5084901..eee6a83a4 100644 --- a/src/VBox/Runtime/testcase/tstInlineAsm.cpp +++ b/src/VBox/Runtime/testcase/tstInlineAsm.cpp @@ -1,4 +1,4 @@ -/* $Id: tstInlineAsm.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstInlineAsm.cpp $ */ /** @file * IPRT Testcase - inline assembly. */ diff --git a/src/VBox/Runtime/testcase/tstIoCtl.cpp b/src/VBox/Runtime/testcase/tstIoCtl.cpp index de900c1e5..0fbae69ed 100644 --- a/src/VBox/Runtime/testcase/tstIoCtl.cpp +++ b/src/VBox/Runtime/testcase/tstIoCtl.cpp @@ -1,4 +1,4 @@ -/* $Id: tstIoCtl.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: tstIoCtl.cpp $ */ /** @file * IPRT Testcase - file IoCtl. */ diff --git a/src/VBox/Runtime/testcase/tstLdr-2.cpp b/src/VBox/Runtime/testcase/tstLdr-2.cpp index 3541c13cd..8da701da6 100644 --- a/src/VBox/Runtime/testcase/tstLdr-2.cpp +++ b/src/VBox/Runtime/testcase/tstLdr-2.cpp @@ -1,4 +1,4 @@ -/* $Id: tstLdr-2.cpp 16933 2009-02-18 23:42:57Z vboxsync $ */ +/* $Id: tstLdr-2.cpp $ */ /** @file * IPRT - Testcase for parts of RTLdr*, manual inspection. */ diff --git a/src/VBox/Runtime/testcase/tstLdr-3.cpp b/src/VBox/Runtime/testcase/tstLdr-3.cpp index 7f1113d12..2c3099e40 100644 --- a/src/VBox/Runtime/testcase/tstLdr-3.cpp +++ b/src/VBox/Runtime/testcase/tstLdr-3.cpp @@ -1,4 +1,4 @@ -/* $Id: tstLdr-3.cpp 18357 2009-03-26 23:02:07Z vboxsync $ */ +/* $Id: tstLdr-3.cpp $ */ /** @file * IPRT - Testcase for parts of RTLdr*, manual inspection. */ diff --git a/src/VBox/Runtime/testcase/tstLdr-4.cpp b/src/VBox/Runtime/testcase/tstLdr-4.cpp index dad948ab9..11e66b14f 100644 --- a/src/VBox/Runtime/testcase/tstLdr-4.cpp +++ b/src/VBox/Runtime/testcase/tstLdr-4.cpp @@ -1,4 +1,4 @@ -/* $Id: tstLdr-4.cpp 19924 2009-05-22 21:52:47Z vboxsync $ */ +/* $Id: tstLdr-4.cpp $ */ /** @file * IPRT - Testcase for RTLdrOpen using ldrLdrObjR0.r0. */ diff --git a/src/VBox/Runtime/testcase/tstLdr.cpp b/src/VBox/Runtime/testcase/tstLdr.cpp index aea7d8d67..f33a1c225 100644 --- a/src/VBox/Runtime/testcase/tstLdr.cpp +++ b/src/VBox/Runtime/testcase/tstLdr.cpp @@ -1,4 +1,4 @@ -/* $Id: tstLdr.cpp 18454 2009-03-28 04:42:26Z vboxsync $ */ +/* $Id: tstLdr.cpp $ */ /** @file * IPRT - Testcase for parts of RTLdr*. */ diff --git a/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp b/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp index ad6b6d44a..9ec6cd17c 100644 --- a/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp +++ b/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp @@ -1,4 +1,4 @@ -/* $Id: tstLdrDisasmTest.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: tstLdrDisasmTest.cpp $ */ /** @file * IPRT - RTLdr test object. * diff --git a/src/VBox/Runtime/testcase/tstLdrLoad.cpp b/src/VBox/Runtime/testcase/tstLdrLoad.cpp index 9f867bcdc..44f17b2d2 100644 --- a/src/VBox/Runtime/testcase/tstLdrLoad.cpp +++ b/src/VBox/Runtime/testcase/tstLdrLoad.cpp @@ -1,4 +1,4 @@ -/* $Id: tstLdrLoad.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstLdrLoad.cpp $ */ /** @file * IPRT Testcase - Native Loader. */ diff --git a/src/VBox/Runtime/testcase/tstLdrObj.cpp b/src/VBox/Runtime/testcase/tstLdrObj.cpp index d80171a40..fbeb0101f 100644 --- a/src/VBox/Runtime/testcase/tstLdrObj.cpp +++ b/src/VBox/Runtime/testcase/tstLdrObj.cpp @@ -1,4 +1,4 @@ -/* $Id: tstLdrObj.cpp 19143 2009-04-23 13:57:39Z vboxsync $ */ +/* $Id: tstLdrObj.cpp $ */ /** @file * IPRT - RTLdr test object. * diff --git a/src/VBox/Runtime/testcase/tstLdrObjR0.cpp b/src/VBox/Runtime/testcase/tstLdrObjR0.cpp index f8fcff1f6..4c4492289 100644 --- a/src/VBox/Runtime/testcase/tstLdrObjR0.cpp +++ b/src/VBox/Runtime/testcase/tstLdrObjR0.cpp @@ -1,4 +1,4 @@ -/* $Id: tstLdrObjR0.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: tstLdrObjR0.cpp $ */ /** @file * IPRT - RTLdr test object. * diff --git a/src/VBox/Runtime/testcase/tstLog.cpp b/src/VBox/Runtime/testcase/tstLog.cpp index 09e8107a4..9243cfb39 100644 --- a/src/VBox/Runtime/testcase/tstLog.cpp +++ b/src/VBox/Runtime/testcase/tstLog.cpp @@ -1,4 +1,4 @@ -/* $Id: tstLog.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstLog.cpp $ */ /** @file * IPRT Testcase - Log Formatting. */ diff --git a/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp b/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp index 03f5b0322..0a1a0f0bd 100644 --- a/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp +++ b/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp @@ -1,4 +1,4 @@ -/* $Id: tstMemAutoPtr.cpp 11822 2008-08-29 14:21:03Z vboxsync $ */ +/* $Id: tstMemAutoPtr.cpp $ */ /** @file * IPRT - Testcase the RTMemAutoPtr template. */ diff --git a/src/VBox/Runtime/testcase/tstMove.cpp b/src/VBox/Runtime/testcase/tstMove.cpp index 6a9c5ccb2..047ae23d7 100644 --- a/src/VBox/Runtime/testcase/tstMove.cpp +++ b/src/VBox/Runtime/testcase/tstMove.cpp @@ -1,4 +1,4 @@ -/* $Id: tstMove.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstMove.cpp $ */ /** @file * IPRT - RTFileMove & RTDirMove test program. */ diff --git a/src/VBox/Runtime/testcase/tstMp-1.cpp b/src/VBox/Runtime/testcase/tstMp-1.cpp index 002f5259a..4563cd8b2 100644 --- a/src/VBox/Runtime/testcase/tstMp-1.cpp +++ b/src/VBox/Runtime/testcase/tstMp-1.cpp @@ -1,4 +1,4 @@ -/* $Id: tstMp-1.cpp 12107 2008-09-04 20:10:06Z vboxsync $ */ +/* $Id: tstMp-1.cpp $ */ /** @file * IPRT Testcase - RTMp. */ diff --git a/src/VBox/Runtime/testcase/tstNoCrt-1.cpp b/src/VBox/Runtime/testcase/tstNoCrt-1.cpp index 4a8af4821..f324b5dd0 100644 --- a/src/VBox/Runtime/testcase/tstNoCrt-1.cpp +++ b/src/VBox/Runtime/testcase/tstNoCrt-1.cpp @@ -1,4 +1,4 @@ -/* $Id: tstNoCrt-1.cpp 14026 2008-11-10 17:11:07Z vboxsync $ */ +/* $Id: tstNoCrt-1.cpp $ */ /** @file * IPRT Testcase - Testcase for the No-CRT assembly bits. */ diff --git a/src/VBox/Runtime/testcase/tstOnce.cpp b/src/VBox/Runtime/testcase/tstOnce.cpp index 3861c8122..01292a60c 100644 --- a/src/VBox/Runtime/testcase/tstOnce.cpp +++ b/src/VBox/Runtime/testcase/tstOnce.cpp @@ -1,4 +1,4 @@ -/* $Id: tstOnce.cpp 10947 2008-07-29 18:27:35Z vboxsync $ */ +/* $Id: tstOnce.cpp $ */ /** @file * IPRT Testcase - RTOnce. */ diff --git a/src/VBox/Runtime/testcase/tstPath.cpp b/src/VBox/Runtime/testcase/tstPath.cpp index a8d9f6703..0fcce515b 100644 --- a/src/VBox/Runtime/testcase/tstPath.cpp +++ b/src/VBox/Runtime/testcase/tstPath.cpp @@ -1,4 +1,4 @@ -/* $Id: tstPath.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstPath.cpp $ */ /** @file * IPRT Testcase - Test various path functions. */ diff --git a/src/VBox/Runtime/testcase/tstPrfRT.cpp b/src/VBox/Runtime/testcase/tstPrfRT.cpp index 7004b5f90..84de031c2 100644 --- a/src/VBox/Runtime/testcase/tstPrfRT.cpp +++ b/src/VBox/Runtime/testcase/tstPrfRT.cpp @@ -1,4 +1,4 @@ -/* $Id: tstPrfRT.cpp 19308 2009-05-03 19:24:41Z vboxsync $ */ +/* $Id: tstPrfRT.cpp $ */ /** @file * IPRT testcase - profile some of the important functions. */ diff --git a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp index 914a13e63..0e46065c5 100644 --- a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp +++ b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp @@ -1,4 +1,4 @@ -/* $Id: tstR0ThreadPreemption.cpp 19970 2009-05-24 16:22:00Z vboxsync $ */ +/* $Id: tstR0ThreadPreemption.cpp $ */ /** @file * IPRT R0 Testcase - Thread Preemption. */ diff --git a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h index 048658931..d0aecc364 100644 --- a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h +++ b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h @@ -1,4 +1,4 @@ -/* $Id: tstR0ThreadPreemption.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: tstR0ThreadPreemption.h $ */ /** @file * IPRT R0 Testcase - Thread Preemption, common header. */ diff --git a/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp b/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp index dc6fcc687..a4da0def1 100644 --- a/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp +++ b/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp @@ -1,4 +1,4 @@ -/* $Id: tstR0ThreadPreemptionDriver.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstR0ThreadPreemptionDriver.cpp $ */ /** @file * IPRT R0 Testcase - Thread Preemption, driver program. */ diff --git a/src/VBox/Runtime/testcase/tstRTAvl.cpp b/src/VBox/Runtime/testcase/tstRTAvl.cpp index 2af0a98b5..20d8c16de 100644 --- a/src/VBox/Runtime/testcase/tstRTAvl.cpp +++ b/src/VBox/Runtime/testcase/tstRTAvl.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTAvl.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstRTAvl.cpp $ */ /** @file * IPRT Testcase - AVL trees. */ diff --git a/src/VBox/Runtime/testcase/tstRTBase64.cpp b/src/VBox/Runtime/testcase/tstRTBase64.cpp index 332cfe652..ab85111c9 100644 --- a/src/VBox/Runtime/testcase/tstRTBase64.cpp +++ b/src/VBox/Runtime/testcase/tstRTBase64.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTBase64.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstRTBase64.cpp $ */ /** @file * IPRT Testcase - Base64. */ diff --git a/src/VBox/Runtime/testcase/tstRTBitOperations.cpp b/src/VBox/Runtime/testcase/tstRTBitOperations.cpp index 48292ff01..bafaba79a 100644 --- a/src/VBox/Runtime/testcase/tstRTBitOperations.cpp +++ b/src/VBox/Runtime/testcase/tstRTBitOperations.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTBitOperations.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstRTBitOperations.cpp $ */ /** @file * IPRT Testcase - Inlined Bit Operations. */ diff --git a/src/VBox/Runtime/testcase/tstRTCidr.cpp b/src/VBox/Runtime/testcase/tstRTCidr.cpp index 0349fca7c..26b99b512 100644 --- a/src/VBox/Runtime/testcase/tstRTCidr.cpp +++ b/src/VBox/Runtime/testcase/tstRTCidr.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTCidr.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstRTCidr.cpp $ */ /** @file * IPRT Testcase - IPv4. */ diff --git a/src/VBox/Runtime/testcase/tstRTCritSect.cpp b/src/VBox/Runtime/testcase/tstRTCritSect.cpp index b0e0b6aea..b2d7b5a4d 100644 --- a/src/VBox/Runtime/testcase/tstRTCritSect.cpp +++ b/src/VBox/Runtime/testcase/tstRTCritSect.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTCritSect.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstRTCritSect.cpp $ */ /** @file * IPRT Testcase - Critical Sections. */ diff --git a/src/VBox/Runtime/testcase/tstRTFsQueries.cpp b/src/VBox/Runtime/testcase/tstRTFsQueries.cpp index f13b7514b..7c5da1d14 100644 --- a/src/VBox/Runtime/testcase/tstRTFsQueries.cpp +++ b/src/VBox/Runtime/testcase/tstRTFsQueries.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTFsQueries.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstRTFsQueries.cpp $ */ /** @file * IPRT Testcase - RTFs Queries.. */ diff --git a/src/VBox/Runtime/testcase/tstRTMemPool.cpp b/src/VBox/Runtime/testcase/tstRTMemPool.cpp index c9530cb0a..c64857337 100644 --- a/src/VBox/Runtime/testcase/tstRTMemPool.cpp +++ b/src/VBox/Runtime/testcase/tstRTMemPool.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTMemPool.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstRTMemPool.cpp $ */ /** @file * IPRT Testcase - MemPool. */ diff --git a/src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp b/src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp index e78eb8549..e35b64661 100644 --- a/src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp +++ b/src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTProcIsRunningByName.cpp 17018 2009-02-23 13:27:43Z vboxsync $ */ +/* $Id: tstRTProcIsRunningByName.cpp $ */ /** @file * IPRT Testcase - RTProcIsRunningByName */ diff --git a/src/VBox/Runtime/testcase/tstRTProcWait.cpp b/src/VBox/Runtime/testcase/tstRTProcWait.cpp index 00e09cb7e..34fa5673a 100644 --- a/src/VBox/Runtime/testcase/tstRTProcWait.cpp +++ b/src/VBox/Runtime/testcase/tstRTProcWait.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTProcWait.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstRTProcWait.cpp $ */ /** @file * IPRT Testcase - RTProcWait. */ diff --git a/src/VBox/Runtime/testcase/tstRTS3.cpp b/src/VBox/Runtime/testcase/tstRTS3.cpp index 4e0cd5745..ad0ceb1dc 100644 --- a/src/VBox/Runtime/testcase/tstRTS3.cpp +++ b/src/VBox/Runtime/testcase/tstRTS3.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTS3.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstRTS3.cpp $ */ /** @file * IPRT Testcase - Simple Storage Service (S3) Communication API */ diff --git a/src/VBox/Runtime/testcase/tstRTStrCache.cpp b/src/VBox/Runtime/testcase/tstRTStrCache.cpp index 181d8163f..2d355feac 100644 --- a/src/VBox/Runtime/testcase/tstRTStrCache.cpp +++ b/src/VBox/Runtime/testcase/tstRTStrCache.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTStrCache.cpp 20647 2009-06-16 21:58:09Z vboxsync $ */ +/* $Id: tstRTStrCache.cpp $ */ /** @file * IPRT Testcase - StrCache. */ diff --git a/src/VBox/Runtime/testcase/tstRTTemp.cpp b/src/VBox/Runtime/testcase/tstRTTemp.cpp index d9297075a..e410c637d 100644 --- a/src/VBox/Runtime/testcase/tstRTTemp.cpp +++ b/src/VBox/Runtime/testcase/tstRTTemp.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRTTemp.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstRTTemp.cpp $ */ /** @file * IPRT Testcase - Temporary files and directories. */ diff --git a/src/VBox/Runtime/testcase/tstRand.cpp b/src/VBox/Runtime/testcase/tstRand.cpp index 1e4fa384d..fa63d71f0 100644 --- a/src/VBox/Runtime/testcase/tstRand.cpp +++ b/src/VBox/Runtime/testcase/tstRand.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRand.cpp 18455 2009-03-28 04:45:00Z vboxsync $ */ +/* $Id: tstRand.cpp $ */ /** @file * IPRT - Testcase for the RTRand API. */ diff --git a/src/VBox/Runtime/testcase/tstSemMutex.cpp b/src/VBox/Runtime/testcase/tstSemMutex.cpp index 2e1e82761..906cd0802 100644 --- a/src/VBox/Runtime/testcase/tstSemMutex.cpp +++ b/src/VBox/Runtime/testcase/tstSemMutex.cpp @@ -1,4 +1,4 @@ -/* $Id: tstSemMutex.cpp 20442 2009-06-09 14:38:55Z vboxsync $ */ +/* $Id: tstSemMutex.cpp $ */ /** @file * IPRT Testcase - Simple Mutex Semaphore Smoke Test. */ diff --git a/src/VBox/Runtime/testcase/tstSemPingPong.cpp b/src/VBox/Runtime/testcase/tstSemPingPong.cpp index 9b1556f25..19f630714 100644 --- a/src/VBox/Runtime/testcase/tstSemPingPong.cpp +++ b/src/VBox/Runtime/testcase/tstSemPingPong.cpp @@ -1,4 +1,4 @@ -/* $Id: tstSemPingPong.cpp 12874 2008-10-01 20:09:09Z vboxsync $ */ +/* $Id: tstSemPingPong.cpp $ */ /** @file * IPRT Testcase - RTSemPing/RTSemPong. */ diff --git a/src/VBox/Runtime/testcase/tstSemRW.cpp b/src/VBox/Runtime/testcase/tstSemRW.cpp index 815a1ba2f..f6513f9bc 100644 --- a/src/VBox/Runtime/testcase/tstSemRW.cpp +++ b/src/VBox/Runtime/testcase/tstSemRW.cpp @@ -1,4 +1,4 @@ -/* $Id: tstSemRW.cpp 20597 2009-06-15 17:54:06Z vboxsync $ */ +/* $Id: tstSemRW.cpp $ */ /** @file * IPRT Testcase - Reader/Writer Semaphore Test. */ diff --git a/src/VBox/Runtime/testcase/tstSems.cpp b/src/VBox/Runtime/testcase/tstSems.cpp index 133f92328..a59adba8b 100644 --- a/src/VBox/Runtime/testcase/tstSems.cpp +++ b/src/VBox/Runtime/testcase/tstSems.cpp @@ -1,4 +1,4 @@ -/* $Id: tstSems.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: tstSems.cpp $ */ /** @file * IPRT Testcase - Simple Semaphore Smoke Test. */ diff --git a/src/VBox/Runtime/testcase/tstStrFormat.cpp b/src/VBox/Runtime/testcase/tstStrFormat.cpp index e1c56689f..533fccb97 100644 --- a/src/VBox/Runtime/testcase/tstStrFormat.cpp +++ b/src/VBox/Runtime/testcase/tstStrFormat.cpp @@ -1,4 +1,4 @@ -/* $Id: tstStrFormat.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstStrFormat.cpp $ */ /** @file * IPRT Testcase - String formatting. */ diff --git a/src/VBox/Runtime/testcase/tstStrSimplePattern.cpp b/src/VBox/Runtime/testcase/tstStrSimplePattern.cpp index d3b283a69..42278a789 100644 --- a/src/VBox/Runtime/testcase/tstStrSimplePattern.cpp +++ b/src/VBox/Runtime/testcase/tstStrSimplePattern.cpp @@ -1,4 +1,4 @@ -/* $Id: tstStrSimplePattern.cpp 13472 2008-10-22 09:19:00Z vboxsync $ */ +/* $Id: tstStrSimplePattern.cpp $ */ /** @file * IPRT Testcase - RTStrSimplePattern. */ diff --git a/src/VBox/Runtime/testcase/tstStrToNum.cpp b/src/VBox/Runtime/testcase/tstStrToNum.cpp index 7d7a0c9f8..5a5cff467 100644 --- a/src/VBox/Runtime/testcase/tstStrToNum.cpp +++ b/src/VBox/Runtime/testcase/tstStrToNum.cpp @@ -1,4 +1,4 @@ -/* $Id: tstStrToNum.cpp 13837 2008-11-05 02:54:02Z vboxsync $ */ +/* $Id: tstStrToNum.cpp $ */ /** @file * IPRT Testcase - String To Number Conversion. */ diff --git a/src/VBox/Runtime/testcase/tstSystemQueryOsInfo.cpp b/src/VBox/Runtime/testcase/tstSystemQueryOsInfo.cpp index 49a964b3e..3ddb735e8 100644 --- a/src/VBox/Runtime/testcase/tstSystemQueryOsInfo.cpp +++ b/src/VBox/Runtime/testcase/tstSystemQueryOsInfo.cpp @@ -1,4 +1,4 @@ -/* $Id: tstSystemQueryOsInfo.cpp 11822 2008-08-29 14:21:03Z vboxsync $ */ +/* $Id: tstSystemQueryOsInfo.cpp $ */ /** @file * IPRT Testcase - RTSystemQueryOSInfo. */ diff --git a/src/VBox/Runtime/testcase/tstTSC.cpp b/src/VBox/Runtime/testcase/tstTSC.cpp index 37c601378..901213c19 100644 --- a/src/VBox/Runtime/testcase/tstTSC.cpp +++ b/src/VBox/Runtime/testcase/tstTSC.cpp @@ -1,4 +1,4 @@ -/* $Id: tstTSC.cpp 17093 2009-02-24 19:58:09Z vboxsync $ */ +/* $Id: tstTSC.cpp $ */ /** @file * IPRT Testcase - SMP TSC testcase. */ diff --git a/src/VBox/Runtime/testcase/tstTermCallbacks.cpp b/src/VBox/Runtime/testcase/tstTermCallbacks.cpp index d7f83dfe9..a7aac38c2 100644 --- a/src/VBox/Runtime/testcase/tstTermCallbacks.cpp +++ b/src/VBox/Runtime/testcase/tstTermCallbacks.cpp @@ -1,4 +1,4 @@ -/* $Id: tstTermCallbacks.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstTermCallbacks.cpp $ */ /** @file * IPRT Testcase - Termination Callbacks. */ diff --git a/src/VBox/Runtime/testcase/tstThread-1.cpp b/src/VBox/Runtime/testcase/tstThread-1.cpp index 64889fc89..a1791b68d 100644 --- a/src/VBox/Runtime/testcase/tstThread-1.cpp +++ b/src/VBox/Runtime/testcase/tstThread-1.cpp @@ -1,4 +1,4 @@ -/* $Id: tstThread-1.cpp 11822 2008-08-29 14:21:03Z vboxsync $ */ +/* $Id: tstThread-1.cpp $ */ /** @file * IPRT Testcase - Thread Testcase no.1. */ diff --git a/src/VBox/Runtime/testcase/tstTime-2.cpp b/src/VBox/Runtime/testcase/tstTime-2.cpp index b914add26..cabf1e678 100644 --- a/src/VBox/Runtime/testcase/tstTime-2.cpp +++ b/src/VBox/Runtime/testcase/tstTime-2.cpp @@ -1,4 +1,4 @@ -/* $Id: tstTime-2.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstTime-2.cpp $ */ /** @file * IPRT Testcase - Simple RTTime test. */ diff --git a/src/VBox/Runtime/testcase/tstTime-3.cpp b/src/VBox/Runtime/testcase/tstTime-3.cpp index 6eb3a9ac4..6df3a5c92 100644 --- a/src/VBox/Runtime/testcase/tstTime-3.cpp +++ b/src/VBox/Runtime/testcase/tstTime-3.cpp @@ -1,4 +1,4 @@ -/* $Id: tstTime-3.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstTime-3.cpp $ */ /** @file * IPRT Testcase - Simple RTTime test. */ diff --git a/src/VBox/Runtime/testcase/tstTime-4.cpp b/src/VBox/Runtime/testcase/tstTime-4.cpp index 015afa246..99053ce18 100644 --- a/src/VBox/Runtime/testcase/tstTime-4.cpp +++ b/src/VBox/Runtime/testcase/tstTime-4.cpp @@ -1,4 +1,4 @@ -/* $Id: tstTime-4.cpp 11822 2008-08-29 14:21:03Z vboxsync $ */ +/* $Id: tstTime-4.cpp $ */ /** @file * IPRT Testcase - Simple RTTime vs. RTTimeSystem test. */ diff --git a/src/VBox/Runtime/testcase/tstTime.cpp b/src/VBox/Runtime/testcase/tstTime.cpp index e77438e66..c608fde04 100644 --- a/src/VBox/Runtime/testcase/tstTime.cpp +++ b/src/VBox/Runtime/testcase/tstTime.cpp @@ -1,4 +1,4 @@ -/* $Id: tstTime.cpp 11822 2008-08-29 14:21:03Z vboxsync $ */ +/* $Id: tstTime.cpp $ */ /** @file * IPRT Testcase - Simple RTTime tests. */ diff --git a/src/VBox/Runtime/testcase/tstTimeSpec.cpp b/src/VBox/Runtime/testcase/tstTimeSpec.cpp index 28ffd41fc..c3b13138a 100644 --- a/src/VBox/Runtime/testcase/tstTimeSpec.cpp +++ b/src/VBox/Runtime/testcase/tstTimeSpec.cpp @@ -1,4 +1,4 @@ -/* $Id: tstTimeSpec.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: tstTimeSpec.cpp $ */ /** @file * IPRT - RTTimeSpec and PRTTIME tests. */ diff --git a/src/VBox/Runtime/testcase/tstTimer.cpp b/src/VBox/Runtime/testcase/tstTimer.cpp index a91e17cdf..03a16f3f9 100644 --- a/src/VBox/Runtime/testcase/tstTimer.cpp +++ b/src/VBox/Runtime/testcase/tstTimer.cpp @@ -1,4 +1,4 @@ -/* $Id: tstTimer.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstTimer.cpp $ */ /** @file * IPRT Testcase - Timers. */ diff --git a/src/VBox/Runtime/testcase/tstTimerLR.cpp b/src/VBox/Runtime/testcase/tstTimerLR.cpp index 5bf2ec28a..68b47e23c 100644 --- a/src/VBox/Runtime/testcase/tstTimerLR.cpp +++ b/src/VBox/Runtime/testcase/tstTimerLR.cpp @@ -1,4 +1,4 @@ -/* $Id: tstTimerLR.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */ +/* $Id: tstTimerLR.cpp $ */ /** @file * IPRT Testcase - Low Resolution Timers. */ diff --git a/src/VBox/Runtime/testcase/tstUtf8.cpp b/src/VBox/Runtime/testcase/tstUtf8.cpp index 554c0a1c4..338740e6a 100644 --- a/src/VBox/Runtime/testcase/tstUtf8.cpp +++ b/src/VBox/Runtime/testcase/tstUtf8.cpp @@ -1,4 +1,4 @@ -/* $Id: tstUtf8.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstUtf8.cpp $ */ /** @file * IPRT Testcase - UTF-8 and UTF-16 string conversions. */ diff --git a/src/VBox/Runtime/testcase/tstUuid.cpp b/src/VBox/Runtime/testcase/tstUuid.cpp index 973edf4cc..d24d1461d 100644 --- a/src/VBox/Runtime/testcase/tstUuid.cpp +++ b/src/VBox/Runtime/testcase/tstUuid.cpp @@ -1,4 +1,4 @@ -/* $Id: tstUuid.cpp 20606 2009-06-15 23:49:07Z vboxsync $ */ +/* $Id: tstUuid.cpp $ */ /** @file * IPRT Testcase - UUID. */ diff --git a/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp b/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp index b17cdb0e3..857b7ab31 100644 --- a/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp +++ b/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp @@ -1,4 +1,4 @@ -/* $Id: RTErrConvertFromWin32.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: RTErrConvertFromWin32.cpp $ */ /** @file * IPRT - Convert win32 error codes to iprt status codes. */ diff --git a/src/VBox/Runtime/win/errmsgwin.cpp b/src/VBox/Runtime/win/errmsgwin.cpp index 6c965c856..09e175862 100644 --- a/src/VBox/Runtime/win/errmsgwin.cpp +++ b/src/VBox/Runtime/win/errmsgwin.cpp @@ -1,4 +1,4 @@ -/* $Id: errmsgwin.cpp 14626 2008-11-26 10:01:53Z vboxsync $ */ +/* $Id: errmsgwin.cpp $ */ /** @file * IPRT - Status code messages. */ diff --git a/src/VBox/VMM/CFGM.cpp b/src/VBox/VMM/CFGM.cpp index b22e44e6a..8ff7d9511 100644 --- a/src/VBox/VMM/CFGM.cpp +++ b/src/VBox/VMM/CFGM.cpp @@ -1,4 +1,4 @@ -/* $Id: CFGM.cpp 19466 2009-05-07 00:22:56Z vboxsync $ */ +/* $Id: CFGM.cpp $ */ /** @file * CFGM - Configuration Manager. */ diff --git a/src/VBox/VMM/CFGMInternal.h b/src/VBox/VMM/CFGMInternal.h index 1f98fe483..e1ab20c21 100644 --- a/src/VBox/VMM/CFGMInternal.h +++ b/src/VBox/VMM/CFGMInternal.h @@ -1,4 +1,4 @@ -/* $Id: CFGMInternal.h 14070 2008-11-10 23:45:24Z vboxsync $ */ +/* $Id: CFGMInternal.h $ */ /** @file * CFGM - Internal header file. */ diff --git a/src/VBox/VMM/CPUM.cpp b/src/VBox/VMM/CPUM.cpp index 57a8540a1..bf8b1fb12 100644 --- a/src/VBox/VMM/CPUM.cpp +++ b/src/VBox/VMM/CPUM.cpp @@ -1,4 +1,4 @@ -/* $Id: CPUM.cpp 20917 2009-06-25 09:24:06Z vboxsync $ */ +/* $Id: CPUM.cpp $ */ /** @file * CPUM - CPU Monitor / Manager. */ diff --git a/src/VBox/VMM/CPUMInternal.h b/src/VBox/VMM/CPUMInternal.h index 06f0f2171..356b0fd4d 100644 --- a/src/VBox/VMM/CPUMInternal.h +++ b/src/VBox/VMM/CPUMInternal.h @@ -1,4 +1,4 @@ -/* $Id: CPUMInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: CPUMInternal.h $ */ /** @file * CPUM - Internal header file. */ diff --git a/src/VBox/VMM/CPUMInternal.mac b/src/VBox/VMM/CPUMInternal.mac index f541cf93e..e5f8774a8 100644 --- a/src/VBox/VMM/CPUMInternal.mac +++ b/src/VBox/VMM/CPUMInternal.mac @@ -1,4 +1,4 @@ -; $Id: CPUMInternal.mac 18927 2009-04-16 11:41:38Z vboxsync $ +; $Id: CPUMInternal.mac $ ;; @file ; CPUM - Internal header file (asm). ; diff --git a/src/VBox/VMM/DBGF.cpp b/src/VBox/VMM/DBGF.cpp index bc94cbda3..0430aaa69 100644 --- a/src/VBox/VMM/DBGF.cpp +++ b/src/VBox/VMM/DBGF.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGF.cpp 20664 2009-06-17 12:48:15Z vboxsync $ */ +/* $Id: DBGF.cpp $ */ /** @file * DBGF - Debugger Facility. */ @@ -296,7 +296,7 @@ VMMR3DECL(int) DBGFR3VMMForcedAction(PVM pVM) { int rc = VINF_SUCCESS; - if (VM_FF_TESTANDCLEAR(pVM, VM_FF_DBGF_BIT)) + if (VM_FF_TESTANDCLEAR(pVM, VM_FF_DBGF)) { PVMCPU pVCpu = VMMGetCpu(pVM); diff --git a/src/VBox/VMM/DBGFAddr.cpp b/src/VBox/VMM/DBGFAddr.cpp index e7da8140e..2b291c6da 100644 --- a/src/VBox/VMM/DBGFAddr.cpp +++ b/src/VBox/VMM/DBGFAddr.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFAddr.cpp 19463 2009-05-06 20:30:57Z vboxsync $ */ +/* $Id: DBGFAddr.cpp $ */ /** @file * DBGF - Debugger Facility, Mixed Address Methods. */ diff --git a/src/VBox/VMM/DBGFAddrSpace.cpp b/src/VBox/VMM/DBGFAddrSpace.cpp index 392e661e6..f16af7427 100644 --- a/src/VBox/VMM/DBGFAddrSpace.cpp +++ b/src/VBox/VMM/DBGFAddrSpace.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFAddrSpace.cpp 20353 2009-06-07 09:09:56Z vboxsync $ */ +/* $Id: DBGFAddrSpace.cpp $ */ /** @file * DBGF - Debugger Facility, Address Space Management. */ diff --git a/src/VBox/VMM/DBGFBp.cpp b/src/VBox/VMM/DBGFBp.cpp index d6c294906..2de1d04df 100644 --- a/src/VBox/VMM/DBGFBp.cpp +++ b/src/VBox/VMM/DBGFBp.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFBp.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: DBGFBp.cpp $ */ /** @file * DBGF - Debugger Facility, Breakpoint Management. */ diff --git a/src/VBox/VMM/DBGFDisas.cpp b/src/VBox/VMM/DBGFDisas.cpp index e8c377b33..6d7c6cc6e 100644 --- a/src/VBox/VMM/DBGFDisas.cpp +++ b/src/VBox/VMM/DBGFDisas.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFDisas.cpp 19642 2009-05-12 15:27:05Z vboxsync $ */ +/* $Id: DBGFDisas.cpp $ */ /** @file * DBGF - Debugger Facility, Disassembler. */ diff --git a/src/VBox/VMM/DBGFInfo.cpp b/src/VBox/VMM/DBGFInfo.cpp index bee1d9a9e..6fb413634 100644 --- a/src/VBox/VMM/DBGFInfo.cpp +++ b/src/VBox/VMM/DBGFInfo.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFInfo.cpp 20152 2009-05-29 13:22:06Z vboxsync $ */ +/* $Id: DBGFInfo.cpp $ */ /** @file * DBGF - Debugger Facility, Info. */ diff --git a/src/VBox/VMM/DBGFInternal.h b/src/VBox/VMM/DBGFInternal.h index a0e826dd0..0838dddcf 100644 --- a/src/VBox/VMM/DBGFInternal.h +++ b/src/VBox/VMM/DBGFInternal.h @@ -1,4 +1,4 @@ -/* $Id: DBGFInternal.h 19757 2009-05-15 23:37:31Z vboxsync $ */ +/* $Id: DBGFInternal.h $ */ /** @file * DBGF - Internal header file. */ diff --git a/src/VBox/VMM/DBGFLog.cpp b/src/VBox/VMM/DBGFLog.cpp index 6503be4d6..7586fe0a9 100644 --- a/src/VBox/VMM/DBGFLog.cpp +++ b/src/VBox/VMM/DBGFLog.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFLog.cpp 19300 2009-05-01 18:06:59Z vboxsync $ */ +/* $Id: DBGFLog.cpp $ */ /** @file * DBGF - Debugger Facility, Log Manager. */ diff --git a/src/VBox/VMM/DBGFMem.cpp b/src/VBox/VMM/DBGFMem.cpp index 284de6fd3..f7d466178 100644 --- a/src/VBox/VMM/DBGFMem.cpp +++ b/src/VBox/VMM/DBGFMem.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFMem.cpp 20868 2009-06-24 00:10:55Z vboxsync $ */ +/* $Id: DBGFMem.cpp $ */ /** @file * DBGF - Debugger Facility, Memory Methods. */ diff --git a/src/VBox/VMM/DBGFModule.cpp b/src/VBox/VMM/DBGFModule.cpp index f19e57fd5..c5aafce10 100644 --- a/src/VBox/VMM/DBGFModule.cpp +++ b/src/VBox/VMM/DBGFModule.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFModule.cpp 19757 2009-05-15 23:37:31Z vboxsync $ */ +/* $Id: DBGFModule.cpp $ */ /** @file * DBGF - Debugger Facility, Module & Segment Management. */ diff --git a/src/VBox/VMM/DBGFOS.cpp b/src/VBox/VMM/DBGFOS.cpp index 78b1a138a..93d59a56a 100644 --- a/src/VBox/VMM/DBGFOS.cpp +++ b/src/VBox/VMM/DBGFOS.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFOS.cpp 19300 2009-05-01 18:06:59Z vboxsync $ */ +/* $Id: DBGFOS.cpp $ */ /** @file * DBGF - Debugger Facility, Guest OS Diggers. */ diff --git a/src/VBox/VMM/DBGFStack.cpp b/src/VBox/VMM/DBGFStack.cpp index e5daac8d1..8d9e8644e 100644 --- a/src/VBox/VMM/DBGFStack.cpp +++ b/src/VBox/VMM/DBGFStack.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFStack.cpp 19710 2009-05-14 18:05:41Z vboxsync $ */ +/* $Id: DBGFStack.cpp $ */ /** @file * DBGF - Debugger Facility, Call Stack Analyser. */ diff --git a/src/VBox/VMM/DBGFSym.cpp b/src/VBox/VMM/DBGFSym.cpp index 133a296c6..76cbd684f 100644 --- a/src/VBox/VMM/DBGFSym.cpp +++ b/src/VBox/VMM/DBGFSym.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFSym.cpp 20870 2009-06-24 00:30:16Z vboxsync $ */ +/* $Id: DBGFSym.cpp $ */ /** @file * DBGF - Debugger Facility, Symbol Management. */ diff --git a/src/VBox/VMM/EM.cpp b/src/VBox/VMM/EM.cpp index ef393b4f8..4524bdfbd 100644 --- a/src/VBox/VMM/EM.cpp +++ b/src/VBox/VMM/EM.cpp @@ -1,4 +1,4 @@ -/* $Id: EM.cpp 20871 2009-06-24 01:56:19Z vboxsync $ */ +/* $Id: EM.cpp $ */ /** @file * EM - Execution Monitor / Manager. */ @@ -3353,7 +3353,7 @@ static int emR3ForcedActions(PVM pVM, PVMCPU pVCpu, int rc) /* * Postponed reset request. */ - if (VM_FF_TESTANDCLEAR(pVM, VM_FF_RESET_BIT)) + if (VM_FF_TESTANDCLEAR(pVM, VM_FF_RESET)) { rc2 = VMR3Reset(pVM); UPDATE_RC(); @@ -3842,7 +3842,8 @@ VMMR3DECL(int) EMR3ExecuteVM(PVM pVM, PVMCPU pVCpu) case VINF_EM_TERMINATE: pVCpu->em.s.enmState = EMSTATE_TERMINATING; Log(("EMR3ExecuteVM returns VINF_EM_TERMINATE (%d -> %d)\n", pVCpu->em.s.enmState, EMSTATE_TERMINATING)); - TMR3NotifySuspend(pVM, pVCpu); + if (pVM->enmVMState < VMSTATE_DESTROYING) /* ugly */ + TMR3NotifySuspend(pVM, pVCpu); STAM_REL_PROFILE_ADV_STOP(&pVCpu->em.s.StatTotal, x); return rc; diff --git a/src/VBox/VMM/EMInternal.h b/src/VBox/VMM/EMInternal.h index 49897f5c0..b5b2d93e6 100644 --- a/src/VBox/VMM/EMInternal.h +++ b/src/VBox/VMM/EMInternal.h @@ -1,4 +1,4 @@ -/* $Id: EMInternal.h 20530 2009-06-13 20:53:44Z vboxsync $ */ +/* $Id: EMInternal.h $ */ /** @file * EM - Internal header file. */ diff --git a/src/VBox/VMM/GMM.cpp b/src/VBox/VMM/GMM.cpp index 1c67cf0fb..1e976eee1 100644 --- a/src/VBox/VMM/GMM.cpp +++ b/src/VBox/VMM/GMM.cpp @@ -1,4 +1,4 @@ -/* $Id: GMM.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: GMM.cpp $ */ /** @file * GMM - Global Memory Manager, ring-3 request wrappers. */ diff --git a/src/VBox/VMM/HWACCM.cpp b/src/VBox/VMM/HWACCM.cpp index b107de841..aff8289c0 100644 --- a/src/VBox/VMM/HWACCM.cpp +++ b/src/VBox/VMM/HWACCM.cpp @@ -1,4 +1,4 @@ -/* $Id: HWACCM.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: HWACCM.cpp $ */ /** @file * HWACCM - Intel/AMD VM Hardware Support Manager */ diff --git a/src/VBox/VMM/HWACCMInternal.h b/src/VBox/VMM/HWACCMInternal.h index cb8d0d883..5ee3bcd25 100644 --- a/src/VBox/VMM/HWACCMInternal.h +++ b/src/VBox/VMM/HWACCMInternal.h @@ -1,4 +1,4 @@ -/* $Id: HWACCMInternal.h 21001 2009-06-26 23:18:11Z vboxsync $ */ +/* $Id: HWACCMInternal.h $ */ /** @file * HWACCM - Internal header file. */ diff --git a/src/VBox/VMM/IOM.cpp b/src/VBox/VMM/IOM.cpp index 685dec424..1ef9e52c8 100644 --- a/src/VBox/VMM/IOM.cpp +++ b/src/VBox/VMM/IOM.cpp @@ -1,4 +1,4 @@ -/* $Id: IOM.cpp 20776 2009-06-22 13:09:03Z vboxsync $ */ +/* $Id: IOM.cpp $ */ /** @file * IOM - Input / Output Monitor. */ diff --git a/src/VBox/VMM/IOMInternal.h b/src/VBox/VMM/IOMInternal.h index 184000c5b..c780af1cf 100644 --- a/src/VBox/VMM/IOMInternal.h +++ b/src/VBox/VMM/IOMInternal.h @@ -1,4 +1,4 @@ -/* $Id: IOMInternal.h 20722 2009-06-19 12:34:21Z vboxsync $ */ +/* $Id: IOMInternal.h $ */ /** @file * IOM - Internal header file. */ diff --git a/src/VBox/VMM/MM.cpp b/src/VBox/VMM/MM.cpp index 379022b7b..cd27217e0 100644 --- a/src/VBox/VMM/MM.cpp +++ b/src/VBox/VMM/MM.cpp @@ -1,4 +1,4 @@ -/* $Id: MM.cpp 19663 2009-05-13 15:06:00Z vboxsync $ */ +/* $Id: MM.cpp $ */ /** @file * MM - Memory Manager. */ diff --git a/src/VBox/VMM/MMHeap.cpp b/src/VBox/VMM/MMHeap.cpp index c3dfcbf41..85f2586af 100644 --- a/src/VBox/VMM/MMHeap.cpp +++ b/src/VBox/VMM/MMHeap.cpp @@ -1,4 +1,4 @@ -/* $Id: MMHeap.cpp 20774 2009-06-22 12:59:53Z vboxsync $ */ +/* $Id: MMHeap.cpp $ */ /** @file * MM - Memory Manager - Heap. */ diff --git a/src/VBox/VMM/MMHyper.cpp b/src/VBox/VMM/MMHyper.cpp index 388cae373..ba4f523ab 100644 --- a/src/VBox/VMM/MMHyper.cpp +++ b/src/VBox/VMM/MMHyper.cpp @@ -1,4 +1,4 @@ -/* $Id: MMHyper.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: MMHyper.cpp $ */ /** @file * MM - Memory Manager - Hypervisor Memory Area. */ diff --git a/src/VBox/VMM/MMInternal.h b/src/VBox/VMM/MMInternal.h index 779273fbb..e1cf704ec 100644 --- a/src/VBox/VMM/MMInternal.h +++ b/src/VBox/VMM/MMInternal.h @@ -1,4 +1,4 @@ -/* $Id: MMInternal.h 20866 2009-06-23 19:33:23Z vboxsync $ */ +/* $Id: MMInternal.h $ */ /** @file * MM - Internal header file. */ diff --git a/src/VBox/VMM/MMPagePool.cpp b/src/VBox/VMM/MMPagePool.cpp index 45c90b6e3..e233ba202 100644 --- a/src/VBox/VMM/MMPagePool.cpp +++ b/src/VBox/VMM/MMPagePool.cpp @@ -1,4 +1,4 @@ -/* $Id: MMPagePool.cpp 20866 2009-06-23 19:33:23Z vboxsync $ */ +/* $Id: MMPagePool.cpp $ */ /** @file * MM - Memory Manager - Page Pool. */ diff --git a/src/VBox/VMM/MMUkHeap.cpp b/src/VBox/VMM/MMUkHeap.cpp index d3d296510..2cba97e45 100644 --- a/src/VBox/VMM/MMUkHeap.cpp +++ b/src/VBox/VMM/MMUkHeap.cpp @@ -1,4 +1,4 @@ -/* $Id: MMUkHeap.cpp 20774 2009-06-22 12:59:53Z vboxsync $ */ +/* $Id: MMUkHeap.cpp $ */ /** @file * MM - Memory Manager - Ring-3 Heap with kernel accessible mapping. */ diff --git a/src/VBox/VMM/Makefile.kmk b/src/VBox/VMM/Makefile.kmk index 75fab2c37..fd376a6cc 100644 --- a/src/VBox/VMM/Makefile.kmk +++ b/src/VBox/VMM/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20998 2009-06-26 23:01:02Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for the VMM. # diff --git a/src/VBox/VMM/PATM/CSAM.cpp b/src/VBox/VMM/PATM/CSAM.cpp index a0237ac0a..92a00eb9e 100644 --- a/src/VBox/VMM/PATM/CSAM.cpp +++ b/src/VBox/VMM/PATM/CSAM.cpp @@ -1,4 +1,4 @@ -/* $Id: CSAM.cpp 20011 2009-05-25 19:31:11Z vboxsync $ */ +/* $Id: CSAM.cpp $ */ /** @file * CSAM - Guest OS Code Scanning and Analysis Manager */ @@ -720,8 +720,11 @@ static int CSAMR3AnalyseCallback(PVM pVM, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t * { uint32_t cbInstr = 0; uint32_t opsize = pCpu->opsize; + bool fCode32 = pPage->fCode32; - PATMR3AddHint(pVM, pCurInstrGC, (pPage->fCode32) ? PATMFL_CODE32 : 0); + Assert(fCode32); + + PATMR3AddHint(pVM, pCurInstrGC, (fCode32) ? PATMFL_CODE32 : 0); /* Make sure the instructions that follow the cli have not been encountered before. */ while (true) @@ -749,7 +752,7 @@ static int CSAMR3AnalyseCallback(PVM pVM, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t * } Assert(VALID_PTR(pCurInstrHC)); - cpu.mode = (pPage->fCode32) ? CPUMODE_32BIT : CPUMODE_16BIT; + cpu.mode = (fCode32) ? CPUMODE_32BIT : CPUMODE_16BIT; rc = CSAMR3DISInstr(pVM, &cpu, pCurInstrGC, pCurInstrHC, &opsize, NULL); Assert(RT_SUCCESS(rc)); if (RT_FAILURE(rc)) diff --git a/src/VBox/VMM/PATM/CSAMInternal.h b/src/VBox/VMM/PATM/CSAMInternal.h index 81ae562b9..7edee1836 100644 --- a/src/VBox/VMM/PATM/CSAMInternal.h +++ b/src/VBox/VMM/PATM/CSAMInternal.h @@ -1,4 +1,4 @@ -/* $Id: CSAMInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: CSAMInternal.h $ */ /** @file * CSAM - Internal header file. */ diff --git a/src/VBox/VMM/PATM/PATM.cpp b/src/VBox/VMM/PATM/PATM.cpp index 56932e203..6f739a9b6 100644 --- a/src/VBox/VMM/PATM/PATM.cpp +++ b/src/VBox/VMM/PATM/PATM.cpp @@ -1,4 +1,4 @@ -/* $Id: PATM.cpp 20011 2009-05-25 19:31:11Z vboxsync $ */ +/* $Id: PATM.cpp $ */ /** @file * PATM - Dynamic Guest OS Patching Manager * diff --git a/src/VBox/VMM/PATM/PATMA.asm b/src/VBox/VMM/PATM/PATMA.asm index a64590343..d7651ee22 100644 --- a/src/VBox/VMM/PATM/PATMA.asm +++ b/src/VBox/VMM/PATM/PATMA.asm @@ -1,4 +1,4 @@ -; $Id: PATMA.asm 19141 2009-04-23 13:52:18Z vboxsync $ +; $Id: PATMA.asm $ ;; @file ; PATM Assembly Routines. ; diff --git a/src/VBox/VMM/PATM/PATMA.h b/src/VBox/VMM/PATM/PATMA.h index d3f2b9367..6b381eae0 100644 --- a/src/VBox/VMM/PATM/PATMA.h +++ b/src/VBox/VMM/PATM/PATMA.h @@ -1,4 +1,4 @@ -/* $Id: PATMA.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: PATMA.h $ */ /** @file * PATM macros & definitions (identical to PATMA.mac!!) */ diff --git a/src/VBox/VMM/PATM/PATMA.mac b/src/VBox/VMM/PATM/PATMA.mac index e96ea7e97..cc91fe00d 100644 --- a/src/VBox/VMM/PATM/PATMA.mac +++ b/src/VBox/VMM/PATM/PATMA.mac @@ -1,4 +1,4 @@ -; $Id: PATMA.mac 8155 2008-04-18 15:16:47Z vboxsync $ +; $Id: PATMA.mac $ ;; @file ; PATM macros & definitions (identical to PATMA.h!!) ; diff --git a/src/VBox/VMM/PATM/PATMGuest.cpp b/src/VBox/VMM/PATM/PATMGuest.cpp index 2dd5ac45a..f987a1239 100644 --- a/src/VBox/VMM/PATM/PATMGuest.cpp +++ b/src/VBox/VMM/PATM/PATMGuest.cpp @@ -1,4 +1,4 @@ -/* $Id: PATMGuest.cpp 19418 2009-05-06 09:51:55Z vboxsync $ */ +/* $Id: PATMGuest.cpp $ */ /** @file * PATMGuest - Guest OS Patching Manager (non-generic) */ diff --git a/src/VBox/VMM/PATM/PATMInternal.h b/src/VBox/VMM/PATM/PATMInternal.h index 0eacab557..5212ff8a7 100644 --- a/src/VBox/VMM/PATM/PATMInternal.h +++ b/src/VBox/VMM/PATM/PATMInternal.h @@ -1,4 +1,4 @@ -/* $Id: PATMInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: PATMInternal.h $ */ /** @file * PATM - Internal header file. */ diff --git a/src/VBox/VMM/PATM/PATMPatch.cpp b/src/VBox/VMM/PATM/PATMPatch.cpp index 0f3882d76..376031c24 100644 --- a/src/VBox/VMM/PATM/PATMPatch.cpp +++ b/src/VBox/VMM/PATM/PATMPatch.cpp @@ -1,4 +1,4 @@ -/* $Id: PATMPatch.cpp 19141 2009-04-23 13:52:18Z vboxsync $ */ +/* $Id: PATMPatch.cpp $ */ /** @file * PATMPatch - Dynamic Guest OS Instruction patches * diff --git a/src/VBox/VMM/PATM/PATMPatch.h b/src/VBox/VMM/PATM/PATMPatch.h index ebae0f498..d718e3ccb 100644 --- a/src/VBox/VMM/PATM/PATMPatch.h +++ b/src/VBox/VMM/PATM/PATMPatch.h @@ -1,4 +1,4 @@ -/* $Id: PATMPatch.h 9228 2008-05-29 15:23:15Z vboxsync $ */ +/* $Id: PATMPatch.h $ */ /** @file * PATMPatch - Internal header file. */ diff --git a/src/VBox/VMM/PATM/PATMSSM.cpp b/src/VBox/VMM/PATM/PATMSSM.cpp index f613bd39f..06b7616a4 100644 --- a/src/VBox/VMM/PATM/PATMSSM.cpp +++ b/src/VBox/VMM/PATM/PATMSSM.cpp @@ -1,4 +1,4 @@ -/* $Id: PATMSSM.cpp 19144 2009-04-23 14:05:09Z vboxsync $ */ +/* $Id: PATMSSM.cpp $ */ /** @file * PATMSSM - Dynamic Guest OS Patching Manager; Save and load state * diff --git a/src/VBox/VMM/PATM/VMMAll/CSAMAll.cpp b/src/VBox/VMM/PATM/VMMAll/CSAMAll.cpp index c3e728ea3..27df3d952 100644 --- a/src/VBox/VMM/PATM/VMMAll/CSAMAll.cpp +++ b/src/VBox/VMM/PATM/VMMAll/CSAMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: CSAMAll.cpp 20011 2009-05-25 19:31:11Z vboxsync $ */ +/* $Id: CSAMAll.cpp $ */ /** @file * CSAM - Guest OS Code Scanning and Analysis Manager - Any Context */ diff --git a/src/VBox/VMM/PATM/VMMAll/PATMAll.cpp b/src/VBox/VMM/PATM/VMMAll/PATMAll.cpp index 910d8549f..22163a597 100644 --- a/src/VBox/VMM/PATM/VMMAll/PATMAll.cpp +++ b/src/VBox/VMM/PATM/VMMAll/PATMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: PATMAll.cpp 19259 2009-04-29 12:45:19Z vboxsync $ */ +/* $Id: PATMAll.cpp $ */ /** @file * PATM - The Patch Manager, all contexts. */ diff --git a/src/VBox/VMM/PATM/VMMGC/CSAMGC.cpp b/src/VBox/VMM/PATM/VMMGC/CSAMGC.cpp index 03f921116..2a7028fa4 100644 --- a/src/VBox/VMM/PATM/VMMGC/CSAMGC.cpp +++ b/src/VBox/VMM/PATM/VMMGC/CSAMGC.cpp @@ -1,4 +1,4 @@ -/* $Id: CSAMGC.cpp 19141 2009-04-23 13:52:18Z vboxsync $ */ +/* $Id: CSAMGC.cpp $ */ /** @file * CSAM - Guest OS Code Scanning and Analysis Manager - Any Context */ diff --git a/src/VBox/VMM/PATM/VMMGC/PATMGC.cpp b/src/VBox/VMM/PATM/VMMGC/PATMGC.cpp index a67c108bb..340992359 100644 --- a/src/VBox/VMM/PATM/VMMGC/PATMGC.cpp +++ b/src/VBox/VMM/PATM/VMMGC/PATMGC.cpp @@ -1,4 +1,4 @@ -/* $Id: PATMGC.cpp 18927 2009-04-16 11:41:38Z vboxsync $ */ +/* $Id: PATMGC.cpp $ */ /** @file * PATM - Dynamic Guest OS Patching Manager - Guest Context */ diff --git a/src/VBox/VMM/PDM.cpp b/src/VBox/VMM/PDM.cpp index b114817d5..ad09fbae0 100644 --- a/src/VBox/VMM/PDM.cpp +++ b/src/VBox/VMM/PDM.cpp @@ -1,4 +1,4 @@ -/* $Id: PDM.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: PDM.cpp $ */ /** @file * PDM - Pluggable Device Manager. */ @@ -1366,7 +1366,7 @@ VMMR3DECL(void) PDMR3DmaRun(PVM pVM) if (VMMGetCpuId(pVM) != 0) return; - if (VM_FF_TESTANDCLEAR(pVM, VM_FF_PDM_DMA_BIT)) + if (VM_FF_TESTANDCLEAR(pVM, VM_FF_PDM_DMA)) { if (pVM->pdm.s.pDmac) { diff --git a/src/VBox/VMM/PDMAsyncCompletion.cpp b/src/VBox/VMM/PDMAsyncCompletion.cpp index d7717e863..b040932e8 100644 --- a/src/VBox/VMM/PDMAsyncCompletion.cpp +++ b/src/VBox/VMM/PDMAsyncCompletion.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMAsyncCompletion.cpp 20187 2009-06-02 12:39:15Z vboxsync $ */ +/* $Id: PDMAsyncCompletion.cpp $ */ /** @file * PDM Async I/O - Transport data asynchronous in R3 using EMT. */ diff --git a/src/VBox/VMM/PDMAsyncCompletionFile.cpp b/src/VBox/VMM/PDMAsyncCompletionFile.cpp index dba707b4b..6f36e6ee4 100644 --- a/src/VBox/VMM/PDMAsyncCompletionFile.cpp +++ b/src/VBox/VMM/PDMAsyncCompletionFile.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMAsyncCompletionFile.cpp 20168 2009-06-01 20:31:31Z vboxsync $ */ +/* $Id: PDMAsyncCompletionFile.cpp $ */ /** @file * PDM Async I/O - Transport data asynchronous in R3 using EMT. */ diff --git a/src/VBox/VMM/PDMAsyncCompletionInternal.h b/src/VBox/VMM/PDMAsyncCompletionInternal.h index b844ff753..f20b8673b 100644 --- a/src/VBox/VMM/PDMAsyncCompletionInternal.h +++ b/src/VBox/VMM/PDMAsyncCompletionInternal.h @@ -1,4 +1,4 @@ -/* $Id: PDMAsyncCompletionInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: PDMAsyncCompletionInternal.h $ */ /** @file * PDM - Pluggable Device Manager, Async I/O Completion internal header. */ diff --git a/src/VBox/VMM/PDMCritSect.cpp b/src/VBox/VMM/PDMCritSect.cpp index f2b3b4b26..f877f310c 100644 --- a/src/VBox/VMM/PDMCritSect.cpp +++ b/src/VBox/VMM/PDMCritSect.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMCritSect.cpp 20753 2009-06-21 23:11:24Z vboxsync $ */ +/* $Id: PDMCritSect.cpp $ */ /** @file * PDM - Critical Sections, Ring-3. */ diff --git a/src/VBox/VMM/PDMDevHlp.cpp b/src/VBox/VMM/PDMDevHlp.cpp index 9c6ec81f4..898d4afef 100644 --- a/src/VBox/VMM/PDMDevHlp.cpp +++ b/src/VBox/VMM/PDMDevHlp.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMDevHlp.cpp 20927 2009-06-25 11:41:35Z vboxsync $ */ +/* $Id: PDMDevHlp.cpp $ */ /** @file * PDM - Pluggable Device and Driver Manager, Device Helpers. */ diff --git a/src/VBox/VMM/PDMDevMiscHlp.cpp b/src/VBox/VMM/PDMDevMiscHlp.cpp index 2ef95c081..5ac917f75 100644 --- a/src/VBox/VMM/PDMDevMiscHlp.cpp +++ b/src/VBox/VMM/PDMDevMiscHlp.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMDevMiscHlp.cpp 20902 2009-06-24 18:26:25Z vboxsync $ */ +/* $Id: PDMDevMiscHlp.cpp $ */ /** @file * PDM - Pluggable Device and Driver Manager, Misc. Device Helpers. */ diff --git a/src/VBox/VMM/PDMDevice.cpp b/src/VBox/VMM/PDMDevice.cpp index 4ea247201..bed99ea4e 100644 --- a/src/VBox/VMM/PDMDevice.cpp +++ b/src/VBox/VMM/PDMDevice.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMDevice.cpp 14299 2008-11-18 13:25:40Z vboxsync $ */ +/* $Id: PDMDevice.cpp $ */ /** @file * PDM - Pluggable Device and Driver Manager, Device parts. */ diff --git a/src/VBox/VMM/PDMDriver.cpp b/src/VBox/VMM/PDMDriver.cpp index 4ba44b70b..4354c3e97 100644 --- a/src/VBox/VMM/PDMDriver.cpp +++ b/src/VBox/VMM/PDMDriver.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMDriver.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: PDMDriver.cpp $ */ /** @file * PDM - Pluggable Device and Driver Manager, Driver parts. */ diff --git a/src/VBox/VMM/PDMInternal.h b/src/VBox/VMM/PDMInternal.h index 6d462db48..e28c60a9a 100644 --- a/src/VBox/VMM/PDMInternal.h +++ b/src/VBox/VMM/PDMInternal.h @@ -1,4 +1,4 @@ -/* $Id: PDMInternal.h 21035 2009-06-29 15:45:43Z vboxsync $ */ +/* $Id: PDMInternal.h $ */ /** @file * PDM - Internal header file. */ @@ -723,6 +723,21 @@ typedef struct PDMQUEUE } aFreeItems[1]; } PDMQUEUE; +/** @name PDM::fQueueFlushing + * @{ */ +/** Indicating that an queue insert has been performed. */ +#define PDM_QUEUE_FLUSH_FLAG_ACTIVE RT_BIT_32(PDM_QUEUE_FLUSH_FLAG_ACTIVE_BIT) +/** The bit number for PDM_QUEUE_FLUSH_FLAG_ACTIVE_BIT. */ +#define PDM_QUEUE_FLUSH_FLAG_ACTIVE_BIT 0 +/** Indicating there are pending items. + * This is make sure we don't miss inserts happening during flushing. The FF + * cannot be used for this since it has to be cleared immediately to prevent + * other EMTs from spinning. */ +#define PDM_QUEUE_FLUSH_FLAG_PENDING RT_BIT_32(PDM_QUEUE_FLUSH_FLAG_PENDING_BIT) +/** The bit number for PDM_QUEUE_FLUSH_FLAG_PENDING. */ +#define PDM_QUEUE_FLUSH_FLAG_PENDING_BIT 1 +/** }@ */ + /** * Queue device helper task operation. @@ -887,8 +902,9 @@ typedef struct PDM /** Pointer to the queue which should be manually flushed - RC Ptr. * Only touched by EMT. */ RCPTRTYPE(struct PDMQUEUE *) pQueueFlushRC; - /** Set if we're currently checking queues to prevent other VCPUs from doing the same concurrently. */ - volatile uint32_t fQueueFlushing; + /** Bitmask controlling the queue flushing. + * See PDM_QUEUE_FLUSH_FLAG_ACTIVE and PDM_QUEUE_FLUSH_FLAG_PENDING. */ + uint32_t volatile fQueueFlushing; /** Head of the PDM Thread list. (singly linked) */ R3PTRTYPE(PPDMTHREAD) pThreads; diff --git a/src/VBox/VMM/PDMLdr.cpp b/src/VBox/VMM/PDMLdr.cpp index 6a909bcff..340ffb313 100644 --- a/src/VBox/VMM/PDMLdr.cpp +++ b/src/VBox/VMM/PDMLdr.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMLdr.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: PDMLdr.cpp $ */ /** @file * PDM - Pluggable Device Manager, module loader. */ diff --git a/src/VBox/VMM/PDMQueue.cpp b/src/VBox/VMM/PDMQueue.cpp index 53676e7f6..bc98224c3 100644 --- a/src/VBox/VMM/PDMQueue.cpp +++ b/src/VBox/VMM/PDMQueue.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMQueue.cpp 21039 2009-06-29 15:57:39Z vboxsync $ */ +/* $Id: PDMQueue.cpp $ */ /** @file * PDM Queue - Transport data and tasks to EMT and R3. */ @@ -626,47 +626,30 @@ VMMR3DECL(void) PDMR3QueueFlushAll(PVM pVM) VM_ASSERT_EMT(pVM); LogFlow(("PDMR3QueuesFlush:\n")); + /* + * Only let one EMT flushing queues at any one time to queue preserve order + * and to avoid wasting time. The FF is always cleared here, because it's + * only used to get someones attention. Queue inserts occuring during the + * flush are caught using the pending bit. + * + * Note. The order in which the FF and pending bit are set and cleared is important. + */ VM_FF_CLEAR(pVM, VM_FF_PDM_QUEUES); - -check_queue: - /* Prevent other VCPUs from flushing queues at the same time; we'll never flush an item twice, but the order might change. */ - if (ASMAtomicCmpXchgU32(&pVM->pdm.s.fQueueFlushing, 1, 0)) + if (!ASMAtomicBitTestAndSet(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_ACTIVE_BIT)) { - /* Use atomic test and clear to prevent useless checks; pdmR3QueueFlush is SMP safe. */ + ASMAtomicBitClear(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_PENDING_BIT); do { + VM_FF_CLEAR(pVM, VM_FF_PDM_QUEUES); for (PPDMQUEUE pCur = pVM->pdm.s.pQueuesForced; pCur; pCur = pCur->pNext) - { if ( pCur->pPendingR3 || pCur->pPendingR0 || pCur->pPendingRC) - { - if ( pdmR3QueueFlush(pCur) - && ( pCur->pPendingR3 - || pCur->pPendingR0)) - /* new items arrived while flushing. */ - pdmR3QueueFlush(pCur); - } - } - } - while (VM_FF_TESTANDCLEAR(pVM, VM_FF_PDM_QUEUES_BIT)); + pdmR3QueueFlush(pCur); + } while ( ASMAtomicBitTestAndClear(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_PENDING_BIT) + || VM_FF_ISPENDING(pVM, VM_FF_PDM_QUEUES)); - ASMAtomicXchgU32(&pVM->pdm.s.fQueueFlushing, 0); - - /* Check if we missed anything. */ - for (PPDMQUEUE pCur = pVM->pdm.s.pQueuesForced; pCur; pCur = pCur->pNext) - { - if ( pCur->pPendingR3 - || pCur->pPendingR0 - || pCur->pPendingRC) - { - VM_FF_SET(pVM, VM_FF_PDM_QUEUES); - break; - } - } - if (VM_FF_TESTANDCLEAR(pVM, VM_FF_PDM_QUEUES)) - goto check_queue; - + ASMAtomicBitClear(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_ACTIVE_BIT); } } @@ -690,7 +673,7 @@ static bool pdmR3QueueFlush(PPDMQUEUE pQueue) if ( !pItems && !pItemsRC && !pItemsR0) - /* Somebody was racing us. */ + /* Somebody may be racing us ... never mind. */ return true; /* @@ -739,10 +722,10 @@ static bool pdmR3QueueFlush(PPDMQUEUE pQueue) case PDMQUEUETYPE_DEV: while (pItems) { + if (!pQueue->u.Dev.pfnCallback(pQueue->u.Dev.pDevIns, pItems)) + break; pCur = pItems; pItems = pItems->pNextR3; - if (!pQueue->u.Dev.pfnCallback(pQueue->u.Dev.pDevIns, pCur)) - break; pdmR3QueueFree(pQueue, pCur); } break; @@ -750,10 +733,10 @@ static bool pdmR3QueueFlush(PPDMQUEUE pQueue) case PDMQUEUETYPE_DRV: while (pItems) { + if (!pQueue->u.Drv.pfnCallback(pQueue->u.Drv.pDrvIns, pItems)) + break; pCur = pItems; pItems = pItems->pNextR3; - if (!pQueue->u.Drv.pfnCallback(pQueue->u.Drv.pDrvIns, pCur)) - break; pdmR3QueueFree(pQueue, pCur); } break; @@ -761,10 +744,10 @@ static bool pdmR3QueueFlush(PPDMQUEUE pQueue) case PDMQUEUETYPE_INTERNAL: while (pItems) { + if (!pQueue->u.Int.pfnCallback(pQueue->pVMR3, pItems)) + break; pCur = pItems; pItems = pItems->pNextR3; - if (!pQueue->u.Int.pfnCallback(pQueue->pVMR3, pCur)) - break; pdmR3QueueFree(pQueue, pCur); } break; @@ -772,10 +755,10 @@ static bool pdmR3QueueFlush(PPDMQUEUE pQueue) case PDMQUEUETYPE_EXTERNAL: while (pItems) { + if (!pQueue->u.Ext.pfnCallback(pQueue->u.Ext.pvUser, pItems)) + break; pCur = pItems; pItems = pItems->pNextR3; - if (!pQueue->u.Ext.pfnCallback(pQueue->u.Ext.pvUser, pCur)) - break; pdmR3QueueFree(pQueue, pCur); } break; @@ -791,30 +774,34 @@ static bool pdmR3QueueFlush(PPDMQUEUE pQueue) if (pItems) { /* - * Shit, no! - * 1. Insert pCur. - * 2. Reverse the list. - * 3. Insert the LIFO at the tail of the pending list. + * Reverse the list. */ - pCur->pNextR3 = pItems; - pItems = pCur; - - //pCur = pItems; + pCur = pItems; pItems = NULL; while (pCur) { PPDMQUEUEITEMCORE pInsert = pCur; - pCur = pCur->pNextR3; + pCur = pInsert->pNextR3; pInsert->pNextR3 = pItems; pItems = pInsert; } - if (!ASMAtomicCmpXchgPtr((void * volatile *)&pQueue->pPendingR3, pItems, NULL)) + /* + * Insert the list at the tail of the pending list. + */ + for (;;) { - pCur = pQueue->pPendingR3; - while (pCur->pNextR3) - pCur = pCur->pNextR3; - pCur->pNextR3 = pItems; + if (ASMAtomicCmpXchgPtr((void * volatile *)&pQueue->pPendingR3, pItems, NULL)) + break; + PPDMQUEUEITEMCORE pPending = (PPDMQUEUEITEMCORE)ASMAtomicXchgPtr((void * volatile *)&pQueue->pPendingR3, NULL); + if (pPending) + { + pCur = pPending; + while (pCur->pNextR3) + pCur = pCur->pNextR3; + pCur->pNextR3 = pItems; + pItems = pPending; + } } return false; } diff --git a/src/VBox/VMM/PDMThread.cpp b/src/VBox/VMM/PDMThread.cpp index 5691633f5..4e3adc674 100644 --- a/src/VBox/VMM/PDMThread.cpp +++ b/src/VBox/VMM/PDMThread.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMThread.cpp 15540 2008-12-15 20:01:28Z vboxsync $ */ +/* $Id: PDMThread.cpp $ */ /** @file * PDM Thread - VM Thread Management. */ diff --git a/src/VBox/VMM/PGM.cpp b/src/VBox/VMM/PGM.cpp index 89092b27d..9d99d4d2d 100644 --- a/src/VBox/VMM/PGM.cpp +++ b/src/VBox/VMM/PGM.cpp @@ -1,4 +1,4 @@ -/* $Id: PGM.cpp 20925 2009-06-25 11:25:09Z vboxsync $ */ +/* $Id: PGM.cpp $ */ /** @file * PGM - Page Manager and Monitor. (Mixing stuff here, not good?) */ diff --git a/src/VBox/VMM/PGMBth.h b/src/VBox/VMM/PGMBth.h index 083cde2aa..8d0353482 100644 --- a/src/VBox/VMM/PGMBth.h +++ b/src/VBox/VMM/PGMBth.h @@ -1,4 +1,4 @@ -/* $Id: PGMBth.h 20759 2009-06-22 10:14:16Z vboxsync $ */ +/* $Id: PGMBth.h $ */ /** @file * VBox - Page Manager / Monitor, Shadow+Guest Paging Template. */ diff --git a/src/VBox/VMM/PGMDbg.cpp b/src/VBox/VMM/PGMDbg.cpp index f592d9c75..a7759003e 100644 --- a/src/VBox/VMM/PGMDbg.cpp +++ b/src/VBox/VMM/PGMDbg.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMDbg.cpp 20947 2009-06-25 15:37:20Z vboxsync $ */ +/* $Id: PGMDbg.cpp $ */ /** @file * PGM - Page Manager and Monitor - Debugger & Debugging APIs. */ diff --git a/src/VBox/VMM/PGMGst.h b/src/VBox/VMM/PGMGst.h index 7afaaabc8..9db17be91 100644 --- a/src/VBox/VMM/PGMGst.h +++ b/src/VBox/VMM/PGMGst.h @@ -1,4 +1,4 @@ -/* $Id: PGMGst.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: PGMGst.h $ */ /** @file * VBox - Page Manager / Monitor, Guest Paging Template. */ diff --git a/src/VBox/VMM/PGMGstDefs.h b/src/VBox/VMM/PGMGstDefs.h index 28476ae5d..f9a508233 100644 --- a/src/VBox/VMM/PGMGstDefs.h +++ b/src/VBox/VMM/PGMGstDefs.h @@ -1,4 +1,4 @@ -/* $Id: PGMGstDefs.h 17215 2009-02-27 16:33:19Z vboxsync $ */ +/* $Id: PGMGstDefs.h $ */ /** @file * VBox - Page Manager, Guest Paging Template - All context code. */ diff --git a/src/VBox/VMM/PGMHandler.cpp b/src/VBox/VMM/PGMHandler.cpp index 48b69155f..ac2b6d276 100644 --- a/src/VBox/VMM/PGMHandler.cpp +++ b/src/VBox/VMM/PGMHandler.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMHandler.cpp 20808 2009-06-23 08:43:53Z vboxsync $ */ +/* $Id: PGMHandler.cpp $ */ /** @file * PGM - Page Manager / Monitor, Access Handlers. */ diff --git a/src/VBox/VMM/PGMInternal.h b/src/VBox/VMM/PGMInternal.h index aa4339b29..3f850ee65 100644 --- a/src/VBox/VMM/PGMInternal.h +++ b/src/VBox/VMM/PGMInternal.h @@ -1,4 +1,4 @@ -/* $Id: PGMInternal.h 20808 2009-06-23 08:43:53Z vboxsync $ */ +/* $Id: PGMInternal.h $ */ /** @file * PGM - Internal header file. */ diff --git a/src/VBox/VMM/PGMMap.cpp b/src/VBox/VMM/PGMMap.cpp index 6401601cc..8c3a699d3 100644 --- a/src/VBox/VMM/PGMMap.cpp +++ b/src/VBox/VMM/PGMMap.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMMap.cpp 20796 2009-06-22 18:57:52Z vboxsync $ */ +/* $Id: PGMMap.cpp $ */ /** @file * PGM - Page Manager, Guest Context Mappings. */ diff --git a/src/VBox/VMM/PGMPhys.cpp b/src/VBox/VMM/PGMPhys.cpp index e2c98680e..bcdab9b71 100644 --- a/src/VBox/VMM/PGMPhys.cpp +++ b/src/VBox/VMM/PGMPhys.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMPhys.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: PGMPhys.cpp $ */ /** @file * PGM - Page Manager and Monitor, Physical Memory Addressing. */ diff --git a/src/VBox/VMM/PGMPhysRWTmpl.h b/src/VBox/VMM/PGMPhysRWTmpl.h index c3b87245f..bef288083 100644 --- a/src/VBox/VMM/PGMPhysRWTmpl.h +++ b/src/VBox/VMM/PGMPhysRWTmpl.h @@ -1,4 +1,4 @@ -/* $Id: PGMPhysRWTmpl.h 20808 2009-06-23 08:43:53Z vboxsync $ */ +/* $Id: PGMPhysRWTmpl.h $ */ /** @file * PGM - Page Manager and Monitor, Physical Memory Access Template. */ diff --git a/src/VBox/VMM/PGMPool.cpp b/src/VBox/VMM/PGMPool.cpp index d210f5dba..6e22f87fb 100644 --- a/src/VBox/VMM/PGMPool.cpp +++ b/src/VBox/VMM/PGMPool.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMPool.cpp 20764 2009-06-22 11:13:45Z vboxsync $ */ +/* $Id: PGMPool.cpp $ */ /** @file * PGM Shadow Page Pool. */ diff --git a/src/VBox/VMM/PGMShw.h b/src/VBox/VMM/PGMShw.h index bc476b904..2a68e92d3 100644 --- a/src/VBox/VMM/PGMShw.h +++ b/src/VBox/VMM/PGMShw.h @@ -1,4 +1,4 @@ -/* $Id: PGMShw.h 20810 2009-06-23 09:27:38Z vboxsync $ */ +/* $Id: PGMShw.h $ */ /** @file * VBox - Page Manager / Monitor, Shadow Paging Template. */ diff --git a/src/VBox/VMM/REMInternal.h b/src/VBox/VMM/REMInternal.h index f123acf48..f7b863997 100644 --- a/src/VBox/VMM/REMInternal.h +++ b/src/VBox/VMM/REMInternal.h @@ -1,4 +1,4 @@ -/* $Id: REMInternal.h 20749 2009-06-21 20:57:37Z vboxsync $ */ +/* $Id: REMInternal.h $ */ /** @file * REM - Internal header file. */ diff --git a/src/VBox/VMM/SELM.cpp b/src/VBox/VMM/SELM.cpp index f6c79b169..3aa607839 100644 --- a/src/VBox/VMM/SELM.cpp +++ b/src/VBox/VMM/SELM.cpp @@ -1,4 +1,4 @@ -/* $Id: SELM.cpp 19463 2009-05-06 20:30:57Z vboxsync $ */ +/* $Id: SELM.cpp $ */ /** @file * SELM - The Selector Manager. */ diff --git a/src/VBox/VMM/SELMInternal.h b/src/VBox/VMM/SELMInternal.h index e2bb11790..c9365262e 100644 --- a/src/VBox/VMM/SELMInternal.h +++ b/src/VBox/VMM/SELMInternal.h @@ -1,4 +1,4 @@ -/* $Id: SELMInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: SELMInternal.h $ */ /** @file * SELM - Internal header file. */ diff --git a/src/VBox/VMM/SSM.cpp b/src/VBox/VMM/SSM.cpp index 0d4e72274..9a89fd6c6 100644 --- a/src/VBox/VMM/SSM.cpp +++ b/src/VBox/VMM/SSM.cpp @@ -1,4 +1,4 @@ -/* $Id: SSM.cpp 20153 2009-05-29 13:28:12Z vboxsync $ */ +/* $Id: SSM.cpp $ */ /** @file * SSM - Saved State Manager. */ diff --git a/src/VBox/VMM/SSMInternal.h b/src/VBox/VMM/SSMInternal.h index 1a3948295..ff5dd1d9c 100644 --- a/src/VBox/VMM/SSMInternal.h +++ b/src/VBox/VMM/SSMInternal.h @@ -1,4 +1,4 @@ -/* $Id: SSMInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: SSMInternal.h $ */ /** @file * SSM - Internal header file. */ diff --git a/src/VBox/VMM/STAM.cpp b/src/VBox/VMM/STAM.cpp index bad8d3c4a..824db5915 100644 --- a/src/VBox/VMM/STAM.cpp +++ b/src/VBox/VMM/STAM.cpp @@ -1,4 +1,4 @@ -/* $Id: STAM.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: STAM.cpp $ */ /** @file * STAM - The Statistics Manager. */ diff --git a/src/VBox/VMM/STAMInternal.h b/src/VBox/VMM/STAMInternal.h index bf563d02e..ad5382eaf 100644 --- a/src/VBox/VMM/STAMInternal.h +++ b/src/VBox/VMM/STAMInternal.h @@ -1,4 +1,4 @@ -/* $Id: STAMInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: STAMInternal.h $ */ /** @file * STAM Internal Header. */ diff --git a/src/VBox/VMM/TM.cpp b/src/VBox/VMM/TM.cpp index 56d6c9e8c..d2ec13429 100644 --- a/src/VBox/VMM/TM.cpp +++ b/src/VBox/VMM/TM.cpp @@ -1,4 +1,4 @@ -/* $Id: TM.cpp 20943 2009-06-25 14:09:31Z vboxsync $ */ +/* $Id: TM.cpp $ */ /** @file * TM - Time Manager. */ diff --git a/src/VBox/VMM/TMInternal.h b/src/VBox/VMM/TMInternal.h index 54189136c..1a68e4dea 100644 --- a/src/VBox/VMM/TMInternal.h +++ b/src/VBox/VMM/TMInternal.h @@ -1,4 +1,4 @@ -/* $Id: TMInternal.h 20784 2009-06-22 14:37:39Z vboxsync $ */ +/* $Id: TMInternal.h $ */ /** @file * TM - Internal header file. */ diff --git a/src/VBox/VMM/TRPM.cpp b/src/VBox/VMM/TRPM.cpp index f36eda003..30df454e5 100644 --- a/src/VBox/VMM/TRPM.cpp +++ b/src/VBox/VMM/TRPM.cpp @@ -1,4 +1,4 @@ -/* $Id: TRPM.cpp 20841 2009-06-23 14:45:16Z vboxsync $ */ +/* $Id: TRPM.cpp $ */ /** @file * TRPM - The Trap Monitor. */ diff --git a/src/VBox/VMM/TRPMInternal.h b/src/VBox/VMM/TRPMInternal.h index 2b41d233a..9268b8262 100644 --- a/src/VBox/VMM/TRPMInternal.h +++ b/src/VBox/VMM/TRPMInternal.h @@ -1,4 +1,4 @@ -/* $Id: TRPMInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: TRPMInternal.h $ */ /** @file * TRPM - Internal header file. */ diff --git a/src/VBox/VMM/TRPMInternal.mac b/src/VBox/VMM/TRPMInternal.mac index c4bcbcdb0..32e92bb9c 100644 --- a/src/VBox/VMM/TRPMInternal.mac +++ b/src/VBox/VMM/TRPMInternal.mac @@ -1,4 +1,4 @@ -; $Id: TRPMInternal.mac 19286 2009-05-01 12:41:07Z vboxsync $ +; $Id: TRPMInternal.mac $ ;; @file ; TRPM - Internal header file. ; diff --git a/src/VBox/VMM/VBoxVMMDeps.cpp b/src/VBox/VMM/VBoxVMMDeps.cpp index 408c30a12..3239a8aa6 100644 --- a/src/VBox/VMM/VBoxVMMDeps.cpp +++ b/src/VBox/VMM/VBoxVMMDeps.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxVMMDeps.cpp 13035 2008-10-07 09:54:32Z vboxsync $ */ +/* $Id: VBoxVMMDeps.cpp $ */ /** @file * VBoxVMM link dependencies - drag all we want into the link! */ diff --git a/src/VBox/VMM/VM.cpp b/src/VBox/VMM/VM.cpp index 57fd2343c..d56ae1c55 100644 --- a/src/VBox/VMM/VM.cpp +++ b/src/VBox/VMM/VM.cpp @@ -1,4 +1,4 @@ -/* $Id: VM.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: VM.cpp $ */ /** @file * VM - Virtual Machine */ diff --git a/src/VBox/VMM/VMEmt.cpp b/src/VBox/VMM/VMEmt.cpp index f84493777..e8afaba53 100644 --- a/src/VBox/VMM/VMEmt.cpp +++ b/src/VBox/VMM/VMEmt.cpp @@ -1,4 +1,4 @@ -/* $Id: VMEmt.cpp 20961 2009-06-26 08:45:18Z vboxsync $ */ +/* $Id: VMEmt.cpp $ */ /** @file * VM - Virtual Machine, The Emulation Thread. */ @@ -183,7 +183,7 @@ int vmR3EmulationThreadWithId(RTTHREAD ThreadSelf, PUVMCPU pUVCpu, VMCPUID idCpu rc = DBGFR3VMMForcedAction(pVM); Log(("vmR3EmulationThread: Dbg rc=%Rrc, VM state %d -> %d\n", rc, enmBefore, pVM->enmVMState)); } - else if (VM_FF_TESTANDCLEAR(pVM, VM_FF_RESET_BIT)) + else if (VM_FF_TESTANDCLEAR(pVM, VM_FF_RESET)) { /* * Service a delayed reset request. diff --git a/src/VBox/VMM/VMInternal.h b/src/VBox/VMM/VMInternal.h index adb86eacd..293948b52 100644 --- a/src/VBox/VMM/VMInternal.h +++ b/src/VBox/VMM/VMInternal.h @@ -1,4 +1,4 @@ -/* $Id: VMInternal.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VMInternal.h $ */ /** @file * VM - Internal header file. */ diff --git a/src/VBox/VMM/VMM.cpp b/src/VBox/VMM/VMM.cpp index 219b06e87..43a870e94 100644 --- a/src/VBox/VMM/VMM.cpp +++ b/src/VBox/VMM/VMM.cpp @@ -1,4 +1,4 @@ -/* $Id: VMM.cpp 20875 2009-06-24 02:29:17Z vboxsync $ */ +/* $Id: VMM.cpp $ */ /** @file * VMM - The Virtual Machine Monitor Core. */ diff --git a/src/VBox/VMM/VMMAll/CPUMAllA.asm b/src/VBox/VMM/VMMAll/CPUMAllA.asm index 8ba0d8561..b43cac3b2 100644 --- a/src/VBox/VMM/VMMAll/CPUMAllA.asm +++ b/src/VBox/VMM/VMMAll/CPUMAllA.asm @@ -1,4 +1,4 @@ -; $Id: CPUMAllA.asm 16108 2009-01-21 00:16:27Z vboxsync $ +; $Id: CPUMAllA.asm $ ;; @file ; CPUM - Guest Context Assembly Routines. ; diff --git a/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp b/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp index 9464d8fe2..8e2bf58ba 100644 --- a/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp +++ b/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp @@ -1,4 +1,4 @@ -/* $Id: CPUMAllRegs.cpp 19076 2009-04-21 13:20:48Z vboxsync $ */ +/* $Id: CPUMAllRegs.cpp $ */ /** @file * CPUM - CPU Monitor(/Manager) - Getters and Setters. */ diff --git a/src/VBox/VMM/VMMAll/CPUMStack.cpp b/src/VBox/VMM/VMMAll/CPUMStack.cpp index d60a8cf9d..77a778ff6 100644 --- a/src/VBox/VMM/VMMAll/CPUMStack.cpp +++ b/src/VBox/VMM/VMMAll/CPUMStack.cpp @@ -1,4 +1,4 @@ -/* $Id: CPUMStack.cpp 18927 2009-04-16 11:41:38Z vboxsync $ */ +/* $Id: CPUMStack.cpp $ */ /** @file * CPUM - CPU Monitor(/Manager) - Stack manipulation. */ diff --git a/src/VBox/VMM/VMMAll/DBGFAll.cpp b/src/VBox/VMM/VMMAll/DBGFAll.cpp index 550ad3e44..f8fec8b3e 100644 --- a/src/VBox/VMM/VMMAll/DBGFAll.cpp +++ b/src/VBox/VMM/VMMAll/DBGFAll.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFAll.cpp 19286 2009-05-01 12:41:07Z vboxsync $ */ +/* $Id: DBGFAll.cpp $ */ /** @file * DBGF - Debugger Facility, All Context Code. */ diff --git a/src/VBox/VMM/VMMAll/EMAll.cpp b/src/VBox/VMM/VMMAll/EMAll.cpp index 33c7067fb..5a782266e 100644 --- a/src/VBox/VMM/VMMAll/EMAll.cpp +++ b/src/VBox/VMM/VMMAll/EMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: EMAll.cpp 20682 2009-06-18 11:07:33Z vboxsync $ */ +/* $Id: EMAll.cpp $ */ /** @file * EM - Execution Monitor(/Manager) - All contexts */ @@ -69,8 +69,10 @@ /* Used to pass information during instruction disassembly. */ typedef struct { - PVM pVM; - PVMCPU pVCpu; + PVM pVM; + PVMCPU pVCpu; + RTGCPTR GCPtr; + uint8_t aOpcode[8]; } EMDISSTATE, *PEMDISSTATE; /******************************************************************************* @@ -124,7 +126,23 @@ DECLCALLBACK(int) EMReadBytes(RTUINTPTR pSrc, uint8_t *pDest, unsigned cb, void PVMCPU pVCpu = pState->pVCpu; # ifdef IN_RING0 - int rc = PGMPhysSimpleReadGCPtr(pVCpu, pDest, pSrc, cb); + int rc; + + if ( pState->GCPtr + && pSrc + cb <= pState->GCPtr + sizeof(pState->aOpcode)) + { + unsigned offset = pSrc - pState->GCPtr; + + Assert(pSrc >= pState->GCPtr); + + for (unsigned i=0; i<cb; i++) + { + pDest[i] = pState->aOpcode[offset + i]; + } + return VINF_SUCCESS; + } + + rc = PGMPhysSimpleReadGCPtr(pVCpu, pDest, pSrc, cb); AssertMsgRC(rc, ("PGMPhysSimpleReadGCPtr failed for pSrc=%RGv cb=%x rc=%d\n", pSrc, cb, rc)); # else /* IN_RING3 */ if (!PATMIsPatchGCAddr(pVM, pSrc)) @@ -134,7 +152,7 @@ DECLCALLBACK(int) EMReadBytes(RTUINTPTR pSrc, uint8_t *pDest, unsigned cb, void } else { - for (uint32_t i = 0; i < cb; i++) + for (unsigned i = 0; i < cb; i++) { uint8_t opcode; if (RT_SUCCESS(PATMR3QueryOpcode(pVM, (RTGCPTR)pSrc + i, &opcode))) @@ -152,6 +170,11 @@ DECLINLINE(int) emDisCoreOne(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, RTGCUINTP State.pVM = pVM; State.pVCpu = pVCpu; + int rc = PGMPhysSimpleReadGCPtr(pVCpu, &State.aOpcode, InstrGC, sizeof(State.aOpcode)); + if (RT_SUCCESS(rc)) + State.GCPtr = InstrGC; + else + State.GCPtr = NULL; return DISCoreOneEx(InstrGC, pDis->mode, EMReadBytes, &State, pDis, pOpsize); } @@ -212,14 +235,22 @@ VMMDECL(int) EMInterpretDisasOne(PVM pVM, PVMCPU pVCpu, PCCPUMCTXCORE pCtxCore, */ VMMDECL(int) EMInterpretDisasOneEx(PVM pVM, PVMCPU pVCpu, RTGCUINTPTR GCPtrInstr, PCCPUMCTXCORE pCtxCore, PDISCPUSTATE pDis, unsigned *pcbInstr) { + int rc; + #ifndef IN_RC EMDISSTATE State; State.pVM = pVM; State.pVCpu = pVCpu; + + rc = PGMPhysSimpleReadGCPtr(pVCpu, &State.aOpcode, GCPtrInstr, sizeof(State.aOpcode)); + if (RT_SUCCESS(rc)) + State.GCPtr = GCPtrInstr; + else + State.GCPtr = NULL; #endif - int rc = DISCoreOneEx(GCPtrInstr, SELMGetCpuModeFromSelector(pVM, pCtxCore->eflags, pCtxCore->cs, (PCPUMSELREGHID)&pCtxCore->csHid), + rc = DISCoreOneEx(GCPtrInstr, SELMGetCpuModeFromSelector(pVM, pCtxCore->eflags, pCtxCore->cs, (PCPUMSELREGHID)&pCtxCore->csHid), #ifdef IN_RC NULL, NULL, #else diff --git a/src/VBox/VMM/VMMAll/EMAllA.asm b/src/VBox/VMM/VMMAll/EMAllA.asm index 9a60201f6..1410df1fc 100644 --- a/src/VBox/VMM/VMMAll/EMAllA.asm +++ b/src/VBox/VMM/VMMAll/EMAllA.asm @@ -1,4 +1,4 @@ -; $Id: EMAllA.asm 20641 2009-06-16 16:14:33Z vboxsync $ +; $Id: EMAllA.asm $ ;; @file ; EM Assembly Routines. ; diff --git a/src/VBox/VMM/VMMAll/HWACCMAll.cpp b/src/VBox/VMM/VMMAll/HWACCMAll.cpp index ff47a13d5..c4c8e6063 100644 --- a/src/VBox/VMM/VMMAll/HWACCMAll.cpp +++ b/src/VBox/VMM/VMMAll/HWACCMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: HWACCMAll.cpp 20981 2009-06-26 15:03:24Z vboxsync $ */ +/* $Id: HWACCMAll.cpp $ */ /** @file * HWACCM - All contexts. */ diff --git a/src/VBox/VMM/VMMAll/IOMAll.cpp b/src/VBox/VMM/VMMAll/IOMAll.cpp index d856889fe..8567dd64b 100644 --- a/src/VBox/VMM/VMMAll/IOMAll.cpp +++ b/src/VBox/VMM/VMMAll/IOMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: IOMAll.cpp 19807 2009-05-19 09:01:05Z vboxsync $ */ +/* $Id: IOMAll.cpp $ */ /** @file * IOM - Input / Output Monitor - Any Context. */ diff --git a/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp b/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp index 817f7260d..3b7c6f245 100644 --- a/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp +++ b/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp @@ -1,4 +1,4 @@ -/* $Id: IOMAllMMIO.cpp 20722 2009-06-19 12:34:21Z vboxsync $ */ +/* $Id: IOMAllMMIO.cpp $ */ /** @file * IOM - Input / Output Monitor - Any Context, MMIO & String I/O. */ @@ -1786,7 +1786,7 @@ VMMDECL(int) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, while (cTransfers && rc == VINF_SUCCESS) { - uint32_t u32Value; + uint32_t u32Value = 0; rc = iomRamRead(pVCpu, &u32Value, GCPtrSrc, cbTransfer); if (rc != VINF_SUCCESS) break; diff --git a/src/VBox/VMM/VMMAll/MMAll.cpp b/src/VBox/VMM/VMMAll/MMAll.cpp index 8655ac0c7..0cc786f78 100644 --- a/src/VBox/VMM/VMMAll/MMAll.cpp +++ b/src/VBox/VMM/VMMAll/MMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: MMAll.cpp 20774 2009-06-22 12:59:53Z vboxsync $ */ +/* $Id: MMAll.cpp $ */ /** @file * MM - Memory Manager - Any Context. */ diff --git a/src/VBox/VMM/VMMAll/MMAllHyper.cpp b/src/VBox/VMM/VMMAll/MMAllHyper.cpp index 9a95ef6cf..4157bf91d 100644 --- a/src/VBox/VMM/VMMAll/MMAllHyper.cpp +++ b/src/VBox/VMM/VMMAll/MMAllHyper.cpp @@ -1,4 +1,4 @@ -/* $Id: MMAllHyper.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: MMAllHyper.cpp $ */ /** @file * MM - Memory Manager - Hypervisor Memory Area, All Contexts. */ diff --git a/src/VBox/VMM/VMMAll/MMAllPagePool.cpp b/src/VBox/VMM/VMMAll/MMAllPagePool.cpp index 3132e9eac..6844db32e 100644 --- a/src/VBox/VMM/VMMAll/MMAllPagePool.cpp +++ b/src/VBox/VMM/VMMAll/MMAllPagePool.cpp @@ -1,4 +1,4 @@ -/* $Id: MMAllPagePool.cpp 14157 2008-11-13 02:50:46Z vboxsync $ */ +/* $Id: MMAllPagePool.cpp $ */ /** @file * MM - Memory Manager - Page Pool. * diff --git a/src/VBox/VMM/VMMAll/PDMAll.cpp b/src/VBox/VMM/VMMAll/PDMAll.cpp index f0089f336..a86096d72 100644 --- a/src/VBox/VMM/VMMAll/PDMAll.cpp +++ b/src/VBox/VMM/VMMAll/PDMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMAll.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: PDMAll.cpp $ */ /** @file * PDM Critical Sections */ diff --git a/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp b/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp index 775305e8b..7de17652c 100644 --- a/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp +++ b/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMAllCritSect.cpp 20998 2009-06-26 23:01:02Z vboxsync $ */ +/* $Id: PDMAllCritSect.cpp $ */ /** @file * PDM - Critical Sections, All Contexts. */ diff --git a/src/VBox/VMM/VMMAll/PDMAllQueue.cpp b/src/VBox/VMM/VMMAll/PDMAllQueue.cpp index 4677e7eda..3988e4276 100644 --- a/src/VBox/VMM/VMMAll/PDMAllQueue.cpp +++ b/src/VBox/VMM/VMMAll/PDMAllQueue.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMAllQueue.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: PDMAllQueue.cpp $ */ /** @file * PDM Queue - Transport data and tasks to EMT and R3. */ @@ -91,6 +91,7 @@ VMMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem) PVM pVM = pQueue->CTX_SUFF(pVM); Log2(("PDMQueueInsert: VM_FF_PDM_QUEUES %d -> 1\n", VM_FF_ISSET(pVM, VM_FF_PDM_QUEUES))); VM_FF_SET(pVM, VM_FF_PDM_QUEUES); + ASMAtomicBitSet(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_PENDING_BIT); #ifdef IN_RING3 REMR3NotifyQueuePending(pVM); /** @todo r=bird: we can remove REMR3NotifyQueuePending and let VMR3NotifyFF do the work. */ VMR3NotifyGlobalFFU(pVM->pUVM, VMNOTIFYFF_FLAGS_DONE_REM); diff --git a/src/VBox/VMM/VMMAll/PGMAll.cpp b/src/VBox/VMM/VMMAll/PGMAll.cpp index b7162d1bd..f2ed96cfc 100644 --- a/src/VBox/VMM/VMMAll/PGMAll.cpp +++ b/src/VBox/VMM/VMMAll/PGMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMAll.cpp 21059 2009-06-30 09:24:20Z vboxsync $ */ +/* $Id: PGMAll.cpp $ */ /** @file * PGM - Page Manager and Monitor - All context code. */ diff --git a/src/VBox/VMM/VMMAll/PGMAllBth.h b/src/VBox/VMM/VMMAll/PGMAllBth.h index 74bceebbd..002ae157d 100644 --- a/src/VBox/VMM/VMMAll/PGMAllBth.h +++ b/src/VBox/VMM/VMMAll/PGMAllBth.h @@ -1,4 +1,4 @@ -/* $Id: PGMAllBth.h 20871 2009-06-24 01:56:19Z vboxsync $ */ +/* $Id: PGMAllBth.h $ */ /** @file * VBox - Page Manager, Shadow+Guest Paging Template - All context code. * @@ -434,17 +434,22 @@ PGM_BTH_DECL(int, Trap0eHandler)(PVMCPU pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegF # if defined(IN_RC) || defined(IN_RING0) if (pCur->CTX_SUFF(pfnHandler)) { + PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); # ifdef IN_RING0 PFNPGMR0PHYSHANDLER pfnHandler = pCur->CTX_SUFF(pfnHandler); # else PFNPGMRCPHYSHANDLER pfnHandler = pCur->CTX_SUFF(pfnHandler); # endif + bool fLeaveLock = (pfnHandler != pPool->CTX_SUFF(pfnAccessHandler)); void *pvUser = pCur->CTX_SUFF(pvUser); STAM_PROFILE_START(&pCur->Stat, h); - pgmUnlock(pVM); /* @todo: Not entirely safe. */ + if (fLeaveLock) + pgmUnlock(pVM); /* @todo: Not entirely safe. */ + rc = pfnHandler(pVM, uErr, pRegFrame, pvFault, GCPhysFault, pvUser); - pgmLock(pVM); + if (fLeaveLock) + pgmLock(pVM); # ifdef VBOX_WITH_STATISTICS pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhysFault); if (pCur) @@ -793,6 +798,27 @@ PGM_BTH_DECL(int, Trap0eHandler)(PVMCPU pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegF if (RT_UNLIKELY(VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY))) return VINF_EM_NO_MEMORY; } + + /* Check to see if we need to emulate the instruction as X86_CR0_WP has been cleared. */ + if ( CPUMGetGuestCPL(pVCpu, pRegFrame) == 0 + && ((CPUMGetGuestCR0(pVCpu) & (X86_CR0_WP | X86_CR0_PG)) == X86_CR0_PG)) + { + Assert((uErr & (X86_TRAP_PF_RW | X86_TRAP_PF_P)) == (X86_TRAP_PF_RW | X86_TRAP_PF_P)); + uint64_t fPageGst; + rc = PGMGstGetPage(pVCpu, pvFault, &fPageGst, NULL); + if ( RT_SUCCESS(rc) + && !(fPageGst & X86_PTE_RW)) + { + rc = PGMInterpretInstruction(pVM, pVCpu, pRegFrame, pvFault); + if (RT_SUCCESS(rc)) + STAM_COUNTER_INC(&pVCpu->pgm.s.StatRZTrap0eWPEmulInRZ); + else + STAM_COUNTER_INC(&pVCpu->pgm.s.StatRZTrap0eWPEmulToR3); + return rc; + } + AssertMsg(RT_SUCCESS(rc), ("Unexpected r/w page %RGv flag=%x rc=%Rrc\n", pvFault, (uint32_t)fPageGst, rc)); + } + /// @todo count the above case; else if (uErr & X86_TRAP_PF_US) STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_MID_Z(Stat,PageOutOfSyncUser)); @@ -826,26 +852,6 @@ PGM_BTH_DECL(int, Trap0eHandler)(PVMCPU pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegF STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.StatRZTrap0eTime2OutOfSyncHndObs; }); return VINF_SUCCESS; } - - /* Check to see if we need to emulate the instruction as X86_CR0_WP has been cleared. */ - if ( CPUMGetGuestCPL(pVCpu, pRegFrame) == 0 - && ((CPUMGetGuestCR0(pVCpu) & (X86_CR0_WP | X86_CR0_PG)) == X86_CR0_PG) - && (uErr & (X86_TRAP_PF_RW | X86_TRAP_PF_P)) == (X86_TRAP_PF_RW | X86_TRAP_PF_P)) - { - uint64_t fPageGst; - rc = PGMGstGetPage(pVCpu, pvFault, &fPageGst, NULL); - if ( RT_SUCCESS(rc) - && !(fPageGst & X86_PTE_RW)) - { - rc = PGMInterpretInstruction(pVM, pVCpu, pRegFrame, pvFault); - if (RT_SUCCESS(rc)) - STAM_COUNTER_INC(&pVCpu->pgm.s.StatRZTrap0eWPEmulInRZ); - else - STAM_COUNTER_INC(&pVCpu->pgm.s.StatRZTrap0eWPEmulToR3); - return rc; - } - AssertMsgFailed(("Unexpected r/w page %RGv flag=%x rc=%Rrc\n", pvFault, (uint32_t)fPageGst, rc)); - } } # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) diff --git a/src/VBox/VMM/VMMAll/PGMAllGst.h b/src/VBox/VMM/VMMAll/PGMAllGst.h index ed8c8187d..cfe0236b9 100644 --- a/src/VBox/VMM/VMMAll/PGMAllGst.h +++ b/src/VBox/VMM/VMMAll/PGMAllGst.h @@ -1,4 +1,4 @@ -/* $Id: PGMAllGst.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: PGMAllGst.h $ */ /** @file * VBox - Page Manager, Guest Paging Template - All context code. */ diff --git a/src/VBox/VMM/VMMAll/PGMAllHandler.cpp b/src/VBox/VMM/VMMAll/PGMAllHandler.cpp index af25dce59..6264a8252 100644 --- a/src/VBox/VMM/VMMAll/PGMAllHandler.cpp +++ b/src/VBox/VMM/VMMAll/PGMAllHandler.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMAllHandler.cpp 20808 2009-06-23 08:43:53Z vboxsync $ */ +/* $Id: PGMAllHandler.cpp $ */ /** @file * PGM - Page Manager / Monitor, Access Handlers. */ diff --git a/src/VBox/VMM/VMMAll/PGMAllMap.cpp b/src/VBox/VMM/VMMAll/PGMAllMap.cpp index 96bccb48c..6f763d564 100644 --- a/src/VBox/VMM/VMMAll/PGMAllMap.cpp +++ b/src/VBox/VMM/VMMAll/PGMAllMap.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMAllMap.cpp 20865 2009-06-23 19:27:16Z vboxsync $ */ +/* $Id: PGMAllMap.cpp $ */ /** @file * PGM - Page Manager and Monitor - All context code. */ diff --git a/src/VBox/VMM/VMMAll/PGMAllPhys.cpp b/src/VBox/VMM/VMMAll/PGMAllPhys.cpp index 2e97d7ad2..3675f2ac6 100644 --- a/src/VBox/VMM/VMMAll/PGMAllPhys.cpp +++ b/src/VBox/VMM/VMMAll/PGMAllPhys.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMAllPhys.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: PGMAllPhys.cpp $ */ /** @file * PGM - Page Manager and Monitor, Physical Memory Addressing. */ diff --git a/src/VBox/VMM/VMMAll/PGMAllPool.cpp b/src/VBox/VMM/VMMAll/PGMAllPool.cpp index 103631124..4bcd13ee3 100644 --- a/src/VBox/VMM/VMMAll/PGMAllPool.cpp +++ b/src/VBox/VMM/VMMAll/PGMAllPool.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMAllPool.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: PGMAllPool.cpp $ */ /** @file * PGM Shadow Page Pool. */ diff --git a/src/VBox/VMM/VMMAll/PGMAllShw.h b/src/VBox/VMM/VMMAll/PGMAllShw.h index 5df99bad2..05aed8b45 100644 --- a/src/VBox/VMM/VMMAll/PGMAllShw.h +++ b/src/VBox/VMM/VMMAll/PGMAllShw.h @@ -1,4 +1,4 @@ -/* $Id: PGMAllShw.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: PGMAllShw.h $ */ /** @file * VBox - Page Manager, Shadow Paging Template - All context code. */ diff --git a/src/VBox/VMM/VMMAll/REMAll.cpp b/src/VBox/VMM/VMMAll/REMAll.cpp index 5addc58dd..81c2d86b2 100644 --- a/src/VBox/VMM/VMMAll/REMAll.cpp +++ b/src/VBox/VMM/VMMAll/REMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: REMAll.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: REMAll.cpp $ */ /** @file * REM - Recompiled Execution Monitor, all Contexts part. */ diff --git a/src/VBox/VMM/VMMAll/SELMAll.cpp b/src/VBox/VMM/VMMAll/SELMAll.cpp index bb698dd3e..a5d69ff6a 100644 --- a/src/VBox/VMM/VMMAll/SELMAll.cpp +++ b/src/VBox/VMM/VMMAll/SELMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: SELMAll.cpp 19334 2009-05-04 16:03:57Z vboxsync $ */ +/* $Id: SELMAll.cpp $ */ /** @file * SELM All contexts. */ diff --git a/src/VBox/VMM/VMMAll/TMAll.cpp b/src/VBox/VMM/VMMAll/TMAll.cpp index cc5efbc6d..4c315c221 100644 --- a/src/VBox/VMM/VMMAll/TMAll.cpp +++ b/src/VBox/VMM/VMMAll/TMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: TMAll.cpp 20784 2009-06-22 14:37:39Z vboxsync $ */ +/* $Id: TMAll.cpp $ */ /** @file * TM - Timeout Manager, all contexts. */ diff --git a/src/VBox/VMM/VMMAll/TMAllCpu.cpp b/src/VBox/VMM/VMMAll/TMAllCpu.cpp index 1427bffcf..007c7c0b8 100644 --- a/src/VBox/VMM/VMMAll/TMAllCpu.cpp +++ b/src/VBox/VMM/VMMAll/TMAllCpu.cpp @@ -1,4 +1,4 @@ -/* $Id: TMAllCpu.cpp 20689 2009-06-18 12:13:14Z vboxsync $ */ +/* $Id: TMAllCpu.cpp $ */ /** @file * TM - Timeout Manager, CPU Time, All Contexts. */ diff --git a/src/VBox/VMM/VMMAll/TMAllReal.cpp b/src/VBox/VMM/VMMAll/TMAllReal.cpp index f3f101fef..f55183145 100644 --- a/src/VBox/VMM/VMMAll/TMAllReal.cpp +++ b/src/VBox/VMM/VMMAll/TMAllReal.cpp @@ -1,4 +1,4 @@ -/* $Id: TMAllReal.cpp 12989 2008-10-06 02:15:39Z vboxsync $ */ +/* $Id: TMAllReal.cpp $ */ /** @file * TM - Timeout Manager, Real Time, All Contexts. */ diff --git a/src/VBox/VMM/VMMAll/TMAllVirtual.cpp b/src/VBox/VMM/VMMAll/TMAllVirtual.cpp index aa4667a99..d4f1d9a7d 100644 --- a/src/VBox/VMM/VMMAll/TMAllVirtual.cpp +++ b/src/VBox/VMM/VMMAll/TMAllVirtual.cpp @@ -1,4 +1,4 @@ -/* $Id: TMAllVirtual.cpp 20050 2009-05-26 17:12:12Z vboxsync $ */ +/* $Id: TMAllVirtual.cpp $ */ /** @file * TM - Timeout Manager, Virtual Time, All Contexts. */ diff --git a/src/VBox/VMM/VMMAll/TRPMAll.cpp b/src/VBox/VMM/VMMAll/TRPMAll.cpp index 3071bc7c1..40b9a71ef 100644 --- a/src/VBox/VMM/VMMAll/TRPMAll.cpp +++ b/src/VBox/VMM/VMMAll/TRPMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: TRPMAll.cpp 20840 2009-06-23 14:44:13Z vboxsync $ */ +/* $Id: TRPMAll.cpp $ */ /** @file * TRPM - Trap Monitor - Any Context. */ diff --git a/src/VBox/VMM/VMMAll/VMAll.cpp b/src/VBox/VMM/VMMAll/VMAll.cpp index 1b547dfab..f8ee9f568 100644 --- a/src/VBox/VMM/VMMAll/VMAll.cpp +++ b/src/VBox/VMM/VMMAll/VMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: VMAll.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: VMAll.cpp $ */ /** @file * VM - Virtual Machine All Contexts. */ diff --git a/src/VBox/VMM/VMMAll/VMMAll.cpp b/src/VBox/VMM/VMMAll/VMMAll.cpp index ae2590711..d2636a733 100644 --- a/src/VBox/VMM/VMMAll/VMMAll.cpp +++ b/src/VBox/VMM/VMMAll/VMMAll.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMAll.cpp 19476 2009-05-07 11:06:26Z vboxsync $ */ +/* $Id: VMMAll.cpp $ */ /** @file * VMM All Contexts. */ diff --git a/src/VBox/VMM/VMMAll/VMMAllA.asm b/src/VBox/VMM/VMMAll/VMMAllA.asm index fd13c3119..f0d6d51d0 100644 --- a/src/VBox/VMM/VMMAll/VMMAllA.asm +++ b/src/VBox/VMM/VMMAll/VMMAllA.asm @@ -1,4 +1,4 @@ -; $Id: VMMAllA.asm 20999 2009-06-26 23:15:38Z vboxsync $ +; $Id: VMMAllA.asm $ ;; @file ; VMM - All Contexts Assembly Routines. ; diff --git a/src/VBox/VMM/VMMCodingGuidelines.cpp b/src/VBox/VMM/VMMCodingGuidelines.cpp index b088d612b..a007bb268 100644 --- a/src/VBox/VMM/VMMCodingGuidelines.cpp +++ b/src/VBox/VMM/VMMCodingGuidelines.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMCodingGuidelines.cpp 9212 2008-05-29 09:38:38Z vboxsync $ */ +/* $Id: VMMCodingGuidelines.cpp $ */ /** @file * VMM - Coding Guidelines. */ diff --git a/src/VBox/VMM/VMMDocsRawMode.cpp b/src/VBox/VMM/VMMDocsRawMode.cpp index 3c49b71df..f8292427b 100644 --- a/src/VBox/VMM/VMMDocsRawMode.cpp +++ b/src/VBox/VMM/VMMDocsRawMode.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMDocsRawMode.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: VMMDocsRawMode.cpp $ */ /** @file * This file contains the documentation of the raw-mode execution. */ diff --git a/src/VBox/VMM/VMMGC/CPUMGC.cpp b/src/VBox/VMM/VMMGC/CPUMGC.cpp index 3c5c63432..60540ad4c 100644 --- a/src/VBox/VMM/VMMGC/CPUMGC.cpp +++ b/src/VBox/VMM/VMMGC/CPUMGC.cpp @@ -1,4 +1,4 @@ -/* $Id: CPUMGC.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: CPUMGC.cpp $ */ /** @file * CPUM - Guest Context Code. */ diff --git a/src/VBox/VMM/VMMGC/CPUMGCA.asm b/src/VBox/VMM/VMMGC/CPUMGCA.asm index 6a7b64197..4a48e1632 100644 --- a/src/VBox/VMM/VMMGC/CPUMGCA.asm +++ b/src/VBox/VMM/VMMGC/CPUMGCA.asm @@ -1,4 +1,4 @@ -; $Id: CPUMGCA.asm 13960 2008-11-07 13:04:45Z vboxsync $ +; $Id: CPUMGCA.asm $ ;; @file ; CPUM - Guest Context Assembly Routines. ; diff --git a/src/VBox/VMM/VMMGC/EMGCA.asm b/src/VBox/VMM/VMMGC/EMGCA.asm index b39566f1b..e0f70de28 100644 --- a/src/VBox/VMM/VMMGC/EMGCA.asm +++ b/src/VBox/VMM/VMMGC/EMGCA.asm @@ -1,4 +1,4 @@ -; $Id: EMAllA.asm 20278 2007-04-09 11:56:29Z sandervl $ +; $Id: EMAllA.asm $ ;; @file ; EM Assembly Routines. ; diff --git a/src/VBox/VMM/VMMGC/HWACCMGCA.asm b/src/VBox/VMM/VMMGC/HWACCMGCA.asm index 3d20997de..6fedc9331 100644 --- a/src/VBox/VMM/VMMGC/HWACCMGCA.asm +++ b/src/VBox/VMM/VMMGC/HWACCMGCA.asm @@ -1,4 +1,4 @@ -; $Id: HWACCMGCA.asm 15962 2009-01-15 12:33:49Z vboxsync $ +; $Id: HWACCMGCA.asm $ ;; @file ; VMXM - GC vmx helpers ; diff --git a/src/VBox/VMM/VMMGC/IOMGC.cpp b/src/VBox/VMM/VMMGC/IOMGC.cpp index 76ac5e8df..cd27e2278 100644 --- a/src/VBox/VMM/VMMGC/IOMGC.cpp +++ b/src/VBox/VMM/VMMGC/IOMGC.cpp @@ -1,4 +1,4 @@ -/* $Id: IOMGC.cpp 12989 2008-10-06 02:15:39Z vboxsync $ */ +/* $Id: IOMGC.cpp $ */ /** @file * IOM - Input / Output Monitor - Guest Context. */ diff --git a/src/VBox/VMM/VMMGC/MMRamGC.cpp b/src/VBox/VMM/VMMGC/MMRamGC.cpp index ded8485ba..fa4e6f342 100644 --- a/src/VBox/VMM/VMMGC/MMRamGC.cpp +++ b/src/VBox/VMM/VMMGC/MMRamGC.cpp @@ -1,4 +1,4 @@ -/* $Id: MMRamGC.cpp 19015 2009-04-20 07:54:29Z vboxsync $ */ +/* $Id: MMRamGC.cpp $ */ /** @file * MMRamGC - Guest Context Ram access Routines, pair for MMRamGCA.asm. */ diff --git a/src/VBox/VMM/VMMGC/MMRamGCA.asm b/src/VBox/VMM/VMMGC/MMRamGCA.asm index b5397fabf..138fa49ac 100644 --- a/src/VBox/VMM/VMMGC/MMRamGCA.asm +++ b/src/VBox/VMM/VMMGC/MMRamGCA.asm @@ -1,4 +1,4 @@ -; $Id: MMRamGCA.asm 12989 2008-10-06 02:15:39Z vboxsync $ +; $Id: MMRamGCA.asm $ ;; @file ; MMRamGCA - Guest Context Ram access Assembly Routines. ; diff --git a/src/VBox/VMM/VMMGC/PDMGCDevice.cpp b/src/VBox/VMM/VMMGC/PDMGCDevice.cpp index f5061dcd2..4b677bf1a 100644 --- a/src/VBox/VMM/VMMGC/PDMGCDevice.cpp +++ b/src/VBox/VMM/VMMGC/PDMGCDevice.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMGCDevice.cpp 20902 2009-06-24 18:26:25Z vboxsync $ */ +/* $Id: PDMGCDevice.cpp $ */ /** @file * PDM - Pluggable Device and Driver Manager, GC Device parts. */ diff --git a/src/VBox/VMM/VMMGC/PGMGC.cpp b/src/VBox/VMM/VMMGC/PGMGC.cpp index cea22db18..a1983372f 100644 --- a/src/VBox/VMM/VMMGC/PGMGC.cpp +++ b/src/VBox/VMM/VMMGC/PGMGC.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMGC.cpp 13235 2008-10-13 20:48:53Z vboxsync $ */ +/* $Id: PGMGC.cpp $ */ /** @file * PGM - Page Monitor, Guest Context. */ diff --git a/src/VBox/VMM/VMMGC/PGMGCBth.h b/src/VBox/VMM/VMMGC/PGMGCBth.h index 23052fab1..54b13f087 100644 --- a/src/VBox/VMM/VMMGC/PGMGCBth.h +++ b/src/VBox/VMM/VMMGC/PGMGCBth.h @@ -1,4 +1,4 @@ -/* $Id: PGMGCBth.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: PGMGCBth.h $ */ /** @file * VBox - Page Manager, Shadow+Guest Paging Template - Guest Context. */ diff --git a/src/VBox/VMM/VMMGC/PGMGCGst.h b/src/VBox/VMM/VMMGC/PGMGCGst.h index 052baaaba..118a049db 100644 --- a/src/VBox/VMM/VMMGC/PGMGCGst.h +++ b/src/VBox/VMM/VMMGC/PGMGCGst.h @@ -1,4 +1,4 @@ -/* $Id: PGMGCGst.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: PGMGCGst.h $ */ /** @file * VBox - Page Manager, Guest Paging Template - Guest Context. */ diff --git a/src/VBox/VMM/VMMGC/PGMGCShw.h b/src/VBox/VMM/VMMGC/PGMGCShw.h index 428bc71ad..65c90369c 100644 --- a/src/VBox/VMM/VMMGC/PGMGCShw.h +++ b/src/VBox/VMM/VMMGC/PGMGCShw.h @@ -1,4 +1,4 @@ -/* $Id: PGMGCShw.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: PGMGCShw.h $ */ /** @file * VBox - Page Manager, Shadow Paging Template - Guest Context. */ diff --git a/src/VBox/VMM/VMMGC/SELMGC.cpp b/src/VBox/VMM/VMMGC/SELMGC.cpp index 47f1e9179..f98440bd3 100644 --- a/src/VBox/VMM/VMMGC/SELMGC.cpp +++ b/src/VBox/VMM/VMMGC/SELMGC.cpp @@ -1,4 +1,4 @@ -/* $Id: SELMGC.cpp 19141 2009-04-23 13:52:18Z vboxsync $ */ +/* $Id: SELMGC.cpp $ */ /** @file * SELM - The Selector Manager, Guest Context. */ diff --git a/src/VBox/VMM/VMMGC/TRPMGC.cpp b/src/VBox/VMM/VMMGC/TRPMGC.cpp index 707cd54b5..44d2b5be3 100644 --- a/src/VBox/VMM/VMMGC/TRPMGC.cpp +++ b/src/VBox/VMM/VMMGC/TRPMGC.cpp @@ -1,4 +1,4 @@ -/* $Id: TRPMGC.cpp 19141 2009-04-23 13:52:18Z vboxsync $ */ +/* $Id: TRPMGC.cpp $ */ /** @file * TRPM - The Trap Monitor, Guest Context */ diff --git a/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp b/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp index 8c9495a59..3c4408843 100644 --- a/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp +++ b/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp @@ -1,4 +1,4 @@ -/* $Id: TRPMGCHandlers.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: TRPMGCHandlers.cpp $ */ /** @file * TRPM - Guest Context Trap Handlers, CPP part */ diff --git a/src/VBox/VMM/VMMGC/TRPMGCHandlersA.asm b/src/VBox/VMM/VMMGC/TRPMGCHandlersA.asm index 2ab19bbe8..647ff45aa 100644 --- a/src/VBox/VMM/VMMGC/TRPMGCHandlersA.asm +++ b/src/VBox/VMM/VMMGC/TRPMGCHandlersA.asm @@ -1,4 +1,4 @@ -; $Id: TRPMGCHandlersA.asm 20673 2009-06-17 16:00:46Z vboxsync $ +; $Id: TRPMGCHandlersA.asm $ ;; @file ; TRPM - Guest Context Trap Handlers ; diff --git a/src/VBox/VMM/VMMGC/VMMGC.cpp b/src/VBox/VMM/VMMGC/VMMGC.cpp index a2ffcb464..5e873eaec 100644 --- a/src/VBox/VMM/VMMGC/VMMGC.cpp +++ b/src/VBox/VMM/VMMGC/VMMGC.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMGC.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: VMMGC.cpp $ */ /** @file * VMM - Raw-mode Context. */ diff --git a/src/VBox/VMM/VMMGC/VMMGC.def b/src/VBox/VMM/VMMGC/VMMGC.def index 1e7f41b90..8660e8a41 100644 --- a/src/VBox/VMM/VMMGC/VMMGC.def +++ b/src/VBox/VMM/VMMGC/VMMGC.def @@ -1,4 +1,4 @@ -; $Id: VMMGC.def 20824 2009-06-23 12:52:41Z vboxsync $ +; $Id: VMMGC.def $ ;; @file ; VMM Raw-mode Context DLL - Definition file. diff --git a/src/VBox/VMM/VMMGC/VMMGC.mac b/src/VBox/VMM/VMMGC/VMMGC.mac index bc68b678c..c37842d4a 100644 --- a/src/VBox/VMM/VMMGC/VMMGC.mac +++ b/src/VBox/VMM/VMMGC/VMMGC.mac @@ -1,4 +1,4 @@ -; $Id: VMMGC.mac 13813 2008-11-04 21:55:34Z vboxsync $ +; $Id: VMMGC.mac $ ;; @file ; VMMGC - Raw-mode Context Assembly Macros. ; diff --git a/src/VBox/VMM/VMMGC/VMMGC0.asm b/src/VBox/VMM/VMMGC/VMMGC0.asm index 146916a35..9c1cb3767 100644 --- a/src/VBox/VMM/VMMGC/VMMGC0.asm +++ b/src/VBox/VMM/VMMGC/VMMGC0.asm @@ -1,4 +1,4 @@ -; $Id: VMMGC0.asm 8155 2008-04-18 15:16:47Z vboxsync $ +; $Id: VMMGC0.asm $ ;; @file ; VMMGC0 - The first object module in the link. ; diff --git a/src/VBox/VMM/VMMGC/VMMGC99.asm b/src/VBox/VMM/VMMGC/VMMGC99.asm index 2d0242c95..cf26adcb2 100644 --- a/src/VBox/VMM/VMMGC/VMMGC99.asm +++ b/src/VBox/VMM/VMMGC/VMMGC99.asm @@ -1,4 +1,4 @@ -; $Id: VMMGC99.asm 13813 2008-11-04 21:55:34Z vboxsync $ +; $Id: VMMGC99.asm $ ;; @file ; VMMGC99 - The last object module in the link. ; diff --git a/src/VBox/VMM/VMMGC/VMMGCA.asm b/src/VBox/VMM/VMMGC/VMMGCA.asm index ab94ba2d6..67d5a477d 100644 --- a/src/VBox/VMM/VMMGC/VMMGCA.asm +++ b/src/VBox/VMM/VMMGC/VMMGCA.asm @@ -1,4 +1,4 @@ -; $Id: VMMGCA.asm 13813 2008-11-04 21:55:34Z vboxsync $ +; $Id: VMMGCA.asm $ ;; @file ; VMMGC - Raw-mode Context Virtual Machine Monitor assembly routines. ; diff --git a/src/VBox/VMM/VMMGC/VMMGCBuiltin.def b/src/VBox/VMM/VMMGC/VMMGCBuiltin.def index 0d592b235..e3efacc4e 100644 --- a/src/VBox/VMM/VMMGC/VMMGCBuiltin.def +++ b/src/VBox/VMM/VMMGC/VMMGCBuiltin.def @@ -1,4 +1,4 @@ -; $Id: VMMGCBuiltin.def 19015 2009-04-20 07:54:29Z vboxsync $ +; $Id: VMMGCBuiltin.def $ ;; @file ; VMM Raw-mode Context Builtin DLL - Definition file for generating import library. ; diff --git a/src/VBox/VMM/VMMGC/VMMGCDeps.cpp b/src/VBox/VMM/VMMGC/VMMGCDeps.cpp index 41eb921f1..91153725e 100644 --- a/src/VBox/VMM/VMMGC/VMMGCDeps.cpp +++ b/src/VBox/VMM/VMMGC/VMMGCDeps.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMGCDeps.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: VMMGCDeps.cpp $ */ /** @file * VMMGC Runtime Dependencies. */ diff --git a/src/VBox/VMM/VMMGuruMeditation.cpp b/src/VBox/VMM/VMMGuruMeditation.cpp index ab3c4e145..071792c0a 100644 --- a/src/VBox/VMM/VMMGuruMeditation.cpp +++ b/src/VBox/VMM/VMMGuruMeditation.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMGuruMeditation.cpp 20875 2009-06-24 02:29:17Z vboxsync $ */ +/* $Id: VMMGuruMeditation.cpp $ */ /** @file * VMM - The Virtual Machine Monitor, Guru Meditation Code. */ diff --git a/src/VBox/VMM/VMMInternal.h b/src/VBox/VMM/VMMInternal.h index 0c19663a4..3ac7cbf72 100644 --- a/src/VBox/VMM/VMMInternal.h +++ b/src/VBox/VMM/VMMInternal.h @@ -1,4 +1,4 @@ -/* $Id: VMMInternal.h 20992 2009-06-26 18:20:27Z vboxsync $ */ +/* $Id: VMMInternal.h $ */ /** @file * VMM - Internal header file. */ diff --git a/src/VBox/VMM/VMMInternal.mac b/src/VBox/VMM/VMMInternal.mac index 540702bbf..76bba859a 100644 --- a/src/VBox/VMM/VMMInternal.mac +++ b/src/VBox/VMM/VMMInternal.mac @@ -1,4 +1,4 @@ -; $Id: VMMInternal.mac 20992 2009-06-26 18:20:27Z vboxsync $ +; $Id: VMMInternal.mac $ ;; @file ; VMM - Internal header file. ; diff --git a/src/VBox/VMM/VMMR0/CPUMR0.cpp b/src/VBox/VMM/VMMR0/CPUMR0.cpp index 8e799f2e3..26a658053 100644 --- a/src/VBox/VMM/VMMR0/CPUMR0.cpp +++ b/src/VBox/VMM/VMMR0/CPUMR0.cpp @@ -1,4 +1,4 @@ -/* $Id: CPUMR0.cpp 20997 2009-06-26 22:23:04Z vboxsync $ */ +/* $Id: CPUMR0.cpp $ */ /** @file * CPUM - Host Context Ring 0. */ diff --git a/src/VBox/VMM/VMMR0/CPUMR0A.asm b/src/VBox/VMM/VMMR0/CPUMR0A.asm index d57fda1aa..ca342d3ef 100644 --- a/src/VBox/VMM/VMMR0/CPUMR0A.asm +++ b/src/VBox/VMM/VMMR0/CPUMR0A.asm @@ -1,4 +1,4 @@ -; $Id: CPUMR0A.asm 21039 2009-06-29 15:57:39Z vboxsync $ +; $Id: CPUMR0A.asm $ ;; @file ; CPUM - Guest Context Assembly Routines. ; diff --git a/src/VBox/VMM/VMMR0/CPUMR0UnusedA.asm b/src/VBox/VMM/VMMR0/CPUMR0UnusedA.asm index 4cfafa992..02edcb0ed 100644 --- a/src/VBox/VMM/VMMR0/CPUMR0UnusedA.asm +++ b/src/VBox/VMM/VMMR0/CPUMR0UnusedA.asm @@ -1,4 +1,4 @@ -; $Id: CPUMR0UnusedA.asm 20539 2009-06-13 21:22:54Z vboxsync $ +; $Id: CPUMR0UnusedA.asm $ ;; @file ; CPUM - Guest Context Assembly Routines. ; diff --git a/src/VBox/VMM/VMMR0/GMMR0.cpp b/src/VBox/VMM/VMMR0/GMMR0.cpp index b401b8720..16f60957e 100644 --- a/src/VBox/VMM/VMMR0/GMMR0.cpp +++ b/src/VBox/VMM/VMMR0/GMMR0.cpp @@ -1,4 +1,4 @@ -/* $Id: GMMR0.cpp 20900 2009-06-24 18:05:15Z vboxsync $ */ +/* $Id: GMMR0.cpp $ */ /** @file * GMM - Global Memory Manager. */ diff --git a/src/VBox/VMM/VMMR0/GMMR0Internal.h b/src/VBox/VMM/VMMR0/GMMR0Internal.h index 782ce85de..fababee62 100644 --- a/src/VBox/VMM/VMMR0/GMMR0Internal.h +++ b/src/VBox/VMM/VMMR0/GMMR0Internal.h @@ -1,4 +1,4 @@ -/* $Id: GMMR0Internal.h 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: GMMR0Internal.h $ */ /** @file * GMM - The Global Memory Manager, Internal Header. */ diff --git a/src/VBox/VMM/VMMR0/GVMMR0.cpp b/src/VBox/VMM/VMMR0/GVMMR0.cpp index e8020d8e7..22c051b91 100644 --- a/src/VBox/VMM/VMMR0/GVMMR0.cpp +++ b/src/VBox/VMM/VMMR0/GVMMR0.cpp @@ -1,4 +1,4 @@ -/* $Id: GVMMR0.cpp 19707 2009-05-14 17:36:11Z vboxsync $ */ +/* $Id: GVMMR0.cpp $ */ /** @file * GVMM - Global VM Manager. */ diff --git a/src/VBox/VMM/VMMR0/GVMMR0Internal.h b/src/VBox/VMM/VMMR0/GVMMR0Internal.h index 16bb292f2..0da63b0f1 100644 --- a/src/VBox/VMM/VMMR0/GVMMR0Internal.h +++ b/src/VBox/VMM/VMMR0/GVMMR0Internal.h @@ -1,4 +1,4 @@ -/* $Id: GVMMR0Internal.h 19360 2009-05-05 10:14:15Z vboxsync $ */ +/* $Id: GVMMR0Internal.h $ */ /** @file * GVMM - The Global VM Manager, Internal header. */ diff --git a/src/VBox/VMM/VMMR0/HWACCMR0.cpp b/src/VBox/VMM/VMMR0/HWACCMR0.cpp index ba6362cad..82a5571db 100644 --- a/src/VBox/VMM/VMMR0/HWACCMR0.cpp +++ b/src/VBox/VMM/VMMR0/HWACCMR0.cpp @@ -1,4 +1,4 @@ -/* $Id: HWACCMR0.cpp 20981 2009-06-26 15:03:24Z vboxsync $ */ +/* $Id: HWACCMR0.cpp $ */ /** @file * HWACCM - Host Context Ring 0. */ diff --git a/src/VBox/VMM/VMMR0/HWACCMR0A.asm b/src/VBox/VMM/VMMR0/HWACCMR0A.asm index c992b4723..acbd67f27 100644 --- a/src/VBox/VMM/VMMR0/HWACCMR0A.asm +++ b/src/VBox/VMM/VMMR0/HWACCMR0A.asm @@ -1,4 +1,4 @@ -; $Id: HWACCMR0A.asm 21001 2009-06-26 23:18:11Z vboxsync $ +; $Id: HWACCMR0A.asm $ ;; @file ; VMXM - R0 vmx helpers ; diff --git a/src/VBox/VMM/VMMR0/HWACCMR0Mixed.mac b/src/VBox/VMM/VMMR0/HWACCMR0Mixed.mac index 29325e51d..eee829c86 100644 --- a/src/VBox/VMM/VMMR0/HWACCMR0Mixed.mac +++ b/src/VBox/VMM/VMMR0/HWACCMR0Mixed.mac @@ -1,4 +1,4 @@ -; $Id: HWACCMR0Mixed.mac 20996 2009-06-26 22:20:02Z vboxsync $ +; $Id: HWACCMR0Mixed.mac $ ;; @file ; HWACCMR0Mixed.mac - Stuff that darwin needs to build two versions of. ; diff --git a/src/VBox/VMM/VMMR0/HWSVMR0.cpp b/src/VBox/VMM/VMMR0/HWSVMR0.cpp index a9bd46d4f..1eecf9870 100644 --- a/src/VBox/VMM/VMMR0/HWSVMR0.cpp +++ b/src/VBox/VMM/VMMR0/HWSVMR0.cpp @@ -1,4 +1,4 @@ -/* $Id: HWSVMR0.cpp 21001 2009-06-26 23:18:11Z vboxsync $ */ +/* $Id: HWSVMR0.cpp $ */ /** @file * HWACCM SVM - Host Context Ring 0. */ @@ -428,7 +428,7 @@ static int SVMR0CheckPendingInterrupt(PVM pVM, PVMCPU pVCpu, SVM_VMCB *pVMCB, CP /* If an active trap is already pending, then we must forward it first! */ if (!TRPMHasTrap(pVCpu)) { - if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI_BIT)) + if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI)) { SVM_EVENT Event; @@ -1068,7 +1068,7 @@ ResumeExecution: pVCpu->hwaccm.s.idLastCpu = pCpu->idCpu; /* Check for tlb shootdown flushes. */ - if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_TLB_FLUSH_BIT)) + if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_TLB_FLUSH)) pVCpu->hwaccm.s.fForceTLBFlush = true; /* Make sure we flush the TLB when required. Switch ASID to achieve the same thing, but without actually flushing the whole TLB (which is expensive). */ diff --git a/src/VBox/VMM/VMMR0/HWSVMR0.h b/src/VBox/VMM/VMMR0/HWSVMR0.h index bf49a8f07..0640e19d8 100644 --- a/src/VBox/VMM/VMMR0/HWSVMR0.h +++ b/src/VBox/VMM/VMMR0/HWSVMR0.h @@ -1,4 +1,4 @@ -/* $Id: HWSVMR0.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: HWSVMR0.h $ */ /** @file * HWACCM AMD-V - Internal header file. */ diff --git a/src/VBox/VMM/VMMR0/HWVMXR0.cpp b/src/VBox/VMM/VMMR0/HWVMXR0.cpp index bacaa0fa9..60f85de3f 100644 --- a/src/VBox/VMM/VMMR0/HWVMXR0.cpp +++ b/src/VBox/VMM/VMMR0/HWVMXR0.cpp @@ -1,4 +1,4 @@ -/* $Id: HWVMXR0.cpp 21001 2009-06-26 23:18:11Z vboxsync $ */ +/* $Id: HWVMXR0.cpp $ */ /** @file * HWACCM VMX - Host Context Ring 0. */ @@ -756,7 +756,7 @@ static int VMXR0CheckPendingInterrupt(PVM pVM, PVMCPU pVCpu, CPUMCTX *pCtx) /* If an active trap is already pending, then we must forward it first! */ if (!TRPMHasTrap(pVCpu)) { - if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI_BIT)) + if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI)) { RTGCUINTPTR intInfo; @@ -1870,7 +1870,7 @@ static void vmxR0SetupTLBEPT(PVM pVM, PVMCPU pVCpu) Assert(!pCpu->fFlushTLB); /* Check for tlb shootdown flushes. */ - if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_TLB_FLUSH_BIT)) + if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_TLB_FLUSH)) pVCpu->hwaccm.s.fForceTLBFlush = true; pVCpu->hwaccm.s.idLastCpu = pCpu->idCpu; @@ -1935,7 +1935,7 @@ static void vmxR0SetupTLBVPID(PVM pVM, PVMCPU pVCpu) pVCpu->hwaccm.s.idLastCpu = pCpu->idCpu; /* Check for tlb shootdown flushes. */ - if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_TLB_FLUSH_BIT)) + if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_TLB_FLUSH)) pVCpu->hwaccm.s.fForceTLBFlush = true; /* Make sure we flush the TLB when required. Switch ASID to achieve the same thing, but without actually flushing the whole TLB (which is expensive). */ diff --git a/src/VBox/VMM/VMMR0/HWVMXR0.h b/src/VBox/VMM/VMMR0/HWVMXR0.h index e30462582..f0c9fe55d 100644 --- a/src/VBox/VMM/VMMR0/HWVMXR0.h +++ b/src/VBox/VMM/VMMR0/HWVMXR0.h @@ -1,4 +1,4 @@ -/* $Id: HWVMXR0.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: HWVMXR0.h $ */ /** @file * HWACCM VT-x - Internal header file. */ diff --git a/src/VBox/VMM/VMMR0/PDMR0Device.cpp b/src/VBox/VMM/VMMR0/PDMR0Device.cpp index c60e1aa94..0d0ed8537 100644 --- a/src/VBox/VMM/VMMR0/PDMR0Device.cpp +++ b/src/VBox/VMM/VMMR0/PDMR0Device.cpp @@ -1,4 +1,4 @@ -/* $Id: PDMR0Device.cpp 21016 2009-06-29 07:53:50Z vboxsync $ */ +/* $Id: PDMR0Device.cpp $ */ /** @file * PDM - Pluggable Device and Driver Manager, R0 Device parts. */ diff --git a/src/VBox/VMM/VMMR0/PGMR0.cpp b/src/VBox/VMM/VMMR0/PGMR0.cpp index 2c0ee3875..527a6c4e8 100644 --- a/src/VBox/VMM/VMMR0/PGMR0.cpp +++ b/src/VBox/VMM/VMMR0/PGMR0.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMR0.cpp 20671 2009-06-17 15:23:14Z vboxsync $ */ +/* $Id: PGMR0.cpp $ */ /** @file * PGM - Page Manager and Monitor, Ring-0. */ diff --git a/src/VBox/VMM/VMMR0/PGMR0Bth.h b/src/VBox/VMM/VMMR0/PGMR0Bth.h index 1ff3a8d01..c1ed94bf7 100644 --- a/src/VBox/VMM/VMMR0/PGMR0Bth.h +++ b/src/VBox/VMM/VMMR0/PGMR0Bth.h @@ -1,4 +1,4 @@ -/* $Id: PGMR0Bth.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: PGMR0Bth.h $ */ /** @file * VBox - Page Manager / Monitor, Shadow+Guest Paging Template. */ diff --git a/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp b/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp index ffc05a221..bae3a82ff 100644 --- a/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp +++ b/src/VBox/VMM/VMMR0/PGMR0DynMap.cpp @@ -1,4 +1,4 @@ -/* $Id: PGMR0DynMap.cpp 20874 2009-06-24 02:19:29Z vboxsync $ */ +/* $Id: PGMR0DynMap.cpp $ */ /** @file * PGM - Page Manager and Monitor, ring-0 dynamic mapping cache. */ diff --git a/src/VBox/VMM/VMMR0/TRPMR0.cpp b/src/VBox/VMM/VMMR0/TRPMR0.cpp index 82c67bc72..1d7bbbba9 100644 --- a/src/VBox/VMM/VMMR0/TRPMR0.cpp +++ b/src/VBox/VMM/VMMR0/TRPMR0.cpp @@ -1,4 +1,4 @@ -/* $Id: TRPMR0.cpp 19207 2009-04-27 12:05:38Z vboxsync $ */ +/* $Id: TRPMR0.cpp $ */ /** @file * TRPM - The Trap Monitor - HC Ring 0 */ diff --git a/src/VBox/VMM/VMMR0/TRPMR0A.asm b/src/VBox/VMM/VMMR0/TRPMR0A.asm index 55107be79..4a0d4fb8e 100644 --- a/src/VBox/VMM/VMMR0/TRPMR0A.asm +++ b/src/VBox/VMM/VMMR0/TRPMR0A.asm @@ -1,4 +1,4 @@ -; $Id: TRPMR0A.asm 14515 2008-11-24 12:33:00Z vboxsync $ +; $Id: TRPMR0A.asm $ ;; @file ; TRPM - Host Context Ring-0 ; diff --git a/src/VBox/VMM/VMMR0/VMMR0.cpp b/src/VBox/VMM/VMMR0/VMMR0.cpp index ff8927daa..a3ca5e1fb 100644 --- a/src/VBox/VMM/VMMR0/VMMR0.cpp +++ b/src/VBox/VMM/VMMR0/VMMR0.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMR0.cpp 20984 2009-06-26 15:21:07Z vboxsync $ */ +/* $Id: VMMR0.cpp $ */ /** @file * VMM - Host Context Ring 0. */ diff --git a/src/VBox/VMM/VMMR0/VMMR0.def b/src/VBox/VMM/VMMR0/VMMR0.def index fe991d5a7..5744a8f03 100644 --- a/src/VBox/VMM/VMMR0/VMMR0.def +++ b/src/VBox/VMM/VMMR0/VMMR0.def @@ -1,4 +1,4 @@ -; $Id: VMMR0.def 20825 2009-06-23 12:55:36Z vboxsync $ +; $Id: VMMR0.def $ ;; @file ; VMM Ring 0 DLL - Definition file. diff --git a/src/VBox/VMM/VMMR0/VMMR0JmpA-amd64.asm b/src/VBox/VMM/VMMR0/VMMR0JmpA-amd64.asm index 21b4bb3d4..f40b27e33 100644 --- a/src/VBox/VMM/VMMR0/VMMR0JmpA-amd64.asm +++ b/src/VBox/VMM/VMMR0/VMMR0JmpA-amd64.asm @@ -1,4 +1,4 @@ -; $Id: VMMR0JmpA-amd64.asm 20992 2009-06-26 18:20:27Z vboxsync $ +; $Id: VMMR0JmpA-amd64.asm $ ;; @file ; VMM - R0 SetJmp / LongJmp routines for AMD64. ; diff --git a/src/VBox/VMM/VMMR0/VMMR0JmpA-x86.asm b/src/VBox/VMM/VMMR0/VMMR0JmpA-x86.asm index f6f86f272..89865351e 100644 --- a/src/VBox/VMM/VMMR0/VMMR0JmpA-x86.asm +++ b/src/VBox/VMM/VMMR0/VMMR0JmpA-x86.asm @@ -1,4 +1,4 @@ -; $Id: VMMR0JmpA-x86.asm 20875 2009-06-24 02:29:17Z vboxsync $ +; $Id: VMMR0JmpA-x86.asm $ ;; @file ; VMM - R0 SetJmp / LongJmp routines for X86. ; diff --git a/src/VBox/VMM/VMMRZ/DBGFRZ.cpp b/src/VBox/VMM/VMMRZ/DBGFRZ.cpp index 942205e95..86668182d 100644 --- a/src/VBox/VMM/VMMRZ/DBGFRZ.cpp +++ b/src/VBox/VMM/VMMRZ/DBGFRZ.cpp @@ -1,4 +1,4 @@ -/* $Id: DBGFRZ.cpp 19288 2009-05-01 13:09:18Z vboxsync $ */ +/* $Id: DBGFRZ.cpp $ */ /** @file * DBGF - Debugger Facility, RZ part. */ diff --git a/src/VBox/VMM/VMMRZ/VMMRZ.cpp b/src/VBox/VMM/VMMRZ/VMMRZ.cpp index b91fce55c..e4f349b06 100644 --- a/src/VBox/VMM/VMMRZ/VMMRZ.cpp +++ b/src/VBox/VMM/VMMRZ/VMMRZ.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMRZ.cpp 20875 2009-06-24 02:29:17Z vboxsync $ */ +/* $Id: VMMRZ.cpp $ */ /** @file * VMM - Virtual Machine Monitor, Raw-mode and ring-0 context code. */ diff --git a/src/VBox/VMM/VMMSwitcher.cpp b/src/VBox/VMM/VMMSwitcher.cpp index 6272e7d78..7e7cc9fb9 100644 --- a/src/VBox/VMM/VMMSwitcher.cpp +++ b/src/VBox/VMM/VMMSwitcher.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMSwitcher.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: VMMSwitcher.cpp $ */ /** @file * VMM - The Virtual Machine Monitor, World Switcher(s). */ diff --git a/src/VBox/VMM/VMMSwitcher/32BitTo32Bit.asm b/src/VBox/VMM/VMMSwitcher/32BitTo32Bit.asm index 6310a421f..471d46c94 100644 --- a/src/VBox/VMM/VMMSwitcher/32BitTo32Bit.asm +++ b/src/VBox/VMM/VMMSwitcher/32BitTo32Bit.asm @@ -1,4 +1,4 @@ -; $Id: 32BitTo32Bit.asm 16859 2009-02-17 16:19:51Z vboxsync $ +; $Id: 32BitTo32Bit.asm $ ;; @file ; VMM - World Switchers, 32-Bit to 32-Bit. ; diff --git a/src/VBox/VMM/VMMSwitcher/32BitToAMD64.asm b/src/VBox/VMM/VMMSwitcher/32BitToAMD64.asm index 4dfce7f98..64783b32d 100644 --- a/src/VBox/VMM/VMMSwitcher/32BitToAMD64.asm +++ b/src/VBox/VMM/VMMSwitcher/32BitToAMD64.asm @@ -1,4 +1,4 @@ -; $Id: 32BitToAMD64.asm 14890 2008-12-02 10:47:49Z vboxsync $ +; $Id: 32BitToAMD64.asm $ ;; @file ; VMM - World Switchers, 32-Bit to AMD64 ; diff --git a/src/VBox/VMM/VMMSwitcher/32BitToPAE.asm b/src/VBox/VMM/VMMSwitcher/32BitToPAE.asm index 1b20b2686..cc2af951d 100644 --- a/src/VBox/VMM/VMMSwitcher/32BitToPAE.asm +++ b/src/VBox/VMM/VMMSwitcher/32BitToPAE.asm @@ -1,4 +1,4 @@ -; $Id: 32BitToPAE.asm 16859 2009-02-17 16:19:51Z vboxsync $ +; $Id: 32BitToPAE.asm $ ;; @file ; VMM - World Switchers, 32-Bit to 32-Bit. ; diff --git a/src/VBox/VMM/VMMSwitcher/AMD64To32Bit.asm b/src/VBox/VMM/VMMSwitcher/AMD64To32Bit.asm index 39a2df2e3..7260b6366 100644 --- a/src/VBox/VMM/VMMSwitcher/AMD64To32Bit.asm +++ b/src/VBox/VMM/VMMSwitcher/AMD64To32Bit.asm @@ -1,4 +1,4 @@ -; $Id: AMD64To32Bit.asm 16859 2009-02-17 16:19:51Z vboxsync $ +; $Id: AMD64To32Bit.asm $ ;; @file ; VMM - World Switchers, AMD64 to 32-bit ; diff --git a/src/VBox/VMM/VMMSwitcher/AMD64ToPAE.asm b/src/VBox/VMM/VMMSwitcher/AMD64ToPAE.asm index 53d51f8bd..4fc2e4976 100644 --- a/src/VBox/VMM/VMMSwitcher/AMD64ToPAE.asm +++ b/src/VBox/VMM/VMMSwitcher/AMD64ToPAE.asm @@ -1,4 +1,4 @@ -; $Id: AMD64ToPAE.asm 16859 2009-02-17 16:19:51Z vboxsync $ +; $Id: AMD64ToPAE.asm $ ;; @file ; VMM - World Switchers, PAE to PAE ; diff --git a/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac b/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac index 1426c6bcf..4d721fbea 100644 --- a/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac +++ b/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac @@ -1,4 +1,4 @@ -; $Id: AMD64andLegacy.mac 18927 2009-04-16 11:41:38Z vboxsync $ +; $Id: AMD64andLegacy.mac $ ;; @file ; VMM - World Switchers, template for AMD64 to PAE and 32-bit. ; diff --git a/src/VBox/VMM/VMMSwitcher/PAETo32Bit.asm b/src/VBox/VMM/VMMSwitcher/PAETo32Bit.asm index ef8e05bba..d7316f225 100644 --- a/src/VBox/VMM/VMMSwitcher/PAETo32Bit.asm +++ b/src/VBox/VMM/VMMSwitcher/PAETo32Bit.asm @@ -1,4 +1,4 @@ -; $Id: PAETo32Bit.asm 16859 2009-02-17 16:19:51Z vboxsync $ +; $Id: PAETo32Bit.asm $ ;; @file ; VMM - World Switchers, PAE to PAE ; diff --git a/src/VBox/VMM/VMMSwitcher/PAEToAMD64.asm b/src/VBox/VMM/VMMSwitcher/PAEToAMD64.asm index 910bbb401..02e08a3b1 100644 --- a/src/VBox/VMM/VMMSwitcher/PAEToAMD64.asm +++ b/src/VBox/VMM/VMMSwitcher/PAEToAMD64.asm @@ -1,4 +1,4 @@ -; $Id: PAEToAMD64.asm 14892 2008-12-02 11:10:19Z vboxsync $ +; $Id: PAEToAMD64.asm $ ;; @file ; VMM - World Switchers, PAE to AMD64 ; diff --git a/src/VBox/VMM/VMMSwitcher/PAEToPAE.asm b/src/VBox/VMM/VMMSwitcher/PAEToPAE.asm index cc6a43aca..6aea5ad7b 100644 --- a/src/VBox/VMM/VMMSwitcher/PAEToPAE.asm +++ b/src/VBox/VMM/VMMSwitcher/PAEToPAE.asm @@ -1,4 +1,4 @@ -; $Id: PAEToPAE.asm 16859 2009-02-17 16:19:51Z vboxsync $ +; $Id: PAEToPAE.asm $ ;; @file ; VMM - World Switchers, PAE to PAE ; diff --git a/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac b/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac index a185769cd..4505db638 100644 --- a/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac +++ b/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac @@ -1,4 +1,4 @@ -; $Id: PAEand32Bit.mac 18927 2009-04-16 11:41:38Z vboxsync $ +; $Id: PAEand32Bit.mac $ ;; @file ; VMM - World Switchers, template for PAE and 32-Bit. ; diff --git a/src/VBox/VMM/VMMSwitcher/VMMSwitcher.h b/src/VBox/VMM/VMMSwitcher/VMMSwitcher.h index 708ade217..6c6d6d4e8 100644 --- a/src/VBox/VMM/VMMSwitcher/VMMSwitcher.h +++ b/src/VBox/VMM/VMMSwitcher/VMMSwitcher.h @@ -1,4 +1,4 @@ -/* $Id: VMMSwitcher.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: VMMSwitcher.h $ */ /** @file * VMM - World Switchers. */ diff --git a/src/VBox/VMM/VMMSwitcher/VMMSwitcher.mac b/src/VBox/VMM/VMMSwitcher/VMMSwitcher.mac index 0b4ffe312..319afa90c 100644 --- a/src/VBox/VMM/VMMSwitcher/VMMSwitcher.mac +++ b/src/VBox/VMM/VMMSwitcher/VMMSwitcher.mac @@ -1,4 +1,4 @@ -; $Id: VMMSwitcher.mac 18927 2009-04-16 11:41:38Z vboxsync $ +; $Id: VMMSwitcher.mac $ ;; @file ; VMM - World Switchers. ; diff --git a/src/VBox/VMM/VMMTests.cpp b/src/VBox/VMM/VMMTests.cpp index 648a80fec..a2ab9e314 100644 --- a/src/VBox/VMM/VMMTests.cpp +++ b/src/VBox/VMM/VMMTests.cpp @@ -1,4 +1,4 @@ -/* $Id: VMMTests.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: VMMTests.cpp $ */ /** @file * VMM - The Virtual Machine Monitor Core, Tests. */ diff --git a/src/VBox/VMM/VMReq.cpp b/src/VBox/VMM/VMReq.cpp index 894145eae..e905de9ab 100644 --- a/src/VBox/VMM/VMReq.cpp +++ b/src/VBox/VMM/VMReq.cpp @@ -1,4 +1,4 @@ -/* $Id: VMReq.cpp 20880 2009-06-24 08:10:25Z vboxsync $ */ +/* $Id: VMReq.cpp $ */ /** @file * VM - Virtual Machine */ diff --git a/src/VBox/VMM/testcase/Makefile.kmk b/src/VBox/VMM/testcase/Makefile.kmk index 57124db5e..2ee2b970a 100644 --- a/src/VBox/VMM/testcase/Makefile.kmk +++ b/src/VBox/VMM/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20543 2009-06-13 22:09:32Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the VMM testcases. # diff --git a/src/VBox/VMM/testcase/mkdsk.sh b/src/VBox/VMM/testcase/mkdsk.sh index 3201eee37..3201eee37 100644..100755 --- a/src/VBox/VMM/testcase/mkdsk.sh +++ b/src/VBox/VMM/testcase/mkdsk.sh diff --git a/src/VBox/VMM/testcase/tstAnimate.cpp b/src/VBox/VMM/testcase/tstAnimate.cpp index 93dd8035f..b9b4e23ca 100644 --- a/src/VBox/VMM/testcase/tstAnimate.cpp +++ b/src/VBox/VMM/testcase/tstAnimate.cpp @@ -1,4 +1,4 @@ -/* $Id: tstAnimate.cpp 19500 2009-05-07 18:23:22Z vboxsync $ */ +/* $Id: tstAnimate.cpp $ */ /** @file * VBox Animation Testcase / Tool. */ diff --git a/src/VBox/VMM/testcase/tstAsmStructs.cpp b/src/VBox/VMM/testcase/tstAsmStructs.cpp index 00c5d2203..40d198fe6 100644 --- a/src/VBox/VMM/testcase/tstAsmStructs.cpp +++ b/src/VBox/VMM/testcase/tstAsmStructs.cpp @@ -1,4 +1,4 @@ -/* $Id: tstAsmStructs.cpp 15236 2008-12-10 09:50:10Z vboxsync $ */ +/* $Id: tstAsmStructs.cpp $ */ /** @file * Testcase for checking offsets in the assembly structures shared with C/C++. */ diff --git a/src/VBox/VMM/testcase/tstAsmStructsAsm.asm b/src/VBox/VMM/testcase/tstAsmStructsAsm.asm index c8008818b..ce3111770 100644 --- a/src/VBox/VMM/testcase/tstAsmStructsAsm.asm +++ b/src/VBox/VMM/testcase/tstAsmStructsAsm.asm @@ -1,4 +1,4 @@ -; $Id: tstAsmStructsAsm.asm 15236 2008-12-10 09:50:10Z vboxsync $ +; $Id: tstAsmStructsAsm.asm $ ;; @file ; Assembly / C structure layout testcase. ; diff --git a/src/VBox/VMM/testcase/tstCFGM.cpp b/src/VBox/VMM/testcase/tstCFGM.cpp index e4cf0da2a..8ed557700 100644 --- a/src/VBox/VMM/testcase/tstCFGM.cpp +++ b/src/VBox/VMM/testcase/tstCFGM.cpp @@ -1,4 +1,4 @@ -/* $Id: tstCFGM.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: tstCFGM.cpp $ */ /** @file * Testcase for CFGM. */ diff --git a/src/VBox/VMM/testcase/tstCompiler.cpp b/src/VBox/VMM/testcase/tstCompiler.cpp index ec334de14..ba8cc7249 100644 --- a/src/VBox/VMM/testcase/tstCompiler.cpp +++ b/src/VBox/VMM/testcase/tstCompiler.cpp @@ -1,4 +1,4 @@ -/* $Id: tstCompiler.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: tstCompiler.cpp $ */ /** @file * Testing how the compiler deals with various things. * diff --git a/src/VBox/VMM/testcase/tstGlobalConfig.cpp b/src/VBox/VMM/testcase/tstGlobalConfig.cpp index a9336dd73..069850900 100644 --- a/src/VBox/VMM/testcase/tstGlobalConfig.cpp +++ b/src/VBox/VMM/testcase/tstGlobalConfig.cpp @@ -1,4 +1,4 @@ -/* $Id: tstGlobalConfig.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: tstGlobalConfig.cpp $ */ /** @file * Ring-3 Management program for the GCFGM mock-up. */ diff --git a/src/VBox/VMM/testcase/tstHelp.h b/src/VBox/VMM/testcase/tstHelp.h index 386ff0ae6..65bba0528 100644 --- a/src/VBox/VMM/testcase/tstHelp.h +++ b/src/VBox/VMM/testcase/tstHelp.h @@ -1,4 +1,4 @@ -/* $Id: tstHelp.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: tstHelp.h $ */ /** @file * VMM testcase - Helper stuff. */ diff --git a/src/VBox/VMM/testcase/tstInstrEmul.cpp b/src/VBox/VMM/testcase/tstInstrEmul.cpp index 1bbd3cc2a..fde8d40d8 100644 --- a/src/VBox/VMM/testcase/tstInstrEmul.cpp +++ b/src/VBox/VMM/testcase/tstInstrEmul.cpp @@ -1,4 +1,4 @@ -/* $Id: tstMicro.cpp 37408 2008-10-03 22:22:37Z bird $ */ +/* $Id: tstMicro.cpp $ */ /** @file * Micro Testcase, checking emulation of certain instructions */ diff --git a/src/VBox/VMM/testcase/tstMMHyperHeap.cpp b/src/VBox/VMM/testcase/tstMMHyperHeap.cpp index c1e131a56..b6359503d 100644 --- a/src/VBox/VMM/testcase/tstMMHyperHeap.cpp +++ b/src/VBox/VMM/testcase/tstMMHyperHeap.cpp @@ -1,4 +1,4 @@ -/* $Id: tstMMHyperHeap.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: tstMMHyperHeap.cpp $ */ /** @file * MM Hypervisor Heap testcase. */ diff --git a/src/VBox/VMM/testcase/tstMicro.cpp b/src/VBox/VMM/testcase/tstMicro.cpp index 2526b28f8..a416b3981 100644 --- a/src/VBox/VMM/testcase/tstMicro.cpp +++ b/src/VBox/VMM/testcase/tstMicro.cpp @@ -1,4 +1,4 @@ -/* $Id: tstMicro.cpp 19300 2009-05-01 18:06:59Z vboxsync $ */ +/* $Id: tstMicro.cpp $ */ /** @file * Micro Testcase, profiling special CPU operations. */ diff --git a/src/VBox/VMM/testcase/tstMicro.h b/src/VBox/VMM/testcase/tstMicro.h index 97b1d663a..64c88ce40 100644 --- a/src/VBox/VMM/testcase/tstMicro.h +++ b/src/VBox/VMM/testcase/tstMicro.h @@ -1,4 +1,4 @@ -/* $Id: tstMicro.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: tstMicro.h $ */ /** @file * Micro Testcase, profiling special CPU operations. */ diff --git a/src/VBox/VMM/testcase/tstMicro.mac b/src/VBox/VMM/testcase/tstMicro.mac index 2bc927fae..6a6ebcb5d 100644 --- a/src/VBox/VMM/testcase/tstMicro.mac +++ b/src/VBox/VMM/testcase/tstMicro.mac @@ -1,4 +1,4 @@ -; $Id: tstMicro.mac 13813 2008-11-04 21:55:34Z vboxsync $ +; $Id: tstMicro.mac $ ;; @file ; Micro Testcase, profiling special CPU operations. ; diff --git a/src/VBox/VMM/testcase/tstMicroGC.cpp b/src/VBox/VMM/testcase/tstMicroGC.cpp index 665fea8b8..798912307 100644 --- a/src/VBox/VMM/testcase/tstMicroGC.cpp +++ b/src/VBox/VMM/testcase/tstMicroGC.cpp @@ -1,4 +1,4 @@ -/* $Id: tstMicroGC.cpp 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: tstMicroGC.cpp $ */ /** @file * Micro Testcase, profiling special CPU operations - GC Code (hacks). */ diff --git a/src/VBox/VMM/testcase/tstMicroGCA.asm b/src/VBox/VMM/testcase/tstMicroGCA.asm index a13b6d3d0..22c05e83e 100644 --- a/src/VBox/VMM/testcase/tstMicroGCA.asm +++ b/src/VBox/VMM/testcase/tstMicroGCA.asm @@ -1,4 +1,4 @@ -; $Id: tstMicroGCA.asm 13813 2008-11-04 21:55:34Z vboxsync $ +; $Id: tstMicroGCA.asm $ ;; @file ; tstMicroGCA ; diff --git a/src/VBox/VMM/testcase/tstPDMAsyncCompletion.cpp b/src/VBox/VMM/testcase/tstPDMAsyncCompletion.cpp index 5659b4d8d..0791f9822 100644 --- a/src/VBox/VMM/testcase/tstPDMAsyncCompletion.cpp +++ b/src/VBox/VMM/testcase/tstPDMAsyncCompletion.cpp @@ -1,4 +1,4 @@ -/* $Id: tstPDMAsyncCompletion.cpp 20429 2009-06-09 11:45:08Z vboxsync $ */ +/* $Id: tstPDMAsyncCompletion.cpp $ */ /** @file * PDM Asynchronous Completion Testcase. * diff --git a/src/VBox/VMM/testcase/tstSSM.cpp b/src/VBox/VMM/testcase/tstSSM.cpp index a6e10fae3..721a01a92 100644 --- a/src/VBox/VMM/testcase/tstSSM.cpp +++ b/src/VBox/VMM/testcase/tstSSM.cpp @@ -1,4 +1,4 @@ -/* $Id: tstSSM.cpp 20864 2009-06-23 19:19:42Z vboxsync $ */ +/* $Id: tstSSM.cpp $ */ /** @file * Saved State Manager Testcase. */ diff --git a/src/VBox/VMM/testcase/tstVMM-HwAccm.cpp b/src/VBox/VMM/testcase/tstVMM-HwAccm.cpp index 813588d27..87d08cb61 100644 --- a/src/VBox/VMM/testcase/tstVMM-HwAccm.cpp +++ b/src/VBox/VMM/testcase/tstVMM-HwAccm.cpp @@ -1,4 +1,4 @@ -/* $Id: tstVMM.cpp 17451 2007-01-15 14:08:28Z bird $ */ +/* $Id: tstVMM.cpp $ */ /** @file * VMM Testcase. */ diff --git a/src/VBox/VMM/testcase/tstVMM.cpp b/src/VBox/VMM/testcase/tstVMM.cpp index 52438d3cd..0f3d6d452 100644 --- a/src/VBox/VMM/testcase/tstVMM.cpp +++ b/src/VBox/VMM/testcase/tstVMM.cpp @@ -1,4 +1,4 @@ -/* $Id: tstVMM.cpp 19537 2009-05-08 18:09:57Z vboxsync $ */ +/* $Id: tstVMM.cpp $ */ /** @file * VMM Testcase. */ diff --git a/src/VBox/VMM/testcase/tstVMMFork.cpp b/src/VBox/VMM/testcase/tstVMMFork.cpp index 124ac3349..1bb0d6cb8 100644 --- a/src/VBox/VMM/testcase/tstVMMFork.cpp +++ b/src/VBox/VMM/testcase/tstVMMFork.cpp @@ -1,4 +1,4 @@ -/* $Id: tstVMMFork.cpp 19300 2009-05-01 18:06:59Z vboxsync $ */ +/* $Id: tstVMMFork.cpp $ */ /** @file * VMM Fork Test. */ diff --git a/src/VBox/VMM/testcase/tstVMMR0CallHost-1.cpp b/src/VBox/VMM/testcase/tstVMMR0CallHost-1.cpp index abff23b4b..c9862b672 100644 --- a/src/VBox/VMM/testcase/tstVMMR0CallHost-1.cpp +++ b/src/VBox/VMM/testcase/tstVMMR0CallHost-1.cpp @@ -1,4 +1,4 @@ -/* $Id: tstVMMR0CallHost-1.cpp 20875 2009-06-24 02:29:17Z vboxsync $ */ +/* $Id: tstVMMR0CallHost-1.cpp $ */ /** @file * Testcase for the VMMR0JMPBUF operations. */ diff --git a/src/VBox/VMM/testcase/tstVMREQ.cpp b/src/VBox/VMM/testcase/tstVMREQ.cpp index d377b619b..bcf8f9ee8 100644 --- a/src/VBox/VMM/testcase/tstVMREQ.cpp +++ b/src/VBox/VMM/testcase/tstVMREQ.cpp @@ -1,4 +1,4 @@ -/* $Id: tstVMREQ.cpp 19300 2009-05-01 18:06:59Z vboxsync $ */ +/* $Id: tstVMREQ.cpp $ */ /** @file * VMM Testcase. */ diff --git a/src/VBox/VMM/testcase/tstVMStructGC.cpp b/src/VBox/VMM/testcase/tstVMStructGC.cpp index 52ec8e1a3..c8b9a6779 100644 --- a/src/VBox/VMM/testcase/tstVMStructGC.cpp +++ b/src/VBox/VMM/testcase/tstVMStructGC.cpp @@ -1,4 +1,4 @@ -/* $Id: tstVMStructGC.cpp 20875 2009-06-24 02:29:17Z vboxsync $ */ +/* $Id: tstVMStructGC.cpp $ */ /** @file * tstVMMStructGC - Generate structure member and size checks from the GC perspective. * diff --git a/src/VBox/VMM/testcase/tstVMStructSize.cpp b/src/VBox/VMM/testcase/tstVMStructSize.cpp index b6f50b6a0..df2246beb 100644 --- a/src/VBox/VMM/testcase/tstVMStructSize.cpp +++ b/src/VBox/VMM/testcase/tstVMStructSize.cpp @@ -1,4 +1,4 @@ -/* $Id: tstVMStructSize.cpp 20993 2009-06-26 18:37:15Z vboxsync $ */ +/* $Id: tstVMStructSize.cpp $ */ /** @file * tstVMStructSize - testcase for check structure sizes/alignment * and to verify that HC and GC uses the same diff --git a/src/apps/Makefile.kmk b/src/apps/Makefile.kmk index 0a977f9d2..401120522 100644 --- a/src/apps/Makefile.kmk +++ b/src/apps/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 17855 2009-03-13 18:28:26Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for the external apps. # diff --git a/src/apps/adpctl/Makefile.kmk b/src/apps/adpctl/Makefile.kmk index 648a69faf..4cca36f9f 100644 --- a/src/apps/adpctl/Makefile.kmk +++ b/src/apps/adpctl/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 17993 2009-03-17 07:37:15Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for VBoxAdpCtl # diff --git a/src/apps/adpctl/VBoxNetAdpCtl.cpp b/src/apps/adpctl/VBoxNetAdpCtl.cpp index 56766106e..c93e66fae 100644 --- a/src/apps/adpctl/VBoxNetAdpCtl.cpp +++ b/src/apps/adpctl/VBoxNetAdpCtl.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxNetAdpCtl.cpp 18864 2009-04-10 12:03:59Z vboxsync $ */ +/* $Id: VBoxNetAdpCtl.cpp $ */ /** @file * Apps - VBoxAdpCtl, Configuration tool for vboxnetX adapters. */ diff --git a/src/apps/tunctl/Makefile.kmk b/src/apps/tunctl/Makefile.kmk index d92c41bc6..289752213 100644 --- a/src/apps/tunctl/Makefile.kmk +++ b/src/apps/tunctl/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 31342 2008-05-28 08:44:35Z frank $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for VBoxTunctl # diff --git a/src/bldprogs/Makefile.kmk b/src/bldprogs/Makefile.kmk index d26338d8a..2c3a11c49 100644 --- a/src/bldprogs/Makefile.kmk +++ b/src/bldprogs/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 13155 2008-10-10 08:07:41Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for various generic build tools (there is currently only one of them). # diff --git a/src/bldprogs/bin2c.c b/src/bldprogs/bin2c.c index 316c55323..79b3ff433 100644 --- a/src/bldprogs/bin2c.c +++ b/src/bldprogs/bin2c.c @@ -1,4 +1,4 @@ -/* $Id: bin2c.c 19412 2009-05-06 08:21:39Z vboxsync $ */ +/* $Id: bin2c.c $ */ /** @file * bin2c - Binary 2 C Structure Converter. */ diff --git a/src/bldprogs/biossums.c b/src/bldprogs/biossums.c index 1f6697710..19a23d306 100644 --- a/src/bldprogs/biossums.c +++ b/src/bldprogs/biossums.c @@ -1,4 +1,4 @@ -/* $Id: biossums.c 14076 2008-11-11 07:24:05Z vboxsync $ */ +/* $Id: biossums.c $ */ /** @file * Tool for modifying a BIOS image to write the BIOS checksum. */ diff --git a/src/bldprogs/checkUndefined.sh b/src/bldprogs/checkUndefined.sh index 60879f2ed..60879f2ed 100644..100755 --- a/src/bldprogs/checkUndefined.sh +++ b/src/bldprogs/checkUndefined.sh diff --git a/src/libs/Makefile.kmk b/src/libs/Makefile.kmk index 8b5af4366..2da14a557 100644 --- a/src/libs/Makefile.kmk +++ b/src/libs/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20987 2009-06-26 15:52:38Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Top-level makefile for the external libraries. # diff --git a/src/libs/kStuff/Makefile.kmk b/src/libs/kStuff/Makefile.kmk index 2937ca9fe..4967ad3ca 100644 --- a/src/libs/kStuff/Makefile.kmk +++ b/src/libs/kStuff/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 16438 2009-01-31 01:54:49Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for kStuff, for statically linking into VBoxRT. # diff --git a/src/libs/kStuff/iprt/kHlpAlloc-iprt.cpp b/src/libs/kStuff/iprt/kHlpAlloc-iprt.cpp index 81f03f648..778bb136f 100644 --- a/src/libs/kStuff/iprt/kHlpAlloc-iprt.cpp +++ b/src/libs/kStuff/iprt/kHlpAlloc-iprt.cpp @@ -1,4 +1,4 @@ -/* $Id: kHlpAlloc-iprt.cpp 8155 2008-04-18 15:16:47Z vboxsync $ *//* $Id: kHlpAlloc-iprt.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: kHlpAlloc-iprt.cpp $ */ /** @file * kHlpAlloc - Memory Allocation, IPRT based implementation. */ diff --git a/src/libs/kStuff/iprt/kHlpAssert-iprt.cpp b/src/libs/kStuff/iprt/kHlpAssert-iprt.cpp index b74fde61b..4508274c4 100644 --- a/src/libs/kStuff/iprt/kHlpAssert-iprt.cpp +++ b/src/libs/kStuff/iprt/kHlpAssert-iprt.cpp @@ -1,4 +1,4 @@ -/* $Id: kHlpAssert-iprt.cpp 16404 2009-01-30 06:33:23Z vboxsync $ */ +/* $Id: kHlpAssert-iprt.cpp $ */ /** @file * kHlpEnv - Assertions, IPRT based implementation. */ diff --git a/src/libs/kStuff/iprt/kHlpEnv-iprt.cpp b/src/libs/kStuff/iprt/kHlpEnv-iprt.cpp index c386d12de..e48624101 100644 --- a/src/libs/kStuff/iprt/kHlpEnv-iprt.cpp +++ b/src/libs/kStuff/iprt/kHlpEnv-iprt.cpp @@ -1,4 +1,4 @@ -/* $Id: kHlpEnv-iprt.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: kHlpEnv-iprt.cpp $ */ /** @file * kHlpEnv - Environment Manipulation, IPRT based implementation. */ diff --git a/src/libs/kStuff/iprt/kHlpPage-iprt.cpp b/src/libs/kStuff/iprt/kHlpPage-iprt.cpp index ff5f0ceae..0a900c1c4 100644 --- a/src/libs/kStuff/iprt/kHlpPage-iprt.cpp +++ b/src/libs/kStuff/iprt/kHlpPage-iprt.cpp @@ -1,4 +1,4 @@ -/* $Id: kHlpPage-iprt.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: kHlpPage-iprt.cpp $ */ /** @file * kHlpPage - Page Memory Allocation, IPRT based implementation. */ diff --git a/src/libs/kStuff/iprt/kHlpString-iprt.cpp b/src/libs/kStuff/iprt/kHlpString-iprt.cpp index f45374201..883d0b473 100644 --- a/src/libs/kStuff/iprt/kHlpString-iprt.cpp +++ b/src/libs/kStuff/iprt/kHlpString-iprt.cpp @@ -1,4 +1,4 @@ -/* $Id: kHlpString-iprt.cpp 8155 2008-04-18 15:16:47Z vboxsync $ */ +/* $Id: kHlpString-iprt.cpp $ */ /** @file * kHlpString - String And Memory Routines, IPRT based implementation. */ diff --git a/src/libs/kStuff/iprt/kRdrFile-iprt.cpp b/src/libs/kStuff/iprt/kRdrFile-iprt.cpp index a012cb419..691af74d0 100644 --- a/src/libs/kStuff/iprt/kRdrFile-iprt.cpp +++ b/src/libs/kStuff/iprt/kRdrFile-iprt.cpp @@ -1,4 +1,4 @@ -/* $Id: kRdrFile-iprt.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ +/* $Id: kRdrFile-iprt.cpp $ */ /** @file * IPRT - kRdr Backend. */ diff --git a/src/libs/kStuff/kStuff/COPYING.LIB b/src/libs/kStuff/kStuff/COPYING.LIB deleted file mode 100644 index 5ab7695ab..000000000 --- a/src/libs/kStuff/kStuff/COPYING.LIB +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/src/libs/kStuff/kStuff/Config.kmk b/src/libs/kStuff/kStuff/Config.kmk index fbb402f13..df3bf4a6f 100644 --- a/src/libs/kStuff/kStuff/Config.kmk +++ b/src/libs/kStuff/kStuff/Config.kmk @@ -1,26 +1,31 @@ -# $Id: Config.kmk 24 2009-02-08 13:58:54Z bird $ +# $Id: Config.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kBuild configuration for kStuff # # -# Copyright (c) 2006-2008 knut st. osmundsen <bird-kStuff-spam@anduin.net> +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kStuff. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kStuff is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # -# kStuff is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kStuff; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # # diff --git a/src/libs/kStuff/kStuff/Copyright b/src/libs/kStuff/kStuff/Copyright new file mode 100644 index 000000000..ff0902bfd --- /dev/null +++ b/src/libs/kStuff/kStuff/Copyright @@ -0,0 +1,25 @@ +All kStuff files are: + + Copyright (c) 2006-2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/libs/kStuff/kStuff/Makefile.kmk b/src/libs/kStuff/kStuff/Makefile.kmk index 6316e6d1d..e06f67a80 100644 --- a/src/libs/kStuff/kStuff/Makefile.kmk +++ b/src/libs/kStuff/kStuff/Makefile.kmk @@ -1,26 +1,31 @@ -# $Id: Makefile.kmk 24 2009-02-08 13:58:54Z bird $ +# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kStuff - Top-level makefile. # # -# Copyright (c) 2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kStuff. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kStuff is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # -# kStuff is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kStuff; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # DEPTH = . diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlBase.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlBase.h index 2daef5a3c..593626004 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlBase.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlBase.h @@ -1,34 +1,31 @@ -/* $Id: kAvlBase.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlBase.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, The Mandatory Base Code. */ /* - * Copyright (c) 2001-2007 knut st. osmundsen <bird-src-spam@anduin.net> - * - * This file is part of kStuff. - * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * Copyright (c) 2001-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /** @page pg_kAvlTmpl Template Configuration. @@ -63,39 +60,39 @@ * * \#define KAVL_LOOKTHRU * Define this to employ a lookthru cache (direct) to speed up lookup for - * some usage patterns. The value should be the number of members of the + * some usage patterns. The value should be the number of members of the * array. * * \#define KAVL_LOOKTHRU_HASH(Key) - * Define this to specify a more efficient translation of the key into - * a lookthru array index. The default is key % size. - * For some key types this is required as the default will not compile. - * + * Define this to specify a more efficient translation of the key into + * a lookthru array index. The default is key % size. + * For some key types this is required as the default will not compile. + * * \#define KAVL_LOCKED - * Define this if you wish for the tree to be locked via the - * KAVL_WRITE_LOCK, KAVL_WRITE_UNLOCK, KAVL_READ_LOCK and + * Define this if you wish for the tree to be locked via the + * KAVL_WRITE_LOCK, KAVL_WRITE_UNLOCK, KAVL_READ_LOCK and * KAVL_READ_UNLOCK macros. If not defined the tree will not be subject * do any kind of locking and the problem of concurrency is left the user. - * + * * \#define KAVL_WRITE_LOCK(pRoot) * Lock the tree for writing. - * + * * \#define KAVL_WRITE_UNLOCK(pRoot) * Counteracts KAVL_WRITE_LOCK. - * + * * \#define KAVL_READ_LOCK(pRoot) * Lock the tree for reading. - * + * * \#define KAVL_READ_UNLOCK(pRoot) * Counteracts KAVL_READ_LOCK. - * + * * \#define KAVLKEY * Define this to the name of the AVL key type. * * \#define KAVL_STD_KEY_COMP * Define this to use the standard key compare macros. If not set all the * compare operations for KAVLKEY have to be defined: KAVL_G, KAVL_E, KAVL_NE, - * KAVL_R_IS_IDENTICAL, KAVL_R_IS_INTERSECTING and KAVL_R_IS_IN_RANGE. The + * KAVL_R_IS_IDENTICAL, KAVL_R_IS_INTERSECTING and KAVL_R_IS_IN_RANGE. The * latter three are only required when KAVL_RANGE is defined. * * \#define KAVLNODE @@ -111,10 +108,10 @@ * to KAVLNODE *. * * \#define KAVLROOT - * Define this to the name (typedef) of the AVL root structure. This + * Define this to the name (typedef) of the AVL root structure. This * is optional. However, if specified it must at least have a mpRoot * member of KAVLTREEPTR type. If KAVL_LOOKTHRU is non-zero a - * maLookthru[KAVL_LOOKTHRU] member of the KAVLTREEPTR type is also + * maLookthru[KAVL_LOOKTHRU] member of the KAVLTREEPTR type is also * required. * * \#define KAVL_FN @@ -212,7 +209,7 @@ #ifdef KAVL_LOOKTHRU # define KAVL_LOOKTHRU_INVALIDATE_NODE(pRoot, pNode, Key) \ do { \ - KAVLTREEPTR **ppEntry = &pRoot->maLookthru[KAVL_LOOKTHRU_HASH(Key)]; \ + KAVLTREEPTR **ppEntry = &pRoot->maLookthru[KAVL_LOOKTHRU_HASH(Key)]; \ if ((pNode) == KAVL_GET_POINTER_NULL(ppEntry)) \ *ppEntry = KAVL_NULL; \ } while (0) @@ -421,14 +418,14 @@ K_DECL_INLINE(void) KAVL_FN(Rebalance)(KAVL_INT(STACK) *pStack) /** * Initializes the root of the AVL-tree. - * + * * @param pTree Pointer to the root structure. */ KAVL_DECL(void) KAVL_FN(Init)(KAVLROOT *pRoot) { #ifdef KAVL_LOOKTHRU unsigned i; -#endif +#endif pRoot->mpRoot = KAVL_NULL; #ifdef KAVL_LOOKTHRU diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlDestroy.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlDestroy.h index aef1d20e7..17115f3a0 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlDestroy.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlDestroy.h @@ -1,37 +1,33 @@ -/* $Id: kAvlDestroy.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlDestroy.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Destroy the tree. */ /* - * Copyright (c) 1999-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /** * Destroys the specified tree, starting with the root node and working our way down. * @@ -61,7 +57,7 @@ KAVL_DECL(int) KAVL_FN(Destroy)(KAVLROOT *pRoot, KAVL_TYPE(PFN,CALLBACK) pfnCall } #ifdef KAVL_LOOKTHRU - /* + /* * Kill the lookthru cache. */ for (i = 0; i < (KAVL_LOOKTHRU); i++) diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlDoWithAll.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlDoWithAll.h index 3b5e47c54..f2eaba1d4 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlDoWithAll.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlDoWithAll.h @@ -1,34 +1,31 @@ -/* $Id: kAvlDoWithAll.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlDoWithAll.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, The Callback Iterator. */ /* - * Copyright (c) 1999-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlEnum.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlEnum.h index 11dca17bb..da151d17d 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlEnum.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlEnum.h @@ -1,34 +1,31 @@ -/* $Id: kAvlEnum.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlEnum.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Node Enumeration. */ /* - * Copyright (c) 1999-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* @@ -51,11 +48,11 @@ typedef struct KAVL_TYPE(,ENUMDATA) /** * Ends an enumeration. - * - * The purpose of this function is to unlock the tree should the + * + * The purpose of this function is to unlock the tree should the * AVL implementation include locking. It's good practice to call * it anyway even if the tree doesn't do any locking. - * + * * @param pEnumData Pointer to enumeration control data. */ KAVL_DECL(void) KAVL_FN(EndEnum)(KAVL_TYPE(,ENUMDATA) *pEnumData) @@ -149,7 +146,7 @@ KAVL_DECL(KAVLNODE *) KAVL_FN(GetNext)(KAVL_TYPE(,ENUMDATA) *pEnumData) } /* while */ } - /* + /* * Call EndEnum. */ KAVL_FN(EndEnum)(pEnumData); @@ -164,7 +161,7 @@ KAVL_DECL(KAVLNODE *) KAVL_FN(GetNext)(KAVL_TYPE(,ENUMDATA) *pEnumData) * chain like the DoWithAll function does. This may be changed later. * * @returns Pointer to the first node in the enumeration. - * If NULL is returned the tree is empty calling EndEnum isn't + * If NULL is returned the tree is empty calling EndEnum isn't * strictly necessary (although it will do no harm). * @param pRoot Pointer to the AVL-tree root structure. * @param pEnumData Pointer to enumeration control data. diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGet.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGet.h index b62dd905a..a80eb49cb 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGet.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGet.h @@ -1,37 +1,33 @@ -/* $Id: kAvlGet.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlGet.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Get a Node. */ /* - * Copyright (c) 1999-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /** * Gets a node from the tree (does not remove it!) * @@ -81,7 +77,7 @@ KAVL_DECL(KAVLNODE *) KAVL_FN(Get)(KAVLROOT *pRoot, KAVLKEY Key) pNode = KAVL_GET_POINTER(&pNode->mpRight); } } - + #ifdef KAVL_LOOKTHRU_CACHE KAVL_SET_POINTER(ppEntry, pNode); #endif diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGetBestFit.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGetBestFit.h index fcb716416..1d5170915 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGetBestFit.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGetBestFit.h @@ -1,37 +1,33 @@ -/* $Id: kAvlGetBestFit.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlGetBestFit.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Get Best Fitting Node. */ /* - * Copyright (c) 1999-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /** * Finds the best fitting node in the tree for the given Key value. * diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGetWithParent.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGetWithParent.h index 58f5ac100..e260ba9c6 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGetWithParent.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlGetWithParent.h @@ -1,37 +1,33 @@ -/* $Id: kAvlGetWithParent.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlGetWithParent.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Get Node With Parent. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /** * Gets a node from the tree and its parent node (if any). * The tree remains unchanged. diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlRemove2.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlRemove2.h index d558ff422..e6b8f47ed 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlRemove2.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlRemove2.h @@ -1,37 +1,33 @@ -/* $Id: kAvlRemove2.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlRemove2.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Remove A Specific Node. */ /* - * Copyright (c) 1999-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /** * Removes the specified node from the tree. * diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlRemoveBestFit.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlRemoveBestFit.h index 0f5ebd287..3c9ed9893 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlRemoveBestFit.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlRemoveBestFit.h @@ -1,37 +1,33 @@ -/* $Id: kAvlRemoveBestFit.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlRemoveBestFit.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Templated AVL Trees, Remove Best Fitting Node. */ /* - * Copyright (c) 1999-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 1999-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /** * Finds the best fitting node in the tree for the given Key value and removes the node. * diff --git a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlUndef.h b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlUndef.h index 196b2ea0e..bd6957fc1 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlUndef.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlTmpl/kAvlUndef.h @@ -1,34 +1,31 @@ -/* $Id: kAvlUndef.h 7 2008-02-04 02:08:02Z bird $ */ +/* $Id: kAvlUndef.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvlTmpl - Undefines All Macros (both config and temp). */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * As a special exception, since this is a source file and not a header - * file, you are granted permission to #include this file as you wish - * without this in itself causing the resulting program or whatever to be - * covered by the LGPL license. This exception does not however invalidate - * any other reasons why the resulting program/whatever should not be - * covered the LGPL or GPL. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /* diff --git a/src/libs/kStuff/kStuff/include/k/kAvlU32.h b/src/libs/kStuff/kStuff/include/k/kAvlU32.h index d1707aaae..7aacb1578 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlU32.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlU32.h @@ -1,27 +1,31 @@ -/* $Id: kAvlU32.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kAvlU32.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvl - AVL Tree Implementation, KU32 keys. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kAvlU32_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kAvloU32.h b/src/libs/kStuff/kStuff/include/k/kAvloU32.h index 88a208b3f..e9ad305d9 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvloU32.h +++ b/src/libs/kStuff/kStuff/include/k/kAvloU32.h @@ -1,27 +1,31 @@ -/* $Id: kAvloU32.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kAvloU32.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvl - AVL Tree Implementation, KU32 keys, Offset Based. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kAvloU32_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kAvlrU32.h b/src/libs/kStuff/kStuff/include/k/kAvlrU32.h index 16d9be848..532a55d8c 100644 --- a/src/libs/kStuff/kStuff/include/k/kAvlrU32.h +++ b/src/libs/kStuff/kStuff/include/k/kAvlrU32.h @@ -1,27 +1,31 @@ -/* $Id: kAvlrU32.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kAvlrU32.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kAvl - AVL Tree Implementation, KU32 key ranges. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kAvlrU32_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kCpu.h b/src/libs/kStuff/kStuff/include/k/kCpu.h index ac27a3e17..bbbf8158c 100644 --- a/src/libs/kStuff/kStuff/include/k/kCpu.h +++ b/src/libs/kStuff/kStuff/include/k/kCpu.h @@ -1,27 +1,31 @@ -/* $Id: kCpu.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kCpu.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kCpu - The CPU and Architecture API. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kCpu_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kCpus.h b/src/libs/kStuff/kStuff/include/k/kCpus.h index 7a3548bec..6fa8400f3 100644 --- a/src/libs/kStuff/kStuff/include/k/kCpus.h +++ b/src/libs/kStuff/kStuff/include/k/kCpus.h @@ -1,27 +1,31 @@ -/* $Id: kCpus.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kCpus.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kCpus - CPU Identifiers. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kCpus_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kDbg.h b/src/libs/kStuff/kStuff/include/k/kDbg.h index eb5fe340b..07ee43148 100644 --- a/src/libs/kStuff/kStuff/include/k/kDbg.h +++ b/src/libs/kStuff/kStuff/include/k/kDbg.h @@ -1,25 +1,31 @@ -/* $Id: kDbg.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbg.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with This program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kDbg_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kDbgAll.h b/src/libs/kStuff/kStuff/include/k/kDbgAll.h index af50983a3..fde7c0f28 100644 --- a/src/libs/kStuff/kStuff/include/k/kDbgAll.h +++ b/src/libs/kStuff/kStuff/include/k/kDbgAll.h @@ -1,25 +1,31 @@ -/* $Id: kDbgAll.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgAll.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Read, All Details and Dependencies Included. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with This program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kDbgAll_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kDbgBase.h b/src/libs/kStuff/kStuff/include/k/kDbgBase.h index 911a5f0c2..9787dce6b 100644 --- a/src/libs/kStuff/kStuff/include/k/kDbgBase.h +++ b/src/libs/kStuff/kStuff/include/k/kDbgBase.h @@ -1,28 +1,31 @@ -/* $Id: kDbgBase.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgBase.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Base Definitions and Typedefs. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * This file is part of kDbg. - * - * kDbg is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kDbg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with kDbg; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kDbgBase_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kDefs.h b/src/libs/kStuff/kStuff/include/k/kDefs.h index 277801792..0f2215fc0 100644 --- a/src/libs/kStuff/kStuff/include/k/kDefs.h +++ b/src/libs/kStuff/kStuff/include/k/kDefs.h @@ -1,27 +1,31 @@ -/* $Id: kDefs.h 16 2008-12-25 18:15:19Z bird $ */ +/* $Id: kDefs.h 29 2009-07-01 20:30:29Z bird $ */ /** @file - * * kTypes - Defines and Macros. + */ + +/* + * Copyright (c) 2006-2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * Copyright (c) 2007-2008 knut st. osmundsen <bird-src-spam@anduin.net> - * - * - * This file is part of k*. - * - * k* is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * k* is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * You should have received a copy of the GNU Lesser General Public License - * along with k*; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kDefs_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kErr.h b/src/libs/kStuff/kStuff/include/k/kErr.h index ad6df342a..f183ef490 100644 --- a/src/libs/kStuff/kStuff/include/k/kErr.h +++ b/src/libs/kStuff/kStuff/include/k/kErr.h @@ -1,27 +1,31 @@ -/* $Id: kErr.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kErr.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kErr - Status Code API. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kErr_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kErrors.h b/src/libs/kStuff/kStuff/include/k/kErrors.h index 8f5953368..f9744485a 100644 --- a/src/libs/kStuff/kStuff/include/k/kErrors.h +++ b/src/libs/kStuff/kStuff/include/k/kErrors.h @@ -1,27 +1,31 @@ -/* $Id: kErrors.h 25 2009-02-19 00:56:15Z bird $ */ +/* $Id: kErrors.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kErrors - Status Codes. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kErrors_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlp.h b/src/libs/kStuff/kStuff/include/k/kHlp.h index f372b7baf..7e83b8530 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlp.h +++ b/src/libs/kStuff/kStuff/include/k/kHlp.h @@ -1,27 +1,31 @@ -/* $Id: kHlp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlp - Helpers, All Of Them. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlp_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpAlloc.h b/src/libs/kStuff/kStuff/include/k/kHlpAlloc.h index 75d01e8b0..99ae8b687 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpAlloc.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpAlloc.h @@ -1,27 +1,31 @@ -/* $Id: kHlpAlloc.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpAlloc.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpAlloc - Memory Allocation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpAlloc_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpAssert.h b/src/libs/kStuff/kStuff/include/k/kHlpAssert.h index 906857854..dfd36c2c7 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpAssert.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpAssert.h @@ -1,27 +1,31 @@ -/* $Id: kHlpAssert.h 18 2009-01-30 06:26:49Z bird $ */ +/* $Id: kHlpAssert.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpAssert - Assertion Macros. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kHlpAssert_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpDefs.h b/src/libs/kStuff/kStuff/include/k/kHlpDefs.h index 468463ae4..bcda10a04 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpDefs.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpDefs.h @@ -1,27 +1,31 @@ -/* $Id: kHlpDefs.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpDefs.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpDefs - Helper Definitions. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpDefs_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpEnv.h b/src/libs/kStuff/kStuff/include/k/kHlpEnv.h index 159975c2f..95c2bda7c 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpEnv.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpEnv.h @@ -1,27 +1,31 @@ -/* $Id: kHlpEnv.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpEnv.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpEnv - Environment Manipulation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpEnv_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpPath.h b/src/libs/kStuff/kStuff/include/k/kHlpPath.h index c99ae43f2..c9d6ce5c6 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpPath.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpPath.h @@ -1,27 +1,31 @@ -/* $Id: kHlpPath.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpPath.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpPath - Path Manipulation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpPath_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpProcess.h b/src/libs/kStuff/kStuff/include/k/kHlpProcess.h index 9523c1361..c637545a3 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpProcess.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpProcess.h @@ -1,27 +1,31 @@ -/* $Id: kHlpProcess.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpProcess.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpProcess - Process Management. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpProcess_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpSem.h b/src/libs/kStuff/kStuff/include/k/kHlpSem.h index c8f49b03d..72c6407d8 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpSem.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpSem.h @@ -1,27 +1,31 @@ -/* $Id: kHlpSem.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpSem.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpSem - Semaphores. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpSem_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpString.h b/src/libs/kStuff/kStuff/include/k/kHlpString.h index 8b31356b4..23da03d92 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpString.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpString.h @@ -1,27 +1,31 @@ -/* $Id: kHlpString.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpString.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - String And Memory Routines. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpString_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpSys.h b/src/libs/kStuff/kStuff/include/k/kHlpSys.h index a0adcce82..63aeaeee3 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpSys.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpSys.h @@ -1,27 +1,31 @@ -/* $Id: kHlpSys.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpSys.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpSys - System Call Prototypes. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpSys_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kHlpThread.h b/src/libs/kStuff/kStuff/include/k/kHlpThread.h index 91f4d06ad..1b2f2335a 100644 --- a/src/libs/kStuff/kStuff/include/k/kHlpThread.h +++ b/src/libs/kStuff/kStuff/include/k/kHlpThread.h @@ -1,27 +1,31 @@ -/* $Id: kHlpThread.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpThread.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpThread - Thread Manipulation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kHlpThread_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kLdr.h b/src/libs/kStuff/kStuff/include/k/kLdr.h index 58b0def7c..55b5c178e 100644 --- a/src/libs/kStuff/kStuff/include/k/kLdr.h +++ b/src/libs/kStuff/kStuff/include/k/kLdr.h @@ -1,27 +1,31 @@ -/* $Id: kLdr.h 25 2009-02-19 00:56:15Z bird $ */ +/* $Id: kLdr.h 29 2009-07-01 20:30:29Z bird $ */ /** @file - * * kLdr - The Dynamic Loader. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * Copyright (c) 2006 knut st. osmundsen <bird@anduin.net> - * - * - * This file is part of kLdr. - * - * kLdr is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kLdr is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * You should have received a copy of the GNU General Public License - * along with kLdr; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kLdr_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf-amd64.h b/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf-amd64.h deleted file mode 100644 index ce5c8d3c4..000000000 --- a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf-amd64.h +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * Copyright (c) 1996-1997 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/include/elf.h,v 1.18 2004/08/03 08:21:48 dfr Exp $ - */ - -#ifndef ___k_kLdrFmts_elf_amd64_h___ -#define ___k_kLdrFmts_elf_amd64_h___ - -/* - * ELF definitions for the AMD64 architecture. - */ - -#if 0 /** @todo Auxiliary vector entries. */ -/* - * Auxiliary vector entries for passing information to the interpreter. - * - * The i386 supplement to the SVR4 ABI specification names this "auxv_t", - * but POSIX lays claim to all symbols ending with "_t". - */ -typedef struct { /* Auxiliary vector entry on initial stack */ - int a_type; /* Entry type. */ - union { - int a_val; /* Integer value. */ - } a_un; -} Elf32_Auxinfo; - - -typedef struct { /* Auxiliary vector entry on initial stack */ - long a_type; /* Entry type. */ - union { - long a_val; /* Integer value. */ - void *a_ptr; /* Address. */ - void (*a_fcn)(void); /* Function pointer (not used). */ - } a_un; -} Elf64_Auxinfo; - -__ElfType(Auxinfo); - -/* Values for a_type. */ -#define AT_NULL 0 /* Terminates the vector. */ -#define AT_IGNORE 1 /* Ignored entry. */ -#define AT_EXECFD 2 /* File descriptor of program to load. */ -#define AT_PHDR 3 /* Program header of program already loaded. */ -#define AT_PHENT 4 /* Size of each program header entry. */ -#define AT_PHNUM 5 /* Number of program header entries. */ -#define AT_PAGESZ 6 /* Page size in bytes. */ -#define AT_BASE 7 /* Interpreter's base address. */ -#define AT_FLAGS 8 /* Flags (unused for i386). */ -#define AT_ENTRY 9 /* Where interpreter should transfer control. */ - -/* - * The following non-standard values are used for passing information - * from John Polstra's testbed program to the dynamic linker. These - * are expected to go away soon. - * - * Unfortunately, these overlap the Linux non-standard values, so they - * must not be used in the same context. - */ -#define AT_BRK 10 /* Starting point for sbrk and brk. */ -#define AT_DEBUG 11 /* Debugging level. */ - -/* - * The following non-standard values are used in Linux ELF binaries. - */ -#define AT_NOTELF 10 /* Program is not ELF ?? */ -#define AT_UID 11 /* Real uid. */ -#define AT_EUID 12 /* Effective uid. */ -#define AT_GID 13 /* Real gid. */ -#define AT_EGID 14 /* Effective gid. */ - -#define AT_COUNT 15 /* Count of defined aux entry types. */ - -#endif /* [todo] */ - -/* - * Relocation types. - */ - -#define R_X86_64_NONE 0 /* No relocation. */ -#define R_X86_64_64 1 /* Add 64 bit symbol value. */ -#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */ -#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */ -#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */ -#define R_X86_64_COPY 5 /* Copy data from shared object. */ -#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */ -#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */ -#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */ -#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */ -#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */ -#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */ -#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */ -#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */ -#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */ -#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */ -#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ -#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */ -#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */ -#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */ -#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */ -#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ -#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */ -#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */ - -#define R_X86_64_COUNT 24 /* Count of defined relocation types. */ - -#endif - diff --git a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf-i386.h b/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf-i386.h deleted file mode 100644 index d6164fe81..000000000 --- a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf-i386.h +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * Copyright (c) 1996-1997 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/i386/include/elf.h,v 1.16 2004/08/02 19:12:17 dfr Exp $ - */ - -#ifndef ___k_kLdrFmts_elf_i386_h___ -#define ___k_kLdrFmts_elf_i386_h___ - -#if 0 /** @todo Auxiliary vector entries. */ - -/* - * Auxiliary vector entries for passing information to the interpreter. - * - * The i386 supplement to the SVR4 ABI specification names this "auxv_t", - * but POSIX lays claim to all symbols ending with "_t". - */ - -typedef struct { /* Auxiliary vector entry on initial stack */ - int a_type; /* Entry type. */ - union { - long a_val; /* Integer value. */ - void *a_ptr; /* Address. */ - void (*a_fcn)(void); /* Function pointer (not used). */ - } a_un; -} Elf32_Auxinfo; - -#if __ELF_WORD_SIZE == 64 -/* Fake for amd64 loader support */ -typedef struct { - int fake; -} Elf64_Auxinfo; -#endif - -/* Values for a_type. */ -#define AT_NULL 0 /* Terminates the vector. */ -#define AT_IGNORE 1 /* Ignored entry. */ -#define AT_EXECFD 2 /* File descriptor of program to load. */ -#define AT_PHDR 3 /* Program header of program already loaded. */ -#define AT_PHENT 4 /* Size of each program header entry. */ -#define AT_PHNUM 5 /* Number of program header entries. */ -#define AT_PAGESZ 6 /* Page size in bytes. */ -#define AT_BASE 7 /* Interpreter's base address. */ -#define AT_FLAGS 8 /* Flags (unused for i386). */ -#define AT_ENTRY 9 /* Where interpreter should transfer control. */ - -/* - * The following non-standard values are used for passing information - * from John Polstra's testbed program to the dynamic linker. These - * are expected to go away soon. - * - * Unfortunately, these overlap the Linux non-standard values, so they - * must not be used in the same context. - */ -#define AT_BRK 10 /* Starting point for sbrk and brk. */ -#define AT_DEBUG 11 /* Debugging level. */ - -/* - * The following non-standard values are used in Linux ELF binaries. - */ -#define AT_NOTELF 10 /* Program is not ELF ?? */ -#define AT_UID 11 /* Real uid. */ -#define AT_EUID 12 /* Effective uid. */ -#define AT_GID 13 /* Real gid. */ -#define AT_EGID 14 /* Effective gid. */ - -#define AT_COUNT 15 /* Count of defined aux entry types. */ - -#endif /* [todo] */ - - -/* - * Relocation types. - */ - -#define R_386_NONE 0 /* No relocation. */ -#define R_386_32 1 /* Add symbol value. */ -#define R_386_PC32 2 /* Add PC-relative symbol value. */ -#define R_386_GOT32 3 /* Add PC-relative GOT offset. */ -#define R_386_PLT32 4 /* Add PC-relative PLT offset. */ -#define R_386_COPY 5 /* Copy data from shared object. */ -#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */ -#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */ -#define R_386_RELATIVE 8 /* Add load address of shared object. */ -#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */ -#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */ -#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */ -#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */ -#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */ -#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */ -#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */ -#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */ -#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */ -#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */ -#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */ -#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */ -#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */ -#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */ -#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */ -#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */ -#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */ -#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */ -#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */ -#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */ -#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */ -#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */ - -#define R_386_COUNT 38 /* Count of defined relocation types. */ - -#endif - diff --git a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf32.h b/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf32.h deleted file mode 100644 index 7fa3c2dc7..000000000 --- a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf32.h +++ /dev/null @@ -1,159 +0,0 @@ -/*- - * Copyright (c) 1996-1998 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/sys/elf32.h,v 1.8 2002/05/30 08:32:18 dfr Exp $ - */ - -#ifndef ___k_kLdrFmts_elf32_h___ -#define ___k_kLdrFmts_elf32_h___ - -#include <k/kDefs.h> -#include <k/kTypes.h> -#include <k/kLdrFmts/elf_common.h> - -/* - * ELF definitions common to all 32-bit architectures. - */ - -typedef KU32 Elf32_Addr; -typedef KU16 Elf32_Half; -typedef KU32 Elf32_Off; -typedef KI32 Elf32_Sword; -typedef KU32 Elf32_Word; -typedef KU32 Elf32_Size; -typedef Elf32_Off Elf32_Hashelt; - -/* - * ELF header. - */ - -typedef struct Elf32_Ehdr { - unsigned char e_ident[EI_NIDENT]; /* File identification. */ - Elf32_Half e_type; /* File type. */ - Elf32_Half e_machine; /* Machine architecture. */ - Elf32_Word e_version; /* ELF format version. */ - Elf32_Addr e_entry; /* Entry point. */ - Elf32_Off e_phoff; /* Program header file offset. */ - Elf32_Off e_shoff; /* Section header file offset. */ - Elf32_Word e_flags; /* Architecture-specific flags. */ - Elf32_Half e_ehsize; /* Size of ELF header in bytes. */ - Elf32_Half e_phentsize; /* Size of program header entry. */ - Elf32_Half e_phnum; /* Number of program header entries. */ - Elf32_Half e_shentsize; /* Size of section header entry. */ - Elf32_Half e_shnum; /* Number of section header entries. */ - Elf32_Half e_shstrndx; /* Section name strings section. */ -} Elf32_Ehdr; - -/* - * Section header. - */ - -typedef struct { - Elf32_Word sh_name; /* Section name (index into the - section header string table). */ - Elf32_Word sh_type; /* Section type. */ - Elf32_Word sh_flags; /* Section flags. */ - Elf32_Addr sh_addr; /* Address in memory image. */ - Elf32_Off sh_offset; /* Offset in file. */ - Elf32_Size sh_size; /* Size in bytes. */ - Elf32_Word sh_link; /* Index of a related section. */ - Elf32_Word sh_info; /* Depends on section type. */ - Elf32_Size sh_addralign; /* Alignment in bytes. */ - Elf32_Size sh_entsize; /* Size of each entry in section. */ -} Elf32_Shdr; - -/* - * Program header. - */ - -typedef struct { - Elf32_Word p_type; /* Entry type. */ - Elf32_Off p_offset; /* File offset of contents. */ - Elf32_Addr p_vaddr; /* Virtual address in memory image. */ - Elf32_Addr p_paddr; /* Physical address (not used). */ - Elf32_Size p_filesz; /* Size of contents in file. */ - Elf32_Size p_memsz; /* Size of contents in memory. */ - Elf32_Word p_flags; /* Access permission flags. */ - Elf32_Size p_align; /* Alignment in memory and file. */ -} Elf32_Phdr; - -/* - * Dynamic structure. The ".dynamic" section contains an array of them. - */ - -typedef struct { - Elf32_Sword d_tag; /* Entry type. */ - union { - Elf32_Size d_val; /* Integer value. */ - Elf32_Addr d_ptr; /* Address value. */ - } d_un; -} Elf32_Dyn; - -/* - * Relocation entries. - */ - -/* Relocations that don't need an addend field. */ -typedef struct { - Elf32_Addr r_offset; /* Location to be relocated. */ - Elf32_Word r_info; /* Relocation type and symbol index. */ -} Elf32_Rel; - -/* Relocations that need an addend field. */ -typedef struct { - Elf32_Addr r_offset; /* Location to be relocated. */ - Elf32_Word r_info; /* Relocation type and symbol index. */ - Elf32_Sword r_addend; /* Addend. */ -} Elf32_Rela; - -/* Macros for accessing the fields of r_info. */ -#define ELF32_R_SYM(info) ((info) >> 8) -#define ELF32_R_TYPE(info) ((unsigned char)(info)) - -/* Macro for constructing r_info from field values. */ -#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) - -/* - * Symbol table entries. - */ - -typedef struct { - Elf32_Word st_name; /* String table index of name. */ - Elf32_Addr st_value; /* Symbol value. */ - Elf32_Size st_size; /* Size of associated object. */ - unsigned char st_info; /* Type and binding information. */ - unsigned char st_other; /* Reserved (not used). */ - Elf32_Half st_shndx; /* Section index of symbol. */ -} Elf32_Sym; - -/* Macros for accessing the fields of st_info. */ -#define ELF32_ST_BIND(info) ((info) >> 4) -#define ELF32_ST_TYPE(info) ((info) & 0xf) - -/* Macro for constructing st_info from field values. */ -#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) - -#endif - diff --git a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf64.h b/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf64.h deleted file mode 100644 index 6fd29d74e..000000000 --- a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf64.h +++ /dev/null @@ -1,172 +0,0 @@ -/*- - * Copyright (c) 1996-1998 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/sys/elf64.h,v 1.10 2002/05/30 08:32:18 dfr Exp $ - */ - -#ifndef ___k_kLdrFmts_elf64_h___ -#define ___k_kLdrFmts_elf64_h___ - -#include <k/kDefs.h> -#include <k/kTypes.h> -#include <k/kLdrFmts/elf_common.h> - -/* - * ELF definitions common to all 64-bit architectures. - */ - -typedef KU64 Elf64_Addr; -typedef KU32 Elf64_Half; -typedef KU64 Elf64_Off; -typedef KI64 Elf64_Sword; -typedef KU64 Elf64_Word; -typedef KU64 Elf64_Size; -typedef KU16 Elf64_Quarter; - -/* - * Types of dynamic symbol hash table bucket and chain elements. - * - * This is inconsistent among 64 bit architectures, so a machine dependent - * typedef is required. - */ - -#ifdef __alpha__ -typedef Elf64_Off Elf64_Hashelt; -#else -typedef Elf64_Half Elf64_Hashelt; -#endif - -/* - * ELF header. - */ - -typedef struct { - unsigned char e_ident[EI_NIDENT]; /* File identification. */ - Elf64_Quarter e_type; /* File type. */ - Elf64_Quarter e_machine; /* Machine architecture. */ - Elf64_Half e_version; /* ELF format version. */ - Elf64_Addr e_entry; /* Entry point. */ - Elf64_Off e_phoff; /* Program header file offset. */ - Elf64_Off e_shoff; /* Section header file offset. */ - Elf64_Half e_flags; /* Architecture-specific flags. */ - Elf64_Quarter e_ehsize; /* Size of ELF header in bytes. */ - Elf64_Quarter e_phentsize; /* Size of program header entry. */ - Elf64_Quarter e_phnum; /* Number of program header entries. */ - Elf64_Quarter e_shentsize; /* Size of section header entry. */ - Elf64_Quarter e_shnum; /* Number of section header entries. */ - Elf64_Quarter e_shstrndx; /* Section name strings section. */ -} Elf64_Ehdr; - -/* - * Section header. - */ - -typedef struct { - Elf64_Half sh_name; /* Section name (index into the - section header string table). */ - Elf64_Half sh_type; /* Section type. */ - Elf64_Size sh_flags; /* Section flags. */ - Elf64_Addr sh_addr; /* Address in memory image. */ - Elf64_Off sh_offset; /* Offset in file. */ - Elf64_Size sh_size; /* Size in bytes. */ - Elf64_Half sh_link; /* Index of a related section. */ - Elf64_Half sh_info; /* Depends on section type. */ - Elf64_Size sh_addralign; /* Alignment in bytes. */ - Elf64_Size sh_entsize; /* Size of each entry in section. */ -} Elf64_Shdr; - -/* - * Program header. - */ - -typedef struct { - Elf64_Half p_type; /* Entry type. */ - Elf64_Half p_flags; /* Access permission flags. */ - Elf64_Off p_offset; /* File offset of contents. */ - Elf64_Addr p_vaddr; /* Virtual address in memory image. */ - Elf64_Addr p_paddr; /* Physical address (not used). */ - Elf64_Size p_filesz; /* Size of contents in file. */ - Elf64_Size p_memsz; /* Size of contents in memory. */ - Elf64_Size p_align; /* Alignment in memory and file. */ -} Elf64_Phdr; - -/* - * Dynamic structure. The ".dynamic" section contains an array of them. - */ - -typedef struct { - Elf64_Size d_tag; /* Entry type. */ - union { - Elf64_Size d_val; /* Integer value. */ - Elf64_Addr d_ptr; /* Address value. */ - } d_un; -} Elf64_Dyn; - -/* - * Relocation entries. - */ - -/* Relocations that don't need an addend field. */ -typedef struct { - Elf64_Addr r_offset; /* Location to be relocated. */ - Elf64_Size r_info; /* Relocation type and symbol index. */ -} Elf64_Rel; - -/* Relocations that need an addend field. */ -typedef struct { - Elf64_Addr r_offset; /* Location to be relocated. */ - Elf64_Size r_info; /* Relocation type and symbol index. */ - Elf64_Off r_addend; /* Addend. */ -} Elf64_Rela; - -/* Macros for accessing the fields of r_info. */ -#define ELF64_R_SYM(info) ((info) >> 32) -#define ELF64_R_TYPE(info) ((unsigned char)(info)) - -/* Macro for constructing r_info from field values. */ -#define ELF64_R_INFO(sym, type) (((sym) << 32) + (unsigned char)(type)) - -/* - * Symbol table entries. - */ - -typedef struct { - Elf64_Half st_name; /* String table index of name. */ - unsigned char st_info; /* Type and binding information. */ - unsigned char st_other; /* Reserved (not used). */ - Elf64_Quarter st_shndx; /* Section index of symbol. */ - Elf64_Addr st_value; /* Symbol value. */ - Elf64_Size st_size; /* Size of associated object. */ -} Elf64_Sym; - -/* Macros for accessing the fields of st_info. */ -#define ELF64_ST_BIND(info) ((info) >> 4) -#define ELF64_ST_TYPE(info) ((info) & 0xf) - -/* Macro for constructing st_info from field values. */ -#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) - -#endif - diff --git a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf_common.h b/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf_common.h deleted file mode 100644 index 4de9de4a1..000000000 --- a/src/libs/kStuff/kStuff/include/k/kLdrFmts/elf_common.h +++ /dev/null @@ -1,300 +0,0 @@ -/*- - * Copyright (c) 1998 John D. Polstra. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/sys/elf_common.h,v 1.15 2004/05/05 02:38:54 marcel Exp $ - */ - -#ifndef ___k_kLdrFmts_elf_common_h___ -#define ___k_kLdrFmts_elf_common_h___ - -/* - * ELF definitions that are independent of architecture or word size. - */ - -/* - * Note header. The ".note" section contains an array of notes. Each - * begins with this header, aligned to a word boundary. Immediately - * following the note header is n_namesz bytes of name, padded to the - * next word boundary. Then comes n_descsz bytes of descriptor, again - * padded to a word boundary. The values of n_namesz and n_descsz do - * not include the padding. - */ - -typedef struct { - KU32 n_namesz; /* Length of name. */ - KU32 n_descsz; /* Length of descriptor. */ - KU32 n_type; /* Type of this note. */ -} Elf_Note; - -/* Indexes into the e_ident array. Keep synced with - http://www.sco.com/developer/gabi/ch4.eheader.html */ -#define EI_MAG0 0 /* Magic number, byte 0. */ -#define EI_MAG1 1 /* Magic number, byte 1. */ -#define EI_MAG2 2 /* Magic number, byte 2. */ -#define EI_MAG3 3 /* Magic number, byte 3. */ -#define EI_CLASS 4 /* Class of machine. */ -#define EI_DATA 5 /* Data format. */ -#define EI_VERSION 6 /* ELF format version. */ -#define EI_OSABI 7 /* Operating system / ABI identification */ -#define EI_ABIVERSION 8 /* ABI version */ -#define OLD_EI_BRAND 8 /* Start of architecture identification. */ -#define EI_PAD 9 /* Start of padding (per SVR4 ABI). */ -#define EI_NIDENT 16 /* Size of e_ident array. */ - -/* Values for the magic number bytes. */ -#define ELFMAG0 0x7f -#define ELFMAG1 'E' -#define ELFMAG2 'L' -#define ELFMAG3 'F' -#define ELFMAG "\177ELF" /* magic string */ -#define SELFMAG 4 /* magic string size */ - -/* Values for e_ident[EI_VERSION] and e_version. */ -#define EV_NONE 0 -#define EV_CURRENT 1 - -/* Values for e_ident[EI_CLASS]. */ -#define ELFCLASSNONE 0 /* Unknown class. */ -#define ELFCLASS32 1 /* 32-bit architecture. */ -#define ELFCLASS64 2 /* 64-bit architecture. */ - -/* Values for e_ident[EI_DATA]. */ -#define ELFDATANONE 0 /* Unknown data format. */ -#define ELFDATA2LSB 1 /* 2's complement little-endian. */ -#define ELFDATA2MSB 2 /* 2's complement big-endian. */ - -/* Values for e_ident[EI_OSABI]. */ -#define ELFOSABI_SYSV 0 /* UNIX System V ABI */ -#define ELFOSABI_NONE ELFOSABI_SYSV /* symbol used in old spec */ -#define ELFOSABI_HPUX 1 /* HP-UX operating system */ -#define ELFOSABI_NETBSD 2 /* NetBSD */ -#define ELFOSABI_LINUX 3 /* GNU/Linux */ -#define ELFOSABI_HURD 4 /* GNU/Hurd */ -#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */ -#define ELFOSABI_SOLARIS 6 /* Solaris */ -#define ELFOSABI_MONTEREY 7 /* Monterey */ -#define ELFOSABI_IRIX 8 /* IRIX */ -#define ELFOSABI_FREEBSD 9 /* FreeBSD */ -#define ELFOSABI_TRU64 10 /* TRU64 UNIX */ -#define ELFOSABI_MODESTO 11 /* Novell Modesto */ -#define ELFOSABI_OPENBSD 12 /* OpenBSD */ -#define ELFOSABI_ARM 97 /* ARM */ -#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ - -/* e_ident */ -#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ - (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ - (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ - (ehdr).e_ident[EI_MAG3] == ELFMAG3) - -/* Values for e_type. */ -#define ET_NONE 0 /* Unknown type. */ -#define ET_REL 1 /* Relocatable. */ -#define ET_EXEC 2 /* Executable. */ -#define ET_DYN 3 /* Shared object. */ -#define ET_CORE 4 /* Core file. */ - -/* Values for e_machine. */ -#define EM_NONE 0 /* Unknown machine. */ -#define EM_M32 1 /* AT&T WE32100. */ -#define EM_SPARC 2 /* Sun SPARC. */ -#define EM_386 3 /* Intel i386. */ -#define EM_68K 4 /* Motorola 68000. */ -#define EM_88K 5 /* Motorola 88000. */ -#define EM_486 6 /* Intel i486. */ -#define EM_860 7 /* Intel i860. */ -#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ - -/* Extensions. This list is not complete. */ -#define EM_S370 9 /* IBM System/370 */ -#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ /* Depreciated */ -#define EM_PARISC 15 /* HPPA */ -#define EM_SPARC32PLUS 18 /* SPARC v8plus */ -#define EM_PPC 20 /* PowerPC 32-bit */ -#define EM_PPC64 21 /* PowerPC 64-bit */ -#define EM_ARM 40 /* ARM */ -#define EM_SPARCV9 43 /* SPARC v9 64-bit */ -#define EM_IA_64 50 /* Intel IA-64 Processor */ -#define EM_X86_64 62 /* Advanced Micro Devices x86-64 */ -#define EM_ALPHA 0x9026 /* Alpha (written in the absence of an ABI */ - -/* Special section indexes. */ -#define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */ -#define SHN_LORESERVE 0xff00 /* First of reserved range. */ -#define SHN_LOPROC 0xff00 /* First processor-specific. */ -#define SHN_HIPROC 0xff1f /* Last processor-specific. */ -#define SHN_ABS 0xfff1 /* Absolute values. */ -#define SHN_COMMON 0xfff2 /* Common data. */ -#define SHN_HIRESERVE 0xffff /* Last of reserved range. */ - -/* sh_type */ -#define SHT_NULL 0 /* inactive */ -#define SHT_PROGBITS 1 /* program defined information */ -#define SHT_SYMTAB 2 /* symbol table section */ -#define SHT_STRTAB 3 /* string table section */ -#define SHT_RELA 4 /* relocation section with addends */ -#define SHT_HASH 5 /* symbol hash table section */ -#define SHT_DYNAMIC 6 /* dynamic section */ -#define SHT_NOTE 7 /* note section */ -#define SHT_NOBITS 8 /* no space section */ -#define SHT_REL 9 /* relocation section - no addends */ -#define SHT_SHLIB 10 /* reserved - purpose unknown */ -#define SHT_DYNSYM 11 /* dynamic symbol table section */ -#define SHT_NUM 12 /* number of section types */ -#define SHT_LOOS 0x60000000 /* First of OS specific semantics */ -#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */ -#define SHT_LOPROC 0x70000000 /* reserved range for processor */ -#define SHT_HIPROC 0x7fffffff /* specific section header types */ -#define SHT_LOUSER 0x80000000 /* reserved range for application */ -#define SHT_HIUSER 0xffffffff /* specific indexes */ - -/* Flags for sh_flags. */ -#define SHF_WRITE 0x1 /* Section contains writable data. */ -#define SHF_ALLOC 0x2 /* Section occupies memory. */ -#define SHF_EXECINSTR 0x4 /* Section contains instructions. */ -#define SHF_TLS 0x400 /* Section contains TLS data. */ -#define SHF_MASKPROC 0xf0000000 /* Reserved for processor-specific. */ - -/* Values for p_type. */ -#define PT_NULL 0 /* Unused entry. */ -#define PT_LOAD 1 /* Loadable segment. */ -#define PT_DYNAMIC 2 /* Dynamic linking information segment. */ -#define PT_INTERP 3 /* Pathname of interpreter. */ -#define PT_NOTE 4 /* Auxiliary information. */ -#define PT_SHLIB 5 /* Reserved (not used). */ -#define PT_PHDR 6 /* Location of program header itself. */ -#define PT_TLS 7 /* Thread local storage segment */ - -#define PT_COUNT 8 /* Number of defined p_type values. */ - -#define PT_LOOS 0x60000000 /* OS-specific */ -#define PT_HIOS 0x6fffffff /* OS-specific */ -#define PT_LOPROC 0x70000000 /* First processor-specific type. */ -#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */ - -/* Values for p_flags. */ -#define PF_X 0x1 /* Executable. */ -#define PF_W 0x2 /* Writable. */ -#define PF_R 0x4 /* Readable. */ - -/* Values for d_tag. */ -#define DT_NULL 0 /* Terminating entry. */ -#define DT_NEEDED 1 /* String table offset of a needed shared - library. */ -#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */ -#define DT_PLTGOT 3 /* Processor-dependent address. */ -#define DT_HASH 4 /* Address of symbol hash table. */ -#define DT_STRTAB 5 /* Address of string table. */ -#define DT_SYMTAB 6 /* Address of symbol table. */ -#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */ -#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */ -#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */ -#define DT_STRSZ 10 /* Size of string table. */ -#define DT_SYMENT 11 /* Size of each symbol table entry. */ -#define DT_INIT 12 /* Address of initialization function. */ -#define DT_FINI 13 /* Address of finalization function. */ -#define DT_SONAME 14 /* String table offset of shared object - name. */ -#define DT_RPATH 15 /* String table offset of library path. [sup] */ -#define DT_SYMBOLIC 16 /* Indicates "symbolic" linking. [sup] */ -#define DT_REL 17 /* Address of ElfNN_Rel relocations. */ -#define DT_RELSZ 18 /* Total size of ElfNN_Rel relocations. */ -#define DT_RELENT 19 /* Size of each ElfNN_Rel relocation. */ -#define DT_PLTREL 20 /* Type of relocation used for PLT. */ -#define DT_DEBUG 21 /* Reserved (not used). */ -#define DT_TEXTREL 22 /* Indicates there may be relocations in - non-writable segments. [sup] */ -#define DT_JMPREL 23 /* Address of PLT relocations. */ -#define DT_BIND_NOW 24 /* [sup] */ -#define DT_INIT_ARRAY 25 /* Address of the array of pointers to - initialization functions */ -#define DT_FINI_ARRAY 26 /* Address of the array of pointers to - termination functions */ -#define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of - initialization functions. */ -#define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of - terminationfunctions. */ -#define DT_RUNPATH 29 /* String table offset of a null-terminated - library search path string. */ -#define DT_FLAGS 30 /* Object specific flag values. */ -#define DT_ENCODING 32 /* Values greater than or equal to DT_ENCODING - and less than DT_LOOS follow the rules for - the interpretation of the d_un union - as follows: even == 'd_ptr', even == 'd_val' - or none */ -#define DT_PREINIT_ARRAY 32 /* Address of the array of pointers to - pre-initialization functions. */ -#define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of - pre-initialization functions. */ - -#define DT_COUNT 33 /* Number of defined d_tag values. */ - -#define DT_LOOS 0x6000000d /* First OS-specific */ -#define DT_HIOS 0x6fff0000 /* Last OS-specific */ -#define DT_LOPROC 0x70000000 /* First processor-specific type. */ -#define DT_HIPROC 0x7fffffff /* Last processor-specific type. */ - -/* Values for DT_FLAGS */ -#define DF_ORIGIN 0x0001 /* Indicates that the object being loaded may - make reference to the $ORIGIN substitution - string */ -#define DF_SYMBOLIC 0x0002 /* Indicates "symbolic" linking. */ -#define DF_TEXTREL 0x0004 /* Indicates there may be relocations in - non-writable segments. */ -#define DF_BIND_NOW 0x0008 /* Indicates that the dynamic linker should - process all relocations for the object - containing this entry before transferring - control to the program. */ -#define DF_STATIC_TLS 0x0010 /* Indicates that the shared object or - executable contains code using a static - thread-local storage scheme. */ - -/* Values for n_type. Used in core files. */ -#define NT_PRSTATUS 1 /* Process status. */ -#define NT_FPREGSET 2 /* Floating point registers. */ -#define NT_PRPSINFO 3 /* Process state info. */ - -/* Symbol Binding - ELFNN_ST_BIND - st_info */ -#define STB_LOCAL 0 /* Local symbol */ -#define STB_GLOBAL 1 /* Global symbol */ -#define STB_WEAK 2 /* like global - lower precedence */ -#define STB_LOPROC 13 /* reserved range for processor */ -#define STB_HIPROC 15 /* specific symbol bindings */ - -/* Symbol type - ELFNN_ST_TYPE - st_info */ -#define STT_NOTYPE 0 /* Unspecified type. */ -#define STT_OBJECT 1 /* Data object. */ -#define STT_FUNC 2 /* Function. */ -#define STT_SECTION 3 /* Section. */ -#define STT_FILE 4 /* Source file. */ -#define STT_TLS 6 /* TLS object. */ -#define STT_LOPROC 13 /* reserved range for processor */ -#define STT_HIPROC 15 /* specific symbol types */ - -/* Special symbol table indexes. */ -#define STN_UNDEF 0 /* Undefined symbol index. */ - -#endif - diff --git a/src/libs/kStuff/kStuff/include/k/kLdrFmts/lx.h b/src/libs/kStuff/kStuff/include/k/kLdrFmts/lx.h index e21fc1503..fc1d1e213 100644 --- a/src/libs/kStuff/kStuff/include/k/kLdrFmts/lx.h +++ b/src/libs/kStuff/kStuff/include/k/kLdrFmts/lx.h @@ -3,6 +3,31 @@ * LX structures, types and defines. */ +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + #ifndef ___k_kLdrFmts_lx_h___ #define ___k_kLdrFmts_lx_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kLdrFmts/mach-o.h b/src/libs/kStuff/kStuff/include/k/kLdrFmts/mach-o.h index 932c89d5b..bacbdc4e3 100644 --- a/src/libs/kStuff/kStuff/include/k/kLdrFmts/mach-o.h +++ b/src/libs/kStuff/kStuff/include/k/kLdrFmts/mach-o.h @@ -1,8 +1,33 @@ -/* $Id $ */ +/* $Id: mach-o.h 32 2009-07-01 21:08:59Z bird $ */ /** @file * Mach-0 structures, types and defines. */ +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + #ifndef ___k_kLdrFmts_mach_o_h___ #define ___k_kLdrFmts_mach_o_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kLdrFmts/mz.h b/src/libs/kStuff/kStuff/include/k/kLdrFmts/mz.h index 52ea1046d..b159cac27 100644 --- a/src/libs/kStuff/kStuff/include/k/kLdrFmts/mz.h +++ b/src/libs/kStuff/kStuff/include/k/kLdrFmts/mz.h @@ -1,8 +1,33 @@ -/* $Id: mz.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: mz.h 31 2009-07-01 21:08:06Z bird $ */ /** @file * MZ structures, types and defines. */ +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + #ifndef ___k_kLdrFmts_mz_h___ #define ___k_kLdrFmts_mz_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kLdrFmts/pe.h b/src/libs/kStuff/kStuff/include/k/kLdrFmts/pe.h index 4b044d0b2..e8432b987 100644 --- a/src/libs/kStuff/kStuff/include/k/kLdrFmts/pe.h +++ b/src/libs/kStuff/kStuff/include/k/kLdrFmts/pe.h @@ -1,8 +1,33 @@ -/* $Id: pe.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: pe.h 31 2009-07-01 21:08:06Z bird $ */ /** @file * PE structures, types and defines. */ +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + #ifndef ___k_kLdrFmts_pe_h___ #define ___k_kLdrFmts_pe_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kMagics.h b/src/libs/kStuff/kStuff/include/k/kMagics.h index 4c32ca188..9690b9b1d 100644 --- a/src/libs/kStuff/kStuff/include/k/kMagics.h +++ b/src/libs/kStuff/kStuff/include/k/kMagics.h @@ -1,27 +1,31 @@ -/* $Id: kMagics.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kMagics.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kMagics - Various Magic Constants. */ /* - * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/include/k/kRdr.h b/src/libs/kStuff/kStuff/include/k/kRdr.h index 2964690d6..7e0b5e872 100644 --- a/src/libs/kStuff/kStuff/include/k/kRdr.h +++ b/src/libs/kStuff/kStuff/include/k/kRdr.h @@ -1,27 +1,31 @@ -/* $Id: kRdr.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kRdr.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kRdr - The File Provider. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kRdr_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kRdrAll.h b/src/libs/kStuff/kStuff/include/k/kRdrAll.h index b4865bc7b..78f946f2d 100644 --- a/src/libs/kStuff/kStuff/include/k/kRdrAll.h +++ b/src/libs/kStuff/kStuff/include/k/kRdrAll.h @@ -1,27 +1,31 @@ -/* $Id: kRdrAll.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kRdrAll.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kRdr - The File Provider, All Details and Dependencies Included. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kRdrAll_h___ diff --git a/src/libs/kStuff/kStuff/include/k/kTypes.h b/src/libs/kStuff/kStuff/include/k/kTypes.h index c3e46cf5d..d79f295b4 100644 --- a/src/libs/kStuff/kStuff/include/k/kTypes.h +++ b/src/libs/kStuff/kStuff/include/k/kTypes.h @@ -1,27 +1,31 @@ -/* $Id: kTypes.h 17 2009-01-24 02:03:50Z bird $ */ +/* $Id: kTypes.h 29 2009-07-01 20:30:29Z bird $ */ /** @file - * * kTypes - Typedefs And Related Constants And Macros. + */ + +/* + * Copyright (c) 2006-2009 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * Copyright (c) 2007-2009 knut st. osmundsen <bird-src-spam@anduin.net> - * - * - * This file is part of kStuff. - * - * kStuff is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * You should have received a copy of the GNU Lesser General Public License - * along with kStuff; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___k_kTypes_h___ diff --git a/src/libs/kStuff/kStuff/kCpu/Makefile.kmk b/src/libs/kStuff/kStuff/kCpu/Makefile.kmk index 41f3f19cf..505d4382c 100644 --- a/src/libs/kStuff/kStuff/kCpu/Makefile.kmk +++ b/src/libs/kStuff/kStuff/kCpu/Makefile.kmk @@ -1,27 +1,31 @@ -# $Id: Makefile.kmk 5 2008-02-03 20:56:09Z bird $ +# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kCpu - The CPU and Architecture API, sub-makefile. # # -# Copyright (c) 2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> -# -# This file is part of kStuff. -# -# kStuff is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# kStuff is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kStuff; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. diff --git a/src/libs/kStuff/kStuff/kCpu/kCpuCompare.c b/src/libs/kStuff/kStuff/kCpu/kCpuCompare.c index cc931f670..0d351a0b1 100644 --- a/src/libs/kStuff/kStuff/kCpu/kCpuCompare.c +++ b/src/libs/kStuff/kStuff/kCpu/kCpuCompare.c @@ -1,33 +1,31 @@ -/* $Id: kCpuCompare.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kCpuCompare.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kCpu - kCpuCompare. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kCpu/kCpuGetArchAndCpu.c b/src/libs/kStuff/kStuff/kCpu/kCpuGetArchAndCpu.c index 522e443b2..8e0c00bfc 100644 --- a/src/libs/kStuff/kStuff/kCpu/kCpuGetArchAndCpu.c +++ b/src/libs/kStuff/kStuff/kCpu/kCpuGetArchAndCpu.c @@ -1,33 +1,31 @@ -/* $Id: kCpuGetArchAndCpu.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kCpuGetArchAndCpu.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kCpu - kCpuGetArchAndCpu. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kDbg/Makefile.kmk b/src/libs/kStuff/kStuff/kDbg/Makefile.kmk index 17f584275..af8bed3fd 100644 --- a/src/libs/kStuff/kStuff/kDbg/Makefile.kmk +++ b/src/libs/kStuff/kStuff/kDbg/Makefile.kmk @@ -1,26 +1,31 @@ -# $Id: Makefile.kmk 6 2008-02-03 23:37:34Z bird $ +# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kDbg - The Debug Info Reader, sub-makefile. # # -# Copyright (c) 2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kStuff. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kStuff is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # -# kStuff is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kStuff; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgDump.cpp b/src/libs/kStuff/kStuff/kDbg/kDbgDump.cpp index 75ab58f6a..83cb36b9d 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgDump.cpp +++ b/src/libs/kStuff/kStuff/kDbg/kDbgDump.cpp @@ -1,33 +1,31 @@ -/* $Id: kDbgDump.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgDump.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbgDump - Debug Info Dumper. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgHlp.h b/src/libs/kStuff/kStuff/kDbg/kDbgHlp.h index 2fec657fd..7a2cabcf6 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgHlp.h +++ b/src/libs/kStuff/kStuff/kDbg/kDbgHlp.h @@ -1,33 +1,31 @@ -/* $Id: kDbgHlp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgHlp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Internal Header. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kDbgHlp_h___ diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgHlpCrt.cpp b/src/libs/kStuff/kStuff/kDbg/kDbgHlpCrt.cpp index 6c7338245..3a003e5f1 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgHlpCrt.cpp +++ b/src/libs/kStuff/kStuff/kDbg/kDbgHlpCrt.cpp @@ -1,33 +1,31 @@ -/* $Id: kDbgHlpCrt.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgHlpCrt.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Helpers, CRT Based Implementation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgInternal.h b/src/libs/kStuff/kStuff/kDbg/kDbgInternal.h index 4e391d09e..fdb3fcdaf 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgInternal.h +++ b/src/libs/kStuff/kStuff/kDbg/kDbgInternal.h @@ -1,33 +1,31 @@ -/* $Id: kDbgInternal.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgInternal.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Internal Header. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kDbgInternal_h___ diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgLine.cpp b/src/libs/kStuff/kStuff/kDbg/kDbgLine.cpp index 6285bfde0..52e573f8b 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgLine.cpp +++ b/src/libs/kStuff/kStuff/kDbg/kDbgLine.cpp @@ -1,33 +1,31 @@ -/* $Id: kDbgLine.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgLine.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Read, Line Numbers. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgModLdr.cpp b/src/libs/kStuff/kStuff/kDbg/kDbgModLdr.cpp index 5da054180..5e7709523 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgModLdr.cpp +++ b/src/libs/kStuff/kStuff/kDbg/kDbgModLdr.cpp @@ -1,33 +1,31 @@ -/* $Id: kDbgModLdr.cpp 6 2008-02-03 23:37:34Z bird $ */ +/* $Id: kDbgModLdr.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, kLdr Based. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgModPE.cpp b/src/libs/kStuff/kStuff/kDbg/kDbgModPE.cpp index dcc70d579..85de91ca1 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgModPE.cpp +++ b/src/libs/kStuff/kStuff/kDbg/kDbgModPE.cpp @@ -1,33 +1,31 @@ -/* $Id: kDbgModPE.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgModPE.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, PE Module (Generic). */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgModWinDbgHelp.cpp b/src/libs/kStuff/kStuff/kDbg/kDbgModWinDbgHelp.cpp index f1c5316de..3c3077385 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgModWinDbgHelp.cpp +++ b/src/libs/kStuff/kStuff/kDbg/kDbgModWinDbgHelp.cpp @@ -1,33 +1,31 @@ -/* $Id: kDbgModWinDbgHelp.cpp 6 2008-02-03 23:37:34Z bird $ */ +/* $Id: kDbgModWinDbgHelp.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, DbgHelp Based Reader. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgModule.cpp b/src/libs/kStuff/kStuff/kDbg/kDbgModule.cpp index 118d04c8a..c43fb1678 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgModule.cpp +++ b/src/libs/kStuff/kStuff/kDbg/kDbgModule.cpp @@ -1,33 +1,31 @@ -/* $Id: kDbgModule.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgModule.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Module API. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgSpace.cpp b/src/libs/kStuff/kStuff/kDbg/kDbgSpace.cpp index f369bf410..2d6f1c01e 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgSpace.cpp +++ b/src/libs/kStuff/kStuff/kDbg/kDbgSpace.cpp @@ -1,33 +1,31 @@ -/* $Id: kDbgSpace.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgSpace.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Address Space Manager. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kDbg/kDbgSymbol.cpp b/src/libs/kStuff/kStuff/kDbg/kDbgSymbol.cpp index f9b4c7af8..d542807ec 100644 --- a/src/libs/kStuff/kStuff/kDbg/kDbgSymbol.cpp +++ b/src/libs/kStuff/kStuff/kDbg/kDbgSymbol.cpp @@ -1,33 +1,31 @@ -/* $Id: kDbgSymbol.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kDbgSymbol.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kDbg - The Debug Info Reader, Symbols. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kErr/Makefile.kmk b/src/libs/kStuff/kStuff/kErr/Makefile.kmk index 5b27f3d00..de11e2087 100644 --- a/src/libs/kStuff/kStuff/kErr/Makefile.kmk +++ b/src/libs/kStuff/kStuff/kErr/Makefile.kmk @@ -1,27 +1,31 @@ -# $Id: Makefile.kmk 5 2008-02-03 20:56:09Z bird $ +# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kErr - The Status Code API, sub-makefile. # # -# Copyright (c) 2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kStuff. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kStuff is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# kStuff is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kStuff; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. diff --git a/src/libs/kStuff/kStuff/kErr/kErrName.c b/src/libs/kStuff/kStuff/kErr/kErrName.c index da5e08175..a412e2a8d 100644 --- a/src/libs/kStuff/kStuff/kErr/kErrName.c +++ b/src/libs/kStuff/kStuff/kErr/kErrName.c @@ -1,33 +1,31 @@ -/* $Id: kErrName.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kErrName.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kErr - Status Code API, kErrName. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBare-gcc.c b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBare-gcc.c index 8e52645cf..889e48f34 100644 --- a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBare-gcc.c +++ b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBare-gcc.c @@ -1,33 +1,31 @@ -/* $Id: kHlpBare-gcc.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpBare-gcc.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - The Dynamic Loader, Helper Functions for GCC. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include <k/kLdr.h> diff --git a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareAssert.c b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareAssert.c index 585ac2e24..73bae5bfd 100644 --- a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareAssert.c +++ b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareAssert.c @@ -1,33 +1,31 @@ -/* $Id: kHlpBareAssert.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpBareAssert.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - Assert Backend. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareEnv.c b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareEnv.c index c88843393..353c19e20 100644 --- a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareEnv.c +++ b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareEnv.c @@ -1,33 +1,31 @@ -/* $Id: kHlpBareEnv.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpBareEnv.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - Environment Manipulation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareHeap.c b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareHeap.c index 61f1302a0..d5e44b4e7 100644 --- a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareHeap.c +++ b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareHeap.c @@ -1,33 +1,31 @@ -/* $Id: kHlpBareHeap.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpBareHeap.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - Heap. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #define KHLPHEAP_STRICT diff --git a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareProcess.c b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareProcess.c index ef1dd1755..f7db3ffee 100644 --- a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareProcess.c +++ b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareProcess.c @@ -1,33 +1,31 @@ -/* $Id: kHlpBareProcess.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpBareProcess.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - Process Management */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareThread.c b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareThread.c index cc837c5ba..b484676a1 100644 --- a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareThread.c +++ b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpBareThread.c @@ -1,33 +1,31 @@ -/* $Id: kHlpBareThread.c 24 2009-02-08 13:58:54Z bird $ */ +/* $Id: kHlpBareThread.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - Thread Manipulation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpSys-darwin.c b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpSys-darwin.c index 695fd96b1..b4153f265 100644 --- a/src/libs/kStuff/kStuff/kHlp/Bare/kHlpSys-darwin.c +++ b/src/libs/kStuff/kStuff/kHlp/Bare/kHlpSys-darwin.c @@ -1,33 +1,31 @@ -/* $Id: kHlpSys-darwin.c 24 2009-02-08 13:58:54Z bird $ */ +/* $Id: kHlpSys-darwin.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpBare - */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include <k/kHlpSys.h> diff --git a/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTAlloc.cpp b/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTAlloc.cpp index e345e814f..fa5f2af52 100644 --- a/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTAlloc.cpp +++ b/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTAlloc.cpp @@ -1,33 +1,31 @@ -/* $Id: kHlpCRTAlloc.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpCRTAlloc.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpAlloc - Memory Allocation, CRT based implementation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTEnv.cpp b/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTEnv.cpp index a1fa0216b..108c9f1a0 100644 --- a/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTEnv.cpp +++ b/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTEnv.cpp @@ -1,33 +1,31 @@ -/* $Id: kHlpCRTEnv.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpCRTEnv.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpEnv - Environment Manipulation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTString.cpp b/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTString.cpp index 9bf0a1e8c..401b378e2 100644 --- a/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTString.cpp +++ b/src/libs/kStuff/kStuff/kHlp/CRT/kHlpCRTString.cpp @@ -1,33 +1,31 @@ -/* $Id: kHlpCRTString.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpCRTString.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - String And Memory Routines, CRT based implementation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetEnvUZ.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetEnvUZ.c index debcc1e41..4721af7bc 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetEnvUZ.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetEnvUZ.c @@ -1,33 +1,31 @@ -/* $Id: kHlpGetEnvUZ.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpGetEnvUZ.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpEnv - kHlpGetEnvUZ. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetExt.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetExt.c index 8c3c710f2..7e338fa3d 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetExt.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetExt.c @@ -1,33 +1,31 @@ -/* $Id: kHlpGetExt.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpGetExt.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpPath - kHlpGetExt and kHlpGetSuff. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetFilename.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetFilename.c index 7292ffb04..43e061056 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetFilename.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpGetFilename.c @@ -1,33 +1,31 @@ -/* $Id: kHlpGetFilename.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpGetFilename.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpPath - kHlpGetFilename. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpInt2Ascii.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpInt2Ascii.c index 0f8fbda00..411342b82 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpInt2Ascii.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpInt2Ascii.c @@ -1,33 +1,31 @@ -/* $Id: kHlpInt2Ascii.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpInt2Ascii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpInt2Ascii. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpIsFilenameOnly.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpIsFilenameOnly.c index 9650afc6a..1cefa61ee 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpIsFilenameOnly.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpIsFilenameOnly.c @@ -1,33 +1,31 @@ -/* $Id: kHlpIsFilenameOnly.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpIsFilenameOnly.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpPath - kHlpIsFilenameOnly. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemChr.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemChr.c index ae7aaaf0c..060916d36 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemChr.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemChr.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemChr.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemChr.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemChr. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemComp.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemComp.c index 353ff8adf..54d199975 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemComp.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemComp.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemComp.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemComp. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemCopy.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemCopy.c index ab392fe39..86746746e 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemCopy.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemCopy.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemCopy.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemCopy.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemCopy. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemICompAscii.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemICompAscii.c index 9faa83b32..6df576792 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemICompAscii.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemICompAscii.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemICompAscii.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemICompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemICompAscii. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemMove.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemMove.c index 341bbe0af..438a299d1 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemMove.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemMove.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemMove.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemMove.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemMove. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPComp.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPComp.c index f1b4b550b..d67851753 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPComp.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPComp.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemPComp.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemPComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemPComp. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPCopy.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPCopy.c index 054da63c4..0b7945e36 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPCopy.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPCopy.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemPCopy.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemPCopy.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemPCopy. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPMove.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPMove.c index 6d294772f..6276519ec 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPMove.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPMove.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemPMove.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemPMove.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemPMove. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPSet.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPSet.c index 3fa2ecc86..0a77e1ade 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPSet.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemPSet.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemPSet.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemPSet.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemPSet. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemSet.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemSet.c index 39c68f35a..4e986aef0 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemSet.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpMemSet.c @@ -1,33 +1,31 @@ -/* $Id: kHlpMemSet.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpMemSet.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpMemSet. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpPage.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpPage.c index 1a61e6ae7..f915f5848 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpPage.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpPage.c @@ -1,33 +1,31 @@ -/* $Id: kHlpPage.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpPage.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlp - Generic Page Memory Functions. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrCat.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrCat.c index 9d902c9dc..82900ea34 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrCat.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrCat.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrCat.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrCat.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrCat. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrChr.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrChr.c index ac32105b7..acff27c9b 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrChr.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrChr.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrChr.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrChr.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrChr. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrComp.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrComp.c index 589c2e196..12bdaaf0c 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrComp.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrComp.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrComp.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrComp. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrCopy.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrCopy.c index 763647277..86efbab67 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrCopy.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrCopy.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrCopy.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrCopy.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrCopy. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrICompAscii.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrICompAscii.c index 20ea5d76e..446f61f78 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrICompAscii.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrICompAscii.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrICompAscii.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrICompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrICompAscii. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrIPCompAscii.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrIPCompAscii.c index 60dc5e1eb..40d28f769 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrIPCompAscii.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrIPCompAscii.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrIPCompAscii.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrIPCompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrIPCompAscii. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrLen.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrLen.c index 989fe3901..714c70381 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrLen.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrLen.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrLen.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrLen.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrLen. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNCat.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNCat.c index 78a461cc2..a311cb019 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNCat.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNCat.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrNCat.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrNCat.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNCat. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNComp.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNComp.c index 48580f681..f46aa8ada 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNComp.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNComp.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrNComp.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrNComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNComp. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNICompAscii.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNICompAscii.c index 73d5794fa..d9670a04c 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNICompAscii.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNICompAscii.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrNICompAscii.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrNICompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNICompAscii. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNIPCompAscii.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNIPCompAscii.c index 91139b9b3..976f19744 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNIPCompAscii.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNIPCompAscii.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrNIPCompAscii.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrNIPCompAscii.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNIPCompAscii. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNLen.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNLen.c index 173bb5e30..bf1db6c4b 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNLen.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNLen.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrNLen.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrNLen.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNLen. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNPCat.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNPCat.c index 85320c93e..cec0921b4 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNPCat.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNPCat.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrNPCat.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrNPCat.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNPCat. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNPComp.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNPComp.c index 197693cec..bafd05e12 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNPComp.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrNPComp.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrNPComp.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrNPComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrNPComp. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPCat.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPCat.c index 6625db3ec..fc80f9cfb 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPCat.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPCat.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrPCat.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrPCat.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrPCat. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPComp.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPComp.c index 867faef2b..35724273b 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPComp.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPComp.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrPComp.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrPComp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrPComp. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPCopy.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPCopy.c index ad6b746f7..57d062ba6 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPCopy.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrPCopy.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrPCopy.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrPCopy.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrPCopy. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrRChr.c b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrRChr.c index 6235ed768..a71284034 100644 --- a/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrRChr.c +++ b/src/libs/kStuff/kStuff/kHlp/Generic/kHlpStrRChr.c @@ -1,33 +1,31 @@ -/* $Id: kHlpStrRChr.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kHlpStrRChr.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kHlpString - kHlpStrRChr. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kHlp/Makefile.kmk b/src/libs/kStuff/kStuff/kHlp/Makefile.kmk index 3dfb7d76d..3ba988275 100644 --- a/src/libs/kStuff/kStuff/kHlp/Makefile.kmk +++ b/src/libs/kStuff/kStuff/kHlp/Makefile.kmk @@ -1,27 +1,31 @@ -# $Id: Makefile.kmk 24 2009-02-08 13:58:54Z bird $ +# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kHlp - The Helper API, sub-makefile. # # -# Copyright (c) 2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kStuff. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kStuff is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# kStuff is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kStuff; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. diff --git a/src/libs/kStuff/kStuff/kLdr/Makefile.kmk b/src/libs/kStuff/kStuff/kLdr/Makefile.kmk index 547a7c191..fc8455b34 100644 --- a/src/libs/kStuff/kStuff/kLdr/Makefile.kmk +++ b/src/libs/kStuff/kStuff/kLdr/Makefile.kmk @@ -1,27 +1,31 @@ -# $Id: Makefile.kmk 5 2008-02-03 20:56:09Z bird $ +# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kLdr - The Dynamic Loader, sub-makefile. # # -# Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kStuff. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kStuff is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# kStuff is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kStuff; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. diff --git a/src/libs/kStuff/kStuff/kLdr/kLdr-os2.c b/src/libs/kStuff/kStuff/kLdr/kLdr-os2.c index f927912a9..62835ac49 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdr-os2.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdr-os2.c @@ -1,33 +1,31 @@ -/* $Id: kLdr-os2.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdr-os2.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, OS/2 Specifics. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdr-os2.def b/src/libs/kStuff/kStuff/kLdr/kLdr-os2.def index b68ffa8e5..e9895f711 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdr-os2.def +++ b/src/libs/kStuff/kStuff/kLdr/kLdr-os2.def @@ -1,35 +1,32 @@ -; $Id: kLdr-os2.def 2 2007-11-16 16:07:14Z bird $ +; $Id: kLdr-os2.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - The Dynamic Loader, OS/2 Linker Definition File. ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; -; This file is part of kStuff. +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: ; -; kStuff is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. ; -; In addition to the permissions in the GNU Lesser General Public -; License, you are granted unlimited permission to link the compiled -; version of this file into combinations with other programs, and to -; distribute those combinations without any restriction coming from -; the use of this file. +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; -; kStuff is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. -; -; You should have received a copy of the GNU Lesser General Public -; License along with kStuff; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -; 02110-1301, USA -; - LIBRARY kLdr INITINSTANCE TERMINSTANCE DATA MULTIPLE diff --git a/src/libs/kStuff/kStuff/kLdr/kLdr-win.c b/src/libs/kStuff/kStuff/kLdr/kLdr-win.c index e6a3006b3..1fe7e5989 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdr-win.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdr-win.c @@ -1,33 +1,31 @@ -/* $Id: kLdr-win.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdr-win.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, Windows Specifics. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdr-win.def b/src/libs/kStuff/kStuff/kLdr/kLdr-win.def index f3183d2d9..fc36e5978 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdr-win.def +++ b/src/libs/kStuff/kStuff/kLdr/kLdr-win.def @@ -1,35 +1,32 @@ -; $Id: kLdr-win.def 2 2007-11-16 16:07:14Z bird $ +; $Id: kLdr-win.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - The Dynamic Loader, Windows Linker Definition File. ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; -; This file is part of kStuff. +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: ; -; kStuff is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. ; -; In addition to the permissions in the GNU Lesser General Public -; License, you are granted unlimited permission to link the compiled -; version of this file into combinations with other programs, and to -; distribute those combinations without any restriction coming from -; the use of this file. +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; -; kStuff is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. -; -; You should have received a copy of the GNU Lesser General Public -; License along with kStuff; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -; 02110-1301, USA -; - LIBRARY kLdr EXPORTS diff --git a/src/libs/kStuff/kStuff/kLdr/kLdr.c b/src/libs/kStuff/kStuff/kLdr/kLdr.c index 601b59e08..38f4cfab7 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdr.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdr.c @@ -1,33 +1,31 @@ -/* $Id: kLdr.c 2 2007-11-16 16:07:14Z bird $ */
+/* $Id: kLdr.c 29 2009-07-01 20:30:29Z bird $ */
/** @file
* kLdr - The Dynamic Loader.
*/
/*
- * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+ * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
*
- * This file is part of kStuff.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
*
- * kStuff is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
- * In addition to the permissions in the GNU Lesser General Public
- * License, you are granted unlimited permission to link the compiled
- * version of this file into combinations with other programs, and to
- * distribute those combinations without any restriction coming from
- * the use of this file.
- *
- * kStuff is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with kStuff; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrA-os2.asm b/src/libs/kStuff/kStuff/kLdr/kLdrA-os2.asm index f1ecd46a2..cc9784ae0 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrA-os2.asm +++ b/src/libs/kStuff/kStuff/kLdr/kLdrA-os2.asm @@ -1,33 +1,31 @@ -; $Id: kLdrA-os2.asm 2 2007-11-16 16:07:14Z bird $
+; $Id: kLdrA-os2.asm 29 2009-07-01 20:30:29Z bird $
;; @file
; kLdr - The Dynamic Loader, OS/2 Assembly Helpers.
;
;
-; Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
;
-; This file is part of kStuff.
+; Permission is hereby granted, free of charge, to any person
+; obtaining a copy of this software and associated documentation
+; files (the "Software"), to deal in the Software without
+; restriction, including without limitation the rights to use,
+; copy, modify, merge, publish, distribute, sublicense, and/or sell
+; copies of the Software, and to permit persons to whom the
+; Software is furnished to do so, subject to the following
+; conditions:
;
-; kStuff is free software; you can redistribute it and/or
-; modify it under the terms of the GNU Lesser General Public
-; License as published by the Free Software Foundation; either
-; version 2.1 of the License, or (at your option) any later version.
+; The above copyright notice and this permission notice shall be
+; included in all copies or substantial portions of the Software.
;
-; In addition to the permissions in the GNU Lesser General Public
-; License, you are granted unlimited permission to link the compiled
-; version of this file into combinations with other programs, and to
-; distribute those combinations without any restriction coming from
-; the use of this file.
-;
-; kStuff is distributed in the hope that it will be useful,
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-; Lesser General Public License for more details.
-;
-; You should have received a copy of the GNU Lesser General Public
-; License along with kStuff; if not, write to the Free Software
-; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-; 02110-1301, USA
+; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+; OTHER DEALINGS IN THE SOFTWARE.
;
segment TEXT32 public align=16 CLASS=CODE use32
diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrDyld.c b/src/libs/kStuff/kStuff/kLdr/kLdrDyld.c index c76e16fc1..9ff3dd824 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrDyld.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrDyld.c @@ -1,33 +1,31 @@ -/* $Id: kLdrDyld.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdrDyld.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrDyldFind.c b/src/libs/kStuff/kStuff/kLdr/kLdrDyldFind.c index 995974186..9d6562eb5 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrDyldFind.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrDyldFind.c @@ -1,33 +1,31 @@ -/* $Id: kLdrDyldFind.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdrDyldFind.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, File Searching Methods. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrDyldMod.c b/src/libs/kStuff/kStuff/kLdr/kLdrDyldMod.c index 9ee7f0368..b8ebcfc18 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrDyldMod.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrDyldMod.c @@ -1,33 +1,31 @@ -/* $Id: kLdrDyldMod.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdrDyldMod.c 33 2009-07-01 21:22:37Z bird $ */ /** @file * kLdr - The Dynamic Loader, Dyld module methods. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* @@ -78,11 +76,12 @@ int kldrDyldModCreate(PKRDR pRdr, KU32 fFlags, PPKLDRDYLDMOD ppMod) *ppMod = NULL; /** @todo deal with fFlags (exec/dll) */ +/** @todo Check up the cpu architecture. */ /* * Try open an module interpreter. */ - rc = kLdrModOpenFromRdr(pRdr, &pRawMod); + rc = kLdrModOpenFromRdr(pRdr, 0 /*fFlags*/, KCPUARCH_UNKNOWN, &pRawMod); if (rc) return kldrDyldFailure(rc, "%s: %rc", kRdrName(pRdr), rc); diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrDyldOS.c b/src/libs/kStuff/kStuff/kLdr/kLdrDyldOS.c index e0f588780..ed475613c 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrDyldOS.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrDyldOS.c @@ -1,33 +1,31 @@ -/* $Id: kLdrDyldOS.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdrDyldOS.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, OS specific operations. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrDyldSem.c b/src/libs/kStuff/kStuff/kLdr/kLdrDyldSem.c index 3a158b311..9ffa49735 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrDyldSem.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrDyldSem.c @@ -1,33 +1,31 @@ -/* $Id: kLdrDyldSem.c 24 2009-02-08 13:58:54Z bird $ */ +/* $Id: kLdrDyldSem.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, Semaphore Helper Functions. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2.asm b/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2.asm index c777277cc..ad897e3b0 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2.asm +++ b/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2.asm @@ -1,4 +1,4 @@ -; $Id: kLdrExeStub-os2.asm 2 2007-11-16 16:07:14Z bird $
+; $Id: kLdrExeStub-os2.asm 29 2009-07-01 20:30:29Z bird $
;; @file
; kLdr - OS/2 Loader Stub.
;
@@ -7,30 +7,28 @@ ;
;
-; Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
;
-; This file is part of kStuff.
+; Permission is hereby granted, free of charge, to any person
+; obtaining a copy of this software and associated documentation
+; files (the "Software"), to deal in the Software without
+; restriction, including without limitation the rights to use,
+; copy, modify, merge, publish, distribute, sublicense, and/or sell
+; copies of the Software, and to permit persons to whom the
+; Software is furnished to do so, subject to the following
+; conditions:
;
-; kStuff is free software; you can redistribute it and/or
-; modify it under the terms of the GNU Lesser General Public
-; License as published by the Free Software Foundation; either
-; version 2.1 of the License, or (at your option) any later version.
+; The above copyright notice and this permission notice shall be
+; included in all copies or substantial portions of the Software.
;
-; In addition to the permissions in the GNU Lesser General Public
-; License, you are granted unlimited permission to link the compiled
-; version of this file into combinations with other programs, and to
-; distribute those combinations without any restriction coming from
-; the use of this file.
-;
-; kStuff is distributed in the hope that it will be useful,
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-; Lesser General Public License for more details.
-;
-; You should have received a copy of the GNU Lesser General Public
-; License along with kStuff; if not, write to the Free Software
-; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-; 02110-1301, USA
+; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+; OTHER DEALINGS IN THE SOFTWARE.
;
struc KLDRARGS
diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2.c b/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2.c index 45ec02743..17a4b1c07 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2.c @@ -1,33 +1,31 @@ -/* $Id: kLdrExeStub-os2.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdrExeStub-os2.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - OS/2 C Loader Stub. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2A.asm b/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2A.asm index f7b8bab97..b3d692c3f 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2A.asm +++ b/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-os2A.asm @@ -1,35 +1,32 @@ -; $Id: kLdrExeStub-os2A.asm 2 2007-11-16 16:07:14Z bird $ +; $Id: kLdrExeStub-os2A.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - OS/2 Loader Stub, entry point thingy... ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +; +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: +; +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; -; This file is part of kStuff. -; -; kStuff is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. -; -; In addition to the permissions in the GNU Lesser General Public -; License, you are granted unlimited permission to link the compiled -; version of this file into combinations with other programs, and to -; distribute those combinations without any restriction coming from -; the use of this file. -; -; kStuff is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. -; -; You should have received a copy of the GNU Lesser General Public -; License along with kStuff; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -; 02110-1301, USA -; - segment TEXT32 public CLASS=CODE align=16 use32 diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-win.c b/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-win.c index 987c65074..55920e5ef 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-win.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrExeStub-win.c @@ -1,33 +1,31 @@ -/* $Id: kLdrExeStub-win.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdrExeStub-win.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Windows Loader Stub. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrInternal.h b/src/libs/kStuff/kStuff/kLdr/kLdrInternal.h index e17c0d56c..508f3ab01 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrInternal.h +++ b/src/libs/kStuff/kStuff/kLdr/kLdrInternal.h @@ -1,33 +1,31 @@ -/* $Id: kLdrInternal.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdrInternal.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Dynamic Loader, internal header. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kLdrInternal_h___ diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrMod.c b/src/libs/kStuff/kStuff/kLdr/kLdrMod.c index 43ea384f0..68f852d23 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrMod.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrMod.c @@ -1,33 +1,31 @@ -/* $Id: kLdrMod.c 26 2009-02-19 01:06:09Z bird $ */
+/* $Id: kLdrMod.c 30 2009-07-01 20:54:59Z bird $ */
/** @file
* kLdr - The Module Interpreter.
*/
/*
- * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
- *
- * This file is part of kStuff.
- *
- * kStuff is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * In addition to the permissions in the GNU Lesser General Public
- * License, you are granted unlimited permission to link the compiled
- * version of this file into combinations with other programs, and to
- * distribute those combinations without any restriction coming from
- * the use of this file.
- *
- * kStuff is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with kStuff; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
+ * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
/*******************************************************************************
@@ -40,8 +38,6 @@ #if 1 /* testing headers */
# include <k/kLdrFmts/pe.h>
# include <k/kLdrFmts/lx.h>
-# include <k/kLdrFmts/elf32.h>
-# include <k/kLdrFmts/elf64.h>
# include <k/kLdrFmts/mach-o.h>
#endif
diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrModLX.c b/src/libs/kStuff/kStuff/kLdr/kLdrModLX.c index f3916c94c..061b06a09 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrModLX.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrModLX.c @@ -1,33 +1,31 @@ -/* $Id: kLdrModLX.c 28 2009-03-28 18:37:20Z bird $ */ +/* $Id: kLdrModLX.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Module Interpreter for the Linear eXecutable (LX) Format. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrModMachO.c b/src/libs/kStuff/kStuff/kLdr/kLdrModMachO.c index ce71326c7..1e74804e8 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrModMachO.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrModMachO.c @@ -1,33 +1,31 @@ -/* $Id: kLdrModMachO.c 28 2009-03-28 18:37:20Z bird $ */ +/* $Id: kLdrModMachO.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Module Interpreter for the MACH-O format. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrModNative.c b/src/libs/kStuff/kStuff/kLdr/kLdrModNative.c index 8726a9aa7..aa5efb84c 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrModNative.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrModNative.c @@ -1,33 +1,31 @@ -/* $Id: kLdrModNative.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kLdrModNative.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Module Interpreter for the Native Loaders. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/kLdrModPE.c b/src/libs/kStuff/kStuff/kLdr/kLdrModPE.c index f1ba0b6e1..1e721c0b8 100644 --- a/src/libs/kStuff/kStuff/kLdr/kLdrModPE.c +++ b/src/libs/kStuff/kStuff/kLdr/kLdrModPE.c @@ -1,33 +1,31 @@ -/* $Id: kLdrModPE.c 28 2009-03-28 18:37:20Z bird $ */ +/* $Id: kLdrModPE.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - The Module Interpreter for the Portable Executable (PE) Format. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/Makefile.kmk b/src/libs/kStuff/kStuff/kLdr/testcase/Makefile.kmk index 1c9a9d6d7..7b3efb6f6 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/Makefile.kmk +++ b/src/libs/kStuff/kStuff/kLdr/testcase/Makefile.kmk @@ -1,27 +1,31 @@ -# $Id: Makefile.kmk 5 2008-02-03 20:56:09Z bird $
+# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $
## @file
# kBuild Makefile for the kLdr testcases.
#
#
-# Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
#
-# This file is part of kStuff.
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
#
-# kStuff is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# kStuff is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with kStuff; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
#
# generate rules.
diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tst-0-driver.c b/src/libs/kStuff/kStuff/kLdr/testcase/tst-0-driver.c index 24e86d198..be304d5c2 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tst-0-driver.c +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tst-0-driver.c @@ -1,27 +1,31 @@ -/* $Id: tst-0-driver.c 2 2007-11-16 16:07:14Z bird $ */
+/* $Id: tst-0-driver.c 29 2009-07-01 20:30:29Z bird $ */
/** @file
* kLdr - Dynamic Loader testcase no. 0, Driver.
*/
/*
- * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+ * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
*
- * This file is part of kStuff.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
*
- * kStuff is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * kStuff is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with kStuff; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
/*******************************************************************************
diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-driver.c b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-driver.c index f4748be8f..483a5857f 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-driver.c +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-driver.c @@ -1,27 +1,31 @@ -/* $Id: tst-3-driver.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: tst-3-driver.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Dynamic Loader testcase no. 3, Driver. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-ext.c b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-ext.c index 80fd1dc3f..2b4c839e8 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-ext.c +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-ext.c @@ -1,27 +1,31 @@ -/* $Id: tst-3-ext.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: tst-3-ext.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Dynamic Loader testcase no. 3, 2nd object module. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include "tst.h" diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-imp-os2.def b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-imp-os2.def index 2c740475a..9ec3b139c 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-imp-os2.def +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-imp-os2.def @@ -1,27 +1,31 @@ -; $Id: tst-3-imp-os2.def 2 2007-11-16 16:07:14Z bird $ +; $Id: tst-3-imp-os2.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - Dynamic Loader testcase no. 3, Fake module import library - OS/2. ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> -; -; This file is part of kStuff. -; -; kStuff is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. -; -; kStuff is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. -; -; You should have received a copy of the GNU Lesser General Public -; License along with kStuff; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -; +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +; +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: +; +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; LIBRARY tst-3-imp diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-imp-win.def b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-imp-win.def index 505cae6e6..738180455 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-imp-win.def +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3-imp-win.def @@ -1,27 +1,31 @@ -; $Id: tst-3-imp-win.def 2 2007-11-16 16:07:14Z bird $ +; $Id: tst-3-imp-win.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - Dynamic Loader testcase no. 3, Fake module import library - Windows. ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> -; -; This file is part of kStuff. -; -; kStuff is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. -; -; kStuff is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. -; -; You should have received a copy of the GNU Lesser General Public -; License along with kStuff; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -; +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +; +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: +; +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; LIBRARY tst-3-imp diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3.c b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3.c index 9184a6158..ed89d9e4d 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tst-3.c +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tst-3.c @@ -1,27 +1,31 @@ -/* $Id: tst-3.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: tst-3.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Dynamic Loader testcase no. 3, Driver. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include "tst.h" diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tst.h b/src/libs/kStuff/kStuff/kLdr/testcase/tst.h index 9a837e48c..f06dba74a 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tst.h +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tst.h @@ -1,27 +1,31 @@ -/* $Id: tst.h 2 2007-11-16 16:07:14Z bird $ */
+/* $Id: tst.h 29 2009-07-01 20:30:29Z bird $ */
/** @file
* kLdr testcase header.
*/
/*
- * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+ * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
*
- * This file is part of kStuff.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
*
- * kStuff is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * kStuff is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with kStuff; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ___tst_h___
diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMain.c b/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMain.c index 119e01406..b86819ceb 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMain.c +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMain.c @@ -1,27 +1,31 @@ -/* $Id: tstDllMain.c 2 2007-11-16 16:07:14Z bird $ */
+/* $Id: tstDllMain.c 29 2009-07-01 20:30:29Z bird $ */
/** @file
* kLdr testcase.
*/
/*
- * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+ * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
*
- * This file is part of kStuff.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
*
- * kStuff is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * kStuff is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with kStuff; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
/*******************************************************************************
diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMainStub-os2.asm b/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMainStub-os2.asm index ec3f55e54..76dad0129 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMainStub-os2.asm +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMainStub-os2.asm @@ -1,27 +1,31 @@ -; $Id: tstDllMainStub-os2.asm 2 2007-11-16 16:07:14Z bird $ +; $Id: tstDllMainStub-os2.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - OS/2 entry point thingy... ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> -; -; This file is part of kStuff. -; -; kStuff is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. -; -; kStuff is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. -; -; You should have received a copy of the GNU Lesser General Public -; License along with kStuff; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -; +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +; +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: +; +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; segment TEXT32 public CLASS=CODE align=16 use32 diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMainStub.c b/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMainStub.c index 8e5049aa6..67681c8b9 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMainStub.c +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tstDllMainStub.c @@ -1,27 +1,31 @@ -/* $Id: tstDllMainStub.c 2 2007-11-16 16:07:14Z bird $ */
+/* $Id: tstDllMainStub.c 29 2009-07-01 20:30:29Z bird $ */
/** @file
* kLdr testcase - DLL Stub.
*/
/*
- * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+ * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
*
- * This file is part of kStuff.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
*
- * kStuff is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * kStuff is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with kStuff; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
/*******************************************************************************
diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tstExeMainStub-os2.asm b/src/libs/kStuff/kStuff/kLdr/testcase/tstExeMainStub-os2.asm index 9fe127bd2..d4a8ee945 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tstExeMainStub-os2.asm +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tstExeMainStub-os2.asm @@ -1,27 +1,31 @@ -; $Id: tstExeMainStub-os2.asm 2 2007-11-16 16:07:14Z bird $ +; $Id: tstExeMainStub-os2.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kLdr - OS/2 entry point thingy... ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> -; -; This file is part of kStuff. -; -; kStuff is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. -; -; kStuff is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. -; -; You should have received a copy of the GNU Lesser General Public -; License along with kStuff; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -; +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +; +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: +; +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; segment TEXT32 public CLASS=CODE align=16 use32 diff --git a/src/libs/kStuff/kStuff/kLdr/testcase/tstExeMainStub.c b/src/libs/kStuff/kStuff/kLdr/testcase/tstExeMainStub.c index 851578ebd..9ec9f47b2 100644 --- a/src/libs/kStuff/kStuff/kLdr/testcase/tstExeMainStub.c +++ b/src/libs/kStuff/kStuff/kLdr/testcase/tstExeMainStub.c @@ -1,27 +1,31 @@ -/* $Id: tstExeMainStub.c 2 2007-11-16 16:07:14Z bird $ */
+/* $Id: tstExeMainStub.c 29 2009-07-01 20:30:29Z bird $ */
/** @file
* kLdr testcase - DLL Stub.
*/
/*
- * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+ * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
*
- * This file is part of kStuff.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
*
- * kStuff is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * kStuff is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with kStuff; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
/*******************************************************************************
diff --git a/src/libs/kStuff/kStuff/kLdr/tstkLdrHeap.c b/src/libs/kStuff/kStuff/kLdr/tstkLdrHeap.c index ed2e9659b..a5891dd1f 100644 --- a/src/libs/kStuff/kStuff/kLdr/tstkLdrHeap.c +++ b/src/libs/kStuff/kStuff/kLdr/tstkLdrHeap.c @@ -1,36 +1,33 @@ -/* $Id: tstkLdrHeap.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: tstkLdrHeap.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Heap testcase. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /******************************************************************************* * Header Files * *******************************************************************************/ diff --git a/src/libs/kStuff/kStuff/kLdr/tstkLdrMod.c b/src/libs/kStuff/kStuff/kLdr/tstkLdrMod.c index 74821820a..c49907bf3 100644 --- a/src/libs/kStuff/kStuff/kLdr/tstkLdrMod.c +++ b/src/libs/kStuff/kStuff/kLdr/tstkLdrMod.c @@ -1,33 +1,31 @@ -/* $Id: tstkLdrMod.c 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: tstkLdrMod.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * kLdr - Module interpreter testcase. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kProfiler2/Makefile.kmk b/src/libs/kStuff/kStuff/kProfiler2/Makefile.kmk index 7fc4d6120..b3650c926 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/Makefile.kmk +++ b/src/libs/kStuff/kStuff/kProfiler2/Makefile.kmk @@ -1,28 +1,32 @@ -# $Id: Makefile.kmk 13 2008-04-20 10:13:43Z bird $ +# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kProfiler Mark 2, sub-makefile. # # -# Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kProfiler. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kProfiler is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # -# kProfiler is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # -# You should have received a copy of the GNU Lesser General Public -# License along with kProfiler; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# - DEPTH ?= .. SUB_DEPTH = .. diff --git a/src/libs/kStuff/kStuff/kProfiler2/dllmain-win.cpp b/src/libs/kStuff/kStuff/kProfiler2/dllmain-win.cpp index 9c9b771e2..56928d9a1 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/dllmain-win.cpp +++ b/src/libs/kStuff/kStuff/kProfiler2/dllmain-win.cpp @@ -1,30 +1,33 @@ -/* $Id: dllmain-win.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: dllmain-win.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - The Windows DllMain for the profiler DLL. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfile. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfile is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfile is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfile; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /******************************************************************************* * Header Files * *******************************************************************************/ diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2-win-amd64.def b/src/libs/kStuff/kStuff/kProfiler2/kPrf2-win-amd64.def index 6f52c7a40..33bb8e22c 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2-win-amd64.def +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2-win-amd64.def @@ -1,28 +1,32 @@ -; $Id: kPrf2-win-amd64.def 13 2008-04-20 10:13:43Z bird $LIBRARY kPrf2 +; $Id: kPrf2-win-amd64.def 29 2009-07-01 20:30:29Z bird $LIBRARY kPrf2 ;; @file ; kProfiler Mark 2 - Windows Linker Definition File, AMD64. ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; -; This file is part of kProfiler. +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: ; -; kProfiler is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. ; -; kProfiler is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; -; You should have received a copy of the GNU Lesser General Public -; License along with kProfiler; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -; - LIBRARY kPrf2 EXPORTS diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2-win-x86.def b/src/libs/kStuff/kStuff/kProfiler2/kPrf2-win-x86.def index 650658a0d..d486a09f6 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2-win-x86.def +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2-win-x86.def @@ -1,28 +1,32 @@ -; $Id: kPrf2-win-x86.def 13 2008-04-20 10:13:43Z bird $ +; $Id: kPrf2-win-x86.def 29 2009-07-01 20:30:29Z bird $ ;; @file ; kProfiler Mark 2 - Windows Linker Definition File, x86. ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; -; This file is part of kProfiler. +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: ; -; kProfiler is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. ; -; kProfiler is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; -; You should have received a copy of the GNU Lesser General Public -; License along with kProfiler; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -; - LIBRARY kPrf2 EXPORTS diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2Read.cpp b/src/libs/kStuff/kStuff/kProfiler2/kPrf2Read.cpp index fc328db60..a73167a37 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2Read.cpp +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2Read.cpp @@ -1,30 +1,33 @@ -/* $Id: kPrf2Read.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kPrf2Read.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - The reader and producer of statistics. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /******************************************************************************* * Header Files * *******************************************************************************/ diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-dumpbin.sed b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-dumpbin.sed index 79797e99d..a9a44f245 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-dumpbin.sed +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-dumpbin.sed @@ -1,28 +1,32 @@ -# $Id: kPrf2WinApi-dumpbin.sed 13 2008-04-20 10:13:43Z bird $ +# $Id: kPrf2WinApi-dumpbin.sed 29 2009-07-01 20:30:29Z bird $ ## @file # Strip down dumpbin /export output. # # -# Copyright (c) 2008 knut st. osmundsen <bird-src-spam@anduin.net> +# Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # -# This file is part of kProfiler. -# -# kProfiler is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# kProfiler is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kProfiler; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# - # # State switch diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-gencode.sed b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-gencode.sed index d93cd007f..7d39edfef 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-gencode.sed +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-gencode.sed @@ -1,26 +1,31 @@ -# $Id: kPrf2WinApi-gencode.sed 11 2008-04-20 09:18:23Z bird $ +# $Id: kPrf2WinApi-gencode.sed 29 2009-07-01 20:30:29Z bird $ ## @file # Generate code (for kernel32). # # -# Copyright (c) 2008 knut st. osmundsen <bird-src-spam@anduin.net> +# Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kProfiler. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kProfiler is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # -# kProfiler is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kProfiler; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # # Example: diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-genimp.sed b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-genimp.sed index d8ba669d4..1473ed0ec 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-genimp.sed +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-genimp.sed @@ -1,26 +1,31 @@ -# $Id: kPrf2WinApi-genimp.sed 11 2008-04-20 09:18:23Z bird $ +# $Id: kPrf2WinApi-genimp.sed 29 2009-07-01 20:30:29Z bird $ ## # Generate imports from normalized dumpbin output. # # -# Copyright (c) 2008 knut st. osmundsen <bird-src-spam@anduin.net> +# Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kProfiler. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kProfiler is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # -# kProfiler is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kProfiler; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # # Normalize the input a bit. diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-pre.sed b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-pre.sed index 887ea4788..de90156b6 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-pre.sed +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApi-pre.sed @@ -1,27 +1,32 @@ -# $Id: kPrf2WinApi-pre.sed 13 2008-04-20 10:13:43Z bird $ +# $Id: kPrf2WinApi-pre.sed 29 2009-07-01 20:30:29Z bird $ ## @file # This SED script will try normalize a windows header # in order to make it easy to pick out function prototypes. # # -# Copyright (c) 2008 knut st. osmundsen <bird-src-spam@anduin.net> +# Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> # -# This file is part of kProfiler. +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: # -# kProfiler is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # -# kProfiler is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with kProfiler; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.c b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.c index 7810e01ba..0788cdf5f 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.c +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.c @@ -1,25 +1,31 @@ -/* $Id: kPrf2WinApiWrapperHlp.c 13 2008-04-20 10:13:43Z bird $ */ +/* $Id: kPrf2WinApiWrapperHlp.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * Helpers for the Windows API wrapper DLL. */ /* - * Copyright (c) 2008 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with This program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.h b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.h index c88ea7fc8..b75d3030d 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.h @@ -1,25 +1,31 @@ -/* $Id: kPrf2WinApiWrapperHlp.h 13 2008-04-20 10:13:43Z bird $ */ +/* $Id: kPrf2WinApiWrapperHlp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * Helpers for the Windows API wrapper DLL. */ /* - * Copyright (c) 2008 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with This program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ typedef struct KPRF2WRAPDLL diff --git a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrappers.c b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrappers.c index 88a0945bb..ecb31f078 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrappers.c +++ b/src/libs/kStuff/kStuff/kProfiler2/kPrf2WinApiWrappers.c @@ -1,25 +1,31 @@ -/* $Id: kPrf2WinApiWrappers.c 13 2008-04-20 10:13:43Z bird $ */ +/* $Id: kPrf2WinApiWrappers.c 29 2009-07-01 20:30:29Z bird $ */ /** @file * Wrappers for a number of common Windows APIs. */ /* - * Copyright (c) 2008 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with This program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kProfiler2/kProfileR3.cpp b/src/libs/kStuff/kStuff/kProfiler2/kProfileR3.cpp index c9f02b1b6..9e19ee65a 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kProfileR3.cpp +++ b/src/libs/kStuff/kStuff/kProfiler2/kProfileR3.cpp @@ -1,30 +1,33 @@ -/* $Id: kProfileR3.cpp 9 2008-04-20 03:47:01Z bird $ */ +/* $Id: kProfileR3.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - The Ring-3 Implementation. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ - /******************************************************************************* * Header Files * *******************************************************************************/ diff --git a/src/libs/kStuff/kStuff/kProfiler2/kProfileR3.h b/src/libs/kStuff/kStuff/kProfiler2/kProfileR3.h index 60664e071..87938c9ab 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/kProfileR3.h +++ b/src/libs/kStuff/kStuff/kProfiler2/kProfileR3.h @@ -1,27 +1,31 @@ -/* $Id: kProfileR3.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kProfileR3.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Internal header, Ring-3. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kProfileR3_h___ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfamd64msc.asm b/src/libs/kStuff/kStuff/kProfiler2/prfamd64msc.asm index 7df9e9bd9..87079e273 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfamd64msc.asm +++ b/src/libs/kStuff/kStuff/kProfiler2/prfamd64msc.asm @@ -1,28 +1,32 @@ -; $Id: prfamd64msc.asm 14 2008-04-21 00:03:13Z bird $; +; $Id: prfamd64msc.asm 29 2009-07-01 20:30:29Z bird $; ;; @file ; kProfiler Mark 2 - Microsoft C/C++ Compiler Interaction, AMD64. ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; -; This file is part of kProfiler. +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: ; -; kProfiler is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. ; -; kProfiler is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; -; You should have received a copy of the GNU Lesser General Public -; License along with kProfiler; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -; - [section .data] ; diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfcore.cpp.h b/src/libs/kStuff/kStuff/kProfiler2/prfcore.cpp.h index 0b02be414..ac19eb7df 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfcore.cpp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfcore.cpp.h @@ -1,27 +1,31 @@ -/* $Id: prfcore.cpp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: prfcore.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Code Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfcore.h.h b/src/libs/kStuff/kStuff/kProfiler2/prfcore.h.h index 7ffa2ffb9..d4413d102 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfcore.h.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfcore.h.h @@ -1,27 +1,31 @@ -/* $Id: prfcore.h.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: prfcore.h.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Header Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfcorefunction.cpp.h b/src/libs/kStuff/kStuff/kProfiler2/prfcorefunction.cpp.h index 42079be00..686b45203 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfcorefunction.cpp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfcorefunction.cpp.h @@ -1,27 +1,31 @@ -/* $Id: prfcorefunction.cpp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: prfcorefunction.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core NewFunction Code Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfcoreinit.cpp.h b/src/libs/kStuff/kStuff/kProfiler2/prfcoreinit.cpp.h index 6ca9e45b8..5a94f46a5 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfcoreinit.cpp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfcoreinit.cpp.h @@ -1,27 +1,31 @@ -/* $Id: prfcoreinit.cpp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: prfcoreinit.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Initialization Code Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfcoremodseg.cpp.h b/src/libs/kStuff/kStuff/kProfiler2/prfcoremodseg.cpp.h index a1d94df3a..32c6e24b8 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfcoremodseg.cpp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfcoremodseg.cpp.h @@ -1,27 +1,31 @@ -/* $Id: prfcoremodseg.cpp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: prfcoremodseg.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Module Segment Code Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfcorepost.cpp.h b/src/libs/kStuff/kStuff/kProfiler2/prfcorepost.cpp.h index 453f58e25..84ea2b0ce 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfcorepost.cpp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfcorepost.cpp.h @@ -1,27 +1,31 @@ -/* $Id: prfcorepost.cpp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: prfcorepost.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Post-Code Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfcorepre.cpp.h b/src/libs/kStuff/kStuff/kProfiler2/prfcorepre.cpp.h index 1fe5d9c85..50f6b6a52 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfcorepre.cpp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfcorepre.cpp.h @@ -1,27 +1,31 @@ -/* $Id: prfcorepre.cpp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: prfcorepre.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Pre-Code Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfcorereloc.cpp.h b/src/libs/kStuff/kStuff/kProfiler2/prfcorereloc.cpp.h index e9be4dbd0..c7fc66707 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfcorereloc.cpp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfcorereloc.cpp.h @@ -1,27 +1,31 @@ -/* $Id: prfcorereloc.cpp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: prfcorereloc.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core SetBasePtr Code Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfcoreterm.cpp.h b/src/libs/kStuff/kStuff/kProfiler2/prfcoreterm.cpp.h index 28f506052..561fcdffa 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfcoreterm.cpp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfcoreterm.cpp.h @@ -1,27 +1,31 @@ -/* $Id: prfcoreterm.cpp.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: prfcoreterm.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Core Termination Code Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfreader.cpp.h b/src/libs/kStuff/kStuff/kProfiler2/prfreader.cpp.h index acd7ec31d..302b04954 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfreader.cpp.h +++ b/src/libs/kStuff/kStuff/kProfiler2/prfreader.cpp.h @@ -1,27 +1,31 @@ -/* $Id: prfreader.cpp.h 10 2008-04-20 04:06:12Z bird $ */ +/* $Id: prfreader.cpp.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kProfiler Mark 2 - Reader Code Template. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kProfiler. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kProfiler is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * kProfiler is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kProfiler; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ diff --git a/src/libs/kStuff/kStuff/kProfiler2/prfx86msc.asm b/src/libs/kStuff/kStuff/kProfiler2/prfx86msc.asm index d3aeb05ee..c7339583c 100644 --- a/src/libs/kStuff/kStuff/kProfiler2/prfx86msc.asm +++ b/src/libs/kStuff/kStuff/kProfiler2/prfx86msc.asm @@ -1,28 +1,32 @@ -; $Id: prfx86msc.asm 2 2007-11-16 16:07:14Z bird $ +; $Id: prfx86msc.asm 29 2009-07-01 20:30:29Z bird $ ;; @file ; kProfiler Mark 2 - Microsoft C/C++ Compiler Interaction, x86. ; ; -; Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> ; -; This file is part of kProfiler. +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: ; -; kProfiler is free software; you can redistribute it and/or -; modify it under the terms of the GNU Lesser General Public -; License as published by the Free Software Foundation; either -; version 2.1 of the License, or (at your option) any later version. +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. ; -; kProfiler is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -; Lesser General Public License for more details. +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. ; -; You should have received a copy of the GNU Lesser General Public -; License along with kProfiler; if not, write to the Free Software -; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -; - [section .data] ; diff --git a/src/libs/kStuff/kStuff/kRdr/Makefile.kmk b/src/libs/kStuff/kStuff/kRdr/Makefile.kmk index 4d5c1bb60..357acf60e 100644 --- a/src/libs/kStuff/kStuff/kRdr/Makefile.kmk +++ b/src/libs/kStuff/kStuff/kRdr/Makefile.kmk @@ -1,27 +1,31 @@ -# $Id: Makefile.kmk 5 2008-02-03 20:56:09Z bird $ +# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ ## @file # kRdr - The File Provider, sub-makefile. # # -# Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net> -# -# This file is part of kStuff. -# -# kStuff is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# kStuff is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with kStuff; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. # DEPTH ?= .. diff --git a/src/libs/kStuff/kStuff/kRdr/kRdr.cpp b/src/libs/kStuff/kStuff/kRdr/kRdr.cpp index c8fde8655..5952cb1b5 100644 --- a/src/libs/kStuff/kStuff/kRdr/kRdr.cpp +++ b/src/libs/kStuff/kStuff/kRdr/kRdr.cpp @@ -1,36 +1,33 @@ -/* $Id: kRdr.cpp 2 2007-11-16 16:07:14Z bird $ */
+/* $Id: kRdr.cpp 29 2009-07-01 20:30:29Z bird $ */
/** @file
* kRdr - The File Provider.
*/
/*
- * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+ * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
*
- * This file is part of kStuff.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
*
- * kStuff is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
- * In addition to the permissions in the GNU Lesser General Public
- * License, you are granted unlimited permission to link the compiled
- * version of this file into combinations with other programs, and to
- * distribute those combinations without any restriction coming from
- * the use of this file.
- *
- * kStuff is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with kStuff; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
-
/*******************************************************************************
* Header Files *
*******************************************************************************/
diff --git a/src/libs/kStuff/kStuff/kRdr/kRdrBuffered.cpp b/src/libs/kStuff/kStuff/kRdr/kRdrBuffered.cpp index 9a494dad6..30a216312 100644 --- a/src/libs/kStuff/kStuff/kRdr/kRdrBuffered.cpp +++ b/src/libs/kStuff/kStuff/kRdr/kRdrBuffered.cpp @@ -1,33 +1,31 @@ -/* $Id: kRdrBuffered.cpp 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kRdrBuffered.cpp 29 2009-07-01 20:30:29Z bird $ */ /** @file * kRdrBuffered - Buffered File Provider. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /******************************************************************************* diff --git a/src/libs/kStuff/kStuff/kRdr/kRdrFile.cpp b/src/libs/kStuff/kStuff/kRdr/kRdrFile.cpp index e8f90dee8..16c2b1320 100644 --- a/src/libs/kStuff/kStuff/kRdr/kRdrFile.cpp +++ b/src/libs/kStuff/kStuff/kRdr/kRdrFile.cpp @@ -1,33 +1,31 @@ -/* $Id: kRdrFile.cpp 2 2007-11-16 16:07:14Z bird $ */
+/* $Id: kRdrFile.cpp 29 2009-07-01 20:30:29Z bird $ */
/** @file
* kRdrFile - The Native File Provider
*/
/*
- * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
+ * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net>
*
- * This file is part of kStuff.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
*
- * kStuff is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
- * In addition to the permissions in the GNU Lesser General Public
- * License, you are granted unlimited permission to link the compiled
- * version of this file into combinations with other programs, and to
- * distribute those combinations without any restriction coming from
- * the use of this file.
- *
- * kStuff is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with kStuff; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
/*******************************************************************************
diff --git a/src/libs/kStuff/kStuff/kRdr/kRdrInternal.h b/src/libs/kStuff/kStuff/kRdr/kRdrInternal.h index 1240b284d..d8f67dbab 100644 --- a/src/libs/kStuff/kStuff/kRdr/kRdrInternal.h +++ b/src/libs/kStuff/kStuff/kRdr/kRdrInternal.h @@ -1,33 +1,31 @@ -/* $Id: kRdrInternal.h 2 2007-11-16 16:07:14Z bird $ */ +/* $Id: kRdrInternal.h 29 2009-07-01 20:30:29Z bird $ */ /** @file * kRdr - Internal Header. */ /* - * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net> + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> * - * This file is part of kStuff. + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: * - * kStuff is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. * - * In addition to the permissions in the GNU Lesser General Public - * License, you are granted unlimited permission to link the compiled - * version of this file into combinations with other programs, and to - * distribute those combinations without any restriction coming from - * the use of this file. - * - * kStuff is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with kStuff; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ___kRdrInternal_h___ diff --git a/src/libs/liblzf-1.51/Makefile.kmk b/src/libs/liblzf-1.51/Makefile.kmk index d5bebba61..ab7d7b98d 100644 --- a/src/libs/liblzf-1.51/Makefile.kmk +++ b/src/libs/liblzf-1.51/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 12196 2008-09-08 02:23:00Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for liblzf. # diff --git a/src/libs/liblzf-1.51/configure b/src/libs/liblzf-1.51/configure index f329662ef..f329662ef 100644..100755 --- a/src/libs/liblzf-1.51/configure +++ b/src/libs/liblzf-1.51/configure diff --git a/src/libs/liblzf-1.51/install-sh b/src/libs/liblzf-1.51/install-sh index e9de23842..e9de23842 100644..100755 --- a/src/libs/liblzf-1.51/install-sh +++ b/src/libs/liblzf-1.51/install-sh diff --git a/src/libs/liblzf-3.4/Makefile.kmk b/src/libs/liblzf-3.4/Makefile.kmk index 36156b8a9..fb720ac28 100644 --- a/src/libs/liblzf-3.4/Makefile.kmk +++ b/src/libs/liblzf-3.4/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 17027 2009-02-23 16:10:06Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for liblzf. # diff --git a/src/libs/xpcom18a4/Makefile.kmk b/src/libs/xpcom18a4/Makefile.kmk index e1a6cae8c..14c361bbc 100644 --- a/src/libs/xpcom18a4/Makefile.kmk +++ b/src/libs/xpcom18a4/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20940 2009-06-25 13:44:58Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for XPCOM. # diff --git a/src/libs/xpcom18a4/nsprpub/Makefile.in b/src/libs/xpcom18a4/nsprpub/Makefile.in index 9273b16db..9273b16db 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/Makefile.in +++ b/src/libs/xpcom18a4/nsprpub/Makefile.in diff --git a/src/libs/xpcom18a4/nsprpub/admin/explode.pl b/src/libs/xpcom18a4/nsprpub/admin/explode.pl index 881f21b9b..881f21b9b 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/admin/explode.pl +++ b/src/libs/xpcom18a4/nsprpub/admin/explode.pl diff --git a/src/libs/xpcom18a4/nsprpub/admin/makeTargetDirs.sh b/src/libs/xpcom18a4/nsprpub/admin/makeTargetDirs.sh index 4250ce4a0..4250ce4a0 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/admin/makeTargetDirs.sh +++ b/src/libs/xpcom18a4/nsprpub/admin/makeTargetDirs.sh diff --git a/src/libs/xpcom18a4/nsprpub/admin/repackage.sh b/src/libs/xpcom18a4/nsprpub/admin/repackage.sh index 37ba0e163..37ba0e163 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/admin/repackage.sh +++ b/src/libs/xpcom18a4/nsprpub/admin/repackage.sh diff --git a/src/libs/xpcom18a4/nsprpub/admin/symlinks.sh b/src/libs/xpcom18a4/nsprpub/admin/symlinks.sh index f90582e2d..f90582e2d 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/admin/symlinks.sh +++ b/src/libs/xpcom18a4/nsprpub/admin/symlinks.sh diff --git a/src/libs/xpcom18a4/nsprpub/config/Makefile.in b/src/libs/xpcom18a4/nsprpub/config/Makefile.in index 1b83ffa56..1b83ffa56 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/config/Makefile.in +++ b/src/libs/xpcom18a4/nsprpub/config/Makefile.in diff --git a/src/libs/xpcom18a4/nsprpub/config/config.mk b/src/libs/xpcom18a4/nsprpub/config/config.mk index 697a6015d..697a6015d 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/config/config.mk +++ b/src/libs/xpcom18a4/nsprpub/config/config.mk diff --git a/src/libs/xpcom18a4/nsprpub/config/nfspwd.pl b/src/libs/xpcom18a4/nsprpub/config/nfspwd.pl index 947b822ae..947b822ae 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/config/nfspwd.pl +++ b/src/libs/xpcom18a4/nsprpub/config/nfspwd.pl diff --git a/src/libs/xpcom18a4/nsprpub/config/nspr-config.in b/src/libs/xpcom18a4/nsprpub/config/nspr-config.in index e9e186791..e9e186791 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/config/nspr-config.in +++ b/src/libs/xpcom18a4/nsprpub/config/nspr-config.in diff --git a/src/libs/xpcom18a4/nsprpub/config/rules.mk b/src/libs/xpcom18a4/nsprpub/config/rules.mk index bba50ee75..bba50ee75 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/config/rules.mk +++ b/src/libs/xpcom18a4/nsprpub/config/rules.mk diff --git a/src/libs/xpcom18a4/nsprpub/configure b/src/libs/xpcom18a4/nsprpub/configure index 2046d79f6..2046d79f6 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/configure +++ b/src/libs/xpcom18a4/nsprpub/configure diff --git a/src/libs/xpcom18a4/nsprpub/pkg/linux/Makefile.in b/src/libs/xpcom18a4/nsprpub/pkg/linux/Makefile.in index 09edb474b..630af186b 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/linux/Makefile.in +++ b/src/libs/xpcom18a4/nsprpub/pkg/linux/Makefile.in @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: Makefile.in 1 vboxsync $" +#ident "$Id: Makefile.in $" # MOD_DEPTH = ../.. diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.com b/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.com index 511e5913b..32de8a9ba 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.com +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.com @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: Makefile.com 1 vboxsync $" +#ident "$Id: Makefile.com $" # MACH = $(shell mach) diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.in b/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.in index 53ac721f5..0c2d2e317 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.in +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.in @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: Makefile.in 1 vboxsync $" +#ident "$Id: Makefile.in $" # MOD_DEPTH = ../.. diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.targ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.targ index b5ea1586b..9c49cf206 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.targ +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/Makefile.targ @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: Makefile.targ 1 vboxsync $" +#ident "$Id: Makefile.targ $" # pkginfo: pkginfo.tmpl ../awk_pkginfo diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/Makefile.in b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/Makefile.in index 66885f029..ab54db6fb 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/Makefile.in +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/Makefile.in @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: Makefile.in 1 vboxsync $" +#ident "$Id: Makefile.in $" # MOD_DEPTH = ../../.. diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/depend b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/depend index 47748f629..57bc554e3 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/depend +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/depend @@ -1,7 +1,7 @@ # Copyright 2002 Microsystems, Inc. All Rights Reserved. # Use is subject to license terms. # -# $Id: depend 1 vboxsync $ +# $Id: depend $ # # This package information file defines software dependencies associated # with the pkg. You can define three types of pkg dependencies with this file: diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/pkginfo.tmpl b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/pkginfo.tmpl index d387aa5dc..431ef37a0 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/pkginfo.tmpl +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/pkginfo.tmpl @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: pkginfo.tmpl 1 vboxsync $" +#ident "$Id: pkginfo.tmpl $" # # # This required package information file describes characteristics of the diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_com b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_com index d7c4366ca..e92c4e513 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_com +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_com @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: prototype_com 1 vboxsync $" +#ident "$Id: prototype_com $" # # This required package information file contains a list of package contents. # The 'pkgmk' command uses this file to identify the contents of a package diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_i386 b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_i386 index 652e25a1f..76b920168 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_i386 +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_i386 @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: prototype_i386 1 vboxsync $" +#ident "$Id: prototype_i386 $" # # This required package information file contains a list of package contents. # The 'pkgmk' command uses this file to identify the contents of a package diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_sparc b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_sparc index ae0a7032e..4da58b010 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_sparc +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWpr/prototype_sparc @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: prototype_sparc 1 vboxsync $" +#ident "$Id: prototype_sparc $" # # This required package information file contains a list of package contents. # The 'pkgmk' command uses this file to identify the contents of a package diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/Makefile.in b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/Makefile.in index 66885f029..ab54db6fb 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/Makefile.in +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/Makefile.in @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: Makefile.in 1 vboxsync $" +#ident "$Id: Makefile.in $" # MOD_DEPTH = ../../.. diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/depend b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/depend index 027675ef6..5be1ecd98 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/depend +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/depend @@ -1,7 +1,7 @@ # Copyright 2002 Microsystems, Inc. All Rights Reserved. # Use is subject to license terms. # -# $Id: depend 1 vboxsync $ +# $Id: depend $ # # This package information file defines software dependencies associated # with the pkg. You can define three types of pkg dependencies with this file: diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/pkginfo.tmpl b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/pkginfo.tmpl index f7504a307..0b13c5be4 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/pkginfo.tmpl +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/pkginfo.tmpl @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: pkginfo.tmpl 1 vboxsync $" +#ident "$Id: pkginfo.tmpl $" # # # This required package information file describes characteristics of the diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/prototype_com b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/prototype_com index ac92436fd..700d61ca9 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/prototype_com +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/prototype_com @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: prototype_com 1 vboxsync $" +#ident "$Id: prototype_com $" # # This required package information file contains a list of package contents. # The 'pkgmk' command uses this file to identify the contents of a package diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/prototype_sparc b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/prototype_sparc index 26e6d7d70..cd3da1210 100644 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/prototype_sparc +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/SUNWprx/prototype_sparc @@ -2,7 +2,7 @@ # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "$Id: prototype_sparc 1 vboxsync $" +#ident "$Id: prototype_sparc $" # # This required package information file contains a list of package contents. # The 'pkgmk' command uses this file to identify the contents of a package diff --git a/src/libs/xpcom18a4/nsprpub/pkg/solaris/bld_awk_pkginfo.ksh b/src/libs/xpcom18a4/nsprpub/pkg/solaris/bld_awk_pkginfo.ksh index 80d6fab36..b01645e47 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/pkg/solaris/bld_awk_pkginfo.ksh +++ b/src/libs/xpcom18a4/nsprpub/pkg/solaris/bld_awk_pkginfo.ksh @@ -1,6 +1,6 @@ #!/usr/bin/ksh -p # -#ident "$Id: bld_awk_pkginfo.ksh 1 vboxsync $" +#ident "$Id: bld_awk_pkginfo.ksh $" # # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. diff --git a/src/libs/xpcom18a4/nsprpub/pr/include/md/_iprt_atomic.h b/src/libs/xpcom18a4/nsprpub/pr/include/md/_iprt_atomic.h index 36731b0c2..66c1e44ad 100644 --- a/src/libs/xpcom18a4/nsprpub/pr/include/md/_iprt_atomic.h +++ b/src/libs/xpcom18a4/nsprpub/pr/include/md/_iprt_atomic.h @@ -1,4 +1,4 @@ -/* $Id: _iprt_atomic.h 16772 2009-02-14 21:33:20Z vboxsync $ */ +/* $Id: _iprt_atomic.h $ */ /** @file * IPRT Atomic Operation, for including into a system config header. */ diff --git a/src/libs/xpcom18a4/nsprpub/pr/src/misc/compile-et.pl b/src/libs/xpcom18a4/nsprpub/pr/src/misc/compile-et.pl index 9f0d90bc1..9f0d90bc1 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/pr/src/misc/compile-et.pl +++ b/src/libs/xpcom18a4/nsprpub/pr/src/misc/compile-et.pl diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/runtests.ksh b/src/libs/xpcom18a4/nsprpub/pr/tests/runtests.ksh index 3af86d394..3af86d394 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/pr/tests/runtests.ksh +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/runtests.ksh diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/runtests.sh b/src/libs/xpcom18a4/nsprpub/pr/tests/runtests.sh index bb4a65eba..bb4a65eba 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/pr/tests/runtests.sh +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/runtests.sh diff --git a/src/libs/xpcom18a4/nsprpub/pr/tests/runy2ktests.ksh b/src/libs/xpcom18a4/nsprpub/pr/tests/runy2ktests.ksh index e7a325019..e7a325019 100644..100755 --- a/src/libs/xpcom18a4/nsprpub/pr/tests/runy2ktests.ksh +++ b/src/libs/xpcom18a4/nsprpub/pr/tests/runy2ktests.ksh diff --git a/src/libs/xpcom18a4/python/Makefile.kmk b/src/libs/xpcom18a4/python/Makefile.kmk index afa04d6f0..c02390106 100644 --- a/src/libs/xpcom18a4/python/Makefile.kmk +++ b/src/libs/xpcom18a4/python/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 20972 2009-06-26 13:47:31Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for Python bindings # @@ -23,7 +23,7 @@ SUB_DEPTH = ../../../.. include $(KBUILD_PATH)/subheader.kmk # list of supported Python versions -$(eval $(patsubst %|,%$(NL),$(shell $(VBOX_BLD_PYTHON) $(PATH_SUB_CURRENT)/gen_python_deps.py))) +$(eval $(patsubst %|,%$(NL),$(shell $(VBOX_BLD_PYTHON) $(PATH_SUB_CURRENT)/gen_python_deps.py $(KBUILD_TARGET) $(KBUILD_TARGET_ARCH)))) # Python Client Module - the C++/XPCOM bits. VBoxPythonBase_TEMPLATE = XPCOM @@ -115,7 +115,11 @@ endif VBoxPython26_EXTENDS = VBoxPythonBase VBoxPython26_EXTENDS_BY = appending VBoxPython26_NAME = VBoxPython2_6 -VBoxPython26_TEMPLATE = XPCOM +if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "darwin.x86" + VBoxPython26_TEMPLATE = XPCOMOSX105 +else + VBoxPython26_TEMPLATE = XPCOM +endif VBoxPython26_DEFS = VBOX_PYXPCOM_VERSIONED VBoxPython26_INCS = $(VBOX_PYTHON26_INC) diff --git a/src/libs/xpcom18a4/python/gen_python_deps.py b/src/libs/xpcom18a4/python/gen_python_deps.py index 42397a931..5aca475b5 100755 --- a/src/libs/xpcom18a4/python/gen_python_deps.py +++ b/src/libs/xpcom18a4/python/gen_python_deps.py @@ -22,25 +22,65 @@ versions = ["2.3", "2.4", "2.5", "2.6", "2.7", "2.8"] prefixes = ["/usr", "/usr/local", "/opt", "/opt/local"] known = {} -def checkPair(p,v,dllpre,dllsuff): +def checkPair(p, v,dllpre,dllsuff, bitness_magic): file = os.path.join(p, "include", "python"+v, "Python.h") - # or just stat()? if not os.path.isfile(file): return None + + lib = os.path.join(p, "lib", dllpre+"python"+v+dllsuff) + + if bitness_magic == 1: + lib64 = os.path.join(p, "lib", "64", dllpre+"python"+v+dllsuff) + elif bitness_magic == 2: + lib64 = os.path.join(p, "lib64", dllpre+"python"+v+dllsuff) + if not os.path.isfile(lib64): + lib64 = lib + else: + lib64 = None return [os.path.join(p, "include", "python"+v), - os.path.join(p, "lib", dllpre+"python"+v+dllsuff)] + lib, + lib64] + +def print_vars(vers, known, sep, bitness_magic): + print "VBOX_PYTHON%s_INC=%s%s" %(vers, known[0], sep) + if bitness_magic > 0: + print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[2], sep) + else: + print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[1], sep) + def main(argv): dllpre = "lib" dllsuff = ".so" - if sys.platform == 'darwin': + bitness_magic = 0 + + if len(argv) > 1: + target = argv[1] + else: + target = sys.platform + + if len(argv) > 2: + arch = argv[2] + else: + arch = "unknown" + + if target == 'darwin': prefixes.insert(0, '/Developer/SDKs/MacOSX10.4u.sdk/usr') prefixes.insert(0, '/Developer/SDKs/MacOSX10.5.sdk/usr') + # Python 2.3 on Darwin buildbox is bad + # /Developer/SDKs/MacOSX10.4u.sdk/usr/include/python2.3/pyport.h:554:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?). + versions.remove("2.3") dllsuff = '.dylib' - + + if target == 'solaris' and arch == 'amd64': + bitness_magic = 1 + + if target == 'linux' and arch == 'amd64': + bitness_magic = 2 + for v in versions: for p in prefixes: - c = checkPair(p, v, dllpre, dllsuff) + c = checkPair(p, v, dllpre, dllsuff, bitness_magic) if c is not None: known[v] = c break @@ -54,11 +94,9 @@ def main(argv): if d is None: d = k vers = k.replace('.', '') - print "VBOX_PYTHON%s_INC=%s%s" %(vers, known[k][0], sep) - print "VBOX_PYTHON%s_LIB=%s%s" %(vers, known[k][1], sep) + print_vars(vers, known[k], sep, bitness_magic) if d is not None: - print "VBOX_PYTHONDEF_INC=%s%s" %(known[d][0], sep) - print "VBOX_PYTHONDEF_LIB=%s%s" %(known[d][1], sep) + print_vars("DEF", known[d], sep, bitness_magic) if __name__ == '__main__': main(sys.argv) diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/genstubs.pl b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/genstubs.pl index b8962930d..b8962930d 100644..100755 --- a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/genstubs.pl +++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/genstubs.pl diff --git a/src/libs/xpcom18a4/xpcom/tools/analyze-xpcom-log.pl b/src/libs/xpcom18a4/xpcom/tools/analyze-xpcom-log.pl index 81ccb2123..81ccb2123 100644..100755 --- a/src/libs/xpcom18a4/xpcom/tools/analyze-xpcom-log.pl +++ b/src/libs/xpcom18a4/xpcom/tools/analyze-xpcom-log.pl diff --git a/src/recompiler/Makefile.kmk b/src/recompiler/Makefile.kmk index 394baf284..989de6080 100644 --- a/src/recompiler/Makefile.kmk +++ b/src/recompiler/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 19297 2009-05-01 17:03:40Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # The Recompiler Sub-Makefile. # diff --git a/src/recompiler/Sun/config-host.h b/src/recompiler/Sun/config-host.h index 693cb2dbe..d58c05375 100644 --- a/src/recompiler/Sun/config-host.h +++ b/src/recompiler/Sun/config-host.h @@ -1,4 +1,4 @@ -/* $Id: config-host.h 13731 2008-11-01 19:39:12Z vboxsync $ */ +/* $Id: config-host.h $ */ /** @file * Sun host config - maintained by hand */ diff --git a/src/recompiler/Sun/config.h b/src/recompiler/Sun/config.h index f80c7657f..d4cc3d490 100644 --- a/src/recompiler/Sun/config.h +++ b/src/recompiler/Sun/config.h @@ -1,4 +1,4 @@ -/* $Id: config.h 15278 2008-12-10 19:22:20Z vboxsync $ */ +/* $Id: config.h $ */ /** @file * Sun config - Maintained by hand */ diff --git a/src/recompiler/Sun/crt/stdio.h b/src/recompiler/Sun/crt/stdio.h index 286fbfd08..d64414b3f 100644 --- a/src/recompiler/Sun/crt/stdio.h +++ b/src/recompiler/Sun/crt/stdio.h @@ -1,4 +1,4 @@ -/* $Id: stdio.h 20374 2009-06-08 00:43:21Z vboxsync $ */ +/* $Id: stdio.h $ */ /** @file * Our minimal stdio */ diff --git a/src/recompiler/Sun/deftoimp.sed b/src/recompiler/Sun/deftoimp.sed index aa0d7bd32..51b5850d1 100644 --- a/src/recompiler/Sun/deftoimp.sed +++ b/src/recompiler/Sun/deftoimp.sed @@ -1,4 +1,4 @@ -# $Id: deftoimp.sed 8155 2008-04-18 15:16:47Z vboxsync $ +# $Id: deftoimp.sed $ ## @file # SED script for generating a dummy .so from a windows .def file. # diff --git a/src/recompiler/Sun/testmath.c b/src/recompiler/Sun/testmath.c index d629638fb..1e7f09f0f 100644 --- a/src/recompiler/Sun/testmath.c +++ b/src/recompiler/Sun/testmath.c @@ -1,4 +1,4 @@ -/* $Id: testmath.c 18083 2009-03-19 09:16:55Z vboxsync $ */ +/* $Id: testmath.c $ */ /** @file * Testcase for the no-crt math stuff. */ diff --git a/src/recompiler/VBoxREM.def b/src/recompiler/VBoxREM.def index b4b9ce97d..7b8e9aad7 100644 --- a/src/recompiler/VBoxREM.def +++ b/src/recompiler/VBoxREM.def @@ -1,4 +1,4 @@ -; $Id: VBoxREM.def 20406 2009-06-08 13:39:32Z vboxsync $ +; $Id: VBoxREM.def $ ;; @file ; VBoxREM Definition File. ; diff --git a/src/recompiler/VBoxREMWrapper.cpp b/src/recompiler/VBoxREMWrapper.cpp index be28a20bc..c36c23a5a 100644 --- a/src/recompiler/VBoxREMWrapper.cpp +++ b/src/recompiler/VBoxREMWrapper.cpp @@ -1,4 +1,4 @@ -/* $Id: VBoxREMWrapper.cpp 20426 2009-06-09 11:21:44Z vboxsync $ */ +/* $Id: VBoxREMWrapper.cpp $ */ /** @file * * VBoxREM Win64 DLL Wrapper. diff --git a/src/recompiler/VBoxREMWrapperA.asm b/src/recompiler/VBoxREMWrapperA.asm index 14017124c..dfac41463 100644 --- a/src/recompiler/VBoxREMWrapperA.asm +++ b/src/recompiler/VBoxREMWrapperA.asm @@ -1,4 +1,4 @@ -; $Id: VBoxREMWrapperA.asm 17042 2009-02-23 23:10:37Z vboxsync $ +; $Id: VBoxREMWrapperA.asm $ ;; @file ; VBoxREM Wrapper, Assembly routines and wrapper Templates. ; diff --git a/src/recompiler/VBoxRecompiler.c b/src/recompiler/VBoxRecompiler.c index 624463623..0ad84fb6e 100644 --- a/src/recompiler/VBoxRecompiler.c +++ b/src/recompiler/VBoxRecompiler.c @@ -1,4 +1,4 @@ -/* $Id: VBoxRecompiler.c 20867 2009-06-24 00:09:39Z vboxsync $ */ +/* $Id: VBoxRecompiler.c $ */ /** @file * VBox Recompiler - QEMU. */ @@ -2726,7 +2726,7 @@ REMR3DECL(void) REMR3ReplayHandlerNotifications(PVM pVM) VM_ASSERT_EMT(pVM); /** @todo this isn't ensuring correct replay order. */ - if (VM_FF_TESTANDCLEAR(pVM, VM_FF_REM_HANDLER_NOTIFY_BIT)) + if (VM_FF_TESTANDCLEAR(pVM, VM_FF_REM_HANDLER_NOTIFY)) { uint32_t idxNext; uint32_t idxRevHead; diff --git a/src/testcase/Makefile.kmk b/src/testcase/Makefile.kmk index f8fc9c4d6..c75a9d526 100644 --- a/src/testcase/Makefile.kmk +++ b/src/testcase/Makefile.kmk @@ -1,4 +1,4 @@ -# $Id: Makefile.kmk 11805 2008-08-29 10:17:27Z vboxsync $ +# $Id: Makefile.kmk $ ## @file # Sub-Makefile for misc testcases. # diff --git a/src/testcase/tstRunTestcases.cpp b/src/testcase/tstRunTestcases.cpp index 9e7805c5f..0013d5a97 100644 --- a/src/testcase/tstRunTestcases.cpp +++ b/src/testcase/tstRunTestcases.cpp @@ -1,4 +1,4 @@ -/* $Id: tstRunTestcases.cpp 20669 2009-06-17 13:57:45Z vboxsync $ */ +/* $Id: tstRunTestcases.cpp $ */ /** @file * tstRunTescases - Driver program for running VBox testcase (tst* testcase/tst*). */ |
