direct-io.hg

changeset 11972:b725c9e51a7c

merge with xen-unstable.hg
author awilliam@xenbuild.aw
date Sat Oct 14 13:28:45 2006 -0600 (2006-10-14)
parents 5176c3ea3293 7da100019e00
children 9e8fdcc46fa3
files linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c	Sun Oct 08 18:55:12 2006 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c	Sat Oct 14 13:28:45 2006 -0600
     1.3 @@ -29,6 +29,8 @@ static int direct_remap_area_pte_fn(pte_
     1.4  {
     1.5  	mmu_update_t **v = (mmu_update_t **)data;
     1.6  
     1.7 +	BUG_ON(!pte_none(*pte));
     1.8 +
     1.9  	(*v)->ptr = ((u64)pfn_to_mfn(page_to_pfn(pmd_page)) <<
    1.10  		     PAGE_SHIFT) | ((unsigned long)pte & ~PAGE_MASK);
    1.11  	(*v)++;
    1.12 @@ -110,12 +112,14 @@ int direct_remap_pfn_range(struct vm_are
    1.13  			   pgprot_t prot,
    1.14  			   domid_t  domid)
    1.15  {
    1.16 -	/* Same as remap_pfn_range(). */
    1.17 -	vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
    1.18 +	if (xen_feature(XENFEAT_auto_translated_physmap))
    1.19 +		return remap_pfn_range(vma, address, mfn, size, prot);
    1.20  
    1.21  	if (domid == DOMID_SELF)
    1.22  		return -EINVAL;
    1.23  
    1.24 +	vma->vm_flags |= VM_IO | VM_RESERVED;
    1.25 +
    1.26  	vma->vm_mm->context.has_foreign_mappings = 1;
    1.27  
    1.28  	return __direct_remap_pfn_range(
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Sun Oct 08 18:55:12 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Sat Oct 14 13:28:45 2006 -0600
     2.3 @@ -478,6 +478,7 @@ struct xen_ia64_privcmd_range {
     2.4  };
     2.5  
     2.6  struct xen_ia64_privcmd_vma {
     2.7 +	int				is_privcmd_mmapped;
     2.8  	struct xen_ia64_privcmd_range*	range;
     2.9  
    2.10  	unsigned long			num_entries;
    2.11 @@ -616,12 +617,15 @@ static void
    2.12  static void
    2.13  xen_ia64_privcmd_vma_open(struct vm_area_struct* vma)
    2.14  {
    2.15 +	struct xen_ia64_privcmd_vma* old_privcmd_vma = (struct xen_ia64_privcmd_vma*)vma->vm_private_data;
    2.16  	struct xen_ia64_privcmd_vma* privcmd_vma = (struct xen_ia64_privcmd_vma*)vma->vm_private_data;
    2.17  	struct xen_ia64_privcmd_range* privcmd_range = privcmd_vma->range;
    2.18  
    2.19  	atomic_inc(&privcmd_range->ref_count);
    2.20  	// vm_op->open() can't fail.
    2.21  	privcmd_vma = kmalloc(sizeof(*privcmd_vma), GFP_KERNEL | __GFP_NOFAIL);
    2.22 +	// copy original value if necessary
    2.23 +	privcmd_vma->is_privcmd_mmapped = old_privcmd_vma->is_privcmd_mmapped;
    2.24  
    2.25  	__xen_ia64_privcmd_vma_open(vma, privcmd_vma, privcmd_range);
    2.26  }
    2.27 @@ -657,6 +661,14 @@ xen_ia64_privcmd_vma_close(struct vm_are
    2.28  }
    2.29  
    2.30  int
    2.31 +privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma)
    2.32 +{
    2.33 +	struct xen_ia64_privcmd_vma* privcmd_vma =
    2.34 +		(struct xen_ia64_privcmd_vma *)vma->vm_private_data;
    2.35 +	return (xchg(&privcmd_vma->is_privcmd_mmapped, 1) == 0);
    2.36 +}
    2.37 +
    2.38 +int
    2.39  privcmd_mmap(struct file * file, struct vm_area_struct * vma)
    2.40  {
    2.41  	int error;
    2.42 @@ -681,6 +693,8 @@ privcmd_mmap(struct file * file, struct 
    2.43  	if (privcmd_vma == NULL) {
    2.44  		goto out_enomem1;
    2.45  	}
    2.46 +	privcmd_vma->is_privcmd_mmapped = 0;
    2.47 +
    2.48  	res = kzalloc(sizeof(*res), GFP_KERNEL);
    2.49  	if (res == NULL) {
    2.50  		goto out_enomem1;
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Sun Oct 08 18:55:12 2006 -0600
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Sat Oct 14 13:28:45 2006 -0600
     3.3 @@ -534,74 +534,86 @@ static int dealloc_pte_fn(
     3.4  	return 0;
     3.5  }
     3.6  
     3.7 -struct page *balloon_alloc_empty_page_range(unsigned long nr_pages)
     3.8 +struct page **alloc_empty_pages_and_pagevec(int nr_pages)
     3.9  {
    3.10 -	unsigned long vstart, flags;
    3.11 -	unsigned int  order = get_order(nr_pages * PAGE_SIZE);
    3.12 -	int ret;
    3.13 -	unsigned long i;
    3.14 -	struct page *page;
    3.15 +	unsigned long vaddr, flags;
    3.16 +	struct page *page, **pagevec;
    3.17 +	int i, ret;
    3.18  
    3.19 -	vstart = __get_free_pages(GFP_KERNEL, order);
    3.20 -	if (vstart == 0)
    3.21 +	pagevec = kmalloc(sizeof(page) * nr_pages, GFP_KERNEL);
    3.22 +	if (pagevec == NULL)
    3.23  		return NULL;
    3.24  
    3.25 -	scrub_pages(vstart, 1 << order);
    3.26 +	for (i = 0; i < nr_pages; i++) {
    3.27 +		page = pagevec[i] = alloc_page(GFP_KERNEL);
    3.28 +		if (page == NULL)
    3.29 +			goto err;
    3.30 +
    3.31 +		vaddr = (unsigned long)page_address(page);
    3.32 +
    3.33 +		scrub_pages(vaddr, 1);
    3.34 +
    3.35 +		balloon_lock(flags);
    3.36 +
    3.37 +		if (xen_feature(XENFEAT_auto_translated_physmap)) {
    3.38 +			unsigned long gmfn = page_to_pfn(page);
    3.39 +			struct xen_memory_reservation reservation = {
    3.40 +				.nr_extents   = 1,
    3.41 +				.extent_order = 0,
    3.42 +				.domid        = DOMID_SELF
    3.43 +			};
    3.44 +			set_xen_guest_handle(reservation.extent_start, &gmfn);
    3.45 +			ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation,
    3.46 +						   &reservation);
    3.47 +			if (ret == 1)
    3.48 +				ret = 0; /* success */
    3.49 +		} else {
    3.50 +			ret = apply_to_page_range(&init_mm, vaddr, PAGE_SIZE,
    3.51 +						  dealloc_pte_fn, NULL);
    3.52 +		}
    3.53 +
    3.54 +		if (ret != 0) {
    3.55 +			balloon_unlock(flags);
    3.56 +			__free_page(page);
    3.57 +			goto err;
    3.58 +		}
    3.59 +
    3.60 +		totalram_pages = --current_pages;
    3.61 +
    3.62 +		balloon_unlock(flags);
    3.63 +	}
    3.64 +
    3.65 + out:
    3.66 +	schedule_work(&balloon_worker);
    3.67 +	flush_tlb_all();
    3.68 +	return pagevec;
    3.69 +
    3.70 + err:
    3.71 +	balloon_lock(flags);
    3.72 +	while (--i >= 0)
    3.73 +		balloon_append(pagevec[i]);
    3.74 +	balloon_unlock(flags);
    3.75 +	kfree(pagevec);
    3.76 +	pagevec = NULL;
    3.77 +	goto out;
    3.78 +}
    3.79 +
    3.80 +void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages)
    3.81 +{
    3.82 +	unsigned long flags;
    3.83 +	int i;
    3.84 +
    3.85 +	if (pagevec == NULL)
    3.86 +		return;
    3.87  
    3.88  	balloon_lock(flags);
    3.89 -	if (xen_feature(XENFEAT_auto_translated_physmap)) {
    3.90 -		unsigned long gmfn = __pa(vstart) >> PAGE_SHIFT;
    3.91 -		struct xen_memory_reservation reservation = {
    3.92 -			.nr_extents   = 1,
    3.93 -			.extent_order = order,
    3.94 -			.domid        = DOMID_SELF
    3.95 -		};
    3.96 -		set_xen_guest_handle(reservation.extent_start, &gmfn);
    3.97 -		ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation,
    3.98 -					   &reservation);
    3.99 -		if (ret == -ENOSYS)
   3.100 -			goto err;
   3.101 -		BUG_ON(ret != 1);
   3.102 -	} else {
   3.103 -		ret = apply_to_page_range(&init_mm, vstart, PAGE_SIZE << order,
   3.104 -					  dealloc_pte_fn, NULL);
   3.105 -		if (ret == -ENOSYS)
   3.106 -			goto err;
   3.107 -		BUG_ON(ret);
   3.108 +	for (i = 0; i < nr_pages; i++) {
   3.109 +		BUG_ON(page_count(pagevec[i]) != 1);
   3.110 +		balloon_append(pagevec[i]);
   3.111  	}
   3.112 -	current_pages -= 1UL << order;
   3.113 -	totalram_pages = current_pages;
   3.114  	balloon_unlock(flags);
   3.115  
   3.116 -	schedule_work(&balloon_worker);
   3.117 -
   3.118 -	flush_tlb_all();
   3.119 -
   3.120 -	page = virt_to_page(vstart);
   3.121 -
   3.122 -	for (i = 0; i < (1UL << order); i++)
   3.123 -		set_page_count(page + i, 1);
   3.124 -
   3.125 -	return page;
   3.126 -
   3.127 - err:
   3.128 -	free_pages(vstart, order);
   3.129 -	balloon_unlock(flags);
   3.130 -	return NULL;
   3.131 -}
   3.132 -
   3.133 -void balloon_dealloc_empty_page_range(
   3.134 -	struct page *page, unsigned long nr_pages)
   3.135 -{
   3.136 -	unsigned long i, flags;
   3.137 -	unsigned int  order = get_order(nr_pages * PAGE_SIZE);
   3.138 -
   3.139 -	balloon_lock(flags);
   3.140 -	for (i = 0; i < (1UL << order); i++) {
   3.141 -		BUG_ON(page_count(page + i) != 1);
   3.142 -		balloon_append(page + i);
   3.143 -	}
   3.144 -	balloon_unlock(flags);
   3.145 +	kfree(pagevec);
   3.146  
   3.147  	schedule_work(&balloon_worker);
   3.148  }
   3.149 @@ -619,8 +631,8 @@ void balloon_release_driver_page(struct 
   3.150  }
   3.151  
   3.152  EXPORT_SYMBOL_GPL(balloon_update_driver_allowance);
   3.153 -EXPORT_SYMBOL_GPL(balloon_alloc_empty_page_range);
   3.154 -EXPORT_SYMBOL_GPL(balloon_dealloc_empty_page_range);
   3.155 +EXPORT_SYMBOL_GPL(alloc_empty_pages_and_pagevec);
   3.156 +EXPORT_SYMBOL_GPL(free_empty_pages_and_pagevec);
   3.157  EXPORT_SYMBOL_GPL(balloon_release_driver_page);
   3.158  
   3.159  MODULE_LICENSE("Dual BSD/GPL");
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sun Oct 08 18:55:12 2006 -0600
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Oct 14 13:28:45 2006 -0600
     4.3 @@ -56,8 +56,6 @@ static int blkif_reqs = 64;
     4.4  module_param_named(reqs, blkif_reqs, int, 0);
     4.5  MODULE_PARM_DESC(reqs, "Number of blkback requests to allocate");
     4.6  
     4.7 -static int mmap_pages;
     4.8 -
     4.9  /* Run-time switchable: /sys/module/blkback/parameters/ */
    4.10  static unsigned int log_stats = 0;
    4.11  static unsigned int debug_lvl = 0;
    4.12 @@ -87,8 +85,7 @@ static DECLARE_WAIT_QUEUE_HEAD(pending_f
    4.13  
    4.14  #define BLKBACK_INVALID_HANDLE (~0)
    4.15  
    4.16 -static unsigned long mmap_vstart;
    4.17 -static unsigned long *pending_vaddrs;
    4.18 +static struct page **pending_pages;
    4.19  static grant_handle_t *pending_grant_handles;
    4.20  
    4.21  static inline int vaddr_pagenr(pending_req_t *req, int seg)
    4.22 @@ -98,7 +95,8 @@ static inline int vaddr_pagenr(pending_r
    4.23  
    4.24  static inline unsigned long vaddr(pending_req_t *req, int seg)
    4.25  {
    4.26 -	return pending_vaddrs[vaddr_pagenr(req, seg)];
    4.27 +	unsigned long pfn = page_to_pfn(pending_pages[vaddr_pagenr(req, seg)]);
    4.28 +	return (unsigned long)pfn_to_kaddr(pfn);
    4.29  }
    4.30  
    4.31  #define pending_handle(_req, _seg) \
    4.32 @@ -506,52 +504,43 @@ static void make_response(blkif_t *blkif
    4.33  
    4.34  static int __init blkif_init(void)
    4.35  {
    4.36 -	struct page *page;
    4.37 -	int i;
    4.38 +	int i, mmap_pages;
    4.39  
    4.40  	if (!is_running_on_xen())
    4.41  		return -ENODEV;
    4.42  
    4.43 -	mmap_pages            = blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST;
    4.44 -
    4.45 -	page = balloon_alloc_empty_page_range(mmap_pages);
    4.46 -	if (page == NULL)
    4.47 -		return -ENOMEM;
    4.48 -	mmap_vstart = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
    4.49 +	mmap_pages = blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST;
    4.50  
    4.51  	pending_reqs          = kmalloc(sizeof(pending_reqs[0]) *
    4.52  					blkif_reqs, GFP_KERNEL);
    4.53  	pending_grant_handles = kmalloc(sizeof(pending_grant_handles[0]) *
    4.54  					mmap_pages, GFP_KERNEL);
    4.55 -	pending_vaddrs        = kmalloc(sizeof(pending_vaddrs[0]) *
    4.56 -					mmap_pages, GFP_KERNEL);
    4.57 -	if (!pending_reqs || !pending_grant_handles || !pending_vaddrs) {
    4.58 -		kfree(pending_reqs);
    4.59 -		kfree(pending_grant_handles);
    4.60 -		kfree(pending_vaddrs);
    4.61 -		printk("%s: out of memory\n", __FUNCTION__);
    4.62 -		return -ENOMEM;
    4.63 -	}
    4.64 +	pending_pages         = alloc_empty_pages_and_pagevec(mmap_pages);
    4.65 +
    4.66 +	if (!pending_reqs || !pending_grant_handles || !pending_pages)
    4.67 +		goto out_of_memory;
    4.68 +
    4.69 +	for (i = 0; i < mmap_pages; i++)
    4.70 +		pending_grant_handles[i] = BLKBACK_INVALID_HANDLE;
    4.71  
    4.72  	blkif_interface_init();
    4.73 -	
    4.74 -	printk("%s: reqs=%d, pages=%d, mmap_vstart=0x%lx\n",
    4.75 -	       __FUNCTION__, blkif_reqs, mmap_pages, mmap_vstart);
    4.76 -	BUG_ON(mmap_vstart == 0);
    4.77 -	for (i = 0; i < mmap_pages; i++) {
    4.78 -		pending_vaddrs[i] = mmap_vstart + (i << PAGE_SHIFT);
    4.79 -		pending_grant_handles[i] = BLKBACK_INVALID_HANDLE;
    4.80 -	}
    4.81  
    4.82  	memset(pending_reqs, 0, sizeof(pending_reqs));
    4.83  	INIT_LIST_HEAD(&pending_free);
    4.84  
    4.85  	for (i = 0; i < blkif_reqs; i++)
    4.86  		list_add_tail(&pending_reqs[i].free_list, &pending_free);
    4.87 -    
    4.88 +
    4.89  	blkif_xenbus_init();
    4.90  
    4.91  	return 0;
    4.92 +
    4.93 + out_of_memory:
    4.94 +	kfree(pending_reqs);
    4.95 +	kfree(pending_grant_handles);
    4.96 +	free_empty_pages_and_pagevec(pending_pages, mmap_pages);
    4.97 +	printk("%s: out of memory\n", __FUNCTION__);
    4.98 +	return -ENOMEM;
    4.99  }
   4.100  
   4.101  module_init(blkif_init);
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Sun Oct 08 18:55:12 2006 -0600
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Sat Oct 14 13:28:45 2006 -0600
     5.3 @@ -186,16 +186,18 @@ static inline unsigned int RTN_PEND_IDX(
     5.4  
     5.5  #define BLKBACK_INVALID_HANDLE (~0)
     5.6  
     5.7 -typedef struct mmap_page {
     5.8 -	unsigned long start;
     5.9 -	struct page *mpage;
    5.10 -} mmap_page_t;
    5.11 +static struct page **foreign_pages[MAX_DYNAMIC_MEM];
    5.12 +static inline unsigned long idx_to_kaddr(
    5.13 +	unsigned int mmap_idx, unsigned int req_idx, unsigned int sg_idx)
    5.14 +{
    5.15 +	unsigned int arr_idx = req_idx*BLKIF_MAX_SEGMENTS_PER_REQUEST + sg_idx;
    5.16 +	unsigned long pfn = page_to_pfn(foreign_pages[mmap_idx][arr_idx]);
    5.17 +	return (unsigned long)pfn_to_kaddr(pfn);
    5.18 +}
    5.19  
    5.20 -static mmap_page_t mmap_start[MAX_DYNAMIC_MEM];
    5.21  static unsigned short mmap_alloc = 0;
    5.22  static unsigned short mmap_lock = 0;
    5.23  static unsigned short mmap_inuse = 0;
    5.24 -static unsigned long *pending_addrs[MAX_DYNAMIC_MEM];
    5.25  
    5.26  /******************************************************************
    5.27   * GRANT HANDLES
    5.28 @@ -726,63 +728,21 @@ static void make_response(blkif_t *blkif
    5.29  static int req_increase(void)
    5.30  {
    5.31  	int i, j;
    5.32 -	struct page *page;
    5.33 -	int ret;
    5.34  
    5.35 -	ret = -EINVAL;
    5.36  	if (mmap_alloc >= MAX_PENDING_REQS || mmap_lock) 
    5.37 -		goto done;
    5.38 +		return -EINVAL;
    5.39  
    5.40 -#ifdef __ia64__
    5.41 -	extern unsigned long alloc_empty_foreign_map_page_range(
    5.42 -		unsigned long pages);
    5.43 -	mmap_start[mmap_alloc].start = (unsigned long)
    5.44 -		alloc_empty_foreign_map_page_range(mmap_pages);
    5.45 -#else /* ! ia64 */
    5.46 -	page = balloon_alloc_empty_page_range(mmap_pages);
    5.47 -	ret = -ENOMEM;
    5.48 -	if (page == NULL) {
    5.49 -		printk("%s balloon_alloc_empty_page_range gave NULL\n", __FUNCTION__);
    5.50 -		goto done;
    5.51 -	}
    5.52 -
    5.53 -	/* Pin all of the pages. */
    5.54 -	for (i=0; i<mmap_pages; i++)
    5.55 -		get_page(&page[i]);
    5.56 -
    5.57 -	mmap_start[mmap_alloc].start = 
    5.58 -		(unsigned long)pfn_to_kaddr(page_to_pfn(page));
    5.59 -	mmap_start[mmap_alloc].mpage = page;
    5.60 +	pending_reqs[mmap_alloc]  = kzalloc(sizeof(pending_req_t)
    5.61 +					    * blkif_reqs, GFP_KERNEL);
    5.62 +	foreign_pages[mmap_alloc] = alloc_empty_pages_and_pagevec(mmap_pages);
    5.63  
    5.64 -#endif
    5.65 -
    5.66 -	pending_reqs[mmap_alloc]  = kzalloc(sizeof(pending_req_t) *
    5.67 -					blkif_reqs, GFP_KERNEL);
    5.68 -	pending_addrs[mmap_alloc] = kzalloc(sizeof(unsigned long) *
    5.69 -					mmap_pages, GFP_KERNEL);
    5.70 +	if (!pending_reqs[mmap_alloc] || !foreign_pages[mmap_alloc])
    5.71 +		goto out_of_memory;
    5.72  
    5.73 -	ret = -ENOMEM;
    5.74 -	if (!pending_reqs[mmap_alloc] || !pending_addrs[mmap_alloc]) {
    5.75 -		kfree(pending_reqs[mmap_alloc]);
    5.76 -		kfree(pending_addrs[mmap_alloc]);
    5.77 -		WPRINTK("%s: out of memory\n", __FUNCTION__);
    5.78 -		ret = -ENOMEM;
    5.79 -		goto done;
    5.80 -	}
    5.81 -
    5.82 -	ret = 0;
    5.83 +	DPRINTK("%s: reqs=%d, pages=%d\n",
    5.84 +		__FUNCTION__, blkif_reqs, mmap_pages);
    5.85  
    5.86 -	DPRINTK("%s: reqs=%d, pages=%d, mmap_vstart=0x%lx\n",
    5.87 -	        __FUNCTION__, blkif_reqs, mmap_pages, 
    5.88 -	       mmap_start[mmap_alloc].start);
    5.89 -
    5.90 -	BUG_ON(mmap_start[mmap_alloc].start == 0);
    5.91 -
    5.92 -	for (i = 0; i < mmap_pages; i++) 
    5.93 -		pending_addrs[mmap_alloc][i] = 
    5.94 -			mmap_start[mmap_alloc].start + (i << PAGE_SHIFT);
    5.95 -
    5.96 -	for (i = 0; i < MAX_PENDING_REQS ; i++) {
    5.97 +	for (i = 0; i < MAX_PENDING_REQS; i++) {
    5.98  		list_add_tail(&pending_reqs[mmap_alloc][i].free_list, 
    5.99  			      &pending_free);
   5.100  		pending_reqs[mmap_alloc][i].mem_idx = mmap_alloc;
   5.101 @@ -793,30 +753,24 @@ static int req_increase(void)
   5.102  
   5.103  	mmap_alloc++;
   5.104  	DPRINTK("# MMAPs increased to %d\n",mmap_alloc);
   5.105 -done:
   5.106 -	return ret;
   5.107 +	return 0;
   5.108 +
   5.109 + out_of_memory:
   5.110 +	free_empty_pages_and_pagevec(foreign_pages[mmap_alloc], mmap_pages);
   5.111 +	kfree(pending_reqs[mmap_alloc]);
   5.112 +	WPRINTK("%s: out of memory\n", __FUNCTION__);
   5.113 +	return -ENOMEM;
   5.114  }
   5.115  
   5.116  static void mmap_req_del(int mmap)
   5.117  {
   5.118 -	int i;
   5.119 -	struct page *page;
   5.120 -
   5.121 -	/*Spinlock already acquired*/
   5.122 -	kfree(pending_reqs[mmap]);
   5.123 -	kfree(pending_addrs[mmap]);
   5.124 +	BUG_ON(!spin_is_locked(&pending_free_lock));
   5.125  
   5.126 -#ifdef __ia64__
   5.127 -	/*Not sure what goes here yet!*/
   5.128 -#else
   5.129 +	kfree(pending_reqs[mmap]);
   5.130 +	pending_reqs[mmap] = NULL;
   5.131  
   5.132 -	/* Unpin all of the pages. */
   5.133 -	page = mmap_start[mmap].mpage;
   5.134 -	for (i=0; i<mmap_pages; i++)
   5.135 -		put_page(&page[i]);
   5.136 -
   5.137 -	balloon_dealloc_empty_page_range(mmap_start[mmap].mpage, mmap_pages);
   5.138 -#endif
   5.139 +	free_empty_pages_and_pagevec(foreign_pages[mmap_alloc], mmap_pages);
   5.140 +	foreign_pages[mmap] = NULL;
   5.141  
   5.142  	mmap_lock = 0;
   5.143  	DPRINTK("# MMAPs decreased to %d\n",mmap_alloc);
   5.144 @@ -887,7 +841,7 @@ static void fast_flush_area(pending_req_
   5.145  	mmap_idx = req->mem_idx;
   5.146  
   5.147  	for (i = 0; i < req->nr_pages; i++) {
   5.148 -		kvaddr = MMAP_VADDR(mmap_start[mmap_idx].start, k_idx, i);
   5.149 +		kvaddr = idx_to_kaddr(mmap_idx, k_idx, i);
   5.150  		uvaddr = MMAP_VADDR(info->user_vstart, u_idx, i);
   5.151  
   5.152  		khandle = &pending_handle(mmap_idx, k_idx, i);
   5.153 @@ -896,7 +850,7 @@ static void fast_flush_area(pending_req_
   5.154  			continue;
   5.155  		}
   5.156  		gnttab_set_unmap_op(&unmap[invcount], 
   5.157 -			MMAP_VADDR(mmap_start[mmap_idx].start, k_idx, i), 
   5.158 +				    idx_to_kaddr(mmap_idx, k_idx, i), 
   5.159  				    GNTMAP_host_map, khandle->kernel);
   5.160  		invcount++;
   5.161  
   5.162 @@ -1030,9 +984,8 @@ static int blktap_read_ufe_ring(tap_blki
   5.163  			struct page *pg;
   5.164  			int offset;
   5.165  
   5.166 -			uvaddr  = MMAP_VADDR(info->user_vstart, usr_idx, j);
   5.167 -			kvaddr = MMAP_VADDR(mmap_start[mmap_idx].start, 
   5.168 -					    pending_idx, j);
   5.169 +			uvaddr = MMAP_VADDR(info->user_vstart, usr_idx, j);
   5.170 +			kvaddr = idx_to_kaddr(mmap_idx, pending_idx, j);
   5.171  
   5.172  			pg = pfn_to_page(__pa(kvaddr) >> PAGE_SHIFT);
   5.173  			ClearPageReserved(pg);
   5.174 @@ -1214,8 +1167,7 @@ static void dispatch_rw_block_io(blkif_t
   5.175  		uint32_t flags;
   5.176  
   5.177  		uvaddr = MMAP_VADDR(info->user_vstart, usr_idx, i);
   5.178 -		kvaddr = MMAP_VADDR(mmap_start[mmap_idx].start, 
   5.179 -				    pending_idx, i);
   5.180 +		kvaddr = idx_to_kaddr(mmap_idx, pending_idx, i);
   5.181  		page = virt_to_page(kvaddr);
   5.182  
   5.183  		sector = req->sector_number + (8*i);
   5.184 @@ -1267,8 +1219,7 @@ static void dispatch_rw_block_io(blkif_t
   5.185  		struct page *pg;
   5.186  
   5.187  		uvaddr = MMAP_VADDR(info->user_vstart, usr_idx, i/2);
   5.188 -		kvaddr = MMAP_VADDR(mmap_start[mmap_idx].start, 
   5.189 -				    pending_idx, i/2);
   5.190 +		kvaddr = idx_to_kaddr(mmap_idx, pending_idx, i/2);
   5.191  
   5.192  		if (unlikely(map[i].status != 0)) {
   5.193  			WPRINTK("invalid kernel buffer -- "
   5.194 @@ -1298,8 +1249,7 @@ static void dispatch_rw_block_io(blkif_t
   5.195  		unsigned long kvaddr;
   5.196  		struct page *pg;
   5.197  
   5.198 -		kvaddr = MMAP_VADDR(mmap_start[mmap_idx].start, 
   5.199 -				    pending_idx, i);
   5.200 +		kvaddr = idx_to_kaddr(mmap_idx, pending_idx, i);
   5.201  		pg = pfn_to_page(__pa(kvaddr) >> PAGE_SHIFT);
   5.202  		SetPageReserved(pg);
   5.203  	}
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Sun Oct 08 18:55:12 2006 -0600
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Sat Oct 14 13:28:45 2006 -0600
     6.3 @@ -106,7 +106,7 @@ typedef struct netif_st {
     6.4  
     6.5  void netif_disconnect(netif_t *netif);
     6.6  
     6.7 -netif_t *netif_alloc(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN]);
     6.8 +netif_t *netif_alloc(domid_t domid, unsigned int handle);
     6.9  int netif_map(netif_t *netif, unsigned long tx_ring_ref,
    6.10  	      unsigned long rx_ring_ref, unsigned int evtchn);
    6.11  
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Sun Oct 08 18:55:12 2006 -0600
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Sat Oct 14 13:28:45 2006 -0600
     7.3 @@ -62,6 +62,7 @@ static void __netif_down(netif_t *netif)
     7.4  {
     7.5  	disable_irq(netif->irq);
     7.6  	netif_deschedule_work(netif);
     7.7 +	del_timer_sync(&netif->credit_timeout);
     7.8  }
     7.9  
    7.10  static int net_open(struct net_device *dev)
    7.11 @@ -125,7 +126,7 @@ static struct ethtool_ops network_ethtoo
    7.12  	.get_link = ethtool_op_get_link,
    7.13  };
    7.14  
    7.15 -netif_t *netif_alloc(domid_t domid, unsigned int handle, u8 be_mac[ETH_ALEN])
    7.16 +netif_t *netif_alloc(domid_t domid, unsigned int handle)
    7.17  {
    7.18  	int err = 0, i;
    7.19  	struct net_device *dev;
    7.20 @@ -152,6 +153,7 @@ netif_t *netif_alloc(domid_t domid, unsi
    7.21  	netif->credit_bytes = netif->remaining_credit = ~0UL;
    7.22  	netif->credit_usec  = 0UL;
    7.23  	init_timer(&netif->credit_timeout);
    7.24 +	netif->credit_timeout.expires = jiffies;
    7.25  
    7.26  	dev->hard_start_xmit = netif_be_start_xmit;
    7.27  	dev->get_stats       = netif_be_get_stats;
    7.28 @@ -167,20 +169,14 @@ netif_t *netif_alloc(domid_t domid, unsi
    7.29  		printk(KERN_WARNING "netbk: WARNING: device '%s' has non-zero "
    7.30  		       "queue length (%lu)!\n", dev->name, dev->tx_queue_len);
    7.31  
    7.32 -	for (i = 0; i < ETH_ALEN; i++)
    7.33 -		if (be_mac[i] != 0)
    7.34 -			break;
    7.35 -	if (i == ETH_ALEN) {
    7.36 -		/*
    7.37 -		 * Initialise a dummy MAC address. We choose the numerically
    7.38 -		 * largest non-broadcast address to prevent the address getting
    7.39 -		 * stolen by an Ethernet bridge for STP purposes.
    7.40 -		 * (FE:FF:FF:FF:FF:FF)
    7.41 -		 */ 
    7.42 -		memset(dev->dev_addr, 0xFF, ETH_ALEN);
    7.43 -		dev->dev_addr[0] &= ~0x01;
    7.44 -	} else
    7.45 -		memcpy(dev->dev_addr, be_mac, ETH_ALEN);
    7.46 +	/*
    7.47 +	 * Initialise a dummy MAC address. We choose the numerically
    7.48 +	 * largest non-broadcast address to prevent the address getting
    7.49 +	 * stolen by an Ethernet bridge for STP purposes.
    7.50 +	 * (FE:FF:FF:FF:FF:FF)
    7.51 +	 */ 
    7.52 +	memset(dev->dev_addr, 0xFF, ETH_ALEN);
    7.53 +	dev->dev_addr[0] &= ~0x01;
    7.54  
    7.55  	rtnl_lock();
    7.56  	err = register_netdevice(dev);
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Sun Oct 08 18:55:12 2006 -0600
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Sat Oct 14 13:28:45 2006 -0600
     8.3 @@ -70,14 +70,15 @@ static struct timer_list net_timer;
     8.4  
     8.5  static struct sk_buff_head rx_queue;
     8.6  
     8.7 -static unsigned long mmap_vstart;
     8.8 -#define MMAP_VADDR(_req) (mmap_vstart + ((_req) * PAGE_SIZE))
     8.9 -
    8.10 -static void *rx_mmap_area;
    8.11 +static struct page **mmap_pages;
    8.12 +static inline unsigned long idx_to_kaddr(unsigned int idx)
    8.13 +{
    8.14 +	return (unsigned long)pfn_to_kaddr(page_to_pfn(mmap_pages[idx]));
    8.15 +}
    8.16  
    8.17  #define PKT_PROT_LEN 64
    8.18  
    8.19 -static struct {
    8.20 +static struct pending_tx_info {
    8.21  	netif_tx_request_t req;
    8.22  	netif_t *netif;
    8.23  } pending_tx_info[MAX_PENDING_REQS];
    8.24 @@ -373,14 +374,22 @@ static u16 netbk_gop_frag(netif_t *netif
    8.25  		   flipped. */
    8.26  		meta->copy = 1;
    8.27  		copy_gop = npo->copy + npo->copy_prod++;
    8.28 -		copy_gop->source.domid = DOMID_SELF;
    8.29 +		copy_gop->flags = GNTCOPY_dest_gref;
    8.30 +		if (PageForeign(page)) {
    8.31 +			struct pending_tx_info *src_pend =
    8.32 +				&pending_tx_info[page->index];
    8.33 +			copy_gop->source.domid = src_pend->netif->domid;
    8.34 +			copy_gop->source.u.ref = src_pend->req.gref;
    8.35 +			copy_gop->flags |= GNTCOPY_source_gref;
    8.36 +		} else {
    8.37 +			copy_gop->source.domid = DOMID_SELF;
    8.38 +			copy_gop->source.u.gmfn = old_mfn;
    8.39 +		}
    8.40  		copy_gop->source.offset = offset;
    8.41 -		copy_gop->source.u.gmfn = old_mfn;
    8.42  		copy_gop->dest.domid = netif->domid;
    8.43  		copy_gop->dest.offset = 0;
    8.44  		copy_gop->dest.u.ref = req->gref;
    8.45  		copy_gop->len = size;
    8.46 -		copy_gop->flags = GNTCOPY_dest_gref;
    8.47  	} else {
    8.48  		meta->copy = 0;
    8.49  		if (!xen_feature(XENFEAT_auto_translated_physmap)) {
    8.50 @@ -792,10 +801,27 @@ void netif_deschedule_work(netif_t *neti
    8.51  }
    8.52  
    8.53  
    8.54 +static void tx_add_credit(netif_t *netif)
    8.55 +{
    8.56 +	unsigned long max_burst;
    8.57 +
    8.58 +	/*
    8.59 +	 * Allow a burst big enough to transmit a jumbo packet of up to 128kB.
    8.60 +	 * Otherwise the interface can seize up due to insufficient credit.
    8.61 +	 */
    8.62 +	max_burst = RING_GET_REQUEST(&netif->tx, netif->tx.req_cons)->size;
    8.63 +	max_burst = min(max_burst, 131072UL);
    8.64 +	max_burst = max(max_burst, netif->credit_bytes);
    8.65 +
    8.66 +	netif->remaining_credit = min(netif->remaining_credit +
    8.67 +				      netif->credit_bytes,
    8.68 +				      max_burst);
    8.69 +}
    8.70 +
    8.71  static void tx_credit_callback(unsigned long data)
    8.72  {
    8.73  	netif_t *netif = (netif_t *)data;
    8.74 -	netif->remaining_credit = netif->credit_bytes;
    8.75 +	tx_add_credit(netif);
    8.76  	netif_schedule_work(netif);
    8.77  }
    8.78  
    8.79 @@ -819,7 +845,7 @@ inline static void net_tx_action_dealloc
    8.80  	gop = tx_unmap_ops;
    8.81  	while (dc != dp) {
    8.82  		pending_idx = dealloc_ring[MASK_PEND_IDX(dc++)];
    8.83 -		gnttab_set_unmap_op(gop, MMAP_VADDR(pending_idx),
    8.84 +		gnttab_set_unmap_op(gop, idx_to_kaddr(pending_idx),
    8.85  				    GNTMAP_host_map,
    8.86  				    grant_tx_handle[pending_idx]);
    8.87  		gop++;
    8.88 @@ -857,20 +883,28 @@ static void netbk_tx_err(netif_t *netif,
    8.89  	netif_put(netif);
    8.90  }
    8.91  
    8.92 -static int netbk_count_requests(netif_t *netif, netif_tx_request_t *txp,
    8.93 -				int work_to_do)
    8.94 +static int netbk_count_requests(netif_t *netif, netif_tx_request_t *first,
    8.95 +				netif_tx_request_t *txp, int work_to_do)
    8.96  {
    8.97 -	netif_tx_request_t *first = txp;
    8.98  	RING_IDX cons = netif->tx.req_cons;
    8.99  	int frags = 0;
   8.100  
   8.101 -	while (txp->flags & NETTXF_more_data) {
   8.102 +	if (!(first->flags & NETTXF_more_data))
   8.103 +		return 0;
   8.104 +
   8.105 +	do {
   8.106  		if (frags >= work_to_do) {
   8.107  			DPRINTK("Need more frags\n");
   8.108  			return -frags;
   8.109  		}
   8.110  
   8.111 -		txp = RING_GET_REQUEST(&netif->tx, cons + frags);
   8.112 +		if (unlikely(frags >= MAX_SKB_FRAGS)) {
   8.113 +			DPRINTK("Too many frags\n");
   8.114 +			return -frags;
   8.115 +		}
   8.116 +
   8.117 +		memcpy(txp, RING_GET_REQUEST(&netif->tx, cons + frags),
   8.118 +		       sizeof(*txp));
   8.119  		if (txp->size > first->size) {
   8.120  			DPRINTK("Frags galore\n");
   8.121  			return -frags;
   8.122 @@ -884,30 +918,28 @@ static int netbk_count_requests(netif_t 
   8.123  				txp->offset, txp->size);
   8.124  			return -frags;
   8.125  		}
   8.126 -	}
   8.127 +	} while ((txp++)->flags & NETTXF_more_data);
   8.128  
   8.129  	return frags;
   8.130  }
   8.131  
   8.132  static gnttab_map_grant_ref_t *netbk_get_requests(netif_t *netif,
   8.133  						  struct sk_buff *skb,
   8.134 +						  netif_tx_request_t *txp,
   8.135  						  gnttab_map_grant_ref_t *mop)
   8.136  {
   8.137  	struct skb_shared_info *shinfo = skb_shinfo(skb);
   8.138  	skb_frag_t *frags = shinfo->frags;
   8.139 -	netif_tx_request_t *txp;
   8.140  	unsigned long pending_idx = *((u16 *)skb->data);
   8.141 -	RING_IDX cons = netif->tx.req_cons;
   8.142  	int i, start;
   8.143  
   8.144  	/* Skip first skb fragment if it is on same page as header fragment. */
   8.145  	start = ((unsigned long)shinfo->frags[0].page == pending_idx);
   8.146  
   8.147 -	for (i = start; i < shinfo->nr_frags; i++) {
   8.148 -		txp = RING_GET_REQUEST(&netif->tx, cons++);
   8.149 +	for (i = start; i < shinfo->nr_frags; i++, txp++) {
   8.150  		pending_idx = pending_ring[MASK_PEND_IDX(pending_cons++)];
   8.151  
   8.152 -		gnttab_set_map_op(mop++, MMAP_VADDR(pending_idx),
   8.153 +		gnttab_set_map_op(mop++, idx_to_kaddr(pending_idx),
   8.154  				  GNTMAP_host_map | GNTMAP_readonly,
   8.155  				  txp->gref, netif->domid);
   8.156  
   8.157 @@ -940,7 +972,7 @@ static int netbk_tx_check_mop(struct sk_
   8.158  		netif_put(netif);
   8.159  	} else {
   8.160  		set_phys_to_machine(
   8.161 -			__pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT,
   8.162 +			__pa(idx_to_kaddr(pending_idx)) >> PAGE_SHIFT,
   8.163  			FOREIGN_FRAME(mop->dev_bus_addr >> PAGE_SHIFT));
   8.164  		grant_tx_handle[pending_idx] = mop->handle;
   8.165  	}
   8.166 @@ -957,7 +989,7 @@ static int netbk_tx_check_mop(struct sk_
   8.167  		newerr = (++mop)->status;
   8.168  		if (likely(!newerr)) {
   8.169  			set_phys_to_machine(
   8.170 -				__pa(MMAP_VADDR(pending_idx))>>PAGE_SHIFT,
   8.171 +				__pa(idx_to_kaddr(pending_idx))>>PAGE_SHIFT,
   8.172  				FOREIGN_FRAME(mop->dev_bus_addr>>PAGE_SHIFT));
   8.173  			grant_tx_handle[pending_idx] = mop->handle;
   8.174  			/* Had a previous error? Invalidate this fragment. */
   8.175 @@ -1005,7 +1037,7 @@ static void netbk_fill_frags(struct sk_b
   8.176  
   8.177  		pending_idx = (unsigned long)frag->page;
   8.178  		txp = &pending_tx_info[pending_idx].req;
   8.179 -		frag->page = virt_to_page(MMAP_VADDR(pending_idx));
   8.180 +		frag->page = virt_to_page(idx_to_kaddr(pending_idx));
   8.181  		frag->size = txp->size;
   8.182  		frag->page_offset = txp->offset;
   8.183  
   8.184 @@ -1018,7 +1050,7 @@ static void netbk_fill_frags(struct sk_b
   8.185  int netbk_get_extras(netif_t *netif, struct netif_extra_info *extras,
   8.186  		     int work_to_do)
   8.187  {
   8.188 -	struct netif_extra_info *extra;
   8.189 +	struct netif_extra_info extra;
   8.190  	RING_IDX cons = netif->tx.req_cons;
   8.191  
   8.192  	do {
   8.193 @@ -1027,18 +1059,18 @@ int netbk_get_extras(netif_t *netif, str
   8.194  			return -EBADR;
   8.195  		}
   8.196  
   8.197 -		extra = (struct netif_extra_info *)
   8.198 -			RING_GET_REQUEST(&netif->tx, cons);
   8.199 -		if (unlikely(!extra->type ||
   8.200 -			     extra->type >= XEN_NETIF_EXTRA_TYPE_MAX)) {
   8.201 +		memcpy(&extra, RING_GET_REQUEST(&netif->tx, cons),
   8.202 +		       sizeof(extra));
   8.203 +		if (unlikely(!extra.type ||
   8.204 +			     extra.type >= XEN_NETIF_EXTRA_TYPE_MAX)) {
   8.205  			netif->tx.req_cons = ++cons;
   8.206 -			DPRINTK("Invalid extra type: %d\n", extra->type);
   8.207 +			DPRINTK("Invalid extra type: %d\n", extra.type);
   8.208  			return -EINVAL;
   8.209  		}
   8.210  
   8.211 -		memcpy(&extras[extra->type - 1], extra, sizeof(*extra));
   8.212 +		memcpy(&extras[extra.type - 1], &extra, sizeof(extra));
   8.213  		netif->tx.req_cons = ++cons;
   8.214 -	} while (extra->flags & XEN_NETIF_EXTRA_FLAG_MORE);
   8.215 +	} while (extra.flags & XEN_NETIF_EXTRA_FLAG_MORE);
   8.216  
   8.217  	return work_to_do;
   8.218  }
   8.219 @@ -1073,6 +1105,7 @@ static void net_tx_action(unsigned long 
   8.220  	struct sk_buff *skb;
   8.221  	netif_t *netif;
   8.222  	netif_tx_request_t txreq;
   8.223 +	netif_tx_request_t txfrags[MAX_SKB_FRAGS];
   8.224  	struct netif_extra_info extras[XEN_NETIF_EXTRA_TYPE_MAX - 1];
   8.225  	u16 pending_idx;
   8.226  	RING_IDX i;
   8.227 @@ -1101,6 +1134,7 @@ static void net_tx_action(unsigned long 
   8.228  		i = netif->tx.req_cons;
   8.229  		rmb(); /* Ensure that we see the request before we copy it. */
   8.230  		memcpy(&txreq, RING_GET_REQUEST(&netif->tx, i), sizeof(txreq));
   8.231 +
   8.232  		/* Credit-based scheduling. */
   8.233  		if (txreq.size > netif->remaining_credit) {
   8.234  			unsigned long now = jiffies;
   8.235 @@ -1109,25 +1143,27 @@ static void net_tx_action(unsigned long 
   8.236  				msecs_to_jiffies(netif->credit_usec / 1000);
   8.237  
   8.238  			/* Timer could already be pending in rare cases. */
   8.239 -			if (timer_pending(&netif->credit_timeout))
   8.240 -				break;
   8.241 +			if (timer_pending(&netif->credit_timeout)) {
   8.242 +				netif_put(netif);
   8.243 +				continue;
   8.244 +			}
   8.245  
   8.246  			/* Passed the point where we can replenish credit? */
   8.247  			if (time_after_eq(now, next_credit)) {
   8.248  				netif->credit_timeout.expires = now;
   8.249 -				netif->remaining_credit = netif->credit_bytes;
   8.250 +				tx_add_credit(netif);
   8.251  			}
   8.252  
   8.253  			/* Still too big to send right now? Set a callback. */
   8.254  			if (txreq.size > netif->remaining_credit) {
   8.255 -				netif->remaining_credit = 0;
   8.256  				netif->credit_timeout.data     =
   8.257  					(unsigned long)netif;
   8.258  				netif->credit_timeout.function =
   8.259  					tx_credit_callback;
   8.260  				__mod_timer(&netif->credit_timeout,
   8.261  					    next_credit);
   8.262 -				break;
   8.263 +				netif_put(netif);
   8.264 +				continue;
   8.265  			}
   8.266  		}
   8.267  		netif->remaining_credit -= txreq.size;
   8.268 @@ -1146,19 +1182,13 @@ static void net_tx_action(unsigned long 
   8.269  			}
   8.270  		}
   8.271  
   8.272 -		ret = netbk_count_requests(netif, &txreq, work_to_do);
   8.273 +		ret = netbk_count_requests(netif, &txreq, txfrags, work_to_do);
   8.274  		if (unlikely(ret < 0)) {
   8.275  			netbk_tx_err(netif, &txreq, i - ret);
   8.276  			continue;
   8.277  		}
   8.278  		i += ret;
   8.279  
   8.280 -		if (unlikely(ret > MAX_SKB_FRAGS)) {
   8.281 -			DPRINTK("Too many frags\n");
   8.282 -			netbk_tx_err(netif, &txreq, i);
   8.283 -			continue;
   8.284 -		}
   8.285 -
   8.286  		if (unlikely(txreq.size < ETH_HLEN)) {
   8.287  			DPRINTK("Bad packet size: %d\n", txreq.size);
   8.288  			netbk_tx_err(netif, &txreq, i);
   8.289 @@ -1201,7 +1231,7 @@ static void net_tx_action(unsigned long 
   8.290  			}
   8.291  		}
   8.292  
   8.293 -		gnttab_set_map_op(mop, MMAP_VADDR(pending_idx),
   8.294 +		gnttab_set_map_op(mop, idx_to_kaddr(pending_idx),
   8.295  				  GNTMAP_host_map | GNTMAP_readonly,
   8.296  				  txreq.gref, netif->domid);
   8.297  		mop++;
   8.298 @@ -1227,7 +1257,7 @@ static void net_tx_action(unsigned long 
   8.299  
   8.300  		pending_cons++;
   8.301  
   8.302 -		mop = netbk_get_requests(netif, skb, mop);
   8.303 +		mop = netbk_get_requests(netif, skb, txfrags, mop);
   8.304  
   8.305  		netif->tx.req_cons = i;
   8.306  		netif_schedule_work(netif);
   8.307 @@ -1260,8 +1290,8 @@ static void net_tx_action(unsigned long 
   8.308  		}
   8.309  
   8.310  		data_len = skb->len;
   8.311 -		memcpy(skb->data, 
   8.312 -		       (void *)(MMAP_VADDR(pending_idx)|txp->offset),
   8.313 +		memcpy(skb->data,
   8.314 +		       (void *)(idx_to_kaddr(pending_idx)|txp->offset),
   8.315  		       data_len);
   8.316  		if (data_len < txp->size) {
   8.317  			/* Append the packet payload as a fragment. */
   8.318 @@ -1315,18 +1345,10 @@ static void netif_idx_release(u16 pendin
   8.319  
   8.320  static void netif_page_release(struct page *page)
   8.321  {
   8.322 -	u16 pending_idx = page - virt_to_page(mmap_vstart);
   8.323 -
   8.324  	/* Ready for next use. */
   8.325  	set_page_count(page, 1);
   8.326  
   8.327 -	netif_idx_release(pending_idx);
   8.328 -}
   8.329 -
   8.330 -static void netif_rx_page_release(struct page *page)
   8.331 -{
   8.332 -	/* Ready for next use. */
   8.333 -	set_page_count(page, 1);
   8.334 +	netif_idx_release(page->index);
   8.335  }
   8.336  
   8.337  irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs)
   8.338 @@ -1446,27 +1468,17 @@ static int __init netback_init(void)
   8.339  	init_timer(&net_timer);
   8.340  	net_timer.data = 0;
   8.341  	net_timer.function = net_alarm;
   8.342 -    
   8.343 -	page = balloon_alloc_empty_page_range(MAX_PENDING_REQS);
   8.344 -	if (page == NULL)
   8.345 +
   8.346 +	mmap_pages = alloc_empty_pages_and_pagevec(MAX_PENDING_REQS);
   8.347 +	if (mmap_pages == NULL) {
   8.348 +		printk("%s: out of memory\n", __FUNCTION__);
   8.349  		return -ENOMEM;
   8.350 -
   8.351 -	mmap_vstart = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
   8.352 +	}
   8.353  
   8.354  	for (i = 0; i < MAX_PENDING_REQS; i++) {
   8.355 -		page = virt_to_page(MMAP_VADDR(i));
   8.356 -		set_page_count(page, 1);
   8.357 +		page = mmap_pages[i];
   8.358  		SetPageForeign(page, netif_page_release);
   8.359 -	}
   8.360 -
   8.361 -	page = balloon_alloc_empty_page_range(NET_RX_RING_SIZE);
   8.362 -	BUG_ON(page == NULL);
   8.363 -	rx_mmap_area = pfn_to_kaddr(page_to_pfn(page));
   8.364 -
   8.365 -	for (i = 0; i < NET_RX_RING_SIZE; i++) {
   8.366 -		page = virt_to_page(rx_mmap_area + (i * PAGE_SIZE));
   8.367 -		set_page_count(page, 1);
   8.368 -		SetPageForeign(page, netif_rx_page_release);
   8.369 +		page->index = i;
   8.370  	}
   8.371  
   8.372  	pending_cons = 0;
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Sun Oct 08 18:55:12 2006 -0600
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c	Sat Oct 14 13:28:45 2006 -0600
     9.3 @@ -28,29 +28,20 @@
     9.4      printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
     9.5  #endif
     9.6  
     9.7 -struct backend_info
     9.8 -{
     9.9 +struct backend_info {
    9.10  	struct xenbus_device *dev;
    9.11  	netif_t *netif;
    9.12 -	struct xenbus_watch backend_watch;
    9.13  	enum xenbus_state frontend_state;
    9.14  };
    9.15  
    9.16  static int connect_rings(struct backend_info *);
    9.17  static void connect(struct backend_info *);
    9.18 -static void maybe_connect(struct backend_info *);
    9.19 -static void backend_changed(struct xenbus_watch *, const char **,
    9.20 -			    unsigned int);
    9.21 +static void backend_create_netif(struct backend_info *be);
    9.22  
    9.23  static int netback_remove(struct xenbus_device *dev)
    9.24  {
    9.25  	struct backend_info *be = dev->dev.driver_data;
    9.26  
    9.27 -	if (be->backend_watch.node) {
    9.28 -		unregister_xenbus_watch(&be->backend_watch);
    9.29 -		kfree(be->backend_watch.node);
    9.30 -		be->backend_watch.node = NULL;
    9.31 -	}
    9.32  	if (be->netif) {
    9.33  		netif_disconnect(be->netif);
    9.34  		be->netif = NULL;
    9.35 @@ -63,8 +54,7 @@ static int netback_remove(struct xenbus_
    9.36  
    9.37  /**
    9.38   * Entry point to this code when a new device is created.  Allocate the basic
    9.39 - * structures, and watch the store waiting for the hotplug scripts to tell us
    9.40 - * the device's handle.  Switch to InitWait.
    9.41 + * structures and switch to InitWait.
    9.42   */
    9.43  static int netback_probe(struct xenbus_device *dev,
    9.44  			 const struct xenbus_device_id *id)
    9.45 @@ -83,11 +73,6 @@ static int netback_probe(struct xenbus_d
    9.46  	be->dev = dev;
    9.47  	dev->dev.driver_data = be;
    9.48  
    9.49 -	err = xenbus_watch_path2(dev, dev->nodename, "handle",
    9.50 -				 &be->backend_watch, backend_changed);
    9.51 -	if (err)
    9.52 -		goto fail;
    9.53 -
    9.54  	do {
    9.55  		err = xenbus_transaction_start(&xbt);
    9.56  		if (err) {
    9.57 @@ -108,7 +93,8 @@ static int netback_probe(struct xenbus_d
    9.58  			goto abort_transaction;
    9.59  		}
    9.60  
    9.61 -		err = xenbus_printf(xbt, dev->nodename, "feature-rx-copy", "%d", 1);
    9.62 +		err = xenbus_printf(xbt, dev->nodename,
    9.63 +				    "feature-rx-copy", "%d", 1);
    9.64  		if (err) {
    9.65  			message = "writing feature-copying";
    9.66  			goto abort_transaction;
    9.67 @@ -123,9 +109,11 @@ static int netback_probe(struct xenbus_d
    9.68  	}
    9.69  
    9.70  	err = xenbus_switch_state(dev, XenbusStateInitWait);
    9.71 -	if (err) {
    9.72 +	if (err)
    9.73  		goto fail;
    9.74 -	}
    9.75 +
    9.76 +	/* This kicks hotplug scripts, so do it immediately. */
    9.77 +	backend_create_netif(be);
    9.78  
    9.79  	return 0;
    9.80  
    9.81 @@ -175,48 +163,30 @@ static int netback_uevent(struct xenbus_
    9.82  }
    9.83  
    9.84  
    9.85 -/**
    9.86 - * Callback received when the hotplug scripts have placed the handle node.
    9.87 - * Read it, and create a netif structure.  If the frontend is ready, connect.
    9.88 - */
    9.89 -static void backend_changed(struct xenbus_watch *watch,
    9.90 -			    const char **vec, unsigned int len)
    9.91 +static void backend_create_netif(struct backend_info *be)
    9.92  {
    9.93  	int err;
    9.94  	long handle;
    9.95 -	struct backend_info *be
    9.96 -		= container_of(watch, struct backend_info, backend_watch);
    9.97  	struct xenbus_device *dev = be->dev;
    9.98  
    9.99 -	DPRINTK("");
   9.100 +	if (be->netif != NULL)
   9.101 +		return;
   9.102  
   9.103  	err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle);
   9.104 -	if (XENBUS_EXIST_ERR(err)) {
   9.105 -		/* Since this watch will fire once immediately after it is
   9.106 -		   registered, we expect this.  Ignore it, and wait for the
   9.107 -		   hotplug scripts. */
   9.108 -		return;
   9.109 -	}
   9.110  	if (err != 1) {
   9.111  		xenbus_dev_fatal(dev, err, "reading handle");
   9.112  		return;
   9.113  	}
   9.114  
   9.115 -	if (be->netif == NULL) {
   9.116 -		u8 be_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
   9.117 +	be->netif = netif_alloc(dev->otherend_id, handle);
   9.118 +	if (IS_ERR(be->netif)) {
   9.119 +		err = PTR_ERR(be->netif);
   9.120 +		be->netif = NULL;
   9.121 +		xenbus_dev_fatal(dev, err, "creating interface");
   9.122 +		return;
   9.123 +	}
   9.124  
   9.125 -		be->netif = netif_alloc(dev->otherend_id, handle, be_mac);
   9.126 -		if (IS_ERR(be->netif)) {
   9.127 -			err = PTR_ERR(be->netif);
   9.128 -			be->netif = NULL;
   9.129 -			xenbus_dev_fatal(dev, err, "creating interface");
   9.130 -			return;
   9.131 -		}
   9.132 -
   9.133 -		kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
   9.134 -
   9.135 -		maybe_connect(be);
   9.136 -	}
   9.137 +	kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
   9.138  }
   9.139  
   9.140  
   9.141 @@ -249,11 +219,9 @@ static void frontend_changed(struct xenb
   9.142  		break;
   9.143  
   9.144  	case XenbusStateConnected:
   9.145 -		if (!be->netif) {
   9.146 -			/* reconnect: setup be->netif */
   9.147 -			backend_changed(&be->backend_watch, NULL, 0);
   9.148 -		}
   9.149 -		maybe_connect(be);
   9.150 +		backend_create_netif(be);
   9.151 +		if (be->netif)
   9.152 +			connect(be);
   9.153  		break;
   9.154  
   9.155  	case XenbusStateClosing:
   9.156 @@ -279,15 +247,6 @@ static void frontend_changed(struct xenb
   9.157  }
   9.158  
   9.159  
   9.160 -/* ** Connection ** */
   9.161 -
   9.162 -
   9.163 -static void maybe_connect(struct backend_info *be)
   9.164 -{
   9.165 -	if (be->netif && (be->frontend_state == XenbusStateConnected))
   9.166 -		connect(be);
   9.167 -}
   9.168 -
   9.169  static void xen_net_read_rate(struct xenbus_device *dev,
   9.170  			      unsigned long *bytes, unsigned long *usec)
   9.171  {
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Sun Oct 08 18:55:12 2006 -0600
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Sat Oct 14 13:28:45 2006 -0600
    10.3 @@ -47,6 +47,7 @@
    10.4  #include <linux/in.h>
    10.5  #include <linux/if_ether.h>
    10.6  #include <linux/io.h>
    10.7 +#include <linux/moduleparam.h>
    10.8  #include <net/sock.h>
    10.9  #include <net/pkt_sched.h>
   10.10  #include <net/arp.h>
   10.11 @@ -85,17 +86,42 @@ static const int MODPARM_rx_flip = 0;
   10.12  #define RX_COPY_THRESHOLD 256
   10.13  
   10.14  /* If we don't have GSO, fake things up so that we never try to use it. */
   10.15 -#ifndef NETIF_F_GSO
   10.16 -#define netif_needs_gso(dev, skb)	0
   10.17 -#define dev_disable_gso_features(dev)	((void)0)
   10.18 -#else
   10.19 +#if defined(NETIF_F_GSO)
   10.20  #define HAVE_GSO			1
   10.21 +#define HAVE_TSO			1 /* TSO is a subset of GSO */
   10.22  static inline void dev_disable_gso_features(struct net_device *dev)
   10.23  {
   10.24  	/* Turn off all GSO bits except ROBUST. */
   10.25  	dev->features &= (1 << NETIF_F_GSO_SHIFT) - 1;
   10.26  	dev->features |= NETIF_F_GSO_ROBUST;
   10.27  }
   10.28 +#elif defined(NETIF_F_TSO)
   10.29 +#define HAVE_TSO                       1
   10.30 +#define gso_size tso_size
   10.31 +#define gso_segs tso_segs
   10.32 +static inline void dev_disable_gso_features(struct net_device *dev)
   10.33 +{
   10.34 +       /* Turn off all TSO bits. */
   10.35 +       dev->features &= ~NETIF_F_TSO;
   10.36 +}
   10.37 +static inline int skb_is_gso(const struct sk_buff *skb)
   10.38 +{
   10.39 +        return skb_shinfo(skb)->tso_size;
   10.40 +}
   10.41 +static inline int skb_gso_ok(struct sk_buff *skb, int features)
   10.42 +{
   10.43 +        return (features & NETIF_F_TSO);
   10.44 +}
   10.45 +
   10.46 +static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
   10.47 +{
   10.48 +        return skb_is_gso(skb) &&
   10.49 +               (!skb_gso_ok(skb, dev->features) ||
   10.50 +                unlikely(skb->ip_summed != CHECKSUM_HW));
   10.51 +}
   10.52 +#else
   10.53 +#define netif_needs_gso(dev, skb)	0
   10.54 +#define dev_disable_gso_features(dev)	((void)0)
   10.55  #endif
   10.56  
   10.57  #define GRANT_INVALID_REF	0
   10.58 @@ -115,7 +141,6 @@ struct netfront_info {
   10.59  	spinlock_t   tx_lock;
   10.60  	spinlock_t   rx_lock;
   10.61  
   10.62 -	unsigned int handle;
   10.63  	unsigned int evtchn, irq;
   10.64  	unsigned int copying_receiver;
   10.65  
   10.66 @@ -139,7 +164,7 @@ struct netfront_info {
   10.67  	grant_ref_t gref_tx_head;
   10.68  	grant_ref_t grant_tx_ref[NET_TX_RING_SIZE + 1];
   10.69  	grant_ref_t gref_rx_head;
   10.70 -	grant_ref_t grant_rx_ref[NET_TX_RING_SIZE];
   10.71 +	grant_ref_t grant_rx_ref[NET_RX_RING_SIZE];
   10.72  
   10.73  	struct xenbus_device *xbdev;
   10.74  	int tx_ring_ref;
   10.75 @@ -204,9 +229,8 @@ static inline grant_ref_t xennet_get_rx_
   10.76  #define WPRINTK(fmt, args...)				\
   10.77  	printk(KERN_WARNING "netfront: " fmt, ##args)
   10.78  
   10.79 -static int talk_to_backend(struct xenbus_device *, struct netfront_info *);
   10.80  static int setup_device(struct xenbus_device *, struct netfront_info *);
   10.81 -static struct net_device *create_netdev(int, int, struct xenbus_device *);
   10.82 +static struct net_device *create_netdev(struct xenbus_device *);
   10.83  
   10.84  static void netfront_closing(struct xenbus_device *);
   10.85  
   10.86 @@ -216,7 +240,7 @@ static int open_netdev(struct netfront_i
   10.87  static void close_netdev(struct netfront_info *);
   10.88  static void netif_free(struct netfront_info *);
   10.89  
   10.90 -static void network_connect(struct net_device *);
   10.91 +static int network_connect(struct net_device *);
   10.92  static void network_tx_buf_gc(struct net_device *);
   10.93  static void network_alloc_rx_buffers(struct net_device *);
   10.94  static int send_fake_arp(struct net_device *);
   10.95 @@ -239,8 +263,7 @@ static inline int xennet_can_sg(struct n
   10.96  /**
   10.97   * Entry point to this code when a new device is created.  Allocate the basic
   10.98   * structures and the ring buffers for communication with the backend, and
   10.99 - * inform the backend of the appropriate details for those.  Switch to
  10.100 - * Connected state.
  10.101 + * inform the backend of the appropriate details for those.
  10.102   */
  10.103  static int __devinit netfront_probe(struct xenbus_device *dev,
  10.104  				    const struct xenbus_device_id *id)
  10.105 @@ -248,32 +271,8 @@ static int __devinit netfront_probe(stru
  10.106  	int err;
  10.107  	struct net_device *netdev;
  10.108  	struct netfront_info *info;
  10.109 -	unsigned int handle, feature_rx_copy, feature_rx_flip, use_copy;
  10.110  
  10.111 -	err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%u", &handle);
  10.112 -	if (err != 1) {
  10.113 -		xenbus_dev_fatal(dev, err, "reading handle");
  10.114 -		return err;
  10.115 -	}
  10.116 -
  10.117 -	err = xenbus_scanf(XBT_NIL, dev->otherend, "feature-rx-copy", "%u",
  10.118 -			   &feature_rx_copy);
  10.119 -	if (err != 1)
  10.120 -		feature_rx_copy = 0;
  10.121 -	err = xenbus_scanf(XBT_NIL, dev->otherend, "feature-rx-flip", "%u",
  10.122 -			   &feature_rx_flip);
  10.123 -	if (err != 1)
  10.124 -		feature_rx_flip = 1;
  10.125 -
  10.126 -	/*
  10.127 -	 * Copy packets on receive path if:
  10.128 -	 *  (a) This was requested by user, and the backend supports it; or
  10.129 -	 *  (b) Flipping was requested, but this is unsupported by the backend.
  10.130 -	 */
  10.131 -	use_copy = (MODPARM_rx_copy && feature_rx_copy) ||
  10.132 -		(MODPARM_rx_flip && !feature_rx_flip);
  10.133 -
  10.134 -	netdev = create_netdev(handle, use_copy, dev);
  10.135 +	netdev = create_netdev(dev);
  10.136  	if (IS_ERR(netdev)) {
  10.137  		err = PTR_ERR(netdev);
  10.138  		xenbus_dev_fatal(dev, err, "creating netdev");
  10.139 @@ -283,23 +282,13 @@ static int __devinit netfront_probe(stru
  10.140  	info = netdev_priv(netdev);
  10.141  	dev->dev.driver_data = info;
  10.142  
  10.143 -	err = talk_to_backend(dev, info);
  10.144 -	if (err)
  10.145 -		goto fail_backend;
  10.146 -
  10.147  	err = open_netdev(info);
  10.148  	if (err)
  10.149 -		goto fail_open;
  10.150 -
  10.151 -	IPRINTK("Created netdev %s with %sing receive path.\n",
  10.152 -		netdev->name, info->copying_receiver ? "copy" : "flipp");
  10.153 +		goto fail;
  10.154  
  10.155  	return 0;
  10.156  
  10.157 - fail_open:
  10.158 -	xennet_sysfs_delif(info->netdev);
  10.159 -	unregister_netdev(netdev);
  10.160 - fail_backend:
  10.161 + fail:
  10.162  	free_netdev(netdev);
  10.163  	dev->dev.driver_data = NULL;
  10.164  	return err;
  10.165 @@ -319,7 +308,7 @@ static int netfront_resume(struct xenbus
  10.166  	DPRINTK("%s\n", dev->nodename);
  10.167  
  10.168  	netif_disconnect_backend(info);
  10.169 -	return talk_to_backend(dev, info);
  10.170 +	return 0;
  10.171  }
  10.172  
  10.173  static int xen_net_read_mac(struct xenbus_device *dev, u8 mac[])
  10.174 @@ -408,7 +397,7 @@ again:
  10.175  		goto abort_transaction;
  10.176  	}
  10.177  
  10.178 -#ifdef HAVE_GSO
  10.179 +#ifdef HAVE_TSO
  10.180  	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d", 1);
  10.181  	if (err) {
  10.182  		message = "writing feature-gso-tcpv4";
  10.183 @@ -430,7 +419,7 @@ again:
  10.184  	xenbus_transaction_end(xbt, 1);
  10.185  	xenbus_dev_fatal(dev, err, "%s", message);
  10.186   destroy_ring:
  10.187 -	netif_free(info);
  10.188 +	netif_disconnect_backend(info);
  10.189   out:
  10.190  	return err;
  10.191  }
  10.192 @@ -520,7 +509,10 @@ static void backend_changed(struct xenbu
  10.193  		break;
  10.194  
  10.195  	case XenbusStateInitWait:
  10.196 -		network_connect(netdev);
  10.197 +		if (network_connect(netdev) != 0) {
  10.198 +			netif_free(np);
  10.199 +			break;
  10.200 +		}
  10.201  		xenbus_switch_state(dev, XenbusStateConnected);
  10.202  		(void)send_fake_arp(netdev);
  10.203  		break;
  10.204 @@ -940,7 +932,7 @@ static int network_start_xmit(struct sk_
  10.205  		tx->flags |= NETTXF_data_validated;
  10.206  #endif
  10.207  
  10.208 -#ifdef HAVE_GSO
  10.209 +#ifdef HAVE_TSO
  10.210  	if (skb_shinfo(skb)->gso_size) {
  10.211  		struct netif_extra_info *gso = (struct netif_extra_info *)
  10.212  			RING_GET_REQUEST(&np->tx, ++i);
  10.213 @@ -1094,6 +1086,7 @@ static int xennet_get_responses(struct n
  10.214  			if (net_ratelimit())
  10.215  				WPRINTK("rx->offset: %x, size: %u\n",
  10.216  					rx->offset, rx->status);
  10.217 +			xennet_move_rx_slot(np, skb, ref);
  10.218  			err = -EINVAL;
  10.219  			goto next;
  10.220  		}
  10.221 @@ -1104,7 +1097,8 @@ static int xennet_get_responses(struct n
  10.222  		 * situation to the system controller to reboot the backed.
  10.223  		 */
  10.224  		if (ref == GRANT_INVALID_REF) {
  10.225 -			WPRINTK("Bad rx response id %d.\n", rx->id);
  10.226 +			if (net_ratelimit())
  10.227 +				WPRINTK("Bad rx response id %d.\n", rx->id);
  10.228  			err = -EINVAL;
  10.229  			goto next;
  10.230  		}
  10.231 @@ -1176,6 +1170,9 @@ next:
  10.232  		err = -E2BIG;
  10.233  	}
  10.234  
  10.235 +	if (unlikely(err))
  10.236 +		np->rx.rsp_cons = cons + frags;
  10.237 +
  10.238  	*pages_flipped_p = pages_flipped;
  10.239  
  10.240  	return err;
  10.241 @@ -1228,12 +1225,14 @@ static int xennet_set_skb_gso(struct sk_
  10.242  		return -EINVAL;
  10.243  	}
  10.244  
  10.245 +#ifdef HAVE_TSO
  10.246 +	skb_shinfo(skb)->gso_size = gso->u.gso.size;
  10.247  #ifdef HAVE_GSO
  10.248 -	skb_shinfo(skb)->gso_size = gso->u.gso.size;
  10.249  	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
  10.250  
  10.251  	/* Header must be checked, and gso_segs computed. */
  10.252  	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
  10.253 +#endif
  10.254  	skb_shinfo(skb)->gso_segs = 0;
  10.255  
  10.256  	return 0;
  10.257 @@ -1278,9 +1277,9 @@ static int netif_poll(struct net_device 
  10.258  	rp = np->rx.sring->rsp_prod;
  10.259  	rmb(); /* Ensure we see queued responses up to 'rp'. */
  10.260  
  10.261 -	for (i = np->rx.rsp_cons, work_done = 0;
  10.262 -	     (i != rp) && (work_done < budget);
  10.263 -	     np->rx.rsp_cons = ++i, work_done++) {
  10.264 +	i = np->rx.rsp_cons;
  10.265 +	work_done = 0;
  10.266 +	while ((i != rp) && (work_done < budget)) {
  10.267  		memcpy(rx, RING_GET_RESPONSE(&np->rx, i), sizeof(*rx));
  10.268  		memset(extras, 0, sizeof(extras));
  10.269  
  10.270 @@ -1288,12 +1287,11 @@ static int netif_poll(struct net_device 
  10.271  					   &pages_flipped);
  10.272  
  10.273  		if (unlikely(err)) {
  10.274 -err:
  10.275 -			i = np->rx.rsp_cons + skb_queue_len(&tmpq) - 1;
  10.276 -			work_done--;
  10.277 +err:	
  10.278  			while ((skb = __skb_dequeue(&tmpq)))
  10.279  				__skb_queue_tail(&errq, skb);
  10.280  			np->stats.rx_errors++;
  10.281 +			i = np->rx.rsp_cons;
  10.282  			continue;
  10.283  		}
  10.284  
  10.285 @@ -1305,6 +1303,7 @@ err:
  10.286  
  10.287  			if (unlikely(xennet_set_skb_gso(skb, gso))) {
  10.288  				__skb_queue_head(&tmpq, skb);
  10.289 +				np->rx.rsp_cons += skb_queue_len(&tmpq);
  10.290  				goto err;
  10.291  			}
  10.292  		}
  10.293 @@ -1368,6 +1367,9 @@ err:
  10.294  		np->stats.rx_bytes += skb->len;
  10.295  
  10.296  		__skb_queue_tail(&rxq, skb);
  10.297 +
  10.298 +		np->rx.rsp_cons = ++i;
  10.299 +		work_done++;
  10.300  	}
  10.301  
  10.302  	if (pages_flipped) {
  10.303 @@ -1584,7 +1586,7 @@ static int xennet_set_sg(struct net_devi
  10.304  
  10.305  static int xennet_set_tso(struct net_device *dev, u32 data)
  10.306  {
  10.307 -#ifdef HAVE_GSO
  10.308 +#ifdef HAVE_TSO
  10.309  	if (data) {
  10.310  		struct netfront_info *np = netdev_priv(dev);
  10.311  		int val;
  10.312 @@ -1615,16 +1617,41 @@ static void xennet_set_features(struct n
  10.313  		xennet_set_tso(dev, 1);
  10.314  }
  10.315  
  10.316 -static void network_connect(struct net_device *dev)
  10.317 +static int network_connect(struct net_device *dev)
  10.318  {
  10.319  	struct netfront_info *np = netdev_priv(dev);
  10.320 -	int i, requeue_idx;
  10.321 +	int i, requeue_idx, err;
  10.322  	struct sk_buff *skb;
  10.323  	grant_ref_t ref;
  10.324  	netif_rx_request_t *req;
  10.325 +	unsigned int feature_rx_copy, feature_rx_flip;
  10.326 +
  10.327 +	err = xenbus_scanf(XBT_NIL, np->xbdev->otherend,
  10.328 +			   "feature-rx-copy", "%u", &feature_rx_copy);
  10.329 +	if (err != 1)
  10.330 +		feature_rx_copy = 0;
  10.331 +	err = xenbus_scanf(XBT_NIL, np->xbdev->otherend,
  10.332 +			   "feature-rx-flip", "%u", &feature_rx_flip);
  10.333 +	if (err != 1)
  10.334 +		feature_rx_flip = 1;
  10.335 +
  10.336 +	/*
  10.337 +	 * Copy packets on receive path if:
  10.338 +	 *  (a) This was requested by user, and the backend supports it; or
  10.339 +	 *  (b) Flipping was requested, but this is unsupported by the backend.
  10.340 +	 */
  10.341 +	np->copying_receiver = ((MODPARM_rx_copy && feature_rx_copy) ||
  10.342 +				(MODPARM_rx_flip && !feature_rx_flip));
  10.343 +
  10.344 +	err = talk_to_backend(np->xbdev, np);
  10.345 +	if (err)
  10.346 +		return err;
  10.347  
  10.348  	xennet_set_features(dev);
  10.349  
  10.350 +	IPRINTK("device %s has %sing receive path.\n",
  10.351 +		dev->name, np->copying_receiver ? "copy" : "flipp");
  10.352 +
  10.353  	spin_lock_irq(&np->tx_lock);
  10.354  	spin_lock(&np->rx_lock);
  10.355  
  10.356 @@ -1680,6 +1707,8 @@ static void network_connect(struct net_d
  10.357  
  10.358  	spin_unlock(&np->rx_lock);
  10.359  	spin_unlock_irq(&np->tx_lock);
  10.360 +
  10.361 +	return 0;
  10.362  }
  10.363  
  10.364  static void netif_uninit(struct net_device *dev)
  10.365 @@ -1845,8 +1874,7 @@ static void network_set_multicast_list(s
  10.366  {
  10.367  }
  10.368  
  10.369 -static struct net_device * __devinit
  10.370 -create_netdev(int handle, int copying_receiver, struct xenbus_device *dev)
  10.371 +static struct net_device * __devinit create_netdev(struct xenbus_device *dev)
  10.372  {
  10.373  	int i, err = 0;
  10.374  	struct net_device *netdev = NULL;
  10.375 @@ -1860,9 +1888,7 @@ create_netdev(int handle, int copying_re
  10.376  	}
  10.377  
  10.378  	np                   = netdev_priv(netdev);
  10.379 -	np->handle           = handle;
  10.380  	np->xbdev            = dev;
  10.381 -	np->copying_receiver = copying_receiver;
  10.382  
  10.383  	netif_carrier_off(netdev);
  10.384  
  10.385 @@ -1993,10 +2019,12 @@ static int open_netdev(struct netfront_i
  10.386  
  10.387  	err = xennet_sysfs_addif(info->netdev);
  10.388  	if (err) {
  10.389 -		/* This can be non-fatal: it only means no tuning parameters */
  10.390 +		unregister_netdev(info->netdev);
  10.391  		printk(KERN_WARNING "%s: add sysfs failed err=%d\n",
  10.392  		       __FUNCTION__, err);
  10.393 +		return err;
  10.394  	}
  10.395 +
  10.396  	return 0;
  10.397  }
  10.398  
    11.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Sun Oct 08 18:55:12 2006 -0600
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Sat Oct 14 13:28:45 2006 -0600
    11.3 @@ -35,6 +35,10 @@
    11.4  static struct proc_dir_entry *privcmd_intf;
    11.5  static struct proc_dir_entry *capabilities_intf;
    11.6  
    11.7 +#ifndef HAVE_ARCH_PRIVCMD_MMAP
    11.8 +static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma);
    11.9 +#endif
   11.10 +
   11.11  static int privcmd_ioctl(struct inode *inode, struct file *file,
   11.12  			 unsigned int cmd, unsigned long data)
   11.13  {
   11.14 @@ -89,10 +93,12 @@ static int privcmd_ioctl(struct inode *i
   11.15  	break;
   11.16  
   11.17  	case IOCTL_PRIVCMD_MMAP: {
   11.18 -#define PRIVCMD_MMAP_SZ 32
   11.19  		privcmd_mmap_t mmapcmd;
   11.20 -		privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ];
   11.21 +		privcmd_mmap_entry_t msg;
   11.22  		privcmd_mmap_entry_t __user *p;
   11.23 +		struct mm_struct *mm = current->mm;
   11.24 +		struct vm_area_struct *vma;
   11.25 +		unsigned long va;
   11.26  		int i, rc;
   11.27  
   11.28  		if (!is_initial_xendomain())
   11.29 @@ -102,47 +108,60 @@ static int privcmd_ioctl(struct inode *i
   11.30  			return -EFAULT;
   11.31  
   11.32  		p = mmapcmd.entry;
   11.33 +		if (copy_from_user(&msg, p, sizeof(msg)))
   11.34 +			return -EFAULT;
   11.35  
   11.36 -		for (i = 0; i < mmapcmd.num;
   11.37 -		     i += PRIVCMD_MMAP_SZ, p += PRIVCMD_MMAP_SZ) {
   11.38 -			int j, n = ((mmapcmd.num-i)>PRIVCMD_MMAP_SZ)?
   11.39 -				PRIVCMD_MMAP_SZ:(mmapcmd.num-i);
   11.40 +		down_read(&mm->mmap_sem);
   11.41 +
   11.42 +		vma = find_vma(mm, msg.va);
   11.43 +		rc = -EINVAL;
   11.44 +		if (!vma || (msg.va != vma->vm_start) ||
   11.45 +		    !privcmd_enforce_singleshot_mapping(vma))
   11.46 +			goto mmap_out;
   11.47  
   11.48 -			if (copy_from_user(&msg, p,
   11.49 -					   n*sizeof(privcmd_mmap_entry_t)))
   11.50 -				return -EFAULT;
   11.51 -     
   11.52 -			for (j = 0; j < n; j++) {
   11.53 -				struct vm_area_struct *vma = 
   11.54 -					find_vma( current->mm, msg[j].va );
   11.55 +		va = vma->vm_start;
   11.56  
   11.57 -				if (!vma)
   11.58 -					return -EINVAL;
   11.59 +		for (i = 0; i < mmapcmd.num; i++) {
   11.60 +			rc = -EFAULT;
   11.61 +			if (copy_from_user(&msg, p, sizeof(msg)))
   11.62 +				goto mmap_out;
   11.63 +
   11.64 +			/* Do not allow range to wrap the address space. */
   11.65 +			rc = -EINVAL;
   11.66 +			if ((msg.npages > (LONG_MAX >> PAGE_SHIFT)) ||
   11.67 +			    ((unsigned long)(msg.npages << PAGE_SHIFT) >= -va))
   11.68 +				goto mmap_out;
   11.69  
   11.70 -				if (msg[j].va > PAGE_OFFSET)
   11.71 -					return -EINVAL;
   11.72 -
   11.73 -				if ((msg[j].va + (msg[j].npages << PAGE_SHIFT))
   11.74 -				    > vma->vm_end )
   11.75 -					return -EINVAL;
   11.76 +			/* Range chunks must be contiguous in va space. */
   11.77 +			if ((msg.va != va) ||
   11.78 +			    ((msg.va+(msg.npages<<PAGE_SHIFT)) > vma->vm_end))
   11.79 +				goto mmap_out;
   11.80  
   11.81 -				if ((rc = direct_remap_pfn_range(
   11.82 -					vma,
   11.83 -					msg[j].va&PAGE_MASK, 
   11.84 -					msg[j].mfn, 
   11.85 -					msg[j].npages<<PAGE_SHIFT, 
   11.86 -					vma->vm_page_prot,
   11.87 -					mmapcmd.dom)) < 0)
   11.88 -					return rc;
   11.89 -			}
   11.90 +			if ((rc = direct_remap_pfn_range(
   11.91 +				vma,
   11.92 +				msg.va & PAGE_MASK, 
   11.93 +				msg.mfn, 
   11.94 +				msg.npages << PAGE_SHIFT, 
   11.95 +				vma->vm_page_prot,
   11.96 +				mmapcmd.dom)) < 0)
   11.97 +				goto mmap_out;
   11.98 +
   11.99 +			p++;
  11.100 +			va += msg.npages << PAGE_SHIFT;
  11.101  		}
  11.102 -		ret = 0;
  11.103 +
  11.104 +		rc = 0;
  11.105 +
  11.106 +	mmap_out:
  11.107 +		up_read(&mm->mmap_sem);
  11.108 +		ret = rc;
  11.109  	}
  11.110  	break;
  11.111  
  11.112  	case IOCTL_PRIVCMD_MMAPBATCH: {
  11.113  		privcmd_mmapbatch_t m;
  11.114 -		struct vm_area_struct *vma = NULL;
  11.115 +		struct mm_struct *mm = current->mm;
  11.116 +		struct vm_area_struct *vma;
  11.117  		xen_pfn_t __user *p;
  11.118  		unsigned long addr, mfn;
  11.119  		int i;
  11.120 @@ -150,37 +169,31 @@ static int privcmd_ioctl(struct inode *i
  11.121  		if (!is_initial_xendomain())
  11.122  			return -EPERM;
  11.123  
  11.124 -		if (copy_from_user(&m, udata, sizeof(m))) {
  11.125 -			ret = -EFAULT;
  11.126 -			goto batch_err;
  11.127 -		}
  11.128 +		if (copy_from_user(&m, udata, sizeof(m)))
  11.129 +			return -EFAULT;
  11.130  
  11.131 -		if (m.dom == DOMID_SELF) {
  11.132 -			ret = -EINVAL;
  11.133 -			goto batch_err;
  11.134 -		}
  11.135 +		if ((m.num <= 0) || (m.num > (LONG_MAX >> PAGE_SHIFT)))
  11.136 +			return -EINVAL;
  11.137 +
  11.138 +		down_read(&mm->mmap_sem);
  11.139  
  11.140 -		vma = find_vma(current->mm, m.addr);
  11.141 -		if (!vma) {
  11.142 -			ret = -EINVAL;
  11.143 -			goto batch_err;
  11.144 -		}
  11.145 -
  11.146 -		if (m.addr > PAGE_OFFSET) {
  11.147 -			ret = -EFAULT;
  11.148 -			goto batch_err;
  11.149 -		}
  11.150 -
  11.151 -		if ((m.addr + (m.num<<PAGE_SHIFT)) > vma->vm_end) {
  11.152 -			ret = -EFAULT;
  11.153 -			goto batch_err;
  11.154 +		vma = find_vma(mm, m.addr);
  11.155 +		if (!vma ||
  11.156 +		    (m.addr != vma->vm_start) ||
  11.157 +		    ((m.addr + ((unsigned long)m.num<<PAGE_SHIFT)) !=
  11.158 +		     vma->vm_end) ||
  11.159 +		    !privcmd_enforce_singleshot_mapping(vma)) {
  11.160 +			up_read(&mm->mmap_sem);
  11.161 +			return -EINVAL;
  11.162  		}
  11.163  
  11.164  		p = m.arr;
  11.165  		addr = m.addr;
  11.166  		for (i = 0; i < m.num; i++, addr += PAGE_SIZE, p++) {
  11.167 -			if (get_user(mfn, p))
  11.168 +			if (get_user(mfn, p)) {
  11.169 +				up_read(&mm->mmap_sem);
  11.170  				return -EFAULT;
  11.171 +			}
  11.172  
  11.173  			ret = direct_remap_pfn_range(vma, addr & PAGE_MASK,
  11.174  						     mfn, PAGE_SIZE,
  11.175 @@ -189,15 +202,8 @@ static int privcmd_ioctl(struct inode *i
  11.176  				put_user(0xF0000000 | mfn, p);
  11.177  		}
  11.178  
  11.179 +		up_read(&mm->mmap_sem);
  11.180  		ret = 0;
  11.181 -		break;
  11.182 -
  11.183 -	batch_err:
  11.184 -		printk("batch_err ret=%d vma=%p addr=%lx "
  11.185 -		       "num=%d arr=%p %lx-%lx\n", 
  11.186 -		       ret, vma, (unsigned long)m.addr, m.num, m.arr,
  11.187 -		       vma ? vma->vm_start : 0, vma ? vma->vm_end : 0);
  11.188 -		break;
  11.189  	}
  11.190  	break;
  11.191  
  11.192 @@ -210,13 +216,35 @@ static int privcmd_ioctl(struct inode *i
  11.193  }
  11.194  
  11.195  #ifndef HAVE_ARCH_PRIVCMD_MMAP
  11.196 +static struct page *privcmd_nopage(struct vm_area_struct *vma,
  11.197 +				   unsigned long address,
  11.198 +				   int *type)
  11.199 +{
  11.200 +	return NOPAGE_SIGBUS;
  11.201 +}
  11.202 +
  11.203 +static struct vm_operations_struct privcmd_vm_ops = {
  11.204 +	.nopage = privcmd_nopage
  11.205 +};
  11.206 +
  11.207  static int privcmd_mmap(struct file * file, struct vm_area_struct * vma)
  11.208  {
  11.209 +	/* Unsupported for auto-translate guests. */
  11.210 +	if (xen_feature(XENFEAT_auto_translated_physmap))
  11.211 +		return -ENOSYS;
  11.212 +
  11.213  	/* DONTCOPY is essential for Xen as copy_page_range is broken. */
  11.214  	vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY;
  11.215 +	vma->vm_ops = &privcmd_vm_ops;
  11.216 +	vma->vm_private_data = NULL;
  11.217  
  11.218  	return 0;
  11.219  }
  11.220 +
  11.221 +static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma)
  11.222 +{
  11.223 +	return (xchg(&vma->vm_private_data, (void *)1) == NULL);
  11.224 +}
  11.225  #endif
  11.226  
  11.227  static struct file_operations privcmd_file_ops = {
    12.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h	Sun Oct 08 18:55:12 2006 -0600
    12.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h	Sat Oct 14 13:28:45 2006 -0600
    12.3 @@ -46,11 +46,10 @@ typedef struct tpmif_st {
    12.4  	atomic_t refcnt;
    12.5  
    12.6  	struct backend_info *bi;
    12.7 -	unsigned long mmap_vstart;
    12.8  
    12.9  	grant_handle_t shmem_handle;
   12.10  	grant_ref_t shmem_ref;
   12.11 -	struct page *pagerange;
   12.12 +	struct page **mmap_pages;
   12.13  
   12.14  	char devname[20];
   12.15  } tpmif_t;
   12.16 @@ -80,6 +79,9 @@ int vtpm_release_packets(tpmif_t * tpmif
   12.17  
   12.18  extern int num_frontends;
   12.19  
   12.20 -#define MMAP_VADDR(t,_req) ((t)->mmap_vstart + ((_req) * PAGE_SIZE))
   12.21 +static inline unsigned long idx_to_kaddr(tpmif_t *t, unsigned int idx)
   12.22 +{
   12.23 +	return (unsigned long)pfn_to_kaddr(page_to_pfn(t->mmap_pages[idx]));
   12.24 +}
   12.25  
   12.26  #endif /* __TPMIF__BACKEND__COMMON_H__ */
    13.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Sun Oct 08 18:55:12 2006 -0600
    13.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Sat Oct 14 13:28:45 2006 -0600
    13.3 @@ -25,8 +25,8 @@ static tpmif_t *alloc_tpmif(domid_t domi
    13.4  	tpmif_t *tpmif;
    13.5  
    13.6  	tpmif = kmem_cache_alloc(tpmif_cachep, GFP_KERNEL);
    13.7 -	if (!tpmif)
    13.8 -		return ERR_PTR(-ENOMEM);
    13.9 +	if (tpmif == NULL)
   13.10 +		goto out_of_memory;
   13.11  
   13.12  	memset(tpmif, 0, sizeof (*tpmif));
   13.13  	tpmif->domid = domid;
   13.14 @@ -35,22 +35,27 @@ static tpmif_t *alloc_tpmif(domid_t domi
   13.15  	snprintf(tpmif->devname, sizeof(tpmif->devname), "tpmif%d", domid);
   13.16  	atomic_set(&tpmif->refcnt, 1);
   13.17  
   13.18 -	tpmif->pagerange = balloon_alloc_empty_page_range(TPMIF_TX_RING_SIZE);
   13.19 -	BUG_ON(tpmif->pagerange == NULL);
   13.20 -	tpmif->mmap_vstart = (unsigned long)pfn_to_kaddr(
   13.21 -	                                    page_to_pfn(tpmif->pagerange));
   13.22 +	tpmif->mmap_pages = alloc_empty_pages_and_pagevec(TPMIF_TX_RING_SIZE);
   13.23 +	if (tpmif->mmap_pages == NULL)
   13.24 +		goto out_of_memory;
   13.25  
   13.26  	list_add(&tpmif->tpmif_list, &tpmif_list);
   13.27  	num_frontends++;
   13.28  
   13.29  	return tpmif;
   13.30 +
   13.31 + out_of_memory:
   13.32 +	if (tpmif != NULL)
   13.33 +		kmem_cache_free(tpmif_cachep, tpmif);
   13.34 +	printk("%s: out of memory\n", __FUNCTION__);
   13.35 +	return ERR_PTR(-ENOMEM);
   13.36  }
   13.37  
   13.38  static void free_tpmif(tpmif_t * tpmif)
   13.39  {
   13.40  	num_frontends--;
   13.41  	list_del(&tpmif->tpmif_list);
   13.42 -	balloon_dealloc_empty_page_range(tpmif->pagerange, TPMIF_TX_RING_SIZE);
   13.43 +	free_empty_pages_and_pagevec(tpmif->mmap_pages, TPMIF_TX_RING_SIZE);
   13.44  	kmem_cache_free(tpmif_cachep, tpmif);
   13.45  }
   13.46  
    14.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Sun Oct 08 18:55:12 2006 -0600
    14.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Sat Oct 14 13:28:45 2006 -0600
    14.3 @@ -253,7 +253,7 @@ int _packet_write(struct packet *pak,
    14.4  			return 0;
    14.5  		}
    14.6  
    14.7 -		gnttab_set_map_op(&map_op, MMAP_VADDR(tpmif, i),
    14.8 +		gnttab_set_map_op(&map_op, idx_to_kaddr(tpmif, i),
    14.9  				  GNTMAP_host_map, tx->ref, tpmif->domid);
   14.10  
   14.11  		if (unlikely(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
   14.12 @@ -270,7 +270,7 @@ int _packet_write(struct packet *pak,
   14.13  
   14.14  		tocopy = min_t(size_t, size - offset, PAGE_SIZE);
   14.15  
   14.16 -		if (copy_from_buffer((void *)(MMAP_VADDR(tpmif, i) |
   14.17 +		if (copy_from_buffer((void *)(idx_to_kaddr(tpmif, i) |
   14.18  					      (tx->addr & ~PAGE_MASK)),
   14.19  				     &data[offset], tocopy, isuserbuffer)) {
   14.20  			tpmif_put(tpmif);
   14.21 @@ -278,7 +278,7 @@ int _packet_write(struct packet *pak,
   14.22  		}
   14.23  		tx->size = tocopy;
   14.24  
   14.25 -		gnttab_set_unmap_op(&unmap_op, MMAP_VADDR(tpmif, i),
   14.26 +		gnttab_set_unmap_op(&unmap_op, idx_to_kaddr(tpmif, i),
   14.27  				    GNTMAP_host_map, handle);
   14.28  
   14.29  		if (unlikely
   14.30 @@ -391,7 +391,7 @@ static int packet_read_shmem(struct pack
   14.31  
   14.32  		tx = &tpmif->tx->ring[i].req;
   14.33  
   14.34 -		gnttab_set_map_op(&map_op, MMAP_VADDR(tpmif, i),
   14.35 +		gnttab_set_map_op(&map_op, idx_to_kaddr(tpmif, i),
   14.36  				  GNTMAP_host_map, tx->ref, tpmif->domid);
   14.37  
   14.38  		if (unlikely(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
   14.39 @@ -414,10 +414,10 @@ static int packet_read_shmem(struct pack
   14.40  		}
   14.41  
   14.42  		DPRINTK("Copying from mapped memory at %08lx\n",
   14.43 -			(unsigned long)(MMAP_VADDR(tpmif, i) |
   14.44 +			(unsigned long)(idx_to_kaddr(tpmif, i) |
   14.45  					(tx->addr & ~PAGE_MASK)));
   14.46  
   14.47 -		src = (void *)(MMAP_VADDR(tpmif, i) |
   14.48 +		src = (void *)(idx_to_kaddr(tpmif, i) |
   14.49  			       ((tx->addr & ~PAGE_MASK) + pg_offset));
   14.50  		if (copy_to_buffer(&buffer[offset],
   14.51  				   src, to_copy, isuserbuffer)) {
   14.52 @@ -428,7 +428,7 @@ static int packet_read_shmem(struct pack
   14.53  			tpmif->domid, buffer[offset], buffer[offset + 1],
   14.54  			buffer[offset + 2], buffer[offset + 3]);
   14.55  
   14.56 -		gnttab_set_unmap_op(&unmap_op, MMAP_VADDR(tpmif, i),
   14.57 +		gnttab_set_unmap_op(&unmap_op, idx_to_kaddr(tpmif, i),
   14.58  				    GNTMAP_host_map, handle);
   14.59  
   14.60  		if (unlikely
    15.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Sun Oct 08 18:55:12 2006 -0600
    15.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Sat Oct 14 13:28:45 2006 -0600
    15.3 @@ -127,6 +127,7 @@ int direct_remap_pfn_range(struct vm_are
    15.4  			   pgprot_t prot,
    15.5  			   domid_t  domid);
    15.6  struct file;
    15.7 +int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma);
    15.8  int privcmd_mmap(struct file * file, struct vm_area_struct * vma);
    15.9  #define HAVE_ARCH_PRIVCMD_MMAP
   15.10  
    16.1 --- a/linux-2.6-xen-sparse/include/xen/balloon.h	Sun Oct 08 18:55:12 2006 -0600
    16.2 +++ b/linux-2.6-xen-sparse/include/xen/balloon.h	Sat Oct 14 13:28:45 2006 -0600
    16.3 @@ -38,23 +38,13 @@
    16.4   * Inform the balloon driver that it should allow some slop for device-driver
    16.5   * memory activities.
    16.6   */
    16.7 -void
    16.8 -balloon_update_driver_allowance(
    16.9 -	long delta);
   16.10 -
   16.11 -/* Allocate an empty low-memory page range. */
   16.12 -struct page *
   16.13 -balloon_alloc_empty_page_range(
   16.14 -	unsigned long nr_pages);
   16.15 +void balloon_update_driver_allowance(long delta);
   16.16  
   16.17 -/* Deallocate an empty page range, adding to the balloon. */
   16.18 -void
   16.19 -balloon_dealloc_empty_page_range(
   16.20 -	struct page *page, unsigned long nr_pages);
   16.21 +/* Allocate/free a set of empty pages in low memory (i.e., no RAM mapped). */
   16.22 +struct page **alloc_empty_pages_and_pagevec(int nr_pages);
   16.23 +void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages);
   16.24  
   16.25 -void
   16.26 -balloon_release_driver_page(
   16.27 -	struct page *page);
   16.28 +void balloon_release_driver_page(struct page *page);
   16.29  
   16.30  /*
   16.31   * Prevent the balloon driver from changing the memory reservation during
    17.1 --- a/linux-2.6-xen-sparse/mm/memory.c	Sun Oct 08 18:55:12 2006 -0600
    17.2 +++ b/linux-2.6-xen-sparse/mm/memory.c	Sat Oct 14 13:28:45 2006 -0600
    17.3 @@ -390,7 +390,7 @@ struct page *vm_normal_page(struct vm_ar
    17.4  
    17.5  	if (vma->vm_flags & VM_PFNMAP) {
    17.6  		unsigned long off = (addr - vma->vm_start) >> PAGE_SHIFT;
    17.7 -		if ((pfn == vma->vm_pgoff + off) || !pfn_valid(pfn))
    17.8 +		if (pfn == vma->vm_pgoff + off)
    17.9  			return NULL;
   17.10  		if (!is_cow_mapping(vma->vm_flags))
   17.11  			return NULL;
   17.12 @@ -405,7 +405,8 @@ struct page *vm_normal_page(struct vm_ar
   17.13  	 * Remove this test eventually!
   17.14  	 */
   17.15  	if (unlikely(!pfn_valid(pfn))) {
   17.16 -		print_bad_pte(vma, pte, addr);
   17.17 +		if (!(vma->vm_flags & VM_RESERVED))
   17.18 +			print_bad_pte(vma, pte, addr);
   17.19  		return NULL;
   17.20  	}
   17.21  
    18.1 --- a/tools/blktap/drivers/Makefile	Sun Oct 08 18:55:12 2006 -0600
    18.2 +++ b/tools/blktap/drivers/Makefile	Sat Oct 14 13:28:45 2006 -0600
    18.3 @@ -10,11 +10,8 @@ QCOW_UTIL    = img2qcow qcow2raw qcow-cr
    18.4  INSTALL_DIR  = /usr/sbin
    18.5  LIBAIO_DIR   = ../../libaio/src
    18.6  
    18.7 -CFLAGS   += -fPIC
    18.8 -CFLAGS   += -Wall
    18.9  CFLAGS   += -Werror
   18.10  CFLAGS   += -Wno-unused
   18.11 -CFLAGS   += -g3
   18.12  CFLAGS   += -fno-strict-aliasing
   18.13  CFLAGS   += -I $(XEN_LIBXC) -I $(LIBAIO_DIR)
   18.14  CFLAGS   += $(INCLUDES) -I. -I../../xenstore 
    19.1 --- a/tools/blktap/drivers/blktapctrl.c	Sun Oct 08 18:55:12 2006 -0600
    19.2 +++ b/tools/blktap/drivers/blktapctrl.c	Sat Oct 14 13:28:45 2006 -0600
    19.3 @@ -74,11 +74,6 @@ static int write_msg(int fd, int msgtype
    19.4  static int read_msg(int fd, int msgtype, void *ptr);
    19.5  static driver_list_entry_t *active_disks[MAX_DISK_TYPES];
    19.6  
    19.7 -void sig_handler(int sig)
    19.8 -{
    19.9 -	run = 0;	
   19.10 -}
   19.11 -
   19.12  static void init_driver_list(void)
   19.13  {
   19.14  	int i;
   19.15 @@ -669,6 +664,7 @@ int main(int argc, char *argv[])
   19.16  		goto open_failed;
   19.17  	}
   19.18  
   19.19 +
   19.20   retry:
   19.21  	/* Set up store connection and watch. */
   19.22  	h = xs_daemon_open();
   19.23 @@ -682,15 +678,11 @@ int main(int argc, char *argv[])
   19.24                  } else goto open_failed;
   19.25  	}
   19.26  	
   19.27 -	ret = add_blockdevice_probe_watch(h, "Domain-0");
   19.28 +	ret = setup_probe_watch(h);
   19.29  	if (ret != 0) {
   19.30  		DPRINTF("Failed adding device probewatch\n");
   19.31 -                if (count < MAX_ATTEMPTS) {
   19.32 -                        count++;
   19.33 -                        sleep(2);
   19.34 -                        xs_daemon_close(h);
   19.35 -                        goto retry;
   19.36 -                } else goto open_failed;
   19.37 +		xs_daemon_close(h);
   19.38 +		goto open_failed;
   19.39  	}
   19.40  
   19.41  	ioctl(ctlfd, BLKTAP_IOCTL_SETMODE, BLKTAP_MODE_INTERPOSE );
    20.1 --- a/tools/blktap/lib/blktaplib.h	Sun Oct 08 18:55:12 2006 -0600
    20.2 +++ b/tools/blktap/lib/blktaplib.h	Sat Oct 14 13:28:45 2006 -0600
    20.3 @@ -193,8 +193,8 @@ typedef struct msg_pid {
    20.4  #define CTLMSG_PID_RSP     10
    20.5  
    20.6  /* xenstore/xenbus: */
    20.7 -extern int add_blockdevice_probe_watch(struct xs_handle *h, 
    20.8 -                                       const char *domname);
    20.9 +#define DOMNAME "Domain-0"
   20.10 +int setup_probe_watch(struct xs_handle *h);
   20.11  int xs_fire_next_watch(struct xs_handle *h);
   20.12  
   20.13  
    21.1 --- a/tools/blktap/lib/xenbus.c	Sun Oct 08 18:55:12 2006 -0600
    21.2 +++ b/tools/blktap/lib/xenbus.c	Sat Oct 14 13:28:45 2006 -0600
    21.3 @@ -166,60 +166,58 @@ static void ueblktap_setup(struct xs_han
    21.4  		goto fail;
    21.5  	}
    21.6  
    21.7 -        deverr = xs_gather(h, bepath, "physical-device", "%li", &pdev, NULL);
    21.8 -        if (!deverr) {
    21.9 -                DPRINTF("pdev set to %ld\n",pdev);
   21.10 -                if (be->pdev && be->pdev != pdev) {
   21.11 -                        DPRINTF("changing physical-device not supported");
   21.12 -                        goto fail;
   21.13 -                }
   21.14 -                be->pdev = pdev;
   21.15 -        }
   21.16 +	deverr = xs_gather(h, bepath, "physical-device", "%li", &pdev, NULL);
   21.17 +	if (!deverr) {
   21.18 +		DPRINTF("pdev set to %ld\n",pdev);
   21.19 +		if (be->pdev && be->pdev != pdev) {
   21.20 +			DPRINTF("changing physical-device not supported");
   21.21 +			goto fail;
   21.22 +		}
   21.23 +		be->pdev = pdev;
   21.24 +	}
   21.25  
   21.26 -        /*Check to see if device is to be opened read-only*/
   21.27 -        asprintf(&path, "%s/%s", bepath, "read-only");
   21.28 -        if (xs_exists(h, path))
   21.29 -                be->readonly = 1;
   21.30 -
   21.31 -        if (be->blkif == NULL) {
   21.32 +	/* Check to see if device is to be opened read-only. */
   21.33 +	asprintf(&path, "%s/%s", bepath, "read-only");
   21.34 +	if (xs_exists(h, path))
   21.35 +		be->readonly = 1;
   21.36  
   21.37 -                /* Front end dir is a number, which is used as the handle. */
   21.38 -                p = strrchr(be->frontpath, '/') + 1;
   21.39 -                handle = strtoul(p, NULL, 0);
   21.40 +	if (be->blkif == NULL) {
   21.41 +		/* Front end dir is a number, which is used as the handle. */
   21.42 +		p = strrchr(be->frontpath, '/') + 1;
   21.43 +		handle = strtoul(p, NULL, 0);
   21.44  
   21.45 -                be->blkif = alloc_blkif(be->frontend_id);
   21.46 -	
   21.47 -                if (be->blkif == NULL)
   21.48 -                        goto fail;
   21.49 +		be->blkif = alloc_blkif(be->frontend_id);
   21.50 +		if (be->blkif == NULL)
   21.51 +			goto fail;
   21.52  
   21.53  		be->blkif->be_id = get_be_id(bepath);
   21.54  		
   21.55 -                /*Insert device specific info*/
   21.56 -                blk = malloc(sizeof(blkif_info_t));
   21.57 +		/* Insert device specific info, */
   21.58 +		blk = malloc(sizeof(blkif_info_t));
   21.59  		if (!blk) {
   21.60  			DPRINTF("Out of memory - blkif_info_t\n");
   21.61  			goto fail;
   21.62  		}
   21.63 -                er = xs_gather(h, bepath, "params", NULL, &blk->params, NULL);
   21.64 -                if (er)
   21.65 -                        goto fail;
   21.66 -                be->blkif->info = blk;
   21.67 +		er = xs_gather(h, bepath, "params", NULL, &blk->params, NULL);
   21.68 +		if (er)
   21.69 +			goto fail;
   21.70 +		be->blkif->info = blk;
   21.71  		
   21.72 -                if (deverr) {
   21.73 -                        /*Dev number was not available, try to set manually*/
   21.74 -                        pdev = convert_dev_name_to_num(blk->params);
   21.75 -                        be->pdev = pdev;
   21.76 -                }
   21.77 +		if (deverr) {
   21.78 +			/*Dev number was not available, try to set manually*/
   21.79 +			pdev = convert_dev_name_to_num(blk->params);
   21.80 +			be->pdev = pdev;
   21.81 +		}
   21.82  
   21.83 -                er = blkif_init(be->blkif, handle, be->pdev, be->readonly);
   21.84 -
   21.85 -                if (er != 0) {
   21.86 -                        DPRINTF("Unable to open device %s\n",blk->params);
   21.87 +		er = blkif_init(be->blkif, handle, be->pdev, be->readonly);
   21.88 +		if (er != 0) {
   21.89 +			DPRINTF("Unable to open device %s\n",blk->params);
   21.90  			goto fail;
   21.91  		}
   21.92  
   21.93 -                DPRINTF("[BECHG]: ADDED A NEW BLKIF (%s)\n", bepath);
   21.94 -        }	
   21.95 +		DPRINTF("[BECHG]: ADDED A NEW BLKIF (%s)\n", bepath);
   21.96 +	}
   21.97 +
   21.98  	/* Supply the information about the device to xenstore */
   21.99  	er = xs_printf(h, be->backpath, "sectors", "%lu",
  21.100  			be->blkif->ops->get_size(be->blkif));
  21.101 @@ -283,10 +281,10 @@ static void ueblktap_probe(struct xs_han
  21.102  	 *asserts that xenstore structure is always 7 levels deep
  21.103  	 *e.g. /local/domain/0/backend/vbd/1/2049
  21.104  	 */
  21.105 -        len = strsep_len(bepath, '/', 7);
  21.106 -        if (len < 0) 
  21.107 -		goto free_be;     
  21.108 -        bepath[len] = '\0';
  21.109 +	len = strsep_len(bepath, '/', 7);
  21.110 +	if (len < 0) 
  21.111 +		goto free_be;
  21.112 +	bepath[len] = '\0';
  21.113  	
  21.114  	be = malloc(sizeof(*be));
  21.115  	if (!be) {
  21.116 @@ -318,22 +316,21 @@ static void ueblktap_probe(struct xs_han
  21.117  		if ( (be != NULL) && (be->blkif != NULL) ) 
  21.118  			backend_remove(h, be);
  21.119  		else goto free_be;
  21.120 -	        if (bepath)
  21.121 +		if (bepath)
  21.122  			free(bepath);
  21.123  		return;
  21.124  	}
  21.125  	
  21.126 -        /* Are we already tracking this device? */
  21.127 -        if (be_exists_be(bepath)) {
  21.128 +	/* Are we already tracking this device? */
  21.129 +	if (be_exists_be(bepath))
  21.130  		goto free_be;
  21.131 -	}
  21.132  	
  21.133  	be->backpath = bepath;
  21.134 -       	be->frontpath = frontend;
  21.135 +	be->frontpath = frontend;
  21.136  	
  21.137 -        list_add(&be->list, &belist);
  21.138 +	list_add(&be->list, &belist);
  21.139  	
  21.140 -        DPRINTF("[PROBE]\tADDED NEW DEVICE (%s)\n", bepath);
  21.141 +	DPRINTF("[PROBE]\tADDED NEW DEVICE (%s)\n", bepath);
  21.142  	DPRINTF("\tFRONTEND (%s),(%ld)\n", frontend,be->frontend_id);
  21.143  	
  21.144  	ueblktap_setup(h, bepath);	
  21.145 @@ -342,11 +339,10 @@ static void ueblktap_probe(struct xs_han
  21.146   free_be:
  21.147  	if (frontend)
  21.148  		free(frontend);
  21.149 -        if (bepath)
  21.150 +	if (bepath)
  21.151  		free(bepath);
  21.152  	if (be) 
  21.153  		free(be);
  21.154 -	return;
  21.155  }
  21.156  
  21.157  /**
  21.158 @@ -356,16 +352,10 @@ static void ueblktap_probe(struct xs_han
  21.159   *are created, we initalise the state and attach a disk.
  21.160   */
  21.161  
  21.162 -int add_blockdevice_probe_watch(struct xs_handle *h, const char *domname)
  21.163 +int add_blockdevice_probe_watch(struct xs_handle *h, const char *domid)
  21.164  {
  21.165 -	char *domid, *path;
  21.166 +	char *path;
  21.167  	struct xenbus_watch *vbd_watch;
  21.168 -	int er;
  21.169 -	
  21.170 -	domid = get_dom_domid(h, domname);
  21.171 -
  21.172 -	DPRINTF("%s: %s\n", 
  21.173 -		domname, (domid != NULL) ? domid : "[ not found! ]");
  21.174  	
  21.175  	asprintf(&path, "/local/domain/%s/backend/tap", domid);
  21.176  	if (path == NULL) 
  21.177 @@ -378,10 +368,67 @@ int add_blockdevice_probe_watch(struct x
  21.178  	}	
  21.179  	vbd_watch->node     = path;
  21.180  	vbd_watch->callback = ueblktap_probe;
  21.181 -	er = register_xenbus_watch(h, vbd_watch);
  21.182 -	if (er == 0) {
  21.183 +	if (register_xenbus_watch(h, vbd_watch) != 0) {
  21.184  		DPRINTF("ERROR: adding vbd probe watch %s\n", path);
  21.185  		return -EINVAL;
  21.186  	}
  21.187  	return 0;
  21.188  }
  21.189 +
  21.190 +/* Asynch callback to check for /local/domain/<DOMID>/name */
  21.191 +void check_dom(struct xs_handle *h, struct xenbus_watch *w, 
  21.192 +	       const char *bepath_im)
  21.193 +{
  21.194 +	char *domid;
  21.195 +
  21.196 +	domid = get_dom_domid(h);
  21.197 +	if (domid == NULL)
  21.198 +		return;
  21.199 +
  21.200 +	add_blockdevice_probe_watch(h, domid);
  21.201 +	free(domid);
  21.202 +	unregister_xenbus_watch(h, w);
  21.203 +}
  21.204 +
  21.205 +/* We must wait for xend to register /local/domain/<DOMID> */
  21.206 +int watch_for_domid(struct xs_handle *h)
  21.207 +{
  21.208 +	struct xenbus_watch *domid_watch;
  21.209 +	char *path = NULL;
  21.210 +
  21.211 +	asprintf(&path, "/local/domain");
  21.212 +	if (path == NULL) 
  21.213 +		return -ENOMEM;
  21.214 +
  21.215 +	domid_watch = malloc(sizeof(struct xenbus_watch));
  21.216 +	if (domid_watch == NULL) {
  21.217 +		DPRINTF("ERROR: unable to malloc domid_watch [%s]\n", path);
  21.218 +		return -EINVAL;
  21.219 +	}	
  21.220 +
  21.221 +	domid_watch->node     = path;
  21.222 +	domid_watch->callback = check_dom;
  21.223 +
  21.224 +	if (register_xenbus_watch(h, domid_watch) != 0) {
  21.225 +		DPRINTF("ERROR: adding vbd probe watch %s\n", path);
  21.226 +		return -EINVAL;
  21.227 +	}
  21.228 +
  21.229 +	DPRINTF("Set async watch for /local/domain\n");
  21.230 +
  21.231 +	return 0;
  21.232 +}
  21.233 +
  21.234 +int setup_probe_watch(struct xs_handle *h)
  21.235 +{
  21.236 +	char *domid;
  21.237 +	int ret;
  21.238 +	
  21.239 +	domid = get_dom_domid(h);
  21.240 +	if (domid == NULL)
  21.241 +		return watch_for_domid(h);
  21.242 +
  21.243 +	ret = add_blockdevice_probe_watch(h, domid);
  21.244 +	free(domid);
  21.245 +	return ret;
  21.246 +}
    22.1 --- a/tools/blktap/lib/xs_api.c	Sun Oct 08 18:55:12 2006 -0600
    22.2 +++ b/tools/blktap/lib/xs_api.c	Sat Oct 14 13:28:45 2006 -0600
    22.3 @@ -106,7 +106,7 @@ again:
    22.4  	if (!xs_transaction_end(xs, xth, ret)) {
    22.5  		if (ret == 0 && errno == EAGAIN)
    22.6  			goto again;
    22.7 -                else
    22.8 +		else
    22.9  			ret = errno;
   22.10  	}
   22.11  
   22.12 @@ -118,25 +118,25 @@ again:
   22.13  int xs_printf(struct xs_handle *h, const char *dir, const char *node, 
   22.14  	      const char *fmt, ...)
   22.15  {
   22.16 -        char *buf, *path;
   22.17 -        va_list ap;
   22.18 -        int ret;
   22.19 +	char *buf, *path;
   22.20 +	va_list ap;
   22.21 +	int ret;
   22.22  	
   22.23 -        va_start(ap, fmt);
   22.24 -        ret = vasprintf(&buf, fmt, ap);
   22.25 -        va_end(ap);
   22.26 +	va_start(ap, fmt);
   22.27 +	ret = vasprintf(&buf, fmt, ap);
   22.28 +	va_end(ap);
   22.29  	
   22.30 -        asprintf(&path, "%s/%s", dir, node);
   22.31 +	asprintf(&path, "%s/%s", dir, node);
   22.32  	
   22.33 -        if ( (path == NULL) || (buf == NULL) )
   22.34 +	if ((path == NULL) || (buf == NULL))
   22.35  		return 0;
   22.36  
   22.37 -        ret = xs_write(h, XBT_NULL, path, buf, strlen(buf)+1);
   22.38 +	ret = xs_write(h, XBT_NULL, path, buf, strlen(buf)+1);
   22.39  	
   22.40 -        free(buf);
   22.41 -        free(path);
   22.42 +	free(buf);
   22.43 +	free(path);
   22.44  	
   22.45 -        return ret;
   22.46 +	return ret;
   22.47  }
   22.48  
   22.49  
   22.50 @@ -165,7 +165,7 @@ int xs_exists(struct xs_handle *h, const
   22.51   * This assumes that the domain name we are looking for is unique. 
   22.52   * Name parameter Domain-0 
   22.53   */
   22.54 -char *get_dom_domid(struct xs_handle *h, const char *name)
   22.55 +char *get_dom_domid(struct xs_handle *h)
   22.56  {
   22.57  	char **e, *val, *domid = NULL;
   22.58  	unsigned int num, len;
   22.59 @@ -179,7 +179,9 @@ char *get_dom_domid(struct xs_handle *h,
   22.60  	}
   22.61  	
   22.62  	e = xs_directory(h, xth, "/local/domain", &num);
   22.63 -	
   22.64 +	if (e == NULL)
   22.65 +		return NULL;
   22.66 +
   22.67  	for (i = 0; (i < num) && (domid == NULL); i++) {
   22.68  		asprintf(&path, "/local/domain/%s/name", e[i]);
   22.69  		val = xs_read(h, xth, path, &len);
   22.70 @@ -187,7 +189,7 @@ char *get_dom_domid(struct xs_handle *h,
   22.71  		if (val == NULL)
   22.72  			continue;
   22.73  		
   22.74 -		if (strcmp(val, name) == 0) {
   22.75 +		if (strcmp(val, DOMNAME) == 0) {
   22.76  			/* match! */
   22.77  			asprintf(&path, "/local/domain/%s/domid", e[i]);
   22.78  			domid = xs_read(h, xth, path, &len);
   22.79 @@ -249,12 +251,12 @@ int convert_dev_name_to_num(char *name) 
   22.80  		ret = BASE_DEV_VAL;
   22.81  	}
   22.82  
   22.83 -        free(p_sd);
   22.84 -        free(p_hd);
   22.85 -        free(p_xvd);
   22.86 -        free(p_plx);
   22.87 -        free(alpha);
   22.88 -        
   22.89 +	free(p_sd);
   22.90 +	free(p_hd);
   22.91 +	free(p_xvd);
   22.92 +	free(p_plx);
   22.93 +	free(alpha);
   22.94 +
   22.95  	return ret;
   22.96  }
   22.97  
   22.98 @@ -281,42 +283,39 @@ int register_xenbus_watch(struct xs_hand
   22.99  {
  22.100  	/* Pointer in ascii is the token. */
  22.101  	char token[sizeof(watch) * 2 + 1];
  22.102 -	int er;
  22.103 -	
  22.104 +
  22.105  	sprintf(token, "%lX", (long)watch);
  22.106 -	if (find_watch(token)) 
  22.107 -	{
  22.108 +	if (find_watch(token)) {
  22.109  		DPRINTF("watch collision!\n");
  22.110  		return -EINVAL;
  22.111  	}
  22.112  	
  22.113 -	er = xs_watch(h, watch->node, token);
  22.114 -	if (er != 0) {
  22.115 -		list_add(&watch->list, &watches);
  22.116 -	} 
  22.117 -        
  22.118 -	return er;
  22.119 +	if (!xs_watch(h, watch->node, token)) {
  22.120 +		DPRINTF("unable to set watch!\n");
  22.121 +		return -EINVAL;
  22.122 +	}
  22.123 +
  22.124 +	list_add(&watch->list, &watches);
  22.125 +
  22.126 +	return 0;
  22.127  }
  22.128  
  22.129  int unregister_xenbus_watch(struct xs_handle *h, struct xenbus_watch *watch)
  22.130  {
  22.131  	char token[sizeof(watch) * 2 + 1];
  22.132 -	int er;
  22.133  	
  22.134  	sprintf(token, "%lX", (long)watch);
  22.135 -	if (!find_watch(token))
  22.136 -	{
  22.137 +	if (!find_watch(token)) {
  22.138  		DPRINTF("no such watch!\n");
  22.139  		return -EINVAL;
  22.140  	}
  22.141 -	
  22.142 -	
  22.143 -	er = xs_unwatch(h, watch->node, token);
  22.144 +
  22.145 +	if (!xs_unwatch(h, watch->node, token))
  22.146 +		DPRINTF("XENBUS Failed to release watch %s: %i\n",
  22.147 +			watch->node, er);
  22.148 +
  22.149  	list_del(&watch->list);
  22.150  	
  22.151 -	if (er == 0)
  22.152 -		DPRINTF("XENBUS Failed to release watch %s: %i\n",
  22.153 -		     watch->node, er);
  22.154  	return 0;
  22.155  }
  22.156  
  22.157 @@ -354,14 +353,10 @@ int xs_fire_next_watch(struct xs_handle 
  22.158  	token = res[XS_WATCH_TOKEN];
  22.159  	
  22.160  	w = find_watch(token);
  22.161 -	if (!w)
  22.162 -	{
  22.163 -		DPRINTF("unregistered watch fired\n");
  22.164 -		goto done;
  22.165 -	}
  22.166 -	w->callback(h, w, node);
  22.167 -	
  22.168 - done:
  22.169 +	if (w)
  22.170 +		w->callback(h, w, node);
  22.171 +
  22.172  	free(res);
  22.173 +
  22.174  	return 1;
  22.175  }
    23.1 --- a/tools/blktap/lib/xs_api.h	Sun Oct 08 18:55:12 2006 -0600
    23.2 +++ b/tools/blktap/lib/xs_api.h	Sat Oct 14 13:28:45 2006 -0600
    23.3 @@ -42,7 +42,7 @@ int xs_gather(struct xs_handle *xs, cons
    23.4  int xs_printf(struct xs_handle *h, const char *dir, const char *node, 
    23.5  	      const char *fmt, ...);
    23.6  int xs_exists(struct xs_handle *h, const char *path);
    23.7 -char *get_dom_domid(struct xs_handle *h, const char *name);
    23.8 +char *get_dom_domid(struct xs_handle *h);
    23.9  int convert_dev_name_to_num(char *name);
   23.10  int register_xenbus_watch(struct xs_handle *h, struct xenbus_watch *watch);
   23.11  int unregister_xenbus_watch(struct xs_handle *h, struct xenbus_watch *watch);
    24.1 --- a/tools/examples/block	Sun Oct 08 18:55:12 2006 -0600
    24.2 +++ b/tools/examples/block	Sat Oct 14 13:28:45 2006 -0600
    24.3 @@ -377,7 +377,6 @@ mount it read-write in a guest domain."
    24.4        "")
    24.5          claim_lock "block"
    24.6          success
    24.7 -        echo happy gun \"$t\" >>/tmp/block.$$
    24.8          release_lock "block"
    24.9  	;;
   24.10      esac
    25.1 --- a/tools/examples/xend-config.sxp	Sun Oct 08 18:55:12 2006 -0600
    25.2 +++ b/tools/examples/xend-config.sxp	Sat Oct 14 13:28:45 2006 -0600
    25.3 @@ -130,3 +130,8 @@
    25.4  
    25.5  # The tool used for initiating virtual TPM migration
    25.6  #(external-migration-tool '')
    25.7 +
    25.8 +# The interface for VNC servers to listen on. Defaults
    25.9 +# to 127.0.0.1  To restore old 'listen everywhere' behaviour
   25.10 +# set this to 0.0.0.0
   25.11 +#(vnc-listen '127.0.0.1')
    26.1 --- a/tools/examples/xmexample.hvm	Sun Oct 08 18:55:12 2006 -0600
    26.2 +++ b/tools/examples/xmexample.hvm	Sat Oct 14 13:28:45 2006 -0600
    26.3 @@ -132,6 +132,11 @@ sdl=0
    26.4  vnc=1
    26.5  
    26.6  #----------------------------------------------------------------------------
    26.7 +# address that should be listened on for the VNC server if vnc is set.
    26.8 +# default is to use 'vnc-listen' setting from /etc/xen/xend-config.sxp
    26.9 +#vnclisten="127.0.0.1"
   26.10 +
   26.11 +#----------------------------------------------------------------------------
   26.12  # set VNC display number, default = domid
   26.13  #vncdisplay=1
   26.14  
    27.1 --- a/tools/firmware/acpi/acpi_dsdt.asl	Sun Oct 08 18:55:12 2006 -0600
    27.2 +++ b/tools/firmware/acpi/acpi_dsdt.asl	Sat Oct 14 13:28:45 2006 -0600
    27.3 @@ -115,20 +115,15 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
    27.4                          0x0000,
    27.5                          0xF300)
    27.6  
    27.7 -                /* reserve what device model consumed for PCI VGA device        */
    27.8 +                /* reserve memory for pci devices */
    27.9  
   27.10                      DWordMemory (ResourceConsumer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
   27.11                          0x00000000,
   27.12                          0xF0000000,
   27.13 -                        0xF1FFFFFF,
   27.14 -                        0x00000000,
   27.15 -                        0x02000000)
   27.16 -                    DWordMemory (ResourceConsumer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
   27.17 +                        0xF4FFFFFF,
   27.18                          0x00000000,
   27.19 -                        0xF2000000,
   27.20 -                        0xF2000FFF,
   27.21 -                        0x00000000,
   27.22 -                        0x00001000)
   27.23 +                        0x05000000)
   27.24 +
   27.25                  })
   27.26                  Return (PRT0)
   27.27              }
   27.28 @@ -299,38 +294,43 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
   27.29                 Return (PRTP)  
   27.30                 } // end _PRT
   27.31  
   27.32 -        Name(PRTP, Package(){
   27.33 -                        Package(){0x0000ffff, 0, \_SB.PCI0.LNKA, 0}, // Slot 1, INTA
   27.34 -                        Package(){0x0000ffff, 1, \_SB.PCI0.LNKB, 0}, // Slot 1, INTB
   27.35 -                        Package(){0x0000ffff, 2, \_SB.PCI0.LNKC, 0}, // Slot 1, INTC
   27.36 -                        Package(){0x0000ffff, 3, \_SB.PCI0.LNKD, 0}, // Slot 1, INTD
   27.37 +        Name(PRTP, Package() {
   27.38 +                        // Slot 1, INTA - INTD
   27.39 +                        Package(){0x0000ffff, 0, \_SB.PCI0.LNKA, 0},
   27.40 +                        Package(){0x0000ffff, 1, \_SB.PCI0.LNKB, 0},
   27.41 +                        Package(){0x0000ffff, 2, \_SB.PCI0.LNKC, 0},
   27.42 +                        Package(){0x0000ffff, 3, \_SB.PCI0.LNKD, 0},
   27.43  
   27.44 -                        Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0}, // Slot 2, INTB
   27.45 -                        Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0}, // Slot 2, INTC
   27.46 -                        Package(){0x0001ffff, 2, \_SB.PCI0.LNKD, 0}, // Slot 2, INTD
   27.47 -                        Package(){0x0001ffff, 3, \_SB.PCI0.LNKA, 0}, // Slot 2, INTA
   27.48 +                        // Slot 2, INTA - INTD
   27.49 +                        Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0},
   27.50 +                        Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0},
   27.51 +                        Package(){0x0001ffff, 2, \_SB.PCI0.LNKD, 0},
   27.52 +                        Package(){0x0001ffff, 3, \_SB.PCI0.LNKA, 0},
   27.53                          
   27.54 -                        Package(){0x0002ffff, 0, \_SB.PCI0.LNKC, 0}, // Slot 3, INTC
   27.55 -                        Package(){0x0002ffff, 1, \_SB.PCI0.LNKD, 0}, // Slot 3, INTD
   27.56 -                        Package(){0x0002ffff, 2, \_SB.PCI0.LNKA, 0}, // Slot 3, INTA
   27.57 -                        Package(){0x0002ffff, 3, \_SB.PCI0.LNKB, 0}, // Slot 3, INTB
   27.58 +                        // Slot 3, INTA - INTD
   27.59 +                        Package(){0x0002ffff, 0, \_SB.PCI0.LNKC, 0},
   27.60 +                        Package(){0x0002ffff, 1, \_SB.PCI0.LNKD, 0},
   27.61 +                        Package(){0x0002ffff, 2, \_SB.PCI0.LNKA, 0},
   27.62 +                        Package(){0x0002ffff, 3, \_SB.PCI0.LNKB, 0},
   27.63                          
   27.64 -                        Package(){0x0003ffff, 0, \_SB.PCI0.LNKD, 0}, // Slot 2, INTD
   27.65 -                        Package(){0x0003ffff, 1, \_SB.PCI0.LNKA, 0}, // Slot 2, INTA
   27.66 -                        Package(){0x0003ffff, 2, \_SB.PCI0.LNKB, 0}, // Slot 2, INTB
   27.67 -                        Package(){0x0003ffff, 3, \_SB.PCI0.LNKC, 0}, // Slot 2, INTC
   27.68 +                        // Slot 4, INTA - INTD
   27.69 +                        Package(){0x0003ffff, 0, \_SB.PCI0.LNKD, 0},
   27.70 +                        Package(){0x0003ffff, 1, \_SB.PCI0.LNKA, 0},
   27.71 +                        Package(){0x0003ffff, 2, \_SB.PCI0.LNKB, 0},
   27.72 +                        Package(){0x0003ffff, 3, \_SB.PCI0.LNKC, 0},
   27.73                          
   27.74 +                        // Slot 5, INTA - INTD
   27.75 +                        Package(){0x0004ffff, 0, \_SB.PCI0.LNKA, 0},
   27.76 +                        Package(){0x0004ffff, 1, \_SB.PCI0.LNKB, 0},
   27.77 +                        Package(){0x0004ffff, 2, \_SB.PCI0.LNKC, 0},
   27.78 +                        Package(){0x0004ffff, 3, \_SB.PCI0.LNKD, 0},
   27.79                          }
   27.80              )
   27.81          Name(PRTA, Package(){
   27.82 -                        Package(){0x0001ffff, 0, 0, 5}, // Device 1, INTA
   27.83 -
   27.84 +                        Package(){0x0001ffff, 0, 0, 5},  // Device 1, INTA
   27.85                          Package(){0x0002ffff, 0, 0, 7},  // Device 2, INTA
   27.86 -                       
   27.87                          Package(){0x0003ffff, 0, 0, 10}, // Device 3, INTA
   27.88 -
   27.89 -                        Package(){0x0004ffff, 0, 0, 11},  // Device 4, INTA                                
   27.90 -                        
   27.91 +                        Package(){0x0004ffff, 0, 0, 11}, // Device 4, INTA
   27.92                          }
   27.93              )
   27.94              
    28.1 --- a/tools/firmware/acpi/acpi_dsdt.c	Sun Oct 08 18:55:12 2006 -0600
    28.2 +++ b/tools/firmware/acpi/acpi_dsdt.c	Sat Oct 14 13:28:45 2006 -0600
    28.3 @@ -1,19 +1,19 @@
    28.4  /*
    28.5   * 
    28.6   * Intel ACPI Component Architecture
    28.7 - * ASL Optimizing Compiler / AML Disassembler version 20050513 [Jun  8 2005]
    28.8 + * ASL Optimizing Compiler / AML Disassembler version 20050513 [Oct 12 2006]
    28.9   * Copyright (C) 2000 - 2005 Intel Corporation
   28.10   * Supports ACPI Specification Revision 3.0
   28.11   * 
   28.12 - * Compilation of "acpi_dsdt.asl" - Mon Aug 14 18:15:09 2006
   28.13 + * Compilation of "acpi_dsdt.asl" - Thu Oct 12 14:08:49 2006
   28.14   * 
   28.15   * C source code output
   28.16   *
   28.17   */
   28.18  unsigned char AmlCode[] = 
   28.19  {
   28.20 -    0x44,0x53,0x44,0x54,0xBA,0x08,0x00,0x00,  /* 00000000    "DSDT...." */
   28.21 -    0x01,0x1D,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    "..INTEL." */
   28.22 +    0x44,0x53,0x44,0x54,0xDA,0x08,0x00,0x00,  /* 00000000    "DSDT...." */
   28.23 +    0x01,0x26,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    ".&INTEL." */
   28.24      0x69,0x6E,0x74,0x2D,0x78,0x65,0x6E,0x00,  /* 00000010    "int-xen." */
   28.25      0xD6,0x07,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
   28.26      0x13,0x05,0x05,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    "... .PMB" */
   28.27 @@ -34,7 +34,7 @@ unsigned char AmlCode[] =
   28.28      0x12,0x08,0x04,0x0A,0x07,0x0A,0x07,0x00,  /* 00000098    "........" */
   28.29      0x00,0x08,0x50,0x49,0x43,0x44,0x00,0x14,  /* 000000A0    "..PICD.." */
   28.30      0x0C,0x5F,0x50,0x49,0x43,0x01,0x70,0x68,  /* 000000A8    "._PIC.ph" */
   28.31 -    0x50,0x49,0x43,0x44,0x10,0x45,0x80,0x5F,  /* 000000B0    "PICD.E._" */
   28.32 +    0x50,0x49,0x43,0x44,0x10,0x45,0x82,0x5F,  /* 000000B0    "PICD.E._" */
   28.33      0x53,0x42,0x5F,0x5B,0x82,0x49,0x04,0x4D,  /* 000000B8    "SB_[.I.M" */
   28.34      0x45,0x4D,0x30,0x08,0x5F,0x48,0x49,0x44,  /* 000000C0    "EM0._HID" */
   28.35      0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x43,  /* 000000C8    ".A...._C" */
   28.36 @@ -45,7 +45,7 @@ unsigned char AmlCode[] =
   28.37      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000F0    "........" */
   28.38      0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,  /* 000000F8    "........" */
   28.39      0x00,0x00,0x00,0x00,0x79,0x00,0x5B,0x82,  /* 00000100    "....y.[." */
   28.40 -    0x42,0x7B,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "B{PCI0._" */
   28.41 +    0x42,0x7D,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "B}PCI0._" */
   28.42      0x48,0x49,0x44,0x0C,0x41,0xD0,0x0A,0x03,  /* 00000110    "HID.A..." */
   28.43      0x08,0x5F,0x55,0x49,0x44,0x00,0x08,0x5F,  /* 00000118    "._UID.._" */
   28.44      0x41,0x44,0x52,0x00,0x08,0x5F,0x42,0x42,  /* 00000120    "ADR.._BB" */
   28.45 @@ -55,9 +55,9 @@ unsigned char AmlCode[] =
   28.46      0x33,0x03,0x49,0x52,0x51,0x35,0x05,0x49,  /* 00000140    "3.IRQ5.I" */
   28.47      0x52,0x51,0x37,0x07,0x49,0x52,0x51,0x39,  /* 00000148    "RQ7.IRQ9" */
   28.48      0x09,0x49,0x52,0x51,0x41,0x0A,0x49,0x52,  /* 00000150    ".IRQA.IR" */
   28.49 -    0x51,0x42,0x0B,0x14,0x44,0x08,0x5F,0x43,  /* 00000158    "QB..D._C" */
   28.50 +    0x51,0x42,0x0B,0x14,0x4A,0x06,0x5F,0x43,  /* 00000158    "QB..J._C" */
   28.51      0x52,0x53,0x00,0x08,0x50,0x52,0x54,0x30,  /* 00000160    "RS..PRT0" */
   28.52 -    0x11,0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00,  /* 00000168    ".B..n..." */
   28.53 +    0x11,0x48,0x05,0x0A,0x54,0x88,0x0D,0x00,  /* 00000168    ".H..T..." */
   28.54      0x02,0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,  /* 00000170    "........" */
   28.55      0x00,0x00,0x00,0x00,0x01,0x47,0x01,0xF8,  /* 00000178    ".....G.." */
   28.56      0x0C,0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00,  /* 00000180    "........" */
   28.57 @@ -66,231 +66,235 @@ unsigned char AmlCode[] =
   28.58      0x01,0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF,  /* 00000198    "........" */
   28.59      0xFF,0x00,0x00,0x00,0xF3,0x87,0x17,0x00,  /* 000001A0    "........" */
   28.60      0x00,0x0D,0x03,0x00,0x00,0x00,0x00,0x00,  /* 000001A8    "........" */
   28.61 -    0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xF1,0x00,  /* 000001B0    "........" */
   28.62 -    0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x87,  /* 000001B8    "........" */
   28.63 -    0x17,0x00,0x00,0x0D,0x03,0x00,0x00,0x00,  /* 000001C0    "........" */
   28.64 -    0x00,0x00,0x00,0x00,0xF2,0xFF,0x0F,0x00,  /* 000001C8    "........" */
   28.65 -    0xF2,0x00,0x00,0x00,0x00,0x00,0x10,0x00,  /* 000001D0    "........" */
   28.66 -    0x00,0x79,0x00,0xA4,0x50,0x52,0x54,0x30,  /* 000001D8    ".y..PRT0" */
   28.67 -    0x08,0x42,0x55,0x46,0x41,0x11,0x09,0x0A,  /* 000001E0    ".BUFA..." */
   28.68 -    0x06,0x23,0xF8,0xDC,0x18,0x79,0x00,0x08,  /* 000001E8    ".#...y.." */
   28.69 -    0x42,0x55,0x46,0x42,0x11,0x09,0x0A,0x06,  /* 000001F0    "BUFB...." */
   28.70 -    0x23,0x00,0x00,0x18,0x79,0x00,0x8B,0x42,  /* 000001F8    "#...y..B" */
   28.71 -    0x55,0x46,0x42,0x01,0x49,0x52,0x51,0x56,  /* 00000200    "UFB.IRQV" */
   28.72 -    0x08,0x42,0x55,0x46,0x43,0x11,0x07,0x0A,  /* 00000208    ".BUFC..." */
   28.73 -    0x04,0x05,0x07,0x0A,0x0B,0x8C,0x42,0x55,  /* 00000210    "......BU" */
   28.74 -    0x46,0x43,0x01,0x50,0x49,0x51,0x41,0x8C,  /* 00000218    "FC.PIQA." */
   28.75 -    0x42,0x55,0x46,0x43,0x01,0x50,0x49,0x51,  /* 00000220    "BUFC.PIQ" */
   28.76 -    0x42,0x8C,0x42,0x55,0x46,0x43,0x01,0x50,  /* 00000228    "B.BUFC.P" */
   28.77 -    0x49,0x51,0x43,0x8C,0x42,0x55,0x46,0x43,  /* 00000230    "IQC.BUFC" */
   28.78 -    0x01,0x50,0x49,0x51,0x44,0x5B,0x82,0x48,  /* 00000238    ".PIQD[.H" */
   28.79 -    0x08,0x4C,0x4E,0x4B,0x41,0x08,0x5F,0x48,  /* 00000240    ".LNKA._H" */
   28.80 -    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 00000248    "ID.A...." */
   28.81 -    0x5F,0x55,0x49,0x44,0x01,0x14,0x1C,0x5F,  /* 00000250    "_UID..._" */
   28.82 -    0x53,0x54,0x41,0x00,0x7B,0x50,0x49,0x52,  /* 00000258    "STA.{PIR" */
   28.83 -    0x41,0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,  /* 00000260    "A..`...`" */
   28.84 -    0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,  /* 00000268    "........" */
   28.85 -    0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,  /* 00000270    "...._PRS" */
   28.86 -    0x00,0xA4,0x42,0x55,0x46,0x41,0x14,0x11,  /* 00000278    "..BUFA.." */
   28.87 -    0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x49,  /* 00000280    "_DIS.}PI" */
   28.88 -    0x52,0x41,0x0A,0x80,0x50,0x49,0x52,0x41,  /* 00000288    "RA..PIRA" */
   28.89 -    0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,  /* 00000290    ".._CRS.{" */
   28.90 -    0x50,0x49,0x52,0x42,0x0A,0x0F,0x60,0x79,  /* 00000298    "PIRB..`y" */
   28.91 -    0x01,0x60,0x49,0x52,0x51,0x56,0xA4,0x42,  /* 000002A0    ".`IRQV.B" */
   28.92 -    0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,  /* 000002A8    "UFB.._SR" */
   28.93 -    0x53,0x01,0x8B,0x68,0x01,0x49,0x52,0x51,  /* 000002B0    "S..h.IRQ" */
   28.94 -    0x31,0x82,0x49,0x52,0x51,0x31,0x60,0x76,  /* 000002B8    "1.IRQ1`v" */
   28.95 -    0x60,0x70,0x60,0x50,0x49,0x52,0x41,0x5B,  /* 000002C0    "`p`PIRA[" */
   28.96 -    0x82,0x49,0x08,0x4C,0x4E,0x4B,0x42,0x08,  /* 000002C8    ".I.LNKB." */
   28.97 -    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,  /* 000002D0    "_HID.A.." */
   28.98 -    0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x02,  /* 000002D8    ".._UID.." */
   28.99 -    0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,  /* 000002E0    ".._STA.{" */
  28.100 -    0x50,0x49,0x52,0x42,0x0A,0x80,0x60,0xA0,  /* 000002E8    "PIRB..`." */
  28.101 -    0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,  /* 000002F0    "..`....." */
  28.102 -    0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,  /* 000002F8    "......._" */
  28.103 -    0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46,  /* 00000300    "PRS..BUF" */
  28.104 -    0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00,  /* 00000308    "A.._DIS." */
  28.105 -    0x7D,0x50,0x49,0x52,0x42,0x0A,0x80,0x50,  /* 00000310    "}PIRB..P" */
  28.106 -    0x49,0x52,0x42,0x14,0x1A,0x5F,0x43,0x52,  /* 00000318    "IRB.._CR" */
  28.107 -    0x53,0x00,0x7B,0x50,0x49,0x52,0x42,0x0A,  /* 00000320    "S.{PIRB." */
  28.108 -    0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51,  /* 00000328    ".`y.`IRQ" */
  28.109 -    0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,  /* 00000330    "V.BUFB.." */
  28.110 -    0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01,  /* 00000338    "_SRS..h." */
  28.111 -    0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51,  /* 00000340    "IRQ1.IRQ" */
  28.112 -    0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49,  /* 00000348    "1`v`p`PI" */
  28.113 -    0x52,0x42,0x5B,0x82,0x49,0x08,0x4C,0x4E,  /* 00000350    "RB[.I.LN" */
  28.114 -    0x4B,0x43,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000358    "KC._HID." */
  28.115 -    0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,  /* 00000360    "A...._UI" */
  28.116 -    0x44,0x0A,0x03,0x14,0x1C,0x5F,0x53,0x54,  /* 00000368    "D...._ST" */
  28.117 -    0x41,0x00,0x7B,0x50,0x49,0x52,0x43,0x0A,  /* 00000370    "A.{PIRC." */
  28.118 -    0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,  /* 00000378    ".`...`.." */
  28.119 -    0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,  /* 00000380    "........" */
  28.120 -    0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,  /* 00000388    ".._PRS.." */
  28.121 -    0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44,  /* 00000390    "BUFA.._D" */
  28.122 -    0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x43,  /* 00000398    "IS.}PIRC" */
  28.123 -    0x0A,0x80,0x50,0x49,0x52,0x43,0x14,0x1A,  /* 000003A0    "..PIRC.." */
  28.124 -    0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49,  /* 000003A8    "_CRS.{PI" */
  28.125 -    0x52,0x43,0x0A,0x0F,0x60,0x79,0x01,0x60,  /* 000003B0    "RC..`y.`" */
  28.126 -    0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46,  /* 000003B8    "IRQV.BUF" */
  28.127 -    0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,  /* 000003C0    "B.._SRS." */
  28.128 -    0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82,  /* 000003C8    ".h.IRQ1." */
  28.129 -    0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70,  /* 000003D0    "IRQ1`v`p" */
  28.130 -    0x60,0x50,0x49,0x52,0x43,0x5B,0x82,0x49,  /* 000003D8    "`PIRC[.I" */
  28.131 -    0x08,0x4C,0x4E,0x4B,0x44,0x08,0x5F,0x48,  /* 000003E0    ".LNKD._H" */
  28.132 -    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 000003E8    "ID.A...." */
  28.133 -    0x5F,0x55,0x49,0x44,0x0A,0x04,0x14,0x1C,  /* 000003F0    "_UID...." */
  28.134 -    0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49,  /* 000003F8    "_STA.{PI" */
  28.135 -    0x52,0x44,0x0A,0x80,0x60,0xA0,0x08,0x93,  /* 00000400    "RD..`..." */
  28.136 -    0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,  /* 00000408    "`......." */
  28.137 -    0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,  /* 00000410    "....._PR" */
  28.138 -    0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14,  /* 00000418    "S..BUFA." */
  28.139 -    0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,  /* 00000420    "._DIS.}P" */
  28.140 -    0x49,0x52,0x44,0x0A,0x80,0x50,0x49,0x52,  /* 00000428    "IRD..PIR" */
  28.141 -    0x44,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,  /* 00000430    "D.._CRS." */
  28.142 -    0x7B,0x50,0x49,0x52,0x44,0x0A,0x0F,0x60,  /* 00000438    "{PIRD..`" */
  28.143 -    0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4,  /* 00000440    "y.`IRQV." */
  28.144 -    0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,  /* 00000448    "BUFB.._S" */
  28.145 -    0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52,  /* 00000450    "RS..h.IR" */
  28.146 -    0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60,  /* 00000458    "Q1.IRQ1`" */
  28.147 -    0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x44,  /* 00000460    "v`p`PIRD" */
  28.148 -    0x14,0x16,0x5F,0x50,0x52,0x54,0x00,0xA0,  /* 00000468    ".._PRT.." */
  28.149 -    0x0A,0x50,0x49,0x43,0x44,0xA4,0x50,0x52,  /* 00000470    ".PICD.PR" */
  28.150 -    0x54,0x41,0xA4,0x50,0x52,0x54,0x50,0x08,  /* 00000478    "TA.PRTP." */
  28.151 -    0x50,0x52,0x54,0x50,0x12,0x43,0x0E,0x10,  /* 00000480    "PRTP.C.." */
  28.152 -    0x12,0x0B,0x04,0x0B,0xFF,0xFF,0x00,0x4C,  /* 00000488    ".......L" */
  28.153 -    0x4E,0x4B,0x41,0x00,0x12,0x0B,0x04,0x0B,  /* 00000490    "NKA....." */
  28.154 -    0xFF,0xFF,0x01,0x4C,0x4E,0x4B,0x42,0x00,  /* 00000498    "...LNKB." */
  28.155 -    0x12,0x0C,0x04,0x0B,0xFF,0xFF,0x0A,0x02,  /* 000004A0    "........" */
  28.156 -    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0C,0x04,  /* 000004A8    "LNKC...." */
  28.157 -    0x0B,0xFF,0xFF,0x0A,0x03,0x4C,0x4E,0x4B,  /* 000004B0    ".....LNK" */
  28.158 -    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 000004B8    "D......." */
  28.159 -    0x01,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 000004C0    "...LNKB." */
  28.160 -    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 000004C8    "........" */
  28.161 -    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 000004D0    ".LNKC..." */
  28.162 -    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,  /* 000004D8    "........" */
  28.163 -    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 000004E0    "LNKD...." */
  28.164 -    0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,0x4C,  /* 000004E8    ".......L" */
  28.165 -    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 000004F0    "NKA....." */
  28.166 -    0xFF,0xFF,0x02,0x00,0x00,0x4C,0x4E,0x4B,  /* 000004F8    ".....LNK" */
  28.167 -    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000500    "C......." */
  28.168 -    0x02,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000508    "...LNKD." */
  28.169 -    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000510    "........" */
  28.170 -    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000518    "..LNKA.." */
  28.171 -    0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A,  /* 00000520    "........" */
  28.172 -    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000528    ".LNKB..." */
  28.173 -    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x00,0x4C,  /* 00000530    ".......L" */
  28.174 -    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 00000538    "NKD....." */
  28.175 -    0xFF,0xFF,0x03,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000540    ".....LNK" */
  28.176 -    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000548    "A......." */
  28.177 -    0x03,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 00000550    "....LNKB" */
  28.178 -    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03,  /* 00000558    "........" */
  28.179 -    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000560    "...LNKC." */
  28.180 -    0x08,0x50,0x52,0x54,0x41,0x12,0x32,0x04,  /* 00000568    ".PRTA.2." */
  28.181 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 00000570    "........" */
  28.182 -    0x00,0x00,0x0A,0x05,0x12,0x0B,0x04,0x0C,  /* 00000578    "........" */
  28.183 -    0xFF,0xFF,0x02,0x00,0x00,0x00,0x0A,0x07,  /* 00000580    "........" */
  28.184 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x03,0x00,  /* 00000588    "........" */
  28.185 -    0x00,0x00,0x0A,0x0A,0x12,0x0B,0x04,0x0C,  /* 00000590    "........" */
  28.186 -    0xFF,0xFF,0x04,0x00,0x00,0x00,0x0A,0x0B,  /* 00000598    "........" */
  28.187 -    0x5B,0x82,0x48,0x31,0x49,0x53,0x41,0x5F,  /* 000005A0    "[.H1ISA_" */
  28.188 -    0x08,0x5F,0x41,0x44,0x52,0x00,0x5B,0x80,  /* 000005A8    "._ADR.[." */
  28.189 -    0x50,0x49,0x52,0x51,0x02,0x0A,0x60,0x0A,  /* 000005B0    "PIRQ..`." */
  28.190 -    0x04,0x10,0x2E,0x5C,0x00,0x5B,0x81,0x29,  /* 000005B8    "...\.[.)" */
  28.191 -    0x5C,0x2F,0x04,0x5F,0x53,0x42,0x5F,0x50,  /* 000005C0    "\/._SB_P" */
  28.192 -    0x43,0x49,0x30,0x49,0x53,0x41,0x5F,0x50,  /* 000005C8    "CI0ISA_P" */
  28.193 -    0x49,0x52,0x51,0x01,0x50,0x49,0x52,0x41,  /* 000005D0    "IRQ.PIRA" */
  28.194 -    0x08,0x50,0x49,0x52,0x42,0x08,0x50,0x49,  /* 000005D8    ".PIRB.PI" */
  28.195 -    0x52,0x43,0x08,0x50,0x49,0x52,0x44,0x08,  /* 000005E0    "RC.PIRD." */
  28.196 -    0x5B,0x82,0x46,0x0B,0x53,0x59,0x53,0x52,  /* 000005E8    "[.F.SYSR" */
  28.197 -    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000005F0    "._HID.A." */
  28.198 -    0x0C,0x02,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 000005F8    "..._UID." */
  28.199 -    0x08,0x43,0x52,0x53,0x5F,0x11,0x4E,0x08,  /* 00000600    ".CRS_.N." */
  28.200 -    0x0A,0x8A,0x47,0x01,0x10,0x00,0x10,0x00,  /* 00000608    "..G....." */
  28.201 -    0x00,0x10,0x47,0x01,0x22,0x00,0x22,0x00,  /* 00000610    "..G."."." */
  28.202 -    0x00,0x0C,0x47,0x01,0x30,0x00,0x30,0x00,  /* 00000618    "..G.0.0." */
  28.203 -    0x00,0x10,0x47,0x01,0x44,0x00,0x44,0x00,  /* 00000620    "..G.D.D." */
  28.204 -    0x00,0x1C,0x47,0x01,0x62,0x00,0x62,0x00,  /* 00000628    "..G.b.b." */
  28.205 -    0x00,0x02,0x47,0x01,0x65,0x00,0x65,0x00,  /* 00000630    "..G.e.e." */
  28.206 -    0x00,0x0B,0x47,0x01,0x72,0x00,0x72,0x00,  /* 00000638    "..G.r.r." */
  28.207 -    0x00,0x0E,0x47,0x01,0x80,0x00,0x80,0x00,  /* 00000640    "..G....." */
  28.208 -    0x00,0x01,0x47,0x01,0x84,0x00,0x84,0x00,  /* 00000648    "..G....." */
  28.209 -    0x00,0x03,0x47,0x01,0x88,0x00,0x88,0x00,  /* 00000650    "..G....." */
  28.210 -    0x00,0x01,0x47,0x01,0x8C,0x00,0x8C,0x00,  /* 00000658    "..G....." */
  28.211 -    0x00,0x03,0x47,0x01,0x90,0x00,0x90,0x00,  /* 00000660    "..G....." */
  28.212 -    0x00,0x10,0x47,0x01,0xA2,0x00,0xA2,0x00,  /* 00000668    "..G....." */
  28.213 -    0x00,0x1C,0x47,0x01,0xE0,0x00,0xE0,0x00,  /* 00000670    "..G....." */
  28.214 -    0x00,0x10,0x47,0x01,0xA0,0x08,0xA0,0x08,  /* 00000678    "..G....." */
  28.215 -    0x00,0x04,0x47,0x01,0xC0,0x0C,0xC0,0x0C,  /* 00000680    "..G....." */
  28.216 -    0x00,0x10,0x47,0x01,0xD0,0x04,0xD0,0x04,  /* 00000688    "..G....." */
  28.217 -    0x00,0x02,0x79,0x00,0x14,0x0B,0x5F,0x43,  /* 00000690    "..y..._C" */
  28.218 -    0x52,0x53,0x00,0xA4,0x43,0x52,0x53,0x5F,  /* 00000698    "RS..CRS_" */
  28.219 -    0x5B,0x82,0x2B,0x50,0x49,0x43,0x5F,0x08,  /* 000006A0    "[.+PIC_." */
  28.220 -    0x5F,0x48,0x49,0x44,0x0B,0x41,0xD0,0x08,  /* 000006A8    "_HID.A.." */
  28.221 -    0x5F,0x43,0x52,0x53,0x11,0x18,0x0A,0x15,  /* 000006B0    "_CRS...." */
  28.222 -    0x47,0x01,0x20,0x00,0x20,0x00,0x01,0x02,  /* 000006B8    "G. . ..." */
  28.223 -    0x47,0x01,0xA0,0x00,0xA0,0x00,0x01,0x02,  /* 000006C0    "G......." */
  28.224 -    0x22,0x04,0x00,0x79,0x00,0x5B,0x82,0x47,  /* 000006C8    ""..y.[.G" */
  28.225 -    0x05,0x44,0x4D,0x41,0x30,0x08,0x5F,0x48,  /* 000006D0    ".DMA0._H" */
  28.226 -    0x49,0x44,0x0C,0x41,0xD0,0x02,0x00,0x08,  /* 000006D8    "ID.A...." */
  28.227 -    0x5F,0x43,0x52,0x53,0x11,0x41,0x04,0x0A,  /* 000006E0    "_CRS.A.." */
  28.228 -    0x3D,0x2A,0x10,0x04,0x47,0x01,0x00,0x00,  /* 000006E8    "=*..G..." */
  28.229 -    0x00,0x00,0x00,0x10,0x47,0x01,0x81,0x00,  /* 000006F0    "....G..." */
  28.230 -    0x81,0x00,0x00,0x03,0x47,0x01,0x87,0x00,  /* 000006F8    "....G..." */
  28.231 -    0x87,0x00,0x00,0x01,0x47,0x01,0x89,0x00,  /* 00000700    "....G..." */
  28.232 -    0x89,0x00,0x00,0x03,0x47,0x01,0x8F,0x00,  /* 00000708    "....G..." */
  28.233 -    0x8F,0x00,0x00,0x01,0x47,0x01,0xC0,0x00,  /* 00000710    "....G..." */
  28.234 -    0xC0,0x00,0x00,0x20,0x47,0x01,0x80,0x04,  /* 00000718    "... G..." */
  28.235 -    0x80,0x04,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000720    "....y.[." */
  28.236 -    0x25,0x54,0x4D,0x52,0x5F,0x08,0x5F,0x48,  /* 00000728    "%TMR_._H" */
  28.237 -    0x49,0x44,0x0C,0x41,0xD0,0x01,0x00,0x08,  /* 00000730    "ID.A...." */
  28.238 -    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000738    "_CRS...." */
  28.239 -    0x47,0x01,0x40,0x00,0x40,0x00,0x00,0x04,  /* 00000740    "G.@.@..." */
  28.240 -    0x22,0x01,0x00,0x79,0x00,0x5B,0x82,0x25,  /* 00000748    ""..y.[.%" */
  28.241 -    0x52,0x54,0x43,0x5F,0x08,0x5F,0x48,0x49,  /* 00000750    "RTC_._HI" */
  28.242 -    0x44,0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F,  /* 00000758    "D.A...._" */
  28.243 -    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000760    "CRS....G" */
  28.244 -    0x01,0x70,0x00,0x70,0x00,0x00,0x02,0x22,  /* 00000768    ".p.p..."" */
  28.245 -    0x00,0x01,0x79,0x00,0x5B,0x82,0x22,0x53,  /* 00000770    "..y.[."S" */
  28.246 -    0x50,0x4B,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000778    "PKR._HID" */
  28.247 -    0x0C,0x41,0xD0,0x08,0x00,0x08,0x5F,0x43,  /* 00000780    ".A...._C" */
  28.248 -    0x52,0x53,0x11,0x0D,0x0A,0x0A,0x47,0x01,  /* 00000788    "RS....G." */
  28.249 -    0x61,0x00,0x61,0x00,0x00,0x01,0x79,0x00,  /* 00000790    "a.a...y." */
  28.250 -    0x5B,0x82,0x31,0x50,0x53,0x32,0x4D,0x08,  /* 00000798    "[.1PS2M." */
  28.251 -    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0F,  /* 000007A0    "_HID.A.." */
  28.252 -    0x13,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 000007A8    ".._CID.A" */
  28.253 -    0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54,  /* 000007B0    "....._ST" */
  28.254 -    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 000007B8    "A....._C" */
  28.255 -    0x52,0x53,0x11,0x08,0x0A,0x05,0x22,0x00,  /* 000007C0    "RS...."." */
  28.256 -    0x10,0x79,0x00,0x5B,0x82,0x42,0x04,0x50,  /* 000007C8    ".y.[.B.P" */
  28.257 -    0x53,0x32,0x4B,0x08,0x5F,0x48,0x49,0x44,  /* 000007D0    "S2K._HID" */
  28.258 -    0x0C,0x41,0xD0,0x03,0x03,0x08,0x5F,0x43,  /* 000007D8    ".A...._C" */
  28.259 -    0x49,0x44,0x0C,0x41,0xD0,0x03,0x0B,0x14,  /* 000007E0    "ID.A...." */
  28.260 -    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 000007E8    "._STA..." */
  28.261 -    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 000007F0    ".._CRS.." */
  28.262 -    0x0A,0x15,0x47,0x01,0x60,0x00,0x60,0x00,  /* 000007F8    "..G.`.`." */
  28.263 -    0x00,0x01,0x47,0x01,0x64,0x00,0x64,0x00,  /* 00000800    "..G.d.d." */
  28.264 -    0x00,0x01,0x22,0x02,0x00,0x79,0x00,0x5B,  /* 00000808    ".."..y.[" */
  28.265 -    0x82,0x3A,0x46,0x44,0x43,0x30,0x08,0x5F,  /* 00000810    ".:FDC0._" */
  28.266 -    0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00,  /* 00000818    "HID.A..." */
  28.267 -    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000820    ".._STA.." */
  28.268 -    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000828    "..._CRS." */
  28.269 -    0x1B,0x0A,0x18,0x47,0x01,0xF0,0x03,0xF0,  /* 00000830    "...G...." */
  28.270 -    0x03,0x01,0x06,0x47,0x01,0xF7,0x03,0xF7,  /* 00000838    "...G...." */
  28.271 -    0x03,0x01,0x01,0x22,0x40,0x00,0x2A,0x04,  /* 00000840    "..."@.*." */
  28.272 -    0x00,0x79,0x00,0x5B,0x82,0x35,0x55,0x41,  /* 00000848    ".y.[.5UA" */
  28.273 -    0x52,0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000850    "R1._HID." */
  28.274 -    0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,0x49,  /* 00000858    "A...._UI" */
  28.275 -    0x44,0x01,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000860    "D..._STA" */
  28.276 -    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000868    "....._CR" */
  28.277 -    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8,  /* 00000870    "S....G.." */
  28.278 -    0x03,0xF8,0x03,0x01,0x08,0x22,0x10,0x00,  /* 00000878    ".....".." */
  28.279 -    0x79,0x00,0x5B,0x82,0x36,0x4C,0x54,0x50,  /* 00000880    "y.[.6LTP" */
  28.280 -    0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000888    "1._HID.A" */
  28.281 -    0xD0,0x04,0x00,0x08,0x5F,0x55,0x49,0x44,  /* 00000890    "...._UID" */
  28.282 -    0x0A,0x02,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000898    "...._STA" */
  28.283 -    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 000008A0    "....._CR" */
  28.284 -    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0x78,  /* 000008A8    "S....G.x" */
  28.285 -    0x03,0x78,0x03,0x08,0x08,0x22,0x80,0x00,  /* 000008B0    ".x...".." */
  28.286 +    0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xF4,0x00,  /* 000001B0    "........" */
  28.287 +    0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x79,  /* 000001B8    ".......y" */
  28.288 +    0x00,0xA4,0x50,0x52,0x54,0x30,0x08,0x42,  /* 000001C0    "..PRT0.B" */
  28.289 +    0x55,0x46,0x41,0x11,0x09,0x0A,0x06,0x23,  /* 000001C8    "UFA....#" */
  28.290 +    0xF8,0xDC,0x18,0x79,0x00,0x08,0x42,0x55,  /* 000001D0    "...y..BU" */
  28.291 +    0x46,0x42,0x11,0x09,0x0A,0x06,0x23,0x00,  /* 000001D8    "FB....#." */
  28.292 +    0x00,0x18,0x79,0x00,0x8B,0x42,0x55,0x46,  /* 000001E0    "..y..BUF" */
  28.293 +    0x42,0x01,0x49,0x52,0x51,0x56,0x08,0x42,  /* 000001E8    "B.IRQV.B" */
  28.294 +    0x55,0x46,0x43,0x11,0x07,0x0A,0x04,0x05,  /* 000001F0    "UFC....." */
  28.295 +    0x07,0x0A,0x0B,0x8C,0x42,0x55,0x46,0x43,  /* 000001F8    "....BUFC" */
  28.296 +    0x01,0x50,0x49,0x51,0x41,0x8C,0x42,0x55,  /* 00000200    ".PIQA.BU" */
  28.297 +    0x46,0x43,0x01,0x50,0x49,0x51,0x42,0x8C,  /* 00000208    "FC.PIQB." */
  28.298 +    0x42,0x55,0x46,0x43,0x01,0x50,0x49,0x51,  /* 00000210    "BUFC.PIQ" */
  28.299 +    0x43,0x8C,0x42,0x55,0x46,0x43,0x01,0x50,  /* 00000218    "C.BUFC.P" */
  28.300 +    0x49,0x51,0x44,0x5B,0x82,0x48,0x08,0x4C,  /* 00000220    "IQD[.H.L" */
  28.301 +    0x4E,0x4B,0x41,0x08,0x5F,0x48,0x49,0x44,  /* 00000228    "NKA._HID" */
  28.302 +    0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,  /* 00000230    ".A...._U" */
  28.303 +    0x49,0x44,0x01,0x14,0x1C,0x5F,0x53,0x54,  /* 00000238    "ID..._ST" */
  28.304 +    0x41,0x00,0x7B,0x50,0x49,0x52,0x41,0x0A,  /* 00000240    "A.{PIRA." */
  28.305 +    0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,  /* 00000248    ".`...`.." */
  28.306 +    0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,  /* 00000250    "........" */
  28.307 +    0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,  /* 00000258    ".._PRS.." */
  28.308 +    0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44,  /* 00000260    "BUFA.._D" */
  28.309 +    0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x41,  /* 00000268    "IS.}PIRA" */
  28.310 +    0x0A,0x80,0x50,0x49,0x52,0x41,0x14,0x1A,  /* 00000270    "..PIRA.." */
  28.311 +    0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49,  /* 00000278    "_CRS.{PI" */
  28.312 +    0x52,0x42,0x0A,0x0F,0x60,0x79,0x01,0x60,  /* 00000280    "RB..`y.`" */
  28.313 +    0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46,  /* 00000288    "IRQV.BUF" */
  28.314 +    0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,  /* 00000290    "B.._SRS." */
  28.315 +    0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82,  /* 00000298    ".h.IRQ1." */
  28.316 +    0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70,  /* 000002A0    "IRQ1`v`p" */
  28.317 +    0x60,0x50,0x49,0x52,0x41,0x5B,0x82,0x49,  /* 000002A8    "`PIRA[.I" */
  28.318 +    0x08,0x4C,0x4E,0x4B,0x42,0x08,0x5F,0x48,  /* 000002B0    ".LNKB._H" */
  28.319 +    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 000002B8    "ID.A...." */
  28.320 +    0x5F,0x55,0x49,0x44,0x0A,0x02,0x14,0x1C,  /* 000002C0    "_UID...." */
  28.321 +    0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49,  /* 000002C8    "_STA.{PI" */
  28.322 +    0x52,0x42,0x0A,0x80,0x60,0xA0,0x08,0x93,  /* 000002D0    "RB..`..." */
  28.323 +    0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,  /* 000002D8    "`......." */
  28.324 +    0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,  /* 000002E0    "....._PR" */
  28.325 +    0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14,  /* 000002E8    "S..BUFA." */
  28.326 +    0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,  /* 000002F0    "._DIS.}P" */
  28.327 +    0x49,0x52,0x42,0x0A,0x80,0x50,0x49,0x52,  /* 000002F8    "IRB..PIR" */
  28.328 +    0x42,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,  /* 00000300    "B.._CRS." */
  28.329 +    0x7B,0x50,0x49,0x52,0x42,0x0A,0x0F,0x60,  /* 00000308    "{PIRB..`" */
  28.330 +    0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4,  /* 00000310    "y.`IRQV." */
  28.331 +    0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,  /* 00000318    "BUFB.._S" */
  28.332 +    0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52,  /* 00000320    "RS..h.IR" */
  28.333 +    0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60,  /* 00000328    "Q1.IRQ1`" */
  28.334 +    0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x42,  /* 00000330    "v`p`PIRB" */
  28.335 +    0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,0x43,  /* 00000338    "[.I.LNKC" */
  28.336 +    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000340    "._HID.A." */
  28.337 +    0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,  /* 00000348    "..._UID." */
  28.338 +    0x03,0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,  /* 00000350    "..._STA." */
  28.339 +    0x7B,0x50,0x49,0x52,0x43,0x0A,0x80,0x60,  /* 00000358    "{PIRC..`" */
  28.340 +    0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,  /* 00000360    "...`...." */
  28.341 +    0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,  /* 00000368    "........" */
  28.342 +    0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,0x55,  /* 00000370    "_PRS..BU" */
  28.343 +    0x46,0x41,0x14,0x11,0x5F,0x44,0x49,0x53,  /* 00000378    "FA.._DIS" */
  28.344 +    0x00,0x7D,0x50,0x49,0x52,0x43,0x0A,0x80,  /* 00000380    ".}PIRC.." */
  28.345 +    0x50,0x49,0x52,0x43,0x14,0x1A,0x5F,0x43,  /* 00000388    "PIRC.._C" */
  28.346 +    0x52,0x53,0x00,0x7B,0x50,0x49,0x52,0x43,  /* 00000390    "RS.{PIRC" */
  28.347 +    0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,0x52,  /* 00000398    "..`y.`IR" */
  28.348 +    0x51,0x56,0xA4,0x42,0x55,0x46,0x42,0x14,  /* 000003A0    "QV.BUFB." */
  28.349 +    0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,  /* 000003A8    "._SRS..h" */
  28.350 +    0x01,0x49,0x52,0x51,0x31,0x82,0x49,0x52,  /* 000003B0    ".IRQ1.IR" */
  28.351 +    0x51,0x31,0x60,0x76,0x60,0x70,0x60,0x50,  /* 000003B8    "Q1`v`p`P" */
  28.352 +    0x49,0x52,0x43,0x5B,0x82,0x49,0x08,0x4C,  /* 000003C0    "IRC[.I.L" */
  28.353 +    0x4E,0x4B,0x44,0x08,0x5F,0x48,0x49,0x44,  /* 000003C8    "NKD._HID" */
  28.354 +    0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,  /* 000003D0    ".A...._U" */
  28.355 +    0x49,0x44,0x0A,0x04,0x14,0x1C,0x5F,0x53,  /* 000003D8    "ID...._S" */
  28.356 +    0x54,0x41,0x00,0x7B,0x50,0x49,0x52,0x44,  /* 000003E0    "TA.{PIRD" */
  28.357 +    0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,  /* 000003E8    "..`...`." */
  28.358 +    0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,  /* 000003F0    "........" */
  28.359 +    0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,  /* 000003F8    "..._PRS." */
  28.360 +    0xA4,0x42,0x55,0x46,0x41,0x14,0x11,0x5F,  /* 00000400    ".BUFA.._" */
  28.361 +    0x44,0x49,0x53,0x00,0x7D,0x50,0x49,0x52,  /* 00000408    "DIS.}PIR" */
  28.362 +    0x44,0x0A,0x80,0x50,0x49,0x52,0x44,0x14,  /* 00000410    "D..PIRD." */
  28.363 +    0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,  /* 00000418    "._CRS.{P" */
  28.364 +    0x49,0x52,0x44,0x0A,0x0F,0x60,0x79,0x01,  /* 00000420    "IRD..`y." */
  28.365 +    0x60,0x49,0x52,0x51,0x56,0xA4,0x42,0x55,  /* 00000428    "`IRQV.BU" */
  28.366 +    0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,  /* 00000430    "FB.._SRS" */
  28.367 +    0x01,0x8B,0x68,0x01,0x49,0x52,0x51,0x31,  /* 00000438    "..h.IRQ1" */
  28.368 +    0x82,0x49,0x52,0x51,0x31,0x60,0x76,0x60,  /* 00000440    ".IRQ1`v`" */
  28.369 +    0x70,0x60,0x50,0x49,0x52,0x44,0x14,0x16,  /* 00000448    "p`PIRD.." */
  28.370 +    0x5F,0x50,0x52,0x54,0x00,0xA0,0x0A,0x50,  /* 00000450    "_PRT...P" */
  28.371 +    0x49,0x43,0x44,0xA4,0x50,0x52,0x54,0x41,  /* 00000458    "ICD.PRTA" */
  28.372 +    0xA4,0x50,0x52,0x54,0x50,0x08,0x50,0x52,  /* 00000460    ".PRTP.PR" */
  28.373 +    0x54,0x50,0x12,0x4D,0x11,0x14,0x12,0x0B,  /* 00000468    "TP.M...." */
  28.374 +    0x04,0x0B,0xFF,0xFF,0x00,0x4C,0x4E,0x4B,  /* 00000470    ".....LNK" */
  28.375 +    0x41,0x00,0x12,0x0B,0x04,0x0B,0xFF,0xFF,  /* 00000478    "A......." */
  28.376 +    0x01,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0C,  /* 00000480    ".LNKB..." */
  28.377 +    0x04,0x0B,0xFF,0xFF,0x0A,0x02,0x4C,0x4E,  /* 00000488    "......LN" */
  28.378 +    0x4B,0x43,0x00,0x12,0x0C,0x04,0x0B,0xFF,  /* 00000490    "KC......" */
  28.379 +    0xFF,0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000498    "...LNKD." */
  28.380 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 000004A0    "........" */
  28.381 +    0x00,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 000004A8    ".LNKB..." */
  28.382 +    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x01,0x4C,  /* 000004B0    ".......L" */
  28.383 +    0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,  /* 000004B8    "NKC....." */
  28.384 +    0xFF,0xFF,0x01,0x00,0x0A,0x02,0x4C,0x4E,  /* 000004C0    "......LN" */
  28.385 +    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000004C8    "KD......" */
  28.386 +    0xFF,0x01,0x00,0x0A,0x03,0x4C,0x4E,0x4B,  /* 000004D0    ".....LNK" */
  28.387 +    0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 000004D8    "A......." */
  28.388 +    0x02,0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,  /* 000004E0    "...LNKC." */
  28.389 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 000004E8    "........" */
  28.390 +    0x01,0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,  /* 000004F0    ".LNKD..." */
  28.391 +    0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x02,  /* 000004F8    "........" */
  28.392 +    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 00000500    "LNKA...." */
  28.393 +    0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x03,0x4C,  /* 00000508    ".......L" */
  28.394 +    0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,  /* 00000510    "NKB....." */
  28.395 +    0xFF,0xFF,0x03,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000518    ".....LNK" */
  28.396 +    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000520    "D......." */
  28.397 +    0x03,0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,  /* 00000528    "...LNKA." */
  28.398 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03,0x00,  /* 00000530    "........" */
  28.399 +    0x0A,0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000538    "..LNKB.." */
  28.400 +    0x0E,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,  /* 00000540    "........" */
  28.401 +    0x03,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,  /* 00000548    ".LNKC..." */
  28.402 +    0x04,0x0C,0xFF,0xFF,0x04,0x00,0x00,0x4C,  /* 00000550    ".......L" */
  28.403 +    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000558    "NKA....." */
  28.404 +    0xFF,0xFF,0x04,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000560    ".....LNK" */
  28.405 +    0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000568    "B......." */
  28.406 +    0x04,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x43,  /* 00000570    "....LNKC" */
  28.407 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x04,  /* 00000578    "........" */
  28.408 +    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000580    "...LNKD." */
  28.409 +    0x08,0x50,0x52,0x54,0x41,0x12,0x32,0x04,  /* 00000588    ".PRTA.2." */
  28.410 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 00000590    "........" */
  28.411 +    0x00,0x00,0x0A,0x05,0x12,0x0B,0x04,0x0C,  /* 00000598    "........" */
  28.412 +    0xFF,0xFF,0x02,0x00,0x00,0x00,0x0A,0x07,  /* 000005A0    "........" */
  28.413 +    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x03,0x00,  /* 000005A8    "........" */
  28.414 +    0x00,0x00,0x0A,0x0A,0x12,0x0B,0x04,0x0C,  /* 000005B0    "........" */
  28.415 +    0xFF,0xFF,0x04,0x00,0x00,0x00,0x0A,0x0B,  /* 000005B8    "........" */
  28.416 +    0x5B,0x82,0x48,0x31,0x49,0x53,0x41,0x5F,  /* 000005C0    "[.H1ISA_" */
  28.417 +    0x08,0x5F,0x41,0x44,0x52,0x00,0x5B,0x80,  /* 000005C8    "._ADR.[." */
  28.418 +    0x50,0x49,0x52,0x51,0x02,0x0A,0x60,0x0A,  /* 000005D0    "PIRQ..`." */
  28.419 +    0x04,0x10,0x2E,0x5C,0x00,0x5B,0x81,0x29,  /* 000005D8    "...\.[.)" */
  28.420 +    0x5C,0x2F,0x04,0x5F,0x53,0x42,0x5F,0x50,  /* 000005E0    "\/._SB_P" */
  28.421 +    0x43,0x49,0x30,0x49,0x53,0x41,0x5F,0x50,  /* 000005E8    "CI0ISA_P" */
  28.422 +    0x49,0x52,0x51,0x01,0x50,0x49,0x52,0x41,  /* 000005F0    "IRQ.PIRA" */
  28.423 +    0x08,0x50,0x49,0x52,0x42,0x08,0x50,0x49,  /* 000005F8    ".PIRB.PI" */
  28.424 +    0x52,0x43,0x08,0x50,0x49,0x52,0x44,0x08,  /* 00000600    "RC.PIRD." */
  28.425 +    0x5B,0x82,0x46,0x0B,0x53,0x59,0x53,0x52,  /* 00000608    "[.F.SYSR" */
  28.426 +    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000610    "._HID.A." */
  28.427 +    0x0C,0x02,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 00000618    "..._UID." */
  28.428 +    0x08,0x43,0x52,0x53,0x5F,0x11,0x4E,0x08,  /* 00000620    ".CRS_.N." */
  28.429 +    0x0A,0x8A,0x47,0x01,0x10,0x00,0x10,0x00,  /* 00000628    "..G....." */
  28.430 +    0x00,0x10,0x47,0x01,0x22,0x00,0x22,0x00,  /* 00000630    "..G."."." */
  28.431 +    0x00,0x0C,0x47,0x01,0x30,0x00,0x30,0x00,  /* 00000638    "..G.0.0." */
  28.432 +    0x00,0x10,0x47,0x01,0x44,0x00,0x44,0x00,  /* 00000640    "..G.D.D." */
  28.433 +    0x00,0x1C,0x47,0x01,0x62,0x00,0x62,0x00,  /* 00000648    "..G.b.b." */
  28.434 +    0x00,0x02,0x47,0x01,0x65,0x00,0x65,0x00,  /* 00000650    "..G.e.e." */
  28.435 +    0x00,0x0B,0x47,0x01,0x72,0x00,0x72,0x00,  /* 00000658    "..G.r.r." */
  28.436 +    0x00,0x0E,0x47,0x01,0x80,0x00,0x80,0x00,  /* 00000660    "..G....." */
  28.437 +    0x00,0x01,0x47,0x01,0x84,0x00,0x84,0x00,  /* 00000668    "..G....." */
  28.438 +    0x00,0x03,0x47,0x01,0x88,0x00,0x88,0x00,  /* 00000670    "..G....." */
  28.439 +    0x00,0x01,0x47,0x01,0x8C,0x00,0x8C,0x00,  /* 00000678    "..G....." */
  28.440 +    0x00,0x03,0x47,0x01,0x90,0x00,0x90,0x00,  /* 00000680    "..G....." */
  28.441 +    0x00,0x10,0x47,0x01,0xA2,0x00,0xA2,0x00,  /* 00000688    "..G....." */
  28.442 +    0x00,0x1C,0x47,0x01,0xE0,0x00,0xE0,0x00,  /* 00000690    "..G....." */
  28.443 +    0x00,0x10,0x47,0x01,0xA0,0x08,0xA0,0x08,  /* 00000698    "..G....." */
  28.444 +    0x00,0x04,0x47,0x01,0xC0,0x0C,0xC0,0x0C,  /* 000006A0    "..G....." */
  28.445 +    0x00,0x10,0x47,0x01,0xD0,0x04,0xD0,0x04,  /* 000006A8    "..G....." */
  28.446 +    0x00,0x02,0x79,0x00,0x14,0x0B,0x5F,0x43,  /* 000006B0    "..y..._C" */
  28.447 +    0x52,0x53,0x00,0xA4,0x43,0x52,0x53,0x5F,  /* 000006B8    "RS..CRS_" */
  28.448 +    0x5B,0x82,0x2B,0x50,0x49,0x43,0x5F,0x08,  /* 000006C0    "[.+PIC_." */
  28.449 +    0x5F,0x48,0x49,0x44,0x0B,0x41,0xD0,0x08,  /* 000006C8    "_HID.A.." */
  28.450 +    0x5F,0x43,0x52,0x53,0x11,0x18,0x0A,0x15,  /* 000006D0    "_CRS...." */
  28.451 +    0x47,0x01,0x20,0x00,0x20,0x00,0x01,0x02,  /* 000006D8    "G. . ..." */
  28.452 +    0x47,0x01,0xA0,0x00,0xA0,0x00,0x01,0x02,  /* 000006E0    "G......." */
  28.453 +    0x22,0x04,0x00,0x79,0x00,0x5B,0x82,0x47,  /* 000006E8    ""..y.[.G" */
  28.454 +    0x05,0x44,0x4D,0x41,0x30,0x08,0x5F,0x48,  /* 000006F0    ".DMA0._H" */
  28.455 +    0x49,0x44,0x0C,0x41,0xD0,0x02,0x00,0x08,  /* 000006F8    "ID.A...." */
  28.456 +    0x5F,0x43,0x52,0x53,0x11,0x41,0x04,0x0A,  /* 00000700    "_CRS.A.." */
  28.457 +    0x3D,0x2A,0x10,0x04,0x47,0x01,0x00,0x00,  /* 00000708    "=*..G..." */
  28.458 +    0x00,0x00,0x00,0x10,0x47,0x01,0x81,0x00,  /* 00000710    "....G..." */
  28.459 +    0x81,0x00,0x00,0x03,0x47,0x01,0x87,0x00,  /* 00000718    "....G..." */
  28.460 +    0x87,0x00,0x00,0x01,0x47,0x01,0x89,0x00,  /* 00000720    "....G..." */
  28.461 +    0x89,0x00,0x00,0x03,0x47,0x01,0x8F,0x00,  /* 00000728    "....G..." */
  28.462 +    0x8F,0x00,0x00,0x01,0x47,0x01,0xC0,0x00,  /* 00000730    "....G..." */
  28.463 +    0xC0,0x00,0x00,0x20,0x47,0x01,0x80,0x04,  /* 00000738    "... G..." */
  28.464 +    0x80,0x04,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000740    "....y.[." */
  28.465 +    0x25,0x54,0x4D,0x52,0x5F,0x08,0x5F,0x48,  /* 00000748    "%TMR_._H" */
  28.466 +    0x49,0x44,0x0C,0x41,0xD0,0x01,0x00,0x08,  /* 00000750    "ID.A...." */
  28.467 +    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000758    "_CRS...." */
  28.468 +    0x47,0x01,0x40,0x00,0x40,0x00,0x00,0x04,  /* 00000760    "G.@.@..." */
  28.469 +    0x22,0x01,0x00,0x79,0x00,0x5B,0x82,0x25,  /* 00000768    ""..y.[.%" */
  28.470 +    0x52,0x54,0x43,0x5F,0x08,0x5F,0x48,0x49,  /* 00000770    "RTC_._HI" */
  28.471 +    0x44,0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F,  /* 00000778    "D.A...._" */
  28.472 +    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000780    "CRS....G" */
  28.473 +    0x01,0x70,0x00,0x70,0x00,0x00,0x02,0x22,  /* 00000788    ".p.p..."" */
  28.474 +    0x00,0x01,0x79,0x00,0x5B,0x82,0x22,0x53,  /* 00000790    "..y.[."S" */
  28.475 +    0x50,0x4B,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000798    "PKR._HID" */
  28.476 +    0x0C,0x41,0xD0,0x08,0x00,0x08,0x5F,0x43,  /* 000007A0    ".A...._C" */
  28.477 +    0x52,0x53,0x11,0x0D,0x0A,0x0A,0x47,0x01,  /* 000007A8    "RS....G." */
  28.478 +    0x61,0x00,0x61,0x00,0x00,0x01,0x79,0x00,  /* 000007B0    "a.a...y." */
  28.479 +    0x5B,0x82,0x31,0x50,0x53,0x32,0x4D,0x08,  /* 000007B8    "[.1PS2M." */
  28.480 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0F,  /* 000007C0    "_HID.A.." */
  28.481 +    0x13,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 000007C8    ".._CID.A" */
  28.482 +    0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54,  /* 000007D0    "....._ST" */
  28.483 +    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 000007D8    "A....._C" */
  28.484 +    0x52,0x53,0x11,0x08,0x0A,0x05,0x22,0x00,  /* 000007E0    "RS...."." */
  28.485 +    0x10,0x79,0x00,0x5B,0x82,0x42,0x04,0x50,  /* 000007E8    ".y.[.B.P" */
  28.486 +    0x53,0x32,0x4B,0x08,0x5F,0x48,0x49,0x44,  /* 000007F0    "S2K._HID" */
  28.487 +    0x0C,0x41,0xD0,0x03,0x03,0x08,0x5F,0x43,  /* 000007F8    ".A...._C" */
  28.488 +    0x49,0x44,0x0C,0x41,0xD0,0x03,0x0B,0x14,  /* 00000800    "ID.A...." */
  28.489 +    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000808    "._STA..." */
  28.490 +    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 00000810    ".._CRS.." */
  28.491 +    0x0A,0x15,0x47,0x01,0x60,0x00,0x60,0x00,  /* 00000818    "..G.`.`." */
  28.492 +    0x00,0x01,0x47,0x01,0x64,0x00,0x64,0x00,  /* 00000820    "..G.d.d." */
  28.493 +    0x00,0x01,0x22,0x02,0x00,0x79,0x00,0x5B,  /* 00000828    ".."..y.[" */
  28.494 +    0x82,0x3A,0x46,0x44,0x43,0x30,0x08,0x5F,  /* 00000830    ".:FDC0._" */
  28.495 +    0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00,  /* 00000838    "HID.A..." */
  28.496 +    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000840    ".._STA.." */
  28.497 +    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000848    "..._CRS." */
  28.498 +    0x1B,0x0A,0x18,0x47,0x01,0xF0,0x03,0xF0,  /* 00000850    "...G...." */
  28.499 +    0x03,0x01,0x06,0x47,0x01,0xF7,0x03,0xF7,  /* 00000858    "...G...." */
  28.500 +    0x03,0x01,0x01,0x22,0x40,0x00,0x2A,0x04,  /* 00000860    "..."@.*." */
  28.501 +    0x00,0x79,0x00,0x5B,0x82,0x35,0x55,0x41,  /* 00000868    ".y.[.5UA" */
  28.502 +    0x52,0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000870    "R1._HID." */
  28.503 +    0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,0x49,  /* 00000878    "A...._UI" */
  28.504 +    0x44,0x01,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000880    "D..._STA" */
  28.505 +    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000888    "....._CR" */
  28.506 +    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8,  /* 00000890    "S....G.." */
  28.507 +    0x03,0xF8,0x03,0x01,0x08,0x22,0x10,0x00,  /* 00000898    ".....".." */
  28.508 +    0x79,0x00,0x5B,0x82,0x36,0x4C,0x54,0x50,  /* 000008A0    "y.[.6LTP" */
  28.509 +    0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 000008A8    "1._HID.A" */
  28.510 +    0xD0,0x04,0x00,0x08,0x5F,0x55,0x49,0x44,  /* 000008B0    "...._UID" */
  28.511 +    0x0A,0x02,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 000008B8    "...._STA" */
  28.512 +    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 000008C0    "....._CR" */
  28.513 +    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0x78,  /* 000008C8    "S....G.x" */
  28.514 +    0x03,0x78,0x03,0x08,0x08,0x22,0x80,0x00,  /* 000008D0    ".x...".." */
  28.515      0x79,0x00,
  28.516  };
  28.517  int DsdtLen=sizeof(AmlCode);
    29.1 --- a/tools/firmware/hvmloader/smbios.c	Sun Oct 08 18:55:12 2006 -0600
    29.2 +++ b/tools/firmware/hvmloader/smbios.c	Sat Oct 14 13:28:45 2006 -0600
    29.3 @@ -92,7 +92,6 @@ write_smbios_tables(void *start,
    29.4  	unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
    29.5  	char *p, *q;
    29.6  	char cpu_manufacturer[15];
    29.7 -	size_t structure_table_length;
    29.8  
    29.9  	get_cpu_manufacturer(cpu_manufacturer, 15);
   29.10  
    30.1 --- a/tools/ioemu/vl.c	Sun Oct 08 18:55:12 2006 -0600
    30.2 +++ b/tools/ioemu/vl.c	Sat Oct 14 13:28:45 2006 -0600
    30.3 @@ -122,6 +122,7 @@ static DisplayState display_state;
    30.4  int nographic;
    30.5  int vncviewer;
    30.6  int vncunused;
    30.7 +struct sockaddr_in vnclisten_addr;
    30.8  const char* keyboard_layout = NULL;
    30.9  int64_t ticks_per_sec;
   30.10  char *boot_device = NULL;
   30.11 @@ -2783,10 +2784,22 @@ fail:
   30.12      return -1;
   30.13  }
   30.14  
   30.15 +int parse_host(struct sockaddr_in *saddr, const char *buf)
   30.16 +{
   30.17 +    struct hostent *he;
   30.18 +
   30.19 +    if ((he = gethostbyname(buf)) != NULL) {
   30.20 +        saddr->sin_addr = *(struct in_addr *)he->h_addr;
   30.21 +    } else {
   30.22 +        if (!inet_aton(buf, &saddr->sin_addr))
   30.23 +            return -1;
   30.24 +    }
   30.25 +    return 0;
   30.26 +}
   30.27 +
   30.28  int parse_host_port(struct sockaddr_in *saddr, const char *str)
   30.29  {
   30.30      char buf[512];
   30.31 -    struct hostent *he;
   30.32      const char *p, *r;
   30.33      int port;
   30.34  
   30.35 @@ -2797,14 +2810,8 @@ int parse_host_port(struct sockaddr_in *
   30.36      if (buf[0] == '\0') {
   30.37          saddr->sin_addr.s_addr = 0;
   30.38      } else {
   30.39 -        if (isdigit(buf[0])) {
   30.40 -            if (!inet_aton(buf, &saddr->sin_addr))
   30.41 -                return -1;
   30.42 -        } else {
   30.43 -            if ((he = gethostbyname(buf)) == NULL)
   30.44 -                return - 1;
   30.45 -            saddr->sin_addr = *(struct in_addr *)he->h_addr;
   30.46 -        }
   30.47 +        if (parse_host(saddr, buf) == -1)
   30.48 +            return -1;
   30.49      }
   30.50      port = strtol(p, (char **)&r, 0);
   30.51      if (r == p)
   30.52 @@ -5352,6 +5359,7 @@ void help(void)
   30.53  	   "-vnc display    start a VNC server on display\n"
   30.54             "-vncviewer      start a vncviewer process for this domain\n"
   30.55             "-vncunused      bind the VNC server to an unused port\n"
   30.56 +           "-vnclisten      bind the VNC server to this address\n"
   30.57             "-timeoffset     time offset (in seconds) from local time\n"
   30.58             "-acpi           disable or enable ACPI of HVM domain \n"
   30.59             "\n"
   30.60 @@ -5444,6 +5452,7 @@ enum {
   30.61      QEMU_OPTION_acpi,
   30.62      QEMU_OPTION_vncviewer,
   30.63      QEMU_OPTION_vncunused,
   30.64 +    QEMU_OPTION_vnclisten,
   30.65  };
   30.66  
   30.67  typedef struct QEMUOption {
   30.68 @@ -5522,6 +5531,7 @@ const QEMUOption qemu_options[] = {
   30.69      { "vnc", HAS_ARG, QEMU_OPTION_vnc },
   30.70      { "vncviewer", 0, QEMU_OPTION_vncviewer },
   30.71      { "vncunused", 0, QEMU_OPTION_vncunused },
   30.72 +    { "vnclisten", HAS_ARG, QEMU_OPTION_vnclisten },
   30.73      
   30.74      /* temporary options */
   30.75      { "usb", 0, QEMU_OPTION_usb },
   30.76 @@ -5928,6 +5938,8 @@ int main(int argc, char **argv)
   30.77  
   30.78      nb_nics = 0;
   30.79      /* default mac address of the first network interface */
   30.80 +
   30.81 +    memset(&vnclisten_addr.sin_addr, 0, sizeof(vnclisten_addr.sin_addr));
   30.82      
   30.83      /* init debug */
   30.84      sprintf(qemu_dm_logfilename, "/var/log/xen/qemu-dm.%d.log", getpid());
   30.85 @@ -6312,6 +6324,9 @@ int main(int argc, char **argv)
   30.86                  if (vnc_display == -1)
   30.87                      vnc_display = 0;
   30.88                  break;
   30.89 +            case QEMU_OPTION_vnclisten:
   30.90 +                parse_host(&vnclisten_addr, optarg);
   30.91 +                break;
   30.92              }
   30.93          }
   30.94      }
   30.95 @@ -6548,7 +6563,7 @@ int main(int argc, char **argv)
   30.96      if (nographic) {
   30.97          dumb_display_init(ds);
   30.98      } else if (vnc_display != -1) {
   30.99 -	vnc_display = vnc_display_init(ds, vnc_display, vncunused);
  30.100 +	vnc_display = vnc_display_init(ds, vnc_display, vncunused, &vnclisten_addr);
  30.101  	if (vncviewer)
  30.102  	    vnc_start_viewer(vnc_display);
  30.103  	xenstore_write_vncport(vnc_display);
    31.1 --- a/tools/ioemu/vl.h	Sun Oct 08 18:55:12 2006 -0600
    31.2 +++ b/tools/ioemu/vl.h	Sat Oct 14 13:28:45 2006 -0600
    31.3 @@ -37,6 +37,8 @@
    31.4  #include <unistd.h>
    31.5  #include <fcntl.h>
    31.6  #include <sys/stat.h>
    31.7 +#include <sys/socket.h>
    31.8 +#include <sys/types.h>
    31.9  #include "xenctrl.h"
   31.10  #include "xs.h"
   31.11  #include <xen/hvm/e820.h>
   31.12 @@ -786,7 +788,7 @@ void sdl_display_init(DisplayState *ds, 
   31.13  void cocoa_display_init(DisplayState *ds, int full_screen);
   31.14  
   31.15  /* vnc.c */
   31.16 -int vnc_display_init(DisplayState *ds, int display, int find_unused);
   31.17 +int vnc_display_init(DisplayState *ds, int display, int find_unused, struct sockaddr_in *addr);
   31.18  int vnc_start_viewer(int port);
   31.19  
   31.20  /* ide.c */
    32.1 --- a/tools/ioemu/vnc.c	Sun Oct 08 18:55:12 2006 -0600
    32.2 +++ b/tools/ioemu/vnc.c	Sat Oct 14 13:28:45 2006 -0600
    32.3 @@ -1250,9 +1250,8 @@ static void vnc_listen_read(void *opaque
    32.4      }
    32.5  }
    32.6  
    32.7 -int vnc_display_init(DisplayState *ds, int display, int find_unused)
    32.8 +int vnc_display_init(DisplayState *ds, int display, int find_unused, struct sockaddr_in *addr)
    32.9  {
   32.10 -    struct sockaddr_in addr;
   32.11      int reuse_addr, ret;
   32.12      VncState *vs;
   32.13  
   32.14 @@ -1290,11 +1289,10 @@ int vnc_display_init(DisplayState *ds, i
   32.15      }
   32.16  
   32.17   retry:
   32.18 -    addr.sin_family = AF_INET;
   32.19 -    addr.sin_port = htons(5900 + display);
   32.20 -    memset(&addr.sin_addr, 0, sizeof(addr.sin_addr));
   32.21 +    addr->sin_family = AF_INET;
   32.22 +    addr->sin_port = htons(5900 + display);
   32.23  
   32.24 -    if (bind(vs->lsock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
   32.25 +    if (bind(vs->lsock, (struct sockaddr *)addr, sizeof(struct sockaddr_in)) == -1) {
   32.26  	if (find_unused && errno == EADDRINUSE) {
   32.27  	    display++;
   32.28  	    goto retry;
    33.1 --- a/tools/libxc/xc_load_elf.c	Sun Oct 08 18:55:12 2006 -0600
    33.2 +++ b/tools/libxc/xc_load_elf.c	Sat Oct 14 13:28:45 2006 -0600
    33.3 @@ -364,7 +364,7 @@ static int parseelfimage(const char *ima
    33.4          if ( p != NULL && strncmp(p, "yes", 3) == 0 )
    33.5          {
    33.6              dsi->pae_kernel = PAEKERN_yes;
    33.7 -            if ( !strncmp(p+4, "[extended-cr3]", 14) )
    33.8 +            if ( !strncmp(p+3, "[extended-cr3]", 14) )
    33.9                  dsi->pae_kernel = PAEKERN_extended_cr3;
   33.10          }
   33.11      }
    34.1 --- a/tools/misc/mbootpack/Makefile	Sun Oct 08 18:55:12 2006 -0600
    34.2 +++ b/tools/misc/mbootpack/Makefile	Sat Oct 14 13:28:45 2006 -0600
    34.3 @@ -20,12 +20,8 @@ install: build
    34.4  
    34.5  #  Tools etc.
    34.6  RM 	:= rm -f
    34.7 -GDB	:= gdb
    34.8  INCS	:= -I. -I-
    34.9  DEFS	:= 
   34.10 -LDFLAGS	:= 
   34.11 -CFLAGS	+= -Wpointer-arith -Wcast-qual -Wno-unused -Wno-format
   34.12 -CFLAGS	+= -Wmissing-prototypes -pipe
   34.13  
   34.14  #  What object files need building for the program
   34.15  OBJS	:= mbootpack.o buildimage.o
   34.16 @@ -35,22 +31,22 @@ DEPFLAGS = -Wp,-MD,.$(@F).d
   34.17  DEPS     = .*.d
   34.18  
   34.19  mbootpack: $(OBJS)
   34.20 -	$(HOSTCC) -o $@ $(filter-out %.a, $^)
   34.21 +	$(HOSTCC) $(HOSTCFLAGS) -o $@ $(filter-out %.a, $^)
   34.22  
   34.23  .PHONY: clean
   34.24  clean:
   34.25  	$(RM) mbootpack *.o $(DEPS) bootsect setup bzimage_header.c bin2c
   34.26  
   34.27  bootsect: bootsect.S
   34.28 -	$(CC) $(CFLAGS) $(INCS) $(DEFS) -D__MB_ASM -c bootsect.S -o bootsect.o
   34.29 +	$(CC) -m32 $(INCS) $(DEFS) -D__MB_ASM -c bootsect.S -o bootsect.o
   34.30  	$(LD) -m elf_i386 -Ttext 0x0 -s --oformat binary bootsect.o -o $@
   34.31  
   34.32  setup: setup.S
   34.33 -	$(CC) $(CFLAGS) $(INCS) $(DEFS) -D__MB_ASM -c setup.S -o setup.o
   34.34 +	$(CC) -m32 $(INCS) $(DEFS) -D__MB_ASM -c setup.S -o setup.o
   34.35  	$(LD) -m elf_i386 -Ttext 0x0 -s --oformat binary setup.o -o $@
   34.36  
   34.37  bin2c: bin2c.o 
   34.38 -	$(HOSTCC) -o $@ $^ 
   34.39 +	$(HOSTCC) $(HOSTCFLAGS) -o $@ $^ 
   34.40  
   34.41  bzimage_header.c: bootsect setup bin2c
   34.42  	./bin2c -n 8 -b1 -a bzimage_bootsect bootsect > bzimage_header.c
   34.43 @@ -59,11 +55,8 @@ bzimage_header.c: bootsect setup bin2c
   34.44  buildimage.c: bzimage_header.c
   34.45  	@
   34.46  
   34.47 -%.o: %.S
   34.48 -	$(HOSTCC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@
   34.49 -
   34.50  %.o: %.c
   34.51 -	$(HOSTCC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@
   34.52 +	$(HOSTCC) $(DEPFLAGS) $(HOSTCFLAGS) $(INCS) $(DEFS) -c $< -o $@
   34.53  
   34.54  .PRECIOUS: $(OBJS) $(OBJS:.o=.c) $(DEPS)
   34.55  .SUFFIXES: 
    35.1 --- a/tools/misc/mbootpack/buildimage.c	Sun Oct 08 18:55:12 2006 -0600
    35.2 +++ b/tools/misc/mbootpack/buildimage.c	Sat Oct 14 13:28:45 2006 -0600
    35.3 @@ -25,8 +25,6 @@
    35.4   *
    35.5   */
    35.6  
    35.7 -
    35.8 -
    35.9  #include <assert.h>
   35.10  #include <stdio.h>
   35.11  #include <stdlib.h>
   35.12 @@ -77,20 +75,22 @@
   35.13  /* Bring in the bzImage boot sector and setup code */
   35.14  #include "bzimage_header.c"
   35.15  
   35.16 +#define _p(x) ((void *)(unsigned long)(x))
   35.17 +
   35.18  address_t place_mbi(long int size) 
   35.19  /* Find space at the top of *low* memory for the MBI and associated red tape */
   35.20  {
   35.21      address_t start;
   35.22      start = 0xa000 - size;
   35.23      if (start < 0x9000 + sizeof(bzimage_bootsect) + sizeof(bzimage_setup)) {
   35.24 -        printf("Fatal: command-lines too long: need %i, have %i bytes\n",
   35.25 +        printf("Fatal: command-lines too long: need %ld, have %ld bytes\n",
   35.26                 size, 
   35.27 -               0x1000 - (sizeof(bzimage_bootsect) + sizeof(bzimage_setup)));
   35.28 -        exit(1);        
   35.29 +               0x1000L - (sizeof(bzimage_bootsect) + sizeof(bzimage_setup)));
   35.30 +        exit(1);
   35.31      }
   35.32      if (!quiet) {
   35.33          printf("Placed MBI and strings (%p+%p)\n", 
   35.34 -               start, size);
   35.35 +               _p(start), _p(size));
   35.36      }
   35.37      return start;
   35.38  }
   35.39 @@ -108,7 +108,7 @@ void make_bzImage(section_t *sections,
   35.40      /* Patch the kernel and mbi addresses into the setup code */
   35.41      *(address_t *)(bzimage_setup + BZ_ENTRY_OFFSET) = eswap(entry);
   35.42      *(address_t *)(bzimage_setup + BZ_MBI_OFFSET) = eswap(mbi);
   35.43 -    if (!quiet) printf("Kernel entry is %p, MBI is %p.\n", entry, mbi);
   35.44 +    if (!quiet) printf("Kernel entry is %p, MBI is %p.\n",_p(entry), _p(mbi));
   35.45  
   35.46      /* Write out header and trampoline */
   35.47      if (fseek(fp, 0, SEEK_SET) < 0) {
   35.48 @@ -127,8 +127,9 @@ void make_bzImage(section_t *sections,
   35.49          exit(1);
   35.50      }
   35.51  
   35.52 -    if (!quiet) printf("Wrote bzImage header: %i + %i bytes.\n", 
   35.53 -                       sizeof(bzimage_bootsect), sizeof(bzimage_setup));
   35.54 +    if (!quiet) printf("Wrote bzImage header: %ld + %ld bytes.\n", 
   35.55 +                       (long)sizeof(bzimage_bootsect),
   35.56 +                       (long)sizeof(bzimage_setup));
   35.57  
   35.58      /* Sorted list of sections below 1MB: write them out */
   35.59      for (s = sections, i = 0; s; s = s->next) {
    36.1 --- a/tools/misc/mbootpack/mbootpack.c	Sun Oct 08 18:55:12 2006 -0600
    36.2 +++ b/tools/misc/mbootpack/mbootpack.c	Sat Oct 14 13:28:45 2006 -0600
    36.3 @@ -128,6 +128,7 @@ static void usage(void)
    36.4      exit(1);
    36.5  }
    36.6  
    36.7 +#define _p(x) ((void *)(unsigned long)(x))
    36.8  
    36.9  static void place_kernel_section(address_t start, long int size)
   36.10  /* Place the kernel in memory, checking for the memory hole. */
   36.11 @@ -136,7 +137,8 @@ static void place_kernel_section(address
   36.12          /* Above the memory hole: easy */
   36.13          next_free_space = MAX(next_free_space, start + size);
   36.14          if (!quiet) {
   36.15 -            printf("Placed kernel section (%p+%p)\n", start, size);
   36.16 +            printf("Placed kernel section (%p+%p)\n",
   36.17 +                   _p(start), _p(size));
   36.18          }
   36.19          return;
   36.20      }
   36.21 @@ -144,14 +146,14 @@ static void place_kernel_section(address
   36.22      if (start >= MEM_HOLE_START) {
   36.23          /* In the memory hole.  Not so good */
   36.24          printf("Fatal: kernel load address (%p) is in the memory hole.\n",
   36.25 -               start);
   36.26 +               _p(start));
   36.27          exit(1);
   36.28      }
   36.29      
   36.30      if (start + size > MEM_HOLE_START) {
   36.31          /* Too big for low memory */
   36.32          printf("Fatal: kernel (%p+%p) runs into the memory hole.\n",
   36.33 -               start, size);
   36.34 +               _p(start), _p(size));
   36.35          exit(1);
   36.36      }	
   36.37      
   36.38 @@ -159,7 +161,7 @@ static void place_kernel_section(address
   36.39      next_free_space = MAX(next_free_space, start + size);
   36.40  
   36.41      if (!quiet) {
   36.42 -        printf("Placed kernel section (%p+%p)\n", start, size);
   36.43 +        printf("Placed kernel section (%p+%p)\n", _p(start), _p(size));
   36.44      }
   36.45  }
   36.46  
   36.47 @@ -182,14 +184,12 @@ static address_t place_section(long int 
   36.48  
   36.49      if (!quiet) {
   36.50          printf("Placed section (%p+%p), align=%p\n", 
   36.51 -               start, size, align);
   36.52 +               _p(start), _p(size), _p(align));
   36.53      }
   36.54      return start;
   36.55  }
   36.56  
   36.57  
   36.58 -
   36.59 -
   36.60  static address_t load_kernel(const char *filename)
   36.61  /* Load an elf32/multiboot kernel from this file 
   36.62   * Returns the entry address for the kernel. */
   36.63 @@ -296,7 +296,7 @@ static address_t load_kernel(const char 
   36.64                  size = loadsize;
   36.65              
   36.66              if (loadsize > size) {
   36.67 -                printf("Fatal: can't load %i bytes of kernel into %i bytes " 
   36.68 +                printf("Fatal: can't load %ld bytes of kernel into %ld bytes "
   36.69                         "of memory.\n", loadsize, size);
   36.70                  exit(1);
   36.71              }
   36.72 @@ -466,8 +466,6 @@ static address_t load_kernel(const char 
   36.73  }
   36.74  
   36.75  
   36.76 -
   36.77 -
   36.78  int main(int argc, char **argv) 
   36.79  {
   36.80      char *buffer, *imagename, *command_line, *p;
   36.81 @@ -480,7 +478,7 @@ int main(int argc, char **argv)
   36.82      struct mod_list *modp;
   36.83      address_t start, kernel_entry;
   36.84      long int size, mod_command_line_space, command_line_len;
   36.85 -    int modules, opt, mbi_reloc_offset, make_multiboot;
   36.86 +    int modules, opt, mbi_reloc_offset;
   36.87  
   36.88      static const char short_options[] = "hc:m:o:qM";
   36.89      static const struct option options[] = {
    37.1 --- a/tools/misc/miniterm/miniterm.c	Sun Oct 08 18:55:12 2006 -0600
    37.2 +++ b/tools/misc/miniterm/miniterm.c	Sat Oct 14 13:28:45 2006 -0600
    37.3 @@ -32,10 +32,11 @@
    37.4  #include <signal.h>
    37.5  #include <sys/types.h>
    37.6  #include <sys/wait.h>
    37.7 +#include <string.h>
    37.8  
    37.9  #define DEFAULT_BAUDRATE   115200
   37.10  #define DEFAULT_SERDEVICE  "/dev/ttyS0"
   37.11 -#define ENDMINITERM        2  /* ctrl-b to quit miniterm */
   37.12 +#define ENDMINITERM        0x1d
   37.13  
   37.14  volatile int stop = 0;
   37.15  
   37.16 @@ -76,7 +77,11 @@ int main(int argc, char **argv)
   37.17      char            *sername = DEFAULT_SERDEVICE;
   37.18      struct termios   oldsertio, newsertio, oldstdtio, newstdtio;
   37.19      struct sigaction sa;
   37.20 - 
   37.21 +    static char start_str[] = 
   37.22 +        "************ REMOTE CONSOLE: CTRL-] TO QUIT ********\r\n";
   37.23 +    static char end_str[] =
   37.24 +        "\n************ REMOTE CONSOLE EXITED *****************\n";
   37.25 +
   37.26      while ( --argc != 0 )
   37.27      {
   37.28          char *p = argv[argc];
   37.29 @@ -121,7 +126,7 @@ int main(int argc, char **argv)
   37.30      newsertio.c_iflag = IGNBRK | IGNPAR;
   37.31  
   37.32      /* Raw output. */
   37.33 -    newsertio.c_oflag = 0; 
   37.34 +    newsertio.c_oflag = OPOST;
   37.35  
   37.36      /* No echo and no signals. */
   37.37      newsertio.c_lflag = 0;
   37.38 @@ -137,7 +142,13 @@ int main(int argc, char **argv)
   37.39      /* next stop echo and buffering for stdin */
   37.40      tcgetattr(0,&oldstdtio);
   37.41      tcgetattr(0,&newstdtio); /* get working stdtio */
   37.42 -    newstdtio.c_lflag &= ~(ICANON | ECHO);
   37.43 +    newstdtio.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
   37.44 +    newstdtio.c_oflag &= ~OPOST;
   37.45 +    newstdtio.c_cflag &= ~(CSIZE | PARENB);
   37.46 +    newstdtio.c_cflag |= CS8;
   37.47 +    newstdtio.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
   37.48 +    newstdtio.c_cc[VMIN]=1;
   37.49 +    newstdtio.c_cc[VTIME]=0;
   37.50      tcsetattr(0,TCSANOW,&newstdtio);
   37.51  
   37.52      /* Terminal settings done: now enter the main I/O loops. */
   37.53 @@ -145,7 +156,7 @@ int main(int argc, char **argv)
   37.54      {
   37.55      case 0:
   37.56          close(1); /* stdout not needed */
   37.57 -        for ( c = getchar(); c != ENDMINITERM ; c = getchar() ) 
   37.58 +        for ( c = (char)getchar(); c != ENDMINITERM; c = (char)getchar() )
   37.59              write(fd,&c,1);
   37.60          tcsetattr(fd,TCSANOW,&oldsertio);
   37.61          tcsetattr(0,TCSANOW,&oldstdtio);
   37.62 @@ -158,7 +169,7 @@ int main(int argc, char **argv)
   37.63          close(fd);
   37.64          exit(-1);
   37.65      default:
   37.66 -        printf("** ctrl-b quits miniterm **\n");
   37.67 +        write(1, start_str, strlen(start_str));
   37.68          close(0); /* stdin not needed */
   37.69          sa.sa_handler = child_handler;
   37.70          sa.sa_flags = 0;
   37.71 @@ -166,9 +177,11 @@ int main(int argc, char **argv)
   37.72          while ( !stop )
   37.73          {
   37.74              read(fd,&c,1); /* modem */
   37.75 +            c = (char)c;
   37.76              write(1,&c,1); /* stdout */
   37.77          }
   37.78          wait(NULL); /* wait for child to die or it will become a zombie */
   37.79 +        write(1, end_str, strlen(end_str));
   37.80          break;
   37.81      }
   37.82  
    38.1 --- a/tools/python/xen/util/blkif.py	Sun Oct 08 18:55:12 2006 -0600
    38.2 +++ b/tools/python/xen/util/blkif.py	Sat Oct 14 13:28:45 2006 -0600
    38.3 @@ -64,7 +64,7 @@ def blkdev_uname_to_file(uname):
    38.4      """Take a blkdev uname and return the corresponding filename."""
    38.5      fn = None
    38.6      if uname.find(":") != -1:
    38.7 -        (typ, fn) = uname.split(":")
    38.8 +        (typ, fn) = uname.split(":", 1)
    38.9          if typ == "phy" and not fn.startswith("/"):
   38.10              fn = "/dev/%s" %(fn,)
   38.11          if typ == "tap":
    39.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Sun Oct 08 18:55:12 2006 -0600
    39.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sat Oct 14 13:28:45 2006 -0600
    39.3 @@ -1745,7 +1745,7 @@ class XendDomainInfo:
    39.4          blcfg = None
    39.5          # FIXME: this assumes that we want to use the first disk device
    39.6          for (n,c) in self.info['device']:
    39.7 -            if not n or not c or n != "vbd":
    39.8 +            if not n or not c or not(n in ["vbd", "tap"]):
    39.9                  continue
   39.10              disk = sxp.child_value(c, "uname")
   39.11              if disk is None:
    40.1 --- a/tools/python/xen/xend/XendRoot.py	Sun Oct 08 18:55:12 2006 -0600
    40.2 +++ b/tools/python/xen/xend/XendRoot.py	Sat Oct 14 13:28:45 2006 -0600
    40.3 @@ -96,6 +96,9 @@ class XendRoot:
    40.4  
    40.5      dom0_vcpus_default = '0'
    40.6  
    40.7 +    """Default interface to listen for VNC connections on"""
    40.8 +    xend_vnc_listen_default = '127.0.0.1'
    40.9 +
   40.10      components = {}
   40.11  
   40.12      def __init__(self):
   40.13 @@ -272,6 +275,9 @@ class XendRoot:
   40.14      def get_console_limit(self):
   40.15          return self.get_config_int('console-limit', 1024)
   40.16  
   40.17 +    def get_vnclisten_address(self):
   40.18 +        return self.get_config_value('vnc-listen', self.xend_vnc_listen_default)
   40.19 +
   40.20  def instance():
   40.21      """Get an instance of XendRoot.
   40.22      Use this instead of the constructor.
    41.1 --- a/tools/python/xen/xend/image.py	Sun Oct 08 18:55:12 2006 -0600
    41.2 +++ b/tools/python/xen/xend/image.py	Sat Oct 14 13:28:45 2006 -0600
    41.3 @@ -361,6 +361,11 @@ class HVMImageHandler(ImageHandler):
    41.4              else:
    41.5                  ret += ['-vnc', '%d' % vncdisplay]
    41.6              ret += ['-k', 'en-us']
    41.7 +            vnclisten = sxp.child_value(config, 'vnclisten')
    41.8 +            if not(vnclisten):
    41.9 +                vnclisten = xen.xend.XendRoot.instance().get_vnclisten_address()
   41.10 +            if vnclisten:
   41.11 +                ret += ['-vnclisten', vnclisten]
   41.12          return ret
   41.13  
   41.14      def createDeviceModel(self):
    42.1 --- a/tools/python/xen/xm/create.py	Sun Oct 08 18:55:12 2006 -0600
    42.2 +++ b/tools/python/xen/xm/create.py	Sat Oct 14 13:28:45 2006 -0600
    42.3 @@ -415,6 +415,10 @@ gopts.var('vncdisplay', val='',
    42.4            fn=set_value, default=None,
    42.5            use="""VNC display to use""")
    42.6  
    42.7 +gopts.var('vnclisten', val='',
    42.8 +          fn=set_value, default=None,
    42.9 +          use="""Address for VNC server to listen on.""")
   42.10 +
   42.11  gopts.var('vncunused', val='',
   42.12            fn=set_bool, default=1,
   42.13            use="""Try to find an unused port for the VNC server.
   42.14 @@ -633,8 +637,9 @@ def configure_hvm(config_image, vals):
   42.15      """
   42.16      args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb',
   42.17               'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
   42.18 -             'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'sdl', 'display',
   42.19 -             'acpi', 'apic', 'xauthority', 'usb', 'usbdevice' ]
   42.20 +             'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
   42.21 +             'sdl', 'display', 'xauthority',
   42.22 +             'acpi', 'apic', 'usb', 'usbdevice' ]
   42.23      for a in args:
   42.24          if (vals.__dict__[a]):
   42.25              config_image.append([a, vals.__dict__[a]])
    43.1 --- a/tools/python/xen/xm/main.py	Sun Oct 08 18:55:12 2006 -0600
    43.2 +++ b/tools/python/xen/xm/main.py	Sat Oct 14 13:28:45 2006 -0600
    43.3 @@ -291,6 +291,11 @@ all_commands = (domain_commands + host_c
    43.4  def cmdHelp(cmd):
    43.5      """Print help for a specific subcommand."""
    43.6      
    43.7 +    for fc in SUBCOMMAND_HELP.keys():
    43.8 +        if fc[:len(cmd)] == cmd:
    43.9 +            cmd = fc
   43.10 +            break
   43.11 +    
   43.12      try:
   43.13          args, desc = SUBCOMMAND_HELP[cmd]
   43.14      except KeyError:
    44.1 --- a/tools/xenstore/xenstore_client.c	Sun Oct 08 18:55:12 2006 -0600
    44.2 +++ b/tools/xenstore/xenstore_client.c	Sat Oct 14 13:28:45 2006 -0600
    44.3 @@ -267,12 +267,13 @@ int
    44.4  main(int argc, char **argv)
    44.5  {
    44.6      struct xs_handle *xsh;
    44.7 -    xs_transaction_t xth;
    44.8 +    xs_transaction_t xth = XBT_NULL;
    44.9      int ret = 0, socket = 0;
   44.10      int prefix = 0;
   44.11      int tidy = 0;
   44.12      int upto = 0;
   44.13      int recurse = 0;
   44.14 +    int transaction;
   44.15  
   44.16      while (1) {
   44.17  	int c, index = 0;
   44.18 @@ -339,18 +340,28 @@ main(int argc, char **argv)
   44.19      }
   44.20  #endif
   44.21  
   44.22 +#if defined(CLIENT_read)
   44.23 +    transaction = (argc - optind) > 1;
   44.24 +#elif defined(CLIENT_write)
   44.25 +    transaction = (argc - optind) > 2;
   44.26 +#else
   44.27 +    transaction = 1;
   44.28 +#endif
   44.29 +
   44.30      xsh = socket ? xs_daemon_open() : xs_domain_open();
   44.31      if (xsh == NULL)
   44.32  	err(1, socket ? "xs_daemon_open" : "xs_domain_open");
   44.33  
   44.34    again:
   44.35 -    xth = xs_transaction_start(xsh);
   44.36 -    if (xth == XBT_NULL)
   44.37 -	errx(1, "couldn't start transaction");
   44.38 +    if (transaction) {
   44.39 +	xth = xs_transaction_start(xsh);
   44.40 +	if (xth == XBT_NULL)
   44.41 +	    errx(1, "couldn't start transaction");
   44.42 +    }
   44.43  
   44.44      ret = perform(optind, argc, argv, xsh, xth, prefix, tidy, upto, recurse);
   44.45  
   44.46 -    if (!xs_transaction_end(xsh, xth, ret)) {
   44.47 +    if (transaction && !xs_transaction_end(xsh, xth, ret)) {
   44.48  	if (ret == 0 && errno == EAGAIN) {
   44.49  	    output_pos = 0;
   44.50  	    goto again;
    45.1 --- a/tools/xenstore/xenstored_transaction.c	Sun Oct 08 18:55:12 2006 -0600
    45.2 +++ b/tools/xenstore/xenstored_transaction.c	Sat Oct 14 13:28:45 2006 -0600
    45.3 @@ -133,7 +133,7 @@ void do_transaction_start(struct connect
    45.4  		return;
    45.5  	}
    45.6  
    45.7 -	if (conn->transaction_started > quota_max_transaction) {
    45.8 +	if (conn->id && conn->transaction_started > quota_max_transaction) {
    45.9  		send_error(conn, ENOSPC);
   45.10  		return;
   45.11  	}
    46.1 --- a/xen/arch/x86/Makefile	Sun Oct 08 18:55:12 2006 -0600
    46.2 +++ b/xen/arch/x86/Makefile	Sat Oct 14 13:28:45 2006 -0600
    46.3 @@ -53,18 +53,18 @@ obj-$(crash_debug) += gdbstub.o
    46.4  	$(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o
    46.5  	$(LD) $(LDFLAGS) -T xen.lds -N \
    46.6  	    boot/$(TARGET_SUBARCH).o $(ALL_OBJS) \
    46.7 -	    $(BASEDIR)/common/symbols-dummy.o -o $@
    46.8 -	$(NM) -n $@ | $(BASEDIR)/tools/symbols >$(BASEDIR)/xen-syms.S
    46.9 -	$(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/xen-syms.o
   46.10 +	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
   46.11 +	$(NM) -n $(@D)/.$(@F).0 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).0.S
   46.12 +	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o
   46.13  	$(LD) $(LDFLAGS) -T xen.lds -N \
   46.14  	    boot/$(TARGET_SUBARCH).o $(ALL_OBJS) \
   46.15 -	    $(BASEDIR)/xen-syms.o -o $@
   46.16 -	$(NM) -n $@ | $(BASEDIR)/tools/symbols >$(BASEDIR)/xen-syms.S
   46.17 -	$(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/xen-syms.o
   46.18 +	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
   46.19 +	$(NM) -n $(@D)/.$(@F).1 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).1.S
   46.20 +	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o
   46.21  	$(LD) $(LDFLAGS) -T xen.lds -N \
   46.22  	    boot/$(TARGET_SUBARCH).o $(ALL_OBJS) \
   46.23 -	    $(BASEDIR)/xen-syms.o -o $@
   46.24 -	rm -f $(BASEDIR)/xen-syms.S $(BASEDIR)/xen-syms.o
   46.25 +	    $(@D)/.$(@F).1.o -o $@
   46.26 +	rm -f $(@D)/.$(@F).[0-9]*
   46.27  
   46.28  asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS)
   46.29  	$(CC) $(CFLAGS) -S -o $@ $<
   46.30 @@ -78,3 +78,4 @@ boot/mkelf32: boot/mkelf32.c
   46.31  .PHONY: clean
   46.32  clean::
   46.33  	rm -f asm-offsets.s xen.lds boot/*.o boot/*~ boot/core boot/mkelf32
   46.34 +	rm -f $(BASEDIR)/.xen-syms.[0-9]*
    47.1 --- a/xen/arch/x86/domain_build.c	Sun Oct 08 18:55:12 2006 -0600
    47.2 +++ b/xen/arch/x86/domain_build.c	Sat Oct 14 13:28:45 2006 -0600
    47.3 @@ -401,11 +401,11 @@ int construct_dom0(struct domain *d,
    47.4             _p(dsi.v_start), _p(v_end));
    47.5      printk(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
    47.6  
    47.7 -    if ( (v_end - dsi.v_start) > (nr_pages * PAGE_SIZE) )
    47.8 +    if ( ((v_end - dsi.v_start)>>PAGE_SHIFT) > nr_pages )
    47.9      {
   47.10          printk("Initial guest OS requires too much space\n"
   47.11                 "(%luMB is greater than %luMB limit)\n",
   47.12 -               (v_end-dsi.v_start)>>20, (nr_pages<<PAGE_SHIFT)>>20);
   47.13 +               (v_end-dsi.v_start)>>20, nr_pages>>(20-PAGE_SHIFT));
   47.14          return -ENOMEM;
   47.15      }
   47.16  
    48.1 --- a/xen/arch/x86/hvm/hvm.c	Sun Oct 08 18:55:12 2006 -0600
    48.2 +++ b/xen/arch/x86/hvm/hvm.c	Sat Oct 14 13:28:45 2006 -0600
    48.3 @@ -653,15 +653,15 @@ int hvm_bringup_ap(int vcpuid, int tramp
    48.4      if ( rc != 0 )
    48.5      {
    48.6          DPRINTK("AP %d bringup failed in boot_vcpu %x.\n", vcpuid, rc);
    48.7 -        return rc;
    48.8 +        goto out;
    48.9      }
   48.10  
   48.11      if ( test_and_clear_bit(_VCPUF_down, &d->vcpu[vcpuid]->vcpu_flags) )
   48.12          vcpu_wake(d->vcpu[vcpuid]);
   48.13      DPRINTK("AP %d bringup suceeded.\n", vcpuid);
   48.14  
   48.15 + out:
   48.16      xfree(ctxt);
   48.17 -
   48.18      return rc;
   48.19  }
   48.20  
    49.1 --- a/xen/arch/x86/hvm/svm/intr.c	Sun Oct 08 18:55:12 2006 -0600
    49.2 +++ b/xen/arch/x86/hvm/svm/intr.c	Sat Oct 14 13:28:45 2006 -0600
    49.3 @@ -74,6 +74,7 @@ asmlinkage void svm_intr_assist(void)
    49.4      int intr_type = APIC_DM_EXTINT;
    49.5      int intr_vector = -1;
    49.6      int re_injecting = 0;
    49.7 +    unsigned long rflags;
    49.8  
    49.9      ASSERT(vmcb);
   49.10  
   49.11 @@ -86,6 +87,14 @@ asmlinkage void svm_intr_assist(void)
   49.12          re_injecting = 1;
   49.13      }
   49.14  
   49.15 +    /* Guest's interrputs masked? */
   49.16 +    rflags = vmcb->rflags;
   49.17 +    if (irq_masked(rflags)) {
   49.18 +        HVM_DBG_LOG(DBG_LEVEL_1, "Guest IRQs masked: rflags: %lx", rflags);
   49.19 +        /* bail out, we won't be injecting an interrupt this time */
   49.20 +        return;
   49.21 +    }
   49.22 +    
   49.23      /* Previous interrupt still pending? */
   49.24      if (vmcb->vintr.fields.irq) {
   49.25  //        printk("Re-injecting IRQ from Vintr\n");
    50.1 --- a/xen/arch/x86/hvm/svm/svm.c	Sun Oct 08 18:55:12 2006 -0600
    50.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Sat Oct 14 13:28:45 2006 -0600
    50.3 @@ -840,7 +840,15 @@ int start_svm(void)
    50.4      
    50.5      if (!(test_bit(X86_FEATURE_SVME, &boot_cpu_data.x86_capability)))
    50.6          return 0;
    50.7 -    
    50.8 +
    50.9 +    /* check whether SVM feature is disabled in BIOS */
   50.10 +    rdmsr(MSR_K8_VM_CR, eax, edx);
   50.11 +    if ( eax & K8_VMCR_SVME_DISABLE )
   50.12 +    {
   50.13 +        printk("AMD SVM Extension is disabled in BIOS.\n");
   50.14 +        return 0;
   50.15 +    }
   50.16 +
   50.17      if (!(hsa[cpu] = alloc_host_save_area()))
   50.18          return 0;
   50.19      
    51.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Sun Oct 08 18:55:12 2006 -0600
    51.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Sat Oct 14 13:28:45 2006 -0600
    51.3 @@ -226,21 +226,10 @@ static inline int long_mode_do_msr_read(
    51.4      case MSR_EFER:
    51.5          HVM_DBG_LOG(DBG_LEVEL_2, "EFER msr_content 0x%"PRIx64, msr_content);
    51.6          msr_content = msr->msr_items[VMX_INDEX_MSR_EFER];
    51.7 -
    51.8 -        /* the following code may be not needed */
    51.9 -        if ( test_bit(VMX_CPU_STATE_LME_ENABLED, &v->arch.hvm_vmx.cpu_state) )
   51.10 -            msr_content |= EFER_LME;
   51.11 -        else
   51.12 -            msr_content &= ~EFER_LME;
   51.13 -
   51.14 -        if ( VMX_LONG_GUEST(v) )
   51.15 -            msr_content |= EFER_LMA;
   51.16 -        else
   51.17 -            msr_content &= ~EFER_LMA;
   51.18          break;
   51.19  
   51.20      case MSR_FS_BASE:
   51.21 -        if ( !(VMX_LONG_GUEST(v)) )
   51.22 +        if ( !(vmx_long_mode_enabled(v)) )
   51.23              /* XXX should it be GP fault */
   51.24              domain_crash_synchronous();
   51.25  
   51.26 @@ -248,7 +237,7 @@ static inline int long_mode_do_msr_read(
   51.27          break;
   51.28  
   51.29      case MSR_GS_BASE:
   51.30 -        if ( !(VMX_LONG_GUEST(v)) )
   51.31 +        if ( !(vmx_long_mode_enabled(v)) )
   51.32              domain_crash_synchronous();
   51.33  
   51.34          __vmread(GUEST_GS_BASE, &msr_content);
   51.35 @@ -296,21 +285,25 @@ static inline int long_mode_do_msr_write
   51.36              return 0;
   51.37          }
   51.38  
   51.39 -        /* LME: 0 -> 1 */
   51.40 -        if ( msr_content & EFER_LME &&
   51.41 -             !test_bit(VMX_CPU_STATE_LME_ENABLED, &v->arch.hvm_vmx.cpu_state) )
   51.42 +        if ( (msr_content & EFER_LME)
   51.43 +             &&  !(msr->msr_items[VMX_INDEX_MSR_EFER] & EFER_LME) )
   51.44          {
   51.45 -            if ( vmx_paging_enabled(v) ||
   51.46 -                 !test_bit(VMX_CPU_STATE_PAE_ENABLED,
   51.47 -                           &v->arch.hvm_vmx.cpu_state) )
   51.48 +            if ( unlikely(vmx_paging_enabled(v)) )
   51.49              {
   51.50 -                printk("Trying to set LME bit when "
   51.51 -                       "in paging mode or PAE bit is not set\n");
   51.52 +                printk("Trying to set EFER.LME with paging enabled\n");
   51.53                  vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
   51.54                  return 0;
   51.55              }
   51.56 -
   51.57 -            set_bit(VMX_CPU_STATE_LME_ENABLED, &v->arch.hvm_vmx.cpu_state);
   51.58 +        }
   51.59 +        else if ( !(msr_content & EFER_LME)
   51.60 +                  && (msr->msr_items[VMX_INDEX_MSR_EFER] & EFER_LME) )
   51.61 +        {
   51.62 +            if ( unlikely(vmx_paging_enabled(v)) )
   51.63 +            {
   51.64 +                printk("Trying to clear EFER.LME with paging enabled\n");
   51.65 +                vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
   51.66 +                return 0;
   51.67 +            }
   51.68          }
   51.69  
   51.70          msr->msr_items[VMX_INDEX_MSR_EFER] = msr_content;
   51.71 @@ -318,7 +311,7 @@ static inline int long_mode_do_msr_write
   51.72  
   51.73      case MSR_FS_BASE:
   51.74      case MSR_GS_BASE:
   51.75 -        if ( !(VMX_LONG_GUEST(v)) )
   51.76 +        if ( !(vmx_long_mode_enabled(v)) )
   51.77              domain_crash_synchronous();
   51.78  
   51.79          if ( !IS_CANO_ADDRESS(msr_content) )
   51.80 @@ -336,7 +329,7 @@ static inline int long_mode_do_msr_write
   51.81          break;
   51.82  
   51.83      case MSR_SHADOW_GS_BASE:
   51.84 -        if ( !(VMX_LONG_GUEST(v)) )
   51.85 +        if ( !(vmx_long_mode_enabled(v)) )
   51.86              domain_crash_synchronous();
   51.87  
   51.88          v->arch.hvm_vmx.msr_content.shadow_gs = msr_content;
   51.89 @@ -1257,7 +1250,7 @@ static int vmx_world_save(struct vcpu *v
   51.90  
   51.91  static int vmx_world_restore(struct vcpu *v, struct vmx_assist_context *c)
   51.92  {
   51.93 -    unsigned long mfn, old_cr4, old_base_mfn;
   51.94 +    unsigned long mfn, old_base_mfn;
   51.95      int error = 0;
   51.96  
   51.97      error |= __vmwrite(GUEST_RIP, c->eip);
   51.98 @@ -1307,14 +1300,11 @@ static int vmx_world_restore(struct vcpu
   51.99  
  51.100   skip_cr3:
  51.101  
  51.102 -    shadow_update_paging_modes(v);
  51.103      if (!vmx_paging_enabled(v))
  51.104          HVM_DBG_LOG(DBG_LEVEL_VMMU, "switching to vmxassist. use phys table");
  51.105      else
  51.106          HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %x", c->cr3);
  51.107 -    __vmwrite(GUEST_CR3, v->arch.hvm_vcpu.hw_cr3);
  51.108  
  51.109 -    error |= __vmread(CR4_READ_SHADOW, &old_cr4);
  51.110      error |= __vmwrite(GUEST_CR4, (c->cr4 | VMX_CR4_HOST_MASK));
  51.111      error |= __vmwrite(CR4_READ_SHADOW, c->cr4);
  51.112  
  51.113 @@ -1364,6 +1354,9 @@ static int vmx_world_restore(struct vcpu
  51.114      error |= __vmwrite(GUEST_LDTR_BASE, c->ldtr_base);
  51.115      error |= __vmwrite(GUEST_LDTR_AR_BYTES, c->ldtr_arbytes.bytes);
  51.116  
  51.117 +    shadow_update_paging_modes(v);
  51.118 +    __vmwrite(GUEST_CR3, v->arch.hvm_vcpu.hw_cr3);
  51.119 +
  51.120      return !error;
  51.121  }
  51.122  
  51.123 @@ -1408,6 +1401,7 @@ static int vmx_assist(struct vcpu *v, in
  51.124                  goto error;
  51.125              if (!vmx_world_restore(v, &c))
  51.126                  goto error;
  51.127 +            v->arch.hvm_vmx.vmxassist_enabled = 1;            
  51.128              return 1;
  51.129          }
  51.130          break;
  51.131 @@ -1425,6 +1419,7 @@ static int vmx_assist(struct vcpu *v, in
  51.132                  goto error;
  51.133              if (!vmx_world_restore(v, &c))
  51.134                  goto error;
  51.135 +            v->arch.hvm_vmx.vmxassist_enabled = 0;
  51.136              return 1;
  51.137          }
  51.138          break;
  51.139 @@ -1480,26 +1475,23 @@ static int vmx_set_cr0(unsigned long val
  51.140          }
  51.141  
  51.142  #if defined(__x86_64__)
  51.143 -        if ( test_bit(VMX_CPU_STATE_LME_ENABLED,
  51.144 -                      &v->arch.hvm_vmx.cpu_state) &&
  51.145 -             !test_bit(VMX_CPU_STATE_PAE_ENABLED,
  51.146 -                       &v->arch.hvm_vmx.cpu_state) )
  51.147 +        if ( vmx_lme_is_set(v) )
  51.148          {
  51.149 -            HVM_DBG_LOG(DBG_LEVEL_1, "Enable paging before PAE enabled\n");
  51.150 -            vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
  51.151 -        }
  51.152 -
  51.153 -        if ( test_bit(VMX_CPU_STATE_LME_ENABLED,
  51.154 -                     &v->arch.hvm_vmx.cpu_state) )
  51.155 -        {
  51.156 -            /* Here the PAE is should be opened */
  51.157 -            HVM_DBG_LOG(DBG_LEVEL_1, "Enable long mode\n");
  51.158 -            set_bit(VMX_CPU_STATE_LMA_ENABLED,
  51.159 -                    &v->arch.hvm_vmx.cpu_state);
  51.160 -
  51.161 -            __vmread(VM_ENTRY_CONTROLS, &vm_entry_value);
  51.162 -            vm_entry_value |= VM_ENTRY_IA32E_MODE;
  51.163 -            __vmwrite(VM_ENTRY_CONTROLS, vm_entry_value);
  51.164 +            if ( !(v->arch.hvm_vmx.cpu_shadow_cr4 & X86_CR4_PAE) )
  51.165 +            {
  51.166 +                HVM_DBG_LOG(DBG_LEVEL_1, "Guest enabled paging "
  51.167 +                            "with EFER.LME set but not CR4.PAE\n");
  51.168 +                vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
  51.169 +            }
  51.170 +            else 
  51.171 +            {
  51.172 +                HVM_DBG_LOG(DBG_LEVEL_1, "Enabling long mode\n");
  51.173 +                v->arch.hvm_vmx.msr_content.msr_items[VMX_INDEX_MSR_EFER]
  51.174 +                    |= EFER_LMA;
  51.175 +                __vmread(VM_ENTRY_CONTROLS, &vm_entry_value);
  51.176 +                vm_entry_value |= VM_ENTRY_IA32E_MODE;
  51.177 +                __vmwrite(VM_ENTRY_CONTROLS, vm_entry_value);
  51.178 +            }
  51.179          }
  51.180  #endif
  51.181  
  51.182 @@ -1546,11 +1538,10 @@ static int vmx_set_cr0(unsigned long val
  51.183               * Disable paging here.
  51.184               * Same to PE == 1 && PG == 0
  51.185               */
  51.186 -            if ( test_bit(VMX_CPU_STATE_LMA_ENABLED,
  51.187 -                          &v->arch.hvm_vmx.cpu_state) )
  51.188 +            if ( vmx_long_mode_enabled(v) )
  51.189              {
  51.190 -                clear_bit(VMX_CPU_STATE_LMA_ENABLED,
  51.191 -                          &v->arch.hvm_vmx.cpu_state);
  51.192 +                v->arch.hvm_vmx.msr_content.msr_items[VMX_INDEX_MSR_EFER]
  51.193 +                    &= ~EFER_LMA;
  51.194                  __vmread(VM_ENTRY_CONTROLS, &vm_entry_value);
  51.195                  vm_entry_value &= ~VM_ENTRY_IA32E_MODE;
  51.196                  __vmwrite(VM_ENTRY_CONTROLS, vm_entry_value);
  51.197 @@ -1559,22 +1550,19 @@ static int vmx_set_cr0(unsigned long val
  51.198  
  51.199          if ( vmx_assist(v, VMX_ASSIST_INVOKE) )
  51.200          {
  51.201 -            set_bit(VMX_CPU_STATE_ASSIST_ENABLED, &v->arch.hvm_vmx.cpu_state);
  51.202              __vmread(GUEST_RIP, &eip);
  51.203              HVM_DBG_LOG(DBG_LEVEL_1,
  51.204                          "Transfering control to vmxassist %%eip 0x%lx\n", eip);
  51.205              return 0; /* do not update eip! */
  51.206          }
  51.207 -    } else if ( test_bit(VMX_CPU_STATE_ASSIST_ENABLED,
  51.208 -                         &v->arch.hvm_vmx.cpu_state) )
  51.209 +    }
  51.210 +    else if ( v->arch.hvm_vmx.vmxassist_enabled )
  51.211      {
  51.212          __vmread(GUEST_RIP, &eip);
  51.213          HVM_DBG_LOG(DBG_LEVEL_1,
  51.214                      "Enabling CR0.PE at %%eip 0x%lx\n", eip);
  51.215          if ( vmx_assist(v, VMX_ASSIST_RESTORE) )
  51.216          {
  51.217 -            clear_bit(VMX_CPU_STATE_ASSIST_ENABLED,
  51.218 -                      &v->arch.hvm_vmx.cpu_state);
  51.219              __vmread(GUEST_RIP, &eip);
  51.220              HVM_DBG_LOG(DBG_LEVEL_1,
  51.221                          "Restoring to %%eip 0x%lx\n", eip);
  51.222 @@ -1583,8 +1571,8 @@ static int vmx_set_cr0(unsigned long val
  51.223      }
  51.224      else if ( (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PE )
  51.225      {
  51.226 +        shadow_update_paging_modes(v);
  51.227          __vmwrite(GUEST_CR3, v->arch.hvm_vcpu.hw_cr3);
  51.228 -        shadow_update_paging_modes(v);
  51.229      }
  51.230  
  51.231      return 1;
  51.232 @@ -1705,8 +1693,6 @@ static int mov_to_cr(int gp, int cr, str
  51.233  
  51.234          if ( value & X86_CR4_PAE && !(old_cr & X86_CR4_PAE) )
  51.235          {
  51.236 -            set_bit(VMX_CPU_STATE_PAE_ENABLED, &v->arch.hvm_vmx.cpu_state);
  51.237 -
  51.238              if ( vmx_pgbit_test(v) )
  51.239              {
  51.240                  /* The guest is a 32-bit PAE guest. */
  51.241 @@ -1745,14 +1731,14 @@ static int mov_to_cr(int gp, int cr, str
  51.242  #endif
  51.243              }
  51.244          }
  51.245 -        else if ( value & X86_CR4_PAE )
  51.246 -            set_bit(VMX_CPU_STATE_PAE_ENABLED, &v->arch.hvm_vmx.cpu_state);
  51.247 -        else
  51.248 +        else if ( !(value & X86_CR4_PAE) )
  51.249          {
  51.250 -            if ( test_bit(VMX_CPU_STATE_LMA_ENABLED, &v->arch.hvm_vmx.cpu_state) )
  51.251 +            if ( unlikely(vmx_long_mode_enabled(v)) )
  51.252 +            {
  51.253 +                HVM_DBG_LOG(DBG_LEVEL_1, "Guest cleared CR4.PAE while "
  51.254 +                            "EFER.LMA is set\n");
  51.255                  vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
  51.256 -
  51.257 -            clear_bit(VMX_CPU_STATE_PAE_ENABLED, &v->arch.hvm_vmx.cpu_state);
  51.258 +            }
  51.259          }
  51.260  
  51.261          __vmwrite(GUEST_CR4, value| VMX_CR4_HOST_MASK);
    52.1 --- a/xen/arch/x86/microcode.c	Sun Oct 08 18:55:12 2006 -0600
    52.2 +++ b/xen/arch/x86/microcode.c	Sat Oct 14 13:28:45 2006 -0600
    52.3 @@ -455,7 +455,7 @@ out:
    52.4  	return error;
    52.5  }
    52.6  
    52.7 -int microcode_update(void *buf, unsigned long len)
    52.8 +int microcode_update(XEN_GUEST_HANDLE(void) buf, unsigned long len)
    52.9  {
   52.10  	int ret;
   52.11  
   52.12 @@ -464,10 +464,15 @@ int microcode_update(void *buf, unsigned
   52.13  		return -EINVAL;
   52.14  	}
   52.15  
   52.16 +	if (len != (typeof(user_buffer_size))len) {
   52.17 +		printk(KERN_ERR "microcode: too much data\n");
   52.18 +		return -E2BIG;
   52.19 +	}
   52.20 +
   52.21  	mutex_lock(&microcode_mutex);
   52.22  
   52.23 -	user_buffer = (void __user *) buf;
   52.24 -	user_buffer_size = (int) len;
   52.25 +	user_buffer = buf.p;
   52.26 +	user_buffer_size = len;
   52.27  
   52.28  	ret = do_microcode_update();
   52.29  
    53.1 --- a/xen/arch/x86/mm/shadow/multi.c	Sun Oct 08 18:55:12 2006 -0600
    53.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Sat Oct 14 13:28:45 2006 -0600
    53.3 @@ -1375,80 +1375,6 @@ static int shadow_set_l1e(struct vcpu *v
    53.4  
    53.5  
    53.6  /**************************************************************************/
    53.7 -/* These functions take a vcpu and a virtual address, and return a pointer
    53.8 - * to the appropriate level N entry from the shadow tables.  
    53.9 - * If the necessary tables are not present in the shadow, they return NULL. */
   53.10 -
   53.11 -/* N.B. The use of GUEST_PAGING_LEVELS here is correct.  If the shadow has
   53.12 - * more levels than the guest, the upper levels are always fixed and do not 
   53.13 - * reflect any information from the guest, so we do not use these functions 
   53.14 - * to access them. */
   53.15 -
   53.16 -#if GUEST_PAGING_LEVELS >= 4
   53.17 -static shadow_l4e_t *
   53.18 -shadow_get_l4e(struct vcpu *v, unsigned long va)
   53.19 -{
   53.20 -    /* Reading the top level table is always valid. */
   53.21 -    return sh_linear_l4_table(v) + shadow_l4_linear_offset(va);
   53.22 -}
   53.23 -#endif /* GUEST_PAGING_LEVELS >= 4 */
   53.24 -
   53.25 -
   53.26 -#if GUEST_PAGING_LEVELS >= 3
   53.27 -static shadow_l3e_t *
   53.28 -shadow_get_l3e(struct vcpu *v, unsigned long va)
   53.29 -{
   53.30 -#if GUEST_PAGING_LEVELS >= 4 /* 64bit... */
   53.31 -    /* Get the l4 */
   53.32 -    shadow_l4e_t *sl4e = shadow_get_l4e(v, va);
   53.33 -    ASSERT(sl4e != NULL);
   53.34 -    if ( !(shadow_l4e_get_flags(*sl4e) & _PAGE_PRESENT) )
   53.35 -        return NULL;
   53.36 -    ASSERT(valid_mfn(shadow_l4e_get_mfn(*sl4e)));
   53.37 -    /* l4 was present; OK to get the l3 */
   53.38 -    return sh_linear_l3_table(v) + shadow_l3_linear_offset(va);
   53.39 -#else /* PAE... */
   53.40 -    /* Top level is always mapped */
   53.41 -    ASSERT(v->arch.shadow_vtable);
   53.42 -    return ((shadow_l3e_t *)v->arch.shadow_vtable) + shadow_l3_linear_offset(va);
   53.43 -#endif 
   53.44 -}
   53.45 -#endif /* GUEST_PAGING_LEVELS >= 3 */
   53.46 -
   53.47 -
   53.48 -static shadow_l2e_t *
   53.49 -shadow_get_l2e(struct vcpu *v, unsigned long va)
   53.50 -{
   53.51 -#if GUEST_PAGING_LEVELS >= 3  /* 64bit/PAE... */
   53.52 -    /* Get the l3 */
   53.53 -    shadow_l3e_t *sl3e = shadow_get_l3e(v, va);
   53.54 -    if ( sl3e == NULL || !(shadow_l3e_get_flags(*sl3e) & _PAGE_PRESENT) )
   53.55 -        return NULL;
   53.56 -    ASSERT(valid_mfn(shadow_l3e_get_mfn(*sl3e)));
   53.57 -    /* l3 was present; OK to get the l2 */
   53.58 -#endif
   53.59 -    return sh_linear_l2_table(v) + shadow_l2_linear_offset(va);
   53.60 -}
   53.61 -
   53.62 -
   53.63 -#if 0 // avoid the compiler warning for now...
   53.64 -
   53.65 -static shadow_l1e_t *
   53.66 -shadow_get_l1e(struct vcpu *v, unsigned long va)
   53.67 -{
   53.68 -    /* Get the l2 */
   53.69 -    shadow_l2e_t *sl2e = shadow_get_l2e(v, va);
   53.70 -    if ( sl2e == NULL || !(shadow_l2e_get_flags(*sl2e) & _PAGE_PRESENT) )
   53.71 -        return NULL;
   53.72 -    ASSERT(valid_mfn(shadow_l2e_get_mfn(*sl2e)));
   53.73 -    /* l2 was present; OK to get the l1 */
   53.74 -    return sh_linear_l1_table(v) + shadow_l1_linear_offset(va);
   53.75 -}
   53.76 -
   53.77 -#endif
   53.78 -
   53.79 -
   53.80 -/**************************************************************************/
   53.81  /* Macros to walk pagetables.  These take the shadow of a pagetable and 
   53.82   * walk every "interesting" entry.  That is, they don't touch Xen mappings, 
   53.83   * and for 32-bit l2s shadowed onto PAE or 64-bit, they only touch every 
   53.84 @@ -2050,6 +1976,12 @@ sh_make_monitor_table(struct vcpu *v)
   53.85   * they are needed.  The "demand" argument is non-zero when handling
   53.86   * a demand fault (so we know what to do about accessed bits &c).
   53.87   * If the necessary tables are not present in the guest, they return NULL. */
   53.88 +
   53.89 +/* N.B. The use of GUEST_PAGING_LEVELS here is correct.  If the shadow has
   53.90 + * more levels than the guest, the upper levels are always fixed and do not 
   53.91 + * reflect any information from the guest, so we do not use these functions 
   53.92 + * to access them. */
   53.93 +
   53.94  #if GUEST_PAGING_LEVELS >= 4
   53.95  static shadow_l4e_t * shadow_get_and_create_l4e(struct vcpu *v, 
   53.96                                                  walk_t *gw, 
   53.97 @@ -2324,11 +2256,11 @@ static void sh_destroy_l3_subshadow(stru
   53.98  /* Tear down just a single 4-entry l3 on a 2-page l3 shadow. */
   53.99  {
  53.100      int i;
  53.101 +    mfn_t sl3mfn = _mfn(maddr_from_mapped_domain_page(sl3e) >> PAGE_SHIFT);
  53.102      ASSERT((unsigned long)sl3e % (4 * sizeof (shadow_l3e_t)) == 0); 
  53.103      for ( i = 0; i < GUEST_L3_PAGETABLE_ENTRIES; i++ ) 
  53.104          if ( shadow_l3e_get_flags(sl3e[i]) & _PAGE_PRESENT ) 
  53.105 -            sh_put_ref(v, shadow_l3e_get_mfn(sl3e[i]),
  53.106 -                        maddr_from_mapped_domain_page(sl3e));
  53.107 +            shadow_set_l3e(v, &sl3e[i], shadow_l3e_empty(), sl3mfn);
  53.108  }
  53.109  #endif
  53.110  
  53.111 @@ -3223,26 +3155,62 @@ sh_invlpg(struct vcpu *v, unsigned long 
  53.112   * instruction should be issued on the hardware, or 0 if it's safe not
  53.113   * to do so. */
  53.114  {
  53.115 -    shadow_l2e_t *ptr_sl2e = shadow_get_l2e(v, va);
  53.116 -
  53.117 -    // XXX -- might be a good thing to prefetch the va into the shadow
  53.118 -
  53.119 -    // no need to flush anything if there's no SL2...
  53.120 -    //
  53.121 -    if ( !ptr_sl2e )
  53.122 +    shadow_l2e_t sl2e;
  53.123 +    
  53.124 +    perfc_incrc(shadow_invlpg);
  53.125 +
  53.126 +    /* First check that we can safely read the shadow l2e.  SMP/PAE linux can
  53.127 +     * run as high as 6% of invlpg calls where we haven't shadowed the l2 
  53.128 +     * yet. */
  53.129 +#if SHADOW_PAGING_LEVELS == 4
  53.130 +    {
  53.131 +        shadow_l3e_t sl3e;
  53.132 +        if ( !(shadow_l4e_get_flags(
  53.133 +                   sh_linear_l4_table(v)[shadow_l4_linear_offset(va)])
  53.134 +               & _PAGE_PRESENT) )
  53.135 +            return 0;
  53.136 +        /* This must still be a copy-from-user because we don't have the
  53.137 +         * shadow lock, and the higher-level shadows might disappear
  53.138 +         * under our feet. */
  53.139 +        if ( __copy_from_user(&sl3e, (sh_linear_l3_table(v) 
  53.140 +                                      + shadow_l3_linear_offset(va)),
  53.141 +                              sizeof (sl3e)) != 0 )
  53.142 +        {
  53.143 +            perfc_incrc(shadow_invlpg_fault);
  53.144 +            return 0;
  53.145 +        }
  53.146 +        if ( (!shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
  53.147 +            return 0;
  53.148 +    }
  53.149 +#elif SHADOW_PAGING_LEVELS == 3
  53.150 +    if ( !(shadow_l3e_get_flags(
  53.151 +          ((shadow_l3e_t *)v->arch.shadow_vtable)[shadow_l3_linear_offset(va)])
  53.152 +           & _PAGE_PRESENT) )
  53.153 +        // no need to flush anything if there's no SL2...
  53.154          return 0;
  53.155 +#endif
  53.156 +
  53.157 +    /* This must still be a copy-from-user because we don't have the shadow
  53.158 +     * lock, and the higher-level shadows might disappear under our feet. */
  53.159 +    if ( __copy_from_user(&sl2e, 
  53.160 +                          sh_linear_l2_table(v) + shadow_l2_linear_offset(va),
  53.161 +                          sizeof (sl2e)) != 0 )
  53.162 +    {
  53.163 +        perfc_incrc(shadow_invlpg_fault);
  53.164 +        return 0;
  53.165 +    }
  53.166  
  53.167      // If there's nothing shadowed for this particular sl2e, then
  53.168      // there is no need to do an invlpg, either...
  53.169      //
  53.170 -    if ( !(shadow_l2e_get_flags(*ptr_sl2e) & _PAGE_PRESENT) )
  53.171 +    if ( !(shadow_l2e_get_flags(sl2e) & _PAGE_PRESENT) )
  53.172          return 0;
  53.173  
  53.174      // Check to see if the SL2 is a splintered superpage...
  53.175      // If so, then we'll need to flush the entire TLB (because that's
  53.176      // easier than invalidating all of the individual 4K pages).
  53.177      //
  53.178 -    if ( (mfn_to_page(shadow_l2e_get_mfn(*ptr_sl2e))->count_info &
  53.179 +    if ( (mfn_to_page(shadow_l2e_get_mfn(sl2e))->count_info &
  53.180            PGC_SH_type_mask) == PGC_SH_fl1_shadow )
  53.181      {
  53.182          local_flush_tlb();
    54.1 --- a/xen/arch/x86/platform_hypercall.c	Sun Oct 08 18:55:12 2006 -0600
    54.2 +++ b/xen/arch/x86/platform_hypercall.c	Sat Oct 14 13:28:45 2006 -0600
    54.3 @@ -58,12 +58,13 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
    54.4              op->u.add_memtype.nr_mfns,
    54.5              op->u.add_memtype.type,
    54.6              1);
    54.7 -        if ( ret > 0 )
    54.8 +        if ( ret >= 0 )
    54.9          {
   54.10              op->u.add_memtype.handle = 0;
   54.11              op->u.add_memtype.reg    = ret;
   54.12 -            (void)copy_to_guest(u_xenpf_op, op, 1);
   54.13 -            ret = 0;
   54.14 +            ret = copy_to_guest(u_xenpf_op, op, 1) ? -EFAULT : 0;
   54.15 +            if ( ret != 0 )
   54.16 +                mtrr_del_page(ret, 0, 0);
   54.17          }
   54.18      }
   54.19      break;
   54.20 @@ -75,7 +76,7 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
   54.21              && (int)op->u.del_memtype.reg >= 0)
   54.22          {
   54.23              ret = mtrr_del_page(op->u.del_memtype.reg, 0, 0);
   54.24 -            if (ret > 0)
   54.25 +            if ( ret > 0 )
   54.26                  ret = 0;
   54.27          }
   54.28          else
   54.29 @@ -96,16 +97,15 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
   54.30              op->u.read_memtype.mfn     = mfn;
   54.31              op->u.read_memtype.nr_mfns = nr_mfns;
   54.32              op->u.read_memtype.type    = type;
   54.33 -            (void)copy_to_guest(u_xenpf_op, op, 1);
   54.34 -            ret = 0;
   54.35 +            ret = copy_to_guest(u_xenpf_op, op, 1) ? -EFAULT : 0;
   54.36          }
   54.37      }
   54.38      break;
   54.39  
   54.40      case XENPF_microcode_update:
   54.41      {
   54.42 -        extern int microcode_update(void *buf, unsigned long len);
   54.43 -        ret = microcode_update(op->u.microcode.data.p,
   54.44 +        extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len);
   54.45 +        ret = microcode_update(op->u.microcode.data,
   54.46                                 op->u.microcode.length);
   54.47      }
   54.48      break;
    55.1 --- a/xen/arch/x86/x86_32/asm-offsets.c	Sun Oct 08 18:55:12 2006 -0600
    55.2 +++ b/xen/arch/x86/x86_32/asm-offsets.c	Sat Oct 14 13:28:45 2006 -0600
    55.3 @@ -118,7 +118,6 @@ void __dummy__(void)
    55.4      OFFSET(MULTICALL_arg3, struct multicall_entry, args[3]);
    55.5      OFFSET(MULTICALL_arg4, struct multicall_entry, args[4]);
    55.6      OFFSET(MULTICALL_arg5, struct multicall_entry, args[5]);
    55.7 -    OFFSET(MULTICALL_arg6, struct multicall_entry, args[6]);
    55.8      OFFSET(MULTICALL_result, struct multicall_entry, result);
    55.9      BLANK();
   55.10  
    56.1 --- a/xen/arch/x86/x86_64/asm-offsets.c	Sun Oct 08 18:55:12 2006 -0600
    56.2 +++ b/xen/arch/x86/x86_64/asm-offsets.c	Sat Oct 14 13:28:45 2006 -0600
    56.3 @@ -112,7 +112,6 @@ void __dummy__(void)
    56.4      OFFSET(MULTICALL_arg3, struct multicall_entry, args[3]);
    56.5      OFFSET(MULTICALL_arg4, struct multicall_entry, args[4]);
    56.6      OFFSET(MULTICALL_arg5, struct multicall_entry, args[5]);
    56.7 -    OFFSET(MULTICALL_arg6, struct multicall_entry, args[6]);
    56.8      OFFSET(MULTICALL_result, struct multicall_entry, result);
    56.9      BLANK();
   56.10  
    57.1 --- a/xen/common/elf.c	Sun Oct 08 18:55:12 2006 -0600
    57.2 +++ b/xen/common/elf.c	Sat Oct 14 13:28:45 2006 -0600
    57.3 @@ -304,7 +304,7 @@ int parseelfimage(struct domain_setup_in
    57.4          if ( p != NULL && strncmp(p, "yes", 3) == 0 )
    57.5          {
    57.6              dsi->pae_kernel = PAEKERN_yes;
    57.7 -            if ( !strncmp(p+4, "[extended-cr3]", 14) )
    57.8 +            if ( !strncmp(p+3, "[extended-cr3]", 14) )
    57.9                  dsi->pae_kernel = PAEKERN_extended_cr3;
   57.10          }
   57.11      }
    58.1 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h	Sun Oct 08 18:55:12 2006 -0600
    58.2 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h	Sat Oct 14 13:28:45 2006 -0600
    58.3 @@ -29,19 +29,6 @@ extern void vmcs_dump_vcpu(void);
    58.4  extern void vmx_init_vmcs_config(void);
    58.5  extern void setup_vmcs_dump(void);
    58.6  
    58.7 -enum {
    58.8 -    VMX_CPU_STATE_PAE_ENABLED=0,
    58.9 -    VMX_CPU_STATE_LME_ENABLED,
   58.10 -    VMX_CPU_STATE_LMA_ENABLED,
   58.11 -    VMX_CPU_STATE_ASSIST_ENABLED,
   58.12 -};
   58.13 -
   58.14 -#define VMX_LONG_GUEST(ed)    \
   58.15 -  (test_bit(VMX_CPU_STATE_LMA_ENABLED, &ed->arch.hvm_vmx.cpu_state))
   58.16 -
   58.17 -#define VMX_PAE_GUEST(ed)       \
   58.18 -  (test_bit(VMX_CPU_STATE_PAE_ENABLED, &ed->arch.hvm_vmx.cpu_state))
   58.19 -
   58.20  struct vmcs_struct {
   58.21      u32 vmcs_revision_id;
   58.22      unsigned char data [0]; /* vmcs size is read from MSR */
   58.23 @@ -93,10 +80,10 @@ struct arch_vmx_struct {
   58.24      unsigned long        cpu_shadow_cr4; /* copy of guest read shadow CR4 */
   58.25      unsigned long        cpu_cr2; /* save CR2 */
   58.26      unsigned long        cpu_cr3;
   58.27 -    unsigned long        cpu_state;
   58.28      unsigned long        cpu_based_exec_control;
   58.29      struct vmx_msr_state msr_content;
   58.30      void                *io_bitmap_a, *io_bitmap_b;
   58.31 +    unsigned long        vmxassist_enabled:1; 
   58.32  };
   58.33  
   58.34  #define vmx_schedule_tail(next)         \
    59.1 --- a/xen/include/asm-x86/hvm/vmx/vmx.h	Sun Oct 08 18:55:12 2006 -0600
    59.2 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h	Sat Oct 14 13:28:45 2006 -0600
    59.3 @@ -335,26 +335,30 @@ static inline int __vmxon (u64 addr)
    59.4      return rc;
    59.5  }
    59.6  
    59.7 -/* Works only for vcpu == current */
    59.8  static inline int vmx_paging_enabled(struct vcpu *v)
    59.9  {
   59.10      unsigned long cr0;
   59.11 -
   59.12      __vmread_vcpu(v, CR0_READ_SHADOW, &cr0);
   59.13 -    return (cr0 & X86_CR0_PE) && (cr0 & X86_CR0_PG);
   59.14 -}
   59.15 -
   59.16 -/* Works only for vcpu == current */
   59.17 -static inline int vmx_long_mode_enabled(struct vcpu *v)
   59.18 -{
   59.19 -    ASSERT(v == current);
   59.20 -    return VMX_LONG_GUEST(current);
   59.21 +    return ((cr0 & (X86_CR0_PE|X86_CR0_PG)) == (X86_CR0_PE|X86_CR0_PG));
   59.22  }
   59.23  
   59.24  static inline int vmx_pae_enabled(struct vcpu *v)
   59.25  {
   59.26 -    ASSERT(v == current);
   59.27 -    return VMX_PAE_GUEST(current);
   59.28 +    unsigned long cr4;
   59.29 +    __vmread_vcpu(v, CR4_READ_SHADOW, &cr4);
   59.30 +    return (vmx_paging_enabled(v) && (cr4 & X86_CR4_PAE));
   59.31 +}
   59.32 +
   59.33 +static inline int vmx_long_mode_enabled(struct vcpu *v)
   59.34 +{
   59.35 +    u64 efer = v->arch.hvm_vmx.msr_content.msr_items[VMX_INDEX_MSR_EFER];
   59.36 +    return efer & EFER_LMA;
   59.37 +}
   59.38 +
   59.39 +static inline int vmx_lme_is_set(struct vcpu *v)
   59.40 +{
   59.41 +    u64 efer = v->arch.hvm_vmx.msr_content.msr_items[VMX_INDEX_MSR_EFER];
   59.42 +    return efer & EFER_LME;
   59.43  }
   59.44  
   59.45  /* Works only for vcpu == current */
    60.1 --- a/xen/include/asm-x86/msr.h	Sun Oct 08 18:55:12 2006 -0600
    60.2 +++ b/xen/include/asm-x86/msr.h	Sat Oct 14 13:28:45 2006 -0600
    60.3 @@ -302,8 +302,14 @@ static inline void wrmsrl(unsigned int m
    60.4  
    60.5  #define MSR_K8_TOP_MEM1			0xC001001A
    60.6  #define MSR_K8_TOP_MEM2			0xC001001D
    60.7 +#define MSR_K8_SYSCFG			0xC0010010
    60.8 +#define MSR_K8_HWCR			0xC0010015
    60.9 +#define MSR_K8_VM_CR			0xC0010114
   60.10  #define MSR_K8_VM_HSAVE_PA		0xC0010117
   60.11 -#define MSR_K8_SYSCFG			0xC0000010	
   60.12 +
   60.13 +/* MSR_K8_VM_CR bits: */
   60.14 +#define _K8_VMCR_SVME_DISABLE		4
   60.15 +#define K8_VMCR_SVME_DISABLE		(1 << _K8_VMCR_SVME_DISABLE)
   60.16  
   60.17  /* Centaur-Hauls/IDT defined MSRs. */
   60.18  #define MSR_IDT_FCR1			0x107
    61.1 --- a/xen/include/asm-x86/multicall.h	Sun Oct 08 18:55:12 2006 -0600
    61.2 +++ b/xen/include/asm-x86/multicall.h	Sat Oct 14 13:28:45 2006 -0600
    61.3 @@ -16,7 +16,7 @@
    61.4              "    movq  "STR(MULTICALL_op)"(%0),%%rax; "      \
    61.5              "    cmpq  $("STR(NR_hypercalls)"),%%rax; "      \
    61.6              "    jae   2f; "                                 \
    61.7 -            "    leaq  "STR(hypercall_table)"(%%rip),%%rdi; "\
    61.8 +            "    leaq  hypercall_table(%%rip),%%rdi; "       \
    61.9              "    leaq  (%%rdi,%%rax,8),%%rax; "              \
   61.10              "    movq  "STR(MULTICALL_arg0)"(%0),%%rdi; "    \
   61.11              "    movq  "STR(MULTICALL_arg1)"(%0),%%rsi; "    \
    62.1 --- a/xen/include/asm-x86/perfc_defn.h	Sun Oct 08 18:55:12 2006 -0600
    62.2 +++ b/xen/include/asm-x86/perfc_defn.h	Sat Oct 14 13:28:45 2006 -0600
    62.3 @@ -81,8 +81,8 @@ PERFCOUNTER_CPU(shadow_up_pointer,     "
    62.4  PERFCOUNTER_CPU(shadow_unshadow_bf,    "shadow unshadow brute-force")
    62.5  PERFCOUNTER_CPU(shadow_get_page_fail,  "shadow_get_page_from_l1e failed")
    62.6  PERFCOUNTER_CPU(shadow_guest_walk,     "shadow walks guest tables")
    62.7 -PERFCOUNTER_CPU(shadow_walk_cache_hit, "shadow walk-cache hits")
    62.8 -PERFCOUNTER_CPU(shadow_walk_cache_miss, "shadow walk-cache misses")
    62.9 +PERFCOUNTER_CPU(shadow_invlpg,         "shadow emulates invlpg")
   62.10 +PERFCOUNTER_CPU(shadow_invlpg_fault,   "shadow invlpg faults")
   62.11  
   62.12  
   62.13  /*#endif*/ /* __XEN_PERFC_DEFN_H__ */