summary refs log tree commit diff
path: root/pkgs/applications/virtualization/virtualbox/linux-4.12.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/virtualization/virtualbox/linux-4.12.patch')
-rw-r--r--pkgs/applications/virtualization/virtualbox/linux-4.12.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/pkgs/applications/virtualization/virtualbox/linux-4.12.patch b/pkgs/applications/virtualization/virtualbox/linux-4.12.patch
new file mode 100644
index 00000000000..7157365466f
--- /dev/null
+++ b/pkgs/applications/virtualization/virtualbox/linux-4.12.patch
@@ -0,0 +1,80 @@
+commit 47fee9325e3b5feed0dbc4ba9e2de77c6d55e3bb
+Author: vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>
+Date:   Wed May 17 09:42:23 2017 +0000
+
+    Runtime/r0drv: Linux 4.12 5-level page table adaptions
+    
+    
+    git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@66927 cfe28804-0f27-0410-a406-dd0f0b0b656f
+
+diff --git a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+index 28dc33f963..41ed058860 100644
+--- a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
++++ b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+@@ -902,6 +902,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
+@@ -917,12 +920,26 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv)
+     u.Global = *pgd_offset(current->active_mm, ulAddr);
+     if (RT_UNLIKELY(pgd_none(u.Global)))
+         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);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+     u.Upper = *pud_offset(&u.Global, ulAddr);
++#endif
+     if (RT_UNLIKELY(pud_none(u.Upper)))
+         return NULL;
+-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+     if (pud_large(u.Upper))
+     {
+         pPage = pud_page(u.Upper);
+@@ -931,8 +948,8 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv)
+         pfn += (ulAddr >> PAGE_SHIFT) & ((UINT32_C(1) << (PUD_SHIFT - PAGE_SHIFT)) - 1);
+         return pfn_to_page(pfn);
+     }
+-# endif
+-
++#endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+     u.Middle = *pmd_offset(&u.Upper, ulAddr);
+ #else  /* < 2.6.11 */
+     u.Middle = *pmd_offset(&u.Global, ulAddr);
+diff --git a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
+index 5afdee9e71..20aab0817f 100644
+--- a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
++++ b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
+@@ -159,6 +159,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