aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-01-30 07:33:25 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:25 -0500
commita5ff677c2fb10567d1e750fb9e4417d95081071b (patch)
treedb7be4151a8aefcb4078843046f44a11df2e0746 /arch
parent625d6cffcac1c96faa18d629f1271d63af0e05f2 (diff)
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 <harvey.harrison@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/traps_32.c28
-rw-r--r--arch/x86/kernel/traps_64.c11
2 files changed, 32 insertions, 7 deletions
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);
102int kstack_depth_to_print = 24; 102int kstack_depth_to_print = 24;
103static unsigned int code_bytes = 64; 103static unsigned int code_bytes = 64;
104 104
105void printk_address(unsigned long address, int reliable)
106{
107#ifdef CONFIG_KALLSYMS
108 unsigned long offset = 0, symsize;
109 const char *symname;
110 char *modname;
111 char *delim = ":";
112 char namebuf[128];
113 char reliab[4] = "";
114
115 symname = kallsyms_lookup(address, &symsize, &offset,
116 &modname, namebuf);
117 if (!symname) {
118 printk(" [<%08lx>]\n", address);
119 return;
120 }
121 if (!reliable)
122 strcpy(reliab, "? ");
123
124 if (!modname)
125 modname = delim = "";
126 printk(" [<%08lx>] %s%s%s%s%s+0x%lx/0x%lx\n",
127 address, reliab, delim, modname, delim, symname, offset, symsize);
128#else
129 printk(" [<%08lx>]\n", address);
130#endif
131}
132
105static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size) 133static inline int valid_stack_ptr(struct thread_info *tinfo, void *p, unsigned size)
106{ 134{
107 return p > (void *)tinfo && 135 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)
100 100
101int kstack_depth_to_print = 12; 101int kstack_depth_to_print = 12;
102 102
103#ifdef CONFIG_KALLSYMS
104void printk_address(unsigned long address, int reliable) 103void printk_address(unsigned long address, int reliable)
105{ 104{
105#ifdef CONFIG_KALLSYMS
106 unsigned long offset = 0, symsize; 106 unsigned long offset = 0, symsize;
107 const char *symname; 107 const char *symname;
108 char *modname; 108 char *modname;
109 char *delim = ":"; 109 char *delim = ":";
110 char namebuf[128]; 110 char namebuf[128];
111 char reliab[4] = "";; 111 char reliab[4] = "";
112 112
113 symname = kallsyms_lookup(address, &symsize, &offset, 113 symname = kallsyms_lookup(address, &symsize, &offset,
114 &modname, namebuf); 114 &modname, namebuf);
@@ -120,16 +120,13 @@ void printk_address(unsigned long address, int reliable)
120 strcpy(reliab, "? "); 120 strcpy(reliab, "? ");
121 121
122 if (!modname) 122 if (!modname)
123 modname = delim = ""; 123 modname = delim = "";
124 printk(" [<%016lx>] %s%s%s%s%s+0x%lx/0x%lx\n", 124 printk(" [<%016lx>] %s%s%s%s%s+0x%lx/0x%lx\n",
125 address, reliab, delim, modname, delim, symname, offset, symsize); 125 address, reliab, delim, modname, delim, symname, offset, symsize);
126}
127#else 126#else
128void printk_address(unsigned long address, int reliable)
129{
130 printk(" [<%016lx>]\n", address); 127 printk(" [<%016lx>]\n", address);
131}
132#endif 128#endif
129}
133 130
134static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, 131static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
135 unsigned *usedp, char **idp) 132 unsigned *usedp, char **idp)