ia64/xen-unstable

changeset 5945:0db6a59abb95

Manual merge.
author smh22@firebug.cl.cam.ac.uk
date Mon Aug 01 10:48:24 2005 +0000 (2005-08-01)
parents 6a83d157a391 90f2b122fc43
children 1efe6f4163ee 975c937c33f9
files linux-2.4-xen-sparse/arch/xen/Makefile linux-2.4-xen-sparse/arch/xen/kernel/time.c linux-2.4-xen-sparse/include/asm-xen/bugs.h linux-2.4-xen-sparse/include/asm-xen/fixmap.h linux-2.4-xen-sparse/include/asm-xen/highmem.h linux-2.4-xen-sparse/include/asm-xen/hw_irq.h linux-2.4-xen-sparse/include/asm-xen/io.h linux-2.4-xen-sparse/include/asm-xen/irq.h linux-2.4-xen-sparse/include/asm-xen/mmu_context.h linux-2.4-xen-sparse/include/asm-xen/page.h linux-2.4-xen-sparse/include/asm-xen/pci.h linux-2.4-xen-sparse/include/asm-xen/pgalloc.h linux-2.4-xen-sparse/include/asm-xen/pgtable.h linux-2.4-xen-sparse/include/asm-xen/processor.h linux-2.4-xen-sparse/include/asm-xen/segment.h linux-2.4-xen-sparse/include/asm-xen/smp.h linux-2.4-xen-sparse/include/asm-xen/system.h linux-2.4-xen-sparse/include/asm-xen/vga.h linux-2.4-xen-sparse/include/linux/blk.h linux-2.4-xen-sparse/include/linux/highmem.h linux-2.4-xen-sparse/include/linux/irq.h linux-2.4-xen-sparse/include/linux/mm.h linux-2.4-xen-sparse/include/linux/sched.h linux-2.4-xen-sparse/include/linux/skbuff.h linux-2.4-xen-sparse/include/linux/timer.h linux-2.4-xen-sparse/mkbuildtree linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypercall.h linux-2.6-xen-sparse/include/asm-xen/ctrl_if.h linux-2.6-xen-sparse/include/asm-xen/evtchn.h linux-2.6-xen-sparse/include/asm-xen/hypervisor.h tools/debugger/pdb/Makefile tools/debugger/pdb/linux-2.6-module/module.c tools/debugger/pdb/linux-2.6-patches/Makefile tools/debugger/pdb/linux-2.6-patches/i386_ksyms.patch tools/debugger/pdb/linux-2.6-patches/kdebug.patch tools/debugger/pdb/linux-2.6-patches/makefile.patch tools/debugger/pdb/linux-2.6-patches/ptrace.patch tools/debugger/pdb/linux-2.6-patches/traps.patch xen/arch/x86/vmx_intercept.c xen/include/public/io/blkif.h xen/include/xen/time.h
line diff
     2.1 --- a/linux-2.4-xen-sparse/arch/xen/kernel/time.c	Mon Aug 01 10:45:07 2005 +0000
     2.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/time.c	Mon Aug 01 10:48:24 2005 +0000
     2.3 @@ -225,22 +225,31 @@ static int set_rtc_mmss(unsigned long no
     2.4   */
     2.5  static void __get_time_values_from_xen(void)
     2.6  {
     2.7 -    do {
     2.8 -        shadow_time_version = HYPERVISOR_shared_info->time_version2;
     2.9 -        rmb();
    2.10 -        shadow_tv.tv_sec    = HYPERVISOR_shared_info->wc_sec;
    2.11 -        shadow_tv.tv_usec   = HYPERVISOR_shared_info->wc_usec;
    2.12 -        shadow_tsc_stamp    = 
    2.13 -            (u32)(HYPERVISOR_shared_info->tsc_timestamp >> rdtsc_bitshift);
    2.14 -        shadow_system_time  = HYPERVISOR_shared_info->system_time;
    2.15 -        rmb();
    2.16 -    }
    2.17 -    while ( shadow_time_version != HYPERVISOR_shared_info->time_version1 );
    2.18 +	shared_info_t           *s = HYPERVISOR_shared_info;
    2.19 +	struct vcpu_time_info   *src;
    2.20 +	struct shadow_time_info *dst;
    2.21 +
    2.22 +	src = &s->vcpu_time[smp_processor_id()];
    2.23 +	dst = &per_cpu(shadow_time, smp_processor_id());
    2.24 +
    2.25 +	do {
    2.26 +		dst->version = src->time_version2;
    2.27 +		rmb();
    2.28 +		dst->tsc_timestamp     = src->tsc_timestamp;
    2.29 +		dst->system_timestamp  = src->system_time;
    2.30 +		dst->tsc_to_nsec_mul   = src->tsc_to_system_mul;
    2.31 +		dst->tsc_shift         = src->tsc_shift;
    2.32 +		rmb();
    2.33 +	}
    2.34 +	while (dst->version != src->time_version1);
    2.35 +
    2.36 +	dst->tsc_to_usec_mul = dst->tsc_to_nsec_mul / 1000;
    2.37 +
    2.38 +	if ((shadow_tv.tv_sec != s->wc_sec) ||
    2.39 +	    (shadow_tv.tv_usec != s->wc_usec))
    2.40 +		update_wallclock();
    2.41  }
    2.42  
    2.43 -#define TIME_VALUES_UP_TO_DATE \
    2.44 - ({ rmb(); (shadow_time_version == HYPERVISOR_shared_info->time_version2); })
    2.45 -
    2.46  
    2.47  /*
    2.48   * Returns the system time elapsed, in ns, since the current shadow_timestamp
    2.49 @@ -263,6 +272,17 @@ static inline unsigned long __get_time_d
    2.50      return (unsigned long)delta;
    2.51  }
    2.52  
    2.53 +static inline int time_values_up_to_date()
    2.54 +{
    2.55 +	struct vcpu_time_info   *src;
    2.56 +	struct shadow_time_info *dst;
    2.57 +
    2.58 +	src = &HYPERVISOR_shared_info->vcpu_time[smp_processor_id()];
    2.59 +	dst = &per_cpu(shadow_time, smp_processor_id());
    2.60 +
    2.61 +	return (dst->version == src->time_version2);
    2.62 +}
    2.63 +
    2.64  
    2.65  /*
    2.66   * Returns the current time-of-day in UTC timeval format.
    2.67 @@ -286,7 +306,7 @@ void do_gettimeofday(struct timeval *tv)
    2.68      __normalize_time(&_tv.tv_sec, &nsec);
    2.69      _tv.tv_usec += (long)nsec / 1000L;
    2.70  
    2.71 -    if ( unlikely(!TIME_VALUES_UP_TO_DATE) )
    2.72 +    if ( unlikely(!time_values_up_to_date()) )
    2.73      {
    2.74          /*
    2.75           * We may have blocked for a long time, rendering our calculations
    27.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Mon Aug 01 10:45:07 2005 +0000
    27.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Mon Aug 01 10:48:24 2005 +0000
    27.3 @@ -18,8 +18,8 @@ CONFIG_XEN_BLKDEV_GRANT=y
    27.4  CONFIG_XEN_NETDEV_BACKEND=y
    27.5  CONFIG_XEN_BLKDEV_FRONTEND=y
    27.6  CONFIG_XEN_NETDEV_FRONTEND=y
    27.7 -# CONFIG_XEN_NETDEV_GRANT_TX is not set
    27.8 -# CONFIG_XEN_NETDEV_GRANT_RX is not set
    27.9 +CONFIG_XEN_NETDEV_GRANT_TX=y
   27.10 + CONFIG_XEN_NETDEV_GRANT_RX=y
   27.11  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
   27.12  # CONFIG_XEN_BLKDEV_TAP is not set
   27.13  # CONFIG_XEN_SHADOW_MODE is not set
    28.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Mon Aug 01 10:45:07 2005 +0000
    28.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Mon Aug 01 10:48:24 2005 +0000
    28.3 @@ -15,8 +15,8 @@ CONFIG_NO_IDLE_HZ=y
    28.4  CONFIG_XEN_BLKDEV_GRANT=y
    28.5  CONFIG_XEN_BLKDEV_FRONTEND=y
    28.6  CONFIG_XEN_NETDEV_FRONTEND=y
    28.7 -# CONFIG_XEN_NETDEV_GRANT_TX is not set
    28.8 -# CONFIG_XEN_NETDEV_GRANT_RX is not set
    28.9 +CONFIG_XEN_NETDEV_GRANT_TX=y
   28.10 +CONFIG_XEN_NETDEV_GRANT_RX=y
   28.11  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
   28.12  # CONFIG_XEN_BLKDEV_TAP is not set
   28.13  # CONFIG_XEN_SHADOW_MODE is not set
    30.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Mon Aug 01 10:45:07 2005 +0000
    30.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Mon Aug 01 10:48:24 2005 +0000
    30.3 @@ -90,9 +90,7 @@ asmlinkage void machine_check(void);
    30.4  
    30.5  static int kstack_depth_to_print = 24;
    30.6  struct notifier_block *i386die_chain;
    30.7 -DEFINE_SPINLOCK(die_notifier_lock);
    30.8 -EXPORT_SYMBOL(die_notifier_lock);
    30.9 -EXPORT_SYMBOL(i386die_chain);
   30.10 +static DEFINE_SPINLOCK(die_notifier_lock);
   30.11  
   30.12  int register_die_notifier(struct notifier_block *nb)
   30.13  {
    37.1 --- a/linux-2.6-xen-sparse/kernel/ptrace.c	Mon Aug 01 10:45:07 2005 +0000
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,391 +0,0 @@
    37.4 -/*
    37.5 - * linux/kernel/ptrace.c
    37.6 - *
    37.7 - * (C) Copyright 1999 Linus Torvalds
    37.8 - *
    37.9 - * Common interfaces for "ptrace()" which we do not want
   37.10 - * to continually duplicate across every architecture.
   37.11 - */
   37.12 -
   37.13 -#include <linux/module.h>
   37.14 -#include <linux/sched.h>
   37.15 -#include <linux/errno.h>
   37.16 -#include <linux/mm.h>
   37.17 -#include <linux/highmem.h>
   37.18 -#include <linux/pagemap.h>
   37.19 -#include <linux/smp_lock.h>
   37.20 -#include <linux/ptrace.h>
   37.21 -#include <linux/security.h>
   37.22 -#include <linux/signal.h>
   37.23 -
   37.24 -#include <asm/pgtable.h>
   37.25 -#include <asm/uaccess.h>
   37.26 -
   37.27 -/*
   37.28 - * ptrace a task: make the debugger its new parent and
   37.29 - * move it to the ptrace list.
   37.30 - *
   37.31 - * Must be called with the tasklist lock write-held.
   37.32 - */
   37.33 -void __ptrace_link(task_t *child, task_t *new_parent)
   37.34 -{
   37.35 -	if (!list_empty(&child->ptrace_list))
   37.36 -		BUG();
   37.37 -	if (child->parent == new_parent)
   37.38 -		return;
   37.39 -	list_add(&child->ptrace_list, &child->parent->ptrace_children);
   37.40 -	REMOVE_LINKS(child);
   37.41 -	child->parent = new_parent;
   37.42 -	SET_LINKS(child);
   37.43 -}
   37.44 - 
   37.45 -/*
   37.46 - * Turn a tracing stop into a normal stop now, since with no tracer there
   37.47 - * would be no way to wake it up with SIGCONT or SIGKILL.  If there was a
   37.48 - * signal sent that would resume the child, but didn't because it was in
   37.49 - * TASK_TRACED, resume it now.
   37.50 - * Requires that irqs be disabled.
   37.51 - */
   37.52 -void ptrace_untrace(task_t *child)
   37.53 -{
   37.54 -	spin_lock(&child->sighand->siglock);
   37.55 -	if (child->state == TASK_TRACED) {
   37.56 -		if (child->signal->flags & SIGNAL_STOP_STOPPED) {
   37.57 -			child->state = TASK_STOPPED;
   37.58 -		} else {
   37.59 -			signal_wake_up(child, 1);
   37.60 -		}
   37.61 -	}
   37.62 -	spin_unlock(&child->sighand->siglock);
   37.63 -}
   37.64 -
   37.65 -/*
   37.66 - * unptrace a task: move it back to its original parent and
   37.67 - * remove it from the ptrace list.
   37.68 - *
   37.69 - * Must be called with the tasklist lock write-held.
   37.70 - */
   37.71 -void __ptrace_unlink(task_t *child)
   37.72 -{
   37.73 -	if (!child->ptrace)
   37.74 -		BUG();
   37.75 -	child->ptrace = 0;
   37.76 -	if (!list_empty(&child->ptrace_list)) {
   37.77 -		list_del_init(&child->ptrace_list);
   37.78 -		REMOVE_LINKS(child);
   37.79 -		child->parent = child->real_parent;
   37.80 -		SET_LINKS(child);
   37.81 -	}
   37.82 -
   37.83 -	if (child->state == TASK_TRACED)
   37.84 -		ptrace_untrace(child);
   37.85 -}
   37.86 -
   37.87 -/*
   37.88 - * Check that we have indeed attached to the thing..
   37.89 - */
   37.90 -int ptrace_check_attach(struct task_struct *child, int kill)
   37.91 -{
   37.92 -	int ret = -ESRCH;
   37.93 -
   37.94 -	/*
   37.95 -	 * We take the read lock around doing both checks to close a
   37.96 -	 * possible race where someone else was tracing our child and
   37.97 -	 * detached between these two checks.  After this locked check,
   37.98 -	 * we are sure that this is our traced child and that can only
   37.99 -	 * be changed by us so it's not changing right after this.
  37.100 -	 */
  37.101 -	read_lock(&tasklist_lock);
  37.102 -	if ((child->ptrace & PT_PTRACED) && child->parent == current &&
  37.103 -	    (!(child->ptrace & PT_ATTACHED) || child->real_parent != current)
  37.104 -	    && child->signal != NULL) {
  37.105 -		ret = 0;
  37.106 -		spin_lock_irq(&child->sighand->siglock);
  37.107 -		if (child->state == TASK_STOPPED) {
  37.108 -			child->state = TASK_TRACED;
  37.109 -		} else if (child->state != TASK_TRACED && !kill) {
  37.110 -			ret = -ESRCH;
  37.111 -		}
  37.112 -		spin_unlock_irq(&child->sighand->siglock);
  37.113 -	}
  37.114 -	read_unlock(&tasklist_lock);
  37.115 -
  37.116 -	if (!ret && !kill) {
  37.117 -		wait_task_inactive(child);
  37.118 -	}
  37.119 -
  37.120 -	/* All systems go.. */
  37.121 -	return ret;
  37.122 -}
  37.123 -
  37.124 -int ptrace_attach(struct task_struct *task)
  37.125 -{
  37.126 -	int retval;
  37.127 -	task_lock(task);
  37.128 -	retval = -EPERM;
  37.129 -	if (task->pid <= 1)
  37.130 -		goto bad;
  37.131 -	if (task == current)
  37.132 -		goto bad;
  37.133 -	if (!task->mm)
  37.134 -		goto bad;
  37.135 -	if(((current->uid != task->euid) ||
  37.136 -	    (current->uid != task->suid) ||
  37.137 -	    (current->uid != task->uid) ||
  37.138 - 	    (current->gid != task->egid) ||
  37.139 - 	    (current->gid != task->sgid) ||
  37.140 - 	    (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE))
  37.141 -		goto bad;
  37.142 -	smp_rmb();
  37.143 -	if (!task->mm->dumpable && !capable(CAP_SYS_PTRACE))
  37.144 -		goto bad;
  37.145 -	/* the same process cannot be attached many times */
  37.146 -	if (task->ptrace & PT_PTRACED)
  37.147 -		goto bad;
  37.148 -	retval = security_ptrace(current, task);
  37.149 -	if (retval)
  37.150 -		goto bad;
  37.151 -
  37.152 -	/* Go */
  37.153 -	task->ptrace |= PT_PTRACED | ((task->real_parent != current)
  37.154 -				      ? PT_ATTACHED : 0);
  37.155 -	if (capable(CAP_SYS_PTRACE))
  37.156 -		task->ptrace |= PT_PTRACE_CAP;
  37.157 -	task_unlock(task);
  37.158 -
  37.159 -	write_lock_irq(&tasklist_lock);
  37.160 -	__ptrace_link(task, current);
  37.161 -	write_unlock_irq(&tasklist_lock);
  37.162 -
  37.163 -	force_sig_specific(SIGSTOP, task);
  37.164 -	return 0;
  37.165 -
  37.166 -bad:
  37.167 -	task_unlock(task);
  37.168 -	return retval;
  37.169 -}
  37.170 -
  37.171 -int ptrace_detach(struct task_struct *child, unsigned int data)
  37.172 -{
  37.173 -	if (!valid_signal(data))
  37.174 -		return	-EIO;
  37.175 -
  37.176 -	/* Architecture-specific hardware disable .. */
  37.177 -	ptrace_disable(child);
  37.178 -
  37.179 -	/* .. re-parent .. */
  37.180 -	child->exit_code = data;
  37.181 -
  37.182 -	write_lock_irq(&tasklist_lock);
  37.183 -	__ptrace_unlink(child);
  37.184 -	/* .. and wake it up. */
  37.185 -	if (child->exit_state != EXIT_ZOMBIE)
  37.186 -		wake_up_process(child);
  37.187 -	write_unlock_irq(&tasklist_lock);
  37.188 -
  37.189 -	return 0;
  37.190 -}
  37.191 -
  37.192 -/*
  37.193 - * Access another process' address space.
  37.194 - * Source/target buffer must be kernel space, 
  37.195 - * Do not walk the page table directly, use get_user_pages
  37.196 - */
  37.197 -
  37.198 -int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
  37.199 -{
  37.200 -	struct mm_struct *mm;
  37.201 -	struct vm_area_struct *vma;
  37.202 -	struct page *page;
  37.203 -	void *old_buf = buf;
  37.204 -
  37.205 -	mm = get_task_mm(tsk);
  37.206 -	if (!mm)
  37.207 -		return 0;
  37.208 -
  37.209 -	down_read(&mm->mmap_sem);
  37.210 -	/* ignore errors, just check how much was sucessfully transfered */
  37.211 -	while (len) {
  37.212 -		int bytes, ret, offset;
  37.213 -		void *maddr;
  37.214 -
  37.215 -		ret = get_user_pages(tsk, mm, addr, 1,
  37.216 -				write, 1, &page, &vma);
  37.217 -		if (ret <= 0)
  37.218 -			break;
  37.219 -
  37.220 -		bytes = len;
  37.221 -		offset = addr & (PAGE_SIZE-1);
  37.222 -		if (bytes > PAGE_SIZE-offset)
  37.223 -			bytes = PAGE_SIZE-offset;
  37.224 -
  37.225 -		maddr = kmap(page);
  37.226 -		if (write) {
  37.227 -			copy_to_user_page(vma, page, addr,
  37.228 -					  maddr + offset, buf, bytes);
  37.229 -			set_page_dirty_lock(page);
  37.230 -		} else {
  37.231 -			copy_from_user_page(vma, page, addr,
  37.232 -					    buf, maddr + offset, bytes);
  37.233 -		}
  37.234 -		kunmap(page);
  37.235 -		page_cache_release(page);
  37.236 -		len -= bytes;
  37.237 -		buf += bytes;
  37.238 -		addr += bytes;
  37.239 -	}
  37.240 -	up_read(&mm->mmap_sem);
  37.241 -	mmput(mm);
  37.242 -	
  37.243 -	return buf - old_buf;
  37.244 -}
  37.245 -EXPORT_SYMBOL(access_process_vm);
  37.246 -
  37.247 -int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len)
  37.248 -{
  37.249 -	int copied = 0;
  37.250 -
  37.251 -	while (len > 0) {
  37.252 -		char buf[128];
  37.253 -		int this_len, retval;
  37.254 -
  37.255 -		this_len = (len > sizeof(buf)) ? sizeof(buf) : len;
  37.256 -		retval = access_process_vm(tsk, src, buf, this_len, 0);
  37.257 -		if (!retval) {
  37.258 -			if (copied)
  37.259 -				break;
  37.260 -			return -EIO;
  37.261 -		}
  37.262 -		if (copy_to_user(dst, buf, retval))
  37.263 -			return -EFAULT;
  37.264 -		copied += retval;
  37.265 -		src += retval;
  37.266 -		dst += retval;
  37.267 -		len -= retval;			
  37.268 -	}
  37.269 -	return copied;
  37.270 -}
  37.271 -
  37.272 -int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len)
  37.273 -{
  37.274 -	int copied = 0;
  37.275 -
  37.276 -	while (len > 0) {
  37.277 -		char buf[128];
  37.278 -		int this_len, retval;
  37.279 -
  37.280 -		this_len = (len > sizeof(buf)) ? sizeof(buf) : len;
  37.281 -		if (copy_from_user(buf, src, this_len))
  37.282 -			return -EFAULT;
  37.283 -		retval = access_process_vm(tsk, dst, buf, this_len, 1);
  37.284 -		if (!retval) {
  37.285 -			if (copied)
  37.286 -				break;
  37.287 -			return -EIO;
  37.288 -		}
  37.289 -		copied += retval;
  37.290 -		src += retval;
  37.291 -		dst += retval;
  37.292 -		len -= retval;			
  37.293 -	}
  37.294 -	return copied;
  37.295 -}
  37.296 -
  37.297 -static int ptrace_setoptions(struct task_struct *child, long data)
  37.298 -{
  37.299 -	child->ptrace &= ~PT_TRACE_MASK;
  37.300 -
  37.301 -	if (data & PTRACE_O_TRACESYSGOOD)
  37.302 -		child->ptrace |= PT_TRACESYSGOOD;
  37.303 -
  37.304 -	if (data & PTRACE_O_TRACEFORK)
  37.305 -		child->ptrace |= PT_TRACE_FORK;
  37.306 -
  37.307 -	if (data & PTRACE_O_TRACEVFORK)
  37.308 -		child->ptrace |= PT_TRACE_VFORK;
  37.309 -
  37.310 -	if (data & PTRACE_O_TRACECLONE)
  37.311 -		child->ptrace |= PT_TRACE_CLONE;
  37.312 -
  37.313 -	if (data & PTRACE_O_TRACEEXEC)
  37.314 -		child->ptrace |= PT_TRACE_EXEC;
  37.315 -
  37.316 -	if (data & PTRACE_O_TRACEVFORKDONE)
  37.317 -		child->ptrace |= PT_TRACE_VFORK_DONE;
  37.318 -
  37.319 -	if (data & PTRACE_O_TRACEEXIT)
  37.320 -		child->ptrace |= PT_TRACE_EXIT;
  37.321 -
  37.322 -	return (data & ~PTRACE_O_MASK) ? -EINVAL : 0;
  37.323 -}
  37.324 -
  37.325 -static int ptrace_getsiginfo(struct task_struct *child, siginfo_t __user * data)
  37.326 -{
  37.327 -	siginfo_t lastinfo;
  37.328 -	int error = -ESRCH;
  37.329 -
  37.330 -	read_lock(&tasklist_lock);
  37.331 -	if (likely(child->sighand != NULL)) {
  37.332 -		error = -EINVAL;
  37.333 -		spin_lock_irq(&child->sighand->siglock);
  37.334 -		if (likely(child->last_siginfo != NULL)) {
  37.335 -			lastinfo = *child->last_siginfo;
  37.336 -			error = 0;
  37.337 -		}
  37.338 -		spin_unlock_irq(&child->sighand->siglock);
  37.339 -	}
  37.340 -	read_unlock(&tasklist_lock);
  37.341 -	if (!error)
  37.342 -		return copy_siginfo_to_user(data, &lastinfo);
  37.343 -	return error;
  37.344 -}
  37.345 -
  37.346 -static int ptrace_setsiginfo(struct task_struct *child, siginfo_t __user * data)
  37.347 -{
  37.348 -	siginfo_t newinfo;
  37.349 -	int error = -ESRCH;
  37.350 -
  37.351 -	if (copy_from_user(&newinfo, data, sizeof (siginfo_t)))
  37.352 -		return -EFAULT;
  37.353 -
  37.354 -	read_lock(&tasklist_lock);
  37.355 -	if (likely(child->sighand != NULL)) {
  37.356 -		error = -EINVAL;
  37.357 -		spin_lock_irq(&child->sighand->siglock);
  37.358 -		if (likely(child->last_siginfo != NULL)) {
  37.359 -			*child->last_siginfo = newinfo;
  37.360 -			error = 0;
  37.361 -		}
  37.362 -		spin_unlock_irq(&child->sighand->siglock);
  37.363 -	}
  37.364 -	read_unlock(&tasklist_lock);
  37.365 -	return error;
  37.366 -}
  37.367 -
  37.368 -int ptrace_request(struct task_struct *child, long request,
  37.369 -		   long addr, long data)
  37.370 -{
  37.371 -	int ret = -EIO;
  37.372 -
  37.373 -	switch (request) {
  37.374 -#ifdef PTRACE_OLDSETOPTIONS
  37.375 -	case PTRACE_OLDSETOPTIONS:
  37.376 -#endif
  37.377 -	case PTRACE_SETOPTIONS:
  37.378 -		ret = ptrace_setoptions(child, data);
  37.379 -		break;
  37.380 -	case PTRACE_GETEVENTMSG:
  37.381 -		ret = put_user(child->ptrace_message, (unsigned long __user *) data);
  37.382 -		break;
  37.383 -	case PTRACE_GETSIGINFO:
  37.384 -		ret = ptrace_getsiginfo(child, (siginfo_t __user *) data);
  37.385 -		break;
  37.386 -	case PTRACE_SETSIGINFO:
  37.387 -		ret = ptrace_setsiginfo(child, (siginfo_t __user *) data);
  37.388 -		break;
  37.389 -	default:
  37.390 -		break;
  37.391 -	}
  37.392 -
  37.393 -	return ret;
  37.394 -}
    38.1 --- a/tools/debugger/pdb/Makefile	Mon Aug 01 10:45:07 2005 +0000
    38.2 +++ b/tools/debugger/pdb/Makefile	Mon Aug 01 10:48:24 2005 +0000
    38.3 @@ -33,7 +33,7 @@ LIBDIRS    += ../libxendebug
    38.4  LIBS       += unix str
    38.5  
    38.6  # bc = byte-code, dc = debug byte-code
    38.7 -all : dc
    38.8 +all : patches dc
    38.9  
   38.10  SOURCES    += pdb_caml_xc.c 
   38.11  SOURCES    += pdb_caml_domain.c pdb_caml_process.c
   38.12 @@ -50,3 +50,6 @@ RESULT      = pdb
   38.13  
   38.14  include $(OCAMLMAKEFILE)
   38.15  
   38.16 +PATCHDIR    = ./linux-2.6-patches
   38.17 +patches :
   38.18 +	make -C $(PATCHDIR) patches
    39.1 --- a/tools/debugger/pdb/linux-2.6-module/module.c	Mon Aug 01 10:45:07 2005 +0000
    39.2 +++ b/tools/debugger/pdb/linux-2.6-module/module.c	Mon Aug 01 10:48:24 2005 +0000
    39.3 @@ -278,14 +278,10 @@ pdb_initialize (void)
    39.4      return err;
    39.5  }
    39.6  
    39.7 -extern struct notifier_block *i386die_chain;
    39.8 -extern spinlock_t die_notifier_lock;
    39.9 -
   39.10  static void __exit
   39.11  pdb_terminate(void)
   39.12  {
   39.13      int err = 0;
   39.14 -    unsigned long flags;
   39.15  
   39.16      printk("pdb cleanup\n");
   39.17  
   39.18 @@ -305,9 +301,8 @@ pdb_terminate(void)
   39.19  
   39.20      pdb_send_connection_status(PDB_CONNECTION_STATUS_DOWN, 0);
   39.21  
   39.22 -	spin_lock_irqsave(&die_notifier_lock, flags);
   39.23 -    err = notifier_chain_unregister(&i386die_chain, &pdb_exceptions_nb);
   39.24 -	spin_unlock_irqrestore(&die_notifier_lock, flags);
   39.25 +    /* handler for int1 & int3 */
   39.26 +    err = unregister_die_notifier(&pdb_exceptions_nb);
   39.27  
   39.28  	return;
   39.29  }
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/tools/debugger/pdb/linux-2.6-patches/Makefile	Mon Aug 01 10:48:24 2005 +0000
    40.3 @@ -0,0 +1,10 @@
    40.4 +XEN_ROOT   = ../../../..
    40.5 +LINUX_DIR  = linux-2.6.12-xenU
    40.6 +KDIR       = $(XEN_ROOT)/$(LINUX_DIR)
    40.7 +PATCH_DIR  = $(CURDIR)
    40.8 +
    40.9 +patches : patches-done
   40.10 +
   40.11 +patches-done :
   40.12 +	( for i in *.patch ; do ( cd $(KDIR) ; patch -p1 < $(PATCH_DIR)/$$i || exit 1 ) ; done )
   40.13 +	touch $@
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/tools/debugger/pdb/linux-2.6-patches/i386_ksyms.patch	Mon Aug 01 10:48:24 2005 +0000
    41.3 @@ -0,0 +1,11 @@
    41.4 +diff -u linux-2.6.12/arch/xen/i386/kernel/i386_ksyms.c linux-2.6.12-pdb/arch/xen/i386/kernel/i386_ksyms.c
    41.5 +--- linux-2.6.12/arch/xen/i386/kernel/i386_ksyms.c	2005-07-31 22:36:50.000000000 +0100
    41.6 ++++ linux-2.6.12-pdb/arch/xen/i386/kernel/i386_ksyms.c	2005-08-01 10:57:31.000000000 +0100
    41.7 +@@ -172,6 +172,7 @@
    41.8 + EXPORT_SYMBOL_GPL(unset_nmi_callback);
    41.9 + 
   41.10 + EXPORT_SYMBOL(register_die_notifier);
   41.11 ++EXPORT_SYMBOL(unregister_die_notifier);
   41.12 + #ifdef CONFIG_HAVE_DEC_LOCK
   41.13 + EXPORT_SYMBOL(_atomic_dec_and_lock);
   41.14 + #endif
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/tools/debugger/pdb/linux-2.6-patches/kdebug.patch	Mon Aug 01 10:48:24 2005 +0000
    42.3 @@ -0,0 +1,11 @@
    42.4 +diff -u linux-2.6.12/include/asm-i386/kdebug.h linux-2.6.12-pdb/include/asm-i386/kdebug.h
    42.5 +--- linux-2.6.12/include/asm-i386/kdebug.h	2005-06-17 20:48:29.000000000 +0100
    42.6 ++++ linux-2.6.12-pdb/include/asm-i386/kdebug.h	2005-08-01 11:11:53.000000000 +0100
    42.7 +@@ -21,6 +21,7 @@
    42.8 +    If you really want to do it first unregister - then synchronize_kernel - then free.
    42.9 +   */
   42.10 + int register_die_notifier(struct notifier_block *nb);
   42.11 ++int unregister_die_notifier(struct notifier_block *nb);
   42.12 + extern struct notifier_block *i386die_chain;
   42.13 + 
   42.14 + 
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/tools/debugger/pdb/linux-2.6-patches/makefile.patch	Mon Aug 01 10:48:24 2005 +0000
    43.3 @@ -0,0 +1,12 @@
    43.4 +diff -Naur linux-2.6.12/Makefile linux-2.6.12-pdb/Makefile
    43.5 +--- linux-2.6.12/Makefile	2005-08-01 01:21:21.000000000 +0100
    43.6 ++++ linux-2.6.12-pdb/Makefile	2005-08-01 10:28:10.000000000 +0100
    43.7 +@@ -508,7 +508,7 @@
    43.8 + ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
    43.9 + CFLAGS		+= -Os
   43.10 + else
   43.11 +-CFLAGS		+= -O2
   43.12 ++CFLAGS		+= -O
   43.13 + endif
   43.14 + 
   43.15 + #Add align options if CONFIG_CC_* is not equal to 0
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/tools/debugger/pdb/linux-2.6-patches/ptrace.patch	Mon Aug 01 10:48:24 2005 +0000
    44.3 @@ -0,0 +1,11 @@
    44.4 +diff -u linux-2.6.12/kernel/ptrace.c linux-2.6.12-pdb/kernel/ptrace.c
    44.5 +--- linux-2.6.12/kernel/ptrace.c       2005-06-17 20:48:29.000000000 +0100
    44.6 ++++ linux-2.6.12-pdb/kernel/ptrace.c   2005-07-22 13:23:16.000000000 +0100
    44.7 +@@ -239,6 +239,7 @@
    44.8 + 
    44.9 +        return buf - old_buf;
   44.10 + }
   44.11 ++EXPORT_SYMBOL(access_process_vm);
   44.12 + 
   44.13 + int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len)
   44.14 + {
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/tools/debugger/pdb/linux-2.6-patches/traps.patch	Mon Aug 01 10:48:24 2005 +0000
    45.3 @@ -0,0 +1,20 @@
    45.4 +diff -u linux-2.6.12/arch/xen/i386/kernel/traps.c linux-2.6.12-pdb/arch/xen/i386/kernel/traps.c
    45.5 +--- linux-2.6.12/arch/xen/i386/kernel/traps.c	2005-07-31 22:47:00.000000000 +0100
    45.6 ++++ linux-2.6.12-pdb/arch/xen/i386/kernel/traps.c	2005-07-31 22:47:32.000000000 +0100
    45.7 +@@ -102,6 +102,16 @@
    45.8 + 	return err;
    45.9 + }
   45.10 + 
   45.11 ++int unregister_die_notifier(struct notifier_block *nb)
   45.12 ++{
   45.13 ++	int err = 0;
   45.14 ++	unsigned long flags;
   45.15 ++	spin_lock_irqsave(&die_notifier_lock, flags);
   45.16 ++	err = notifier_chain_unregister(&i386die_chain, nb);
   45.17 ++	spin_unlock_irqrestore(&die_notifier_lock, flags);
   45.18 ++	return err;
   45.19 ++}
   45.20 ++
   45.21 + static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
   45.22 + {
   45.23 + 	return	p > (void *)tinfo &&