git.iko.soy/typeable/nixpkgs
on master help sign in
linuxPackages.nvidia_x11_legacy340: fix cr4 references

Patch was copied from here: https://devtalk.nvidia.com/default/topic/813458/linux-4-0-rc1-346-47-build-error-_cr4-functions-fix/ Reference to kernel change, also noted in the forum post: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/arch/x86/include/asm/paravirt.h?id=1e02ce4cccdcb9688386e5b8d2c9fa4660b45389

commit6257425dabe7ad9190d7e5d5fab3d0bc5dad366e authorEdward Tjörnhammar <ed@cflags.cc> dateFri 3 Jul 2015, 09:28 (11 years ago) parent8e16c57
2 files changed+30
pkgs/os-specific/linux/nvidia-x11/legacy340.nix+2 pkgs/os-specific/linux/nvidia-x11/nvidia-340.76-kernel-4.0.patch+28
pkgs/os-specific/linux/nvidia-x11/legacy340.nix+2
@@ -25,6 +25,8 @@ stdenv.mkDerivation {
2525
2626 builder = ./builder-legacy340.sh;
2727
28+ patches = [ ./nvidia-340.76-kernel-4.0.patch ];
29+
2830 src =
2931 if stdenv.system == "i686-linux" then
3032 fetchurl {
pkgs/os-specific/linux/nvidia-x11/nvidia-340.76-kernel-4.0.patchnew file+28
@@ -0,0 +1,28 @@
1+--- a/kernel/nv-pat.c 2015-07-03 08:39:35.417031728 +0200
2++++ b/kernel/nv-pat.c 2015-07-03 08:42:15.631838988 +0200
3+@@ -35,8 +35,13 @@
4+ unsigned long cr0 = read_cr0();
5+ write_cr0(((cr0 & (0xdfffffff)) | 0x40000000));
6+ wbinvd();
7++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0)
8+ *cr4 = read_cr4();
9+ if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
10++#else
11++ *cr4 = __read_cr4();
12++ if (*cr4 & 0x80) __write_cr4(*cr4 & ~0x80);
13++#endif
14+ __flush_tlb();
15+ }
16+
17+@@ -46,7 +51,11 @@
18+ wbinvd();
19+ __flush_tlb();
20+ write_cr0((cr0 & 0x9fffffff));
21++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0)
22+ if (cr4 & 0x80) write_cr4(cr4);
23++#else
24++ if (cr4 & 0x80) __write_cr4(cr4);
25++#endif
26+ }
27+
28+ static int nv_determine_pat_mode(void)