#define XRSTOR ".byte " REX_PREFIX "0x0f,0xae,0x2f"
#define XRSTORS ".byte " REX_PREFIX "0x0f,0xc7,0x1f"
-#define xstate_fault ".section .fixup,\"ax\"\n" \
- "3: movl $-1,%[err]\n" \
- " jmp 2b\n" \
- ".previous\n" \
- _ASM_EXTABLE(1b, 3b) \
- : [err] "=r" (err)
+/* xstate instruction fault handler: */
+#define xstate_fault(__err) \
+ \
+ ".section .fixup,\"ax\"\n" \
+ \
+ "3: movl $-1,%[err]\n" \
+ " jmp 2b\n" \
+ \
+ ".previous\n" \
+ \
+ _ASM_EXTABLE(1b, 3b) \
+ : [err] "=r" (__err)
/*
* This function is called only during boot time when x86 caps are not set
if (boot_cpu_has(X86_FEATURE_XSAVES))
asm volatile("1:"XSAVES"\n\t"
"2:\n\t"
- xstate_fault
+ xstate_fault(err)
: "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
: "memory");
else
asm volatile("1:"XSAVE"\n\t"
"2:\n\t"
- xstate_fault
+ xstate_fault(err)
: "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
: "memory");
return err;
if (boot_cpu_has(X86_FEATURE_XSAVES))
asm volatile("1:"XRSTORS"\n\t"
"2:\n\t"
- xstate_fault
+ xstate_fault(err)
: "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
: "memory");
else
asm volatile("1:"XRSTOR"\n\t"
"2:\n\t"
- xstate_fault
+ xstate_fault(err)
: "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
: "memory");
return err;
[fx] "D" (fx), "a" (lmask), "d" (hmask) :
"memory");
asm volatile("2:\n\t"
- xstate_fault
+ xstate_fault(err)
: "0" (0)
: "memory");
: "memory");
asm volatile("2:\n"
- xstate_fault
+ xstate_fault(err)
: "0" (0)
: "memory");
__asm__ __volatile__(ASM_STAC "\n"
"1:"XSAVE"\n"
"2: " ASM_CLAC "\n"
- xstate_fault
+ xstate_fault(err)
: "D" (buf), "a" (-1), "d" (-1), "0" (0)
: "memory");
return err;
__asm__ __volatile__(ASM_STAC "\n"
"1:"XRSTOR"\n"
"2: " ASM_CLAC "\n"
- xstate_fault
+ xstate_fault(err)
: "D" (xstate), "a" (lmask), "d" (hmask), "0" (0)
: "memory"); /* memory required? */
return err;