mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander van Heukelum <heukelum@fastmail.fm>
To: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Alexander van Heukelum <heukelum@fastmail.fm>
Subject: [PATCH 1/4] traps: x86_64: split out math_error and simd_math_error
Date: Tue, 30 Sep 2008 18:41:34 +0200	[thread overview]
Message-ID: <1222792897-5691-2-git-send-email-heukelum@fastmail.fm> (raw)
In-Reply-To: <1222792897-5691-1-git-send-email-heukelum@fastmail.fm>

Split out math_error from do_coprocessor_error and simd_math_error
from do_simd_coprocessor_error, like on i386. While at it, add the
"error_code" parameter to do_coprocessor_error, do_simd_coprocessor_error
and do_spurious_interrupt_bug. This does not change the generated
code, but brings the declarations in line with all the other trap
handlers.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
---
 arch/x86/kernel/traps_64.c |   36 +++++++++++++++++++++---------------
 include/asm-x86/traps.h    |    6 +++---
 2 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 8ab8f81..201f98d 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -457,18 +457,12 @@ static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr)
  * the correct behaviour even in the presence of the asynchronous
  * IRQ13 behaviour
  */
-asmlinkage void do_coprocessor_error(struct pt_regs *regs)
+void math_error(void __user *ip)
 {
-	void __user *ip = (void __user *)(regs->ip);
 	struct task_struct *task;
 	siginfo_t info;
 	unsigned short cwd, swd;
 
-	conditional_sti(regs);
-	if (!user_mode(regs) &&
-	    kernel_math_error(regs, "kernel x87 math error", 16))
-		return;
-
 	/*
 	 * Save the info for the exception handler and clear the error.
 	 */
@@ -521,23 +515,26 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
 	force_sig_info(SIGFPE, &info, task);
 }
 
+asmlinkage void do_coprocessor_error(struct pt_regs *regs, long error_code)
+{
+	conditional_sti(regs);
+	if (!user_mode(regs) &&
+	    kernel_math_error(regs, "kernel x87 math error", 16))
+		return;
+	math_error((void __user *)regs->ip);
+}
+
 asmlinkage void bad_intr(void)
 {
 	printk("bad interrupt");
 }
 
-asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
+static void simd_math_error(void __user *ip)
 {
-	void __user *ip = (void __user *)(regs->ip);
 	struct task_struct *task;
 	siginfo_t info;
 	unsigned short mxcsr;
 
-	conditional_sti(regs);
-	if (!user_mode(regs) &&
-			kernel_math_error(regs, "kernel simd math error", 19))
-		return;
-
 	/*
 	 * Save the info for the exception handler and clear the error.
 	 */
@@ -580,7 +577,16 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
 	force_sig_info(SIGFPE, &info, task);
 }
 
-asmlinkage void do_spurious_interrupt_bug(struct pt_regs *regs)
+asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs, long error_code)
+{
+	conditional_sti(regs);
+	if (!user_mode(regs) &&
+			kernel_math_error(regs, "kernel simd math error", 19))
+		return;
+	simd_math_error((void __user *)regs->ip);
+}
+
+asmlinkage void do_spurious_interrupt_bug(struct pt_regs *regs, long error_code)
 {
 }
 
diff --git a/include/asm-x86/traps.h b/include/asm-x86/traps.h
index 7a692ba..c82c39c 100644
--- a/include/asm-x86/traps.h
+++ b/include/asm-x86/traps.h
@@ -72,9 +72,9 @@ asmlinkage void double_fault(void);
 asmlinkage void do_int3(struct pt_regs *, long);
 asmlinkage void do_stack_segment(struct pt_regs *, long);
 asmlinkage void do_debug(struct pt_regs *, unsigned long);
-asmlinkage void do_coprocessor_error(struct pt_regs *);
-asmlinkage void do_simd_coprocessor_error(struct pt_regs *);
-asmlinkage void do_spurious_interrupt_bug(struct pt_regs *);
+asmlinkage void do_coprocessor_error(struct pt_regs *, long);
+asmlinkage void do_simd_coprocessor_error(struct pt_regs *, long);
+asmlinkage void do_spurious_interrupt_bug(struct pt_regs *, long);
 
 asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code);
 
-- 
1.5.4.3


  reply	other threads:[~2008-09-30 16:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-30 16:41 [PATCH 0/4] traps: x86: more unification Alexander van Heukelum
2008-09-30 16:41 ` Alexander van Heukelum [this message]
2008-09-30 16:41   ` [PATCH 2/4] traps: i386: factor out lazy io-bitmap copy Alexander van Heukelum
2008-09-30 16:41     ` [PATCH 3/4] traps: x86: introduce dotraplinkage Alexander van Heukelum
2008-09-30 16:41       ` [PATCH 4/4] traps: x86: converge do_debug handlers Alexander van Heukelum
2008-09-30 19:37 ` [PATCH] fix: x86: remove cpu_vendor_dev Alexander van Heukelum
2008-09-30 20:37   ` Yinghai Lu
2008-10-01  6:49     ` Ingo Molnar
2008-10-01  7:22       ` Yinghai Lu
2008-10-01  7:36         ` Ingo Molnar
2008-10-01 14:53           ` Yinghai Lu
2008-10-01  7:06 ` [PATCH 0/4] traps: x86: more unification Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1222792897-5691-2-git-send-email-heukelum@fastmail.fm \
    --to=heukelum@fastmail.fm \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=yhlu.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®