tree-wide: replace config_enabled() with IS_ENABLED()
[cascardo/linux.git] / arch / x86 / kernel / fpu / signal.c
index 06d80f6..a184c21 100644 (file)
@@ -8,6 +8,7 @@
 #include <asm/fpu/internal.h>
 #include <asm/fpu/signal.h>
 #include <asm/fpu/regset.h>
+#include <asm/fpu/xstate.h>
 
 #include <asm/sigframe.h>
 #include <asm/trace/fpu.h>
@@ -158,8 +159,8 @@ int copy_fpstate_to_sigframe(void __user *buf, void __user *buf_fx, int size)
        struct task_struct *tsk = current;
        int ia32_fxstate = (buf != buf_fx);
 
-       ia32_fxstate &= (config_enabled(CONFIG_X86_32) ||
-                        config_enabled(CONFIG_IA32_EMULATION));
+       ia32_fxstate &= (IS_ENABLED(CONFIG_X86_32) ||
+                        IS_ENABLED(CONFIG_IA32_EMULATION));
 
        if (!access_ok(VERIFY_WRITE, buf, size))
                return -EACCES;
@@ -169,7 +170,7 @@ int copy_fpstate_to_sigframe(void __user *buf, void __user *buf_fx, int size)
                        sizeof(struct user_i387_ia32_struct), NULL,
                        (struct _fpstate_32 __user *) buf) ? -1 : 1;
 
-       if (fpregs_active()) {
+       if (fpregs_active() || using_compacted_format()) {
                /* Save the live register state to the user directly. */
                if (copy_fpregs_to_sigframe(buf_fx))
                        return -1;
@@ -267,8 +268,8 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
        u64 xfeatures = 0;
        int fx_only = 0;
 
-       ia32_fxstate &= (config_enabled(CONFIG_X86_32) ||
-                        config_enabled(CONFIG_IA32_EMULATION));
+       ia32_fxstate &= (IS_ENABLED(CONFIG_X86_32) ||
+                        IS_ENABLED(CONFIG_IA32_EMULATION));
 
        if (!buf) {
                fpu__clear(fpu);
@@ -322,8 +323,15 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
                 */
                fpu__drop(fpu);
 
-               if (__copy_from_user(&fpu->state.xsave, buf_fx, state_size) ||
-                   __copy_from_user(&env, buf, sizeof(env))) {
+               if (using_compacted_format()) {
+                       err = copyin_to_xsaves(NULL, buf_fx,
+                                              &fpu->state.xsave);
+               } else {
+                       err = __copy_from_user(&fpu->state.xsave,
+                                              buf_fx, state_size);
+               }
+
+               if (err || __copy_from_user(&env, buf, sizeof(env))) {
                        fpstate_init(&fpu->state);
                        trace_x86_fpu_init_state(fpu);
                        err = -1;
@@ -408,8 +416,8 @@ void fpu__init_prepare_fx_sw_frame(void)
        fx_sw_reserved.xfeatures = xfeatures_mask;
        fx_sw_reserved.xstate_size = fpu_user_xstate_size;
 
-       if (config_enabled(CONFIG_IA32_EMULATION) ||
-           config_enabled(CONFIG_X86_32)) {
+       if (IS_ENABLED(CONFIG_IA32_EMULATION) ||
+           IS_ENABLED(CONFIG_X86_32)) {
                int fsave_header_size = sizeof(struct fregs_state);
 
                fx_sw_reserved_ia32 = fx_sw_reserved;