From: Harvey Harrison Date: Wed, 30 Jan 2008 12:33:25 +0000 (+0100) Subject: x86: make printk_address available on X86_32 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a5ff677c2fb10567d1e750fb9e4417d95081071b;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git x86: make printk_address available on X86_32 Small fomatting fixes to 64-bit as well, trailing whitespace and extra semicolon, also move the ifdefs for CONFIG_KALLSYMS into the function itself. Signed-off-by: Harvey Harrison Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner --- diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index 270cfd483160..8534cb53ff60 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c @@ -102,6 +102,34 @@ asmlinkage void machine_check(void); int kstack_depth_to_print = 24; static unsigned int code_bytes = 64; +void printk_address(unsigned long address, int reliable) +{ +#ifdef CONFIG_KALLSYMS + unsigned long offset = 0, symsize; + const char *symname; + char *modname; + char *delim = ":"; + char namebuf[128]; + char reliab[4] = ""; + + symname = kallsyms_lookup(address, &symsize, &offset, + &modname, namebuf); + if (!symname) { + printk(" [<%08lx>]\n", address); + return; + } + if (!reliable) + strcpy(reliab, "? "); + + if (!modname) + modname = delim = ""; + printk(" [<%08lx>] %s%s%s%s%s+0x%lx/0x%lx\n", + address, reliab, delim, modname, delim, symname, offset, symsize); +#else + printk(" [<%08lx>]\n", address); +#endif +} + static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size) { return p > (void *)tinfo && diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c index 4aa4520f9499..4ea727869ded 100644 --- a/arch/x86/kernel/traps_64.c +++ b/arch/x86/kernel/traps_64.c @@ -100,15 +100,15 @@ static inline void preempt_conditional_cli(struct pt_regs *regs) int kstack_depth_to_print = 12; -#ifdef CONFIG_KALLSYMS void printk_address(unsigned long address, int reliable) { +#ifdef CONFIG_KALLSYMS unsigned long offset = 0, symsize; const char *symname; char *modname; char *delim = ":"; char namebuf[128]; - char reliab[4] = "";; + char reliab[4] = ""; symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf); @@ -120,16 +120,13 @@ void printk_address(unsigned long address, int reliable) strcpy(reliab, "? "); if (!modname) - modname = delim = ""; + modname = delim = ""; printk(" [<%016lx>] %s%s%s%s%s+0x%lx/0x%lx\n", address, reliab, delim, modname, delim, symname, offset, symsize); -} #else -void printk_address(unsigned long address, int reliable) -{ printk(" [<%016lx>]\n", address); -} #endif +} static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, unsigned *usedp, char **idp)