Skip to contentSkip to conversation

i386: fix merge mistake in i387.c

PATCH In review Jan Beulich 2 participants 2 messages Mar 5, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386: fix merge mistake in i387.c

convert_fxsr_to_user() in 2.6.24's i387_32.c did this, and convert_to_fxsr() also does the inverse, so I assume it's an oversight that it is no longer being done.

---
 arch/x86/kernel/i387.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/i387.c +1 -1
@@ -261,7 +261,7 @@ static void convert_from_fxsr(struct use
 	}
 #else
 	env->fip = fxsave->fip;
-	env->fcs = fxsave->fcs;
+	env->fcs = (u16) fxsave->fcs | ((u32) fxsave->fop << 16);
 	env->foo = fxsave->foo;
 	env->fos = fxsave->fos;
 #endif
#1 lore raw
Quoted 3 lines · Jan Beulich

convert_fxsr_to_user() in 2.6.24's i387_32.c did this, and convert_to_fxsr() also does the inverse, so I assume it's an oversight that it is no longer being done.

thanks Jan, applied.

arch/x86/kernel/i387.c static void convert_from_fxsr(struct use · line 264

Quoted 2 lines
arch/x86/kernel/i387.c +1 -1
-	env->fcs = fxsave->fcs;
+	env->fcs = (u16) fxsave->fcs | ((u32) fxsave->fop << 16);

we encode it this way because there's no space for the 'FPU Last Instruction Opcode' (->fop) field in the legacy user_i387_ia32_struct that ptrace PTRACE_GETFPREGS/PTRACE_SETFPREGS uses.

it's probably pure legacy - i'd be surprised if any user-space relied on the FPU Last Opcode in any way. But indeed we used to do it previously so the most conservative thing is to preserve that piece of information.

FXRESTORE ignores the FOP field so the "restore" direction is meaningless:

    fxsave->fop = (u16) ((u32) env->fcs >> 16);

	Ingo