ia64/xen-unstable

changeset 11961:d246b79986d1

merge with xen-unstable.hg
author awilliam@xenbuild.aw
date Tue Oct 24 11:21:48 2006 -0600 (2006-10-24)
parents aa8ca06d209e fd5140c2854f
children 3e26719ab827
files tools/xm-test/ramdisk/configs/buildroot xen/arch/ia64/vmx/mmio.c xen/arch/ia64/vmx/vmx_phy_mode.c xen/arch/ia64/vmx/vmx_vcpu.c xen/arch/ia64/vmx/vmx_virt.c xen/arch/ia64/xen/dom0_ops.c xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/faults.c xen/arch/ia64/xen/fw_emul.c xen/arch/ia64/xen/hypercall.c xen/arch/ia64/xen/mm.c xen/arch/ia64/xen/privop.c xen/arch/ia64/xen/regionreg.c xen/arch/ia64/xen/tlb_track.c xen/arch/ia64/xen/vcpu.c xen/arch/ia64/xen/vhpt.c xen/arch/ia64/xen/xencomm.c xen/arch/ia64/xen/xensetup.c xen/arch/ia64/xen/xentime.c xen/include/asm-ia64/vcpu.h
line diff
     1.1 --- a/.hgignore	Tue Oct 24 10:08:30 2006 -0600
     1.2 +++ b/.hgignore	Tue Oct 24 11:21:48 2006 -0600
     1.3 @@ -184,6 +184,17 @@
     1.4  ^tools/xentrace/xenctx$
     1.5  ^tools/xentrace/xentrace$
     1.6  ^tools/xm-test/ramdisk/buildroot
     1.7 +^tools/xm-test/aclocal.m4$
     1.8 +^tools/xm-test/autom4te
     1.9 +^tools/xm-test/install-sh$
    1.10 +^tools/xm-test/mkinstalldirs$
    1.11 +^tools/xm-test/missing$
    1.12 +^tools/xm-test/config(ure|.log|.status|.guess|.sub)$
    1.13 +^tools/xm-test/Makefile(.in)*$
    1.14 +^tools/xm-test/.*/Makefile(.in)*$
    1.15 +^tools/xm-test/lib/XmTestLib/config.py$
    1.16 +^tools/xm-test/lib/XmTestReport/xmtest.py$
    1.17 +^tools/xm-test/tests/.*\.test$
    1.18  ^xen/BLOG$
    1.19  ^xen/TAGS$
    1.20  ^xen/arch/x86/asm-offsets\.s$
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/Makefile	Tue Oct 24 10:08:30 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/Makefile	Tue Oct 24 11:21:48 2006 -0600
     2.3 @@ -1,2 +1,2 @@
     2.4  
     2.5 -obj-y += balloon.o
     2.6 +obj-y := balloon.o sysfs.o
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Tue Oct 24 10:08:30 2006 -0600
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Tue Oct 24 11:21:48 2006 -0600
     3.3 @@ -53,10 +53,8 @@
     3.4  #include <asm/uaccess.h>
     3.5  #include <asm/tlb.h>
     3.6  #include <linux/list.h>
     3.7 -
     3.8  #include <xen/xenbus.h>
     3.9 -
    3.10 -#define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10))
    3.11 +#include "common.h"
    3.12  
    3.13  #ifdef CONFIG_PROC_FS
    3.14  static struct proc_dir_entry *balloon_pde;
    3.15 @@ -71,9 +69,7 @@ static DECLARE_MUTEX(balloon_mutex);
    3.16   */
    3.17  DEFINE_SPINLOCK(balloon_lock);
    3.18  
    3.19 -/* We aim for 'current allocation' == 'target allocation'. */
    3.20 -static unsigned long current_pages;
    3.21 -static unsigned long target_pages;
    3.22 +struct balloon_stats balloon_stats;
    3.23  
    3.24  /* We increase/decrease in batches which fit in a page */
    3.25  static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)];
    3.26 @@ -81,18 +77,8 @@ static unsigned long frame_list[PAGE_SIZ
    3.27  /* VM /proc information for memory */
    3.28  extern unsigned long totalram_pages;
    3.29  
    3.30 -/* We may hit the hard limit in Xen. If we do then we remember it. */
    3.31 -static unsigned long hard_limit;
    3.32 -
    3.33 -/*
    3.34 - * Drivers may alter the memory reservation independently, but they must
    3.35 - * inform the balloon driver so that we can avoid hitting the hard limit.
    3.36 - */
    3.37 -static unsigned long driver_pages;
    3.38 -
    3.39  /* List of ballooned pages, threaded through the mem_map array. */
    3.40  static LIST_HEAD(ballooned_pages);
    3.41 -static unsigned long balloon_low, balloon_high;
    3.42  
    3.43  /* Main work function, always executed in process context. */
    3.44  static void balloon_process(void *unused);
    3.45 @@ -124,10 +110,10 @@ static void balloon_append(struct page *
    3.46  	/* Lowmem is re-populated first, so highmem pages go at list tail. */
    3.47  	if (PageHighMem(page)) {
    3.48  		list_add_tail(PAGE_TO_LIST(page), &ballooned_pages);
    3.49 -		balloon_high++;
    3.50 +		bs.balloon_high++;
    3.51  	} else {
    3.52  		list_add(PAGE_TO_LIST(page), &ballooned_pages);
    3.53 -		balloon_low++;
    3.54 +		bs.balloon_low++;
    3.55  	}
    3.56  }
    3.57  
    3.58 @@ -143,9 +129,9 @@ static struct page *balloon_retrieve(voi
    3.59  	UNLIST_PAGE(page);
    3.60  
    3.61  	if (PageHighMem(page))
    3.62 -		balloon_high--;
    3.63 +		bs.balloon_high--;
    3.64  	else
    3.65 -		balloon_low--;
    3.66 +		bs.balloon_low--;
    3.67  
    3.68  	return page;
    3.69  }
    3.70 @@ -172,9 +158,9 @@ static void balloon_alarm(unsigned long 
    3.71  
    3.72  static unsigned long current_target(void)
    3.73  {
    3.74 -	unsigned long target = min(target_pages, hard_limit);
    3.75 -	if (target > (current_pages + balloon_low + balloon_high))
    3.76 -		target = current_pages + balloon_low + balloon_high;
    3.77 +	unsigned long target = min(bs.target_pages, bs.hard_limit);
    3.78 +	if (target > (bs.current_pages + bs.balloon_low + bs.balloon_high))
    3.79 +		target = bs.current_pages + bs.balloon_low + bs.balloon_high;
    3.80  	return target;
    3.81  }
    3.82  
    3.83 @@ -216,7 +202,8 @@ static int increase_reservation(unsigned
    3.84  			BUG_ON(ret != rc);
    3.85  		}
    3.86  		if (rc >= 0)
    3.87 -			hard_limit = current_pages + rc - driver_pages;
    3.88 +			bs.hard_limit = (bs.current_pages + rc -
    3.89 +					 bs.driver_pages);
    3.90  		goto out;
    3.91  	}
    3.92  
    3.93 @@ -248,8 +235,8 @@ static int increase_reservation(unsigned
    3.94  		__free_page(page);
    3.95  	}
    3.96  
    3.97 -	current_pages += nr_pages;
    3.98 -	totalram_pages = current_pages;
    3.99 +	bs.current_pages += nr_pages;
   3.100 +	totalram_pages = bs.current_pages;
   3.101  
   3.102   out:
   3.103  	balloon_unlock(flags);
   3.104 @@ -317,8 +304,8 @@ static int decrease_reservation(unsigned
   3.105  	ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation);
   3.106  	BUG_ON(ret != nr_pages);
   3.107  
   3.108 -	current_pages -= nr_pages;
   3.109 -	totalram_pages = current_pages;
   3.110 +	bs.current_pages -= nr_pages;
   3.111 +	totalram_pages = bs.current_pages;
   3.112  
   3.113  	balloon_unlock(flags);
   3.114  
   3.115 @@ -339,7 +326,7 @@ static void balloon_process(void *unused
   3.116  	down(&balloon_mutex);
   3.117  
   3.118  	do {
   3.119 -		credit = current_target() - current_pages;
   3.120 +		credit = current_target() - bs.current_pages;
   3.121  		if (credit > 0)
   3.122  			need_sleep = (increase_reservation(credit) != 0);
   3.123  		if (credit < 0)
   3.124 @@ -352,18 +339,18 @@ static void balloon_process(void *unused
   3.125  	} while ((credit != 0) && !need_sleep);
   3.126  
   3.127  	/* Schedule more work if there is some still to be done. */
   3.128 -	if (current_target() != current_pages)
   3.129 +	if (current_target() != bs.current_pages)
   3.130  		mod_timer(&balloon_timer, jiffies + HZ);
   3.131  
   3.132  	up(&balloon_mutex);
   3.133  }
   3.134  
   3.135  /* Resets the Xen limit, sets new target, and kicks off processing. */
   3.136 -static void set_new_target(unsigned long target)
   3.137 +void balloon_set_new_target(unsigned long target)
   3.138  {
   3.139  	/* No need for lock. Not read-modify-write updates. */
   3.140 -	hard_limit   = ~0UL;
   3.141 -	target_pages = target;
   3.142 +	bs.hard_limit   = ~0UL;
   3.143 +	bs.target_pages = target;
   3.144  	schedule_work(&balloon_worker);
   3.145  }
   3.146  
   3.147 @@ -388,7 +375,7 @@ static void watch_target(struct xenbus_w
   3.148  	/* The given memory/target value is in KiB, so it needs converting to
   3.149  	 * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
   3.150  	 */
   3.151 -	set_new_target(new_target >> (PAGE_SHIFT - 10));
   3.152 +	balloon_set_new_target(new_target >> (PAGE_SHIFT - 10));
   3.153  }
   3.154  
   3.155  static int balloon_init_watcher(struct notifier_block *notifier,
   3.156 @@ -424,7 +411,7 @@ static int balloon_write(struct file *fi
   3.157  	memstring[sizeof(memstring)-1] = '\0';
   3.158  
   3.159  	target_bytes = memparse(memstring, &endchar);
   3.160 -	set_new_target(target_bytes >> PAGE_SHIFT);
   3.161 +	balloon_set_new_target(target_bytes >> PAGE_SHIFT);
   3.162  
   3.163  	return count;
   3.164  }
   3.165 @@ -442,12 +429,13 @@ static int balloon_read(char *page, char
   3.166  		"High-mem balloon:   %8lu kB\n"
   3.167  		"Driver pages:       %8lu kB\n"
   3.168  		"Xen hard limit:     ",
   3.169 -		PAGES2KB(current_pages), PAGES2KB(target_pages), 
   3.170 -		PAGES2KB(balloon_low), PAGES2KB(balloon_high),
   3.171 -		PAGES2KB(driver_pages));
   3.172 +		PAGES2KB(bs.current_pages), PAGES2KB(bs.target_pages), 
   3.173 +		PAGES2KB(bs.balloon_low), PAGES2KB(bs.balloon_high),
   3.174 +		PAGES2KB(bs.driver_pages));
   3.175  
   3.176 -	if (hard_limit != ~0UL)
   3.177 -		len += sprintf(page + len, "%8lu kB\n", PAGES2KB(hard_limit));
   3.178 +	if (bs.hard_limit != ~0UL)
   3.179 +		len += sprintf(page + len, "%8lu kB\n",
   3.180 +			       PAGES2KB(bs.hard_limit));
   3.181  	else
   3.182  		len += sprintf(page + len, "     ??? kB\n");
   3.183  
   3.184 @@ -468,13 +456,13 @@ static int __init balloon_init(void)
   3.185  
   3.186  	IPRINTK("Initialising balloon driver.\n");
   3.187  
   3.188 -	current_pages = min(xen_start_info->nr_pages, max_pfn);
   3.189 -	totalram_pages = current_pages;
   3.190 -	target_pages  = current_pages;
   3.191 -	balloon_low   = 0;
   3.192 -	balloon_high  = 0;
   3.193 -	driver_pages  = 0UL;
   3.194 -	hard_limit    = ~0UL;
   3.195 +	bs.current_pages = min(xen_start_info->nr_pages, max_pfn);
   3.196 +	totalram_pages   = bs.current_pages;
   3.197 +	bs.target_pages  = bs.current_pages;
   3.198 +	bs.balloon_low   = 0;
   3.199 +	bs.balloon_high  = 0;
   3.200 +	bs.driver_pages  = 0UL;
   3.201 +	bs.hard_limit    = ~0UL;
   3.202  
   3.203  	init_timer(&balloon_timer);
   3.204  	balloon_timer.data = 0;
   3.205 @@ -489,6 +477,7 @@ static int __init balloon_init(void)
   3.206  	balloon_pde->read_proc  = balloon_read;
   3.207  	balloon_pde->write_proc = balloon_write;
   3.208  #endif
   3.209 +	balloon_sysfs_init();
   3.210      
   3.211  	/* Initialise the balloon with excess memory space. */
   3.212  	for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) {
   3.213 @@ -512,7 +501,7 @@ void balloon_update_driver_allowance(lon
   3.214  	unsigned long flags;
   3.215  
   3.216  	balloon_lock(flags);
   3.217 -	driver_pages += delta;
   3.218 +	bs.driver_pages += delta;
   3.219  	balloon_unlock(flags);
   3.220  }
   3.221  
   3.222 @@ -578,7 +567,7 @@ struct page **alloc_empty_pages_and_page
   3.223  			goto err;
   3.224  		}
   3.225  
   3.226 -		totalram_pages = --current_pages;
   3.227 +		totalram_pages = --bs.current_pages;
   3.228  
   3.229  		balloon_unlock(flags);
   3.230  	}
   3.231 @@ -624,7 +613,7 @@ void balloon_release_driver_page(struct 
   3.232  
   3.233  	balloon_lock(flags);
   3.234  	balloon_append(page);
   3.235 -	driver_pages--;
   3.236 +	bs.driver_pages--;
   3.237  	balloon_unlock(flags);
   3.238  
   3.239  	schedule_work(&balloon_worker);
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/common.h	Tue Oct 24 11:21:48 2006 -0600
     4.3 @@ -0,0 +1,58 @@
     4.4 +/******************************************************************************
     4.5 + * balloon/common.h
     4.6 + *
     4.7 + * This program is free software; you can redistribute it and/or
     4.8 + * modify it under the terms of the GNU General Public License version 2
     4.9 + * as published by the Free Software Foundation; or, when distributed
    4.10 + * separately from the Linux kernel or incorporated into other
    4.11 + * software packages, subject to the following license:
    4.12 + * 
    4.13 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    4.14 + * of this source file (the "Software"), to deal in the Software without
    4.15 + * restriction, including without limitation the rights to use, copy, modify,
    4.16 + * merge, publish, distribute, sublicense, and/or sell copies of the Software,
    4.17 + * and to permit persons to whom the Software is furnished to do so, subject to
    4.18 + * the following conditions:
    4.19 + * 
    4.20 + * The above copyright notice and this permission notice shall be included in
    4.21 + * all copies or substantial portions of the Software.
    4.22 + * 
    4.23 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    4.24 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    4.25 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    4.26 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    4.27 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    4.28 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    4.29 + * IN THE SOFTWARE.
    4.30 + */
    4.31 +
    4.32 +#ifndef __XEN_BALLOON_COMMON_H__
    4.33 +#define __XEN_BALLOON_COMMON_H__
    4.34 +
    4.35 +#define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10))
    4.36 +
    4.37 +struct balloon_stats {
    4.38 +	/* We aim for 'current allocation' == 'target allocation'. */
    4.39 +	unsigned long current_pages;
    4.40 +	unsigned long target_pages;
    4.41 +	/* We may hit the hard limit in Xen. If we do then we remember it. */
    4.42 +	unsigned long hard_limit;
    4.43 +	/*
    4.44 +	 * Drivers may alter the memory reservation independently, but they
    4.45 +	 * must inform the balloon driver so we avoid hitting the hard limit.
    4.46 +	 */
    4.47 +	unsigned long driver_pages;
    4.48 +	/* Number of pages in high- and low-memory balloons. */
    4.49 +	unsigned long balloon_low;
    4.50 +	unsigned long balloon_high;
    4.51 +};
    4.52 +
    4.53 +extern struct balloon_stats balloon_stats;
    4.54 +#define bs balloon_stats
    4.55 +
    4.56 +int balloon_sysfs_init(void);
    4.57 +void balloon_sysfs_exit(void);
    4.58 +
    4.59 +void balloon_set_new_target(unsigned long target);
    4.60 +
    4.61 +#endif /* __XEN_BALLOON_COMMON_H__ */
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/sysfs.c	Tue Oct 24 11:21:48 2006 -0600
     5.3 @@ -0,0 +1,165 @@
     5.4 +/******************************************************************************
     5.5 + * balloon/sysfs.c
     5.6 + *
     5.7 + * Xen balloon driver - sysfs interfaces.
     5.8 + * 
     5.9 + * This program is free software; you can redistribute it and/or
    5.10 + * modify it under the terms of the GNU General Public License version 2
    5.11 + * as published by the Free Software Foundation; or, when distributed
    5.12 + * separately from the Linux kernel or incorporated into other
    5.13 + * software packages, subject to the following license:
    5.14 + * 
    5.15 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    5.16 + * of this source file (the "Software"), to deal in the Software without
    5.17 + * restriction, including without limitation the rights to use, copy, modify,
    5.18 + * merge, publish, distribute, sublicense, and/or sell copies of the Software,
    5.19 + * and to permit persons to whom the Software is furnished to do so, subject to
    5.20 + * the following conditions:
    5.21 + * 
    5.22 + * The above copyright notice and this permission notice shall be included in
    5.23 + * all copies or substantial portions of the Software.
    5.24 + * 
    5.25 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    5.26 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    5.27 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    5.28 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    5.29 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    5.30 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    5.31 + * IN THE SOFTWARE.
    5.32 + */
    5.33 +
    5.34 +#include <linux/config.h>
    5.35 +#include <linux/capability.h>
    5.36 +#include <linux/stat.h>
    5.37 +#include <linux/sysdev.h>
    5.38 +#include "common.h"
    5.39 +
    5.40 +#define BALLOON_CLASS_NAME "memory"
    5.41 +
    5.42 +#define BALLOON_SHOW(name, format, args...)			\
    5.43 +	static ssize_t show_##name(struct sys_device *dev,	\
    5.44 +				   char *buf)			\
    5.45 +	{							\
    5.46 +		return sprintf(buf, format, ##args);		\
    5.47 +	}							\
    5.48 +	static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL)
    5.49 +
    5.50 +BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(bs.current_pages));
    5.51 +BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(bs.balloon_low));
    5.52 +BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(bs.balloon_high));
    5.53 +BALLOON_SHOW(hard_limit_kb,
    5.54 +	     (bs.hard_limit!=~0UL) ? "%lu\n" : "???\n",
    5.55 +	     (bs.hard_limit!=~0UL) ? PAGES2KB(bs.hard_limit) : 0);
    5.56 +BALLOON_SHOW(driver_kb, "%lu\n", PAGES2KB(bs.driver_pages));
    5.57 +
    5.58 +static ssize_t show_target_kb(struct sys_device *dev, char *buf)
    5.59 +{
    5.60 +	return sprintf(buf, "%lu\n", PAGES2KB(bs.target_pages));
    5.61 +}
    5.62 +
    5.63 +static ssize_t store_target_kb(struct sys_device *dev,
    5.64 +			       const char *buf,
    5.65 +			       size_t count)
    5.66 +{
    5.67 +	char memstring[64], *endchar;
    5.68 +	unsigned long long target_bytes;
    5.69 +
    5.70 +	if (!capable(CAP_SYS_ADMIN))
    5.71 +		return -EPERM;
    5.72 +	
    5.73 +	if (count <= 1)
    5.74 +		return -EBADMSG; /* runt */
    5.75 +	if (count > sizeof(memstring))
    5.76 +		return -EFBIG;   /* too long */
    5.77 +	strcpy(memstring, buf);
    5.78 +	
    5.79 +	target_bytes = memparse(memstring, &endchar);
    5.80 +	balloon_set_new_target(target_bytes >> PAGE_SHIFT);
    5.81 +	
    5.82 +	return count;
    5.83 +}
    5.84 +
    5.85 +static SYSDEV_ATTR(target_kb, S_IRUGO | S_IWUSR,
    5.86 +		   show_target_kb, store_target_kb);
    5.87 +
    5.88 +static struct sysdev_attribute *balloon_attrs[] = {
    5.89 +	&attr_target_kb,
    5.90 +};
    5.91 +
    5.92 +static struct attribute *balloon_info_attrs[] = {
    5.93 +	&attr_current_kb.attr,
    5.94 +	&attr_low_kb.attr,
    5.95 +	&attr_high_kb.attr,
    5.96 +	&attr_hard_limit_kb.attr,
    5.97 +	&attr_driver_kb.attr,
    5.98 +	NULL
    5.99 +};
   5.100 +
   5.101 +static struct attribute_group balloon_info_group = {
   5.102 +	.name = "info",
   5.103 +	.attrs = balloon_info_attrs,
   5.104 +};
   5.105 +
   5.106 +static struct sysdev_class balloon_sysdev_class = {
   5.107 +	set_kset_name(BALLOON_CLASS_NAME),
   5.108 +};
   5.109 +
   5.110 +static struct sys_device balloon_sysdev;
   5.111 +
   5.112 +static int register_balloon(struct sys_device *sysdev)
   5.113 +{
   5.114 +	int i, error;
   5.115 +
   5.116 +	error = sysdev_class_register(&balloon_sysdev_class);
   5.117 +	if (error)
   5.118 +		return error;
   5.119 +
   5.120 +	sysdev->id = 0;
   5.121 +	sysdev->cls = &balloon_sysdev_class;
   5.122 +
   5.123 +	error = sysdev_register(sysdev);
   5.124 +	if (error) {
   5.125 +		sysdev_class_unregister(&balloon_sysdev_class);
   5.126 +		return error;
   5.127 +	}
   5.128 +
   5.129 +	for (i = 0; i < ARRAY_SIZE(balloon_attrs); i++) {
   5.130 +		error = sysdev_create_file(sysdev, balloon_attrs[i]);
   5.131 +		if (error)
   5.132 +			goto fail;
   5.133 +	}
   5.134 +
   5.135 +	error = sysfs_create_group(&sysdev->kobj, &balloon_info_group);
   5.136 +	if (error)
   5.137 +		goto fail;
   5.138 +	
   5.139 +	return 0;
   5.140 +
   5.141 + fail:
   5.142 +	while (--i >= 0)
   5.143 +		sysdev_remove_file(sysdev, balloon_attrs[i]);
   5.144 +	sysdev_unregister(sysdev);
   5.145 +	sysdev_class_unregister(&balloon_sysdev_class);
   5.146 +	return error;
   5.147 +}
   5.148 +
   5.149 +static void unregister_balloon(struct sys_device *sysdev)
   5.150 +{
   5.151 +	int i;
   5.152 +
   5.153 +	sysfs_remove_group(&sysdev->kobj, &balloon_info_group);
   5.154 +	for (i = 0; i < ARRAY_SIZE(balloon_attrs); i++)
   5.155 +		sysdev_remove_file(sysdev, balloon_attrs[i]);
   5.156 +	sysdev_unregister(sysdev);
   5.157 +	sysdev_class_unregister(&balloon_sysdev_class);
   5.158 +}
   5.159 +
   5.160 +int balloon_sysfs_init(void)
   5.161 +{
   5.162 +	return register_balloon(&balloon_sysdev);
   5.163 +}
   5.164 +
   5.165 +void balloon_sysfs_exit(void)
   5.166 +{
   5.167 +	unregister_balloon(&balloon_sysdev);
   5.168 +}
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Tue Oct 24 10:08:30 2006 -0600
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Tue Oct 24 11:21:48 2006 -0600
     6.3 @@ -293,7 +293,7 @@ irqreturn_t blkif_be_int(int irq, void *
     6.4  static int do_block_io_op(blkif_t *blkif)
     6.5  {
     6.6  	blkif_back_ring_t *blk_ring = &blkif->blk_ring;
     6.7 -	blkif_request_t *req;
     6.8 +	blkif_request_t req;
     6.9  	pending_req_t *pending_req;
    6.10  	RING_IDX rc, rp;
    6.11  	int more_to_do = 0;
    6.12 @@ -311,22 +311,22 @@ static int do_block_io_op(blkif_t *blkif
    6.13  			break;
    6.14  		}
    6.15  
    6.16 -		req = RING_GET_REQUEST(blk_ring, rc);
    6.17 +		memcpy(&req, RING_GET_REQUEST(blk_ring, rc), sizeof(req));
    6.18  		blk_ring->req_cons = ++rc; /* before make_response() */
    6.19  
    6.20 -		switch (req->operation) {
    6.21 +		switch (req.operation) {
    6.22  		case BLKIF_OP_READ:
    6.23  			blkif->st_rd_req++;
    6.24 -			dispatch_rw_block_io(blkif, req, pending_req);
    6.25 +			dispatch_rw_block_io(blkif, &req, pending_req);
    6.26  			break;
    6.27  		case BLKIF_OP_WRITE:
    6.28  			blkif->st_wr_req++;
    6.29 -			dispatch_rw_block_io(blkif, req, pending_req);
    6.30 +			dispatch_rw_block_io(blkif, &req, pending_req);
    6.31  			break;
    6.32  		default:
    6.33  			DPRINTK("error: unknown block io operation [%d]\n",
    6.34 -				req->operation);
    6.35 -			make_response(blkif, req->id, req->operation,
    6.36 +				req.operation);
    6.37 +			make_response(blkif, req.id, req.operation,
    6.38  				      BLKIF_RSP_ERROR);
    6.39  			free_req(pending_req);
    6.40  			break;
    6.41 @@ -375,7 +375,7 @@ static void dispatch_rw_block_io(blkif_t
    6.42  			req->seg[i].first_sect + 1;
    6.43  
    6.44  		if ((req->seg[i].last_sect >= (PAGE_SIZE >> 9)) ||
    6.45 -		    (seg[i].nsec <= 0))
    6.46 +		    (req->seg[i].last_sect < req->seg[i].first_sect))
    6.47  			goto fail_response;
    6.48  		preq.nr_sects += seg[i].nsec;
    6.49  
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Tue Oct 24 10:08:30 2006 -0600
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Tue Oct 24 11:21:48 2006 -0600
     7.3 @@ -10,6 +10,9 @@
     7.4   * 
     7.5   * Copyright (c) 2004-2005, Andrew Warfield and Julian Chesterfield
     7.6   *
     7.7 + * Clean ups and fix ups:
     7.8 + *    Copyright (c) 2006, Steven Rostedt - Red Hat, Inc.
     7.9 + *
    7.10   * This program is free software; you can redistribute it and/or
    7.11   * modify it under the terms of the GNU General Public License version 2
    7.12   * as published by the Free Software Foundation; or, when distributed
    7.13 @@ -51,7 +54,7 @@
    7.14  #include <asm/tlbflush.h>
    7.15  #include <linux/devfs_fs_kernel.h>
    7.16  
    7.17 -#define MAX_TAP_DEV 100     /*the maximum number of tapdisk ring devices    */
    7.18 +#define MAX_TAP_DEV 256     /*the maximum number of tapdisk ring devices    */
    7.19  #define MAX_DEV_NAME 100    /*the max tapdisk ring device name e.g. blktap0 */
    7.20  
    7.21  
    7.22 @@ -105,6 +108,12 @@ static int mmap_pages = MMAP_PAGES;
    7.23  		      * memory rings.
    7.24  		      */
    7.25  
    7.26 +/*Data struct handed back to userspace for tapdisk device to VBD mapping*/
    7.27 +typedef struct domid_translate {
    7.28 +	unsigned short domid;
    7.29 +	unsigned short busid;
    7.30 +} domid_translate_t ;
    7.31 +
    7.32  /*Data struct associated with each of the tapdisk devices*/
    7.33  typedef struct tap_blkif {
    7.34  	struct vm_area_struct *vma;   /*Shared memory area                   */
    7.35 @@ -123,17 +132,11 @@ typedef struct tap_blkif {
    7.36  	unsigned long *idx_map;       /*Record the user ring id to kern 
    7.37  					[req id, idx] tuple                  */
    7.38  	blkif_t *blkif;               /*Associate blkif with tapdev          */
    7.39 -	int sysfs_set;                /*Set if it has a class device.        */
    7.40 +	struct domid_translate trans; /*Translation from domid to bus.       */
    7.41  } tap_blkif_t;
    7.42  
    7.43 -/*Data struct handed back to userspace for tapdisk device to VBD mapping*/
    7.44 -typedef struct domid_translate {
    7.45 -	unsigned short domid;
    7.46 -	unsigned short busid;
    7.47 -} domid_translate_t ;
    7.48 -
    7.49 -static domid_translate_t  translate_domid[MAX_TAP_DEV];
    7.50 -static tap_blkif_t *tapfds[MAX_TAP_DEV];
    7.51 +static struct tap_blkif *tapfds[MAX_TAP_DEV];
    7.52 +static int blktap_next_minor;
    7.53  
    7.54  static int __init set_blkif_reqs(char *str)
    7.55  {
    7.56 @@ -322,7 +325,7 @@ struct vm_operations_struct blktap_vm_op
    7.57   */
    7.58   
    7.59  /*Function Declarations*/
    7.60 -static int get_next_free_dev(void);
    7.61 +static tap_blkif_t *get_next_free_dev(void);
    7.62  static int blktap_open(struct inode *inode, struct file *filp);
    7.63  static int blktap_release(struct inode *inode, struct file *filp);
    7.64  static int blktap_mmap(struct file *filp, struct vm_area_struct *vma);
    7.65 @@ -340,51 +343,96 @@ static struct file_operations blktap_fop
    7.66  };
    7.67  
    7.68  
    7.69 -static int get_next_free_dev(void)
    7.70 +static tap_blkif_t *get_next_free_dev(void)
    7.71  {
    7.72  	tap_blkif_t *info;
    7.73 -	int i = 0, ret = -1;
    7.74 -	unsigned long flags;
    7.75 -
    7.76 -	spin_lock_irqsave(&pending_free_lock, flags);
    7.77 -	
    7.78 -	while (i < MAX_TAP_DEV) {
    7.79 -		info = tapfds[i];
    7.80 -		if ( (tapfds[i] != NULL) && (info->dev_inuse == 0)
    7.81 -			&& (info->dev_pending == 0) ) {
    7.82 -			info->dev_pending = 1;
    7.83 -			ret = i;
    7.84 -			goto done;
    7.85 -		}
    7.86 -		i++;
    7.87 -	}
    7.88 -	
    7.89 -done:
    7.90 -	spin_unlock_irqrestore(&pending_free_lock, flags);
    7.91 +	int minor;
    7.92  
    7.93  	/*
    7.94 -	 * We are protected by having the dev_pending set.
    7.95 +	 * This is called only from the ioctl, which
    7.96 +	 * means we should always have interrupts enabled.
    7.97  	 */
    7.98 -	if (!tapfds[i]->sysfs_set && xen_class) {
    7.99 +	BUG_ON(irqs_disabled());
   7.100 +
   7.101 +	spin_lock_irq(&pending_free_lock);
   7.102 +
   7.103 +	/* tapfds[0] is always NULL */
   7.104 +
   7.105 +	for (minor = 1; minor < blktap_next_minor; minor++) {
   7.106 +		info = tapfds[minor];
   7.107 +		/* we could have failed a previous attempt. */
   7.108 +		if (!info ||
   7.109 +		    ((info->dev_inuse == 0) &&
   7.110 +		     (info->dev_pending == 0)) ) {
   7.111 +			info->dev_pending = 1;
   7.112 +			goto found;
   7.113 +		}
   7.114 +	}
   7.115 +	info = NULL;
   7.116 +	minor = -1;
   7.117 +
   7.118 +	/*
   7.119 +	 * We didn't find free device. If we can still allocate
   7.120 +	 * more, then we grab the next device minor that is
   7.121 +	 * available.  This is done while we are still under
   7.122 +	 * the protection of the pending_free_lock.
   7.123 +	 */
   7.124 +	if (blktap_next_minor < MAX_TAP_DEV)
   7.125 +		minor = blktap_next_minor++;
   7.126 +found:
   7.127 +	spin_unlock_irq(&pending_free_lock);
   7.128 +
   7.129 +	if (!info && minor > 0) {
   7.130 +		info = kzalloc(sizeof(*info), GFP_KERNEL);
   7.131 +		if (unlikely(!info)) {
   7.132 +			/*
   7.133 +			 * If we failed here, try to put back
   7.134 +			 * the next minor number. But if one
   7.135 +			 * was just taken, then we just lose this
   7.136 +			 * minor.  We can try to allocate this
   7.137 +			 * minor again later.
   7.138 +			 */
   7.139 +			spin_lock_irq(&pending_free_lock);
   7.140 +			if (blktap_next_minor == minor+1)
   7.141 +				blktap_next_minor--;
   7.142 +			spin_unlock_irq(&pending_free_lock);
   7.143 +			goto out;
   7.144 +		}
   7.145 +
   7.146 +		info->minor = minor;
   7.147 +		/*
   7.148 +		 * Make sure that we have a minor before others can
   7.149 +		 * see us.
   7.150 +		 */
   7.151 +		wmb();
   7.152 +		tapfds[minor] = info;
   7.153 +
   7.154  		class_device_create(xen_class, NULL,
   7.155 -				    MKDEV(blktap_major, ret), NULL,
   7.156 -				    "blktap%d", ret);
   7.157 -		tapfds[i]->sysfs_set = 1;
   7.158 +				    MKDEV(blktap_major, minor), NULL,
   7.159 +				    "blktap%d", minor);
   7.160 +		devfs_mk_cdev(MKDEV(blktap_major, minor),
   7.161 +			S_IFCHR|S_IRUGO|S_IWUSR, "xen/blktap%d", minor);
   7.162  	}
   7.163 -	return ret;
   7.164 +
   7.165 +out:
   7.166 +	return info;
   7.167  }
   7.168  
   7.169  int dom_to_devid(domid_t domid, int xenbus_id, blkif_t *blkif) 
   7.170  {
   7.171 +	tap_blkif_t *info;
   7.172  	int i;
   7.173 -		
   7.174 -	for (i = 0; i < MAX_TAP_DEV; i++)
   7.175 -		if ( (translate_domid[i].domid == domid)
   7.176 -		    && (translate_domid[i].busid == xenbus_id) ) {
   7.177 -			tapfds[i]->blkif = blkif;
   7.178 -			tapfds[i]->status = RUNNING;
   7.179 +
   7.180 +	for (i = 1; i < blktap_next_minor; i++) {
   7.181 +		info = tapfds[i];
   7.182 +		if ( info &&
   7.183 +		     (info->trans.domid == domid) &&
   7.184 +		     (info->trans.busid == xenbus_id) ) {
   7.185 +			info->blkif = blkif;
   7.186 +			info->status = RUNNING;
   7.187  			return i;
   7.188  		}
   7.189 +	}
   7.190  	return -1;
   7.191  }
   7.192  
   7.193 @@ -394,12 +442,16 @@ void signal_tapdisk(int idx)
   7.194  	struct task_struct *ptask;
   7.195  
   7.196  	info = tapfds[idx];
   7.197 -	if ( (idx > 0) && (idx < MAX_TAP_DEV) && (info->pid > 0) ) {
   7.198 +	if ((idx < 0) || (idx > MAX_TAP_DEV) || !info)
   7.199 +		return;
   7.200 +
   7.201 +	if (info->pid > 0) {
   7.202  		ptask = find_task_by_pid(info->pid);
   7.203  		if (ptask)
   7.204  			info->status = CLEANSHUTDOWN;
   7.205  	}
   7.206  	info->blkif = NULL;
   7.207 +
   7.208  	return;
   7.209  }
   7.210  
   7.211 @@ -410,15 +462,20 @@ static int blktap_open(struct inode *ino
   7.212  	tap_blkif_t *info;
   7.213  	int i;
   7.214  	
   7.215 -	if (tapfds[idx] == NULL) {
   7.216 +	/* ctrl device, treat differently */
   7.217 +	if (!idx)
   7.218 +		return 0;
   7.219 +
   7.220 +	info = tapfds[idx];
   7.221 +
   7.222 +	if ((idx < 0) || (idx > MAX_TAP_DEV) || !info) {
   7.223  		WPRINTK("Unable to open device /dev/xen/blktap%d\n",
   7.224 -		       idx);
   7.225 -		return -ENOMEM;
   7.226 +			idx);
   7.227 +		return -ENODEV;
   7.228  	}
   7.229 +
   7.230  	DPRINTK("Opening device /dev/xen/blktap%d\n",idx);
   7.231  	
   7.232 -	info = tapfds[idx];
   7.233 -	
   7.234  	/*Only one process can access device at a time*/
   7.235  	if (test_and_set_bit(0, &info->dev_inuse))
   7.236  		return -EBUSY;
   7.237 @@ -458,12 +515,10 @@ static int blktap_release(struct inode *
   7.238  {
   7.239  	tap_blkif_t *info = filp->private_data;
   7.240  	
   7.241 -	/* can this ever happen? - sdr */
   7.242 -	if (!info) {
   7.243 -		WPRINTK("Trying to free device that doesn't exist "
   7.244 -		       "[/dev/xen/blktap%d]\n",iminor(inode) - BLKTAP_MINOR);
   7.245 -		return -EBADF;
   7.246 -	}
   7.247 +	/* check for control device */
   7.248 +	if (!info)
   7.249 +		return 0;
   7.250 +
   7.251  	info->dev_inuse = 0;
   7.252  	DPRINTK("Freeing device [/dev/xen/blktap%d]\n",info->minor);
   7.253  
   7.254 @@ -619,33 +674,31 @@ static int blktap_ioctl(struct inode *in
   7.255  	{		
   7.256  		uint64_t val = (uint64_t)arg;
   7.257  		domid_translate_t *tr = (domid_translate_t *)&val;
   7.258 -		int newdev;
   7.259  
   7.260  		DPRINTK("NEWINTF Req for domid %d and bus id %d\n", 
   7.261  		       tr->domid, tr->busid);
   7.262 -		newdev = get_next_free_dev();
   7.263 -		if (newdev < 1) {
   7.264 +		info = get_next_free_dev();
   7.265 +		if (!info) {
   7.266  			WPRINTK("Error initialising /dev/xen/blktap - "
   7.267  				"No more devices\n");
   7.268  			return -1;
   7.269  		}
   7.270 -		translate_domid[newdev].domid = tr->domid;
   7.271 -		translate_domid[newdev].busid = tr->busid;
   7.272 -		return newdev;
   7.273 +		info->trans.domid = tr->domid;
   7.274 +		info->trans.busid = tr->busid;
   7.275 +		return info->minor;
   7.276  	}
   7.277  	case BLKTAP_IOCTL_FREEINTF:
   7.278  	{
   7.279  		unsigned long dev = arg;
   7.280  		unsigned long flags;
   7.281  
   7.282 -		/* Looking at another device */
   7.283 -		info = NULL;
   7.284 +		info = tapfds[dev];
   7.285  
   7.286 -		if ( (dev > 0) && (dev < MAX_TAP_DEV) )
   7.287 -			info = tapfds[dev];
   7.288 +		if ((dev > MAX_TAP_DEV) || !info)
   7.289 +			return 0; /* should this be an error? */
   7.290  
   7.291  		spin_lock_irqsave(&pending_free_lock, flags);
   7.292 -		if ( (info != NULL) && (info->dev_pending) )
   7.293 +		if (info->dev_pending)
   7.294  			info->dev_pending = 0;
   7.295  		spin_unlock_irqrestore(&pending_free_lock, flags);
   7.296  
   7.297 @@ -655,16 +708,12 @@ static int blktap_ioctl(struct inode *in
   7.298  	{
   7.299  		unsigned long dev = arg;
   7.300  
   7.301 -		/* Looking at another device */
   7.302 -		info = NULL;
   7.303 -		
   7.304 -		if ( (dev > 0) && (dev < MAX_TAP_DEV) )
   7.305 -			info = tapfds[dev];
   7.306 -		
   7.307 -		if (info != NULL)
   7.308 -			return info->minor;
   7.309 -		else
   7.310 -			return -1;
   7.311 +		info = tapfds[dev];
   7.312 +
   7.313 +		if ((dev > MAX_TAP_DEV) || !info)
   7.314 +			return -EINVAL;
   7.315 +
   7.316 +		return info->minor;
   7.317  	}
   7.318  	case BLKTAP_IOCTL_MAJOR:
   7.319  		return blktap_major;
   7.320 @@ -683,13 +732,8 @@ static unsigned int blktap_poll(struct f
   7.321  {
   7.322  	tap_blkif_t *info = filp->private_data;
   7.323  	
   7.324 -	if (!info) {
   7.325 -		WPRINTK(" poll, retrieving idx failed\n");
   7.326 -		return 0;
   7.327 -	}
   7.328 -
   7.329  	/* do not work on the control device */
   7.330 -	if (!info->minor)
   7.331 +	if (!info)
   7.332  		return 0;
   7.333  
   7.334  	poll_wait(filp, &info->wait, wait);
   7.335 @@ -704,13 +748,12 @@ void blktap_kick_user(int idx)
   7.336  {
   7.337  	tap_blkif_t *info;
   7.338  
   7.339 -	if (idx == 0)
   7.340 +	info = tapfds[idx];
   7.341 +
   7.342 +	if ((idx < 0) || (idx > MAX_TAP_DEV) || !info)
   7.343  		return;
   7.344 -	
   7.345 -	info = tapfds[idx];
   7.346 -	
   7.347 -	if (info != NULL)
   7.348 -		wake_up_interruptible(&info->wait);
   7.349 +
   7.350 +	wake_up_interruptible(&info->wait);
   7.351  
   7.352  	return;
   7.353  }
   7.354 @@ -822,8 +865,8 @@ static void free_req(pending_req_t *req)
   7.355  		wake_up(&pending_free_wq);
   7.356  }
   7.357  
   7.358 -static void fast_flush_area(pending_req_t *req, int k_idx, int u_idx, int 
   7.359 -			    tapidx)
   7.360 +static void fast_flush_area(pending_req_t *req, int k_idx, int u_idx,
   7.361 +			    int tapidx)
   7.362  {
   7.363  	struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST*2];
   7.364  	unsigned int i, invcount = 0;
   7.365 @@ -831,13 +874,16 @@ static void fast_flush_area(pending_req_
   7.366  	uint64_t ptep;
   7.367  	int ret, mmap_idx;
   7.368  	unsigned long kvaddr, uvaddr;
   7.369 +	tap_blkif_t *info;
   7.370 +	
   7.371  
   7.372 -	tap_blkif_t *info = tapfds[tapidx];
   7.373 -	
   7.374 -	if (info == NULL) {
   7.375 +	info = tapfds[tapidx];
   7.376 +
   7.377 +	if ((tapidx < 0) || (tapidx > MAX_TAP_DEV) || !info) {
   7.378  		WPRINTK("fast_flush: Couldn't get info!\n");
   7.379  		return;
   7.380  	}
   7.381 +
   7.382  	mmap_idx = req->mem_idx;
   7.383  
   7.384  	for (i = 0; i < req->nr_pages; i++) {
   7.385 @@ -1042,7 +1088,7 @@ static int do_block_io_op(blkif_t *blkif
   7.386  	rmb(); /* Ensure we see queued requests up to 'rp'. */
   7.387  
   7.388  	/*Check blkif has corresponding UE ring*/
   7.389 -	if (blkif->dev_num == -1) {
   7.390 +	if (blkif->dev_num < 0) {
   7.391  		/*oops*/
   7.392  		if (print_dbug) {
   7.393  			WPRINTK("Corresponding UE " 
   7.394 @@ -1053,7 +1099,8 @@ static int do_block_io_op(blkif_t *blkif
   7.395  	}
   7.396  
   7.397  	info = tapfds[blkif->dev_num];
   7.398 -	if (info == NULL || !info->dev_inuse) {
   7.399 +
   7.400 +	if (blkif->dev_num > MAX_TAP_DEV || !info || !info->dev_inuse) {
   7.401  		if (print_dbug) {
   7.402  			WPRINTK("Can't get UE info!\n");
   7.403  			print_dbug = 0;
   7.404 @@ -1121,15 +1168,22 @@ static void dispatch_rw_block_io(blkif_t
   7.405  	struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST*2];
   7.406  	unsigned int nseg;
   7.407  	int ret, i;
   7.408 -	tap_blkif_t *info = tapfds[blkif->dev_num];
   7.409 +	tap_blkif_t *info;
   7.410  	uint64_t sector;
   7.411 -	
   7.412  	blkif_request_t *target;
   7.413  	int pending_idx = RTN_PEND_IDX(pending_req,pending_req->mem_idx);
   7.414 -	int usr_idx = GET_NEXT_REQ(info->idx_map);
   7.415 +	int usr_idx;
   7.416  	uint16_t mmap_idx = pending_req->mem_idx;
   7.417  
   7.418 +	if (blkif->dev_num < 0 || blkif->dev_num > MAX_TAP_DEV)
   7.419 +		goto fail_response;
   7.420 +
   7.421 +	info = tapfds[blkif->dev_num];
   7.422 +	if (info == NULL)
   7.423 +		goto fail_response;
   7.424 +
   7.425  	/* Check we have space on user ring - should never fail. */
   7.426 +	usr_idx = GET_NEXT_REQ(info->idx_map);
   7.427  	if (usr_idx == INVALID_REQ)
   7.428  		goto fail_response;
   7.429  
   7.430 @@ -1330,7 +1384,6 @@ static void make_response(blkif_t *blkif
   7.431  static int __init blkif_init(void)
   7.432  {
   7.433  	int i,ret,blktap_dir;
   7.434 -	tap_blkif_t *info;
   7.435  
   7.436  	if (!is_running_on_xen())
   7.437  		return -ENODEV;
   7.438 @@ -1350,9 +1403,6 @@ static int __init blkif_init(void)
   7.439  
   7.440  	tap_blkif_xenbus_init();
   7.441  
   7.442 -	/*Create the blktap devices, but do not map memory or waitqueue*/
   7.443 -	for(i = 0; i < MAX_TAP_DEV; i++) translate_domid[i].domid = 0xFFFF;
   7.444 -
   7.445  	/* Dynamically allocate a major for this device */
   7.446  	ret = register_chrdev(0, "blktap", &blktap_fops);
   7.447  	blktap_dir = devfs_mk_dir(NULL, "xen", 0, NULL);
   7.448 @@ -1364,24 +1414,17 @@ static int __init blkif_init(void)
   7.449  	
   7.450  	blktap_major = ret;
   7.451  
   7.452 -	for(i = 0; i < MAX_TAP_DEV; i++ ) {
   7.453 -		info = tapfds[i] = kzalloc(sizeof(tap_blkif_t),GFP_KERNEL);
   7.454 -		if(tapfds[i] == NULL)
   7.455 -			return -ENOMEM;
   7.456 -		info->minor = i;
   7.457 -		info->pid = 0;
   7.458 -		info->blkif = NULL;
   7.459 +	/* tapfds[0] is always NULL */
   7.460 +	blktap_next_minor++;
   7.461  
   7.462 -		ret = devfs_mk_cdev(MKDEV(blktap_major, i),
   7.463 -			S_IFCHR|S_IRUGO|S_IWUSR, "xen/blktap%d", i);
   7.464 +	ret = devfs_mk_cdev(MKDEV(blktap_major, i),
   7.465 +			    S_IFCHR|S_IRUGO|S_IWUSR, "xen/blktap%d", i);
   7.466  
   7.467 -		if(ret != 0)
   7.468 -			return -ENOMEM;
   7.469 -		info->dev_pending = info->dev_inuse = 0;
   7.470 +	if(ret != 0)
   7.471 +		return -ENOMEM;
   7.472  
   7.473 -		DPRINTK("Created misc_dev [/dev/xen/blktap%d]\n",i);
   7.474 -	}
   7.475 -	
   7.476 +	DPRINTK("Created misc_dev [/dev/xen/blktap%d]\n",i);
   7.477 +
   7.478  	/* Make sure the xen class exists */
   7.479  	if (!setup_xen_class()) {
   7.480  		/*
   7.481 @@ -1394,7 +1437,6 @@ static int __init blkif_init(void)
   7.482  		class_device_create(xen_class, NULL,
   7.483  				    MKDEV(blktap_major, 0), NULL,
   7.484  				    "blktap0");
   7.485 -		tapfds[0]->sysfs_set = 1;
   7.486  	} else {
   7.487  		/* this is bad, but not fatal */
   7.488  		WPRINTK("blktap: sysfs xen_class not created\n");
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Tue Oct 24 10:08:30 2006 -0600
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Tue Oct 24 11:21:48 2006 -0600
     8.3 @@ -92,6 +92,9 @@ typedef struct netif_st {
     8.4  	unsigned long   remaining_credit;
     8.5  	struct timer_list credit_timeout;
     8.6  
     8.7 +	/* Enforce draining of the transmit queue. */
     8.8 +	struct timer_list tx_queue_timeout;
     8.9 +
    8.10  	/* Miscellaneous private stuff. */
    8.11  	struct list_head list;  /* scheduling list */
    8.12  	atomic_t         refcnt;
    8.13 @@ -119,6 +122,8 @@ int netif_map(netif_t *netif, unsigned l
    8.14  
    8.15  void netif_xenbus_init(void);
    8.16  
    8.17 +#define netif_schedulable(dev) (netif_running(dev) && netif_carrier_ok(dev))
    8.18 +
    8.19  void netif_schedule_work(netif_t *netif);
    8.20  void netif_deschedule_work(netif_t *netif);
    8.21  
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Tue Oct 24 10:08:30 2006 -0600
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Tue Oct 24 11:21:48 2006 -0600
     9.3 @@ -44,12 +44,11 @@
     9.4   * For example, consider a packet that holds onto resources belonging to the
     9.5   * guest for which it is queued (e.g., packet received on vif1.0, destined for
     9.6   * vif1.1 which is not activated in the guest): in this situation the guest
     9.7 - * will never be destroyed, unless vif1.1 is taken down (which flushes the
     9.8 - * 'tx_queue').
     9.9 - * 
    9.10 - * Only set this parameter to non-zero value if you know what you are doing!
    9.11 + * will never be destroyed, unless vif1.1 is taken down. To avoid this, we
    9.12 + * run a timer (tx_queue_timeout) to drain the queue when the interface is
    9.13 + * blocked.
    9.14   */
    9.15 -static unsigned long netbk_queue_length = 0;
    9.16 +static unsigned long netbk_queue_length = 32;
    9.17  module_param_named(queue_length, netbk_queue_length, ulong, 0);
    9.18  
    9.19  static void __netif_up(netif_t *netif)
    9.20 @@ -62,7 +61,6 @@ static void __netif_down(netif_t *netif)
    9.21  {
    9.22  	disable_irq(netif->irq);
    9.23  	netif_deschedule_work(netif);
    9.24 -	del_timer_sync(&netif->credit_timeout);
    9.25  }
    9.26  
    9.27  static int net_open(struct net_device *dev)
    9.28 @@ -153,8 +151,11 @@ netif_t *netif_alloc(domid_t domid, unsi
    9.29  	netif->credit_bytes = netif->remaining_credit = ~0UL;
    9.30  	netif->credit_usec  = 0UL;
    9.31  	init_timer(&netif->credit_timeout);
    9.32 +	/* Initialize 'expires' now: it's used to track the credit window. */
    9.33  	netif->credit_timeout.expires = jiffies;
    9.34  
    9.35 +	init_timer(&netif->tx_queue_timeout);
    9.36 +
    9.37  	dev->hard_start_xmit = netif_be_start_xmit;
    9.38  	dev->get_stats       = netif_be_get_stats;
    9.39  	dev->open            = net_open;
    9.40 @@ -319,11 +320,23 @@ err_rx:
    9.41  	return err;
    9.42  }
    9.43  
    9.44 -static void netif_free(netif_t *netif)
    9.45 +void netif_disconnect(netif_t *netif)
    9.46  {
    9.47 +	if (netif_carrier_ok(netif->dev)) {
    9.48 +		rtnl_lock();
    9.49 +		netif_carrier_off(netif->dev);
    9.50 +		if (netif_running(netif->dev))
    9.51 +			__netif_down(netif);
    9.52 +		rtnl_unlock();
    9.53 +		netif_put(netif);
    9.54 +	}
    9.55 +
    9.56  	atomic_dec(&netif->refcnt);
    9.57  	wait_event(netif->waiting_to_free, atomic_read(&netif->refcnt) == 0);
    9.58  
    9.59 +	del_timer_sync(&netif->credit_timeout);
    9.60 +	del_timer_sync(&netif->tx_queue_timeout);
    9.61 +
    9.62  	if (netif->irq)
    9.63  		unbind_from_irqhandler(netif->irq, netif);
    9.64  	
    9.65 @@ -337,16 +350,3 @@ static void netif_free(netif_t *netif)
    9.66  
    9.67  	free_netdev(netif->dev);
    9.68  }
    9.69 -
    9.70 -void netif_disconnect(netif_t *netif)
    9.71 -{
    9.72 -	if (netif_carrier_ok(netif->dev)) {
    9.73 -		rtnl_lock();
    9.74 -		netif_carrier_off(netif->dev);
    9.75 -		if (netif_running(netif->dev))
    9.76 -			__netif_down(netif);
    9.77 -		rtnl_unlock();
    9.78 -		netif_put(netif);
    9.79 -	}
    9.80 -	netif_free(netif);
    9.81 -}
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Tue Oct 24 10:08:30 2006 -0600
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Tue Oct 24 11:21:48 2006 -0600
    10.3 @@ -264,6 +264,13 @@ static inline int netbk_queue_full(netif
    10.4  	       ((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) < needed);
    10.5  }
    10.6  
    10.7 +static void tx_queue_callback(unsigned long data)
    10.8 +{
    10.9 +	netif_t *netif = (netif_t *)data;
   10.10 +	if (netif_schedulable(netif->dev))
   10.11 +		netif_wake_queue(netif->dev);
   10.12 +}
   10.13 +
   10.14  int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev)
   10.15  {
   10.16  	netif_t *netif = netdev_priv(dev);
   10.17 @@ -271,20 +278,13 @@ int netif_be_start_xmit(struct sk_buff *
   10.18  	BUG_ON(skb->dev != dev);
   10.19  
   10.20  	/* Drop the packet if the target domain has no receive buffers. */
   10.21 -	if (unlikely(!netif_running(dev) || !netif_carrier_ok(dev)))
   10.22 +	if (unlikely(!netif_schedulable(dev) || netbk_queue_full(netif)))
   10.23  		goto drop;
   10.24  
   10.25 -	if (unlikely(netbk_queue_full(netif))) {
   10.26 -		/* Not a BUG_ON() -- misbehaving netfront can trigger this. */
   10.27 -		if (netbk_can_queue(dev))
   10.28 -			DPRINTK("Queue full but not stopped!\n");
   10.29 -		goto drop;
   10.30 -	}
   10.31 -
   10.32 -	/* Copy the packet here if it's destined for a flipping
   10.33 -	   interface but isn't flippable (e.g. extra references to
   10.34 -	   data)
   10.35 -	*/
   10.36 +	/*
   10.37 +	 * Copy the packet here if it's destined for a flipping interface
   10.38 +	 * but isn't flippable (e.g. extra references to data).
   10.39 +	 */
   10.40  	if (!netif->copying_receiver && !is_flippable_skb(skb)) {
   10.41  		struct sk_buff *nskb = netbk_copy_skb(skb);
   10.42  		if ( unlikely(nskb == NULL) )
   10.43 @@ -305,8 +305,19 @@ int netif_be_start_xmit(struct sk_buff *
   10.44  		netif->rx.sring->req_event = netif->rx_req_cons_peek +
   10.45  			netbk_max_required_rx_slots(netif);
   10.46  		mb(); /* request notification /then/ check & stop the queue */
   10.47 -		if (netbk_queue_full(netif))
   10.48 +		if (netbk_queue_full(netif)) {
   10.49  			netif_stop_queue(dev);
   10.50 +			/*
   10.51 +			 * Schedule 500ms timeout to restart the queue, thus
   10.52 +			 * ensuring that an inactive queue will be drained.
   10.53 +			 * Packets will be immediately be dropped until more
   10.54 +			 * receive buffers become available (see
   10.55 +			 * netbk_queue_full() check above).
   10.56 +			 */
   10.57 +			netif->tx_queue_timeout.data = (unsigned long)netif;
   10.58 +			netif->tx_queue_timeout.function = tx_queue_callback;
   10.59 +			__mod_timer(&netif->tx_queue_timeout, jiffies + HZ/2);
   10.60 +		}
   10.61  	}
   10.62  
   10.63  	skb_queue_tail(&rx_queue, skb);
   10.64 @@ -706,6 +717,7 @@ static void net_rx_action(unsigned long 
   10.65  		}
   10.66  
   10.67  		if (netif_queue_stopped(netif->dev) &&
   10.68 +		    netif_schedulable(netif->dev) &&
   10.69  		    !netbk_queue_full(netif))
   10.70  			netif_wake_queue(netif->dev);
   10.71  
   10.72 @@ -763,8 +775,7 @@ static void add_to_net_schedule_list_tai
   10.73  
   10.74  	spin_lock_irq(&net_schedule_list_lock);
   10.75  	if (!__on_net_schedule_list(netif) &&
   10.76 -	    likely(netif_running(netif->dev) &&
   10.77 -		   netif_carrier_ok(netif->dev))) {
   10.78 +	    likely(netif_schedulable(netif->dev))) {
   10.79  		list_add_tail(&netif->list, &net_schedule_list);
   10.80  		netif_get(netif);
   10.81  	}
   10.82 @@ -1358,7 +1369,7 @@ irqreturn_t netif_be_int(int irq, void *
   10.83  	add_to_net_schedule_list_tail(netif);
   10.84  	maybe_schedule_tx_action();
   10.85  
   10.86 -	if (netif_queue_stopped(netif->dev) && !netbk_queue_full(netif))
   10.87 +	if (netif_schedulable(netif->dev) && !netbk_queue_full(netif))
   10.88  		netif_wake_queue(netif->dev);
   10.89  
   10.90  	return IRQ_HANDLED;
    11.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Tue Oct 24 10:08:30 2006 -0600
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Tue Oct 24 11:21:48 2006 -0600
    11.3 @@ -328,7 +328,7 @@ static void connect(struct backend_info 
    11.4  
    11.5  	/* May not get a kick from the frontend, so start the tx_queue now. */
    11.6  	if (!netbk_can_queue(be->netif->dev))
    11.7 -		netif_start_queue(be->netif->dev);
    11.8 +		netif_wake_queue(be->netif->dev);
    11.9  }
   11.10  
   11.11  
    12.1 --- a/tools/ioemu/patches/domain-timeoffset	Tue Oct 24 10:08:30 2006 -0600
    12.2 +++ b/tools/ioemu/patches/domain-timeoffset	Tue Oct 24 11:21:48 2006 -0600
    12.3 @@ -1,7 +1,7 @@
    12.4  Index: ioemu/hw/mc146818rtc.c
    12.5  ===================================================================
    12.6 ---- ioemu.orig/hw/mc146818rtc.c	2006-09-21 19:33:25.000000000 +0100
    12.7 -+++ ioemu/hw/mc146818rtc.c	2006-09-21 19:33:30.000000000 +0100
    12.8 +--- ioemu.orig/hw/mc146818rtc.c	2006-10-24 14:45:21.000000000 +0100
    12.9 ++++ ioemu/hw/mc146818rtc.c	2006-10-24 14:45:39.000000000 +0100
   12.10  @@ -178,10 +178,27 @@
   12.11       }
   12.12   }
   12.13 @@ -46,8 +46,8 @@ Index: ioemu/hw/mc146818rtc.c
   12.14   static void rtc_copy_date(RTCState *s)
   12.15  Index: ioemu/hw/pc.c
   12.16  ===================================================================
   12.17 ---- ioemu.orig/hw/pc.c	2006-09-21 19:33:30.000000000 +0100
   12.18 -+++ ioemu/hw/pc.c	2006-09-21 19:33:30.000000000 +0100
   12.19 +--- ioemu.orig/hw/pc.c	2006-10-24 14:45:38.000000000 +0100
   12.20 ++++ ioemu/hw/pc.c	2006-10-24 14:45:39.000000000 +0100
   12.21  @@ -159,7 +159,7 @@
   12.22   }
   12.23   
   12.24 @@ -117,8 +117,8 @@ Index: ioemu/hw/pc.c
   12.25   QEMUMachine pc_machine = {
   12.26  Index: ioemu/vl.c
   12.27  ===================================================================
   12.28 ---- ioemu.orig/vl.c	2006-09-21 19:33:30.000000000 +0100
   12.29 -+++ ioemu/vl.c	2006-09-21 19:33:30.000000000 +0100
   12.30 +--- ioemu.orig/vl.c	2006-10-24 14:45:38.000000000 +0100
   12.31 ++++ ioemu/vl.c	2006-10-24 14:45:39.000000000 +0100
   12.32  @@ -163,6 +163,8 @@
   12.33   
   12.34   int xc_handle;
   12.35 @@ -174,8 +174,8 @@ Index: ioemu/vl.c
   12.36       if (usb_enabled) {
   12.37  Index: ioemu/vl.h
   12.38  ===================================================================
   12.39 ---- ioemu.orig/vl.h	2006-09-21 19:33:30.000000000 +0100
   12.40 -+++ ioemu/vl.h	2006-09-21 19:33:30.000000000 +0100
   12.41 +--- ioemu.orig/vl.h	2006-10-24 14:45:38.000000000 +0100
   12.42 ++++ ioemu/vl.h	2006-10-24 14:45:39.000000000 +0100
   12.43  @@ -576,7 +576,7 @@
   12.44                                    int boot_device,
   12.45                DisplayState *ds, const char **fd_filename, int snapshot,
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/tools/ioemu/patches/hypervisor-rtc	Tue Oct 24 11:21:48 2006 -0600
    13.3 @@ -0,0 +1,143 @@
    13.4 +# HG changeset patch
    13.5 +# User kfraser@localhost.localdomain
    13.6 +# Node ID 71e2a165aa7f81602c569430b18ba1ea705f0b70
    13.7 +# Parent  da66691687dfd90c55420cfdf27f55d18cca7810
    13.8 +[HVM] Move RTC emulation into the hypervisor.
    13.9 +Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
   13.10 +
   13.11 +--- ioemu/Makefile.target	Wed Oct 18 18:13:57 2006 +0100
   13.12 ++++ ioemu/Makefile.target	Wed Oct 18 18:35:21 2006 +0100
   13.13 +@@ -294,7 +294,11 @@ endif
   13.14 + endif
   13.15 + 
   13.16 + # qemu-dm objects
   13.17 ++ifeq ($(ARCH),ia64)
   13.18 + LIBOBJS=helper2.o exec-dm.o i8259-dm.o
   13.19 ++else
   13.20 ++LIBOBJS=helper2.o exec-dm.o i8259-dm.o rtc-dm.o
   13.21 ++endif
   13.22 + 
   13.23 + all: $(PROGS)
   13.24 + 
   13.25 +@@ -354,7 +358,11 @@ ifeq ($(TARGET_BASE_ARCH), i386)
   13.26 + ifeq ($(TARGET_BASE_ARCH), i386)
   13.27 + # Hardware support
   13.28 + VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
   13.29 ++ifeq ($(ARCH),ia64)
   13.30 + VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o
   13.31 ++else
   13.32 ++VL_OBJS+= fdc.o serial.o pc.o
   13.33 ++endif
   13.34 + VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o
   13.35 + VL_OBJS+= usb-uhci.o
   13.36 + VL_OBJS+= piix4acpi.o
   13.37 +--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   13.38 ++++ ioemu/target-i386-dm/rtc-dm.c	Wed Oct 18 18:35:21 2006 +0100
   13.39 +@@ -0,0 +1,107 @@
   13.40 ++/*
   13.41 ++ * QEMU MC146818 RTC emulation
   13.42 ++ * 
   13.43 ++ * Copyright (c) 2003-2004 Fabrice Bellard
   13.44 ++ * 
   13.45 ++ * Permission is hereby granted, free of charge, to any person obtaining a copy
   13.46 ++ * of this software and associated documentation files (the "Software"), to deal
   13.47 ++ * in the Software without restriction, including without limitation the rights
   13.48 ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   13.49 ++ * copies of the Software, and to permit persons to whom the Software is
   13.50 ++ * furnished to do so, subject to the following conditions:
   13.51 ++ *
   13.52 ++ * The above copyright notice and this permission notice shall be included in
   13.53 ++ * all copies or substantial portions of the Software.
   13.54 ++ *
   13.55 ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   13.56 ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   13.57 ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
   13.58 ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   13.59 ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   13.60 ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   13.61 ++ * THE SOFTWARE.
   13.62 ++ */
   13.63 ++
   13.64 ++#include "vl.h"
   13.65 ++
   13.66 ++//#define DEBUG_CMOS
   13.67 ++
   13.68 ++struct RTCState {
   13.69 ++    uint8_t cmos_data[128];
   13.70 ++    uint8_t cmos_index;
   13.71 ++};
   13.72 ++
   13.73 ++void rtc_set_memory(RTCState *s, int addr, int val)
   13.74 ++{
   13.75 ++    if (addr >= 0 && addr <= 127)
   13.76 ++        s->cmos_data[addr] = val;
   13.77 ++}
   13.78 ++
   13.79 ++static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data)
   13.80 ++{
   13.81 ++    RTCState *s = opaque;
   13.82 ++
   13.83 ++    if ((addr & 1) == 0) {
   13.84 ++        s->cmos_index = data & 0x7f;
   13.85 ++    } else {
   13.86 ++#ifdef DEBUG_CMOS
   13.87 ++        printf("cmos: write index=0x%02x val=0x%02x\n",
   13.88 ++               s->cmos_index, data);
   13.89 ++#endif        
   13.90 ++        s->cmos_data[s->cmos_index] = data;
   13.91 ++    }
   13.92 ++}
   13.93 ++
   13.94 ++static uint32_t cmos_ioport_read(void *opaque, uint32_t addr)
   13.95 ++{
   13.96 ++    RTCState *s = opaque;
   13.97 ++    int ret;
   13.98 ++    if ((addr & 1) == 0) {
   13.99 ++        return 0xff;
  13.100 ++    } else {
  13.101 ++        ret = s->cmos_data[s->cmos_index];
  13.102 ++#ifdef DEBUG_CMOS
  13.103 ++        printf("cmos: read index=0x%02x val=0x%02x\n",
  13.104 ++               s->cmos_index, ret);
  13.105 ++#endif
  13.106 ++        return ret;
  13.107 ++    }
  13.108 ++}
  13.109 ++
  13.110 ++static void rtc_save(QEMUFile *f, void *opaque)
  13.111 ++{
  13.112 ++    RTCState *s = opaque;
  13.113 ++
  13.114 ++    qemu_put_buffer(f, s->cmos_data, 128);
  13.115 ++    qemu_put_8s(f, &s->cmos_index);
  13.116 ++}
  13.117 ++
  13.118 ++static int rtc_load(QEMUFile *f, void *opaque, int version_id)
  13.119 ++{
  13.120 ++    RTCState *s = opaque;
  13.121 ++
  13.122 ++    if (version_id != 1)
  13.123 ++        return -EINVAL;
  13.124 ++
  13.125 ++    qemu_get_buffer(f, s->cmos_data, 128);
  13.126 ++    qemu_get_8s(f, &s->cmos_index);
  13.127 ++
  13.128 ++    return 0;
  13.129 ++}
  13.130 ++
  13.131 ++RTCState *rtc_init(int base, int irq)
  13.132 ++{
  13.133 ++    RTCState *s;
  13.134 ++
  13.135 ++    s = qemu_mallocz(sizeof(RTCState));
  13.136 ++    if (!s)
  13.137 ++        return NULL;
  13.138 ++
  13.139 ++    register_ioport_write(base, 2, 1, cmos_ioport_write, s);
  13.140 ++    register_ioport_read(base, 2, 1, cmos_ioport_read, s);
  13.141 ++
  13.142 ++    register_savevm("mc146818rtc", base, 1, rtc_save, rtc_load, s);
  13.143 ++    return s;
  13.144 ++}
  13.145 ++
  13.146 ++void rtc_set_date(RTCState *s, const struct tm *tm) {}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/tools/ioemu/patches/ide-cd-dma	Tue Oct 24 11:21:48 2006 -0600
    14.3 @@ -0,0 +1,21 @@
    14.4 +# HG changeset patch
    14.5 +# User kfraser@localhost.localdomain
    14.6 +# Node ID 1e8ba8d2117548d4f13b7b438d1e992b1815f580
    14.7 +# Parent  f247e0b52dda257c0000c9da5a0cdff507b3ced8
    14.8 +[HVM] Enable DMA mode for CD-ROM IDE ATAPI interface.
    14.9 +Signed-off-by: Winston Wang <winston.l.wang@intel.com
   14.10 +
   14.11 +--- ioemu/hw/ide.c	Wed Oct 18 18:37:18 2006 +0100
   14.12 ++++ ioemu/hw/ide.c	Wed Oct 18 18:41:47 2006 +0100
   14.13 +@@ -557,9 +557,9 @@ static void ide_atapi_identify(IDEState 
   14.14 +     padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
   14.15 +     padstr((uint8_t *)(p + 27), "QEMU CD-ROM", 40); /* model */
   14.16 +     put_le16(p + 48, 1); /* dword I/O (XXX: should not be set on CDROM) */
   14.17 +-    put_le16(p + 49, 1 << 9); /* LBA supported, no DMA */
   14.18 ++    put_le16(p + 49, (1 << 11) | (1 << 9) | (1 << 8)); /* DMA and LBA supported */
   14.19 +     put_le16(p + 53, 3); /* words 64-70, 54-58 valid */
   14.20 +-    put_le16(p + 63, 0x103); /* DMA modes XXX: may be incorrect */
   14.21 ++    put_le16(p + 63, 0x07); /* mdma0-2 supported */
   14.22 +     put_le16(p + 64, 1); /* PIO modes */
   14.23 +     put_le16(p + 65, 0xb4); /* minimum DMA multiword tx cycle time */
   14.24 +     put_le16(p + 66, 0xb4); /* recommended DMA multiword tx cycle time */
    15.1 --- a/tools/ioemu/patches/qemu-bootorder	Tue Oct 24 10:08:30 2006 -0600
    15.2 +++ b/tools/ioemu/patches/qemu-bootorder	Tue Oct 24 11:21:48 2006 -0600
    15.3 @@ -1,9 +1,9 @@
    15.4  Index: ioemu/vl.c
    15.5  ===================================================================
    15.6 ---- ioemu.orig/vl.c	2006-09-21 19:33:32.000000000 +0100
    15.7 -+++ ioemu/vl.c	2006-09-21 19:33:32.000000000 +0100
    15.8 -@@ -124,7 +124,7 @@
    15.9 - int vncunused;
   15.10 +--- ioemu.orig/vl.c	2006-10-24 14:33:47.000000000 +0100
   15.11 ++++ ioemu/vl.c	2006-10-24 14:33:47.000000000 +0100
   15.12 +@@ -125,7 +125,7 @@
   15.13 + struct sockaddr_in vnclisten_addr;
   15.14   const char* keyboard_layout = NULL;
   15.15   int64_t ticks_per_sec;
   15.16  -int boot_device = 'c';
   15.17 @@ -11,7 +11,7 @@ Index: ioemu/vl.c
   15.18   uint64_t ram_size;
   15.19   int pit_min_timer_count = 0;
   15.20   int nb_nics;
   15.21 -@@ -6063,14 +6063,14 @@
   15.22 +@@ -6075,14 +6075,14 @@
   15.23                   break;
   15.24   #endif /* !CONFIG_DM */
   15.25               case QEMU_OPTION_boot:
   15.26 @@ -32,7 +32,7 @@ Index: ioemu/vl.c
   15.27                       exit(1);
   15.28                   }
   15.29                   break;
   15.30 -@@ -6334,6 +6334,7 @@
   15.31 +@@ -6349,6 +6349,7 @@
   15.32           fd_filename[0] == '\0')
   15.33           help();
   15.34       
   15.35 @@ -40,7 +40,7 @@ Index: ioemu/vl.c
   15.36       /* boot to cd by default if no hard disk */
   15.37       if (hd_filename[0] == '\0' && boot_device == 'c') {
   15.38           if (fd_filename[0] != '\0')
   15.39 -@@ -6341,6 +6342,7 @@
   15.40 +@@ -6356,6 +6357,7 @@
   15.41           else
   15.42               boot_device = 'd';
   15.43       }
   15.44 @@ -48,7 +48,7 @@ Index: ioemu/vl.c
   15.45   #endif /* !CONFIG_DM */
   15.46   
   15.47       setvbuf(stdout, NULL, _IOLBF, 0);
   15.48 -@@ -6599,6 +6601,7 @@
   15.49 +@@ -6614,6 +6616,7 @@
   15.50                     ds, fd_filename, snapshot,
   15.51                     kernel_filename, kernel_cmdline, initrd_filename,
   15.52                     timeoffset);
   15.53 @@ -58,9 +58,9 @@ Index: ioemu/vl.c
   15.54       if (usb_enabled) {
   15.55  Index: ioemu/vl.h
   15.56  ===================================================================
   15.57 ---- ioemu.orig/vl.h	2006-09-21 19:33:32.000000000 +0100
   15.58 -+++ ioemu/vl.h	2006-09-21 19:33:32.000000000 +0100
   15.59 -@@ -576,7 +576,7 @@
   15.60 +--- ioemu.orig/vl.h	2006-10-24 14:33:47.000000000 +0100
   15.61 ++++ ioemu/vl.h	2006-10-24 14:33:47.000000000 +0100
   15.62 +@@ -578,7 +578,7 @@
   15.63   #ifndef QEMU_TOOL
   15.64   
   15.65   typedef void QEMUMachineInitFunc(uint64_t ram_size, int vga_ram_size, 
   15.66 @@ -69,7 +69,7 @@ Index: ioemu/vl.h
   15.67                DisplayState *ds, const char **fd_filename, int snapshot,
   15.68                const char *kernel_filename, const char *kernel_cmdline,
   15.69                const char *initrd_filename, time_t timeoffset);
   15.70 -@@ -1021,7 +1021,7 @@
   15.71 +@@ -1023,7 +1023,7 @@
   15.72                       uint32_t start, uint32_t count);
   15.73   int PPC_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
   15.74                             const unsigned char *arch,
   15.75 @@ -80,8 +80,8 @@ Index: ioemu/vl.h
   15.76                             uint32_t initrd_image, uint32_t initrd_size,
   15.77  Index: ioemu/hw/pc.c
   15.78  ===================================================================
   15.79 ---- ioemu.orig/hw/pc.c	2006-09-21 19:33:32.000000000 +0100
   15.80 -+++ ioemu/hw/pc.c	2006-09-21 19:33:32.000000000 +0100
   15.81 +--- ioemu.orig/hw/pc.c	2006-10-24 14:33:47.000000000 +0100
   15.82 ++++ ioemu/hw/pc.c	2006-10-24 14:33:47.000000000 +0100
   15.83  @@ -158,8 +158,23 @@
   15.84       rtc_set_memory(s, info_ofs + 8, sectors);
   15.85   }
    16.1 --- a/tools/ioemu/patches/qemu-cleanup	Tue Oct 24 10:08:30 2006 -0600
    16.2 +++ b/tools/ioemu/patches/qemu-cleanup	Tue Oct 24 11:21:48 2006 -0600
    16.3 @@ -1,7 +1,7 @@
    16.4  Index: ioemu/hw/vga.c
    16.5  ===================================================================
    16.6 ---- ioemu.orig/hw/vga.c	2006-08-06 02:03:51.906765409 +0100
    16.7 -+++ ioemu/hw/vga.c	2006-08-06 02:15:10.364150665 +0100
    16.8 +--- ioemu.orig/hw/vga.c	2006-10-24 14:44:03.000000000 +0100
    16.9 ++++ ioemu/hw/vga.c	2006-10-24 14:45:22.000000000 +0100
   16.10  @@ -1622,7 +1622,9 @@
   16.11   static void vga_save(QEMUFile *f, void *opaque)
   16.12   {
   16.13 @@ -26,8 +26,8 @@ Index: ioemu/hw/vga.c
   16.14           return -EINVAL;
   16.15  Index: ioemu/vl.c
   16.16  ===================================================================
   16.17 ---- ioemu.orig/vl.c	2006-08-06 02:15:01.774108287 +0100
   16.18 -+++ ioemu/vl.c	2006-08-06 02:15:31.040845624 +0100
   16.19 +--- ioemu.orig/vl.c	2006-10-24 14:44:08.000000000 +0100
   16.20 ++++ ioemu/vl.c	2006-10-24 14:45:29.000000000 +0100
   16.21  @@ -39,6 +39,7 @@
   16.22   #include <sys/ioctl.h>
   16.23   #include <sys/socket.h>
   16.24 @@ -36,6 +36,24 @@ Index: ioemu/vl.c
   16.25   #include <dirent.h>
   16.26   #include <netdb.h>
   16.27   #ifdef _BSD
   16.28 +@@ -2932,7 +2933,7 @@
   16.29 +     }
   16.30 + 
   16.31 +     /* XXX: better tmp dir construction */
   16.32 +-    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
   16.33 ++    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%ld", (long)getpid());
   16.34 +     if (mkdir(smb_dir, 0700) < 0) {
   16.35 +         fprintf(stderr, "qemu: could not create samba server dir '%s'\n", smb_dir);
   16.36 +         exit(1);
   16.37 +@@ -3893,7 +3894,7 @@
   16.38 +                 perror("Opening pidfile");
   16.39 +                 exit(1);
   16.40 +             }
   16.41 +-            fprintf(f, "%d\n", getpid());
   16.42 ++            fprintf(f, "%ld\n", (long)getpid());
   16.43 +             fclose(f);
   16.44 +             pid_filename = qemu_strdup(filename);
   16.45 +             if (!pid_filename) {
   16.46  @@ -5308,7 +5309,9 @@
   16.47       QEMU_OPTION_d,
   16.48       QEMU_OPTION_hdachs,
   16.49 @@ -70,8 +88,8 @@ Index: ioemu/vl.c
   16.50                       fprintf(stderr, "qemu: too many network clients\n");
   16.51  Index: ioemu/vl.h
   16.52  ===================================================================
   16.53 ---- ioemu.orig/vl.h	2006-08-06 02:15:01.775108175 +0100
   16.54 -+++ ioemu/vl.h	2006-08-06 02:15:10.368150219 +0100
   16.55 +--- ioemu.orig/vl.h	2006-10-24 14:44:08.000000000 +0100
   16.56 ++++ ioemu/vl.h	2006-10-24 14:45:22.000000000 +0100
   16.57  @@ -957,7 +957,7 @@
   16.58   	       unsigned long vram_offset, int vram_size, int width, int height);
   16.59   
   16.60 @@ -81,3 +99,18 @@ Index: ioemu/vl.h
   16.61   void slavio_intctl_set_cpu(void *opaque, unsigned int cpu, CPUState *env);
   16.62   void slavio_pic_info(void *opaque);
   16.63   void slavio_irq_info(void *opaque);
   16.64 +Index: ioemu/usb-linux.c
   16.65 +===================================================================
   16.66 +--- ioemu.orig/usb-linux.c	2006-10-24 14:44:03.000000000 +0100
   16.67 ++++ ioemu/usb-linux.c	2006-10-24 14:44:08.000000000 +0100
   16.68 +@@ -26,7 +26,9 @@
   16.69 + #if defined(__linux__)
   16.70 + #include <dirent.h>
   16.71 + #include <sys/ioctl.h>
   16.72 +-#include <linux/compiler.h>
   16.73 ++/* Some versions of usbdevice_fs.h need __user to be defined for them.   */
   16.74 ++/* This may (harmlessly) conflict with a definition in linux/compiler.h. */
   16.75 ++#define __user
   16.76 + #include <linux/usbdevice_fs.h>
   16.77 + #include <linux/version.h>
   16.78 + 
    17.1 --- a/tools/ioemu/patches/qemu-daemonize	Tue Oct 24 10:08:30 2006 -0600
    17.2 +++ b/tools/ioemu/patches/qemu-daemonize	Tue Oct 24 11:21:48 2006 -0600
    17.3 @@ -2,9 +2,9 @@ Changes required because qemu-dm runs da
    17.4  
    17.5  Index: ioemu/vl.c
    17.6  ===================================================================
    17.7 ---- ioemu.orig/vl.c	2006-09-21 19:33:32.000000000 +0100
    17.8 -+++ ioemu/vl.c	2006-09-21 19:33:32.000000000 +0100
    17.9 -@@ -6042,10 +6042,11 @@
   17.10 +--- ioemu.orig/vl.c	2006-10-24 14:33:47.000000000 +0100
   17.11 ++++ ioemu/vl.c	2006-10-24 14:33:47.000000000 +0100
   17.12 +@@ -6054,10 +6054,11 @@
   17.13                   }
   17.14                   break;
   17.15               case QEMU_OPTION_nographic:
    18.1 --- a/tools/ioemu/patches/qemu-logging	Tue Oct 24 10:08:30 2006 -0600
    18.2 +++ b/tools/ioemu/patches/qemu-logging	Tue Oct 24 11:21:48 2006 -0600
    18.3 @@ -1,7 +1,7 @@
    18.4  Index: ioemu/vl.c
    18.5  ===================================================================
    18.6 ---- ioemu.orig/vl.c	2006-08-06 02:15:48.550893605 +0100
    18.7 -+++ ioemu/vl.c	2006-08-06 02:16:31.246133963 +0100
    18.8 +--- ioemu.orig/vl.c	2006-10-24 14:36:58.000000000 +0100
    18.9 ++++ ioemu/vl.c	2006-10-24 14:37:03.000000000 +0100
   18.10  @@ -5234,7 +5234,7 @@
   18.11              "-S              freeze CPU at startup (use 'c' to start execution)\n"
   18.12              "-s              wait gdb connection to port %d\n"
   18.13 @@ -43,7 +43,7 @@ Index: ioemu/vl.c
   18.14       /* default mac address of the first network interface */
   18.15       
   18.16  +    /* init debug */
   18.17 -+    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%d.log", getpid());
   18.18 ++    sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%ld.log", (long)getpid());
   18.19  +    cpu_set_log_filename(qemu_dm_logfilename);
   18.20  +    cpu_set_log(0);
   18.21  +    
    19.1 --- a/tools/ioemu/patches/qemu-target-i386-dm	Tue Oct 24 10:08:30 2006 -0600
    19.2 +++ b/tools/ioemu/patches/qemu-target-i386-dm	Tue Oct 24 11:21:48 2006 -0600
    19.3 @@ -1,7 +1,7 @@
    19.4  Index: ioemu/Makefile.target
    19.5  ===================================================================
    19.6 ---- ioemu.orig/Makefile.target	2006-09-21 11:30:11.000000000 +0100
    19.7 -+++ ioemu/Makefile.target	2006-09-21 18:54:22.000000000 +0100
    19.8 +--- ioemu.orig/Makefile.target	2006-10-24 13:47:23.000000000 +0100
    19.9 ++++ ioemu/Makefile.target	2006-10-24 14:30:56.000000000 +0100
   19.10  @@ -62,6 +62,8 @@
   19.11   QEMU_SYSTEM=qemu-fast
   19.12   endif
   19.13 @@ -32,8 +32,8 @@ Index: ioemu/Makefile.target
   19.14   DEFINES += -DHAS_AUDIO
   19.15  Index: ioemu/configure
   19.16  ===================================================================
   19.17 ---- ioemu.orig/configure	2006-09-21 11:30:11.000000000 +0100
   19.18 -+++ ioemu/configure	2006-09-21 18:54:21.000000000 +0100
   19.19 +--- ioemu.orig/configure	2006-10-24 13:47:23.000000000 +0100
   19.20 ++++ ioemu/configure	2006-10-24 14:29:34.000000000 +0100
   19.21  @@ -373,6 +373,8 @@
   19.22       if [ "$user" = "yes" ] ; then
   19.23           target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
   19.24 @@ -45,8 +45,8 @@ Index: ioemu/configure
   19.25   fi
   19.26  Index: ioemu/monitor.c
   19.27  ===================================================================
   19.28 ---- ioemu.orig/monitor.c	2006-09-21 11:30:11.000000000 +0100
   19.29 -+++ ioemu/monitor.c	2006-09-21 18:54:23.000000000 +0100
   19.30 +--- ioemu.orig/monitor.c	2006-10-24 13:47:23.000000000 +0100
   19.31 ++++ ioemu/monitor.c	2006-10-24 14:30:56.000000000 +0100
   19.32  @@ -1262,6 +1262,10 @@
   19.33         "", "show profiling information", },
   19.34       { "capture", "", do_info_capture,
   19.35 @@ -60,8 +60,8 @@ Index: ioemu/monitor.c
   19.36   
   19.37  Index: ioemu/vl.c
   19.38  ===================================================================
   19.39 ---- ioemu.orig/vl.c	2006-09-21 11:30:11.000000000 +0100
   19.40 -+++ ioemu/vl.c	2006-09-21 18:54:23.000000000 +0100
   19.41 +--- ioemu.orig/vl.c	2006-10-24 13:47:23.000000000 +0100
   19.42 ++++ ioemu/vl.c	2006-10-24 14:30:56.000000000 +0100
   19.43  @@ -87,7 +87,7 @@
   19.44   
   19.45   #include "exec-all.h"
   19.46 @@ -98,8 +98,8 @@ Index: ioemu/vl.c
   19.47   {
   19.48  Index: ioemu/vl.h
   19.49  ===================================================================
   19.50 ---- ioemu.orig/vl.h	2006-09-21 11:30:11.000000000 +0100
   19.51 -+++ ioemu/vl.h	2006-09-21 18:54:23.000000000 +0100
   19.52 +--- ioemu.orig/vl.h	2006-10-24 13:47:23.000000000 +0100
   19.53 ++++ ioemu/vl.h	2006-10-24 14:30:56.000000000 +0100
   19.54  @@ -37,6 +37,8 @@
   19.55   #include <unistd.h>
   19.56   #include <fcntl.h>
   19.57 @@ -132,7 +132,7 @@ Index: ioemu/vl.h
   19.58  Index: ioemu/target-i386-dm/cpu.h
   19.59  ===================================================================
   19.60  --- /dev/null	1970-01-01 00:00:00.000000000 +0000
   19.61 -+++ ioemu/target-i386-dm/cpu.h	2006-09-21 18:54:22.000000000 +0100
   19.62 ++++ ioemu/target-i386-dm/cpu.h	2006-10-24 14:30:56.000000000 +0100
   19.63  @@ -0,0 +1,86 @@
   19.64  +/*
   19.65  + * i386 virtual CPU header
   19.66 @@ -223,7 +223,7 @@ Index: ioemu/target-i386-dm/cpu.h
   19.67  Index: ioemu/target-i386-dm/exec-dm.c
   19.68  ===================================================================
   19.69  --- /dev/null	1970-01-01 00:00:00.000000000 +0000
   19.70 -+++ ioemu/target-i386-dm/exec-dm.c	2006-09-21 18:54:22.000000000 +0100
   19.71 ++++ ioemu/target-i386-dm/exec-dm.c	2006-10-24 14:30:56.000000000 +0100
   19.72  @@ -0,0 +1,516 @@
   19.73  +/*
   19.74  + *  virtual page mapping and translated block handling
   19.75 @@ -744,7 +744,7 @@ Index: ioemu/target-i386-dm/exec-dm.c
   19.76  Index: ioemu/target-i386-dm/helper2.c
   19.77  ===================================================================
   19.78  --- /dev/null	1970-01-01 00:00:00.000000000 +0000
   19.79 -+++ ioemu/target-i386-dm/helper2.c	2006-09-21 18:55:31.000000000 +0100
   19.80 ++++ ioemu/target-i386-dm/helper2.c	2006-10-24 14:31:01.000000000 +0100
   19.81  @@ -0,0 +1,469 @@
   19.82  +/*
   19.83  + *  i386 helpers (without register variable usage)
   19.84 @@ -1205,8 +1205,8 @@ Index: ioemu/target-i386-dm/helper2.c
   19.85  +                break;
   19.86  +        }
   19.87  +
   19.88 -+        /* Wait up to 100 msec. */
   19.89 -+        main_loop_wait(100);
   19.90 ++        /* Wait up to 10 msec. */
   19.91 ++        main_loop_wait(10);
   19.92  +
   19.93  +        if (env->send_event) {
   19.94  +            env->send_event = 0;
   19.95 @@ -1218,7 +1218,7 @@ Index: ioemu/target-i386-dm/helper2.c
   19.96  Index: ioemu/target-i386-dm/i8259-dm.c
   19.97  ===================================================================
   19.98  --- /dev/null	1970-01-01 00:00:00.000000000 +0000
   19.99 -+++ ioemu/target-i386-dm/i8259-dm.c	2006-09-21 11:30:11.000000000 +0100
  19.100 ++++ ioemu/target-i386-dm/i8259-dm.c	2006-10-24 13:47:23.000000000 +0100
  19.101  @@ -0,0 +1,107 @@
  19.102  +/* Xen 8259 stub for interrupt controller emulation
  19.103  + * 
  19.104 @@ -1330,7 +1330,7 @@ Index: ioemu/target-i386-dm/i8259-dm.c
  19.105  Index: ioemu/target-i386-dm/qemu-dm.debug
  19.106  ===================================================================
  19.107  --- /dev/null	1970-01-01 00:00:00.000000000 +0000
  19.108 -+++ ioemu/target-i386-dm/qemu-dm.debug	2006-09-21 11:30:11.000000000 +0100
  19.109 ++++ ioemu/target-i386-dm/qemu-dm.debug	2006-10-24 13:47:23.000000000 +0100
  19.110  @@ -0,0 +1,5 @@
  19.111  +#!/bin/sh
  19.112  +
  19.113 @@ -1340,7 +1340,7 @@ Index: ioemu/target-i386-dm/qemu-dm.debu
  19.114  Index: ioemu/target-i386-dm/qemu-ifup
  19.115  ===================================================================
  19.116  --- /dev/null	1970-01-01 00:00:00.000000000 +0000
  19.117 -+++ ioemu/target-i386-dm/qemu-ifup	2006-09-21 11:30:11.000000000 +0100
  19.118 ++++ ioemu/target-i386-dm/qemu-ifup	2006-10-24 13:47:23.000000000 +0100
  19.119  @@ -0,0 +1,10 @@
  19.120  +#!/bin/sh
  19.121  +
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/tools/ioemu/patches/serial-port-rate-limit	Tue Oct 24 11:21:48 2006 -0600
    20.3 @@ -0,0 +1,116 @@
    20.4 +# HG changeset patch
    20.5 +# User Steven Smith <ssmith@xensource.com>
    20.6 +# Node ID 1d3f52eb256e3522edc12daca91039b319dbbbe5
    20.7 +# Parent  b7b653e36d20811831f26bb951ea66dca5854b17
    20.8 +[HVM] Rate limit guest accesses to the qemu virtual serial port.  This stops
    20.9 +grub's boot menu from hammering dom0.
   20.10 +
   20.11 +Signed-off-by: Steven Smith <sos22@cam.ac.uk>
   20.12 +
   20.13 +--- ioemu/hw/serial.c	Mon Sep 25 16:31:02 2006 +0100
   20.14 ++++ ioemu/hw/serial.c	Mon Sep 25 17:27:18 2006 +0100
   20.15 +@@ -22,6 +22,9 @@
   20.16 +  * THE SOFTWARE.
   20.17 +  */
   20.18 + #include "vl.h"
   20.19 ++#include <sys/time.h>
   20.20 ++#include <time.h>
   20.21 ++#include <assert.h>
   20.22 + 
   20.23 + //#define DEBUG_SERIAL
   20.24 + 
   20.25 +@@ -138,6 +141,67 @@ static void serial_update_parameters(Ser
   20.26 +     printf("speed=%d parity=%c data=%d stop=%d\n", 
   20.27 +            speed, parity, data_bits, stop_bits);
   20.28 + #endif
   20.29 ++}
   20.30 ++
   20.31 ++/* Rate limit serial requests so that e.g. grub on a serial console
   20.32 ++   doesn't kill dom0.  Simple token bucket.  If we get some actual
   20.33 ++   data from the user, instantly refil the bucket. */
   20.34 ++
   20.35 ++/* How long it takes to generate a token, in microseconds. */
   20.36 ++#define TOKEN_PERIOD 1000
   20.37 ++/* Maximum and initial size of token bucket */
   20.38 ++#define TOKENS_MAX 100000
   20.39 ++
   20.40 ++static int tokens_avail;
   20.41 ++
   20.42 ++static void serial_get_token(void)
   20.43 ++{
   20.44 ++    static struct timeval last_refil_time;
   20.45 ++    static int started;
   20.46 ++
   20.47 ++    assert(tokens_avail >= 0);
   20.48 ++    if (!tokens_avail) {
   20.49 ++	struct timeval delta, now;
   20.50 ++	int generated;
   20.51 ++
   20.52 ++	if (!started) {
   20.53 ++	    gettimeofday(&last_refil_time, NULL);
   20.54 ++	    tokens_avail = TOKENS_MAX;
   20.55 ++	    started = 1;
   20.56 ++	    return;
   20.57 ++	}
   20.58 ++    retry:
   20.59 ++	gettimeofday(&now, NULL);
   20.60 ++	delta.tv_sec = now.tv_sec - last_refil_time.tv_sec;
   20.61 ++	delta.tv_usec = now.tv_usec - last_refil_time.tv_usec;
   20.62 ++	if (delta.tv_usec < 0) {
   20.63 ++	    delta.tv_usec += 1000000;
   20.64 ++	    delta.tv_sec--;
   20.65 ++	}
   20.66 ++	assert(delta.tv_usec >= 0 && delta.tv_sec >= 0);
   20.67 ++	if (delta.tv_usec < TOKEN_PERIOD) {
   20.68 ++	    struct timespec ts;
   20.69 ++	    /* Wait until at least one token is available. */
   20.70 ++	    ts.tv_sec = TOKEN_PERIOD / 1000000;
   20.71 ++	    ts.tv_nsec = (TOKEN_PERIOD % 1000000) * 1000;
   20.72 ++	    while (nanosleep(&ts, &ts) < 0 && errno == EINTR)
   20.73 ++		;
   20.74 ++	    goto retry;
   20.75 ++	}
   20.76 ++	generated = (delta.tv_sec * 1000000) / TOKEN_PERIOD;
   20.77 ++	generated +=
   20.78 ++	    ((delta.tv_sec * 1000000) % TOKEN_PERIOD + delta.tv_usec) / TOKEN_PERIOD;
   20.79 ++	assert(generated > 0);
   20.80 ++
   20.81 ++	last_refil_time.tv_usec += (generated * TOKEN_PERIOD) % 1000000;
   20.82 ++	last_refil_time.tv_sec  += last_refil_time.tv_usec / 1000000;
   20.83 ++	last_refil_time.tv_usec %= 1000000;
   20.84 ++	last_refil_time.tv_sec  += (generated * TOKEN_PERIOD) / 1000000;
   20.85 ++	if (generated > TOKENS_MAX)
   20.86 ++	    generated = TOKENS_MAX;
   20.87 ++	tokens_avail = generated;
   20.88 ++    }
   20.89 ++    tokens_avail--;
   20.90 + }
   20.91 + 
   20.92 + static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
   20.93 +@@ -245,9 +309,11 @@ static uint32_t serial_ioport_read(void 
   20.94 +         ret = s->mcr;
   20.95 +         break;
   20.96 +     case 5:
   20.97 ++	serial_get_token();
   20.98 +         ret = s->lsr;
   20.99 +         break;
  20.100 +     case 6:
  20.101 ++	serial_get_token();
  20.102 +         if (s->mcr & UART_MCR_LOOP) {
  20.103 +             /* in loopback, the modem output pins are connected to the
  20.104 +                inputs */
  20.105 +@@ -296,12 +362,14 @@ static void serial_receive1(void *opaque
  20.106 + static void serial_receive1(void *opaque, const uint8_t *buf, int size)
  20.107 + {
  20.108 +     SerialState *s = opaque;
  20.109 ++    tokens_avail = TOKENS_MAX;
  20.110 +     serial_receive_byte(s, buf[0]);
  20.111 + }
  20.112 + 
  20.113 + static void serial_event(void *opaque, int event)
  20.114 + {
  20.115 +     SerialState *s = opaque;
  20.116 ++    tokens_avail = TOKENS_MAX;
  20.117 +     if (event == CHR_EVENT_BREAK)
  20.118 +         serial_receive_break(s);
  20.119 + }
    21.1 --- a/tools/ioemu/patches/series	Tue Oct 24 10:08:30 2006 -0600
    21.2 +++ b/tools/ioemu/patches/series	Tue Oct 24 11:21:48 2006 -0600
    21.3 @@ -32,10 +32,12 @@ acpi-poweroff-support
    21.4  fix-vga-scanning-code-overflow
    21.5  vnc-cleanup
    21.6  vnc-fixes
    21.7 +vnc-protocol-fixes
    21.8  vnc-start-vncviewer
    21.9  vnc-title-domain-name
   21.10  vnc-access-monitor-vt
   21.11  vnc-display-find-unused
   21.12 +vnc-listen-specific-interface
   21.13  vnc-backoff-screen-scan
   21.14  xenstore-block-device-config
   21.15  xenstore-write-vnc-port
   21.16 @@ -47,3 +49,7 @@ xen-platform-device
   21.17  qemu-bootorder
   21.18  qemu-tunable-ide-write-cache
   21.19  qemu-pci 
   21.20 +serial-port-rate-limit
   21.21 +hypervisor-rtc
   21.22 +ide-cd-dma
   21.23 +vnc-password
    22.1 --- a/tools/ioemu/patches/vnc-access-monitor-vt	Tue Oct 24 10:08:30 2006 -0600
    22.2 +++ b/tools/ioemu/patches/vnc-access-monitor-vt	Tue Oct 24 11:21:48 2006 -0600
    22.3 @@ -1,8 +1,8 @@
    22.4  Index: ioemu/vnc.c
    22.5  ===================================================================
    22.6 ---- ioemu.orig/vnc.c	2006-09-21 19:33:31.000000000 +0100
    22.7 -+++ ioemu/vnc.c	2006-09-21 19:33:31.000000000 +0100
    22.8 -@@ -32,6 +32,10 @@
    22.9 +--- ioemu.orig/vnc.c	2006-10-24 14:33:46.000000000 +0100
   22.10 ++++ ioemu/vnc.c	2006-10-24 14:33:46.000000000 +0100
   22.11 +@@ -33,6 +33,10 @@
   22.12   #include "vnc_keysym.h"
   22.13   #include "keymaps.c"
   22.14   
   22.15 @@ -13,7 +13,7 @@ Index: ioemu/vnc.c
   22.16   typedef struct Buffer
   22.17   {
   22.18       size_t capacity;
   22.19 -@@ -95,6 +99,8 @@
   22.20 +@@ -96,6 +100,8 @@
   22.21       int visible_h;
   22.22   
   22.23       int slow_client;
   22.24 @@ -22,7 +22,7 @@ Index: ioemu/vnc.c
   22.25   };
   22.26   
   22.27   #define DIRTY_PIXEL_BITS 64
   22.28 -@@ -791,16 +797,80 @@
   22.29 +@@ -794,16 +800,80 @@
   22.30   
   22.31   static void do_key_event(VncState *vs, int down, uint32_t sym)
   22.32   {
    23.1 --- a/tools/ioemu/patches/vnc-backoff-screen-scan	Tue Oct 24 10:08:30 2006 -0600
    23.2 +++ b/tools/ioemu/patches/vnc-backoff-screen-scan	Tue Oct 24 11:21:48 2006 -0600
    23.3 @@ -1,10 +1,10 @@
    23.4  Index: ioemu/vnc.c
    23.5  ===================================================================
    23.6 ---- ioemu.orig/vnc.c	2006-09-21 19:31:03.000000000 +0100
    23.7 -+++ ioemu/vnc.c	2006-09-21 19:32:23.000000000 +0100
    23.8 -@@ -27,7 +27,19 @@
    23.9 - #include "vl.h"
   23.10 +--- ioemu.orig/vnc.c	2006-10-24 14:33:17.000000000 +0100
   23.11 ++++ ioemu/vnc.c	2006-10-24 14:33:24.000000000 +0100
   23.12 +@@ -28,7 +28,19 @@
   23.13   #include "qemu_socket.h"
   23.14 + #include <assert.h>
   23.15   
   23.16  -#define VNC_REFRESH_INTERVAL (1000 / 30)
   23.17  +/* The refresh interval starts at BASE.  If we scan the buffer and
   23.18 @@ -23,7 +23,7 @@ Index: ioemu/vnc.c
   23.19   
   23.20   #include "vnc_keysym.h"
   23.21   #include "keymaps.c"
   23.22 -@@ -64,10 +76,11 @@
   23.23 +@@ -65,10 +77,11 @@
   23.24   struct VncState
   23.25   {
   23.26       QEMUTimer *timer;
   23.27 @@ -36,7 +36,7 @@ Index: ioemu/vnc.c
   23.28       int width;
   23.29       int height;
   23.30       uint64_t *dirty_row;	/* screen regions which are possibly dirty */
   23.31 -@@ -98,8 +111,6 @@
   23.32 +@@ -99,8 +112,6 @@
   23.33       int visible_w;
   23.34       int visible_h;
   23.35   
   23.36 @@ -45,7 +45,7 @@ Index: ioemu/vnc.c
   23.37       int ctl_keys;               /* Ctrl+Alt starts calibration */
   23.38   };
   23.39   
   23.40 -@@ -380,7 +391,7 @@
   23.41 +@@ -381,7 +392,7 @@
   23.42       int y = 0;
   23.43       int pitch = ds->linesize;
   23.44       VncState *vs = ds->opaque;
   23.45 @@ -54,19 +54,19 @@ Index: ioemu/vnc.c
   23.46   
   23.47       if (src_x < vs->visible_x || src_y < vs->visible_y ||
   23.48   	dst_x < vs->visible_x || dst_y < vs->visible_y ||
   23.49 -@@ -390,11 +401,6 @@
   23.50 +@@ -391,10 +402,8 @@
   23.51   	(dst_y + h) > (vs->visible_y + vs->visible_h))
   23.52   	updating_client = 0;
   23.53   
   23.54  -    if (updating_client) {
   23.55  -	vs->need_update = 1;
   23.56 --	_vnc_update_client(vs);
   23.57 ++    if (updating_client)
   23.58 + 	_vnc_update_client(vs);
   23.59  -    }
   23.60 --
   23.61 + 
   23.62       if (dst_y > src_y) {
   23.63   	y = h - 1;
   23.64 - 	pitch = -pitch;
   23.65 -@@ -445,110 +451,145 @@
   23.66 +@@ -446,110 +455,149 @@
   23.67   static void _vnc_update_client(void *opaque)
   23.68   {
   23.69       VncState *vs = opaque;
   23.70 @@ -279,12 +279,16 @@ Index: ioemu/vnc.c
   23.71  +	       interested (e.g. minimised) it'll ignore this, and we
   23.72  +	       can stop scanning the buffer until it sends another
   23.73  +	       update request. */
   23.74 -+	    /* Note that there are bugs in xvncviewer which prevent
   23.75 -+	       this from actually working.  Leave the code in place
   23.76 -+	       for correct clients. */
   23.77 ++	    /* It turns out that there's a bug in realvncviewer 4.1.2
   23.78 ++	       which means that if you send a proper null update (with
   23.79 ++	       no update rectangles), it gets a bit out of sync and
   23.80 ++	       never sends any further requests, regardless of whether
   23.81 ++	       it needs one or not.  Fix this by sending a single 1x1
   23.82 ++	       update rectangle instead. */
   23.83  +	    vnc_write_u8(vs, 0);
   23.84  +	    vnc_write_u8(vs, 0);
   23.85 -+	    vnc_write_u16(vs, 0);
   23.86 ++	    vnc_write_u16(vs, 1);
   23.87 ++	    send_framebuffer_update(vs, 0, 0, 1, 1);
   23.88  +	    vnc_flush(vs);
   23.89  +	    vs->last_update_time = now;
   23.90  +	    return;
   23.91 @@ -295,7 +299,7 @@ Index: ioemu/vnc.c
   23.92   }
   23.93   
   23.94   static void vnc_update_client(void *opaque)
   23.95 -@@ -561,8 +602,10 @@
   23.96 +@@ -562,8 +610,10 @@
   23.97   
   23.98   static void vnc_timer_init(VncState *vs)
   23.99   {
  23.100 @@ -307,7 +311,7 @@ Index: ioemu/vnc.c
  23.101   }
  23.102   
  23.103   static void vnc_dpy_refresh(DisplayState *ds)
  23.104 -@@ -622,7 +665,6 @@
  23.105 +@@ -623,7 +673,6 @@
  23.106   	vs->csock = -1;
  23.107   	buffer_reset(&vs->input);
  23.108   	buffer_reset(&vs->output);
  23.109 @@ -315,7 +319,7 @@ Index: ioemu/vnc.c
  23.110   	return 0;
  23.111       }
  23.112       return ret;
  23.113 -@@ -892,7 +934,6 @@
  23.114 +@@ -895,7 +944,6 @@
  23.115   				       int x_position, int y_position,
  23.116   				       int w, int h)
  23.117   {
  23.118 @@ -323,7 +327,7 @@ Index: ioemu/vnc.c
  23.119       if (!incremental)
  23.120   	framebuffer_set_updated(vs, x_position, y_position, w, h);
  23.121       vs->visible_x = x_position;
  23.122 -@@ -1015,6 +1056,7 @@
  23.123 +@@ -1018,6 +1066,7 @@
  23.124   {
  23.125       int i;
  23.126       uint16_t limit;
  23.127 @@ -331,7 +335,7 @@ Index: ioemu/vnc.c
  23.128   
  23.129       switch (data[0]) {
  23.130       case 0:
  23.131 -@@ -1054,12 +1096,18 @@
  23.132 +@@ -1061,12 +1110,18 @@
  23.133   	if (len == 1)
  23.134   	    return 8;
  23.135   
  23.136 @@ -352,15 +356,15 @@ Index: ioemu/vnc.c
  23.137       case 6:
  23.138  Index: ioemu/vl.c
  23.139  ===================================================================
  23.140 ---- ioemu.orig/vl.c	2006-09-21 19:31:03.000000000 +0100
  23.141 -+++ ioemu/vl.c	2006-09-21 19:32:23.000000000 +0100
  23.142 -@@ -725,6 +725,12 @@
  23.143 +--- ioemu.orig/vl.c	2006-10-24 14:33:17.000000000 +0100
  23.144 ++++ ioemu/vl.c	2006-10-24 14:33:24.000000000 +0100
  23.145 +@@ -726,6 +726,12 @@
  23.146       }
  23.147   }
  23.148   
  23.149  +void qemu_advance_timer(QEMUTimer *ts, int64_t expire_time)
  23.150  +{
  23.151 -+    if (ts->expire_time > expire_time)
  23.152 ++    if (ts->expire_time > expire_time || !qemu_timer_pending(ts))
  23.153  +	qemu_mod_timer(ts, expire_time);
  23.154  +}
  23.155  +
  23.156 @@ -369,9 +373,9 @@ Index: ioemu/vl.c
  23.157   void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time)
  23.158  Index: ioemu/vl.h
  23.159  ===================================================================
  23.160 ---- ioemu.orig/vl.h	2006-09-21 19:31:03.000000000 +0100
  23.161 -+++ ioemu/vl.h	2006-09-21 19:32:23.000000000 +0100
  23.162 -@@ -405,6 +405,7 @@
  23.163 +--- ioemu.orig/vl.h	2006-10-24 14:33:17.000000000 +0100
  23.164 ++++ ioemu/vl.h	2006-10-24 14:33:24.000000000 +0100
  23.165 +@@ -407,6 +407,7 @@
  23.166   void qemu_free_timer(QEMUTimer *ts);
  23.167   void qemu_del_timer(QEMUTimer *ts);
  23.168   void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
    24.1 --- a/tools/ioemu/patches/vnc-display-find-unused	Tue Oct 24 10:08:30 2006 -0600
    24.2 +++ b/tools/ioemu/patches/vnc-display-find-unused	Tue Oct 24 11:21:48 2006 -0600
    24.3 @@ -1,8 +1,8 @@
    24.4  Index: ioemu/vnc.c
    24.5  ===================================================================
    24.6 ---- ioemu.orig/vnc.c	2006-09-21 19:33:31.000000000 +0100
    24.7 -+++ ioemu/vnc.c	2006-09-21 19:33:31.000000000 +0100
    24.8 -@@ -1182,7 +1182,7 @@
    24.9 +--- ioemu.orig/vnc.c	2006-10-24 14:31:09.000000000 +0100
   24.10 ++++ ioemu/vnc.c	2006-10-24 14:31:36.000000000 +0100
   24.11 +@@ -1195,7 +1195,7 @@
   24.12       }
   24.13   }
   24.14   
   24.15 @@ -11,7 +11,7 @@ Index: ioemu/vnc.c
   24.16   {
   24.17       struct sockaddr_in addr;
   24.18       int reuse_addr, ret;
   24.19 -@@ -1213,10 +1213,6 @@
   24.20 +@@ -1226,10 +1226,6 @@
   24.21   	exit(1);
   24.22       }
   24.23   
   24.24 @@ -22,7 +22,7 @@ Index: ioemu/vnc.c
   24.25       reuse_addr = 1;
   24.26       ret = setsockopt(vs->lsock, SOL_SOCKET, SO_REUSEADDR,
   24.27   		     (const char *)&reuse_addr, sizeof(reuse_addr));
   24.28 -@@ -1225,7 +1221,16 @@
   24.29 +@@ -1238,7 +1234,16 @@
   24.30   	exit(1);
   24.31       }
   24.32   
   24.33 @@ -39,7 +39,7 @@ Index: ioemu/vnc.c
   24.34   	fprintf(stderr, "bind() failed\n");
   24.35   	exit(1);
   24.36       }
   24.37 -@@ -1246,6 +1251,8 @@
   24.38 +@@ -1259,6 +1264,8 @@
   24.39       vs->ds->dpy_refresh = vnc_dpy_refresh;
   24.40   
   24.41       vnc_dpy_resize(vs->ds, 640, 400);
   24.42 @@ -50,8 +50,8 @@ Index: ioemu/vnc.c
   24.43   int vnc_start_viewer(int port)
   24.44  Index: ioemu/vl.c
   24.45  ===================================================================
   24.46 ---- ioemu.orig/vl.c	2006-09-21 19:33:31.000000000 +0100
   24.47 -+++ ioemu/vl.c	2006-09-21 19:33:31.000000000 +0100
   24.48 +--- ioemu.orig/vl.c	2006-10-24 14:31:09.000000000 +0100
   24.49 ++++ ioemu/vl.c	2006-10-24 14:31:41.000000000 +0100
   24.50  @@ -121,6 +121,7 @@
   24.51   static DisplayState display_state;
   24.52   int nographic;
   24.53 @@ -99,7 +99,7 @@ Index: ioemu/vl.c
   24.54  +            case QEMU_OPTION_vncunused:
   24.55  +                vncunused++;
   24.56  +                if (vnc_display == -1)
   24.57 -+                    vnc_display = -2;
   24.58 ++                    vnc_display = 0;
   24.59  +                break;
   24.60               }
   24.61           }
   24.62 @@ -115,8 +115,8 @@ Index: ioemu/vl.c
   24.63       } else {
   24.64  Index: ioemu/vl.h
   24.65  ===================================================================
   24.66 ---- ioemu.orig/vl.h	2006-09-21 19:33:31.000000000 +0100
   24.67 -+++ ioemu/vl.h	2006-09-21 19:33:31.000000000 +0100
   24.68 +--- ioemu.orig/vl.h	2006-10-24 14:31:09.000000000 +0100
   24.69 ++++ ioemu/vl.h	2006-10-24 14:31:36.000000000 +0100
   24.70  @@ -785,7 +785,7 @@
   24.71   void cocoa_display_init(DisplayState *ds, int full_screen);
   24.72   
    25.1 --- a/tools/ioemu/patches/vnc-fixes	Tue Oct 24 10:08:30 2006 -0600
    25.2 +++ b/tools/ioemu/patches/vnc-fixes	Tue Oct 24 11:21:48 2006 -0600
    25.3 @@ -1,7 +1,7 @@
    25.4  Index: ioemu/vl.c
    25.5  ===================================================================
    25.6 ---- ioemu.orig/vl.c	2006-09-21 19:08:18.000000000 +0100
    25.7 -+++ ioemu/vl.c	2006-09-21 19:26:24.000000000 +0100
    25.8 +--- ioemu.orig/vl.c	2006-10-24 13:47:23.000000000 +0100
    25.9 ++++ ioemu/vl.c	2006-10-24 14:19:36.000000000 +0100
   25.10  @@ -6534,8 +6534,10 @@
   25.11           }
   25.12       }
   25.13 @@ -17,8 +17,8 @@ Index: ioemu/vl.c
   25.14       if (use_gdbstub) {
   25.15  Index: ioemu/vnc.c
   25.16  ===================================================================
   25.17 ---- ioemu.orig/vnc.c	2006-09-21 19:08:18.000000000 +0100
   25.18 -+++ ioemu/vnc.c	2006-09-21 19:26:38.000000000 +0100
   25.19 +--- ioemu.orig/vnc.c	2006-10-24 13:47:23.000000000 +0100
   25.20 ++++ ioemu/vnc.c	2006-10-24 14:20:00.000000000 +0100
   25.21  @@ -3,6 +3,7 @@
   25.22    * 
   25.23    * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
   25.24 @@ -483,7 +483,16 @@ Index: ioemu/vnc.c
   25.25   
   25.26       vga_hw_invalidate();
   25.27       vga_hw_update();
   25.28 -@@ -1010,11 +1101,11 @@
   25.29 +@@ -924,6 +1015,8 @@
   25.30 + {
   25.31 +     char pad[3] = { 0, 0, 0 };
   25.32 + 
   25.33 ++    vga_hw_update();
   25.34 ++
   25.35 +     vs->width = vs->ds->width;
   25.36 +     vs->height = vs->ds->height;
   25.37 +     vnc_write_u16(vs, vs->ds->width);
   25.38 +@@ -1010,11 +1103,11 @@
   25.39   	vnc_write(vs, "RFB 003.003\n", 12);
   25.40   	vnc_flush(vs);
   25.41   	vnc_read_when(vs, protocol_version, 12);
   25.42 @@ -497,7 +506,7 @@ Index: ioemu/vnc.c
   25.43       }
   25.44   }
   25.45   
   25.46 -@@ -1071,17 +1162,15 @@
   25.47 +@@ -1071,17 +1164,15 @@
   25.48   	exit(1);
   25.49       }
   25.50   
   25.51 @@ -520,8 +529,8 @@ Index: ioemu/vnc.c
   25.52   }
   25.53  Index: ioemu/vl.h
   25.54  ===================================================================
   25.55 ---- ioemu.orig/vl.h	2006-09-21 19:00:48.000000000 +0100
   25.56 -+++ ioemu/vl.h	2006-09-21 19:26:24.000000000 +0100
   25.57 +--- ioemu.orig/vl.h	2006-10-24 13:47:23.000000000 +0100
   25.58 ++++ ioemu/vl.h	2006-10-24 14:19:36.000000000 +0100
   25.59  @@ -319,6 +319,7 @@
   25.60   int is_graphic_console(void);
   25.61   CharDriverState *text_console_init(DisplayState *ds);
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/tools/ioemu/patches/vnc-listen-specific-interface	Tue Oct 24 11:21:48 2006 -0600
    26.3 @@ -0,0 +1,177 @@
    26.4 +# HG changeset patch
    26.5 +# User Christian Limpach <Christian.Limpach@xensource.com>
    26.6 +# Node ID a95dfbc8dca8ecddcb9be51d78f446b0fa461892
    26.7 +# Parent  8959876abbe319963974fab21dda7185e0ad84e6
    26.8 +[HVM/vncserver] Implement a 'vnclisten' option to limit the interface
    26.9 +that the VNC server from qemu listens on. 
   26.10 +
   26.11 +Defaults to only listen on 127.0.0.1
   26.12 +
   26.13 +The old behaviour (listen on all interfaces) can be restored, by
   26.14 +- changing the system-wide default in /etc/xen/xend-config.sxp by adding:
   26.15 +(vnc-listen '0.0.0.0')
   26.16 +- changing individual domain config files by adding:
   26.17 +vnclisten="0.0.0.0"
   26.18 +
   26.19 +Also allows specifying the hostname associated with an interface to limit
   26.20 +to that interface.
   26.21 +
   26.22 +Signed-off-by:  Daniel P. Berrange <berrange@redhat.com>
   26.23 +
   26.24 +Index: ioemu/vl.c
   26.25 +===================================================================
   26.26 +--- ioemu.orig/vl.c	2006-10-24 14:33:46.000000000 +0100
   26.27 ++++ ioemu/vl.c	2006-10-24 14:34:28.000000000 +0100
   26.28 +@@ -122,6 +122,7 @@
   26.29 + int nographic;
   26.30 + int vncviewer;
   26.31 + int vncunused;
   26.32 ++struct sockaddr_in vnclisten_addr;
   26.33 + const char* keyboard_layout = NULL;
   26.34 + int64_t ticks_per_sec;
   26.35 + int boot_device = 'c';
   26.36 +@@ -2777,10 +2778,22 @@
   26.37 +     return -1;
   26.38 + }
   26.39 + 
   26.40 ++int parse_host(struct sockaddr_in *saddr, const char *buf)
   26.41 ++{
   26.42 ++    struct hostent *he;
   26.43 ++
   26.44 ++    if ((he = gethostbyname(buf)) != NULL) {
   26.45 ++        saddr->sin_addr = *(struct in_addr *)he->h_addr;
   26.46 ++    } else {
   26.47 ++        if (!inet_aton(buf, &saddr->sin_addr))
   26.48 ++            return -1;
   26.49 ++    }
   26.50 ++    return 0;
   26.51 ++}
   26.52 ++
   26.53 + int parse_host_port(struct sockaddr_in *saddr, const char *str)
   26.54 + {
   26.55 +     char buf[512];
   26.56 +-    struct hostent *he;
   26.57 +     const char *p, *r;
   26.58 +     int port;
   26.59 + 
   26.60 +@@ -2791,14 +2804,8 @@
   26.61 +     if (buf[0] == '\0') {
   26.62 +         saddr->sin_addr.s_addr = 0;
   26.63 +     } else {
   26.64 +-        if (isdigit(buf[0])) {
   26.65 +-            if (!inet_aton(buf, &saddr->sin_addr))
   26.66 +-                return -1;
   26.67 +-        } else {
   26.68 +-            if ((he = gethostbyname(buf)) == NULL)
   26.69 +-                return - 1;
   26.70 +-            saddr->sin_addr = *(struct in_addr *)he->h_addr;
   26.71 +-        }
   26.72 ++        if (parse_host(saddr, buf) == -1)
   26.73 ++            return -1;
   26.74 +     }
   26.75 +     port = strtol(p, (char **)&r, 0);
   26.76 +     if (r == p)
   26.77 +@@ -5344,6 +5351,7 @@
   26.78 + 	   "-vnc display    start a VNC server on display\n"
   26.79 +            "-vncviewer      start a vncviewer process for this domain\n"
   26.80 +            "-vncunused      bind the VNC server to an unused port\n"
   26.81 ++           "-vnclisten      bind the VNC server to this address\n"
   26.82 +            "-timeoffset     time offset (in seconds) from local time\n"
   26.83 +            "-acpi           disable or enable ACPI of HVM domain \n"
   26.84 +            "\n"
   26.85 +@@ -5434,6 +5442,7 @@
   26.86 +     QEMU_OPTION_acpi,
   26.87 +     QEMU_OPTION_vncviewer,
   26.88 +     QEMU_OPTION_vncunused,
   26.89 ++    QEMU_OPTION_vnclisten,
   26.90 + };
   26.91 + 
   26.92 + typedef struct QEMUOption {
   26.93 +@@ -5510,6 +5519,7 @@
   26.94 +     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
   26.95 +     { "vncviewer", 0, QEMU_OPTION_vncviewer },
   26.96 +     { "vncunused", 0, QEMU_OPTION_vncunused },
   26.97 ++    { "vnclisten", HAS_ARG, QEMU_OPTION_vnclisten },
   26.98 +     
   26.99 +     /* temporary options */
  26.100 +     { "usb", 0, QEMU_OPTION_usb },
  26.101 +@@ -5905,6 +5915,8 @@
  26.102 + 
  26.103 +     nb_nics = 0;
  26.104 +     /* default mac address of the first network interface */
  26.105 ++
  26.106 ++    memset(&vnclisten_addr.sin_addr, 0, sizeof(vnclisten_addr.sin_addr));
  26.107 +     
  26.108 +     /* init debug */
  26.109 +     sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%d.log", getpid());
  26.110 +@@ -6280,6 +6292,9 @@
  26.111 +                 if (vnc_display == -1)
  26.112 +                     vnc_display = 0;
  26.113 +                 break;
  26.114 ++            case QEMU_OPTION_vnclisten:
  26.115 ++                parse_host(&vnclisten_addr, optarg);
  26.116 ++                break;
  26.117 +             }
  26.118 +         }
  26.119 +     }
  26.120 +@@ -6493,7 +6508,7 @@
  26.121 +     if (nographic) {
  26.122 +         dumb_display_init(ds);
  26.123 +     } else if (vnc_display != -1) {
  26.124 +-	vnc_display = vnc_display_init(ds, vnc_display, vncunused);
  26.125 ++	vnc_display = vnc_display_init(ds, vnc_display, vncunused, &vnclisten_addr);
  26.126 + 	if (vncviewer)
  26.127 + 	    vnc_start_viewer(vnc_display);
  26.128 +     } else {
  26.129 +Index: ioemu/vl.h
  26.130 +===================================================================
  26.131 +--- ioemu.orig/vl.h	2006-10-24 14:33:46.000000000 +0100
  26.132 ++++ ioemu/vl.h	2006-10-24 14:34:22.000000000 +0100
  26.133 +@@ -37,6 +37,8 @@
  26.134 + #include <unistd.h>
  26.135 + #include <fcntl.h>
  26.136 + #include <sys/stat.h>
  26.137 ++#include <sys/socket.h>
  26.138 ++#include <sys/types.h>
  26.139 + #include "xenctrl.h"
  26.140 + #include "xs.h"
  26.141 + #include <xen/hvm/e820.h>
  26.142 +@@ -785,7 +787,7 @@
  26.143 + void cocoa_display_init(DisplayState *ds, int full_screen);
  26.144 + 
  26.145 + /* vnc.c */
  26.146 +-int vnc_display_init(DisplayState *ds, int display, int find_unused);
  26.147 ++int vnc_display_init(DisplayState *ds, int display, int find_unused, struct sockaddr_in *addr);
  26.148 + int vnc_start_viewer(int port);
  26.149 + 
  26.150 + /* ide.c */
  26.151 +Index: ioemu/vnc.c
  26.152 +===================================================================
  26.153 +--- ioemu.orig/vnc.c	2006-10-24 14:33:46.000000000 +0100
  26.154 ++++ ioemu/vnc.c	2006-10-24 14:34:22.000000000 +0100
  26.155 +@@ -1195,9 +1195,8 @@
  26.156 +     }
  26.157 + }
  26.158 + 
  26.159 +-int vnc_display_init(DisplayState *ds, int display, int find_unused)
  26.160 ++int vnc_display_init(DisplayState *ds, int display, int find_unused, struct sockaddr_in *addr)
  26.161 + {
  26.162 +-    struct sockaddr_in addr;
  26.163 +     int reuse_addr, ret;
  26.164 +     VncState *vs;
  26.165 + 
  26.166 +@@ -1235,11 +1234,10 @@
  26.167 +     }
  26.168 + 
  26.169 +  retry:
  26.170 +-    addr.sin_family = AF_INET;
  26.171 +-    addr.sin_port = htons(5900 + display);
  26.172 +-    memset(&addr.sin_addr, 0, sizeof(addr.sin_addr));
  26.173 ++    addr->sin_family = AF_INET;
  26.174 ++    addr->sin_port = htons(5900 + display);
  26.175 + 
  26.176 +-    if (bind(vs->lsock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
  26.177 ++    if (bind(vs->lsock, (struct sockaddr *)addr, sizeof(struct sockaddr_in)) == -1) {
  26.178 + 	if (find_unused && errno == EADDRINUSE) {
  26.179 + 	    display++;
  26.180 + 	    goto retry;
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/tools/ioemu/patches/vnc-password	Tue Oct 24 11:21:48 2006 -0600
    27.3 @@ -0,0 +1,785 @@
    27.4 +# HG changeset patch
    27.5 +# User kfraser@localhost.localdomain
    27.6 +# Node ID 02506a7443155611d6bbf03e49fbf193e96d24db
    27.7 +# Parent  328606e0705f0341bebda14cdd17962e463868e8
    27.8 +[HVM] Implement password authentication of VNC connections.
    27.9 +
   27.10 +The specification is as mentioned at
   27.11 +http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00666.html
   27.12 +(However, password came to describe plain text)
   27.13 +
   27.14 +The difference is follows.
   27.15 +- protocol_authtype() without the necessity was deleted.
   27.16 +- The check on the protocol version was added.
   27.17 +- And, some small modification.
   27.18 +
   27.19 +Signed-off-by: Masami Watanabe <masami.watanabe@jp.fujitsu.com>
   27.20 +
   27.21 +--- ioemu/Makefile.target	Fri Oct 20 09:32:16 2006 +0100
   27.22 ++++ ioemu/Makefile.target	Fri Oct 20 09:50:09 2006 +0100
   27.23 +@@ -406,6 +406,7 @@ VL_OBJS+=sdl.o
   27.24 + VL_OBJS+=sdl.o
   27.25 + endif
   27.26 + VL_OBJS+=vnc.o
   27.27 ++VL_OBJS+=d3des.o
   27.28 + ifdef CONFIG_COCOA
   27.29 + VL_OBJS+=cocoa.o
   27.30 + COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
   27.31 +@@ -464,6 +465,9 @@ sdl.o: sdl.c keymaps.c sdl_keysym.h
   27.32 + 	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
   27.33 + 
   27.34 + vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
   27.35 ++	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
   27.36 ++
   27.37 ++d3des.o: d3des.c d3des.h
   27.38 + 	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
   27.39 + 
   27.40 + sdlaudio.o: sdlaudio.c
   27.41 +--- ioemu/vl.c	Fri Oct 20 09:32:16 2006 +0100
   27.42 ++++ ioemu/vl.c	Fri Oct 20 09:50:09 2006 +0100
   27.43 +@@ -170,6 +170,9 @@ time_t timeoffset = 0;
   27.44 + 
   27.45 + char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
   27.46 + extern int domid;
   27.47 ++
   27.48 ++char vncpasswd[64];
   27.49 ++unsigned char challenge[AUTHCHALLENGESIZE];
   27.50 + 
   27.51 + /***********************************************************/
   27.52 + /* x86 ISA bus support */
   27.53 +@@ -5911,6 +5914,7 @@ int main(int argc, char **argv)
   27.54 +     vncunused = 0;
   27.55 +     kernel_filename = NULL;
   27.56 +     kernel_cmdline = "";
   27.57 ++    *vncpasswd = '\0';
   27.58 + #ifndef CONFIG_DM
   27.59 + #ifdef TARGET_PPC
   27.60 +     cdrom_index = 1;
   27.61 +@@ -6559,6 +6563,10 @@ int main(int argc, char **argv)
   27.62 + 
   27.63 +     init_ioports();
   27.64 + 
   27.65 ++    /* read vncpasswd from xenstore */
   27.66 ++    if (0 > xenstore_read_vncpasswd(domid))
   27.67 ++        exit(1);
   27.68 ++
   27.69 +     /* terminal init */
   27.70 +     if (nographic) {
   27.71 +         dumb_display_init(ds);
   27.72 +--- ioemu/vl.h	Fri Oct 20 09:32:16 2006 +0100
   27.73 ++++ ioemu/vl.h	Fri Oct 20 09:50:09 2006 +0100
   27.74 +@@ -1211,6 +1211,7 @@ void xenstore_process_event(void *opaque
   27.75 + void xenstore_process_event(void *opaque);
   27.76 + void xenstore_check_new_media_present(int timeout);
   27.77 + void xenstore_write_vncport(int vnc_display);
   27.78 ++int xenstore_read_vncpasswd(int domid);
   27.79 + 
   27.80 + /* xen_platform.c */
   27.81 + void pci_xen_platform_init(PCIBus *bus);
   27.82 +@@ -1222,4 +1223,7 @@ extern char domain_name[];
   27.83 + 
   27.84 + void destroy_hvm_domain(void);
   27.85 + 
   27.86 ++/* VNC Authentication */
   27.87 ++#define AUTHCHALLENGESIZE 16
   27.88 ++
   27.89 + #endif /* VL_H */
   27.90 +--- ioemu/vnc.c	Fri Oct 20 09:32:16 2006 +0100
   27.91 ++++ ioemu/vnc.c	Fri Oct 20 09:50:09 2006 +0100
   27.92 +@@ -44,6 +44,7 @@
   27.93 + 
   27.94 + #include "vnc_keysym.h"
   27.95 + #include "keymaps.c"
   27.96 ++#include "d3des.h"
   27.97 + 
   27.98 + #define XK_MISCELLANY
   27.99 + #define XK_LATIN1
  27.100 +@@ -137,6 +138,9 @@ static void vnc_update_client(void *opaq
  27.101 + static void vnc_update_client(void *opaque);
  27.102 + static void vnc_client_read(void *opaque);
  27.103 + static void framebuffer_set_updated(VncState *vs, int x, int y, int w, int h);
  27.104 ++static int make_challenge(char *random, int size);
  27.105 ++static void set_seed(unsigned int *seedp);
  27.106 ++static void get_random(int len, unsigned char *buf);
  27.107 + 
  27.108 + #if 0
  27.109 + static inline void vnc_set_bit(uint32_t *d, int k)
  27.110 +@@ -1208,23 +1212,92 @@ static int protocol_client_init(VncState
  27.111 +     return 0;
  27.112 + }
  27.113 + 
  27.114 ++static int protocol_response(VncState *vs, char *client_response, size_t len)
  27.115 ++{
  27.116 ++    extern char vncpasswd[64];
  27.117 ++    extern unsigned char challenge[AUTHCHALLENGESIZE];
  27.118 ++    unsigned char cryptchallenge[AUTHCHALLENGESIZE];
  27.119 ++    unsigned char key[8];
  27.120 ++    int passwdlen, i, j;
  27.121 ++
  27.122 ++    memcpy(cryptchallenge, challenge, AUTHCHALLENGESIZE);
  27.123 ++
  27.124 ++    /* Calculate the sent challenge */
  27.125 ++    passwdlen = strlen(vncpasswd);
  27.126 ++    for (i=0; i<8; i++)
  27.127 ++	key[i] = i<passwdlen ? vncpasswd[i] : 0;
  27.128 ++    deskey(key, EN0);
  27.129 ++    for (j = 0; j < AUTHCHALLENGESIZE; j += 8)
  27.130 ++	des(cryptchallenge+j, cryptchallenge+j);
  27.131 ++
  27.132 ++    /* Check the actual response */
  27.133 ++    if (memcmp(cryptchallenge, client_response, AUTHCHALLENGESIZE) != 0) {
  27.134 ++	/* password error */
  27.135 ++	vnc_write_u32(vs, 1);
  27.136 ++	vnc_write_u32(vs, 22);
  27.137 ++	vnc_write(vs, "Authentication failure", 22);
  27.138 ++	vnc_flush(vs);
  27.139 ++	fprintf(stderr, "VNC Password error.\n");
  27.140 ++	vnc_client_error(vs);
  27.141 ++	return 0;
  27.142 ++    }
  27.143 ++
  27.144 ++    vnc_write_u32(vs, 0);
  27.145 ++    vnc_flush(vs);
  27.146 ++
  27.147 ++    vnc_read_when(vs, protocol_client_init, 1);
  27.148 ++
  27.149 ++    return 0;
  27.150 ++}
  27.151 ++
  27.152 + static int protocol_version(VncState *vs, char *version, size_t len)
  27.153 + {
  27.154 ++    extern char vncpasswd[64];
  27.155 ++    extern unsigned char challenge[AUTHCHALLENGESIZE];
  27.156 +     char local[13];
  27.157 +-    int maj, min;
  27.158 ++    int  support, maj, min;
  27.159 + 
  27.160 +     memcpy(local, version, 12);
  27.161 +     local[12] = 0;
  27.162 + 
  27.163 ++    /* protocol version check */
  27.164 +     if (sscanf(local, "RFB %03d.%03d\n", &maj, &min) != 2) {
  27.165 ++	fprintf(stderr, "Protocol version error.\n");
  27.166 + 	vnc_client_error(vs);
  27.167 + 	return 0;
  27.168 +     }
  27.169 + 
  27.170 +-    vnc_write_u32(vs, 1); /* None */
  27.171 +-    vnc_flush(vs);
  27.172 +-
  27.173 +-    vnc_read_when(vs, protocol_client_init, 1);
  27.174 ++
  27.175 ++    support = 0;
  27.176 ++    if (maj = 3) {
  27.177 ++	if (min == 3 || min ==4) {
  27.178 ++	    support = 1;
  27.179 ++	}
  27.180 ++    }
  27.181 ++
  27.182 ++    if (! support) {
  27.183 ++	fprintf(stderr, "Client uses unsupported protocol version %d.%d.\n",
  27.184 ++		maj, min);
  27.185 ++	vnc_client_error(vs);
  27.186 ++	return 0;
  27.187 ++    }
  27.188 ++
  27.189 ++    if (*vncpasswd == '\0') {
  27.190 ++	/* AuthType is None */
  27.191 ++	vnc_write_u32(vs, 1);
  27.192 ++	vnc_flush(vs);
  27.193 ++	vnc_read_when(vs, protocol_client_init, 1);
  27.194 ++    } else {
  27.195 ++	/* AuthType is VncAuth */
  27.196 ++	vnc_write_u32(vs, 2);
  27.197 ++
  27.198 ++	/* Challenge-Responce authentication */
  27.199 ++	/* Send Challenge */
  27.200 ++	make_challenge(challenge, AUTHCHALLENGESIZE);
  27.201 ++	vnc_write(vs, challenge, AUTHCHALLENGESIZE);
  27.202 ++	vnc_flush(vs);
  27.203 ++	vnc_read_when(vs, protocol_response, AUTHCHALLENGESIZE);
  27.204 ++    }
  27.205 + 
  27.206 +     return 0;
  27.207 + }
  27.208 +@@ -1342,3 +1415,32 @@ int vnc_start_viewer(int port)
  27.209 + 	return pid;
  27.210 +     }
  27.211 + }
  27.212 ++
  27.213 ++unsigned int seed;
  27.214 ++
  27.215 ++static int make_challenge(char *random, int size)
  27.216 ++{
  27.217 ++ 
  27.218 ++    set_seed(&seed);
  27.219 ++    get_random(size, random);
  27.220 ++
  27.221 ++    return 0;
  27.222 ++}
  27.223 ++
  27.224 ++static void set_seed(unsigned int *seedp)
  27.225 ++{
  27.226 ++    *seedp += (unsigned int)(time(NULL)+getpid()+getpid()*987654+rand());
  27.227 ++    srand(*seedp);
  27.228 ++
  27.229 ++    return;
  27.230 ++}
  27.231 ++
  27.232 ++static void get_random(int len, unsigned char *buf)
  27.233 ++{
  27.234 ++    int i;
  27.235 ++
  27.236 ++    for (i=0; i<len; i++)
  27.237 ++	buf[i] = (int) (256.0*rand()/(RAND_MAX+1.0));
  27.238 ++
  27.239 ++    return;
  27.240 ++}
  27.241 +--- ioemu/xenstore.c	Fri Oct 20 09:32:16 2006 +0100
  27.242 ++++ ioemu/xenstore.c	Fri Oct 20 09:50:09 2006 +0100
  27.243 +@@ -213,3 +213,54 @@ void xenstore_write_vncport(int display)
  27.244 +     free(portstr);
  27.245 +     free(buf);
  27.246 + }
  27.247 ++
  27.248 ++int xenstore_read_vncpasswd(int domid)
  27.249 ++{
  27.250 ++    extern char vncpasswd[64];
  27.251 ++    char *buf = NULL, *path, *uuid = NULL, *passwd = NULL;
  27.252 ++    unsigned int i, len, rc = 0;
  27.253 ++
  27.254 ++    if (xsh == NULL) {
  27.255 ++	return -1;
  27.256 ++    }
  27.257 ++
  27.258 ++    path = xs_get_domain_path(xsh, domid);
  27.259 ++    if (path == NULL) {
  27.260 ++	fprintf(logfile, "xs_get_domain_path() error. domid %d.\n", domid);
  27.261 ++	return -1;
  27.262 ++    }
  27.263 ++
  27.264 ++    pasprintf(&buf, "%s/vm", path);
  27.265 ++    uuid = xs_read(xsh, XBT_NULL, buf, &len);
  27.266 ++    if (uuid == NULL) {
  27.267 ++	fprintf(logfile, "xs_read(): uuid get error. %s.\n", buf);
  27.268 ++	free(path);
  27.269 ++	return -1;
  27.270 ++    }
  27.271 ++
  27.272 ++    pasprintf(&buf, "%s/vncpasswd", uuid);
  27.273 ++    passwd = xs_read(xsh, XBT_NULL, buf, &len);
  27.274 ++    if (passwd == NULL) {
  27.275 ++	fprintf(logfile, "xs_read(): vncpasswd get error. %s.\n", buf);
  27.276 ++	free(uuid);
  27.277 ++	free(path);
  27.278 ++	return rc;
  27.279 ++    }
  27.280 ++
  27.281 ++    for (i=0; i<len && i<63; i++) {
  27.282 ++	vncpasswd[i] = passwd[i];
  27.283 ++	passwd[i] = '\0';
  27.284 ++    }
  27.285 ++    vncpasswd[len] = '\0';
  27.286 ++    pasprintf(&buf, "%s/vncpasswd", uuid);
  27.287 ++    if (xs_write(xsh, XBT_NULL, buf, passwd, len) == 0) {
  27.288 ++	fprintf(logfile, "xs_write() vncpasswd failed.\n");
  27.289 ++	rc = -1;
  27.290 ++    }
  27.291 ++
  27.292 ++    free(passwd);
  27.293 ++    free(uuid);
  27.294 ++    free(path);
  27.295 ++
  27.296 ++    return rc;
  27.297 ++}
  27.298 +--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  27.299 ++++ ioemu/d3des.c	Fri Oct 20 09:50:09 2006 +0100
  27.300 +@@ -0,0 +1,434 @@
  27.301 ++/*
  27.302 ++ * This is D3DES (V5.09) by Richard Outerbridge with the double and
  27.303 ++ * triple-length support removed for use in VNC.  Also the bytebit[] array
  27.304 ++ * has been reversed so that the most significant bit in each byte of the
  27.305 ++ * key is ignored, not the least significant.
  27.306 ++ *
  27.307 ++ * These changes are:
  27.308 ++ *  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
  27.309 ++ *
  27.310 ++ * This software is distributed in the hope that it will be useful,
  27.311 ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  27.312 ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  27.313 ++ */
  27.314 ++
  27.315 ++/* D3DES (V5.09) -
  27.316 ++ *
  27.317 ++ * A portable, public domain, version of the Data Encryption Standard.
  27.318 ++ *
  27.319 ++ * Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
  27.320 ++ * Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
  27.321 ++ * code;  Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
  27.322 ++ * Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
  27.323 ++ * for humouring me on.
  27.324 ++ *
  27.325 ++ * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
  27.326 ++ * (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
  27.327 ++ */
  27.328 ++
  27.329 ++#include "d3des.h"
  27.330 ++
  27.331 ++static void scrunch(unsigned char *, unsigned long *);
  27.332 ++static void unscrun(unsigned long *, unsigned char *);
  27.333 ++static void desfunc(unsigned long *, unsigned long *);
  27.334 ++static void cookey(unsigned long *);
  27.335 ++
  27.336 ++static unsigned long KnL[32] = { 0L };
  27.337 ++
  27.338 ++static unsigned short bytebit[8]	= {
  27.339 ++	01, 02, 04, 010, 020, 040, 0100, 0200 };
  27.340 ++
  27.341 ++static unsigned long bigbyte[24] = {
  27.342 ++	0x800000L,	0x400000L,	0x200000L,	0x100000L,
  27.343 ++	0x80000L,	0x40000L,	0x20000L,	0x10000L,
  27.344 ++	0x8000L,	0x4000L,	0x2000L,	0x1000L,
  27.345 ++	0x800L, 	0x400L, 	0x200L, 	0x100L,
  27.346 ++	0x80L,		0x40L,		0x20L,		0x10L,
  27.347 ++	0x8L,		0x4L,		0x2L,		0x1L	};
  27.348 ++
  27.349 ++/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
  27.350 ++
  27.351 ++static unsigned char pc1[56] = {
  27.352 ++	56, 48, 40, 32, 24, 16,  8,	 0, 57, 49, 41, 33, 25, 17,
  27.353 ++	 9,  1, 58, 50, 42, 34, 26,	18, 10,  2, 59, 51, 43, 35,
  27.354 ++	62, 54, 46, 38, 30, 22, 14,	 6, 61, 53, 45, 37, 29, 21,
  27.355 ++	13,  5, 60, 52, 44, 36, 28,	20, 12,  4, 27, 19, 11,  3 };
  27.356 ++
  27.357 ++static unsigned char totrot[16] = {
  27.358 ++	1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
  27.359 ++
  27.360 ++static unsigned char pc2[48] = {
  27.361 ++	13, 16, 10, 23,  0,  4,  2, 27, 14,  5, 20,  9,
  27.362 ++	22, 18, 11,  3, 25,  7, 15,  6, 26, 19, 12,  1,
  27.363 ++	40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
  27.364 ++	43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
  27.365 ++
  27.366 ++void deskey(key, edf)	/* Thanks to James Gillogly & Phil Karn! */
  27.367 ++unsigned char *key;
  27.368 ++int edf;
  27.369 ++{
  27.370 ++	register int i, j, l, m, n;
  27.371 ++	unsigned char pc1m[56], pcr[56];
  27.372 ++	unsigned long kn[32];
  27.373 ++
  27.374 ++	for ( j = 0; j < 56; j++ ) {
  27.375 ++		l = pc1[j];
  27.376 ++		m = l & 07;
  27.377 ++		pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
  27.378 ++		}
  27.379 ++	for( i = 0; i < 16; i++ ) {
  27.380 ++		if( edf == DE1 ) m = (15 - i) << 1;
  27.381 ++		else m = i << 1;
  27.382 ++		n = m + 1;
  27.383 ++		kn[m] = kn[n] = 0L;
  27.384 ++		for( j = 0; j < 28; j++ ) {
  27.385 ++			l = j + totrot[i];
  27.386 ++			if( l < 28 ) pcr[j] = pc1m[l];
  27.387 ++			else pcr[j] = pc1m[l - 28];
  27.388 ++			}
  27.389 ++		for( j = 28; j < 56; j++ ) {
  27.390 ++		    l = j + totrot[i];
  27.391 ++		    if( l < 56 ) pcr[j] = pc1m[l];
  27.392 ++		    else pcr[j] = pc1m[l - 28];
  27.393 ++		    }
  27.394 ++		for( j = 0; j < 24; j++ ) {
  27.395 ++			if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
  27.396 ++			if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
  27.397 ++			}
  27.398 ++		}
  27.399 ++	cookey(kn);
  27.400 ++	return;
  27.401 ++	}
  27.402 ++
  27.403 ++static void cookey(raw1)
  27.404 ++register unsigned long *raw1;
  27.405 ++{
  27.406 ++	register unsigned long *cook, *raw0;
  27.407 ++	unsigned long dough[32];
  27.408 ++	register int i;
  27.409 ++
  27.410 ++	cook = dough;
  27.411 ++	for( i = 0; i < 16; i++, raw1++ ) {
  27.412 ++		raw0 = raw1++;
  27.413 ++		*cook	 = (*raw0 & 0x00fc0000L) << 6;
  27.414 ++		*cook	|= (*raw0 & 0x00000fc0L) << 10;
  27.415 ++		*cook	|= (*raw1 & 0x00fc0000L) >> 10;
  27.416 ++		*cook++ |= (*raw1 & 0x00000fc0L) >> 6;
  27.417 ++		*cook	 = (*raw0 & 0x0003f000L) << 12;
  27.418 ++		*cook	|= (*raw0 & 0x0000003fL) << 16;
  27.419 ++		*cook	|= (*raw1 & 0x0003f000L) >> 4;
  27.420 ++		*cook++ |= (*raw1 & 0x0000003fL);
  27.421 ++		}
  27.422 ++	usekey(dough);
  27.423 ++	return;
  27.424 ++	}
  27.425 ++
  27.426 ++void cpkey(into)
  27.427 ++register unsigned long *into;
  27.428 ++{
  27.429 ++	register unsigned long *from, *endp;
  27.430 ++
  27.431 ++	from = KnL, endp = &KnL[32];
  27.432 ++	while( from < endp ) *into++ = *from++;
  27.433 ++	return;
  27.434 ++	}
  27.435 ++
  27.436 ++void usekey(from)
  27.437 ++register unsigned long *from;
  27.438 ++{
  27.439 ++	register unsigned long *to, *endp;
  27.440 ++
  27.441 ++	to = KnL, endp = &KnL[32];
  27.442 ++	while( to < endp ) *to++ = *from++;
  27.443 ++	return;
  27.444 ++	}
  27.445 ++
  27.446 ++void des(inblock, outblock)
  27.447 ++unsigned char *inblock, *outblock;
  27.448 ++{
  27.449 ++	unsigned long work[2];
  27.450 ++
  27.451 ++	scrunch(inblock, work);
  27.452 ++	desfunc(work, KnL);
  27.453 ++	unscrun(work, outblock);
  27.454 ++	return;
  27.455 ++	}
  27.456 ++
  27.457 ++static void scrunch(outof, into)
  27.458 ++register unsigned char *outof;
  27.459 ++register unsigned long *into;
  27.460 ++{
  27.461 ++	*into	 = (*outof++ & 0xffL) << 24;
  27.462 ++	*into	|= (*outof++ & 0xffL) << 16;
  27.463 ++	*into	|= (*outof++ & 0xffL) << 8;
  27.464 ++	*into++ |= (*outof++ & 0xffL);
  27.465 ++	*into	 = (*outof++ & 0xffL) << 24;
  27.466 ++	*into	|= (*outof++ & 0xffL) << 16;
  27.467 ++	*into	|= (*outof++ & 0xffL) << 8;
  27.468 ++	*into	|= (*outof   & 0xffL);
  27.469 ++	return;
  27.470 ++	}
  27.471 ++
  27.472 ++static void unscrun(outof, into)
  27.473 ++register unsigned long *outof;
  27.474 ++register unsigned char *into;
  27.475 ++{
  27.476 ++	*into++ = (unsigned char)((*outof >> 24) & 0xffL);
  27.477 ++	*into++ = (unsigned char)((*outof >> 16) & 0xffL);
  27.478 ++	*into++ = (unsigned char)((*outof >>  8) & 0xffL);
  27.479 ++	*into++ = (unsigned char)(*outof++	 & 0xffL);
  27.480 ++	*into++ = (unsigned char)((*outof >> 24) & 0xffL);
  27.481 ++	*into++ = (unsigned char)((*outof >> 16) & 0xffL);
  27.482 ++	*into++ = (unsigned char)((*outof >>  8) & 0xffL);
  27.483 ++	*into	=  (unsigned char)(*outof	 & 0xffL);
  27.484 ++	return;
  27.485 ++	}
  27.486 ++
  27.487 ++static unsigned long SP1[64] = {
  27.488 ++	0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
  27.489 ++	0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
  27.490 ++	0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
  27.491 ++	0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
  27.492 ++	0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
  27.493 ++	0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
  27.494 ++	0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
  27.495 ++	0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
  27.496 ++	0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
  27.497 ++	0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
  27.498 ++	0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
  27.499 ++	0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
  27.500 ++	0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
  27.501 ++	0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
  27.502 ++	0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
  27.503 ++	0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
  27.504 ++
  27.505 ++static unsigned long SP2[64] = {
  27.506 ++	0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
  27.507 ++	0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
  27.508 ++	0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
  27.509 ++	0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
  27.510 ++	0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
  27.511 ++	0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
  27.512 ++	0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
  27.513 ++	0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
  27.514 ++	0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
  27.515 ++	0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
  27.516 ++	0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
  27.517 ++	0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
  27.518 ++	0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
  27.519 ++	0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
  27.520 ++	0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
  27.521 ++	0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
  27.522 ++
  27.523 ++static unsigned long SP3[64] = {
  27.524 ++	0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
  27.525 ++	0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
  27.526 ++	0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
  27.527 ++	0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
  27.528 ++	0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
  27.529 ++	0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
  27.530 ++	0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
  27.531 ++	0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
  27.532 ++	0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
  27.533 ++	0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
  27.534 ++	0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
  27.535 ++	0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
  27.536 ++	0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
  27.537 ++	0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
  27.538 ++	0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
  27.539 ++	0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
  27.540 ++
  27.541 ++static unsigned long SP4[64] = {
  27.542 ++	0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
  27.543 ++	0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
  27.544 ++	0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
  27.545 ++	0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
  27.546 ++	0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
  27.547 ++	0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
  27.548 ++	0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
  27.549 ++	0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
  27.550 ++	0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
  27.551 ++	0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
  27.552 ++	0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
  27.553 ++	0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
  27.554 ++	0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
  27.555 ++	0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
  27.556 ++	0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
  27.557 ++	0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
  27.558 ++
  27.559 ++static unsigned long SP5[64] = {
  27.560 ++	0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
  27.561 ++	0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
  27.562 ++	0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
  27.563 ++	0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
  27.564 ++	0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
  27.565 ++	0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
  27.566 ++	0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
  27.567 ++	0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
  27.568 ++	0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
  27.569 ++	0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
  27.570 ++	0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
  27.571 ++	0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
  27.572 ++	0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
  27.573 ++	0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
  27.574 ++	0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
  27.575 ++	0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
  27.576 ++
  27.577 ++static unsigned long SP6[64] = {
  27.578 ++	0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
  27.579 ++	0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
  27.580 ++	0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
  27.581 ++	0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
  27.582 ++	0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
  27.583 ++	0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
  27.584 ++	0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
  27.585 ++	0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
  27.586 ++	0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
  27.587 ++	0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
  27.588 ++	0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
  27.589 ++	0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
  27.590 ++	0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
  27.591 ++	0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
  27.592 ++	0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
  27.593 ++	0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
  27.594 ++
  27.595 ++static unsigned long SP7[64] = {
  27.596 ++	0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
  27.597 ++	0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
  27.598 ++	0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
  27.599 ++	0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
  27.600 ++	0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
  27.601 ++	0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
  27.602 ++	0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
  27.603 ++	0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
  27.604 ++	0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
  27.605 ++	0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
  27.606 ++	0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
  27.607 ++	0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
  27.608 ++	0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
  27.609 ++	0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
  27.610 ++	0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
  27.611 ++	0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
  27.612 ++
  27.613 ++static unsigned long SP8[64] = {
  27.614 ++	0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
  27.615 ++	0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
  27.616 ++	0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
  27.617 ++	0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
  27.618 ++	0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
  27.619 ++	0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
  27.620 ++	0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
  27.621 ++	0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
  27.622 ++	0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
  27.623 ++	0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
  27.624 ++	0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
  27.625 ++	0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
  27.626 ++	0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
  27.627 ++	0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
  27.628 ++	0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
  27.629 ++	0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
  27.630 ++
  27.631 ++static void desfunc(block, keys)
  27.632 ++register unsigned long *block, *keys;
  27.633 ++{
  27.634 ++	register unsigned long fval, work, right, leftt;
  27.635 ++	register int round;
  27.636 ++
  27.637 ++	leftt = block[0];
  27.638 ++	right = block[1];
  27.639 ++	work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
  27.640 ++	right ^= work;
  27.641 ++	leftt ^= (work << 4);
  27.642 ++	work = ((leftt >> 16) ^ right) & 0x0000ffffL;
  27.643 ++	right ^= work;
  27.644 ++	leftt ^= (work << 16);
  27.645 ++	work = ((right >> 2) ^ leftt) & 0x33333333L;
  27.646 ++	leftt ^= work;
  27.647 ++	right ^= (work << 2);
  27.648 ++	work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
  27.649 ++	leftt ^= work;
  27.650 ++	right ^= (work << 8);
  27.651 ++	right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
  27.652 ++	work = (leftt ^ right) & 0xaaaaaaaaL;
  27.653 ++	leftt ^= work;
  27.654 ++	right ^= work;
  27.655 ++	leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
  27.656 ++
  27.657 ++	for( round = 0; round < 8; round++ ) {
  27.658 ++		work  = (right << 28) | (right >> 4);
  27.659 ++		work ^= *keys++;
  27.660 ++		fval  = SP7[ work		 & 0x3fL];
  27.661 ++		fval |= SP5[(work >>  8) & 0x3fL];
  27.662 ++		fval |= SP3[(work >> 16) & 0x3fL];
  27.663 ++		fval |= SP1[(work >> 24) & 0x3fL];
  27.664 ++		work  = right ^ *keys++;
  27.665 ++		fval |= SP8[ work		 & 0x3fL];
  27.666 ++		fval |= SP6[(work >>  8) & 0x3fL];
  27.667 ++		fval |= SP4[(work >> 16) & 0x3fL];
  27.668 ++		fval |= SP2[(work >> 24) & 0x3fL];
  27.669 ++		leftt ^= fval;
  27.670 ++		work  = (leftt << 28) | (leftt >> 4);
  27.671 ++		work ^= *keys++;
  27.672 ++		fval  = SP7[ work		 & 0x3fL];
  27.673 ++		fval |= SP5[(work >>  8) & 0x3fL];
  27.674 ++		fval |= SP3[(work >> 16) & 0x3fL];
  27.675 ++		fval |= SP1[(work >> 24) & 0x3fL];
  27.676 ++		work  = leftt ^ *keys++;
  27.677 ++		fval |= SP8[ work		 & 0x3fL];
  27.678 ++		fval |= SP6[(work >>  8) & 0x3fL];
  27.679 ++		fval |= SP4[(work >> 16) & 0x3fL];
  27.680 ++		fval |= SP2[(work >> 24) & 0x3fL];
  27.681 ++		right ^= fval;
  27.682 ++		}
  27.683 ++
  27.684 ++	right = (right << 31) | (right >> 1);
  27.685 ++	work = (leftt ^ right) & 0xaaaaaaaaL;
  27.686 ++	leftt ^= work;
  27.687 ++	right ^= work;
  27.688 ++	leftt = (leftt << 31) | (leftt >> 1);
  27.689 ++	work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
  27.690 ++	right ^= work;
  27.691 ++	leftt ^= (work << 8);
  27.692 ++	work = ((leftt >> 2) ^ right) & 0x33333333L;
  27.693 ++	right ^= work;
  27.694 ++	leftt ^= (work << 2);
  27.695 ++	work = ((right >> 16) ^ leftt) & 0x0000ffffL;
  27.696 ++	leftt ^= work;
  27.697 ++	right ^= (work << 16);
  27.698 ++	work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
  27.699 ++	leftt ^= work;
  27.700 ++	right ^= (work << 4);
  27.701 ++	*block++ = right;
  27.702 ++	*block = leftt;
  27.703 ++	return;
  27.704 ++	}
  27.705 ++
  27.706 ++/* Validation sets:
  27.707 ++ *
  27.708 ++ * Single-length key, single-length plaintext -
  27.709 ++ * Key	  : 0123 4567 89ab cdef
  27.710 ++ * Plain  : 0123 4567 89ab cde7
  27.711 ++ * Cipher : c957 4425 6a5e d31d
  27.712 ++ *
  27.713 ++ * Double-length key, single-length plaintext -
  27.714 ++ * Key	  : 0123 4567 89ab cdef fedc ba98 7654 3210
  27.715 ++ * Plain  : 0123 4567 89ab cde7
  27.716 ++ * Cipher : 7f1d 0a77 826b 8aff
  27.717 ++ *
  27.718 ++ * Double-length key, double-length plaintext -
  27.719 ++ * Key	  : 0123 4567 89ab cdef fedc ba98 7654 3210
  27.720 ++ * Plain  : 0123 4567 89ab cdef 0123 4567 89ab cdff
  27.721 ++ * Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
  27.722 ++ *
  27.723 ++ * Triple-length key, single-length plaintext -
  27.724 ++ * Key	  : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
  27.725 ++ * Plain  : 0123 4567 89ab cde7
  27.726 ++ * Cipher : de0b 7c06 ae5e 0ed5
  27.727 ++ *
  27.728 ++ * Triple-length key, double-length plaintext -
  27.729 ++ * Key	  : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
  27.730 ++ * Plain  : 0123 4567 89ab cdef 0123 4567 89ab cdff
  27.731 ++ * Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
  27.732 ++ *
  27.733 ++ * d3des V5.0a rwo 9208.07 18:44 Graven Imagery
  27.734 ++ **********************************************************************/
  27.735 +--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  27.736 ++++ ioemu/d3des.h	Fri Oct 20 09:50:09 2006 +0100
  27.737 +@@ -0,0 +1,51 @@
  27.738 ++/*
  27.739 ++ * This is D3DES (V5.09) by Richard Outerbridge with the double and
  27.740 ++ * triple-length support removed for use in VNC.
  27.741 ++ *
  27.742 ++ * These changes are:
  27.743 ++ *  Copyright (C) 1999 AT&T Laboratories Cambridge.  All Rights Reserved.
  27.744 ++ *
  27.745 ++ * This software is distributed in the hope that it will be useful,
  27.746 ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  27.747 ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  27.748 ++ */
  27.749 ++
  27.750 ++/* d3des.h -
  27.751 ++ *
  27.752 ++ *	Headers and defines for d3des.c
  27.753 ++ *	Graven Imagery, 1992.
  27.754 ++ *
  27.755 ++ * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
  27.756 ++ *	(GEnie : OUTER; CIS : [71755,204])
  27.757 ++ */
  27.758 ++
  27.759 ++#define EN0	0	/* MODE == encrypt */
  27.760 ++#define DE1	1	/* MODE == decrypt */
  27.761 ++
  27.762 ++extern void deskey(unsigned char *, int);
  27.763 ++/*		      hexkey[8]     MODE
  27.764 ++ * Sets the internal key register according to the hexadecimal
  27.765 ++ * key contained in the 8 bytes of hexkey, according to the DES,
  27.766 ++ * for encryption or decryption according to MODE.
  27.767 ++ */
  27.768 ++
  27.769 ++extern void usekey(unsigned long *);
  27.770 ++/*		    cookedkey[32]
  27.771 ++ * Loads the internal key register with the data in cookedkey.
  27.772 ++ */
  27.773 ++
  27.774 ++extern void cpkey(unsigned long *);
  27.775 ++/*		   cookedkey[32]
  27.776 ++ * Copies the contents of the internal key register into the storage
  27.777 ++ * located at &cookedkey[0].
  27.778 ++ */
  27.779 ++
  27.780 ++extern void des(unsigned char *, unsigned char *);
  27.781 ++/*		    from[8]	      to[8]
  27.782 ++ * Encrypts/Decrypts (according to the key currently loaded in the
  27.783 ++ * internal key register) one block of eight bytes at address 'from'
  27.784 ++ * into the block at address 'to'.  They can be the same.
  27.785 ++ */
  27.786 ++
  27.787 ++/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
  27.788 ++ ********************************************************************/
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/tools/ioemu/patches/vnc-protocol-fixes	Tue Oct 24 11:21:48 2006 -0600
    28.3 @@ -0,0 +1,63 @@
    28.4 +# HG changeset patch
    28.5 +# User Steven Smith <ssmith@xensource.com>
    28.6 +# Node ID ca3abb3804f4400b24037a4366cb2ca5e51ed742
    28.7 +# Parent  7fca81d456b2cb40d4effe2492f7ed1aafd32f52
    28.8 +[HVM][VNC] Make sure that qemu doesn't go into an infinite loop when
    28.9 +it receives certain invalid requests from the viewer.
   28.10 +
   28.11 +Signed-off-by: Steven Smith <sos22@cam.ac.uk>
   28.12 +
   28.13 +Index: ioemu/vnc.c
   28.14 +===================================================================
   28.15 +--- ioemu.orig/vnc.c	2006-10-24 14:28:05.000000000 +0100
   28.16 ++++ ioemu/vnc.c	2006-10-24 14:30:11.000000000 +0100
   28.17 +@@ -26,6 +26,7 @@
   28.18 + 
   28.19 + #include "vl.h"
   28.20 + #include "qemu_socket.h"
   28.21 ++#include <assert.h>
   28.22 + 
   28.23 + #define VNC_REFRESH_INTERVAL (1000 / 30)
   28.24 + 
   28.25 +@@ -677,8 +678,10 @@
   28.26 + 	    memmove(vs->input.buffer, vs->input.buffer + len,
   28.27 + 		    vs->input.offset - len);
   28.28 + 	    vs->input.offset -= len;
   28.29 +-	} else
   28.30 ++	} else {
   28.31 ++	    assert(ret > vs->read_handler_expect);
   28.32 + 	    vs->read_handler_expect = ret;
   28.33 ++	}
   28.34 +     }
   28.35 + }
   28.36 + 
   28.37 +@@ -961,8 +964,12 @@
   28.38 + 	if (len == 1)
   28.39 + 	    return 4;
   28.40 + 
   28.41 +-	if (len == 4)
   28.42 +-	    return 4 + (read_u16(data, 2) * 4);
   28.43 ++	if (len == 4) {
   28.44 ++	    uint16_t v;
   28.45 ++	    v = read_u16(data, 2);
   28.46 ++	    if (v)
   28.47 ++		return 4 + v * 4;
   28.48 ++	}
   28.49 + 
   28.50 + 	limit = read_u16(data, 2);
   28.51 + 	for (i = 0; i < limit; i++) {
   28.52 +@@ -996,8 +1003,12 @@
   28.53 + 	if (len == 1)
   28.54 + 	    return 8;
   28.55 + 
   28.56 +-	if (len == 8)
   28.57 +-	    return 8 + read_u32(data, 4);
   28.58 ++	if (len == 8) {
   28.59 ++	    uint32_t v;
   28.60 ++	    v = read_u32(data, 4);
   28.61 ++	    if (v)
   28.62 ++		return 8 + v;
   28.63 ++	}
   28.64 + 
   28.65 + 	client_cut_text(vs, read_u32(data, 4), data + 8);
   28.66 + 	break;
    29.1 --- a/tools/ioemu/patches/vnc-start-vncviewer	Tue Oct 24 10:08:30 2006 -0600
    29.2 +++ b/tools/ioemu/patches/vnc-start-vncviewer	Tue Oct 24 11:21:48 2006 -0600
    29.3 @@ -1,8 +1,8 @@
    29.4  Index: ioemu/vnc.c
    29.5  ===================================================================
    29.6 ---- ioemu.orig/vnc.c	2006-09-21 19:26:38.000000000 +0100
    29.7 -+++ ioemu/vnc.c	2006-09-21 19:29:58.000000000 +0100
    29.8 -@@ -1174,3 +1174,25 @@
    29.9 +--- ioemu.orig/vnc.c	2006-10-24 14:33:46.000000000 +0100
   29.10 ++++ ioemu/vnc.c	2006-10-24 14:33:46.000000000 +0100
   29.11 +@@ -1187,3 +1187,25 @@
   29.12   
   29.13       vnc_dpy_resize(vs->ds, 640, 400);
   29.14   }
   29.15 @@ -30,8 +30,8 @@ Index: ioemu/vnc.c
   29.16  +}
   29.17  Index: ioemu/vl.c
   29.18  ===================================================================
   29.19 ---- ioemu.orig/vl.c	2006-09-21 19:26:24.000000000 +0100
   29.20 -+++ ioemu/vl.c	2006-09-21 19:29:50.000000000 +0100
   29.21 +--- ioemu.orig/vl.c	2006-10-24 14:33:46.000000000 +0100
   29.22 ++++ ioemu/vl.c	2006-10-24 14:33:46.000000000 +0100
   29.23  @@ -120,6 +120,7 @@
   29.24   int bios_size;
   29.25   static DisplayState display_state;
   29.26 @@ -93,8 +93,8 @@ Index: ioemu/vl.c
   29.27           sdl_display_init(ds, full_screen);
   29.28  Index: ioemu/vl.h
   29.29  ===================================================================
   29.30 ---- ioemu.orig/vl.h	2006-09-21 19:26:24.000000000 +0100
   29.31 -+++ ioemu/vl.h	2006-09-21 19:29:50.000000000 +0100
   29.32 +--- ioemu.orig/vl.h	2006-10-24 14:33:46.000000000 +0100
   29.33 ++++ ioemu/vl.h	2006-10-24 14:33:46.000000000 +0100
   29.34  @@ -786,6 +786,7 @@
   29.35   
   29.36   /* vnc.c */
    30.1 --- a/tools/ioemu/patches/vnc-title-domain-name	Tue Oct 24 10:08:30 2006 -0600
    30.2 +++ b/tools/ioemu/patches/vnc-title-domain-name	Tue Oct 24 11:21:48 2006 -0600
    30.3 @@ -1,16 +1,16 @@
    30.4  Index: ioemu/vnc.c
    30.5  ===================================================================
    30.6 ---- ioemu.orig/vnc.c	2006-09-21 19:33:31.000000000 +0100
    30.7 -+++ ioemu/vnc.c	2006-09-21 19:33:31.000000000 +0100
    30.8 -@@ -1013,6 +1013,7 @@
    30.9 +--- ioemu.orig/vnc.c	2006-10-24 14:33:46.000000000 +0100
   30.10 ++++ ioemu/vnc.c	2006-10-24 14:33:46.000000000 +0100
   30.11 +@@ -1024,6 +1024,7 @@
   30.12   
   30.13   static int protocol_client_init(VncState *vs, char *data, size_t len)
   30.14   {
   30.15  +    size_t l;
   30.16       char pad[3] = { 0, 0, 0 };
   30.17   
   30.18 -     vs->width = vs->ds->width;
   30.19 -@@ -1058,8 +1059,10 @@
   30.20 +     vga_hw_update();
   30.21 +@@ -1071,8 +1072,10 @@
   30.22   	
   30.23       vnc_write(vs, pad, 3);           /* padding */
   30.24   
    31.1 --- a/tools/ioemu/patches/xen-build	Tue Oct 24 10:08:30 2006 -0600
    31.2 +++ b/tools/ioemu/patches/xen-build	Tue Oct 24 11:21:48 2006 -0600
    31.3 @@ -1,7 +1,7 @@
    31.4  Index: ioemu/Makefile
    31.5  ===================================================================
    31.6 ---- ioemu.orig/Makefile	2006-08-28 20:19:23.000000000 +0100
    31.7 -+++ ioemu/Makefile	2006-08-28 20:20:08.000000000 +0100
    31.8 +--- ioemu.orig/Makefile	2006-10-24 14:37:25.000000000 +0100
    31.9 ++++ ioemu/Makefile	2006-10-24 14:37:28.000000000 +0100
   31.10  @@ -1,11 +1,14 @@
   31.11   # Makefile for QEMU.
   31.12   
   31.13 @@ -85,8 +85,8 @@ Index: ioemu/Makefile
   31.14   info: qemu-doc.info qemu-tech.info
   31.15  Index: ioemu/Makefile.target
   31.16  ===================================================================
   31.17 ---- ioemu.orig/Makefile.target	2006-08-28 20:19:23.000000000 +0100
   31.18 -+++ ioemu/Makefile.target	2006-08-28 20:19:47.000000000 +0100
   31.19 +--- ioemu.orig/Makefile.target	2006-10-24 14:37:25.000000000 +0100
   31.20 ++++ ioemu/Makefile.target	2006-10-24 14:40:25.000000000 +0100
   31.21  @@ -1,5 +1,8 @@
   31.22   include config.mak
   31.23   
   31.24 @@ -112,7 +112,7 @@ Index: ioemu/Makefile.target
   31.25   endif
   31.26  -CFLAGS=-Wall -O2 -g -fno-strict-aliasing
   31.27  +CFLAGS+=-Wall -O2 -g -fno-strict-aliasing
   31.28 -+SSE2 := $(call test-gcc-flag,$(CC),-msse2)
   31.29 ++SSE2 := $(call cc-option,$(CC),-msse2,)
   31.30  +ifeq ($(SSE2),-msse2)
   31.31  +CFLAGS += -DUSE_SSE2=1 -msse2
   31.32  +endif
   31.33 @@ -149,17 +149,18 @@ Index: ioemu/Makefile.target
   31.34   install: all 
   31.35  +	mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configdir)"
   31.36   ifneq ($(PROGS),)
   31.37 - 	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
   31.38 +-	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
   31.39 ++	$(INSTALL_PROG) $(PROGS) "$(DESTDIR)$(bindir)"
   31.40   endif
   31.41 -+	install -m 755 $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
   31.42 -+	install -m 755 $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
   31.43 ++	$(INSTALL_PROG) $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
   31.44 ++	$(INSTALL_PROG) $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
   31.45   
   31.46   ifneq ($(wildcard .depend),)
   31.47   include .depend
   31.48  Index: ioemu/configure
   31.49  ===================================================================
   31.50 ---- ioemu.orig/configure	2006-08-28 20:19:23.000000000 +0100
   31.51 -+++ ioemu/configure	2006-08-28 20:19:47.000000000 +0100
   31.52 +--- ioemu.orig/configure	2006-10-24 14:37:25.000000000 +0100
   31.53 ++++ ioemu/configure	2006-10-24 14:40:20.000000000 +0100
   31.54  @@ -18,8 +18,8 @@
   31.55   
   31.56   # default parameters
    32.1 --- a/tools/ioemu/patches/xen-platform-device	Tue Oct 24 10:08:30 2006 -0600
    32.2 +++ b/tools/ioemu/patches/xen-platform-device	Tue Oct 24 11:21:48 2006 -0600
    32.3 @@ -3,8 +3,8 @@ will come later.
    32.4  
    32.5  Index: ioemu/Makefile.target
    32.6  ===================================================================
    32.7 ---- ioemu.orig/Makefile.target	2006-09-21 19:33:31.000000000 +0100
    32.8 -+++ ioemu/Makefile.target	2006-09-21 19:33:32.000000000 +0100
    32.9 +--- ioemu.orig/Makefile.target	2006-10-24 14:41:01.000000000 +0100
   32.10 ++++ ioemu/Makefile.target	2006-10-24 14:41:01.000000000 +0100
   32.11  @@ -359,6 +359,7 @@
   32.12   VL_OBJS+= usb-uhci.o
   32.13   VL_OBJS+= piix4acpi.o
   32.14 @@ -15,8 +15,8 @@ Index: ioemu/Makefile.target
   32.15   ifeq ($(TARGET_BASE_ARCH), ppc)
   32.16  Index: ioemu/hw/pc.c
   32.17  ===================================================================
   32.18 ---- ioemu.orig/hw/pc.c	2006-09-21 19:33:31.000000000 +0100
   32.19 -+++ ioemu/hw/pc.c	2006-09-21 19:33:32.000000000 +0100
   32.20 +--- ioemu.orig/hw/pc.c	2006-10-24 14:41:00.000000000 +0100
   32.21 ++++ ioemu/hw/pc.c	2006-10-24 14:41:01.000000000 +0100
   32.22  @@ -823,6 +823,9 @@
   32.23       }
   32.24   #endif /* !CONFIG_DM */
   32.25 @@ -30,8 +30,8 @@ Index: ioemu/hw/pc.c
   32.26  Index: ioemu/hw/xen_platform.c
   32.27  ===================================================================
   32.28  --- /dev/null	1970-01-01 00:00:00.000000000 +0000
   32.29 -+++ ioemu/hw/xen_platform.c	2006-09-21 19:33:32.000000000 +0100
   32.30 -@@ -0,0 +1,138 @@
   32.31 ++++ ioemu/hw/xen_platform.c	2006-10-24 14:41:04.000000000 +0100
   32.32 +@@ -0,0 +1,144 @@
   32.33  +/*
   32.34  + * XEN platform fake pci device, formerly known as the event channel device
   32.35  + * 
   32.36 @@ -131,7 +131,8 @@ Index: ioemu/hw/xen_platform.c
   32.37  +    uint8_t  bist; /* Built in self test */
   32.38  +    uint32_t base_address_regs[6];
   32.39  +    uint32_t reserved1;
   32.40 -+    uint32_t reserved2;
   32.41 ++    uint16_t subsystem_vendor_id;
   32.42 ++    uint16_t subsystem_id;
   32.43  +    uint32_t rom_addr;
   32.44  +    uint32_t reserved3;
   32.45  +    uint32_t reserved4;
   32.46 @@ -160,6 +161,11 @@ Index: ioemu/hw/xen_platform.c
   32.47  +    pch->header_type = 0;
   32.48  +    pch->interrupt_pin = 1;
   32.49  +
   32.50 ++    /* Microsoft WHQL requires non-zero subsystem IDs. */
   32.51 ++    /* http://www.pcisig.com/reflector/msg02205.html.  */
   32.52 ++    pch->subsystem_vendor_id = pch->vendor_id; /* Duplicate vendor id.  */
   32.53 ++    pch->subsystem_id        = 0x0001;         /* Hardcode sub-id as 1. */
   32.54 ++
   32.55  +    pci_register_io_region(d, 0, 0x100, PCI_ADDRESS_SPACE_IO,
   32.56  +                           platform_ioport_map);
   32.57  +
   32.58 @@ -172,9 +178,9 @@ Index: ioemu/hw/xen_platform.c
   32.59  +}
   32.60  Index: ioemu/vl.h
   32.61  ===================================================================
   32.62 ---- ioemu.orig/vl.h	2006-09-21 19:33:32.000000000 +0100
   32.63 -+++ ioemu/vl.h	2006-09-21 19:33:32.000000000 +0100
   32.64 -@@ -1210,6 +1210,9 @@
   32.65 +--- ioemu.orig/vl.h	2006-10-24 14:41:01.000000000 +0100
   32.66 ++++ ioemu/vl.h	2006-10-24 14:41:01.000000000 +0100
   32.67 +@@ -1212,6 +1212,9 @@
   32.68   void xenstore_check_new_media_present(int timeout);
   32.69   void xenstore_write_vncport(int vnc_display);
   32.70   
    33.1 --- a/tools/ioemu/patches/xen-support-buffered-ioreqs	Tue Oct 24 10:08:30 2006 -0600
    33.2 +++ b/tools/ioemu/patches/xen-support-buffered-ioreqs	Tue Oct 24 11:21:48 2006 -0600
    33.3 @@ -1,8 +1,8 @@
    33.4  Index: ioemu/vl.c
    33.5  ===================================================================
    33.6 ---- ioemu.orig/vl.c	2006-09-21 19:33:32.000000000 +0100
    33.7 -+++ ioemu/vl.c	2006-09-21 19:33:32.000000000 +0100
    33.8 -@@ -5844,6 +5844,7 @@
    33.9 +--- ioemu.orig/vl.c	2006-10-24 14:33:47.000000000 +0100
   33.10 ++++ ioemu/vl.c	2006-10-24 14:33:47.000000000 +0100
   33.11 +@@ -5854,6 +5854,7 @@
   33.12       unsigned long nr_pages, tmp_nr_pages, shared_page_nr;
   33.13       xen_pfn_t *page_array;
   33.14       extern void *shared_page;
   33.15 @@ -10,7 +10,7 @@ Index: ioemu/vl.c
   33.16   
   33.17       char qemu_dm_logfilename[64];
   33.18   
   33.19 -@@ -6425,6 +6426,18 @@
   33.20 +@@ -6440,6 +6441,18 @@
   33.21       fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n",
   33.22               shared_page_nr, (uint64_t)(page_array[shared_page_nr]));
   33.23   
   33.24 @@ -31,8 +31,8 @@ Index: ioemu/vl.c
   33.25   #elif defined(__ia64__)
   33.26  Index: ioemu/target-i386-dm/helper2.c
   33.27  ===================================================================
   33.28 ---- ioemu.orig/target-i386-dm/helper2.c	2006-09-21 19:33:30.000000000 +0100
   33.29 -+++ ioemu/target-i386-dm/helper2.c	2006-09-21 19:33:32.000000000 +0100
   33.30 +--- ioemu.orig/target-i386-dm/helper2.c	2006-10-24 14:33:45.000000000 +0100
   33.31 ++++ ioemu/target-i386-dm/helper2.c	2006-10-24 14:33:47.000000000 +0100
   33.32  @@ -76,6 +76,10 @@
   33.33   
   33.34   shared_iopage_t *shared_page = NULL;
    34.1 --- a/tools/ioemu/patches/xenstore-block-device-config	Tue Oct 24 10:08:30 2006 -0600
    34.2 +++ b/tools/ioemu/patches/xenstore-block-device-config	Tue Oct 24 11:21:48 2006 -0600
    34.3 @@ -1,7 +1,7 @@
    34.4  Index: ioemu/Makefile.target
    34.5  ===================================================================
    34.6 ---- ioemu.orig/Makefile.target	2006-09-21 19:33:31.000000000 +0100
    34.7 -+++ ioemu/Makefile.target	2006-09-21 19:33:31.000000000 +0100
    34.8 +--- ioemu.orig/Makefile.target	2006-10-24 14:31:36.000000000 +0100
    34.9 ++++ ioemu/Makefile.target	2006-10-24 14:33:28.000000000 +0100
   34.10  @@ -358,6 +358,7 @@
   34.11   VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o
   34.12   VL_OBJS+= usb-uhci.o
   34.13 @@ -13,7 +13,7 @@ Index: ioemu/Makefile.target
   34.14  Index: ioemu/xenstore.c
   34.15  ===================================================================
   34.16  --- /dev/null	1970-01-01 00:00:00.000000000 +0000
   34.17 -+++ ioemu/xenstore.c	2006-09-21 19:33:31.000000000 +0100
   34.18 ++++ ioemu/xenstore.c	2006-10-24 14:33:28.000000000 +0100
   34.19  @@ -0,0 +1,187 @@
   34.20  +/*
   34.21  + * This file is subject to the terms and conditions of the GNU General
   34.22 @@ -204,9 +204,9 @@ Index: ioemu/xenstore.c
   34.23  +}
   34.24  Index: ioemu/vl.c
   34.25  ===================================================================
   34.26 ---- ioemu.orig/vl.c	2006-09-21 19:33:31.000000000 +0100
   34.27 -+++ ioemu/vl.c	2006-09-21 19:33:31.000000000 +0100
   34.28 -@@ -5249,9 +5249,11 @@
   34.29 +--- ioemu.orig/vl.c	2006-10-24 14:33:24.000000000 +0100
   34.30 ++++ ioemu/vl.c	2006-10-24 14:33:28.000000000 +0100
   34.31 +@@ -5256,9 +5256,11 @@
   34.32              "Standard options:\n"
   34.33              "-M machine      select emulated machine (-M ? for list)\n"
   34.34              "-fda/-fdb file  use 'file' as floppy disk 0/1 image\n"
   34.35 @@ -218,7 +218,7 @@ Index: ioemu/vl.c
   34.36              "-boot [a|c|d]   boot on floppy (a), hard disk (c) or CD-ROM (d)\n"
   34.37   	   "-snapshot       write to temporary files instead of disk image files\n"
   34.38   #ifdef TARGET_I386
   34.39 -@@ -5378,11 +5380,13 @@
   34.40 +@@ -5386,11 +5388,13 @@
   34.41       QEMU_OPTION_M,
   34.42       QEMU_OPTION_fda,
   34.43       QEMU_OPTION_fdb,
   34.44 @@ -232,7 +232,7 @@ Index: ioemu/vl.c
   34.45       QEMU_OPTION_boot,
   34.46       QEMU_OPTION_snapshot,
   34.47   #ifdef TARGET_I386
   34.48 -@@ -5454,11 +5458,13 @@
   34.49 +@@ -5463,11 +5467,13 @@
   34.50       { "M", HAS_ARG, QEMU_OPTION_M },
   34.51       { "fda", HAS_ARG, QEMU_OPTION_fda },
   34.52       { "fdb", HAS_ARG, QEMU_OPTION_fdb },
   34.53 @@ -246,7 +246,7 @@ Index: ioemu/vl.c
   34.54       { "boot", HAS_ARG, QEMU_OPTION_boot },
   34.55       { "snapshot", 0, QEMU_OPTION_snapshot },
   34.56   #ifdef TARGET_I386
   34.57 -@@ -5807,10 +5813,16 @@
   34.58 +@@ -5817,10 +5823,16 @@
   34.59   #ifdef CONFIG_GDBSTUB
   34.60       int use_gdbstub, gdbstub_port;
   34.61   #endif
   34.62 @@ -265,7 +265,7 @@ Index: ioemu/vl.c
   34.63       const char *kernel_filename, *kernel_cmdline;
   34.64       DisplayState *ds = &display_state;
   34.65       int cyls, heads, secs, translation;
   34.66 -@@ -5871,8 +5883,10 @@
   34.67 +@@ -5881,8 +5893,10 @@
   34.68       initrd_filename = NULL;
   34.69       for(i = 0; i < MAX_FD; i++)
   34.70           fd_filename[i] = NULL;
   34.71 @@ -276,7 +276,7 @@ Index: ioemu/vl.c
   34.72       ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
   34.73       vga_ram_size = VGA_RAM_SIZE;
   34.74       bios_size = BIOS_SIZE;
   34.75 -@@ -5886,11 +5900,13 @@
   34.76 +@@ -5896,11 +5910,13 @@
   34.77       vncunused = 0;
   34.78       kernel_filename = NULL;
   34.79       kernel_cmdline = "";
   34.80 @@ -290,7 +290,7 @@ Index: ioemu/vl.c
   34.81       cyls = heads = secs = 0;
   34.82       translation = BIOS_ATA_TRANSLATION_AUTO;
   34.83       pstrcpy(monitor_device, sizeof(monitor_device), "vc");
   34.84 -@@ -5923,7 +5939,11 @@
   34.85 +@@ -5935,7 +5951,11 @@
   34.86               break;
   34.87           r = argv[optind];
   34.88           if (r[0] != '-') {
   34.89 @@ -302,7 +302,7 @@ Index: ioemu/vl.c
   34.90           } else {
   34.91               const QEMUOption *popt;
   34.92   
   34.93 -@@ -5967,6 +5987,7 @@
   34.94 +@@ -5979,6 +5999,7 @@
   34.95               case QEMU_OPTION_initrd:
   34.96                   initrd_filename = optarg;
   34.97                   break;
   34.98 @@ -310,7 +310,7 @@ Index: ioemu/vl.c
   34.99               case QEMU_OPTION_hda:
  34.100               case QEMU_OPTION_hdb:
  34.101               case QEMU_OPTION_hdc:
  34.102 -@@ -5979,6 +6000,7 @@
  34.103 +@@ -5991,6 +6012,7 @@
  34.104                           cdrom_index = -1;
  34.105                   }
  34.106                   break;
  34.107 @@ -318,7 +318,7 @@ Index: ioemu/vl.c
  34.108               case QEMU_OPTION_snapshot:
  34.109                   snapshot = 1;
  34.110                   break;
  34.111 -@@ -6031,11 +6053,13 @@
  34.112 +@@ -6043,11 +6065,13 @@
  34.113               case QEMU_OPTION_append:
  34.114                   kernel_cmdline = optarg;
  34.115                   break;
  34.116 @@ -332,7 +332,7 @@ Index: ioemu/vl.c
  34.117               case QEMU_OPTION_boot:
  34.118                   boot_device = optarg[0];
  34.119                   if (boot_device != 'a' && 
  34.120 -@@ -6290,12 +6314,18 @@
  34.121 +@@ -6305,12 +6329,18 @@
  34.122           }
  34.123       }
  34.124   
  34.125 @@ -351,7 +351,7 @@ Index: ioemu/vl.c
  34.126       if (!linux_boot && 
  34.127           hd_filename[0] == '\0' && 
  34.128           (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
  34.129 -@@ -6309,6 +6339,7 @@
  34.130 +@@ -6324,6 +6354,7 @@
  34.131           else
  34.132               boot_device = 'd';
  34.133       }
  34.134 @@ -359,7 +359,7 @@ Index: ioemu/vl.c
  34.135   
  34.136       setvbuf(stdout, NULL, _IOLBF, 0);
  34.137       
  34.138 -@@ -6441,6 +6472,7 @@
  34.139 +@@ -6456,6 +6487,7 @@
  34.140   
  34.141   #endif /* !CONFIG_DM */
  34.142   
  34.143 @@ -367,7 +367,7 @@ Index: ioemu/vl.c
  34.144       /* we always create the cdrom drive, even if no disk is there */
  34.145       bdrv_init();
  34.146       if (cdrom_index >= 0) {
  34.147 -@@ -6467,6 +6499,7 @@
  34.148 +@@ -6482,6 +6514,7 @@
  34.149               }
  34.150           }
  34.151       }
  34.152 @@ -375,7 +375,7 @@ Index: ioemu/vl.c
  34.153   
  34.154       /* we always create at least one floppy disk */
  34.155       fd_table[0] = bdrv_new("fda");
  34.156 -@@ -6545,6 +6578,8 @@
  34.157 +@@ -6560,6 +6593,8 @@
  34.158           }
  34.159       }
  34.160   
  34.161 @@ -386,8 +386,8 @@ Index: ioemu/vl.c
  34.162                     kernel_filename, kernel_cmdline, initrd_filename,
  34.163  Index: ioemu/monitor.c
  34.164  ===================================================================
  34.165 ---- ioemu.orig/monitor.c	2006-09-21 19:33:30.000000000 +0100
  34.166 -+++ ioemu/monitor.c	2006-09-21 19:33:31.000000000 +0100
  34.167 +--- ioemu.orig/monitor.c	2006-10-24 14:31:36.000000000 +0100
  34.168 ++++ ioemu/monitor.c	2006-10-24 14:33:28.000000000 +0100
  34.169  @@ -24,6 +24,7 @@
  34.170   #include "vl.h"
  34.171   #include "disas.h"
  34.172 @@ -416,8 +416,8 @@ Index: ioemu/monitor.c
  34.173       int i;
  34.174  Index: ioemu/block.c
  34.175  ===================================================================
  34.176 ---- ioemu.orig/block.c	2006-09-21 19:33:25.000000000 +0100
  34.177 -+++ ioemu/block.c	2006-09-21 19:33:31.000000000 +0100
  34.178 +--- ioemu.orig/block.c	2006-10-24 14:31:36.000000000 +0100
  34.179 ++++ ioemu/block.c	2006-10-24 14:33:28.000000000 +0100
  34.180  @@ -758,6 +758,7 @@
  34.181   static void raw_close(BlockDriverState *bs)
  34.182   {
  34.183 @@ -428,9 +428,9 @@ Index: ioemu/block.c
  34.184   
  34.185  Index: ioemu/vl.h
  34.186  ===================================================================
  34.187 ---- ioemu.orig/vl.h	2006-09-21 19:33:31.000000000 +0100
  34.188 -+++ ioemu/vl.h	2006-09-21 19:33:31.000000000 +0100
  34.189 -@@ -1189,6 +1189,8 @@
  34.190 +--- ioemu.orig/vl.h	2006-10-24 14:33:24.000000000 +0100
  34.191 ++++ ioemu/vl.h	2006-10-24 14:33:28.000000000 +0100
  34.192 +@@ -1191,6 +1191,8 @@
  34.193   void term_print_help(void);
  34.194   void monitor_readline(const char *prompt, int is_password,
  34.195                         char *buf, int buf_size);
  34.196 @@ -439,7 +439,7 @@ Index: ioemu/vl.h
  34.197   
  34.198   /* readline.c */
  34.199   typedef void ReadLineFunc(void *opaque, const char *str);
  34.200 -@@ -1201,6 +1203,13 @@
  34.201 +@@ -1203,6 +1205,13 @@
  34.202   void readline_start(const char *prompt, int is_password,
  34.203                       ReadLineFunc *readline_func, void *opaque);
  34.204   
  34.205 @@ -455,8 +455,8 @@ Index: ioemu/vl.h
  34.206   extern char domain_name[];
  34.207  Index: ioemu/hw/ide.c
  34.208  ===================================================================
  34.209 ---- ioemu.orig/hw/ide.c	2006-09-21 19:33:30.000000000 +0100
  34.210 -+++ ioemu/hw/ide.c	2006-09-21 19:33:31.000000000 +0100
  34.211 +--- ioemu.orig/hw/ide.c	2006-10-24 14:31:36.000000000 +0100
  34.212 ++++ ioemu/hw/ide.c	2006-10-24 14:33:28.000000000 +0100
  34.213  @@ -1158,6 +1158,7 @@
  34.214           } else {
  34.215               ide_atapi_cmd_error(s, SENSE_NOT_READY, 
    35.1 --- a/tools/ioemu/patches/xenstore-write-vnc-port	Tue Oct 24 10:08:30 2006 -0600
    35.2 +++ b/tools/ioemu/patches/xenstore-write-vnc-port	Tue Oct 24 11:21:48 2006 -0600
    35.3 @@ -1,7 +1,7 @@
    35.4  Index: ioemu/xenstore.c
    35.5  ===================================================================
    35.6 ---- ioemu.orig/xenstore.c	2006-09-21 19:33:31.000000000 +0100
    35.7 -+++ ioemu/xenstore.c	2006-09-21 19:33:32.000000000 +0100
    35.8 +--- ioemu.orig/xenstore.c	2006-10-24 14:33:47.000000000 +0100
    35.9 ++++ ioemu/xenstore.c	2006-10-24 14:33:47.000000000 +0100
   35.10  @@ -185,3 +185,31 @@
   35.11       free(image);
   35.12       free(vec);
   35.13 @@ -36,10 +36,10 @@ Index: ioemu/xenstore.c
   35.14  +}
   35.15  Index: ioemu/vl.c
   35.16  ===================================================================
   35.17 ---- ioemu.orig/vl.c	2006-09-21 19:33:31.000000000 +0100
   35.18 -+++ ioemu/vl.c	2006-09-21 19:33:32.000000000 +0100
   35.19 -@@ -6535,6 +6535,7 @@
   35.20 - 	vnc_display = vnc_display_init(ds, vnc_display, vncunused);
   35.21 +--- ioemu.orig/vl.c	2006-10-24 14:33:47.000000000 +0100
   35.22 ++++ ioemu/vl.c	2006-10-24 14:33:47.000000000 +0100
   35.23 +@@ -6550,6 +6550,7 @@
   35.24 + 	vnc_display = vnc_display_init(ds, vnc_display, vncunused, &vnclisten_addr);
   35.25   	if (vncviewer)
   35.26   	    vnc_start_viewer(vnc_display);
   35.27  +	xenstore_write_vncport(vnc_display);
   35.28 @@ -48,9 +48,9 @@ Index: ioemu/vl.c
   35.29           sdl_display_init(ds, full_screen);
   35.30  Index: ioemu/vl.h
   35.31  ===================================================================
   35.32 ---- ioemu.orig/vl.h	2006-09-21 19:33:31.000000000 +0100
   35.33 -+++ ioemu/vl.h	2006-09-21 19:33:32.000000000 +0100
   35.34 -@@ -1208,6 +1208,7 @@
   35.35 +--- ioemu.orig/vl.h	2006-10-24 14:33:47.000000000 +0100
   35.36 ++++ ioemu/vl.h	2006-10-24 14:33:47.000000000 +0100
   35.37 +@@ -1210,6 +1210,7 @@
   35.38   int xenstore_fd(void);
   35.39   void xenstore_process_event(void *opaque);
   35.40   void xenstore_check_new_media_present(int timeout);
    36.1 --- a/tools/libxc/xc_acm.c	Tue Oct 24 10:08:30 2006 -0600
    36.2 +++ b/tools/libxc/xc_acm.c	Tue Oct 24 11:21:48 2006 -0600
    36.3 @@ -24,12 +24,12 @@ int xc_acm_op(int xc_handle, int cmd, vo
    36.4      hypercall.arg[0] = cmd;
    36.5      hypercall.arg[1] = (unsigned long) arg;
    36.6  
    36.7 -    if (mlock(arg, arg_size) != 0) {
    36.8 -        PERROR("xc_acm_op: arg mlock failed");
    36.9 +    if (lock_pages(arg, arg_size) != 0) {
   36.10 +        PERROR("xc_acm_op: arg lock failed");
   36.11          goto out;
   36.12      }
   36.13      ret = do_xen_hypercall(xc_handle, &hypercall);
   36.14 -    safe_munlock(arg, arg_size);
   36.15 +    unlock_pages(arg, arg_size);
   36.16   out:
   36.17      return ret;
   36.18  }
    37.1 --- a/tools/libxc/xc_domain.c	Tue Oct 24 10:08:30 2006 -0600
    37.2 +++ b/tools/libxc/xc_domain.c	Tue Oct 24 11:21:48 2006 -0600
    37.3 @@ -72,7 +72,7 @@ int xc_domain_shutdown(int xc_handle,
    37.4      arg.domain_id = domid;
    37.5      arg.reason = reason;
    37.6  
    37.7 -    if ( mlock(&arg, sizeof(arg)) != 0 )
    37.8 +    if ( lock_pages(&arg, sizeof(arg)) != 0 )
    37.9      {
   37.10          PERROR("Could not lock memory for Xen hypercall");
   37.11          goto out1;
   37.12 @@ -80,7 +80,7 @@ int xc_domain_shutdown(int xc_handle,
   37.13  
   37.14      ret = do_xen_hypercall(xc_handle, &hypercall);
   37.15  
   37.16 -    safe_munlock(&arg, sizeof(arg));
   37.17 +    unlock_pages(&arg, sizeof(arg));
   37.18  
   37.19   out1:
   37.20      return ret;
   37.21 @@ -103,7 +103,7 @@ int xc_vcpu_setaffinity(int xc_handle,
   37.22                           (uint8_t *)&cpumap);
   37.23      domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
   37.24      
   37.25 -    if ( mlock(&cpumap, sizeof(cpumap)) != 0 )
   37.26 +    if ( lock_pages(&cpumap, sizeof(cpumap)) != 0 )
   37.27      {
   37.28          PERROR("Could not lock memory for Xen hypercall");
   37.29          goto out;
   37.30 @@ -111,7 +111,7 @@ int xc_vcpu_setaffinity(int xc_handle,
   37.31  
   37.32      ret = do_domctl(xc_handle, &domctl);
   37.33  
   37.34 -    safe_munlock(&cpumap, sizeof(cpumap));
   37.35 +    unlock_pages(&cpumap, sizeof(cpumap));
   37.36  
   37.37   out:
   37.38      return ret;
   37.39 @@ -134,7 +134,7 @@ int xc_vcpu_getaffinity(int xc_handle,
   37.40                           (uint8_t *)cpumap);
   37.41      domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(*cpumap) * 8;
   37.42      
   37.43 -    if ( mlock(cpumap, sizeof(*cpumap)) != 0 )
   37.44 +    if ( lock_pages(cpumap, sizeof(*cpumap)) != 0 )
   37.45      {
   37.46          PERROR("Could not lock memory for Xen hypercall");
   37.47          goto out;
   37.48 @@ -142,7 +142,7 @@ int xc_vcpu_getaffinity(int xc_handle,
   37.49  
   37.50      ret = do_domctl(xc_handle, &domctl);
   37.51  
   37.52 -    safe_munlock(cpumap, sizeof(*cpumap));
   37.53 +    unlock_pages(cpumap, sizeof(*cpumap));
   37.54  
   37.55   out:
   37.56      return ret;
   37.57 @@ -213,7 +213,7 @@ int xc_domain_getinfolist(int xc_handle,
   37.58      int ret = 0;
   37.59      DECLARE_SYSCTL;
   37.60  
   37.61 -    if ( mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
   37.62 +    if ( lock_pages(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
   37.63          return -1;
   37.64  
   37.65      sysctl.cmd = XEN_SYSCTL_getdomaininfolist;
   37.66 @@ -226,8 +226,7 @@ int xc_domain_getinfolist(int xc_handle,
   37.67      else
   37.68          ret = sysctl.u.getdomaininfolist.num_domains;
   37.69  
   37.70 -    if ( munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 )
   37.71 -        ret = -1;
   37.72 +    unlock_pages(info, max_domains*sizeof(xc_domaininfo_t));
   37.73  
   37.74      return ret;
   37.75  }
   37.76 @@ -245,12 +244,12 @@ int xc_vcpu_getcontext(int xc_handle,
   37.77      domctl.u.vcpucontext.vcpu   = (uint16_t)vcpu;
   37.78      set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
   37.79  
   37.80 -    if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 )
   37.81 +    if ( (rc = lock_pages(ctxt, sizeof(*ctxt))) != 0 )
   37.82          return rc;
   37.83  
   37.84      rc = do_domctl(xc_handle, &domctl);
   37.85  
   37.86 -    safe_munlock(ctxt, sizeof(*ctxt));
   37.87 +    unlock_pages(ctxt, sizeof(*ctxt));
   37.88  
   37.89      return rc;
   37.90  }
   37.91 @@ -512,12 +511,12 @@ int xc_vcpu_setcontext(int xc_handle,
   37.92      domctl.u.vcpucontext.vcpu = vcpu;
   37.93      set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt);
   37.94  
   37.95 -    if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 )
   37.96 +    if ( (rc = lock_pages(ctxt, sizeof(*ctxt))) != 0 )
   37.97          return rc;
   37.98  
   37.99      rc = do_domctl(xc_handle, &domctl);
  37.100  
  37.101 -    safe_munlock(ctxt, sizeof(*ctxt));
  37.102 +    unlock_pages(ctxt, sizeof(*ctxt));
  37.103  
  37.104      return rc;
  37.105  
    38.1 --- a/tools/libxc/xc_evtchn.c	Tue Oct 24 10:08:30 2006 -0600
    38.2 +++ b/tools/libxc/xc_evtchn.c	Tue Oct 24 11:21:48 2006 -0600
    38.3 @@ -18,16 +18,16 @@ static int do_evtchn_op(int xc_handle, i
    38.4      hypercall.arg[0] = cmd;
    38.5      hypercall.arg[1] = (unsigned long)arg;
    38.6  
    38.7 -    if ( mlock(arg, arg_size) != 0 )
    38.8 +    if ( lock_pages(arg, arg_size) != 0 )
    38.9      {
   38.10 -        PERROR("do_evtchn_op: arg mlock failed");
   38.11 +        PERROR("do_evtchn_op: arg lock failed");
   38.12          goto out;
   38.13      }
   38.14  
   38.15      if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0)
   38.16          ERROR("do_evtchn_op: HYPERVISOR_event_channel_op failed: %d", ret);
   38.17  
   38.18 -    safe_munlock(arg, arg_size);
   38.19 +    unlock_pages(arg, arg_size);
   38.20   out:
   38.21      return ret;
   38.22  }
    39.1 --- a/tools/libxc/xc_hvm_build.c	Tue Oct 24 10:08:30 2006 -0600
    39.2 +++ b/tools/libxc/xc_hvm_build.c	Tue Oct 24 11:21:48 2006 -0600
    39.3 @@ -38,13 +38,13 @@ static void xc_set_hvm_param(int handle,
    39.4      arg.domid = dom;
    39.5      arg.index = param;
    39.6      arg.value = value;
    39.7 -    if ( mlock(&arg, sizeof(arg)) != 0 )
    39.8 +    if ( lock_pages(&arg, sizeof(arg)) != 0 )
    39.9      {
   39.10          PERROR("Could not lock memory for set parameter");
   39.11          return;
   39.12      }
   39.13      rc = do_xen_hypercall(handle, &hypercall);
   39.14 -    safe_munlock(&arg, sizeof(arg));
   39.15 +    unlock_pages(&arg, sizeof(arg));
   39.16      if (rc < 0)
   39.17          PERROR("set HVM parameter failed (%d)", rc);
   39.18  }
   39.19 @@ -403,7 +403,7 @@ static int xc_hvm_build_internal(int xc_
   39.20          goto error_out;
   39.21      }
   39.22  
   39.23 -    if ( mlock(&st_ctxt, sizeof(st_ctxt) ) )
   39.24 +    if ( lock_pages(&st_ctxt, sizeof(st_ctxt) ) )
   39.25      {
   39.26          PERROR("%s: ctxt mlock failed", __func__);
   39.27          return 1;
    40.1 --- a/tools/libxc/xc_linux_build.c	Tue Oct 24 10:08:30 2006 -0600
    40.2 +++ b/tools/libxc/xc_linux_build.c	Tue Oct 24 11:21:48 2006 -0600
    40.3 @@ -1140,9 +1140,9 @@ static int xc_linux_build_internal(int x
    40.4      memset(&st_ctxt, 0, sizeof(st_ctxt));
    40.5  #endif
    40.6  
    40.7 -    if ( mlock(&st_ctxt, sizeof(st_ctxt) ) )
    40.8 +    if ( lock_pages(&st_ctxt, sizeof(st_ctxt) ) )
    40.9      {
   40.10 -        PERROR("%s: ctxt mlock failed", __func__);
   40.11 +        PERROR("%s: ctxt lock failed", __func__);
   40.12          return 1;
   40.13      }
   40.14  
    41.1 --- a/tools/libxc/xc_linux_restore.c	Tue Oct 24 10:08:30 2006 -0600
    41.2 +++ b/tools/libxc/xc_linux_restore.c	Tue Oct 24 11:21:48 2006 -0600
    41.3 @@ -162,9 +162,9 @@ int xc_linux_restore(int xc_handle, int 
    41.4          return 1;
    41.5      }
    41.6  
    41.7 -    if (mlock(&ctxt, sizeof(ctxt))) {
    41.8 +    if (lock_pages(&ctxt, sizeof(ctxt))) {
    41.9          /* needed for build domctl, but might as well do early */
   41.10 -        ERROR("Unable to mlock ctxt");
   41.11 +        ERROR("Unable to lock ctxt");
   41.12          return 1;
   41.13      }
   41.14  
   41.15 @@ -251,8 +251,8 @@ int xc_linux_restore(int xc_handle, int 
   41.16          goto out;
   41.17      }
   41.18  
   41.19 -    if (mlock(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE)) {
   41.20 -        ERROR("Could not mlock region_mfn");
   41.21 +    if (lock_pages(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE)) {
   41.22 +        ERROR("Could not lock region_mfn");
   41.23          goto out;
   41.24      }
   41.25  
    42.1 --- a/tools/libxc/xc_linux_save.c	Tue Oct 24 10:08:30 2006 -0600
    42.2 +++ b/tools/libxc/xc_linux_save.c	Tue Oct 24 11:21:48 2006 -0600
    42.3 @@ -628,8 +628,8 @@ int xc_linux_save(int xc_handle, int io_
    42.4          return 1;
    42.5      }
    42.6  
    42.7 -    if (mlock(&ctxt, sizeof(ctxt))) {
    42.8 -        ERROR("Unable to mlock ctxt");
    42.9 +    if (lock_pages(&ctxt, sizeof(ctxt))) {
   42.10 +        ERROR("Unable to lock ctxt");
   42.11          return 1;
   42.12      }
   42.13  
   42.14 @@ -767,14 +767,14 @@ int xc_linux_save(int xc_handle, int io_
   42.15  
   42.16      memset(to_send, 0xff, BITMAP_SIZE);
   42.17  
   42.18 -    if (mlock(to_send, BITMAP_SIZE)) {
   42.19 -        ERROR("Unable to mlock to_send");
   42.20 +    if (lock_pages(to_send, BITMAP_SIZE)) {
   42.21 +        ERROR("Unable to lock to_send");
   42.22          return 1;
   42.23      }
   42.24  
   42.25      /* (to fix is local only) */
   42.26 -    if (mlock(to_skip, BITMAP_SIZE)) {
   42.27 -        ERROR("Unable to mlock to_skip");
   42.28 +    if (lock_pages(to_skip, BITMAP_SIZE)) {
   42.29 +        ERROR("Unable to lock to_skip");
   42.30          return 1;
   42.31      }
   42.32  
   42.33 @@ -790,8 +790,8 @@ int xc_linux_save(int xc_handle, int io_
   42.34          goto out;
   42.35      }
   42.36  
   42.37 -    if (mlock(pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type))) {
   42.38 -        ERROR("Unable to mlock");
   42.39 +    if (lock_pages(pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type))) {
   42.40 +        ERROR("Unable to lock");
   42.41          goto out;
   42.42      }
   42.43  
    43.1 --- a/tools/libxc/xc_misc.c	Tue Oct 24 10:08:30 2006 -0600
    43.2 +++ b/tools/libxc/xc_misc.c	Tue Oct 24 11:21:48 2006 -0600
    43.3 @@ -21,13 +21,13 @@ int xc_readconsolering(int xc_handle,
    43.4      sysctl.u.readconsole.count  = nr_chars;
    43.5      sysctl.u.readconsole.clear  = clear;
    43.6  
    43.7 -    if ( (ret = mlock(buffer, nr_chars)) != 0 )
    43.8 +    if ( (ret = lock_pages(buffer, nr_chars)) != 0 )
    43.9          return ret;
   43.10  
   43.11      if ( (ret = do_sysctl(xc_handle, &sysctl)) == 0 )
   43.12          *pnr_chars = sysctl.u.readconsole.count;
   43.13  
   43.14 -    safe_munlock(buffer, nr_chars);
   43.15 +    unlock_pages(buffer, nr_chars);
   43.16  
   43.17      return ret;
   43.18  }
    44.1 --- a/tools/libxc/xc_private.c	Tue Oct 24 10:08:30 2006 -0600
    44.2 +++ b/tools/libxc/xc_private.c	Tue Oct 24 11:21:48 2006 -0600
    44.3 @@ -7,7 +7,23 @@
    44.4  #include <inttypes.h>
    44.5  #include "xc_private.h"
    44.6  
    44.7 -/* NB: arr must be mlock'ed */
    44.8 +int lock_pages(void *addr, size_t len)
    44.9 +{
   44.10 +      int e = 0;
   44.11 +#ifndef __sun__
   44.12 +      e = mlock(addr, len);
   44.13 +#endif
   44.14 +      return (e);
   44.15 +}
   44.16 +
   44.17 +void unlock_pages(void *addr, size_t len)
   44.18 +{
   44.19 +#ifndef __sun__
   44.20 +	safe_munlock(addr, len);
   44.21 +#endif
   44.22 +}
   44.23 +
   44.24 +/* NB: arr must be locked */
   44.25  int xc_get_pfn_type_batch(int xc_handle,
   44.26                            uint32_t dom, int num, unsigned long *arr)
   44.27  {
   44.28 @@ -51,7 +67,7 @@ int xc_mmuext_op(
   44.29      hypercall.arg[2] = (unsigned long)0;
   44.30      hypercall.arg[3] = (unsigned long)dom;
   44.31  
   44.32 -    if ( mlock(op, nr_ops*sizeof(*op)) != 0 )
   44.33 +    if ( lock_pages(op, nr_ops*sizeof(*op)) != 0 )
   44.34      {
   44.35          PERROR("Could not lock memory for Xen hypercall");
   44.36          goto out1;
   44.37 @@ -59,7 +75,7 @@ int xc_mmuext_op(
   44.38  
   44.39      ret = do_xen_hypercall(xc_handle, &hypercall);
   44.40  
   44.41 -    safe_munlock(op, nr_ops*sizeof(*op));
   44.42 +    unlock_pages(op, nr_ops*sizeof(*op));
   44.43  
   44.44   out1:
   44.45      return ret;
   44.46 @@ -79,9 +95,9 @@ static int flush_mmu_updates(int xc_hand
   44.47      hypercall.arg[2] = 0;
   44.48      hypercall.arg[3] = mmu->subject;
   44.49  
   44.50 -    if ( mlock(mmu->updates, sizeof(mmu->updates)) != 0 )
   44.51 +    if ( lock_pages(mmu->updates, sizeof(mmu->updates)) != 0 )
   44.52      {
   44.53 -        PERROR("flush_mmu_updates: mmu updates mlock failed");
   44.54 +        PERROR("flush_mmu_updates: mmu updates lock_pages failed");
   44.55          err = 1;
   44.56          goto out;
   44.57      }
   44.58 @@ -94,7 +110,7 @@ static int flush_mmu_updates(int xc_hand
   44.59  
   44.60      mmu->idx = 0;
   44.61  
   44.62 -    safe_munlock(mmu->updates, sizeof(mmu->updates));
   44.63 +    unlock_pages(mmu->updates, sizeof(mmu->updates));
   44.64  
   44.65   out:
   44.66      return err;
   44.67 @@ -149,62 +165,62 @@ int xc_memory_op(int xc_handle,
   44.68      case XENMEM_increase_reservation:
   44.69      case XENMEM_decrease_reservation:
   44.70      case XENMEM_populate_physmap:
   44.71 -        if ( mlock(reservation, sizeof(*reservation)) != 0 )
   44.72 +        if ( lock_pages(reservation, sizeof(*reservation)) != 0 )
   44.73          {
   44.74 -            PERROR("Could not mlock");
   44.75 +            PERROR("Could not lock");
   44.76              goto out1;
   44.77          }
   44.78          get_xen_guest_handle(extent_start, reservation->extent_start);
   44.79          if ( (extent_start != NULL) &&
   44.80 -             (mlock(extent_start,
   44.81 +             (lock_pages(extent_start,
   44.82                      reservation->nr_extents * sizeof(xen_pfn_t)) != 0) )
   44.83          {
   44.84 -            PERROR("Could not mlock");
   44.85 -            safe_munlock(reservation, sizeof(*reservation));
   44.86 +            PERROR("Could not lock");
   44.87 +            unlock_pages(reservation, sizeof(*reservation));
   44.88              goto out1;
   44.89          }
   44.90          break;
   44.91      case XENMEM_machphys_mfn_list:
   44.92 -        if ( mlock(xmml, sizeof(*xmml)) != 0 )
   44.93 +        if ( lock_pages(xmml, sizeof(*xmml)) != 0 )
   44.94          {
   44.95 -            PERROR("Could not mlock");
   44.96 +            PERROR("Could not lock");
   44.97              goto out1;
   44.98          }
   44.99          get_xen_guest_handle(extent_start, xmml->extent_start);
  44.100 -        if ( mlock(extent_start,
  44.101 +        if ( lock_pages(extent_start,
  44.102                     xmml->max_extents * sizeof(xen_pfn_t)) != 0 )
  44.103          {
  44.104 -            PERROR("Could not mlock");
  44.105 -            safe_munlock(xmml, sizeof(*xmml));
  44.106 +            PERROR("Could not lock");
  44.107 +            unlock_pages(xmml, sizeof(*xmml));
  44.108              goto out1;
  44.109          }
  44.110          break;
  44.111      case XENMEM_add_to_physmap:
  44.112 -        if ( mlock(arg, sizeof(struct xen_add_to_physmap)) )
  44.113 +        if ( lock_pages(arg, sizeof(struct xen_add_to_physmap)) )
  44.114          {
  44.115 -            PERROR("Could not mlock");
  44.116 +            PERROR("Could not lock");
  44.117              goto out1;
  44.118          }
  44.119          break;
  44.120      case XENMEM_translate_gpfn_list:
  44.121 -        if ( mlock(trans, sizeof(*trans)) != 0 )
  44.122 +        if ( lock_pages(trans, sizeof(*trans)) != 0 )
  44.123          {
  44.124 -            PERROR("Could not mlock");
  44.125 +            PERROR("Could not lock");
  44.126              goto out1;
  44.127          }
  44.128          get_xen_guest_handle(gpfn_list, trans->gpfn_list);
  44.129 -        if ( mlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
  44.130 +        if ( lock_pages(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
  44.131          {
  44.132 -            PERROR("Could not mlock");
  44.133 -            safe_munlock(trans, sizeof(*trans));
  44.134 +            PERROR("Could not lock");
  44.135 +            unlock_pages(trans, sizeof(*trans));
  44.136              goto out1;
  44.137          }
  44.138          get_xen_guest_handle(mfn_list, trans->mfn_list);
  44.139 -        if ( mlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
  44.140 +        if ( lock_pages(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 )
  44.141          {
  44.142 -            PERROR("Could not mlock");
  44.143 -            safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
  44.144 -            safe_munlock(trans, sizeof(*trans));
  44.145 +            PERROR("Could not lock");
  44.146 +            unlock_pages(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
  44.147 +            unlock_pages(trans, sizeof(*trans));
  44.148              goto out1;
  44.149          }
  44.150          break;
  44.151 @@ -217,27 +233,27 @@ int xc_memory_op(int xc_handle,
  44.152      case XENMEM_increase_reservation:
  44.153      case XENMEM_decrease_reservation:
  44.154      case XENMEM_populate_physmap:
  44.155 -        safe_munlock(reservation, sizeof(*reservation));
  44.156 +        unlock_pages(reservation, sizeof(*reservation));
  44.157          get_xen_guest_handle(extent_start, reservation->extent_start);
  44.158          if ( extent_start != NULL )
  44.159 -            safe_munlock(extent_start,
  44.160 +            unlock_pages(extent_start,
  44.161                           reservation->nr_extents * sizeof(xen_pfn_t));
  44.162          break;
  44.163      case XENMEM_machphys_mfn_list:
  44.164 -        safe_munlock(xmml, sizeof(*xmml));
  44.165 +        unlock_pages(xmml, sizeof(*xmml));
  44.166          get_xen_guest_handle(extent_start, xmml->extent_start);
  44.167 -        safe_munlock(extent_start,
  44.168 +        unlock_pages(extent_start,
  44.169                       xmml->max_extents * sizeof(xen_pfn_t));
  44.170          break;
  44.171      case XENMEM_add_to_physmap:
  44.172 -        safe_munlock(arg, sizeof(struct xen_add_to_physmap));
  44.173 +        unlock_pages(arg, sizeof(struct xen_add_to_physmap));
  44.174          break;
  44.175      case XENMEM_translate_gpfn_list:
  44.176              get_xen_guest_handle(mfn_list, trans->mfn_list);
  44.177 -            safe_munlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
  44.178 +            unlock_pages(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
  44.179              get_xen_guest_handle(gpfn_list, trans->gpfn_list);
  44.180 -            safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
  44.181 -            safe_munlock(trans, sizeof(*trans));
  44.182 +            unlock_pages(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t));
  44.183 +            unlock_pages(trans, sizeof(*trans));
  44.184          break;
  44.185      }
  44.186  
  44.187 @@ -279,15 +295,15 @@ int xc_get_pfn_list(int xc_handle,
  44.188      memset(pfn_buf, 0, max_pfns * sizeof(xen_pfn_t));
  44.189  #endif
  44.190  
  44.191 -    if ( mlock(pfn_buf, max_pfns * sizeof(xen_pfn_t)) != 0 )
  44.192 +    if ( lock_pages(pfn_buf, max_pfns * sizeof(xen_pfn_t)) != 0 )
  44.193      {
  44.194 -        PERROR("xc_get_pfn_list: pfn_buf mlock failed");
  44.195 +        PERROR("xc_get_pfn_list: pfn_buf lock failed");
  44.196          return -1;
  44.197      }
  44.198  
  44.199      ret = do_domctl(xc_handle, &domctl);
  44.200  
  44.201 -    safe_munlock(pfn_buf, max_pfns * sizeof(xen_pfn_t));
  44.202 +    unlock_pages(pfn_buf, max_pfns * sizeof(xen_pfn_t));
  44.203  
  44.204  #if 0
  44.205  #ifdef DEBUG
  44.206 @@ -419,7 +435,7 @@ int xc_version(int xc_handle, int cmd, v
  44.207          break;
  44.208      }
  44.209  
  44.210 -    if ( (argsize != 0) && (mlock(arg, argsize) != 0) )
  44.211 +    if ( (argsize != 0) && (lock_pages(arg, argsize) != 0) )
  44.212      {
  44.213          PERROR("Could not lock memory for version hypercall");
  44.214          return -ENOMEM;
  44.215 @@ -433,7 +449,7 @@ int xc_version(int xc_handle, int cmd, v
  44.216      rc = do_xen_version(xc_handle, cmd, arg);
  44.217  
  44.218      if ( argsize != 0 )
  44.219 -        safe_munlock(arg, argsize);
  44.220 +        unlock_pages(arg, argsize);
  44.221  
  44.222      return rc;
  44.223  }
    45.1 --- a/tools/libxc/xc_private.h	Tue Oct 24 10:08:30 2006 -0600
    45.2 +++ b/tools/libxc/xc_private.h	Tue Oct 24 11:21:48 2006 -0600
    45.3 @@ -66,6 +66,9 @@ do {                                    
    45.4      errno = __saved_errno;                      \
    45.5  } while (0)
    45.6  
    45.7 +int lock_pages(void *addr, size_t len);
    45.8 +void unlock_pages(void *addr, size_t len);
    45.9 +
   45.10  #define PERROR(_m, _a...)                               \
   45.11  do {                                                    \
   45.12      int __saved_errno = errno;                          \
   45.13 @@ -104,7 +107,7 @@ static inline int do_domctl(int xc_handl
   45.14      hypercall.op     = __HYPERVISOR_domctl;
   45.15      hypercall.arg[0] = (unsigned long)domctl;
   45.16  
   45.17 -    if ( mlock(domctl, sizeof(*domctl)) != 0 )
   45.18 +    if ( lock_pages(domctl, sizeof(*domctl)) != 0 )
   45.19      {
   45.20          PERROR("Could not lock memory for Xen hypercall");
   45.21          goto out1;
   45.22 @@ -117,7 +120,7 @@ static inline int do_domctl(int xc_handl
   45.23                      " rebuild the user-space tool set?\n");
   45.24      }
   45.25  
   45.26 -    safe_munlock(domctl, sizeof(*domctl));
   45.27 +    unlock_pages(domctl, sizeof(*domctl));
   45.28  
   45.29   out1:
   45.30      return ret;
   45.31 @@ -133,7 +136,7 @@ static inline int do_sysctl(int xc_handl
   45.32      hypercall.op     = __HYPERVISOR_sysctl;
   45.33      hypercall.arg[0] = (unsigned long)sysctl;
   45.34  
   45.35 -    if ( mlock(sysctl, sizeof(*sysctl)) != 0 )
   45.36 +    if ( lock_pages(sysctl, sizeof(*sysctl)) != 0 )
   45.37      {
   45.38          PERROR("Could not lock memory for Xen hypercall");
   45.39          goto out1;
   45.40 @@ -146,7 +149,7 @@ static inline int do_sysctl(int xc_handl
   45.41                      " rebuild the user-space tool set?\n");
   45.42      }
   45.43  
   45.44 -    safe_munlock(sysctl, sizeof(*sysctl));
   45.45 +    unlock_pages(sysctl, sizeof(*sysctl));
   45.46  
   45.47   out1:
   45.48      return ret;
    46.1 --- a/tools/libxc/xc_tbuf.c	Tue Oct 24 10:08:30 2006 -0600
    46.2 +++ b/tools/libxc/xc_tbuf.c	Tue Oct 24 11:21:48 2006 -0600
    46.3 @@ -104,7 +104,7 @@ int xc_tbuf_set_cpu_mask(int xc_handle, 
    46.4      set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, (uint8_t *)&mask);
    46.5      sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(mask) * 8;
    46.6  
    46.7 -    if ( mlock(&mask, sizeof(mask)) != 0 )
    46.8 +    if ( lock_pages(&mask, sizeof(mask)) != 0 )
    46.9      {
   46.10          PERROR("Could not lock memory for Xen hypercall");
   46.11          goto out;
   46.12 @@ -112,7 +112,7 @@ int xc_tbuf_set_cpu_mask(int xc_handle, 
   46.13  
   46.14      ret = do_sysctl(xc_handle, &sysctl);
   46.15  
   46.16 -    safe_munlock(&mask, sizeof(mask));
   46.17 +    unlock_pages(&mask, sizeof(mask));
   46.18  
   46.19   out:
   46.20      return ret;
    47.1 --- a/tools/libxc/xg_private.c	Tue Oct 24 10:08:30 2006 -0600
    47.2 +++ b/tools/libxc/xg_private.c	Tue Oct 24 11:21:48 2006 -0600
    47.3 @@ -11,6 +11,22 @@
    47.4  
    47.5  #include "xg_private.h"
    47.6  
    47.7 +int lock_pages(void *addr, size_t len)
    47.8 +{
    47.9 +    int e = 0;
   47.10 +#ifndef __sun__
   47.11 +    e = mlock(addr, len);
   47.12 +#endif
   47.13 +    return (e);
   47.14 +}
   47.15 +
   47.16 +void unlock_pages(void *addr, size_t len)
   47.17 +{
   47.18 +#ifndef __sun__
   47.19 +    safe_munlock(addr, len);
   47.20 +#endif
   47.21 +}
   47.22 +
   47.23  char *xc_read_image(const char *filename, unsigned long *size)
   47.24  {
   47.25      int kernel_fd = -1;
    48.1 --- a/tools/misc/xenperf.c	Tue Oct 24 10:08:30 2006 -0600
    48.2 +++ b/tools/misc/xenperf.c	Tue Oct 24 11:21:48 2006 -0600
    48.3 @@ -18,6 +18,22 @@
    48.4  #include <errno.h>
    48.5  #include <string.h>
    48.6  
    48.7 +int lock_pages(void *addr, size_t len)
    48.8 +{
    48.9 +    int e = 0;
   48.10 +#ifndef __sun__
   48.11 +    e = mlock(addr, len);
   48.12 +#endif
   48.13 +    return (e);
   48.14 +}
   48.15 +
   48.16 +void unlock_pages(void *addr, size_t len)
   48.17 +{
   48.18 +#ifndef __sun__
   48.19 +	munlock(addr, len);
   48.20 +#endif
   48.21 +}
   48.22 +
   48.23  int main(int argc, char *argv[])
   48.24  {
   48.25      int              i, j, xc_handle;
   48.26 @@ -87,11 +103,11 @@ int main(int argc, char *argv[])
   48.27  	pcv = malloc(sizeof(*pcv) * num_val);
   48.28  
   48.29      if ( pcd == NULL
   48.30 -		 || mlock(pcd, sizeof(*pcd) * num_desc) != 0
   48.31 +		 || lock_pages(pcd, sizeof(*pcd) * num_desc) != 0
   48.32  		 || pcv == NULL
   48.33 -		 || mlock(pcd, sizeof(*pcv) * num_val) != 0)
   48.34 +		 || lock_pages(pcd, sizeof(*pcv) * num_val) != 0)
   48.35      {
   48.36 -        fprintf(stderr, "Could not alloc or mlock buffers: %d (%s)\n",
   48.37 +        fprintf(stderr, "Could not alloc or lock buffers: %d (%s)\n",
   48.38                  errno, strerror(errno));
   48.39          exit(-1);
   48.40      }
   48.41 @@ -104,8 +120,8 @@ int main(int argc, char *argv[])
   48.42          return 1;
   48.43      }
   48.44  
   48.45 -    munlock(pcd, sizeof(*pcd) * num_desc);
   48.46 -    munlock(pcv, sizeof(*pcv) * num_val);
   48.47 +    unlock_pages(pcd, sizeof(*pcd) * num_desc);
   48.48 +    unlock_pages(pcv, sizeof(*pcv) * num_val);
   48.49  
   48.50  	val = pcv;
   48.51      for ( i = 0; i < num_desc; i++ )
    49.1 --- a/tools/python/xen/lowlevel/acm/acm.c	Tue Oct 24 10:08:30 2006 -0600
    49.2 +++ b/tools/python/xen/lowlevel/acm/acm.c	Tue Oct 24 11:21:48 2006 -0600
    49.3 @@ -147,9 +147,10 @@ static PyObject *getdecision(PyObject * 
    49.4  {
    49.5      char *arg1_name, *arg1, *arg2_name, *arg2, *decision = NULL;
    49.6      struct acm_getdecision getdecision;
    49.7 -    int xc_handle;
    49.8 +    int xc_handle, rc;
    49.9  
   49.10 -    if (!PyArg_ParseTuple(args, "ssss", &arg1_name, &arg1, &arg2_name, &arg2)) {
   49.11 +    if (!PyArg_ParseTuple(args, "ssss", &arg1_name,
   49.12 +                          &arg1, &arg2_name, &arg2)) {
   49.13          return NULL;
   49.14      }
   49.15  
   49.16 @@ -179,13 +180,17 @@ static PyObject *getdecision(PyObject * 
   49.17          getdecision.id2.ssidref = atol(arg2);
   49.18      }
   49.19  
   49.20 -    if (xc_acm_op(xc_handle, ACMOP_getdecision, &getdecision, sizeof(getdecision)) < 0) {
   49.21 +    rc = xc_acm_op(xc_handle, ACMOP_getdecision,
   49.22 +                   &getdecision, sizeof(getdecision));
   49.23 +
   49.24 +    xc_interface_close(xc_handle);
   49.25 +
   49.26 +    if (rc < 0) {
   49.27          if (errno == EACCES)
   49.28              PERROR("ACM operation failed.");
   49.29 +        return NULL;
   49.30      }
   49.31  
   49.32 -    xc_interface_close(xc_handle);
   49.33 -
   49.34      if (getdecision.acm_decision == ACM_ACCESS_PERMITTED)
   49.35          decision = "PERMITTED";
   49.36      else if (getdecision.acm_decision == ACM_ACCESS_DENIED)
    50.1 --- a/tools/python/xen/util/security.py	Tue Oct 24 10:08:30 2006 -0600
    50.2 +++ b/tools/python/xen/util/security.py	Tue Oct 24 11:21:48 2006 -0600
    50.3 @@ -601,8 +601,15 @@ def unify_resname(resource):
    50.4      """Makes all resource locations absolute. In case of physical
    50.5      resources, '/dev/' is added to local file names"""
    50.6  
    50.7 +    if not resource:
    50.8 +        return resource
    50.9 +
   50.10      # sanity check on resource name
   50.11 -    (type, resfile) = resource.split(":")
   50.12 +    try:
   50.13 +        (type, resfile) = resource.split(":")
   50.14 +    except:
   50.15 +        err("Resource spec '%s' contains no ':' delimiter" % resource)
   50.16 +
   50.17      if type == "phy":
   50.18          if not resfile.startswith("/"):
   50.19              resfile = "/dev/" + resfile
    51.1 --- a/tools/python/xen/xend/XendDomain.py	Tue Oct 24 10:08:30 2006 -0600
    51.2 +++ b/tools/python/xen/xend/XendDomain.py	Tue Oct 24 11:21:48 2006 -0600
    51.3 @@ -227,6 +227,9 @@ class XendDomain:
    51.4          try:
    51.5              dominfo = XendDomainInfo.create(config)
    51.6              self._add_domain(dominfo)
    51.7 +            self.domain_sched_credit_set(dominfo.getDomid(),
    51.8 +                                         dominfo.getWeight(),
    51.9 +                                         dominfo.getCap())
   51.10              return dominfo
   51.11          finally:
   51.12              self.domains_lock.release()
    52.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Oct 24 10:08:30 2006 -0600
    52.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Oct 24 11:21:48 2006 -0600
    52.3 @@ -131,7 +131,8 @@ ROUNDTRIPPING_CONFIG_ENTRIES = [
    52.4      ('uuid',            str),
    52.5      ('vcpus',           int),
    52.6      ('vcpu_avail',      int),
    52.7 -    ('cpu_weight',      float),
    52.8 +    ('cpu_cap',         int),
    52.9 +    ('cpu_weight',      int),
   52.10      ('memory',          int),
   52.11      ('shadow_memory',   int),
   52.12      ('maxmem',          int),
   52.13 @@ -562,7 +563,8 @@ class XendDomainInfo:
   52.14              defaultInfo('features',     lambda: "")
   52.15              defaultInfo('cpu',          lambda: None)
   52.16              defaultInfo('cpus',         lambda: [])
   52.17 -            defaultInfo('cpu_weight',   lambda: 1.0)
   52.18 +            defaultInfo('cpu_cap',      lambda: 0)
   52.19 +            defaultInfo('cpu_weight',   lambda: 256)
   52.20  
   52.21              # some domains don't have a config file (e.g. dom0 )
   52.22              # to set number of vcpus so we derive available cpus
   52.23 @@ -826,6 +828,12 @@ class XendDomainInfo:
   52.24      def getResume(self):
   52.25          return "%s" % self.info['resume']
   52.26  
   52.27 +    def getCap(self):
   52.28 +        return self.info['cpu_cap']
   52.29 +
   52.30 +    def getWeight(self):
   52.31 +        return self.info['cpu_weight']
   52.32 +
   52.33      def endRestore(self):
   52.34          self.setResume(False)
   52.35  
    53.1 --- a/tools/python/xen/xm/create.py	Tue Oct 24 10:08:30 2006 -0600
    53.2 +++ b/tools/python/xen/xm/create.py	Tue Oct 24 11:21:48 2006 -0600
    53.3 @@ -189,10 +189,14 @@ gopts.var('vcpus', val='VCPUS',
    53.4            fn=set_int, default=1,
    53.5            use="# of Virtual CPUS in domain.")
    53.6  
    53.7 +gopts.var('cpu_cap', val='CAP',
    53.8 +          fn=set_int, default=None,
    53.9 +          use="""Set the maximum amount of cpu.
   53.10 +          CAP is a percentage that fixes the maximum amount of cpu.""")
   53.11 +
   53.12  gopts.var('cpu_weight', val='WEIGHT',
   53.13 -          fn=set_float, default=None,
   53.14 -          use="""Set the new domain's cpu weight.
   53.15 -          WEIGHT is a float that controls the domain's share of the cpu.""")
   53.16 +          fn=set_int, default=None,
   53.17 +          use="""Set the cpu time ratio to be allocated to the domain.""")
   53.18  
   53.19  gopts.var('restart', val='onreboot|always|never',
   53.20            fn=set_value, default=None,
   53.21 @@ -687,6 +691,8 @@ def make_config(vals):
   53.22          config.append(['cpu', vals.cpu])
   53.23      if vals.cpus is not None:
   53.24          config.append(['cpus', vals.cpus])
   53.25 +    if vals.cpu_cap is not None:
   53.26 +        config.append(['cpu_cap', vals.cpu_cap])
   53.27      if vals.cpu_weight is not None:
   53.28          config.append(['cpu_weight', vals.cpu_weight])
   53.29      if vals.blkif:
   53.30 @@ -1143,6 +1149,8 @@ def config_security_check(config, verbos
   53.31          except security.ACMError:
   53.32              print "   %s: DENIED" % (resource)
   53.33              (res_label, res_policy) = security.get_res_label(resource)
   53.34 +            if not res_label:
   53.35 +                res_label = ""
   53.36              print "   --> res:"+res_label+" ("+res_policy+")"
   53.37              print "   --> dom:"+domain_label+" ("+domain_policy+")"
   53.38              answer = 0
   53.39 @@ -1181,7 +1189,7 @@ def main(argv):
   53.40          PrettyPrint.prettyprint(config)
   53.41      else:
   53.42          if not create_security_check(config):
   53.43 -            raise OptionError('Security Configuration prevents domain from starting')
   53.44 +            raise security.ACMError('Security Configuration prevents domain from starting')
   53.45          else:
   53.46              dom = make_domain(opts, config)
   53.47              if opts.vals.console_autoconnect:
    54.1 --- a/tools/python/xen/xm/opts.py	Tue Oct 24 10:08:30 2006 -0600
    54.2 +++ b/tools/python/xen/xm/opts.py	Tue Oct 24 11:21:48 2006 -0600
    54.3 @@ -488,6 +488,8 @@ class Opts:
    54.4                  p = os.path.join(x, self.vals.defconfig)
    54.5              else:
    54.6                  p = self.vals.defconfig
    54.7 +            if not p.startswith('/'):
    54.8 +                p = os.path.join(os.path.curdir, p)
    54.9              if os.path.exists(p):
   54.10                  self.info('Using config file "%s".' % p)
   54.11                  self.load(p, help)
   54.12 @@ -518,6 +520,10 @@ class Opts:
   54.13          exec cmd in globs, locs
   54.14          try:
   54.15              execfile(defconfig, globs, locs)
   54.16 +        except SyntaxError,e:
   54.17 +                raise SyntaxError, \
   54.18 +                "Errors were found at line %d while processing %s:\n\t%s"\
   54.19 +                %(e.lineno,defconfig,e.text)
   54.20          except:
   54.21              if not help: raise
   54.22          if help:
    55.1 --- a/tools/xm-test/README	Tue Oct 24 10:08:30 2006 -0600
    55.2 +++ b/tools/xm-test/README	Tue Oct 24 11:21:48 2006 -0600
    55.3 @@ -45,7 +45,7 @@ special files, this process must be done
    55.4  NB: If you have the initrd.img from another installation of xm-test,
    55.5  you can copy it into the ramdisk directory to eliminate the need to
    55.6  rebuild it.  If you do this, there is no need to run 'make' again.
    55.7 -Simply copy the initrd-X.Y.img file into ramdisk/ and then run:
    55.8 +Simply copy the initrd-X.Y-ARCH.img file into ramdisk/ and then run:
    55.9  
   55.10     # make existing
   55.11  
   55.12 @@ -53,7 +53,7 @@ Or, you can run:
   55.13     # INITRD="http://url.of.initrd.repo/" make existing
   55.14  
   55.15  You do not need to include the name of the image itself in the url, 
   55.16 -however, an initrd with the right name (initrd.X.Y.img) and version 
   55.17 +however, an initrd with the right name (initrd.X.Y-ARCH.img) and version 
   55.18  number must exist at that location.  The script will determine which 
   55.19  version of the initrd it needs and try to download the right file from 
   55.20  that location.
    56.1 --- a/tools/xm-test/configure.ac	Tue Oct 24 10:08:30 2006 -0600
    56.2 +++ b/tools/xm-test/configure.ac	Tue Oct 24 11:21:48 2006 -0600
    56.3 @@ -1,9 +1,11 @@
    56.4  # xm-test configure.ac input script
    56.5  
    56.6  # Basic header information
    56.7 -AC_INIT([xm-test], [0.8.0])
    56.8 +AC_INIT([xm-test], [1.0.0])
    56.9  AM_INIT_AUTOMAKE([1.7 foreign])
   56.10  
   56.11 +MK=''; AC_SUBST(MK)
   56.12 +
   56.13  # Check for dependencies
   56.14  AC_PROG_CC
   56.15  #AC_PROG_INSTALL
    57.1 --- a/tools/xm-test/lib/XmTestLib/Console.py	Tue Oct 24 10:08:30 2006 -0600
    57.2 +++ b/tools/xm-test/lib/XmTestLib/Console.py	Tue Oct 24 11:21:48 2006 -0600
    57.3 @@ -31,6 +31,7 @@ import termios
    57.4  import fcntl
    57.5  import select
    57.6  
    57.7 +import arch
    57.8  from Test import *
    57.9  
   57.10  TIMEDOUT = 1
   57.11 @@ -120,6 +121,7 @@ class XmConsole:
   57.12      def __getprompt(self, fd):
   57.13          timeout = 0
   57.14          bytes = 0
   57.15 +        buffer = ""
   57.16          while timeout < 180:
   57.17              # eat anything while total bytes less than limit else raise RUNAWAY
   57.18              while (not self.limit) or (bytes < self.limit):
   57.19 @@ -130,6 +132,7 @@ class XmConsole:
   57.20                          if self.debugMe:
   57.21                              sys.stdout.write(foo)
   57.22                          bytes += 1
   57.23 +                        buffer += foo
   57.24                      except Exception, exn:
   57.25                          raise ConsoleError(str(exn))
   57.26                  else:
   57.27 @@ -137,6 +140,8 @@ class XmConsole:
   57.28              else:
   57.29                  raise ConsoleError("Console run-away (exceeded %i bytes)"
   57.30                                     % self.limit, RUNAWAY)
   57.31 +            # Check to see if the buffer contains anything interetsing
   57.32 +            arch.checkBuffer(buffer)
   57.33              # press enter
   57.34              os.write(self.consoleFd, "\n")
   57.35              # look for prompt
    58.1 --- a/tools/xm-test/lib/XmTestLib/XenDomain.py	Tue Oct 24 10:08:30 2006 -0600
    58.2 +++ b/tools/xm-test/lib/XmTestLib/XenDomain.py	Tue Oct 24 11:21:48 2006 -0600
    58.3 @@ -20,34 +20,23 @@
    58.4  
    58.5  import sys
    58.6  import commands
    58.7 -import os
    58.8  import re
    58.9  import time
   58.10  
   58.11  from Xm import *
   58.12 +from arch import *
   58.13  from Test import *
   58.14  from config import *
   58.15  from Console import *
   58.16  from XenDevice import *
   58.17  from acm import *
   58.18  
   58.19 -BLOCK_ROOT_DEV = "hda"
   58.20 -
   58.21 -def getDeviceModel():
   58.22 -    """Get the path to the device model based on
   58.23 -    the architecture reported in uname"""
   58.24 -    arch = os.uname()[4]
   58.25 -    if re.search("64", arch):
   58.26 -        return "/usr/lib64/xen/bin/qemu-dm"
   58.27 -    else:
   58.28 -        return "/usr/lib/xen/bin/qemu-dm"
   58.29  
   58.30  def getDefaultKernel():
   58.31 -    """Get the path to the default DomU kernel"""
   58.32 -    dom0Ver = commands.getoutput("uname -r");
   58.33 -    domUVer = dom0Ver.replace("xen0", "xenU");
   58.34 -    
   58.35 -    return "/boot/vmlinuz-" + domUVer;
   58.36 +    return arch.getDefaultKernel()
   58.37 +
   58.38 +def getRdPath():
   58.39 +    return arch.getRdPath()
   58.40  
   58.41  def getUniqueName():
   58.42      """Get a uniqueish name for use in a domain"""
   58.43 @@ -56,43 +45,8 @@ def getUniqueName():
   58.44      test_name = re.sub("\.test", "", test_name)
   58.45      test_name = re.sub("[\/\.]", "", test_name)
   58.46      name = "%s-%i" % (test_name, unixtime)
   58.47 -    
   58.48 -    return name
   58.49 -
   58.50 -def getRdPath():
   58.51 -    rdpath = os.environ.get("RD_PATH")
   58.52 -    if not rdpath:
   58.53 -        rdpath = "../../ramdisk"
   58.54 -    rdpath = os.path.abspath(rdpath)
   58.55 -
   58.56 -    return rdpath
   58.57  
   58.58 -ParavirtDefaults = {"memory"       : 64,
   58.59 -                    "vcpus"        : 1,
   58.60 -                    "kernel"       : getDefaultKernel(),
   58.61 -                    "root"         : "/dev/ram0",
   58.62 -                    "ramdisk"      : getRdPath() + "/initrd.img"
   58.63 -                    }
   58.64 -HVMDefaults =      {"memory"       : 64,
   58.65 -                    "vcpus"        : 1,
   58.66 -                    "acpi"         : 0,
   58.67 -                    "apic"         : 0,
   58.68 -                    "disk"         : ["file:%s/disk.img,ioemu:%s,w!" %
   58.69 -                                   (getRdPath(), BLOCK_ROOT_DEV)],
   58.70 -                    "kernel"       : "/usr/lib/xen/boot/hvmloader",
   58.71 -                    "builder"      : "hvm",
   58.72 -                    "sdl"          : 0,
   58.73 -                    "vnc"          : 0,
   58.74 -                    "vncviewer"    : 0,
   58.75 -                    "nographic"    : 1,
   58.76 -                    "serial"       : "pty",
   58.77 -                    "device_model" : getDeviceModel()
   58.78 -                    }
   58.79 -
   58.80 -if ENABLE_HVM_SUPPORT:
   58.81 -    configDefaults = HVMDefaults
   58.82 -else:
   58.83 -    configDefaults = ParavirtDefaults
   58.84 +    return name
   58.85  
   58.86  class XenConfig:
   58.87      """An object to help create a xen-compliant config file"""
   58.88 @@ -145,8 +99,12 @@ class XenConfig:
   58.89  
   58.90      def setOpt(self, name, value):
   58.91          """Set an option in the config"""
   58.92 -        if name in self.opts.keys() and isinstance(self.opts[name], list) and not isinstance(value, list):
   58.93 +        if name in self.opts.keys() and isinstance(self.opts[name] ,
   58.94 +                                        list) and not isinstance(value, list):
   58.95                  self.opts[name] = [value]
   58.96 +        # "extra" is special so append to it.
   58.97 +        elif name == "extra" and name in self.opts.keys():
   58.98 +            self.opts[name] += " %s" % (value)
   58.99          else:
  58.100              self.opts[name] = value
  58.101  
  58.102 @@ -182,7 +140,7 @@ class DomainError(Exception):
  58.103              self.errorcode = int(errorcode)
  58.104          except Exception, e:
  58.105              self.errorcode = -1
  58.106 -            
  58.107 +
  58.108      def __str__(self):
  58.109          return str(self.msg)
  58.110  
  58.111 @@ -204,7 +162,7 @@ class XenDomain:
  58.112          self.devices = {}
  58.113          self.netEnv = "bridge"
  58.114  
  58.115 -        # Set domain type, either PV for ParaVirt domU or HVM for 
  58.116 +        # Set domain type, either PV for ParaVirt domU or HVM for
  58.117          # FullVirt domain
  58.118          if ENABLE_HVM_SUPPORT:
  58.119              self.type = "HVM"
  58.120 @@ -337,7 +295,8 @@ class XenDomain:
  58.121  
  58.122  class XmTestDomain(XenDomain):
  58.123  
  58.124 -    def __init__(self, name=None, extraConfig=None, baseConfig=configDefaults):
  58.125 +    def __init__(self, name=None, extraConfig=None,
  58.126 +                 baseConfig=arch.configDefaults):
  58.127          """Create a new xm-test domain
  58.128          @param name: The requested domain name
  58.129          @param extraConfig: Additional configuration options
  58.130 @@ -356,11 +315,12 @@ class XmTestDomain(XenDomain):
  58.131          XenDomain.__init__(self, config.getOpt("name"), config=config)
  58.132  
  58.133      def minSafeMem(self):
  58.134 -        return 32
  58.135 +        return arch.minSafeMem
  58.136  
  58.137  class XmTestNetDomain(XmTestDomain):
  58.138  
  58.139 -    def __init__(self, name=None, extraConfig=None, baseConfig=configDefaults):
  58.140 +    def __init__(self, name=None, extraConfig=None,
  58.141 +                 baseConfig=arch.configDefaults):
  58.142          """Create a new xm-test domain with one network device
  58.143          @param name: The requested domain name
  58.144          @param extraConfig: Additional configuration options
    59.1 --- a/tools/xm-test/lib/XmTestLib/acm.py	Tue Oct 24 10:08:30 2006 -0600
    59.2 +++ b/tools/xm-test/lib/XmTestLib/acm.py	Tue Oct 24 11:21:48 2006 -0600
    59.3 @@ -26,7 +26,7 @@ except:
    59.4      ACM_LABEL_RESOURCES = False
    59.5  
    59.6  labeled_resources = {}
    59.7 -acm_verbose = True
    59.8 +acm_verbose = False
    59.9  
   59.10  def isACMEnabled():
   59.11      return security.on()
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/tools/xm-test/lib/XmTestLib/arch.py	Tue Oct 24 11:21:48 2006 -0600
    60.3 @@ -0,0 +1,148 @@
    60.4 +#!/usr/bin/python
    60.5 +"""
    60.6 + arch.py - Encapsulate all logic regarding what type of hardware xen
    60.7 +           is running on to make adding new platforms easier.
    60.8 +
    60.9 + Copyright (C) 2006 Tony Breeds IBM Corporation
   60.10 +
   60.11 + This program is free software; you can redistribute it and/or modify
   60.12 + it under the terms of the GNU General Public License as published by
   60.13 + the Free Software Foundation; under version 2 of the License.
   60.14 +
   60.15 + This program is distributed in the hope that it will be useful,
   60.16 + but WITHOUT ANY WARRANTY; without even the implied warranty of
   60.17 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   60.18 + GNU General Public License for more details.
   60.19 +
   60.20 + You should have received a copy of the GNU General Public License
   60.21 + along with this program; if not, write to the Free Software
   60.22 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   60.23 +
   60.24 +"""
   60.25 +
   60.26 +import os
   60.27 +import re
   60.28 +import config
   60.29 +import commands
   60.30 +
   60.31 +from Test import *
   60.32 +
   60.33 +BLOCK_ROOT_DEV = "hda"
   60.34 +
   60.35 +# This isn't truly platform related but it makes the code tidier
   60.36 +def getRdPath():
   60.37 +    """Locate the full path to ramdisks needed by domUs"""
   60.38 +    rdpath = os.environ.get("RD_PATH")
   60.39 +    if not rdpath:
   60.40 +        rdpath = "../../ramdisk"
   60.41 +    rdpath = os.path.abspath(rdpath)
   60.42 +
   60.43 +    return rdpath
   60.44 +
   60.45 +# Begin: Intel ia32 and ia64 as well as AMD 32-bit and 64-bit processors
   60.46 +def ia_checkBuffer(buffer):
   60.47 +    return
   60.48 +
   60.49 +def ia_minSafeMem():
   60.50 +    return 32
   60.51 +
   60.52 +def ia_getDeviceModel():
   60.53 +    """Get the path to the device model based on
   60.54 +    the architecture reported in uname"""
   60.55 +    architecture = os.uname()[4]
   60.56 +    if re.search("64", architecture):
   60.57 +        return "/usr/lib64/xen/bin/qemu-dm"
   60.58 +    else:
   60.59 +        return "/usr/lib/xen/bin/qemu-dm"
   60.60 +
   60.61 +def ia_getDefaultKernel():
   60.62 +    """Get the path to the default DomU kernel"""
   60.63 +    dom0Ver = commands.getoutput("uname -r");
   60.64 +    domUVer = dom0Ver.replace("xen0", "xenU");
   60.65 +
   60.66 +    return "/boot/vmlinuz-" + domUVer;
   60.67 +
   60.68 +ia_ParavirtDefaults = {"memory"       : 64,
   60.69 +                       "vcpus"        : 1,
   60.70 +                       "kernel"       : ia_getDefaultKernel(),
   60.71 +                       "root"         : "/dev/ram0",
   60.72 +                       "ramdisk"      : getRdPath() + "/initrd.img",
   60.73 +}
   60.74 +ia_HVMDefaults =      {"memory"       : 64,
   60.75 +                       "vcpus"        : 1,
   60.76 +                       "acpi"         : 0,
   60.77 +                       "apic"         : 0,
   60.78 +                       "disk"         : ["file:%s/disk.img,ioemu:%s,w!" %
   60.79 +                                         (getRdPath(), BLOCK_ROOT_DEV)],
   60.80 +                       "kernel"       : "/usr/lib/xen/boot/hvmloader",
   60.81 +                       "builder"      : "hvm",
   60.82 +                       "sdl"          : 0,
   60.83 +                       "vnc"          : 0,
   60.84 +                       "vncviewer"    : 0,
   60.85 +                       "nographic"    : 1,
   60.86 +                       "serial"       : "pty",
   60.87 +                       "device_model" : ia_getDeviceModel(),
   60.88 +}
   60.89 +# End  : Intel ia32 and ia64 as well as AMD 32-bit and 64-bit processors
   60.90 +
   60.91 +# Begin: PowerPC
   60.92 +def ppc_checkBuffer(buffer):
   60.93 +    checks = [
   60.94 +        {"pattern" : re.compile("^\d+:mon>\s*$", re.MULTILINE),
   60.95 +         "message" : "domain trapped into XMON"},
   60.96 +    ]
   60.97 +
   60.98 +    for i in range(0, len(checks)):
   60.99 +        check=checks[i]
  60.100 +        if check.get('pattern').search(buffer):
  60.101 +		FAIL(check.get('message'))
  60.102 +
  60.103 +    return
  60.104 +
  60.105 +def ppc_minSafeMem():
  60.106 +    return 64
  60.107 +
  60.108 +def ppc_getDefaultKernel():
  60.109 +    """Get the path to the default DomU kernel"""
  60.110 +    dom0Ver = commands.getoutput("uname -r");
  60.111 +    domUVer = dom0Ver.replace("xen0", "xenU");
  60.112 +
  60.113 +    return "/boot/vmlinux-" + domUVer;
  60.114 +
  60.115 +ppc_ParavirtDefaults = {"memory"  : 64,
  60.116 +                        "vcpus"   : 1,
  60.117 +                        "kernel"  : ppc_getDefaultKernel(),
  60.118 +                        "root"    : "/dev/ram0",
  60.119 +                        "ramdisk" : getRdPath() + "/initrd.img",
  60.120 +                        "extra"   : "xencons=tty128 console=tty128",
  60.121 +}
  60.122 +# End  : PowerPC
  60.123 +
  60.124 +"""Convert from uname specification to a more general platform."""
  60.125 +_uname_to_arch_map = {
  60.126 +    "i386"  : "x86",
  60.127 +    "i486"  : "x86",
  60.128 +    "i586"  : "x86",
  60.129 +    "i686"  : "x86",
  60.130 +    "ia64"  : "ia64",
  60.131 +    "ppc"   : "powerpc",
  60.132 +    "ppc64" : "powerpc",
  60.133 +}
  60.134 +
  60.135 +# Lookup current platform.
  60.136 +_arch = _uname_to_arch_map.get(os.uname()[4], "Unknown")
  60.137 +if _arch == "x86" or _arch == "ia64":
  60.138 +    minSafeMem = ia_minSafeMem
  60.139 +    getDefaultKernel = ia_getDefaultKernel
  60.140 +    checkBuffer = ia_checkBuffer
  60.141 +    if config.ENABLE_HVM_SUPPORT:
  60.142 +        configDefaults = ia_HVMDefaults
  60.143 +    else:
  60.144 +        configDefaults = ia_ParavirtDefaults
  60.145 +elif _arch == "powerpc":
  60.146 +    minSafeMem = ppc_minSafeMem
  60.147 +    getDefaultKernel = ppc_getDefaultKernel
  60.148 +    checkBuffer = ppc_checkBuffer
  60.149 +    configDefaults = ppc_ParavirtDefaults
  60.150 +else:
  60.151 +    raise ValueError, "Unknown architecture!"
    61.1 --- a/tools/xm-test/lib/XmTestReport/OSReport.py	Tue Oct 24 10:08:30 2006 -0600
    61.2 +++ b/tools/xm-test/lib/XmTestReport/OSReport.py	Tue Oct 24 11:21:48 2006 -0600
    61.3 @@ -29,6 +29,7 @@ import re
    61.4  import os
    61.5  import commands
    61.6  import sys
    61.7 +import arch
    61.8  
    61.9  class Machine:
   61.10  
   61.11 @@ -89,8 +90,6 @@ class Machine:
   61.12          self.values = {}
   61.13          self.errors = 0
   61.14  
   61.15 -        cpuValues = {"model_name"       : "Unknown",
   61.16 -                     "flags"            : "Unknown"}
   61.17          xenValues = {"nr_cpus"          : "Unknown",
   61.18                       "nr_nodes"         : "Unknown",
   61.19                       "sockets_per_node" : "Unknown",
   61.20 @@ -100,12 +99,7 @@ class Machine:
   61.21                       "total_memory"     : "Unknown"}
   61.22  
   61.23          xen = self.__getXenInfo(xenValues)
   61.24 -        cpu = self.__getCpuInfo(cpuValues)
   61.25 -
   61.26 -        if cpu["model_name"] == "Unknown":   
   61.27 -            cpuValues={"arch"  : "Unknown",
   61.28 -                       "features": "Unknown"}
   61.29 -            cpu=self.__getCpuInfo(cpuValues)
   61.30 +        cpu = self.__getCpuInfo(arch.cpuValues)
   61.31  
   61.32          for k in xen.keys():
   61.33              self.values[k] = xen[k]
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/tools/xm-test/lib/XmTestReport/arch.py	Tue Oct 24 11:21:48 2006 -0600
    62.3 @@ -0,0 +1,48 @@
    62.4 +#!/usr/bin/python
    62.5 +"""
    62.6 + arch.py - Encapsulate all logic regarding what type of hardware xen
    62.7 +           is running on to make adding new platforms easier.
    62.8 +
    62.9 + Copyright (C) 2006 Tony Breeds IBM Corporation
   62.10 +
   62.11 + This program is free software; you can redistribute it and/or modify
   62.12 + it under the terms of the GNU General Public License as published by
   62.13 + the Free Software Foundation; under version 2 of the License.
   62.14 +
   62.15 + This program is distributed in the hope that it will be useful,
   62.16 + but WITHOUT ANY WARRANTY; without even the implied warranty of
   62.17 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   62.18 + GNU General Public License for more details.
   62.19 +
   62.20 + You should have received a copy of the GNU General Public License
   62.21 + along with this program; if not, write to the Free Software
   62.22 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   62.23 +
   62.24 +"""
   62.25 +
   62.26 +import os
   62.27 +
   62.28 +"""Convert from uname specification to a more general platform."""
   62.29 +_uname_to_arch_map = {
   62.30 +    "i386"  : "x86",
   62.31 +    "i486"  : "x86",
   62.32 +    "i586"  : "x86",
   62.33 +    "i686"  : "x86",
   62.34 +    "ia64"  : "ia64",
   62.35 +    "ppc"   : "powerpc",
   62.36 +    "ppc64" : "powerpc",
   62.37 +}
   62.38 +
   62.39 +_arch = _uname_to_arch_map.get(os.uname()[4], "Unknown")
   62.40 +if _arch == "x86":
   62.41 +    cpuValues = {"model_name" : "Unknown",
   62.42 +                 "flags"      : "Unknown"}
   62.43 +elif _arch == "ia64":
   62.44 +    cpuValues = {"arch"     : "Unknown",
   62.45 +                 "features" : "Unknown"}
   62.46 +elif _arch == "powerpc":
   62.47 +    cpuValues = {"cpu"      : "Unknown",
   62.48 +                 "platform" : "Unknown",
   62.49 +                 "revision" : "Unknown"}
   62.50 +else:
   62.51 +    raise ValueError, "Unknown architecture!"
    63.1 --- a/tools/xm-test/ramdisk/Makefile.am	Tue Oct 24 10:08:30 2006 -0600
    63.2 +++ b/tools/xm-test/ramdisk/Makefile.am	Tue Oct 24 11:21:48 2006 -0600
    63.3 @@ -1,19 +1,39 @@
    63.4 +#
    63.5 +# make existing:
    63.6 +#
    63.7 +#   Download a pre-built ramdisk.
    63.8 +#     INITRD = <Directory to download ramdisk from>
    63.9 +#
   63.10 +# make initrd:
   63.11 +#
   63.12 +#   Make a ramdisk from scratch.
   63.13 +#     BR_URL = <The URL of the Buildroot source code>
   63.14 +#     BR_SNAPSHOT = 1  Set BR_URL to the upstream Buildroot daily snapshot.
   63.15 +#     BR_ARCH = <The build architecture for the initrd>
   63.16 +#
   63.17 +
   63.18  INITRD ?= http://xm-test.xensource.com/ramdisks
   63.19  
   63.20 +BR_ARCH ?= $(shell uname -m | sed -e s/i.86/i386/ -e 's/ppc\(64\)*/powerpc/')
   63.21 +
   63.22 +@MK@ifdef BR_SNAPSHOT
   63.23 +  BR_URL = http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2
   63.24 +@MK@else
   63.25 +  BR_URL ?= http://xm-test.xensource.com/ramdisks/buildroot-20061023.tar.bz2
   63.26 +@MK@endif
   63.27 +BR_TAR = $(notdir $(BR_URL))
   63.28 +
   63.29 +BR_SRC = buildroot
   63.30 +BR_IMG = $(BR_SRC)/rootfs.$(BR_ARCH).ext2
   63.31 +
   63.32 +BR_ROOT = build_$(BR_ARCH)/root
   63.33 +
   63.34  EXTRA_DIST = skel configs patches
   63.35  
   63.36 -BR_TAR = buildroot-20060606.tar.bz2
   63.37 -BR_URL = http://buildroot.uclibc.org/downloads/snapshots/$(BR_TAR)
   63.38 -#BR_URL = http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2
   63.39 -BR_SRC = buildroot
   63.40 -BR_IMG = $(BR_SRC)/rootfs.i386.ext2
   63.41 -
   63.42 -BR_ROOT = build_i386/root
   63.43 -
   63.44  HVM_SCRIPT = bin/create_disk_image
   63.45  
   63.46  XMTEST_MAJ_VER = $(shell echo @PACKAGE_VERSION@ | perl -pe 's/(\d+)\.(\d+)\.\d+/\1.\2/')
   63.47 -XMTEST_VER_IMG = initrd-$(XMTEST_MAJ_VER).img
   63.48 +XMTEST_VER_IMG = initrd-$(XMTEST_MAJ_VER)-$(BR_ARCH).img
   63.49  
   63.50  EXTRA_ROOT_DIRS = sys
   63.51  
   63.52 @@ -30,7 +50,7 @@ endif
   63.53  	tar xjf $(BR_TAR)
   63.54  
   63.55  $(BR_IMG): $(BR_SRC)
   63.56 -	cp configs/buildroot $(BR_SRC)/.config
   63.57 +	cp configs/buildroot-$(BR_ARCH) $(BR_SRC)/.config
   63.58  	cp configs/busybox $(BR_SRC)/package/busybox/busybox.config
   63.59  	cp configs/uClibc $(BR_SRC)/toolchain/uClibc/uClibc.config
   63.60  	(for i in patches/buildroot/*.patch; do \
   63.61 @@ -42,7 +62,7 @@ endif
   63.62  	(cd skel; mkdir -p $(EXTRA_ROOT_DIRS); tar cf - .) \
   63.63  		| (cd $(BR_SRC)/$(BR_ROOT); tar xvf -)
   63.64  	cd $(BR_SRC) && make
   63.65 -	cp $(BR_IMG) initrd-$(XMTEST_MAJ_VER).img
   63.66 +	cp $(BR_IMG) $(XMTEST_VER_IMG)
   63.67  
   63.68  initrd.img: $(XMTEST_VER_IMG)
   63.69  	ln -sf $(XMTEST_VER_IMG) initrd.img
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/tools/xm-test/ramdisk/README-XenSource-initrd-1.0-img	Tue Oct 24 11:21:48 2006 -0600
    64.3 @@ -0,0 +1,45 @@
    64.4 +XenSource xm-test 1.0 initrds
    64.5 +=============================
    64.6 +
    64.7 +http://xm-test.xensource.com/ramdisks/initrd-1.0-i386.img and
    64.8 +http://xm-test.xensource.com/ramdisks/initrd-1.0-powerpc.img are initrds
    64.9 +suitable for use with Xen's xm-test regression testing suite.  They has been
   64.10 +built and provided by XenSource, for the convenience of Xen users.  xm-test
   64.11 +initrds may be mixed across minor xm-test versions, but not across major
   64.12 +versions; this initrd is suitable for all 1.0.x versions of xm-test (as
   64.13 +shipped with Xen 3.0.4 and the unstable tree leading up to that release).
   64.14 +
   64.15 +In order to use one of these initrds, run "./autogen; ./configure; make
   64.16 +existing" inside the xm-test directory, and the appropriate initrd for your
   64.17 +architecture will be downloaded automatically.  Alternatively, if you have
   64.18 +already downloaded that file, place it into the xm-test/ramdisk directory and
   64.19 +run the same command.  In either case, runtest.sh can then be used as normal.
   64.20 +See xm-test/README for more details.
   64.21 +
   64.22 +These initrds were built using the infrastructure provided by xm-test.  Each
   64.23 +is a full guest operating system and filesystem, and as such includes a large
   64.24 +number of pieces of software.  The source code for the majority of these are
   64.25 +included in full inside the file
   64.26 +http://xm-test.xensource.com/ramdisks/<INITRD>-buildroot.tar.bz2, where
   64.27 +<INITRD> is either initrd-1.0-i386 or initrd-1.0-powerpc as appropriate, or
   64.28 +alongside this file.  Copyright statements and licences are contained therein.
   64.29 +The remaining source code is included in the Xen distribution, at
   64.30 +http://www.xensource.com/xen/downloads/archives.html.  The configurations used
   64.31 +for BusyBox, uClibc, and Buildroot are available as
   64.32 +http://xm-test.xensource.com/ramdisks/<INITRD>-busybox-config,
   64.33 +http://xm-test.xensource.com/ramdisks/<INITRD>-uClibc-config, and
   64.34 +http://xm-test.xensource.com/ramdisks/<INITRD>-buildroot-config respectively,
   64.35 +or alongside this file.
   64.36 +
   64.37 +XenSource and the Xen contributors are grateful to the authors of these
   64.38 +software packages for their contributions to free and open-source software.
   64.39 +
   64.40 +
   64.41 +Buildroot and BusyBox are Copyright (c) Erik Andersen <andersen@codepoet.org>.
   64.42 +BusyBox is licensed under the GNU General Public License (GPL).  A copy of
   64.43 +this license is available in the file GPL-2,
   64.44 +http://xm-test.xensource.com/ramdisks/GPL-2, or alongside this file.
   64.45 +
   64.46 +uClibc is licensed under the GNU Lesser General Public License (LGPL).  A copy
   64.47 +of this license is available in the file
   64.48 +http://xm-test.xensource.com/ramdisks/LGPL-2, or alongside this file.
    65.1 --- a/tools/xm-test/ramdisk/configs/buildroot	Tue Oct 24 10:08:30 2006 -0600
    65.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.3 @@ -1,330 +0,0 @@
    65.4 -#
    65.5 -# Automatically generated make config: don't edit
    65.6 -#
    65.7 -BR2_HAVE_DOT_CONFIG=y
    65.8 -# BR2_alpha is not set
    65.9 -# BR2_arm is not set
   65.10 -# BR2_armeb is not set
   65.11 -# BR2_cris is not set
   65.12 -BR2_i386=y
   65.13 -# BR2_m68k is not set
   65.14 -# BR2_mips is not set
   65.15 -# BR2_mipsel is not set
   65.16 -# BR2_nios2 is not set
   65.17 -# BR2_powerpc is not set
   65.18 -# BR2_sh is not set
   65.19 -# BR2_sparc is not set
   65.20 -# BR2_x86_64 is not set
   65.21 -BR2_x86_i386=y
   65.22 -# BR2_x86_i486 is not set
   65.23 -# BR2_x86_i586 is not set
   65.24 -# BR2_x86_i686 is not set
   65.25 -BR2_ARCH="i386"
   65.26 -BR2_ENDIAN="LITTLE"
   65.27 -
   65.28 -#
   65.29 -# Build options
   65.30 -#
   65.31 -BR2_WGET="wget --passive-ftp"
   65.32 -BR2_SVN="svn co"
   65.33 -BR2_TAR_OPTIONS=""
   65.34 -BR2_DL_DIR="$(BASE_DIR)/dl"
   65.35 -BR2_SOURCEFORGE_MIRROR="easynews"
   65.36 -BR2_STAGING_DIR="$(BUILD_DIR)/staging_dir"
   65.37 -BR2_TOPDIR_PREFIX=""
   65.38 -BR2_TOPDIR_SUFFIX=""
   65.39 -BR2_GNU_BUILD_SUFFIX="pc-linux-gnu"
   65.40 -BR2_JLEVEL=1
   65.41 -
   65.42 -#
   65.43 -# Toolchain Options
   65.44 -#
   65.45 -
   65.46 -#
   65.47 -# Kernel Header Options
   65.48 -#
   65.49 -# BR2_KERNEL_HEADERS_2_4_25 is not set
   65.50 -# BR2_KERNEL_HEADERS_2_4_27 is not set
   65.51 -# BR2_KERNEL_HEADERS_2_4_29 is not set
   65.52 -# BR2_KERNEL_HEADERS_2_4_31 is not set
   65.53 -# BR2_KERNEL_HEADERS_2_6_9 is not set
   65.54 -# BR2_KERNEL_HEADERS_2_6_11 is not set
   65.55 -BR2_KERNEL_HEADERS_2_6_12=y
   65.56 -BR2_DEFAULT_KERNEL_HEADERS="2.6.12"
   65.57 -
   65.58 -#
   65.59 -# uClibc Options
   65.60 -#
   65.61 -# BR2_UCLIBC_VERSION_SNAPSHOT is not set
   65.62 -# BR2_ENABLE_LOCALE is not set
   65.63 -# BR2_PTHREADS_NONE is not set
   65.64 -# BR2_PTHREADS is not set
   65.65 -BR2_PTHREADS_OLD=y
   65.66 -# BR2_PTHREADS_NATIVE is not set
   65.67 -
   65.68 -#
   65.69 -# Binutils Options
   65.70 -#
   65.71 -# BR2_BINUTILS_VERSION_2_14_90_0_8 is not set
   65.72 -# BR2_BINUTILS_VERSION_2_15 is not set
   65.73 -# BR2_BINUTILS_VERSION_2_15_94_0_2_2 is not set
   65.74 -# BR2_BINUTILS_VERSION_2_15_97 is not set
   65.75 -# BR2_BINUTILS_VERSION_2_16_1 is not set
   65.76 -# BR2_BINUTILS_VERSION_2_16_90_0_3 is not set
   65.77 -# BR2_BINUTILS_VERSION_2_16_91_0_3 is not set
   65.78 -# BR2_BINUTILS_VERSION_2_16_91_0_4 is not set
   65.79 -# BR2_BINUTILS_VERSION_2_16_91_0_5 is not set
   65.80 -# BR2_BINUTILS_VERSION_2_16_91_0_6 is not set
   65.81 -BR2_BINUTILS_VERSION_2_16_91_0_7=y
   65.82 -BR2_BINUTILS_VERSION="2.16.91.0.7"
   65.83 -BR2_EXTRA_BINUTILS_CONFIG_OPTIONS=""
   65.84 -
   65.85 -#
   65.86 -# Gcc Options
   65.87 -#
   65.88 -# BR2_GCC_VERSION_3_3_5 is not set
   65.89 -# BR2_GCC_VERSION_3_3_6 is not set
   65.90 -# BR2_GCC_VERSION_3_4_2 is not set
   65.91 -# BR2_GCC_VERSION_3_4_3 is not set
   65.92 -# BR2_GCC_VERSION_3_4_4 is not set
   65.93 -# BR2_GCC_VERSION_3_4_5 is not set
   65.94 -BR2_GCC_VERSION_3_4_6=y
   65.95 -# BR2_GCC_VERSION_4_0_0 is not set
   65.96 -# BR2_GCC_VERSION_4_0_1 is not set
   65.97 -# BR2_GCC_VERSION_4_0_2 is not set
   65.98 -# BR2_GCC_VERSION_4_0_3 is not set
   65.99 -# BR2_GCC_VERSION_4_1_0 is not set
  65.100 -# BR2_GCC_VERSION_4_2 is not set
  65.101 -# BR2_GCC_IS_SNAP is not set
  65.102 -BR2_GCC_VERSION="3.4.6"
  65.103 -# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set
  65.104 -BR2_EXTRA_GCC_CONFIG_OPTIONS=""
  65.105 -# BR2_INSTALL_LIBSTDCPP is not set
  65.106 -# BR2_INSTALL_OBJC is not set
  65.107 -
  65.108 -#
  65.109 -# Ccache Options
  65.110 -#
  65.111 -BR2_CCACHE=y
  65.112 -
  65.113 -#
  65.114 -# Gdb Options
  65.115 -#
  65.116 -# BR2_PACKAGE_GDB is not set
  65.117 -# BR2_PACKAGE_GDB_SERVER is not set
  65.118 -# BR2_PACKAGE_GDB_HOST is not set
  65.119 -
  65.120 -#
  65.121 -# elf2flt
  65.122 -#
  65.123 -# BR2_ELF2FLT is not set
  65.124 -
  65.125 -#
  65.126 -# Common Toolchain Options
  65.127 -#
  65.128 -# BR2_PACKAGE_SSTRIP_TARGET is not set
  65.129 -# BR2_PACKAGE_SSTRIP_HOST is not set
  65.130 -BR2_ENABLE_MULTILIB=y
  65.131 -BR2_LARGEFILE=y
  65.132 -BR2_TARGET_OPTIMIZATION="-Os -pipe"
  65.133 -BR2_CROSS_TOOLCHAIN_TARGET_UTILS=y
  65.134 -
  65.135 -#
  65.136 -# Package Selection for the target
  65.137 -#
  65.138 -
  65.139 -#
  65.140 -# The default minimal system
  65.141 -#
  65.142 -BR2_PACKAGE_BUSYBOX=y
  65.143 -# BR2_PACKAGE_BUSYBOX_SNAPSHOT is not set
  65.144 -BR2_PACKAGE_BUSYBOX_INSTALL_SYMLINKS=y
  65.145 -BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox.config"
  65.146 -
  65.147 -#
  65.148 -# The minimum needed to build a uClibc development system
  65.149 -#
  65.150 -# BR2_PACKAGE_BASH is not set
  65.151 -# BR2_PACKAGE_BZIP2 is not set
  65.152 -# BR2_PACKAGE_COREUTILS is not set
  65.153 -# BR2_PACKAGE_DIFFUTILS is not set
  65.154 -# BR2_PACKAGE_ED is not set
  65.155 -# BR2_PACKAGE_FINDUTILS is not set
  65.156 -# BR2_PACKAGE_FLEX is not set
  65.157 -# BR2_PACKAGE_GAWK is not set
  65.158 -# BR2_PACKAGE_GCC_TARGET is not set
  65.159 -# BR2_PACKAGE_CCACHE_TARGET is not set
  65.160 -# BR2_PACKAGE_GREP is not set
  65.161 -# BR2_PACKAGE_MAKE is not set
  65.162 -# BR2_PACKAGE_PATCH is not set
  65.163 -# BR2_PACKAGE_SED is not set
  65.164 -# BR2_PACKAGE_TAR is not set
  65.165 -
  65.166 -#
  65.167 -# Other stuff
  65.168 -#
  65.169 -# BR2_PACKAGE_ACPID is not set
  65.170 -# BR2_PACKAGE_ASTERISK is not set
  65.171 -# BR2_PACKAGE_AT is not set
  65.172 -# BR2_PACKAGE_AUTOCONF is not set
  65.173 -# BR2_PACKAGE_AUTOMAKE is not set
  65.174 -# BR2_PACKAGE_BERKELEYDB is not set
  65.175 -# BR2_PACKAGE_BIND is not set
  65.176 -# BR2_PACKAGE_BISON is not set
  65.177 -# BR2_PACKAGE_BOA is not set
  65.178 -# BR2_PACKAGE_BRIDGE is not set
  65.179 -# BR2_PACKAGE_CUSTOMIZE is not set
  65.180 -# BR2_PACKAGE_ISC_DHCP is not set
  65.181 -# BR2_PACKAGE_DIALOG is not set
  65.182 -# BR2_PACKAGE_DIRECTFB is not set
  65.183 -# BR2_PACKAGE_DISTCC is not set
  65.184 -# BR2_PACKAGE_DM is not set
  65.185 -# BR2_PACKAGE_DNSMASQ is not set
  65.186 -# BR2_PACKAGE_DROPBEAR is not set
  65.187 -# BR2_PACKAGE_ETHTOOL is not set
  65.188 -# BR2_PACKAGE_EXPAT is not set
  65.189 -# BR2_PACKAGE_E2FSPROGS is not set
  65.190 -# BR2_PACKAGE_FAKEROOT is not set
  65.191 -# BR2_PACKAGE_FILE is not set
  65.192 -# BR2_PACKAGE_FREETYPE is not set
  65.193 -# BR2_PACKAGE_GETTEXT is not set
  65.194 -# BR2_PACKAGE_LIBINTL is not set
  65.195 -# BR2_PACKAGE_GZIP is not set
  65.196 -# BR2_PACKAGE_HASERL is not set
  65.197 -# BR2_PACKAGE_HOSTAP is not set
  65.198 -# BR2_PACKAGE_HOTPLUG is not set
  65.199 -# BR2_PACKAGE_IOSTAT is not set
  65.200 -# BR2_PACKAGE_IPROUTE2 is not set
  65.201 -# BR2_PACKAGE_IPSEC_TOOLS is not set
  65.202 -# BR2_PACKAGE_IPTABLES is not set
  65.203 -# BR2_PACKAGE_JPEG is not set
  65.204 -# BR2_PACKAGE_LESS is not set
  65.205 -# BR2_PACKAGE_LIBCGI is not set
  65.206 -# BR2_PACKAGE_LIBCGICC is not set
  65.207 -# BR2_PACKAGE_LIBELF is not set
  65.208 -# BR2_PACKAGE_LIBFLOAT is not set
  65.209 -# BR2_PACKAGE_LIBGLIB12 is not set
  65.210 -# BR2_PACKAGE_LIBMAD is not set
  65.211 -# BR2_PACKAGE_LIBPCAP is not set
  65.212 -# BR2_PACKAGE_LIBPNG is not set
  65.213 -# BR2_PACKAGE_LIBSYSFS is not set
  65.214 -# BR2_PACKAGE_LIBTOOL is not set
  65.215 -# BR2_PACKAGE_LIBUSB is not set
  65.216 -# BR2_PACKAGE_LIGHTTPD is not set
  65.217 -# BR2_PACKAGE_LINKS is not set
  65.218 -# BR2_PACKAGE_LRZSZ is not set
  65.219 -# BR2_PACKAGE_LTP-TESTSUITE is not set
  65.220 -# BR2_PACKAGE_LTT is not set
  65.221 -# BR2_PACKAGE_LVM2 is not set
  65.222 -# BR2_PACKAGE_LZO is not set
  65.223 -# BR2_PACKAGE_M4 is not set
  65.224 -# BR2_PACKAGE_MDADM is not set
  65.225 -# BR2_PACKAGE_MEMTESTER is not set
  65.226 -# BR2_PACKAGE_MICROCOM is not set
  65.227 -# BR2_PACKAGE_MICROPERL is not set
  65.228 -# BR2_PACKAGE_MICROWIN is not set
  65.229 -# BR2_PACKAGE_MKDOSFS is not set
  65.230 -# BR2_PACKAGE_MODULE_INIT_TOOLS is not set
  65.231 -# BR2_PACKAGE_MODUTILS is not set
  65.232 -# BR2_PACKAGE_MPG123 is not set
  65.233 -# BR2_PACKAGE_MROUTED is not set
  65.234 -# BR2_PACKAGE_MTD is not set
  65.235 -# BR2_PACKAGE_NANO is not set
  65.236 -# BR2_PACKAGE_NCURSES is not set
  65.237 -# BR2_PACKAGE_NETKITBASE is not set
  65.238 -# BR2_PACKAGE_NETKITTELNET is not set
  65.239 -# BR2_PACKAGE_NETSNMP is not set
  65.240 -# BR2_PACKAGE_NEWT is not set
  65.241 -# BR2_PACKAGE_NTP is not set
  65.242 -# BR2_PACKAGE_OPENNTPD is not set
  65.243 -# BR2_PACKAGE_OPENSSH is not set
  65.244 -# BR2_PACKAGE_OPENSSL is not set
  65.245 -# BR2_PACKAGE_OPENVPN is not set
  65.246 -# BR2_PACKAGE_PCIUTILS is not set
  65.247 -# BR2_PACKAGE_PORTAGE is not set
  65.248 -# BR2_PACKAGE_PORTMAP is not set
  65.249 -# BR2_PACKAGE_PPPD is not set
  65.250 -# BR2_PACKAGE_PROCPS is not set
  65.251 -# BR2_PACKAGE_PSMISC is not set
  65.252 -# BR2_PACKAGE_PYTHON is not set
  65.253 -# BR2_PACKAGE_QTE is not set
  65.254 -BR2_QTE_TMAKE_VERSION="1.13"
  65.255 -# BR2_PACKAGE_RAIDTOOLS is not set
  65.256 -# BR2_READLINE is not set
  65.257 -# BR2_PACKAGE_RSYNC is not set
  65.258 -# BR2_PACKAGE_RUBY is not set
  65.259 -# BR2_PACKAGE_RXVT is not set
  65.260 -# BR2_PACKAGE_SDL is not set
  65.261 -# BR2_PACKAGE_SFDISK is not set
  65.262 -# BR2_PACKAGE_SLANG is not set
  65.263 -# BR2_PACKAGE_SMARTMONTOOLS is not set
  65.264 -# BR2_PACKAGE_SOCAT is not set
  65.265 -# BR2_PACKAGE_STRACE is not set
  65.266 -# BR2_PACKAGE_SUDO is not set
  65.267 -# BR2_PACKAGE_SYSKLOGD is not set
  65.268 -# BR2_PACKAGE_SYSVINIT is not set
  65.269 -# BR2_PACKAGE_TCL is not set
  65.270 -# BR2_PACKAGE_TCPDUMP is not set
  65.271 -# BR2_PACKAGE_TFTPD is not set
  65.272 -# BR2_PACKAGE_THTTPD is not set
  65.273 -# BR2_PACKAGE_TINYLOGIN is not set
  65.274 -# BR2_PACKAGE_TINYX is not set
  65.275 -# BR2_PACKAGE_TN5250 is not set
  65.276 -# BR2_PACKAGE_TTCP is not set
  65.277 -# BR2_PACKAGE_UDEV is not set
  65.278 -# BR2_PACKAGE_UDHCP is not set
  65.279 -# BR2_PACKAGE_UEMACS is not set
  65.280 -# BR2_PACKAGE_USBUTILS is not set
  65.281 -# BR2_PACKAGE_UTIL-LINUX is not set
  65.282 -# BR2_PACKAGE_VALGRIND is not set
  65.283 -# BR2_PACKAGE_VTUN is not set
  65.284 -# BR2_PACKAGE_WGET is not set
  65.285 -# BR2_PACKAGE_WHICH is not set
  65.286 -# BR2_PACKAGE_WIPE is not set
  65.287 -# BR2_PACKAGE_WIRELESS_TOOLS is not set
  65.288 -# BR2_PACKAGE_XFSPROGS is not set
  65.289 -# BR2_PACKAGE_XORG is not set
  65.290 -# BR2_PACKAGE_ZLIB is not set
  65.291 -BR2_PACKAGE_HPING=y
  65.292 -
  65.293 -#
  65.294 -# Target Options
  65.295 -#
  65.296 -
  65.297 -#
  65.298 -# filesystem for target device
  65.299 -#
  65.300 -# BR2_TARGET_ROOTFS_CRAMFS is not set
  65.301 -# BR2_TARGET_ROOTFS_CLOOP is not set
  65.302 -BR2_TARGET_ROOTFS_EXT2=y
  65.303 -BR2_TARGET_ROOTFS_EXT2_BLOCKS=0
  65.304 -BR2_TARGET_ROOTFS_EXT2_INODES=0
  65.305 -BR2_TARGET_ROOTFS_EXT2_RESBLKS=0
  65.306 -BR2_TARGET_ROOTFS_EXT2_SQUASH=y
  65.307 -BR2_TARGET_ROOTFS_EXT2_OUTPUT="$(IMAGE).ext2"
  65.308 -# BR2_TARGET_ROOTFS_EXT2_GZ is not set
  65.309 -BR2_TARGET_ROOTFS_EXT2_COPYTO=""
  65.310 -# BR2_TARGET_ROOTFS_JFFS2 is not set
  65.311 -# BR2_TARGET_ROOTFS_SQUASHFS is not set
  65.312 -# BR2_TARGET_ROOTFS_TAR is not set
  65.313 -# BR2_TARGET_ROOTFS_ISO9660 is not set
  65.314 -
  65.315 -#
  65.316 -# bootloader for target device
  65.317 -#
  65.318 -# BR2_TARGET_GRUB is not set
  65.319 -# BR2_TARGET_SYSLINUX is not set
  65.320 -
  65.321 -#
  65.322 -# Board Support Options
  65.323 -#
  65.324 -# BR2_TARGET_SOEKRIS_NET4521 is not set
  65.325 -# BR2_TARGET_SOEKRIS_NET4801 is not set
  65.326 -# BR2_TARGET_VIA_EPIA_MII is not set
  65.327 -
  65.328 -#
  65.329 -# Generic System Support
  65.330 -#
  65.331 -# BR2_TARGET_GENERIC_ACCESS_POINT is not set
  65.332 -# BR2_TARGET_GENERIC_FIREWALL is not set
  65.333 -# BR2_TARGET_GENERIC_DEV_SYSTEM is not set
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/tools/xm-test/ramdisk/configs/buildroot-i386	Tue Oct 24 11:21:48 2006 -0600
    66.3 @@ -0,0 +1,346 @@
    66.4 +#
    66.5 +# Automatically generated make config: don't edit
    66.6 +#
    66.7 +BR2_HAVE_DOT_CONFIG=y
    66.8 +# BR2_alpha is not set
    66.9 +# BR2_arm is not set
   66.10 +# BR2_armeb is not set
   66.11 +# BR2_cris is not set
   66.12 +BR2_i386=y
   66.13 +# BR2_m68k is not set
   66.14 +# BR2_mips is not set
   66.15 +# BR2_mipsel is not set
   66.16 +# BR2_nios2 is not set
   66.17 +# BR2_powerpc is not set
   66.18 +# BR2_sh is not set
   66.19 +# BR2_sh64 is not set
   66.20 +# BR2_sparc is not set
   66.21 +# BR2_x86_64 is not set
   66.22 +BR2_x86_i386=y
   66.23 +# BR2_x86_i486 is not set
   66.24 +# BR2_x86_i586 is not set
   66.25 +# BR2_x86_i686 is not set
   66.26 +BR2_ARCH="i386"
   66.27 +BR2_ENDIAN="LITTLE"
   66.28 +
   66.29 +#
   66.30 +# Build options
   66.31 +#
   66.32 +BR2_WGET="wget --passive-ftp"
   66.33 +BR2_SVN="svn co"
   66.34 +BR2_ZCAT="zcat"
   66.35 +BR2_TAR_OPTIONS=""
   66.36 +BR2_DL_DIR="$(BASE_DIR)/dl"
   66.37 +BR2_SOURCEFORGE_MIRROR="easynews"
   66.38 +BR2_STAGING_DIR="$(BUILD_DIR)/staging_dir"
   66.39 +BR2_TOPDIR_PREFIX=""
   66.40 +BR2_TOPDIR_SUFFIX=""
   66.41 +BR2_GNU_BUILD_SUFFIX="pc-linux-gnu"
   66.42 +BR2_GNU_TARGET_SUFFIX="linux-uclibc"
   66.43 +BR2_JLEVEL=1
   66.44 +
   66.45 +#
   66.46 +# Toolchain Options
   66.47 +#
   66.48 +
   66.49 +#
   66.50 +# Kernel Header Options
   66.51 +#
   66.52 +# BR2_KERNEL_HEADERS_2_4_25 is not set
   66.53 +# BR2_KERNEL_HEADERS_2_4_27 is not set
   66.54 +# BR2_KERNEL_HEADERS_2_4_29 is not set
   66.55 +# BR2_KERNEL_HEADERS_2_4_31 is not set
   66.56 +# BR2_KERNEL_HEADERS_2_6_9 is not set
   66.57 +# BR2_KERNEL_HEADERS_2_6_11 is not set
   66.58 +BR2_KERNEL_HEADERS_2_6_12=y
   66.59 +# BR2_KERNEL_HEADERS_2_6_18 is not set
   66.60 +BR2_DEFAULT_KERNEL_HEADERS="2.6.12"
   66.61 +
   66.62 +#
   66.63 +# uClibc Options
   66.64 +#
   66.65 +# BR2_UCLIBC_VERSION_SNAPSHOT is not set
   66.66 +# BR2_ENABLE_LOCALE is not set
   66.67 +# BR2_PTHREADS_NONE is not set
   66.68 +# BR2_PTHREADS is not set
   66.69 +BR2_PTHREADS_OLD=y
   66.70 +# BR2_PTHREADS_NATIVE is not set
   66.71 +
   66.72 +#
   66.73 +# Binutils Options
   66.74 +#
   66.75 +# BR2_BINUTILS_VERSION_2_14_90_0_8 is not set
   66.76 +# BR2_BINUTILS_VERSION_2_15 is not set
   66.77 +# BR2_BINUTILS_VERSION_2_15_94_0_2_2 is not set
   66.78 +# BR2_BINUTILS_VERSION_2_16_1 is not set
   66.79 +# BR2_BINUTILS_VERSION_2_16_90_0_3 is not set
   66.80 +# BR2_BINUTILS_VERSION_2_16_91_0_5 is not set
   66.81 +# BR2_BINUTILS_VERSION_2_16_91_0_6 is not set
   66.82 +BR2_BINUTILS_VERSION_2_16_91_0_7=y
   66.83 +# BR2_BINUTILS_VERSION_2_17 is not set
   66.84 +# BR2_BINUTILS_VERSION_2_17_50_0_2 is not set
   66.85 +# BR2_BINUTILS_VERSION_2_17_50_0_3 is not set
   66.86 +# BR2_BINUTILS_VERSION_2_17_50_0_4 is not set
   66.87 +# BR2_BINUTILS_VERSION_2_17_50_0_5 is not set
   66.88 +# BR2_BINUTILS_VERSION_2_17_50_0_6 is not set
   66.89 +BR2_BINUTILS_VERSION="2.16.91.0.7"
   66.90 +BR2_EXTRA_BINUTILS_CONFIG_OPTIONS=""
   66.91 +
   66.92 +#
   66.93 +# Gcc Options
   66.94 +#
   66.95 +# BR2_GCC_VERSION_3_3_5 is not set
   66.96 +# BR2_GCC_VERSION_3_3_6 is not set
   66.97 +# BR2_GCC_VERSION_3_4_2 is not set
   66.98 +# BR2_GCC_VERSION_3_4_3 is not set
   66.99 +# BR2_GCC_VERSION_3_4_4 is not set
  66.100 +# BR2_GCC_VERSION_3_4_5 is not set
  66.101 +BR2_GCC_VERSION_3_4_6=y
  66.102 +# BR2_GCC_VERSION_4_0_0 is not set
  66.103 +# BR2_GCC_VERSION_4_0_1 is not set
  66.104 +# BR2_GCC_VERSION_4_0_2 is not set
  66.105 +# BR2_GCC_VERSION_4_0_3 is not set
  66.106 +# BR2_GCC_VERSION_4_1_0 is not set
  66.107 +# BR2_GCC_VERSION_4_1_1 is not set
  66.108 +# BR2_GCC_VERSION_4_2 is not set
  66.109 +# BR2_GCC_IS_SNAP is not set
  66.110 +BR2_GCC_VERSION="3.4.6"
  66.111 +# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set
  66.112 +BR2_EXTRA_GCC_CONFIG_OPTIONS=""
  66.113 +# BR2_INSTALL_LIBSTDCPP is not set
  66.114 +# BR2_INSTALL_OBJC is not set
  66.115 +# BR2_GCC_SHARED_LIBGCC is not set
  66.116 +
  66.117 +#
  66.118 +# Ccache Options
  66.119 +#
  66.120 +BR2_CCACHE=y
  66.121 +
  66.122 +#
  66.123 +# Gdb Options
  66.124 +#
  66.125 +# BR2_PACKAGE_GDB is not set
  66.126 +# BR2_PACKAGE_GDB_SERVER is not set
  66.127 +# BR2_PACKAGE_GDB_HOST is not set
  66.128 +
  66.129 +#
  66.130 +# elf2flt
  66.131 +#
  66.132 +# BR2_ELF2FLT is not set
  66.133 +# BR2_MKLIBS is not set
  66.134 +
  66.135 +#
  66.136 +# Common Toolchain Options
  66.137 +#
  66.138 +# BR2_PACKAGE_SSTRIP_TARGET is not set
  66.139 +# BR2_PACKAGE_SSTRIP_HOST is not set
  66.140 +BR2_ENABLE_MULTILIB=y
  66.141 +BR2_LARGEFILE=y
  66.142 +BR2_TARGET_OPTIMIZATION="-Os -pipe"
  66.143 +BR2_CROSS_TOOLCHAIN_TARGET_UTILS=y
  66.144 +
  66.145 +#
  66.146 +# Package Selection for the target
  66.147 +#
  66.148 +
  66.149 +#
  66.150 +# The default minimal system
  66.151 +#
  66.152 +BR2_PACKAGE_BUSYBOX=y
  66.153 +# BR2_PACKAGE_BUSYBOX_SNAPSHOT is not set
  66.154 +BR2_PACKAGE_BUSYBOX_INSTALL_SYMLINKS=y
  66.155 +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox.config"
  66.156 +
  66.157 +#
  66.158 +# The minimum needed to build a uClibc development system
  66.159 +#
  66.160 +# BR2_PACKAGE_BASH is not set
  66.161 +# BR2_PACKAGE_BZIP2 is not set
  66.162 +# BR2_PACKAGE_COREUTILS is not set
  66.163 +# BR2_PACKAGE_DIFFUTILS is not set
  66.164 +# BR2_PACKAGE_ED is not set
  66.165 +# BR2_PACKAGE_FINDUTILS is not set
  66.166 +# BR2_PACKAGE_FLEX is not set
  66.167 +# BR2_PACKAGE_GAWK is not set
  66.168 +# BR2_PACKAGE_GCC_TARGET is not set
  66.169 +# BR2_PACKAGE_CCACHE_TARGET is not set
  66.170 +# BR2_PACKAGE_GREP is not set
  66.171 +# BR2_PACKAGE_MAKE is not set
  66.172 +# BR2_PACKAGE_PATCH is not set
  66.173 +# BR2_PACKAGE_SED is not set
  66.174 +# BR2_PACKAGE_TAR is not set
  66.175 +
  66.176 +#
  66.177 +# Other stuff
  66.178 +#
  66.179 +# BR2_PACKAGE_ACPID is not set
  66.180 +# BR2_PACKAGE_ASTERISK is not set
  66.181 +# BR2_PACKAGE_AT is not set
  66.182 +# BR2_PACKAGE_AUTOCONF is not set
  66.183 +# BR2_PACKAGE_AUTOMAKE is not set
  66.184 +# BR2_PACKAGE_BERKELEYDB is not set
  66.185 +# BR2_PACKAGE_BIND is not set
  66.186 +# BR2_PACKAGE_BISON is not set
  66.187 +# BR2_PACKAGE_BOA is not set
  66.188 +# BR2_PACKAGE_BRIDGE is not set
  66.189 +# BR2_PACKAGE_CUSTOMIZE is not set
  66.190 +# BR2_PACKAGE_ISC_DHCP is not set
  66.191 +# BR2_PACKAGE_DIALOG is not set
  66.192 +# BR2_PACKAGE_DIRECTFB is not set
  66.193 +# BR2_PACKAGE_DISTCC is not set
  66.194 +# BR2_PACKAGE_DM is not set
  66.195 +# BR2_PACKAGE_DMRAID is not set
  66.196 +# BR2_PACKAGE_DNSMASQ is not set
  66.197 +# BR2_PACKAGE_DROPBEAR is not set
  66.198 +# BR2_PACKAGE_ETHTOOL is not set
  66.199 +# BR2_PACKAGE_EXPAT is not set
  66.200 +# BR2_PACKAGE_E2FSPROGS is not set
  66.201 +# BR2_PACKAGE_FAKEROOT is not set
  66.202 +# BR2_PACKAGE_FILE is not set
  66.203 +# BR2_PACKAGE_FREETYPE is not set
  66.204 +# BR2_PACKAGE_GETTEXT is not set
  66.205 +# BR2_PACKAGE_LIBINTL is not set
  66.206 +# BR2_PACKAGE_GZIP is not set
  66.207 +# BR2_PACKAGE_HASERL is not set
  66.208 +# BR2_PACKAGE_HDPARM is not set
  66.209 +# BR2_PACKAGE_HOSTAP is not set
  66.210 +# BR2_PACKAGE_HOTPLUG is not set
  66.211 +# BR2_PACKAGE_IOSTAT is not set
  66.212 +# BR2_PACKAGE_IPROUTE2 is not set
  66.213 +# BR2_PACKAGE_IPSEC_TOOLS is not set
  66.214 +# BR2_PACKAGE_IPTABLES is not set
  66.215 +# BR2_PACKAGE_JPEG is not set
  66.216 +# BR2_PACKAGE_LESS is not set
  66.217 +# BR2_PACKAGE_LIBCGI is not set
  66.218 +# BR2_PACKAGE_LIBCGICC is not set
  66.219 +# BR2_PACKAGE_LIBELF is not set
  66.220 +# BR2_PACKAGE_LIBFLOAT is not set
  66.221 +# BR2_PACKAGE_LIBGLIB12 is not set
  66.222 +# BR2_PACKAGE_LIBMAD is not set
  66.223 +# BR2_PACKAGE_LIBPCAP is not set
  66.224 +# BR2_PACKAGE_LIBPNG is not set
  66.225 +# BR2_PACKAGE_LIBSYSFS is not set
  66.226 +# BR2_PACKAGE_LIBTOOL is not set
  66.227 +# BR2_PACKAGE_LIBUSB is not set
  66.228 +# BR2_PACKAGE_LIGHTTPD is not set
  66.229 +# BR2_PACKAGE_LINKS is not set
  66.230 +# BR2_PACKAGE_LRZSZ is not set
  66.231 +# BR2_PACKAGE_LSOF is not set
  66.232 +# BR2_PACKAGE_LTP-TESTSUITE is not set
  66.233 +# BR2_PACKAGE_LTT is not set
  66.234 +# BR2_PACKAGE_LVM2 is not set
  66.235 +# BR2_PACKAGE_LZO is not set
  66.236 +# BR2_PACKAGE_LZMA is not set
  66.237 +# BR2_PACKAGE_M4 is not set
  66.238 +# BR2_PACKAGE_MDADM is not set
  66.239 +# BR2_PACKAGE_MEMTESTER is not set
  66.240 +# BR2_PACKAGE_MICROCOM is not set
  66.241 +# BR2_PACKAGE_MICROPERL is not set
  66.242 +# BR2_PACKAGE_MICROWIN is not set
  66.243 +# BR2_PACKAGE_MKDOSFS is not set
  66.244 +# BR2_PACKAGE_MODULE_INIT_TOOLS is not set
  66.245 +# BR2_PACKAGE_MODUTILS is not set
  66.246 +# BR2_PACKAGE_MPG123 is not set
  66.247 +# BR2_PACKAGE_MROUTED is not set
  66.248 +# BR2_PACKAGE_MTD is not set
  66.249 +# BR2_PACKAGE_NANO is not set
  66.250 +# BR2_PACKAGE_NBD is not set
  66.251 +# BR2_PACKAGE_NCURSES is not set
  66.252 +# BR2_PACKAGE_NETKITBASE is not set
  66.253 +# BR2_PACKAGE_NETKITTELNET is not set
  66.254 +# BR2_PACKAGE_NETSNMP is not set
  66.255 +# BR2_PACKAGE_NEWT is not set
  66.256 +# BR2_PACKAGE_NTP is not set
  66.257 +# BR2_PACKAGE_OPENNTPD is not set
  66.258 +# BR2_PACKAGE_OPENSSH is not set
  66.259 +# BR2_PACKAGE_OPENSSL is not set
  66.260 +# BR2_PACKAGE_OPENVPN is not set
  66.261 +# BR2_PACKAGE_PCIUTILS is not set
  66.262 +# BR2_PACKAGE_PKGCONFIG is not set
  66.263 +# BR2_PACKAGE_PORTAGE is not set
  66.264 +# BR2_PACKAGE_PORTMAP is not set
  66.265 +# BR2_PACKAGE_PPPD is not set
  66.266 +# BR2_PACKAGE_PROCPS is not set
  66.267 +# BR2_PACKAGE_PSMISC is not set
  66.268 +# BR2_PACKAGE_PYTHON is not set
  66.269 +# BR2_PACKAGE_QTE is not set
  66.270 +BR2_QTE_TMAKE_VERSION="1.13"
  66.271 +# BR2_PACKAGE_RAIDTOOLS is not set
  66.272 +# BR2_READLINE is not set
  66.273 +# BR2_PACKAGE_RSYNC is not set
  66.274 +# BR2_PACKAGE_RUBY is not set
  66.275 +# BR2_PACKAGE_RXVT is not set
  66.276 +# BR2_PACKAGE_SDL is not set
  66.277 +# BR2_PACKAGE_SFDISK is not set
  66.278 +# BR2_PACKAGE_SLANG is not set
  66.279 +# BR2_PACKAGE_SMARTMONTOOLS is not set
  66.280 +# BR2_PACKAGE_SOCAT is not set
  66.281 +# BR2_PACKAGE_SQLITE is not set
  66.282 +# BR2_PACKAGE_STRACE is not set
  66.283 +# BR2_PACKAGE_SUDO is not set
  66.284 +# BR2_PACKAGE_SYSKLOGD is not set
  66.285 +# BR2_PACKAGE_SYSVINIT is not set
  66.286 +# BR2_PACKAGE_TCL is not set
  66.287 +# BR2_PACKAGE_TCPDUMP is not set
  66.288 +# BR2_PACKAGE_TFTPD is not set
  66.289 +# BR2_PACKAGE_THTTPD is not set
  66.290 +# BR2_PACKAGE_TINYLOGIN is not set
  66.291 +# BR2_PACKAGE_TINYX is not set
  66.292 +# BR2_PACKAGE_TN5250 is not set
  66.293 +# BR2_PACKAGE_TTCP is not set
  66.294 +# BR2_PACKAGE_UDEV is not set
  66.295 +# BR2_PACKAGE_UDHCP is not set
  66.296 +# BR2_PACKAGE_UEMACS is not set
  66.297 +# BR2_PACKAGE_USBUTILS is not set
  66.298 +# BR2_PACKAGE_UTIL-LINUX is not set
  66.299 +# BR2_PACKAGE_VALGRIND is not set
  66.300 +# BR2_PACKAGE_VTUN is not set
  66.301 +# BR2_PACKAGE_WGET is not set
  66.302 +# BR2_PACKAGE_WHICH is not set
  66.303 +# BR2_PACKAGE_WIPE is not set
  66.304 +# BR2_PACKAGE_WIRELESS_TOOLS is not set
  66.305 +# BR2_PACKAGE_XFSPROGS is not set
  66.306 +# BR2_PACKAGE_ZLIB is not set
  66.307 +BR2_PACKAGE_HPING=y
  66.308 +
  66.309 +#
  66.310 +# Target Options
  66.311 +#
  66.312 +
  66.313 +#
  66.314 +# filesystem for target device
  66.315 +#
  66.316 +# BR2_TARGET_ROOTFS_CRAMFS is not set
  66.317 +# BR2_TARGET_ROOTFS_CLOOP is not set
  66.318 +BR2_TARGET_ROOTFS_EXT2=y
  66.319 +BR2_TARGET_ROOTFS_EXT2_BLOCKS=0
  66.320 +BR2_TARGET_ROOTFS_EXT2_INODES=0
  66.321 +BR2_TARGET_ROOTFS_EXT2_RESBLKS=0
  66.322 +BR2_TARGET_ROOTFS_EXT2_SQUASH=y
  66.323 +BR2_TARGET_ROOTFS_EXT2_OUTPUT="$(IMAGE).ext2"
  66.324 +# BR2_TARGET_ROOTFS_EXT2_GZ is not set
  66.325 +BR2_TARGET_ROOTFS_EXT2_COPYTO=""
  66.326 +# BR2_TARGET_ROOTFS_JFFS2 is not set
  66.327 +# BR2_TARGET_ROOTFS_SQUASHFS is not set
  66.328 +# BR2_TARGET_ROOTFS_TAR is not set
  66.329 +# BR2_TARGET_ROOTFS_ISO9660 is not set
  66.330 +
  66.331 +#
  66.332 +# bootloader for target device
  66.333 +#
  66.334 +# BR2_TARGET_GRUB is not set
  66.335 +# BR2_TARGET_SYSLINUX is not set
  66.336 +
  66.337 +#
  66.338 +# Board Support Options
  66.339 +#
  66.340 +# BR2_TARGET_SOEKRIS_NET4521 is not set
  66.341 +# BR2_TARGET_SOEKRIS_NET4801 is not set
  66.342 +# BR2_TARGET_VIA_EPIA_MII is not set
  66.343 +
  66.344 +#
  66.345 +# Generic System Support
  66.346 +#
  66.347 +# BR2_TARGET_GENERIC_ACCESS_POINT is not set
  66.348 +# BR2_TARGET_GENERIC_FIREWALL is not set
  66.349 +# BR2_TARGET_GENERIC_DEV_SYSTEM is not set
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/tools/xm-test/ramdisk/configs/buildroot-powerpc	Tue Oct 24 11:21:48 2006 -0600
    67.3 @@ -0,0 +1,338 @@
    67.4 +#
    67.5 +# Automatically generated make config: don't edit
    67.6 +#
    67.7 +BR2_HAVE_DOT_CONFIG=y
    67.8 +# BR2_alpha is not set
    67.9 +# BR2_arm is not set
   67.10 +# BR2_armeb is not set
   67.11 +# BR2_cris is not set
   67.12 +# BR2_i386 is not set
   67.13 +# BR2_m68k is not set
   67.14 +# BR2_mips is not set
   67.15 +# BR2_mipsel is not set
   67.16 +# BR2_nios2 is not set
   67.17 +BR2_powerpc=y
   67.18 +# BR2_sh is not set
   67.19 +# BR2_sh64 is not set
   67.20 +# BR2_sparc is not set
   67.21 +# BR2_x86_64 is not set
   67.22 +BR2_ARCH="powerpc"
   67.23 +BR2_ENDIAN="BIG"
   67.24 +
   67.25 +#
   67.26 +# Build options
   67.27 +#
   67.28 +BR2_WGET="wget --passive-ftp"
   67.29 +BR2_SVN="svn co"
   67.30 +BR2_ZCAT="zcat"
   67.31 +BR2_TAR_OPTIONS=""
   67.32 +BR2_DL_DIR="$(BASE_DIR)/dl"
   67.33 +BR2_SOURCEFORGE_MIRROR="easynews"
   67.34 +BR2_STAGING_DIR="$(BUILD_DIR)/staging_dir"
   67.35 +BR2_TOPDIR_PREFIX=""
   67.36 +BR2_TOPDIR_SUFFIX=""
   67.37 +BR2_GNU_BUILD_SUFFIX="pc-linux-gnu"
   67.38 +BR2_GNU_TARGET_SUFFIX="linux-uclibc"
   67.39 +BR2_JLEVEL=1
   67.40 +
   67.41 +#
   67.42 +# Toolchain Options
   67.43 +#
   67.44 +
   67.45 +#
   67.46 +# Kernel Header Options
   67.47 +#
   67.48 +# BR2_KERNEL_HEADERS_2_4_25 is not set
   67.49 +# BR2_KERNEL_HEADERS_2_4_27 is not set
   67.50 +# BR2_KERNEL_HEADERS_2_4_29 is not set
   67.51 +# BR2_KERNEL_HEADERS_2_4_31 is not set
   67.52 +# BR2_KERNEL_HEADERS_2_6_9 is not set
   67.53 +# BR2_KERNEL_HEADERS_2_6_11 is not set
   67.54 +BR2_KERNEL_HEADERS_2_6_12=y
   67.55 +# BR2_KERNEL_HEADERS_2_6_18 is not set
   67.56 +BR2_DEFAULT_KERNEL_HEADERS="2.6.12"
   67.57 +
   67.58 +#
   67.59 +# uClibc Options
   67.60 +#
   67.61 +# BR2_UCLIBC_VERSION_SNAPSHOT is not set
   67.62 +# BR2_ENABLE_LOCALE is not set
   67.63 +# BR2_PTHREADS_NONE is not set
   67.64 +# BR2_PTHREADS is not set
   67.65 +BR2_PTHREADS_OLD=y
   67.66 +# BR2_PTHREADS_NATIVE is not set
   67.67 +
   67.68 +#
   67.69 +# Binutils Options
   67.70 +#
   67.71 +# BR2_BINUTILS_VERSION_2_14_90_0_8 is not set
   67.72 +# BR2_BINUTILS_VERSION_2_15 is not set
   67.73 +# BR2_BINUTILS_VERSION_2_15_94_0_2_2 is not set
   67.74 +# BR2_BINUTILS_VERSION_2_16_1 is not set
   67.75 +# BR2_BINUTILS_VERSION_2_16_90_0_3 is not set
   67.76 +# BR2_BINUTILS_VERSION_2_16_91_0_5 is not set
   67.77 +# BR2_BINUTILS_VERSION_2_16_91_0_6 is not set
   67.78 +# BR2_BINUTILS_VERSION_2_16_91_0_7 is not set
   67.79 +BR2_BINUTILS_VERSION_2_17=y
   67.80 +# BR2_BINUTILS_VERSION_2_17_50_0_2 is not set
   67.81 +# BR2_BINUTILS_VERSION_2_17_50_0_3 is not set
   67.82 +# BR2_BINUTILS_VERSION_2_17_50_0_4 is not set
   67.83 +# BR2_BINUTILS_VERSION_2_17_50_0_5 is not set
   67.84 +# BR2_BINUTILS_VERSION_2_17_50_0_6 is not set
   67.85 +BR2_BINUTILS_VERSION="2.17"
   67.86 +BR2_EXTRA_BINUTILS_CONFIG_OPTIONS=""
   67.87 +
   67.88 +#
   67.89 +# Gcc Options
   67.90 +#
   67.91 +# BR2_GCC_VERSION_3_3_5 is not set
   67.92 +# BR2_GCC_VERSION_3_3_6 is not set
   67.93 +BR2_GCC_VERSION_3_4_2=y
   67.94 +# BR2_GCC_VERSION_3_4_3 is not set
   67.95 +# BR2_GCC_VERSION_3_4_4 is not set
   67.96 +# BR2_GCC_VERSION_3_4_5 is not set
   67.97 +# BR2_GCC_VERSION_3_4_6 is not set
   67.98 +# BR2_GCC_VERSION_4_0_0 is not set
   67.99 +# BR2_GCC_VERSION_4_0_1 is not set
  67.100 +# BR2_GCC_VERSION_4_0_2 is not set
  67.101 +# BR2_GCC_VERSION_4_0_3 is not set
  67.102 +# BR2_GCC_VERSION_4_1_0 is not set
  67.103 +# BR2_GCC_VERSION_4_1_1 is not set
  67.104 +# BR2_GCC_VERSION_4_2 is not set
  67.105 +# BR2_GCC_IS_SNAP is not set
  67.106 +BR2_GCC_VERSION="3.4.2"
  67.107 +# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set
  67.108 +BR2_EXTRA_GCC_CONFIG_OPTIONS=""
  67.109 +# BR2_INSTALL_LIBSTDCPP is not set
  67.110 +# BR2_INSTALL_OBJC is not set
  67.111 +# BR2_GCC_SHARED_LIBGCC is not set
  67.112 +
  67.113 +#
  67.114 +# Ccache Options
  67.115 +#
  67.116 +BR2_CCACHE=y
  67.117 +
  67.118 +#
  67.119 +# Gdb Options
  67.120 +#
  67.121 +# BR2_PACKAGE_GDB is not set
  67.122 +# BR2_PACKAGE_GDB_SERVER is not set
  67.123 +# BR2_PACKAGE_GDB_HOST is not set
  67.124 +
  67.125 +#
  67.126 +# elf2flt
  67.127 +#
  67.128 +# BR2_ELF2FLT is not set
  67.129 +# BR2_MKLIBS is not set
  67.130 +
  67.131 +#
  67.132 +# Common Toolchain Options
  67.133 +#
  67.134 +# BR2_PACKAGE_SSTRIP_TARGET is not set
  67.135 +# BR2_PACKAGE_SSTRIP_HOST is not set
  67.136 +BR2_ENABLE_MULTILIB=y
  67.137 +BR2_LARGEFILE=y
  67.138 +# BR2_SOFT_FLOAT is not set
  67.139 +BR2_TARGET_OPTIMIZATION="-Os -pipe"
  67.140 +BR2_CROSS_TOOLCHAIN_TARGET_UTILS=y
  67.141 +
  67.142 +#
  67.143 +# Package Selection for the target
  67.144 +#
  67.145 +
  67.146 +#
  67.147 +# The default minimal system
  67.148 +#
  67.149 +BR2_PACKAGE_BUSYBOX=y
  67.150 +# BR2_PACKAGE_BUSYBOX_SNAPSHOT is not set
  67.151 +BR2_PACKAGE_BUSYBOX_INSTALL_SYMLINKS=y
  67.152 +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox.config"
  67.153 +
  67.154 +#
  67.155 +# The minimum needed to build a uClibc development system
  67.156 +#
  67.157 +# BR2_PACKAGE_BASH is not set
  67.158 +# BR2_PACKAGE_BZIP2 is not set
  67.159 +# BR2_PACKAGE_COREUTILS is not set
  67.160 +# BR2_PACKAGE_DIFFUTILS is not set
  67.161 +# BR2_PACKAGE_ED is not set
  67.162 +# BR2_PACKAGE_FINDUTILS is not set
  67.163 +# BR2_PACKAGE_FLEX is not set
  67.164 +# BR2_PACKAGE_GAWK is not set
  67.165 +# BR2_PACKAGE_GCC_TARGET is not set
  67.166 +# BR2_PACKAGE_CCACHE_TARGET is not set
  67.167 +# BR2_PACKAGE_GREP is not set
  67.168 +# BR2_PACKAGE_MAKE is not set
  67.169 +# BR2_PACKAGE_PATCH is not set
  67.170 +# BR2_PACKAGE_SED is not set
  67.171 +# BR2_PACKAGE_TAR is not set
  67.172 +
  67.173 +#
  67.174 +# Other stuff
  67.175 +#
  67.176 +# BR2_PACKAGE_ACPID is not set
  67.177 +# BR2_PACKAGE_ASTERISK is not set
  67.178 +# BR2_PACKAGE_AT is not set
  67.179 +# BR2_PACKAGE_AUTOCONF is not set
  67.180 +# BR2_PACKAGE_AUTOMAKE is not set
  67.181 +# BR2_PACKAGE_BERKELEYDB is not set
  67.182 +# BR2_PACKAGE_BIND is not set
  67.183 +# BR2_PACKAGE_BISON is not set
  67.184 +# BR2_PACKAGE_BOA is not set
  67.185 +# BR2_PACKAGE_BRIDGE is not set
  67.186 +# BR2_PACKAGE_CUSTOMIZE is not set
  67.187 +# BR2_PACKAGE_ISC_DHCP is not set
  67.188 +# BR2_PACKAGE_DIALOG is not set
  67.189 +# BR2_PACKAGE_DIRECTFB is not set
  67.190 +# BR2_PACKAGE_DISTCC is not set
  67.191 +# BR2_PACKAGE_DM is not set
  67.192 +# BR2_PACKAGE_DMRAID is not set
  67.193 +# BR2_PACKAGE_DNSMASQ is not set
  67.194 +# BR2_PACKAGE_DROPBEAR is not set
  67.195 +# BR2_PACKAGE_ETHTOOL is not set
  67.196 +# BR2_PACKAGE_EXPAT is not set
  67.197 +# BR2_PACKAGE_E2FSPROGS is not set
  67.198 +# BR2_PACKAGE_FAKEROOT is not set
  67.199 +# BR2_PACKAGE_FILE is not set
  67.200 +# BR2_PACKAGE_FREETYPE is not set
  67.201 +# BR2_PACKAGE_GETTEXT is not set
  67.202 +# BR2_PACKAGE_LIBINTL is not set
  67.203 +# BR2_PACKAGE_GZIP is not set
  67.204 +# BR2_PACKAGE_HASERL is not set
  67.205 +# BR2_PACKAGE_HDPARM is not set
  67.206 +# BR2_PACKAGE_HOSTAP is not set
  67.207 +# BR2_PACKAGE_HOTPLUG is not set
  67.208 +# BR2_PACKAGE_IOSTAT is not set
  67.209 +# BR2_PACKAGE_IPROUTE2 is not set
  67.210 +# BR2_PACKAGE_IPSEC_TOOLS is not set
  67.211 +# BR2_PACKAGE_IPTABLES is not set
  67.212 +# BR2_PACKAGE_JPEG is not set
  67.213 +# BR2_PACKAGE_LESS is not set
  67.214 +# BR2_PACKAGE_LIBCGI is not set
  67.215 +# BR2_PACKAGE_LIBCGICC is not set
  67.216 +# BR2_PACKAGE_LIBELF is not set
  67.217 +# BR2_PACKAGE_LIBFLOAT is not set
  67.218 +# BR2_PACKAGE_LIBGLIB12 is not set
  67.219 +# BR2_PACKAGE_LIBMAD is not set
  67.220 +# BR2_PACKAGE_LIBPCAP is not set
  67.221 +# BR2_PACKAGE_LIBPNG is not set
  67.222 +# BR2_PACKAGE_LIBSYSFS is not set
  67.223 +# BR2_PACKAGE_LIBTOOL is not set
  67.224 +# BR2_PACKAGE_LIBUSB is not set
  67.225 +# BR2_PACKAGE_LIGHTTPD is not set
  67.226 +# BR2_PACKAGE_LINKS is not set
  67.227 +# BR2_PACKAGE_LRZSZ is not set
  67.228 +# BR2_PACKAGE_LSOF is not set
  67.229 +# BR2_PACKAGE_LTP-TESTSUITE is not set
  67.230 +# BR2_PACKAGE_LTT is not set
  67.231 +# BR2_PACKAGE_LVM2 is not set
  67.232 +# BR2_PACKAGE_LZO is not set
  67.233 +# BR2_PACKAGE_LZMA is not set
  67.234 +# BR2_PACKAGE_M4 is not set
  67.235 +# BR2_PACKAGE_MDADM is not set
  67.236 +# BR2_PACKAGE_MEMTESTER is not set
  67.237 +# BR2_PACKAGE_MICROCOM is not set
  67.238 +# BR2_PACKAGE_MICROPERL is not set
  67.239 +# BR2_PACKAGE_MICROWIN is not set
  67.240 +# BR2_PACKAGE_MKDOSFS is not set
  67.241 +# BR2_PACKAGE_MODULE_INIT_TOOLS is not set
  67.242 +# BR2_PACKAGE_MODUTILS is not set
  67.243 +# BR2_PACKAGE_MPG123 is not set
  67.244 +# BR2_PACKAGE_MROUTED is not set
  67.245 +# BR2_PACKAGE_MTD is not set
  67.246 +# BR2_PACKAGE_NANO is not set
  67.247 +# BR2_PACKAGE_NBD is not set
  67.248 +# BR2_PACKAGE_NCURSES is not set
  67.249 +# BR2_PACKAGE_NETKITBASE is not set
  67.250 +# BR2_PACKAGE_NETKITTELNET is not set
  67.251 +# BR2_PACKAGE_NETSNMP is not set
  67.252 +# BR2_PACKAGE_NEWT is not set
  67.253 +# BR2_PACKAGE_NTP is not set
  67.254 +# BR2_PACKAGE_OPENNTPD is not set
  67.255 +# BR2_PACKAGE_OPENSSH is not set
  67.256 +# BR2_PACKAGE_OPENSSL is not set
  67.257 +# BR2_PACKAGE_OPENVPN is not set
  67.258 +# BR2_PACKAGE_PCIUTILS is not set
  67.259 +# BR2_PACKAGE_PKGCONFIG is not set
  67.260 +# BR2_PACKAGE_PORTAGE is not set
  67.261 +# BR2_PACKAGE_PORTMAP is not set
  67.262 +# BR2_PACKAGE_PPPD is not set
  67.263 +# BR2_PACKAGE_PROCPS is not set
  67.264 +# BR2_PACKAGE_PSMISC is not set
  67.265 +# BR2_PACKAGE_PYTHON is not set
  67.266 +# BR2_PACKAGE_QTE is not set
  67.267 +BR2_QTE_TMAKE_VERSION="1.13"
  67.268 +# BR2_PACKAGE_RAIDTOOLS is not set
  67.269 +# BR2_READLINE is not set
  67.270 +# BR2_PACKAGE_RSYNC is not set
  67.271 +# BR2_PACKAGE_RUBY is not set
  67.272 +# BR2_PACKAGE_RXVT is not set
  67.273 +# BR2_PACKAGE_SDL is not set
  67.274 +# BR2_PACKAGE_SFDISK is not set
  67.275 +# BR2_PACKAGE_SLANG is not set
  67.276 +# BR2_PACKAGE_SMARTMONTOOLS is not set
  67.277 +# BR2_PACKAGE_SOCAT is not set
  67.278 +# BR2_PACKAGE_SQLITE is not set
  67.279 +# BR2_PACKAGE_STRACE is not set
  67.280 +# BR2_PACKAGE_SUDO is not set
  67.281 +# BR2_PACKAGE_SYSKLOGD is not set
  67.282 +# BR2_PACKAGE_SYSVINIT is not set
  67.283 +# BR2_PACKAGE_TCL is not set
  67.284 +# BR2_PACKAGE_TCPDUMP is not set
  67.285 +# BR2_PACKAGE_TFTPD is not set
  67.286 +# BR2_PACKAGE_THTTPD is not set
  67.287 +# BR2_PACKAGE_TINYLOGIN is not set
  67.288 +# BR2_PACKAGE_TINYX is not set
  67.289 +# BR2_PACKAGE_TN5250 is not set
  67.290 +# BR2_PACKAGE_TTCP is not set
  67.291 +# BR2_PACKAGE_UDEV is not set
  67.292 +# BR2_PACKAGE_UDHCP is not set
  67.293 +# BR2_PACKAGE_UEMACS is not set
  67.294 +# BR2_PACKAGE_USBUTILS is not set
  67.295 +# BR2_PACKAGE_UTIL-LINUX is not set
  67.296 +# BR2_PACKAGE_VALGRIND is not set
  67.297 +# BR2_PACKAGE_VTUN is not set
  67.298 +# BR2_PACKAGE_WGET is not set
  67.299 +# BR2_PACKAGE_WHICH is not set
  67.300 +# BR2_PACKAGE_WIPE is not set
  67.301 +# BR2_PACKAGE_WIRELESS_TOOLS is not set
  67.302 +# BR2_PACKAGE_XFSPROGS is not set
  67.303 +# BR2_PACKAGE_ZLIB is not set
  67.304 +BR2_PACKAGE_HPING=y
  67.305 +
  67.306 +#
  67.307 +# Target Options
  67.308 +#
  67.309 +
  67.310 +#
  67.311 +# filesystem for target device
  67.312 +#
  67.313 +# BR2_TARGET_ROOTFS_CRAMFS is not set
  67.314 +# BR2_TARGET_ROOTFS_CLOOP is not set
  67.315 +BR2_TARGET_ROOTFS_EXT2=y
  67.316 +BR2_TARGET_ROOTFS_EXT2_BLOCKS=0
  67.317 +BR2_TARGET_ROOTFS_EXT2_INODES=0
  67.318 +BR2_TARGET_ROOTFS_EXT2_RESBLKS=0
  67.319 +BR2_TARGET_ROOTFS_EXT2_SQUASH=y
  67.320 +BR2_TARGET_ROOTFS_EXT2_OUTPUT="$(IMAGE).ext2"
  67.321 +# BR2_TARGET_ROOTFS_EXT2_GZ is not set
  67.322 +BR2_TARGET_ROOTFS_EXT2_COPYTO=""
  67.323 +# BR2_TARGET_ROOTFS_JFFS2 is not set
  67.324 +# BR2_TARGET_ROOTFS_SQUASHFS is not set
  67.325 +# BR2_TARGET_ROOTFS_TAR is not set
  67.326 +
  67.327 +#
  67.328 +# bootloader for target device
  67.329 +#
  67.330 +# BR2_TARGET_YABOOT is not set
  67.331 +
  67.332 +#
  67.333 +# Board Support Options
  67.334 +#
  67.335 +
  67.336 +#
  67.337 +# Generic System Support
  67.338 +#
  67.339 +# BR2_TARGET_GENERIC_ACCESS_POINT is not set
  67.340 +# BR2_TARGET_GENERIC_FIREWALL is not set
  67.341 +# BR2_TARGET_GENERIC_DEV_SYSTEM is not set
    68.1 --- a/tools/xm-test/runtest.sh	Tue Oct 24 10:08:30 2006 -0600
    68.2 +++ b/tools/xm-test/runtest.sh	Tue Oct 24 11:21:48 2006 -0600
    68.3 @@ -76,9 +76,11 @@ runnable_tests() {
    68.4      # using the right version
    68.5      realrd=$(readlink ramdisk/initrd.img)
    68.6      eval $(./lib/XmTestReport/xmtest.py)
    68.7 -    rrdver="initrd-${XM_TEST_MAJ}.${XM_TEST_MIN}.img"
    68.8 +    ARCH=$(uname -m | sed -e s/i.86/i386/ -e 's/ppc\(64\)*/powerpc/')
    68.9 +    rrdver="initrd-${XM_TEST_MAJ}.${XM_TEST_MIN}-${ARCH}.img"
   68.10      if [ "$realrd" != "$rrdver" ]; then
   68.11 -	echo "Error: ramdisk/initrd.img is from an old version"
   68.12 +	echo "Error: ramdisk/initrd.img is from an old version, or is not for this "
   68.13 +        echo "architecture ($ARCH)."
   68.14  	echo "You need to build a ramdisk from at least ${XM_TEST_MAJ}.${XM_TEST_MIN}"
   68.15  	exit 1
   68.16      fi
   68.17 @@ -197,7 +199,10 @@ run=yes
   68.18  unsafe=no
   68.19  GROUPENTERED=default
   68.20  
   68.21 -cp -f tests/security-acm/xm-test-security_policy.xml /etc/xen/acm-security/policies
   68.22 +if [ -d /etc/xen/acm-security/policies ]; then
   68.23 +	cp -f tests/security-acm/xm-test-security_policy.xml \
   68.24 +	      /etc/xen/acm-security/policies
   68.25 +fi
   68.26  
   68.27  # Resolve options
   68.28  while [ $# -gt 0 ]
    69.1 --- a/tools/xm-test/tests/create/11_create_concurrent_pos.py	Tue Oct 24 10:08:30 2006 -0600
    69.2 +++ b/tools/xm-test/tests/create/11_create_concurrent_pos.py	Tue Oct 24 11:21:48 2006 -0600
    69.3 @@ -16,7 +16,7 @@ else:
    69.4      MAX_DOMS = 50
    69.5  
    69.6  MIN_DOMS    = 5
    69.7 -MEM_PER_DOM = 24
    69.8 +MEM_PER_DOM = minSafeMem()
    69.9  
   69.10  domains = []
   69.11  console = []
    70.1 --- a/tools/xm-test/tests/create/12_create_concurrent_stress_pos.py	Tue Oct 24 10:08:30 2006 -0600
    70.2 +++ b/tools/xm-test/tests/create/12_create_concurrent_stress_pos.py	Tue Oct 24 11:21:48 2006 -0600
    70.3 @@ -8,11 +8,18 @@ from XmTestLib import *
    70.4  import time
    70.5  
    70.6  DOMS=5
    70.7 -MEM=32
    70.8 +MEM=minSafeMem()
    70.9  DUR=60
   70.10  
   70.11  domains = []
   70.12  
   70.13 +free_mem = int(getInfo("free_memory"))
   70.14 +NUM_DOMS = int(free_mem / MEM)
   70.15 +
   70.16 +if NUM_DOMS < DOMS:
   70.17 +    SKIP("Need %i MB of RAM to start %i@%iMB domains! (%i MB avail)" %
   70.18 +         (DOMS * MEM, DOMS, MEM, free_mem))
   70.19 +
   70.20  for i in range(0,DOMS):
   70.21      dom = XmTestDomain(extraConfig={"memory" : MEM})
   70.22  
    71.1 --- a/tools/xm-test/tests/create/15_create_smallmem_pos.py	Tue Oct 24 10:08:30 2006 -0600
    71.2 +++ b/tools/xm-test/tests/create/15_create_smallmem_pos.py	Tue Oct 24 11:21:48 2006 -0600
    71.3 @@ -5,8 +5,8 @@
    71.4  
    71.5  from XmTestLib import *
    71.6  
    71.7 -# 32MBs is the default lower limit for creating domains, it should work
    71.8 -MEM = 32
    71.9 +# Create a domain with the minimum memory allocation
   71.10 +MEM = minSafeMem()
   71.11  
   71.12  domain = XmTestDomain(extraConfig={"memory": MEM,
   71.13                                     "extra" :"mem=%iM" % MEM})
    72.1 --- a/tools/xm-test/tests/create/16_create_smallmem_neg.py	Tue Oct 24 10:08:30 2006 -0600
    72.2 +++ b/tools/xm-test/tests/create/16_create_smallmem_neg.py	Tue Oct 24 11:21:48 2006 -0600
    72.3 @@ -3,6 +3,7 @@
    72.4  # Copyright (C) International Business Machines Corp., 2005
    72.5  # Author: Dan Smith <danms@us.ibm.com>
    72.6  
    72.7 +import re
    72.8  from XmTestLib import *
    72.9  
   72.10  # This is under the default lower limit of 32 and we expect this test
   72.11 @@ -16,13 +17,14 @@ try:
   72.12      console = domain.start()
   72.13      console.runCmd("ls")
   72.14  except DomainError, e:
   72.15 -    FAIL("Unable to start a domain with %i MB" % MEM)
   72.16 +    if not re.search('^Error: Domain memory must be at least \d+ KB', e.extra):
   72.17 +        # PPC gracefully fails like this, rather than crashing.
   72.18 +        FAIL("Unable to start a domain with %i MB" % MEM)
   72.19  except ConsoleError, e:
   72.20      if e.reason == RUNAWAY:
   72.21          print "Domain with %i MB has runaway console as expected" % MEM
   72.22 -    else:
   72.23 -        print "Starting a domain with %i MB failed as expected" % MEM
   72.24  else:
   72.25      FAIL("Starting a console with %i MB passed, expected test to fail" % MEM)
   72.26  
   72.27 +print "Starting a domain with %i MB failed as expected" % MEM
   72.28  domain.destroy()
    73.1 --- a/xen/arch/ia64/linux-xen/setup.c	Tue Oct 24 10:08:30 2006 -0600
    73.2 +++ b/xen/arch/ia64/linux-xen/setup.c	Tue Oct 24 11:21:48 2006 -0600
    73.3 @@ -803,7 +803,7 @@ cpu_init (void)
    73.4  	cpu_data = per_cpu_init();
    73.5  
    73.6  #ifdef XEN
    73.7 -	printf ("cpu_init: current=%p\n", current);
    73.8 +	printk("cpu_init: current=%p\n", current);
    73.9  #endif
   73.10  
   73.11  	/*
    74.1 --- a/xen/arch/ia64/vmx/mmio.c	Tue Oct 24 10:08:30 2006 -0600
    74.2 +++ b/xen/arch/ia64/vmx/mmio.c	Tue Oct 24 11:21:48 2006 -0600
    74.3 @@ -80,7 +80,7 @@ static void pib_write(VCPU *vcpu, void *
    74.4              }
    74.5          }
    74.6          else {      // upper half
    74.7 -            printf("IPI-UHF write %lx\n",pib_off);
    74.8 +            printk("IPI-UHF write %lx\n",pib_off);
    74.9              panic_domain(NULL,"Not support yet for SM-VP\n");
   74.10          }
   74.11          break;
   74.12 @@ -114,7 +114,7 @@ static void pib_read(VCPU *vcpu, uint64_
   74.13              }
   74.14              else {
   74.15  #ifdef  IPI_DEBUG
   74.16 -                printf("IPI-LHF read %lx\n",pib_off);
   74.17 +                printk("IPI-LHF read %lx\n",pib_off);
   74.18  #endif
   74.19                  *(uint64_t *)dest = 0;  // TODO for SM-VP
   74.20              }
   74.21 @@ -125,7 +125,7 @@ static void pib_read(VCPU *vcpu, uint64_
   74.22              }
   74.23              else {
   74.24  #ifdef  IPI_DEBUG
   74.25 -                printf("IPI-UHF read %lx\n",pib_off);
   74.26 +                printk("IPI-UHF read %lx\n",pib_off);
   74.27  #endif
   74.28                  *(uint8_t *)dest = 0;   // TODO for SM-VP
   74.29              }
   74.30 @@ -321,7 +321,7 @@ memread_p(VCPU *vcpu, u64 *src, u64 *des
   74.31  static void deliver_ipi (VCPU *vcpu, uint64_t dm, uint64_t vector)
   74.32  {
   74.33  #ifdef  IPI_DEBUG
   74.34 -  printf ("deliver_ipi %lx %lx\n",dm,vector);
   74.35 +  printk ("deliver_ipi %lx %lx\n",dm,vector);
   74.36  #endif
   74.37      switch ( dm ) {
   74.38      case 0:     // INT
   74.39 @@ -387,7 +387,7 @@ static void write_ipi (VCPU *vcpu, uint6
   74.40          memset (&c, 0, sizeof (c));
   74.41  
   74.42          if (arch_set_info_guest (targ, &c) != 0) {
   74.43 -            printf ("arch_boot_vcpu: failure\n");
   74.44 +            printk ("arch_boot_vcpu: failure\n");
   74.45              return;
   74.46          }
   74.47          /* First or next rendez-vous: set registers.  */
   74.48 @@ -397,11 +397,11 @@ static void write_ipi (VCPU *vcpu, uint6
   74.49  
   74.50          if (test_and_clear_bit(_VCPUF_down,&targ->vcpu_flags)) {
   74.51              vcpu_wake(targ);
   74.52 -            printf ("arch_boot_vcpu: vcpu %d awaken %016lx!\n",
   74.53 +            printk ("arch_boot_vcpu: vcpu %d awaken %016lx!\n",
   74.54                      targ->vcpu_id, targ_regs->cr_iip);
   74.55          }
   74.56          else
   74.57 -            printf ("arch_boot_vcpu: huu, already awaken!");
   74.58 +            printk ("arch_boot_vcpu: huu, already awaken!");
   74.59      }
   74.60      else {
   74.61          int running = test_bit(_VCPUF_running,&targ->vcpu_flags);
    75.1 --- a/xen/arch/ia64/vmx/vmx_phy_mode.c	Tue Oct 24 10:08:30 2006 -0600
    75.2 +++ b/xen/arch/ia64/vmx/vmx_phy_mode.c	Tue Oct 24 11:21:48 2006 -0600
    75.3 @@ -246,7 +246,7 @@ switch_mm_mode(VCPU *vcpu, IA64_PSR old_
    75.4      perfc_incra(vmx_switch_mm_mode, act);
    75.5      switch (act) {
    75.6      case SW_V2P:
    75.7 -//        printf("V -> P mode transition: (0x%lx -> 0x%lx)\n",
    75.8 +//        printk("V -> P mode transition: (0x%lx -> 0x%lx)\n",
    75.9  //               old_psr.val, new_psr.val);
   75.10          vcpu->arch.old_rsc = regs->ar_rsc;
   75.11          switch_to_physical_rid(vcpu);
   75.12 @@ -258,7 +258,7 @@ switch_mm_mode(VCPU *vcpu, IA64_PSR old_
   75.13          vcpu->arch.mode_flags |= GUEST_IN_PHY;
   75.14          break;
   75.15      case SW_P2V:
   75.16 -//        printf("P -> V mode transition: (0x%lx -> 0x%lx)\n",
   75.17 +//        printk("P -> V mode transition: (0x%lx -> 0x%lx)\n",
   75.18  //               old_psr.val, new_psr.val);
   75.19          switch_to_virtual_rid(vcpu);
   75.20          /*
   75.21 @@ -269,11 +269,11 @@ switch_mm_mode(VCPU *vcpu, IA64_PSR old_
   75.22          vcpu->arch.mode_flags &= ~GUEST_IN_PHY;
   75.23          break;
   75.24      case SW_SELF:
   75.25 -        printf("Switch to self-0x%lx!!! MM mode doesn't change...\n",
   75.26 +        printk("Switch to self-0x%lx!!! MM mode doesn't change...\n",
   75.27              old_psr.val);
   75.28          break;
   75.29      case SW_NOP:
   75.30 -//        printf("No action required for mode transition: (0x%lx -> 0x%lx)\n",
   75.31 +//        printk("No action required for mode transition: (0x%lx -> 0x%lx)\n",
   75.32  //               old_psr.val, new_psr.val);
   75.33          break;
   75.34      default:
    76.1 --- a/xen/arch/ia64/vmx/vmx_vcpu.c	Tue Oct 24 10:08:30 2006 -0600
    76.2 +++ b/xen/arch/ia64/vmx/vmx_vcpu.c	Tue Oct 24 11:21:48 2006 -0600
    76.3 @@ -274,7 +274,7 @@ check_entry(u64 va, u64 ps, char *str)
    76.4        va == 0x600000000000C000UL ) {
    76.5      stop();
    76.6       }
    76.7 -     if (tlb_debug) printf("%s at %lx %lx\n", str, va, 1UL<<ps);
    76.8 +     if (tlb_debug) printk("%s at %lx %lx\n", str, va, 1UL<<ps);
    76.9  }
   76.10  #endif
   76.11  
    77.1 --- a/xen/arch/ia64/vmx/vmx_virt.c	Tue Oct 24 10:08:30 2006 -0600
    77.2 +++ b/xen/arch/ia64/vmx/vmx_virt.c	Tue Oct 24 11:21:48 2006 -0600
    77.3 @@ -1364,7 +1364,7 @@ vmx_emulate(VCPU *vcpu, REGS *regs)
    77.4  #endif
    77.5  #if 0
    77.6  if ( (cause == 0xff && opcode == 0x1e000000000) || cause == 0 ) {
    77.7 -		printf ("VMAL decode error: cause - %lx; op - %lx\n", 
    77.8 +		printk ("VMAL decode error: cause - %lx; op - %lx\n", 
    77.9  			cause, opcode );
   77.10  		return;
   77.11  }
   77.12 @@ -1381,7 +1381,7 @@ if ( (cause == 0xff && opcode == 0x1e000
   77.13      else if (slot == 1)
   77.14          inst.inst = bundle.slot1a + (bundle.slot1b<<18);
   77.15      else if (slot == 2) inst.inst = bundle.slot2;
   77.16 -    else printf("priv_handle_op: illegal slot: %d\n", slot);
   77.17 +    else printk("priv_handle_op: illegal slot: %d\n", slot);
   77.18      slot_type = slot_types[bundle.template][slot];
   77.19      ia64_priv_decoder(slot_type, inst, &cause);
   77.20      if(cause==0){
   77.21 @@ -1554,7 +1554,7 @@ if ( (cause == 0xff && opcode == 0x1e000
   77.22          status=vmx_emul_mov_from_cpuid(vcpu, inst);
   77.23          break;
   77.24      case EVENT_VMSW:
   77.25 -        printf ("Unimplemented instruction %ld\n", cause);
   77.26 +        printk ("Unimplemented instruction %ld\n", cause);
   77.27  	status=IA64_FAULT;
   77.28          break;
   77.29      default:
    78.1 --- a/xen/arch/ia64/xen/dom0_ops.c	Tue Oct 24 10:08:30 2006 -0600
    78.2 +++ b/xen/arch/ia64/xen/dom0_ops.c	Tue Oct 24 11:21:48 2006 -0600
    78.3 @@ -171,7 +171,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
    78.4      }
    78.5      break;
    78.6      default:
    78.7 -        printf("arch_do_domctl: unrecognized domctl: %d!!!\n",op->cmd);
    78.8 +        printk("arch_do_domctl: unrecognized domctl: %d!!!\n",op->cmd);
    78.9          ret = -ENOSYS;
   78.10  
   78.11      }
   78.12 @@ -211,7 +211,7 @@ long arch_do_sysctl(xen_sysctl_t *op, XE
   78.13      break;
   78.14  
   78.15      default:
   78.16 -        printf("arch_do_sysctl: unrecognized sysctl: %d!!!\n",op->cmd);
   78.17 +        printk("arch_do_sysctl: unrecognized sysctl: %d!!!\n",op->cmd);
   78.18          ret = -ENOSYS;
   78.19  
   78.20      }
   78.21 @@ -278,7 +278,7 @@ do_dom0vp_op(unsigned long cmd,
   78.22          break;
   78.23      default:
   78.24          ret = -1;
   78.25 -		printf("unknown dom0_vp_op 0x%lx\n", cmd);
   78.26 +		printk("unknown dom0_vp_op 0x%lx\n", cmd);
   78.27          break;
   78.28      }
   78.29  
    79.1 --- a/xen/arch/ia64/xen/dom_fw.c	Tue Oct 24 10:08:30 2006 -0600
    79.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Tue Oct 24 11:21:48 2006 -0600
    79.3 @@ -204,9 +204,9 @@ print_md(efi_memory_desc_t *md)
    79.4  
    79.5  	size = md->num_pages << EFI_PAGE_SHIFT;
    79.6  	if (size > ONE_MB)
    79.7 -		printf ("(%luMB)\n", size >> 20);
    79.8 +		printk ("(%luMB)\n", size >> 20);
    79.9  	else
   79.10 -		printf ("(%luKB)\n", size >> 10);
   79.11 +		printk ("(%luKB)\n", size >> 10);
   79.12  }
   79.13  
   79.14  static u32 lsapic_nbr;
   79.15 @@ -574,7 +574,7 @@ complete_dom0_memmap(struct domain *d,
   79.16  
   79.17  		default:
   79.18  			/* Print a warning but continue.  */
   79.19 -			printf("complete_dom0_memmap: warning: "
   79.20 +			printk("complete_dom0_memmap: warning: "
   79.21  			       "unhandled MDT entry type %u\n", md->type);
   79.22  		}
   79.23  	}
   79.24 @@ -734,47 +734,47 @@ dom_fw_init(struct domain *d,
   79.25  		/* Write messages to the console.  */
   79.26  		touch_acpi_table();
   79.27  
   79.28 -		printf("Domain0 EFI passthrough:");
   79.29 +		printk("Domain0 EFI passthrough:");
   79.30  		if (efi.mps) {
   79.31  			tables->efi_tables[i].guid = MPS_TABLE_GUID;
   79.32  			tables->efi_tables[i].table = __pa(efi.mps);
   79.33 -			printf(" MPS=0x%lx",tables->efi_tables[i].table);
   79.34 +			printk(" MPS=0x%lx",tables->efi_tables[i].table);
   79.35  			i++;
   79.36  		}
   79.37  
   79.38  		if (efi.acpi20) {
   79.39  			tables->efi_tables[i].guid = ACPI_20_TABLE_GUID;
   79.40  			tables->efi_tables[i].table = __pa(efi.acpi20);
   79.41 -			printf(" ACPI 2.0=0x%lx",tables->efi_tables[i].table);
   79.42 +			printk(" ACPI 2.0=0x%lx",tables->efi_tables[i].table);
   79.43  			i++;
   79.44  		}
   79.45  		if (efi.acpi) {
   79.46  			tables->efi_tables[i].guid = ACPI_TABLE_GUID;
   79.47  			tables->efi_tables[i].table = __pa(efi.acpi);
   79.48 -			printf(" ACPI=0x%lx",tables->efi_tables[i].table);
   79.49 +			printk(" ACPI=0x%lx",tables->efi_tables[i].table);
   79.50  			i++;
   79.51  		}
   79.52  		if (efi.smbios) {
   79.53  			tables->efi_tables[i].guid = SMBIOS_TABLE_GUID;
   79.54  			tables->efi_tables[i].table = __pa(efi.smbios);
   79.55 -			printf(" SMBIOS=0x%lx",tables->efi_tables[i].table);
   79.56 +			printk(" SMBIOS=0x%lx",tables->efi_tables[i].table);
   79.57  			i++;
   79.58  		}
   79.59  		if (efi.hcdp) {
   79.60  			tables->efi_tables[i].guid = HCDP_TABLE_GUID;
   79.61  			tables->efi_tables[i].table = __pa(efi.hcdp);
   79.62 -			printf(" HCDP=0x%lx",tables->efi_tables[i].table);
   79.63 +			printk(" HCDP=0x%lx",tables->efi_tables[i].table);
   79.64  			i++;
   79.65  		}
   79.66 -		printf("\n");
   79.67 +		printk("\n");
   79.68  	} else {
   79.69 -		printf("DomainU EFI build up:");
   79.70 +		printk("DomainU EFI build up:");
   79.71  
   79.72  		tables->efi_tables[i].guid = ACPI_20_TABLE_GUID;
   79.73  		tables->efi_tables[i].table = FW_ACPI_BASE_PADDR;
   79.74 -		printf(" ACPI 2.0=0x%lx",tables->efi_tables[i].table);
   79.75 +		printk(" ACPI 2.0=0x%lx",tables->efi_tables[i].table);
   79.76  		i++;
   79.77 -		printf("\n");
   79.78 +		printk("\n");
   79.79  	}
   79.80  
   79.81  	/* fill in the SAL system table: */
    80.1 --- a/xen/arch/ia64/xen/domain.c	Tue Oct 24 10:08:30 2006 -0600
    80.2 +++ b/xen/arch/ia64/xen/domain.c	Tue Oct 24 11:21:48 2006 -0600
    80.3 @@ -441,7 +441,7 @@ int arch_domain_create(struct domain *d)
    80.4  	d->arch.ioport_caps = rangeset_new(d, "I/O Ports",
    80.5  	                                   RANGESETF_prettyprint_hex);
    80.6  
    80.7 -	printf ("arch_domain_create: domain=%p\n", d);
    80.8 +	printk ("arch_domain_create: domain=%p\n", d);
    80.9  	return 0;
   80.10  
   80.11  fail_nomem:
   80.12 @@ -655,7 +655,7 @@ domain_set_shared_info_va (unsigned long
   80.13  
   80.14  	/* Note: this doesn't work well if other cpus are already running.
   80.15  	   However this is part of the spec :-)  */
   80.16 -	printf ("Domain set shared_info_va to 0x%016lx\n", va);
   80.17 +	printk ("Domain set shared_info_va to 0x%016lx\n", va);
   80.18  	d->arch.shared_info_va = va;
   80.19  
   80.20  	for_each_vcpu (d, v1) {
   80.21 @@ -955,7 +955,7 @@ int construct_dom0(struct domain *d,
   80.22  	struct page_info *page = NULL;
   80.23  #endif
   80.24  
   80.25 -//printf("construct_dom0: starting\n");
   80.26 +//printk("construct_dom0: starting\n");
   80.27  
   80.28  	/* Sanity! */
   80.29  	BUG_ON(d != dom0);
   80.30 @@ -1059,10 +1059,10 @@ int construct_dom0(struct domain *d,
   80.31  	if (dom0_max_vcpus > MAX_VIRT_CPUS)
   80.32  	    dom0_max_vcpus = MAX_VIRT_CPUS;
   80.33  	
   80.34 -	printf ("Dom0 max_vcpus=%d\n", dom0_max_vcpus);
   80.35 +	printk ("Dom0 max_vcpus=%d\n", dom0_max_vcpus);
   80.36  	for ( i = 1; i < dom0_max_vcpus; i++ )
   80.37  	    if (alloc_vcpu(d, i, i) == NULL)
   80.38 -		printf ("Cannot allocate dom0 vcpu %d\n", i);
   80.39 +		printk ("Cannot allocate dom0 vcpu %d\n", i);
   80.40  
   80.41  	/* Copy the OS image. */
   80.42  	loaddomainelfimage(d,image_start);
   80.43 @@ -1148,7 +1148,7 @@ void machine_restart(char * __unused)
   80.44  {
   80.45  	console_start_sync();
   80.46  	if (running_on_sim)
   80.47 -		printf ("machine_restart called.  spinning...\n");
   80.48 +		printk ("machine_restart called.  spinning...\n");
   80.49  	else
   80.50  		(*efi.reset_system)(EFI_RESET_WARM,0,0,NULL);
   80.51  	while(1);
   80.52 @@ -1160,7 +1160,7 @@ void machine_halt(void)
   80.53  {
   80.54  	console_start_sync();
   80.55  	if (running_on_sim)
   80.56 -		printf ("machine_halt called.  spinning...\n");
   80.57 +		printk ("machine_halt called.  spinning...\n");
   80.58  	else
   80.59  		cpu_halt();
   80.60  	while(1);
    81.1 --- a/xen/arch/ia64/xen/faults.c	Tue Oct 24 10:08:30 2006 -0600
    81.2 +++ b/xen/arch/ia64/xen/faults.c	Tue Oct 24 11:21:48 2006 -0600
    81.3 @@ -105,11 +105,11 @@ void reflect_extint(struct pt_regs *regs
    81.4  	static int first_extint = 1;
    81.5  
    81.6  	if (first_extint) {
    81.7 -		printf("Delivering first extint to domain: isr=0x%lx, iip=0x%lx\n", isr, regs->cr_iip);
    81.8 +		printk("Delivering first extint to domain: isr=0x%lx, iip=0x%lx\n", isr, regs->cr_iip);
    81.9  		first_extint = 0;
   81.10  	}
   81.11  	if (vcpu_timer_pending_early(v))
   81.12 -printf("*#*#*#* about to deliver early timer to domain %d!!!\n",v->domain->domain_id);
   81.13 +printk("*#*#*#* about to deliver early timer to domain %d!!!\n",v->domain->domain_id);
   81.14  	PSCB(current,itir) = 0;
   81.15  	reflect_interruption(isr,regs,IA64_EXTINT_VECTOR);
   81.16  }
   81.17 @@ -129,7 +129,7 @@ void reflect_event(struct pt_regs *regs)
   81.18  		return;
   81.19  
   81.20  	if (!PSCB(v,interrupt_collection_enabled))
   81.21 -		printf("psr.ic off, delivering event, ipsr=%lx,iip=%lx,isr=%lx,viip=0x%lx\n",
   81.22 +		printk("psr.ic off, delivering event, ipsr=%lx,iip=%lx,isr=%lx,viip=0x%lx\n",
   81.23  		       regs->cr_ipsr, regs->cr_iip, isr, PSCB(v, iip));
   81.24  	PSCB(v,unat) = regs->ar_unat;  // not sure if this is really needed?
   81.25  	PSCB(v,precover_ifs) = regs->cr_ifs;
   81.26 @@ -245,7 +245,7 @@ void ia64_do_page_fault (unsigned long a
   81.27  
   81.28  	if (!PSCB(current,interrupt_collection_enabled)) {
   81.29  		check_bad_nested_interruption(isr,regs,fault);
   81.30 -		//printf("Delivering NESTED DATA TLB fault\n");
   81.31 +		//printk("Delivering NESTED DATA TLB fault\n");
   81.32  		fault = IA64_DATA_NESTED_TLB_VECTOR;
   81.33  		regs->cr_iip = ((unsigned long) PSCBX(current,iva) + fault) & ~0xffUL;
   81.34  		regs->cr_ipsr = (regs->cr_ipsr & ~DELIVER_PSR_CLR) | DELIVER_PSR_SET;
   81.35 @@ -374,7 +374,7 @@ ia64_fault (unsigned long vector, unsign
   81.36  		"Unknown fault 13", "Unknown fault 14", "Unknown fault 15"
   81.37  	};
   81.38  
   81.39 -	printf("ia64_fault, vector=0x%lx, ifa=0x%016lx, iip=0x%016lx, ipsr=0x%016lx, isr=0x%016lx\n",
   81.40 +	printk("ia64_fault, vector=0x%lx, ifa=0x%016lx, iip=0x%016lx, ipsr=0x%016lx, isr=0x%016lx\n",
   81.41  	       vector, ifa, regs->cr_iip, regs->cr_ipsr, isr);
   81.42  
   81.43  
   81.44 @@ -384,7 +384,7 @@ ia64_fault (unsigned long vector, unsign
   81.45  		 * the lfetch.
   81.46  		 */
   81.47  		ia64_psr(regs)->ed = 1;
   81.48 -		printf("ia64_fault: handled lfetch.fault\n");
   81.49 +		printk("ia64_fault: handled lfetch.fault\n");
   81.50  		return;
   81.51  	}
   81.52  
   81.53 @@ -433,7 +433,7 @@ ia64_fault (unsigned long vector, unsign
   81.54  			       regs->cr_iip + ia64_psr(regs)->ri,
   81.55  			       regs->pr);
   81.56  # endif
   81.57 -			printf("ia64_fault: returning on hazard\n");
   81.58 +			printk("ia64_fault: returning on hazard\n");
   81.59  			return;
   81.60  		}
   81.61  		break;
   81.62 @@ -592,7 +592,7 @@ ia64_handle_reflection (unsigned long if
   81.63  		if (((isr >> 4L) & 0xfL) == 1) {
   81.64  			/* Fault is due to a register NaT consumption fault. */
   81.65  			//regs->eml_unat = 0;  FIXME: DO WE NEED THIS??
   81.66 -			printf("ia64_handle_reflection: handling regNaT fault\n");
   81.67 +			printk("ia64_handle_reflection: handling regNaT fault\n");
   81.68  			vector = IA64_NAT_CONSUMPTION_VECTOR; break;
   81.69  		}
   81.70  #if 1
   81.71 @@ -605,20 +605,20 @@ ia64_handle_reflection (unsigned long if
   81.72  #ifdef CONFIG_PRIVIFY
   81.73  		/* Some privified operations are coded using reg+64 instead
   81.74  		   of reg.  */
   81.75 -		printf("*** NaT fault... attempting to handle as privop\n");
   81.76 -		printf("isr=%016lx, ifa=%016lx, iip=%016lx, ipsr=%016lx\n",
   81.77 +		printk("*** NaT fault... attempting to handle as privop\n");
   81.78 +		printk("isr=%016lx, ifa=%016lx, iip=%016lx, ipsr=%016lx\n",
   81.79  		       isr, ifa, regs->cr_iip, psr);
   81.80  		//regs->eml_unat = 0;  FIXME: DO WE NEED THIS???
   81.81  		// certain NaT faults are higher priority than privop faults
   81.82  		vector = priv_emulate(v,regs,isr);
   81.83  		if (vector == IA64_NO_FAULT) {
   81.84 -			printf("*** Handled privop masquerading as NaT fault\n");
   81.85 +			printk("*** Handled privop masquerading as NaT fault\n");
   81.86  			return;
   81.87  		}
   81.88  #endif
   81.89  		vector = IA64_NAT_CONSUMPTION_VECTOR; break;
   81.90  	    case 27:
   81.91 -		//printf("*** Handled speculation vector, itc=%lx!\n",ia64_get_itc());
   81.92 +		//printk("*** Handled speculation vector, itc=%lx!\n",ia64_get_itc());
   81.93  		PSCB(current,iim) = iim;
   81.94  		vector = IA64_SPECULATION_VECTOR; break;
   81.95  	    case 30:
   81.96 @@ -633,7 +633,7 @@ ia64_handle_reflection (unsigned long if
   81.97  		// fetch code fail
   81.98  		if (IA64_RETRY == status)
   81.99  			return;
  81.100 -		printf("ia64_handle_reflection: handling FP fault\n");
  81.101 +		printk("ia64_handle_reflection: handling FP fault\n");
  81.102  		vector = IA64_FP_FAULT_VECTOR; break;
  81.103  	    case 33:
  81.104  		status = handle_fpu_swa(0, regs, isr);
  81.105 @@ -642,20 +642,20 @@ ia64_handle_reflection (unsigned long if
  81.106  		// fetch code fail
  81.107  		if (IA64_RETRY == status)
  81.108  			return;
  81.109 -		printf("ia64_handle_reflection: handling FP trap\n");
  81.110 +		printk("ia64_handle_reflection: handling FP trap\n");
  81.111  		vector = IA64_FP_TRAP_VECTOR; break;
  81.112  	    case 34:
  81.113 -		printf("ia64_handle_reflection: handling lowerpriv trap\n");
  81.114 +		printk("ia64_handle_reflection: handling lowerpriv trap\n");
  81.115  		vector = IA64_LOWERPRIV_TRANSFER_TRAP_VECTOR; break;
  81.116  	    case 35:
  81.117 -		printf("ia64_handle_reflection: handling taken branch trap\n");
  81.118 +		printk("ia64_handle_reflection: handling taken branch trap\n");
  81.119  		vector = IA64_TAKEN_BRANCH_TRAP_VECTOR; break;
  81.120  	    case 36:
  81.121 -		printf("ia64_handle_reflection: handling single step trap\n");
  81.122 +		printk("ia64_handle_reflection: handling single step trap\n");
  81.123  		vector = IA64_SINGLE_STEP_TRAP_VECTOR; break;
  81.124  
  81.125  	    default:
  81.126 -		printf("ia64_handle_reflection: unhandled vector=0x%lx\n",vector);
  81.127 +		printk("ia64_handle_reflection: unhandled vector=0x%lx\n",vector);
  81.128  		while(vector);
  81.129  		return;
  81.130  	}
    82.1 --- a/xen/arch/ia64/xen/fw_emul.c	Tue Oct 24 10:08:30 2006 -0600
    82.2 +++ b/xen/arch/ia64/xen/fw_emul.c	Tue Oct 24 11:21:48 2006 -0600
    82.3 @@ -75,20 +75,20 @@ sal_emulator (long index, unsigned long 
    82.4  			r9 = value;
    82.5  		}
    82.6  		else
    82.7 -		     printf("NON-PRIV DOMAIN CALLED SAL_PCI_CONFIG_READ\n");
    82.8 +		     printk("NON-PRIV DOMAIN CALLED SAL_PCI_CONFIG_READ\n");
    82.9  		break;
   82.10  	    case SAL_PCI_CONFIG_WRITE:
   82.11  		if (current->domain == dom0) {
   82.12  			if (((in1 & ~0xffffffffUL) && (in4 == 0)) ||
   82.13  			    (in4 > 1) ||
   82.14  			    (in2 > 8) || (in2 & (in2-1)))
   82.15 -				printf("*** SAL_PCI_CONF_WRITE?!?(adr=0x%lx,typ=0x%lx,sz=0x%lx,val=0x%lx)\n",
   82.16 +				printk("*** SAL_PCI_CONF_WRITE?!?(adr=0x%lx,typ=0x%lx,sz=0x%lx,val=0x%lx)\n",
   82.17  					in1,in4,in2,in3);
   82.18  			// note that args are in a different order!!
   82.19  			status = ia64_sal_pci_config_write(in1,in4,in2,in3);
   82.20  		}
   82.21  		else
   82.22 -		     printf("NON-PRIV DOMAIN CALLED SAL_PCI_CONFIG_WRITE\n");
   82.23 +		     printk("NON-PRIV DOMAIN CALLED SAL_PCI_CONFIG_WRITE\n");
   82.24  		break;
   82.25  	    case SAL_SET_VECTORS:
   82.26   		if (in1 == SAL_VECTOR_OS_BOOT_RENDEZ) {
   82.27 @@ -104,7 +104,7 @@ sal_emulator (long index, unsigned long 
   82.28  			}
   82.29   		}
   82.30   		else
   82.31 - 			printf("*** CALLED SAL_SET_VECTORS %lu.  IGNORED...\n",
   82.32 + 			printk("*** CALLED SAL_SET_VECTORS %lu.  IGNORED...\n",
   82.33   			       in1);
   82.34  		break;
   82.35  	    case SAL_GET_STATE_INFO:
   82.36 @@ -121,10 +121,10 @@ sal_emulator (long index, unsigned long 
   82.37  		/* Noop.  */
   82.38  		break;
   82.39  	    case SAL_MC_RENDEZ:
   82.40 -		printf("*** CALLED SAL_MC_RENDEZ.  IGNORED...\n");
   82.41 +		printk("*** CALLED SAL_MC_RENDEZ.  IGNORED...\n");
   82.42  		break;
   82.43  	    case SAL_MC_SET_PARAMS:
   82.44 -		printf("*** CALLED SAL_MC_SET_PARAMS.  IGNORED...\n");
   82.45 +		printk("*** CALLED SAL_MC_SET_PARAMS.  IGNORED...\n");
   82.46  		break;
   82.47  	    case SAL_CACHE_FLUSH:
   82.48  		if (1) {
   82.49 @@ -141,13 +141,13 @@ sal_emulator (long index, unsigned long 
   82.50  		}
   82.51  		break;
   82.52  	    case SAL_CACHE_INIT:
   82.53 -		printf("*** CALLED SAL_CACHE_INIT.  IGNORED...\n");
   82.54 +		printk("*** CALLED SAL_CACHE_INIT.  IGNORED...\n");
   82.55  		break;
   82.56  	    case SAL_UPDATE_PAL:
   82.57 -		printf("*** CALLED SAL_UPDATE_PAL.  IGNORED...\n");
   82.58 +		printk("*** CALLED SAL_UPDATE_PAL.  IGNORED...\n");
   82.59  		break;
   82.60  	    default:
   82.61 -		printf("*** CALLED SAL_ WITH UNKNOWN INDEX.  IGNORED...\n");
   82.62 +		printk("*** CALLED SAL_ WITH UNKNOWN INDEX.  IGNORED...\n");
   82.63  		status = -1;
   82.64  		break;
   82.65  	}
   82.66 @@ -362,7 +362,7 @@ xen_pal_emulator(unsigned long index, u6
   82.67  		break;
   82.68  	    case PAL_HALT:
   82.69  		if (current->domain == dom0) {
   82.70 -			printf ("Domain0 halts the machine\n");
   82.71 +			printk ("Domain0 halts the machine\n");
   82.72  			console_start_sync();
   82.73  			(*efi.reset_system)(EFI_RESET_SHUTDOWN,0,0,NULL);
   82.74  		}
   82.75 @@ -429,7 +429,7 @@ efi_emulate_get_time(
   82.76  	struct page_info *tc_page = NULL;
   82.77  	efi_status_t status = 0;
   82.78  
   82.79 -	//printf("efi_get_time(%016lx,%016lx) called\n", tv_addr, tc_addr);
   82.80 +	//printk("efi_get_time(%016lx,%016lx) called\n", tv_addr, tc_addr);
   82.81  	tv = efi_translate_domain_addr(tv_addr, fault, &tv_page);
   82.82  	if (*fault != IA64_NO_FAULT)
   82.83  		goto errout;
   82.84 @@ -439,9 +439,9 @@ efi_emulate_get_time(
   82.85  			goto errout;
   82.86  	}
   82.87  
   82.88 -	//printf("efi_get_time(%016lx,%016lx) translated to xen virtual address\n", tv, tc);
   82.89 +	//printk("efi_get_time(%016lx,%016lx) translated to xen virtual address\n", tv, tc);
   82.90  	status = (*efi.get_time)((efi_time_t *) tv, (efi_time_cap_t *) tc);
   82.91 -	//printf("efi_get_time returns %lx\n", status);
   82.92 +	//printk("efi_get_time returns %lx\n", status);
   82.93  
   82.94  errout:
   82.95  	if (tc_page != NULL)
   82.96 @@ -695,14 +695,14 @@ efi_emulate_set_virtual_address_map(
   82.97  	fpswa_interface_t *fpswa_inf = d->arch.fpswa_inf;
   82.98  
   82.99  	if (descriptor_version != EFI_MEMDESC_VERSION) {
  82.100 -		printf ("efi_emulate_set_virtual_address_map: memory "
  82.101 +		printk ("efi_emulate_set_virtual_address_map: memory "
  82.102  		        "descriptor version unmatched (%d vs %d)\n",
  82.103  		        (int)descriptor_version, EFI_MEMDESC_VERSION);
  82.104  		return EFI_INVALID_PARAMETER;
  82.105  	}
  82.106  
  82.107  	if (descriptor_size != sizeof(efi_memory_desc_t)) {
  82.108 -		printf ("efi_emulate_set_virtual_address_map: memory descriptor size unmatched\n");
  82.109 +		printk ("efi_emulate_set_virtual_address_map: memory descriptor size unmatched\n");
  82.110  		return EFI_INVALID_PARAMETER;
  82.111  	}
  82.112  
  82.113 @@ -715,7 +715,7 @@ efi_emulate_set_virtual_address_map(
  82.114  
  82.115  	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
  82.116  		if (copy_from_user(&entry, p, sizeof(efi_memory_desc_t))) {
  82.117 -			printf ("efi_emulate_set_virtual_address_map: copy_from_user() fault. addr=0x%p\n", p);
  82.118 +			printk ("efi_emulate_set_virtual_address_map: copy_from_user() fault. addr=0x%p\n", p);
  82.119  			return EFI_UNSUPPORTED;
  82.120  		}
  82.121  
  82.122 @@ -843,7 +843,7 @@ efi_emulator (struct pt_regs *regs, IA64
  82.123  		status = EFI_UNSUPPORTED;
  82.124  		break;
  82.125  	    default:
  82.126 -		printf("unknown ia64 fw hypercall %lx\n", regs->r2);
  82.127 +		printk("unknown ia64 fw hypercall %lx\n", regs->r2);
  82.128  		status = EFI_UNSUPPORTED;
  82.129  	}
  82.130  
  82.131 @@ -864,7 +864,7 @@ do_ssc(unsigned long ssc, struct pt_regs
  82.132  	    case SSC_PUTCHAR:
  82.133  		buf[0] = arg0;
  82.134  		buf[1] = '\0';
  82.135 -		printf(buf);
  82.136 +		printk(buf);
  82.137  		break;
  82.138  	    case SSC_GETCHAR:
  82.139  		retval = ia64_ssc(0,0,0,0,ssc);
  82.140 @@ -877,7 +877,7 @@ do_ssc(unsigned long ssc, struct pt_regs
  82.141  /**/			stat = (struct ssc_disk_stat *)__va(arg0);
  82.142  ///**/			if (stat->fd == last_fd) stat->count = last_count;
  82.143  /**/			stat->count = last_count;
  82.144 -//if (last_count >= PAGE_SIZE) printf("ssc_wait: stat->fd=%d,last_fd=%d,last_count=%d\n",stat->fd,last_fd,last_count);
  82.145 +//if (last_count >= PAGE_SIZE) printk("ssc_wait: stat->fd=%d,last_fd=%d,last_count=%d\n",stat->fd,last_fd,last_count);
  82.146  ///**/			retval = ia64_ssc(arg0,0,0,0,ssc);
  82.147  /**/			retval = 0;
  82.148  		}
  82.149 @@ -886,7 +886,7 @@ do_ssc(unsigned long ssc, struct pt_regs
  82.150  		break;
  82.151  	    case SSC_OPEN:
  82.152  		arg1 = vcpu_get_gr(current,33);	// access rights
  82.153 -if (!running_on_sim) { printf("SSC_OPEN, not implemented on hardware.  (ignoring...)\n"); arg0 = 0; }
  82.154 +if (!running_on_sim) { printk("SSC_OPEN, not implemented on hardware.  (ignoring...)\n"); arg0 = 0; }
  82.155  		if (arg0) {	// metaphysical address
  82.156  			arg0 = translate_domain_mpaddr(arg0, NULL);
  82.157  			retval = ia64_ssc(arg0,arg1,0,0,ssc);
  82.158 @@ -896,7 +896,7 @@ if (!running_on_sim) { printf("SSC_OPEN,
  82.159  		break;
  82.160  	    case SSC_WRITE:
  82.161  	    case SSC_READ:
  82.162 -//if (ssc == SSC_WRITE) printf("DOING AN SSC_WRITE\n");
  82.163 +//if (ssc == SSC_WRITE) printk("DOING AN SSC_WRITE\n");
  82.164  		arg1 = vcpu_get_gr(current,33);
  82.165  		arg2 = vcpu_get_gr(current,34);
  82.166  		arg3 = vcpu_get_gr(current,35);
  82.167 @@ -912,7 +912,7 @@ if (!running_on_sim) { printf("SSC_OPEN,
  82.168  /**/			last_fd = arg1;
  82.169  /**/			last_count = len;
  82.170  			mpaddr = req->addr;
  82.171 -//if (last_count >= PAGE_SIZE) printf("do_ssc: read fd=%d, addr=%p, len=%lx ",last_fd,mpaddr,len);
  82.172 +//if (last_count >= PAGE_SIZE) printk("do_ssc: read fd=%d, addr=%p, len=%lx ",last_fd,mpaddr,len);
  82.173  			retval = 0;
  82.174  			if ((mpaddr & PAGE_MASK) != ((mpaddr+len-1) & PAGE_MASK)) {
  82.175  				// do partial page first
  82.176 @@ -923,7 +923,7 @@ if (!running_on_sim) { printf("SSC_OPEN,
  82.177  				arg3 += req->len; // file offset
  82.178  /**/				last_stat.fd = last_fd;
  82.179  /**/				(void)ia64_ssc(__pa(&last_stat),0,0,0,SSC_WAIT_COMPLETION);
  82.180 -//if (last_count >= PAGE_SIZE) printf("ssc(%p,%lx)[part]=%x ",req->addr,req->len,retval);
  82.181 +//if (last_count >= PAGE_SIZE) printk("ssc(%p,%lx)[part]=%x ",req->addr,req->len,retval);
  82.182  			}
  82.183  			if (retval >= 0) while (len > 0) {
  82.184  				req->addr = translate_domain_mpaddr(mpaddr, NULL);
  82.185 @@ -934,27 +934,27 @@ if (!running_on_sim) { printf("SSC_OPEN,
  82.186  // TEMP REMOVED AGAIN				arg3 += req->len; // file offset
  82.187  /**/				last_stat.fd = last_fd;
  82.188  /**/				(void)ia64_ssc(__pa(&last_stat),0,0,0,SSC_WAIT_COMPLETION);
  82.189 -//if (last_count >= PAGE_SIZE) printf("ssc(%p,%lx)=%x ",req->addr,req->len,retval);
  82.190 +//if (last_count >= PAGE_SIZE) printk("ssc(%p,%lx)=%x ",req->addr,req->len,retval);
  82.191  			}
  82.192  			// set it back to the original value
  82.193  			req->len = last_count;
  82.194  		}
  82.195  		else retval = -1L;
  82.196  		vcpu_set_gr(current,8,retval,0);
  82.197 -//if (last_count >= PAGE_SIZE) printf("retval=%x\n",retval);
  82.198 +//if (last_count >= PAGE_SIZE) printk("retval=%x\n",retval);
  82.199  		break;
  82.200  	    case SSC_CONNECT_INTERRUPT:
  82.201  		arg1 = vcpu_get_gr(current,33);
  82.202  		arg2 = vcpu_get_gr(current,34);
  82.203  		arg3 = vcpu_get_gr(current,35);
  82.204 -		if (!running_on_sim) { printf("SSC_CONNECT_INTERRUPT, not implemented on hardware.  (ignoring...)\n"); break; }
  82.205 +		if (!running_on_sim) { printk("SSC_CONNECT_INTERRUPT, not implemented on hardware.  (ignoring...)\n"); break; }
  82.206  		(void)ia64_ssc(arg0,arg1,arg2,arg3,ssc);
  82.207  		break;
  82.208  	    case SSC_NETDEV_PROBE:
  82.209  		vcpu_set_gr(current,8,-1L,0);
  82.210  		break;
  82.211  	    default:
  82.212 -		printf("ia64_handle_break: bad ssc code %lx, iip=0x%lx, b0=0x%lx... spinning\n",
  82.213 +		printk("ia64_handle_break: bad ssc code %lx, iip=0x%lx, b0=0x%lx... spinning\n",
  82.214  			ssc, regs->cr_iip, regs->b0);
  82.215  		while(1);
  82.216  		break;
    83.1 --- a/xen/arch/ia64/xen/hypercall.c	Tue Oct 24 10:08:30 2006 -0600
    83.2 +++ b/xen/arch/ia64/xen/hypercall.c	Tue Oct 24 11:21:48 2006 -0600
    83.3 @@ -163,7 +163,7 @@ fw_hypercall_ipi (struct pt_regs *regs)
    83.4  			memset (&c, 0, sizeof (c));
    83.5  
    83.6  			if (arch_set_info_guest (targ, &c) != 0) {
    83.7 -				printf ("arch_boot_vcpu: failure\n");
    83.8 +				printk ("arch_boot_vcpu: failure\n");
    83.9  				return;
   83.10  			}
   83.11  		}
   83.12 @@ -177,11 +177,11 @@ fw_hypercall_ipi (struct pt_regs *regs)
   83.13  		if (test_and_clear_bit(_VCPUF_down,
   83.14  				       &targ->vcpu_flags)) {
   83.15  			vcpu_wake(targ);
   83.16 -			printf ("arch_boot_vcpu: vcpu %d awaken\n",
   83.17 +			printk ("arch_boot_vcpu: vcpu %d awaken\n",
   83.18  				targ->vcpu_id);
   83.19  		}
   83.20  		else
   83.21 -			printf ("arch_boot_vcpu: huu, already awaken!\n");
   83.22 +			printk ("arch_boot_vcpu: huu, already awaken!\n");
   83.23  	}
   83.24  	else {
   83.25  		int running = test_bit(_VCPUF_running,
   83.26 @@ -220,7 +220,7 @@ ia64_hypercall(struct pt_regs *regs)
   83.27  		return xen_fast_hypercall(regs);
   83.28  
   83.29  	case FW_HYPERCALL_PAL_CALL:
   83.30 -		//printf("*** PAL hypercall: index=%d\n",regs->r28);
   83.31 +		//printk("*** PAL hypercall: index=%d\n",regs->r28);
   83.32  		//FIXME: This should call a C routine
   83.33  #if 0
   83.34  		// This is very conservative, but avoids a possible
   83.35 @@ -235,7 +235,7 @@ ia64_hypercall(struct pt_regs *regs)
   83.36  				event_pending(v)) {
   83.37  				perfc_incrc(idle_when_pending);
   83.38  				vcpu_pend_unspecified_interrupt(v);
   83.39 -//printf("idle w/int#%d pending!\n",pi);
   83.40 +//printk("idle w/int#%d pending!\n",pi);
   83.41  //this shouldn't happen, but it apparently does quite a bit!  so don't
   83.42  //allow it to happen... i.e. if a domain has an interrupt pending and
   83.43  //it tries to halt itself because it thinks it is idle, just return here
   83.44 @@ -301,7 +301,7 @@ ia64_hypercall(struct pt_regs *regs)
   83.45  		regs->r11 = fpswa_ret.err2;
   83.46  		break;
   83.47  	default:
   83.48 -		printf("unknown ia64 fw hypercall %lx\n", regs->r2);
   83.49 +		printk("unknown ia64 fw hypercall %lx\n", regs->r2);
   83.50  		regs->r8 = do_ni_hypercall();
   83.51  	}
   83.52  	return IA64_NO_FAULT;
    84.1 --- a/xen/arch/ia64/xen/hyperprivop.S	Tue Oct 24 10:08:30 2006 -0600
    84.2 +++ b/xen/arch/ia64/xen/hyperprivop.S	Tue Oct 24 11:21:48 2006 -0600
    84.3 @@ -203,7 +203,7 @@ END(fast_hyperprivop)
    84.4  
    84.5  // give up for now if: ipsr.be==1, ipsr.pp==1
    84.6  // from reflect_interruption, don't need to:
    84.7 -//  - printf first extint (debug only)
    84.8 +//  - printk first extint (debug only)
    84.9  //  - check for interrupt collection enabled (routine will force on)
   84.10  //  - set ifa (not valid for extint)
   84.11  //  - set iha (not valid for extint)
    85.1 --- a/xen/arch/ia64/xen/irq.c	Tue Oct 24 10:08:30 2006 -0600
    85.2 +++ b/xen/arch/ia64/xen/irq.c	Tue Oct 24 11:21:48 2006 -0600
    85.3 @@ -481,7 +481,7 @@ xen_debug_irq(unsigned long vector, stru
    85.4  		firstirq = 0;
    85.5  	}
    85.6  	if (firsttime[vector]) {
    85.7 -		printf("**** (entry) First received int on vector=%lu,itc=%lx\n",
    85.8 +		printk("**** (entry) First received int on vector=%lu,itc=%lx\n",
    85.9  			(unsigned long) vector, ia64_get_itc());
   85.10  		firsttime[vector] = 0;
   85.11  	}
    86.1 --- a/xen/arch/ia64/xen/mm.c	Tue Oct 24 10:08:30 2006 -0600
    86.2 +++ b/xen/arch/ia64/xen/mm.c	Tue Oct 24 11:21:48 2006 -0600
    86.3 @@ -469,7 +469,7 @@ u64 translate_domain_pte(u64 pteval, u64
    86.4  			   This can happen when domU tries to touch i/o
    86.5  			   port space.  Also prevents possible address
    86.6  			   aliasing issues.  */
    86.7 -			printf("Warning: UC to WB for mpaddr=%lx\n", mpaddr);
    86.8 +			printk("Warning: UC to WB for mpaddr=%lx\n", mpaddr);
    86.9  			pteval = (pteval & ~_PAGE_MA_MASK) | _PAGE_MA_WB;
   86.10  		}
   86.11  		break;
   86.12 @@ -720,7 +720,7 @@ xencomm_paddr_to_maddr(unsigned long pad
   86.13  
   86.14      pa = ____lookup_domain_mpa(d, paddr);
   86.15      if (pa == INVALID_MFN) {
   86.16 -        printf("%s: called with bad memory address: 0x%lx - iip=%lx\n",
   86.17 +        printk("%s: called with bad memory address: 0x%lx - iip=%lx\n",
   86.18                 __func__, paddr, vcpu_regs(v)->cr_iip);
   86.19          return 0;
   86.20      }
   86.21 @@ -740,7 +740,7 @@ static struct page_info *
   86.22  
   86.23      p = alloc_domheap_page(d);
   86.24      if (unlikely(!p)) {
   86.25 -        printf("assign_new_domain_page: Can't alloc!!!! Aaaargh!\n");
   86.26 +        printk("assign_new_domain_page: Can't alloc!!!! Aaaargh!\n");
   86.27          return(p);
   86.28      }
   86.29  
   86.30 @@ -751,7 +751,7 @@ static struct page_info *
   86.31                   && maddr < __get_cpu_var(vhpt_pend))) {
   86.32          /* FIXME: how can this happen ?
   86.33             vhpt is allocated by alloc_domheap_page.  */
   86.34 -        printf("assign_new_domain_page: reassigned vhpt page %lx!!\n",
   86.35 +        printk("assign_new_domain_page: reassigned vhpt page %lx!!\n",
   86.36                 maddr);
   86.37      }
   86.38  
   86.39 @@ -1749,7 +1749,7 @@ void domain_cache_flush (struct domain *
   86.40              }
   86.41          }
   86.42      }
   86.43 -    //printf ("domain_cache_flush: %d %d pages\n", d->domain_id, nbr_page);
   86.44 +    //printk ("domain_cache_flush: %d %d pages\n", d->domain_id, nbr_page);
   86.45  }
   86.46  
   86.47  #ifdef VERBOSE
    87.1 --- a/xen/arch/ia64/xen/privop.c	Tue Oct 24 10:08:30 2006 -0600
    87.2 +++ b/xen/arch/ia64/xen/privop.c	Tue Oct 24 11:21:48 2006 -0600
    87.3 @@ -594,16 +594,16 @@ static IA64FAULT priv_handle_op(VCPU * v
    87.4  	if (iip == 0xa000000100001820) {
    87.5  		static int firstpagefault = 1;
    87.6  		if (firstpagefault) {
    87.7 -			printf("*** First time to domain page fault!\n");
    87.8 +			printk("*** First time to domain page fault!\n");
    87.9  			firstpagefault = 0;
   87.10  		}
   87.11  	}
   87.12  #endif
   87.13  	if (privop_trace) {
   87.14  		static long i = 400;
   87.15 -		//if (i > 0) printf("priv_handle_op: at 0x%lx\n",iip);
   87.16 +		//if (i > 0) printk("priv_handle_op: at 0x%lx\n",iip);
   87.17  		if (i > 0)
   87.18 -			printf("priv_handle_op: privop trace at 0x%lx, "
   87.19 +			printk("priv_handle_op: privop trace at 0x%lx, "
   87.20  			       "itc=%lx, itm=%lx\n",
   87.21  			       iip, ia64_get_itc(), ia64_get_itm());
   87.22  		i--;
   87.23 @@ -617,11 +617,11 @@ static IA64FAULT priv_handle_op(VCPU * v
   87.24  	else if (slot == 2)
   87.25  		inst.inst = (bundle.i64[1] >> 23) & MASK_41;
   87.26  	else
   87.27 -		printf("priv_handle_op: illegal slot: %d\n", slot);
   87.28 +		printk("priv_handle_op: illegal slot: %d\n", slot);
   87.29  
   87.30  	slot_type = slot_types[bundle.template][slot];
   87.31  	if (priv_verbose) {
   87.32 -		printf("priv_handle_op: checking bundle at 0x%lx "
   87.33 +		printk("priv_handle_op: checking bundle at 0x%lx "
   87.34  		       "(op=0x%016lx) slot %d (type=%d)\n",
   87.35  		       iip, (u64) inst.inst, slot, slot_type);
   87.36  	}
   87.37 @@ -734,11 +734,11 @@ static IA64FAULT priv_handle_op(VCPU * v
   87.38  	default:
   87.39  		break;
   87.40  	}
   87.41 -	//printf("We who are about do die salute you\n");
   87.42 -	printf("priv_handle_op: can't handle privop at 0x%lx (op=0x%016lx) "
   87.43 +	//printk("We who are about do die salute you\n");
   87.44 +	printk("priv_handle_op: can't handle privop at 0x%lx (op=0x%016lx) "
   87.45  	       "slot %d (type=%d), ipsr=0x%lx\n",
   87.46  	       iip, (u64) inst.inst, slot, slot_type, ipsr);
   87.47 -	//printf("vtop(0x%lx)==0x%lx\n", iip, tr_vtop(iip));
   87.48 +	//printk("vtop(0x%lx)==0x%lx\n", iip, tr_vtop(iip));
   87.49  	//thread_mozambique("privop fault\n");
   87.50  	return IA64_ILLOP_FAULT;
   87.51  }
   87.52 @@ -762,8 +762,8 @@ IA64FAULT priv_emulate(VCPU * vcpu, REGS
   87.53  
   87.54  	// handle privops masked as illops? and breaks (6)
   87.55  	if (isrcode != 1 && isrcode != 2 && isrcode != 0 && isrcode != 6) {
   87.56 -		printf("priv_emulate: isrcode != 0 or 1 or 2\n");
   87.57 -		printf("priv_emulate: returning ILLOP, not implemented!\n");
   87.58 +		printk("priv_emulate: isrcode != 0 or 1 or 2\n");
   87.59 +		printk("priv_emulate: returning ILLOP, not implemented!\n");
   87.60  		while (1) ;
   87.61  		return IA64_ILLOP_FAULT;
   87.62  	}
   87.63 @@ -777,7 +777,7 @@ IA64FAULT priv_emulate(VCPU * vcpu, REGS
   87.64  		(void)vcpu_increment_iip(vcpu);
   87.65  	}
   87.66  	if (fault == IA64_ILLOP_FAULT)
   87.67 -		printf("priv_emulate: priv_handle_op fails, "
   87.68 +		printk("priv_emulate: priv_handle_op fails, "
   87.69  		       "isr=0x%lx iip=%lx\n", isr, regs->cr_iip);
   87.70  	return fault;
   87.71  }
    88.1 --- a/xen/arch/ia64/xen/regionreg.c	Tue Oct 24 10:08:30 2006 -0600
    88.2 +++ b/xen/arch/ia64/xen/regionreg.c	Tue Oct 24 11:21:48 2006 -0600
    88.3 @@ -106,7 +106,7 @@ void init_rid_allocator (void)
    88.4  	/* Due to RID mangling, we expect 24 RID bits!
    88.5  	   This test should be removed if RID mangling is removed/modified.  */
    88.6  	if (implemented_rid_bits != 24) {
    88.7 -		printf ("RID mangling expected 24 RID bits, got only %d!\n",
    88.8 +		printk ("RID mangling expected 24 RID bits, got only %d!\n",
    88.9  			implemented_rid_bits);
   88.10  		BUG();
   88.11  	}
   88.12 @@ -117,14 +117,14 @@ void init_rid_allocator (void)
   88.13  
   88.14  	/* Check for too small values.  */
   88.15  	if (domain_rid_bits_default < IA64_MIN_IMPL_RID_BITS) {
   88.16 -		printf ("Default domain rid bits %d is too small, use %d\n",
   88.17 +		printk ("Default domain rid bits %d is too small, use %d\n",
   88.18  			domain_rid_bits_default, IA64_MIN_IMPL_RID_BITS);
   88.19  		domain_rid_bits_default = IA64_MIN_IMPL_RID_BITS;
   88.20  	}
   88.21  
   88.22  	log_blocks = (implemented_rid_bits - IA64_MIN_IMPL_RID_BITS);
   88.23  
   88.24 -	printf ("Maximum number of domains: %d; %d RID bits per domain\n",
   88.25 +	printk ("Maximum number of domains: %d; %d RID bits per domain\n",
   88.26  		(1 << (implemented_rid_bits - domain_rid_bits_default)) - 1,
   88.27  		domain_rid_bits_default);
   88.28  	
   88.29 @@ -185,7 +185,7 @@ int allocate_rid_range(struct domain *d,
   88.30  	d->arch.metaphysical_rr0 = allocate_metaphysical_rr(d, 0);
   88.31  	d->arch.metaphysical_rr4 = allocate_metaphysical_rr(d, 1);
   88.32  
   88.33 -	printf("### domain %p: rid=%x-%x mp_rid=%x\n",
   88.34 +	printk("### domain %p: rid=%x-%x mp_rid=%x\n",
   88.35  	       d, d->arch.starting_rid, d->arch.ending_rid,
   88.36  	       d->arch.starting_mp_rid);
   88.37  	
    89.1 --- a/xen/arch/ia64/xen/tlb_track.c	Tue Oct 24 10:08:30 2006 -0600
    89.2 +++ b/xen/arch/ia64/xen/tlb_track.c	Tue Oct 24 11:21:48 2006 -0600
    89.3 @@ -29,7 +29,7 @@
    89.4  #define CONFIG_TLB_TRACK_DEBUG
    89.5  #ifdef CONFIG_TLB_TRACK_DEBUG
    89.6  # define tlb_track_printd(fmt, ...)     \
    89.7 -    printf("%s:%d " fmt, __func__, __LINE__, ##__VA_ARGS__)
    89.8 +    printk("%s:%d " fmt, __func__, __LINE__, ##__VA_ARGS__)
    89.9  #else
   89.10  # define tlb_track_printd(fmt, ...)     do { } while (0)
   89.11  #endif
    90.1 --- a/xen/arch/ia64/xen/vcpu.c	Tue Oct 24 10:08:30 2006 -0600
    90.2 +++ b/xen/arch/ia64/xen/vcpu.c	Tue Oct 24 11:21:48 2006 -0600
    90.3 @@ -199,7 +199,7 @@ IA64FAULT vcpu_set_ar(VCPU * vcpu, u64 r
    90.4  	else if (reg == 27)
    90.5  		return IA64_ILLOP_FAULT;
    90.6  	else if (reg == 24)
    90.7 -		printf("warning: setting ar.eflg is a no-op; no IA-32 "
    90.8 +		printk("warning: setting ar.eflg is a no-op; no IA-32 "
    90.9  		       "support\n");
   90.10  	else if (reg > 7)
   90.11  		return IA64_ILLOP_FAULT;
   90.12 @@ -213,7 +213,7 @@ IA64FAULT vcpu_set_ar(VCPU * vcpu, u64 r
   90.13  IA64FAULT vcpu_get_ar(VCPU * vcpu, u64 reg, u64 * val)
   90.14  {
   90.15  	if (reg == 24)
   90.16 -		printf("warning: getting ar.eflg is a no-op; no IA-32 "
   90.17 +		printk("warning: getting ar.eflg is a no-op; no IA-32 "
   90.18  		       "support\n");
   90.19  	else if (reg > 7)
   90.20  		return IA64_ILLOP_FAULT;
   90.21 @@ -337,7 +337,7 @@ IA64FAULT vcpu_set_psr_sm(VCPU * vcpu, u
   90.22  	}
   90.23  	if (imm.i) {
   90.24  		if (vcpu->vcpu_info->evtchn_upcall_mask) {
   90.25 -//printf("vcpu_set_psr_sm: psr.ic 0->1\n");
   90.26 +//printk("vcpu_set_psr_sm: psr.ic 0->1\n");
   90.27  			enabling_interrupts = 1;
   90.28  		}
   90.29  		vcpu->vcpu_info->evtchn_upcall_mask = 0;
   90.30 @@ -362,7 +362,7 @@ IA64FAULT vcpu_set_psr_sm(VCPU * vcpu, u
   90.31  		psr.up = 1;
   90.32  	}
   90.33  	if (imm.be) {
   90.34 -		printf("*** DOMAIN TRYING TO TURN ON BIG-ENDIAN!!!\n");
   90.35 +		printk("*** DOMAIN TRYING TO TURN ON BIG-ENDIAN!!!\n");
   90.36  		return IA64_ILLOP_FAULT;
   90.37  	}
   90.38  	if (imm.dt)
   90.39 @@ -437,7 +437,7 @@ IA64FAULT vcpu_set_psr_l(VCPU * vcpu, u6
   90.40  	else
   90.41  		vcpu_set_metaphysical_mode(vcpu, TRUE);
   90.42  	if (newpsr.be) {
   90.43 -		printf("*** DOMAIN TRYING TO TURN ON BIG-ENDIAN!!!\n");
   90.44 +		printk("*** DOMAIN TRYING TO TURN ON BIG-ENDIAN!!!\n");
   90.45  		return IA64_ILLOP_FAULT;
   90.46  	}
   90.47  	if (enabling_interrupts &&
   90.48 @@ -489,7 +489,7 @@ u64 vcpu_get_ipsr_int_state(VCPU * vcpu,
   90.49  	u64 dcr = PSCBX(vcpu, dcr);
   90.50  	PSR psr;
   90.51  
   90.52 -	//printf("*** vcpu_get_ipsr_int_state (0x%016lx)...\n",prevpsr);
   90.53 +	//printk("*** vcpu_get_ipsr_int_state (0x%016lx)...\n",prevpsr);
   90.54  	psr.i64 = prevpsr;
   90.55  	psr.ia64_psr.be = 0;
   90.56  	if (dcr & IA64_DCR_BE)
   90.57 @@ -506,7 +506,7 @@ u64 vcpu_get_ipsr_int_state(VCPU * vcpu,
   90.58  	if (psr.ia64_psr.cpl == 2)
   90.59  		psr.ia64_psr.cpl = 0;	// !!!! fool domain
   90.60  	// psr.pk = 1;
   90.61 -	//printf("returns 0x%016lx...\n",psr.i64);
   90.62 +	//printk("returns 0x%016lx...\n",psr.i64);
   90.63  	return psr.i64;
   90.64  }
   90.65  
   90.66 @@ -606,7 +606,7 @@ IA64FAULT vcpu_get_iipa(VCPU * vcpu, u64
   90.67  	u64 val = PSCB(vcpu, iipa);
   90.68  	// SP entry code does not save iipa yet nor does it get
   90.69  	//  properly delivered in the pscb
   90.70 -//	printf("*** vcpu_get_iipa: cr.iipa not fully implemented yet!!\n");
   90.71 +//	printk("*** vcpu_get_iipa: cr.iipa not fully implemented yet!!\n");
   90.72  	*pval = val;
   90.73  	return IA64_NO_FAULT;
   90.74  }
   90.75 @@ -657,7 +657,7 @@ IA64FAULT vcpu_set_iva(VCPU * vcpu, u64 
   90.76  IA64FAULT vcpu_set_pta(VCPU * vcpu, u64 val)
   90.77  {
   90.78  	if (val & IA64_PTA_LFMT) {
   90.79 -		printf("*** No support for VHPT long format yet!!\n");
   90.80 +		printk("*** No support for VHPT long format yet!!\n");
   90.81  		return IA64_ILLOP_FAULT;
   90.82  	}
   90.83  	if (val & (0x3f << 9))	/* reserved fields */
   90.84 @@ -714,7 +714,7 @@ IA64FAULT vcpu_set_iipa(VCPU * vcpu, u64
   90.85  {
   90.86  	// SP entry code does not save iipa yet nor does it get
   90.87  	//  properly delivered in the pscb
   90.88 -//	printf("*** vcpu_set_iipa: cr.iipa not fully implemented yet!!\n");
   90.89 +//	printk("*** vcpu_set_iipa: cr.iipa not fully implemented yet!!\n");
   90.90  	PSCB(vcpu, iipa) = val;
   90.91  	return IA64_NO_FAULT;
   90.92  }
   90.93 @@ -750,12 +750,12 @@ void vcpu_pend_unspecified_interrupt(VCP
   90.94  void vcpu_pend_interrupt(VCPU * vcpu, u64 vector)
   90.95  {
   90.96  	if (vector & ~0xff) {
   90.97 -		printf("vcpu_pend_interrupt: bad vector\n");
   90.98 +		printk("vcpu_pend_interrupt: bad vector\n");
   90.99  		return;
  90.100  	}
  90.101  
  90.102  	if (vcpu->arch.event_callback_ip) {
  90.103 -		printf("Deprecated interface. Move to new event based "
  90.104 +		printk("Deprecated interface. Move to new event based "
  90.105  		       "solution\n");
  90.106  		return;
  90.107  	}
  90.108 @@ -814,7 +814,7 @@ u64 vcpu_check_pending_interrupts(VCPU *
  90.109  	}
  90.110  	// have a pending,deliverable interrupt... see if it is masked
  90.111  	bitnum = ia64_fls(bits);
  90.112 -//printf("XXXXXXX vcpu_check_pending_interrupts: got bitnum=%p...\n",bitnum);
  90.113 +//printk("XXXXXXX vcpu_check_pending_interrupts: got bitnum=%p...\n",bitnum);
  90.114  	vector = bitnum + (i * 64);
  90.115  	mask = 1L << bitnum;
  90.116  	/* sanity check for guest timer interrupt */
  90.117 @@ -826,23 +826,23 @@ u64 vcpu_check_pending_interrupts(VCPU *
  90.118  			goto check_start;
  90.119  		}
  90.120  	}
  90.121 -//printf("XXXXXXX vcpu_check_pending_interrupts: got vector=%p...\n",vector);
  90.122 +//printk("XXXXXXX vcpu_check_pending_interrupts: got vector=%p...\n",vector);
  90.123  	if (*r >= mask) {
  90.124  		// masked by equal inservice
  90.125 -//printf("but masked by equal inservice\n");
  90.126 +//printk("but masked by equal inservice\n");
  90.127  		return SPURIOUS_VECTOR;
  90.128  	}
  90.129  	if (PSCB(vcpu, tpr) & IA64_TPR_MMI) {
  90.130  		// tpr.mmi is set
  90.131 -//printf("but masked by tpr.mmi\n");
  90.132 +//printk("but masked by tpr.mmi\n");
  90.133  		return SPURIOUS_VECTOR;
  90.134  	}
  90.135  	if (((PSCB(vcpu, tpr) & IA64_TPR_MIC) + 15) >= vector) {
  90.136  		//tpr.mic masks class
  90.137 -//printf("but masked by tpr.mic\n");
  90.138 +//printk("but masked by tpr.mic\n");
  90.139  		return SPURIOUS_VECTOR;
  90.140  	}
  90.141 -//printf("returned to caller\n");
  90.142 +//printk("returned to caller\n");
  90.143  	return vector;
  90.144  }
  90.145  
  90.146 @@ -902,7 +902,7 @@ IA64FAULT vcpu_get_ivr(VCPU * vcpu, u64 
  90.147  #if 0
  90.148  	if (vector == (PSCB(vcpu, itv) & 0xff)) {
  90.149  		if (!(++count[domid] & ((HEARTBEAT_FREQ * 1024) - 1))) {
  90.150 -			printf("Dom%d heartbeat... ticks=%lx,nonticks=%lx\n",
  90.151 +			printk("Dom%d heartbeat... ticks=%lx,nonticks=%lx\n",
  90.152  			       domid, count[domid], nonclockcount[domid]);
  90.153  			//count[domid] = 0;
  90.154  			//dump_runq();
  90.155 @@ -916,7 +916,7 @@ IA64FAULT vcpu_get_ivr(VCPU * vcpu, u64 
  90.156  	// getting ivr has "side effects"
  90.157  #ifdef IRQ_DEBUG
  90.158  	if (firsttime[vector]) {
  90.159 -		printf("*** First get_ivr on vector=%lu,itc=%lx\n",
  90.160 +		printk("*** First get_ivr on vector=%lu,itc=%lx\n",
  90.161  		       vector, ia64_get_itc());
  90.162  		firsttime[vector] = 0;
  90.163  	}
  90.164 @@ -930,7 +930,7 @@ IA64FAULT vcpu_get_ivr(VCPU * vcpu, u64 
  90.165  
  90.166  	i = vector >> 6;
  90.167  	mask = 1L << (vector & 0x3f);
  90.168 -//printf("ZZZZZZ vcpu_get_ivr: setting insvc mask for vector %lu\n",vector);
  90.169 +//printk("ZZZZZZ vcpu_get_ivr: setting insvc mask for vector %lu\n",vector);
  90.170  	PSCBX(vcpu, insvc[i]) |= mask;
  90.171  	PSCBX(vcpu, irr[i]) &= ~mask;
  90.172  	//PSCB(vcpu,pending_interruption)--;
  90.173 @@ -995,7 +995,7 @@ IA64FAULT vcpu_get_cmcv(VCPU * vcpu, u64
  90.174  IA64FAULT vcpu_get_lrr0(VCPU * vcpu, u64 * pval)
  90.175  {
  90.176  	// fix this when setting values other than m-bit is supported
  90.177 -	printf("vcpu_get_lrr0: Unmasked interrupts unsupported\n");
  90.178 +	printk("vcpu_get_lrr0: Unmasked interrupts unsupported\n");
  90.179  	*pval = (1L << 16);
  90.180  	return IA64_NO_FAULT;
  90.181  }
  90.182 @@ -1003,14 +1003,14 @@ IA64FAULT vcpu_get_lrr0(VCPU * vcpu, u64
  90.183  IA64FAULT vcpu_get_lrr1(VCPU * vcpu, u64 * pval)
  90.184  {
  90.185  	// fix this when setting values other than m-bit is supported
  90.186 -	printf("vcpu_get_lrr1: Unmasked interrupts unsupported\n");
  90.187 +	printk("vcpu_get_lrr1: Unmasked interrupts unsupported\n");
  90.188  	*pval = (1L << 16);
  90.189  	return IA64_NO_FAULT;
  90.190  }
  90.191  
  90.192  IA64FAULT vcpu_set_lid(VCPU * vcpu, u64 val)
  90.193  {
  90.194 -	printf("vcpu_set_lid: Setting cr.lid is unsupported\n");
  90.195 +	printk("vcpu_set_lid: Setting cr.lid is unsupported\n");
  90.196  	return IA64_ILLOP_FAULT;
  90.197  }
  90.198  
  90.199 @@ -1034,7 +1034,7 @@ IA64FAULT vcpu_set_eoi(VCPU * vcpu, u64 
  90.200  	for (i = 3; (i >= 0) && !(bits = *p); i--, p--)
  90.201  		;
  90.202  	if (i < 0) {
  90.203 -		printf("Trying to EOI interrupt when none are in-service.\n");
  90.204 +		printk("Trying to EOI interrupt when none are in-service.\n");
  90.205  		return IA64_NO_FAULT;
  90.206  	}
  90.207  	bitnum = ia64_fls(bits);
  90.208 @@ -1046,18 +1046,18 @@ IA64FAULT vcpu_set_eoi(VCPU * vcpu, u64 
  90.209  	if (!vcpu->vcpu_info->evtchn_upcall_mask) {	// but only if enabled...
  90.210  		// worry about this later... Linux only calls eoi
  90.211  		// with interrupts disabled
  90.212 -		printf("Trying to EOI interrupt with interrupts enabled\n");
  90.213 +		printk("Trying to EOI interrupt with interrupts enabled\n");
  90.214  	}
  90.215  	if (vcpu_check_pending_interrupts(vcpu) != SPURIOUS_VECTOR)
  90.216  		PSCB(vcpu, pending_interruption) = 1;
  90.217 -//printf("YYYYY vcpu_set_eoi: Successful\n");
  90.218 +//printk("YYYYY vcpu_set_eoi: Successful\n");
  90.219  	return IA64_NO_FAULT;
  90.220  }
  90.221  
  90.222  IA64FAULT vcpu_set_lrr0(VCPU * vcpu, u64 val)
  90.223  {
  90.224  	if (!(val & (1L << 16))) {
  90.225 -		printf("vcpu_set_lrr0: Unmasked interrupts unsupported\n");
  90.226 +		printk("vcpu_set_lrr0: Unmasked interrupts unsupported\n");
  90.227  		return IA64_ILLOP_FAULT;
  90.228  	}
  90.229  	// no place to save this state but nothing to do anyway
  90.230 @@ -1067,7 +1067,7 @@ IA64FAULT vcpu_set_lrr0(VCPU * vcpu, u64
  90.231  IA64FAULT vcpu_set_lrr1(VCPU * vcpu, u64 val)
  90.232  {
  90.233  	if (!(val & (1L << 16))) {
  90.234 -		printf("vcpu_set_lrr0: Unmasked interrupts unsupported\n");
  90.235 +		printk("vcpu_set_lrr0: Unmasked interrupts unsupported\n");
  90.236  		return IA64_ILLOP_FAULT;
  90.237  	}
  90.238  	// no place to save this state but nothing to do anyway
  90.239 @@ -1158,7 +1158,7 @@ void vcpu_safe_set_itm(unsigned long val
  90.240  
  90.241  	local_irq_save(flags);
  90.242  	while (1) {
  90.243 -//printf("*** vcpu_safe_set_itm: Setting itm to %lx, itc=%lx\n",val,now);
  90.244 +//printk("*** vcpu_safe_set_itm: Setting itm to %lx, itc=%lx\n",val,now);
  90.245  		ia64_set_itm(val);
  90.246  		if (val > (now = ia64_get_itc()))
  90.247  			break;
  90.248 @@ -1179,7 +1179,7 @@ void vcpu_set_next_timer(VCPU * vcpu)
  90.249  	 * but it doesn't matter right now */
  90.250  
  90.251  	if (is_idle_domain(vcpu->domain)) {
  90.252 -//		printf("****** vcpu_set_next_timer called during idle!!\n");
  90.253 +//		printk("****** vcpu_set_next_timer called during idle!!\n");
  90.254  		vcpu_safe_set_itm(s);
  90.255  		return;
  90.256  	}
  90.257 @@ -1198,7 +1198,7 @@ IA64FAULT vcpu_set_itm(VCPU * vcpu, u64 
  90.258  	//UINT now = ia64_get_itc();
  90.259  
  90.260  	//if (val < now) val = now + 1000;
  90.261 -//printf("*** vcpu_set_itm: called with %lx\n",val);
  90.262 +//printk("*** vcpu_set_itm: called with %lx\n",val);
  90.263  	PSCBX(vcpu, domain_itm) = val;
  90.264  	vcpu_set_next_timer(vcpu);
  90.265  	return IA64_NO_FAULT;
  90.266 @@ -1210,8 +1210,8 @@ IA64FAULT vcpu_set_itc(VCPU * vcpu, u64 
  90.267  #ifdef DISALLOW_SETTING_ITC_FOR_NOW
  90.268  	static int did_print;
  90.269  	if (!did_print) {
  90.270 -		printf("vcpu_set_itc: Setting ar.itc is currently disabled\n");
  90.271 -		printf("(this message is only displayed one)\n");
  90.272 +		printk("vcpu_set_itc: Setting ar.itc is currently disabled\n");
  90.273 +		printk("(this message is only displayed one)\n");
  90.274  		did_print = 1;
  90.275  	}
  90.276  #else
  90.277 @@ -1224,7 +1224,7 @@ IA64FAULT vcpu_set_itc(VCPU * vcpu, u64 
  90.278  
  90.279  	local_irq_disable();
  90.280  	if (olditm) {
  90.281 -		printf("**** vcpu_set_itc(%lx): vitm changed to %lx\n", val,
  90.282 +		printk("**** vcpu_set_itc(%lx): vitm changed to %lx\n", val,
  90.283  		       newnow + d);
  90.284  		PSCBX(vcpu, domain_itm) = newnow + d;
  90.285  	}
  90.286 @@ -1248,7 +1248,7 @@ IA64FAULT vcpu_set_itc(VCPU * vcpu, u64 
  90.287  IA64FAULT vcpu_get_itm(VCPU * vcpu, u64 * pval)
  90.288  {
  90.289  	//FIXME: Implement this
  90.290 -	printf("vcpu_get_itm: Getting cr.itm is unsupported... continuing\n");
  90.291 +	printk("vcpu_get_itm: Getting cr.itm is unsupported... continuing\n");
  90.292  	return IA64_NO_FAULT;
  90.293  	//return IA64_ILLOP_FAULT;
  90.294  }
  90.295 @@ -1256,7 +1256,7 @@ IA64FAULT vcpu_get_itm(VCPU * vcpu, u64 
  90.296  IA64FAULT vcpu_get_itc(VCPU * vcpu, u64 * pval)
  90.297  {
  90.298  	//TODO: Implement this
  90.299 -	printf("vcpu_get_itc: Getting ar.itc is unsupported\n");
  90.300 +	printk("vcpu_get_itc: Getting ar.itc is unsupported\n");
  90.301  	return IA64_ILLOP_FAULT;
  90.302  }
  90.303  
  90.304 @@ -1349,7 +1349,7 @@ IA64FAULT vcpu_rfi(VCPU * vcpu)
  90.305  	psr.ia64_psr.bn = 1;
  90.306  	//psr.pk = 1;  // checking pkeys shouldn't be a problem but seems broken
  90.307  	if (psr.ia64_psr.be) {
  90.308 -		printf("*** DOMAIN TRYING TO TURN ON BIG-ENDIAN!!!\n");
  90.309 +		printk("*** DOMAIN TRYING TO TURN ON BIG-ENDIAN!!!\n");
  90.310  		return IA64_ILLOP_FAULT;
  90.311  	}
  90.312  	PSCB(vcpu, incomplete_regframe) = 0;	// is this necessary?
  90.313 @@ -1416,7 +1416,7 @@ IA64FAULT vcpu_thash(VCPU * vcpu, u64 va
  90.314  
  90.315  IA64FAULT vcpu_ttag(VCPU * vcpu, u64 vadr, u64 * padr)
  90.316  {
  90.317 -	printf("vcpu_ttag: ttag instruction unsupported\n");
  90.318 +	printk("vcpu_ttag: ttag instruction unsupported\n");
  90.319  	return IA64_ILLOP_FAULT;
  90.320  }
  90.321  
  90.322 @@ -1730,7 +1730,7 @@ IA64FAULT vcpu_tpa(VCPU * vcpu, u64 vadr
  90.323  
  90.324  IA64FAULT vcpu_tak(VCPU * vcpu, u64 vadr, u64 * key)
  90.325  {
  90.326 -	printf("vcpu_tak: tak instruction unsupported\n");
  90.327 +	printk("vcpu_tak: tak instruction unsupported\n");
  90.328  	return IA64_ILLOP_FAULT;
  90.329  	// HACK ALERT: tak does a thash for now
  90.330  	//return vcpu_thash(vcpu,vadr,key);
  90.331 @@ -1781,7 +1781,7 @@ IA64FAULT vcpu_set_pmc(VCPU * vcpu, u64 
  90.332  	// TODO: Should set Logical CPU state, not just physical
  90.333  	// NOTE: Writes to unimplemented PMC registers are discarded
  90.334  #ifdef DEBUG_PFMON
  90.335 -	printf("vcpu_set_pmc(%x,%lx)\n", reg, val);
  90.336 +	printk("vcpu_set_pmc(%x,%lx)\n", reg, val);
  90.337  #endif
  90.338  	ia64_set_pmc(reg, val);
  90.339  	return IA64_NO_FAULT;
  90.340 @@ -1792,7 +1792,7 @@ IA64FAULT vcpu_set_pmd(VCPU * vcpu, u64 
  90.341  	// TODO: Should set Logical CPU state, not just physical
  90.342  	// NOTE: Writes to unimplemented PMD registers are discarded
  90.343  #ifdef DEBUG_PFMON
  90.344 -	printf("vcpu_set_pmd(%x,%lx)\n", reg, val);
  90.345 +	printk("vcpu_set_pmd(%x,%lx)\n", reg, val);
  90.346  #endif
  90.347  	ia64_set_pmd(reg, val);
  90.348  	return IA64_NO_FAULT;
  90.349 @@ -1803,7 +1803,7 @@ IA64FAULT vcpu_get_pmc(VCPU * vcpu, u64 
  90.350  	// NOTE: Reads from unimplemented PMC registers return zero
  90.351  	u64 val = (u64) ia64_get_pmc(reg);
  90.352  #ifdef DEBUG_PFMON
  90.353 -	printf("%lx=vcpu_get_pmc(%x)\n", val, reg);
  90.354 +	printk("%lx=vcpu_get_pmc(%x)\n", val, reg);
  90.355  #endif
  90.356  	*pval = val;
  90.357  	return IA64_NO_FAULT;
  90.358 @@ -1814,7 +1814,7 @@ IA64FAULT vcpu_get_pmd(VCPU * vcpu, u64 
  90.359  	// NOTE: Reads from unimplemented PMD registers return zero
  90.360  	u64 val = (u64) ia64_get_pmd(reg);
  90.361  #ifdef DEBUG_PFMON
  90.362 -	printf("%lx=vcpu_get_pmd(%x)\n", val, reg);
  90.363 +	printk("%lx=vcpu_get_pmd(%x)\n", val, reg);
  90.364  #endif
  90.365  	*pval = val;
  90.366  	return IA64_NO_FAULT;
  90.367 @@ -2061,7 +2061,7 @@ IA64FAULT vcpu_itr_d(VCPU * vcpu, u64 sl
  90.368  	vcpu_purge_tr_entry(&PSCBX(vcpu, dtlb));
  90.369  
  90.370  	trp = &PSCBX(vcpu, dtrs[slot]);
  90.371 -//printf("***** itr.d: setting slot %d: ifa=%p\n",slot,ifa);
  90.372 +//printk("***** itr.d: setting slot %d: ifa=%p\n",slot,ifa);
  90.373  	vcpu_set_tr_entry(trp, pte, itir, ifa);
  90.374  	vcpu_quick_region_set(PSCBX(vcpu, dtr_regions), ifa);
  90.375  
  90.376 @@ -2088,7 +2088,7 @@ IA64FAULT vcpu_itr_i(VCPU * vcpu, u64 sl
  90.377  	vcpu_purge_tr_entry(&PSCBX(vcpu, itlb));
  90.378  
  90.379  	trp = &PSCBX(vcpu, itrs[slot]);
  90.380 -//printf("***** itr.i: setting slot %d: ifa=%p\n",slot,ifa);
  90.381 +//printk("***** itr.i: setting slot %d: ifa=%p\n",slot,ifa);
  90.382  	vcpu_set_tr_entry(trp, pte, itir, ifa);
  90.383  	vcpu_quick_region_set(PSCBX(vcpu, itr_regions), ifa);
  90.384  
  90.385 @@ -2171,7 +2171,7 @@ vcpu_itc_no_srlz(VCPU * vcpu, u64 IorD, 
  90.386  		// FIXME: this is dangerous... vhpt_flush_address ensures these
  90.387  		// addresses never get flushed.  More work needed if this
  90.388  		// ever happens.
  90.389 -//printf("vhpt_insert(%p,%p,%p)\n",vaddr,pte,1L<<logps);
  90.390 +//printk("vhpt_insert(%p,%p,%p)\n",vaddr,pte,1L<<logps);
  90.391  		if (logps > PAGE_SHIFT)
  90.392  			vhpt_multiple_insert(vaddr, pte, logps);
  90.393  		else
  90.394 @@ -2307,7 +2307,7 @@ IA64FAULT vcpu_ptc_ga(VCPU * vcpu, u64 v
  90.395  	// FIXME: validate not flushing Xen addresses
  90.396  	// if (Xen address) return(IA64_ILLOP_FAULT);
  90.397  	// FIXME: ??breaks if domain PAGE_SIZE < Xen PAGE_SIZE
  90.398 -//printf("######## vcpu_ptc_ga(%p,%p) ##############\n",vadr,addr_range);
  90.399 +//printk("######## vcpu_ptc_ga(%p,%p) ##############\n",vadr,addr_range);
  90.400  
  90.401  	check_xen_space_overlap("ptc_ga", vadr, addr_range);
  90.402  
    91.1 --- a/xen/arch/ia64/xen/vhpt.c	Tue Oct 24 10:08:30 2006 -0600
    91.2 +++ b/xen/arch/ia64/xen/vhpt.c	Tue Oct 24 11:21:48 2006 -0600
    91.3 @@ -109,7 +109,7 @@ void vhpt_multiple_insert(unsigned long 
    91.4  		//  only a few times/second, so OK for now.
    91.5  		//  An alternate solution would be to just insert the one
    91.6  		//  16KB in the vhpt (but with the full mapping)?
    91.7 -		//printf("vhpt_multiple_insert: logps-PAGE_SHIFT==%d,"
    91.8 +		//printk("vhpt_multiple_insert: logps-PAGE_SHIFT==%d,"
    91.9  			//"va=%p, pa=%p, pa-masked=%p\n",
   91.10  			//logps-PAGE_SHIFT,vaddr,pte&_PFN_MASK,
   91.11  			//(pte&_PFN_MASK)&~mask);
   91.12 @@ -142,7 +142,7 @@ void vhpt_init(void)
   91.13  		panic("vhpt_init: bad VHPT alignment!\n");
   91.14  	__get_cpu_var(vhpt_paddr) = paddr;
   91.15  	__get_cpu_var(vhpt_pend) = paddr + (1 << VHPT_SIZE_LOG2) - 1;
   91.16 -	printf("vhpt_init: vhpt paddr=0x%lx, end=0x%lx\n",
   91.17 +	printk("vhpt_init: vhpt paddr=0x%lx, end=0x%lx\n",
   91.18  		paddr, __get_cpu_var(vhpt_pend));
   91.19  	vhpt_erase(paddr);
   91.20  	// we don't enable VHPT here.
   91.21 @@ -336,7 +336,7 @@ void domain_flush_vtlb_range (struct dom
   91.22  #if 0
   91.23  	// this only seems to occur at shutdown, but it does occur
   91.24  	if ((!addr_range) || addr_range & (addr_range - 1)) {
   91.25 -		printf("vhpt_flush_address: weird range, spinning...\n");
   91.26 +		printk("vhpt_flush_address: weird range, spinning...\n");
   91.27  		while(1);
   91.28  	}
   91.29  #endif
    92.1 --- a/xen/arch/ia64/xen/xencomm.c	Tue Oct 24 10:08:30 2006 -0600
    92.2 +++ b/xen/arch/ia64/xen/xencomm.c	Tue Oct 24 11:21:48 2006 -0600
    92.3 @@ -92,7 +92,7 @@ xencomm_copy_from_guest(
    92.4      unsigned int i = 0;
    92.5  
    92.6      if (xencomm_debug)
    92.7 -        printf("xencomm_copy_from_guest: from=%lx+%u n=%u\n",
    92.8 +        printk("xencomm_copy_from_guest: from=%lx+%u n=%u\n",
    92.9                 (unsigned long)from, skip, n);
   92.10  
   92.11      if (XENCOMM_IS_INLINE(from)) {
   92.12 @@ -158,7 +158,7 @@ xencomm_copy_from_guest(
   92.13  	    int res;
   92.14  
   92.15              if (xencomm_debug > 1)
   92.16 -                printf ("src_paddr=%lx i=%d, skip=%d\n",
   92.17 +                printk ("src_paddr=%lx i=%d, skip=%d\n",
   92.18                          src_paddr, i, chunk_skip);
   92.19  
   92.20              res = xencomm_copy_chunk_from((unsigned long)to + to_pos,
   92.21 @@ -233,7 +233,7 @@ xencomm_copy_to_guest(
   92.22      unsigned int i = 0;
   92.23  
   92.24      if (xencomm_debug)
   92.25 -        printf ("xencomm_copy_to_guest: to=%lx+%u n=%u\n",
   92.26 +        printk ("xencomm_copy_to_guest: to=%lx+%u n=%u\n",
   92.27                  (unsigned long)to, skip, n);
   92.28  
   92.29      if (XENCOMM_IS_INLINE(to)) {
    93.1 --- a/xen/arch/ia64/xen/xenmisc.c	Tue Oct 24 10:08:30 2006 -0600
    93.2 +++ b/xen/arch/ia64/xen/xenmisc.c	Tue Oct 24 11:21:48 2006 -0600
    93.3 @@ -179,13 +179,13 @@ void panic_domain(struct pt_regs *regs, 
    93.4  	char buf[256];
    93.5  	struct vcpu *v = current;
    93.6  
    93.7 -	printf("$$$$$ PANIC in domain %d (k6=0x%lx): ",
    93.8 +	printk("$$$$$ PANIC in domain %d (k6=0x%lx): ",
    93.9  		v->domain->domain_id,
   93.10  		__get_cpu_var(cpu_kr)._kr[IA64_KR_CURRENT]);
   93.11  	va_start(args, fmt);
   93.12  	(void)vsnprintf(buf, sizeof(buf), fmt, args);
   93.13  	va_end(args);
   93.14 -	printf(buf);
   93.15 +	printk(buf);
   93.16  	if (regs) show_registers(regs);
   93.17  	if (regs) {
   93.18  		debugger_trap_fatal(0 /* don't care */, regs);
    94.1 --- a/xen/arch/ia64/xen/xensetup.c	Tue Oct 24 10:08:30 2006 -0600
    94.2 +++ b/xen/arch/ia64/xen/xensetup.c	Tue Oct 24 11:21:48 2006 -0600
    94.3 @@ -389,13 +389,13 @@ void start_kernel(void)
    94.4      /* first find highest page frame number */
    94.5      max_page = 0;
    94.6      efi_memmap_walk(find_max_pfn, &max_page);
    94.7 -    printf("find_memory: efi_memmap_walk returns max_page=%lx\n",max_page);
    94.8 +    printk("find_memory: efi_memmap_walk returns max_page=%lx\n",max_page);
    94.9      efi_print();
   94.10  
   94.11      xen_heap_start = memguard_init(ia64_imva(&_end));
   94.12 -    printf("Before xen_heap_start: %p\n", xen_heap_start);
   94.13 +    printk("Before xen_heap_start: %p\n", xen_heap_start);
   94.14      xen_heap_start = __va(init_boot_allocator(__pa(xen_heap_start)));
   94.15 -    printf("After xen_heap_start: %p\n", xen_heap_start);
   94.16 +    printk("After xen_heap_start: %p\n", xen_heap_start);
   94.17  
   94.18      efi_memmap_walk(filter_rsvd_memory, init_boot_pages);
   94.19      efi_memmap_walk(xen_count_pages, &nr_pages);
    95.1 --- a/xen/arch/ia64/xen/xentime.c	Tue Oct 24 10:08:30 2006 -0600
    95.2 +++ b/xen/arch/ia64/xen/xentime.c	Tue Oct 24 11:21:48 2006 -0600
    95.3 @@ -115,7 +115,7 @@ xen_timer_interrupt (int irq, void *dev_
    95.4  #ifdef HEARTBEAT_FREQ
    95.5  	static long count = 0;
    95.6  	if (!(++count & ((HEARTBEAT_FREQ*1024)-1))) {
    95.7 -		printf("Heartbeat... iip=%p\n", /*",psr.i=%d,pend=%d\n", */
    95.8 +		printk("Heartbeat... iip=%p\n", /*",psr.i=%d,pend=%d\n", */
    95.9  			regs->cr_iip /*,
   95.10  			!current->vcpu_info->evtchn_upcall_mask,
   95.11  			VCPU(current,pending_interruption) */);
    96.1 --- a/xen/arch/powerpc/backtrace.c	Tue Oct 24 10:08:30 2006 -0600
    96.2 +++ b/xen/arch/powerpc/backtrace.c	Tue Oct 24 11:21:48 2006 -0600
    96.3 @@ -93,13 +93,13 @@ static void xmon_print_symbol(unsigned l
    96.4  	const char *name = NULL;
    96.5  	unsigned long offset, size;
    96.6  
    96.7 -	printf(REG, address);
    96.8 +	printk(REG, address);
    96.9  
   96.10      name = symbols_lookup(address, &size, &offset, namebuf);
   96.11  	if (name) {
   96.12 -		printf("%s%s+%#lx/%#lx", mid, name, offset, size);
   96.13 +		printk("%s%s+%#lx/%#lx", mid, name, offset, size);
   96.14  	}
   96.15 -	printf("%s", after);
   96.16 +	printk("%s", after);
   96.17  }
   96.18  
   96.19  static void backtrace(
   96.20 @@ -114,13 +114,13 @@ static void backtrace(
   96.21  	do {
   96.22  		if (sp > xenheap_phys_end) {
   96.23  			if (sp != 0)
   96.24 -				printf("SP (%lx) is not in xen space\n", sp);
   96.25 +				printk("SP (%lx) is not in xen space\n", sp);
   96.26  			break;
   96.27  		}
   96.28  
   96.29  		if (!mread(sp + LRSAVE_OFFSET, &ip, sizeof(unsigned long))
   96.30  		    || !mread(sp, &newsp, sizeof(unsigned long))) {
   96.31 -			printf("Couldn't read stack frame at %lx\n", sp);
   96.32 +			printk("Couldn't read stack frame at %lx\n", sp);
   96.33  			break;
   96.34  		}
   96.35  
   96.36 @@ -147,17 +147,17 @@ static void backtrace(
   96.37  				printip = 0;
   96.38  			} else if (lr < xenheap_phys_end
   96.39                         && !(fnstart <= lr && lr < fnend)) {
   96.40 -				printf("[link register   ] ");
   96.41 +				printk("[link register   ] ");
   96.42  				xmon_print_symbol(lr, " ", "\n");
   96.43  			}
   96.44  			if (printip) {
   96.45 -				printf("["REG"] ", sp);
   96.46 +				printk("["REG"] ", sp);
   96.47  				xmon_print_symbol(ip, " ", " (unreliable)\n");
   96.48  			}
   96.49  			pc = lr = 0;
   96.50  
   96.51  		} else {
   96.52 -			printf("["REG"] ", sp);
   96.53 +			printk("["REG"] ", sp);
   96.54  			xmon_print_symbol(ip, " ", "\n");
   96.55  		}
   96.56  
   96.57 @@ -167,11 +167,11 @@ static void backtrace(
   96.58  		    && marker == REG_FRAME_MARKER) {
   96.59  			if (mread(sp + REGS_OFFSET, &regs, sizeof(regs))
   96.60  			    != sizeof(regs)) {
   96.61 -				printf("Couldn't read registers at %lx\n",
   96.62 +				printk("Couldn't read registers at %lx\n",
   96.63  				       sp + REGS_OFFSET);
   96.64  				break;
   96.65  			}
   96.66 -            printf("--- Exception: %x %s at ", regs.entry_vector,
   96.67 +            printk("--- Exception: %x %s at ", regs.entry_vector,
   96.68  			       getvecname(TRAP(&regs)));
   96.69  			pc = regs.pc;
   96.70  			lr = regs.lr;
    97.1 --- a/xen/arch/powerpc/domain.c	Tue Oct 24 10:08:30 2006 -0600
    97.2 +++ b/xen/arch/powerpc/domain.c	Tue Oct 24 11:21:48 2006 -0600
    97.3 @@ -97,14 +97,14 @@ void arch_domain_destroy(struct domain *
    97.4  
    97.5  void machine_halt(void)
    97.6  {
    97.7 -    printf("machine_halt called: spinning....\n");
    97.8 +    printk("machine_halt called: spinning....\n");
    97.9      console_start_sync();
   97.10      while(1);
   97.11  }
   97.12  
   97.13  void machine_restart(char * __unused)
   97.14  {
   97.15 -    printf("machine_restart called: spinning....\n");
   97.16 +    printk("machine_restart called: spinning....\n");
   97.17      console_start_sync();
   97.18      while(1);
   97.19  }
   97.20 @@ -134,7 +134,7 @@ int arch_set_info_guest(struct vcpu *v, 
   97.21  { 
   97.22      memcpy(&v->arch.ctxt, &c->user_regs, sizeof(c->user_regs));
   97.23  
   97.24 -    printf("Domain[%d].%d: initializing\n",
   97.25 +    printk("Domain[%d].%d: initializing\n",
   97.26             v->domain->domain_id, v->vcpu_id);
   97.27  
   97.28      if (v->domain->arch.htab.order == 0)
   97.29 @@ -186,7 +186,7 @@ void context_switch(struct vcpu *prev, s
   97.30      unsigned int cpu = smp_processor_id();
   97.31  
   97.32  #if 0
   97.33 -    printf("%s: dom %x to dom %x\n", __func__, prev->domain->domain_id,
   97.34 +    printk("%s: dom %x to dom %x\n", __func__, prev->domain->domain_id,
   97.35              next->domain->domain_id);
   97.36  #endif
   97.37  
    98.1 --- a/xen/arch/powerpc/of-devwalk.c	Tue Oct 24 10:08:30 2006 -0600
    98.2 +++ b/xen/arch/powerpc/of-devwalk.c	Tue Oct 24 11:21:48 2006 -0600
    98.3 @@ -35,7 +35,7 @@ void ofd_prop_print(
    98.4      if ( path[0] == '/' && path[1] == '\0' ) {
    98.5          path = "";
    98.6      }
    98.7 -    printf("%s: %s/%s: 0x%lx\n", head, path,  name, sz);
    98.8 +    printk("%s: %s/%s: 0x%lx\n", head, path,  name, sz);
    98.9  
   98.10  #define DEBUG_PROP
   98.11  #ifdef DEBUG_PROP
   98.12 @@ -56,24 +56,24 @@ void ofd_prop_print(
   98.13      }
   98.14  
   98.15      if ( isstr > 0 ) {
   98.16 -        printf("%s: \t%s\n", head, b);
   98.17 +        printk("%s: \t%s\n", head, b);
   98.18      } else if ( sz != 0 ) {
   98.19 -        printf("%s: \t0x", head);
   98.20 +        printk("%s: \t0x", head);
   98.21  
   98.22          for ( i = 0; i < sz; i++ ) {
   98.23              if ( (i % 4) == 0 && i != 0 ) {
   98.24                  if ( (i % 16) == 0 && i != 0 ) {
   98.25 -                    printf("\n%s: \t0x", head);
   98.26 +                    printk("\n%s: \t0x", head);
   98.27                  } else {
   98.28 -                    printf(" 0x");
   98.29 +                    printk(" 0x");
   98.30                  }
   98.31              }
   98.32              if (b[i] < 0x10) {
   98.33 -                printf("0");
   98.34 +                printk("0");
   98.35              }
   98.36 -            printf("%x", b[i]);
   98.37 +            printk("%x", b[i]);
   98.38          }
   98.39 -        printf("\n");
   98.40 +        printk("\n");
   98.41      }
   98.42  #else
   98.43      (void)prop;
   98.44 @@ -95,7 +95,7 @@ void ofd_dump_props(void *mem, ofdn_t n,
   98.45      }
   98.46  
   98.47      if (dump & OFD_DUMP_NAMES) {
   98.48 -        printf("of_walk: %s: phandle 0x%x\n", path, n);
   98.49 +        printk("of_walk: %s: phandle 0x%x\n", path, n);
   98.50      }
   98.51  
   98.52      p = ofd_nextprop(mem, n, NULL, name);
    99.1 --- a/xen/arch/powerpc/powerpc64/domain.c	Tue Oct 24 10:08:30 2006 -0600
    99.2 +++ b/xen/arch/powerpc/powerpc64/domain.c	Tue Oct 24 11:21:48 2006 -0600
    99.3 @@ -112,7 +112,7 @@ void save_segments(struct vcpu *v)
    99.4          slb_entry[i].slb_esid = esid;
    99.5  #ifdef SLB_DEBUG
    99.6          if (vsid != 0) {
    99.7 -            printf("%s: DOM[0x%x]: S%02d: 0x%016lx 0x%016lx\n",
    99.8 +            printk("%s: DOM[0x%x]: S%02d: 0x%016lx 0x%016lx\n",
    99.9                      __func__, v->domain->domain_id, i, vsid, esid);
   99.10          }
   99.11  #endif
   99.12 @@ -146,7 +146,7 @@ void load_segments(struct vcpu *v)
   99.13  
   99.14  #ifdef SLB_DEBUG
   99.15          if (vsid != 0) {
   99.16 -            printf("%s: DOM[0x%x]: R%02d: 0x%016lx 0x%016lx\n",
   99.17 +            printk("%s: DOM[0x%x]: R%02d: 0x%016lx 0x%016lx\n",
   99.18                      __func__, v->domain->domain_id, i, vsid, esid);
   99.19          }
   99.20  #endif
   99.21 @@ -173,6 +173,6 @@ void dump_segments(int valid)
   99.22  
   99.23          if (valid && !(esid & SLB_ESID_VALID))
   99.24              continue;
   99.25 -        printf("S%02d: 0x%016lx 0x%016lx\n", i, vsid, esid);
   99.26 +        printk("S%02d: 0x%016lx 0x%016lx\n", i, vsid, esid);
   99.27      }
   99.28  }
   100.1 --- a/xen/arch/x86/boot/x86_32.S	Tue Oct 24 10:08:30 2006 -0600
   100.2 +++ b/xen/arch/x86/boot/x86_32.S	Tue Oct 24 11:21:48 2006 -0600
   100.3 @@ -185,7 +185,7 @@ ignore_int:
   100.4          mov     %eax,%ds
   100.5          mov     %eax,%es
   100.6          pushl   $int_msg
   100.7 -        call    printf
   100.8 +        call    printk
   100.9  1:      jmp     1b
  100.10  
  100.11  /*** STACK LOCATION ***/
   101.1 --- a/xen/arch/x86/boot/x86_64.S	Tue Oct 24 10:08:30 2006 -0600
   101.2 +++ b/xen/arch/x86/boot/x86_64.S	Tue Oct 24 11:21:48 2006 -0600
   101.3 @@ -186,7 +186,7 @@ ignore_int:
   101.4          cld
   101.5          leaq    int_msg(%rip),%rdi
   101.6          xorl    %eax,%eax
   101.7 -        call    printf
   101.8 +        call    printk
   101.9  1:      jmp     1b
  101.10  
  101.11  
   102.1 --- a/xen/arch/x86/domain.c	Tue Oct 24 10:08:30 2006 -0600
   102.2 +++ b/xen/arch/x86/domain.c	Tue Oct 24 11:21:48 2006 -0600
   102.3 @@ -378,6 +378,7 @@ arch_do_vcpu_op(
   102.4      case VCPUOP_register_runstate_memory_area:
   102.5      {
   102.6          struct vcpu_register_runstate_memory_area area;
   102.7 +        struct vcpu_runstate_info runstate;
   102.8  
   102.9          rc = -EFAULT;
  102.10          if ( copy_from_guest(&area, arg, 1) )
  102.11 @@ -390,8 +391,15 @@ arch_do_vcpu_op(
  102.12          v->runstate_guest = area.addr.v;
  102.13  
  102.14          if ( v == current )
  102.15 +        {
  102.16              __copy_to_user(v->runstate_guest, &v->runstate,
  102.17                             sizeof(v->runstate));
  102.18 +        }
  102.19 +        else
  102.20 +        {
  102.21 +            vcpu_runstate_get(v, &runstate);
  102.22 +            __copy_to_user(v->runstate_guest, &runstate, sizeof(runstate));
  102.23 +        }
  102.24  
  102.25          break;
  102.26      }
   103.1 --- a/xen/arch/x86/hvm/hvm.c	Tue Oct 24 10:08:30 2006 -0600
   103.2 +++ b/xen/arch/x86/hvm/hvm.c	Tue Oct 24 11:21:48 2006 -0600
   103.3 @@ -237,13 +237,18 @@ void hvm_do_resume(struct vcpu *v)
   103.4      }
   103.5  
   103.6      p = &get_vio(v->domain, v->vcpu_id)->vp_ioreq;
   103.7 -    wait_on_xen_event_channel(v->arch.hvm.xen_port,
   103.8 +    wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port,
   103.9                                p->state != STATE_IOREQ_READY &&
  103.10                                p->state != STATE_IOREQ_INPROCESS);
  103.11 -    if ( p->state == STATE_IORESP_READY )
  103.12 +    switch ( p->state )
  103.13 +    {
  103.14 +    case STATE_IORESP_READY:
  103.15          hvm_io_assist(v);
  103.16 -    if ( p->state != STATE_INVALID ) {
  103.17 -        printf("Weird HVM iorequest state %d.\n", p->state);
  103.18 +        break;
  103.19 +    case STATE_INVALID:
  103.20 +        break;
  103.21 +    default:
  103.22 +        printk("Weird HVM iorequest state %d.\n", p->state);
  103.23          domain_crash(v->domain);
  103.24      }
  103.25  }
   104.1 --- a/xen/arch/x86/hvm/io.c	Tue Oct 24 10:08:30 2006 -0600
   104.2 +++ b/xen/arch/x86/hvm/io.c	Tue Oct 24 11:21:48 2006 -0600
   104.3 @@ -723,7 +723,7 @@ void hvm_io_assist(struct vcpu *v)
   104.4      vio = get_vio(v->domain, v->vcpu_id);
   104.5  
   104.6      if ( vio == 0 ) {
   104.7 -        printf("bad shared page: %lx\n", (unsigned long)vio);
   104.8 +        printk("bad shared page: %lx\n", (unsigned long)vio);
   104.9          domain_crash_synchronous();
  104.10      }
  104.11  
   105.1 --- a/xen/arch/x86/hvm/platform.c	Tue Oct 24 10:08:30 2006 -0600
   105.2 +++ b/xen/arch/x86/hvm/platform.c	Tue Oct 24 11:21:48 2006 -0600
   105.3 @@ -727,7 +727,8 @@ static void hvm_send_assist_req(struct v
   105.4          domain_crash(v->domain);
   105.5          return;
   105.6      }
   105.7 -    wmb();
   105.8 +
   105.9 +    prepare_wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port);
  105.10      p->state = STATE_IOREQ_READY;
  105.11      notify_via_xen_event_channel(v->arch.hvm_vcpu.xen_port);
  105.12  }
  105.13 @@ -740,7 +741,8 @@ void send_pio_req(unsigned long port, un
  105.14      ioreq_t *p;
  105.15  
  105.16      if ( size == 0 || count == 0 ) {
  105.17 -        printf("null pio request? port %lx, count %lx, size %d, value %lx, dir %d, pvalid %d.\n",
  105.18 +        printk("null pio request? port %lx, count %lx, "
  105.19 +               "size %d, value %lx, dir %d, pvalid %d.\n",
  105.20                 port, count, size, value, dir, pvalid);
  105.21      }
  105.22  
  105.23 @@ -793,7 +795,8 @@ static void send_mmio_req(unsigned char 
  105.24      ioreq_t *p;
  105.25  
  105.26      if ( size == 0 || count == 0 ) {
  105.27 -        printf("null mmio request? type %d, gpa %lx, count %lx, size %d, value %lx, dir %d, pvalid %d.\n",
  105.28 +        printk("null mmio request? type %d, gpa %lx, "
  105.29 +               "count %lx, size %d, value %lx, dir %d, pvalid %d.\n",
  105.30                 type, gpa, count, size, value, dir, pvalid);
  105.31      }
  105.32  
   106.1 --- a/xen/arch/x86/hvm/svm/intr.c	Tue Oct 24 10:08:30 2006 -0600
   106.2 +++ b/xen/arch/x86/hvm/svm/intr.c	Tue Oct 24 11:21:48 2006 -0600
   106.3 @@ -59,7 +59,7 @@ static inline int svm_inject_extint(stru
   106.4      intr.fields.prio = 0xF;
   106.5      intr.fields.ign_tpr = 1;
   106.6      vmcb->vintr = intr;
   106.7 -//  printf( "IRQ = %d\n", trap );
   106.8 +
   106.9      return 0;
  106.10  }
  106.11      
   107.1 --- a/xen/arch/x86/hvm/svm/svm.c	Tue Oct 24 10:08:30 2006 -0600
   107.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Tue Oct 24 11:21:48 2006 -0600
   107.3 @@ -1021,7 +1021,7 @@ static void svm_do_general_protection_fa
   107.4      error_code = vmcb->exitinfo1;
   107.5  
   107.6      if (vmcb->idtr.limit == 0) {
   107.7 -        printf("Huh? We got a GP Fault with an invalid IDTR!\n");
   107.8 +        printk("Huh? We got a GP Fault with an invalid IDTR!\n");
   107.9          svm_dump_vmcb(__func__, vmcb);
  107.10          svm_dump_regs(__func__, regs);
  107.11          svm_dump_inst(vmcb->rip);
  107.12 @@ -2295,7 +2295,7 @@ static int svm_do_vmmcall(struct vcpu *v
  107.13          /* VMMCALL sanity check */
  107.14          if ( vmcb->cpl > get_vmmcall_cpl(regs->edi) )
  107.15          {
  107.16 -            printf("VMMCALL CPL check failed\n");
  107.17 +            printk("VMMCALL CPL check failed\n");
  107.18              return -1;
  107.19          }
  107.20  
  107.21 @@ -2305,7 +2305,7 @@ static int svm_do_vmmcall(struct vcpu *v
  107.22          case VMMCALL_RESET_TO_REALMODE:
  107.23              if ( svm_do_vmmcall_reset_to_realmode(v, regs) )
  107.24              {
  107.25 -                printf("svm_do_vmmcall_reset_to_realmode() failed\n");
  107.26 +                printk("svm_do_vmmcall_reset_to_realmode() failed\n");
  107.27                  return -1;
  107.28              }
  107.29              /* since we just reset the VMCB, return without adjusting
  107.30 @@ -2313,7 +2313,7 @@ static int svm_do_vmmcall(struct vcpu *v
  107.31              return 0;
  107.32  
  107.33          case VMMCALL_DEBUG:
  107.34 -            printf("DEBUG features not implemented yet\n");
  107.35 +            printk("DEBUG features not implemented yet\n");
  107.36              break;
  107.37          default:
  107.38              break;
  107.39 @@ -2344,16 +2344,16 @@ void svm_dump_inst(unsigned long eip)
  107.40      if (hvm_copy_from_guest_virt(opcode, ptr, sizeof(opcode)) == 0)
  107.41          len = sizeof(opcode);
  107.42  
  107.43 -    printf("Code bytes around(len=%d) %lx:", len, eip);
  107.44 +    printk("Code bytes around(len=%d) %lx:", len, eip);
  107.45      for (i = 0; i < len; i++)
  107.46      {
  107.47          if ((i & 0x0f) == 0)
  107.48 -            printf("\n%08lx:", ptr+i);
  107.49 -
  107.50 -        printf("%02x ", opcode[i]);
  107.51 +            printk("\n%08lx:", ptr+i);
  107.52 +
  107.53 +        printk("%02x ", opcode[i]);
  107.54      }
  107.55  
  107.56 -    printf("\n");
  107.57 +    printk("\n");
  107.58  }
  107.59  
  107.60  
  107.61 @@ -2363,7 +2363,7 @@ void svm_dump_regs(const char *from, str
  107.62      struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
  107.63      unsigned long pt = v->arch.hvm_vcpu.hw_cr3;
  107.64  
  107.65 -    printf("%s: guest registers from %s:\n", __func__, from);
  107.66 +    printk("%s: guest registers from %s:\n", __func__, from);
  107.67  #if defined (__x86_64__)
  107.68      printk("rax: %016lx   rbx: %016lx   rcx: %016lx\n",
  107.69             regs->rax, regs->rbx, regs->rcx);
  107.70 @@ -2378,15 +2378,15 @@ void svm_dump_regs(const char *from, str
  107.71      printk("r15: %016lx   cr0: %016lx   cr3: %016lx\n",
  107.72             regs->r15, v->arch.hvm_svm.cpu_shadow_cr0, vmcb->cr3);
  107.73  #else
  107.74 -    printf("eax: %08x, ebx: %08x, ecx: %08x, edx: %08x\n", 
  107.75 +    printk("eax: %08x, ebx: %08x, ecx: %08x, edx: %08x\n", 
  107.76             regs->eax, regs->ebx, regs->ecx, regs->edx);
  107.77 -    printf("edi: %08x, esi: %08x, ebp: %08x, esp: %08x\n", 
  107.78 +    printk("edi: %08x, esi: %08x, ebp: %08x, esp: %08x\n", 
  107.79             regs->edi, regs->esi, regs->ebp, regs->esp);
  107.80 -    printf("%s: guest cr0: %lx\n", __func__, 
  107.81 +    printk("%s: guest cr0: %lx\n", __func__, 
  107.82             v->arch.hvm_svm.cpu_shadow_cr0);
  107.83 -    printf("guest CR3 = %llx\n", vmcb->cr3);
  107.84 +    printk("guest CR3 = %llx\n", vmcb->cr3);
  107.85  #endif
  107.86 -    printf("%s: pt = %lx\n", __func__, pt);
  107.87 +    printk("%s: pt = %lx\n", __func__, pt);
  107.88  }
  107.89  
  107.90  
  107.91 @@ -2395,12 +2395,12 @@ void svm_dump_host_regs(const char *from
  107.92      struct vcpu *v = current;
  107.93      unsigned long pt = pt = pagetable_get_paddr(v->arch.monitor_table);
  107.94      unsigned long cr3, cr0;
  107.95 -    printf("Host registers at %s\n", from);
  107.96 +    printk("Host registers at %s\n", from);
  107.97  
  107.98      __asm__ __volatile__ ("\tmov %%cr0,%0\n"
  107.99                            "\tmov %%cr3,%1\n"
 107.100                            : "=r" (cr0), "=r"(cr3));
 107.101 -    printf("%s: pt = %lx, cr3 = %lx, cr0 = %lx\n", __func__, pt, cr3, cr0);
 107.102 +    printk("%s: pt = %lx, cr3 = %lx, cr0 = %lx\n", __func__, pt, cr3, cr0);
 107.103  }
 107.104  
 107.105  #ifdef SVM_EXTRA_DEBUG
   108.1 --- a/xen/arch/x86/hvm/svm/vmcb.c	Tue Oct 24 10:08:30 2006 -0600
   108.2 +++ b/xen/arch/x86/hvm/svm/vmcb.c	Tue Oct 24 11:21:48 2006 -0600
   108.3 @@ -408,7 +408,7 @@ void svm_do_launch(struct vcpu *v)
   108.4  
   108.5  static void svm_dump_sel(char *name, segment_selector_t *s)
   108.6  {
   108.7 -    printf("%s: sel=0x%04x, attr=0x%04x, limit=0x%08x, base=0x%016llx\n", 
   108.8 +    printk("%s: sel=0x%04x, attr=0x%04x, limit=0x%08x, base=0x%016llx\n", 
   108.9             name, s->sel, s->attributes.bytes, s->limit,
  108.10             (unsigned long long)s->base);
  108.11  }
  108.12 @@ -416,50 +416,50 @@ static void svm_dump_sel(char *name, seg
  108.13  
  108.14  void svm_dump_vmcb(const char *from, struct vmcb_struct *vmcb)
  108.15  {
  108.16 -    printf("Dumping guest's current state at %s...\n", from);
  108.17 -    printf("Size of VMCB = %d, address = %p\n", 
  108.18 +    printk("Dumping guest's current state at %s...\n", from);
  108.19 +    printk("Size of VMCB = %d, address = %p\n", 
  108.20              (int) sizeof(struct vmcb_struct), vmcb);
  108.21  
  108.22 -    printf("cr_intercepts = 0x%08x dr_intercepts = 0x%08x "
  108.23 +    printk("cr_intercepts = 0x%08x dr_intercepts = 0x%08x "
  108.24             "exception_intercepts = 0x%08x\n", 
  108.25             vmcb->cr_intercepts, vmcb->dr_intercepts, 
  108.26             vmcb->exception_intercepts);
  108.27 -    printf("general1_intercepts = 0x%08x general2_intercepts = 0x%08x\n", 
  108.28 +    printk("general1_intercepts = 0x%08x general2_intercepts = 0x%08x\n", 
  108.29             vmcb->general1_intercepts, vmcb->general2_intercepts);
  108.30 -    printf("iopm_base_pa = %016llx msrpm_base_pa = 0x%016llx tsc_offset = "
  108.31 +    printk("iopm_base_pa = %016llx msrpm_base_pa = 0x%016llx tsc_offset = "
  108.32              "0x%016llx\n", 
  108.33             (unsigned long long) vmcb->iopm_base_pa,
  108.34             (unsigned long long) vmcb->msrpm_base_pa,
  108.35             (unsigned long long) vmcb->tsc_offset);
  108.36 -    printf("tlb_control = 0x%08x vintr = 0x%016llx interrupt_shadow = "
  108.37 +    printk("tlb_control = 0x%08x vintr = 0x%016llx interrupt_shadow = "
  108.38              "0x%016llx\n", vmcb->tlb_control,
  108.39             (unsigned long long) vmcb->vintr.bytes,
  108.40             (unsigned long long) vmcb->interrupt_shadow);
  108.41 -    printf("exitcode = 0x%016llx exitintinfo = 0x%016llx\n", 
  108.42 +    printk("exitcode = 0x%016llx exitintinfo = 0x%016llx\n", 
  108.43             (unsigned long long) vmcb->exitcode,
  108.44             (unsigned long long) vmcb->exitintinfo.bytes);
  108.45 -    printf("exitinfo1 = 0x%016llx exitinfo2 = 0x%016llx \n",
  108.46 +    printk("exitinfo1 = 0x%016llx exitinfo2 = 0x%016llx \n",
  108.47             (unsigned long long) vmcb->exitinfo1,
  108.48             (unsigned long long) vmcb->exitinfo2);
  108.49 -    printf("np_enable = 0x%016llx guest_asid = 0x%03x\n", 
  108.50 +    printk("np_enable = 0x%016llx guest_asid = 0x%03x\n", 
  108.51             (unsigned long long) vmcb->np_enable, vmcb->guest_asid);
  108.52 -    printf("cpl = %d efer = 0x%016llx star = 0x%016llx lstar = 0x%016llx\n", 
  108.53 +    printk("cpl = %d efer = 0x%016llx star = 0x%016llx lstar = 0x%016llx\n", 
  108.54             vmcb->cpl, (unsigned long long) vmcb->efer,
  108.55             (unsigned long long) vmcb->star, (unsigned long long) vmcb->lstar);
  108.56 -    printf("CR0 = 0x%016llx CR2 = 0x%016llx\n",
  108.57 +    printk("CR0 = 0x%016llx CR2 = 0x%016llx\n",
  108.58             (unsigned long long) vmcb->cr0, (unsigned long long) vmcb->cr2);
  108.59 -    printf("CR3 = 0x%016llx CR4 = 0x%016llx\n", 
  108.60 +    printk("CR3 = 0x%016llx CR4 = 0x%016llx\n", 
  108.61             (unsigned long long) vmcb->cr3, (unsigned long long) vmcb->cr4);
  108.62 -    printf("RSP = 0x%016llx  RIP = 0x%016llx\n", 
  108.63 +    printk("RSP = 0x%016llx  RIP = 0x%016llx\n", 
  108.64             (unsigned long long) vmcb->rsp, (unsigned long long) vmcb->rip);
  108.65 -    printf("RAX = 0x%016llx  RFLAGS=0x%016llx\n",
  108.66 +    printk("RAX = 0x%016llx  RFLAGS=0x%016llx\n",
  108.67             (unsigned long long) vmcb->rax, (unsigned long long) vmcb->rflags);
  108.68 -    printf("DR6 = 0x%016llx, DR7 = 0x%016llx\n", 
  108.69 +    printk("DR6 = 0x%016llx, DR7 = 0x%016llx\n", 
  108.70             (unsigned long long) vmcb->dr6, (unsigned long long) vmcb->dr7);
  108.71 -    printf("CSTAR = 0x%016llx SFMask = 0x%016llx\n",
  108.72 +    printk("CSTAR = 0x%016llx SFMask = 0x%016llx\n",
  108.73             (unsigned long long) vmcb->cstar, 
  108.74             (unsigned long long) vmcb->sfmask);
  108.75 -    printf("KernGSBase = 0x%016llx PAT = 0x%016llx \n", 
  108.76 +    printk("KernGSBase = 0x%016llx PAT = 0x%016llx \n", 
  108.77             (unsigned long long) vmcb->kerngsbase,
  108.78             (unsigned long long) vmcb->g_pat);
  108.79      
   109.1 --- a/xen/arch/x86/hvm/svm/x86_32/exits.S	Tue Oct 24 10:08:30 2006 -0600
   109.2 +++ b/xen/arch/x86/hvm/svm/x86_32/exits.S	Tue Oct 24 11:21:48 2006 -0600
   109.3 @@ -139,9 +139,6 @@ svm_stgi_label:
   109.4  ENTRY(svm_asm_do_resume)
   109.5  svm_test_all_events:
   109.6          GET_CURRENT(%ebx)
   109.7 -        pushl %ebx
   109.8 -        call hvm_do_resume
   109.9 -        addl $4, %esp
  109.10  /*test_all_events:*/
  109.11          xorl %ecx,%ecx
  109.12          notl %ecx
   110.1 --- a/xen/arch/x86/hvm/svm/x86_64/exits.S	Tue Oct 24 10:08:30 2006 -0600
   110.2 +++ b/xen/arch/x86/hvm/svm/x86_64/exits.S	Tue Oct 24 11:21:48 2006 -0600
   110.3 @@ -153,8 +153,6 @@ svm_stgi_label:
   110.4  ENTRY(svm_asm_do_resume)
   110.5  svm_test_all_events:
   110.6          GET_CURRENT(%rbx)
   110.7 -        movq %rbx, %rdi
   110.8 -        call hvm_do_resume
   110.9  /*test_all_events:*/
  110.10          cli                             # tests must not race interrupts
  110.11  /*test_softirqs:*/
   111.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Oct 24 10:08:30 2006 -0600
   111.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Oct 24 11:21:48 2006 -0600
   111.3 @@ -1087,7 +1087,7 @@ static int check_for_null_selector(unsig
   111.4      memset(inst, 0, MAX_INST_LEN);
   111.5      if ( inst_copy_from_guest(inst, eip, inst_len) != inst_len )
   111.6      {
   111.7 -        printf("check_for_null_selector: get guest instruction failed\n");
   111.8 +        printk("check_for_null_selector: get guest instruction failed\n");
   111.9          domain_crash_synchronous();
  111.10      }
  111.11  
  111.12 @@ -1470,7 +1470,7 @@ static int vmx_assist(struct vcpu *v, in
  111.13      }
  111.14  
  111.15   error:
  111.16 -    printf("Failed to transfer to vmxassist\n");
  111.17 +    printk("Failed to transfer to vmxassist\n");
  111.18      domain_crash_synchronous();
  111.19      return 0;
  111.20  }
   112.1 --- a/xen/arch/x86/hvm/vmx/x86_32/exits.S	Tue Oct 24 10:08:30 2006 -0600
   112.2 +++ b/xen/arch/x86/hvm/vmx/x86_32/exits.S	Tue Oct 24 11:21:48 2006 -0600
   112.3 @@ -97,9 +97,6 @@ vmx_process_softirqs:
   112.4          ALIGN
   112.5  ENTRY(vmx_asm_do_vmentry)
   112.6          GET_CURRENT(%ebx)
   112.7 -        pushl %ebx
   112.8 -        call hvm_do_resume
   112.9 -        addl $4, %esp
  112.10          cli                             # tests must not race interrupts
  112.11  
  112.12          movl VCPU_processor(%ebx),%eax
   113.1 --- a/xen/arch/x86/hvm/vmx/x86_64/exits.S	Tue Oct 24 10:08:30 2006 -0600
   113.2 +++ b/xen/arch/x86/hvm/vmx/x86_64/exits.S	Tue Oct 24 11:21:48 2006 -0600
   113.3 @@ -106,8 +106,6 @@ vmx_process_softirqs:
   113.4          ALIGN
   113.5  ENTRY(vmx_asm_do_vmentry)
   113.6          GET_CURRENT(%rbx)
   113.7 -        movq %rbx, %rdi
   113.8 -        call hvm_do_resume
   113.9          cli                             # tests must not race interrupts
  113.10  
  113.11          movl  VCPU_processor(%rbx),%eax
   114.1 --- a/xen/arch/x86/setup.c	Tue Oct 24 10:08:30 2006 -0600
   114.2 +++ b/xen/arch/x86/setup.c	Tue Oct 24 11:21:48 2006 -0600
   114.3 @@ -296,7 +296,7 @@ void __init __start_xen(multiboot_info_t
   114.4  
   114.5      init_console();
   114.6  
   114.7 -    printf("Command line: %s\n", cmdline);
   114.8 +    printk("Command line: %s\n", cmdline);
   114.9  
  114.10      /* Check that we have at least one Multiboot module. */
  114.11      if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0) )
   115.1 --- a/xen/arch/x86/x86_32/entry.S	Tue Oct 24 10:08:30 2006 -0600
   115.2 +++ b/xen/arch/x86/x86_32/entry.S	Tue Oct 24 11:21:48 2006 -0600
   115.3 @@ -398,7 +398,7 @@ domain_crash_synchronous_string:
   115.4  
   115.5  domain_crash_synchronous:
   115.6          pushl $domain_crash_synchronous_string
   115.7 -        call  printf
   115.8 +        call  printk
   115.9          jmp   __domain_crash_synchronous
  115.10  
  115.11          ALIGN
   116.1 --- a/xen/arch/x86/x86_32/supervisor_mode_kernel.S	Tue Oct 24 10:08:30 2006 -0600
   116.2 +++ b/xen/arch/x86/x86_32/supervisor_mode_kernel.S	Tue Oct 24 11:21:48 2006 -0600
   116.3 @@ -141,5 +141,5 @@ domain_crash_synchronous_string:
   116.4  
   116.5  domain_crash_synchronous:
   116.6          pushl $domain_crash_synchronous_string
   116.7 -        call  printf
   116.8 +        call  printk
   116.9          jmp   __domain_crash_synchronous
   117.1 --- a/xen/arch/x86/x86_64/entry.S	Tue Oct 24 10:08:30 2006 -0600
   117.2 +++ b/xen/arch/x86/x86_64/entry.S	Tue Oct 24 11:21:48 2006 -0600
   117.3 @@ -328,7 +328,7 @@ domain_crash_synchronous:
   117.4          # printk(domain_crash_synchronous_string)
   117.5          leaq  domain_crash_synchronous_string(%rip),%rdi
   117.6          xorl  %eax,%eax
   117.7 -        call  printf
   117.8 +        call  printk
   117.9          jmp  __domain_crash_synchronous
  117.10  
  117.11          ALIGN
   118.1 --- a/xen/common/sched_sedf.c	Tue Oct 24 10:08:30 2006 -0600
   118.2 +++ b/xen/common/sched_sedf.c	Tue Oct 24 11:21:48 2006 -0600
   118.3 @@ -1190,10 +1190,10 @@ static void sedf_dump_domain(struct vcpu
   118.4      
   118.5  #ifdef SEDF_STATS
   118.6      if ( EDOM_INFO(d)->block_time_tot != 0 )
   118.7 -        printf(" pen=%"PRIu64"%%", (EDOM_INFO(d)->penalty_time_tot * 100) /
   118.8 +        printk(" pen=%"PRIu64"%%", (EDOM_INFO(d)->penalty_time_tot * 100) /
   118.9                 EDOM_INFO(d)->block_time_tot);
  118.10      if ( EDOM_INFO(d)->block_tot != 0 )
  118.11 -        printf("\n   blks=%u sh=%u (%u%%) (shc=%u (%u%%) shex=%i "\
  118.12 +        printk("\n   blks=%u sh=%u (%u%%) (shc=%u (%u%%) shex=%i "\
  118.13                 "shexsl=%i) l=%u (%u%%) avg: b=%"PRIu64" p=%"PRIu64"",
  118.14                 EDOM_INFO(d)->block_tot, EDOM_INFO(d)->short_block_tot,
  118.15                 (EDOM_INFO(d)->short_block_tot * 100) 
  118.16 @@ -1206,7 +1206,7 @@ static void sedf_dump_domain(struct vcpu
  118.17                 (EDOM_INFO(d)->block_time_tot) / EDOM_INFO(d)->block_tot,
  118.18                 (EDOM_INFO(d)->penalty_time_tot) / EDOM_INFO(d)->block_tot);
  118.19  #endif
  118.20 -    printf("\n");
  118.21 +    printk("\n");
  118.22  }
  118.23  
  118.24  
   119.1 --- a/xen/drivers/char/console.c	Tue Oct 24 10:08:30 2006 -0600
   119.2 +++ b/xen/drivers/char/console.c	Tue Oct 24 11:21:48 2006 -0600
   119.3 @@ -294,7 +294,7 @@ static inline void __putstr(const char *
   119.4      }
   119.5  }
   119.6  
   119.7 -void printf(const char *fmt, ...)
   119.8 +void printk(const char *fmt, ...)
   119.9  {
  119.10      static char   buf[1024];
  119.11      static int    start_of_line = 1;
   120.1 --- a/xen/include/asm-ia64/config.h	Tue Oct 24 10:08:30 2006 -0600
   120.2 +++ b/xen/include/asm-ia64/config.h	Tue Oct 24 11:21:48 2006 -0600
   120.3 @@ -232,7 +232,7 @@ typedef long clock_t;
   120.4  extern unsigned long loops_per_jiffy;
   120.5  extern char saved_command_line[];
   120.6  struct screen_info { };
   120.7 -#define seq_printf(a,b...) printf(b)
   120.8 +#define seq_printf(a,b...) printk(b)
   120.9  //#define CONFIG_BLK_DEV_INITRD // needed to reserve memory for domain0
  120.10  
  120.11  #define CONFIG_SHADOW	1
   121.1 --- a/xen/include/asm-ia64/vcpu.h	Tue Oct 24 10:08:30 2006 -0600
   121.2 +++ b/xen/include/asm-ia64/vcpu.h	Tue Oct 24 11:21:48 2006 -0600
   121.3 @@ -200,7 +200,7 @@ static inline s64 vcpu_get_next_timer_ns
   121.4  	return vcpu_get_next_timer_ns;
   121.5  }
   121.6  
   121.7 -#define verbose(a...) do {if (vcpu_verbose) printf(a);} while(0)
   121.8 +#define verbose(a...) do {if (vcpu_verbose) printk(a);} while(0)
   121.9  
  121.10  //#define vcpu_quick_region_check(_tr_regions,_ifa) 1
  121.11  #define vcpu_quick_region_check(_tr_regions,_ifa)           \
   122.1 --- a/xen/include/xen/event.h	Tue Oct 24 10:08:30 2006 -0600
   122.2 +++ b/xen/include/xen/event.h	Tue Oct 24 11:21:48 2006 -0600
   122.3 @@ -70,4 +70,11 @@ void notify_via_xen_event_channel(int lp
   122.4          do_softirq();                                                   \
   122.5      } while ( 0 )
   122.6  
   122.7 +#define prepare_wait_on_xen_event_channel(port)                         \
   122.8 +    do {                                                                \
   122.9 +        set_bit(_VCPUF_blocked_in_xen, &current->vcpu_flags);           \
  122.10 +        raise_softirq(SCHEDULE_SOFTIRQ);                                \
  122.11 +        mb(); /* set blocked status /then/ caller does his work */      \
  122.12 +    } while ( 0 )
  122.13 +
  122.14  #endif /* __XEN_EVENT_H__ */
   123.1 --- a/xen/include/xen/lib.h	Tue Oct 24 10:08:30 2006 -0600
   123.2 +++ b/xen/include/xen/lib.h	Tue Oct 24 11:21:48 2006 -0600
   123.3 @@ -51,8 +51,7 @@ extern void debugtrace_printk(const char
   123.4  
   123.5  /* Allows us to use '%p' as general-purpose machine-word format char. */
   123.6  #define _p(_x) ((void *)(unsigned long)(_x))
   123.7 -#define printk(_f , _a...) printf( _f , ## _a )
   123.8 -extern void printf(const char *format, ...)
   123.9 +extern void printk(const char *format, ...)
  123.10      __attribute__ ((format (printf, 1, 2)));
  123.11  extern void panic(const char *format, ...)
  123.12      __attribute__ ((format (printf, 1, 2)));