diff -ur xorg-driver-video-fglrx-15.9.orig/common/lib/modules/fglrx/build_mod/firegl_public.c xorg-driver-video-fglrx-15.9/common/lib/modules/fglrx/build_mod/firegl_public.c --- xorg-driver-video-fglrx-15.9.orig/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-27 20:53:27.340395813 +0200 +++ xorg-driver-video-fglrx-15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-27 20:54:13.834346677 +0200 @@ -620,8 +628,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); @@ -1703,6 +1716,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) @@ -6422,6 +6442,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 --- a/common/lib/modules/fglrx/build_mod/firegl_public.c 2016-03-30 23:11:47.406938094 +0200 +++ b/common/lib/modules/fglrx/build_mod/firegl_public.c 2016-03-30 23:35:12.447181546 +0200 @@ -6501,7 +6501,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;