ia64/xen-unstable

changeset 6527:40b887fa79d0

Merge.
author adsharma@los-vmm.sc.intel.com
date Fri Aug 12 09:35:15 2005 -0800 (2005-08-12)
parents 9413e453e83b ba46bd7f5cdf
children 29aab159846c
files .hgignore Makefile linux-2.4-xen-sparse/mkbuildtree linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/arch/xen/x86_64/Kconfig linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/kernel/apic.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/genapic.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/genapic_xen.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/irq.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smp.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S linux-2.6-xen-sparse/drivers/xen/blkback/Makefile linux-2.6-xen-sparse/drivers/xen/blkback/control.c linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c linux-2.6-xen-sparse/drivers/xen/xenbus/Makefile linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c linux-2.6-xen-sparse/mkbuildtree tools/console/client/main.c tools/console/daemon/io.c tools/console/daemon/utils.c tools/examples/xmexample.vmx tools/ioemu/hw/pckbd.c tools/ioemu/monitor.c tools/ioemu/target-i386-dm/Makefile tools/ioemu/target-i386-dm/helper2.c tools/ioemu/vl.c tools/ioemu/vl.h tools/libxc/Makefile tools/libxc/xc_core.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_load_elf.c tools/libxc/xc_ptrace.c tools/libxc/xc_vmx_build.c tools/misc/xend tools/python/setup.py tools/python/xen/web/connection.py tools/python/xen/web/reactor.py tools/python/xen/web/tcp.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py tools/python/xen/xend/server/blkif.py tools/python/xen/xend/server/relocate.py tools/python/xen/xm/create.py tools/python/xen/xm/main.py tools/security/secpol_tool.c tools/xenstore/Makefile tools/xenstore/utils.c tools/xenstore/utils.h tools/xenstore/xenstored_core.c tools/xentrace/xentrace.c xen/arch/ia64/domain.c xen/arch/ia64/vcpu.c xen/arch/ia64/xentime.c xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/domain_build.c xen/arch/x86/mm.c xen/arch/x86/setup.c xen/arch/x86/time.c xen/arch/x86/vmx_intercept.c xen/arch/x86/vmx_vmcs.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/mm.c xen/arch/x86/x86_64/entry.S xen/common/dom0_ops.c xen/common/page_alloc.c xen/include/asm-x86/event.h xen/include/asm-x86/page.h xen/include/asm-x86/types.h xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_vmcs.h xen/include/asm-x86/x86_32/uaccess.h xen/include/public/dom0_ops.h xen/include/public/trace.h xen/include/public/xen.h xen/include/xen/domain.h xen/include/xen/event.h xen/include/xen/sched.h xen/include/xen/time.h xen/include/xen/trace.h xen/tools/symbols.c
line diff
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Fri Aug 12 09:25:49 2005 -0800
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c	Fri Aug 12 09:35:15 2005 -0800
     7.3 @@ -1353,83 +1353,82 @@ static void __vcpu_hotplug_handler(void 
     7.4  		printk(KERN_ALERT "Error creating hotplug_cpu process!\n");
     7.5  }
     7.6  
     7.7 -static void handle_cpus_watch(struct xenbus_watch *, const char *);
     7.8 -static struct notifier_block xsn_cpus;
     7.9 +static void handle_vcpu_hotplug_event(struct xenbus_watch *, const char *);
    7.10 +static struct notifier_block xsn_cpu;
    7.11  
    7.12  /* xenbus watch struct */
    7.13 -static struct xenbus_watch cpus_watch = {
    7.14 -	.node = "cpus",
    7.15 -	.callback = handle_cpus_watch,
    7.16 +static struct xenbus_watch cpu_watch = {
    7.17 +	.node = "cpu",
    7.18 +	.callback = handle_vcpu_hotplug_event
    7.19  };
    7.20  
    7.21 -static int setup_cpus_watcher(struct notifier_block *notifier,
    7.22 +/* NB: Assumes xenbus_lock is held! */
    7.23 +static int setup_cpu_watcher(struct notifier_block *notifier,
    7.24  			      unsigned long event, void *data)
    7.25  {
    7.26  	int err = 0;
    7.27  
    7.28 -	down(&xenbus_lock);
    7.29 -	err = register_xenbus_watch(&cpus_watch);
    7.30 -	up(&xenbus_lock);
    7.31 +	BUG_ON(down_trylock(&xenbus_lock) == 0);
    7.32 +	err = register_xenbus_watch(&cpu_watch);
    7.33  
    7.34  	if (err) {
    7.35 -		printk("Failed to set cpus watcher\n");
    7.36 +		printk("Failed to register watch on /cpu\n");
    7.37  	}
    7.38 +
    7.39  	return NOTIFY_DONE;
    7.40  }
    7.41  
    7.42 -static void handle_cpus_watch(struct xenbus_watch *watch, const char *node)
    7.43 +static void handle_vcpu_hotplug_event(struct xenbus_watch *watch, const char *node)
    7.44  {
    7.45  	static DECLARE_WORK(vcpu_hotplug_work, __vcpu_hotplug_handler, NULL);
    7.46  	struct vcpu_hotplug_handler_t *handler = &vcpu_hotplug_handler;
    7.47  	ssize_t ret;
    7.48 -	int err, cpu, state;
    7.49 +	int err, cpu;
    7.50 +	char state[8];
    7.51  	char dir[32];
    7.52  	char *cpustr;
    7.53  
    7.54 -	/* get a pointer to start of cpus/cpu string */
    7.55 -	if ((cpustr = strstr(node, "cpus/cpu")) != NULL) {
    7.56 +	/* get a pointer to start of cpu string */
    7.57 +	if ((cpustr = strstr(node, "cpu/")) != NULL) {
    7.58  
    7.59  		/* find which cpu state changed, note vcpu for handler */
    7.60 -		sscanf(cpustr, "cpus/cpu%d", &cpu);
    7.61 +		sscanf(cpustr, "cpu/%d", &cpu);
    7.62  		handler->vcpu = cpu;
    7.63  
    7.64  		/* calc the dir for xenbus read */
    7.65 -		sprintf(dir, "cpus/cpu%d", cpu);
    7.66 +		sprintf(dir, "cpu/%d", cpu);
    7.67  
    7.68 -		/* make sure watch that was triggered is changes to the online key */
    7.69 -		if ((strcmp(node + strlen(dir), "/online")) != 0)
    7.70 +		/* make sure watch that was triggered is changes to the correct key */
    7.71 +		if ((strcmp(node + strlen(dir), "/availability")) != 0)
    7.72  			return;
    7.73  
    7.74  		/* get the state value */
    7.75 -		xenbus_transaction_start("cpus");
    7.76 -		err = xenbus_scanf(dir, "online", "%d", &state);
    7.77 +		xenbus_transaction_start("cpu");
    7.78 +		err = xenbus_scanf(dir, "availability", "%s", state);
    7.79  		xenbus_transaction_end(0);
    7.80  
    7.81  		if (err != 1) {
    7.82  			printk(KERN_ERR
    7.83 -			       "XENBUS: Unable to read cpu online state\n");
    7.84 +			       "XENBUS: Unable to read cpu state\n");
    7.85  			return;
    7.86  		}
    7.87  
    7.88  		/* if we detect a state change, take action */
    7.89 -		switch (state) {
    7.90 +		if (strcmp(state, "online") == 0) {
    7.91  			/* offline -> online */
    7.92 -		case 1:
    7.93  			if (!cpu_isset(cpu, cpu_online_map)) {
    7.94  				handler->fn = (void *)&cpu_up;
    7.95  				ret = schedule_work(&vcpu_hotplug_work);
    7.96 -			}
    7.97 -			break;
    7.98 +			} 
    7.99 +		} else if (strcmp(state, "offline") == 0) {
   7.100  			/* online -> offline */
   7.101 -		case 0:
   7.102  			if (cpu_isset(cpu, cpu_online_map)) {
   7.103  				handler->fn = (void *)&cpu_down;
   7.104  				ret = schedule_work(&vcpu_hotplug_work);
   7.105 -			}
   7.106 -			break;
   7.107 -		default:
   7.108 +			} 
   7.109 +		} else {
   7.110  			printk(KERN_ERR
   7.111 -			       "XENBUS: unknown state(%d) on node(%s)\n", state,
   7.112 +			       "XENBUS: unknown state(%s) on node(%s)\n", state,
   7.113  			       node);
   7.114  		}
   7.115  	}
   7.116 @@ -1438,13 +1437,9 @@ static void handle_cpus_watch(struct xen
   7.117  
   7.118  static int __init setup_vcpu_hotplug_event(void)
   7.119  {
   7.120 -	xsn_cpus.notifier_call = setup_cpus_watcher;
   7.121 +	xsn_cpu.notifier_call = setup_cpu_watcher;
   7.122  
   7.123 -	if (xen_start_info.store_evtchn) {
   7.124 -		setup_cpus_watcher(&xsn_cpus, 0, NULL);
   7.125 -	} else {
   7.126 -		register_xenstore_notifier(&xsn_cpus);
   7.127 -	}
   7.128 +	register_xenstore_notifier(&xsn_cpu);
   7.129  
   7.130  	return 0;
   7.131  }
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Fri Aug 12 09:25:49 2005 -0800
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Fri Aug 12 09:35:15 2005 -0800
     8.3 @@ -231,18 +231,32 @@ static void __update_wallclock(time_t se
     8.4  {
     8.5  	long wtm_nsec, xtime_nsec;
     8.6  	time_t wtm_sec, xtime_sec;
     8.7 -	u64 tmp, wc_nsec;
     8.8 +	s64 tmp, wc_nsec;
     8.9  
    8.10  	/* Adjust wall-clock time base based on wall_jiffies ticks. */
    8.11  	wc_nsec = processed_system_time;
    8.12 -	wc_nsec += (u64)sec * 1000000000ULL;
    8.13 -	wc_nsec += (u64)nsec;
    8.14 +	wc_nsec += (sec * 1000000000LL) + nsec;
    8.15  	wc_nsec -= (jiffies - wall_jiffies) * (u64)(NSEC_PER_SEC / HZ);
    8.16  
    8.17  	/* Split wallclock base into seconds and nanoseconds. */
    8.18 -	tmp = wc_nsec;
    8.19 -	xtime_nsec = do_div(tmp, 1000000000);
    8.20 -	xtime_sec  = (time_t)tmp;
    8.21 +	if ( (tmp = wc_nsec) < 0 )
    8.22 +	{
    8.23 +		/* -ve UTC offset => -ve seconds, +ve nanoseconds. */
    8.24 +		tmp = -tmp;
    8.25 +		xtime_nsec = do_div(tmp, 1000000000);
    8.26 +		tmp = -tmp;
    8.27 +		if ( xtime_nsec != 0 )
    8.28 +		{
    8.29 +			xtime_nsec = 1000000000 - xtime_nsec;
    8.30 +			tmp--;
    8.31 +		}
    8.32 +	}
    8.33 +	else
    8.34 +	{
    8.35 +		/* +ve UTC offset => +ve seconds, +ve nanoseconds. */
    8.36 +		xtime_nsec = do_div(tmp, 1000000000);
    8.37 +	}
    8.38 +	xtime_sec = (time_t)tmp;
    8.39  
    8.40  	wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - xtime_sec);
    8.41  	wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - xtime_nsec);
    10.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Fri Aug 12 09:25:49 2005 -0800
    10.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Fri Aug 12 09:35:15 2005 -0800
    10.3 @@ -6,6 +6,7 @@
    10.4  #include <linux/module.h>
    10.5  #include <linux/reboot.h>
    10.6  #include <linux/sysrq.h>
    10.7 +#include <linux/stringify.h>
    10.8  #include <asm/irq.h>
    10.9  #include <asm/mmu_context.h>
   10.10  #include <asm-xen/evtchn.h>
   10.11 @@ -254,7 +255,8 @@ static void shutdown_handler(struct xenb
   10.12      char *str;
   10.13  
   10.14      str = (char *)xenbus_read("control", "shutdown", NULL);
   10.15 -    if (IS_ERR(str))
   10.16 +    /* Ignore read errors and recursive shutdown events. */
   10.17 +    if (IS_ERR(str) || !strcmp(str, __stringify(SHUTDOWN_INVALID)))
   10.18          return;
   10.19  
   10.20      xenbus_printf("control", "shutdown", "%i", SHUTDOWN_INVALID);
    12.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile	Fri Aug 12 09:25:49 2005 -0800
    12.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile	Fri Aug 12 09:35:15 2005 -0800
    12.3 @@ -36,7 +36,7 @@ c-obj-$(CONFIG_X86_IO_APIC)	+= genapic_c
    12.4  #obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
    12.5  #obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
    12.6  #obj-$(CONFIG_GART_IOMMU)	+= pci-gart.o aperture.o
    12.7 -c-obj-$(CONFIG_DUMMY_IOMMU)	+= pci-nommu.o pci-dma.o
    12.8 +obj-$(CONFIG_DUMMY_IOMMU)	+= pci-nommu.o pci-dma.o
    12.9  #obj-$(CONFIG_SWIOTLB)		+= swiotlb.o
   12.10  obj-$(CONFIG_KPROBES)		+= kprobes.o
   12.11  obj-$(CONFIG_X86_PM_TIMER)	+= pmtimer.o
    17.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/init_task.c	Fri Aug 12 09:25:49 2005 -0800
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,49 +0,0 @@
    17.4 -#include <linux/mm.h>
    17.5 -#include <linux/module.h>
    17.6 -#include <linux/sched.h>
    17.7 -#include <linux/init.h>
    17.8 -#include <linux/init_task.h>
    17.9 -#include <linux/fs.h>
   17.10 -#include <linux/mqueue.h>
   17.11 -
   17.12 -#include <asm/uaccess.h>
   17.13 -#include <asm/pgtable.h>
   17.14 -#include <asm/desc.h>
   17.15 -
   17.16 -static struct fs_struct init_fs = INIT_FS;
   17.17 -static struct files_struct init_files = INIT_FILES;
   17.18 -static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
   17.19 -static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
   17.20 -struct mm_struct init_mm = INIT_MM(init_mm);
   17.21 -
   17.22 -EXPORT_SYMBOL(init_mm);
   17.23 -
   17.24 -/*
   17.25 - * Initial task structure.
   17.26 - *
   17.27 - * We need to make sure that this is 8192-byte aligned due to the
   17.28 - * way process stacks are handled. This is done by having a special
   17.29 - * "init_task" linker map entry..
   17.30 - */
   17.31 -union thread_union init_thread_union 
   17.32 -	__attribute__((__section__(".data.init_task"))) =
   17.33 -		{ INIT_THREAD_INFO(init_task) };
   17.34 -
   17.35 -/*
   17.36 - * Initial task structure.
   17.37 - *
   17.38 - * All other task structs will be allocated on slabs in fork.c
   17.39 - */
   17.40 -struct task_struct init_task = INIT_TASK(init_task);
   17.41 -
   17.42 -EXPORT_SYMBOL(init_task);
   17.43 -/*
   17.44 - * per-CPU TSS segments. Threads are completely 'soft' on Linux,
   17.45 - * no more per-task TSS's. The TSS size is kept cacheline-aligned
   17.46 - * so they are allowed to end up in the .data.cacheline_aligned
   17.47 - * section. Since TSS's are completely CPU-local, we want them
   17.48 - * on exact cacheline boundaries, to eliminate cacheline ping-pong.
   17.49 - */ 
   17.50 -DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp;
   17.51 -
   17.52 -#define ALIGN_TO_4K __attribute__((section(".data.init_task")))
    43.1 --- a/tools/libxc/xc_core.c	Fri Aug 12 09:25:49 2005 -0800
    43.2 +++ b/tools/libxc/xc_core.c	Fri Aug 12 09:35:15 2005 -0800
    43.3 @@ -43,7 +43,7 @@ xc_domain_dumpcore(int xc_handle,
    43.4  		goto error_out;
    43.5  	}
    43.6  	
    43.7 -	if ((dump_mem_start = malloc(DUMP_INCREMENT*PAGE_SIZE)) == 0) {
    43.8 +	if ((dump_mem_start = malloc(DUMP_INCREMENT*PAGE_SIZE)) == NULL) {
    43.9  		PERROR("Could not allocate dump_mem");
   43.10  		goto error_out;
   43.11  	}
   43.12 @@ -108,9 +108,8 @@ xc_domain_dumpcore(int xc_handle,
   43.13  	free(dump_mem_start);
   43.14  	return 0;
   43.15   error_out:
   43.16 -	if (dump_fd)
   43.17 +	if (dump_fd != -1)
   43.18  		close(dump_fd);
   43.19 -	if (dump_mem_start)
   43.20 -		free(dump_mem_start);
   43.21 +	free(dump_mem_start);
   43.22  	return -1;
   43.23  }
    44.1 --- a/tools/libxc/xc_linux_build.c	Fri Aug 12 09:25:49 2005 -0800
    44.2 +++ b/tools/libxc/xc_linux_build.c	Fri Aug 12 09:35:15 2005 -0800
    44.3 @@ -318,8 +318,7 @@ static int setup_guest(int xc_handle,
    44.4      return 0;
    44.5  
    44.6   error_out:
    44.7 -    if ( page_array != NULL )
    44.8 -        free(page_array);
    44.9 +    free(page_array);
   44.10      return -1;
   44.11  }
   44.12  #else /* x86 */
   44.13 @@ -616,10 +615,8 @@ static int setup_guest(int xc_handle,
   44.14      return 0;
   44.15  
   44.16   error_out:
   44.17 -    if ( mmu != NULL )
   44.18 -        free(mmu);
   44.19 -    if ( page_array != NULL )
   44.20 -        free(page_array);
   44.21 +    free(mmu);
   44.22 +    free(page_array);
   44.23      return -1;
   44.24  }
   44.25  #endif
   44.26 @@ -719,8 +716,7 @@ int xc_linux_build(int xc_handle,
   44.27          close(initrd_fd);
   44.28      if ( initrd_gfd )
   44.29          gzclose(initrd_gfd);
   44.30 -    if ( image != NULL )
   44.31 -        free(image);
   44.32 +    free(image);
   44.33  
   44.34  #ifdef __ia64__
   44.35      /* based on new_thread in xen/arch/ia64/domain.c */
   44.36 @@ -806,8 +802,7 @@ int xc_linux_build(int xc_handle,
   44.37          gzclose(initrd_gfd);
   44.38      else if ( initrd_fd >= 0 )
   44.39          close(initrd_fd);
   44.40 -    if ( image != NULL )
   44.41 -        free(image);
   44.42 +    free(image);
   44.43  
   44.44      return -1;
   44.45  }
    45.1 --- a/tools/libxc/xc_linux_restore.c	Fri Aug 12 09:25:49 2005 -0800
    45.2 +++ b/tools/libxc/xc_linux_restore.c	Fri Aug 12 09:35:15 2005 -0800
    45.3 @@ -32,7 +32,7 @@
    45.4  #define PPRINTF(_f, _a...)
    45.5  #endif
    45.6  
    45.7 -ssize_t
    45.8 +static ssize_t
    45.9  read_exact(int fd, void *buf, size_t count)
   45.10  {
   45.11      int r = 0, s;
   45.12 @@ -607,12 +607,9 @@ int xc_linux_restore(int xc_handle, int 
   45.13   out:
   45.14      if ( (rc != 0) && (dom != 0) )
   45.15          xc_domain_destroy(xc_handle, dom);
   45.16 -    if ( mmu != NULL )
   45.17 -        free(mmu);
   45.18 -    if ( pfn_to_mfn_table != NULL )
   45.19 -        free(pfn_to_mfn_table);
   45.20 -    if ( pfn_type != NULL )
   45.21 -        free(pfn_type);
   45.22 +    free(mmu);
   45.23 +    free(pfn_to_mfn_table);
   45.24 +    free(pfn_type);
   45.25  
   45.26      DPRINTF("Restore exit with rc=%d\n", rc);
   45.27      return rc;
    46.1 --- a/tools/libxc/xc_linux_save.c	Fri Aug 12 09:25:49 2005 -0800
    46.2 +++ b/tools/libxc/xc_linux_save.c	Fri Aug 12 09:35:15 2005 -0800
    46.3 @@ -136,7 +136,7 @@ static long long tv_to_us( struct timeva
    46.4      return (new->tv_sec * 1000000) + new->tv_usec;
    46.5  }
    46.6  
    46.7 -static long long llgettimeofday()
    46.8 +static long long llgettimeofday( void )
    46.9  {
   46.10      struct timeval now;
   46.11      gettimeofday(&now, NULL);
   46.12 @@ -312,9 +312,9 @@ static int analysis_phase( int xc_handle
   46.13  }
   46.14  
   46.15  
   46.16 -int suspend_and_state(int xc_handle, int io_fd,	int dom,	      
   46.17 -                      xc_dominfo_t *info,
   46.18 -                      vcpu_guest_context_t *ctxt)
   46.19 +static int suspend_and_state(int xc_handle, int io_fd,	int dom,	      
   46.20 +                             xc_dominfo_t *info,
   46.21 +                             vcpu_guest_context_t *ctxt)
   46.22  {
   46.23      int i=0;
   46.24      char ans[30];
   46.25 @@ -429,7 +429,7 @@ int xc_linux_save(int xc_handle, int io_
   46.26         - that should be sent this iteration (unless later marked as skip); 
   46.27         - to skip this iteration because already dirty;
   46.28         - to fixup by sending at the end if not already resent; */
   46.29 -    unsigned long *to_send, *to_skip, *to_fix;
   46.30 +    unsigned long *to_send = NULL, *to_skip = NULL, *to_fix = NULL;
   46.31      
   46.32      xc_shadow_control_stats_t stats;
   46.33  
   46.34 @@ -1051,8 +1051,11 @@ int xc_linux_save(int xc_handle, int io_
   46.35      if(live_mfn_to_pfn_table) 
   46.36          munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024);
   46.37  
   46.38 -    if (pfn_type != NULL) 
   46.39 -        free(pfn_type);
   46.40 +    free(pfn_type);
   46.41 +    free(pfn_batch);
   46.42 +    free(to_send);
   46.43 +    free(to_fix);
   46.44 +    free(to_skip);
   46.45  
   46.46      DPRINTF("Save exit rc=%d\n",rc);
   46.47      return !!rc;
    47.1 --- a/tools/libxc/xc_load_elf.c	Fri Aug 12 09:25:49 2005 -0800
    47.2 +++ b/tools/libxc/xc_load_elf.c	Fri Aug 12 09:35:15 2005 -0800
    47.3 @@ -309,8 +309,7 @@ loadelfsymtab(
    47.4      dsi->v_end = round_pgup(maxva);
    47.5  
    47.6   out:
    47.7 -    if ( p != NULL )
    47.8 -        free(p);
    47.9 +    free(p);
   47.10  
   47.11      return 0;
   47.12  }
    48.1 --- a/tools/libxc/xc_ptrace.c	Fri Aug 12 09:25:49 2005 -0800
    48.2 +++ b/tools/libxc/xc_ptrace.c	Fri Aug 12 09:35:15 2005 -0800
    48.3 @@ -221,7 +221,7 @@ map_domain_va(unsigned long domid, int c
    48.4      return (void *)(((unsigned long)page_virt[cpu]) | (va & BSD_PAGE_MASK));
    48.5  
    48.6   error_out:
    48.7 -    return 0;
    48.8 +    return NULL;
    48.9  }
   48.10  
   48.11  int 
    49.1 --- a/tools/libxc/xc_vmx_build.c	Fri Aug 12 09:25:49 2005 -0800
    49.2 +++ b/tools/libxc/xc_vmx_build.c	Fri Aug 12 09:35:15 2005 -0800
    49.3 @@ -616,17 +616,15 @@ static int setup_guest(int xc_handle,
    49.4      return 0;
    49.5  
    49.6   error_out:
    49.7 -    if ( mmu != NULL )
    49.8 -        free(mmu);
    49.9 -    if ( page_array != NULL )
   49.10 -        free(page_array);
   49.11 +    free(mmu);
   49.12 +    free(page_array);
   49.13      return -1;
   49.14  }
   49.15  
   49.16  
   49.17  #define VMX_FEATURE_FLAG 0x20
   49.18  
   49.19 -int vmx_identify(void)
   49.20 +static int vmx_identify(void)
   49.21  {
   49.22      int eax, ecx;
   49.23  
   49.24 @@ -745,8 +743,7 @@ int xc_vmx_build(int xc_handle,
   49.25          close(initrd_fd);
   49.26      if ( initrd_gfd )
   49.27          gzclose(initrd_gfd);
   49.28 -    if ( image != NULL )
   49.29 -        free(image);
   49.30 +    free(image);
   49.31  
   49.32      ctxt->flags = VGCF_VMX_GUEST;
   49.33      /* FPU is set up to default initial state. */
   49.34 @@ -801,8 +798,7 @@ int xc_vmx_build(int xc_handle,
   49.35          gzclose(initrd_gfd);
   49.36      else if ( initrd_fd >= 0 )
   49.37          close(initrd_fd);
   49.38 -    if ( image != NULL )
   49.39 -        free(image);
   49.40 +    free(image);
   49.41  
   49.42      return -1;
   49.43  }
    51.1 --- a/tools/python/setup.py	Fri Aug 12 09:25:49 2005 -0800
    51.2 +++ b/tools/python/setup.py	Fri Aug 12 09:35:15 2005 -0800
    51.3 @@ -17,7 +17,7 @@ library_dirs = [ XEN_ROOT + "/tools/libx
    51.4                   XEN_ROOT + "/tools/xenstore",
    51.5                   ]
    51.6  
    51.7 -libraries = [ "xc", "xenstore-pic" ]
    51.8 +libraries = [ "xc", "xenstore" ]
    51.9  
   51.10  xc = Extension("xc",
   51.11                 extra_compile_args = extra_compile_args,
    55.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Aug 12 09:25:49 2005 -0800
    55.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Aug 12 09:35:15 2005 -0800
    55.3 @@ -561,12 +561,12 @@ class XendDomainInfo:
    55.4  
    55.5      def exportVCPUSToDB(self, vcpus):
    55.6          for v in range(0,vcpus):
    55.7 -            path = "/cpus/cpu%d"%(v)
    55.8 +            path = "/cpu/%d"%(v)
    55.9              if not self.vcpusdb.has_key(path):
   55.10                  self.vcpusdb[path] = self.db.addChild(path)
   55.11              db = self.vcpusdb[path]
   55.12 -            log.debug("writing key online=1 to path %s in store"%(path))
   55.13 -            db['online'] = "1"
   55.14 +            log.debug("writing key availability=online to path %s in store"%(path))
   55.15 +            db['availability'] = "online"
   55.16              db.saveDB(save=True)
   55.17  
   55.18      def init_image(self):
   55.19 @@ -915,7 +915,8 @@ class XendDomainInfo:
   55.20          """
   55.21          self.configure_fields()
   55.22          self.create_devices()
   55.23 -        self.create_blkif()
   55.24 +	if self.image.ostype != 'vmx':
   55.25 +            self.create_blkif()
   55.26  
   55.27      def create_blkif(self):
   55.28          """Create the block device interface (blkif) for the vm.
   55.29 @@ -957,16 +958,16 @@ class XendDomainInfo:
   55.30          """
   55.31          db = ""
   55.32          try:
   55.33 -            db = self.vcpusdb['/cpus/cpu%d'%(vcpu)]
   55.34 +            db = self.vcpusdb['/cpu/%d'%(vcpu)]
   55.35          except:
   55.36              log.error("Invalid VCPU")
   55.37              return
   55.38  
   55.39          if self.store_channel:
   55.40              if int(state) == 0:
   55.41 -                db['online'] = "0"
   55.42 +                db['availability'] = "offline"
   55.43              else:
   55.44 -                db['online'] = "1"
   55.45 +                db['availability'] = "online"
   55.46  
   55.47          db.saveDB(save=True)
   55.48  
    60.1 --- a/tools/python/xen/xm/main.py	Fri Aug 12 09:25:49 2005 -0800
    60.2 +++ b/tools/python/xen/xm/main.py	Fri Aug 12 09:35:15 2005 -0800
    60.3 @@ -289,13 +289,12 @@ def xm_destroy(args):
    60.4      args.insert(0,"bogus")
    60.5      destroy.main(args)
    60.6              
    60.7 -# TODO: make reboot do the right thing, right now
    60.8 -# reboot and shutdown are exactly the same
    60.9  def xm_reboot(args):
   60.10      arg_check(args,1,"reboot")
   60.11      # ugly hack because the opt parser apparently wants
   60.12      # the subcommand name just to throw it away!
   60.13      args.insert(0,"bogus")
   60.14 +    args.insert(2,"-R")
   60.15      from xen.xm import shutdown
   60.16      shutdown.main(args)
   60.17  
    61.1 --- a/tools/security/secpol_tool.c	Fri Aug 12 09:25:49 2005 -0800
    61.2 +++ b/tools/security/secpol_tool.c	Fri Aug 12 09:35:15 2005 -0800
    61.3 @@ -612,7 +612,7 @@ void usage(char *progname)
    61.4  int main(int argc, char **argv)
    61.5  {
    61.6  
    61.7 -    int acm_cmd_fd, ret;
    61.8 +    int acm_cmd_fd, ret = 0;
    61.9  
   61.10      if (argc < 2)
   61.11          usage(argv[0]);
    62.1 --- a/tools/xenstore/Makefile	Fri Aug 12 09:25:49 2005 -0800
    62.2 +++ b/tools/xenstore/Makefile	Fri Aug 12 09:35:15 2005 -0800
    62.3 @@ -24,7 +24,7 @@ TESTDIR  = `pwd`/testsuite/tmp
    62.4  TESTFLAGS= -DTESTING
    62.5  TESTENV  = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
    62.6  
    62.7 -all: xen xenstored libxenstore.a libxenstore-pic.a
    62.8 +all: xen xenstored libxenstore.so
    62.9  
   62.10  testcode: xen xs_test xenstored_test xs_random xs_dom0_test
   62.11  
   62.12 @@ -53,20 +53,14 @@ xs_test_lib.o: xs.c
   62.13  talloc_test.o: talloc.c
   62.14  	$(COMPILE.c) -o $@ $<
   62.15  
   62.16 -LIB_OBJS     := xs.o xs_lib.o
   62.17 -
   62.18 -LIB_OBJS_A   := $(patsubst %.o,libxenstore.a(%.o),$(LIB_OBJS))
   62.19 -LIB_OBJS_PIC := $(patsubst %.o,libxenstore-pic.a(%.opic),$(LIB_OBJS))
   62.20 -
   62.21 -libxenstore.a: $(LIB_OBJS_A)
   62.22 -
   62.23 -libxenstore-pic.a: $(LIB_OBJS_PIC)
   62.24 +libxenstore.so: xs.opic xs_lib.opic
   62.25 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenstore.so -shared -o $@ $^
   62.26  
   62.27  clean: testsuite-clean
   62.28 -	rm -f *.o *.opic *.a
   62.29 +	rm -f *.o *.opic *.so
   62.30  	rm -f xen xenstored xs_random xs_stress xs_crashme
   62.31  	rm -f xs_test xenstored_test xs_dom0_test
   62.32 -	-$(RM) $(PROG_DEP)
   62.33 +	$(RM) $(PROG_DEP)
   62.34  
   62.35  print-dir:
   62.36  	@echo -n tools/xenstore: 
   62.37 @@ -117,15 +111,14 @@ TAGS:
   62.38  tarball: clean
   62.39  	cd .. && tar -c -j -v -h -f xenstore.tar.bz2 xenstore/
   62.40  
   62.41 -install: xenstored libxenstore.a libxenstore-pic.a
   62.42 +install: xenstored libxenstore.so
   62.43  	$(INSTALL_DIR) -p $(DESTDIR)/var/run/xenstored
   62.44  	$(INSTALL_DIR) -p $(DESTDIR)/var/lib/xenstored
   62.45  	$(INSTALL_DIR) -p $(DESTDIR)/usr/sbin
   62.46  	$(INSTALL_DIR) -p $(DESTDIR)/usr/include
   62.47  	$(INSTALL_PROG) xenstored $(DESTDIR)/usr/sbin
   62.48  	$(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
   62.49 -	$(INSTALL_DATA) libxenstore.a $(DESTDIR)/usr/$(LIBDIR)
   62.50 -	$(INSTALL_DATA) libxenstore-pic.a $(DESTDIR)/usr/$(LIBDIR)
   62.51 +	$(INSTALL_DATA) libxenstore.so $(DESTDIR)/usr/$(LIBDIR)
   62.52  	$(INSTALL_DATA) xs.h $(DESTDIR)/usr/include
   62.53  	$(INSTALL_DATA) xs_lib.h $(DESTDIR)/usr/include
   62.54  
    65.1 --- a/tools/xenstore/xenstored_core.c	Fri Aug 12 09:25:49 2005 -0800
    65.2 +++ b/tools/xenstore/xenstored_core.c	Fri Aug 12 09:35:15 2005 -0800
    65.3 @@ -1587,7 +1587,7 @@ static struct option options[] = { { "no
    65.4  
    65.5  int main(int argc, char *argv[])
    65.6  {
    65.7 -	int opt, *sock, *ro_sock, event_fd, max, tmpout;
    65.8 +	int opt, *sock, *ro_sock, event_fd, max;
    65.9  	struct sockaddr_un addr;
   65.10  	fd_set inset, outset;
   65.11  	bool dofork = true;
   65.12 @@ -1673,9 +1673,8 @@ int main(int argc, char *argv[])
   65.13  	restore_existing_connections();
   65.14  
   65.15  	if (outputpid) {
   65.16 -		char buffer[20];
   65.17 -		sprintf(buffer, "%i\n", getpid());
   65.18 -		write(tmpout, buffer, strlen(buffer));
   65.19 +		printf("%i\n", getpid());
   65.20 +		fflush(stdout);
   65.21  	}
   65.22  
   65.23  	/* close stdin/stdout now we're ready to accept connections */
    67.1 --- a/xen/arch/ia64/domain.c	Fri Aug 12 09:25:49 2005 -0800
    67.2 +++ b/xen/arch/ia64/domain.c	Fri Aug 12 09:35:15 2005 -0800
    67.3 @@ -1398,3 +1398,12 @@ void domain_pend_keyboard_interrupt(int 
    67.4  {
    67.5  	vcpu_pend_interrupt(dom0->vcpu[0],irq);
    67.6  }
    67.7 +
    67.8 +void vcpu_migrate_cpu(struct vcpu *v, int newcpu)
    67.9 +{
   67.10 +	if ( v->processor == newcpu )
   67.11 +		return;
   67.12 +
   67.13 +	set_bit(_VCPUF_cpu_migrated, &v->vcpu_flags);
   67.14 +	v->processor = newcpu;
   67.15 +}
    69.1 --- a/xen/arch/ia64/xentime.c	Fri Aug 12 09:25:49 2005 -0800
    69.2 +++ b/xen/arch/ia64/xentime.c	Fri Aug 12 09:35:15 2005 -0800
    69.3 @@ -103,7 +103,7 @@ void update_dom_time(struct vcpu *v)
    69.4  }
    69.5  
    69.6  /* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
    69.7 -void do_settime(unsigned long secs, unsigned long nsecs, u64 system_time_base)
    69.8 +void do_settime(s64 secs, u32 nsecs, u64 system_time_base)
    69.9  {
   69.10  #ifdef  CONFIG_VTI
   69.11      u64 _nsecs;
    70.1 --- a/xen/arch/x86/dom0_ops.c	Fri Aug 12 09:25:49 2005 -0800
    70.2 +++ b/xen/arch/x86/dom0_ops.c	Fri Aug 12 09:35:15 2005 -0800
    70.3 @@ -404,16 +404,18 @@ void arch_getdomaininfo_ctxt(
    70.4  
    70.5      memcpy(c, &v->arch.guest_context, sizeof(*c));
    70.6  
    70.7 -    /* IOPL privileges are virtualised -- merge back into returned eflags. */
    70.8 -    BUG_ON(((c->user_regs.eflags & EF_IOPL) != 0) && !(VMX_DOMAIN(v)));
    70.9 -    c->user_regs.eflags |= v->arch.iopl << 12;
   70.10 -
   70.11      if ( VMX_DOMAIN(v) )
   70.12      {
   70.13          save_vmx_cpu_user_regs(&c->user_regs);
   70.14          __vmread(CR0_READ_SHADOW, &c->ctrlreg[0]);
   70.15          __vmread(CR4_READ_SHADOW, &c->ctrlreg[4]);
   70.16      }
   70.17 +    else
   70.18 +    {
   70.19 +        /* IOPL privileges are virtualised: merge back into returned eflags. */
   70.20 +        BUG_ON((c->user_regs.eflags & EF_IOPL) != 0);
   70.21 +        c->user_regs.eflags |= v->arch.iopl << 12;
   70.22 +    }
   70.23  
   70.24      c->flags = 0;
   70.25      if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
    71.1 --- a/xen/arch/x86/domain.c	Fri Aug 12 09:25:49 2005 -0800
    71.2 +++ b/xen/arch/x86/domain.c	Fri Aug 12 09:35:15 2005 -0800
    71.3 @@ -295,12 +295,17 @@ void arch_do_boot_vcpu(struct vcpu *v)
    71.4          l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
    71.5  }
    71.6  
    71.7 -void
    71.8 -arch_migrate_cpu(struct vcpu *v, int newcpu)
    71.9 +void vcpu_migrate_cpu(struct vcpu *v, int newcpu)
   71.10  {
   71.11 -    if ( VMX_DOMAIN(v) && (v->processor != newcpu) ){
   71.12 -        u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
   71.13 -        __vmpclear(vmcs_phys_ptr);
   71.14 +    if ( v->processor == newcpu )
   71.15 +        return;
   71.16 +
   71.17 +    set_bit(_VCPUF_cpu_migrated, &v->vcpu_flags);
   71.18 +    v->processor = newcpu;
   71.19 +
   71.20 +    if ( VMX_DOMAIN(v) )
   71.21 +    {
   71.22 +        __vmpclear(virt_to_phys(v->arch.arch_vmx.vmcs));
   71.23          v->arch.schedule_tail = arch_vmx_do_relaunch;
   71.24      }
   71.25  }
   71.26 @@ -308,36 +313,6 @@ arch_migrate_cpu(struct vcpu *v, int new
   71.27  #ifdef CONFIG_VMX
   71.28  static int vmx_switch_on;
   71.29  
   71.30 -void arch_vmx_do_resume(struct vcpu *v) 
   71.31 -{
   71.32 -    u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
   71.33 -
   71.34 -    load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
   71.35 -    vmx_do_resume(v);
   71.36 -    reset_stack_and_jump(vmx_asm_do_resume);
   71.37 -}
   71.38 -
   71.39 -void arch_vmx_do_launch(struct vcpu *v) 
   71.40 -{
   71.41 -    u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
   71.42 -
   71.43 -    load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
   71.44 -    vmx_do_launch(v);
   71.45 -    reset_stack_and_jump(vmx_asm_do_launch);
   71.46 -}
   71.47 -
   71.48 -void arch_vmx_do_relaunch(struct vcpu *v)
   71.49 -{
   71.50 -    u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
   71.51 -
   71.52 -    load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
   71.53 -    vmx_do_resume(v);
   71.54 -    vmx_set_host_env(v);
   71.55 -    v->arch.schedule_tail = arch_vmx_do_resume;
   71.56 -
   71.57 -    reset_stack_and_jump(vmx_asm_do_relaunch);
   71.58 -}
   71.59 -
   71.60  static int vmx_final_setup_guest(
   71.61      struct vcpu *v, struct vcpu_guest_context *ctxt)
   71.62  {
   71.63 @@ -368,7 +343,7 @@ static int vmx_final_setup_guest(
   71.64  
   71.65      v->arch.schedule_tail = arch_vmx_do_launch;
   71.66  
   71.67 -#if defined (__i386)
   71.68 +#if defined (__i386__)
   71.69      v->domain->arch.vmx_platform.real_mode_data = 
   71.70          (unsigned long *) regs->esi;
   71.71  #endif
    74.1 --- a/xen/arch/x86/setup.c	Fri Aug 12 09:25:49 2005 -0800
    74.2 +++ b/xen/arch/x86/setup.c	Fri Aug 12 09:35:15 2005 -0800
    74.3 @@ -336,26 +336,25 @@ void __init __start_xen(multiboot_info_t
    74.4      /* Find a large enough RAM extent to stash the DOM0 modules. */
    74.5      for ( i = 0; ; i++ )
    74.6      {
    74.7 -        if ( (e820.map[i].type == E820_RAM) &&
    74.8 -             (e820.map[i].size >= modules_length) &&
    74.9 -             ((e820.map[i].addr + e820.map[i].size) >=
   74.10 -              (xenheap_phys_end + modules_length)) )
   74.11 -        {
   74.12 -            /* Stash as near as possible to the beginning of the RAM extent. */
   74.13 -            initial_images_start = e820.map[i].addr;
   74.14 -            if ( initial_images_start < xenheap_phys_end )
   74.15 -                initial_images_start = xenheap_phys_end;
   74.16 -            initial_images_end = initial_images_start + modules_length;
   74.17 -            break;
   74.18 -        }
   74.19 -
   74.20          if ( i == e820.nr_map )
   74.21          {
   74.22              printk("Not enough memory to stash the DOM0 kernel image.\n");
   74.23              for ( ; ; ) ;
   74.24          }
   74.25 +        
   74.26 +        if ( (e820.map[i].type == E820_RAM) &&
   74.27 +             (e820.map[i].size >= modules_length) &&
   74.28 +             ((e820.map[i].addr + e820.map[i].size) >=
   74.29 +              (xenheap_phys_end + modules_length)) )
   74.30 +            break;
   74.31      }
   74.32  
   74.33 +    /* Stash as near as possible to the beginning of the RAM extent. */
   74.34 +    initial_images_start = e820.map[i].addr;
   74.35 +    if ( initial_images_start < xenheap_phys_end )
   74.36 +        initial_images_start = xenheap_phys_end;
   74.37 +    initial_images_end = initial_images_start + modules_length;
   74.38 +
   74.39  #if defined(CONFIG_X86_32)
   74.40      memmove((void *)initial_images_start,  /* use low mapping */
   74.41              (void *)mod[0].mod_start,      /* use low mapping */
    75.1 --- a/xen/arch/x86/time.c	Fri Aug 12 09:25:49 2005 -0800
    75.2 +++ b/xen/arch/x86/time.c	Fri Aug 12 09:35:15 2005 -0800
    75.3 @@ -43,7 +43,10 @@ unsigned long hpet_address;
    75.4  spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
    75.5  int timer_ack = 0;
    75.6  unsigned long volatile jiffies;
    75.7 -static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */
    75.8 +
    75.9 +/* UTC time at system boot. */
   75.10 +static s64 wc_sec;
   75.11 +static u32 wc_nsec;
   75.12  static spinlock_t wc_lock = SPIN_LOCK_UNLOCKED;
   75.13  
   75.14  struct time_scale {
   75.15 @@ -693,18 +696,33 @@ void update_dom_time(struct vcpu *v)
   75.16  }
   75.17  
   75.18  /* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
   75.19 -void do_settime(unsigned long secs, unsigned long nsecs, u64 system_time_base)
   75.20 +void do_settime(s64 secs, u32 nsecs, u64 system_time_base)
   75.21  {
   75.22 -    u64 x;
   75.23 -    u32 y, _wc_sec, _wc_nsec;
   75.24 +    s64 x;
   75.25 +    u32 y;
   75.26      struct domain *d;
   75.27      shared_info_t *s;
   75.28  
   75.29 -    x = (secs * 1000000000ULL) + (u64)nsecs - system_time_base;
   75.30 -    y = do_div(x, 1000000000);
   75.31 +    x = (secs * 1000000000LL) + (u64)nsecs - system_time_base;
   75.32 +    if ( x < 0 )
   75.33 +    {
   75.34 +        /* -ve UTC offset => -ve seconds, +ve nanoseconds. */
   75.35 +        x = -x;
   75.36 +        y = do_div(x, 1000000000);
   75.37 +        x = -x;
   75.38 +        if ( y != 0 )
   75.39 +        {
   75.40 +            y = 1000000000 - y;
   75.41 +            x--;
   75.42 +        }
   75.43 +    }
   75.44 +    else
   75.45 +    {
   75.46 +        y = do_div(x, 1000000000);
   75.47 +    }
   75.48  
   75.49 -    wc_sec  = _wc_sec  = (u32)x;
   75.50 -    wc_nsec = _wc_nsec = (u32)y;
   75.51 +    wc_sec  = x;
   75.52 +    wc_nsec = y;
   75.53  
   75.54      read_lock(&domlist_lock);
   75.55      spin_lock(&wc_lock);
   75.56 @@ -713,8 +731,8 @@ void do_settime(unsigned long secs, unsi
   75.57      {
   75.58          s = d->shared_info;
   75.59          version_update_begin(&s->wc_version);
   75.60 -        s->wc_sec  = _wc_sec;
   75.61 -        s->wc_nsec = _wc_nsec;
   75.62 +        s->wc_sec  = x;
   75.63 +        s->wc_nsec = y;
   75.64          version_update_end(&s->wc_version);
   75.65      }
   75.66  
    77.1 --- a/xen/arch/x86/vmx_vmcs.c	Fri Aug 12 09:25:49 2005 -0800
    77.2 +++ b/xen/arch/x86/vmx_vmcs.c	Fri Aug 12 09:35:15 2005 -0800
    77.3 @@ -543,6 +543,36 @@ void vm_resume_fail(unsigned long eflags
    77.4      __vmx_bug(guest_cpu_user_regs());
    77.5  }
    77.6  
    77.7 +void arch_vmx_do_resume(struct vcpu *v) 
    77.8 +{
    77.9 +    u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
   77.10 +
   77.11 +    load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
   77.12 +    vmx_do_resume(v);
   77.13 +    reset_stack_and_jump(vmx_asm_do_resume);
   77.14 +}
   77.15 +
   77.16 +void arch_vmx_do_launch(struct vcpu *v) 
   77.17 +{
   77.18 +    u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
   77.19 +
   77.20 +    load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
   77.21 +    vmx_do_launch(v);
   77.22 +    reset_stack_and_jump(vmx_asm_do_launch);
   77.23 +}
   77.24 +
   77.25 +void arch_vmx_do_relaunch(struct vcpu *v)
   77.26 +{
   77.27 +    u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
   77.28 +
   77.29 +    load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
   77.30 +    vmx_do_resume(v);
   77.31 +    vmx_set_host_env(v);
   77.32 +    v->arch.schedule_tail = arch_vmx_do_resume;
   77.33 +
   77.34 +    reset_stack_and_jump(vmx_asm_do_relaunch);
   77.35 +}
   77.36 +
   77.37  #endif /* CONFIG_VMX */
   77.38  
   77.39  /*
    78.1 --- a/xen/arch/x86/x86_32/entry.S	Fri Aug 12 09:25:49 2005 -0800
    78.2 +++ b/xen/arch/x86/x86_32/entry.S	Fri Aug 12 09:35:15 2005 -0800
    78.3 @@ -183,6 +183,7 @@ ENTRY(vmx_asm_do_relaunch)
    78.4  
    78.5  #endif
    78.6  
    78.7 +        ALIGN
    78.8  restore_all_guest:
    78.9          testl $X86_EFLAGS_VM,UREGS_eflags(%esp)
   78.10          jnz  restore_all_vm86
    79.1 --- a/xen/arch/x86/x86_32/mm.c	Fri Aug 12 09:25:49 2005 -0800
    79.2 +++ b/xen/arch/x86/x86_32/mm.c	Fri Aug 12 09:35:15 2005 -0800
    79.3 @@ -150,7 +150,7 @@ void __init zap_low_mappings(l2_pgentry_
    79.4  void subarch_init_memory(struct domain *dom_xen)
    79.5  {
    79.6      unsigned long m2p_start_mfn;
    79.7 -    int i;
    79.8 +    unsigned int i, j;
    79.9  
   79.10      /*
   79.11       * We are rather picky about the layout of 'struct pfn_info'. The
   79.12 @@ -174,12 +174,12 @@ void subarch_init_memory(struct domain *
   79.13      {
   79.14          m2p_start_mfn = l2e_get_pfn(
   79.15              idle_pg_table_l2[l2_linear_offset(RDWR_MPT_VIRT_START) + i]);
   79.16 -        for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
   79.17 +        for ( j = 0; j < L2_PAGETABLE_ENTRIES; j++ )
   79.18          {
   79.19 -            frame_table[m2p_start_mfn+i].count_info = PGC_allocated | 1;
   79.20 +            frame_table[m2p_start_mfn+j].count_info = PGC_allocated | 1;
   79.21              /* Ensure it's only mapped read-only by domains. */
   79.22 -            frame_table[m2p_start_mfn+i].u.inuse.type_info = PGT_gdt_page | 1;
   79.23 -            page_set_owner(&frame_table[m2p_start_mfn+i], dom_xen);
   79.24 +            frame_table[m2p_start_mfn+j].u.inuse.type_info = PGT_gdt_page | 1;
   79.25 +            page_set_owner(&frame_table[m2p_start_mfn+j], dom_xen);
   79.26          }
   79.27      }
   79.28  }
    81.1 --- a/xen/common/dom0_ops.c	Fri Aug 12 09:25:49 2005 -0800
    81.2 +++ b/xen/common/dom0_ops.c	Fri Aug 12 09:35:15 2005 -0800
    81.3 @@ -293,19 +293,17 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    81.4          v->cpumap = cpumap;
    81.5  
    81.6          if ( cpumap == CPUMAP_RUNANYWHERE )
    81.7 +        {
    81.8              clear_bit(_VCPUF_cpu_pinned, &v->vcpu_flags);
    81.9 +        }
   81.10          else
   81.11          {
   81.12              /* pick a new cpu from the usable map */
   81.13              int new_cpu = (int)find_first_set_bit(cpumap) % num_online_cpus();
   81.14  
   81.15              vcpu_pause(v);
   81.16 -            if ( v->processor != new_cpu ){
   81.17 -                set_bit(_VCPUF_cpu_migrated, &v->vcpu_flags);
   81.18 -                arch_migrate_cpu(v, new_cpu);
   81.19 -            }
   81.20 +            vcpu_migrate_cpu(v, new_cpu);
   81.21              set_bit(_VCPUF_cpu_pinned, &v->vcpu_flags);
   81.22 -            v->processor = new_cpu;
   81.23              vcpu_unpause(v);
   81.24          }
   81.25  
    89.1 --- a/xen/include/public/dom0_ops.h	Fri Aug 12 09:25:49 2005 -0800
    89.2 +++ b/xen/include/public/dom0_ops.h	Fri Aug 12 09:35:15 2005 -0800
    89.3 @@ -133,11 +133,12 @@ typedef struct {
    89.4  /*
    89.5   * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
    89.6   * 1 January, 1970 if the current system time was <system_time>.
    89.7 + * NB. <secs> can be negative, but <nsecs> must always be non-negative.
    89.8   */
    89.9  #define DOM0_SETTIME          17
   89.10  typedef struct {
   89.11      /* IN variables. */
   89.12 -    u32 secs;
   89.13 +    s64 secs;
   89.14      u32 nsecs;
   89.15      u64 system_time;
   89.16  } dom0_settime_t;
    91.1 --- a/xen/include/public/xen.h	Fri Aug 12 09:25:49 2005 -0800
    91.2 +++ b/xen/include/public/xen.h	Fri Aug 12 09:35:15 2005 -0800
    91.3 @@ -399,11 +399,12 @@ typedef struct shared_info {
    91.4  
    91.5      /*
    91.6       * Wallclock time: updated only by control software. Guests should base
    91.7 -     * their gettimeofday() syscall on this wallclock-base value.
    91.8 +     * their gettimeofday() syscall on this wallclock-base value, which
    91.9 +     * indicates UTC when system_time == 0 (i.e., at boot).
   91.10       */
   91.11      u32 wc_version;      /* Version counter: see vcpu_time_info_t. */
   91.12 -    u32 wc_sec;          /* Secs  00:00:00 UTC, Jan 1, 1970.  */
   91.13 -    u32 wc_nsec;         /* Nsecs 00:00:00 UTC, Jan 1, 1970.  */
   91.14 +    u32 wc_nsec;         /* Nsecs since 00:00:00 UTC, Jan 1, 1970.  */
   91.15 +    s64 wc_sec;          /* Secs  since 00:00:00 UTC, Jan 1, 1970.  */
   91.16  
   91.17      arch_shared_info_t arch;
   91.18  
    92.1 --- a/xen/include/xen/domain.h	Fri Aug 12 09:25:49 2005 -0800
    92.2 +++ b/xen/include/xen/domain.h	Fri Aug 12 09:35:15 2005 -0800
    92.3 @@ -14,10 +14,10 @@ extern void arch_do_createdomain(struct 
    92.4  
    92.5  extern void arch_do_boot_vcpu(struct vcpu *v);
    92.6  
    92.7 -void arch_migrate_cpu(struct vcpu *v, int newcpu);
    92.8 +extern int  arch_set_info_guest(
    92.9 +    struct vcpu *v, struct vcpu_guest_context *c);
   92.10  
   92.11 -extern int  arch_set_info_guest(
   92.12 -    struct vcpu *d, struct vcpu_guest_context *c);
   92.13 +extern void vcpu_migrate_cpu(struct vcpu *v, int newcpu);
   92.14  
   92.15  extern void free_perdomain_pt(struct domain *d);
   92.16  
    95.1 --- a/xen/include/xen/time.h	Fri Aug 12 09:25:49 2005 -0800
    95.2 +++ b/xen/include/xen/time.h	Fri Aug 12 09:35:15 2005 -0800
    95.3 @@ -56,8 +56,7 @@ s_time_t get_s_time(void);
    95.4  #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
    95.5  
    95.6  extern void update_dom_time(struct vcpu *v);
    95.7 -extern void do_settime(
    95.8 -    unsigned long secs, unsigned long nsecs, u64 system_time_base);
    95.9 +extern void do_settime(s64 secs, u32 nsecs, u64 system_time_base);
   95.10  
   95.11  #endif /* __XEN_TIME_H__ */
   95.12