KBUILD_VERBOSE =\r
\r
all:\r
- @echo "*** Building 'vboxguest' module ***"\r
+ @echo "=== Building 'vboxguest' module ==="\r
@$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxguest\r
@if [ -f vboxguest/vboxguest.ko ]; then \\r
cp vboxguest/vboxguest.ko .; \\r
if [ -f vboxguest/Module.symvers ]; then \\r
cp vboxguest/Module.symvers vboxsf; \\r
fi; \\r
- echo "*** Building 'vboxsf' module ***"; \\r
- $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf; \\r
+ echo "=== Building 'vboxsf' module ==="; \\r
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxsf || exit 1; \\r
if [ -f vboxsf/vboxsf.ko ]; then \\r
cp vboxsf/vboxsf.ko .; \\r
else \\r
if [ -f vboxguest/Module.symvers ]; then \\r
cp vboxguest/Module.symvers vboxvideo; \\r
fi; \\r
- echo "*** Building 'vboxvideo' module ***"; \\r
- $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo; \\r
+ echo "=== Building 'vboxvideo' module ==="; \\r
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxvideo || \\r
+ (echo; echo "Building of vboxvideo failed, ignoring!"; echo); \\r
if [ -f vboxvideo/vboxvideo.ko ]; then \\r
cp vboxvideo/vboxvideo.ko .; \\r
- else \\r
+ elif [ -f vboxvideo/vboxvideo.o ]; then \\r
cp vboxvideo/vboxvideo.o .; \\r
fi; \\r
echo; \\r
-# $Revision: 107348 $
+# $Revision: 114568 $
## @file
# VirtualBox Guest Additions Module Makefile.
#
common/err/RTErrConvertFromErrno.o \
common/err/RTErrConvertToErrno.o \
common/log/log.o \
- common/log/logellipsis.o \
- common/log/logrel.o \
- common/log/logrelellipsis.o \
- common/log/logcom.o \
+ common/log/logellipsis.o \
+ common/log/logrel.o \
+ common/log/logrelellipsis.o \
+ common/log/logcom.o \
common/log/logformat.o \
common/misc/RTAssertMsg1Weak.o \
common/misc/RTAssertMsg2.o \
common/table/avlpv.o \
common/time/time.o \
generic/RTAssertShouldPanic-generic.o \
- generic/RTLogWriteStdErr-stub-generic.o \
- generic/RTLogWriteStdOut-stub-generic.o \
+ generic/RTLogWriteStdErr-stub-generic.o \
+ generic/RTLogWriteStdOut-stub-generic.o \
generic/RTMpGetCoreCount-generic.o \
generic/RTSemEventWait-2-ex-generic.o \
generic/RTSemEventWaitNoResume-2-ex-generic.o \
generic/RTSemEventMultiWait-2-ex-generic.o \
generic/RTSemEventMultiWaitNoResume-2-ex-generic.o \
+ generic/rtStrFormatKernelAddress-generic.o \
generic/errvars-generic.o \
generic/mppresent-generic.o \
VBox/log-vbox.o \
MOD_CLEAN = . linux r0drv generic r0drv/linux r0drv/generic VBox \
common/alloc common/err common/log common/math/gcc common/misc \
- common/string common/time
+ common/string common/table common/time
include $(obj)/Makefile.include.footer
# build defs
EXTRA_CFLAGS += $(MOD_CFLAGS) $(INCL) $(KFLAGS) $(MOD_EXTRA) $(KDEBUG)
+.PHONY: $(MODULE)
all: $(MODULE)
obj-m += $(MODULE).o
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
+# Testing:
+# * Building with KERN_VER set to an installed but non-current kernel works and
+# installs to the right location.
+# * Building with KERN_DIR and/or MODULE_DIR set uses the value specified and
+# the default value for the unspecified one if any.
+
#
# These file should be included by the Makefiles for any kernel modules we
# build as part of the Guest Additions. The intended way of doing this is as
# building from this directory
#
+ # target kernel version
+ ifndef KERN_VER
+ KERN_VER := $(shell uname -r)
+ else
+ ifneq ($(shell if test -d /lib/modules/$(KERN_VER)/build; then echo yes; fi),yes)
+ KERN_VER := $(shell uname -r)
+ endif
+ endif
+
# kernel base directory
ifndef KERN_DIR
- KERN_DIR := /lib/modules/$(shell uname -r)/build
+ KERN_DIR := /lib/modules/$(KERN_VER)/build
ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
KERN_DIR := /usr/src/linux
ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
# module install dir, only for current kernel
ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
ifndef MODULE_DIR
- MODULE_DIR_TST := /lib/modules/$(shell uname -r)
+ MODULE_DIR_TST := /lib/modules/$(KERN_VER)
ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
MODULE_DIR := $(MODULE_DIR_TST)/misc
else
-/* $Id: strformatrt.cpp 109493 2016-08-03 08:46:35Z klaus $ */\r
+/* $Id: strformatrt.cpp 114404 2017-04-05 13:02:36Z fmehnert $ */\r
/** @file\r
* IPRT - IPRT String Formatter Extensions.\r
*/\r
case 'I':\r
case 'X':\r
case 'U':\r
+ case 'K':\r
{\r
/*\r
* Interpret the type.\r
{ STRMEM("I32"), sizeof(int32_t), 10, RTSF_INT, RTSTR_F_VALSIGNED },\r
{ STRMEM("I64"), sizeof(int64_t), 10, RTSF_INT, RTSTR_F_VALSIGNED },\r
{ STRMEM("I8"), sizeof(int8_t), 10, RTSF_INT, RTSTR_F_VALSIGNED },\r
+ { STRMEM("Kv"), sizeof(RTHCPTR), 16, RTSF_INT, RTSTR_F_OBFUSCATE_PTR },\r
{ STRMEM("Rv"), sizeof(RTRCPTR), 16, RTSF_INTW, 0 },\r
{ STRMEM("Tbool"), sizeof(bool), 10, RTSF_BOOL, 0 },\r
{ STRMEM("Tfile"), sizeof(RTFILE), 10, RTSF_INT, 0 },\r
int16_t i16;\r
int32_t i32;\r
int64_t i64;\r
+ RTR0INTPTR uR0Ptr;\r
RTFAR16 fp16;\r
RTFAR32 fp32;\r
RTFAR64 fp64;\r
}\r
}\r
\r
+#ifndef DEBUG\r
+ /*\r
+ * For now don't show the address.\r
+ */\r
+ if (fFlags & RTSTR_F_OBFUSCATE_PTR)\r
+ {\r
+ cch = rtStrFormatKernelAddress(szBuf, sizeof(szBuf), u.uR0Ptr, cchWidth, cchPrecision, fFlags);\r
+ return pfnOutput(pvArgOutput, szBuf, cch);\r
+ }\r
+#endif\r
+\r
/*\r
* Format the output.\r
*/\r
-/* $Id: avl_Base.cpp.h 83575 2013-02-04 14:27:54Z fmehnert $ */\r
+/* $Id: avl_Base.cpp.h 114582 2017-04-13 13:21:35Z fmehnert $ */\r
/** @file\r
* kAVLBase - basic routines for all AVL trees.\r
*/\r
\r
/*\r
- * Copyright (C) 2001-2012 knut st. osmundsen (bird-src-spam@anduin.net)\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
-/* $Id: avl_Destroy.cpp.h 91108 2013-12-05 12:39:28Z fmehnert $ */\r
+/* $Id: avl_Destroy.cpp.h 114582 2017-04-13 13:21:35Z fmehnert $ */\r
/** @file\r
* kAVLDestroy - Walk the tree calling a callback to destroy all the nodes.\r
*/\r
\r
/*\r
- * Copyright (C) 1999-2011 knut st. osmundsen (bird-src-spam@anduin.net)\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
-/* $Id: avl_DoWithAll.cpp.h 91108 2013-12-05 12:39:28Z fmehnert $ */\r
+/* $Id: avl_DoWithAll.cpp.h 114582 2017-04-13 13:21:35Z fmehnert $ */\r
/** @file\r
* kAVLDoWithAll - Do with all nodes routine for AVL trees.\r
*/\r
\r
/*\r
- * Copyright (C) 1999-2011 knut st. osmundsen (bird-src-spam@anduin.net)\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
-/* $Id: avl_Get.cpp.h 83575 2013-02-04 14:27:54Z fmehnert $ */\r
+/* $Id: avl_Get.cpp.h 114582 2017-04-13 13:21:35Z fmehnert $ */\r
/** @file\r
* kAVLGet - get routine for AVL trees.\r
*/\r
\r
/*\r
- * Copyright (C) 1999-2012 knut st. osmundsen (bird-src-spam@anduin.net)\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
-/* $Id: avl_GetBestFit.cpp.h 83575 2013-02-04 14:27:54Z fmehnert $ */\r
+/* $Id: avl_GetBestFit.cpp.h 114582 2017-04-13 13:21:35Z fmehnert $ */\r
/** @file\r
* kAVLGetBestFit - Get Best Fit routine for AVL trees.\r
* Intended specially on heaps. The tree should allow duplicate keys.\r
*/\r
\r
/*\r
- * Copyright (C) 1999-2012 knut st. osmundsen (bird-src-spam@anduin.net)\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
-/* $Id: avl_RemoveBestFit.cpp.h 83575 2013-02-04 14:27:54Z fmehnert $ */\r
+/* $Id: avl_RemoveBestFit.cpp.h 114582 2017-04-13 13:21:35Z fmehnert $ */\r
/** @file\r
* kAVLRemoveBestFit - Remove Best Fit routine for AVL trees.\r
* Intended specially on heaps. The tree should allow duplicate keys.\r
*/\r
\r
/*\r
- * Copyright (C) 1999-2011 knut st. osmundsen (bird-src-spam@anduin.net)\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
-/* $Id: avlpv.cpp 102121 2015-08-14 15:16:38Z bird $ */\r
+/* $Id: avlpv.cpp 114582 2017-04-13 13:21:35Z fmehnert $ */\r
/** @file\r
* IPRT - AVL tree, void *, unique keys.\r
*/\r
\r
/*\r
- * Copyright (C) 2001-2010 knut st. osmundsen (bird-src-spam@anduin.net)\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
--- /dev/null
+/* $Id: rtStrFormatKernelAddress-generic.cpp 114404 2017-04-05 13:02:36Z fmehnert $ */\r
+/** @file\r
+ * IPRT - IPRT String Formatter, ring-0 addresses.\r
+ */\r
+\r
+/*\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
+ *\r
+ * This file is part of VirtualBox Open Source Edition (OSE), as\r
+ * available from http://www.virtualbox.org. This file is free software;\r
+ * you can redistribute it and/or modify it under the terms of the GNU\r
+ * General Public License (GPL) as published by the Free Software\r
+ * Foundation, in version 2 as it comes in the "COPYING" file of the\r
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.\r
+ *\r
+ * The contents of this file may alternatively be used under the terms\r
+ * of the Common Development and Distribution License Version 1.0\r
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the\r
+ * VirtualBox OSE distribution, in which case the provisions of the\r
+ * CDDL are applicable instead of those of the GPL.\r
+ *\r
+ * You may elect to license modified versions of this file under the\r
+ * terms and conditions of either the GPL or the CDDL or both.\r
+ */\r
+\r
+\r
+/*********************************************************************************************************************************\r
+* Header Files *\r
+*********************************************************************************************************************************/\r
+#define LOG_GROUP RTLOGGROUP_STRING\r
+#include <iprt/string.h>\r
+#include "internal/iprt.h"\r
+\r
+#include <iprt/assert.h>\r
+#include <iprt/string.h>\r
+\r
+#include "internal/string.h"\r
+\r
+\r
+\r
+DECLHIDDEN(size_t) rtStrFormatKernelAddress(char *pszBuf, size_t cbBuf, RTR0INTPTR uPtr, signed int cchWidth,\r
+ signed int cchPrecision, unsigned int fFlags)\r
+{\r
+#ifndef DEBUG\r
+ RT_NOREF(uPtr, cchWidth, cchPrecision);\r
+# if R0_ARCH_BITS == 64\r
+ static const char s_szObfuscated[] = "0xXXXXXXXXXXXXXXXX";\r
+# else\r
+ static const char s_szObfuscated[] = "0xXXXXXXXX";\r
+# endif\r
+ size_t cbSrc = sizeof(s_szObfuscated);\r
+ const char *pszSrc = s_szObfuscated;\r
+ if (!(fFlags & RTSTR_F_SPECIAL))\r
+ {\r
+ pszSrc += 2;\r
+ cbSrc -= 2;\r
+ }\r
+ if (cbSrc <= cbBuf)\r
+ {\r
+ memcpy(pszBuf, pszSrc, cbSrc);\r
+ return cbSrc - 1;\r
+ }\r
+ AssertFailed();\r
+ memcpy(pszBuf, pszSrc, cbBuf);\r
+ pszBuf[cbBuf - 1] = '\0';\r
+ return cbBuf - 1;\r
+\r
+#else /* DEBUG */\r
+ Assert(cbBuf >= 64);\r
+ return RTStrFormatNumber(pszBuf, uPtr, 16, cchWidth, cchPrecision, fFlags);\r
+#endif /* DEBUG */\r
+}\r
+\r
* @param type The return type of the function declaration.\r
*/\r
#if defined(IN_DIS)\r
-# define DISDECL(type) DECLEXPORT(type) VBOXCALL\r
+# ifdef IN_DIS_STATIC\r
+# define DISDECL(type) DECLHIDDEN(type) VBOXCALL\r
+# else\r
+# define DISDECL(type) DECLEXPORT(type) VBOXCALL\r
+# endif\r
#else\r
# define DISDECL(type) DECLIMPORT(type) VBOXCALL\r
#endif\r
*/\r
\r
/*\r
- * Copyright (C) 2006-2016 Oracle Corporation\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
#define VERR_SUPLIB_NT_PROCESS_UNTRUSTED_4 (-3774)\r
/** Unable to establish trusted of VM process (5). */\r
#define VERR_SUPLIB_NT_PROCESS_UNTRUSTED_5 (-3775)\r
+/** Unable to make text memory writeable (hardening). */\r
+#define VERR_SUPLIB_TEXT_NOT_WRITEABLE (-3776)\r
+/** Unable to seal text memory again to protect against write access (hardening). */\r
+#define VERR_SUPLIB_TEXT_NOT_SEALED (-3777)\r
+/** Unexpected instruction encountered for which there is no patch strategy\r
+ * implemented (hardening). */\r
+#define VERR_SUPLIB_UNEXPECTED_INSTRUCTION (-3778)\r
/** @} */\r
\r
\r
#define VERR_SVM_IPE_4 (-4064)\r
/** Internal SVM processing error no 5. */\r
#define VERR_SVM_IPE_5 (-4065)\r
+/** The nested-guest \#VMEXIT processing failed, initiate shutdown. */\r
+#define VERR_SVM_VMEXIT_FAILED (-4066)\r
+/** An operation caused a nested-guest SVM \#VMEXIT. */\r
+#define VINF_SVM_VMEXIT 4067\r
/** @} */\r
\r
\r
#define VERR_HM_INVALID_HM64ON32OP (-4116)\r
/** Resume guest execution after injecting a double-fault. */\r
#define VINF_HM_DOUBLE_FAULT 4117\r
+/** The requested nested-guest VM-exit intercept is not active or not in\r
+ * nested-guest execution mode. */\r
+#define VINF_HM_INTERCEPT_NOT_ACTIVE 4118\r
/** @} */\r
\r
\r
#define VERR_SUP_VP_FILE_MODE_ERROR (-5674)\r
/** Error creating an event semaphore for used with asynchronous reads. */\r
#define VERR_SUP_VP_CREATE_READ_EVT_SEM_FAILED (-5675)\r
+/** Undesirable module. */\r
+#define VERR_SUP_VP_UNDESIRABLE_MODULE (-5676)\r
\r
/** @} */\r
\r
#define VERR_AUDIO_NO_FREE_OUTPUT_STREAMS (-6602)\r
/** Pending stream disable operation in progress. */\r
#define VERR_AUDIO_STREAM_PENDING_DISABLE (-6603)\r
+/** There is more data available.\r
+ * This can happen due to a buffer wraparound of a buffer read/write operation. */\r
+#define VINF_AUDIO_MORE_DATA_AVAILABLE (6604)\r
/** @} */\r
\r
\r
VBOXOSTYPE_Win81_x64 = 0x3A100,\r
VBOXOSTYPE_Win10 = 0x3B000,\r
VBOXOSTYPE_Win10_x64 = 0x3B100,\r
+ VBOXOSTYPE_Win2k16_x64 = 0x3C100,\r
VBOXOSTYPE_OS2 = 0x40000,\r
VBOXOSTYPE_OS2Warp3 = 0x41000,\r
VBOXOSTYPE_OS2Warp4 = 0x42000,\r
-/* $Id: string.h 109033 2016-07-22 18:27:37Z bird $ */\r
+/* $Id: string.h 114404 2017-04-05 13:02:36Z fmehnert $ */\r
/** @file\r
* IPRT - Internal RTStr header.\r
*/\r
DECLHIDDEN(size_t) rtstrFormatType(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs,\r
int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize);\r
\r
+/**\r
+ * Format kernel address into @a pszBuf.\r
+ *\r
+ * @returns Number of bytes returned.\r
+ * @param pszBuf The return buffer.\r
+ * @param cbBuf The buffer size.\r
+ * @param uPtr The ring-0 pointer value.\r
+ * @param cchWidth The specified width, -1 if not given.\r
+ * @param cchPrecision The specified precision.\r
+ * @param fFlags Format flags, RTSTR_F_XXX.\r
+ */\r
+DECLHIDDEN(size_t) rtStrFormatKernelAddress(char *pszBuf, size_t cbBuf, RTR0INTPTR uPtr, signed int cchWidth,\r
+ signed int cchPrecision, unsigned int fFlags);\r
+\r
#ifdef RT_WITH_ICONV_CACHE\r
DECLHIDDEN(void) rtStrIconvCacheInit(struct RTTHREADINT *pThread);\r
DECLHIDDEN(void) rtStrIconvCacheDestroy(struct RTTHREADINT *pThread);\r
DECLASM(void) ASMXRstor(struct X86XSAVEAREA const *pXStateArea, uint64_t fComponents);\r
\r
\r
+struct X86FXSTATE;\r
+/**\r
+ * Save FPU and SSE CPU state.\r
+ * @param pXStateArea Where to save the state.\r
+ */\r
+DECLASM(void) ASMFxSave(struct X86FXSTATE *pXStateArea);\r
+\r
+/**\r
+ * Load FPU and SSE CPU state.\r
+ * @param pXStateArea Where to load the state from.\r
+ */\r
+DECLASM(void) ASMFxRstor(struct X86FXSTATE const *pXStateArea);\r
+\r
+\r
/**\r
* Enables interrupts (EFLAGS.IF).\r
*/\r
*\r
* @todo Fix name, it is a predicate function but it's not returning boolean!\r
*/\r
-#if !defined(RT_OS_LINUX) || !defined(__KERNEL__)\r
+#if !defined(RDESKTOP) && (!defined(RT_OS_LINUX) || !defined(__KERNEL__))\r
DECLASM(void *) ASMMemFirstNonZero(void const *pv, size_t cb);\r
#else\r
DECLINLINE(void *) ASMMemFirstNonZero(void const *pv, size_t cb)\r
*/\r
\r
/*\r
- * Copyright (C) 1999-2012 knut st. osmundsen <bird-src-spam@anduin.net>\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
/** RT_CONCAT6 helper, don't use. */\r
#define RT_CONCAT6_HLP(a,b,c,d,e,f) a##b##c##d##e##f\r
\r
+/** @def RT_CONCAT7\r
+ * Concatenate the expanded arguments without any extra spaces in between.\r
+ *\r
+ * @param a The 1st part.\r
+ * @param b The 2nd part.\r
+ * @param c The 3rd part.\r
+ * @param d The 4th part.\r
+ * @param e The 5th part.\r
+ * @param f The 6th part.\r
+ * @param g The 7th part.\r
+ */\r
+#define RT_CONCAT7(a,b,c,d,e,f,g) RT_CONCAT7_HLP(a,b,c,d,e,f,g)\r
+/** RT_CONCAT7 helper, don't use. */\r
+#define RT_CONCAT7_HLP(a,b,c,d,e,f,g) a##b##c##d##e##f##g\r
+\r
+/** @def RT_CONCAT8\r
+ * Concatenate the expanded arguments without any extra spaces in between.\r
+ *\r
+ * @param a The 1st part.\r
+ * @param b The 2nd part.\r
+ * @param c The 3rd part.\r
+ * @param d The 4th part.\r
+ * @param e The 5th part.\r
+ * @param f The 6th part.\r
+ * @param g The 7th part.\r
+ * @param h The 8th part.\r
+ */\r
+#define RT_CONCAT8(a,b,c,d,e,f,g,h) RT_CONCAT8_HLP(a,b,c,d,e,f,g,h)\r
+/** RT_CONCAT8 helper, don't use. */\r
+#define RT_CONCAT8_HLP(a,b,c,d,e,f,g,h) a##b##c##d##e##f##g##h\r
+\r
+/** @def RT_CONCAT9\r
+ * Concatenate the expanded arguments without any extra spaces in between.\r
+ *\r
+ * @param a The 1st part.\r
+ * @param b The 2nd part.\r
+ * @param c The 3rd part.\r
+ * @param d The 4th part.\r
+ * @param e The 5th part.\r
+ * @param f The 6th part.\r
+ * @param g The 7th part.\r
+ * @param h The 8th part.\r
+ * @param i The 9th part.\r
+ */\r
+#define RT_CONCAT9(a,b,c,d,e,f,g,h,i) RT_CONCAT9_HLP(a,b,c,d,e,f,g,h,i)\r
+/** RT_CONCAT9 helper, don't use. */\r
+#define RT_CONCAT9_HLP(a,b,c,d,e,f,g,h,i) a##b##c##d##e##f##g##h##i\r
+\r
/**\r
* String constant tuple - string constant, strlen(string constant).\r
*\r
*/\r
#define RT_ELEMENTS(aArray) ( sizeof(aArray) / sizeof((aArray)[0]) )\r
\r
+/** @def RT_FLEXIBLE_ARRAY\r
+ * What to up inside the square brackets when declaring a structure member\r
+ * with a flexible size.\r
+ *\r
+ * @note Use RT_UOFFSETOF() to calculate the structure size.\r
+ *\r
+ * @note Never to a sizeof() on the structure or member!\r
+ *\r
+ * @note The member must be the last one.\r
+ *\r
+ * @note GCC does not permit using this in a union. So, for unions you must\r
+ * use RT_FLEXIBLE_ARRAY_IN_UNION instead.\r
+ *\r
+ * @note GCC does not permit using this in nested structures, where as MSC\r
+ * does. So, use RT_FLEXIBLE_ARRAY_NESTED for that.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY_NESTED, RT_FLEXIBLE_ARRAY_IN_UNION\r
+ */\r
+#if RT_MSC_PREREQ(RT_MSC_VER_VS2005) /** @todo Probably much much earlier. */ \\r
+ || (defined(__cplusplus) && RT_GNUC_PREREQ(6, 1)) \\r
+ || defined(__WATCOMC__) /* openwatcom 1.9 supports it, we don't care about older atm. */\r
+# define RT_FLEXIBLE_ARRAY\r
+# if defined(__cplusplus) && defined(_MSC_VER)\r
+# pragma warning(disable:4200) /* -wd4200 does not work with VS2010 */\r
+# endif\r
+#elif defined(__STDC_VERSION__)\r
+# if __STDC_VERSION__ >= 1999901L\r
+# define RT_FLEXIBLE_ARRAY\r
+# else\r
+# define RT_FLEXIBLE_ARRAY 1\r
+# endif\r
+#else\r
+# define RT_FLEXIBLE_ARRAY 1\r
+#endif\r
+\r
+/** @def RT_FLEXIBLE_ARRAY_NESTED\r
+ * Variant of RT_FLEXIBLE_ARRAY for use in structures that are nested.\r
+ *\r
+ * GCC only allow the use of flexible array member in the top structure, whereas\r
+ * MSC is less strict and let you do struct { struct { char szName[]; } s; };\r
+ *\r
+ * @note See notes for RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @note GCC does not permit using this in a union. So, for unions you must\r
+ * use RT_FLEXIBLE_ARRAY_IN_NESTED_UNION instead.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ */\r
+#ifdef _MSC_VER\r
+# define RT_FLEXIBLE_ARRAY_NESTED RT_FLEXIBLE_ARRAY\r
+#else\r
+# define RT_FLEXIBLE_ARRAY_NESTED 1\r
+#endif\r
+\r
+/** @def RT_FLEXIBLE_ARRAY_IN_UNION\r
+ * The union version of RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @remarks GCC does not support flexible array members in unions, 6.1.x\r
+ * actively checks for this. Visual C++ 2010 seems happy with it.\r
+ *\r
+ * @note See notes for RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ */\r
+#ifdef _MSC_VER\r
+# define RT_FLEXIBLE_ARRAY_IN_UNION RT_FLEXIBLE_ARRAY\r
+#else\r
+# define RT_FLEXIBLE_ARRAY_IN_UNION 1\r
+#endif\r
+\r
+/** @def RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ * The union version of RT_FLEXIBLE_ARRAY_NESTED.\r
+ *\r
+ * @note See notes for RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ */\r
+#ifdef _MSC_VER\r
+# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION RT_FLEXIBLE_ARRAY_NESTED\r
+#else\r
+# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION 1\r
+#endif\r
+\r
/**\r
* Checks if the value is a power of two.\r
*\r
/** @def RT_NOREF9\r
* RT_NOREF_PV shorthand taking nine parameters. */\r
#define RT_NOREF9(var1, var2, var3, var4, var5, var6, var7, var8, var9) \\r
- RT_NOREF_PV(var1); RT_NOREF8(var2, var3, var4, var5, var6, var7, var8)\r
+ RT_NOREF_PV(var1); RT_NOREF8(var2, var3, var4, var5, var6, var7, var8, var9)\r
/** @def RT_NOREF10\r
* RT_NOREF_PV shorthand taking ten parameters. */\r
#define RT_NOREF10(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10) \\r
*/\r
\r
/*\r
- * Copyright (C) 2011-2016 Oracle Corporation\r
+ * Copyright (C) 2011-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
# define ASMXRstor_EndProc RT_MANGLER(ASMXRstor_EndProc)\r
# define ASMXSave RT_MANGLER(ASMXSave)\r
# define ASMXSave_EndProc RT_MANGLER(ASMXSave_EndProc)\r
+# define ASMFxRstor RT_MANGLER(ASMFxRstor)\r
+# define ASMFxRstor_EndProc RT_MANGLER(ASMFxRstor_EndProc)\r
+# define ASMFxSave RT_MANGLER(ASMFxSave)\r
+# define ASMFxSave_EndProc RT_MANGLER(ASMFxSave_EndProc)\r
\r
# define RTAssertAreQuiet RT_MANGLER(RTAssertAreQuiet)\r
# define RTAssertMayPanic RT_MANGLER(RTAssertMayPanic)\r
# define RTCircBufFree RT_MANGLER(RTCircBufFree)\r
# define RTCircBufIsReading RT_MANGLER(RTCircBufIsReading)\r
# define RTCircBufIsWriting RT_MANGLER(RTCircBufIsWriting)\r
+# define RTCircBufOffsetRead RT_MANGLER(RTCircBufOffsetRead)\r
+# define RTCircBufOffsetWrite RT_MANGLER(RTCircBufOffsetWrite)\r
# define RTCircBufReleaseReadBlock RT_MANGLER(RTCircBufReleaseReadBlock)\r
# define RTCircBufReleaseWriteBlock RT_MANGLER(RTCircBufReleaseWriteBlock)\r
# define RTCircBufReset RT_MANGLER(RTCircBufReset)\r
# define RTNetIPv6PseudoChecksum RT_MANGLER(RTNetIPv6PseudoChecksum)\r
# define RTNetIPv6PseudoChecksumBits RT_MANGLER(RTNetIPv6PseudoChecksumBits)\r
# define RTNetIPv6PseudoChecksumEx RT_MANGLER(RTNetIPv6PseudoChecksumEx)\r
+# define RTNetMaskToPrefixIPv4 RT_MANGLER(RTNetMaskToPrefixIPv4)\r
+# define RTNetPrefixToMaskIPv4 RT_MANGLER(RTNetPrefixToMaskIPv4)\r
# define RTNetTCPChecksum RT_MANGLER(RTNetTCPChecksum)\r
# define RTNetUDPChecksum RT_MANGLER(RTNetUDPChecksum)\r
# define RTNetStrToMacAddr RT_MANGLER(RTNetStrToMacAddr)\r
# define RTStrHash1ExNV RT_MANGLER(RTStrHash1ExNV)\r
# define RTStrHash1N RT_MANGLER(RTStrHash1N)\r
# define RTStrICmp RT_MANGLER(RTStrICmp)\r
+# define RTStrICmpAscii RT_MANGLER(RTStrICmpAscii)\r
# define RTStrIStartsWith RT_MANGLER(RTStrIStartsWith)\r
# define RTStrIStr RT_MANGLER(RTStrIStr)\r
# define RTStrIsCaseFoldable RT_MANGLER(RTStrIsCaseFoldable)\r
RTDECL(int) RTNetStrToIPv4Addr(const char *pcszAddr, PRTNETADDRIPV4 pAddr);\r
\r
/**\r
+ * Verifies that RTNETADDRIPV4 is a valid contiguous netmask and\r
+ * computes its prefix length.\r
+ *\r
+ * @returns VINF_SUCCESS on success, VERR_INVALID_PARAMETER on\r
+ * failure.\r
+ *\r
+ * @param pMask The netmask to verify and convert.\r
+ * @param piPrefix Where to store the prefix length. (Optional)\r
+ */\r
+RTDECL(int) RTNetMaskToPrefixIPv4(PCRTNETADDRIPV4 pMask, int *piPrefix);\r
+\r
+/**\r
+ * Computes netmask corresponding to the prefix length.\r
+ *\r
+ * @returns VINF_SUCCESS on success, VERR_INVALID_PARAMETER on\r
+ * failure.\r
+ *\r
+ * @param iPrefix The prefix to convert.\r
+ * @param pMask Where to store the netmask.\r
+ */\r
+RTDECL(int) RTNetPrefixToMaskIPv4(int iPrefix, PRTNETADDRIPV4 pMask);\r
+\r
+\r
+/**\r
* IPv6 address.\r
*/\r
typedef RTUINT128U RTNETADDRIPV6;\r
#define RTSTR_F_WIDTH 0x0080\r
#define RTSTR_F_PRECISION 0x0100\r
#define RTSTR_F_THOUSAND_SEP 0x0200\r
+#define RTSTR_F_OBFUSCATE_PTR 0x0400\r
\r
#define RTSTR_F_BIT_MASK 0xf800\r
#define RTSTR_F_8BIT 0x0800\r
RTDECL(int) RTStrNICmp(const char *psz1, const char *psz2, size_t cchMax);\r
\r
/**\r
+ * Performs a case insensitive string compare between a UTF-8 string and a 7-bit\r
+ * ASCII string.\r
+ *\r
+ * This is potentially faster than RTStrICmp and drags in less dependencies. It\r
+ * is really handy for hardcoded inputs.\r
+ *\r
+ * If the string encoding is invalid the function will assert (strict builds)\r
+ * and use RTStrCmp for the remainder of the string.\r
+ *\r
+ * @returns < 0 if the first string less than the second string.\r
+ * @returns 0 if the first string identical to the second string.\r
+ * @returns > 0 if the first string greater than the second string.\r
+ * @param psz1 First UTF-8 string. Null is allowed.\r
+ * @param psz2 Second string, 7-bit ASCII. Null is allowed.\r
+ * @sa RTUtf16ICmpAscii\r
+ */\r
+RTDECL(int) RTStrICmpAscii(const char *psz1, const char *psz2);\r
+\r
+/**\r
* Checks whether @a pszString starts with @a pszStart.\r
*\r
* @returns true / false.\r
/** @} */\r
\r
\r
+/** @name CPUID AMD SVM Feature information.\r
+ * CPUID query with EAX=0x8000000a.\r
+ * @{\r
+ */\r
+/** Bit 0 - NP - Nested Paging supported. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_NESTED_PAGING RT_BIT(0)\r
+/** Bit 1 - LbrVirt - Support for saving five debug MSRs. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_LBR_VIRT RT_BIT(1)\r
+/** Bit 2 - SVML - SVM locking bit supported. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_SVM_LOCK RT_BIT(2)\r
+/** Bit 3 - NRIPS - Saving the next instruction pointer is supported. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE RT_BIT(3)\r
+/** Bit 4 - TscRateMsr - Support for MSR TSC ratio. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_TSC_RATE_MSR RT_BIT(4)\r
+/** Bit 5 - VmcbClean - Support VMCB clean bits. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN RT_BIT(5)\r
+/** Bit 6 - FlushByAsid - Indicate TLB flushing for current ASID only, and that\r
+ * VMCB.TLB_Control is supported. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_FLUSH_BY_ASID RT_BIT(6)\r
+/** Bit 7 - DecodeAssist - Indicate decode assist is supported. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST RT_BIT(7)\r
+/** Bit 10 - PauseFilter - Indicates support for the PAUSE intercept filter. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_PAUSE_FILTER RT_BIT(10)\r
+/** Bit 12 - PauseFilterThreshold - Indicates support for the PAUSE\r
+ * intercept filter cycle count threshold. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_PAUSE_FILTER_THRESHOLD RT_BIT(12)\r
+/** Bit 13 - AVIC - Advanced Virtual Interrupt Controller. */\r
+#define X86_CPUID_SVM_FEATURE_EDX_AVIC RT_BIT(13)\r
+/** @} */\r
+\r
+\r
/** @name CR0\r
* @remarks The 286 (MSW), 386 and 486 ignores attempts at setting\r
* reserved flags.\r
/** Hypertransport interrupt pending register.\r
* "BIOS and Kernel Developer's Guide for AMD NPT Family 0Fh Processors" */\r
#define MSR_K8_INT_PENDING UINT32_C(0xc0010055)\r
+\r
+/** SVM Control. */\r
#define MSR_K8_VM_CR UINT32_C(0xc0010114)\r
+/** Disables HDT (Hardware Debug Tool) and certain internal debug\r
+ * features. */\r
+#define MSR_K8_VM_CR_DPD RT_BIT_32(0)\r
+/** If set, non-intercepted INIT signals are converted to \#SX\r
+ * exceptions. */\r
+#define MSR_K8_VM_CR_R_INIT RT_BIT_32(1)\r
+/** Disables A20 masking. */\r
+#define MSR_K8_VM_CR_DIS_A20M RT_BIT_32(2)\r
+/** Lock bit for this MSR controlling bits 3 (LOCK) and 4 (SVMDIS). */\r
+#define MSR_K8_VM_CR_LOCK RT_BIT_32(3)\r
+/** SVM disable. When set, writes to EFER.SVME are treated as MBZ. When\r
+ * clear, EFER.SVME can be written normally. */\r
#define MSR_K8_VM_CR_SVM_DISABLE RT_BIT_32(4)\r
\r
#define MSR_K8_IGNNE UINT32_C(0xc0010115)\r
*/\r
typedef union X86XMMREG\r
{\r
- /** XMM Register view *. */\r
+ /** XMM Register view. */\r
uint128_t xmm;\r
/** 8-bit view. */\r
uint8_t au8[16];\r
uint64_t au64[2];\r
/** 128-bit view. (yeah, very helpful) */\r
uint128_t au128[1];\r
+ /** Confusing nested 128-bit union view (this is what xmm should've been). */\r
+ RTUINT128U uXmm;\r
} X86XMMREG;\r
#ifndef VBOX_FOR_DTRACE_LIB\r
AssertCompileSize(X86XMMREG, 16);\r
/** @name SSE MXCSR\r
* @{ */\r
/** Exception Flag: Invalid operation. */\r
-#define X86_MXSCR_IE RT_BIT_32(0)\r
+#define X86_MXCSR_IE RT_BIT_32(0)\r
/** Exception Flag: Denormalized operand. */\r
-#define X86_MXSCR_DE RT_BIT_32(1)\r
+#define X86_MXCSR_DE RT_BIT_32(1)\r
/** Exception Flag: Zero divide. */\r
-#define X86_MXSCR_ZE RT_BIT_32(2)\r
+#define X86_MXCSR_ZE RT_BIT_32(2)\r
/** Exception Flag: Overflow. */\r
-#define X86_MXSCR_OE RT_BIT_32(3)\r
+#define X86_MXCSR_OE RT_BIT_32(3)\r
/** Exception Flag: Underflow. */\r
-#define X86_MXSCR_UE RT_BIT_32(4)\r
+#define X86_MXCSR_UE RT_BIT_32(4)\r
/** Exception Flag: Precision. */\r
-#define X86_MXSCR_PE RT_BIT_32(5)\r
+#define X86_MXCSR_PE RT_BIT_32(5)\r
\r
/** Denormals are zero. */\r
-#define X86_MXSCR_DAZ RT_BIT_32(6)\r
+#define X86_MXCSR_DAZ RT_BIT_32(6)\r
\r
/** Exception Mask: Invalid operation. */\r
-#define X86_MXSCR_IM RT_BIT_32(7)\r
+#define X86_MXCSR_IM RT_BIT_32(7)\r
/** Exception Mask: Denormalized operand. */\r
-#define X86_MXSCR_DM RT_BIT_32(8)\r
+#define X86_MXCSR_DM RT_BIT_32(8)\r
/** Exception Mask: Zero divide. */\r
-#define X86_MXSCR_ZM RT_BIT_32(9)\r
+#define X86_MXCSR_ZM RT_BIT_32(9)\r
/** Exception Mask: Overflow. */\r
-#define X86_MXSCR_OM RT_BIT_32(10)\r
+#define X86_MXCSR_OM RT_BIT_32(10)\r
/** Exception Mask: Underflow. */\r
-#define X86_MXSCR_UM RT_BIT_32(11)\r
+#define X86_MXCSR_UM RT_BIT_32(11)\r
/** Exception Mask: Precision. */\r
-#define X86_MXSCR_PM RT_BIT_32(12)\r
+#define X86_MXCSR_PM RT_BIT_32(12)\r
\r
/** Rounding control mask. */\r
-#define X86_MXSCR_RC_MASK UINT16_C(0x6000)\r
+#define X86_MXCSR_RC_MASK UINT16_C(0x6000)\r
/** Rounding control: To nearest. */\r
-#define X86_MXSCR_RC_NEAREST UINT16_C(0x0000)\r
+#define X86_MXCSR_RC_NEAREST UINT16_C(0x0000)\r
/** Rounding control: Down. */\r
-#define X86_MXSCR_RC_DOWN UINT16_C(0x2000)\r
+#define X86_MXCSR_RC_DOWN UINT16_C(0x2000)\r
/** Rounding control: Up. */\r
-#define X86_MXSCR_RC_UP UINT16_C(0x4000)\r
+#define X86_MXCSR_RC_UP UINT16_C(0x4000)\r
/** Rounding control: Towards zero. */\r
-#define X86_MXSCR_RC_ZERO UINT16_C(0x6000)\r
+#define X86_MXCSR_RC_ZERO UINT16_C(0x6000)\r
\r
/** Flush-to-zero for masked underflow. */\r
-#define X86_MXSCR_FZ RT_BIT_32(15)\r
+#define X86_MXCSR_FZ RT_BIT_32(15)\r
\r
/** Misaligned Exception Mask (AMD MISALIGNSSE). */\r
-#define X86_MXSCR_MM RT_BIT_32(17)\r
+#define X86_MXCSR_MM RT_BIT_32(17)\r
/** @} */\r
\r
/**\r
typedef X86XSAVEAREA const *PCX86XSAVEAREA;\r
\r
\r
-/** @name XSAVE_C_XXX - XSAVE State Components Bits.\r
+/** @name XSAVE_C_XXX - XSAVE State Components Bits (XCR0).\r
* @{ */\r
/** Bit 0 - x87 - Legacy FPU state (bit number) */\r
#define XSAVE_C_X87_BIT 0\r
#define XSAVE_C_LWP_BIT 62\r
/** Bit 62 - LWP - Lightweight Profiling (AMD). */\r
#define XSAVE_C_LWP RT_BIT_64(XSAVE_C_LWP_BIT)\r
+/** Bit 63 - X - Reserved (MBZ) for extending XCR0 (bit number). */\r
+#define XSAVE_C_X_BIT 63\r
+/** Bit 63 - X - Reserved (MBZ) for extending XCR0 (AMD). */\r
+#define XSAVE_C_X RT_BIT_64(XSAVE_C_X_BIT)\r
/** @} */\r
\r
\r
unsigned u16Sel : 16;\r
/** 20 - Number of parameters for a call-gate.\r
* Ignored if interrupt-, trap- or task-gate. */\r
- unsigned u4ParmCount : 4;\r
- /** 24 - Reserved / ignored. */\r
- unsigned u4Reserved : 4;\r
+ unsigned u5ParmCount : 5;\r
+ /** 25 - Reserved / ignored. */\r
+ unsigned u3Reserved : 3;\r
/** 28 - Segment Type. */\r
unsigned u4Type : 4;\r
/** 2c - Descriptor Type (0 = system). */\r
/** \#VE - Virtualization Exception. */\r
X86_XCPT_VE = 0x14,\r
/** \#SX - Security Exception. */\r
- X86_XCPT_SX = 0x1f\r
+ X86_XCPT_SX = 0x1e\r
} X86XCPT;\r
/** Pointer to a x86 exception code. */\r
typedef X86XCPT *PX86XCPT;\r
/** Pointer to a const x86 exception code. */\r
typedef const X86XCPT *PCX86XCPT;\r
-/** The maximum exception value. */\r
-#define X86_XCPT_MAX (X86_XCPT_SX)\r
+/** The last valid (currently reserved) exception value. */\r
+#define X86_XCPT_LAST 0x1f\r
\r
\r
/** @name Trap Error Codes\r
AssertCompile((X86_MODRM_RM_MASK | X86_MODRM_REG_MASK | X86_MODRM_MOD_MASK) == 0xff);\r
AssertCompile((X86_MODRM_REG_MASK >> X86_MODRM_REG_SHIFT) == X86_MODRM_REG_SMASK);\r
AssertCompile((X86_MODRM_MOD_MASK >> X86_MODRM_MOD_SHIFT) == X86_MODRM_MOD_SMASK);\r
+/** @def X86_MODRM_MAKE\r
+ * @param a_Mod The mod value (0..3).\r
+ * @param a_Reg The register value (0..7).\r
+ * @param a_RegMem The register or memory value (0..7). */\r
+# define X86_MODRM_MAKE(a_Mod, a_Reg, a_RegMem) (((a_Mod) << X86_MODRM_MOD_SHIFT) | ((a_Reg) << X86_MODRM_REG_SHIFT) | (a_RegMem))\r
#endif\r
/** @} */\r
\r
#define X86_OP_PRF_SIZE_OP UINT8_C(0x66)\r
#define X86_OP_PRF_SIZE_ADDR UINT8_C(0x67)\r
#define X86_OP_PRF_LOCK UINT8_C(0xf0)\r
-#define X86_OP_PRF_REPZ UINT8_C(0xf2)\r
-#define X86_OP_PRF_REPNZ UINT8_C(0xf3)\r
+#define X86_OP_PRF_REPZ UINT8_C(0xf3)\r
+#define X86_OP_PRF_REPNZ UINT8_C(0xf2)\r
#define X86_OP_REX_B UINT8_C(0x41)\r
#define X86_OP_REX_X UINT8_C(0x42)\r
#define X86_OP_REX_R UINT8_C(0x44)\r
-/* $Id: semmutex-r0drv-linux.c 109135 2016-07-26 15:16:41Z bird $ */\r
+/* $Id: semmutex-r0drv-linux.c 113832 2017-03-08 11:30:08Z fmehnert $ */\r
/** @file\r
* IPRT - Mutex Semaphores, Ring-0 Driver, Linux.\r
*/\r
break;\r
\r
/* Go to sleep. */\r
- set_task_state(pSelf, fInterruptible ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);\r
+ set_current_state(fInterruptible ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);\r
spin_unlock_irq(&pThis->Spinlock);\r
\r
lTimeout = schedule_timeout(lTimeout);\r
-/* $Id: the-linux-kernel.h 109855 2016-08-09 16:35:40Z bird $ */\r
+/* $Id: the-linux-kernel.h 113828 2017-03-08 10:10:39Z fmehnert $ */\r
/** @file\r
* IPRT - Include all necessary headers for the Linux kernel.\r
*/\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)\r
# include <linux/sched/rt.h>\r
#endif\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+# include <linux/sched/signal.h>\r
+# include <linux/sched/types.h>\r
+#endif\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 7)\r
# include <linux/jiffies.h>\r
#endif\r
-#define VBOX_SVN_REV 112924
+#define VBOX_SVN_REV 115126
#define VBOX_VERSION_MAJOR 5
#define VBOX_VERSION_MINOR 1
-#define VBOX_VERSION_BUILD 14
-#define VBOX_VERSION_STRING_RAW "5.1.14"
-#define VBOX_VERSION_STRING "5.1.14"
+#define VBOX_VERSION_BUILD 22
+#define VBOX_VERSION_STRING_RAW "5.1.22"
+#define VBOX_VERSION_STRING "5.1.22"
#define VBOX_API_VERSION_STRING "5_1"
#define VBOX_BUILD_SERVER_BUILD 1
# build defs
EXTRA_CFLAGS += $(MOD_CFLAGS) $(INCL) $(KFLAGS) $(MOD_EXTRA) $(KDEBUG)
+.PHONY: $(MODULE)
all: $(MODULE)
obj-m += $(MODULE).o
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
+# Testing:
+# * Building with KERN_VER set to an installed but non-current kernel works and
+# installs to the right location.
+# * Building with KERN_DIR and/or MODULE_DIR set uses the value specified and
+# the default value for the unspecified one if any.
+
#
# These file should be included by the Makefiles for any kernel modules we
# build as part of the Guest Additions. The intended way of doing this is as
# building from this directory
#
+ # target kernel version
+ ifndef KERN_VER
+ KERN_VER := $(shell uname -r)
+ else
+ ifneq ($(shell if test -d /lib/modules/$(KERN_VER)/build; then echo yes; fi),yes)
+ KERN_VER := $(shell uname -r)
+ endif
+ endif
+
# kernel base directory
ifndef KERN_DIR
- KERN_DIR := /lib/modules/$(shell uname -r)/build
+ KERN_DIR := /lib/modules/$(KERN_VER)/build
ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
KERN_DIR := /usr/src/linux
ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
# module install dir, only for current kernel
ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
ifndef MODULE_DIR
- MODULE_DIR_TST := /lib/modules/$(shell uname -r)
+ MODULE_DIR_TST := /lib/modules/$(KERN_VER)
ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
MODULE_DIR := $(MODULE_DIR_TST)/misc
else
* @param type The return type of the function declaration.\r
*/\r
#if defined(IN_DIS)\r
-# define DISDECL(type) DECLEXPORT(type) VBOXCALL\r
+# ifdef IN_DIS_STATIC\r
+# define DISDECL(type) DECLHIDDEN(type) VBOXCALL\r
+# else\r
+# define DISDECL(type) DECLEXPORT(type) VBOXCALL\r
+# endif\r
#else\r
# define DISDECL(type) DECLIMPORT(type) VBOXCALL\r
#endif\r
*/\r
\r
/*\r
- * Copyright (C) 2006-2016 Oracle Corporation\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
#define VERR_SUPLIB_NT_PROCESS_UNTRUSTED_4 (-3774)\r
/** Unable to establish trusted of VM process (5). */\r
#define VERR_SUPLIB_NT_PROCESS_UNTRUSTED_5 (-3775)\r
+/** Unable to make text memory writeable (hardening). */\r
+#define VERR_SUPLIB_TEXT_NOT_WRITEABLE (-3776)\r
+/** Unable to seal text memory again to protect against write access (hardening). */\r
+#define VERR_SUPLIB_TEXT_NOT_SEALED (-3777)\r
+/** Unexpected instruction encountered for which there is no patch strategy\r
+ * implemented (hardening). */\r
+#define VERR_SUPLIB_UNEXPECTED_INSTRUCTION (-3778)\r
/** @} */\r
\r
\r
#define VERR_SVM_IPE_4 (-4064)\r
/** Internal SVM processing error no 5. */\r
#define VERR_SVM_IPE_5 (-4065)\r
+/** The nested-guest \#VMEXIT processing failed, initiate shutdown. */\r
+#define VERR_SVM_VMEXIT_FAILED (-4066)\r
+/** An operation caused a nested-guest SVM \#VMEXIT. */\r
+#define VINF_SVM_VMEXIT 4067\r
/** @} */\r
\r
\r
#define VERR_HM_INVALID_HM64ON32OP (-4116)\r
/** Resume guest execution after injecting a double-fault. */\r
#define VINF_HM_DOUBLE_FAULT 4117\r
+/** The requested nested-guest VM-exit intercept is not active or not in\r
+ * nested-guest execution mode. */\r
+#define VINF_HM_INTERCEPT_NOT_ACTIVE 4118\r
/** @} */\r
\r
\r
#define VERR_SUP_VP_FILE_MODE_ERROR (-5674)\r
/** Error creating an event semaphore for used with asynchronous reads. */\r
#define VERR_SUP_VP_CREATE_READ_EVT_SEM_FAILED (-5675)\r
+/** Undesirable module. */\r
+#define VERR_SUP_VP_UNDESIRABLE_MODULE (-5676)\r
\r
/** @} */\r
\r
#define VERR_AUDIO_NO_FREE_OUTPUT_STREAMS (-6602)\r
/** Pending stream disable operation in progress. */\r
#define VERR_AUDIO_STREAM_PENDING_DISABLE (-6603)\r
+/** There is more data available.\r
+ * This can happen due to a buffer wraparound of a buffer read/write operation. */\r
+#define VINF_AUDIO_MORE_DATA_AVAILABLE (6604)\r
/** @} */\r
\r
\r
VBOXOSTYPE_Win81_x64 = 0x3A100,\r
VBOXOSTYPE_Win10 = 0x3B000,\r
VBOXOSTYPE_Win10_x64 = 0x3B100,\r
+ VBOXOSTYPE_Win2k16_x64 = 0x3C100,\r
VBOXOSTYPE_OS2 = 0x40000,\r
VBOXOSTYPE_OS2Warp3 = 0x41000,\r
VBOXOSTYPE_OS2Warp4 = 0x42000,\r
DECLASM(void) ASMXRstor(struct X86XSAVEAREA const *pXStateArea, uint64_t fComponents);\r
\r
\r
+struct X86FXSTATE;\r
+/**\r
+ * Save FPU and SSE CPU state.\r
+ * @param pXStateArea Where to save the state.\r
+ */\r
+DECLASM(void) ASMFxSave(struct X86FXSTATE *pXStateArea);\r
+\r
+/**\r
+ * Load FPU and SSE CPU state.\r
+ * @param pXStateArea Where to load the state from.\r
+ */\r
+DECLASM(void) ASMFxRstor(struct X86FXSTATE const *pXStateArea);\r
+\r
+\r
/**\r
* Enables interrupts (EFLAGS.IF).\r
*/\r
*\r
* @todo Fix name, it is a predicate function but it's not returning boolean!\r
*/\r
-#if !defined(RT_OS_LINUX) || !defined(__KERNEL__)\r
+#if !defined(RDESKTOP) && (!defined(RT_OS_LINUX) || !defined(__KERNEL__))\r
DECLASM(void *) ASMMemFirstNonZero(void const *pv, size_t cb);\r
#else\r
DECLINLINE(void *) ASMMemFirstNonZero(void const *pv, size_t cb)\r
/** RT_CONCAT6 helper, don't use. */\r
#define RT_CONCAT6_HLP(a,b,c,d,e,f) a##b##c##d##e##f\r
\r
+/** @def RT_CONCAT7\r
+ * Concatenate the expanded arguments without any extra spaces in between.\r
+ *\r
+ * @param a The 1st part.\r
+ * @param b The 2nd part.\r
+ * @param c The 3rd part.\r
+ * @param d The 4th part.\r
+ * @param e The 5th part.\r
+ * @param f The 6th part.\r
+ * @param g The 7th part.\r
+ */\r
+#define RT_CONCAT7(a,b,c,d,e,f,g) RT_CONCAT7_HLP(a,b,c,d,e,f,g)\r
+/** RT_CONCAT7 helper, don't use. */\r
+#define RT_CONCAT7_HLP(a,b,c,d,e,f,g) a##b##c##d##e##f##g\r
+\r
+/** @def RT_CONCAT8\r
+ * Concatenate the expanded arguments without any extra spaces in between.\r
+ *\r
+ * @param a The 1st part.\r
+ * @param b The 2nd part.\r
+ * @param c The 3rd part.\r
+ * @param d The 4th part.\r
+ * @param e The 5th part.\r
+ * @param f The 6th part.\r
+ * @param g The 7th part.\r
+ * @param h The 8th part.\r
+ */\r
+#define RT_CONCAT8(a,b,c,d,e,f,g,h) RT_CONCAT8_HLP(a,b,c,d,e,f,g,h)\r
+/** RT_CONCAT8 helper, don't use. */\r
+#define RT_CONCAT8_HLP(a,b,c,d,e,f,g,h) a##b##c##d##e##f##g##h\r
+\r
+/** @def RT_CONCAT9\r
+ * Concatenate the expanded arguments without any extra spaces in between.\r
+ *\r
+ * @param a The 1st part.\r
+ * @param b The 2nd part.\r
+ * @param c The 3rd part.\r
+ * @param d The 4th part.\r
+ * @param e The 5th part.\r
+ * @param f The 6th part.\r
+ * @param g The 7th part.\r
+ * @param h The 8th part.\r
+ * @param i The 9th part.\r
+ */\r
+#define RT_CONCAT9(a,b,c,d,e,f,g,h,i) RT_CONCAT9_HLP(a,b,c,d,e,f,g,h,i)\r
+/** RT_CONCAT9 helper, don't use. */\r
+#define RT_CONCAT9_HLP(a,b,c,d,e,f,g,h,i) a##b##c##d##e##f##g##h##i\r
+\r
/**\r
* String constant tuple - string constant, strlen(string constant).\r
*\r
*/\r
#define RT_ELEMENTS(aArray) ( sizeof(aArray) / sizeof((aArray)[0]) )\r
\r
+/** @def RT_FLEXIBLE_ARRAY\r
+ * What to up inside the square brackets when declaring a structure member\r
+ * with a flexible size.\r
+ *\r
+ * @note Use RT_UOFFSETOF() to calculate the structure size.\r
+ *\r
+ * @note Never to a sizeof() on the structure or member!\r
+ *\r
+ * @note The member must be the last one.\r
+ *\r
+ * @note GCC does not permit using this in a union. So, for unions you must\r
+ * use RT_FLEXIBLE_ARRAY_IN_UNION instead.\r
+ *\r
+ * @note GCC does not permit using this in nested structures, where as MSC\r
+ * does. So, use RT_FLEXIBLE_ARRAY_NESTED for that.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY_NESTED, RT_FLEXIBLE_ARRAY_IN_UNION\r
+ */\r
+#if RT_MSC_PREREQ(RT_MSC_VER_VS2005) /** @todo Probably much much earlier. */ \\r
+ || (defined(__cplusplus) && RT_GNUC_PREREQ(6, 1)) \\r
+ || defined(__WATCOMC__) /* openwatcom 1.9 supports it, we don't care about older atm. */\r
+# define RT_FLEXIBLE_ARRAY\r
+# if defined(__cplusplus) && defined(_MSC_VER)\r
+# pragma warning(disable:4200) /* -wd4200 does not work with VS2010 */\r
+# endif\r
+#elif defined(__STDC_VERSION__)\r
+# if __STDC_VERSION__ >= 1999901L\r
+# define RT_FLEXIBLE_ARRAY\r
+# else\r
+# define RT_FLEXIBLE_ARRAY 1\r
+# endif\r
+#else\r
+# define RT_FLEXIBLE_ARRAY 1\r
+#endif\r
+\r
+/** @def RT_FLEXIBLE_ARRAY_NESTED\r
+ * Variant of RT_FLEXIBLE_ARRAY for use in structures that are nested.\r
+ *\r
+ * GCC only allow the use of flexible array member in the top structure, whereas\r
+ * MSC is less strict and let you do struct { struct { char szName[]; } s; };\r
+ *\r
+ * @note See notes for RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @note GCC does not permit using this in a union. So, for unions you must\r
+ * use RT_FLEXIBLE_ARRAY_IN_NESTED_UNION instead.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ */\r
+#ifdef _MSC_VER\r
+# define RT_FLEXIBLE_ARRAY_NESTED RT_FLEXIBLE_ARRAY\r
+#else\r
+# define RT_FLEXIBLE_ARRAY_NESTED 1\r
+#endif\r
+\r
+/** @def RT_FLEXIBLE_ARRAY_IN_UNION\r
+ * The union version of RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @remarks GCC does not support flexible array members in unions, 6.1.x\r
+ * actively checks for this. Visual C++ 2010 seems happy with it.\r
+ *\r
+ * @note See notes for RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ */\r
+#ifdef _MSC_VER\r
+# define RT_FLEXIBLE_ARRAY_IN_UNION RT_FLEXIBLE_ARRAY\r
+#else\r
+# define RT_FLEXIBLE_ARRAY_IN_UNION 1\r
+#endif\r
+\r
+/** @def RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ * The union version of RT_FLEXIBLE_ARRAY_NESTED.\r
+ *\r
+ * @note See notes for RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ */\r
+#ifdef _MSC_VER\r
+# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION RT_FLEXIBLE_ARRAY_NESTED\r
+#else\r
+# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION 1\r
+#endif\r
+\r
/**\r
* Checks if the value is a power of two.\r
*\r
/** @def RT_NOREF9\r
* RT_NOREF_PV shorthand taking nine parameters. */\r
#define RT_NOREF9(var1, var2, var3, var4, var5, var6, var7, var8, var9) \\r
- RT_NOREF_PV(var1); RT_NOREF8(var2, var3, var4, var5, var6, var7, var8)\r
+ RT_NOREF_PV(var1); RT_NOREF8(var2, var3, var4, var5, var6, var7, var8, var9)\r
/** @def RT_NOREF10\r
* RT_NOREF_PV shorthand taking ten parameters. */\r
#define RT_NOREF10(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10) \\r
*/\r
\r
/*\r
- * Copyright (C) 2011-2016 Oracle Corporation\r
+ * Copyright (C) 2011-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
# define ASMXRstor_EndProc RT_MANGLER(ASMXRstor_EndProc)\r
# define ASMXSave RT_MANGLER(ASMXSave)\r
# define ASMXSave_EndProc RT_MANGLER(ASMXSave_EndProc)\r
+# define ASMFxRstor RT_MANGLER(ASMFxRstor)\r
+# define ASMFxRstor_EndProc RT_MANGLER(ASMFxRstor_EndProc)\r
+# define ASMFxSave RT_MANGLER(ASMFxSave)\r
+# define ASMFxSave_EndProc RT_MANGLER(ASMFxSave_EndProc)\r
\r
# define RTAssertAreQuiet RT_MANGLER(RTAssertAreQuiet)\r
# define RTAssertMayPanic RT_MANGLER(RTAssertMayPanic)\r
# define RTCircBufFree RT_MANGLER(RTCircBufFree)\r
# define RTCircBufIsReading RT_MANGLER(RTCircBufIsReading)\r
# define RTCircBufIsWriting RT_MANGLER(RTCircBufIsWriting)\r
+# define RTCircBufOffsetRead RT_MANGLER(RTCircBufOffsetRead)\r
+# define RTCircBufOffsetWrite RT_MANGLER(RTCircBufOffsetWrite)\r
# define RTCircBufReleaseReadBlock RT_MANGLER(RTCircBufReleaseReadBlock)\r
# define RTCircBufReleaseWriteBlock RT_MANGLER(RTCircBufReleaseWriteBlock)\r
# define RTCircBufReset RT_MANGLER(RTCircBufReset)\r
# define RTNetIPv6PseudoChecksum RT_MANGLER(RTNetIPv6PseudoChecksum)\r
# define RTNetIPv6PseudoChecksumBits RT_MANGLER(RTNetIPv6PseudoChecksumBits)\r
# define RTNetIPv6PseudoChecksumEx RT_MANGLER(RTNetIPv6PseudoChecksumEx)\r
+# define RTNetMaskToPrefixIPv4 RT_MANGLER(RTNetMaskToPrefixIPv4)\r
+# define RTNetPrefixToMaskIPv4 RT_MANGLER(RTNetPrefixToMaskIPv4)\r
# define RTNetTCPChecksum RT_MANGLER(RTNetTCPChecksum)\r
# define RTNetUDPChecksum RT_MANGLER(RTNetUDPChecksum)\r
# define RTNetStrToMacAddr RT_MANGLER(RTNetStrToMacAddr)\r
# define RTStrHash1ExNV RT_MANGLER(RTStrHash1ExNV)\r
# define RTStrHash1N RT_MANGLER(RTStrHash1N)\r
# define RTStrICmp RT_MANGLER(RTStrICmp)\r
+# define RTStrICmpAscii RT_MANGLER(RTStrICmpAscii)\r
# define RTStrIStartsWith RT_MANGLER(RTStrIStartsWith)\r
# define RTStrIStr RT_MANGLER(RTStrIStr)\r
# define RTStrIsCaseFoldable RT_MANGLER(RTStrIsCaseFoldable)\r
#define RTSTR_F_WIDTH 0x0080\r
#define RTSTR_F_PRECISION 0x0100\r
#define RTSTR_F_THOUSAND_SEP 0x0200\r
+#define RTSTR_F_OBFUSCATE_PTR 0x0400\r
\r
#define RTSTR_F_BIT_MASK 0xf800\r
#define RTSTR_F_8BIT 0x0800\r
RTDECL(int) RTStrNICmp(const char *psz1, const char *psz2, size_t cchMax);\r
\r
/**\r
+ * Performs a case insensitive string compare between a UTF-8 string and a 7-bit\r
+ * ASCII string.\r
+ *\r
+ * This is potentially faster than RTStrICmp and drags in less dependencies. It\r
+ * is really handy for hardcoded inputs.\r
+ *\r
+ * If the string encoding is invalid the function will assert (strict builds)\r
+ * and use RTStrCmp for the remainder of the string.\r
+ *\r
+ * @returns < 0 if the first string less than the second string.\r
+ * @returns 0 if the first string identical to the second string.\r
+ * @returns > 0 if the first string greater than the second string.\r
+ * @param psz1 First UTF-8 string. Null is allowed.\r
+ * @param psz2 Second string, 7-bit ASCII. Null is allowed.\r
+ * @sa RTUtf16ICmpAscii\r
+ */\r
+RTDECL(int) RTStrICmpAscii(const char *psz1, const char *psz2);\r
+\r
+/**\r
* Checks whether @a pszString starts with @a pszStart.\r
*\r
* @returns true / false.\r
\r
struct inode_operations sf_lnk_iops =\r
{\r
+# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)\r
.readlink = generic_readlink,\r
+# endif\r
# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)\r
.get_link = sf_get_link\r
# elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)\r
-/* $Id: the-linux-kernel.h 109855 2016-08-09 16:35:40Z bird $ */\r
+/* $Id: the-linux-kernel.h 113828 2017-03-08 10:10:39Z fmehnert $ */\r
/** @file\r
* IPRT - Include all necessary headers for the Linux kernel.\r
*/\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)\r
# include <linux/sched/rt.h>\r
#endif\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+# include <linux/sched/signal.h>\r
+# include <linux/sched/types.h>\r
+#endif\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 7)\r
# include <linux/jiffies.h>\r
#endif\r
-/* $Id: regops.c 112705 2017-01-09 12:21:13Z sunlover $ */\r
+/* $Id: regops.c 113832 2017-03-08 11:30:08Z fmehnert $ */\r
/** @file\r
* vboxsf - VBox Linux Shared Folders, Regular file inode and file operations.\r
*/\r
return 0;\r
}\r
\r
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25)\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+static int sf_reg_fault(struct vm_fault *vmf)\r
+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25)\r
static int sf_reg_fault(struct vm_area_struct *vma, struct vm_fault *vmf)\r
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)\r
static struct page *sf_reg_nopage(struct vm_area_struct *vma, unsigned long vaddr, int *type)\r
loff_t off;\r
uint32_t nread = PAGE_SIZE;\r
int err;\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+ struct vm_area_struct *vma = vmf->vma;\r
+#endif\r
struct file *file = vma->vm_file;\r
struct inode *inode = GET_F_DENTRY(file)->d_inode;\r
struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);\r
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25)\r
.fault = sf_reg_fault\r
#else\r
- .nopage = sf_reg_nopage\r
+ .nopage = sf_reg_nopage\r
#endif\r
};\r
\r
-#define VBOX_SVN_REV 112924
+#define VBOX_SVN_REV 115126
has inode at all) from these new attributes we derive [kstat] via\r
[generic_fillattr] */\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)\r
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+int sf_getattr(const struct path *path, struct kstat *kstat, u32 request_mask, unsigned int flags)\r
+# else\r
int sf_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat)\r
+# endif\r
{\r
int err;\r
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+ struct dentry *dentry = path->dentry;\r
+# endif\r
\r
TRACE();\r
err = sf_inode_revalidate(dentry);\r
#define VBOX_VERSION_MAJOR 5
#define VBOX_VERSION_MINOR 1
-#define VBOX_VERSION_BUILD 14
-#define VBOX_VERSION_STRING_RAW "5.1.14"
-#define VBOX_VERSION_STRING "5.1.14"
+#define VBOX_VERSION_BUILD 22
+#define VBOX_VERSION_STRING_RAW "5.1.22"
+#define VBOX_VERSION_STRING "5.1.22"
#define VBOX_API_VERSION_STRING "5_1"
#define VBOX_BUILD_SERVER_BUILD 1
MODULE_DESCRIPTION(VBOX_PRODUCT " VFS Module for Host File System Access");\r
MODULE_AUTHOR(VBOX_VENDOR);\r
MODULE_LICENSE("GPL");\r
+#ifdef MODULE_ALIAS_FS\r
+MODULE_ALIAS_FS("vboxsf");\r
+#endif \r
#ifdef MODULE_VERSION\r
MODULE_VERSION(VBOX_VERSION_STRING " r" RT_XSTR(VBOX_SVN_REV));\r
#endif\r
SHFLSTRING *path, PSHFLFSOBJINFO result, int ok_to_fail);\r
extern int sf_inode_revalidate(struct dentry *dentry);\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)\r
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+extern int sf_getattr(const struct path *path, struct kstat *kstat,\r
+ u32 request_mask, unsigned int query_flags);\r
+# else\r
extern int sf_getattr(struct vfsmount *mnt, struct dentry *dentry,\r
struct kstat *kstat);\r
+#endif\r
extern int sf_setattr(struct dentry *dentry, struct iattr *iattr);\r
#endif\r
extern int sf_path_from_dentry(const char *caller, struct sf_glob_info *sf_g,\r
-# $Id: Makefile.module.kms 107348 2016-05-20 07:17:12Z fmehnert $\r
+# $Id: Makefile.module.kms 114121 2017-03-22 16:12:45Z michael $\r
## @file\r
# VirtualBox Guest Additions Module Makefile.\r
#\r
# as of 2.6.16 KERNELRELEASE is only set if the kernel is configured\r
MY_KERNELRELEASE := $(KERNELVERSION)\r
endif\r
+ifeq ($(KERN_VERSION),24)\r
+ # sledgehammer, see the 2.4 handling in Makefile.include.footer\r
+ MY_KERNELRELEASE := 2.4.0\r
+endif\r
ifeq ($(filter 1.% 2.% 3.0.% 3.1.% 3.2.% 3.3.% 3.4.% 3.5.% 3.6.% 3.7.% \\r
3.8.% 3.9.% 3.10.%,$(MY_KERNELRELEASE)),)\r
MOD_OBJS = HGSMIBase.o HGSMICommon.o HGSMIMemAlloc.o heapoffset.o \\r
Modesetting.o vbox_drv.o vbox_fb.o vbox_irq.o vbox_main.o \\r
- vbox_mode.o vbox_ttm.o VBVABase.o\r
+ vbox_mode.o vbox_ttm.o VBVABase.o vbox_prime.o\r
else\r
MOD_OBJS = vbox_dummy.o\r
endif\r
# build defs
EXTRA_CFLAGS += $(MOD_CFLAGS) $(INCL) $(KFLAGS) $(MOD_EXTRA) $(KDEBUG)
+.PHONY: $(MODULE)
all: $(MODULE)
obj-m += $(MODULE).o
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
+# Testing:
+# * Building with KERN_VER set to an installed but non-current kernel works and
+# installs to the right location.
+# * Building with KERN_DIR and/or MODULE_DIR set uses the value specified and
+# the default value for the unspecified one if any.
+
#
# These file should be included by the Makefiles for any kernel modules we
# build as part of the Guest Additions. The intended way of doing this is as
# building from this directory
#
+ # target kernel version
+ ifndef KERN_VER
+ KERN_VER := $(shell uname -r)
+ else
+ ifneq ($(shell if test -d /lib/modules/$(KERN_VER)/build; then echo yes; fi),yes)
+ KERN_VER := $(shell uname -r)
+ endif
+ endif
+
# kernel base directory
ifndef KERN_DIR
- KERN_DIR := /lib/modules/$(shell uname -r)/build
+ KERN_DIR := /lib/modules/$(KERN_VER)/build
ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
KERN_DIR := /usr/src/linux
ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
# module install dir, only for current kernel
ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
ifndef MODULE_DIR
- MODULE_DIR_TST := /lib/modules/$(shell uname -r)
+ MODULE_DIR_TST := /lib/modules/$(KERN_VER)
ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
MODULE_DIR := $(MODULE_DIR_TST)/misc
else
* @param type The return type of the function declaration.\r
*/\r
#if defined(IN_DIS)\r
-# define DISDECL(type) DECLEXPORT(type) VBOXCALL\r
+# ifdef IN_DIS_STATIC\r
+# define DISDECL(type) DECLHIDDEN(type) VBOXCALL\r
+# else\r
+# define DISDECL(type) DECLEXPORT(type) VBOXCALL\r
+# endif\r
#else\r
# define DISDECL(type) DECLIMPORT(type) VBOXCALL\r
#endif\r
*/\r
\r
/*\r
- * Copyright (C) 2006-2016 Oracle Corporation\r
+ * Copyright (C) 2006-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
#define VERR_SUPLIB_NT_PROCESS_UNTRUSTED_4 (-3774)\r
/** Unable to establish trusted of VM process (5). */\r
#define VERR_SUPLIB_NT_PROCESS_UNTRUSTED_5 (-3775)\r
+/** Unable to make text memory writeable (hardening). */\r
+#define VERR_SUPLIB_TEXT_NOT_WRITEABLE (-3776)\r
+/** Unable to seal text memory again to protect against write access (hardening). */\r
+#define VERR_SUPLIB_TEXT_NOT_SEALED (-3777)\r
+/** Unexpected instruction encountered for which there is no patch strategy\r
+ * implemented (hardening). */\r
+#define VERR_SUPLIB_UNEXPECTED_INSTRUCTION (-3778)\r
/** @} */\r
\r
\r
#define VERR_SVM_IPE_4 (-4064)\r
/** Internal SVM processing error no 5. */\r
#define VERR_SVM_IPE_5 (-4065)\r
+/** The nested-guest \#VMEXIT processing failed, initiate shutdown. */\r
+#define VERR_SVM_VMEXIT_FAILED (-4066)\r
+/** An operation caused a nested-guest SVM \#VMEXIT. */\r
+#define VINF_SVM_VMEXIT 4067\r
/** @} */\r
\r
\r
#define VERR_HM_INVALID_HM64ON32OP (-4116)\r
/** Resume guest execution after injecting a double-fault. */\r
#define VINF_HM_DOUBLE_FAULT 4117\r
+/** The requested nested-guest VM-exit intercept is not active or not in\r
+ * nested-guest execution mode. */\r
+#define VINF_HM_INTERCEPT_NOT_ACTIVE 4118\r
/** @} */\r
\r
\r
#define VERR_SUP_VP_FILE_MODE_ERROR (-5674)\r
/** Error creating an event semaphore for used with asynchronous reads. */\r
#define VERR_SUP_VP_CREATE_READ_EVT_SEM_FAILED (-5675)\r
+/** Undesirable module. */\r
+#define VERR_SUP_VP_UNDESIRABLE_MODULE (-5676)\r
\r
/** @} */\r
\r
#define VERR_AUDIO_NO_FREE_OUTPUT_STREAMS (-6602)\r
/** Pending stream disable operation in progress. */\r
#define VERR_AUDIO_STREAM_PENDING_DISABLE (-6603)\r
+/** There is more data available.\r
+ * This can happen due to a buffer wraparound of a buffer read/write operation. */\r
+#define VINF_AUDIO_MORE_DATA_AVAILABLE (6604)\r
/** @} */\r
\r
\r
VBOXOSTYPE_Win81_x64 = 0x3A100,\r
VBOXOSTYPE_Win10 = 0x3B000,\r
VBOXOSTYPE_Win10_x64 = 0x3B100,\r
+ VBOXOSTYPE_Win2k16_x64 = 0x3C100,\r
VBOXOSTYPE_OS2 = 0x40000,\r
VBOXOSTYPE_OS2Warp3 = 0x41000,\r
VBOXOSTYPE_OS2Warp4 = 0x42000,\r
DECLASM(void) ASMXRstor(struct X86XSAVEAREA const *pXStateArea, uint64_t fComponents);\r
\r
\r
+struct X86FXSTATE;\r
+/**\r
+ * Save FPU and SSE CPU state.\r
+ * @param pXStateArea Where to save the state.\r
+ */\r
+DECLASM(void) ASMFxSave(struct X86FXSTATE *pXStateArea);\r
+\r
+/**\r
+ * Load FPU and SSE CPU state.\r
+ * @param pXStateArea Where to load the state from.\r
+ */\r
+DECLASM(void) ASMFxRstor(struct X86FXSTATE const *pXStateArea);\r
+\r
+\r
/**\r
* Enables interrupts (EFLAGS.IF).\r
*/\r
*\r
* @todo Fix name, it is a predicate function but it's not returning boolean!\r
*/\r
-#if !defined(RT_OS_LINUX) || !defined(__KERNEL__)\r
+#if !defined(RDESKTOP) && (!defined(RT_OS_LINUX) || !defined(__KERNEL__))\r
DECLASM(void *) ASMMemFirstNonZero(void const *pv, size_t cb);\r
#else\r
DECLINLINE(void *) ASMMemFirstNonZero(void const *pv, size_t cb)\r
/** RT_CONCAT6 helper, don't use. */\r
#define RT_CONCAT6_HLP(a,b,c,d,e,f) a##b##c##d##e##f\r
\r
+/** @def RT_CONCAT7\r
+ * Concatenate the expanded arguments without any extra spaces in between.\r
+ *\r
+ * @param a The 1st part.\r
+ * @param b The 2nd part.\r
+ * @param c The 3rd part.\r
+ * @param d The 4th part.\r
+ * @param e The 5th part.\r
+ * @param f The 6th part.\r
+ * @param g The 7th part.\r
+ */\r
+#define RT_CONCAT7(a,b,c,d,e,f,g) RT_CONCAT7_HLP(a,b,c,d,e,f,g)\r
+/** RT_CONCAT7 helper, don't use. */\r
+#define RT_CONCAT7_HLP(a,b,c,d,e,f,g) a##b##c##d##e##f##g\r
+\r
+/** @def RT_CONCAT8\r
+ * Concatenate the expanded arguments without any extra spaces in between.\r
+ *\r
+ * @param a The 1st part.\r
+ * @param b The 2nd part.\r
+ * @param c The 3rd part.\r
+ * @param d The 4th part.\r
+ * @param e The 5th part.\r
+ * @param f The 6th part.\r
+ * @param g The 7th part.\r
+ * @param h The 8th part.\r
+ */\r
+#define RT_CONCAT8(a,b,c,d,e,f,g,h) RT_CONCAT8_HLP(a,b,c,d,e,f,g,h)\r
+/** RT_CONCAT8 helper, don't use. */\r
+#define RT_CONCAT8_HLP(a,b,c,d,e,f,g,h) a##b##c##d##e##f##g##h\r
+\r
+/** @def RT_CONCAT9\r
+ * Concatenate the expanded arguments without any extra spaces in between.\r
+ *\r
+ * @param a The 1st part.\r
+ * @param b The 2nd part.\r
+ * @param c The 3rd part.\r
+ * @param d The 4th part.\r
+ * @param e The 5th part.\r
+ * @param f The 6th part.\r
+ * @param g The 7th part.\r
+ * @param h The 8th part.\r
+ * @param i The 9th part.\r
+ */\r
+#define RT_CONCAT9(a,b,c,d,e,f,g,h,i) RT_CONCAT9_HLP(a,b,c,d,e,f,g,h,i)\r
+/** RT_CONCAT9 helper, don't use. */\r
+#define RT_CONCAT9_HLP(a,b,c,d,e,f,g,h,i) a##b##c##d##e##f##g##h##i\r
+\r
/**\r
* String constant tuple - string constant, strlen(string constant).\r
*\r
*/\r
#define RT_ELEMENTS(aArray) ( sizeof(aArray) / sizeof((aArray)[0]) )\r
\r
+/** @def RT_FLEXIBLE_ARRAY\r
+ * What to up inside the square brackets when declaring a structure member\r
+ * with a flexible size.\r
+ *\r
+ * @note Use RT_UOFFSETOF() to calculate the structure size.\r
+ *\r
+ * @note Never to a sizeof() on the structure or member!\r
+ *\r
+ * @note The member must be the last one.\r
+ *\r
+ * @note GCC does not permit using this in a union. So, for unions you must\r
+ * use RT_FLEXIBLE_ARRAY_IN_UNION instead.\r
+ *\r
+ * @note GCC does not permit using this in nested structures, where as MSC\r
+ * does. So, use RT_FLEXIBLE_ARRAY_NESTED for that.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY_NESTED, RT_FLEXIBLE_ARRAY_IN_UNION\r
+ */\r
+#if RT_MSC_PREREQ(RT_MSC_VER_VS2005) /** @todo Probably much much earlier. */ \\r
+ || (defined(__cplusplus) && RT_GNUC_PREREQ(6, 1)) \\r
+ || defined(__WATCOMC__) /* openwatcom 1.9 supports it, we don't care about older atm. */\r
+# define RT_FLEXIBLE_ARRAY\r
+# if defined(__cplusplus) && defined(_MSC_VER)\r
+# pragma warning(disable:4200) /* -wd4200 does not work with VS2010 */\r
+# endif\r
+#elif defined(__STDC_VERSION__)\r
+# if __STDC_VERSION__ >= 1999901L\r
+# define RT_FLEXIBLE_ARRAY\r
+# else\r
+# define RT_FLEXIBLE_ARRAY 1\r
+# endif\r
+#else\r
+# define RT_FLEXIBLE_ARRAY 1\r
+#endif\r
+\r
+/** @def RT_FLEXIBLE_ARRAY_NESTED\r
+ * Variant of RT_FLEXIBLE_ARRAY for use in structures that are nested.\r
+ *\r
+ * GCC only allow the use of flexible array member in the top structure, whereas\r
+ * MSC is less strict and let you do struct { struct { char szName[]; } s; };\r
+ *\r
+ * @note See notes for RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @note GCC does not permit using this in a union. So, for unions you must\r
+ * use RT_FLEXIBLE_ARRAY_IN_NESTED_UNION instead.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ */\r
+#ifdef _MSC_VER\r
+# define RT_FLEXIBLE_ARRAY_NESTED RT_FLEXIBLE_ARRAY\r
+#else\r
+# define RT_FLEXIBLE_ARRAY_NESTED 1\r
+#endif\r
+\r
+/** @def RT_FLEXIBLE_ARRAY_IN_UNION\r
+ * The union version of RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @remarks GCC does not support flexible array members in unions, 6.1.x\r
+ * actively checks for this. Visual C++ 2010 seems happy with it.\r
+ *\r
+ * @note See notes for RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ */\r
+#ifdef _MSC_VER\r
+# define RT_FLEXIBLE_ARRAY_IN_UNION RT_FLEXIBLE_ARRAY\r
+#else\r
+# define RT_FLEXIBLE_ARRAY_IN_UNION 1\r
+#endif\r
+\r
+/** @def RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ * The union version of RT_FLEXIBLE_ARRAY_NESTED.\r
+ *\r
+ * @note See notes for RT_FLEXIBLE_ARRAY.\r
+ *\r
+ * @sa RT_FLEXIBLE_ARRAY, RT_FLEXIBLE_ARRAY_IN_NESTED_UNION\r
+ */\r
+#ifdef _MSC_VER\r
+# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION RT_FLEXIBLE_ARRAY_NESTED\r
+#else\r
+# define RT_FLEXIBLE_ARRAY_IN_NESTED_UNION 1\r
+#endif\r
+\r
/**\r
* Checks if the value is a power of two.\r
*\r
/** @def RT_NOREF9\r
* RT_NOREF_PV shorthand taking nine parameters. */\r
#define RT_NOREF9(var1, var2, var3, var4, var5, var6, var7, var8, var9) \\r
- RT_NOREF_PV(var1); RT_NOREF8(var2, var3, var4, var5, var6, var7, var8)\r
+ RT_NOREF_PV(var1); RT_NOREF8(var2, var3, var4, var5, var6, var7, var8, var9)\r
/** @def RT_NOREF10\r
* RT_NOREF_PV shorthand taking ten parameters. */\r
#define RT_NOREF10(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10) \\r
*/\r
\r
/*\r
- * Copyright (C) 2011-2016 Oracle Corporation\r
+ * Copyright (C) 2011-2017 Oracle Corporation\r
*\r
* This file is part of VirtualBox Open Source Edition (OSE), as\r
* available from http://www.virtualbox.org. This file is free software;\r
# define ASMXRstor_EndProc RT_MANGLER(ASMXRstor_EndProc)\r
# define ASMXSave RT_MANGLER(ASMXSave)\r
# define ASMXSave_EndProc RT_MANGLER(ASMXSave_EndProc)\r
+# define ASMFxRstor RT_MANGLER(ASMFxRstor)\r
+# define ASMFxRstor_EndProc RT_MANGLER(ASMFxRstor_EndProc)\r
+# define ASMFxSave RT_MANGLER(ASMFxSave)\r
+# define ASMFxSave_EndProc RT_MANGLER(ASMFxSave_EndProc)\r
\r
# define RTAssertAreQuiet RT_MANGLER(RTAssertAreQuiet)\r
# define RTAssertMayPanic RT_MANGLER(RTAssertMayPanic)\r
# define RTCircBufFree RT_MANGLER(RTCircBufFree)\r
# define RTCircBufIsReading RT_MANGLER(RTCircBufIsReading)\r
# define RTCircBufIsWriting RT_MANGLER(RTCircBufIsWriting)\r
+# define RTCircBufOffsetRead RT_MANGLER(RTCircBufOffsetRead)\r
+# define RTCircBufOffsetWrite RT_MANGLER(RTCircBufOffsetWrite)\r
# define RTCircBufReleaseReadBlock RT_MANGLER(RTCircBufReleaseReadBlock)\r
# define RTCircBufReleaseWriteBlock RT_MANGLER(RTCircBufReleaseWriteBlock)\r
# define RTCircBufReset RT_MANGLER(RTCircBufReset)\r
# define RTNetIPv6PseudoChecksum RT_MANGLER(RTNetIPv6PseudoChecksum)\r
# define RTNetIPv6PseudoChecksumBits RT_MANGLER(RTNetIPv6PseudoChecksumBits)\r
# define RTNetIPv6PseudoChecksumEx RT_MANGLER(RTNetIPv6PseudoChecksumEx)\r
+# define RTNetMaskToPrefixIPv4 RT_MANGLER(RTNetMaskToPrefixIPv4)\r
+# define RTNetPrefixToMaskIPv4 RT_MANGLER(RTNetPrefixToMaskIPv4)\r
# define RTNetTCPChecksum RT_MANGLER(RTNetTCPChecksum)\r
# define RTNetUDPChecksum RT_MANGLER(RTNetUDPChecksum)\r
# define RTNetStrToMacAddr RT_MANGLER(RTNetStrToMacAddr)\r
# define RTStrHash1ExNV RT_MANGLER(RTStrHash1ExNV)\r
# define RTStrHash1N RT_MANGLER(RTStrHash1N)\r
# define RTStrICmp RT_MANGLER(RTStrICmp)\r
+# define RTStrICmpAscii RT_MANGLER(RTStrICmpAscii)\r
# define RTStrIStartsWith RT_MANGLER(RTStrIStartsWith)\r
# define RTStrIStr RT_MANGLER(RTStrIStr)\r
# define RTStrIsCaseFoldable RT_MANGLER(RTStrIsCaseFoldable)\r
#define RTSTR_F_WIDTH 0x0080\r
#define RTSTR_F_PRECISION 0x0100\r
#define RTSTR_F_THOUSAND_SEP 0x0200\r
+#define RTSTR_F_OBFUSCATE_PTR 0x0400\r
\r
#define RTSTR_F_BIT_MASK 0xf800\r
#define RTSTR_F_8BIT 0x0800\r
RTDECL(int) RTStrNICmp(const char *psz1, const char *psz2, size_t cchMax);\r
\r
/**\r
+ * Performs a case insensitive string compare between a UTF-8 string and a 7-bit\r
+ * ASCII string.\r
+ *\r
+ * This is potentially faster than RTStrICmp and drags in less dependencies. It\r
+ * is really handy for hardcoded inputs.\r
+ *\r
+ * If the string encoding is invalid the function will assert (strict builds)\r
+ * and use RTStrCmp for the remainder of the string.\r
+ *\r
+ * @returns < 0 if the first string less than the second string.\r
+ * @returns 0 if the first string identical to the second string.\r
+ * @returns > 0 if the first string greater than the second string.\r
+ * @param psz1 First UTF-8 string. Null is allowed.\r
+ * @param psz2 Second string, 7-bit ASCII. Null is allowed.\r
+ * @sa RTUtf16ICmpAscii\r
+ */\r
+RTDECL(int) RTStrICmpAscii(const char *psz1, const char *psz2);\r
+\r
+/**\r
* Checks whether @a pszString starts with @a pszStart.\r
*\r
* @returns true / false.\r
-/* $Id: the-linux-kernel.h 109855 2016-08-09 16:35:40Z bird $ */\r
+/* $Id: the-linux-kernel.h 113828 2017-03-08 10:10:39Z fmehnert $ */\r
/** @file\r
* IPRT - Include all necessary headers for the Linux kernel.\r
*/\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)\r
# include <linux/sched/rt.h>\r
#endif\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+# include <linux/sched/signal.h>\r
+# include <linux/sched/types.h>\r
+#endif\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 7)\r
# include <linux/jiffies.h>\r
#endif\r
-#define VBOX_SVN_REV 112924
+#define VBOX_SVN_REV 115126
-/* $Id: vbox_drv.c 111213 2016-10-11 18:43:04Z michael $ */\r
+/* $Id: vbox_drv.c 114121 2017-03-22 16:12:45Z michael $ */\r
/** @file\r
* VirtualBox Additions Linux kernel video driver\r
*/\r
\r
static struct drm_driver driver =\r
{\r
- .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,\r
+ .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_PRIME,\r
.dev_priv_size = 0,\r
\r
.load = vbox_driver_load,\r
#else\r
.dumb_destroy = drm_gem_dumb_destroy,\r
#endif\r
+ .prime_handle_to_fd = drm_gem_prime_handle_to_fd,\r
+ .prime_fd_to_handle = drm_gem_prime_fd_to_handle,\r
+ .gem_prime_export = drm_gem_prime_export,\r
+ .gem_prime_import = drm_gem_prime_import,\r
+ .gem_prime_pin = vbox_gem_prime_pin,\r
+ .gem_prime_unpin = vbox_gem_prime_unpin,\r
+ .gem_prime_get_sg_table = vbox_gem_prime_get_sg_table,\r
+ .gem_prime_import_sg_table = vbox_gem_prime_import_sg_table,\r
+ .gem_prime_vmap = vbox_gem_prime_vmap,\r
+ .gem_prime_vunmap = vbox_gem_prime_vunmap,\r
+ .gem_prime_mmap = vbox_gem_prime_mmap,\r
\r
};\r
\r
-/* $Id: vbox_drv.h 111043 2016-09-29 13:05:15Z fmehnert $ */\r
+/* $Id: vbox_drv.h 114121 2017-03-22 16:12:45Z michael $ */\r
/** @file\r
* VirtualBox Additions Linux kernel video driver\r
*/\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)\r
# include <drm/drm_gem.h>\r
#endif\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+# include <drm/drm_encoder.h>\r
+#endif\r
\r
/* #include "vboxvideo.h" */\r
\r
#undef CURSOR_DATA_SIZE\r
\r
int vbox_driver_load(struct drm_device *dev, unsigned long flags);\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+void vbox_driver_unload(struct drm_device *dev);\r
+#else\r
int vbox_driver_unload(struct drm_device *dev);\r
+#endif\r
void vbox_driver_lastclose(struct drm_device *dev);\r
\r
struct vbox_gem_object;\r
int vbox_bo_push_sysram(struct vbox_bo *bo);\r
int vbox_mmap(struct file *filp, struct vm_area_struct *vma);\r
\r
+/*vbox_prime*/\r
+int vbox_gem_prime_pin(struct drm_gem_object *obj);\r
+void vbox_gem_prime_unpin(struct drm_gem_object *obj);\r
+struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj);\r
+struct drm_gem_object *vbox_gem_prime_import_sg_table(\r
+ struct drm_device *dev,\r
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)\r
+ size_t size,\r
+#else\r
+ struct dma_buf_attachment *attach,\r
+#endif\r
+ struct sg_table *table);\r
+void *vbox_gem_prime_vmap(struct drm_gem_object *obj);\r
+void vbox_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);\r
+int vbox_gem_prime_mmap(struct drm_gem_object *obj,\r
+ struct vm_area_struct *area);\r
+\r
/* vbox_irq.c */\r
int vbox_irq_init(struct vbox_private *vbox);\r
void vbox_irq_fini(struct vbox_private *vbox);\r
-/* $Id: vbox_fb.c 112423 2016-12-19 13:50:38Z michael $ */\r
+/* $Id: vbox_fb.c 113833 2017-03-08 11:37:21Z fmehnert $ */\r
/** @file\r
* VirtualBox Additions Linux kernel video driver\r
*/\r
struct drm_gem_object *obj;\r
struct vbox_bo *bo;\r
int src_offset, dst_offset;\r
- int bpp = (fbdev->afb.base.bits_per_pixel + 7)/8;\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+ int bpp = fbdev->afb.base.format->cpp[0];\r
+#else\r
+ int bpp = (fbdev->afb.base.bits_per_pixel + 7) / 8;\r
+#endif\r
int ret = -EBUSY;\r
bool unmap = false;\r
bool store_for_later = false;\r
info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);\r
info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);\r
\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+ drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);\r
+#else\r
drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);\r
+#endif\r
drm_fb_helper_fill_var(info, &fbdev->helper, sizes->fb_width, sizes->fb_height);\r
\r
info->screen_base = sysram;\r
#else\r
drm_fb_helper_prepare(dev, &fbdev->helper, &vbox_fb_helper_funcs);\r
#endif\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+ ret = drm_fb_helper_init(dev, &fbdev->helper, vbox->num_crtcs);\r
+#else\r
ret = drm_fb_helper_init(dev, &fbdev->helper, vbox->num_crtcs, vbox->num_crtcs);\r
+#endif\r
if (ret)\r
goto free;\r
\r
-/* $Id: vbox_main.c 111043 2016-09-29 13:05:15Z fmehnert $ */\r
+/* $Id: vbox_main.c 113832 2017-03-08 11:30:08Z fmehnert $ */\r
/** @file\r
* VirtualBox Additions Linux kernel video driver\r
*/\r
\r
LogFunc(("vboxvideo: %d: dev=%p, vbox_fb=%p, obj=%p\n", __LINE__, dev,\r
vbox_fb, obj));\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+ drm_helper_mode_fill_fb_struct(dev, &vbox_fb->base, mode_cmd);\r
+#else\r
drm_helper_mode_fill_fb_struct(&vbox_fb->base, mode_cmd);\r
+#endif\r
vbox_fb->obj = obj;\r
ret = drm_framebuffer_init(dev, &vbox_fb->base, &vbox_fb_funcs);\r
if (ret) {\r
return ret;\r
}\r
\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+void vbox_driver_unload(struct drm_device *dev)\r
+#else\r
int vbox_driver_unload(struct drm_device *dev)\r
+#endif\r
{\r
struct vbox_private *vbox = dev->dev_private;\r
\r
kfree(vbox);\r
dev->dev_private = NULL;\r
LogFunc(("vboxvideo: %d\n", __LINE__));\r
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)\r
return 0;\r
+#endif\r
}\r
\r
/** @note this is described in the DRM framework documentation. AST does not\r
-/* $Id: vbox_mode.c 111148 2016-10-06 14:25:37Z michael $ */\r
+/* $Id: vbox_mode.c 113832 2017-03-08 11:30:08Z fmehnert $ */\r
/** @file\r
* VirtualBox Additions Linux kernel video driver\r
*/\r
width = mode->hdisplay ? mode->hdisplay : 640;\r
height = mode->vdisplay ? mode->vdisplay : 480;\r
crtc_id = vbox_crtc->crtc_id;\r
- bpp = crtc->enabled ? CRTC_FB(crtc)->bits_per_pixel : 32;\r
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)\r
- pitch = crtc->enabled ? CRTC_FB(crtc)->pitch : width * bpp / 8;\r
-#else\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+ bpp = crtc->enabled ? CRTC_FB(crtc)->format->cpp[0] * 8 : 32;\r
pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8;\r
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)\r
+ bpp = crtc->enabled ? CRTC_FB(crtc)->bits_per_pixel : 32;\r
+ pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8;\r
+#else\r
+ bpp = crtc->enabled ? CRTC_FB(crtc)->bits_per_pixel : 32;\r
+ pitch = crtc->enabled ? CRTC_FB(crtc)->pitch : width * bpp / 8;\r
#endif\r
/* This is the old way of setting graphics modes. It assumed one screen\r
* and a frame-buffer at the start of video RAM. On older versions of\r
&& vbox_crtc->fb_offset / pitch < 0xffff - crtc->y\r
&& vbox_crtc->fb_offset % (bpp / 8) == 0)\r
VBoxVideoSetModeRegisters(width, height, pitch * 8 / bpp,\r
- CRTC_FB(crtc)->bits_per_pixel, 0,\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)\r
+ CRTC_FB(crtc)->format->cpp[0] * 8,\r
+#else\r
+ CRTC_FB(crtc)->bits_per_pixel,\r
+#endif\r
+ 0,\r
vbox_crtc->fb_offset % pitch / bpp * 8 + crtc->x,\r
vbox_crtc->fb_offset / pitch + crtc->y);\r
flags = VBVA_SCREEN_F_ACTIVE;\r
--- /dev/null
+/*\r
+ * Copyright (C) 2017 Oracle Corporation\r
+ *\r
+ * This file is part of VirtualBox Open Source Edition (OSE), as\r
+ * available from http://www.virtualbox.org. This file is free software;\r
+ * you can redistribute it and/or modify it under the terms of the GNU\r
+ * General Public License (GPL) as published by the Free Software\r
+ * Foundation, in version 2 as it comes in the "COPYING" file of the\r
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the\r
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.\r
+ * --------------------------------------------------------------------\r
+\r
+ * Copyright 2017 Canonical\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a\r
+ * copy of this software and associated documentation files (the "Software"),\r
+ * to deal in the Software without restriction, including without limitation\r
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+ * and/or sell copies of the Software, and to permit persons to whom the\r
+ * Software is furnished to do so, subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in\r
+ * all copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR\r
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\r
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\r
+ * OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * Authors: Andreas Pokorny\r
+ */\r
+\r
+#include "vbox_drv.h"\r
+\r
+/* Based on qxl_prime.c:\r
+ * Empty Implementations as there should not be any other driver for a virtual\r
+ * device that might share buffers with vboxvideo */\r
+\r
+int vbox_gem_prime_pin(struct drm_gem_object *obj)\r
+{\r
+ WARN_ONCE(1, "not implemented");\r
+ return -ENOSYS;\r
+}\r
+\r
+void vbox_gem_prime_unpin(struct drm_gem_object *obj)\r
+{\r
+ WARN_ONCE(1, "not implemented");\r
+}\r
+\r
+\r
+struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj)\r
+{\r
+ WARN_ONCE(1, "not implemented");\r
+ return ERR_PTR(-ENOSYS);\r
+}\r
+\r
+struct drm_gem_object *vbox_gem_prime_import_sg_table(\r
+ struct drm_device *dev,\r
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)\r
+ size_t size,\r
+#else\r
+ struct dma_buf_attachment *attach,\r
+#endif\r
+ struct sg_table *table)\r
+{\r
+ WARN_ONCE(1, "not implemented");\r
+ return ERR_PTR(-ENOSYS);\r
+}\r
+\r
+void *vbox_gem_prime_vmap(struct drm_gem_object *obj)\r
+{\r
+ WARN_ONCE(1, "not implemented");\r
+ return ERR_PTR(-ENOSYS);\r
+}\r
+\r
+void vbox_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)\r
+{\r
+ WARN_ONCE(1, "not implemented");\r
+}\r
+\r
+int vbox_gem_prime_mmap(struct drm_gem_object *obj,\r
+ struct vm_area_struct *area)\r
+{\r
+ WARN_ONCE(1, "not implemented");\r
+ return -ENOSYS;\r
+}\r
-/* $Id: vbox_ttm.c 111753 2016-11-04 12:32:43Z fmehnert $ */\r
+/* $Id: vbox_ttm.c 113832 2017-03-08 11:30:08Z fmehnert $ */\r
/** @file\r
* VirtualBox Additions Linux kernel video driver\r
*/\r
.verify_access = vbox_bo_verify_access,\r
.io_mem_reserve = &vbox_ttm_io_mem_reserve,\r
.io_mem_free = &vbox_ttm_io_mem_free,\r
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)\r
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)\r
.lru_tail = &ttm_bo_default_lru_tail,\r
.swap_lru_tail = &ttm_bo_default_swap_lru_tail,\r
#endif\r
#define VBOX_VERSION_MAJOR 5
#define VBOX_VERSION_MINOR 1
-#define VBOX_VERSION_BUILD 14
-#define VBOX_VERSION_STRING_RAW "5.1.14"
-#define VBOX_VERSION_STRING "5.1.14"
+#define VBOX_VERSION_BUILD 22
+#define VBOX_VERSION_STRING_RAW "5.1.22"
+#define VBOX_VERSION_STRING "5.1.22"
#define VBOX_API_VERSION_STRING "5_1"
#define VBOX_BUILD_SERVER_BUILD 1