summarylogtreecommitdiffstats
path: root/linux-4.0.patch
blob: 0e023c54a23125ebce02a9c695168c4854b62527 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff -Naur nv.orig/nv.c nv/nv.c
--- nv.orig/nv.c	2015-04-16 13:40:32.359209000 +0200
+++ nv/nv.c	2015-04-16 13:43:35.743919299 +0200
@@ -841,8 +841,13 @@
     unsigned long cr0 = read_cr0();
     write_cr0(((cr0 & (0xdfffffff)) | 0x40000000));
     wbinvd();
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
+    *cr4 = __read_cr4();
+    if (*cr4 & 0x80) __write_cr4(*cr4 & ~0x80);
+#else
     *cr4 = read_cr4();
     if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
+#endif
     __flush_tlb();
 }
 
@@ -852,7 +857,11 @@
     wbinvd();
     __flush_tlb();
     write_cr0((cr0 & 0x9fffffff));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
+    if (cr4 & 0x80) __write_cr4(cr4);
+#else
     if (cr4 & 0x80) write_cr4(cr4);
+#endif
 }
 
 static int __determine_pat_mode()