From: heukelum@fastmail.fm
To: linux-kernel@vger.kernel.org, mingo@elte.hu, ak@suse.de
Cc: Alexander van Heukelum <heukelum@fastmail.fm>
Subject: [PATCH 8/24] i386: convert hardware exception 7 to an interrupt gate
Date: Tue, 9 Sep 2008 21:56:02 +0200 [thread overview]
Message-ID: <1220990178-29773-9-git-send-email-heukelum@fastmail.fm> (raw)
In-Reply-To: <1220990178-29773-8-git-send-email-heukelum@fastmail.fm>
From: Alexander van Heukelum <heukelum@fastmail.fm>
Handle no coprocessor exception with interrupt initially off.
device_not_available in entry_32.S calls either math_state_restore
or math_emulate. This patch adds an extra indirection to be
able to re-enable interrupts explicitly in traps_32.c
Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
---
arch/x86/kernel/entry_32.S | 15 ++-------------
arch/x86/kernel/traps_32.c | 14 +++++++++++++-
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 109792b..5a88585 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -760,20 +760,9 @@ ENTRY(device_not_available)
RING0_INT_FRAME
pushl $-1 # mark this as an int
CFI_ADJUST_CFA_OFFSET 4
- SAVE_ALL
- GET_CR0_INTO_EAX
- testl $0x4, %eax # EM (math emulation bit)
- jne device_not_available_emulate
- preempt_stop(CLBR_ANY)
- call math_state_restore
- jmp ret_from_exception
-device_not_available_emulate:
- pushl $0 # temporary storage for ORIG_EIP
+ pushl $do_device_not_available
CFI_ADJUST_CFA_OFFSET 4
- call math_emulate
- addl $4, %esp
- CFI_ADJUST_CFA_OFFSET -4
- jmp ret_from_exception
+ jmp error_code
CFI_ENDPROC
END(device_not_available)
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 5d8d057..3ddd71b 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -46,6 +46,7 @@
#include <linux/edac.h>
#endif
+#include <asm/processor-flags.h>
#include <asm/arch_hooks.h>
#include <asm/stacktrace.h>
#include <asm/processor.h>
@@ -1234,6 +1235,17 @@ asmlinkage void math_emulate(long arg)
#endif /* CONFIG_MATH_EMULATION */
+void __kprobes do_device_not_available(struct pt_regs *regs, long error)
+{
+ if (read_cr0() & X86_CR0_EM) {
+ conditional_sti(regs);
+ math_emulate(0);
+ } else {
+ math_state_restore(); /* interrupts still off */
+ conditional_sti(regs);
+ }
+}
+
void __init trap_init(void)
{
int i;
@@ -1253,7 +1265,7 @@ void __init trap_init(void)
set_system_intr_gate(4, &overflow); /* int4 can be called from all */
set_intr_gate(5, &bounds);
set_intr_gate(6, &invalid_op);
- set_trap_gate(7, &device_not_available);
+ set_intr_gate(7, &device_not_available);
set_task_gate(8, GDT_ENTRY_DOUBLEFAULT_TSS);
set_trap_gate(9, &coprocessor_segment_overrun);
set_trap_gate(10, &invalid_TSS);
--
1.5.4.3
next prev parent reply other threads:[~2008-09-10 3:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-09 19:55 [RFC/PATCH] i386: handle all exceptions with interrupts off initially heukelum
2008-09-09 19:55 ` [PATCH 1/24] i386: remove kprobes' restore_interrupts in favour of conditional_sti heukelum
2008-09-09 19:55 ` [PATCH 2/24] i386: prepare to convert exceptions to interrupts heukelum
2008-09-09 19:55 ` [PATCH 3/24] i386: convert hardware exception 0 to an interrupt gate heukelum
2008-09-09 19:55 ` [PATCH 4/24] i386: expand exception 3 DO_TRAP macro heukelum
2008-09-09 19:55 ` [PATCH 5/24] i386: convert hardware exception 4 to an interrupt gate heukelum
2008-09-09 19:56 ` [PATCH 6/24] i386: convert hardware exception 5 " heukelum
2008-09-09 19:56 ` [PATCH 7/24] i386: convert hardware exception 6 " heukelum
2008-09-09 19:56 ` heukelum [this message]
2008-09-09 19:56 ` [PATCH 9/24] i386: convert hardware exception 9 " heukelum
2008-09-09 19:56 ` [PATCH 10/24] i386: convert hardware exception 10 " heukelum
2008-09-09 19:56 ` [PATCH 11/24] i386: convert hardware exception 11 " heukelum
2008-09-09 19:56 ` [PATCH 12/24] i386: convert hardware exception 12 " heukelum
2008-09-09 19:56 ` [PATCH 13/24] i386: convert hardware exception 13 " heukelum
2008-09-09 19:56 ` [PATCH 14/24] i386: convert hardware exception 15 " heukelum
2008-09-09 19:56 ` [PATCH 15/24] i386: convert hardware exception 16 " heukelum
2008-09-09 19:56 ` [PATCH 16/24] i386: convert hardware exception 17 " heukelum
2008-09-09 19:56 ` [PATCH 17/24] i386: convert hardware exception 18 " heukelum
2008-09-09 19:56 ` [PATCH 18/24] i386: convert hardware exception 19 " heukelum
2008-09-09 19:56 ` [PATCH 19/24] i386: remove temporary DO_TRAP macros, expanding the last one used heukelum
2008-09-09 19:56 ` [PATCH 20/24] i386: add TRACE_IRQS_OFF to entry_32.S in 'error_code' heukelum
2008-09-09 19:56 ` [PATCH 21/24] i386: add TRACE_IRQS_OFF for exception 1 (debug) heukelum
2008-09-09 19:56 ` [PATCH 22/24] i386: add TRACE_IRQS_OFF for the nmi heukelum
2008-09-09 19:56 ` [PATCH 23/24] i386: add TRACE_IRQS_OFF for the exception 3 (int3) heukelum
2008-09-09 19:56 ` [PATCH 24/24] i386: trace_hardirqs_fixup should now not be necessary: irqs are off heukelum
2009-01-12 17:21 ` [PATCH 22/24] i386: add TRACE_IRQS_OFF for the nmi Peter Zijlstra
2009-01-12 18:39 ` Ingo Molnar
2009-01-12 18:43 ` Peter Zijlstra
2009-01-12 20:50 ` Alexander van Heukelum
2008-09-10 3:27 ` [RFC/PATCH] i386: handle all exceptions with interrupts off initially H. Peter Anvin
2008-09-10 5:53 ` Ingo Molnar
2008-09-10 5:59 ` H. Peter Anvin
2008-09-10 7:00 ` Ingo Molnar
2008-09-10 7:24 ` Ingo Molnar
2008-09-10 9:36 ` Alexander van Heukelum
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=1220990178-29773-9-git-send-email-heukelum@fastmail.fm \
--to=heukelum@fastmail.fm \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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®