diff options
author | Vi0L0 | 2015-09-29 22:24:23 +0200 |
---|---|---|
committer | Vi0L0 | 2015-09-29 22:24:23 +0200 |
commit | f7b885c9b88094b12220602de3095269442403cd (patch) | |
tree | 710fbee08484f62a3990f24b458a897cfda8631b | |
parent | 1c9d0afc8baba00581d726b54bcc5e3bc85bbda0 (diff) | |
download | aur-f7b885c9b88094b12220602de3095269442403cd.tar.gz |
updated to 15.9
-rw-r--r-- | .SRCINFO | 28 | ||||
-rw-r--r-- | 4.2-fglrx-has_fpu.patch | 20 | ||||
-rw-r--r-- | 4.2-kolasa-fpu_save_init.patch | 34 | ||||
-rw-r--r-- | PKGBUILD | 59 | ||||
-rw-r--r-- | catalyst.install | 12 | ||||
-rw-r--r-- | kolasa-3.19-get_cpu_var.patch | 28 | ||||
-rw-r--r-- | kolasa_4.0-cr4-strn.patch | 70 | ||||
-rw-r--r-- | kolasa_4.1_remove-IRQF_DISABLED.patch | 15 | ||||
-rw-r--r-- | ubuntu_buildfix_kernel_4.0.patch | 13 | ||||
-rw-r--r-- | ubuntu_buildfix_kernel_4.1.patch | 29 | ||||
-rw-r--r-- | ubuntu_buildfix_kernel_4.2.patch | 114 |
11 files changed, 270 insertions, 152 deletions
@@ -1,6 +1,6 @@ pkgbase = catalyst - pkgdesc = AMD/ATI Catalyst drivers for linux. fglrx kernel module only. Radeons HD 2 3 4 xxx ARE NOT SUPPORTED - pkgver = 15.5 + pkgdesc = AMD/ATI Catalyst drivers for linux-lts. fglrx kernel module only. Radeons HD 2 3 4 xxx ARE NOT SUPPORTED + pkgver = 15.9 pkgrel = 1 url = http://www.amd.com install = catalyst.install @@ -11,11 +11,11 @@ pkgbase = catalyst makedepends = gcc>4.0.0 makedepends = make makedepends = linux-headers - depends = linux>=3.0 - depends = linux<4.2 + depends = linux-lts>=3.0 + depends = linux-lts<4.2 depends = catalyst-utils conflicts = catalyst-test - source = http://www2.ati.com/drivers/linux/amd-catalyst-omega-15.5-linux-run-installers.zip + source = http://www2.ati.com/drivers/linux/amd-catalyst-15.9-linux-installer-15.201.1151-x86.x86_64.zip source = ati_make.sh source = makefile_compat.patch source = lano1106_fglrx_intel_iommu.patch @@ -24,10 +24,12 @@ pkgbase = catalyst source = cold-fglrx-3.14-current_euid.patch source = fglrx_gpl_symbol.patch source = fglrx_3.17rc6-no_hotplug.patch - source = kolasa-3.19-get_cpu_var.patch - source = kolasa_4.0-cr4-strn.patch - source = kolasa_4.1_remove-IRQF_DISABLED.patch - md5sums = 979f9f2e0948fa6e92ff0125f5c6b575 + source = ubuntu_buildfix_kernel_4.0.patch + source = ubuntu_buildfix_kernel_4.1.patch + source = ubuntu_buildfix_kernel_4.2.patch + source = 4.2-fglrx-has_fpu.patch + source = 4.2-kolasa-fpu_save_init.patch + md5sums = d2de2df6946b452c266a3c892e6e46ff md5sums = fd98b7e486d7fd4cad8de7b95b5b031e md5sums = 3e1b82bd69774ea808da69c983d6a43b md5sums = 5184b94a2a40216a67996999481dd9ee @@ -36,9 +38,11 @@ pkgbase = catalyst md5sums = ba33b6ef10896d3e1b5e4cd96390b771 md5sums = ef97fc080ce7e5a275fe0c372bc2a418 md5sums = 67a22f624bae95a76638ce269392cb01 - md5sums = 3aa45013515b724a71bbd8e01f98ad99 - md5sums = dee3df1c5d3ed87363f4304da917fc00 - md5sums = 81a9e38dee025151cccb7e5db2362cfb + md5sums = 880d5e59554cda382f74206c202942be + md5sums = 982451bcc1fa1ee3da53ffa481d65581 + md5sums = 88832af8d6769aa51fa9b266a74394e0 + md5sums = ed7748a593d6b894269f8c7856b7ae50 + md5sums = dd51495a1d8f2d1042f04a783bf01e08 pkgname = catalyst diff --git a/4.2-fglrx-has_fpu.patch b/4.2-fglrx-has_fpu.patch new file mode 100644 index 000000000000..173ec888dc74 --- /dev/null +++ b/4.2-fglrx-has_fpu.patch @@ -0,0 +1,20 @@ +--- 15.7/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-07-04 16:31:23.000000000 +0200 ++++ 15.7b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-08-21 15:26:44.860536831 +0200 +@@ -6475,6 +6475,7 @@ + */ + struct task_struct *cur_task = current; + preempt_disable(); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) + /* The thread structure is changed with the commit below for kernel 3.3: + * https://github.com/torvalds/linux/commit/7e16838d94b566a17b65231073d179bc04d590c8 +@@ -6483,6 +6484,9 @@ + #else + if (cur_task->thread.has_fpu) + #endif ++#else ++ if (cur_task->thread.fpu.fpregs_active) ++#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) + KCL_fpu_save_init(cur_task); + #else diff --git a/4.2-kolasa-fpu_save_init.patch b/4.2-kolasa-fpu_save_init.patch new file mode 100644 index 000000000000..6d2e4e70c0f5 --- /dev/null +++ b/4.2-kolasa-fpu_save_init.patch @@ -0,0 +1,34 @@ +--- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-20 18:29:19.488890309 +0200 ++++ 15.9b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-20 14:20:51.000000000 +0200 +@@ -6505,11 +6505,15 @@ + struct task_struct *cur_task = get_current(); + preempt_disable(); + if (cur_thread->status & TS_USEDFPU) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) ++ copy_fpregs_to_fpstate(&cur_task->thread.fpu); ++#else + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) + KCL_fpu_save_init(cur_task); + #else + __save_init_fpu(cur_task); + #endif ++#endif + else + clts(); + +@@ -6531,11 +6535,15 @@ + #else + if (cur_task->thread.fpu.fpregs_active) + #endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) ++ copy_fpregs_to_fpstate(&cur_task->thread.fpu); ++#else + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) + KCL_fpu_save_init(cur_task); + #else + __save_init_fpu(cur_task); + #endif ++#endif + else + clts(); + #endif @@ -8,18 +8,20 @@ # Contributor: lano1106 (patch to improve jacob@amd patch) # Contributor: zoopp # Contributor: Cold (current_euid patch) -# Contributor: kolasa (3.19, 4.0 & 4.1 kernel patch) +# Contributor: ubuntu (parts of 4.0, 4.1 and 4.2 kernel patches) +# Contributor: kolasa (part of 4.2 kernel patches) _kernver=`uname -r` pkgname=catalyst -pkgver=15.5 +pkgver=15.9 pkgrel=1 -pkgdesc="AMD/ATI Catalyst drivers for linux. fglrx kernel module only. Radeons HD 2 3 4 xxx ARE NOT SUPPORTED" +_amdver=15.201.1151 +pkgdesc="AMD/ATI Catalyst drivers for linux-lts. fglrx kernel module only. Radeons HD 2 3 4 xxx ARE NOT SUPPORTED" arch=('i686' 'x86_64') url="http://www.amd.com" license=('custom') -depends=('linux>=3.0' 'linux<4.2' 'catalyst-utils') +depends=('linux-lts>=3.0' 'linux-lts<4.2' 'catalyst-utils') makedepends=('gcc-libs' 'gcc>4.0.0' 'make' 'linux-headers') conflicts=('catalyst-test') install=catalyst.install @@ -28,20 +30,22 @@ url_ref="http://support.amd.com/en-us/download/desktop?os=Linux+x86" DLAGENTS="http::/usr/bin/curl --referer ${url_ref} -o %o %u" source=( - http://www2.ati.com/drivers/linux/amd-catalyst-omega-${pkgver}-linux-run-installers.zip + http://www2.ati.com/drivers/linux/amd-catalyst-${pkgver}-linux-installer-${_amdver}-x86.x86_64.zip ati_make.sh makefile_compat.patch - lano1106_fglrx_intel_iommu.patch - lano1106_kcl_agp_13_4.patch - lano1106_fglrx-13.8_proc.patch - cold-fglrx-3.14-current_euid.patch - fglrx_gpl_symbol.patch - fglrx_3.17rc6-no_hotplug.patch - kolasa-3.19-get_cpu_var.patch - kolasa_4.0-cr4-strn.patch - kolasa_4.1_remove-IRQF_DISABLED.patch) + lano1106_fglrx_intel_iommu.patch + lano1106_kcl_agp_13_4.patch + lano1106_fglrx-13.8_proc.patch + cold-fglrx-3.14-current_euid.patch + fglrx_gpl_symbol.patch + fglrx_3.17rc6-no_hotplug.patch + ubuntu_buildfix_kernel_4.0.patch + ubuntu_buildfix_kernel_4.1.patch + ubuntu_buildfix_kernel_4.2.patch + 4.2-fglrx-has_fpu.patch + 4.2-kolasa-fpu_save_init.patch) -md5sums=('979f9f2e0948fa6e92ff0125f5c6b575' +md5sums=('d2de2df6946b452c266a3c892e6e46ff' 'fd98b7e486d7fd4cad8de7b95b5b031e' '3e1b82bd69774ea808da69c983d6a43b' '5184b94a2a40216a67996999481dd9ee' @@ -50,14 +54,17 @@ md5sums=('979f9f2e0948fa6e92ff0125f5c6b575' 'ba33b6ef10896d3e1b5e4cd96390b771' 'ef97fc080ce7e5a275fe0c372bc2a418' '67a22f624bae95a76638ce269392cb01' - '3aa45013515b724a71bbd8e01f98ad99' - 'dee3df1c5d3ed87363f4304da917fc00' - '81a9e38dee025151cccb7e5db2362cfb') + '880d5e59554cda382f74206c202942be' + '982451bcc1fa1ee3da53ffa481d65581' + '88832af8d6769aa51fa9b266a74394e0' + 'ed7748a593d6b894269f8c7856b7ae50' + 'dd51495a1d8f2d1042f04a783bf01e08') build() { # /bin/sh ./amd-catalyst-${pkgver}-linux-x86.x86_64.run --extract archive_files - /bin/sh ./amd-catalyst-omega-${pkgver}-linux-run-installers.run --extract archive_files +# /bin/sh ./amd-catalyst-omega-${pkgver}-linux-run-installers.run --extract archive_files + /bin/sh ./AMD-Catalyst-${pkgver}-Linux-installer-${_amdver}-x86.x86_64.run --extract archive_files ## include ati_make.sh and use _ati_check function from it . ati_make.sh @@ -77,15 +84,17 @@ build() { patch -Np1 -i ../makefile_compat.patch patch -Np1 -i ../lano1106_fglrx_intel_iommu.patch patch -Np1 -i ../lano1106_kcl_agp_13_4.patch - patch -Np1 -i ../lano1106_fglrx-13.8_proc.patch - patch -Np1 -i ../cold-fglrx-3.14-current_euid.patch - patch -Np1 -i ../fglrx_3.17rc6-no_hotplug.patch - patch -Np1 -i ../kolasa-3.19-get_cpu_var.patch +# patch -Np1 -i ../lano1106_fglrx-13.8_proc.patch +# patch -Np1 -i ../cold-fglrx-3.14-current_euid.patch +# patch -Np1 -i ../fglrx_3.17rc6-no_hotplug.patch # test "${CARCH}" = "i686" && patch -Np1 -i ../fglrx_gpl_symbol.patch # since 3.19 not only i686 needs gpl symbol - V patch -Np1 -i ../fglrx_gpl_symbol.patch - patch -Np1 -i ../kolasa_4.0-cr4-strn.patch - patch -Np1 -i ../kolasa_4.1_remove-IRQF_DISABLED.patch + patch -Np1 -i ../ubuntu_buildfix_kernel_4.0.patch + patch -Np1 -i ../ubuntu_buildfix_kernel_4.1.patch + patch -Np1 -i ../ubuntu_buildfix_kernel_4.2.patch #three 4.2 patches left for testing purposes, use simultaneously - V + patch -Np1 -i ../4.2-fglrx-has_fpu.patch + patch -Np1 -i ../4.2-kolasa-fpu_save_init.patch cd ${srcdir}/archive_files/common/lib/modules/fglrx/build_mod cp ${srcdir}/archive_files/arch/${_archdir}/lib/modules/fglrx/build_mod/libfglrx_ip.a . diff --git a/catalyst.install b/catalyst.install index f1401f0b17bf..1f5cdce260ea 100644 --- a/catalyst.install +++ b/catalyst.install @@ -1,5 +1,5 @@ -KERNEL_VERSION=4.1.0-1-mainline -EXTRAMODULES=extramodules-4.1-mainline +KERNEL_VERSION=4.1.7-rt8-1-rt +EXTRAMODULES=extramodules-4.1-rt dep_extr_mod(){ @@ -15,6 +15,14 @@ whisperer(){ echo "For more info and troubleshooting visit:" echo "http://wiki.archlinux.org/index.php/AMD_Catalyst" echo "----------------------------------------------------------------" + echo -e "\e[1;31m--------------------- NO 4.2 KERNEL SUPPORT---------------------\e[0m" + echo "catalyst doesn't support linux kernels >= 4.2" + echo "please configure bootloader to use proper kernel" + echo "like linux-lts in example" + echo "" + echo "sleeping now for 5 seconds as this is important..." + echo -e "\e[1;31m----------------------------------------------------------------\e[0m" + sleep 5 } diff --git a/kolasa-3.19-get_cpu_var.patch b/kolasa-3.19-get_cpu_var.patch deleted file mode 100644 index 5a571da9fd96..000000000000 --- a/kolasa-3.19-get_cpu_var.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-12-11 00:15:11.000000000 +0100 -+++ 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-01-01 21:39:40.471543282 +0100 -@@ -4823,8 +4823,13 @@ - { - unsigned long orig_level; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -+ orig_level = __this_cpu_read(kasExecutionLevel); -+ __this_cpu_write(kasExecutionLevel,level); -+#else - orig_level = __get_cpu_var(kasExecutionLevel); - __get_cpu_var(kasExecutionLevel) = level; -+#endif - - return orig_level; - } -@@ -4836,7 +4841,11 @@ - */ - static unsigned long kas_GetExecutionLevel(void) - { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) -+ return __this_cpu_read(kasExecutionLevel); -+#else - return __get_cpu_var(kasExecutionLevel); -+#endif - } - - /** \brief Type definition for kas_spin_lock() parameter */ diff --git a/kolasa_4.0-cr4-strn.patch b/kolasa_4.0-cr4-strn.patch deleted file mode 100644 index 7bce698bad33..000000000000 --- a/kolasa_4.0-cr4-strn.patch +++ /dev/null @@ -1,70 +0,0 @@ -diff -uNr 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 14.12_2/common/lib/modules/fglrx/build_mod/firegl_public.c ---- 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-11-28 21:02:10.000000000 +0100 -+++ 14.12_2/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-03-08 13:30:42.565275902 +0100 -@@ -4468,8 +4468,13 @@ - - if (cpu_has_pge) - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - cr4 = read_cr4(); - write_cr4(cr4 & ~X86_CR4_PGE); -+#else -+ cr4 = __read_cr4(); -+ __write_cr4(cr4 & ~X86_CR4_PGE); -+#endif - } - __flush_tlb(); - -@@ -4482,7 +4487,11 @@ - write_cr0(cr0 & 0xbfffffff); - if (cpu_has_pge) - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - write_cr4(cr4); -+#else -+ __write_cr4(cr4); -+#endif - } - local_irq_restore(flags); - -@@ -4509,8 +4518,13 @@ - - if (cpu_has_pge) - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - cr4 = read_cr4(); - write_cr4(cr4 & ~X86_CR4_PGE); -+#else -+ cr4 = __read_cr4(); -+ __write_cr4(cr4 & ~X86_CR4_PGE); -+#endif - } - __flush_tlb(); - -@@ -4522,7 +4536,11 @@ - write_cr0(cr0 & 0xbfffffff); - if (cpu_has_pge) - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - write_cr4(cr4); -+#else -+ __write_cr4(cr4); -+#endif - } - local_irq_restore(flags); - -diff -uNr 14.12/common/lib/modules/fglrx/build_mod/kcl_str.c 14.12_2/common/lib/modules/fglrx/build_mod/kcl_str.c ---- 14.12/common/lib/modules/fglrx/build_mod/kcl_str.c 2014-11-28 21:02:10.000000000 +0100 -+++ 14.12_2/common/lib/modules/fglrx/build_mod/kcl_str.c 2015-03-08 13:25:11.568396701 +0100 -@@ -169,7 +169,11 @@ - const char* s2, - KCL_TYPE_SizeSigned count) - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - return strnicmp(s1, s2, count); -+#else -+ return strncasecmp(s1, s2, count); -+#endif - } - - /** \brief Locate character in string diff --git a/kolasa_4.1_remove-IRQF_DISABLED.patch b/kolasa_4.1_remove-IRQF_DISABLED.patch deleted file mode 100644 index f0b1b62756e9..000000000000 --- a/kolasa_4.1_remove-IRQF_DISABLED.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- 15.3/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-03-06 17:44:48.000000000 +0100 -+++ 15.3/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-06-04 12:12:04.997661763 +0200 -@@ -3496,7 +3496,11 @@ - #else - //when MSI enabled. keep irq disabled when calling the action handler, - //exclude this IRQ from irq balancing (only on one CPU) -- ((useMSI) ? (IRQF_DISABLED | IRQF_NOBALANCING) : (IRQF_SHARED)), -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) -+ ((useMSI) ? (IRQF_DISABLED | IRQF_NOBALANCING) : (IRQF_SHARED)), -+#else -+ ((useMSI) ? (IRQF_NOBALANCING) : (IRQF_SHARED)), -+#endif - #endif - dev_name, - context); diff --git a/ubuntu_buildfix_kernel_4.0.patch b/ubuntu_buildfix_kernel_4.0.patch new file mode 100644 index 000000000000..91ae3ea24f45 --- /dev/null +++ b/ubuntu_buildfix_kernel_4.0.patch @@ -0,0 +1,13 @@ +--- 15.7/common/lib/modules/fglrx/build_mod/kcl_str.c ++++ 15.7b/common/lib/modules/fglrx/build_mod/kcl_str.c +@@ -42,6 +42,10 @@ + #include "kcl_type.h" + #include "kcl_str.h" + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0) ++#define strnicmp strncasecmp ++#endif ++ + /** \brief Fill memory with a constant byte + * \param s Pointer to memory + * \param c Initializing value diff --git a/ubuntu_buildfix_kernel_4.1.patch b/ubuntu_buildfix_kernel_4.1.patch new file mode 100644 index 000000000000..cf3dda0bfc57 --- /dev/null +++ b/ubuntu_buildfix_kernel_4.1.patch @@ -0,0 +1,29 @@ +From 94631bfd9b813d9d2f1af0ea744e7121d72d25c5 Mon Sep 17 00:00:00 2001 +From: Alberto Milone <alberto.milone@canonical.com> +Date: Fri, 10 Jul 2015 16:52:29 +0200 +Subject: [PATCH 1/2] Add support for Linux 4.1 + +Drop the IRQF_DISABLED flag, as it was removed in Linux 4.1 + +Signed-off-by: Alberto Milone <alberto.milone@canonical.com> +--- + firegl_public.c | 4 +++- + kcl_acpi.c | 4 ++++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +--- 15.7/common/lib/modules/fglrx/build_mod/firegl_public.c ++++ 15.7b/common/lib/modules/fglrx/build_mod/firegl_public.c +@@ -3495,10 +3495,12 @@ int ATI_API_CALL KCL_InstallInterruptHandler( + KCL_PUB_InterruptHandlerWrap, + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) + ((useMSI) ? (SA_INTERRUPT) : (SA_SHIRQ)), +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) + //when MSI enabled. keep irq disabled when calling the action handler, + //exclude this IRQ from irq balancing (only on one CPU) + ((useMSI) ? (IRQF_DISABLED) : (IRQF_SHARED)), ++#else ++ ((useMSI) ? (0x0) : (IRQF_SHARED)), + #endif + dev_name, + context);
\ No newline at end of file diff --git a/ubuntu_buildfix_kernel_4.2.patch b/ubuntu_buildfix_kernel_4.2.patch new file mode 100644 index 000000000000..9aa71bb11434 --- /dev/null +++ b/ubuntu_buildfix_kernel_4.2.patch @@ -0,0 +1,114 @@ +From eb7beb0ea51de526e59a0c3edc76530b28ef10e7 Mon Sep 17 00:00:00 2001 +From: Alberto Milone <alberto.milone@canonical.com> +Date: Tue, 14 Jul 2015 12:56:37 +0200 +Subject: [PATCH 1/1] Add support for Linux 4.2 + +Deal with the FPU code renaming +--- + firegl_public.c | 38 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +--- 15.7/common/lib/modules/fglrx/build_mod/firegl_public.c ++++ 15.7b/common/lib/modules/fglrx/build_mod/firegl_public.c +@@ -191,9 +191,17 @@ + #include <linux/string.h> + #include <linux/gfp.h> + #include <linux/swap.h> ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + #include "asm/i387.h" ++#else ++#include <asm/fpu/api.h> ++#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + #include <asm/fpu-internal.h> ++#else ++#include <asm/fpu/internal.h> ++#endif + #endif + + #include "firegl_public.h" +@@ -1698,6 +1706,9 @@ void ATI_API_CALL KCL_SetCurrentProcessState(KCL_ENUM_ProcessState state) + + #if defined(__i386__) + #ifndef __HAVE_ARCH_CMPXCHG ++#ifndef __xg ++#define __xg(x) ((volatile long *)(x)) ++#endif + static inline + unsigned long __fgl_cmpxchg(volatile void *ptr, unsigned long old, + unsigned long new, int size) +@@ -1734,7 +1745,11 @@ unsigned long ATI_API_CALL kcl__cmpxchg(volatile void *ptr, unsigned long old, + unsigned long new, int size) + { + #ifndef __HAVE_ARCH_CMPXCHG ++#if defined(__i386__) + return __fgl_cmpxchg(ptr,old,new,size); ++#elif defined(__x86_64__) ++ return cmpxchg((unsigned long*)ptr,old,new); ++#endif + #else + /* On kernel version 2.6.34 passing a variable or unsupported size + * argument to the __cmpxchg macro causes the default-clause of a +@@ -6430,21 +6445,36 @@ static int KCL_fpu_save_init(struct task_struct *tsk) + struct fpu *fpu = &tsk->thread.fpu; + + if(static_cpu_has(X86_FEATURE_XSAVE)) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + fpu_xsave(fpu); + if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP)) ++#else ++ copy_xregs_to_kernel(&fpu->state.xsave); ++ if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP)) ++#endif + return 1; + } else if (static_cpu_has(X86_FEATURE_FXSR)) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + fpu_fxsave(fpu); ++#else ++ copy_fxregs_to_kernel(fpu); ++#endif + } else { + asm volatile("fnsave %[fx]; fwait" ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + : [fx] "=m" (fpu->state->fsave)); ++#else ++ : [fx] "=m" (fpu->state.fsave)); ++#endif + return 0; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + if (unlikely(fpu->state->fxsave.swd & X87_FSW_ES)) { + asm volatile("fnclex"); + return 0; + } ++#endif + return 1; + } + #endif +@@ -6456,8 +6486,12 @@ static int KCL_fpu_save_init(struct task_struct *tsk) + void ATI_API_CALL KCL_fpu_begin(void) + { + #ifdef CONFIG_X86_64 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + kernel_fpu_begin(); + #else ++ __kernel_fpu_begin(); ++#endif ++#else + #ifdef TS_USEDFPU + struct thread_info *cur_thread = current_thread_info(); + struct task_struct *cur_task = get_current(); +@@ -6502,7 +6536,11 @@ void ATI_API_CALL KCL_fpu_begin(void) + */ + void ATI_API_CALL KCL_fpu_end(void) + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + kernel_fpu_end(); ++#else ++ __kernel_fpu_end(); ++#endif + } + + /** Create new directory entry under "/proc/...." |