summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO39
-rw-r--r--4.2-fglrx-has_fpu.patch20
-rw-r--r--4.2-kolasa-fpu_save_init.patch34
-rw-r--r--PKGBUILD47
-rwxr-xr-xcatalyst_build_module2
-rw-r--r--crimson_i686_xg.patch12
-rw-r--r--ubuntu_buildfix_kernel_4.0.patch13
-rw-r--r--ubuntu_buildfix_kernel_4.1.patch29
-rw-r--r--ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch60
-rw-r--r--ubuntu_buildfix_kernel_4.2.patch114
10 files changed, 43 insertions, 327 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 90fe3a20c936..031f915c416a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = catalyst-test
- pkgdesc = AMD/ATI Catalyst drivers for linux. catalyst-hook + catalyst-utils + lib32-catalyst-utils + experimental powerXpress suppport. Radeons HD 2 3 4 xxx ARE NOT SUPPORTED
- pkgver = 15.9
- pkgrel = 6
+ pkgdesc = AMD/ATI Catalyst drivers for linux AKA Crimson. catalyst-hook + catalyst-utils + lib32-catalyst-utils + experimental powerXpress suppport. Radeons HD 2 3 4 k ARE NOT SUPPORTED
+ pkgver = 15.11
+ pkgrel = 2
url = http://www.amd.com
install = catalyst-test.install
arch = i686
@@ -23,19 +23,18 @@ pkgbase = catalyst-test
depends = patch
depends = libxinerama
depends = mesa>=10.1.0-4
- depends = gcc49
optdepends = qt4: to run ATi Catalyst Control Center (amdcccle)
optdepends = libxxf86vm: to run ATi Catalyst Control Center (amdcccle)
optdepends = opencl-headers: headers necessary for OpenCL development
optdepends = acpid: acpi event support / atieventsd
optdepends = procps-ng: brings pgrep used in acpi event support
provides = libgl
- provides = libatical=15.9
- provides = catalyst=15.9
- provides = catalyst-utils=15.9
- provides = catalyst-hook=15.9
- provides = catalyst-libgl=15.9
- provides = opencl-catalyst=15.9
+ provides = libatical=15.11
+ provides = catalyst=15.11
+ provides = catalyst-utils=15.11
+ provides = catalyst-hook=15.11
+ provides = catalyst-libgl=15.11
+ provides = opencl-catalyst=15.11
provides = libcl
provides = dri
provides = libtxc_dxtn
@@ -55,7 +54,7 @@ pkgbase = catalyst-test
options = libtool
options = !strip
options = !upx
- source = http://www2.ati.com/drivers/linux/amd-catalyst-15.9-linux-installer-15.201.1151-x86.x86_64.zip
+ source = http://www2.ati.com/drivers/linux/radeon-crimson-15.11-15.30.1025.zip
source = catalyst_build_module
source = lib32-catalyst.sh
source = catalyst.sh
@@ -78,16 +77,11 @@ pkgbase = catalyst-test
source = lano1106_fglrx_intel_iommu.patch
source = lano1106_kcl_agp_13_4.patch
source = fglrx_gpl_symbol.patch
- 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
- source = ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
source = 4.3-kolasa-seq_printf.patch
source = 4.3-gentoo-mtrr.patch
- md5sums = d2de2df6946b452c266a3c892e6e46ff
- md5sums = f3aaed0084725304cf607f6915e4bfee
+ source = crimson_i686_xg.patch
+ md5sums = 7ba22f465970fbe2bb9ff974beb0a918
+ md5sums = 601d9c756571dd79d26944e54827631e
md5sums = af7fb8ee4fc96fd54c5b483e33dc71c4
md5sums = bdafe749e046bfddee2d1c5e90eabd83
md5sums = 9d9ea496eadf7e883d56723d65e96edf
@@ -109,14 +103,9 @@ pkgbase = catalyst-test
md5sums = 5184b94a2a40216a67996999481dd9ee
md5sums = c5156eddf81c8a1719b160d05a2e8d67
md5sums = ef97fc080ce7e5a275fe0c372bc2a418
- md5sums = 880d5e59554cda382f74206c202942be
- md5sums = 982451bcc1fa1ee3da53ffa481d65581
- md5sums = 88832af8d6769aa51fa9b266a74394e0
- md5sums = ed7748a593d6b894269f8c7856b7ae50
- md5sums = dd51495a1d8f2d1042f04a783bf01e08
- md5sums = 2f7d42fde403a1b4a22e5db8de738d0f
md5sums = 0e0666e95d1d590a7a83192805679485
md5sums = 98828e3eeaec2b3795e584883cc1b746
+ md5sums = 6cdbaf5f71d867d225721a0369413616
pkgname = catalyst-test
diff --git a/4.2-fglrx-has_fpu.patch b/4.2-fglrx-has_fpu.patch
deleted file mode 100644
index 173ec888dc74..000000000000
--- a/4.2-fglrx-has_fpu.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- 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
deleted file mode 100644
index 6d2e4e70c0f5..000000000000
--- a/4.2-kolasa-fpu_save_init.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- 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
diff --git a/PKGBUILD b/PKGBUILD
index 505eb3a3afd3..5a108d3bd723 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -26,16 +26,16 @@
# PKGEXT='.pkg.tar.gz' # imho time to pack this pkg into tar.xz is too long, unfortunatelly yaourt got problems when ext is different from .pkg.tar.xz - V
pkgname=catalyst-test
-pkgver=15.9
-pkgrel=6
+pkgver=15.11
+pkgrel=2
# _betano=1.0
-_amdver=15.201.1151
-pkgdesc="AMD/ATI Catalyst drivers for linux. catalyst-hook + catalyst-utils + lib32-catalyst-utils + experimental powerXpress suppport. Radeons HD 2 3 4 xxx ARE NOT SUPPORTED"
+_amdver=15.30.1025
+pkgdesc="AMD/ATI Catalyst drivers for linux AKA Crimson. catalyst-hook + catalyst-utils + lib32-catalyst-utils + experimental powerXpress suppport. Radeons HD 2 3 4 k ARE NOT SUPPORTED"
arch=('i686' 'x86_64')
url="http://www.amd.com"
license=('custom')
options=('staticlibs' 'libtool' '!strip' '!upx')
-depends=('linux>=3.0' 'linux<4.4' 'linux-headers' 'xorg-server>=1.7.0' 'xorg-server<1.18.0' 'libxrandr' 'libsm' 'fontconfig' 'libxcursor' 'libxi' 'gcc-libs' 'gcc>4.0.0' 'make' 'patch' 'libxinerama' 'mesa>=10.1.0-4' 'gcc49')
+depends=('linux>=3.0' 'linux<4.4' 'linux-headers' 'xorg-server>=1.7.0' 'xorg-server<1.18.0' 'libxrandr' 'libsm' 'fontconfig' 'libxcursor' 'libxi' 'gcc-libs' 'gcc>4.0.0' 'make' 'patch' 'libxinerama' 'mesa>=10.1.0-4')
optdepends=('qt4: to run ATi Catalyst Control Center (amdcccle)'
'libxxf86vm: to run ATi Catalyst Control Center (amdcccle)'
'opencl-headers: headers necessary for OpenCL development'
@@ -68,7 +68,7 @@ source=(
# http://www2.ati.com/drivers/linux/amd-catalyst-${pkgver/./-}-linux-x86-x86-64.zip
# http://www2.ati.com/drivers/linux/amd-catalyst-omega-14.12-linux-run-installers.zip
# http://www2.ati.com/drivers/linux/amd-driver-installer-${_amdver}-x86.x86_64.zip
- http://www2.ati.com/drivers/linux/amd-catalyst-${pkgver}-linux-installer-${_amdver}-x86.x86_64.zip
+ http://www2.ati.com/drivers/linux/radeon-crimson-15.11-15.30.1025.zip
catalyst_build_module
lib32-catalyst.sh
catalyst.sh
@@ -91,17 +91,12 @@ source=(
lano1106_fglrx_intel_iommu.patch
lano1106_kcl_agp_13_4.patch
fglrx_gpl_symbol.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
- ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
4.3-kolasa-seq_printf.patch
- 4.3-gentoo-mtrr.patch)
+ 4.3-gentoo-mtrr.patch
+ crimson_i686_xg.patch)
-md5sums=('d2de2df6946b452c266a3c892e6e46ff'
- 'f3aaed0084725304cf607f6915e4bfee'
+md5sums=('7ba22f465970fbe2bb9ff974beb0a918'
+ '601d9c756571dd79d26944e54827631e'
'af7fb8ee4fc96fd54c5b483e33dc71c4'
'bdafe749e046bfddee2d1c5e90eabd83'
'9d9ea496eadf7e883d56723d65e96edf'
@@ -123,19 +118,14 @@ md5sums=('d2de2df6946b452c266a3c892e6e46ff'
'5184b94a2a40216a67996999481dd9ee'
'c5156eddf81c8a1719b160d05a2e8d67'
'ef97fc080ce7e5a275fe0c372bc2a418'
- '880d5e59554cda382f74206c202942be'
- '982451bcc1fa1ee3da53ffa481d65581'
- '88832af8d6769aa51fa9b266a74394e0'
- 'ed7748a593d6b894269f8c7856b7ae50'
- 'dd51495a1d8f2d1042f04a783bf01e08'
- '2f7d42fde403a1b4a22e5db8de738d0f'
'0e0666e95d1d590a7a83192805679485'
- '98828e3eeaec2b3795e584883cc1b746')
+ '98828e3eeaec2b3795e584883cc1b746'
+ '6cdbaf5f71d867d225721a0369413616')
build() {
## Unpack archive
- /bin/sh ./AMD-Catalyst-${pkgver}-Linux-installer-${_amdver}-x86.x86_64.run --extract archive_files
+ /bin/sh ./fglrx-15.30.1025/amd-driver-installer-${_amdver}-x86.x86_64.run --extract archive_files
# mkdir common
# mv etc lib usr common
# mkdir archive_files
@@ -312,17 +302,12 @@ package() {
patch -Np1 -i ../makefile_compat.patch
patch -Np1 -i ../lano1106_fglrx_intel_iommu.patch
patch -Np1 -i ../lano1106_kcl_agp_13_4.patch
-# test "${CARCH}" = "i686" && patch -Np1 -i ../fglrx_gpl_symbol.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 ../ubuntu_buildfix_kernel_4.0.patch
- patch -Np1 -i ../ubuntu_buildfix_kernel_4.1.patch
- patch -Np1 -i ../ubuntu_buildfix_kernel_4.2.patch
- patch -Np1 -i ../4.2-fglrx-has_fpu.patch
- patch -Np1 -i ../4.2-kolasa-fpu_save_init.patch
- patch -Np1 -i ../ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
+# patch -Np1 -i ../fglrx_gpl_symbol.patch
patch -Np1 -i ../4.3-kolasa-seq_printf.patch
patch -Np1 -i ../4.3-gentoo-mtrr.patch
+ test "${CARCH}" = "i686" && patch -Np1 -i ../crimson_i686_xg.patch
# Prepare modules source files
_archdir=x86_64
diff --git a/catalyst_build_module b/catalyst_build_module
index 0afc3130c19a..02d75f9e4c4a 100755
--- a/catalyst_build_module
+++ b/catalyst_build_module
@@ -35,7 +35,7 @@ install_module(){
## Compile module using _ati_check variables
CFLAGS_MODULE="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions"
- make CC=gcc-4.9 -C /usr/lib/modules/${kernver}/build SUBDIRS="`pwd`" ARCH=${arch} \
+ make -C /usr/lib/modules/${kernver}/build SUBDIRS="`pwd`" ARCH=${arch} \
MODFLAGS="$CFLAGS_MODULE" \
CFLAGS_MODULE="$CFLAGS_MODULE" \
PAGE_ATTR_FIX=$PAGE_ATTR_FIX COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE modules || return 1
diff --git a/crimson_i686_xg.patch b/crimson_i686_xg.patch
new file mode 100644
index 000000000000..e3ce379f33d2
--- /dev/null
+++ b/crimson_i686_xg.patch
@@ -0,0 +1,12 @@
+--- 15.11/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-21 00:35:38.000000000 +0100
++++ 15.11b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-24 22:28:02.113843493 +0100
+@@ -1714,6 +1714,9 @@
+
+ #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)
diff --git a/ubuntu_buildfix_kernel_4.0.patch b/ubuntu_buildfix_kernel_4.0.patch
deleted file mode 100644
index 91ae3ea24f45..000000000000
--- a/ubuntu_buildfix_kernel_4.0.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- 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
deleted file mode 100644
index cf3dda0bfc57..000000000000
--- a/ubuntu_buildfix_kernel_4.1.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-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-build.copy_xregs_to_kernel.patch b/ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
deleted file mode 100644
index b92c64fd5b95..000000000000
--- a/ubuntu_buildfix_kernel_4.2-build.copy_xregs_to_kernel.patch
+++ /dev/null
@@ -1,60 +0,0 @@
---- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-27 10:59:10.121499353 +0200
-+++ 15.9b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-27 10:59:31.869133789 +0200
-@@ -6446,6 +6446,48 @@
- return i;
- }
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
-+/*
-+ * Save processor xstate to xsave area.
-+ */
-+static void _copy_xregs_to_kernel(struct xregs_state *xstate)
-+{
-+ u64 mask = -1;
-+ u32 lmask = mask;
-+ u32 hmask = mask >> 32;
-+ int err = 0;
-+
-+ /*WARN_ON(!alternatives_patched);*/
-+
-+ /*
-+ * If xsaves is enabled, xsaves replaces xsaveopt because
-+ * it supports compact format and supervisor states in addition to
-+ * modified optimization in xsaveopt.
-+ *
-+ * Otherwise, if xsaveopt is enabled, xsaveopt replaces xsave
-+ * because xsaveopt supports modified optimization which is not
-+ * supported by xsave.
-+ *
-+ * If none of xsaves and xsaveopt is enabled, use xsave.
-+ */
-+ alternative_input_2(
-+ "1:"XSAVE,
-+ XSAVEOPT,
-+ X86_FEATURE_XSAVEOPT,
-+ XSAVES,
-+ X86_FEATURE_XSAVES,
-+ [xstate] "D" (xstate), "a" (lmask), "d" (hmask) :
-+ "memory");
-+ asm volatile("2:\n\t"
-+ xstate_fault(err)
-+ : "0" (err)
-+ : "memory");
-+
-+ /* We should never fault when copying to a kernel buffer: */
-+ WARN_ON_FPU(err);
-+}
-+#endif
-+
- /** \brief Generate UUID
- * \param buf pointer to the generated UUID
- * \return None
-@@ -6465,7 +6507,7 @@
- fpu_xsave(fpu);
- if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
- #else
-- copy_xregs_to_kernel(&fpu->state.xsave);
-+ _copy_xregs_to_kernel(&fpu->state.xsave);
- if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
- #endif
- return 1;
diff --git a/ubuntu_buildfix_kernel_4.2.patch b/ubuntu_buildfix_kernel_4.2.patch
deleted file mode 100644
index 9aa71bb11434..000000000000
--- a/ubuntu_buildfix_kernel_4.2.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-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/...."