Commit a5ff677c authored by Harvey Harrison's avatar Harvey Harrison Committed by Ingo Molnar

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: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 625d6cff
...@@ -102,6 +102,34 @@ asmlinkage void machine_check(void); ...@@ -102,6 +102,34 @@ asmlinkage void machine_check(void);
int kstack_depth_to_print = 24; int kstack_depth_to_print = 24;
static unsigned int code_bytes = 64; 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) static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size)
{ {
return p > (void *)tinfo && return p > (void *)tinfo &&
......
...@@ -100,15 +100,15 @@ static inline void preempt_conditional_cli(struct pt_regs *regs) ...@@ -100,15 +100,15 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
int kstack_depth_to_print = 12; int kstack_depth_to_print = 12;
#ifdef CONFIG_KALLSYMS
void printk_address(unsigned long address, int reliable) void printk_address(unsigned long address, int reliable)
{ {
#ifdef CONFIG_KALLSYMS
unsigned long offset = 0, symsize; unsigned long offset = 0, symsize;
const char *symname; const char *symname;
char *modname; char *modname;
char *delim = ":"; char *delim = ":";
char namebuf[128]; char namebuf[128];
char reliab[4] = "";; char reliab[4] = "";
symname = kallsyms_lookup(address, &symsize, &offset, symname = kallsyms_lookup(address, &symsize, &offset,
&modname, namebuf); &modname, namebuf);
...@@ -120,16 +120,13 @@ void printk_address(unsigned long address, int reliable) ...@@ -120,16 +120,13 @@ void printk_address(unsigned long address, int reliable)
strcpy(reliab, "? "); strcpy(reliab, "? ");
if (!modname) if (!modname)
modname = delim = ""; modname = delim = "";
printk(" [<%016lx>] %s%s%s%s%s+0x%lx/0x%lx\n", printk(" [<%016lx>] %s%s%s%s%s+0x%lx/0x%lx\n",
address, reliab, delim, modname, delim, symname, offset, symsize); address, reliab, delim, modname, delim, symname, offset, symsize);
}
#else #else
void printk_address(unsigned long address, int reliable)
{
printk(" [<%016lx>]\n", address); printk(" [<%016lx>]\n", address);
}
#endif #endif
}
static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
unsigned *usedp, char **idp) unsigned *usedp, char **idp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment