x86: make printk_address available on X86_32
PATCH 1/3 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 <[email protected]>
---
Replacements for the 2-patch series I sent earlier.
arch/x86/kernel/traps_32.c | 28 ++++++++++++++++++++++++++++ arch/x86/kernel/traps_64.c | 11 ++++------- 2 files changed, 32 insertions(+), 7 deletions(-)
arch/x86/kernel/traps_32.c +28 -0
@@ -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 &&
arch/x86/kernel/traps_64.c +4 -7
@@ -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)
Signature · 1 line
1.5.4.rc3.1118.gf6754c
Ingo Molnar
AppliedQuoted 3 lines · Harvey Harrison
Small fomatting fixes to 64-bit as well, trailing whitespace and extra semicolon, also move the ifdefs for
CONFIG_KALLSYMSinto the function itself.
thanks, applied. Could you send a followup fix for:
arch/x86/kernel/traps_32.c asmlinkage void machine_check(void); · line 112
Quoted 1 line
arch/x86/kernel/traps_32.c +1
-0+char namebuf[128 ];
that should be KSYM_NAME_LEN.
Quoted 1 line
char namebuf[128];
ditto.
Ingo