Skip to content

Commit fd35fbc

Browse files
author
H. Peter Anvin
committed
x86-64, asm: Use fxsaveq/fxrestorq in more places
Checkin d7acb92 made use of fxsaveq in fpu_fxsave() if the assembler supports it; this adds fxsaveq/fxrstorq to fxrstor_checking() and fxsave_user() as well. Reported-by: Linus Torvalds <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: H. Peter Anvin <[email protected]>
1 parent f5d9d24 commit fd35fbc

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

arch/x86/include/asm/i387.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
9393
int err;
9494

9595
/* See comment in fxsave() below. */
96+
#ifdef CONFIG_AS_FXSAVEQ
97+
asm volatile("1: fxrstorq %[fx]\n\t"
98+
"2:\n"
99+
".section .fixup,\"ax\"\n"
100+
"3: movl $-1,%[err]\n"
101+
" jmp 2b\n"
102+
".previous\n"
103+
_ASM_EXTABLE(1b, 3b)
104+
: [err] "=r" (err)
105+
: [fx] "m" (*fx), "0" (0));
106+
#else
96107
asm volatile("1: rex64/fxrstor (%[fx])\n\t"
97108
"2:\n"
98109
".section .fixup,\"ax\"\n"
@@ -102,6 +113,7 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
102113
_ASM_EXTABLE(1b, 3b)
103114
: [err] "=r" (err)
104115
: [fx] "R" (fx), "m" (*fx), "0" (0));
116+
#endif
105117
return err;
106118
}
107119

@@ -119,6 +131,17 @@ static inline int fxsave_user(struct i387_fxsave_struct __user *fx)
119131
return -EFAULT;
120132

121133
/* See comment in fxsave() below. */
134+
#ifdef CONFIG_AS_FXSAVEQ
135+
asm volatile("1: fxsaveq %[fx]\n\t"
136+
"2:\n"
137+
".section .fixup,\"ax\"\n"
138+
"3: movl $-1,%[err]\n"
139+
" jmp 2b\n"
140+
".previous\n"
141+
_ASM_EXTABLE(1b, 3b)
142+
: [err] "=r" (err), [fx] "=m" (*fx)
143+
: "0" (0));
144+
#else
122145
asm volatile("1: rex64/fxsave (%[fx])\n\t"
123146
"2:\n"
124147
".section .fixup,\"ax\"\n"
@@ -128,6 +151,7 @@ static inline int fxsave_user(struct i387_fxsave_struct __user *fx)
128151
_ASM_EXTABLE(1b, 3b)
129152
: [err] "=r" (err), "=m" (*fx)
130153
: [fx] "R" (fx), "0" (0));
154+
#endif
131155
if (unlikely(err) &&
132156
__clear_user(fx, sizeof(struct i387_fxsave_struct)))
133157
err = -EFAULT;

0 commit comments

Comments
 (0)