ia64/xen-unstable

changeset 3667:4294cfa9fad3

bitkeeper revision 1.1159.212.95 (4204aa0ee0re5Xx1zWrJ9ejxzgRs3w)

Various cleanups. Remove PDB pending simpler GDB stub and/or NetBSD debugger.
Force emacs mode to appropriate tabbing in various files.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Sat Feb 05 11:12:14 2005 +0000 (2005-02-05)
parents 5039176029e8
children 4f291c00af8c ed6875102ea3
files .rootkeys xen/Rules.mk xen/arch/x86/Makefile xen/arch/x86/dom0_ops.c xen/arch/x86/pdb-linux.c xen/arch/x86/pdb-stub.c xen/arch/x86/setup.c xen/arch/x86/shadow.c xen/arch/x86/time.c xen/common/Makefile xen/common/ac_timer.c xen/common/debug-linux.c xen/common/debug.c xen/common/dom0_ops.c xen/common/dom_mem_ops.c xen/common/domain.c xen/common/elf.c xen/common/event_channel.c xen/common/grant_table.c xen/common/kernel.c xen/common/keyhandler.c xen/common/lib.c xen/common/multicall.c xen/common/page_alloc.c xen/common/perfc.c xen/common/physdev.c xen/common/resource.c xen/common/sched_atropos.c xen/common/sched_bvt.c xen/common/sched_rrobin.c xen/common/schedule.c xen/common/softirq.c xen/common/string.c xen/common/trace.c xen/common/vsprintf.c xen/common/xmalloc.c xen/drivers/char/console.c xen/drivers/char/serial.c xen/include/asm-x86/pdb.h xen/include/asm-x86/processor.h xen/include/asm-x86/vmx_platform.h
line diff
     1.1 --- a/.rootkeys	Sat Feb 05 10:33:02 2005 +0000
     1.2 +++ b/.rootkeys	Sat Feb 05 11:12:14 2005 +0000
     1.3 @@ -882,8 +882,6 @@ 3ddb79bdHe6_Uij4-glW91vInNtBYQ xen/arch/
     1.4  3ddb79bcZ_2FxINljqNSkqa17ISyJw xen/arch/x86/pci-pc.c
     1.5  3ddb79bdeJ7_86z03yTAPIeeywOg3Q xen/arch/x86/pci-x86.c
     1.6  3ddb79bdIKgipvGoqExEQ7jawfVowA xen/arch/x86/pci-x86.h
     1.7 -40a4dfced2dnSzbKgJFlD3chKHexjQ xen/arch/x86/pdb-linux.c
     1.8 -4022a73czgX7d-2zfF_cb33oVemApQ xen/arch/x86/pdb-stub.c
     1.9  3ddb79bc7KxGCEJsgBnkDX7XjD_ZEQ xen/arch/x86/rwlock.c
    1.10  3ddb79bcrD6Z_rUvSDgrvjyb4846Eg xen/arch/x86/setup.c
    1.11  405b8599xI_PoEr3zZoJ2on-jdn7iw xen/arch/x86/shadow.c
    1.12 @@ -914,8 +912,6 @@ 40e96d3ahBTZqbTViInnq0lM03vs7A xen/arch/
    1.13  40e96d3akN3Hu_J5Bk-WXD8OGscrYQ xen/arch/x86/x86_64/xen.lds
    1.14  3ddb79bdff-gj-jFGKjOejeHLqL8Lg xen/common/Makefile
    1.15  3e397e66AyyD5fYraAySWuwi9uqSXg xen/common/ac_timer.c
    1.16 -4022a73c_BbDFd2YJ_NQYVvKX5Oz7w xen/common/debug-linux.c
    1.17 -3fa152581E5KhrAtqZef2Sr5NKTz4w xen/common/debug.c
    1.18  3ddb79bdLX_P6iB7ILiblRLWvebapg xen/common/dom0_ops.c
    1.19  3e6377e4i0c9GtKN65e99OtRbw3AZw xen/common/dom_mem_ops.c
    1.20  3ddb79bdYO5D8Av12NHqPeSviav7cg xen/common/domain.c
    1.21 @@ -1021,7 +1017,6 @@ 41aaf567Mi3OishhvrCtET1y-mxQBg xen/inclu
    1.22  41a61536MFhNalgbVmYGXAhQsPTZNw xen/include/asm-x86/multicall.h
    1.23  3ddb79c3xjYnrv5t3VqYlR4tNEOl4Q xen/include/asm-x86/page.h
    1.24  3ddb79c3ysKUbxZuwKBRK3WXU2TlEg xen/include/asm-x86/pci.h
    1.25 -4022a73diKn2Ax4-R4gzk59lm1YdDg xen/include/asm-x86/pdb.h
    1.26  3ddb79c2QF5-pZGzuX4QukPCDAl59A xen/include/asm-x86/processor.h
    1.27  40cf1596bim9F9DNdV75klgRSZ6Y2A xen/include/asm-x86/regs.h
    1.28  3ddb79c2plf7ciNgoNjU-RsbUzawsw xen/include/asm-x86/rwlock.h
     2.1 --- a/xen/Rules.mk	Sat Feb 05 10:33:02 2005 +0000
     2.2 +++ b/xen/Rules.mk	Sat Feb 05 11:12:14 2005 +0000
     2.3 @@ -54,9 +54,9 @@ else
     2.4  CFLAGS += -DVERBOSE
     2.5  endif
     2.6  
     2.7 -ifeq ($(debugger),y)
     2.8 -CFLAGS += -DXEN_DEBUGGER
     2.9 -endif
    2.10 +#ifeq ($(debugger),y)
    2.11 +#CFLAGS += -DXEN_DEBUGGER
    2.12 +#endif
    2.13  
    2.14  ifeq ($(perfc),y)
    2.15  CFLAGS += -DPERF_COUNTERS
     3.1 --- a/xen/arch/x86/Makefile	Sat Feb 05 10:33:02 2005 +0000
     3.2 +++ b/xen/arch/x86/Makefile	Sat Feb 05 11:12:14 2005 +0000
     3.3 @@ -1,11 +1,6 @@
     3.4  
     3.5  include $(BASEDIR)/Rules.mk
     3.6  
     3.7 -ifneq ($(debugger),y)
     3.8 -OBJS := $(subst pdb-linux.o,,$(OBJS))
     3.9 -OBJS := $(subst pdb-stub.o,,$(OBJS))
    3.10 -endif
    3.11 -
    3.12  OBJS += $(patsubst %.S,%.o,$(wildcard $(TARGET_SUBARCH)/*.S))
    3.13  OBJS += $(patsubst %.c,%.o,$(wildcard $(TARGET_SUBARCH)/*.c))
    3.14  OBJS += $(patsubst %.c,%.o,$(wildcard mtrr/*.c))
     4.1 --- a/xen/arch/x86/dom0_ops.c	Sat Feb 05 10:33:02 2005 +0000
     4.2 +++ b/xen/arch/x86/dom0_ops.c	Sat Feb 05 11:12:14 2005 +0000
     4.3 @@ -15,7 +15,6 @@
     4.4  #include <xen/event.h>
     4.5  #include <asm/domain_page.h>
     4.6  #include <asm/msr.h>
     4.7 -#include <asm/pdb.h>
     4.8  #include <xen/trace.h>
     4.9  #include <xen/console.h>
    4.10  #include <asm/shadow.h>
     5.1 --- a/xen/arch/x86/pdb-linux.c	Sat Feb 05 10:33:02 2005 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,100 +0,0 @@
     5.4 -
     5.5 -/*
     5.6 - * pervasive debugger
     5.7 - * www.cl.cam.ac.uk/netos/pdb
     5.8 - *
     5.9 - * alex ho
    5.10 - * 2004
    5.11 - * university of cambridge computer laboratory
    5.12 - *
    5.13 - * linux & i386 dependent code. bleech.
    5.14 - */
    5.15 -
    5.16 -#include <asm/pdb.h>
    5.17 -
    5.18 -/* offset to the first instruction in the linux system call code
    5.19 -   where we can safely set a breakpoint */
    5.20 -unsigned int pdb_linux_syscall_enter_bkpt_offset = 20;
    5.21 -
    5.22 -/* offset to eflags saved on the stack after an int 80 */
    5.23 -unsigned int pdb_linux_syscall_eflags_offset     = 48;
    5.24 -
    5.25 -/* offset to the instruction pointer saved on the stack after an int 80 */
    5.26 -unsigned int pdb_linux_syscall_eip_offset        = 40;
    5.27 -
    5.28 -unsigned char
    5.29 -pdb_linux_set_bkpt (unsigned long addr)
    5.30 -{
    5.31 -    unsigned char old_instruction = *(unsigned char *)addr;
    5.32 -    *(unsigned char *)addr = 0xcc;
    5.33 -    return old_instruction;
    5.34 -}
    5.35 -
    5.36 -void
    5.37 -pdb_linux_clr_bkpt (unsigned long addr, unsigned char value)
    5.38 -{
    5.39 -    *(unsigned char *)addr = value;
    5.40 -}
    5.41 -
    5.42 -void
    5.43 -pdb_linux_syscall_enter_bkpt (struct xen_regs *regs, long error_code,
    5.44 -			      trap_info_t *ti)
    5.45 -{
    5.46 -    /* set at breakpoint at the beginning of the 
    5.47 -       system call in the target domain */
    5.48 - 
    5.49 -    pdb_system_call_enter_instr = pdb_linux_set_bkpt(ti->address +
    5.50 -				    pdb_linux_syscall_enter_bkpt_offset);
    5.51 -    pdb_system_call = 1;
    5.52 -}
    5.53 -
    5.54 -void
    5.55 -pdb_linux_syscall_exit_bkpt (struct xen_regs *regs, struct pdb_context *pdb_ctx)
    5.56 -{
    5.57 -    /*
    5.58 -      we've hit an int 0x80 in a user's program, jumped into xen
    5.59 -      (traps.c::do_general_protection()) which re-wrote the next
    5.60 -      instruction in the os kernel to 0xcc, and then hit that 
    5.61 -      exception.
    5.62 -
    5.63 -      we need to re-write the return instruction in the user's
    5.64 -      program so that we know when we have finished the system call
    5.65 -      and are back in the user's program.
    5.66 -
    5.67 -      at this point our stack should look something like this:
    5.68 -
    5.69 -      esp      = 0x80a59f0
    5.70 -      esp + 4  = 0x0
    5.71 -      esp + 8  = 0x80485a0
    5.72 -      esp + 12 = 0x2d
    5.73 -      esp + 16 = 0x80485f4
    5.74 -      esp + 20 = 0xbffffa48
    5.75 -      esp + 24 = 0xd
    5.76 -      esp + 28 = 0xc00a0833
    5.77 -      esp + 32 = 0x833
    5.78 -      esp + 36 = 0xd
    5.79 -      esp + 40 = 0x804dcdd     saved eip
    5.80 -      esp + 44 = 0x82b         saved cs
    5.81 -      esp + 48 = 0x213392      saved eflags
    5.82 -      esp + 52 = 0xbffffa2c    saved esp
    5.83 -      esp + 56 = 0x833         saved ss
    5.84 -      esp + 60 = 0x1000000
    5.85 -    */
    5.86 -
    5.87 -    /* restore the entry instruction for the system call */
    5.88 -    pdb_linux_clr_bkpt(regs->eip - 1, pdb_system_call_enter_instr);
    5.89 -
    5.90 -    /* save the address of eflags that was saved on the stack */
    5.91 -    pdb_system_call_eflags_addr = (regs->esp +
    5.92 -				   pdb_linux_syscall_eflags_offset);
    5.93 - 
    5.94 -    /* muck with the return instruction so that we trap back into the
    5.95 -       debugger when re-entering user space */
    5.96 -    pdb_system_call_next_addr = *(unsigned long *)(regs->esp + 
    5.97 -						 pdb_linux_syscall_eip_offset);
    5.98 -    pdb_linux_get_values (&pdb_system_call_leave_instr, 1, 
    5.99 -			  pdb_system_call_next_addr,
   5.100 -			  pdb_ctx->process, pdb_ctx->ptbr);
   5.101 -    pdb_linux_set_values ("cc", 1, pdb_system_call_next_addr,
   5.102 -			  pdb_ctx->process, pdb_ctx->ptbr);
   5.103 -}
     6.1 --- a/xen/arch/x86/pdb-stub.c	Sat Feb 05 10:33:02 2005 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,1280 +0,0 @@
     6.4 -
     6.5 -/*
     6.6 - * pervasive debugger
     6.7 - * www.cl.cam.ac.uk/netos/pdb
     6.8 - *
     6.9 - * alex ho
    6.10 - * 2004
    6.11 - * university of cambridge computer laboratory
    6.12 - *
    6.13 - * code adapted originally from kgdb, nemesis, & gdbserver
    6.14 - */
    6.15 -
    6.16 -#include <xen/lib.h>
    6.17 -#include <xen/sched.h>
    6.18 -#include <asm/regs.h>
    6.19 -#include <xen/keyhandler.h> 
    6.20 -#include <asm/apic.h>
    6.21 -#include <asm/domain_page.h>                           /* [un]map_domain_mem */
    6.22 -#include <asm/processor.h>
    6.23 -#include <asm/pdb.h>
    6.24 -#include <xen/list.h>
    6.25 -#include <xen/serial.h>
    6.26 -#include <xen/softirq.h>
    6.27 -#include <xen/init.h>
    6.28 -
    6.29 -/* opt_pdb: Name of serial port for Xen pervasive debugger (and enable pdb) */
    6.30 -static unsigned char opt_pdb[10] = "none";
    6.31 -string_param("pdb", opt_pdb);
    6.32 -
    6.33 -#define PDB_DEBUG_TRACE
    6.34 -#ifdef PDB_DEBUG_TRACE
    6.35 -#define TRC(_x) _x
    6.36 -#else
    6.37 -#define TRC(_x)
    6.38 -#endif
    6.39 -
    6.40 -#define DEBUG_EXCEPTION     0x01
    6.41 -#define BREAKPT_EXCEPTION   0x03
    6.42 -#define PDB_LIVE_EXCEPTION  0x58
    6.43 -#define KEYPRESS_EXCEPTION  0x88
    6.44 -
    6.45 -#define BUFMAX 400
    6.46 -
    6.47 -static const char hexchars[] = "0123456789abcdef";
    6.48 -
    6.49 -static int remote_debug;
    6.50 -
    6.51 -#define PDB_BUFMAX 1024
    6.52 -static char pdb_in_buffer[PDB_BUFMAX];
    6.53 -static char pdb_out_buffer[PDB_BUFMAX];
    6.54 -static char pdb_buffer[PDB_BUFMAX];
    6.55 -
    6.56 -struct pdb_context pdb_ctx;
    6.57 -int pdb_continue_thread = 0;
    6.58 -int pdb_general_thread = 0;
    6.59 -
    6.60 -void pdb_put_packet (unsigned char *buffer, int ack);
    6.61 -void pdb_bkpt_check (u_char *buffer, int length,
    6.62 -		     unsigned long cr3, unsigned long addr);
    6.63 -
    6.64 -int pdb_initialized = 0;
    6.65 -int pdb_page_fault_possible = 0;
    6.66 -int pdb_page_fault_scratch = 0;                     /* just a handy variable */
    6.67 -int pdb_page_fault = 0;
    6.68 -static int pdb_serhnd = -1;
    6.69 -static int pdb_stepping = 0;
    6.70 -
    6.71 -int pdb_system_call = 0;
    6.72 -unsigned char pdb_system_call_enter_instr = 0;       /* original enter instr */
    6.73 -unsigned char pdb_system_call_leave_instr = 0;        /* original next instr */
    6.74 -unsigned long pdb_system_call_next_addr = 0;         /* instr after int 0x80 */
    6.75 -unsigned long pdb_system_call_eflags_addr = 0;      /* saved eflags on stack */
    6.76 -
    6.77 -static inline void pdb_put_char(unsigned char c)
    6.78 -{
    6.79 -    serial_putc(pdb_serhnd, c);
    6.80 -}
    6.81 -
    6.82 -static inline unsigned char pdb_get_char(void)
    6.83 -{
    6.84 -    return serial_getc(pdb_serhnd);
    6.85 -}
    6.86 -
    6.87 -int
    6.88 -get_char (char *addr)
    6.89 -{
    6.90 -    return *addr;
    6.91 -}
    6.92 -
    6.93 -void
    6.94 -set_char (char *addr, int val)
    6.95 -{
    6.96 -    *addr = val;
    6.97 -}
    6.98 -
    6.99 -void
   6.100 -pdb_process_query (char *ptr)
   6.101 -{
   6.102 -    if (strcmp(ptr, "C") == 0)
   6.103 -    {
   6.104 -        /* empty string */
   6.105 -    }
   6.106 -    else if (strcmp(ptr, "fThreadInfo") == 0)
   6.107 -    {
   6.108 -#ifdef PDB_PAST
   6.109 -        struct domain *p;
   6.110 -#endif /* PDB_PAST */
   6.111 -
   6.112 -        int buf_idx = 0;
   6.113 -
   6.114 -	pdb_out_buffer[buf_idx++] = 'l';
   6.115 -	pdb_out_buffer[buf_idx++] = 0;
   6.116 -
   6.117 -#ifdef PDB_PAST
   6.118 -	switch (pdb_level)
   6.119 -	{
   6.120 -	case PDB_LVL_XEN:                        /* return a list of domains */
   6.121 -	{
   6.122 -	    int count = 0;
   6.123 -
   6.124 -	    read_lock(&domlist_lock);
   6.125 -
   6.126 -	    pdb_out_buffer[buf_idx++] = 'm';
   6.127 -	    for_each_domain ( p )
   6.128 -	    {
   6.129 -	        domid_t domain = p->domain + PDB_ID_OFFSET;
   6.130 -
   6.131 -		if (count > 0)
   6.132 -		{
   6.133 -		    pdb_out_buffer[buf_idx++] = ',';
   6.134 -		}
   6.135 -		if (domain > 15)
   6.136 -		{
   6.137 -		    pdb_out_buffer[buf_idx++] = hexchars[domain >> 4];
   6.138 -		}
   6.139 -		pdb_out_buffer[buf_idx++] = hexchars[domain % 16];
   6.140 -		count++;
   6.141 -	    }
   6.142 -	    pdb_out_buffer[buf_idx++] = 0;
   6.143 -
   6.144 -	    read_unlock(&domlist_lock);
   6.145 -	    break;
   6.146 -	}
   6.147 -	case PDB_LVL_GUESTOS:                  /* return a list of processes */
   6.148 -	{
   6.149 -	    int foobar[20];
   6.150 -	    int loop, total;
   6.151 -
   6.152 -                                                       /* this cr3 is wrong! */
   6.153 -	    total = pdb_linux_process_list(pdb_ctx[pdb_level].info_cr3,
   6.154 -					   foobar, 20);
   6.155 -
   6.156 -	    pdb_out_buffer[buf_idx++] = 'm';     
   6.157 -	    pdb_out_buffer[buf_idx++] = '1';              /* 1 is to go back */
   6.158 -	    for (loop = 0; loop < total; loop++)
   6.159 -	    {
   6.160 -	        int pid = foobar[loop] + PDB_ID_OFFSET;
   6.161 -
   6.162 -		pdb_out_buffer[buf_idx++] = ',';
   6.163 -		if (pid > 15)
   6.164 -		{
   6.165 -		    pdb_out_buffer[buf_idx++] = hexchars[pid >> 4];
   6.166 -		}
   6.167 -		pdb_out_buffer[buf_idx++] = hexchars[pid % 16];
   6.168 -	    }
   6.169 -	    pdb_out_buffer[buf_idx++] = 0;
   6.170 -	    break;
   6.171 -	}
   6.172 -	case PDB_LVL_PROCESS:                                     /* hmmm... */
   6.173 -	{
   6.174 -	    pdb_out_buffer[buf_idx++] = 'm';
   6.175 -	    pdb_out_buffer[buf_idx++] = '1';              /* 1 is to go back */
   6.176 -	    break;
   6.177 -	}
   6.178 -	default:
   6.179 -	    break;
   6.180 -	}
   6.181 -#endif /* PDB_PAST */
   6.182 -
   6.183 -    }
   6.184 -    else if (strcmp(ptr, "sThreadInfo") == 0)
   6.185 -    {
   6.186 -        int buf_idx = 0;
   6.187 -
   6.188 -	pdb_out_buffer[buf_idx++] = 'l';
   6.189 -	pdb_out_buffer[buf_idx++] = 0;
   6.190 -    }
   6.191 -    else if (strncmp(ptr, "ThreadExtraInfo,", 16) == 0)
   6.192 -    {
   6.193 -        int thread = 0;
   6.194 -	char *message = "foobar ?";
   6.195 -
   6.196 -	ptr += 16;
   6.197 -        if (hexToInt (&ptr, &thread))
   6.198 -	{
   6.199 -            mem2hex (message, pdb_out_buffer, strlen(message) + 1);
   6.200 -	}
   6.201 -
   6.202 -#ifdef PDB_PAST
   6.203 -        int thread = 0;
   6.204 -	char message[16];
   6.205 -	struct domain *p;
   6.206 -
   6.207 -	strncpy (message, dom0->name, 16);
   6.208 -
   6.209 -	ptr += 16;
   6.210 -        if (hexToInt (&ptr, &thread))
   6.211 -	{
   6.212 -            mem2hex ((char *)message, pdb_out_buffer, strlen(message) + 1);
   6.213 -	}
   6.214 -#endif /* PDB_PAST */
   6.215 -
   6.216 -#ifdef PDB_FUTURE
   6.217 -      {
   6.218 -	char string[task_struct_comm_length];
   6.219 -
   6.220 -	string[0] = 0;
   6.221 -	pdb_linux_process_details (cr3, pid, string);
   6.222 -	printk (" (%s)", string);
   6.223 -      }
   6.224 -#endif /* PDB_FUTURE*/
   6.225 -
   6.226 -    }
   6.227 -    else if (strcmp(ptr, "Offsets") == 0)
   6.228 -    {
   6.229 -        /* empty string */
   6.230 -    }
   6.231 -    else if (strncmp(ptr, "Symbol", 6) == 0)
   6.232 -    {
   6.233 -        strcpy (pdb_out_buffer, "OK");
   6.234 -    }
   6.235 -    else
   6.236 -    {
   6.237 -        printk("pdb: error, unknown query [%s]\n", ptr);
   6.238 -    }
   6.239 -}
   6.240 -
   6.241 -void
   6.242 -pdb_x86_to_gdb_regs (char *buffer, struct xen_regs *regs)
   6.243 -{
   6.244 -    int idx = 0;
   6.245 -
   6.246 -    mem2hex ((char *)&regs->eax, &buffer[idx], sizeof(regs->eax));
   6.247 -    idx += sizeof(regs->eax) * 2;
   6.248 -    mem2hex ((char *)&regs->ecx, &buffer[idx], sizeof(regs->ecx));
   6.249 -    idx += sizeof(regs->ecx) * 2;
   6.250 -    mem2hex ((char *)&regs->edx, &buffer[idx], sizeof(regs->edx));
   6.251 -    idx += sizeof(regs->edx) * 2;
   6.252 -    mem2hex ((char *)&regs->ebx, &buffer[idx], sizeof(regs->ebx));
   6.253 -    idx += sizeof(regs->ebx) * 2;
   6.254 -    mem2hex ((char *)&regs->esp, &buffer[idx], sizeof(regs->esp));
   6.255 -    idx += sizeof(regs->esp) * 2;
   6.256 -    mem2hex ((char *)&regs->ebp, &buffer[idx], sizeof(regs->ebp));
   6.257 -    idx += sizeof(regs->ebp) * 2;
   6.258 -    mem2hex ((char *)&regs->esi, &buffer[idx], sizeof(regs->esi));
   6.259 -    idx += sizeof(regs->esi) * 2;
   6.260 -    mem2hex ((char *)&regs->edi, &buffer[idx], sizeof(regs->edi));
   6.261 -    idx += sizeof(regs->edi) * 2;
   6.262 -    mem2hex ((char *)&regs->eip, &buffer[idx], sizeof(regs->eip));
   6.263 -    idx += sizeof(regs->eip) * 2;
   6.264 -    mem2hex ((char *)&regs->eflags, &buffer[idx], sizeof(regs->eflags));
   6.265 -    idx += sizeof(regs->eflags) * 2;
   6.266 -    mem2hex ((char *)&regs->cs, &buffer[idx], sizeof(regs->cs));
   6.267 -    idx += sizeof(regs->cs) * 2;
   6.268 -    mem2hex ((char *)&regs->ss, &buffer[idx], sizeof(regs->ss));
   6.269 -    idx += sizeof(regs->ss) * 2;
   6.270 -    mem2hex ((char *)&regs->ds, &buffer[idx], sizeof(regs->ds));
   6.271 -    idx += sizeof(regs->ds) * 2;
   6.272 -    mem2hex ((char *)&regs->es, &buffer[idx], sizeof(regs->es));
   6.273 -    idx += sizeof(regs->es) * 2;
   6.274 -    mem2hex ((char *)&regs->fs, &buffer[idx], sizeof(regs->fs));
   6.275 -    idx += sizeof(regs->fs) * 2;
   6.276 -    mem2hex ((char *)&regs->gs, &buffer[idx], sizeof(regs->gs));
   6.277 -}
   6.278 -
   6.279 -/* at this point we allow any register to be changed, caveat emptor */
   6.280 -void
   6.281 -pdb_gdb_to_x86_regs (struct xen_regs *regs, char *buffer)
   6.282 -{
   6.283 -    hex2mem(buffer, (char *)&regs->eax, sizeof(regs->eax));
   6.284 -    buffer += sizeof(regs->eax) * 2;
   6.285 -    hex2mem(buffer, (char *)&regs->ecx, sizeof(regs->ecx));
   6.286 -    buffer += sizeof(regs->ecx) * 2;
   6.287 -    hex2mem(buffer, (char *)&regs->edx, sizeof(regs->edx));
   6.288 -    buffer += sizeof(regs->edx) * 2;
   6.289 -    hex2mem(buffer, (char *)&regs->ebx, sizeof(regs->ebx));
   6.290 -    buffer += sizeof(regs->ebx) * 2;
   6.291 -    hex2mem(buffer, (char *)&regs->esp, sizeof(regs->esp));
   6.292 -    buffer += sizeof(regs->esp) * 2;
   6.293 -    hex2mem(buffer, (char *)&regs->ebp, sizeof(regs->ebp));
   6.294 -    buffer += sizeof(regs->ebp) * 2;
   6.295 -    hex2mem(buffer, (char *)&regs->esi, sizeof(regs->esi));
   6.296 -    buffer += sizeof(regs->esi) * 2;
   6.297 -    hex2mem(buffer, (char *)&regs->edi, sizeof(regs->edi));
   6.298 -    buffer += sizeof(regs->edi) * 2;
   6.299 -    hex2mem(buffer, (char *)&regs->eip, sizeof(regs->eip));
   6.300 -    buffer += sizeof(regs->eip) * 2;
   6.301 -    hex2mem(buffer, (char *)&regs->eflags, sizeof(regs->eflags));
   6.302 -    buffer += sizeof(regs->eflags) * 2;
   6.303 -    hex2mem(buffer, (char *)&regs->cs, sizeof(regs->cs));
   6.304 -    buffer += sizeof(regs->cs) * 2;
   6.305 -    hex2mem(buffer, (char *)&regs->ss, sizeof(regs->ss));
   6.306 -    buffer += sizeof(regs->ss) * 2;
   6.307 -    hex2mem(buffer, (char *)&regs->ds, sizeof(regs->ds));
   6.308 -    buffer += sizeof(regs->ds) * 2;
   6.309 -    hex2mem(buffer, (char *)&regs->es, sizeof(regs->es));
   6.310 -    buffer += sizeof(regs->es) * 2;
   6.311 -    hex2mem(buffer, (char *)&regs->fs, sizeof(regs->fs));
   6.312 -    buffer += sizeof(regs->fs) * 2;
   6.313 -    hex2mem(buffer, (char *)&regs->gs, sizeof(regs->gs));
   6.314 -}
   6.315 -
   6.316 -int
   6.317 -pdb_process_command (char *ptr, struct xen_regs *regs, unsigned long cr3,
   6.318 -		     int sigval)
   6.319 -{
   6.320 -    int length;
   6.321 -    unsigned long addr;
   6.322 -    int ack = 1;                           /* wait for ack in pdb_put_packet */
   6.323 -    int go = 0;
   6.324 -
   6.325 -    TRC(printf("pdb: [%s]\n", ptr));
   6.326 -
   6.327 -    pdb_out_buffer[0] = 0;
   6.328 -
   6.329 -    if (pdb_ctx.valid == 1)
   6.330 -    {
   6.331 -        if (pdb_ctx.domain == -1)                        /* pdb context: xen */
   6.332 -	{
   6.333 -	    struct domain *p;
   6.334 -
   6.335 -	    p = &idle0_task;
   6.336 -	    if (p->mm.shadow_mode)
   6.337 -	        pdb_ctx.ptbr = pagetable_val(p->mm.shadow_table);
   6.338 -	    else
   6.339 -	        pdb_ctx.ptbr = pagetable_val(p->mm.pagetable);
   6.340 -	}
   6.341 -	else if (pdb_ctx.process == -1)             /* pdb context: guest os */
   6.342 -	{
   6.343 -	    struct domain *p;
   6.344 -
   6.345 -	    if (pdb_ctx.domain == -2)
   6.346 -	    {
   6.347 -	        p = find_last_domain();
   6.348 -	    }
   6.349 -	    else
   6.350 -	    {
   6.351 -	        p = find_domain_by_id(pdb_ctx.domain);
   6.352 -	    }
   6.353 -	    if (p == NULL)
   6.354 -	    {
   6.355 -	        printk ("pdb error: unknown domain [0x%x]\n", pdb_ctx.domain);
   6.356 -	        strcpy (pdb_out_buffer, "E01");
   6.357 -		pdb_ctx.domain = -1;
   6.358 -		goto exit;
   6.359 -	    }
   6.360 -	    if (p->mm.shadow_mode)
   6.361 -	        pdb_ctx.ptbr = pagetable_val(p->mm.shadow_table);
   6.362 -	    else
   6.363 -	        pdb_ctx.ptbr = pagetable_val(p->mm.pagetable);
   6.364 -	    put_domain(p);
   6.365 -	}
   6.366 -	else                                         /* pdb context: process */
   6.367 -	{
   6.368 -	    struct domain *p;
   6.369 -	    unsigned long domain_ptbr;
   6.370 -
   6.371 -	    p = find_domain_by_id(pdb_ctx.domain);
   6.372 -	    if (p == NULL)
   6.373 -	    {
   6.374 -	        printk ("pdb error: unknown domain [0x%x][0x%x]\n", 
   6.375 -			pdb_ctx.domain, pdb_ctx.process);
   6.376 -	        strcpy (pdb_out_buffer, "E01");
   6.377 -		pdb_ctx.domain = -1;
   6.378 -		goto exit;
   6.379 -	    }
   6.380 -	    if (p->mm.shadow_mode)
   6.381 -	        domain_ptbr = pagetable_val(p->mm.shadow_table);
   6.382 -	    else
   6.383 -	        domain_ptbr = pagetable_val(p->mm.pagetable);
   6.384 -	    put_domain(p);
   6.385 -
   6.386 -	    pdb_ctx.ptbr = domain_ptbr;
   6.387 -	    /*pdb_ctx.ptbr=pdb_linux_pid_ptbr(domain_ptbr, pdb_ctx.process);*/
   6.388 -	}
   6.389 -
   6.390 -	pdb_ctx.valid = 0;
   6.391 -	TRC(printk ("pdb change context (dom:%d, proc:%d) now 0x%lx\n",
   6.392 -		    pdb_ctx.domain, pdb_ctx.process, pdb_ctx.ptbr));
   6.393 -    }
   6.394 -
   6.395 -    switch (*ptr++)
   6.396 -    {
   6.397 -    case '?':
   6.398 -        pdb_out_buffer[0] = 'S';
   6.399 -        pdb_out_buffer[1] = hexchars[sigval >> 4];
   6.400 -        pdb_out_buffer[2] = hexchars[sigval % 16];
   6.401 -        pdb_out_buffer[3] = 0;
   6.402 -        break;
   6.403 -    case 'S':                                            /* step with signal */
   6.404 -    case 's':                                                        /* step */
   6.405 -    {
   6.406 -        if ( pdb_system_call_eflags_addr != 0 )
   6.407 -	{
   6.408 -	    unsigned long eflags;
   6.409 -	    char eflags_buf[sizeof(eflags)*2];       /* STUPID STUPID STUPID */
   6.410 -
   6.411 -	    pdb_linux_get_values((u_char*)&eflags, sizeof(eflags), 
   6.412 -				 pdb_system_call_eflags_addr, 
   6.413 -				 pdb_ctx.process, pdb_ctx.ptbr);
   6.414 -	    eflags |= X86_EFLAGS_TF;
   6.415 -	    mem2hex ((u_char *)&eflags, eflags_buf, sizeof(eflags)); 
   6.416 -	    pdb_linux_set_values(eflags_buf, sizeof(eflags),
   6.417 -				 pdb_system_call_eflags_addr,
   6.418 -				 pdb_ctx.process, pdb_ctx.ptbr);
   6.419 -	}
   6.420 -
   6.421 -        regs->eflags |= X86_EFLAGS_TF;
   6.422 -        pdb_stepping = 1;
   6.423 -        return 1;                                        
   6.424 -        /* not reached */
   6.425 -    }
   6.426 -    case 'C':                                        /* continue with signal */
   6.427 -    case 'c':                                                    /* continue */
   6.428 -    {
   6.429 -        if ( pdb_system_call_eflags_addr != 0 )
   6.430 -	{
   6.431 -	    unsigned long eflags;
   6.432 -	    char eflags_buf[sizeof(eflags)*2];       /* STUPID STUPID STUPID */
   6.433 -
   6.434 -	    pdb_linux_get_values((u_char*)&eflags, sizeof(eflags), 
   6.435 -				 pdb_system_call_eflags_addr, 
   6.436 -				 pdb_ctx.process, pdb_ctx.ptbr);
   6.437 -	    eflags &= ~X86_EFLAGS_TF;
   6.438 -	    mem2hex ((u_char *)&eflags, eflags_buf, sizeof(eflags)); 
   6.439 -	    pdb_linux_set_values(eflags_buf, sizeof(eflags),
   6.440 -				 pdb_system_call_eflags_addr,
   6.441 -				 pdb_ctx.process, pdb_ctx.ptbr);
   6.442 -	}
   6.443 -
   6.444 -        regs->eflags &= ~X86_EFLAGS_TF;
   6.445 -        return 1;                         /* jump out before replying to gdb */
   6.446 -        /* not reached */
   6.447 -    }
   6.448 -    case 'd':
   6.449 -        remote_debug = !(remote_debug);                 /* toggle debug flag */
   6.450 -        break;
   6.451 -    case 'D':                                                      /* detach */
   6.452 -        return go;
   6.453 -        /* not reached */
   6.454 -    case 'g':                       /* return the value of the CPU registers */
   6.455 -    {
   6.456 -        pdb_x86_to_gdb_regs (pdb_out_buffer, regs);
   6.457 -        break;
   6.458 -    }
   6.459 -    case 'G':              /* set the value of the CPU registers - return OK */
   6.460 -    {
   6.461 -        pdb_gdb_to_x86_regs (regs, ptr);
   6.462 -        break;
   6.463 -    }
   6.464 -    case 'H':
   6.465 -    {
   6.466 -        int thread;
   6.467 -        char *next = &ptr[1];
   6.468 -
   6.469 -        if (hexToInt (&next, &thread))
   6.470 -        {
   6.471 -            if (*ptr == 'c')
   6.472 -            {
   6.473 -	        pdb_continue_thread = thread;
   6.474 -            }
   6.475 -            else if (*ptr == 'g')
   6.476 -            {
   6.477 -	        pdb_general_thread = thread;
   6.478 -            }
   6.479 -            else
   6.480 -            {
   6.481 -                printk ("pdb error: unknown set thread command %c (%d)\n", 
   6.482 -                        *ptr, thread);
   6.483 -		strcpy (pdb_out_buffer, "E00");
   6.484 -		break;
   6.485 -            }
   6.486 -        }
   6.487 -        strcpy (pdb_out_buffer, "OK");
   6.488 -        break;
   6.489 -    }
   6.490 -    case 'k':                                                /* kill request */
   6.491 -    {
   6.492 -        strcpy (pdb_out_buffer, "OK");                        /* ack for fun */
   6.493 -        printk ("don't kill bill...\n");
   6.494 -        ack = 0;
   6.495 -        break;
   6.496 -    }
   6.497 -
   6.498 -    case 'q':
   6.499 -    {
   6.500 -        pdb_process_query(ptr);
   6.501 -        break;
   6.502 -    }
   6.503 -
   6.504 -    /* mAA..AA,LLLL  Read LLLL bytes at address AA..AA */
   6.505 -    case 'm':
   6.506 -    {
   6.507 -        /* TRY TO READ %x,%x.  IF SUCCEED, SET PTR = 0 */
   6.508 -        if (hexToInt (&ptr, (int *)&addr))
   6.509 -            if (*(ptr++) == ',')
   6.510 -                if (hexToInt (&ptr, &length))
   6.511 -                {
   6.512 -                    ptr = 0;
   6.513 -
   6.514 -		    pdb_page_fault_possible = 1;
   6.515 -		    pdb_page_fault = 0;
   6.516 -		    if (addr >= PAGE_OFFSET)
   6.517 -		    {
   6.518 -                        mem2hex ((char *) addr, pdb_out_buffer, length); 
   6.519 -		    }
   6.520 -		    else if (pdb_ctx.process != -1)
   6.521 -		    {
   6.522 -		        pdb_linux_get_values(pdb_buffer, length, addr, 
   6.523 -					     pdb_ctx.process, pdb_ctx.ptbr);
   6.524 -                        mem2hex (pdb_buffer, pdb_out_buffer, length); 
   6.525 -		    }
   6.526 -                    else
   6.527 -                    {
   6.528 -		        pdb_get_values (pdb_buffer, length, 
   6.529 -					pdb_ctx.ptbr, addr);
   6.530 -                        mem2hex (pdb_buffer, pdb_out_buffer, length);
   6.531 -                    }
   6.532 -
   6.533 -		    pdb_page_fault_possible = 0;
   6.534 -		    if (pdb_page_fault)
   6.535 -		    {
   6.536 -                        strcpy (pdb_out_buffer, "E03");
   6.537 -		    }
   6.538 -                }
   6.539 -	    
   6.540 -        if (ptr)
   6.541 -        {
   6.542 -            strcpy (pdb_out_buffer, "E01");
   6.543 -        }
   6.544 -        break;
   6.545 -    }
   6.546 -
   6.547 -    /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
   6.548 -    case 'M':
   6.549 -    {
   6.550 -        /* TRY TO READ '%x,%x:'.  IF SUCCEED, SET PTR = 0 */
   6.551 -        if (hexToInt (&ptr, (int *)&addr))
   6.552 -            if (*(ptr++) == ',')
   6.553 -                if (hexToInt (&ptr, &length))
   6.554 -                    if (*(ptr++) == ':')
   6.555 -                    {
   6.556 -
   6.557 -		        pdb_page_fault_possible = 1;
   6.558 -			pdb_page_fault = 0;
   6.559 -			if (addr >= PAGE_OFFSET)
   6.560 -			{
   6.561 -			    hex2mem (ptr, (char *)addr, length);
   6.562 -			    pdb_bkpt_check(ptr, length, pdb_ctx.ptbr, addr);
   6.563 -			}
   6.564 -			else if (pdb_ctx.process != -1)
   6.565 -			{
   6.566 -			    pdb_linux_set_values(ptr, length, addr,
   6.567 -						 pdb_ctx.process, 
   6.568 -						 pdb_ctx.ptbr);
   6.569 -			    pdb_bkpt_check(ptr, length, pdb_ctx.ptbr, addr);
   6.570 -			}
   6.571 -			else
   6.572 -			{
   6.573 -			    pdb_set_values (ptr, length,
   6.574 -					    pdb_ctx.ptbr, addr);
   6.575 -			    pdb_bkpt_check(ptr, length, pdb_ctx.ptbr, addr);
   6.576 -			}
   6.577 -			pdb_page_fault_possible = 0;
   6.578 -                        if (pdb_page_fault)
   6.579 -                        {
   6.580 -                            strcpy (pdb_out_buffer, "E03");
   6.581 -                        }
   6.582 -                        else
   6.583 -                        {
   6.584 -                            strcpy (pdb_out_buffer, "OK");
   6.585 -                        }
   6.586 -
   6.587 -                        ptr = 0;
   6.588 -                    }
   6.589 -        if (ptr)
   6.590 -        {
   6.591 -            strcpy (pdb_out_buffer, "E02");
   6.592 -        }
   6.593 -        break;
   6.594 -    }
   6.595 -    case 'T':
   6.596 -    {
   6.597 -        int id;
   6.598 -
   6.599 -        if (hexToInt (&ptr, &id))
   6.600 -        {
   6.601 -	    strcpy (pdb_out_buffer, "E00");
   6.602 -
   6.603 -#ifdef PDB_PAST
   6.604 -
   6.605 -	    switch (pdb_level)                             /* previous level */
   6.606 -	    {
   6.607 -	        case PDB_LVL_XEN:
   6.608 -		{
   6.609 -		    struct domain *p;
   6.610 -		    id -= PDB_ID_OFFSET;
   6.611 -		    if ( (p = find_domain_by_id(id)) == NULL)
   6.612 -		        strcpy (pdb_out_buffer, "E00");
   6.613 -		    else
   6.614 -		        strcpy (pdb_out_buffer, "OK");
   6.615 -		    put_domain(p);
   6.616 -
   6.617 -		    pdb_level = PDB_LVL_GUESTOS;
   6.618 -		    pdb_ctx[pdb_level].ctrl = id;
   6.619 -		    pdb_ctx[pdb_level].info = id;
   6.620 -		    break;
   6.621 -		}
   6.622 -	        case PDB_LVL_GUESTOS:
   6.623 -		{
   6.624 -		    if (pdb_level == -1)
   6.625 -		    {
   6.626 -		        pdb_level = PDB_LVL_XEN;
   6.627 -		    }
   6.628 -		    else
   6.629 -		    {
   6.630 -		        pdb_level = PDB_LVL_PROCESS;
   6.631 -			pdb_ctx[pdb_level].ctrl = id;
   6.632 -			pdb_ctx[pdb_level].info = id;
   6.633 -		    }
   6.634 -		    break;
   6.635 -		}
   6.636 -	        case PDB_LVL_PROCESS:
   6.637 -		{
   6.638 -		    if (pdb_level == -1)
   6.639 -		    {
   6.640 -		        pdb_level = PDB_LVL_GUESTOS;
   6.641 -		    }
   6.642 -		    break;
   6.643 -		}
   6.644 -	        default:
   6.645 -		{
   6.646 -		    printk ("pdb internal error: invalid level [%d]\n", 
   6.647 -			    pdb_level);
   6.648 -		}
   6.649 -	    }
   6.650 -
   6.651 -#endif /* PDB_PAST */
   6.652 -        }
   6.653 -        break;
   6.654 -    }
   6.655 -    }
   6.656 -
   6.657 -exit:
   6.658 -    /* reply to the request */
   6.659 -    pdb_put_packet (pdb_out_buffer, ack);
   6.660 -
   6.661 -    return go;
   6.662 -}
   6.663 -
   6.664 -/*
   6.665 - * process an input character from the serial line.
   6.666 - *
   6.667 - * return "1" if the character is a gdb debug string
   6.668 - * (and hence shouldn't be further processed).
   6.669 - */
   6.670 -
   6.671 -int pdb_debug_state = 0;                /* small parser state machine */
   6.672 -
   6.673 -int hex(char ch)
   6.674 -{
   6.675 -    if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10);
   6.676 -    if ((ch >= '0') && (ch <= '9')) return (ch-'0');
   6.677 -    if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10);
   6.678 -    return (-1);
   6.679 -}
   6.680 -
   6.681 -/* convert the memory pointed to by mem into hex, placing result in buf */
   6.682 -/* return a pointer to the last char put in buf (null) */
   6.683 -char *
   6.684 -mem2hex (mem, buf, count)
   6.685 -    char *mem;
   6.686 -    char *buf;
   6.687 -    int count;
   6.688 -{
   6.689 -    int i;
   6.690 -    unsigned char ch;
   6.691 -
   6.692 -    for (i = 0; i < count; i++)
   6.693 -    {
   6.694 -        ch = get_char (mem++);
   6.695 -        *buf++ = hexchars[ch >> 4];
   6.696 -        *buf++ = hexchars[ch % 16];
   6.697 -    }
   6.698 -    *buf = 0;
   6.699 -    return (buf);
   6.700 -}
   6.701 -
   6.702 -/* convert the hex array pointed to by buf into binary to be placed in mem */
   6.703 -/* return a pointer to the character AFTER the last byte written */
   6.704 -char *
   6.705 -hex2mem (buf, mem, count)
   6.706 -    char *buf;
   6.707 -    char *mem;
   6.708 -    int count;
   6.709 -{
   6.710 -    int i;
   6.711 -    unsigned char ch;
   6.712 -
   6.713 -    for (i = 0; i < count; i++)
   6.714 -    {
   6.715 -        ch = hex (*buf++) << 4;
   6.716 -        ch = ch + hex (*buf++);
   6.717 -        set_char (mem++, ch);
   6.718 -    }
   6.719 -    return (mem);
   6.720 -}
   6.721 -
   6.722 -int
   6.723 -hexToInt (char **ptr, int *intValue)
   6.724 -{
   6.725 -    int numChars = 0;
   6.726 -    int hexValue;
   6.727 -    int negative = 0;
   6.728 -
   6.729 -    *intValue = 0;
   6.730 -
   6.731 -    if (**ptr == '-')
   6.732 -    {
   6.733 -        negative = 1;
   6.734 -        numChars++;
   6.735 -        (*ptr)++;
   6.736 -    }
   6.737 -
   6.738 -    while (**ptr)
   6.739 -    {
   6.740 -        hexValue = hex (**ptr);
   6.741 -        if (hexValue >= 0)
   6.742 -        {
   6.743 -            *intValue = (*intValue << 4) | hexValue;
   6.744 -            numChars++;
   6.745 -        }
   6.746 -        else
   6.747 -            break;
   6.748 -
   6.749 -        (*ptr)++;
   6.750 -    }
   6.751 -
   6.752 -    if ( negative )
   6.753 -        *intValue *= -1;
   6.754 -  
   6.755 -    return (numChars);
   6.756 -}
   6.757 -
   6.758 -/***********************************************************************/
   6.759 -/***********************************************************************/
   6.760 -
   6.761 -
   6.762 -/*
   6.763 - * Add a breakpoint to the list of known breakpoints.
   6.764 - * For now there should only be two or three breakpoints so
   6.765 - * we use a simple linked list.  In the future, maybe a red-black tree?
   6.766 - */
   6.767 -struct pdb_breakpoint breakpoints;
   6.768 -
   6.769 -void pdb_bkpt_add (unsigned long cr3, unsigned long address)
   6.770 -{
   6.771 -    struct pdb_breakpoint *bkpt = xmalloc(sizeof(*bkpt));
   6.772 -    bkpt->cr3 = cr3;
   6.773 -    bkpt->address = address;
   6.774 -    list_add(&bkpt->list, &breakpoints.list);
   6.775 -}
   6.776 -
   6.777 -/*
   6.778 - * Check to see of the breakpoint is in the list of known breakpoints 
   6.779 - * Return 1 if it has been set, NULL otherwise.
   6.780 - */
   6.781 -struct pdb_breakpoint* pdb_bkpt_search (unsigned long cr3, 
   6.782 -					unsigned long address)
   6.783 -{
   6.784 -    struct pdb_breakpoint *bkpt;
   6.785 -
   6.786 -    list_for_each_entry ( bkpt, &breakpoints.list, list )
   6.787 -    {
   6.788 -	if ( bkpt->cr3 == cr3 && bkpt->address == address )
   6.789 -            return bkpt;
   6.790 -    }
   6.791 -
   6.792 -    return NULL;
   6.793 -}
   6.794 -
   6.795 -/*
   6.796 - * Remove a breakpoint to the list of known breakpoints.
   6.797 - * Return 1 if the element was not found, otherwise 0.
   6.798 - */
   6.799 -int pdb_bkpt_remove (unsigned long cr3, unsigned long address)
   6.800 -{
   6.801 -    struct pdb_breakpoint *bkpt;
   6.802 -
   6.803 -    list_for_each_entry ( bkpt, &breakpoints.list, list )
   6.804 -    {
   6.805 -	if ( bkpt->cr3 == cr3 && bkpt->address == address )
   6.806 -	{
   6.807 -            list_del(&bkpt->list);
   6.808 -            xfree(bkpt);
   6.809 -            return 0;
   6.810 -	}
   6.811 -    }
   6.812 -
   6.813 -    return 1;
   6.814 -}
   6.815 -
   6.816 -/*
   6.817 - * Check to see if a memory write is really gdb setting a breakpoint
   6.818 - */
   6.819 -void pdb_bkpt_check (u_char *buffer, int length,
   6.820 -		     unsigned long cr3, unsigned long addr)
   6.821 -{
   6.822 -    if (length == 1 && buffer[0] == 'c' && buffer[1] == 'c')
   6.823 -    {
   6.824 -        /* inserting a new breakpoint */
   6.825 -        pdb_bkpt_add(cr3, addr);
   6.826 -        TRC(printk("pdb breakpoint detected at 0x%lx:0x%lx\n", cr3, addr));
   6.827 -    }
   6.828 -    else if ( pdb_bkpt_remove(cr3, addr) == 0 )
   6.829 -    {
   6.830 -        /* removing a breakpoint */
   6.831 -        TRC(printk("pdb breakpoint cleared at 0x%lx:0x%lx\n", cr3, addr));
   6.832 -    }
   6.833 -}
   6.834 -
   6.835 -/***********************************************************************/
   6.836 -
   6.837 -int pdb_change_values(u_char *buffer, int length,
   6.838 -		      unsigned long cr3, unsigned long addr, int rw);
   6.839 -int pdb_change_values_one_page(u_char *buffer, int length,
   6.840 -			       unsigned long cr3, unsigned long addr, int rw);
   6.841 -
   6.842 -#define __PDB_GET_VAL 1
   6.843 -#define __PDB_SET_VAL 2
   6.844 -
   6.845 -/*
   6.846 - * Set memory in a domain's address space
   6.847 - * Set "length" bytes at "address" from "domain" to the values in "buffer".
   6.848 - * Return the number of bytes set, 0 if there was a problem.
   6.849 - */
   6.850 -
   6.851 -int pdb_set_values(u_char *buffer, int length,
   6.852 -		   unsigned long cr3, unsigned long addr)
   6.853 -{
   6.854 -    int count = pdb_change_values(buffer, length, cr3, addr, __PDB_SET_VAL);
   6.855 -    return count;
   6.856 -}
   6.857 -
   6.858 -/*
   6.859 - * Read memory from a domain's address space.
   6.860 - * Fetch "length" bytes at "address" from "domain" into "buffer".
   6.861 - * Return the number of bytes read, 0 if there was a problem.
   6.862 - */
   6.863 -
   6.864 -int pdb_get_values(u_char *buffer, int length,
   6.865 -		   unsigned long cr3, unsigned long addr)
   6.866 -{
   6.867 -  return pdb_change_values(buffer, length, cr3, addr, __PDB_GET_VAL);
   6.868 -}
   6.869 -
   6.870 -/*
   6.871 - * Read or write memory in an address space
   6.872 - */
   6.873 -int pdb_change_values(u_char *buffer, int length,
   6.874 -		      unsigned long cr3, unsigned long addr, int rw)
   6.875 -{
   6.876 -    int remaining;                /* number of bytes to touch past this page */
   6.877 -    int bytes = 0;
   6.878 -
   6.879 -    while ( (remaining = (addr + length - 1) - (addr | (PAGE_SIZE - 1))) > 0)
   6.880 -    {
   6.881 -        bytes += pdb_change_values_one_page(buffer, length - remaining, 
   6.882 -					    cr3, addr, rw);
   6.883 -	buffer = buffer + (2 * (length - remaining));
   6.884 -	length = remaining;
   6.885 -	addr = (addr | (PAGE_SIZE - 1)) + 1;
   6.886 -    }
   6.887 -
   6.888 -    bytes += pdb_change_values_one_page(buffer, length, cr3, addr, rw);
   6.889 -    return bytes;
   6.890 -}
   6.891 -
   6.892 -/*
   6.893 - * Change memory in a process' address space in one page
   6.894 - * Read or write "length" bytes at "address" into/from "buffer"
   6.895 - * from the virtual address space referenced by "cr3".
   6.896 - * Return the number of bytes read, 0 if there was a problem.
   6.897 - */
   6.898 -
   6.899 -int pdb_change_values_one_page(u_char *buffer, int length,
   6.900 -			       unsigned long cr3, unsigned long addr, int rw)
   6.901 -{
   6.902 -    l2_pgentry_t* l2_table = NULL;                         /* page directory */
   6.903 -    l1_pgentry_t* l1_table = NULL;                             /* page table */
   6.904 -    u_char *page;                                                 /* 4k page */
   6.905 -    int bytes = 0;
   6.906 -
   6.907 -    l2_table = map_domain_mem(cr3); 
   6.908 -    l2_table += l2_table_offset(addr);
   6.909 -    if (!(l2_pgentry_val(*l2_table) & _PAGE_PRESENT)) 
   6.910 -    {
   6.911 -	if (pdb_page_fault_possible == 1)
   6.912 -	{
   6.913 -	    pdb_page_fault = 1;
   6.914 -	    TRC(printk("pdb: L2 error (0x%lx)\n", addr));
   6.915 -	}
   6.916 -	else
   6.917 -	{
   6.918 -	    printk ("pdb error: cr3: 0x%lx    dom0cr3:  0x%lx\n",  cr3,
   6.919 -		    dom0->mm.shadow_mode ? pagetable_val(dom0->mm.shadow_table)
   6.920 -		    : pagetable_val(dom0->mm.pagetable));
   6.921 -	    printk ("pdb error: L2:0x%p (0x%lx)\n", 
   6.922 -		    l2_table, l2_pgentry_val(*l2_table));
   6.923 -	}
   6.924 -	goto exit2;
   6.925 -    }
   6.926 -
   6.927 -    if (l2_pgentry_val(*l2_table) & _PAGE_PSE)
   6.928 -    {
   6.929 -#define PSE_PAGE_SHIFT           L2_PAGETABLE_SHIFT
   6.930 -#define PSE_PAGE_SIZE	         (1UL << PSE_PAGE_SHIFT)
   6.931 -#define PSE_PAGE_MASK	         (~(PSE_PAGE_SIZE-1))
   6.932 -
   6.933 -#define L1_PAGE_BITS ( (ENTRIES_PER_L1_PAGETABLE - 1) << L1_PAGETABLE_SHIFT )
   6.934 -
   6.935 -#define pse_pgentry_to_phys(_x) (l2_pgentry_val(_x) & PSE_PAGE_MASK)
   6.936 -
   6.937 -        page = map_domain_mem(pse_pgentry_to_phys(*l2_table) +    /* 10 bits */
   6.938 -			      (addr & L1_PAGE_BITS));             /* 10 bits */
   6.939 -	page += addr & (PAGE_SIZE - 1);                           /* 12 bits */
   6.940 -    }
   6.941 -    else
   6.942 -    {
   6.943 -        l1_table = map_domain_mem(l2_pgentry_to_phys(*l2_table));
   6.944 -	l1_table += l1_table_offset(addr); 
   6.945 -	if (!(l1_pgentry_val(*l1_table) & _PAGE_PRESENT))
   6.946 -	{
   6.947 -	    if (pdb_page_fault_possible == 1)
   6.948 -	    {
   6.949 -	        pdb_page_fault = 1;
   6.950 -		TRC(printk ("pdb: L1 error (0x%lx)\n", addr));
   6.951 -	    }
   6.952 -	    else
   6.953 -	    {
   6.954 -	        printk ("L2:0x%p (0x%lx) L1:0x%p (0x%lx)\n", 
   6.955 -			l2_table, l2_pgentry_val(*l2_table),
   6.956 -			l1_table, l1_pgentry_val(*l1_table));
   6.957 -	    }
   6.958 -	    goto exit1;
   6.959 -	}
   6.960 -
   6.961 -	page = map_domain_mem(l1_pgentry_to_phys(*l1_table));
   6.962 -	page += addr & (PAGE_SIZE - 1);
   6.963 -    }
   6.964 -
   6.965 -    switch (rw)
   6.966 -    {
   6.967 -    case __PDB_GET_VAL:                                              /* read */
   6.968 -        memcpy (buffer, page, length);
   6.969 -	bytes = length;
   6.970 -	break;
   6.971 -    case __PDB_SET_VAL:                                             /* write */
   6.972 -        hex2mem (buffer, page, length);
   6.973 -	bytes = length;
   6.974 -	break;
   6.975 -    default:                                                      /* unknown */
   6.976 -        printk ("error: unknown RW flag: %d\n", rw);
   6.977 -	return 0;
   6.978 -    }
   6.979 -
   6.980 -    unmap_domain_mem((void *)page); 
   6.981 -exit1:
   6.982 -    if (l1_table != NULL)
   6.983 -        unmap_domain_mem((void *)l1_table);
   6.984 -exit2:
   6.985 -    unmap_domain_mem((void *)l2_table);
   6.986 -
   6.987 -    return bytes;
   6.988 -}
   6.989 -
   6.990 -/***********************************************************************/
   6.991 -
   6.992 -void breakpoint(void);
   6.993 -
   6.994 -/* send the packet in buffer.  */
   6.995 -void pdb_put_packet (unsigned char *buffer, int ack)
   6.996 -{
   6.997 -    unsigned char checksum;
   6.998 -    int count;
   6.999 -    char ch;
  6.1000 -    
  6.1001 -    /*  $<packet info>#<checksum> */
  6.1002 -    /*  do */
  6.1003 -    {
  6.1004 -        pdb_put_char ('$');
  6.1005 -	checksum = 0;
  6.1006 -	count = 0;
  6.1007 -
  6.1008 -	while ((ch = buffer[count]))
  6.1009 -	{
  6.1010 -            pdb_put_char (ch);
  6.1011 -	    checksum += ch;
  6.1012 -	    count += 1;
  6.1013 -        }
  6.1014 -
  6.1015 -	pdb_put_char('#');
  6.1016 -	pdb_put_char(hexchars[checksum >> 4]);
  6.1017 -	pdb_put_char(hexchars[checksum % 16]);
  6.1018 -    }
  6.1019 -
  6.1020 -    if (ack)
  6.1021 -    {
  6.1022 -	if ((ch = pdb_get_char()) != '+')
  6.1023 -	{
  6.1024 -	    printk(" pdb return error: %c 0x%x [%s]\n", ch, ch, buffer);
  6.1025 -	}
  6.1026 -    }
  6.1027 -}
  6.1028 -
  6.1029 -void pdb_get_packet(char *buffer)
  6.1030 -{
  6.1031 -    int count;
  6.1032 -    char ch;
  6.1033 -    unsigned char checksum = 0;
  6.1034 -    unsigned char xmitcsum = 0;
  6.1035 -
  6.1036 -    do
  6.1037 -    {
  6.1038 -        while ((ch = pdb_get_char()) != '$');
  6.1039 -
  6.1040 -	count = 0;
  6.1041 -	checksum = 0;
  6.1042 -
  6.1043 -	while (count < BUFMAX)
  6.1044 -	{
  6.1045 -	    ch = pdb_get_char();
  6.1046 -	    if (ch  == '#') break;
  6.1047 -	    checksum += ch;
  6.1048 -	    buffer[count] = ch;
  6.1049 -	    count++;
  6.1050 -	}
  6.1051 -	buffer[count] = 0;
  6.1052 -
  6.1053 -	if (ch == '#')
  6.1054 -	{
  6.1055 -	    xmitcsum = hex(pdb_get_char()) << 4;
  6.1056 -	    xmitcsum += hex(pdb_get_char());
  6.1057 -
  6.1058 -	    if (xmitcsum == checksum)
  6.1059 -	    {
  6.1060 -	        pdb_put_char('+');
  6.1061 -		if (buffer[2] == ':')
  6.1062 -		{
  6.1063 -		    printk ("pdb: obsolete gdb packet (sequence ID)\n");
  6.1064 -		}
  6.1065 -	    }
  6.1066 -	    else
  6.1067 -	    {
  6.1068 -	        pdb_put_char('-');
  6.1069 -	    }
  6.1070 -	}
  6.1071 -    } while (checksum != xmitcsum);
  6.1072 -
  6.1073 -    return;
  6.1074 -}
  6.1075 -
  6.1076 -/*
  6.1077 - * process a machine interrupt or exception
  6.1078 - * Return 1 if pdb is not interested in the exception; it should
  6.1079 - * be propagated to the guest os.
  6.1080 - */
  6.1081 -
  6.1082 -int pdb_handle_exception(int exceptionVector,
  6.1083 -			 struct xen_regs *xen_regs)
  6.1084 -{
  6.1085 -    int signal = 0;
  6.1086 -    struct pdb_breakpoint* bkpt;
  6.1087 -    int watchdog_save;
  6.1088 -    unsigned long cr3 = read_cr3();
  6.1089 -
  6.1090 -    /* No vm86 handling here as yet. */
  6.1091 -    if ( VM86_MODE(xen_regs) )
  6.1092 -        return 1;
  6.1093 -
  6.1094 -    /* If the exception is an int3 from user space then pdb is only
  6.1095 -       interested if it re-wrote an instruction set the breakpoint.
  6.1096 -       This occurs when leaving a system call from a domain.
  6.1097 -    */
  6.1098 -    if ( (exceptionVector == 3) &&
  6.1099 -	 RING_3(xen_regs) && 
  6.1100 -	 (xen_regs->eip != (pdb_system_call_next_addr + 1)) )
  6.1101 -    {
  6.1102 -        TRC(printf("pdb: user bkpt (0x%x) at 0x%x:0x%lx:0x%x\n", 
  6.1103 -		   exceptionVector, xen_regs->cs & 3, cr3, xen_regs->eip));
  6.1104 -	return 1;
  6.1105 -    }
  6.1106 -
  6.1107 -    /*
  6.1108 -     * If PDB didn't set the breakpoint, is not single stepping, 
  6.1109 -     * is not entering a system call in a domain,
  6.1110 -     * the user didn't press the magic debug key, 
  6.1111 -     * then we don't handle the exception.
  6.1112 -     */
  6.1113 -    bkpt = pdb_bkpt_search(cr3, xen_regs->eip - 1);
  6.1114 -    if ( (bkpt == NULL) &&
  6.1115 -         !pdb_stepping && 
  6.1116 -	 !pdb_system_call &&
  6.1117 -	 xen_regs->eip != pdb_system_call_next_addr + 1 &&
  6.1118 -	 (exceptionVector != KEYPRESS_EXCEPTION) &&
  6.1119 -	 xen_regs->eip < 0xc0000000)  /* Linux-specific for now! */
  6.1120 -    {
  6.1121 -        TRC(printf("pdb: user bkpt (0x%x) at 0x%lx:0x%x\n", 
  6.1122 -		   exceptionVector, cr3, xen_regs->eip));
  6.1123 -	return 1;
  6.1124 -    }
  6.1125 -
  6.1126 -    printk("pdb_handle_exception [0x%x][0x%lx:0x%x]\n",
  6.1127 -	   exceptionVector, cr3, xen_regs->eip);
  6.1128 -
  6.1129 -    if ( pdb_stepping )
  6.1130 -    {
  6.1131 -        /* Stepped one instruction; now return to normal execution. */
  6.1132 -        xen_regs->eflags &= ~X86_EFLAGS_TF;
  6.1133 -        pdb_stepping = 0;
  6.1134 -    }
  6.1135 -
  6.1136 -    if ( pdb_system_call )
  6.1137 -    {
  6.1138 -	pdb_system_call = 0;
  6.1139 -
  6.1140 -	pdb_linux_syscall_exit_bkpt (xen_regs, &pdb_ctx);
  6.1141 -
  6.1142 -	/* we don't have a saved breakpoint so we need to rewind eip */
  6.1143 -	xen_regs->eip--;
  6.1144 -	
  6.1145 -	/* if ther user doesn't care about breaking when entering a
  6.1146 -	   system call then we'll just ignore the exception */
  6.1147 -	if ( (pdb_ctx.system_call & 0x01) == 0 )
  6.1148 -	{
  6.1149 -	    return 0;
  6.1150 -	}
  6.1151 -    }
  6.1152 -
  6.1153 -    if ( exceptionVector == BREAKPT_EXCEPTION && bkpt != NULL)
  6.1154 -    {
  6.1155 -        /* Executed Int3: replace breakpoint byte with real program byte. */
  6.1156 -        xen_regs->eip--;
  6.1157 -    }
  6.1158 -
  6.1159 -    /* returning to user space after a system call */
  6.1160 -    if ( xen_regs->eip == pdb_system_call_next_addr + 1)
  6.1161 -    {
  6.1162 -        u_char instr[2];                      /* REALLY REALLY REALLY STUPID */
  6.1163 -
  6.1164 -	mem2hex (&pdb_system_call_leave_instr, instr, sizeof(instr)); 
  6.1165 -
  6.1166 -	pdb_linux_set_values (instr, 1, pdb_system_call_next_addr,
  6.1167 -			      pdb_ctx.process, pdb_ctx.ptbr);
  6.1168 -
  6.1169 -	pdb_system_call_next_addr = 0;
  6.1170 -	pdb_system_call_leave_instr = 0;
  6.1171 -
  6.1172 -	/* manually rewind eip */
  6.1173 -	xen_regs->eip--;
  6.1174 -
  6.1175 -	/* if the user doesn't care about breaking when returning 
  6.1176 -	   to user space after a system call then we'll just ignore 
  6.1177 -	   the exception */
  6.1178 -	if ( (pdb_ctx.system_call & 0x02) == 0 )
  6.1179 -	{
  6.1180 -	    return 0;
  6.1181 -	}
  6.1182 -    }
  6.1183 -
  6.1184 -    /* Generate a signal for GDB. */
  6.1185 -    switch ( exceptionVector )
  6.1186 -    {
  6.1187 -    case KEYPRESS_EXCEPTION:
  6.1188 -        signal = 2; break;                                  /* SIGINT */
  6.1189 -    case DEBUG_EXCEPTION:
  6.1190 -        signal = 5; break;                                 /* SIGTRAP */
  6.1191 -    case BREAKPT_EXCEPTION: 
  6.1192 -        signal = 5; break;                                 /* SIGTRAP */
  6.1193 -    default:
  6.1194 -        printk("pdb: can't generate signal for unknown exception vector %d\n",
  6.1195 -               exceptionVector);
  6.1196 -        break;
  6.1197 -    }
  6.1198 -
  6.1199 -    pdb_out_buffer[0] = 'S';
  6.1200 -    pdb_out_buffer[1] = hexchars[signal >> 4];
  6.1201 -    pdb_out_buffer[2] = hexchars[signal % 16];
  6.1202 -    pdb_out_buffer[3] = 0;
  6.1203 -    pdb_put_packet(pdb_out_buffer, 1);
  6.1204 -
  6.1205 -    watchdog_save = watchdog_on;
  6.1206 -    watchdog_on = 0;
  6.1207 -
  6.1208 -    do {
  6.1209 -        pdb_out_buffer[0] = 0;
  6.1210 -	pdb_get_packet(pdb_in_buffer);
  6.1211 -    }
  6.1212 -    while ( pdb_process_command(pdb_in_buffer, xen_regs, cr3, signal) == 0 );
  6.1213 -
  6.1214 -    watchdog_on = watchdog_save;
  6.1215 -
  6.1216 -    return 0;
  6.1217 -}
  6.1218 -
  6.1219 -void pdb_key_pressed(unsigned char key)
  6.1220 -{
  6.1221 -    struct xen_regs *regs = (struct xen_regs *)get_execution_context();
  6.1222 -    pdb_handle_exception(KEYPRESS_EXCEPTION, regs);
  6.1223 -}
  6.1224 -
  6.1225 -void pdb_handle_debug_trap(struct xen_regs *regs, long error_code)
  6.1226 -{
  6.1227 -    unsigned int condition;
  6.1228 -    struct domain *d = current;
  6.1229 -    struct trap_bounce *tb = &d->thread.trap_bounce;
  6.1230 -
  6.1231 -    __asm__ __volatile__("movl %%db6,%0" : "=r" (condition));
  6.1232 -    if ( (condition & (1 << 14)) != (1 << 14) )
  6.1233 -        printk("\nwarning: debug trap w/o BS bit [0x%x]\n\n", condition);
  6.1234 -    __asm__("movl %0,%%db6" : : "r" (0));
  6.1235 -
  6.1236 -    if ( pdb_handle_exception(1, regs) != 0 )
  6.1237 -    {
  6.1238 -        d->thread.debugreg[6] = condition;
  6.1239 -
  6.1240 -        tb->flags = TBF_EXCEPTION;
  6.1241 -        tb->cs    = d->thread.traps[1].cs;
  6.1242 -        tb->eip   = d->thread.traps[1].address;
  6.1243 -    }
  6.1244 -}
  6.1245 -
  6.1246 -void initialize_pdb()
  6.1247 -{
  6.1248 -    /* Certain state must be initialised even when PDB will not be used. */
  6.1249 -    memset((void *) &breakpoints, 0, sizeof(breakpoints));
  6.1250 -    INIT_LIST_HEAD(&breakpoints.list);
  6.1251 -    pdb_stepping = 0;
  6.1252 -
  6.1253 -    if ( strcmp(opt_pdb, "none") == 0 )
  6.1254 -        return;
  6.1255 -
  6.1256 -    if ( (pdb_serhnd = parse_serial_handle(opt_pdb)) == -1 )
  6.1257 -    {
  6.1258 -        printk("error: failed to initialize PDB on port %s\n", opt_pdb);
  6.1259 -        return;
  6.1260 -    }
  6.1261 -
  6.1262 -    pdb_ctx.valid = 1;
  6.1263 -    pdb_ctx.domain = -1;
  6.1264 -    pdb_ctx.process = -1;
  6.1265 -    pdb_ctx.system_call = 0;
  6.1266 -    pdb_ctx.ptbr = 0;
  6.1267 -
  6.1268 -    printk("pdb: pervasive debugger (%s)   www.cl.cam.ac.uk/netos/pdb\n", 
  6.1269 -	   opt_pdb);
  6.1270 -
  6.1271 -    /* Acknowledge any spurious GDB packets. */
  6.1272 -    pdb_put_char('+');
  6.1273 -
  6.1274 -    register_keyhandler('D', pdb_key_pressed, "enter pervasive debugger");
  6.1275 -
  6.1276 -    pdb_initialized = 1;
  6.1277 -}
  6.1278 -
  6.1279 -void breakpoint(void)
  6.1280 -{
  6.1281 -    if ( pdb_initialized )
  6.1282 -        asm("int $3");
  6.1283 -}
     7.1 --- a/xen/arch/x86/setup.c	Sat Feb 05 10:33:02 2005 +0000
     7.2 +++ b/xen/arch/x86/setup.c	Sat Feb 05 11:12:14 2005 +0000
     7.3 @@ -17,7 +17,6 @@
     7.4  #include <asm/apic.h>
     7.5  #include <asm/desc.h>
     7.6  #include <asm/domain_page.h>
     7.7 -#include <asm/pdb.h>
     7.8  #include <asm/shadow.h>
     7.9  #include <asm/e820.h>
    7.10  
    7.11 @@ -427,10 +426,6 @@ static void __init start_of_day(void)
    7.12  
    7.13      serial_init_stage2();
    7.14  
    7.15 -#ifdef XEN_DEBUGGER
    7.16 -    initialize_pdb();      /* pervasive debugger */
    7.17 -#endif
    7.18 -
    7.19      if ( !cpu_has_apic )
    7.20      {
    7.21          do_timer_lists_from_pit = 1;
     8.1 --- a/xen/arch/x86/shadow.c	Sat Feb 05 10:33:02 2005 +0000
     8.2 +++ b/xen/arch/x86/shadow.c	Sat Feb 05 11:12:14 2005 +0000
     8.3 @@ -1,4 +1,4 @@
     8.4 -/* -*-  Mode:C++; c-file-style:BSD; c-basic-offset:4; tab-width:4 -*- */
     8.5 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
     8.6  
     8.7  #include <xen/config.h>
     8.8  #include <xen/types.h>
     8.9 @@ -495,7 +495,7 @@ unsigned long shadow_l2_table(
    8.10              mk_l2_pgentry((spfn << PAGE_SHIFT) | __PAGE_HYPERVISOR);
    8.11          spl2e[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT] =
    8.12              mk_l2_pgentry(__pa(page_get_owner(&frame_table[gpfn])->mm_perdomain_pt) |
    8.13 -			  __PAGE_HYPERVISOR);
    8.14 +                          __PAGE_HYPERVISOR);
    8.15      }
    8.16  #endif
    8.17  
     9.1 --- a/xen/arch/x86/time.c	Sat Feb 05 10:33:02 2005 +0000
     9.2 +++ b/xen/arch/x86/time.c	Sat Feb 05 11:12:14 2005 +0000
     9.3 @@ -1,4 +1,4 @@
     9.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
     9.5 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
     9.6   ****************************************************************************
     9.7   * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
     9.8   * (C) 2002-2003 University of Cambridge
    10.1 --- a/xen/common/Makefile	Sat Feb 05 10:33:02 2005 +0000
    10.2 +++ b/xen/common/Makefile	Sat Feb 05 11:12:14 2005 +0000
    10.3 @@ -9,11 +9,6 @@ OBJS := $(subst physdev.o,,$(OBJS))
    10.4  OBJS := $(subst xmalloc.o,,$(OBJS))
    10.5  endif
    10.6  
    10.7 -ifneq ($(debugger),y)
    10.8 -OBJS := $(subst debug.o,,$(OBJS))
    10.9 -OBJS := $(subst debug-linux.o,,$(OBJS))
   10.10 -endif
   10.11 -
   10.12  ifneq ($(perfc),y)
   10.13  OBJS := $(subst perfc.o,,$(OBJS))
   10.14  endif
    11.1 --- a/xen/common/ac_timer.c	Sat Feb 05 10:33:02 2005 +0000
    11.2 +++ b/xen/common/ac_timer.c	Sat Feb 05 11:12:14 2005 +0000
    11.3 @@ -1,4 +1,4 @@
    11.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
    11.5 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
    11.6   ****************************************************************************
    11.7   * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
    11.8   * (C) 2002-2003 University of Cambridge
    12.1 --- a/xen/common/debug-linux.c	Sat Feb 05 10:33:02 2005 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,267 +0,0 @@
    12.4 -
    12.5 -/*
    12.6 - * pervasive debugger
    12.7 - * www.cl.cam.ac.uk/netos/pdb
    12.8 - *
    12.9 - * alex ho
   12.10 - * 2004
   12.11 - * university of cambridge computer laboratory
   12.12 - *
   12.13 - * linux specific pdb stuff 
   12.14 - */
   12.15 -
   12.16 -#include <xen/config.h>
   12.17 -#include <xen/types.h>
   12.18 -#include <xen/lib.h>
   12.19 -#include <public/dom0_ops.h>
   12.20 -#include <asm/pdb.h>
   12.21 -
   12.22 -/* from linux/sched.h */
   12.23 -#define PIDHASH_SZ (4096 >> 2)
   12.24 -#define pid_hashfn(x)	((((x) >> 8) ^ (x)) & (PIDHASH_SZ - 1))
   12.25 -
   12.26 -/* from asm-xen/pgtable-2level.h */
   12.27 -#define PGDIR_SHIFT	22
   12.28 -#define PTRS_PER_PGD	1024
   12.29 -
   12.30 -/* from asm-xen/page.h */
   12.31 -#define PAGE_SHIFT	12
   12.32 -#define PAGE_SIZE	(1UL << PAGE_SHIFT)
   12.33 -#define PAGE_MASK	(~(PAGE_SIZE-1))
   12.34 -
   12.35 -#define __PAGE_OFFSET		(0xC0000000)
   12.36 -#define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
   12.37 -#define __pa(x)			((unsigned long)(x)-PAGE_OFFSET)
   12.38 -#define __va(x)			((void *)((unsigned long)(x)+PAGE_OFFSET))
   12.39 -
   12.40 -/* from debug.h */
   12.41 -#define ENTRIES_PER_L1_PAGETABLE 1024
   12.42 -#define L1_PAGE_BITS ( (ENTRIES_PER_L1_PAGETABLE - 1) << PAGE_SHIFT )
   12.43 -
   12.44 -void pdb_linux_process_details (unsigned long cr3, int pid, char *buffer);
   12.45 -
   12.46 -/* adapted from asm-xen/page.h */
   12.47 -static inline unsigned long machine_to_phys(unsigned long cr3,
   12.48 -                                            unsigned long machine)
   12.49 -{
   12.50 -  unsigned long phys;
   12.51 -  pdb_get_values((u_char *) &phys, sizeof(phys), cr3,
   12.52 -		 (unsigned long) machine_to_phys_mapping + 
   12.53 -                 (machine >> PAGE_SHIFT) * 4);
   12.54 -  phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
   12.55 -  return phys;
   12.56 -}
   12.57 -
   12.58 -unsigned long pdb_pidhash_addr         = 0xc01971e0UL;
   12.59 -unsigned long pdb_init_task_union_addr = 0xc0182000UL;
   12.60 -
   12.61 -
   12.62 -unsigned int task_struct_mm_offset           = 0x2c;
   12.63 -unsigned int task_struct_next_task_offset    = 0x48;
   12.64 -unsigned int task_struct_pid_offset          = 0x7c;
   12.65 -unsigned int task_struct_pidhash_next_offset = 0xb0;
   12.66 -unsigned int task_struct_comm_offset         = 0x23e;
   12.67 -unsigned int task_struct_comm_length         = 0x10;
   12.68 -
   12.69 -unsigned int mm_struct_pgd_offset            = 0x0c;
   12.70 -
   12.71 -/*
   12.72 - * find the task structure of a process (pid)
   12.73 - * given the cr3 of the guest os.
   12.74 - */
   12.75 -unsigned long pdb_linux_pid_task_struct (unsigned long cr3, int pid)
   12.76 -{
   12.77 -  unsigned long task_struct_p = (unsigned long) NULL;
   12.78 -  unsigned long task_struct_pid;
   12.79 -
   12.80 -  /* find the task_struct of the given process */
   12.81 -  pdb_get_values((u_char *) &task_struct_p, sizeof(task_struct_p),
   12.82 -		 cr3, pdb_pidhash_addr + pid_hashfn(pid) * 4);
   12.83 -
   12.84 -  /* find the correct task struct */
   12.85 -  while (task_struct_p != (unsigned long)NULL)
   12.86 -  {
   12.87 -    pdb_get_values((u_char *) &task_struct_pid, sizeof(task_struct_pid),
   12.88 -		   cr3, task_struct_p + task_struct_pid_offset);
   12.89 -    if (task_struct_pid == pid)
   12.90 -    {
   12.91 -      break;
   12.92 -    }
   12.93 -
   12.94 -    pdb_get_values((u_char *) &task_struct_p, sizeof(task_struct_p),
   12.95 -		   cr3, task_struct_p + task_struct_pidhash_next_offset);
   12.96 -  }
   12.97 -  if (task_struct_p == (unsigned long) NULL)
   12.98 -  {
   12.99 -    /* oops */
  12.100 -    printk ("pdb error: couldn't find process 0x%x (0x%lx)\n", pid, cr3);
  12.101 -  }
  12.102 -
  12.103 -  return task_struct_p;
  12.104 -}
  12.105 -
  12.106 -/*
  12.107 - * find the ptbr of a process (pid)
  12.108 - * given the cr3 of the guest os.
  12.109 - */
  12.110 -unsigned long pdb_linux_pid_ptbr (unsigned long cr3, int pid)
  12.111 -{
  12.112 -  unsigned long task_struct_p;
  12.113 -  unsigned long mm_p, pgd;
  12.114 -
  12.115 -  task_struct_p = pdb_linux_pid_task_struct(cr3, pid);
  12.116 -  if (task_struct_p == (unsigned long) NULL)
  12.117 -  {
  12.118 -    return (unsigned long) NULL;
  12.119 -  }
  12.120 -
  12.121 -  /* get the mm_struct within the task_struct */
  12.122 -  pdb_get_values((u_char *) &mm_p, sizeof(mm_p),
  12.123 -		 cr3, task_struct_p + task_struct_mm_offset);
  12.124 -  /* get the page global directory (cr3) within the mm_struct */
  12.125 -  pdb_get_values((u_char *) &pgd, sizeof(pgd),
  12.126 -		 cr3, mm_p + mm_struct_pgd_offset);
  12.127 -
  12.128 -  return pgd;
  12.129 -}
  12.130 -
  12.131 -
  12.132 -
  12.133 -/* read a byte from a process 
  12.134 - *
  12.135 - * in: pid: process id
  12.136 - *     cr3: ptbr for the process' domain
  12.137 - *     addr: address to read
  12.138 - */
  12.139 -
  12.140 -u_char pdb_linux_get_value(int pid, unsigned long cr3, unsigned long addr)
  12.141 -{
  12.142 -  u_char result = 0;
  12.143 -  unsigned long pgd;
  12.144 -  unsigned long l2tab, page;
  12.145 -
  12.146 -  /* get the process' pgd */
  12.147 -  pgd = pdb_linux_pid_ptbr(cr3, pid);
  12.148 -
  12.149 -  /* get the l2 table entry */
  12.150 -  pdb_get_values((u_char *) &l2tab, sizeof(l2tab),
  12.151 -		 cr3, pgd + (addr >> PGDIR_SHIFT) * 4);
  12.152 -  l2tab = (unsigned long)__va(machine_to_phys(cr3, l2tab) & PAGE_MASK);
  12.153 -
  12.154 -  /* get the page table entry */
  12.155 -  pdb_get_values((u_char *) &page, sizeof(page),
  12.156 -		 cr3, l2tab + ((addr & L1_PAGE_BITS) >> PAGE_SHIFT) * 4);
  12.157 -  page = (unsigned long)__va(machine_to_phys(cr3, page) & PAGE_MASK);
  12.158 -
  12.159 -  /* get the byte */
  12.160 -  pdb_get_values((u_char *) &result, sizeof(result),
  12.161 -		 cr3, page + (addr & ~PAGE_MASK));
  12.162 -
  12.163 -  return result;
  12.164 -}
  12.165 -
  12.166 -void pdb_linux_get_values(char *buffer, int length, unsigned long address,
  12.167 -			  int pid, unsigned long cr3)
  12.168 -{
  12.169 -    int loop;
  12.170 -
  12.171 -    /* yes, this can be optimized... a lot */
  12.172 -    for (loop = 0; loop < length; loop++)
  12.173 -    {
  12.174 -        buffer[loop] = pdb_linux_get_value(pid, cr3, address + loop);
  12.175 -    }
  12.176 -}
  12.177 -
  12.178 - 
  12.179 -void pdb_linux_set_value(int pid, unsigned long cr3, unsigned long addr,
  12.180 -			 u_char *value)
  12.181 -{
  12.182 -    unsigned long pgd;
  12.183 -    unsigned long l2tab, page;
  12.184 - 
  12.185 -    /* get the process' pgd */
  12.186 -    pgd = pdb_linux_pid_ptbr(cr3, pid);
  12.187 - 
  12.188 -    /* get the l2 table entry */
  12.189 -    pdb_get_values((u_char *) &l2tab, sizeof(l2tab),
  12.190 -		   cr3, pgd + (addr >> PGDIR_SHIFT) * 4);
  12.191 -    l2tab = (unsigned long)__va(machine_to_phys(cr3, l2tab) & PAGE_MASK);
  12.192 - 
  12.193 -    /* get the page table entry */
  12.194 -    pdb_get_values((u_char *) &page, sizeof(page),
  12.195 -		   cr3, l2tab + ((addr & L1_PAGE_BITS) >> PAGE_SHIFT) * 4);
  12.196 -    page = (unsigned long)__va(machine_to_phys(cr3, page) & PAGE_MASK);
  12.197 - 
  12.198 -    /* set the byte */
  12.199 -    pdb_set_values(value, sizeof(u_char), cr3, page + (addr & ~PAGE_MASK));
  12.200 -}
  12.201 - 
  12.202 -void pdb_linux_set_values(char *buffer, int length, unsigned long address,
  12.203 -			  int pid, unsigned long cr3)
  12.204 -{
  12.205 -    int loop;
  12.206 - 
  12.207 -    /* it's difficult to imagine a more inefficient algorithm */
  12.208 -    for (loop = 0; loop < length; loop++)
  12.209 -    {
  12.210 -        pdb_linux_set_value(pid, cr3, address + loop, &buffer[loop * 2]);
  12.211 -    }
  12.212 -}
  12.213 -
  12.214 -/**********************************************************************/
  12.215 -
  12.216 -/*
  12.217 - * return 1 if is the virtual address is in the operating system's
  12.218 - * address space, else 0 
  12.219 - */
  12.220 -int pdb_linux_address_space (unsigned long addr)
  12.221 -{
  12.222 -    return (addr > PAGE_OFFSET);
  12.223 -}
  12.224 -
  12.225 -/* get a list of at most "max" processes
  12.226 - * return: number of threads found
  12.227 - *
  12.228 - *   init_task -> init_task_union.task
  12.229 - *   while (next_task != init_task) {}
  12.230 - */
  12.231 -int pdb_linux_process_list (unsigned long cr3, int array[], int max)
  12.232 -{
  12.233 -  unsigned long task_p, next_p;
  12.234 -  int pid;
  12.235 -  int count = 0;
  12.236 -
  12.237 -  /* task_p = init_task->next_task  */
  12.238 -  pdb_get_values((u_char *) &task_p, sizeof(task_p),
  12.239 -		 cr3, pdb_init_task_union_addr + task_struct_next_task_offset);
  12.240 -  
  12.241 -  while (task_p != pdb_init_task_union_addr)
  12.242 -  {
  12.243 -      pdb_get_values((u_char *) &pid, sizeof(pid),
  12.244 -		     cr3, task_p + task_struct_pid_offset);
  12.245 -
  12.246 -      array[count % max] = pid;
  12.247 -      count++;
  12.248 -
  12.249 -      pdb_get_values((u_char *) &next_p, sizeof(next_p),
  12.250 -		     cr3, task_p + task_struct_next_task_offset);
  12.251 -      task_p = next_p;
  12.252 -  }
  12.253 -
  12.254 -  return count;
  12.255 -}
  12.256 -
  12.257 -/*
  12.258 - * get additional details about a particular process
  12.259 - */
  12.260 -void pdb_linux_process_details (unsigned long cr3, int pid, char *buffer)
  12.261 -{
  12.262 -  unsigned long task_struct_p;
  12.263 -
  12.264 -  task_struct_p = pdb_linux_pid_task_struct(cr3, pid);
  12.265 -
  12.266 -  pdb_get_values((u_char *) buffer, task_struct_comm_length,
  12.267 -		 cr3, task_struct_p + task_struct_comm_offset);
  12.268 -  return;
  12.269 -}
  12.270 -
    13.1 --- a/xen/common/debug.c	Sat Feb 05 10:33:02 2005 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,113 +0,0 @@
    13.4 -/*
    13.5 - * debug.c
    13.6 - *
    13.7 - * xen pervasive debugger
    13.8 - */
    13.9 -
   13.10 -#include <xen/config.h>
   13.11 -#include <xen/types.h>
   13.12 -#include <xen/lib.h>
   13.13 -#include <public/dom0_ops.h>
   13.14 -#include <xen/sched.h>
   13.15 -#include <xen/event.h>
   13.16 -#include <asm/page.h>
   13.17 -#include <asm/pdb.h>
   13.18 -#include <asm/shadow.h>
   13.19 -
   13.20 -#undef DEBUG_TRACE
   13.21 -#ifdef DEBUG_TRACE
   13.22 -#define TRC(_x) _x
   13.23 -#else
   13.24 -#define TRC(_x)
   13.25 -#endif
   13.26 -
   13.27 -/****************************************************************************/
   13.28 -
   13.29 -extern u_char pdb_linux_get_value(int pid, unsigned long cr3, 
   13.30 -				  unsigned long addr);
   13.31 -
   13.32 -/*
   13.33 - * interactively call pervasive debugger from a privileged domain
   13.34 - */
   13.35 -void pdb_do_debug (dom0_op_t *op)
   13.36 -{
   13.37 -    op->u.debug.status = 0;
   13.38 -
   13.39 -    TRC(printk("PDB: op:%c, dom:%llu, in1:%x, in2:%x, in3:%x, in4:%x\n",
   13.40 -	       op->u.debug.opcode, op->u.debug.domain,
   13.41 -	       op->u.debug.in1, op->u.debug.in2,
   13.42 -	       op->u.debug.in3, op->u.debug.in4));
   13.43 -
   13.44 -    /* NOT NOW
   13.45 -    if (op->u.debug.domain == 0)
   13.46 -    {
   13.47 -        op->u.debug.status = 1;
   13.48 -	return;
   13.49 -    }
   13.50 -    */
   13.51 -
   13.52 -    switch (op->u.debug.opcode)
   13.53 -    {
   13.54 -        case 'c' :
   13.55 -	{
   13.56 -	    struct domain *d = find_domain_by_id(op->u.debug.domain);
   13.57 -	    if ( d != NULL )
   13.58 -	    {
   13.59 -                domain_unpause_by_systemcontroller(d);
   13.60 -		put_domain(d);
   13.61 -	    }
   13.62 -	    else
   13.63 -	    {
   13.64 -	        op->u.debug.status = 2;                    /* invalid domain */
   13.65 -	    }
   13.66 -	    break;
   13.67 -	}
   13.68 -        case 'r' :
   13.69 -        {
   13.70 -            int loop;
   13.71 -            u_char x;
   13.72 -	    unsigned long cr3;
   13.73 -	    struct domain *d;
   13.74 -
   13.75 -	    d = find_domain_by_id(op->u.debug.domain);
   13.76 -	    if ( shadow_mode(d) )
   13.77 -	      cr3 = pagetable_val(d->mm.shadow_table);
   13.78 -	    else
   13.79 -	      cr3 = pagetable_val(d->mm.pagetable);
   13.80 -
   13.81 -            for (loop = 0; loop < op->u.debug.in2; loop++)         /* length */
   13.82 -            { 
   13.83 -                if (loop % 8 == 0)
   13.84 -                {
   13.85 -                    printk ("\n%08x ", op->u.debug.in1 + loop);
   13.86 -                }
   13.87 -                x = pdb_linux_get_value(op->u.debug.in3,
   13.88 -					cr3, op->u.debug.in1 + loop);
   13.89 -                printk (" %02x", x);
   13.90 -            }
   13.91 -            printk ("\n");
   13.92 -	    put_domain(d);
   13.93 -            break;
   13.94 -        }
   13.95 -        case 's' :
   13.96 -	{
   13.97 -	    struct domain *d = find_domain_by_id(op->u.debug.domain);
   13.98 -
   13.99 -	    if ( d != NULL )
  13.100 -	    {
  13.101 -                domain_pause_by_systemcontroller(d);
  13.102 -		put_domain(d);
  13.103 -	    }
  13.104 -	    else
  13.105 -	    {
  13.106 -	        op->u.debug.status = 2;                    /* invalid domain */
  13.107 -	    }
  13.108 -	    break;
  13.109 -	}
  13.110 -        default :
  13.111 -	{
  13.112 -	    printk("PDB error: unknown debug opcode %c (0x%x)\n",
  13.113 -		   op->u.debug.opcode, op->u.debug.opcode);
  13.114 -	}
  13.115 -    }
  13.116 -}
    14.1 --- a/xen/common/dom0_ops.c	Sat Feb 05 10:33:02 2005 +0000
    14.2 +++ b/xen/common/dom0_ops.c	Sat Feb 05 11:12:14 2005 +0000
    14.3 @@ -1,3 +1,4 @@
    14.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    14.5  /******************************************************************************
    14.6   * dom0_ops.c
    14.7   * 
    14.8 @@ -14,7 +15,6 @@
    14.9  #include <xen/sched.h>
   14.10  #include <xen/event.h>
   14.11  #include <asm/domain_page.h>
   14.12 -#include <asm/pdb.h>
   14.13  #include <xen/trace.h>
   14.14  #include <xen/console.h>
   14.15  #include <asm/shadow.h>
   14.16 @@ -374,16 +374,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   14.17      }
   14.18      break;
   14.19  
   14.20 -#ifdef XEN_DEBUGGER
   14.21 -    case DOM0_DEBUG:
   14.22 -    {
   14.23 -        pdb_do_debug(op);
   14.24 -        copy_to_user(u_dom0_op, op, sizeof(*op));
   14.25 -        ret = 0;
   14.26 -    }
   14.27 -    break;
   14.28 -#endif
   14.29 -
   14.30      case DOM0_SETTIME:
   14.31      {
   14.32          do_settime(op->u.settime.secs, 
    15.1 --- a/xen/common/dom_mem_ops.c	Sat Feb 05 10:33:02 2005 +0000
    15.2 +++ b/xen/common/dom_mem_ops.c	Sat Feb 05 11:12:14 2005 +0000
    15.3 @@ -1,3 +1,4 @@
    15.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    15.5  /******************************************************************************
    15.6   * dom_mem_ops.c
    15.7   *
    15.8 @@ -141,7 +142,7 @@ do_dom_mem_op(unsigned long  op,
    15.9      else if ( unlikely(!IS_PRIV(current->domain)) )
   15.10          return -EPERM;
   15.11      else if ( unlikely((d = find_domain_by_id(domid)) == NULL) )
   15.12 -	return -ESRCH;
   15.13 +        return -ESRCH;
   15.14  
   15.15      LOCK_BIGLOCK(d);
   15.16  
   15.17 @@ -150,18 +151,18 @@ do_dom_mem_op(unsigned long  op,
   15.18      case MEMOP_increase_reservation:
   15.19          rc = alloc_dom_mem(
   15.20              d, extent_list, start_extent, nr_extents, extent_order);
   15.21 -	break;
   15.22 +        break;
   15.23      case MEMOP_decrease_reservation:
   15.24          rc = free_dom_mem(
   15.25              d, extent_list, start_extent, nr_extents, extent_order);
   15.26 -	break;
   15.27 +        break;
   15.28      default:
   15.29          rc = -ENOSYS;
   15.30          break;
   15.31      }
   15.32  
   15.33      if ( unlikely(domid != DOMID_SELF) )
   15.34 -	put_domain(d);
   15.35 +        put_domain(d);
   15.36  
   15.37      UNLOCK_BIGLOCK(d);
   15.38  
    16.1 --- a/xen/common/domain.c	Sat Feb 05 10:33:02 2005 +0000
    16.2 +++ b/xen/common/domain.c	Sat Feb 05 11:12:14 2005 +0000
    16.3 @@ -1,3 +1,4 @@
    16.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    16.5  /******************************************************************************
    16.6   * domain.c
    16.7   * 
    17.1 --- a/xen/common/elf.c	Sat Feb 05 10:33:02 2005 +0000
    17.2 +++ b/xen/common/elf.c	Sat Feb 05 11:12:14 2005 +0000
    17.3 @@ -1,3 +1,4 @@
    17.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    17.5  /******************************************************************************
    17.6   * elf.c
    17.7   * 
    18.1 --- a/xen/common/event_channel.c	Sat Feb 05 10:33:02 2005 +0000
    18.2 +++ b/xen/common/event_channel.c	Sat Feb 05 11:12:14 2005 +0000
    18.3 @@ -1,3 +1,4 @@
    18.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    18.5  /******************************************************************************
    18.6   * event_channel.c
    18.7   * 
    19.1 --- a/xen/common/grant_table.c	Sat Feb 05 10:33:02 2005 +0000
    19.2 +++ b/xen/common/grant_table.c	Sat Feb 05 11:12:14 2005 +0000
    19.3 @@ -1,3 +1,4 @@
    19.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    19.5  /******************************************************************************
    19.6   * common/grant_table.c
    19.7   * 
    19.8 @@ -574,7 +575,7 @@ grant_table_create(
    19.9  
   19.10      /* Active grant table. */
   19.11      if ( (t->active = xmalloc_array(active_grant_entry_t, NR_GRANT_ENTRIES))
   19.12 -	 == NULL )
   19.13 +         == NULL )
   19.14          goto no_mem;
   19.15      memset(t->active, 0, sizeof(active_grant_entry_t) * NR_GRANT_ENTRIES);
   19.16  
    20.1 --- a/xen/common/kernel.c	Sat Feb 05 10:33:02 2005 +0000
    20.2 +++ b/xen/common/kernel.c	Sat Feb 05 11:12:14 2005 +0000
    20.3 @@ -1,3 +1,4 @@
    20.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    20.5  /******************************************************************************
    20.6   * kernel.c
    20.7   * 
    21.1 --- a/xen/common/keyhandler.c	Sat Feb 05 10:33:02 2005 +0000
    21.2 +++ b/xen/common/keyhandler.c	Sat Feb 05 11:12:14 2005 +0000
    21.3 @@ -1,3 +1,4 @@
    21.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    21.5  /******************************************************************************
    21.6   * keyhandler.c
    21.7   */
    22.1 --- a/xen/common/lib.c	Sat Feb 05 10:33:02 2005 +0000
    22.2 +++ b/xen/common/lib.c	Sat Feb 05 11:12:14 2005 +0000
    22.3 @@ -1,3 +1,4 @@
    22.4 +/* -*-  Mode:C; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
    22.5  
    22.6  #include <xen/ctype.h>
    22.7  #include <xen/lib.h>
    22.8 @@ -394,9 +395,9 @@ u64
    22.9   */
   22.10  u64 __umoddi3(u64 a, u64 b)
   22.11  {
   22.12 -    u64 rem;
   22.13 -    __qdivrem(a, b, &rem);
   22.14 -    return rem;
   22.15 +	u64 rem;
   22.16 +	__qdivrem(a, b, &rem);
   22.17 +	return rem;
   22.18  }
   22.19  
   22.20  /*
   22.21 @@ -425,19 +426,18 @@ s64 __moddi3(s64 a, s64 b)
   22.22  		ub = b, neg2 = 0;
   22.23  	__qdivrem(ua, ub, &urem);
   22.24      
   22.25 -    /* There 4 different cases: */
   22.26 -    if(neg1)
   22.27 -    {
   22.28 -        if(neg2)
   22.29 -            return -urem;
   22.30 -        else
   22.31 -            return ub - urem;
   22.32 -    }   
   22.33 -    else
   22.34 -        if(neg2)
   22.35 -            return -ub + urem;
   22.36 -        else
   22.37 -            return urem;
   22.38 +	/* There 4 different cases: */
   22.39 +	if (neg1) {
   22.40 +		if (neg2)
   22.41 +			return -urem;
   22.42 +		else
   22.43 +			return ub - urem;
   22.44 +	} else {
   22.45 +		if (neg2)
   22.46 +			return -ub + urem;
   22.47 +		else
   22.48 +			return urem;
   22.49 +	}
   22.50  }
   22.51  
   22.52  #endif /* BITS_PER_LONG == 32 */
    23.1 --- a/xen/common/multicall.c	Sat Feb 05 10:33:02 2005 +0000
    23.2 +++ b/xen/common/multicall.c	Sat Feb 05 11:12:14 2005 +0000
    23.3 @@ -1,3 +1,4 @@
    23.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    23.5  /******************************************************************************
    23.6   * multicall.c
    23.7   */
    24.1 --- a/xen/common/page_alloc.c	Sat Feb 05 10:33:02 2005 +0000
    24.2 +++ b/xen/common/page_alloc.c	Sat Feb 05 11:12:14 2005 +0000
    24.3 @@ -1,3 +1,4 @@
    24.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    24.5  /******************************************************************************
    24.6   * page_alloc.c
    24.7   * 
    24.8 @@ -262,8 +263,8 @@ struct pfn_info *alloc_heap_pages(unsign
    24.9  
   24.10      /* Find smallest order which can satisfy the request. */
   24.11      for ( i = order; i <= MAX_ORDER; i++ )
   24.12 -	if ( !list_empty(&heap[zone][i]) )
   24.13 -	    goto found;
   24.14 +        if ( !list_empty(&heap[zone][i]) )
   24.15 +            goto found;
   24.16  
   24.17      /* No suitable memory blocks. Fail the request. */
   24.18      spin_unlock(&heap_lock);
    25.1 --- a/xen/common/perfc.c	Sat Feb 05 10:33:02 2005 +0000
    25.2 +++ b/xen/common/perfc.c	Sat Feb 05 11:12:14 2005 +0000
    25.3 @@ -1,3 +1,4 @@
    25.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    25.5  
    25.6  #include <xen/lib.h>
    25.7  #include <xen/smp.h>
    25.8 @@ -22,7 +23,7 @@
    25.9  static struct {
   25.10      char *name;
   25.11      enum { TYPE_SINGLE, TYPE_CPU, TYPE_ARRAY,
   25.12 -	   TYPE_S_SINGLE, TYPE_S_CPU, TYPE_S_ARRAY
   25.13 +           TYPE_S_SINGLE, TYPE_S_CPU, TYPE_S_ARRAY
   25.14      } type;
   25.15      int nr_elements;
   25.16  } perfc_info[] = {
   25.17 @@ -92,19 +93,19 @@ void perfc_reset(unsigned char key)
   25.18          switch ( perfc_info[i].type )
   25.19          {
   25.20          case TYPE_SINGLE:
   25.21 -	    atomic_set(&counters[0],0);
   25.22 +            atomic_set(&counters[0],0);
   25.23          case TYPE_S_SINGLE:
   25.24              counters += 1;
   25.25              break;
   25.26          case TYPE_CPU:
   25.27              for ( j = sum = 0; j < smp_num_cpus; j++ )
   25.28 -	      	atomic_set(&counters[j],0);
   25.29 +                atomic_set(&counters[j],0);
   25.30          case TYPE_S_CPU:
   25.31              counters += NR_CPUS;
   25.32              break;
   25.33          case TYPE_ARRAY:
   25.34              for ( j = sum = 0; j < perfc_info[i].nr_elements; j++ )
   25.35 -	      	atomic_set(&counters[j],0);
   25.36 +                atomic_set(&counters[j],0);
   25.37          case TYPE_S_ARRAY:
   25.38              counters += perfc_info[i].nr_elements;
   25.39              break;
    26.1 --- a/xen/common/physdev.c	Sat Feb 05 10:33:02 2005 +0000
    26.2 +++ b/xen/common/physdev.c	Sat Feb 05 11:12:14 2005 +0000
    26.3 @@ -1,4 +1,4 @@
    26.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
    26.5 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
    26.6   ****************************************************************************
    26.7   * (c) 2004 - Rolf Neugebauer - Intel Research Cambridge
    26.8   * (c) 2004 - Keir Fraser - University of Cambridge
    26.9 @@ -150,9 +150,9 @@ int physdev_pci_access_modify(
   26.10  
   26.11      /* Make the domain privileged. */
   26.12      set_bit(DF_PHYSDEV, &p->d_flags);
   26.13 -	/* FIXME: MAW for now make the domain REALLY privileged so that it
   26.14 -	 * can run a backend driver (hw access should work OK otherwise) */
   26.15 -	set_bit(DF_PRIVILEGED, &p->d_flags);
   26.16 +    /* FIXME: MAW for now make the domain REALLY privileged so that it
   26.17 +     * can run a backend driver (hw access should work OK otherwise) */
   26.18 +    set_bit(DF_PRIVILEGED, &p->d_flags);
   26.19  
   26.20      /* Grant write access to the specified device. */
   26.21      if ( (pdev = pci_find_slot(bus, PCI_DEVFN(dev, func))) == NULL )
    27.1 --- a/xen/common/resource.c	Sat Feb 05 10:33:02 2005 +0000
    27.2 +++ b/xen/common/resource.c	Sat Feb 05 11:12:14 2005 +0000
    27.3 @@ -1,3 +1,4 @@
    27.4 +/* -*-  Mode:C; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
    27.5  /*
    27.6   *	linux/kernel/resource.c
    27.7   *
    28.1 --- a/xen/common/sched_atropos.c	Sat Feb 05 10:33:02 2005 +0000
    28.2 +++ b/xen/common/sched_atropos.c	Sat Feb 05 11:12:14 2005 +0000
    28.3 @@ -1,3 +1,4 @@
    28.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    28.5  /*
    28.6   * atropos.c
    28.7   * ---------
    29.1 --- a/xen/common/sched_bvt.c	Sat Feb 05 10:33:02 2005 +0000
    29.2 +++ b/xen/common/sched_bvt.c	Sat Feb 05 11:12:14 2005 +0000
    29.3 @@ -1,4 +1,4 @@
    29.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
    29.5 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
    29.6   ****************************************************************************
    29.7   * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
    29.8   * (C) 2002-2003 University of Cambridge
    30.1 --- a/xen/common/sched_rrobin.c	Sat Feb 05 10:33:02 2005 +0000
    30.2 +++ b/xen/common/sched_rrobin.c	Sat Feb 05 11:12:14 2005 +0000
    30.3 @@ -1,3 +1,4 @@
    30.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    30.5  /****************************************************************************
    30.6   * Round Robin Scheduler for Xen
    30.7   *
    31.1 --- a/xen/common/schedule.c	Sat Feb 05 10:33:02 2005 +0000
    31.2 +++ b/xen/common/schedule.c	Sat Feb 05 11:12:14 2005 +0000
    31.3 @@ -1,4 +1,4 @@
    31.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
    31.5 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*-
    31.6   ****************************************************************************
    31.7   * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
    31.8   * (C) 2002-2003 University of Cambridge
    32.1 --- a/xen/common/softirq.c	Sat Feb 05 10:33:02 2005 +0000
    32.2 +++ b/xen/common/softirq.c	Sat Feb 05 11:12:14 2005 +0000
    32.3 @@ -1,3 +1,4 @@
    32.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    32.5  /******************************************************************************
    32.6   * common/softirq.c
    32.7   * 
    33.1 --- a/xen/common/string.c	Sat Feb 05 10:33:02 2005 +0000
    33.2 +++ b/xen/common/string.c	Sat Feb 05 11:12:14 2005 +0000
    33.3 @@ -1,3 +1,4 @@
    33.4 +/* -*-  Mode:C; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
    33.5  /*
    33.6   *  linux/lib/string.c
    33.7   *
    34.1 --- a/xen/common/trace.c	Sat Feb 05 10:33:02 2005 +0000
    34.2 +++ b/xen/common/trace.c	Sat Feb 05 11:12:14 2005 +0000
    34.3 @@ -1,3 +1,4 @@
    34.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    34.5  /******************************************************************************
    34.6   * common/trace.c
    34.7   *
    35.1 --- a/xen/common/vsprintf.c	Sat Feb 05 10:33:02 2005 +0000
    35.2 +++ b/xen/common/vsprintf.c	Sat Feb 05 11:12:14 2005 +0000
    35.3 @@ -1,3 +1,4 @@
    35.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    35.5  /*
    35.6   *  linux/lib/vsprintf.c
    35.7   *
    35.8 @@ -115,13 +116,13 @@ static int skip_atoi(const char **s)
    35.9      return i;
   35.10  }
   35.11  
   35.12 -#define ZEROPAD	1		/* pad with zero */
   35.13 -#define SIGN	2		/* unsigned/signed long */
   35.14 -#define PLUS	4		/* show plus */
   35.15 -#define SPACE	8		/* space if plus */
   35.16 -#define LEFT	16		/* left justified */
   35.17 -#define SPECIAL	32		/* 0x */
   35.18 -#define LARGE	64		/* use 'ABCDEF' instead of 'abcdef' */
   35.19 +#define ZEROPAD 1               /* pad with zero */
   35.20 +#define SIGN    2               /* unsigned/signed long */
   35.21 +#define PLUS    4               /* show plus */
   35.22 +#define SPACE   8               /* space if plus */
   35.23 +#define LEFT    16              /* left justified */
   35.24 +#define SPECIAL 32              /* 0x */
   35.25 +#define LARGE   64              /* use 'ABCDEF' instead of 'abcdef' */
   35.26  
   35.27  static char * number(char * buf, char * end, long long num, int base, int size, int precision, int type)
   35.28  {
   35.29 @@ -239,14 +240,14 @@ int vsnprintf(char *buf, size_t size, co
   35.30      char *str, *end, c;
   35.31      const char *s;
   35.32  
   35.33 -    int flags;		/* flags to number() */
   35.34 +    int flags;          /* flags to number() */
   35.35  
   35.36 -    int field_width;	/* width of output field */
   35.37 -    int precision;		/* min. # of digits for integers; max
   35.38 -				   number of chars for from string */
   35.39 -    int qualifier;		/* 'h', 'l', or 'L' for integer fields */
   35.40 -				/* 'z' support added 23/7/1999 S.H.    */
   35.41 -				/* 'z' changed to 'Z' --davidm 1/25/99 */
   35.42 +    int field_width;    /* width of output field */
   35.43 +    int precision;              /* min. # of digits for integers; max
   35.44 +                                   number of chars for from string */
   35.45 +    int qualifier;              /* 'h', 'l', or 'L' for integer fields */
   35.46 +                                /* 'z' support added 23/7/1999 S.H.    */
   35.47 +                                /* 'z' changed to 'Z' --davidm 1/25/99 */
   35.48  
   35.49      str = buf;
   35.50      end = buf + size - 1;
   35.51 @@ -267,7 +268,7 @@ int vsnprintf(char *buf, size_t size, co
   35.52          /* process flags */
   35.53          flags = 0;
   35.54      repeat:
   35.55 -        ++fmt;		/* this also skips first '%' */
   35.56 +        ++fmt;          /* this also skips first '%' */
   35.57          switch (*fmt) {
   35.58          case '-': flags |= LEFT; goto repeat;
   35.59          case '+': flags |= PLUS; goto repeat;
   35.60 @@ -293,12 +294,12 @@ int vsnprintf(char *buf, size_t size, co
   35.61          /* get the precision */
   35.62          precision = -1;
   35.63          if (*fmt == '.') {
   35.64 -            ++fmt;	
   35.65 +            ++fmt;
   35.66              if (isdigit(*fmt))
   35.67                  precision = skip_atoi(&fmt);
   35.68              else if (*fmt == '*') {
   35.69                  ++fmt;
   35.70 -				/* it's the next argument */
   35.71 +                          /* it's the next argument */
   35.72                  precision = va_arg(args, int);
   35.73              }
   35.74              if (precision < 0)
   35.75 @@ -381,8 +382,8 @@ int vsnprintf(char *buf, size_t size, co
   35.76  
   35.77  
   35.78          case 'n':
   35.79 -				/* FIXME:
   35.80 -                                 * What does C99 say about the overflow case here? */
   35.81 +            /* FIXME:
   35.82 +             * What does C99 say about the overflow case here? */
   35.83              if (qualifier == 'l') {
   35.84                  long * ip = va_arg(args, long *);
   35.85                  *ip = (str - buf);
   35.86 @@ -401,7 +402,7 @@ int vsnprintf(char *buf, size_t size, co
   35.87              ++str;
   35.88              continue;
   35.89  
   35.90 -				/* integer number formats - set up the flags and "break" */
   35.91 +                        /* integer number formats - set up the flags and "break" */
   35.92          case 'o':
   35.93              base = 8;
   35.94              break;
    36.1 --- a/xen/common/xmalloc.c	Sat Feb 05 10:33:02 2005 +0000
    36.2 +++ b/xen/common/xmalloc.c	Sat Feb 05 11:12:14 2005 +0000
    36.3 @@ -1,4 +1,6 @@
    36.4 -/* Simple allocator for Xen.  If larger than a page, simply use the
    36.5 +/* -*-  Mode:C; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
    36.6 +/******************************************************************************
    36.7 + * Simple allocator for Xen.  If larger than a page, simply use the
    36.8   * page-order allocator.
    36.9   *
   36.10   * Copyright (C) 2005 Rusty Russell IBM Corporation
   36.11 @@ -17,6 +19,7 @@
   36.12   *  along with this program; if not, write to the Free Software
   36.13   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   36.14   */
   36.15 +
   36.16  #include <xen/mm.h>
   36.17  #include <xen/spinlock.h>
   36.18  #include <xen/ac_timer.h>
    37.1 --- a/xen/drivers/char/console.c	Sat Feb 05 10:33:02 2005 +0000
    37.2 +++ b/xen/drivers/char/console.c	Sat Feb 05 11:12:14 2005 +0000
    37.3 @@ -1,3 +1,4 @@
    37.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    37.5  /******************************************************************************
    37.6   * console.c
    37.7   * 
    38.1 --- a/xen/drivers/char/serial.c	Sat Feb 05 10:33:02 2005 +0000
    38.2 +++ b/xen/drivers/char/serial.c	Sat Feb 05 11:12:14 2005 +0000
    38.3 @@ -1,3 +1,4 @@
    38.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
    38.5  /******************************************************************************
    38.6   * serial.c
    38.7   * 
    38.8 @@ -12,7 +13,6 @@
    38.9  #include <xen/init.h>
   38.10  #include <xen/irq.h>
   38.11  #include <xen/keyhandler.h> 
   38.12 -#include <asm/pdb.h>
   38.13  #include <xen/reboot.h>
   38.14  #include <xen/sched.h>
   38.15  #include <xen/serial.h>
   38.16 @@ -33,14 +33,14 @@ string_param("com2", opt_com2);
   38.17  #define MCR             0x04    /* Modem control        */
   38.18  #define LSR             0x05    /* line status          */
   38.19  #define MSR             0x06    /* Modem status         */
   38.20 -#define DLL             0x00    /* divisor latch (ls) ( DLAB=1)	*/
   38.21 -#define DLM             0x01    /* divisor latch (ms) ( DLAB=1)	*/
   38.22 +#define DLL             0x00    /* divisor latch (ls) (DLAB=1) */
   38.23 +#define DLM             0x01    /* divisor latch (ms) (DLAB=1) */
   38.24  
   38.25  /* Interrupt Enable Register */
   38.26  #define IER_ERDAI       0x01    /* rx data recv'd       */
   38.27  #define IER_ETHREI      0x02    /* tx reg. empty        */
   38.28  #define IER_ELSI        0x04    /* rx line status       */
   38.29 -#define IER_EMSI        0x08    /* MODEM status	        */
   38.30 +#define IER_EMSI        0x08    /* MODEM status         */
   38.31  
   38.32  /* FIFO control register */
   38.33  #define FCR_ENABLE      0x01    /* enable FIFO          */
    39.1 --- a/xen/include/asm-x86/pdb.h	Sat Feb 05 10:33:02 2005 +0000
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,89 +0,0 @@
    39.4 -
    39.5 -/*
    39.6 - * pervasive debugger
    39.7 - * www.cl.cam.ac.uk/netos/pdb
    39.8 - *
    39.9 - * alex ho
   39.10 - * 2004
   39.11 - * university of cambridge computer laboratory
   39.12 - */
   39.13 -
   39.14 -
   39.15 -#ifndef __PDB_H__
   39.16 -#define __PDB_H__
   39.17 -
   39.18 -#include <asm/regs.h>
   39.19 -#include <xen/list.h>
   39.20 -#include <public/dom0_ops.h>
   39.21 -#include <public/xen.h>                   /* for domain id */
   39.22 -
   39.23 -extern int pdb_initialized;
   39.24 -extern int pdb_com_port;
   39.25 -extern int pdb_high_bit;
   39.26 -extern int pdb_page_fault_possible;
   39.27 -extern int pdb_page_fault_scratch;
   39.28 -extern int pdb_page_fault;
   39.29 -
   39.30 -extern void initialize_pdb(void);
   39.31 -
   39.32 -/* Get/set values from generic debug interface. */
   39.33 -extern int pdb_set_values(u_char *buffer, int length,
   39.34 -                          unsigned long cr3, unsigned long addr);
   39.35 -extern int pdb_get_values(u_char *buffer, int length,
   39.36 -                          unsigned long cr3, unsigned long addr);
   39.37 -
   39.38 -/* External entry points. */
   39.39 -extern int pdb_handle_exception(int exceptionVector,
   39.40 -				struct xen_regs *xen_regs);
   39.41 -extern void pdb_do_debug(dom0_op_t *op);
   39.42 -
   39.43 -/* PDB Context. */
   39.44 -struct pdb_context
   39.45 -{
   39.46 -    int valid;
   39.47 -    int domain;
   39.48 -    int process;
   39.49 -    int system_call;              /* 0x01 break on enter, 0x02 break on exit */
   39.50 -    unsigned long ptbr;
   39.51 -};
   39.52 -extern struct pdb_context pdb_ctx;
   39.53 -
   39.54 -/* Breakpoints. */
   39.55 -struct pdb_breakpoint
   39.56 -{
   39.57 -    struct list_head list;
   39.58 -    unsigned long address;
   39.59 -    unsigned long cr3;
   39.60 -    domid_t domain;
   39.61 -};
   39.62 -extern void pdb_bkpt_add (unsigned long cr3, unsigned long address);
   39.63 -extern struct pdb_breakpoint* pdb_bkpt_search (unsigned long cr3, 
   39.64 -					       unsigned long address);
   39.65 -extern int pdb_bkpt_remove (unsigned long cr3, unsigned long address);
   39.66 -
   39.67 -/* Conversions. */
   39.68 -extern int   hex (char);
   39.69 -extern char *mem2hex (char *, char *, int);
   39.70 -extern char *hex2mem (char *, char *, int);
   39.71 -extern int   hexToInt (char **ptr, int *intValue);
   39.72 -
   39.73 -/* Temporary Linux specific definitions */
   39.74 -extern int pdb_system_call;
   39.75 -extern unsigned char pdb_system_call_enter_instr;    /* original enter instr */
   39.76 -extern unsigned char pdb_system_call_leave_instr;     /* original next instr */
   39.77 -extern unsigned long pdb_system_call_next_addr;      /* instr after int 0x80 */
   39.78 -extern unsigned long pdb_system_call_eflags_addr;   /* saved eflags on stack */
   39.79 -
   39.80 -unsigned long pdb_linux_pid_ptbr (unsigned long cr3, int pid);
   39.81 -void pdb_linux_get_values(char *buffer, int length, unsigned long address,
   39.82 -			  int pid, unsigned long cr3);
   39.83 -void pdb_linux_set_values(char *buffer, int length, unsigned long address,
   39.84 -			  int pid, unsigned long cr3);
   39.85 -void pdb_linux_syscall_enter_bkpt (struct xen_regs *regs, long error_code,
   39.86 -				   trap_info_t *ti);
   39.87 -void pdb_linux_syscall_exit_bkpt (struct xen_regs *regs, 
   39.88 -				  struct pdb_context *pdb_ctx);
   39.89 -
   39.90 -void pdb_handle_debug_trap(struct xen_regs *regs, long error_code);
   39.91 -
   39.92 -#endif  /* __PDB_H__ */
    40.1 --- a/xen/include/asm-x86/processor.h	Sat Feb 05 10:33:02 2005 +0000
    40.2 +++ b/xen/include/asm-x86/processor.h	Sat Feb 05 11:12:14 2005 +0000
    40.3 @@ -13,7 +13,6 @@
    40.4  #include <asm/cpufeature.h>
    40.5  #include <asm/desc.h>
    40.6  #include <asm/flushtlb.h>
    40.7 -#include <asm/pdb.h>
    40.8  #include <xen/config.h>
    40.9  #include <xen/spinlock.h>
   40.10  #include <xen/cache.h>
   40.11 @@ -453,16 +452,9 @@ extern idt_entry_t *idt_tables[];
   40.12      (memset(idt_tables[smp_processor_id()] + (_p)->fast_trap_idx, \
   40.13       0, 8))
   40.14  
   40.15 -#ifdef XEN_DEBUGGER
   40.16 -#define SET_FAST_TRAP(_p)   \
   40.17 -    (pdb_initialized ? (void *) 0 : \
   40.18 -       (memcpy(idt_tables[smp_processor_id()] + (_p)->fast_trap_idx, \
   40.19 -               &((_p)->fast_trap_desc), 8)))
   40.20 -#else
   40.21  #define SET_FAST_TRAP(_p)   \
   40.22      (memcpy(idt_tables[smp_processor_id()] + (_p)->fast_trap_idx, \
   40.23              &((_p)->fast_trap_desc), 8))
   40.24 -#endif
   40.25  
   40.26  long set_fast_trap(struct exec_domain *p, int idx);
   40.27  
    41.1 --- a/xen/include/asm-x86/vmx_platform.h	Sat Feb 05 10:33:02 2005 +0000
    41.2 +++ b/xen/include/asm-x86/vmx_platform.h	Sat Feb 05 11:12:14 2005 +0000
    41.3 @@ -19,7 +19,8 @@
    41.4  #ifndef __ASM_X86_VMX_PLATFORM_H__
    41.5  #define __ASM_X86_VMX_PLATFORM_H__
    41.6  
    41.7 -#include <asm/e820.h>       /* from Linux */
    41.8 +#include <public/xen.h>
    41.9 +#include <asm/e820.h>
   41.10  
   41.11  #define MAX_OPERAND_NUM 3
   41.12  #define I_NAME_LEN  16