direct-io.hg

changeset 3790:dbf3fa962906

bitkeeper revision 1.1180 (420ca6f6iwPf_PBxj1CWyA2TtgM19w)

Get rid of cdb_trap, and replace it with a new function ``call_with_registers''.

Signed-off-by: sos22@cl.cam.ac.uk.
author sos22@douglas.cl.cam.ac.uk
date Fri Feb 11 12:37:10 2005 +0000 (2005-02-11)
parents 13fe6a361bc3
children 2e65191dbd80
files xen/arch/x86/cdb.c xen/arch/x86/x86_32/cdb_trap.S xen/include/asm-x86/debugger.h
line diff
     1.1 --- a/xen/arch/x86/cdb.c	Fri Feb 11 10:39:46 2005 +0000
     1.2 +++ b/xen/arch/x86/cdb.c	Fri Feb 11 12:37:10 2005 +0000
     1.3 @@ -219,7 +219,7 @@ handle_register_read_command(struct xen_
     1.4  	char buf[121];
     1.5  
     1.6  	sprintf(buf,
     1.7 -		"%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x",
     1.8 +		"%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x",
     1.9  		bswab32(regs->eax),
    1.10  		bswab32(regs->ecx),
    1.11  		bswab32(regs->edx),
    1.12 @@ -232,6 +232,7 @@ handle_register_read_command(struct xen_
    1.13  		bswab32(regs->eflags),
    1.14  		bswab32(regs->cs),
    1.15  		bswab32(regs->ss),
    1.16 +		bswab32(regs->ds),
    1.17  		bswab32(regs->es),
    1.18  		bswab32(regs->fs),
    1.19  		bswab32(regs->gs));
    1.20 @@ -328,7 +329,7 @@ void
    1.21  
    1.22  	if (xdb_ctx.serhnd < 0) {
    1.23  		dbg_printk("Debugger not ready yet.\n");
    1.24 -		return;
    1.25 +		return 0;
    1.26  	}
    1.27  
    1.28  	/* We rely on our caller to ensure we're only on one processor
    1.29 @@ -346,7 +347,7 @@ void
    1.30  	if (!atomic_dec_and_test(&xendbg_running)) {
    1.31  		printk("WARNING WARNING WARNING: Avoiding recursive xendbg.\n");
    1.32  		atomic_inc(&xendbg_running);
    1.33 -		return;
    1.34 +		return 0;
    1.35  	}
    1.36  
    1.37  	smp_send_stop();
    1.38 @@ -385,6 +386,7 @@ void
    1.39  	watchdog_on = old_watchdog;
    1.40  	atomic_inc(&xendbg_running);
    1.41  	local_irq_restore(flags);
    1.42 +	return 0;
    1.43  }
    1.44  
    1.45  static int
     2.1 --- a/xen/arch/x86/x86_32/cdb_trap.S	Fri Feb 11 10:39:46 2005 +0000
     2.2 +++ b/xen/arch/x86/x86_32/cdb_trap.S	Fri Feb 11 12:37:10 2005 +0000
     2.3 @@ -1,36 +1,36 @@
     2.4 -.global cdb_trap
     2.5 -.extern __trap_to_cdb
     2.6 -	
     2.7 -#define SAVE_ALL_NOSEGREGS \
     2.8 -	pushw $0;  \
     2.9 -        pushw %gs; \
    2.10 -	pushw $0;  \
    2.11 -        pushw %fs; \
    2.12 -	pushw $0;  \
    2.13 -        pushw %es; \
    2.14 -	pushw $0;  \
    2.15 -        pushw %ds; \
    2.16 -        pushl %eax; \
    2.17 -        pushl %ebp; \
    2.18 -        pushl %edi; \
    2.19 -        pushl %esi; \
    2.20 -        pushl %edx; \
    2.21 -        pushl %ecx; \
    2.22 -        pushl %ebx;
    2.23 +.global call_with_registers
    2.24 +
    2.25 +#include <asm/asm-offsets.h>
    2.26  
    2.27 -	// Save the register state and call __trap_to_cdb
    2.28 -cdb_trap:
    2.29 -	pushw $0
    2.30 -	pushw %ss
    2.31 -	pushl %esp //We'll fix this up later, in __trap_to_cdb, by adding 8
    2.32 +	// int call_with_registers(void (*f)(struct xen_regs *r)) ->
    2.33 +	// build a xen_regs structure, and then call f with that.
    2.34 +call_with_registers:
    2.35  	pushf
    2.36 -	pushw $0
    2.37 -	pushw %cs
    2.38 -	pushl 16(%esp)
    2.39 -1:	pushl $0 		// Orig_eax
    2.40 -	SAVE_ALL_NOSEGREGS
    2.41 +	subl $XREGS_user_sizeof, %esp
    2.42 +	movl %ebx, XREGS_ebx(%esp)
    2.43 +	movl %ecx, XREGS_ecx(%esp)
    2.44 +	movl %edx, XREGS_edx(%esp)
    2.45 +	movl %esi, XREGS_esi(%esp)
    2.46 +	movl %edi, XREGS_edi(%esp)
    2.47 +	movl %ebp, XREGS_ebp(%esp)
    2.48 +	movl %eax, XREGS_eax(%esp)
    2.49 +	movw $0, XREGS_error_code(%esp)
    2.50 +	movw $0, XREGS_entry_vector(%esp)
    2.51 +	movl XREGS_user_sizeof+4(%esp), %eax
    2.52 +	movl %eax, XREGS_eip(%esp)
    2.53 +	movl %cs, XREGS_cs(%esp)
    2.54 +	movl XREGS_user_sizeof(%esp), %eax
    2.55 +	movl %eax, XREGS_eflags(%esp)
    2.56 +	movl %esp, XREGS_esp(%esp)
    2.57 +	addl $XREGS_user_sizeof+4, XREGS_esp(%esp)
    2.58 +	movl %ss, XREGS_ss(%esp)
    2.59 +	movl %es, XREGS_es(%esp)
    2.60 +	movl %ds, XREGS_ds(%esp)
    2.61 +	movl %fs, XREGS_fs(%esp)
    2.62 +	movl %gs, XREGS_gs(%esp)
    2.63 +
    2.64 +	movl XREGS_user_sizeof+8(%esp), %eax
    2.65  	pushl %esp
    2.66 -	call __trap_to_cdb
    2.67 -	add $72, %esp
    2.68 -	xorl %eax, %eax
    2.69 +	call *%eax
    2.70 +	add $XREGS_user_sizeof + 8, %esp
    2.71  	ret
     3.1 --- a/xen/include/asm-x86/debugger.h	Fri Feb 11 10:39:46 2005 +0000
     3.2 +++ b/xen/include/asm-x86/debugger.h	Fri Feb 11 12:37:10 2005 +0000
     3.3 @@ -38,6 +38,8 @@
     3.4  #define DEBUGGER_trap_fatal(_v, _r) \
     3.5      if ( debugger_trap_fatal(_v, _r) ) return EXCRET_fault_fixed;
     3.6  
     3.7 +int call_with_registers(int (*f)(struct xen_regs *r));
     3.8 +
     3.9  #ifdef XEN_DEBUGGER
    3.10  
    3.11  #include <asm/pdb.h>
    3.12 @@ -105,11 +107,10 @@ static inline int debugger_trap_fatal(
    3.13  
    3.14  #elif defined(CRASH_DEBUG)
    3.15  
    3.16 -extern void cdb_trap(void);
    3.17 -extern void __trap_to_cdb(struct xen_regs *);
    3.18 +extern int __trap_to_cdb(struct xen_regs *r);
    3.19  #define debugger_trap_entry(_v, _r) (0)
    3.20 -#define debugger_trap_fatal(_v, _r) (__trap_to_cdb(_r), 0)
    3.21 -#define debugger_trap_immediate() (cdb_trap())
    3.22 +#define debugger_trap_fatal(_v, _r) __trap_to_cdb(_r)
    3.23 +#define debugger_trap_immediate() call_with_registers(__trap_to_cdb)
    3.24  
    3.25  #elif 0
    3.26