summarylogtreecommitdiffstats
path: root/ubuntu_buildfix_kernel_4.2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'ubuntu_buildfix_kernel_4.2.patch')
-rw-r--r--ubuntu_buildfix_kernel_4.2.patch114
1 files changed, 114 insertions, 0 deletions
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/...."