Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ObserverHerb/088859a4acb9492b306d046b67fbbfbb to your computer and use it in GitHub Desktop.
Save ObserverHerb/088859a4acb9492b306d046b67fbbfbb to your computer and use it in GitHub Desktop.
virtualbox-modules-5.0.40 vs. kernel 4.14 release
diff --git work/vboxdrv/r0drv/linux/memobj-r0drv-linux.c b/work/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
index c9feddf..1acf6de 100644
--- work/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
+++ work/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
@@ -901,6 +901,9 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv)
union
{
pgd_t Global;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ p4d_t Four;
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
pud_t Upper;
#endif
@@ -918,7 +921,23 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv)
return NULL;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ u.Four = *p4d_offset(&u.Global, ulAddr);
+ if (RT_UNLIKELY(p4d_none(u.Four)))
+ return NULL;
+ if (p4d_large(u.Four))
+ {
+ pPage = p4d_page(u.Four);
+ AssertReturn(pPage, NULL);
+ pfn = page_to_pfn(pPage); /* doing the safe way... */
+ AssertCompile(P4D_SHIFT - PAGE_SHIFT < 31);
+ pfn += (ulAddr >> PAGE_SHIFT) & ((UINT32_C(1) << (P4D_SHIFT - PAGE_SHIFT)) - 1);
+ return pfn_to_page(pfn);
+ }
+ u.Upper = *pud_offset(&u.Four, ulAddr);
+# else /* < 4.12 */
u.Upper = *pud_offset(&u.Global, ulAddr);
+# endif /* < 4.12 */
if (RT_UNLIKELY(pud_none(u.Upper)))
return NULL;
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
diff --git work/vboxdrv/r0drv/linux/the-linux-kernel.h b/work/vboxdrv/r0drv/linux/the-linux-kernel.h
index 1e0236f..aff5441 100644
--- work/vboxdrv/r0drv/linux/the-linux-kernel.h
+++ work/vboxdrv/r0drv/linux/the-linux-kernel.h
@@ -39,7 +39,7 @@
# include <generated/autoconf.h>
#else
# ifndef AUTOCONF_INCLUDED
-# include <generated/autoconf.h>
+# include <linux/autoconf.h>
# endif
#endif
@@ -149,6 +149,11 @@
# include <asm/tlbflush.h>
#endif
+/* for set_pages_x() */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+# include <asm/set_memory.h>
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
# include <asm/smap.h>
#else
diff --git work/vboxnetflt/linux/VBoxNetFlt-linux.c b/work/vboxnetflt/linux/VBoxNetFlt-linux.c
index f4011f5..5667148 100644
--- work/vboxnetflt/linux/VBoxNetFlt-linux.c
+++ work/vboxnetflt/linux/VBoxNetFlt-linux.c
@@ -71,6 +71,8 @@ typedef struct VBOXNETFLTNOTIFIER {
typedef struct VBOXNETFLTNOTIFIER *PVBOXNETFLTNOTIFIER;
+
+
/*********************************************************************************************************************************
* Defined Constants And Macros *
*********************************************************************************************************************************/
@@ -126,6 +128,10 @@ typedef struct VBOXNETFLTNOTIFIER *PVBOXNETFLTNOTIFIER;
# endif
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
+#define SKB_GSO_UDP 0
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0)
# define VBOX_HAVE_SKB_VLAN
#else
diff --git work/vboxpci/linux/VBoxPci-linux.c b/work/vboxpci/linux/VBoxPci-linux.c
index 2041ac7..0477862 100644
--- work/vboxpci/linux/VBoxPci-linux.c
+++ work/vboxpci/linux/VBoxPci-linux.c
@@ -353,12 +353,16 @@ static void vboxPciFileClose(struct file* file)
static int vboxPciFileWrite(struct file* file, unsigned long long offset, unsigned char* data, unsigned int size)
{
int ret;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
+ ret = kernel_write(file, data, size, &offset);
+#else
mm_segment_t fs_save;
fs_save = get_fs();
set_fs(get_ds());
ret = vfs_write(file, data, size, &offset);
set_fs(fs_save);
+#endif
if (ret < 0)
printk(KERN_DEBUG "vboxPciFileWrite: error %d\n", ret);
--- work/vboxdrv/r0drv/linux/waitqueue-r0drv-linux.h 2017-05-28 17:18:48.486626052 -0400
+++ work/vboxdrv/r0drv/linux/waitqueue-r0drv-linux.hb 2017-07-04 23:38:48.235213259 -0400
@@ -46,7 +46,7 @@
typedef struct RTR0SEMLNXWAIT
{
/** The wait queue entry. */
- wait_queue_t WaitQE;
+ wait_queue_entry_t WaitQE;
/** The absolute timeout given as nano seconds since the start of the
* monotonic clock. */
uint64_t uNsAbsTimeout;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment