From: Chuck Ebbert <76306.1226@compuserve.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
Linus Torvalds <torvalds@osdl.org>
Subject: [patch] i386: early pagefault handler
Date: Wed, 5 Jul 2006 07:44:53 -0400 [thread overview]
Message-ID: <200607050745_MC3-1-C42B-9937@compuserve.com> (raw)
Page faults during kernel initialization can be hard to diagnose.
Add a handler that prints the fault address, EIP and top of stack
when an early page fault happens.
Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
arch/i386/kernel/head.S | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+)
--- 2.6.17-nb.orig/arch/i386/kernel/head.S
+++ 2.6.17-nb/arch/i386/kernel/head.S
@@ -378,8 +378,41 @@ rp_sidt:
addl $8,%edi
dec %ecx
jne rp_sidt
+
+ lea page_fault,%edi /* early page fault handler */
+ movw %di,%ax
+ andl $0x0000ffff,%edx
+ andl $0xffff0000,%edi
+ orl %edi,%edx
+ lea idt_table,%edi
+ movl %eax,8*14(%edi)
+ movl %edx,8*14+4(%edi)
+
ret
+/* This is the early page fault handler */
+ ALIGN
+page_fault:
+ cld
+#ifdef CONFIG_PRINTK
+ movl $(__KERNEL_DS),%eax
+ movl %eax,%ds
+ movl %eax,%es
+ movl %cr2,%eax
+ pushl %eax
+ pushl $pf_msg
+#ifdef CONFIG_EARLY_PRINTK
+ call early_printk
+#else
+ call printk
+#endif
+#endif
+hlt_loop:
+ hlt
+1:
+ rep ; nop
+ jmp 1b
+
/* This is the default interrupt "handler" :-) */
ALIGN
ignore_int:
@@ -441,6 +474,10 @@ ready: .byte 0
int_msg:
.asciz "Unknown interrupt or fault at EIP %p %p %p\n"
+pf_msg:
+ .ascii "Pg flt: CR2 %p err %p EIP %p CS %p flags %p\n"
+ .asciz " Stk: %p %p %p %p %p %p %p %p\n"
+
/*
* The IDT and GDT 'descriptors' are a strange 48-bit object
* only used by the lidt and lgdt instructions. They are not
--
Chuck
"You can't read a newspaper if you can't read." --George W. Bush
next reply other threads:[~2006-07-05 11:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-05 11:44 Chuck Ebbert [this message]
2006-07-05 11:47 ` Ingo Molnar
2006-07-05 13:10 ` Andi Kleen
2006-07-05 16:38 ` H. Peter Anvin
2006-07-05 16:54 ` Linus Torvalds
2006-07-05 18:28 ` Alan Cox
2006-07-05 18:26 ` H. Peter Anvin
2006-07-05 18:41 ` Linus Torvalds
2006-07-05 20:24 ` Linus Torvalds
2006-07-07 2:06 ` Daniel Phillips
2006-07-07 2:51 ` H. Peter Anvin
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=200607050745_MC3-1-C42B-9937@compuserve.com \
--to=76306.1226@compuserve.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@osdl.org \
/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
Powered by JetHome