Last active
August 31, 2015 08:55
-
-
Save habibutsu/957a9f2d512507b26a64 to your computer and use it in GitHub Desktop.
Patch for NVIDIA driver 340.76 for Linux 4.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: kernel/nv-pat.c | |
| =================================================================== | |
| --- kernel/nv-pat.c.orig | |
| +++ kernel/nv-pat.c | |
| @@ -35,8 +35,13 @@ static inline void nv_disable_caches(uns | |
| 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 @@ static inline void nv_enable_caches(unsi | |
| 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment