Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753136AbYHCELZ (ORCPT ); Sun, 3 Aug 2008 00:11:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751235AbYHCELR (ORCPT ); Sun, 3 Aug 2008 00:11:17 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:41652 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183AbYHCELQ (ORCPT ); Sun, 3 Aug 2008 00:11:16 -0400 Date: Sun, 03 Aug 2008 00:11:21 -0400 Message-ID: <87k5ey7n6e.wl%ysato@users.sourceforge.jp> From: Yoshinori Sato To: Andrew Morton Cc: lkml Subject: [PATCH} h8300 GENERIC_BUG support User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.7 Emacs/22.2 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3940 Lines: 146 CONFIG_GENERIC_BUG support. Signed-off-by: Yoshinori Sato arch/h8300/Kconfig | 4 ++++ arch/h8300/kernel/module.c | 3 ++- arch/h8300/kernel/traps.c | 17 +++++++++++------ arch/h8300/mm/fault.c | 5 ++--- include/asm-h8300/bug.h | 4 ++++ include/asm-h8300/system.h | 2 ++ 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index adeac03..e20f6d8 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -62,6 +62,10 @@ config GENERIC_TIME bool default y +config GENERIC_BUG + bool + depends on BUG + config TIME_LOW_RES bool default y diff --git a/arch/h8300/kernel/module.c b/arch/h8300/kernel/module.c index 4fd7138..cfc9127 100644 --- a/arch/h8300/kernel/module.c +++ b/arch/h8300/kernel/module.c @@ -114,9 +114,10 @@ int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *me) { - return 0; + return module_bug_finalize(hdr, sechdrs, me); } void module_arch_cleanup(struct module *mod) { + module_bug_cleanup(mod); } diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c index f8f7d7e..0adc61f 100644 --- a/arch/h8300/kernel/traps.c +++ b/arch/h8300/kernel/traps.c @@ -20,12 +20,14 @@ #include #include #include +#include #include #include #include #include -#include + +static DEFINE_SPINLOCK(die_lock); /* * this must be called very early as the kernel might @@ -94,16 +96,19 @@ static void dump(struct pt_regs *fp) printk("\n\n"); } -void die_if_kernel (char *str, struct pt_regs *fp, int nr) +void die(char *str, struct pt_regs *fp, unsigned long err) { - extern int console_loglevel; + static int diecount = 0; - if (!(fp->ccr & PS_S)) - return; + oops_enter(); - console_loglevel = 15; + console_verbose(); + spin_lock_irq(&die_lock); + report_bug(fp->pc, fp); + printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++diecount); dump(fp); + spin_unlock_irq(&die_lock); do_exit(SIGSEGV); } diff --git a/arch/h8300/mm/fault.c b/arch/h8300/mm/fault.c index 29e9af9..1d092ab 100644 --- a/arch/h8300/mm/fault.c +++ b/arch/h8300/mm/fault.c @@ -20,8 +20,6 @@ #include #include -extern void die_if_kernel(char *, struct pt_regs *, long); - /* * This routine handles page faults. It determines the problem, and * then passes it off to one of the appropriate routines. @@ -50,7 +48,8 @@ asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address, } else printk(KERN_ALERT "Unable to handle kernel access"); printk(" at virtual address %08lx\n",address); - die_if_kernel("Oops", regs, error_code); + if (!user_mode(regs)) + die("Oops", regs, error_code); do_exit(SIGKILL); return 1; diff --git a/include/asm-h8300/bug.h b/include/asm-h8300/bug.h index edddf5b..887c197 100644 --- a/include/asm-h8300/bug.h +++ b/include/asm-h8300/bug.h @@ -1,4 +1,8 @@ #ifndef _H8300_BUG_H #define _H8300_BUG_H + +/* always true */ +#define is_valid_bugaddr(addr) (1) + #include #endif diff --git a/include/asm-h8300/system.h b/include/asm-h8300/system.h index e5fed82..59f8b5b 100644 --- a/include/asm-h8300/system.h +++ b/include/asm-h8300/system.h @@ -170,4 +170,6 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz #define arch_align_stack(x) (x) +void die(char *str, struct pt_regs *fp, unsigned long err); + #endif /* _H8300_SYSTEM_H */ -- 1.5.6.3 -- Yoshinori Sato -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/