[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] merge xen-unstable.hg
# HG changeset patch # User awilliam@xxxxxxxxxxx # Node ID b2828004f1310d5e764c4e690654433ee528574d # Parent 695aa28b7cb1c572444235971f13b0d142c6a042 # Parent ecb99d1ce57d6adb3169b38cc57219a9b98144f3 merge xen-unstable.hg diff -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c --- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/arch/i386/mm/init-xen.c --- a/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Wed Mar 22 16:12:48 2006 @@ -93,6 +93,11 @@ /* 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 @@ 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; @@ -988,6 +996,17 @@ #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) { diff -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Wed Mar 22 16:12:48 2006 @@ -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 @@ 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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/blkback/common.h --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/blkback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Wed Mar 22 16:12:48 2006 @@ -810,7 +810,6 @@ MODULE_LICENSE("Dual BSD/GPL"); - /* * Local variables: * c-file-style: "linux" diff -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/blkfront/block.h --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/console/console.c --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c Wed Mar 22 16:12:48 2006 @@ -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 @@ module_init(xencons_init); +MODULE_LICENSE("Dual BSD/GPL"); + /* * Local variables: * c-file-style: "linux" diff -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c --- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/core/evtchn.c --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c Wed Mar 22 16:12:48 2006 @@ -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)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 @@ 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 @@ 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 @@ 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 @@ 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 @@ force_evtchn_callback(); } } -EXPORT_SYMBOL(unmask_evtchn); +EXPORT_SYMBOL_GPL(unmask_evtchn); void irq_resume(void) { diff -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/core/features.c --- a/linux-2.6-xen-sparse/drivers/xen/core/features.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/core/features.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/core/gnttab.c --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/core/reboot.c --- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c Wed Mar 22 16:12:48 2006 @@ -122,7 +122,7 @@ 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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c --- a/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c --- a/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c Wed Mar 22 16:12:48 2006 @@ -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 @@ module_init(evtchn_init); module_exit(evtchn_cleanup); +MODULE_LICENSE("Dual BSD/GPL"); + /* * Local variables: * c-file-style: "linux" diff -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/net_driver_util.c --- a/linux-2.6-xen-sparse/drivers/xen/net_driver_util.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/net_driver_util.c Wed Mar 22 16:12:48 2006 @@ -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 @@ -26,7 +28,6 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ - #include <linux/if_ether.h> #include <linux/err.h> @@ -54,7 +55,7 @@ kfree(macstr); return 0; } -EXPORT_SYMBOL(xen_net_read_mac); +EXPORT_SYMBOL_GPL(xen_net_read_mac); /* * Local variables: diff -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/netback/common.h --- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/netback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/netback/loopback.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/netback/netback.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Wed Mar 22 16:12:48 2006 @@ -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 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 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 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 @@ } else { rc = -EBUSY; } - up(&upperlayer_lock); + mutex_unlock(&upperlayer_lock); return rc; } EXPORT_SYMBOL(tpm_fe_register_receiver); @@ -197,9 +199,9 @@ */ 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 @@ { 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 @@ 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 @@ * 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 @@ upperlayer_tpmfe->status(0); } } - up(&upperlayer_lock); + mutex_unlock(&upperlayer_lock); } @@ -662,21 +664,21 @@ /* * 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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c Wed Mar 22 16:12:48 2006 @@ -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 @@ 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 @@ 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 @@ return 0; } -EXPORT_SYMBOL(xenbus_switch_state); +EXPORT_SYMBOL_GPL(xenbus_switch_state); /** @@ -178,7 +181,7 @@ _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 @@ 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 @@ 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 @@ *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 @@ *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 @@ *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 @@ 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 @@ 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 @@ 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 @@ return result; } -EXPORT_SYMBOL(xenbus_read_driver_state); +EXPORT_SYMBOL_GPL(xenbus_read_driver_state); /* diff -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Wed Mar 22 16:12:48 2006 @@ -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 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; @@ -103,6 +104,23 @@ } *strchr(bus_id, '/') = '-'; return 0; +} + + +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; + } } @@ -123,8 +141,7 @@ !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; } @@ -141,23 +158,6 @@ static int read_frontend_details(struct xenbus_device *xendev) { return read_otherend_details(xendev, "frontend-id", "frontend"); -} - - -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; - } } @@ -396,9 +396,9 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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 @@ return 0; fail: - xenbus_dev_free(xendev); + kfree(xendev); return err; } @@ -845,7 +840,7 @@ 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 @@ 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 @@ 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) @@ -1018,10 +1013,6 @@ page = get_zeroed_page(GFP_KERNEL); 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) >> diff -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Wed Mar 22 16:12:48 2006 @@ -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,13 +41,12 @@ #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 @@ 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 @@ * 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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ /* Flush any currently-executing callback, unless we are it. :-) */ if (current->pid != xenwatch_pid) { - down(&xenwatch_mutex); - up(&xenwatch_mutex); - } -} -EXPORT_SYMBOL(unregister_xenbus_watch); + mutex_lock(&xenwatch_mutex); + mutex_unlock(&xenwatch_mutex); + } +} +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 @@ 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 @@ 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 @@ kfree(msg); } - up(&xenwatch_mutex); + mutex_unlock(&xenwatch_mutex); } return 0; @@ -806,7 +808,7 @@ 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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/asm-ia64/hypercall.h --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h --- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h Wed Mar 22 16:12:48 2006 @@ -9,8 +9,11 @@ * Benjamin Liu <benjamin.liu@xxxxxxxxx> * Jun Nakajima <jun.nakajima@xxxxxxxxx> * - * 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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/xen/balloon.h --- a/linux-2.6-xen-sparse/include/xen/balloon.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/xen/balloon.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/xen/evtchn.h --- a/linux-2.6-xen-sparse/include/xen/evtchn.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/xen/evtchn.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/xen/gnttab.h --- a/linux-2.6-xen-sparse/include/xen/gnttab.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/xen/gnttab.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/xen/net_driver_util.h --- a/linux-2.6-xen-sparse/include/xen/net_driver_util.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/xen/net_driver_util.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/xen/public/evtchn.h --- a/linux-2.6-xen-sparse/include/xen/public/evtchn.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/xen/public/evtchn.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/xen/public/privcmd.h --- a/linux-2.6-xen-sparse/include/xen/public/privcmd.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/xen/public/privcmd.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 linux-2.6-xen-sparse/include/xen/xenbus.h --- a/linux-2.6-xen-sparse/include/xen/xenbus.h Wed Mar 22 15:57:48 2006 +++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 tools/examples/Makefile --- a/tools/examples/Makefile Wed Mar 22 15:57:48 2006 +++ b/tools/examples/Makefile Wed Mar 22 16:12:48 2006 @@ -38,8 +38,8 @@ 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 -r 695aa28b7cb1 -r b2828004f131 tools/examples/xmexample.hvm --- a/tools/examples/xmexample.hvm Wed Mar 22 15:57:48 2006 +++ b/tools/examples/xmexample.hvm Wed Mar 22 16:12:48 2006 @@ -129,6 +129,9 @@ # 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 -r 695aa28b7cb1 -r b2828004f131 tools/firmware/vmxassist/machine.h --- a/tools/firmware/vmxassist/machine.h Wed Mar 22 15:57:48 2006 +++ b/tools/firmware/vmxassist/machine.h Wed Mar 22 16:12:48 2006 @@ -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 -r 695aa28b7cb1 -r b2828004f131 tools/firmware/vmxassist/util.c --- a/tools/firmware/vmxassist/util.c Wed Mar 22 15:57:48 2006 +++ b/tools/firmware/vmxassist/util.c Wed Mar 22 16:12:48 2006 @@ -48,7 +48,8 @@ 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 @@ } 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 @@ 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); - - printf("cr0 0x%lx, cr3 0x%lx, cr4 0x%lx\n", c->cr0, c->cr3, c->cr4); + (long) c->eip, (long) c->esp, (long) c->eflags); + + 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 -r 695aa28b7cb1 -r b2828004f131 tools/firmware/vmxassist/vm86.c --- a/tools/firmware/vmxassist/vm86.c Wed Mar 22 15:57:48 2006 +++ b/tools/firmware/vmxassist/vm86.c Wed Mar 22 16:12:48 2006 @@ -3,7 +3,7 @@ * little work as possible. * * Leendert van Doorn, leendert@xxxxxxxxxxxxxx - * 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 @@ "<VM86_PROTECTED_TO_REAL>", "<VM86_PROTECTED>" }; + +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 @@ unsigned long long entry; unsigned addr; - /* real mode: segment is part of the address */ - if (mode == VM86_REAL || mode == VM86_REAL_TO_PROTECTED) + if (seg == 0) + return off; + + if (seg > oldctx.gdtr_limit) return ((seg & 0xFFFF) << 4) + 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; - } entry = ((unsigned long long *) oldctx.gdtr_base)[seg >> 3]; addr = (((entry >> (56-24)) & 0xFF000000) | @@ -198,7 +195,7 @@ } 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 @@ 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 @@ } } -/* - * Operand (modrm) decode - */ +void +setreg16(struct regs *regs, int r, unsigned v) +{ + 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; + } +} + unsigned -operand(unsigned prefix, struct regs *regs, unsigned modrm) -{ - int mod, disp = 0, seg; - - seg = regs->vds; +segment(unsigned prefix, struct regs *regs, unsigned seg) +{ if (prefix & SEG_ES) seg = regs->ves; if (prefix & SEG_DS) @@ -249,6 +284,47 @@ 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 @@ 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 @@ 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 @@ } break; case 3: - return MASK16(getreg(regs, modrm)); + return getreg16(regs, modrm); } } @@ -400,6 +478,72 @@ } /* + * 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 @@ 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,22 +584,135 @@ 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; + } + + 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; @@ -473,17 +730,16 @@ 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 @@ 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 @@ /* * 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 @@ break; case VM86_PROTECTED_TO_REAL: - if (mode == VM86_PROTECTED) - break; - else + if (mode == VM86_PROTECTED) { + break; + } else panic("unexpected protected-to-real mode transition"); + break; case VM86_PROTECTED: if (mode == VM86_REAL_TO_PROTECTED) { @@ -887,6 +1151,16 @@ 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; @@ -911,6 +1185,33 @@ TRACE((regs, regs->eip - eip, "addr32")); 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")); @@ -924,7 +1225,7 @@ 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 @@ 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ invalid: regs->eip = eip; + TRACE((regs, regs->eip - eip, "opc 0x%x", opc)); return OPC_INVALID; } @@ -1087,4 +1403,3 @@ halt(); } } - diff -r 695aa28b7cb1 -r b2828004f131 tools/xm-test/tests/vtpm/vtpm_utils.py --- a/tools/xm-test/tests/vtpm/vtpm_utils.py Wed Mar 22 15:57:48 2006 +++ b/tools/xm-test/tests/vtpm/vtpm_utils.py Wed Mar 22 16:12:48 2006 @@ -8,7 +8,7 @@ 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 -r 695aa28b7cb1 -r b2828004f131 xen/arch/x86/hvm/svm/intr.c --- a/xen/arch/x86/hvm/svm/intr.c Wed Mar 22 15:57:48 2006 +++ b/xen/arch/x86/hvm/svm/intr.c Wed Mar 22 16:12:48 2006 @@ -58,6 +58,7 @@ 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 @@ } /* 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 -r 695aa28b7cb1 -r b2828004f131 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Wed Mar 22 15:57:48 2006 +++ b/xen/arch/x86/hvm/svm/svm.c Wed Mar 22 16:12:48 2006 @@ -1243,20 +1243,19 @@ "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 @@ } 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 @@ __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 @@ next_wakeup = next_pit; if ( next_wakeup != - 1 ) set_timer(¤t->arch.hvm_svm.hlt_timer, next_wakeup); -/* temporary workaround for 8828/8822 evtchn patches causing SVM failure. hvm_safe_block(); -*/ } @@ -2407,6 +2414,15 @@ do_nmi(®s, 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(®s); diff -r 695aa28b7cb1 -r b2828004f131 xen/arch/x86/hvm/svm/vmcb.c --- a/xen/arch/x86/hvm/svm/vmcb.c Wed Mar 22 15:57:48 2006 +++ b/xen/arch/x86/hvm/svm/vmcb.c Wed Mar 22 16:12:48 2006 @@ -123,7 +123,7 @@ 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 */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |