summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorVi0L02015-12-13 20:47:56 +0100
committerVi0L02015-12-13 20:47:56 +0100
commitd08c07222be06036a2d73ee1d50bb31c27154646 (patch)
tree7b46add0c6e30f8c189e89080141655cc2b3fb81
parentf7b885c9b88094b12220602de3095269442403cd (diff)
downloadaur-d08c07222be06036a2d73ee1d50bb31c27154646.tar.gz
adding new patch from crimson + removing gcc49 dependency + adding initial grsec kernel support
-rw-r--r--.SRCINFO34
-rw-r--r--4.2-amd-from_crimson_15.11.patch447
-rw-r--r--4.2-fglrx-has_fpu.patch20
-rw-r--r--4.2-kolasa-fpu_save_init.patch34
-rw-r--r--4.3-gentoo-mtrr.patch27
-rw-r--r--4.3-kolasa-seq_printf.patch16
-rw-r--r--PKGBUILD61
-rw-r--r--cold-fglrx-3.14-current_euid.patch14
-rw-r--r--crimson_i686_xg.patch12
-rw-r--r--fglrx_3.17rc6-no_hotplug.patch29
-rw-r--r--grsec_arch.patch70
-rw-r--r--lano1106_fglrx-13.8_proc.patch50
-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.patch114
15 files changed, 611 insertions, 359 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 2d1d41334e4..e55b77a8814 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = catalyst
- pkgdesc = AMD/ATI Catalyst drivers for linux-lts. fglrx kernel module only. Radeons HD 2 3 4 xxx ARE NOT SUPPORTED
+ pkgdesc = AMD/ATI Catalyst drivers for linux. fglrx kernel module only. Radeons HD 2 3 4 xxx ARE NOT SUPPORTED
pkgver = 15.9
- pkgrel = 1
+ pkgrel = 8
url = http://www.amd.com
install = catalyst.install
arch = i686
@@ -11,8 +11,8 @@ pkgbase = catalyst
makedepends = gcc>4.0.0
makedepends = make
makedepends = linux-headers
- depends = linux-lts>=3.0
- depends = linux-lts<4.2
+ depends = linux>=3.0
+ depends = linux<4.4
depends = catalyst-utils
conflicts = catalyst-test
source = http://www2.ati.com/drivers/linux/amd-catalyst-15.9-linux-installer-15.201.1151-x86.x86_64.zip
@@ -20,29 +20,23 @@ pkgbase = catalyst
source = makefile_compat.patch
source = lano1106_fglrx_intel_iommu.patch
source = lano1106_kcl_agp_13_4.patch
- source = lano1106_fglrx-13.8_proc.patch
- source = cold-fglrx-3.14-current_euid.patch
source = fglrx_gpl_symbol.patch
- source = fglrx_3.17rc6-no_hotplug.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 = 4.3-kolasa-seq_printf.patch
+ source = 4.3-gentoo-mtrr.patch
+ source = 4.2-amd-from_crimson_15.11.patch
+ source = crimson_i686_xg.patch
+ source = grsec_arch.patch
md5sums = d2de2df6946b452c266a3c892e6e46ff
md5sums = fd98b7e486d7fd4cad8de7b95b5b031e
md5sums = 3e1b82bd69774ea808da69c983d6a43b
md5sums = 5184b94a2a40216a67996999481dd9ee
md5sums = c5156eddf81c8a1719b160d05a2e8d67
- md5sums = 2ab4837233de42332753882445373d7b
- md5sums = ba33b6ef10896d3e1b5e4cd96390b771
md5sums = ef97fc080ce7e5a275fe0c372bc2a418
- md5sums = 67a22f624bae95a76638ce269392cb01
- md5sums = 880d5e59554cda382f74206c202942be
- md5sums = 982451bcc1fa1ee3da53ffa481d65581
- md5sums = 88832af8d6769aa51fa9b266a74394e0
- md5sums = ed7748a593d6b894269f8c7856b7ae50
- md5sums = dd51495a1d8f2d1042f04a783bf01e08
+ md5sums = 0e0666e95d1d590a7a83192805679485
+ md5sums = 98828e3eeaec2b3795e584883cc1b746
+ md5sums = fd2851026228ca72124972d1ea0335ea
+ md5sums = 6cdbaf5f71d867d225721a0369413616
+ md5sums = 570e0a70aa97edcc5934e3203542d8d6
pkgname = catalyst
diff --git a/4.2-amd-from_crimson_15.11.patch b/4.2-amd-from_crimson_15.11.patch
new file mode 100644
index 00000000000..cd957917b1b
--- /dev/null
+++ b/4.2-amd-from_crimson_15.11.patch
@@ -0,0 +1,447 @@
+diff -uNr 15.12/common/lib/modules/fglrx//build_mod/firegl_public.c 15.12b/common/lib/modules/fglrx//build_mod/firegl_public.c
+--- 15.12/common/lib/modules/fglrx//build_mod/firegl_public.c 2015-09-09 00:57:14.000000000 +0200
++++ 15.12b/common/lib/modules/fglrx//build_mod/firegl_public.c 2015-11-21 00:35:38.000000000 +0100
+@@ -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"
+@@ -1742,7 +1750,11 @@
+ 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
+@@ -3503,10 +3515,12 @@
+ 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)),
++ ((useMSI) ? (IRQF_DISABLED) : (IRQF_SHARED)),
++#else
++ ((useMSI) ? (0x0) : (IRQF_SHARED)),
+ #endif
+ dev_name,
+ context);
+@@ -5031,7 +5045,7 @@
+ orig_level = kasSetExecutionLevel(kasContext.exec_level_ih);
+
+ ret = kasContext.callback_wrapper_ret(ih_routine, ih_context);
+- KCL_DEBUG1(FN_FIREGL_KAS,"Interrupt handler returned 0x%08X\n", ret);
++ KCL_DEBUG1(FN_FIREGL_KAS,"Interrupt handler returned 0x%08X\n", ret);
+
+ kasSetExecutionLevel(orig_level);
+ spin_unlock(&kasContext.lock_ih);
+@@ -6436,21 +6450,36 @@
+ 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))
+- return 1;
++#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)) {
+- fpu_fxsave(fpu);
+- } else {
++#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));
+- return 0;
++#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;
++ asm volatile("fnclex");
++ return 0;
+ }
++#endif
+ return 1;
+ }
+ #endif
+@@ -6462,8 +6491,13 @@
+ 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
++ preempt_disable();
++ __kernel_fpu_begin();
++#endif
++#else
+ #ifdef TS_USEDFPU
+ struct thread_info *cur_thread = current_thread_info();
+ struct task_struct *cur_task = get_current();
+@@ -6487,8 +6521,12 @@
+ /* The thread structure is changed with the commit below for kernel 3.3:
+ * https://github.com/torvalds/linux/commit/7e16838d94b566a17b65231073d179bc04d590c8
+ */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ if (cur_task->thread.fpu.has_fpu)
+ #else
++ if (cur_task->thread.fpu.fpregs_active)
++#endif
++#else
+ if (cur_task->thread.has_fpu)
+ #endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+@@ -6508,7 +6546,12 @@
+ */
+ void ATI_API_CALL KCL_fpu_end(void)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ kernel_fpu_end();
++#else
++ __kernel_fpu_end();
++ preempt_enable();
++#endif
+ }
+
+ /** Create new directory entry under "/proc/...."
+diff -uNr 15.12/common/lib/modules/fglrx//build_mod/kcl_debug.c 15.12b/common/lib/modules/fglrx//build_mod/kcl_debug.c
+--- 15.12/common/lib/modules/fglrx//build_mod/kcl_debug.c 2015-09-09 00:57:14.000000000 +0200
++++ 15.12b/common/lib/modules/fglrx//build_mod/kcl_debug.c 2015-11-21 00:35:38.000000000 +0100
+@@ -35,10 +35,10 @@
+ #include <linux/kernel.h>
+ #include <linux/sysrq.h>
+ #include <linux/thread_info.h>
+-
++#include "firegl_public.h"
+ #include "kcl_debug.h"
+
+-extern void* ATI_API_CALL KCL_MEM_SmallBufferAllocAtomic(unsigned long size);
++extern void* ATI_API_CALL KCL_MEM_SmallBufferAllocAtomic(kcl_size_t size);
+ extern void ATI_API_CALL KCL_MEM_SmallBufferFree(void* p);
+
+ extern int ATI_API_CALL firegl_debug_dump(void);
+@@ -156,6 +156,47 @@
+ KCL_MEM_SmallBufferFree(buffer);
+ }
+
++/** \brief Print debug information to the OS debug console according to traceMask and debugMask
++ * \param traceMask Bit mask of enabled trace function
++ * \param debugMask Bit mask of enabled debug level. 0-7 total
++ * \param name function name
++ * \param line line number inside the file
++ * \param the print parameter
++ * \param fmt printf-like formatting string
++ * \param ... printf-like parameters
++ */
++void ATI_API_CALL KCL_DEBUG_Print_Trace(unsigned int traceMask, unsigned int debugMask, void* name, int line, long param, const char* fmt, ...)
++{
++ int print = firegl_trace(traceMask, debugMask, name, line, param);
++ if(print)
++ {
++ int len;
++ char* buffer=KCL_MEM_SmallBufferAllocAtomic(MAX_STRING_LENGTH);
++ if(buffer==NULL)
++ return;
++ if(fmt == NULL)
++ {
++ buffer[0] = '\n';
++ buffer[1] = '\0';
++ }
++ else
++ {
++ va_list marker;
++ va_start(marker, fmt);
++ kcl_vsnprintf(buffer,255,fmt, marker);
++ va_end(marker);
++ len = strlen(buffer);
++ if(buffer[len-1] != '\n')
++ {
++ buffer[len]='\n';
++ buffer[len+1]='\0';
++ }
++ }
++ KCL_DEBUG_Print("[fglrx] %s:%d %s", (char*)name, line, buffer);
++ KCL_MEM_SmallBufferFree(buffer);
++ }
++}
++
+ /** \brief Register keyboard handler to dump module internal state
+ * \param enable 1 to register the handler, 0 to unregister it
+ * \return 0
+diff -uNr 15.12/common/lib/modules/fglrx//build_mod/kcl_debug.h 15.12b/common/lib/modules/fglrx//build_mod/kcl_debug.h
+--- 15.12/common/lib/modules/fglrx//build_mod/kcl_debug.h 2015-09-09 00:57:14.000000000 +0200
++++ 15.12b/common/lib/modules/fglrx//build_mod/kcl_debug.h 2015-11-21 00:35:38.000000000 +0100
+@@ -64,17 +64,22 @@
+ FN_GENERIC_MAXIMUM = 0x3f
+ } FN_TRACE;
+
+-extern void ATI_API_CALL firegl_trace(unsigned int traceMask,
++extern int ATI_API_CALL firegl_trace(unsigned int traceMask,
+ unsigned int debugMask,
+ void* name,
+ int line,
+- long param,
+- const char* fmt,
+- ...);
++ long param);
+
+ #define MAX_STRING_LENGTH 512
+
+ void ATI_API_CALL KCL_DEBUG_Print(const char* fmt, ...);
++void ATI_API_CALL KCL_DEBUG_Print_Trace(unsigned int traceMask,
++ unsigned int debugMask,
++ void* name,
++ int line,
++ long param,
++ const char* fmt,
++ ...);
+ int ATI_API_CALL KCL_DEBUG_RegKbdHandler(int enable);
+ int ATI_API_CALL KCL_DEBUG_RegKbdDumpHandler(int enable);
+ void ATI_API_CALL KCL_DEBUG_OsDump(void);
+@@ -211,102 +216,106 @@
+ KCL_DEBUG_Print("<6>[fglrx] " fmt, ##arg)
+
+
+-#define KCL_DEBUG_TRACE(m, p, fmt, arg...) \
+- do \
+- { \
+- firegl_trace(m, \
+- FN_DEBUG_TRACE, \
+- (void*)__FUNCTION__, \
+- (int)(__LINE__), \
+- (long)(p), \
+- fmt, \
+- ##arg); \
++#define KCL_DEBUG_TRACE(m, p, fmt, arg...) \
++ do \
++ { \
++ KCL_DEBUG_Print_Trace(m, \
++ FN_DEBUG_TRACE, \
++ (void*)__FUNCTION__, \
++ (int)(__LINE__), \
++ (long)(p), \
++ fmt, \
++ ##arg); \
+ } while (0)
+
+ #define KCL_DEBUG_TRACEIN KCL_DEBUG_TRACE
+
+-#define KCL_DEBUG_TRACEOUT(m, p, fmt, arg...) \
+- do \
+- { \
+- firegl_trace(m, \
+- FN_DEBUG_TRACEOUT, \
+- (void*)__FUNCTION__, \
+- (int)(__LINE__), \
+- (long)(p), \
+- fmt, \
+- ##arg); \
+- } while (0)
+-
+-#define KCL_DEBUG1(m, fmt, arg...) \
+- do \
+- { \
+- firegl_trace(m, \
+- FN_DEBUG_LEVEL1, \
+- (void*)__FUNCTION__, \
+- (int)__LINE__, \
+- 0, \
+- fmt, \
+- ##arg); \
+- } while (0)
+-
+-#define KCL_DEBUG2(m, fmt, arg...) \
+- do \
+- { \
+- firegl_trace(m, \
+- FN_DEBUG_LEVEL2, \
+- (void*)__FUNCTION__, \
+- (int)__LINE__, \
+- 0, \
+- fmt, \
+- ##arg); \
+- } while (0)
+-
+-#define KCL_DEBUG3(m, fmt, arg...) \
+- do \
+- { \
+- firegl_trace(m, \
+- FN_DEBUG_LEVEL3, \
+- (void*)__FUNCTION__, \
+- (int)__LINE__, \
+- 0, \
+- fmt, \
+- ##arg); \
+- } while (0)
+-
+-#define KCL_DEBUG4(m, fmt, arg...) \
+- do \
+- { \
+- firegl_trace(m, \
+- FN_DEBUG_LEVEL4, \
+- (void*)__FUNCTION__, \
+- (int)__LINE__, \
+- 0, \
+- fmt, \
+- ##arg); \
+- } while (0)
+-
+-#define KCL_DEBUG5(m, fmt, arg...) \
+- do \
+- { \
+- firegl_trace(m, \
+- FN_DEBUG_LEVEL5, \
+- (void*)__FUNCTION__, \
+- (int)__LINE__, \
+- 0, \
+- fmt, \
+- ##arg); \
+- } while (0)
+-
+-#define KCL_DEBUG6(m, fmt, arg...) \
+- do \
+- { \
+- firegl_trace(m, \
+- FN_DEBUG_LEVEL6, \
+- (void*)__FUNCTION__, \
+- (int)__LINE__, \
+- 0, \
+- fmt, \
+- ##arg); \
++#define KCL_DEBUG_TRACEOUT(m, p, fmt, arg...) \
++ do \
++ { \
++ KCL_DEBUG_Print_Trace(m, \
++ FN_DEBUG_TRACEOUT, \
++ (void*)__FUNCTION__, \
++ (int)(__LINE__), \
++ (long)(p), \
++ fmt, \
++ ##arg); \
++ } while (0)
++
++
++#define KCL_DEBUG1(m, fmt, arg...) \
++ do \
++ { \
++ KCL_DEBUG_Print_Trace(m, \
++ FN_DEBUG_LEVEL1, \
++ (void*)__FUNCTION__, \
++ (int)(__LINE__), \
++ 0, \
++ fmt, \
++ ##arg); \
++ } while (0)
++
++#define KCL_DEBUG2(m, fmt, arg...) \
++ do \
++ { \
++ KCL_DEBUG_Print_Trace(m, \
++ FN_DEBUG_LEVEL2, \
++ (void*)__FUNCTION__, \
++ (int)(__LINE__), \
++ 0, \
++ fmt, \
++ ##arg); \
++ } while (0)
++
++#define KCL_DEBUG3(m, fmt, arg...) \
++ do \
++ { \
++ KCL_DEBUG_Print_Trace(m, \
++ FN_DEBUG_LEVEL3, \
++ (void*)__FUNCTION__, \
++ (int)(__LINE__), \
++ 0, \
++ fmt, \
++ ##arg); \
++ } while (0)
++
++
++#define KCL_DEBUG4(m, fmt, arg...) \
++ do \
++ { \
++ KCL_DEBUG_Print_Trace(m, \
++ FN_DEBUG_LEVEL4, \
++ (void*)__FUNCTION__, \
++ (int)(__LINE__), \
++ 0, \
++ fmt, \
++ ##arg); \
++ } while (0)
++
++
++#define KCL_DEBUG5(m, fmt, arg...) \
++ do \
++ { \
++ KCL_DEBUG_Print_Trace(m, \
++ FN_DEBUG_LEVEL5, \
++ (void*)__FUNCTION__, \
++ (int)(__LINE__), \
++ 0, \
++ fmt, \
++ ##arg); \
++ } while (0)
++
++
++#define KCL_DEBUG6(m, fmt, arg...) \
++ do \
++ { \
++ KCL_DEBUG_Print_Trace(m, \
++ FN_DEBUG_LEVEL6, \
++ (void*)__FUNCTION__, \
++ (int)(__LINE__), \
++ 0, \
++ fmt, \
++ ##arg); \
+ } while (0)
+
+ #endif
+diff -uNr 15.12/common/lib/modules/fglrx//build_mod/kcl_str.c 15.12b/common/lib/modules/fglrx//build_mod/kcl_str.c
+--- 15.12/common/lib/modules/fglrx//build_mod/kcl_str.c 2015-09-09 00:57:14.000000000 +0200
++++ 15.12b/common/lib/modules/fglrx//build_mod/kcl_str.c 2015-11-21 00:35:38.000000000 +0100
+@@ -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/4.2-fglrx-has_fpu.patch b/4.2-fglrx-has_fpu.patch
deleted file mode 100644
index 173ec888dc7..00000000000
--- 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 6d2e4e70c0f..00000000000
--- 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/4.3-gentoo-mtrr.patch b/4.3-gentoo-mtrr.patch
new file mode 100644
index 00000000000..86d7ffc3cc2
--- /dev/null
+++ b/4.3-gentoo-mtrr.patch
@@ -0,0 +1,27 @@
+--- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-09 00:57:14.000000000 +0200
++++ 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-03 19:00:09.121884973 +0100
+@@ -3412,7 +3412,11 @@
+ int ATI_API_CALL KCL_MEM_MTRR_AddRegionWc(unsigned long base, unsigned long size)
+ {
+ #ifdef CONFIG_MTRR
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
++ return arch_phys_wc_add(base, size);
++#else
+ return mtrr_add(base, size, MTRR_TYPE_WRCOMB, 1);
++#endif
+ #else /* !CONFIG_MTRR */
+ return -EPERM;
+ #endif /* !CONFIG_MTRR */
+@@ -3421,7 +3425,12 @@
+ int ATI_API_CALL KCL_MEM_MTRR_DeleteRegion(int reg, unsigned long base, unsigned long size)
+ {
+ #ifdef CONFIG_MTRR
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
++ arch_phys_wc_del(reg);
++ return reg;
++#else
+ return mtrr_del(reg, base, size);
++#endif
+ #else /* !CONFIG_MTRR */
+ return -EPERM;
+ #endif /* !CONFIG_MTRR */
diff --git a/4.3-kolasa-seq_printf.patch b/4.3-kolasa-seq_printf.patch
new file mode 100644
index 00000000000..6cd08a93aca
--- /dev/null
+++ b/4.3-kolasa-seq_printf.patch
@@ -0,0 +1,16 @@
+--- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-09 00:57:14.000000000 +0200
++++ 15.9b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-02 21:02:06.124639919 +0100
+@@ -623,8 +623,13 @@
+
+ len = snprintf(buf, request, "%d\n", major);
+ #else
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
++ seq_printf(m, "%d\n", major);
++ len = 0;
++#else
+ len = seq_printf(m, "%d\n", major);
+ #endif
++#endif
+
+ KCL_DEBUG1(FN_FIREGL_PROC, "return len=%i\n",len);
+
diff --git a/PKGBUILD b/PKGBUILD
index 5ac9940d677..c3b97554b83 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,21 +7,21 @@
# Contributor: lano1106 (patch to remove dependency of kernel's CONFIG_AGP option)
# Contributor: lano1106 (patch to improve jacob@amd patch)
# Contributor: zoopp
-# Contributor: Cold (current_euid patch)
-# Contributor: ubuntu (parts of 4.0, 4.1 and 4.2 kernel patches)
-# Contributor: kolasa (part of 4.2 kernel patches)
+# Contributor: kolasa (part of 4.3 kernel patches)
+# Contributor: gentoo (part of 4.3 kernel patches)
+
_kernver=`uname -r`
pkgname=catalyst
pkgver=15.9
-pkgrel=1
+pkgrel=8
_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"
+pkgdesc="AMD/ATI Catalyst drivers for linux. 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-lts>=3.0' 'linux-lts<4.2' 'catalyst-utils')
+depends=('linux>=3.0' 'linux<4.4' 'catalyst-utils')
makedepends=('gcc-libs' 'gcc>4.0.0' 'make' 'linux-headers')
conflicts=('catalyst-test')
install=catalyst.install
@@ -30,35 +30,29 @@ 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-${pkgver}-linux-installer-${_amdver}-x86.x86_64.zip
- ati_make.sh
- makefile_compat.patch
+ 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
- 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)
+ 4.3-kolasa-seq_printf.patch
+ 4.3-gentoo-mtrr.patch
+ 4.2-amd-from_crimson_15.11.patch
+ crimson_i686_xg.patch
+ grsec_arch.patch)
md5sums=('d2de2df6946b452c266a3c892e6e46ff'
'fd98b7e486d7fd4cad8de7b95b5b031e'
'3e1b82bd69774ea808da69c983d6a43b'
'5184b94a2a40216a67996999481dd9ee'
'c5156eddf81c8a1719b160d05a2e8d67'
- '2ab4837233de42332753882445373d7b'
- 'ba33b6ef10896d3e1b5e4cd96390b771'
'ef97fc080ce7e5a275fe0c372bc2a418'
- '67a22f624bae95a76638ce269392cb01'
- '880d5e59554cda382f74206c202942be'
- '982451bcc1fa1ee3da53ffa481d65581'
- '88832af8d6769aa51fa9b266a74394e0'
- 'ed7748a593d6b894269f8c7856b7ae50'
- 'dd51495a1d8f2d1042f04a783bf01e08')
+ '0e0666e95d1d590a7a83192805679485'
+ '98828e3eeaec2b3795e584883cc1b746'
+ 'fd2851026228ca72124972d1ea0335ea'
+ '6cdbaf5f71d867d225721a0369413616'
+ '570e0a70aa97edcc5934e3203542d8d6')
build() {
@@ -84,17 +78,12 @@ 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
-# 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 #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
+ patch -Np1 -i ../4.2-amd-from_crimson_15.11.patch
+ patch -Np1 -i ../4.3-kolasa-seq_printf.patch
+ patch -Np1 -i ../4.3-gentoo-mtrr.patch
+ test "${CARCH}" = "i686" && patch -Np1 -i ../fglrx_gpl_symbol.patch
+ test "${CARCH}" = "i686" && patch -Np1 -i ../crimson_i686_xg.patch
+ patch -Np1 -i ../grsec_arch.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/cold-fglrx-3.14-current_euid.patch b/cold-fglrx-3.14-current_euid.patch
deleted file mode 100644
index 77bfe256549..00000000000
--- a/cold-fglrx-3.14-current_euid.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- 14.1/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-02-23 19:26:52.215995002 +0100
-+++ 14.1/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-02-23 19:27:59.320999596 +0100
-@@ -1761,7 +1761,11 @@
- #else
-
- #ifdef current_euid
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
-+ return __kuid_val(current_euid());
-+#else
- return current_euid();
-+#endif
- #else
- return current->euid;
- #endif
diff --git a/crimson_i686_xg.patch b/crimson_i686_xg.patch
new file mode 100644
index 00000000000..e3ce379f33d
--- /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/fglrx_3.17rc6-no_hotplug.patch b/fglrx_3.17rc6-no_hotplug.patch
deleted file mode 100644
index 7fbe1a25064..00000000000
--- a/fglrx_3.17rc6-no_hotplug.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff -uNr 14.9/common/lib/modules/fglrx/build_mod/firegl_public.c 14.9/common/lib/modules/fglrx/build_mod/firegl_public.c
---- 14.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-09-09 16:10:17.000000000 +0200
-+++ 14.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-09-26 19:01:44.000000000 +0200
-@@ -1093,6 +1093,9 @@
- // directly here to allow suspend/resume without X server start.
- firegl_pci_save_state((KCL_PCI_DevHandle)pdev, privdev);
- pci_disable_device(pdev);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
-+ pci_ignore_hotplug(pdev);
-+#endif
- PMSG_EVENT(pdev->dev.power.power_state) = state;
- }
- else
-diff -uNr 14.9/common/lib/modules/fglrx/build_mod/kcl_acpi.c 14.9/common/lib/modules/fglrx/build_mod/kcl_acpi.c
---- 14.9/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2014-09-09 16:10:17.000000000 +0200
-+++ 14.9/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2014-09-26 18:57:27.000000000 +0200
-@@ -840,10 +840,12 @@
- if(tdev != NULL)
- {
- device = (acpi_device_adr(tdev) >> 16) & 0xffff;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
- if(PCI_SLOT(pdev->devfn) == device)
- {
- tdev->flags.no_hotplug = true;
- }
-+#endif
- }
- #endif
- return 0;
diff --git a/grsec_arch.patch b/grsec_arch.patch
new file mode 100644
index 00000000000..152e3a6bd36
--- /dev/null
+++ b/grsec_arch.patch
@@ -0,0 +1,70 @@
+diff -uNr 15.12/common/lib/modules/fglrx//build_mod/firegl_public.c 15.12b/common/lib/modules/fglrx//build_mod/firegl_public.c
+--- 15.12/common/lib/modules/fglrx//build_mod/firegl_public.c 2015-12-13 15:12:03.000000000 +0100
++++ 15.12b/common/lib/modules/fglrx//build_mod/firegl_public.c 2015-12-13 19:40:34.991656996 +0100
+@@ -6468,9 +6468,14 @@
+ fpu_xsave(fpu);
+ if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
+ #else
++#ifdef CONFIG_GRKERNSEC
++ copy_xregs_to_kernel(&fpu->state->xsave);
++ if (!(fpu->state->xsave.header.xfeatures & XSTATE_FP))
++#else
+ copy_xregs_to_kernel(&fpu->state.xsave);
+ if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
+ #endif
++#endif
+ return 1;
+ } else if (static_cpu_has(X86_FEATURE_FXSR)) {
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+@@ -6483,8 +6488,12 @@
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ : [fx] "=m" (fpu->state->fsave));
+ #else
++#ifdef CONFIG_GRKERNSEC
++ : [fx] "=m" (fpu->state->fsave));
++#else
+ : [fx] "=m" (fpu->state.fsave));
+ #endif
++#endif
+ return 0;
+ }
+
+diff -uNr 15.12/common/lib/modules/fglrx//build_mod/kcl_acpi.c 15.12b/common/lib/modules/fglrx//build_mod/kcl_acpi.c
+--- 15.12/common/lib/modules/fglrx//build_mod/kcl_acpi.c 2015-12-13 15:12:03.000000000 +0100
++++ 15.12b/common/lib/modules/fglrx//build_mod/kcl_acpi.c 2015-12-13 19:44:36.774418592 +0100
+@@ -145,7 +145,11 @@
+ return NOTIFY_OK;
+ }
+
++#ifdef CONFIG_GRKERNSEC
++static notifier_block_no_const firegl_acpi_lid_notifier = {
++#else
+ static struct notifier_block firegl_acpi_lid_notifier = {
++#endif
+ .notifier_call = firegl_acpi_lid_event,
+ };
+ #endif
+@@ -400,7 +404,11 @@
+ KCL_DEBUG_ERROR ("Could not allocate enough memory for video notifier_block\n");
+ return -ENOMEM;
+ }
++#ifdef CONFIG_GRKERNSEC
++ ((notifier_block_no_const*)(*nb))->notifier_call = firegl_acpi_video_event;
++#else
+ ((struct notifier_block*)(*nb))->notifier_call = firegl_acpi_video_event;
++#endif
+ return register_acpi_notifier((struct notifier_block*)(*nb));
+ }
+
+@@ -413,7 +421,11 @@
+ KCL_DEBUG_ERROR ("Could not allocate enough memory for ac notifier_block\n");
+ return -ENOMEM;
+ }
++#ifdef CONFIG_GRKERNSEC
++ ((notifier_block_no_const*)(*nb))->notifier_call = firegl_acpi_ac_event;
++#else
+ ((struct notifier_block*)(*nb))->notifier_call = firegl_acpi_ac_event;
++#endif
+ return register_acpi_notifier((struct notifier_block*)(*nb));
+ }
+
diff --git a/lano1106_fglrx-13.8_proc.patch b/lano1106_fglrx-13.8_proc.patch
deleted file mode 100644
index e2ec7c30d0d..00000000000
--- a/lano1106_fglrx-13.8_proc.patch
+++ /dev/null
@@ -1,50 +0,0 @@
---- 13.8/common/lib/modules/fglrx/build_mod/firegl_public.c 2013-09-26 00:59:28.292596334 -0400
-+++ 13.8/common/lib/modules/fglrx/build_mod/firegl_public.c 2013-09-26 01:02:35.036252455 -0400
-@@ -821,7 +821,7 @@ static struct proc_dir_entry *firegl_pro
- KCL_DEBUG1(FN_FIREGL_PROC, "minor %d, proc_list 0x%08lx\n", minor, (unsigned long)proc_list);
- if (!minor)
- {
-- root = KCL_create_proc_dir(NULL, "ati", S_IRUGO|S_IXUGO);
-+ root = KCL_create_proc_dir(NULL, "ati", 0);
- }
-
- if (!root)
-@@ -835,7 +835,7 @@ static struct proc_dir_entry *firegl_pro
- // Global major debice number entry and Global debug entry
- while (globallist->rp || globallist->fops)
- {
-- ent = KCL_create_proc_entry(root, globallist->name, S_IFREG|S_IRUGO, globallist->fops, globallist->rp, globallist->wp, dev);
-+ ent = KCL_create_proc_entry(root, globallist->name, 0, globallist->fops, globallist->rp, globallist->wp, dev);
- if (!ent)
- {
- KCL_remove_proc_dir_entry(NULL, "ati");
-@@ -847,7 +847,7 @@ static struct proc_dir_entry *firegl_pro
- }
-
- sprintf(name, "%d", minor);
-- *dev_root = KCL_create_proc_dir(root, name, S_IRUGO|S_IXUGO);
-+ *dev_root = KCL_create_proc_dir(root, name, 0);
- if (!*dev_root) {
- KCL_remove_proc_dir_entry(root, "major");
- KCL_remove_proc_dir_entry(NULL, "ati");
-@@ -857,7 +857,7 @@ static struct proc_dir_entry *firegl_pro
-
- while (list->rp || list->fops)
- {
-- ent = KCL_create_proc_entry(*dev_root, list->name, S_IFREG|S_IRUGO, list->fops, list->rp, list->wp,
-+ ent = KCL_create_proc_entry(*dev_root, list->name, 0, list->fops, list->rp, list->wp,
- ((dev->pubdev.signature == FGL_DEVICE_SIGNATURE)? firegl_find_device(minor) : (dev)));
- if (!ent)
- {
-@@ -6358,9 +6358,9 @@ void * KCL_create_proc_dir(void *root_di
- dir = create_proc_entry(name, S_IFDIR | access, (struct proc_dir_entry *)root_dir);
- #else
- if (root_dir == NULL)
-- dir = proc_mkdir_mode(name, S_IFDIR | access, NULL);
-+ dir = proc_mkdir_mode(name, access, NULL);
- else
-- dir = proc_mkdir_mode(name, S_IFDIR | access, (struct proc_dir_entry *)root_dir);
-+ dir = proc_mkdir_mode(name, access, (struct proc_dir_entry *)root_dir);
- #endif
-
- return dir;
diff --git a/ubuntu_buildfix_kernel_4.0.patch b/ubuntu_buildfix_kernel_4.0.patch
deleted file mode 100644
index 91ae3ea24f4..00000000000
--- 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 cf3dda0bfc5..00000000000
--- 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.patch b/ubuntu_buildfix_kernel_4.2.patch
deleted file mode 100644
index 9aa71bb1143..00000000000
--- 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/...."