From 6257425dabe7ad9190d7e5d5fab3d0bc5dad366e Mon Sep 17 00:00:00 2001 From: Edward Tjörnhammar Date: Fri, 3 Jul 2015 09:28:07 +0200 Subject: 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 --- pkgs/os-specific/linux/nvidia-x11/legacy340.nix | 2 ++ .../nvidia-x11/nvidia-340.76-kernel-4.0.patch | 28 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/os-specific/linux/nvidia-x11/nvidia-340.76-kernel-4.0.patch (limited to 'pkgs/os-specific/linux') diff --git a/pkgs/os-specific/linux/nvidia-x11/legacy340.nix b/pkgs/os-specific/linux/nvidia-x11/legacy340.nix index 7fcdb40de03a..a53906ed0200 100644 --- a/pkgs/os-specific/linux/nvidia-x11/legacy340.nix +++ b/pkgs/os-specific/linux/nvidia-x11/legacy340.nix @@ -25,6 +25,8 @@ stdenv.mkDerivation { builder = ./builder-legacy340.sh; + patches = [ ./nvidia-340.76-kernel-4.0.patch ]; + src = if stdenv.system == "i686-linux" then fetchurl { diff --git a/pkgs/os-specific/linux/nvidia-x11/nvidia-340.76-kernel-4.0.patch b/pkgs/os-specific/linux/nvidia-x11/nvidia-340.76-kernel-4.0.patch new file mode 100644 index 000000000000..c959190023b7 --- /dev/null +++ b/pkgs/os-specific/linux/nvidia-x11/nvidia-340.76-kernel-4.0.patch @@ -0,0 +1,28 @@ +--- a/kernel/nv-pat.c 2015-07-03 08:39:35.417031728 +0200 ++++ b/kernel/nv-pat.c 2015-07-03 08:42:15.631838988 +0200 +@@ -35,8 +35,13 @@ + unsigned long cr0 = read_cr0(); + write_cr0(((cr0 & (0xdfffffff)) | 0x40000000)); + wbinvd(); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 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(); + } + +@@ -46,7 +51,11 @@ + wbinvd(); + __flush_tlb(); + write_cr0((cr0 & 0x9fffffff)); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0) + if (cr4 & 0x80) write_cr4(cr4); ++#else ++ if (cr4 & 0x80) __write_cr4(cr4); ++#endif + } + + static int nv_determine_pat_mode(void) -- cgit 1.4.1