提交 ff347b22 编写于 作者: C Chuck Ebbert 提交者: Linus Torvalds

[PATCH] x86-64: Fix incorrect FP signals

This is the same patch that went into i386 just before 2.6.13
came out.  I still can't build 64-bit user apps, so I tested
with program (see below) in 32-bit mode on 64-bit kernel:

Before:

	$ fpsig
	handler: nr = 8, si = 0x0804bc90, vuc = 0x0804bd10
	handler: altstack is at 0x0804b000, ebp = 0x0804bc7c
	handler: si_signo = 8, si_errno = 0, si_code = 0 [unknown]
	handler: fpu cwd = 0xb40, fpu swd = 0xbaa0
	handler: i387 unmasked precision exception, rounded up

After:

	$ fpsig
	handler: nr = 8, si = 0x0804bc90, vuc = 0x0804bd10
	handler: altstack is at 0x0804b000, ebp = 0x0804bc7c
	handler: si_signo = 8, si_errno = 0, si_code = 6 [inexact result]
	handler: fpu cwd = 0xb40, fpu swd = 0xbaa0
	handler: i387 unmasked precision exception, rounded up
Signed-off-by: NChuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: NAndi Kleen <ak@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 84781576
......@@ -795,13 +795,16 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
*/
cwd = get_fpu_cwd(task);
swd = get_fpu_swd(task);
switch (((~cwd) & swd & 0x3f) | (swd & 0x240)) {
switch (swd & ~cwd & 0x3f) {
case 0x000:
default:
break;
case 0x001: /* Invalid Op */
case 0x041: /* Stack Fault */
case 0x241: /* Stack Fault | Direction */
/*
* swd & 0x240 == 0x040: Stack Underflow
* swd & 0x240 == 0x240: Stack Overflow
* User must clear the SF bit (0x40) if set
*/
info.si_code = FPE_FLTINV;
break;
case 0x002: /* Denormalize */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册