ia64/xen-unstable

changeset 15409:4d159746d0e6

[IA64] Enable PV domain debugging.

Signed-off-by: Tristan Gingold <tgingold@free.fr>
author Alex Williamson <alex.williamson@hp.com>
date Fri Jun 22 11:44:44 2007 -0600 (2007-06-22)
parents 6b1b119191f1
children 8a6a6d4afcb3
files xen/arch/ia64/xen/faults.c xen/include/asm-ia64/debugger.h xen/include/asm-ia64/linux-xen/asm/ptrace.h
line diff
     1.1 --- a/xen/arch/ia64/xen/faults.c	Thu Jun 21 16:50:55 2007 -0600
     1.2 +++ b/xen/arch/ia64/xen/faults.c	Fri Jun 22 11:44:44 2007 -0600
     1.3 @@ -647,6 +647,11 @@ ia64_handle_reflection(unsigned long ifa
     1.4  		PSCB(current, iim) = iim;
     1.5  		vector = IA64_SPECULATION_VECTOR;
     1.6  		break;
     1.7 +	case 29:
     1.8 +		vector = IA64_DEBUG_VECTOR;
     1.9 +		if (debugger_trap_entry(vector,regs))
    1.10 +			return;
    1.11 +		break;
    1.12  	case 30:
    1.13  		// FIXME: Should we handle unaligned refs in Xen??
    1.14  		vector = IA64_UNALIGNED_REF_VECTOR;
    1.15 @@ -681,19 +686,19 @@ ia64_handle_reflection(unsigned long ifa
    1.16  		vector = IA64_LOWERPRIV_TRANSFER_TRAP_VECTOR;
    1.17  		break;
    1.18  	case 35:
    1.19 -		printk("ia64_handle_reflection: handling taken branch trap\n");
    1.20  		vector = IA64_TAKEN_BRANCH_TRAP_VECTOR;
    1.21 +		if (debugger_trap_entry(vector,regs))
    1.22 +			return;
    1.23  		break;
    1.24  	case 36:
    1.25 -		printk("ia64_handle_reflection: handling single step trap\n");
    1.26  		vector = IA64_SINGLE_STEP_TRAP_VECTOR;
    1.27 +		if (debugger_trap_entry(vector,regs))
    1.28 +			return;
    1.29  		break;
    1.30  
    1.31  	default:
    1.32 -		printk("ia64_handle_reflection: unhandled vector=0x%lx\n",
    1.33 -		       vector);
    1.34 -		while (vector)
    1.35 -			/* spin */;
    1.36 +		panic_domain(regs, "ia64_handle_reflection: "
    1.37 +			     "unhandled vector=0x%lx\n", vector);
    1.38  		return;
    1.39  	}
    1.40  	if (check_lazy_cover && (isr & IA64_ISR_IR) &&
     2.1 --- a/xen/include/asm-ia64/debugger.h	Thu Jun 21 16:50:55 2007 -0600
     2.2 +++ b/xen/include/asm-ia64/debugger.h	Fri Jun 22 11:44:44 2007 -0600
     2.3 @@ -56,13 +56,6 @@ show_execution_state(struct cpu_user_reg
     2.4  #ifdef CRASH_DEBUG
     2.5  // crash_debug=y
     2.6  
     2.7 -/* The main trap handlers use these helper macros which include early bail. */
     2.8 -static inline int debugger_trap_entry(
     2.9 -    unsigned int vector, struct cpu_user_regs *regs)
    2.10 -{
    2.11 -    return 0;
    2.12 -}
    2.13 -
    2.14  extern int __trap_to_cdb(struct cpu_user_regs *r);
    2.15  static inline int debugger_trap_fatal(
    2.16      unsigned int vector, struct cpu_user_regs *regs)
    2.17 @@ -80,31 +73,7 @@ static inline int debugger_trap_fatal(
    2.18  #define smp_send_stop()	/* nothing */
    2.19  #endif
    2.20  
    2.21 -#elif defined DOMU_DEBUG
    2.22 -// domu_debug=y
    2.23 -#warning "domu_debug is not implemented yet."
    2.24 -/* The main trap handlers use these helper macros which include early bail. */
    2.25 -static inline int debugger_trap_entry(
    2.26 -    unsigned int vector, struct cpu_user_regs *regs)
    2.27 -{
    2.28 -    return 0;
    2.29 -}
    2.30 -
    2.31 -static inline int debugger_trap_fatal(
    2.32 -    unsigned int vector, struct cpu_user_regs *regs)
    2.33 -{
    2.34 -    return 0;
    2.35 -}
    2.36 -
    2.37 -#define debugger_trap_immediate()		((void)0)
    2.38  #else
    2.39 -/* The main trap handlers use these helper macros which include early bail. */
    2.40 -static inline int debugger_trap_entry(
    2.41 -    unsigned int vector, struct cpu_user_regs *regs)
    2.42 -{
    2.43 -    return 0;
    2.44 -}
    2.45 -
    2.46  static inline int debugger_trap_fatal(
    2.47      unsigned int vector, struct cpu_user_regs *regs)
    2.48  {
    2.49 @@ -113,6 +82,20 @@ static inline int debugger_trap_fatal(
    2.50  
    2.51  #define debugger_trap_immediate()		((void)0)
    2.52  #endif
    2.53 +
    2.54 +static inline int debugger_trap_entry(
    2.55 +    unsigned int vector, struct cpu_user_regs *regs)
    2.56 +{
    2.57 +    struct vcpu *v = current;
    2.58 +
    2.59 +    if (guest_kernel_mode(regs) && v->domain->debugger_attached) {
    2.60 +        domain_pause_for_debugger();
    2.61 +        return 1;
    2.62 +    }
    2.63 +
    2.64 +    return 0;
    2.65 +}
    2.66 +
    2.67  #endif // __ASSEMBLLY__
    2.68  
    2.69  #endif /* __ASM_DEBUGGER_H__ */
     3.1 --- a/xen/include/asm-ia64/linux-xen/asm/ptrace.h	Thu Jun 21 16:50:55 2007 -0600
     3.2 +++ b/xen/include/asm-ia64/linux-xen/asm/ptrace.h	Fri Jun 22 11:44:44 2007 -0600
     3.3 @@ -267,6 +267,7 @@ struct switch_stack {
     3.4  # define ia64_psr(regs)			((struct ia64_psr *) &(regs)->cr_ipsr)
     3.5  #ifdef XEN
     3.6  # define guest_mode(regs)		(ia64_psr(regs)->cpl != 0)
     3.7 +# define guest_kernel_mode(regs)	(ia64_psr(regs)->cpl == 2)
     3.8  #else
     3.9  # define user_mode(regs)		(((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0)
    3.10  #endif