Skip to content

Commit 154c772

Browse files
Russell KingRussell King
authored andcommitted
[ARM] Update show_regs/oops register format
Add the kernel release and version information to the output of show_regs/oops. Add the CPU PSR register. Avoid using printk to output partial lines; always output a complete line. Re-combine the "Control" and "Table + DAC" lines after nommu separated them; we don't want to waste vertical screen space needlessly. Signed-off-by: Russell King <[email protected]>
1 parent d920242 commit 154c772

File tree

2 files changed

+35
-31
lines changed

2 files changed

+35
-31
lines changed

arch/arm/kernel/process.c

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/elfcore.h>
2929
#include <linux/pm.h>
3030
#include <linux/tick.h>
31+
#include <linux/utsname.h>
3132

3233
#include <asm/leds.h>
3334
#include <asm/processor.h>
@@ -199,16 +200,19 @@ void machine_restart(char * __unused)
199200

200201
void __show_regs(struct pt_regs *regs)
201202
{
202-
unsigned long flags = condition_codes(regs);
203+
unsigned long flags;
204+
char buf[64];
203205

204-
printk("CPU: %d\n", smp_processor_id());
206+
printk("CPU: %d %s (%s %.*s)\n",
207+
smp_processor_id(), print_tainted(), init_utsname()->release,
208+
(int)strcspn(init_utsname()->version, " "),
209+
init_utsname()->version);
205210
print_symbol("PC is at %s\n", instruction_pointer(regs));
206211
print_symbol("LR is at %s\n", regs->ARM_lr);
207-
printk("pc : [<%08lx>] lr : [<%08lx>] %s\n"
212+
printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n"
208213
"sp : %08lx ip : %08lx fp : %08lx\n",
209-
instruction_pointer(regs),
210-
regs->ARM_lr, print_tainted(), regs->ARM_sp,
211-
regs->ARM_ip, regs->ARM_fp);
214+
regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr,
215+
regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
212216
printk("r10: %08lx r9 : %08lx r8 : %08lx\n",
213217
regs->ARM_r10, regs->ARM_r9,
214218
regs->ARM_r8);
@@ -218,36 +222,39 @@ void __show_regs(struct pt_regs *regs)
218222
printk("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
219223
regs->ARM_r3, regs->ARM_r2,
220224
regs->ARM_r1, regs->ARM_r0);
221-
printk("Flags: %c%c%c%c",
222-
flags & PSR_N_BIT ? 'N' : 'n',
223-
flags & PSR_Z_BIT ? 'Z' : 'z',
224-
flags & PSR_C_BIT ? 'C' : 'c',
225-
flags & PSR_V_BIT ? 'V' : 'v');
226-
printk(" IRQs o%s FIQs o%s Mode %s%s Segment %s\n",
227-
interrupts_enabled(regs) ? "n" : "ff",
225+
226+
flags = regs->ARM_cpsr;
227+
buf[0] = flags & PSR_N_BIT ? 'N' : 'n';
228+
buf[1] = flags & PSR_Z_BIT ? 'Z' : 'z';
229+
buf[2] = flags & PSR_C_BIT ? 'C' : 'c';
230+
buf[3] = flags & PSR_V_BIT ? 'V' : 'v';
231+
buf[4] = '\0';
232+
233+
printk("Flags: %s IRQs o%s FIQs o%s Mode %s%s Segment %s\n",
234+
buf, interrupts_enabled(regs) ? "n" : "ff",
228235
fast_interrupts_enabled(regs) ? "n" : "ff",
229236
processor_modes[processor_mode(regs)],
230237
thumb_mode(regs) ? " (T)" : "",
231238
get_fs() == get_ds() ? "kernel" : "user");
232-
#if CONFIG_CPU_CP15
239+
#ifdef CONFIG_CPU_CP15
233240
{
234241
unsigned int ctrl;
235-
__asm__ (
236-
" mrc p15, 0, %0, c1, c0\n"
237-
: "=r" (ctrl));
238-
printk("Control: %04X\n", ctrl);
239-
}
242+
243+
buf[0] = '\0';
240244
#ifdef CONFIG_CPU_CP15_MMU
241-
{
242-
unsigned int transbase, dac;
243-
__asm__ (
244-
" mrc p15, 0, %0, c2, c0\n"
245-
" mrc p15, 0, %1, c3, c0\n"
246-
: "=r" (transbase), "=r" (dac));
247-
printk("Table: %08X DAC: %08X\n",
248-
transbase, dac);
249-
}
245+
{
246+
unsigned int transbase, dac;
247+
asm("mrc p15, 0, %0, c2, c0\n\t"
248+
"mrc p15, 0, %1, c3, c0\n"
249+
: "=r" (transbase), "=r" (dac));
250+
snprintf(buf, sizeof(buf), " Table: %08x DAC: %08x",
251+
transbase, dac);
252+
}
250253
#endif
254+
asm("mrc p15, 0, %0, c1, c0\n" : "=r" (ctrl));
255+
256+
printk("Control: %08x%s\n", ctrl, buf);
257+
}
251258
#endif
252259
}
253260

include/asm-arm/ptrace.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ struct pt_regs {
112112
#define fast_interrupts_enabled(regs) \
113113
(!((regs)->ARM_cpsr & PSR_F_BIT))
114114

115-
#define condition_codes(regs) \
116-
((regs)->ARM_cpsr & (PSR_V_BIT|PSR_C_BIT|PSR_Z_BIT|PSR_N_BIT))
117-
118115
/* Are the current registers suitable for user mode?
119116
* (used to maintain security in signal handlers)
120117
*/

0 commit comments

Comments
 (0)