# HG changeset patch # User Tristan Gingold # Date 1182476144 -7200 # Node ID 19ac8265c1552fe64a97e668d9b2818506f05fd7 # Parent 302a277a2686613519bbaf4aab8ef4d13e767b44 Enable PV domain debugging. Signed-off-by: Tristan Gingold diff -r 302a277a2686 -r 19ac8265c155 xen/arch/ia64/xen/faults.c --- a/xen/arch/ia64/xen/faults.c Thu Jun 21 06:12:23 2007 +0200 +++ b/xen/arch/ia64/xen/faults.c Fri Jun 22 03:35:44 2007 +0200 @@ -639,6 +639,11 @@ ia64_handle_reflection(unsigned long ifa PSCB(current, iim) = iim; vector = IA64_SPECULATION_VECTOR; break; + case 29: + vector = IA64_DEBUG_VECTOR; + if (debugger_trap_entry(vector,regs)) + return; + break; case 30: // FIXME: Should we handle unaligned refs in Xen?? vector = IA64_UNALIGNED_REF_VECTOR; @@ -673,19 +678,19 @@ ia64_handle_reflection(unsigned long ifa vector = IA64_LOWERPRIV_TRANSFER_TRAP_VECTOR; break; case 35: - printk("ia64_handle_reflection: handling taken branch trap\n"); vector = IA64_TAKEN_BRANCH_TRAP_VECTOR; + if (debugger_trap_entry(vector,regs)) + return; break; case 36: - printk("ia64_handle_reflection: handling single step trap\n"); vector = IA64_SINGLE_STEP_TRAP_VECTOR; + if (debugger_trap_entry(vector,regs)) + return; break; default: - printk("ia64_handle_reflection: unhandled vector=0x%lx\n", - vector); - while (vector) - /* spin */; + panic_domain(regs, "ia64_handle_reflection: " + "unhandled vector=0x%lx\n", vector); return; } if (check_lazy_cover && (isr & IA64_ISR_IR) && diff -r 302a277a2686 -r 19ac8265c155 xen/include/asm-ia64/debugger.h --- a/xen/include/asm-ia64/debugger.h Thu Jun 21 06:12:23 2007 +0200 +++ b/xen/include/asm-ia64/debugger.h Fri Jun 22 03:35:44 2007 +0200 @@ -56,13 +56,6 @@ show_execution_state(struct cpu_user_reg #ifdef CRASH_DEBUG // crash_debug=y -/* The main trap handlers use these helper macros which include early bail. */ -static inline int debugger_trap_entry( - unsigned int vector, struct cpu_user_regs *regs) -{ - return 0; -} - extern int __trap_to_cdb(struct cpu_user_regs *r); static inline int debugger_trap_fatal( unsigned int vector, struct cpu_user_regs *regs) @@ -80,31 +73,7 @@ static inline int debugger_trap_fatal( #define smp_send_stop() /* nothing */ #endif -#elif defined DOMU_DEBUG -// domu_debug=y -#warning "domu_debug is not implemented yet." -/* The main trap handlers use these helper macros which include early bail. */ -static inline int debugger_trap_entry( - unsigned int vector, struct cpu_user_regs *regs) -{ - return 0; -} - -static inline int debugger_trap_fatal( - unsigned int vector, struct cpu_user_regs *regs) -{ - return 0; -} - -#define debugger_trap_immediate() ((void)0) #else -/* The main trap handlers use these helper macros which include early bail. */ -static inline int debugger_trap_entry( - unsigned int vector, struct cpu_user_regs *regs) -{ - return 0; -} - static inline int debugger_trap_fatal( unsigned int vector, struct cpu_user_regs *regs) { @@ -113,6 +82,21 @@ static inline int debugger_trap_fatal( #define debugger_trap_immediate() ((void)0) #endif + +static inline int debugger_trap_entry( + unsigned int vector, struct cpu_user_regs *regs) +{ + struct vcpu *v = current; + + if ( guest_kernel_mode(regs) && v->domain->debugger_attached ) + { + domain_pause_for_debugger(); + return 1; + } + + return 0; +} + #endif // __ASSEMBLLY__ #endif /* __ASM_DEBUGGER_H__ */ diff -r 302a277a2686 -r 19ac8265c155 xen/include/asm-ia64/linux-xen/asm/ptrace.h --- a/xen/include/asm-ia64/linux-xen/asm/ptrace.h Thu Jun 21 06:12:23 2007 +0200 +++ b/xen/include/asm-ia64/linux-xen/asm/ptrace.h Fri Jun 22 03:35:44 2007 +0200 @@ -267,6 +267,7 @@ struct switch_stack { # define ia64_psr(regs) ((struct ia64_psr *) &(regs)->cr_ipsr) #ifdef XEN # define guest_mode(regs) (ia64_psr(regs)->cpl != 0) +# define guest_kernel_mode(regs) (ia64_psr(regs)->cpl == 2) #else # define user_mode(regs) (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0) #endif