]> git.baikalelectronics.ru Git - kernel.git/commit
x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 26 Jul 2013 16:11:56 +0000 (09:11 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Fri, 26 Jul 2013 16:11:56 +0000 (09:11 -0700)
commite545ca6f7356a41bddf3533253318a1017483aba
treec6ccf3fffc6f575e322ba84ed1de80cda14f49a3
parente0683b505a69a678e77e68d8e729fcfabbd6258d
x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz

GCC will optimize mxcsr_feature_mask_init in arch/x86/kernel/i387.c:

memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
asm volatile("fxsave %0" : : "m" (fx_scratch));
mask = fx_scratch.mxcsr_mask;
if (mask == 0)
mask = 0x0000ffbf;

to

memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
asm volatile("fxsave %0" : : "m" (fx_scratch));
mask = 0x0000ffbf;

since asm statement doesn’t say it will update fx_scratch.  As the
result, the DAZ bit will be cleared.  This patch fixes it. This bug
dates back to at least kernel 2.6.12.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@vger.kernel.org>
arch/x86/kernel/i387.c