[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEN] New function dump_execution_state() displays
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxxxx # Node ID f7eb907d9bcd15989a1899358ca8e26116e88b14 # Parent f3561b1ee7a3313fb0cb62d48f7ad1f56c3c435d [XEN] New function dump_execution_state() displays current register and stack state of local CPU. Use this to extend the 'd' debug key to be more useful. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- xen/arch/x86/traps.c | 15 +++++++++++++++ xen/common/keyhandler.c | 20 +++++++++++++++++++- xen/include/asm-x86/processor.h | 5 +++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff -r f3561b1ee7a3 -r f7eb907d9bcd xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Mon Jun 19 11:44:25 2006 +0100 +++ b/xen/arch/x86/traps.c Mon Jun 19 13:06:10 2006 +0100 @@ -487,6 +487,21 @@ asmlinkage int do_invalid_op(struct cpu_ if ( unlikely(!guest_mode(regs)) ) { + char sig[5]; + /* Signature (ud2; .ascii "dbg") indicates dump state and continue. */ + if ( (__copy_from_user(sig, (char *)regs->eip, sizeof(sig)) == 0) && + (memcmp(sig, "\xf\xb""dbg", sizeof(sig)) == 0) ) + { + show_execution_state(regs); + regs->eip += sizeof(sig); + return EXCRET_fault_fixed; + } + printk("%02x %02x %02x %02x %02x\n", + (unsigned char)sig[0], + (unsigned char)sig[1], + (unsigned char)sig[2], + (unsigned char)sig[3], + (unsigned char)sig[4]); DEBUGGER_trap_fatal(TRAP_invalid_op, regs); show_execution_state(regs); panic("CPU%d FATAL TRAP: vector = %d (invalid opcode)\n", diff -r f3561b1ee7a3 -r f7eb907d9bcd xen/common/keyhandler.c --- a/xen/common/keyhandler.c Mon Jun 19 11:44:25 2006 +0100 +++ b/xen/common/keyhandler.c Mon Jun 19 13:06:10 2006 +0100 @@ -87,10 +87,28 @@ static void show_handlers(unsigned char key_table[i].desc); } +static void __dump_execstate(void *unused) +{ + dump_execution_state(); +} + static void dump_registers(unsigned char key, struct cpu_user_regs *regs) { + unsigned int cpu; + printk("'%c' pressed -> dumping registers\n", key); - show_execution_state(regs); + + /* Get local execution state out immediately, in case we get stuck. */ + printk("\n*** Dumping CPU%d state: ***\n", smp_processor_id()); + show_execution_state(regs); + + for_each_online_cpu ( cpu ) + { + if ( cpu == smp_processor_id() ) + continue; + printk("\n*** Dumping CPU%d state: ***\n", cpu); + on_selected_cpus(cpumask_of_cpu(cpu), __dump_execstate, NULL, 1, 1); + } } static void halt_machine(unsigned char key, struct cpu_user_regs *regs) diff -r f3561b1ee7a3 -r f7eb907d9bcd xen/include/asm-x86/processor.h --- a/xen/include/asm-x86/processor.h Mon Jun 19 11:44:25 2006 +0100 +++ b/xen/include/asm-x86/processor.h Mon Jun 19 13:06:10 2006 +0100 @@ -535,6 +535,11 @@ void show_page_walk(unsigned long addr); void show_page_walk(unsigned long addr); asmlinkage void fatal_trap(int trapnr, struct cpu_user_regs *regs); +/* Dumps current register and stack state. */ +#define dump_execution_state() \ + /* NB. Needs interrupts enabled else we end up in fatal_trap(). */ \ + __asm__ __volatile__ ( "pushf ; sti ; ud2 ; .ascii \"dbg\" ; popf" ) + extern void mtrr_ap_init(void); extern void mtrr_bp_init(void); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |