aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>2006-03-22 09:12:48 -0700
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>2006-03-22 09:12:48 -0700
commit77e7c5a65b10d7b8b45a17ed63ac594df37ef8a6 (patch)
treecf23171b3d8168a4ff0cc9959f755afdf4edf6e1
parent776588f530eb27d55396aaa268e2bb47c44ae5f1 (diff)
parent6d10e95f6fd6f4c8284648649fe939878c2e5cfe (diff)
downloadxen-77e7c5a65b10d7b8b45a17ed63ac594df37ef8a6.tar.gz
xen-77e7c5a65b10d7b8b45a17ed63ac594df37ef8a6.tar.bz2
xen-77e7c5a65b10d7b8b45a17ed63ac594df37ef8a6.zip
merge xen-unstable.hg
-rw-r--r--linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c7
-rw-r--r--linux-2.6-xen-sparse/arch/i386/mm/init-xen.c6
-rw-r--r--linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c19
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c15
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c24
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/blkback/common.h25
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/blkback/interface.c24
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c24
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c1
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/blkfront/block.h7
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c7
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/console/console.c9
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c26
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/core/evtchn.c23
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/core/features.c2
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/core/gnttab.c37
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/core/reboot.c2
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c1
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c9
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/net_driver_util.c11
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/netback/common.h24
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/netback/interface.c24
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/netback/loopback.c24
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/netback/netback.c24
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c3
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c44
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c33
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c7
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h7
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c7
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c85
-rw-r--r--linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c72
-rw-r--r--linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h7
-rw-r--r--linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h7
-rw-r--r--linux-2.6-xen-sparse/include/asm-ia64/hypercall.h7
-rw-r--r--linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h7
-rw-r--r--linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h7
-rw-r--r--linux-2.6-xen-sparse/include/xen/balloon.h7
-rw-r--r--linux-2.6-xen-sparse/include/xen/evtchn.h7
-rw-r--r--linux-2.6-xen-sparse/include/xen/gnttab.h7
-rw-r--r--linux-2.6-xen-sparse/include/xen/net_driver_util.h8
-rw-r--r--linux-2.6-xen-sparse/include/xen/public/evtchn.h7
-rw-r--r--linux-2.6-xen-sparse/include/xen/public/privcmd.h7
-rw-r--r--linux-2.6-xen-sparse/include/xen/xenbus.h9
-rw-r--r--tools/examples/Makefile4
-rw-r--r--tools/examples/xmexample.hvm3
-rw-r--r--tools/firmware/vmxassist/machine.h3
-rw-r--r--tools/firmware/vmxassist/util.c51
-rw-r--r--tools/firmware/vmxassist/vm86.c491
-rw-r--r--tools/xm-test/tests/vtpm/vtpm_utils.py2
-rw-r--r--xen/arch/x86/hvm/svm/intr.c26
-rw-r--r--xen/arch/x86/hvm/svm/svm.c34
-rw-r--r--xen/arch/x86/hvm/svm/vmcb.c2
53 files changed, 997 insertions, 339 deletions
diff --git a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
index 8859304fc8..de80a51f05 100644
--- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
+++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
@@ -5,8 +5,11 @@
*
* Copyright (c) 2002-2004, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c b/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c
index f1cb31ca3f..0e5661ae68 100644
--- a/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c
+++ b/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c
@@ -29,6 +29,8 @@
#include <linux/efi.h>
#include <linux/memory_hotplug.h>
#include <linux/initrd.h>
+#include <linux/dma-mapping.h>
+#include <linux/scatterlist.h>
#include <asm/processor.h>
#include <asm/system.h>
@@ -42,11 +44,7 @@
#include <asm/tlbflush.h>
#include <asm/sections.h>
#include <asm/hypervisor.h>
-#if defined(CONFIG_SWIOTLB)
-#include <linux/dma-mapping.h>
-#include <asm/scatterlist.h>
#include <asm/swiotlb.h>
-#endif
extern unsigned long *contiguous_bitmap;
diff --git a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
index c06c2b26a1..aa7d503a41 100644
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
@@ -93,6 +93,11 @@ EXPORT_SYMBOL(hypercall_page);
/* Allows setting of maximum possible memory size */
unsigned long xen_override_max_pfn;
+static int xen_panic_event(struct notifier_block *, unsigned long, void *);
+static struct notifier_block xen_panic_block = {
+ xen_panic_event, NULL, 0 /* try to go last */
+};
+
unsigned long *phys_to_machine_mapping;
unsigned long *pfn_to_mfn_frame_list_list, *pfn_to_mfn_frame_list[512];
@@ -634,6 +639,9 @@ void __init setup_arch(char **cmdline_p)
unsigned long kernel_end;
#ifdef CONFIG_XEN
+ /* Register a call for panic conditions. */
+ notifier_chain_register(&panic_notifier_list, &xen_panic_block);
+
ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
kernel_end = 0; /* dummy */
screen_info = SCREEN_INFO;
@@ -989,6 +997,17 @@ void __init setup_arch(char **cmdline_p)
#endif /* !CONFIG_XEN */
}
+#ifdef CONFIG_XEN
+static int
+xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
+{
+ HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash);
+ /* we're never actually going to get here... */
+ return NOTIFY_DONE;
+}
+#endif /* !CONFIG_XEN */
+
+
static int __cpuinit get_model_name(struct cpuinfo_x86 *c)
{
unsigned int *v;
diff --git a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
index b2b8e4d29b..d8327b0707 100644
--- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
+++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
@@ -7,8 +7,11 @@
* Copyright (c) 2003-2004, M Williamson, K Fraser
* Copyright (c) 2005 Dan M. Smith, IBM Corporation
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
@@ -572,9 +575,11 @@ void balloon_dealloc_empty_page_range(
schedule_work(&balloon_worker);
}
-EXPORT_SYMBOL(balloon_update_driver_allowance);
-EXPORT_SYMBOL(balloon_alloc_empty_page_range);
-EXPORT_SYMBOL(balloon_dealloc_empty_page_range);
+EXPORT_SYMBOL_GPL(balloon_update_driver_allowance);
+EXPORT_SYMBOL_GPL(balloon_alloc_empty_page_range);
+EXPORT_SYMBOL_GPL(balloon_dealloc_empty_page_range);
+
+MODULE_LICENSE("Dual BSD/GPL");
/*
* Local variables:
diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
index d624cafe95..2de5f1c60c 100644
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
@@ -9,6 +9,30 @@
*
* Copyright (c) 2003-2004, Keir Fraser & Steve Hand
* Copyright (c) 2005, Christopher Clark
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
*/
#include <linux/spinlock.h>
diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h
index aab5a9ff5b..502a02c6b8 100644
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h
@@ -1,3 +1,28 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
#ifndef __BLKIF__BACKEND__COMMON_H__
#define __BLKIF__BACKEND__COMMON_H__
diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
index 090d1078d2..75b9f74b0b 100644
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
@@ -4,6 +4,30 @@
* Block-device interface management.
*
* Copyright (c) 2004, Keir Fraser
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
*/
#include "common.h"
diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c
index b2d0939225..d1d38dcd76 100644
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c
@@ -4,6 +4,30 @@
* Routines for managing virtual block devices (VBDs).
*
* Copyright (c) 2003-2005, Keir Fraser & Steve Hand
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
*/
#include "common.h"
diff --git a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
index 240afd2b0e..6e29fa3d75 100644
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
@@ -810,7 +810,6 @@ module_exit(xlblk_exit);
MODULE_LICENSE("Dual BSD/GPL");
-
/*
* Local variables:
* c-file-style: "linux"
diff --git a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h
index ecede04f63..d6a93140dc 100644
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h
@@ -7,8 +7,11 @@
* Modifications by Mark A. Williamson are (c) Intel Research Cambridge
* Copyright (c) 2004-2005, Christian Limpach
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
index 99b8ab1a99..830b3dd1b0 100644
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
@@ -7,8 +7,11 @@
* Modifications by Mark A. Williamson are (c) Intel Research Cambridge
* Copyright (c) 2004-2005, Christian Limpach
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/drivers/xen/console/console.c b/linux-2.6-xen-sparse/drivers/xen/console/console.c
index ae8255c196..360e550bbc 100644
--- a/linux-2.6-xen-sparse/drivers/xen/console/console.c
+++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c
@@ -5,8 +5,11 @@
*
* Copyright (c) 2002-2004, K A Fraser.
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
@@ -632,6 +635,8 @@ static int __init xencons_init(void)
module_init(xencons_init);
+MODULE_LICENSE("Dual BSD/GPL");
+
/*
* Local variables:
* c-file-style: "linux"
diff --git a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c
index 8abb0a495e..3bb5631d8e 100644
--- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c
+++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c
@@ -1,3 +1,29 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
#include <linux/version.h>
#include <linux/module.h>
#include <linux/errno.h>
diff --git a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c
index 58f08c6c37..686e1e021d 100644
--- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c
+++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c
@@ -5,8 +5,11 @@
*
* Copyright (c) 2002-2005, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
@@ -147,7 +150,7 @@ void force_evtchn_callback(void)
{
(void)HYPERVISOR_xen_version(0, NULL);
}
-EXPORT_SYMBOL(force_evtchn_callback);
+EXPORT_SYMBOL_GPL(force_evtchn_callback);
/* NB. Interrupts are disabled on entry. */
asmlinkage void evtchn_do_upcall(struct pt_regs *regs)
@@ -323,7 +326,7 @@ int bind_evtchn_to_irqhandler(
return irq;
}
-EXPORT_SYMBOL(bind_evtchn_to_irqhandler);
+EXPORT_SYMBOL_GPL(bind_evtchn_to_irqhandler);
int bind_virq_to_irqhandler(
unsigned int virq,
@@ -345,7 +348,7 @@ int bind_virq_to_irqhandler(
return irq;
}
-EXPORT_SYMBOL(bind_virq_to_irqhandler);
+EXPORT_SYMBOL_GPL(bind_virq_to_irqhandler);
int bind_ipi_to_irqhandler(
unsigned int ipi,
@@ -367,14 +370,14 @@ int bind_ipi_to_irqhandler(
return irq;
}
-EXPORT_SYMBOL(bind_ipi_to_irqhandler);
+EXPORT_SYMBOL_GPL(bind_ipi_to_irqhandler);
void unbind_from_irqhandler(unsigned int irq, void *dev_id)
{
free_irq(irq, dev_id);
unbind_from_irq(irq);
}
-EXPORT_SYMBOL(unbind_from_irqhandler);
+EXPORT_SYMBOL_GPL(unbind_from_irqhandler);
#ifdef CONFIG_SMP
static void do_nothing_function(void *ign)
@@ -639,14 +642,14 @@ void notify_remote_via_irq(int irq)
if (VALID_EVTCHN(evtchn))
notify_remote_via_evtchn(evtchn);
}
-EXPORT_SYMBOL(notify_remote_via_irq);
+EXPORT_SYMBOL_GPL(notify_remote_via_irq);
void mask_evtchn(int port)
{
shared_info_t *s = HYPERVISOR_shared_info;
synch_set_bit(port, &s->evtchn_mask[0]);
}
-EXPORT_SYMBOL(mask_evtchn);
+EXPORT_SYMBOL_GPL(mask_evtchn);
void unmask_evtchn(int port)
{
@@ -677,7 +680,7 @@ void unmask_evtchn(int port)
force_evtchn_callback();
}
}
-EXPORT_SYMBOL(unmask_evtchn);
+EXPORT_SYMBOL_GPL(unmask_evtchn);
void irq_resume(void)
{
diff --git a/linux-2.6-xen-sparse/drivers/xen/core/features.c b/linux-2.6-xen-sparse/drivers/xen/core/features.c
index 297d13fb32..ad1f0b4d34 100644
--- a/linux-2.6-xen-sparse/drivers/xen/core/features.c
+++ b/linux-2.6-xen-sparse/drivers/xen/core/features.c
@@ -12,7 +12,7 @@
#include <xen/features.h>
u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly;
-EXPORT_SYMBOL(xen_features);
+EXPORT_SYMBOL_GPL(xen_features);
void setup_xen_features(void)
{
diff --git a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
index 3e62011bfd..31b57d4dac 100644
--- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
+++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
@@ -6,8 +6,11 @@
* Copyright (c) 2005, Christopher Clark
* Copyright (c) 2004-2005, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
@@ -52,21 +55,21 @@
printk(KERN_WARNING "xen_grant: " fmt, ##args)
-EXPORT_SYMBOL(gnttab_grant_foreign_access);
-EXPORT_SYMBOL(gnttab_end_foreign_access_ref);
-EXPORT_SYMBOL(gnttab_end_foreign_access);
-EXPORT_SYMBOL(gnttab_query_foreign_access);
-EXPORT_SYMBOL(gnttab_grant_foreign_transfer);
-EXPORT_SYMBOL(gnttab_end_foreign_transfer_ref);
-EXPORT_SYMBOL(gnttab_end_foreign_transfer);
-EXPORT_SYMBOL(gnttab_alloc_grant_references);
-EXPORT_SYMBOL(gnttab_free_grant_references);
-EXPORT_SYMBOL(gnttab_free_grant_reference);
-EXPORT_SYMBOL(gnttab_claim_grant_reference);
-EXPORT_SYMBOL(gnttab_release_grant_reference);
-EXPORT_SYMBOL(gnttab_request_free_callback);
-EXPORT_SYMBOL(gnttab_grant_foreign_access_ref);
-EXPORT_SYMBOL(gnttab_grant_foreign_transfer_ref);
+EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access);
+EXPORT_SYMBOL_GPL(gnttab_end_foreign_access_ref);
+EXPORT_SYMBOL_GPL(gnttab_end_foreign_access);
+EXPORT_SYMBOL_GPL(gnttab_query_foreign_access);
+EXPORT_SYMBOL_GPL(gnttab_grant_foreign_transfer);
+EXPORT_SYMBOL_GPL(gnttab_end_foreign_transfer_ref);
+EXPORT_SYMBOL_GPL(gnttab_end_foreign_transfer);
+EXPORT_SYMBOL_GPL(gnttab_alloc_grant_references);
+EXPORT_SYMBOL_GPL(gnttab_free_grant_references);
+EXPORT_SYMBOL_GPL(gnttab_free_grant_reference);
+EXPORT_SYMBOL_GPL(gnttab_claim_grant_reference);
+EXPORT_SYMBOL_GPL(gnttab_release_grant_reference);
+EXPORT_SYMBOL_GPL(gnttab_request_free_callback);
+EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access_ref);
+EXPORT_SYMBOL_GPL(gnttab_grant_foreign_transfer_ref);
/* External tools reserve first few grant table entries. */
#define NR_RESERVED_ENTRIES 8
diff --git a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c
index 1fa1f567c7..4ed9b2de3e 100644
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c
@@ -122,7 +122,7 @@ static int __do_suspend(void *ignore)
lock_cpu_hotplug();
#ifdef CONFIG_SMP
/*
- * Take all other CPUs offline. We hold the hotplug semaphore to
+ * Take all other CPUs offline. We hold the hotplug mutex to
* avoid other processes bringing up CPUs under our feet.
*/
cpus_clear(prev_online_cpus);
diff --git a/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c b/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c
index fb6b9d1901..e26ab7f003 100644
--- a/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c
+++ b/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c
@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <asm/hypervisor.h>
+#include <xen/features.h>
#include <xen/hypervisor_sysfs.h>
MODULE_LICENSE("GPL");
diff --git a/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c b/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c
index 7222429f08..2975fe070e 100644
--- a/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c
+++ b/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c
@@ -6,8 +6,11 @@
* Copyright (c) 2004-2005, K A Fraser
* Multi-process extensions Copyright (c) 2004, Steven Smith
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
@@ -448,6 +451,8 @@ static void evtchn_cleanup(void)
module_init(evtchn_init);
module_exit(evtchn_cleanup);
+MODULE_LICENSE("Dual BSD/GPL");
+
/*
* Local variables:
* c-file-style: "linux"
diff --git a/linux-2.6-xen-sparse/drivers/xen/net_driver_util.c b/linux-2.6-xen-sparse/drivers/xen/net_driver_util.c
index 10688f9281..43b9fb7de9 100644
--- a/linux-2.6-xen-sparse/drivers/xen/net_driver_util.c
+++ b/linux-2.6-xen-sparse/drivers/xen/net_driver_util.c
@@ -4,9 +4,11 @@
*
* Copyright (c) 2005 XenSource Ltd.
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following
- * license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this source file (the "Software"), to deal in the Software without
@@ -27,7 +29,6 @@
* DEALINGS IN THE SOFTWARE.
*/
-
#include <linux/if_ether.h>
#include <linux/err.h>
#include <linux/module.h>
@@ -54,7 +55,7 @@ int xen_net_read_mac(struct xenbus_device *dev, u8 mac[])
kfree(macstr);
return 0;
}
-EXPORT_SYMBOL(xen_net_read_mac);
+EXPORT_SYMBOL_GPL(xen_net_read_mac);
/*
* Local variables:
diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/common.h b/linux-2.6-xen-sparse/drivers/xen/netback/common.h
index 61f8d58ea1..ab52a03f07 100644
--- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h
@@ -1,5 +1,29 @@
/******************************************************************************
* arch/xen/drivers/netif/backend/common.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
*/
#ifndef __NETIF__BACKEND__COMMON_H__
diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c
index a27533cf87..79944d6440 100644
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c
@@ -4,6 +4,30 @@
* Network-device interface management.
*
* Copyright (c) 2004-2005, Keir Fraser
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
*/
#include "common.h"
diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c
index a5a11cc55e..e9f354a837 100644
--- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c
@@ -19,6 +19,30 @@
* (to avoid confusing the Etherbridge).
*
* Copyright (c) 2005 K A Fraser
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
*/
#include <linux/config.h>
diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c
index 64173fae5d..5b19f6356d 100644
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c
@@ -8,6 +8,30 @@
* drivers/xen/netfront/netfront.c
*
* Copyright (c) 2002-2005, K A Fraser
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
*/
#include "common.h"
diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
index 2f52c52a33..903532ff39 100644
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
@@ -68,9 +68,6 @@
#define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
#define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE)
-#ifndef __GFP_NOWARN
-#define __GFP_NOWARN 0
-#endif
#define alloc_xen_skb(_l) __dev_alloc_skb((_l), GFP_ATOMIC|__GFP_NOWARN)
#define init_skb_shinfo(_skb) \
diff --git a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
index 527a8f8201..03a2ab9ea0 100644
--- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
@@ -8,9 +8,12 @@
*
* Copyright (c) 2002-2004, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
- *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify,
@@ -40,8 +43,7 @@
#include <linux/init.h>
#include <xen/tpmfe.h>
#include <linux/err.h>
-
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
#include <asm/io.h>
#include <xen/evtchn.h>
#include <xen/interface/grant_table.h>
@@ -150,8 +152,8 @@ static inline void tpm_private_free(void)
**************************************************************/
-static DECLARE_MUTEX(upperlayer_lock);
-static DECLARE_MUTEX(suspend_lock);
+static DEFINE_MUTEX(upperlayer_lock);
+static DEFINE_MUTEX(suspend_lock);
static struct tpmfe_device *upperlayer_tpmfe;
/*
@@ -161,9 +163,9 @@ int tpm_fe_send(struct tpm_private *tp, const u8 * buf, size_t count, void *ptr)
{
int sent;
- down(&suspend_lock);
+ mutex_lock(&suspend_lock);
sent = tpm_xmit(tp, buf, count, 0, ptr);
- up(&suspend_lock);
+ mutex_unlock(&suspend_lock);
return sent;
}
@@ -176,7 +178,7 @@ int tpm_fe_register_receiver(struct tpmfe_device *tpmfe_dev)
{
int rc = 0;
- down(&upperlayer_lock);
+ mutex_lock(&upperlayer_lock);
if (NULL == upperlayer_tpmfe) {
upperlayer_tpmfe = tpmfe_dev;
tpmfe_dev->max_tx_size = TPMIF_TX_RING_SIZE * PAGE_SIZE;
@@ -187,7 +189,7 @@ int tpm_fe_register_receiver(struct tpmfe_device *tpmfe_dev)
} else {
rc = -EBUSY;
}
- up(&upperlayer_lock);
+ mutex_unlock(&upperlayer_lock);
return rc;
}
EXPORT_SYMBOL(tpm_fe_register_receiver);
@@ -197,9 +199,9 @@ EXPORT_SYMBOL(tpm_fe_register_receiver);
*/
void tpm_fe_unregister_receiver(void)
{
- down(&upperlayer_lock);
+ mutex_lock(&upperlayer_lock);
upperlayer_tpmfe = NULL;
- up(&upperlayer_lock);
+ mutex_unlock(&upperlayer_lock);
}
EXPORT_SYMBOL(tpm_fe_unregister_receiver);
@@ -212,12 +214,12 @@ static int tpm_fe_send_upperlayer(const u8 * buf, size_t count,
{
int rc = 0;
- down(&upperlayer_lock);
+ mutex_lock(&upperlayer_lock);
if (upperlayer_tpmfe && upperlayer_tpmfe->receive)
rc = upperlayer_tpmfe->receive(buf, count, ptr);
- up(&upperlayer_lock);
+ mutex_unlock(&upperlayer_lock);
return rc;
}
@@ -412,7 +414,7 @@ tpmfront_suspend(struct xenbus_device *dev)
u32 ctr;
/* lock, so no app can send */
- down(&suspend_lock);
+ mutex_lock(&suspend_lock);
tp->is_suspended = 1;
for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 25; ctr++) {
@@ -644,7 +646,7 @@ static void tpmif_notify_upperlayer(struct tpm_private *tp)
* Notify upper layer about the state of the connection
* to the BE.
*/
- down(&upperlayer_lock);
+ mutex_lock(&upperlayer_lock);
if (upperlayer_tpmfe != NULL) {
if (tp->is_connected) {
@@ -653,7 +655,7 @@ static void tpmif_notify_upperlayer(struct tpm_private *tp)
upperlayer_tpmfe->status(0);
}
}
- up(&upperlayer_lock);
+ mutex_unlock(&upperlayer_lock);
}
@@ -662,21 +664,21 @@ static void tpmif_set_connected_state(struct tpm_private *tp, u8 is_connected)
/*
* Don't notify upper layer if we are in suspend mode and
* should disconnect - assumption is that we will resume
- * The semaphore keeps apps from sending.
+ * The mutex keeps apps from sending.
*/
if (is_connected == 0 && tp->is_suspended == 1) {
return;
}
/*
- * Unlock the semaphore if we are connected again
+ * Unlock the mutex if we are connected again
* after being suspended - now resuming.
* This also removes the suspend state.
*/
if (is_connected == 1 && tp->is_suspended == 1) {
tp->is_suspended = 0;
/* unlock, so apps can resume sending */
- up(&suspend_lock);
+ mutex_unlock(&suspend_lock);
}
if (is_connected != tp->is_connected) {
diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
index fea04d08ff..8126705aeb 100644
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
@@ -5,8 +5,11 @@
*
* Copyright (C) 2005 XenSource Ltd
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
@@ -58,7 +61,7 @@ int xenbus_watch_path(struct xenbus_device *dev, const char *path,
return err;
}
-EXPORT_SYMBOL(xenbus_watch_path);
+EXPORT_SYMBOL_GPL(xenbus_watch_path);
int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
@@ -78,7 +81,7 @@ int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
kfree(state);
return err;
}
-EXPORT_SYMBOL(xenbus_watch_path2);
+EXPORT_SYMBOL_GPL(xenbus_watch_path2);
int xenbus_switch_state(struct xenbus_device *dev,
@@ -115,7 +118,7 @@ int xenbus_switch_state(struct xenbus_device *dev,
return 0;
}
-EXPORT_SYMBOL(xenbus_switch_state);
+EXPORT_SYMBOL_GPL(xenbus_switch_state);
/**
@@ -178,7 +181,7 @@ void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt,
_dev_error(dev, err, fmt, ap);
va_end(ap);
}
-EXPORT_SYMBOL(xenbus_dev_error);
+EXPORT_SYMBOL_GPL(xenbus_dev_error);
void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,
@@ -192,7 +195,7 @@ void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,
xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
}
-EXPORT_SYMBOL(xenbus_dev_fatal);
+EXPORT_SYMBOL_GPL(xenbus_dev_fatal);
int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn)
@@ -202,7 +205,7 @@ int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn)
xenbus_dev_fatal(dev, err, "granting access to ring page");
return err;
}
-EXPORT_SYMBOL(xenbus_grant_ring);
+EXPORT_SYMBOL_GPL(xenbus_grant_ring);
int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port)
@@ -219,7 +222,7 @@ int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port)
*port = op.u.alloc_unbound.port;
return err;
}
-EXPORT_SYMBOL(xenbus_alloc_evtchn);
+EXPORT_SYMBOL_GPL(xenbus_alloc_evtchn);
int xenbus_bind_evtchn(struct xenbus_device *dev, int remote_port, int *port)
@@ -238,7 +241,7 @@ int xenbus_bind_evtchn(struct xenbus_device *dev, int remote_port, int *port)
*port = op.u.bind_interdomain.local_port;
return err;
}
-EXPORT_SYMBOL(xenbus_bind_evtchn);
+EXPORT_SYMBOL_GPL(xenbus_bind_evtchn);
int xenbus_free_evtchn(struct xenbus_device *dev, int port)
@@ -290,7 +293,7 @@ int xenbus_map_ring_valloc(struct xenbus_device *dev, int gnt_ref, void **vaddr)
*vaddr = area->addr;
return 0;
}
-EXPORT_SYMBOL(xenbus_map_ring_valloc);
+EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc);
int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
@@ -314,7 +317,7 @@ int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
return op.status;
}
-EXPORT_SYMBOL(xenbus_map_ring);
+EXPORT_SYMBOL_GPL(xenbus_map_ring);
/* Based on Rusty Russell's skeleton driver's unmap_page */
@@ -359,7 +362,7 @@ int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr)
return op.status;
}
-EXPORT_SYMBOL(xenbus_unmap_ring_vfree);
+EXPORT_SYMBOL_GPL(xenbus_unmap_ring_vfree);
int xenbus_unmap_ring(struct xenbus_device *dev,
@@ -379,7 +382,7 @@ int xenbus_unmap_ring(struct xenbus_device *dev,
return op.status;
}
-EXPORT_SYMBOL(xenbus_unmap_ring);
+EXPORT_SYMBOL_GPL(xenbus_unmap_ring);
XenbusState xenbus_read_driver_state(const char *path)
@@ -391,7 +394,7 @@ XenbusState xenbus_read_driver_state(const char *path)
return result;
}
-EXPORT_SYMBOL(xenbus_read_driver_state);
+EXPORT_SYMBOL_GPL(xenbus_read_driver_state);
/*
diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
index dac34e4e0f..041b7dbacb 100644
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
@@ -5,8 +5,11 @@
*
* Copyright (C) 2005 Rusty Russell, IBM Corporation
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
index 59ca0d3080..a378b2df3d 100644
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
@@ -3,8 +3,11 @@
*
* Copyright (C) 2005 Rusty Russell, IBM Corporation
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
index 8f748dc41d..282cdafb98 100644
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
@@ -7,8 +7,11 @@
* Copyright (c) 2005, Christian Limpach
* Copyright (c) 2005, Rusty Russell, IBM Corporation
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
index a8f3a6c82f..84f35c8841 100644
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
@@ -5,8 +5,11 @@
* Copyright (C) 2005 Mike Wray, Hewlett-Packard
* Copyright (C) 2005 XenSource Ltd
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
@@ -49,9 +52,7 @@
#include "xenbus_comms.h"
-extern struct semaphore xenwatch_mutex;
-
-#define streq(a, b) (strcmp((a), (b)) == 0)
+extern struct mutex xenwatch_mutex;
static struct notifier_block *xenstore_chain;
@@ -59,8 +60,8 @@ static struct notifier_block *xenstore_chain;
static const struct xenbus_device_id *
match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev)
{
- for (; !streq(arr->devicetype, ""); arr++) {
- if (streq(arr->devicetype, dev->devicetype))
+ for (; *arr->devicetype != '\0'; arr++) {
+ if (!strcmp(arr->devicetype, dev->devicetype))
return arr;
}
return NULL;
@@ -106,6 +107,23 @@ static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
}
+static void free_otherend_details(struct xenbus_device *dev)
+{
+ kfree(dev->otherend);
+ dev->otherend = NULL;
+}
+
+
+static void free_otherend_watch(struct xenbus_device *dev)
+{
+ if (dev->otherend_watch.node) {
+ unregister_xenbus_watch(&dev->otherend_watch);
+ kfree(dev->otherend_watch.node);
+ dev->otherend_watch.node = NULL;
+ }
+}
+
+
static int read_otherend_details(struct xenbus_device *xendev,
char *id_node, char *path_node)
{
@@ -123,8 +141,7 @@ static int read_otherend_details(struct xenbus_device *xendev,
!xenbus_exists(XBT_NULL, xendev->otherend, "")) {
xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s",
xendev->nodename);
- kfree(xendev->otherend);
- xendev->otherend = NULL;
+ free_otherend_details(xendev);
return -ENOENT;
}
@@ -144,23 +161,6 @@ static int read_frontend_details(struct xenbus_device *xendev)
}
-static void free_otherend_details(struct xenbus_device *dev)
-{
- kfree(dev->otherend);
- dev->otherend = NULL;
-}
-
-
-static void free_otherend_watch(struct xenbus_device *dev)
-{
- if (dev->otherend_watch.node) {
- unregister_xenbus_watch(&dev->otherend_watch);
- kfree(dev->otherend_watch.node);
- dev->otherend_watch.node = NULL;
- }
-}
-
-
/* Bus type for frontend drivers. */
static int xenbus_probe_frontend(const char *type, const char *name);
static struct xen_bus_type xenbus_frontend = {
@@ -396,9 +396,9 @@ static int xenbus_register_driver_common(struct xenbus_driver *drv,
drv->driver.probe = xenbus_dev_probe;
drv->driver.remove = xenbus_dev_remove;
- down(&xenwatch_mutex);
+ mutex_lock(&xenwatch_mutex);
ret = driver_register(&drv->driver);
- up(&xenwatch_mutex);
+ mutex_unlock(&xenwatch_mutex);
return ret;
}
@@ -408,7 +408,7 @@ int xenbus_register_frontend(struct xenbus_driver *drv)
return xenbus_register_driver_common(drv, &xenbus_frontend);
}
-EXPORT_SYMBOL(xenbus_register_frontend);
+EXPORT_SYMBOL_GPL(xenbus_register_frontend);
int xenbus_register_backend(struct xenbus_driver *drv)
{
@@ -416,13 +416,13 @@ int xenbus_register_backend(struct xenbus_driver *drv)
return xenbus_register_driver_common(drv, &xenbus_backend);
}
-EXPORT_SYMBOL(xenbus_register_backend);
+EXPORT_SYMBOL_GPL(xenbus_register_backend);
void xenbus_unregister_driver(struct xenbus_driver *drv)
{
driver_unregister(&drv->driver);
}
-EXPORT_SYMBOL(xenbus_unregister_driver);
+EXPORT_SYMBOL_GPL(xenbus_unregister_driver);
struct xb_find_info
{
@@ -435,7 +435,7 @@ static int cmp_dev(struct device *dev, void *data)
struct xenbus_device *xendev = to_xenbus_device(dev);
struct xb_find_info *info = data;
- if (streq(xendev->nodename, info->nodename)) {
+ if (!strcmp(xendev->nodename, info->nodename)) {
info->dev = xendev;
get_device(dev);
return 1;
@@ -487,15 +487,10 @@ static void xenbus_cleanup_devices(const char *path, struct bus_type *bus)
} while (info.dev);
}
-static void xenbus_dev_free(struct xenbus_device *xendev)
-{
- kfree(xendev);
-}
-
static void xenbus_dev_release(struct device *dev)
{
if (dev)
- xenbus_dev_free(to_xenbus_device(dev));
+ kfree(to_xenbus_device(dev));
}
/* Simplified asprintf. */
@@ -584,7 +579,7 @@ static int xenbus_probe_node(struct xen_bus_type *bus,
return 0;
fail:
- xenbus_dev_free(xendev);
+ kfree(xendev);
return err;
}
@@ -845,7 +840,7 @@ void xenbus_suspend(void)
bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, suspend_dev);
xs_suspend();
}
-EXPORT_SYMBOL(xenbus_suspend);
+EXPORT_SYMBOL_GPL(xenbus_suspend);
void xenbus_resume(void)
{
@@ -854,7 +849,7 @@ void xenbus_resume(void)
bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, resume_dev);
bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, resume_dev);
}
-EXPORT_SYMBOL(xenbus_resume);
+EXPORT_SYMBOL_GPL(xenbus_resume);
/* A flag to determine if xenstored is 'ready' (i.e. has started) */
@@ -872,13 +867,13 @@ int register_xenstore_notifier(struct notifier_block *nb)
return ret;
}
-EXPORT_SYMBOL(register_xenstore_notifier);
+EXPORT_SYMBOL_GPL(register_xenstore_notifier);
void unregister_xenstore_notifier(struct notifier_block *nb)
{
notifier_chain_unregister(&xenstore_chain, nb);
}
-EXPORT_SYMBOL(unregister_xenstore_notifier);
+EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
static int all_devices_ready_(struct device *dev, void *data)
@@ -1019,10 +1014,6 @@ static int __init xenbus_probe_init(void)
if (!page)
return -ENOMEM;
- /* We don't refcnt properly, so set reserved on page.
- * (this allocation is permanent) */
- SetPageReserved(virt_to_page(page));
-
xen_start_info->store_mfn =
pfn_to_mfn(virt_to_phys((void *)page) >>
PAGE_SHIFT);
diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
index a388a84ffc..7e343eff21 100644
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
@@ -6,8 +6,11 @@
*
* Copyright (C) 2005 Rusty Russell, IBM Corporation
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
@@ -38,14 +41,13 @@
#include <linux/slab.h>
#include <linux/fcntl.h>
#include <linux/kthread.h>
+#include <linux/rwsem.h>
#include <xen/xenbus.h>
#include "xenbus_comms.h"
/* xenbus_probe.c */
extern char *kasprintf(const char *fmt, ...);
-#define streq(a, b) (strcmp((a), (b)) == 0)
-
struct xs_stored_msg {
struct list_head list;
@@ -73,7 +75,7 @@ struct xs_handle {
wait_queue_head_t reply_waitq;
/* One request at a time. */
- struct semaphore request_mutex;
+ struct mutex request_mutex;
/* Protect transactions against save/restore. */
struct rw_semaphore suspend_mutex;
@@ -96,14 +98,14 @@ static DEFINE_SPINLOCK(watch_events_lock);
* carrying out work.
*/
static pid_t xenwatch_pid;
-/* static */ DECLARE_MUTEX(xenwatch_mutex);
+/* static */ DEFINE_MUTEX(xenwatch_mutex);
static DECLARE_WAIT_QUEUE_HEAD(watch_events_waitq);
static int get_error(const char *errorstring)
{
unsigned int i;
- for (i = 0; !streq(errorstring, xsd_errors[i].errstring); i++) {
+ for (i = 0; strcmp(errorstring, xsd_errors[i].errstring) != 0; i++) {
if (i == ARRAY_SIZE(xsd_errors) - 1) {
printk(KERN_WARNING
"XENBUS xen store gave: unknown error %s",
@@ -153,12 +155,12 @@ void xenbus_debug_write(const char *str, unsigned int count)
msg.type = XS_DEBUG;
msg.len = sizeof("print") + count + 1;
- down(&xs_state.request_mutex);
+ mutex_lock(&xs_state.request_mutex);
xb_write(&msg, sizeof(msg));
xb_write("print", sizeof("print"));
xb_write(str, count);
xb_write("", 1);
- up(&xs_state.request_mutex);
+ mutex_unlock(&xs_state.request_mutex);
}
void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)
@@ -170,7 +172,7 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)
if (req_msg.type == XS_TRANSACTION_START)
down_read(&xs_state.suspend_mutex);
- down(&xs_state.request_mutex);
+ mutex_lock(&xs_state.request_mutex);
err = xb_write(msg, sizeof(*msg) + msg->len);
if (err) {
@@ -179,7 +181,7 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)
} else
ret = read_reply(&msg->type, &msg->len);
- up(&xs_state.request_mutex);
+ mutex_unlock(&xs_state.request_mutex);
if ((msg->type == XS_TRANSACTION_END) ||
((req_msg.type == XS_TRANSACTION_START) &&
@@ -208,25 +210,25 @@ static void *xs_talkv(xenbus_transaction_t t,
for (i = 0; i < num_vecs; i++)
msg.len += iovec[i].iov_len;
- down(&xs_state.request_mutex);
+ mutex_lock(&xs_state.request_mutex);
err = xb_write(&msg, sizeof(msg));
if (err) {
- up(&xs_state.request_mutex);
+ mutex_unlock(&xs_state.request_mutex);
return ERR_PTR(err);
}
for (i = 0; i < num_vecs; i++) {
err = xb_write(iovec[i].iov_base, iovec[i].iov_len);;
if (err) {
- up(&xs_state.request_mutex);
+ mutex_unlock(&xs_state.request_mutex);
return ERR_PTR(err);
}
}
ret = read_reply(&msg.type, len);
- up(&xs_state.request_mutex);
+ mutex_unlock(&xs_state.request_mutex);
if (IS_ERR(ret))
return ret;
@@ -333,7 +335,7 @@ char **xenbus_directory(xenbus_transaction_t t,
return split(strings, len, num);
}
-EXPORT_SYMBOL(xenbus_directory);
+EXPORT_SYMBOL_GPL(xenbus_directory);
/* Check if a path exists. Return 1 if it does. */
int xenbus_exists(xenbus_transaction_t t,
@@ -348,7 +350,7 @@ int xenbus_exists(xenbus_transaction_t t,
kfree(d);
return 1;
}
-EXPORT_SYMBOL(xenbus_exists);
+EXPORT_SYMBOL_GPL(xenbus_exists);
/* Get the value of a single file.
* Returns a kmalloced value: call free() on it after use.
@@ -368,7 +370,7 @@ void *xenbus_read(xenbus_transaction_t t,
kfree(path);
return ret;
}
-EXPORT_SYMBOL(xenbus_read);
+EXPORT_SYMBOL_GPL(xenbus_read);
/* Write the value of a single file.
* Returns -err on failure.
@@ -393,7 +395,7 @@ int xenbus_write(xenbus_transaction_t t,
kfree(path);
return ret;
}
-EXPORT_SYMBOL(xenbus_write);
+EXPORT_SYMBOL_GPL(xenbus_write);
/* Create a new directory. */
int xenbus_mkdir(xenbus_transaction_t t,
@@ -410,7 +412,7 @@ int xenbus_mkdir(xenbus_transaction_t t,
kfree(path);
return ret;
}
-EXPORT_SYMBOL(xenbus_mkdir);
+EXPORT_SYMBOL_GPL(xenbus_mkdir);
/* Destroy a file or directory (directories must be empty). */
int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node)
@@ -426,7 +428,7 @@ int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node)
kfree(path);
return ret;
}
-EXPORT_SYMBOL(xenbus_rm);
+EXPORT_SYMBOL_GPL(xenbus_rm);
/* Start a transaction: changes by others will not be seen during this
* transaction, and changes will not be visible to others until end.
@@ -447,7 +449,7 @@ int xenbus_transaction_start(xenbus_transaction_t *t)
kfree(id_str);
return 0;
}
-EXPORT_SYMBOL(xenbus_transaction_start);
+EXPORT_SYMBOL_GPL(xenbus_transaction_start);
/* End a transaction.
* If abandon is true, transaction is discarded instead of committed.
@@ -468,7 +470,7 @@ int xenbus_transaction_end(xenbus_transaction_t t, int abort)
return err;
}
-EXPORT_SYMBOL(xenbus_transaction_end);
+EXPORT_SYMBOL_GPL(xenbus_transaction_end);
/* Single read and scanf: returns -errno or num scanned. */
int xenbus_scanf(xenbus_transaction_t t,
@@ -491,7 +493,7 @@ int xenbus_scanf(xenbus_transaction_t t,
return -ERANGE;
return ret;
}
-EXPORT_SYMBOL(xenbus_scanf);
+EXPORT_SYMBOL_GPL(xenbus_scanf);
/* Single printf and write: returns -errno or 0. */
int xenbus_printf(xenbus_transaction_t t,
@@ -517,7 +519,7 @@ int xenbus_printf(xenbus_transaction_t t,
return ret;
}
-EXPORT_SYMBOL(xenbus_printf);
+EXPORT_SYMBOL_GPL(xenbus_printf);
/* Takes tuples of names, scanf-style args, and void **, NULL terminated. */
int xenbus_gather(xenbus_transaction_t t, const char *dir, ...)
@@ -547,7 +549,7 @@ int xenbus_gather(xenbus_transaction_t t, const char *dir, ...)
va_end(ap);
return ret;
}
-EXPORT_SYMBOL(xenbus_gather);
+EXPORT_SYMBOL_GPL(xenbus_gather);
static int xs_watch(const char *path, const char *token)
{
@@ -617,7 +619,7 @@ int register_xenbus_watch(struct xenbus_watch *watch)
return err;
}
-EXPORT_SYMBOL(register_xenbus_watch);
+EXPORT_SYMBOL_GPL(register_xenbus_watch);
void unregister_xenbus_watch(struct xenbus_watch *watch)
{
@@ -655,16 +657,16 @@ void unregister_xenbus_watch(struct xenbus_watch *watch)
/* Flush any currently-executing callback, unless we are it. :-) */
if (current->pid != xenwatch_pid) {
- down(&xenwatch_mutex);
- up(&xenwatch_mutex);
+ mutex_lock(&xenwatch_mutex);
+ mutex_unlock(&xenwatch_mutex);
}
}
-EXPORT_SYMBOL(unregister_xenbus_watch);
+EXPORT_SYMBOL_GPL(unregister_xenbus_watch);
void xs_suspend(void)
{
down_write(&xs_state.suspend_mutex);
- down(&xs_state.request_mutex);
+ mutex_lock(&xs_state.request_mutex);
}
void xs_resume(void)
@@ -672,7 +674,7 @@ void xs_resume(void)
struct xenbus_watch *watch;
char token[sizeof(watch) * 2 + 1];
- up(&xs_state.request_mutex);
+ mutex_unlock(&xs_state.request_mutex);
/* No need for watches_lock: the suspend_mutex is sufficient. */
list_for_each_entry(watch, &watches, list) {
@@ -695,7 +697,7 @@ static int xenwatch_thread(void *unused)
if (kthread_should_stop())
break;
- down(&xenwatch_mutex);
+ mutex_lock(&xenwatch_mutex);
spin_lock(&watch_events_lock);
ent = watch_events.next;
@@ -713,7 +715,7 @@ static int xenwatch_thread(void *unused)
kfree(msg);
}
- up(&xenwatch_mutex);
+ mutex_unlock(&xenwatch_mutex);
}
return 0;
@@ -806,7 +808,7 @@ int xs_init(void)
spin_lock_init(&xs_state.reply_lock);
init_waitqueue_head(&xs_state.reply_waitq);
- init_MUTEX(&xs_state.request_mutex);
+ mutex_init(&xs_state.request_mutex);
init_rwsem(&xs_state.suspend_mutex);
/* Initialize the shared memory rings to talk to xenstored */
diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h
index a0e63d3ac1..a7832cad1a 100644
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h
@@ -5,8 +5,11 @@
*
* Copyright (c) 2002-2004, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
index fd58716632..2bc97ae342 100644
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
@@ -5,8 +5,11 @@
*
* Copyright (c) 2002-2004, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
index d24bd833e9..b260c56e76 100644
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
@@ -5,8 +5,11 @@
*
* Copyright (c) 2002-2004, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
index 042a95c450..4a5f424417 100644
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
@@ -5,8 +5,11 @@
*
* Copyright (c) 2002-2004, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h
index 57e5568c51..4071a1d6fd 100644
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h
@@ -9,8 +9,11 @@
* Benjamin Liu <benjamin.liu@intel.com>
* Jun Nakajima <jun.nakajima@intel.com>
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/xen/balloon.h b/linux-2.6-xen-sparse/include/xen/balloon.h
index 7f2be02660..d9637ef522 100644
--- a/linux-2.6-xen-sparse/include/xen/balloon.h
+++ b/linux-2.6-xen-sparse/include/xen/balloon.h
@@ -6,8 +6,11 @@
* Copyright (c) 2003, B Dragovic
* Copyright (c) 2003-2004, M Williamson, K Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/xen/evtchn.h b/linux-2.6-xen-sparse/include/xen/evtchn.h
index 594c1a6ec6..100eb1cdaa 100644
--- a/linux-2.6-xen-sparse/include/xen/evtchn.h
+++ b/linux-2.6-xen-sparse/include/xen/evtchn.h
@@ -6,8 +6,11 @@
*
* Copyright (c) 2004-2005, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/xen/gnttab.h b/linux-2.6-xen-sparse/include/xen/gnttab.h
index 58aeb492b0..584a5db355 100644
--- a/linux-2.6-xen-sparse/include/xen/gnttab.h
+++ b/linux-2.6-xen-sparse/include/xen/gnttab.h
@@ -9,8 +9,11 @@
* Copyright (c) 2004-2005, K A Fraser
* Copyright (c) 2005, Christopher Clark
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/xen/net_driver_util.h b/linux-2.6-xen-sparse/include/xen/net_driver_util.h
index 130b4f0981..9054452cbb 100644
--- a/linux-2.6-xen-sparse/include/xen/net_driver_util.h
+++ b/linux-2.6-xen-sparse/include/xen/net_driver_util.h
@@ -4,9 +4,11 @@
*
* Copyright (c) 2005 XenSource Ltd.
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following
- * license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/xen/public/evtchn.h b/linux-2.6-xen-sparse/include/xen/public/evtchn.h
index 456f246530..5ba554bdee 100644
--- a/linux-2.6-xen-sparse/include/xen/public/evtchn.h
+++ b/linux-2.6-xen-sparse/include/xen/public/evtchn.h
@@ -5,8 +5,11 @@
*
* Copyright (c) 2003-2005, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/xen/public/privcmd.h b/linux-2.6-xen-sparse/include/xen/public/privcmd.h
index 074d66c79b..a7da5221e8 100644
--- a/linux-2.6-xen-sparse/include/xen/public/privcmd.h
+++ b/linux-2.6-xen-sparse/include/xen/public/privcmd.h
@@ -5,8 +5,11 @@
*
* Copyright (c) 2003-2005, K A Fraser
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
diff --git a/linux-2.6-xen-sparse/include/xen/xenbus.h b/linux-2.6-xen-sparse/include/xen/xenbus.h
index 27b08d5b3f..122480584f 100644
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h
@@ -6,8 +6,11 @@
* Copyright (C) 2005 Rusty Russell, IBM Corporation
* Copyright (C) 2005 XenSource Ltd.
*
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this source file (the "Software"), to deal in the Software without
@@ -33,7 +36,7 @@
#include <linux/device.h>
#include <linux/notifier.h>
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
#include <xen/interface/xen.h>
#include <xen/interface/grant_table.h>
#include <xen/interface/io/xenbus.h>
diff --git a/tools/examples/Makefile b/tools/examples/Makefile
index 6e71f563bf..37a94b6329 100644
--- a/tools/examples/Makefile
+++ b/tools/examples/Makefile
@@ -38,8 +38,8 @@ XEN_HOTPLUG_SCRIPTS = xen-backend.agent
UDEV_RULES_DIR = /etc/udev
UDEV_RULES = xen-backend.rules
-DI = $(shell readlink -f $(DISTDIR))
-DE = $(shell readlink -f $(DESTDIR))
+DI = $(if $(DISTDIR),$(shell readlink -f $(DISTDIR)),)
+DE = $(if $(DESTDIR),$(shell readlink -f $(DESTDIR)),)
ifeq ($(findstring $(DI),$(DE)),$(DI))
HOTPLUGS=install-hotplug install-udev
else
diff --git a/tools/examples/xmexample.hvm b/tools/examples/xmexample.hvm
index a551c7a7b6..d7576b67a0 100644
--- a/tools/examples/xmexample.hvm
+++ b/tools/examples/xmexample.hvm
@@ -129,6 +129,9 @@ vncviewer=1
# no graphics, use serial port
#nographic=0
+#----------------------------------------------------------------------------
+# enable stdvga, default = 0 (use cirrus logic device model)
+stdvga=0
#-----------------------------------------------------------------------------
# serial port re-direct to pty deivce, /dev/pts/n
diff --git a/tools/firmware/vmxassist/machine.h b/tools/firmware/vmxassist/machine.h
index fd5779af6f..82fa12965d 100644
--- a/tools/firmware/vmxassist/machine.h
+++ b/tools/firmware/vmxassist/machine.h
@@ -37,10 +37,11 @@
#define CR4_PVI (1 << 1)
#define CR4_PSE (1 << 4)
+#define EFLAGS_ZF (1 << 6)
#define EFLAGS_TF (1 << 8)
#define EFLAGS_IF (1 << 9)
#define EFLAGS_DF (1 << 10)
-#define EFLAGS_IOPL (3 << 12)
+#define EFLAGS_IOPL (3 << 12)
#define EFLAGS_VM ((1 << 17) | EFLAGS_IOPL)
#define EFLAGS_VIF (1 << 19)
#define EFLAGS_VIP (1 << 20)
diff --git a/tools/firmware/vmxassist/util.c b/tools/firmware/vmxassist/util.c
index d1d836224e..9e9f86cb12 100644
--- a/tools/firmware/vmxassist/util.c
+++ b/tools/firmware/vmxassist/util.c
@@ -48,7 +48,8 @@ dump_regs(struct regs *regs)
printf("trapno %8x errno %8x\n", regs->trapno, regs->errno);
printf("cr0 %8lx cr2 %8x cr3 %8lx cr4 %8lx\n",
- oldctx.cr0, get_cr2(), oldctx.cr3, oldctx.cr4);
+ (long)oldctx.cr0, get_cr2(),
+ (long)oldctx.cr3, (long)oldctx.cr4);
}
#ifdef DEBUG
@@ -104,15 +105,25 @@ print_e820_map(struct e820entry *map, int entries)
}
void
-dump_dtr(unsigned long base, unsigned long limit)
+dump_dtr(unsigned long addr, unsigned long size)
{
unsigned long long entry;
+ unsigned long base, limit;
int i;
- for (i = 0; i < limit; i += 8) {
- entry = ((unsigned long long *) base)[i >> 3];
- printf("[0x%x] = 0x%08x%08x\n", i,
- (unsigned)(entry >> 32), (unsigned)(entry));
+ for (i = 0; i < size; i += 8) {
+ entry = ((unsigned long long *) addr)[i >> 3];
+ base = (((entry >> (56-24)) & 0xFF000000) |
+ ((entry >> (32-16)) & 0x00FF0000) |
+ ((entry >> ( 16)) & 0x0000FFFF));
+ limit = (((entry >> (48-16)) & 0x000F0000) |
+ ((entry ) & 0x0000FFFF));
+ if (entry & (1ULL << (23+32))) /* G */
+ limit = (limit << 12) | 0xFFF;
+
+ printf("[0x%x] = 0x%08x%08x, base 0x%lx, limit 0x%lx\n", i,
+ (unsigned)(entry >> 32), (unsigned)(entry),
+ base, limit);
}
}
@@ -120,18 +131,19 @@ void
dump_vmx_context(struct vmx_assist_context *c)
{
printf("eip 0x%lx, esp 0x%lx, eflags 0x%lx\n",
- c->eip, c->esp, c->eflags);
+ (long) c->eip, (long) c->esp, (long) c->eflags);
- printf("cr0 0x%lx, cr3 0x%lx, cr4 0x%lx\n", c->cr0, c->cr3, c->cr4);
+ printf("cr0 0x%lx, cr3 0x%lx, cr4 0x%lx\n",
+ (long)c->cr0, (long)c->cr3, (long)c->cr4);
printf("idtr: limit 0x%lx, base 0x%lx\n",
- c->idtr_limit, c->idtr_base);
+ (long)c->idtr_limit, (long)c->idtr_base);
printf("gdtr: limit 0x%lx, base 0x%lx\n",
- c->gdtr_limit, c->gdtr_base);
+ (long)c->gdtr_limit, (long)c->gdtr_base);
printf("cs: sel 0x%lx, limit 0x%lx, base 0x%lx\n",
- c->cs_sel, c->cs_limit, c->cs_base);
+ (long)c->cs_sel, (long)c->cs_limit, (long)c->cs_base);
printf("\ttype %d, s %d, dpl %d, p %d, avl %d, ops %d, g %d, nul %d\n",
c->cs_arbytes.fields.seg_type,
c->cs_arbytes.fields.s,
@@ -143,7 +155,7 @@ dump_vmx_context(struct vmx_assist_context *c)
c->cs_arbytes.fields.null_bit);
printf("ds: sel 0x%lx, limit 0x%lx, base 0x%lx\n",
- c->ds_sel, c->ds_limit, c->ds_base);
+ (long)c->ds_sel, (long)c->ds_limit, (long)c->ds_base);
printf("\ttype %d, s %d, dpl %d, p %d, avl %d, ops %d, g %d, nul %d\n",
c->ds_arbytes.fields.seg_type,
c->ds_arbytes.fields.s,
@@ -155,7 +167,7 @@ dump_vmx_context(struct vmx_assist_context *c)
c->ds_arbytes.fields.null_bit);
printf("es: sel 0x%lx, limit 0x%lx, base 0x%lx\n",
- c->es_sel, c->es_limit, c->es_base);
+ (long)c->es_sel, (long)c->es_limit, (long)c->es_base);
printf("\ttype %d, s %d, dpl %d, p %d, avl %d, ops %d, g %d, nul %d\n",
c->es_arbytes.fields.seg_type,
c->es_arbytes.fields.s,
@@ -167,7 +179,7 @@ dump_vmx_context(struct vmx_assist_context *c)
c->es_arbytes.fields.null_bit);
printf("ss: sel 0x%lx, limit 0x%lx, base 0x%lx\n",
- c->ss_sel, c->ss_limit, c->ss_base);
+ (long)c->ss_sel, (long)c->ss_limit, (long)c->ss_base);
printf("\ttype %d, s %d, dpl %d, p %d, avl %d, ops %d, g %d, nul %d\n",
c->ss_arbytes.fields.seg_type,
c->ss_arbytes.fields.s,
@@ -179,7 +191,7 @@ dump_vmx_context(struct vmx_assist_context *c)
c->ss_arbytes.fields.null_bit);
printf("fs: sel 0x%lx, limit 0x%lx, base 0x%lx\n",
- c->fs_sel, c->fs_limit, c->fs_base);
+ (long)c->fs_sel, (long)c->fs_limit, (long)c->fs_base);
printf("\ttype %d, s %d, dpl %d, p %d, avl %d, ops %d, g %d, nul %d\n",
c->fs_arbytes.fields.seg_type,
c->fs_arbytes.fields.s,
@@ -191,7 +203,7 @@ dump_vmx_context(struct vmx_assist_context *c)
c->fs_arbytes.fields.null_bit);
printf("gs: sel 0x%lx, limit 0x%lx, base 0x%lx\n",
- c->gs_sel, c->gs_limit, c->gs_base);
+ (long)c->gs_sel, (long)c->gs_limit, (long)c->gs_base);
printf("\ttype %d, s %d, dpl %d, p %d, avl %d, ops %d, g %d, nul %d\n",
c->gs_arbytes.fields.seg_type,
c->gs_arbytes.fields.s,
@@ -203,7 +215,7 @@ dump_vmx_context(struct vmx_assist_context *c)
c->gs_arbytes.fields.null_bit);
printf("tr: sel 0x%lx, limit 0x%lx, base 0x%lx\n",
- c->tr_sel, c->tr_limit, c->tr_base);
+ (long)c->tr_sel, (long)c->tr_limit, (long)c->tr_base);
printf("\ttype %d, s %d, dpl %d, p %d, avl %d, ops %d, g %d, nul %d\n",
c->tr_arbytes.fields.seg_type,
c->tr_arbytes.fields.s,
@@ -215,7 +227,7 @@ dump_vmx_context(struct vmx_assist_context *c)
c->tr_arbytes.fields.null_bit);
printf("ldtr: sel 0x%lx, limit 0x%lx, base 0x%lx\n",
- c->ldtr_sel, c->ldtr_limit, c->ldtr_base);
+ (long)c->ldtr_sel, (long)c->ldtr_limit, (long)c->ldtr_base);
printf("\ttype %d, s %d, dpl %d, p %d, avl %d, ops %d, g %d, nul %d\n",
c->ldtr_arbytes.fields.seg_type,
c->ldtr_arbytes.fields.s,
@@ -226,7 +238,8 @@ dump_vmx_context(struct vmx_assist_context *c)
c->ldtr_arbytes.fields.g,
c->ldtr_arbytes.fields.null_bit);
- printf("GDTR <0x%lx,0x%lx>:\n", c->gdtr_base, c->gdtr_limit);
+ printf("GDTR <0x%lx,0x%lx>:\n",
+ (long)c->gdtr_base, (long)c->gdtr_limit);
dump_dtr(c->gdtr_base, c->gdtr_limit);
}
#endif /* DEBUG */
diff --git a/tools/firmware/vmxassist/vm86.c b/tools/firmware/vmxassist/vm86.c
index eb3ee3992c..f9e8ae3753 100644
--- a/tools/firmware/vmxassist/vm86.c
+++ b/tools/firmware/vmxassist/vm86.c
@@ -3,7 +3,7 @@
* little work as possible.
*
* Leendert van Doorn, leendert@watson.ibm.com
- * Copyright (c) 2005, International Business Machines Corporation.
+ * Copyright (c) 2005-2006, International Business Machines Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -35,7 +35,7 @@
#define SEG_GS 0x0080
unsigned prev_eip = 0;
-enum vm86_mode mode;
+enum vm86_mode mode = 0;
#ifdef DEBUG
int traceset = 0;
@@ -46,8 +46,9 @@ char *states[] = {
"<VM86_PROTECTED_TO_REAL>",
"<VM86_PROTECTED>"
};
-#endif /* DEBUG */
+static char *rnames[] = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di" };
+#endif /* DEBUG */
unsigned
address(struct regs *regs, unsigned seg, unsigned off)
@@ -55,15 +56,11 @@ address(struct regs *regs, unsigned seg, unsigned off)
unsigned long long entry;
unsigned addr;
- /* real mode: segment is part of the address */
- if (mode == VM86_REAL || mode == VM86_REAL_TO_PROTECTED)
- return ((seg & 0xFFFF) << 4) + off;
+ if (seg == 0)
+ return off;
- /* protected mode: use seg as index into gdt */
- if (seg > oldctx.gdtr_limit) {
- printf("address: Invalid segment descriptor (0x%x)\n", seg);
- return 0;
- }
+ if (seg > oldctx.gdtr_limit)
+ return ((seg & 0xFFFF) << 4) + off;
entry = ((unsigned long long *) oldctx.gdtr_base)[seg >> 3];
addr = (((entry >> (56-24)) & 0xFF000000) |
@@ -198,7 +195,7 @@ fetch8(struct regs *regs)
}
unsigned
-getreg(struct regs *regs, int r)
+getreg32(struct regs *regs, int r)
{
switch (r & 7) {
case 0: return regs->eax;
@@ -213,8 +210,30 @@ getreg(struct regs *regs, int r)
return ~0;
}
+unsigned
+getreg16(struct regs *regs, int r)
+{
+ return MASK16(getreg32(regs, r));
+}
+
+unsigned
+getreg8(struct regs *regs, int r)
+{
+ switch (r & 7) {
+ case 0: return regs->eax & 0xFF; /* al */
+ case 1: return regs->ecx & 0xFF; /* cl */
+ case 2: return regs->edx & 0xFF; /* dl */
+ case 3: return regs->ebx & 0xFF; /* bl */
+ case 4: return (regs->esp >> 8) & 0xFF; /* ah */
+ case 5: return (regs->ebp >> 8) & 0xFF; /* ch */
+ case 6: return (regs->esi >> 8) & 0xFF; /* dh */
+ case 7: return (regs->edi >> 8) & 0xFF; /* bh */
+ }
+ return ~0;
+}
+
void
-setreg(struct regs *regs, int r, unsigned v)
+setreg32(struct regs *regs, int r, unsigned v)
{
switch (r & 7) {
case 0: regs->eax = v; break;
@@ -228,15 +247,31 @@ setreg(struct regs *regs, int r, unsigned v)
}
}
-/*
- * Operand (modrm) decode
- */
-unsigned
-operand(unsigned prefix, struct regs *regs, unsigned modrm)
+void
+setreg16(struct regs *regs, int r, unsigned v)
{
- int mod, disp = 0, seg;
+ setreg32(regs, r, (getreg32(regs, r) & ~0xFFFF) | MASK16(v));
+}
+
+void
+setreg8(struct regs *regs, int r, unsigned v)
+{
+ v &= 0xFF;
+ switch (r & 7) {
+ case 0: regs->eax = (regs->eax & ~0xFF) | v; break;
+ case 1: regs->ecx = (regs->ecx & ~0xFF) | v; break;
+ case 2: regs->edx = (regs->edx & ~0xFF) | v; break;
+ case 3: regs->ebx = (regs->ebx & ~0xFF) | v; break;
+ case 4: regs->esp = (regs->esp & ~0xFF00) | (v << 8); break;
+ case 5: regs->ebp = (regs->ebp & ~0xFF00) | (v << 8); break;
+ case 6: regs->esi = (regs->esi & ~0xFF00) | (v << 8); break;
+ case 7: regs->edi = (regs->edi & ~0xFF00) | (v << 8); break;
+ }
+}
- seg = regs->vds;
+unsigned
+segment(unsigned prefix, struct regs *regs, unsigned seg)
+{
if (prefix & SEG_ES)
seg = regs->ves;
if (prefix & SEG_DS)
@@ -249,6 +284,47 @@ operand(unsigned prefix, struct regs *regs, unsigned modrm)
seg = regs->fs;
if (prefix & SEG_GS)
seg = regs->gs;
+ return seg;
+}
+
+unsigned
+sib(struct regs *regs, int mod, unsigned byte)
+{
+ unsigned scale = (byte >> 6) & 3;
+ int index = (byte >> 3) & 7;
+ int base = byte & 7;
+ unsigned addr = 0;
+
+ switch (mod) {
+ case 0:
+ if (base == 5)
+ addr = fetch32(regs);
+ else
+ addr = getreg32(regs, base);
+ break;
+ case 1:
+ addr = getreg32(regs, base) + (char) fetch8(regs);
+ break;
+ case 2:
+ addr = getreg32(regs, base) + fetch32(regs);
+ break;
+ }
+
+ if (index != 4)
+ addr += getreg32(regs, index) << scale;
+
+ return addr;
+}
+
+/*
+ * Operand (modrm) decode
+ */
+unsigned
+operand(unsigned prefix, struct regs *regs, unsigned modrm)
+{
+ int mod, disp = 0, seg;
+
+ seg = segment(prefix, regs, regs->vds);
if (prefix & ADDR32) { /* 32-bit addressing */
switch ((mod = (modrm >> 6) & 3)) {
@@ -258,7 +334,8 @@ operand(unsigned prefix, struct regs *regs, unsigned modrm)
case 1: return address(regs, seg, regs->ecx);
case 2: return address(regs, seg, regs->edx);
case 3: return address(regs, seg, regs->ebx);
- case 4: panic("No SIB decode (yet)");
+ case 4: return address(regs, seg,
+ sib(regs, mod, fetch8(regs)));
case 5: return address(regs, seg, fetch32(regs));
case 6: return address(regs, seg, regs->esi);
case 7: return address(regs, seg, regs->edi);
@@ -277,14 +354,15 @@ operand(unsigned prefix, struct regs *regs, unsigned modrm)
case 1: return address(regs, seg, regs->ecx + disp);
case 2: return address(regs, seg, regs->edx + disp);
case 3: return address(regs, seg, regs->ebx + disp);
- case 4: panic("No SIB decode (yet)");
+ case 4: return address(regs, seg,
+ sib(regs, mod, fetch8(regs)));
case 5: return address(regs, seg, regs->ebp + disp);
case 6: return address(regs, seg, regs->esi + disp);
case 7: return address(regs, seg, regs->edi + disp);
}
break;
case 3:
- return getreg(regs, modrm);
+ return getreg32(regs, modrm);
}
} else { /* 16-bit addressing */
switch ((mod = (modrm >> 6) & 3)) {
@@ -330,7 +408,7 @@ operand(unsigned prefix, struct regs *regs, unsigned modrm)
}
break;
case 3:
- return MASK16(getreg(regs, modrm));
+ return getreg16(regs, modrm);
}
}
@@ -400,6 +478,72 @@ lmsw(struct regs *regs, unsigned prefix, unsigned modrm)
}
/*
+ * We need to handle moves that address memory beyond the 64KB segment
+ * limit that VM8086 mode enforces.
+ */
+int
+movr(struct regs *regs, unsigned prefix, unsigned opc)
+{
+ unsigned eip = regs->eip - 1;
+ unsigned modrm = fetch8(regs);
+ unsigned addr = operand(prefix, regs, modrm);
+ unsigned val, r = (modrm >> 3) & 7;
+
+ if ((modrm & 0xC0) == 0xC0) /* no registers */
+ return 0;
+
+ switch (opc) {
+ case 0x88: /* addr32 mov r8, r/m8 */
+ val = getreg8(regs, r);
+ TRACE((regs, regs->eip - eip,
+ "movb %%e%s, *0x%x", rnames[r], addr));
+ write8(addr, val);
+ break;
+
+ case 0x8A: /* addr32 mov r/m8, r8 */
+ TRACE((regs, regs->eip - eip,
+ "movb *0x%x, %%%s", addr, rnames[r]));
+ setreg8(regs, r, read8(addr));
+ break;
+
+ case 0x89: /* addr32 mov r16, r/m16 */
+ val = getreg32(regs, r);
+ if (prefix & DATA32) {
+ TRACE((regs, regs->eip - eip,
+ "movl %%e%s, *0x%x", rnames[r], addr));
+ write32(addr, val);
+ } else {
+ TRACE((regs, regs->eip - eip,
+ "movw %%%s, *0x%x", rnames[r], addr));
+ write16(addr, MASK16(val));
+ }
+ break;
+
+ case 0x8B: /* addr32 mov r/m16, r16 */
+ if (prefix & DATA32) {
+ TRACE((regs, regs->eip - eip,
+ "movl *0x%x, %%e%s", addr, rnames[r]));
+ setreg32(regs, r, read32(addr));
+ } else {
+ TRACE((regs, regs->eip - eip,
+ "movw *0x%x, %%%s", addr, rnames[r]));
+ setreg16(regs, r, read16(addr));
+ }
+ break;
+
+ case 0xC6: /* addr32 movb $imm, r/m8 */
+ if ((modrm >> 3) & 7)
+ return 0;
+ val = fetch8(regs);
+ write8(addr, val);
+ TRACE((regs, regs->eip - eip, "movb $0x%x, *0x%x",
+ val, addr));
+ break;
+ }
+ return 1;
+}
+
+/*
* Move to and from a control register.
*/
int
@@ -418,21 +562,21 @@ movcr(struct regs *regs, unsigned prefix, unsigned opc)
switch (cr) {
case 0:
#ifndef TEST
- setreg(regs, modrm,
+ setreg32(regs, modrm,
oldctx.cr0 & ~(CR0_PE | CR0_NE));
#else
- setreg(regs, modrm,
+ setreg32(regs, modrm,
oldctx.cr0 & ~(CR0_PE | CR0_NE | CR0_PG));
#endif
break;
case 2:
- setreg(regs, modrm, get_cr2());
+ setreg32(regs, modrm, get_cr2());
break;
case 3:
- setreg(regs, modrm, oldctx.cr3);
+ setreg32(regs, modrm, oldctx.cr3);
break;
case 4:
- setreg(regs, modrm, oldctx.cr4);
+ setreg32(regs, modrm, oldctx.cr4);
break;
}
break;
@@ -440,19 +584,20 @@ movcr(struct regs *regs, unsigned prefix, unsigned opc)
TRACE((regs, regs->eip - eip, "movl %%eax, %%cr%d", cr));
switch (cr) {
case 0:
- oldctx.cr0 = getreg(regs, modrm) | (CR0_PE | CR0_NE);
+ oldctx.cr0 = getreg32(regs, modrm) | (CR0_PE | CR0_NE);
#ifdef TEST
oldctx.cr0 |= CR0_PG;
#endif
- if (getreg(regs, modrm) & CR0_PE)
+ if (getreg32(regs, modrm) & CR0_PE)
set_mode(regs, VM86_REAL_TO_PROTECTED);
-
+ else
+ set_mode(regs, VM86_REAL);
break;
case 3:
- oldctx.cr3 = getreg(regs, modrm);
+ oldctx.cr3 = getreg32(regs, modrm);
break;
case 4:
- oldctx.cr4 = getreg(regs, modrm);
+ oldctx.cr4 = getreg32(regs, modrm);
break;
}
break;
@@ -461,6 +606,118 @@ movcr(struct regs *regs, unsigned prefix, unsigned opc)
return 1;
}
+static inline void set_eflags_ZF(unsigned mask, unsigned v1, struct regs *regs)
+{
+ if ((v1 & mask) == 0)
+ regs->eflags |= EFLAGS_ZF;
+ else
+ regs->eflags &= ~EFLAGS_ZF;
+}
+
+/*
+ * We need to handle cmp opcodes that address memory beyond the 64KB
+ * segment limit that VM8086 mode enforces.
+ */
+int
+cmp(struct regs *regs, unsigned prefix, unsigned opc)
+{
+ unsigned eip = regs->eip - 1;
+ unsigned modrm = fetch8(regs);
+ unsigned addr = operand(prefix, regs, modrm);
+ unsigned diff, val, r = (modrm >> 3) & 7;
+
+ if ((modrm & 0xC0) == 0xC0) /* no registers */
+ return 0;
+
+ switch (opc) {
+ case 0x39: /* addr32 cmp r16, r/m16 */
+ val = getreg32(regs, r);
+ if (prefix & DATA32) {
+ diff = read32(addr) - val;
+ set_eflags_ZF(~0, diff, regs);
+
+ TRACE((regs, regs->eip - eip,
+ "cmp %%e%s, *0x%x (0x%x)",
+ rnames[r], addr, diff));
+ } else {
+ diff = read16(addr) - val;
+ set_eflags_ZF(0xFFFF, diff, regs);
+
+ TRACE((regs, regs->eip - eip,
+ "cmp %%%s, *0x%x (0x%x)",
+ rnames[r], addr, diff));
+ }
+ break;
+
+ /* other cmp opcodes ... */
+ }
+ return 1;
+}
+
+/*
+ * We need to handle test opcodes that address memory beyond the 64KB
+ * segment limit that VM8086 mode enforces.
+ */
+int
+test(struct regs *regs, unsigned prefix, unsigned opc)
+{
+ unsigned eip = regs->eip - 1;
+ unsigned modrm = fetch8(regs);
+ unsigned addr = operand(prefix, regs, modrm);
+ unsigned val, diff;
+
+ if ((modrm & 0xC0) == 0xC0) /* no registers */
+ return 0;
+
+ switch (opc) {
+ case 0xF6: /* testb $imm, r/m8 */
+ if ((modrm >> 3) & 7)
+ return 0;
+ val = fetch8(regs);
+ diff = read8(addr) & val;
+ set_eflags_ZF(0xFF, diff, regs);
+
+ TRACE((regs, regs->eip - eip, "testb $0x%x, *0x%x (0x%x)",
+ val, addr, diff));
+ break;
+
+ /* other test opcodes ... */
+ }
+
+ return 1;
+}
+
+/*
+ * We need to handle pop opcodes that address memory beyond the 64KB
+ * segment limit that VM8086 mode enforces.
+ */
+int
+pop(struct regs *regs, unsigned prefix, unsigned opc)
+{
+ unsigned eip = regs->eip - 1;
+ unsigned modrm = fetch8(regs);
+ unsigned addr = operand(prefix, regs, modrm);
+
+ if ((modrm & 0xC0) == 0xC0) /* no registers */
+ return 0;
+
+ switch (opc) {
+ case 0x8F: /* pop r/m16 */
+ if ((modrm >> 3) & 7)
+ return 0;
+ if (prefix & DATA32)
+ write32(addr, pop32(regs));
+ else
+ write16(addr, pop16(regs));
+ TRACE((regs, regs->eip - eip, "pop *0x%x", addr));
+ break;
+
+ /* other pop opcodes ... */
+ }
+
+ return 1;
+}
+
/*
* Emulate a segment load in protected mode
*/
@@ -473,17 +730,16 @@ load_seg(unsigned long sel, uint32_t *base, uint32_t *limit, union vmcs_arbytes
if (sel > oldctx.gdtr_limit)
return 0;
- if (sel == 0) {
- arbytes->fields.null_bit = 1;
- return 1;
- }
+ if (sel == 0) {
+ arbytes->fields.null_bit = 1;
+ return 1;
+ }
entry = ((unsigned long long *) oldctx.gdtr_base)[sel >> 3];
- /* Check the P bit fisrt*/
- if (!((entry >> (15+32)) & 0x1) && sel != 0) {
- return 0;
- }
+ /* Check the P bit first */
+ if (!((entry >> (15+32)) & 0x1) && sel != 0)
+ return 0;
*base = (((entry >> (56-24)) & 0xFF000000) |
((entry >> (32-16)) & 0x00FF0000) |
@@ -530,42 +786,47 @@ protected_mode(struct regs *regs)
if (load_seg(regs->ves, &oldctx.es_base,
&oldctx.es_limit, &oldctx.es_arbytes))
oldctx.es_sel = regs->ves;
- else {
- load_seg(0, &oldctx.es_base,&oldctx.es_limit, &oldctx.es_arbytes);
- oldctx.es_sel = 0;
- }
+ else {
+ load_seg(0, &oldctx.es_base,
+ &oldctx.es_limit, &oldctx.es_arbytes);
+ oldctx.es_sel = 0;
+ }
if (load_seg(regs->uss, &oldctx.ss_base,
&oldctx.ss_limit, &oldctx.ss_arbytes))
oldctx.ss_sel = regs->uss;
- else {
- load_seg(0, &oldctx.ss_base, &oldctx.ss_limit, &oldctx.ss_arbytes);
- oldctx.ss_sel = 0;
- }
+ else {
+ load_seg(0, &oldctx.ss_base,
+ &oldctx.ss_limit, &oldctx.ss_arbytes);
+ oldctx.ss_sel = 0;
+ }
if (load_seg(regs->vds, &oldctx.ds_base,
&oldctx.ds_limit, &oldctx.ds_arbytes))
oldctx.ds_sel = regs->vds;
- else {
- load_seg(0, &oldctx.ds_base, &oldctx.ds_limit, &oldctx.ds_arbytes);
- oldctx.ds_sel = 0;
- }
+ else {
+ load_seg(0, &oldctx.ds_base,
+ &oldctx.ds_limit, &oldctx.ds_arbytes);
+ oldctx.ds_sel = 0;
+ }
if (load_seg(regs->vfs, &oldctx.fs_base,
&oldctx.fs_limit, &oldctx.fs_arbytes))
oldctx.fs_sel = regs->vfs;
- else {
- load_seg(0, &oldctx.fs_base, &oldctx.fs_limit, &oldctx.fs_arbytes);
- oldctx.fs_sel = 0;
- }
+ else {
+ load_seg(0, &oldctx.fs_base,
+ &oldctx.fs_limit, &oldctx.fs_arbytes);
+ oldctx.fs_sel = 0;
+ }
if (load_seg(regs->vgs, &oldctx.gs_base,
&oldctx.gs_limit, &oldctx.gs_arbytes))
oldctx.gs_sel = regs->vgs;
- else {
- load_seg(0, &oldctx.gs_base, &oldctx.gs_limit, &oldctx.gs_arbytes);
- oldctx.gs_sel = 0;
- }
+ else {
+ load_seg(0, &oldctx.gs_base,
+ &oldctx.gs_limit, &oldctx.gs_arbytes);
+ oldctx.gs_sel = 0;
+ }
/* initialize jump environment to warp back to protected mode */
regs->cs = CODE_SELECTOR;
@@ -618,22 +879,24 @@ real_mode(struct regs *regs)
/*
* This is the smarts of the emulator and handles the mode transitions. The
- * emulator handles 4 different modes. 1) VM86_REAL: emulated real-mode, Just
- * handle those instructions that are not supported under VM8086.
- * 2) VM86_REAL_TO_PROTECTED: going from real-mode to protected mode. In this
- * we single step through the instructions until we reload the new %cs (some
- * OSes do a lot of computations before reloading %cs). 2) VM86_PROTECTED_TO_REAL
- * when we are going from protected to real mode. In this case we emulate the
- * instructions by hand. Finally, 4) VM86_PROTECTED when we transitioned to
- * protected mode and we should abandon the emulator. No instructions are
- * emulated when in VM86_PROTECTED mode.
+ * emulator handles 4 different modes. 1) VM86_REAL: emulated real-mode,
+ * Just handle those instructions that are not supported under VM8086.
+ * 2) VM86_REAL_TO_PROTECTED: going from real-mode to protected mode. In
+ * this we single step through the instructions until we reload the
+ * new %cs (some OSes do a lot of computations before reloading %cs). 2)
+ * VM86_PROTECTED_TO_REAL when we are going from protected to real mode. In
+ * this case we emulate the instructions by hand. Finally, 4) VM86_PROTECTED
+ * when we transitioned to protected mode and we should abandon the
+ * emulator. No instructions are emulated when in VM86_PROTECTED mode.
*/
void
set_mode(struct regs *regs, enum vm86_mode newmode)
{
switch (newmode) {
case VM86_REAL:
- if (mode == VM86_PROTECTED_TO_REAL) {
+ if ((mode == VM86_PROTECTED_TO_REAL) ||
+ (mode == VM86_REAL_TO_PROTECTED)) {
+ regs->eflags &= ~EFLAGS_TF;
real_mode(regs);
break;
} else if (mode == VM86_REAL) {
@@ -653,10 +916,11 @@ set_mode(struct regs *regs, enum vm86_mode newmode)
break;
case VM86_PROTECTED_TO_REAL:
- if (mode == VM86_PROTECTED)
+ if (mode == VM86_PROTECTED) {
break;
- else
+ } else
panic("unexpected protected-to-real mode transition");
+ break;
case VM86_PROTECTED:
if (mode == VM86_REAL_TO_PROTECTED) {
@@ -887,6 +1151,16 @@ opcode(struct regs *regs)
prefix |= SEG_SS;
continue;
+ case 0x39: /* addr32 cmp r16, r/m16 */
+ case 0x3B: /* addr32 cmp r/m16, r16 */
+ if (mode != VM86_REAL && mode != VM86_REAL_TO_PROTECTED)
+ goto invalid;
+ if ((prefix & ADDR32) == 0)
+ goto invalid;
+ if (!cmp(regs, prefix, opc))
+ goto invalid;
+ return OPC_EMULATED;
+
case 0x3E:
TRACE((regs, regs->eip - eip, "%%ds:"));
prefix |= SEG_DS;
@@ -912,6 +1186,33 @@ opcode(struct regs *regs)
prefix |= ADDR32;
continue;
+ case 0x88: /* addr32 mov r8, r/m8 */
+ case 0x8A: /* addr32 mov r/m8, r8 */
+ if (mode != VM86_REAL && mode != VM86_REAL_TO_PROTECTED)
+ goto invalid;
+ if ((prefix & ADDR32) == 0)
+ goto invalid;
+ if (!movr(regs, prefix, opc))
+ goto invalid;
+ return OPC_EMULATED;
+
+ case 0x89: /* addr32 mov r16, r/m16 */
+ case 0x8B: /* addr32 mov r/m16, r16 */
+ if (mode != VM86_REAL && mode != VM86_REAL_TO_PROTECTED)
+ goto invalid;
+ if ((prefix & ADDR32) == 0)
+ goto invalid;
+ if (!movr(regs, prefix, opc))
+ goto invalid;
+ return OPC_EMULATED;
+
+ case 0x8F: /* addr32 pop r/m16 */
+ if ((prefix & ADDR32) == 0)
+ goto invalid;
+ if (!pop(regs, prefix, opc))
+ goto invalid;
+ return OPC_EMULATED;
+
case 0x90: /* nop */
TRACE((regs, regs->eip - eip, "nop"));
return OPC_EMULATED;
@@ -924,7 +1225,7 @@ opcode(struct regs *regs)
push16(regs, regs->eflags & ~EFLAGS_VM);
return OPC_EMULATED;
- case 0x9D: /* popf */
+ case 0x9D: /* popf */
TRACE((regs, regs->eip - eip, "popf"));
if (prefix & DATA32)
regs->eflags = pop32(regs);
@@ -934,7 +1235,14 @@ opcode(struct regs *regs)
regs->eflags |= EFLAGS_VM;
return OPC_EMULATED;
- case 0xCB: /* retl */
+ case 0xC6: /* addr32 movb $imm, r/m8 */
+ if ((prefix & ADDR32) == 0)
+ goto invalid;
+ if (!movr(regs, prefix, opc))
+ goto invalid;
+ return OPC_EMULATED;
+
+ case 0xCB: /* retl */
if ((mode == VM86_REAL_TO_PROTECTED) ||
(mode == VM86_PROTECTED_TO_REAL)) {
retl(regs, prefix);
@@ -942,12 +1250,12 @@ opcode(struct regs *regs)
}
goto invalid;
- case 0xCD: /* int $n */
+ case 0xCD: /* int $n */
TRACE((regs, regs->eip - eip, "int"));
interrupt(regs, fetch8(regs));
return OPC_EMULATED;
- case 0xCF: /* iret */
+ case 0xCF: /* iret */
if (prefix & DATA32) {
TRACE((regs, regs->eip - eip, "data32 iretd"));
regs->eip = pop32(regs);
@@ -962,17 +1270,17 @@ opcode(struct regs *regs)
}
return OPC_EMULATED;
- case 0xE4: /* inb al, port */
+ case 0xE4: /* inb al, port */
if (!inbyte(regs, prefix, opc))
goto invalid;
return OPC_EMULATED;
- case 0xE6: /* outb port, al */
+ case 0xE6: /* outb port, al */
if (!outbyte(regs, prefix, opc))
goto invalid;
return OPC_EMULATED;
- case 0xEA: /* jmpl */
+ case 0xEA: /* jmpl */
if ((mode == VM86_REAL_TO_PROTECTED) ||
(mode == VM86_PROTECTED_TO_REAL)) {
jmpl(regs, prefix);
@@ -980,7 +1288,7 @@ opcode(struct regs *regs)
}
goto invalid;
- case 0xEB: /* short jump */
+ case 0xEB: /* short jump */
if ((mode == VM86_REAL_TO_PROTECTED) ||
(mode == VM86_PROTECTED_TO_REAL)) {
disp = (char) fetch8(regs);
@@ -990,26 +1298,33 @@ opcode(struct regs *regs)
}
goto invalid;
- case 0xEC: /* inb al, (%dx) */
+ case 0xEC: /* inb al, (%dx) */
if (!inbyte(regs, prefix, opc))
goto invalid;
return OPC_EMULATED;
- case 0xEE: /* outb (%dx), al */
+ case 0xEE: /* outb (%dx), al */
if (!outbyte(regs, prefix, opc))
goto invalid;
return OPC_EMULATED;
- case 0xF0: /* lock */
+ case 0xF0: /* lock */
TRACE((regs, regs->eip - eip, "lock"));
continue;
- case 0xFA: /* cli */
+ case 0xF6: /* addr32 testb $imm, r/m8 */
+ if ((prefix & ADDR32) == 0)
+ goto invalid;
+ if (!test(regs, prefix, opc))
+ goto invalid;
+ return OPC_EMULATED;
+
+ case 0xFA: /* cli */
TRACE((regs, regs->eip - eip, "cli"));
regs->eflags &= ~EFLAGS_IF;
return OPC_EMULATED;
- case 0xFB: /* sti */
+ case 0xFB: /* sti */
TRACE((regs, regs->eip - eip, "sti"));
regs->eflags |= EFLAGS_IF;
return OPC_EMULATED;
@@ -1021,6 +1336,7 @@ opcode(struct regs *regs)
invalid:
regs->eip = eip;
+ TRACE((regs, regs->eip - eip, "opc 0x%x", opc));
return OPC_INVALID;
}
@@ -1087,4 +1403,3 @@ trap(int trapno, int errno, struct regs *regs)
halt();
}
}
-
diff --git a/tools/xm-test/tests/vtpm/vtpm_utils.py b/tools/xm-test/tests/vtpm/vtpm_utils.py
index 34e4afd583..d855e32311 100644
--- a/tools/xm-test/tests/vtpm/vtpm_utils.py
+++ b/tools/xm-test/tests/vtpm/vtpm_utils.py
@@ -8,7 +8,7 @@ from XmTestLib import *
if ENABLE_HVM_SUPPORT:
SKIP("vtpm tests not supported for HVM domains")
-if not os.path.isfile("/dev/tpm0"):
+if not os.path.exists("/dev/tpm0"):
SKIP("This machine has no hardware TPM; cannot run this test")
status, output = traceCommand("ps aux | grep vtpm_manager | grep -v grep")
diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index 430cad9372..86fc6e4b9d 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -58,6 +58,7 @@ static inline int svm_inject_extint(struct vcpu *v, int trap, int error_code)
intr.fields.intr_masking = 1;
intr.fields.vector = trap;
intr.fields.prio = 0xF;
+ intr.fields.ign_tpr = 1;
vmcb->vintr = intr;
// printf( "IRQ = %d\n", trap );
return 0;
@@ -160,18 +161,21 @@ asmlinkage void svm_intr_assist(void)
}
/* Now let's check for newer interrrupts */
else {
- /* Interrput pending at the PIC? */
- hvm_pic_assist(v);
- if (vpit->pending_intr_nr) {
- pic_set_irq(pic, 0, 0);
- pic_set_irq(pic, 0, 1);
- }
-
- if (plat->interrupt_request) {
- intr_vector = cpu_get_interrupt(v, &intr_type);
- plat->interrupt_request = 0;
- }
+ if ( v->vcpu_id == 0 )
+ hvm_pic_assist(v);
+
+ /* Before we deal with PIT interrupts, let's check
+ for interrupts set by the device model.
+ */
+ if ( cpu_has_pending_irq(v) ) {
+ intr_vector = cpu_get_interrupt(v, &intr_type);
+ }
+ else if ( (v->vcpu_id == 0) && vpit->pending_intr_nr ) {
+ pic_set_irq(pic, 0, 0);
+ pic_set_irq(pic, 0, 1);
+ intr_vector = cpu_get_interrupt(v, &intr_type);
+ }
}
/* have we got an interrupt to inject? */
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 24d0e986e6..4e6965feac 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1243,20 +1243,19 @@ static void svm_io_instruction(struct vcpu *v, struct cpu_user_regs *regs)
"svm_io_instruction: port 0x%lx real %d, eip=%lx:%lx, "
"exit_qualification = %lx",
(unsigned long) port, real, cs, eip, (unsigned long)info.bytes);
-
- /*
- * On SVM, the RIP of the intruction following the IN/OUT is saved in
- * ExitInfo2
- */
- vmcb->rip = vmcb->exitinfo2;
-
/* string instruction */
if (info.fields.str)
{
unsigned long addr, count = 1;
int sign = regs->eflags & EF_DF ? -1 : 1;
+ /* Need the original rip, here. */
addr = svm_get_io_address(vmcb, regs, dir, real);
+ /*
+ * On SVM, the RIP of the intruction following the IN/OUT is saved in
+ * ExitInfo2
+ */
+ vmcb->rip = vmcb->exitinfo2;
/* "rep" prefix */
if (info.fields.rep)
@@ -1295,6 +1294,12 @@ static void svm_io_instruction(struct vcpu *v, struct cpu_user_regs *regs)
}
else
{
+ /*
+ * On SVM, the RIP of the intruction following the IN/OUT is saved in
+ * ExitInfo2
+ */
+ vmcb->rip = vmcb->exitinfo2;
+
if (port == 0xe9 && dir == IOREQ_WRITE && size == 1)
hvm_print_line(v, regs->eax); /* guest debug output */
@@ -1772,6 +1777,10 @@ static inline void svm_vmexit_do_hlt(struct vmcb_struct *vmcb)
__update_guest_eip(vmcb, 1);
+ /* check for interrupt not handled or new interrupt */
+ if ( vmcb->vintr.fields.irq || cpu_has_pending_irq(v) )
+ return;
+
if ( !v->vcpu_id )
next_pit = get_pit_scheduled(v, vpit);
next_wakeup = get_apictime_scheduled(v);
@@ -1779,9 +1788,7 @@ static inline void svm_vmexit_do_hlt(struct vmcb_struct *vmcb)
next_wakeup = next_pit;
if ( next_wakeup != - 1 )
set_timer(&current->arch.hvm_svm.hlt_timer, next_wakeup);
-/* temporary workaround for 8828/8822 evtchn patches causing SVM failure.
hvm_safe_block();
-*/
}
@@ -2407,6 +2414,15 @@ asmlinkage void svm_vmexit_handler(struct cpu_user_regs regs)
do_nmi(&regs, 0);
break;
+ case VMEXIT_SMI:
+ /*
+ * For asynchronous SMI's, we just need to allow global interrupts
+ * so that the SMI is taken properly in the context of the host. The
+ * standard code does a STGI after the VMEXIT which should accomplish
+ * this task. Continue as normal and restart the guest.
+ */
+ break;
+
#ifdef XEN_DEBUGGER
case VMEXIT_EXCEPTION_BP:
svm_debug_save_cpu_user_regs(&regs);
diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c
index 00e06d86b0..eeca39ee68 100644
--- a/xen/arch/x86/hvm/svm/vmcb.c
+++ b/xen/arch/x86/hvm/svm/vmcb.c
@@ -123,7 +123,7 @@ static int construct_vmcb_controls(struct arch_svm_struct *arch_svm)
GENERAL1_INTERCEPT_RDTSC | GENERAL1_INTERCEPT_PUSHF |
GENERAL1_INTERCEPT_SWINT | GENERAL1_INTERCEPT_POPF |
GENERAL1_INTERCEPT_IRET | GENERAL1_INTERCEPT_PAUSE |
- GENERAL1_INTERCEPT_TASK_SWITCH
+ GENERAL1_INTERCEPT_TASK_SWITCH | GENERAL1_INTERCEPT_SMI
);
/* turn on the general 2 intercepts */