diff --git a/pkgs/os-specific/linux/nvidia-x11/legacy304.nix b/pkgs/os-specific/linux/nvidia-x11/legacy304.nix index d5e350a0302a..7f13b6795d47 100644 --- a/pkgs/os-specific/linux/nvidia-x11/legacy304.nix +++ b/pkgs/os-specific/linux/nvidia-x11/legacy304.nix @@ -15,6 +15,8 @@ stdenv.mkDerivation { builder = ./builder-legacy304.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 index c959190023b7..5fdc1fed7272 100644 --- 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 @@ -4,7 +4,7 @@ unsigned long cr0 = read_cr0(); write_cr0(((cr0 & (0xdfffffff)) | 0x40000000)); wbinvd(); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) *cr4 = read_cr4(); if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80); +#else @@ -18,7 +18,7 @@ wbinvd(); __flush_tlb(); write_cr0((cr0 & 0x9fffffff)); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) if (cr4 & 0x80) write_cr4(cr4); +#else + if (cr4 & 0x80) __write_cr4(cr4);