Thu Dec 29 23:12:24 2016 UTC ()
Fix build. Not sure if this makes sense, since it's for the removed xen 4.1.


(wiz)
diff -r1.5 -r1.6 pkgsrc/sysutils/xenstoretools/Makefile
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_arch_i386_include_librm.h
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_core_settings.c
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-.._.._ipxe_src_net_tls.c
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-.._Config.mk
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-CVE-2014-1950
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-CVE-2015-2752
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-CVE-2015-2756
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-CVE-2015-8550
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-CVE-2015-8554
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-XSA-197
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-XSA-198
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-XSA-199
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-aa
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ab
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ac
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ad
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ae
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-af
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ag
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ah
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ai
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-aj
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ak
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-al
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-am
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ba
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-bb
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-bc
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ca
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-cb
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-cc
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-cd
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ce
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-cf
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-cg
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ch
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-config_StdGNU.mk
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-da
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-db
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-dc
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-dd
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-de
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-df
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-firmware_hvmloader_Makefile
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pass-through.c
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pass-through.h
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_piix4acpi.c
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-graphics.c
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-msi.c
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_hw_pt-msi.h
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ioemu-qemu-xen_xen-hooks.mak
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-libfsimage_ufs_ufs.h
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-libxl_libxl_create.c
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-libxl_libxl_internal.h
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-libxl_xl__cmdimpl.c
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ocaml_Makefile.rules
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ocaml_common.make
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ocaml_libs_xb_xs__ring__stubs.c
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ocaml_xenstored_define.ml
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-ocaml_xenstored_utils.ml
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-qemu-phy-devices
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-xenstat_libxenstat_Makefile
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-xenstat_xentop_Makefile
diff -r0 -r1.1 pkgsrc/sysutils/xenstoretools/patches/patch-xenstore_Makefile

cvs diff -r1.5 -r1.6 pkgsrc/sysutils/xenstoretools/Makefile (expand / switch to unified diff)

--- pkgsrc/sysutils/xenstoretools/Makefile 2016/07/09 13:07:20 1.5
+++ pkgsrc/sysutils/xenstoretools/Makefile 2016/12/29 23:12:23 1.6
@@ -1,36 +1,33 @@ @@ -1,36 +1,33 @@
1# $NetBSD: Makefile,v 1.5 2016/07/09 13:07:20 rillig Exp $ 1# $NetBSD: Makefile,v 1.6 2016/12/29 23:12:23 wiz Exp $
2# 
3 
4# VERSION is set in xentool41/version.mk 
5.include "../../sysutils/xentools41/version.mk" 
6 2
7DISTNAME= xen-${VERSION} 3DISTNAME= xen-${VERSION}
8PKGNAME= xenstoretools-${VERSION} 4PKGNAME= xenstoretools-${VERSION}
9PKGREVISION= 1 5PKGREVISION= 1
10CATEGORIES= sysutils 6CATEGORIES= sysutils
11MASTER_SITES= http://bits.xensource.com/oss-xen/release/${VERSION}/ 7MASTER_SITES= http://bits.xensource.com/oss-xen/release/${VERSION}/
12 8
13DISTFILES= ${DISTNAME}.tar.gz 9DISTFILES= ${DISTNAME}.tar.gz
14DISTFILES+= ipxe-git-v${VERSION_IPXE}.tar.gz 10DISTFILES+= ipxe-git-v${VERSION_IPXE}.tar.gz
15SITES.ipxe-git-v${VERSION_IPXE}.tar.gz+= http://xenbits.xensource.com/xen-extfiles/ 11SITES.ipxe-git-v${VERSION_IPXE}.tar.gz+= http://xenbits.xensource.com/xen-extfiles/
16 12
17MAINTAINER= sborrill@NetBSD.org 13MAINTAINER= sborrill@NetBSD.org
18HOMEPAGE= http://xen.org/ 14HOMEPAGE= http://xen.org/
19COMMENT= Xenstore Tools for Xen 4.1.x 15COMMENT= Xenstore Tools for Xen 4.1.x
20 
21LICENSE= gnu-gpl-v2 16LICENSE= gnu-gpl-v2
22DISTINFO_FILE= ${.CURDIR}/../xentools41/distinfo 17
23PATCHDIR= ${.CURDIR}/../xentools41/patches 18VERSION= 4.1.6.1
 19VERSION_IPXE= 1.0.0
 20
24BUILD_DIRS= xenstore 21BUILD_DIRS= xenstore
25BUILD_TARGET= clients 22BUILD_TARGET= clients
26INSTALL_TARGET= installclients 23INSTALL_TARGET= installclients
27INSTALL_DIRS= xenstore 24INSTALL_DIRS= xenstore
28 25
29PKG_SYSCONFSUBDIR= xen 26PKG_SYSCONFSUBDIR= xen
30WRKSRC= ${WRKDIR}/xen-${VERSION}/tools 27WRKSRC= ${WRKDIR}/xen-${VERSION}/tools
31BUILD_DEFS+= VARBASE 28BUILD_DEFS+= VARBASE
32 29
33ONLY_FOR_PLATFORM= Linux-2.6*-i386 Linux-2.6*-x86_64 30ONLY_FOR_PLATFORM= Linux-2.6*-i386 Linux-2.6*-x86_64
34ONLY_FOR_PLATFORM+= NetBSD-[5-9].*-x86_64 NetBSD-[5-9].*-i386 31ONLY_FOR_PLATFORM+= NetBSD-[5-9].*-x86_64 NetBSD-[5-9].*-i386
35 32
36CONFLICTS+= libxen-[0-9]* 33CONFLICTS+= libxen-[0-9]*

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-.._.._ipxe_src_arch_i386_include_librm.h
$NetBSD: patch-.._.._ipxe_src_arch_i386_include_librm.h,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../../ipxe/src/arch/i386/include/librm.h.orig	2010-02-02 16:12:44.000000000 +0000
+++ ../../ipxe/src/arch/i386/include/librm.h
@@ -122,8 +122,9 @@ extern char *text16;
 	_data16_ ## variable __asm__ ( #variable )
 
 #define __bss16_array( variable, array )				\
-	__attribute__ (( section ( ".bss16" ) ))			\
-	_data16_ ## variable array __asm__ ( #variable )
+	_data16_ ## variable array \
+	__asm__ ( #variable ) \
+	__attribute__ (( section ( ".bss16" ) ))
 
 #define __text16( variable )						\
 	__attribute__ (( section ( ".text16.data" ) ))			\

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-.._.._ipxe_src_core_settings.c
$NetBSD: patch-.._.._ipxe_src_core_settings.c,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../../ipxe/src/core/settings.c.orig	2013-03-25 18:48:57.000000000 +0000
+++ ../../ipxe/src/core/settings.c
@@ -263,10 +263,12 @@ static struct settings * find_child_sett
  */
 static struct settings * autovivify_child_settings ( struct settings *parent,
 						     const char *name ) {
+	size_t nlen = strlen ( name ) + 1 /* NUL */;
 	struct {
 		struct generic_settings generic;
-		char name[ strlen ( name ) + 1 /* NUL */ ];
+		char name[];
 	} *new_child;
+	size_t tlen = sizeof(*new_child) + nlen;
 	struct settings *settings;
 
 	/* Return existing settings, if existent */
@@ -274,13 +276,13 @@ static struct settings * autovivify_chil
 		return settings;
 
 	/* Create new generic settings block */
-	new_child = zalloc ( sizeof ( *new_child ) );
+	new_child = zalloc ( tlen );
 	if ( ! new_child ) {
 		DBGC ( parent, "Settings %p could not create child %s\n",
 		       parent, name );
 		return NULL;
 	}
-	memcpy ( new_child->name, name, sizeof ( new_child->name ) );
+	memcpy ( new_child->name, name, nlen );
 	generic_settings_init ( &new_child->generic, NULL, new_child->name );
 	settings = &new_child->generic.settings;
 	register_settings ( settings, parent );

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-.._.._ipxe_src_net_tls.c
$NetBSD: patch-.._.._ipxe_src_net_tls.c,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../../ipxe/src/net/tls.c.orig	2013-03-25 18:53:57.000000000 +0000
+++ ../../ipxe/src/net/tls.c
@@ -650,18 +650,22 @@ static int tls_send_client_key_exchange 
 	RSA_CTX *rsa_ctx;
 	RSA_pub_key_new ( &rsa_ctx, tls->rsa.modulus, tls->rsa.modulus_len,
 			  tls->rsa.exponent, tls->rsa.exponent_len );
+	size_t elen = rsa_ctx->num_octets;
 	struct {
 		uint32_t type_length;
 		uint16_t encrypted_pre_master_secret_len;
-		uint8_t encrypted_pre_master_secret[rsa_ctx->num_octets];
-	} __attribute__ (( packed )) key_xchg;
-
-	memset ( &key_xchg, 0, sizeof ( key_xchg ) );
-	key_xchg.type_length = ( cpu_to_le32 ( TLS_CLIENT_KEY_EXCHANGE ) |
-				 htonl ( sizeof ( key_xchg ) -
-					 sizeof ( key_xchg.type_length ) ) );
-	key_xchg.encrypted_pre_master_secret_len
-		= htons ( sizeof ( key_xchg.encrypted_pre_master_secret ) );
+		uint8_t encrypted_pre_master_secret[];
+	} __attribute__ (( packed )) *key_xchg;
+	size_t klen = sizeof(*key_xchg) + elen;
+
+	key_xchg = alloca(klen);
+
+	memset ( key_xchg, 0, klen );
+	key_xchg->type_length = ( cpu_to_le32 ( TLS_CLIENT_KEY_EXCHANGE ) |
+				 htonl ( klen -
+					 sizeof ( key_xchg->type_length ) ) );
+	key_xchg->encrypted_pre_master_secret_len
+		= htons ( elen );
 
 	/* FIXME: Hack alert */
 	DBGC ( tls, "RSA encrypting plaintext, modulus, exponent:\n" );
@@ -671,14 +675,13 @@ static int tls_send_client_key_exchange 
 	DBGC_HD ( tls, tls->rsa.exponent, tls->rsa.exponent_len );
 	RSA_encrypt ( rsa_ctx, ( const uint8_t * ) &tls->pre_master_secret,
 		      sizeof ( tls->pre_master_secret ),
-		      key_xchg.encrypted_pre_master_secret, 0 );
+		      key_xchg->encrypted_pre_master_secret, 0 );
 	DBGC ( tls, "RSA encrypt done.  Ciphertext:\n" );
-	DBGC_HD ( tls, &key_xchg.encrypted_pre_master_secret,
-		  sizeof ( key_xchg.encrypted_pre_master_secret ) );
+	DBGC_HD ( tls, &key_xchg->encrypted_pre_master_secret, elen );
 	RSA_free ( rsa_ctx );
 
 
-	return tls_send_handshake ( tls, &key_xchg, sizeof ( key_xchg ) );
+	return tls_send_handshake ( tls, key_xchg, klen );
 }
 
 /**
@@ -802,12 +805,12 @@ static int tls_new_server_hello ( struct
 		uint8_t session_id_len;
 		char next[0];
 	} __attribute__ (( packed )) *hello_a = data;
+	size_t slen = hello_a->session_id_len;
 	struct {
-		uint8_t session_id[hello_a->session_id_len];
 		uint16_t cipher_suite;
 		uint8_t compression_method;
 		char next[0];
-	} __attribute__ (( packed )) *hello_b = ( void * ) &hello_a->next;
+	} __attribute__ (( packed )) *hello_b = ( void * ) ((uint8_t *)&hello_a->next + slen);
 	void *end = hello_b->next;
 	int rc;
 

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-.._Config.mk
$NetBSD: patch-.._Config.mk,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../Config.mk.orig	2013-03-25 09:51:57.000000000 +0000
+++ ../Config.mk
@@ -15,7 +15,7 @@ SHELL     ?= /bin/sh
 # Tools to run on system hosting the build
 HOSTCC      = gcc
 HOSTCFLAGS  = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
-HOSTCFLAGS += -fno-strict-aliasing
+HOSTCFLAGS += -fno-strict-aliasing ${EXTRA_HOSTCFLAGS}
 
 DISTDIR     ?= $(XEN_ROOT)/dist
 DESTDIR     ?= /
@@ -141,6 +141,8 @@ CFLAGS += -Wall -Wstrict-prototypes
 # result of any casted expression causes a warning.
 CFLAGS += -Wno-unused-value
 
+CFLAGS += ${EXTRA_CFLAGS}
+
 $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
 $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
 $(call cc-option-add,CFLAGS,CC,-Wno-unused-but-set-variable)

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-CVE-2014-1950
$NetBSD: patch-CVE-2014-1950,v 1.1 2016/12/29 23:12:23 wiz Exp $

http://lists.xenproject.org/archives/html/xen-announce/2014-02/msg00006.html

--- libxc/xc_cpupool.c.orig	2014-02-12 16:27:31.000000000 +0000
+++ libxc/xc_cpupool.c	2014-02-12 16:28:11.000000000 +0000
@@ -104,6 +104,7 @@ xc_cpupoolinfo_t *xc_cpupool_getinfo(xc_
     info->cpumap = xc_cpumap_alloc(xch);
     if (!info->cpumap) {
         free(info);
+        info = NULL;
         goto out;
     }
     info->cpupool_id = sysctl.u.cpupool_op.cpupool_id;

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-CVE-2015-2752
$NetBSD: patch-CVE-2015-2752,v 1.1 2016/12/29 23:12:23 wiz Exp $

Patch for CVE-2015-2752 aka XSA-125 from
http://xenbits.xenproject.org/xsa/xsa125-4.2.patch

--- libxc/xc_domain.c.orig	2013-09-10 06:42:18.000000000 +0000
+++ libxc/xc_domain.c
@@ -1322,6 +1322,13 @@ int xc_domain_bind_pt_isa_irq(
                                   PT_IRQ_TYPE_ISA, 0, 0, 0, machine_irq));
 }
 
+#ifndef min
+#define min(X, Y) ({                             \
+            const typeof (X) _x = (X);           \
+            const typeof (Y) _y = (Y);           \
+            (void) (&_x == &_y);                 \
+            (_x < _y) ? _x : _y; })
+#endif
 int xc_domain_memory_mapping(
     xc_interface *xch,
     uint32_t domid,
@@ -1331,17 +1338,55 @@ int xc_domain_memory_mapping(
     uint32_t add_mapping)
 {
     DECLARE_DOMCTL;
+    int ret = 0, err;
+    unsigned long done = 0, nr, max_batch_sz;
+
+    if ( !nr_mfns )
+        return 0;
 
     domctl.cmd = XEN_DOMCTL_memory_mapping;
     domctl.domain = domid;
-    domctl.u.memory_mapping.first_gfn = first_gfn;
-    domctl.u.memory_mapping.first_mfn = first_mfn;
-    domctl.u.memory_mapping.nr_mfns = nr_mfns;
     domctl.u.memory_mapping.add_mapping = add_mapping;
+    max_batch_sz = nr_mfns;
+    do
+    {
+        nr = min(nr_mfns - done, max_batch_sz);
+        domctl.u.memory_mapping.nr_mfns = nr;
+        domctl.u.memory_mapping.first_gfn = first_gfn + done;
+        domctl.u.memory_mapping.first_mfn = first_mfn + done;
+        err = do_domctl(xch, &domctl);
+        if ( err && errno == E2BIG )
+        {
+            if ( max_batch_sz <= 1 )
+                break;
+            max_batch_sz >>= 1;
+            continue;
+        }
+        /* Save the first error... */
+        if ( !ret )
+            ret = err;
+        /* .. and ignore the rest of them when removing. */
+        if ( err && add_mapping != DPCI_REMOVE_MAPPING )
+            break;
+
+        done += nr;
+    } while ( done < nr_mfns );
+
+    /*
+     * Undo what we have done unless unmapping, by unmapping the entire region.
+     * Errors here are ignored.
+     */
+    if ( ret && add_mapping != DPCI_REMOVE_MAPPING )
+        xc_domain_memory_mapping(xch, domid, first_gfn, first_mfn, nr_mfns,
+                                 DPCI_REMOVE_MAPPING);
+
+    /* We might get E2BIG so many times that we never advance. */
+    if ( !done && !ret )
+        ret = -1;
 
-    return do_domctl(xch, &domctl);
+    return ret;
 }
-
+#undef min
 int xc_domain_ioport_mapping(
     xc_interface *xch,
     uint32_t domid,


File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-CVE-2015-2756
$NetBSD: patch-CVE-2015-2756,v 1.1 2016/12/29 23:12:23 wiz Exp $

patch for CVE-2015-2756 aka XSA-126 from
http://xenbits.xenproject.org/xsa/xsa126-qemut.patch

--- ioemu-qemu-xen/hw/pass-through.c.orig	2013-07-17 10:59:40.000000000 +0000
+++ ioemu-qemu-xen/hw/pass-through.c
@@ -171,9 +171,6 @@ static int pt_word_reg_read(struct pt_de
 static int pt_long_reg_read(struct pt_dev *ptdev,
     struct pt_reg_tbl *cfg_entry,
     uint32_t *value, uint32_t valid_mask);
-static int pt_cmd_reg_read(struct pt_dev *ptdev,
-    struct pt_reg_tbl *cfg_entry,
-    uint16_t *value, uint16_t valid_mask);
 static int pt_bar_reg_read(struct pt_dev *ptdev,
     struct pt_reg_tbl *cfg_entry,
     uint32_t *value, uint32_t valid_mask);
@@ -277,9 +274,9 @@ static struct pt_reg_info_tbl pt_emu_reg
         .size       = 2,
         .init_val   = 0x0000,
         .ro_mask    = 0xF880,
-        .emu_mask   = 0x0740,
+        .emu_mask   = 0x0743,
         .init       = pt_common_reg_init,
-        .u.w.read   = pt_cmd_reg_read,
+        .u.w.read   = pt_word_reg_read,
         .u.w.write  = pt_cmd_reg_write,
         .u.w.restore  = pt_cmd_reg_restore,
     },
@@ -1865,7 +1862,7 @@ static int pt_dev_is_virtfn(struct pci_d
     return rc;
 }
 
-static int pt_register_regions(struct pt_dev *assigned_device)
+static int pt_register_regions(struct pt_dev *assigned_device, uint16_t *cmd)
 {
     int i = 0;
     uint32_t bar_data = 0;
@@ -1885,17 +1882,26 @@ static int pt_register_regions(struct pt
 
             /* Register current region */
             if ( pci_dev->base_addr[i] & PCI_ADDRESS_SPACE_IO )
+            {
                 pci_register_io_region((PCIDevice *)assigned_device, i,
                     (uint32_t)pci_dev->size[i], PCI_ADDRESS_SPACE_IO,
                     pt_ioport_map);
+                *cmd |= PCI_COMMAND_IO;
+            }
             else if ( pci_dev->base_addr[i] & PCI_ADDRESS_SPACE_MEM_PREFETCH )
+            {
                 pci_register_io_region((PCIDevice *)assigned_device, i,
                     (uint32_t)pci_dev->size[i], PCI_ADDRESS_SPACE_MEM_PREFETCH,
                     pt_iomem_map);
+                *cmd |= PCI_COMMAND_MEMORY;
+            }
             else
+            {
                 pci_register_io_region((PCIDevice *)assigned_device, i,
                     (uint32_t)pci_dev->size[i], PCI_ADDRESS_SPACE_MEM,
                     pt_iomem_map);
+                *cmd |= PCI_COMMAND_MEMORY;
+            }
 
             PT_LOG("IO region registered (size=0x%08x base_addr=0x%08x)\n",
                 (uint32_t)(pci_dev->size[i]),
@@ -3221,27 +3227,6 @@ static int pt_long_reg_read(struct pt_de
    return 0;
 }
 
-/* read Command register */
-static int pt_cmd_reg_read(struct pt_dev *ptdev,
-        struct pt_reg_tbl *cfg_entry,
-        uint16_t *value, uint16_t valid_mask)
-{
-    struct pt_reg_info_tbl *reg = cfg_entry->reg;
-    uint16_t valid_emu_mask = 0;
-    uint16_t emu_mask = reg->emu_mask;
-
-    if ( ptdev->is_virtfn )
-        emu_mask |= PCI_COMMAND_MEMORY;
-    if ( pt_is_iomul(ptdev) )
-        emu_mask |= PCI_COMMAND_IO;
-
-    /* emulate word register */
-    valid_emu_mask = emu_mask & valid_mask;
-    *value = PT_MERGE_VALUE(*value, cfg_entry->data, ~valid_emu_mask);
-
-    return 0;
-}
-
 /* read BAR */
 static int pt_bar_reg_read(struct pt_dev *ptdev,
         struct pt_reg_tbl *cfg_entry,
@@ -3376,19 +3361,13 @@ static int pt_cmd_reg_write(struct pt_de
     uint16_t writable_mask = 0;
     uint16_t throughable_mask = 0;
     uint16_t wr_value = *value;
-    uint16_t emu_mask = reg->emu_mask;
-
-    if ( ptdev->is_virtfn )
-        emu_mask |= PCI_COMMAND_MEMORY;
-    if ( pt_is_iomul(ptdev) )
-        emu_mask |= PCI_COMMAND_IO;
 
     /* modify emulate register */
     writable_mask = ~reg->ro_mask & valid_mask;
     cfg_entry->data = PT_MERGE_VALUE(*value, cfg_entry->data, writable_mask);
 
     /* create value for writing to I/O device register */
-    throughable_mask = ~emu_mask & valid_mask;
+    throughable_mask = ~reg->emu_mask & valid_mask;
 
     if (*value & PCI_COMMAND_DISABLE_INTx)
     {
@@ -4151,6 +4130,7 @@ static struct pt_dev * register_real_dev
     struct pt_dev *assigned_device = NULL;
     struct pci_dev *pci_dev;
     uint8_t e_device, e_intx;
+    uint16_t cmd = 0;
     char *key, *val;
     int msi_translate, power_mgmt;
 
@@ -4240,7 +4220,7 @@ static struct pt_dev * register_real_dev
         assigned_device->dev.config[i] = pci_read_byte(pci_dev, i);
 
     /* Handle real device's MMIO/PIO BARs */
-    pt_register_regions(assigned_device);
+    pt_register_regions(assigned_device, &cmd);
 
     /* Setup VGA bios for passthroughed gfx */
     if ( setup_vga_pt(assigned_device) < 0 )
@@ -4318,6 +4298,10 @@ static struct pt_dev * register_real_dev
     }
 
 out:
+    if (cmd)
+        pci_write_word(pci_dev, PCI_COMMAND,
+            *(uint16_t *)(&assigned_device->dev.config[PCI_COMMAND]) | cmd);
+
     PT_LOG("Real physical device %02x:%02x.%x registered successfuly!\n"
            "IRQ type = %s\n", r_bus, r_dev, r_func,
            assigned_device->msi_trans_en? "MSI-INTx":"INTx");

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-CVE-2015-8550
$NetBSD: patch-CVE-2015-8550,v 1.1 2016/12/29 23:12:23 wiz Exp $

patch for CVE-2015-8550 aka XSA-155 from
http://xenbits.xenproject.org/xsa/xsa155-xen-0001-xen-Add-RING_COPY_REQUEST.patch
http://xenbits.xenproject.org/xsa/xsa155-xen-0002-blktap2-Use-RING_COPY_REQUEST.patch
http://xenbits.xenproject.org/xsa/xsa155-qemut-qdisk-double-access.patch
http://xenbits.xenproject.org/xsa/xsa155-qemut-xenfb.patch

--- ../xen/include/public/io/ring.h.orig
+++ ../xen/include/public/io/ring.h
@@ -212,6 +212,20 @@ typedef struct __name##_back_ring __name##_back_ring_t
 #define RING_GET_REQUEST(_r, _idx)                                      \
     (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req))
 
+/*
+ * Get a local copy of a request.
+ *
+ * Use this in preference to RING_GET_REQUEST() so all processing is
+ * done on a local copy that cannot be modified by the other end.
+ *
+ * Note that https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 may cause this
+ * to be ineffective where _req is a struct which consists of only bitfields.
+ */
+#define RING_COPY_REQUEST(_r, _idx, _req) do {				\
+	/* Use volatile to force the copy into _req. */			\
+	*(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx);	\
+} while (0)
+
 #define RING_GET_RESPONSE(_r, _idx)                                     \
     (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp))

--- blktap2/drivers/block-log.c.orig
+++ blktap2/drivers/block-log.c
@@ -494,11 +494,12 @@ static int ctl_kick(struct tdlog_state* s, int fd)
   reqstart = s->bring.req_cons;
   reqend = s->sring->req_prod;
 
+  xen_mb();
   BDPRINTF("ctl: ring kicked (start = %u, end = %u)", reqstart, reqend);
 
   while (reqstart != reqend) {
     /* XXX actually submit these! */
-    memcpy(&req, RING_GET_REQUEST(&s->bring, reqstart), sizeof(req));
+    RING_COPY_REQUEST(&s->bring, reqstart, &req);
     BDPRINTF("ctl: read request %"PRIu64":%u", req.sector, req.count);
     s->bring.req_cons = ++reqstart;
 
--- blktap2/drivers/tapdisk-vbd.c.orig
+++ blktap2/drivers/tapdisk-vbd.c
@@ -1555,7 +1555,7 @@ tapdisk_vbd_pull_ring_requests(td_vbd_t *vbd)
 	int idx;
 	RING_IDX rp, rc;
 	td_ring_t *ring;
-	blkif_request_t *req;
+	blkif_request_t req;
 	td_vbd_request_t *vreq;
 
 	ring = &vbd->ring;
@@ -1566,16 +1566,16 @@ tapdisk_vbd_pull_ring_requests(td_vbd_t *vbd)
 	xen_rmb();
 
 	for (rc = ring->fe_ring.req_cons; rc != rp; rc++) {
-		req = RING_GET_REQUEST(&ring->fe_ring, rc);
+		RING_COPY_REQUEST(&ring->fe_ring, rc, &req);
 		++ring->fe_ring.req_cons;
 
-		idx  = req->id;
+		idx  = req.id;
 		vreq = &vbd->request_list[idx];
 
 		ASSERT(list_empty(&vreq->next));
 		ASSERT(vreq->secs_pending == 0);
 
-		memcpy(&vreq->req, req, sizeof(blkif_request_t));
+		memcpy(&vreq->req, &req, sizeof(blkif_request_t));
 		vbd->received++;
 		vreq->vbd = vbd;

--- ioemu-qemu-xen/hw/xen_blkif.h.orig
+++ ioemu-qemu-xen/hw/xen_blkif.h
@@ -79,8 +79,10 @@ static inline void blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_reque
 	dst->handle = src->handle;
 	dst->id = src->id;
 	dst->sector_number = src->sector_number;
-	if (n > src->nr_segments)
-		n = src->nr_segments;
+	/* prevent the compiler from optimizing the code and using src->nr_segments instead */
+	xen_mb();
+	if (n > dst->nr_segments)
+		n = dst->nr_segments;
 	for (i = 0; i < n; i++)
 		dst->seg[i] = src->seg[i];
 }
@@ -94,8 +96,10 @@ static inline void blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_reque
 	dst->handle = src->handle;
 	dst->id = src->id;
 	dst->sector_number = src->sector_number;
-	if (n > src->nr_segments)
-		n = src->nr_segments;
+	/* prevent the compiler from optimizing the code and using src->nr_segments instead */
+	xen_mb();
+	if (n > dst->nr_segments)
+		n = dst->nr_segments;
 	for (i = 0; i < n; i++)
 		dst->seg[i] = src->seg[i];
 }

--- ioemu-qemu-xen/hw/xenfb.c
+++ ioemu-qemu-xen/hw/xenfb.c
@@ -827,18 +827,20 @@ static void xenfb_invalidate(void *opaque)
 
 static void xenfb_handle_events(struct XenFB *xenfb)
 {
-    uint32_t prod, cons;
+    uint32_t prod, cons, out_cons;
     struct xenfb_page *page = xenfb->c.page;
 
     prod = page->out_prod;
-    if (prod == page->out_cons)
+    out_cons = page->out_cons;
+    if (prod == out_cons)
 	return;
     xen_rmb();		/* ensure we see ring contents up to prod */
-    for (cons = page->out_cons; cons != prod; cons++) {
+    for (cons = out_cons; cons != prod; cons++) {
 	union xenfb_out_event *event = &XENFB_OUT_RING_REF(page, cons);
+        uint8_t type = event->type;
 	int x, y, w, h;
 
-	switch (event->type) {
+	switch (type) {
 	case XENFB_TYPE_UPDATE:
 	    if (xenfb->up_count == UP_QUEUE)
 		xenfb->up_fullscreen = 1;

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-CVE-2015-8554
$NetBSD: patch-CVE-2015-8554,v 1.1 2016/12/29 23:12:23 wiz Exp $

patch for CVE-2015-8554 aka XSA-164 from
http://xenbits.xenproject.org/xsa/xsa164.patch

--- ioemu-qemu-xen/hw/pt-msi.c.orig
+++ ioemu-qemu-xen/hw/pt-msi.c
@@ -440,6 +440,13 @@ static void pci_msix_writel(void *opaque
         return;
     }
 
+    if ( addr - msix->mmio_base_addr >= msix->total_entries * 16 )
+    {
+        PT_LOG("Error: Out of bounds write to MSI-X table,"
+               " addr %016"PRIx64"\n", addr);
+        return;
+    }
+
     entry_nr = (addr - msix->mmio_base_addr) / 16;
     entry = &msix->msix_entry[entry_nr];
     offset = ((addr - msix->mmio_base_addr) % 16) / 4;

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-XSA-197
$NetBSD: patch-XSA-197,v 1.1 2016/12/29 23:12:23 wiz Exp $

Backported from:

From: Jan Beulich <jbeulich@suse.com>
Subject: xen: fix ioreq handling

Avoid double fetches and bounds check size to avoid overflowing
internal variables.

This is XSA-197.

Reported-by: yanghongke <yanghongke@huawei.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>

--- ioemu-qemu-xen/i386-dm/helper2.c.orig	2013-07-17 12:59:40.000000000 +0200
+++ ioemu-qemu-xen/i386-dm/helper2.c	2016-11-22 16:15:32.000000000 +0100
@@ -333,6 +333,11 @@
 
     sign = req->df ? -1 : 1;
 
+    if (req->size > sizeof(unsigned long)) {
+        fprintf(stderr, "PIO: bad size (%u)\n", req->size);
+        exit(-1);
+    }
+
     if (req->dir == IOREQ_READ) {
         if (!req->data_is_ptr) {
             req->data = do_inp(env, req->addr, req->size);
@@ -368,6 +373,11 @@
 
     sign = req->df ? -1 : 1;
 
+    if (req->size > sizeof(req->data)) {
+        fprintf(stderr, "MMIO: bad size (%u)\n", req->size);
+        exit(-1);
+    }
+
     if (!req->data_is_ptr) {
         if (req->dir == IOREQ_READ) {
             for (i = 0; i < req->count; i++) {
@@ -481,11 +491,13 @@
         req.df = 1;
         req.type = buf_req->type;
         req.data_is_ptr = 0;
+        xen_rmb();
         qw = (req.size == 8);
         if (qw) {
             buf_req = &buffered_io_page->buf_ioreq[
                 (buffered_io_page->read_pointer+1) % IOREQ_BUFFER_SLOT_NUM];
             req.data |= ((uint64_t)buf_req->data) << 32;
+            xen_rmb();
         }
 
         __handle_ioreq(env, &req);
@@ -512,7 +524,11 @@
 
     __handle_buffered_iopage(env);
     if (req) {
-        __handle_ioreq(env, req);
+        ioreq_t copy = *req;
+
+        xen_rmb();
+        __handle_ioreq(env, &copy);
+        req->data = copy.data;
 
         if (req->state != STATE_IOREQ_INPROCESS) {
             fprintf(logfile, "Badness in I/O request ... not in service?!: "

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-XSA-198
$NetBSD: patch-XSA-198,v 1.1 2016/12/29 23:12:23 wiz Exp $

Backported from:

From 71a389ae940bc52bf897a6e5becd73fd8ede94c5 Mon Sep 17 00:00:00 2001
From: Ian Jackson <ian.jackson@eu.citrix.com>
Date: Thu, 3 Nov 2016 16:37:40 +0000
Subject: [PATCH] pygrub: Properly quote results, when returning them to the
 caller:

* When the caller wants sexpr output, use `repr()'
  This is what Xend expects.

  The returned S-expressions are now escaped and quoted by Python,
  generally using '...'.  Previously kernel and ramdisk were unquoted
  and args was quoted with "..." but without proper escaping.  This
  change may break toolstacks which do not properly dequote the
  returned S-expressions.

* When the caller wants "simple" output, crash if the delimiter is
  contained in the returned value.

  With --output-format=simple it does not seem like this could ever
  happen, because the bootloader config parsers all take line-based
  input from the various bootloader config files.

  With --output-format=simple0, this can happen if the bootloader
  config file contains nul bytes.

This is XSA-198.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Tested-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

--- pygrub/src/pygrub.orig	2013-09-10 08:42:18.000000000 +0200
+++ pygrub/src/pygrub	2016-11-22 16:26:10.000000000 +0100
@@ -653,14 +653,17 @@
     return cfg
 
 def format_sxp(kernel, ramdisk, args):
-    s = "linux (kernel %s)" % kernel
+    s = "linux (kernel %s)" % repr(kernel)
     if ramdisk:
-        s += "(ramdisk %s)" % ramdisk
+        s += "(ramdisk %s)" % repr(ramdisk)
     if args:
-        s += "(args \"%s\")" % args
+        s += "(args %s)" % repr(args)
     return s
                 
 def format_simple(kernel, ramdisk, args, sep):
+    for check in (kernel, ramdisk, args):
+        if check is not None and sep in check:
+            raise RuntimeError, "simple format cannot represent delimiter-containing value"
     s = ("kernel %s" % kernel) + sep
     if ramdisk:
         s += ("ramdisk %s" % ramdisk) + sep

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-XSA-199
$NetBSD: patch-XSA-199,v 1.1 2016/12/29 23:12:23 wiz Exp $

From b73bd1edc05d1bad5c018228146930d79315a5da Mon Sep 17 00:00:00 2001
From: Ian Jackson <ian.jackson@eu.citrix.com>
Date: Mon, 14 Nov 2016 17:19:46 +0000
Subject: [PATCH] qemu: ioport_read, ioport_write: be defensive about 32-bit
 addresses

On x86, ioport addresses are 16-bit.  That these functions take 32-bit
arguments is a mistake.  Changing the argument type to 16-bit will
discard the top bits of any erroneous values from elsewhere in qemu.

Also, check just before use that the value is in range.  (This turns
an ill-advised change to MAX_IOPORTS into a possible guest crash
rather than a privilege escalation vulnerability.)

And, in the Xen ioreq processor, clamp incoming ioport addresses to
16-bit values.  Xen will never write >16-bit values but the guest may
have access to the ioreq ring.  We want to defend the rest of the qemu
code from wrong values.

This is XSA-199.

Reported-by: yanghongke <yanghongke@huawei.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 i386-dm/helper2.c | 2 ++
 vl.c              | 9 +++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c
index 2706f2e..5d276bb 100644
--- ioemu-qemu-xen/i386-dm/helper2.c.orig
+++ ioemu-qemu-xen/i386-dm/helper2.c
@@ -375,6 +375,8 @@ static void cpu_ioreq_pio(CPUState *env, ioreq_t *req)
 
     sign = req->df ? -1 : 1;
 
+    req->addr &= 0x0ffffU;
+
     if (req->size > sizeof(req->data)) {
         fprintf(stderr, "MMIO: bad size (%u)\n", req->size);
         exit(-1);
diff --git a/vl.c b/vl.c
index f9c4d7e..c3c5d63 100644
--- ioemu-qemu-xen/vl.c.orig
+++ ioemu-qemu-xen/vl.c
@@ -52,6 +52,7 @@
 
 #include <xen/hvm/hvm_info_table.h>
 
+#include <assert.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
@@ -290,26 +291,30 @@ PicState2 *isa_pic;
 static IOPortReadFunc default_ioport_readb, default_ioport_readw, default_ioport_readl;
 static IOPortWriteFunc default_ioport_writeb, default_ioport_writew, default_ioport_writel;
 
-static uint32_t ioport_read(int index, uint32_t address)
+static uint32_t ioport_read(int index, uint16_t address)
 {
     static IOPortReadFunc *default_func[3] = {
         default_ioport_readb,
         default_ioport_readw,
         default_ioport_readl
     };
+    if (address >= MAX_IOPORTS)
+        abort();
     IOPortReadFunc *func = ioport_read_table[index][address];
     if (!func)
         func = default_func[index];
     return func(ioport_opaque[address], address);
 }
 
-static void ioport_write(int index, uint32_t address, uint32_t data)
+static void ioport_write(int index, uint16_t address, uint32_t data)
 {
     static IOPortWriteFunc *default_func[3] = {
         default_ioport_writeb,
         default_ioport_writew,
         default_ioport_writel
     };
+    if (address >= MAX_IOPORTS)
+        abort();
     IOPortWriteFunc *func = ioport_write_table[index][address];
     if (!func)
         func = default_func[index];
-- 
2.1.4

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-aa
$NetBSD: patch-aa,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- xentrace/Makefile.orig	2010-04-07 16:12:05.000000000 +0000
+++ xentrace/Makefile
@@ -43,6 +43,7 @@ install: build
 	[ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(PRIVATE_BINDIR)
 	$(INSTALL_DATA) $(MAN1) $(DESTDIR)$(MAN1DIR)
 	$(INSTALL_DATA) $(MAN8) $(DESTDIR)$(MAN8DIR)
+	$(INSTALL_DATA) formats $(DESTDIR)$(EGDIR)
 
 .PHONY: clean
 clean:

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ab
$NetBSD: patch-ab,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- blktap/drivers/Makefile.orig	2008-08-01 16:38:07.000000000 +0200
+++ blktap/drivers/Makefile
@@ -37,9 +37,11 @@ BLK-OBJS-y  += block-qcow2.o
 BLK-OBJS-y  += aes.o
 BLK-OBJS-y  += tapaio.o
 BLK-OBJS-$(CONFIG_Linux) += blk_linux.o
+BLK-OBJS-$(CONFIG_NetBSD) += blk_netbsd.o
 
 BLKTAB-OBJS-y := blktapctrl.o
 BLKTAB-OBJS-$(CONFIG_Linux) += blktapctrl_linux.o
+BLKTAB-OBJS-$(CONFIG_NetBSD) += blktapctrl_netbsd.o
 
 all: $(IBIN) qcow-util
 

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ac
$NetBSD: patch-ac,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- libfsimage/common/Makefile.orig	2010-05-11 21:27:58.000000000 +0000
+++ libfsimage/common/Makefile
@@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 MAJOR = 1.0
 MINOR = 0
 
+CFLAGS += -DFSIMAGE_FSDIR=\"$(LIBDIR)/fs\"
+
 LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,mapfile-SunOS
 LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU
 LDFLAGS = $(LDFLAGS-y)

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ad
$NetBSD: patch-ad,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- examples/xend-config.sxp.orig	2010-04-07 16:12:04.000000000 +0000
+++ examples/xend-config.sxp
@@ -190,7 +190,7 @@
 
 # Whether to enable auto-ballooning of dom0 to allow domUs to be created.
 # If enable-dom0-ballooning = no, dom0 will never balloon out.
-(enable-dom0-ballooning yes)
+(enable-dom0-ballooning no)
 
 # 32-bit paravirtual domains can only consume physical
 # memory below 168GB. On systems with memory beyond that address,

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ae
$NetBSD: patch-ae,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- Makefile.orig	2011-10-20 17:05:41.000000000 +0000
+++ Makefile
@@ -24,7 +24,8 @@ SUBDIRS-$(CONFIG_Linux) += memshr
 SUBDIRS-$(CONFIG_Linux) += blktap
 SUBDIRS-$(CONFIG_Linux) += blktap2
 SUBDIRS-$(CONFIG_NetBSD) += libaio
-SUBDIRS-$(CONFIG_NetBSD) += blktap2
+SUBDIRS-$(CONFIG_NetBSD) += blktap
+#SUBDIRS-$(CONFIG_NetBSD) += blktap2
 SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
 SUBDIRS-y += libfsimage
 SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-af
$NetBSD: patch-af,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- firmware/etherboot/Makefile.orig	2011-03-25 10:42:50.000000000 +0000
+++ firmware/etherboot/Makefile
@@ -34,18 +34,10 @@ eb-roms.h: Config
 	$(MAKE) NO_WERROR=1 $@.new
 	mv -f $@.new $@
 
-$T:
-	if ! wget -O _$T $(IPXE_TARBALL_URL); then \
-		$(GIT) clone $(IPXE_GIT_URL) $D.git; \
-		(cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \
-		$(IPXE_GIT_TAG) | gzip >../_$T); \
-		rm -rf $D.git; \
-	fi
-	mv _$T $T
+$D:
+	ln -sf $(WRKSRC)/../../ipxe $D
 
-$D/src/arch/i386/Makefile: $T Config
-	rm -rf $D
-	gzip -dc $T | tar xf -
+$D/src/arch/i386/Makefile: $D Config
 	for i in $$(cat patches/series) ; do                 \
 	    patch -d $D -p1 --quiet <patches/$$i || exit 1 ; \
 	done

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ag
$NetBSD: patch-ag,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../config/NetBSD.mk.orig	2011-03-25 11:42:47.000000000 +0100
+++ ../config/NetBSD.mk	2011-04-15 11:36:19.000000000 +0200
@@ -7,12 +7,13 @@
 LIBEXEC = $(PREFIX)/libexec
 PRIVATE_BINDIR = $(BINDIR)
 
+MANDIR = $(PREFIX)/man
+MAN1DIR = $(MANDIR)/man1
+MAN8DIR = $(MANDIR)/man8
+
 DLOPEN_LIBS =
 
-ifeq ($(PREFIX),/usr)
-XEN_LOCK_DIR = /var/lib
-else
-XEN_LOCK_DIR = $(PREFIX)/var/lib
-endif
+XEN_LOCK_DIR = $(VARBASE)/run
+XEN_EXAMPLES_DIR=$(PREFIX)/share/examples/xen
 
 WGET = ftp

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ah
$NetBSD: patch-ah,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- hotplug/NetBSD/Makefile.orig	2011-03-25 11:42:50.000000000 +0100
+++ hotplug/NetBSD/Makefile	2011-04-15 11:38:32.000000000 +0200
@@ -8,7 +8,7 @@
 XEN_SCRIPTS += vif-ip
 
 XEN_SCRIPT_DATA =
-XEN_RCD_PROG = rc.d/xencommons rc.d/xend rc.d/xendomains rc.d/xen-watchdog
+#XEN_RCD_PROG = rc.d/xencommons rc.d/xend rc.d/xendomains rc.d/xen-watchdog
 
 .PHONY: all
 all:
@@ -21,10 +21,11 @@
 
 .PHONY: install-scripts
 install-scripts:
-	$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_EXAMPLES_DIR)
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_EXAMPLES_DIR)/scripts
 	set -e; for i in $(XEN_SCRIPTS); \
 	   do \
-	   $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
+	   $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_EXAMPLES_DIR)/scripts; \
 	done
 	set -e; for i in $(XEN_SCRIPT_DATA); \
 	   do \
@@ -33,12 +34,6 @@
 
 .PHONY: install-rcd
 install-rcd:
-	$(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/rc.d
-	set -e; for i in $(XEN_RCD_PROG); \
-	   do \
-	   $(INSTALL_PROG) $$i $(DESTDIR)$(CONFIG_DIR)/rc.d; \
-	done
-	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(CONFIG_DIR)/rc.d/xen-hotplugpath.sh
 
 .PHONY: clean
 clean:

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ai
$NetBSD: patch-ai,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- python/xen/xend/osdep.py.orig	2011-04-01 12:03:13.000000000 +0200
+++ python/xen/xend/osdep.py	2011-04-01 13:49:45.000000000 +0200
@@ -94,8 +94,12 @@
         return None
     cmd = "/sbin/sysctl " + cmdarg
     sysctloutput = commands.getoutput(cmd)
+    div = 1
+    if label == 'current' and '=' not in sysctloutput:
+        sysctloutput = commands.getoutput( "/sbin/sysctl hw.physmem64")
+        div = 1024
     (name, value) = sysctloutput.split('=')
-    return int(value)
+    return int(value) / div
 
 def _solaris_balloon_stat(label):
     """Returns the value for the named label, or None if an error occurs."""

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-aj
$NetBSD: patch-aj,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- hotplug/NetBSD/vif-bridge.orig	2011-03-25 11:42:50.000000000 +0100
+++ hotplug/NetBSD/vif-bridge	2011-04-01 14:55:58.000000000 +0200
@@ -23,7 +23,10 @@
 	xbridge=$(xenstore-read "$xpath/bridge")
 	xfid=$(xenstore-read "$xpath/frontend-id")
 	xhandle=$(xenstore-read "$xpath/handle")
-	iface=$(xenstore-read "$xpath/vifname")
+ 	iface=$(xenstore-read "$xpath/vifname") || true
+	if [ x${iface} = "x" ] ; then
+		iface=xvif$xfid.$xhandle
+	fi
 	echo ifconfig $iface up
 	ifconfig $iface up
 	brconfig $xbridge add $iface

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ak
$NetBSD: patch-ak,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- hotplug/NetBSD/vif-ip.orig	2011-04-01 16:04:24.000000000 +0200
+++ hotplug/NetBSD/vif-ip	2011-04-01 16:04:54.000000000 +0200
@@ -23,7 +23,10 @@
 	xip=$(xenstore-read "$xpath/ip")
 	xfid=$(xenstore-read "$xpath/frontend-id")
 	xhandle=$(xenstore-read "$xpath/handle")
-	iface=$(xenstore-read "$xpath/vifname")
+ 	iface=$(xenstore-read "$xpath/vifname") || true
+	if [ x${iface} = "x" ] ; then
+		iface=xvif$xfid.$xhandle
+	fi
 	echo ifconfig $iface $xip up
 	ifconfig $iface $xip up
 	xenstore-write $xpath/hotplug-status connected

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-al
$NetBSD: patch-al,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/i386-dm/hookstarget.mak.orig	2011-04-15 11:45:21.000000000 +0200
+++ ioemu-qemu-xen/i386-dm/hookstarget.mak	2011-04-15 11:46:36.000000000 +0200
@@ -2,5 +2,5 @@
 
 install-hook:
 	$(INSTALL_DIR) "$(DESTDIR)/$(bindir)"
-	$(INSTALL_DIR) "$(DESTDIR)/$(configdir)"
-	$(INSTALL_PROG) $(QEMU_ROOT)/i386-dm/qemu-ifup-$(IOEMU_OS) "$(DESTDIR)/$(configdir)/qemu-ifup"
+	$(INSTALL_DIR) "$(DESTDIR)/$(XEN_EXAMPLES_DIR)/scripts"
+	$(INSTALL_PROG) $(QEMU_ROOT)/i386-dm/qemu-ifup-$(IOEMU_OS) "$(DESTDIR)/$(XEN_EXAMPLES_DIR)/scripts/qemu-ifup"

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-am
$NetBSD: patch-am,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- libxc/xc_dom.h.orig	2013-11-29 18:20:47.000000000 +0000
+++ libxc/xc_dom.h	2013-11-29 18:22:14.000000000 +0000
@@ -303,7 +303,7 @@ static inline void *xc_dom_vaddr_to_ptr(
     if ( ptr == NULL )
         return ptr;
     *safe_region_out = (safe_region_count << XC_DOM_PAGE_SHIFT(dom)) - offset;
-    return ptr;
+    return ptr + offset;
 }
 
 static inline int xc_dom_feature_translated(struct xc_dom_image *dom)

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ba
$NetBSD: patch-ba,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- python/xen/xend/XendNode.py.orig	2010-04-07 16:12:05.000000000 +0000
+++ python/xen/xend/XendNode.py
@@ -276,28 +276,29 @@ class XendNode:
                 except KeyError:
                     pass
 
-        for pci_dev in PciUtil.get_all_pci_devices():
-            ppci_record = {
-                'domain':                   pci_dev.domain,
-                'bus':                      pci_dev.bus,
-                'slot':                     pci_dev.slot,
-                'func':                     pci_dev.func,
-                'vendor_id':                pci_dev.vendor,
-                'vendor_name':              pci_dev.vendorname,
-                'device_id':                pci_dev.device,
-                'device_name':              pci_dev.devicename,
-                'revision_id':              pci_dev.revision,
-                'class_code':               pci_dev.classcode,
-                'class_name':               pci_dev.classname,
-                'subsystem_vendor_id':      pci_dev.subvendor,
-                'subsystem_vendor_name':    pci_dev.subvendorname,
-                'subsystem_id':             pci_dev.subdevice,
-                'subsystem_name':           pci_dev.subdevicename,
-                'driver':                   pci_dev.driver
-                }
-            # If saved uuid exists, use it. Otherwise create one.
-            ppci_uuid = saved_ppci_table.get(pci_dev.name, uuid.createString())
-            XendPPCI(ppci_uuid, ppci_record)
+        pass
+        #for pci_dev in PciUtil.get_all_pci_devices():
+        #    ppci_record = {
+        #        'domain':                   pci_dev.domain,
+        #        'bus':                      pci_dev.bus,
+        #        'slot':                     pci_dev.slot,
+        #        'func':                     pci_dev.func,
+        #        'vendor_id':                pci_dev.vendor,
+        #        'vendor_name':              pci_dev.vendorname,
+        #        'device_id':                pci_dev.device,
+        #        'device_name':              pci_dev.devicename,
+        #        'revision_id':              pci_dev.revision,
+        #        'class_code':               pci_dev.classcode,
+        #        'class_name':               pci_dev.classname,
+        #        'subsystem_vendor_id':      pci_dev.subvendor,
+        #        'subsystem_vendor_name':    pci_dev.subvendorname,
+        #        'subsystem_id':             pci_dev.subdevice,
+        #        'subsystem_name':           pci_dev.subdevicename,
+        #        'driver':                   pci_dev.driver
+        #        }
+        #    # If saved uuid exists, use it. Otherwise create one.
+        #    ppci_uuid = saved_ppci_table.get(pci_dev.name, uuid.createString())
+        #    XendPPCI(ppci_uuid, ppci_record)
 
     def _init_PSCSIs(self):
         # Initialise PSCSIs and PSCSI_HBAs

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-bb
$NetBSD: patch-bb,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- libxc/xc_netbsd.c.orig	2011-03-29 17:09:58.000000000 +0000
+++ libxc/xc_netbsd.c
@@ -21,6 +21,7 @@
 #include "xc_private.h"
 
 #include <xen/sys/evtchn.h>
+#include <xen/sys/gntdev.h>
 #include <unistd.h>
 #include <fcntl.h>
 
@@ -351,7 +352,189 @@ void discard_file_cache(xc_interface *xc
     errno = saved_errno;
 }
 
-static struct xc_osdep_ops *netbsd_osdep_init(xc_interface *xch, enum xc_osdep_type type)
+#define DEVXEN  "/dev/xen/"
+
+static xc_osdep_handle
+netbsd_gnttab_open(xc_gnttab *xcg)
+{
+    int fd;
+
+    fd = open(DEVXEN "gntdev", O_RDWR);
+    if (fd == -1)
+        return XC_OSDEP_OPEN_ERROR;
+
+    return (xc_osdep_handle)fd;
+}
+
+static int
+netbsd_gnttab_close(xc_gnttab *xcg, xc_osdep_handle h)
+{
+    int fd = (int)h;
+    return close(fd);
+}
+
+static void *
+netbsd_gnttab_map_grant_ref(xc_gnttab *xch, xc_osdep_handle h,
+    uint32_t domid, uint32_t ref, int prot)
+{
+	int fd = (int)h;
+	struct ioctl_gntdev_map_grant_ref map;
+	void *addr;
+
+	map.count = 1;
+	map.refs[0].domid = domid;
+	map.refs[0].ref = ref;
+
+	if ( ioctl(fd, IOCTL_GNTDEV_MAP_GRANT_REF, &map) ) {
+		PERROR("netbsd_gnttab_map_grant_ref: ioctl MAP_GRANT_REF failed");
+		return NULL;
+	}
+
+mmap_again:
+	addr = mmap(NULL, XC_PAGE_SIZE, prot, MAP_SHARED, fd, map.index);
+	if ( addr == MAP_FAILED )
+	{
+		int saved_errno = errno;
+		struct ioctl_gntdev_unmap_grant_ref unmap_grant;
+
+		if ( saved_errno == EAGAIN )
+		{
+			usleep(1000);
+			goto mmap_again;
+		}
+		/* Unmap the driver slots used to store the grant information. */
+		PERROR("netbsd_gnttab_map_grant_ref: mmap failed");
+		unmap_grant.index = map.index;
+		unmap_grant.count = 1;
+		ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
+		errno = saved_errno;
+		return NULL;
+	}
+
+	return addr;
+}
+
+static void *
+do_gnttab_map_grant_refs(xc_gnttab *xch, xc_osdep_handle h,
+    uint32_t count, uint32_t *domids, int domids_stride,
+    uint32_t *refs, int prot)
+{
+	int fd = (int)h;
+	struct ioctl_gntdev_map_grant_ref *map;
+	void *addr = NULL;
+	int i;
+
+	map = malloc(sizeof(*map) +
+		 (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
+	if ( map == NULL )
+	return NULL;
+
+	for ( i = 0; i < count; i++ )
+	{
+		map->refs[i].domid = domids[i * domids_stride];
+		map->refs[i].ref = refs[i];
+	}
+
+	map->count = count;
+
+	if ( ioctl(fd, IOCTL_GNTDEV_MAP_GRANT_REF, map) ) {
+		PERROR("xc_gnttab_map_grant_refs: ioctl MAP_GRANT_REF failed");
+		goto out;
+	}
+
+	addr = mmap(NULL, XC_PAGE_SIZE * count, prot, MAP_SHARED, fd,
+		map->index);
+	if ( addr == MAP_FAILED )
+	{
+		int saved_errno = errno;
+		struct ioctl_gntdev_unmap_grant_ref unmap_grant;
+
+		/* Unmap the driver slots used to store the grant information. */
+		PERROR("xc_gnttab_map_grant_refs: mmap failed");
+		unmap_grant.index = map->index;
+		unmap_grant.count = count;
+		ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
+		errno = saved_errno;
+		addr = NULL;
+	}
+
+ out:
+	free(map);
+
+	return addr;
+}
+
+static void *
+netbsd_gnttab_map_grant_refs(xc_gnttab *xcg, xc_osdep_handle h,
+    uint32_t count, uint32_t *domids, uint32_t *refs, int prot)
+{
+	return do_gnttab_map_grant_refs(xcg, h, count, domids, 1, refs, prot);
+}
+
+static void *
+netbsd_gnttab_map_domain_grant_refs(xc_gnttab *xcg, xc_osdep_handle h,
+    uint32_t count, uint32_t domid, uint32_t *refs, int prot)
+{
+	return do_gnttab_map_grant_refs(xcg, h, count, &domid, 0, refs, prot);
+}
+
+static int
+netbsd_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
+    void *start_address, uint32_t count)
+{
+	int fd = (int)h;
+	struct ioctl_gntdev_get_offset_for_vaddr get_offset;
+	struct ioctl_gntdev_unmap_grant_ref unmap_grant;
+	int rc;
+
+	if ( start_address == NULL )
+	{
+		errno = EINVAL;
+		return -1;
+	}
+
+	/* First, it is necessary to get the offset which was initially used to
+	 * mmap() the pages.
+	 */
+	get_offset.vaddr = (unsigned long)start_address;
+	rc = ioctl(fd, IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR, &get_offset);
+	if ( rc )
+		return rc;
+
+	if ( get_offset.count != count )
+	{
+		errno = EINVAL;
+		return -1;
+	}
+
+	/* Next, unmap the memory. */
+	rc = munmap(start_address, count * getpagesize());
+	if ( rc )
+		return rc;
+
+	/* Finally, unmap the driver slots used to store the grant information. */
+	unmap_grant.index = get_offset.offset;
+	unmap_grant.count = count;
+	rc = ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
+	if ( rc )
+		return rc;
+	return 0;
+}
+
+static struct xc_osdep_ops netbsd_gnttab_ops = {
+    .open = &netbsd_gnttab_open,
+    .close = &netbsd_gnttab_close,
+
+    .u.gnttab = {
+        .map_grant_ref = &netbsd_gnttab_map_grant_ref,
+        .map_grant_refs = &netbsd_gnttab_map_grant_refs,
+        .map_domain_grant_refs = &netbsd_gnttab_map_domain_grant_refs,
+        .munmap = &netbsd_gnttab_munmap,
+    },
+};
+
+static struct xc_osdep_ops *
+netbsd_osdep_init(xc_interface *xch, enum xc_osdep_type type)
 {
     switch ( type )
     {
@@ -360,8 +543,7 @@ static struct xc_osdep_ops *netbsd_osdep
     case XC_OSDEP_EVTCHN:
         return &netbsd_evtchn_ops;
     case XC_OSDEP_GNTTAB:
-        ERROR("GNTTAB interface not supported on this platform");
-        return NULL;
+        return &netbsd_gnttab_ops;
     default:
         return NULL;
     }

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-bc
$NetBSD: patch-bc,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- include/xen-sys/NetBSD/gntdev.h.orig	2011-03-29 17:10:31.000000000 +0000
+++ include/xen-sys/NetBSD/gntdev.h
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * gntdev.h
+ * 
+ * Interface to /dev/xen/gntdev.
+ * 
+ * Copyright (c) 2007, D G Murray
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __NetBSD_PUBLIC_GNTDEV_H__
+#define __NetBSD_PUBLIC_GNTDEV_H__
+
+struct ioctl_gntdev_grant_ref {
+	/* The domain ID of the grant to be mapped. */
+	uint32_t domid;
+	/* The grant reference of the grant to be mapped. */
+	uint32_t ref;
+};
+
+/*
+ * Inserts the grant references into the mapping table of an instance
+ * of gntdev. N.B. This does not perform the mapping, which is deferred
+ * until mmap() is called with @index as the offset.
+ */
+#define IOCTL_GNTDEV_MAP_GRANT_REF				\
+	_IOWR('G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))
+struct ioctl_gntdev_map_grant_ref {
+	/* IN parameters */
+	/* The number of grants to be mapped. */
+	uint32_t count;
+	uint32_t pad;
+	/* OUT parameters */
+	/* The offset to be used on a subsequent call to mmap(). */
+	uint64_t index;
+	/* Variable IN parameter. */
+	/* Array of grant references, of size @count. */
+	struct ioctl_gntdev_grant_ref refs[1];
+};
+
+/*
+ * Removes the grant references from the mapping table of an instance of
+ * of gntdev. N.B. munmap() must be called on the relevant virtual address(es)
+ * before this ioctl is called, or an error will result.
+ */
+#define IOCTL_GNTDEV_UNMAP_GRANT_REF				\
+	_IOW('G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref))       
+struct ioctl_gntdev_unmap_grant_ref {
+	/* IN parameters */
+	/* The offset was returned by the corresponding map operation. */
+	uint64_t index;
+	/* The number of pages to be unmapped. */
+	uint32_t count;
+	uint32_t pad;
+};
+
+/*
+ * Returns the offset in the driver's address space that corresponds
+ * to @vaddr. This can be used to perform a munmap(), followed by an
+ * UNMAP_GRANT_REF ioctl, where no state about the offset is retained by
+ * the caller. The number of pages that were allocated at the same time as
+ * @vaddr is returned in @count.
+ *
+ * N.B. Where more than one page has been mapped into a contiguous range, the
+ *      supplied @vaddr must correspond to the start of the range; otherwise
+ *      an error will result. It is only possible to munmap() the entire
+ *      contiguously-allocated range at once, and not any subrange thereof.
+ */
+#define IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR			\
+	_IOWR('G', 2, sizeof(struct ioctl_gntdev_get_offset_for_vaddr))
+struct ioctl_gntdev_get_offset_for_vaddr {
+	/* IN parameters */
+	/* The virtual address of the first mapped page in a range. */
+	uint64_t vaddr;
+	/* OUT parameters */
+	/* The offset that was used in the initial mmap() operation. */
+	uint64_t offset;
+	/* The number of pages mapped in the VM area that begins at @vaddr. */
+	uint32_t count;
+	uint32_t pad;
+};
+
+#endif /* __NetBSD_PUBLIC_GNTDEV_H__ */

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ca
$NetBSD: patch-ca,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../docs/man/xend-config.sxp.pod.5.orig	2010-04-07 16:12:04.000000000 +0000
+++ ../docs/man/xend-config.sxp.pod.5
@@ -4,7 +4,7 @@ xend-config.sxp - Xen daemon configurati
 
 =head1 SYNOPSIS
 
-/etc/xen/xend-config.sxp
+@XENDCONFDIR@/xend-config.sxp
 
 =head1 DESCRIPTION
 
@@ -12,7 +12,7 @@ The xend(1) program requires xend-config
 parameters which determine the behavior of the daemon at runtime.
 
 The parameters are specified in S-expression format.  See the example
-configuration file in I</etc/xen/xend-config.sxp> for details.
+configuration file in I<@XENDCONFDIR@/xend-config.sxp> for details.
 
 =head1 OPTIONS
 
@@ -82,13 +82,13 @@ Defaults to I<1024>.
 
 =item I<network-script>
 
-The name of the script in I</etc/xen/scripts> that will be run to
+The name of the script in I<@XENDCONFDIR@/scripts> that will be run to
 setup the networking environment.  This can be any name, but in
 general is either I<network-bridge> or I<network-route>.
 
 =item I<vif-script>
 
-The name of the script in I</etc/xen/scripts> that will be run to
+The name of the script in I<@XENDCONFDIR@/scripts> that will be run to
 setup a virtual interface when it is created or destroyed.  This needs
 to (in general) work in unison with the I<network-script>.
 
@@ -113,7 +113,7 @@ domains should be saved when a crash occ
 
 The name of an application or script that can handle external device
 migration, such as for example virtual TPM migration. An example
-script is I</etc/xen/scripts/external-device-migrate>.
+script is I<@XENDCONFDIR@/scripts/external-device-migrate>.
 
 =item I<device-create-timeout>
 

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-cb
$NetBSD: patch-cb,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../docs/man/xmdomain.cfg.pod.5.orig	2008-08-01 16:38:07.000000000 +0200
+++ ../docs/man/xmdomain.cfg.pod.5
@@ -4,9 +4,9 @@ xmdomain.cfg - xm domain config file for
 
 =head1 SYNOPSIS
 
- /etc/xen/myxendomain
- /etc/xen/myxendomain2
- /etc/xen/auto/myxenautostarted
+ @XENDCONFDIR@/myxendomain
+ @XENDCONFDIR@/myxendomain2
+ @XENDCONFDIR@/auto/myxenautostarted
 
 =head1 DESCRIPTION
 
@@ -14,14 +14,14 @@ The B<xm>(1) program uses python executa
 domains to create from scratch.  Each of these config files needs to
 contain a number of required options, and may specify many more.
 
-Domain configuration files live in /etc/xen by default, if you store
+Domain configuration files live in @XENDCONFDIR@ by default, if you store
 config files anywhere else the full path to the config file must be
 specified in the I<xm create> command.
 
-/etc/xen/auto is a special case.  Domain config files in that
+@XENDCONFDIR@/auto is a special case.  Domain config files in that
 directory will be started automatically at system boot if the
-xendomain init script is enabled.  The contents of /etc/xen/auto
-should be symlinks to files in /etc/xen to allow I<xm create> to be
+xendomain init script is enabled.  The contents of @XENDCONFDIR@/auto
+should be symlinks to files in @XENDCONFDIR@ to allow I<xm create> to be
 used without full paths.
 
 Options are specified by I<name = value> statements in the

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-cc
$NetBSD: patch-cc,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../docs/man/xm.pod.1.orig	2009-01-05 11:26:58.000000000 +0000
+++ ../docs/man/xm.pod.1
@@ -75,7 +75,7 @@ in the config file.  See L<xmdomain.cfg>
 format, and possible options used in either the configfile or for I<vars>.
 
 I<configfile> can either be an absolute path to a file, or a relative
-path to a file located in /etc/xen.
+path to a file located in @XENDCONFDIR@.
 
 Create will return B<as soon> as the domain is started.  This B<does
 not> mean the guest OS in the domain has actually booted, or is
@@ -156,7 +156,7 @@ B<EXAMPLES>
 
   xm create Fedora4
 
-This creates a domain with the file /etc/xen/Fedora4, and returns as
+This creates a domain with the file @XENDCONFDIR@/Fedora4, and returns as
 soon as it is run.
 
 =item I<without config file>
@@ -388,7 +388,7 @@ file format, and possible options used i
 I<vars>.
 
 I<configfile> can either be an absolute path to a file, or a relative 
-path to a file located in /etc/xen.
+path to a file located in @XENDCONFDIR@.
 
 The new subcommand will return without starting the domain.  The 
 domain needs to be started using the B<xm start> command.
@@ -1068,7 +1068,7 @@ I<policy> is a dot-separated list of nam
 name pre-fix for the policy XML file. The preceding name parts are
 translated into the local path pointing to the policy XML file
 relative to the global policy root directory
-(/etc/xen/acm-security/policies). For example,
+(@XENDCONFDIR@/acm-security/policies). For example,
 example.chwall_ste.client_v1 denotes the policy file
 example/chwall_ste/client_v1-security_policy.xml relative to the
 global policy root directory.

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-cd
$NetBSD: patch-cd,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- python/xen/xm/create.py.orig	2010-04-07 16:12:05.000000000 +0000
+++ python/xen/xm/create.py
@@ -426,7 +426,7 @@ gopts.var('vtpm', val="instance=INSTANCE
           preferred instance number. The hotplug script will determine
           which instance number will actually be assigned to the domain.
           The associtation between virtual machine and the TPM instance
-          number can be found in /etc/xen/vtpm.db. Use the backend in the
+          number can be found in @XENDCONFDIR@/vtpm.db. Use the backend in the
           given domain.
           The type parameter can be used to select a specific driver type
           that the VM can use. To prevent a fully virtualized domain (HVM)

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ce
$NetBSD: patch-ce,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- security/policytools.txt.orig	2008-08-01 16:38:07.000000000 +0200
+++ security/policytools.txt
@@ -16,10 +16,10 @@ XML. Read in the user manual about the n
 name is used by the Xen management tools to identify existing
 policies. Creating the security policy means creating a policy
 description in XML:
-/etc/xen/acm-security/policies/example/chwall_ste/test-security_policy.xml.
+@XENDCONFDIR@/acm-security/policies/example/chwall_ste/test-security_policy.xml.
 
 The policy XML description must follow the XML schema definition in
-/etc/xen/acm-security/policies/security_policy.xsd. The policy tools
+@XENDCONFDIR@/acm-security/policies/security_policy.xsd. The policy tools
 are written against this schema; they will create and refine policies
 that conform to this scheme.
 
@@ -144,5 +144,5 @@ policy file naming conventions based on 
 choose to use.
 
 To get a feel for the tool, you could use one of the example policy
-definitions files from /etc/xen/acm-security/policies/example as
+definitions files from @XENDCONFDIR@/acm-security/policies/example as
 input or a policy created by the xensec_ezpolicy tool.

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-cf
$NetBSD: patch-cf,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- xm-test/tests/security-acm/Makefile.am.orig	2008-08-01 16:38:07.000000000 +0200
+++ xm-test/tests/security-acm/Makefile.am
@@ -19,10 +19,10 @@ TESTS_ENVIRONMENT=@TENV@
 %.test: %.py
 	cp $< $@
 	chmod +x $@
-	@if [ -d /etc/xen/acm-security/policies ]; then \
+	@if [ -d @XENDCONFDIR@/acm-security/policies ]; then \
 		cp -f xm-test-security_policy.xml       \
 		      xm-test-update-security_policy.xml\
-		      /etc/xen/acm-security/policies;   \
+		      @XENDCONFDIR@/acm-security/policies;   \
 	fi;
 
 clean-local: am_config_clean-local

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-cg
$NetBSD: patch-cg,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- security/xensec_ezpolicy.orig	2008-08-01 16:38:07.000000000 +0200
+++ security/xensec_ezpolicy
@@ -935,7 +935,7 @@ class ezFrame(wx.Frame):
         policyname = transInfo()
         if not policyname:
             return
-        path="/etc/xen/acm-security/policies/"
+        path="@XENDCONFDIR@/acm-security/policies/"
         nameparts=string.split(policyname, ".")
         if len(nameparts) > 1:
             path = path + "/".join(nameparts[0:len(nameparts)-1])
@@ -1592,7 +1592,7 @@ where you merely replace &quot;NAME&quot
 Save the policy under the name proposed by the tool in the proposed directory
 if you are using this tool in your Xen environment. Otherwise, you need
 to copy the resulting file into your Xen environment to the directory
-&quot;/etc/xen/acm-security/policies/example/chwall_ste/&quot;.<BR>
+&quot;@XENDCONFDIR@/acm-security/policies/example/chwall_ste/&quot;.<BR>
 <BR>
 This tool creates policies for the Xen Chinese Wall and Simple Type Enforcement
 policy. The Xen access control policy in general is more expressive and

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ch
$NetBSD: patch-ch,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- xm-test/runtest.sh.orig	2008-08-01 16:38:07.000000000 +0200
+++ xm-test/runtest.sh
@@ -220,9 +220,9 @@ unsafe=no
 GROUPENTERED=default
 
 #Prepare for usage with ACM
-if [ -d /etc/xen/acm-security/policies ]; then
+if [ -d @XENDCONFDIR@/acm-security/policies ]; then
 	cp -f tests/security-acm/xm-test-security_policy.xml \
-	      /etc/xen/acm-security/policies
+	      @XENDCONFDIR@/acm-security/policies
 fi
 
 unset XM_MANAGED_DOMAINS

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-config_StdGNU.mk
$NetBSD: patch-config_StdGNU.mk,v 1.1 2016/12/29 23:12:23 wiz Exp $

Allow XEN_CONFIG_DIR to be overriden in the environment

--- ../config/StdGNU.mk.orig	2012-05-10 15:51:14.000000000 +0000
+++ ../config/StdGNU.mk
@@ -53,7 +53,7 @@ endif
 
 SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
 
-XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
+XEN_CONFIG_DIR ?= $(CONFIG_DIR)/xen
 XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
 
 SOCKET_LIBS =

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-da
$NetBSD: patch-da,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/configure.orig	2013-07-17 12:59:40.000000000 +0200
+++ ioemu-qemu-xen/configure	2014-08-28 13:59:55.000000000 +0200
@@ -1089,7 +1089,7 @@
 # Check if tools are available to build documentation.
 if [ -x "`which texi2html 2>/dev/null`" ] && \
    [ -x "`which pod2man 2>/dev/null`" ]; then
-  build_docs="yes"
+#  build_docs="yes"
 fi
 
 ##########################################
@@ -1124,7 +1124,7 @@
   if test -z "$prefix" ; then
       prefix="/usr/local"
   fi
-  mansuffix="/share/man"
+  mansuffix="/man"
   datasuffix="/share/qemu"
   docsuffix="/share/doc/qemu"
   binsuffix="/bin"
@@ -1215,6 +1215,9 @@
 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
 echo "MAKE=$make" >> $config_mak
 echo "INSTALL=$install" >> $config_mak
+echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
+echo "INSTALL_DATA=$install -d -m0644 -p" >> $config_mak
+echo "INSTALL_PROG=$install -d -m0755 -p" >> $config_mak
 echo "CC=$cc" >> $config_mak
 echo "HOST_CC=$host_cc" >> $config_mak
 echo "AR=$ar" >> $config_mak
@@ -1492,7 +1495,9 @@
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
   echo "#define O_LARGEFILE 0" >> $config_h
+  echo "#ifndef MAP_ANONYMOUS" >> $config_h
   echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
+  echo "#endif" >> $config_h
   echo "#define _BSD 1" >> $config_h
 fi
 

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-db
$NetBSD: patch-db,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/Makefile.orig	2011-02-11 17:54:51.000000000 +0000
+++ ioemu-qemu-xen/Makefile
@@ -1,7 +1,7 @@
 # Makefile for QEMU.
 
-include config-host.mak
-include $(SRC_PATH)/rules.mak
+-include config-host.mak
+-include $(SRC_PATH)/rules.mak
 
 .PHONY: all clean cscope distclean dvi html info install install-doc \
 	recurse-all speed tar tarbin test
@@ -231,30 +231,30 @@ BLOBS=
 endif
 
 install-doc: $(DOCS)
-	mkdir -p "$(DESTDIR)$(docdir)"
-	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
+	$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
+	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
 ifndef CONFIG_WIN32
-	mkdir -p "$(DESTDIR)$(mandir)/man1"
-	$(INSTALL) -m 644 qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
-	mkdir -p "$(DESTDIR)$(mandir)/man8"
-	$(INSTALL) -m 644 qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
+	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
+	$(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
+	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
+	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
 endif
 
 install: all $(if $(BUILD_DOCS),install-doc)
-	mkdir -p "$(DESTDIR)$(bindir)"
+	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
 ifneq ($(TOOLS),)
-	$(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
+	$(INSTALL_PROG) -s $(TOOLS) "$(DESTDIR)$(bindir)"
 endif
 ifneq ($(BLOBS),)
-	mkdir -p "$(DESTDIR)$(datadir)"
+	$(INSTALL_DIR) "$(DESTDIR)$(datadir)"
 	set -e; for x in $(BLOBS); do \
-		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
+		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
 	done
 endif
 ifndef CONFIG_WIN32
-	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
+	$(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
 	set -e; for x in $(KEYMAPS); do \
-		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
+		$(INSTALL_DATA) $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
 	done
 endif
 	for d in $(TARGET_DIRS); do \
@@ -275,7 +275,7 @@ cscope:
 
 # documentation
 %.html: %.texi
-	texi2html -monolithic -number $<
+	texi2html -monolithic -number-sections $<
 
 %.info: %.texi
 	makeinfo $< -o $@
@@ -284,15 +284,15 @@ cscope:
 	texi2dvi $<
 
 qemu.1: qemu-doc.texi
-	$(SRC_PATH)/texi2pod.pl $< qemu.pod
+	perl $(SRC_PATH)/texi2pod.pl $< qemu.pod
 	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
 
 qemu-img.1: qemu-img.texi
-	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
+	perl $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
 	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
 
 qemu-nbd.8: qemu-nbd.texi
-	$(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod
+	perl $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod
 	pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@
 
 info: qemu-doc.info qemu-tech.info

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-dc
$NetBSD: patch-dc,v 1.1 2016/12/29 23:12:23 wiz Exp $

From sysutils/xentools33/patches/patch-ak.

qemu-0.13.x will include this fix:
http://git.qemu.org/qemu.git/commit/?id=9651ac55e5de0e1534d898316cc851af6ffc4334

--- ioemu-qemu-xen/hw/e1000.c.orig	2009-08-06 12:56:34.000000000 +0000
+++ ioemu-qemu-xen/hw/e1000.c
@@ -244,16 +244,20 @@ set_eecd(E1000State *s, int index, uint3
 
     s->eecd_state.old_eecd = val & (E1000_EECD_SK | E1000_EECD_CS |
             E1000_EECD_DI|E1000_EECD_FWE_MASK|E1000_EECD_REQ);
+    if (!(E1000_EECD_CS & val))                        // CS inactive; nothing to do
+       return;
+    if (E1000_EECD_CS & (val ^ oldval)) {      // CS rise edge; reset state
+       s->eecd_state.val_in = 0;
+       s->eecd_state.bitnum_in = 0;
+       s->eecd_state.bitnum_out = 0;
+       s->eecd_state.reading = 0;
+    }
     if (!(E1000_EECD_SK & (val ^ oldval)))	// no clock edge
         return;
     if (!(E1000_EECD_SK & val)) {		// falling edge
         s->eecd_state.bitnum_out++;
         return;
     }
-    if (!(val & E1000_EECD_CS)) {		// rising, no CS (EEPROM reset)
-        memset(&s->eecd_state, 0, sizeof s->eecd_state);
-        return;
-    }
     s->eecd_state.val_in <<= 1;
     if (val & E1000_EECD_DI)
         s->eecd_state.val_in |= 1;

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-dd
$NetBSD: patch-dd,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../tools/examples/Makefile.orig	2011-10-20 19:05:41.000000000 +0200
+++ ../tools/examples/Makefile	2011-10-26 13:55:46.000000000 +0200
@@ -1,5 +1,6 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
+XEN_CONFIG_DIR=${EGDIR}
 
 # Init scripts.
 XEND_INITD = init.d/xend

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-de
$NetBSD: patch-de,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ../tools/hotplug/common/Makefile.orig	2011-10-20 19:05:42.000000000 +0200
+++ ../tools/hotplug/common/Makefile	2011-10-26 13:57:09.000000000 +0200
@@ -1,5 +1,6 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
+XEN_SCRIPT_DIR = ${EGDIR}/scripts
 
 HOTPLUGPATH="hotplugpath.sh"
 

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-df
$NetBSD: patch-df,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/hw/ide.c.orig	2014-01-09 13:44:42.000000000 +0100
+++ ioemu-qemu-xen/hw/ide.c	2015-06-11 16:15:49.000000000 +0200
@@ -757,10 +757,15 @@
     put_le16(p + 58, oldsize >> 16);
     if (s->mult_sectors)
         put_le16(p + 59, 0x100 | s->mult_sectors);
-    put_le16(p + 60, s->nb_sectors);
-    put_le16(p + 61, s->nb_sectors >> 16);
+    if (s->nb_sectors > 0x10000000)
+	oldsize = 0x10000000; /* report only 128GB */
+    else
+	oldsize =  s->nb_sectors;
+    put_le16(p + 60, oldsize);
+    put_le16(p + 61, oldsize >> 16);
     put_le16(p + 62, 0x07); /* single word dma0-2 supported */
     put_le16(p + 63, 0x07); /* mdma0-2 supported */
+    put_le16(p + 64, 0x03); /* pio3-4 supported */
     put_le16(p + 65, 120);
     put_le16(p + 66, 120);
     put_le16(p + 67, 120);
@@ -812,13 +817,12 @@
     put_le16(p + 53, 7); /* words 64-70, 54-58, 88 valid */
     put_le16(p + 62, 7);  /* single word dma0-2 supported */
     put_le16(p + 63, 7);  /* mdma0-2 supported */
-    put_le16(p + 64, 0x3f); /* PIO modes supported */
 #else
     put_le16(p + 49, 1 << 9); /* LBA supported, no DMA */
     put_le16(p + 53, 3); /* words 64-70, 54-58 valid */
     put_le16(p + 63, 0x103); /* DMA modes XXX: may be incorrect */
-    put_le16(p + 64, 1); /* PIO modes */
 #endif
+    put_le16(p + 64, 3); /* pio3-4 supported */
     put_le16(p + 65, 0xb4); /* minimum DMA multiword tx cycle time */
     put_le16(p + 66, 0xb4); /* recommended DMA multiword tx cycle time */
     put_le16(p + 67, 0x12c); /* minimum PIO cycle time without flow control */

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-firmware_hvmloader_Makefile
$NetBSD: patch-firmware_hvmloader_Makefile,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- firmware/hvmloader/Makefile.orig	2013-03-25 19:35:30.000000000 +0000
+++ firmware/hvmloader/Makefile
@@ -26,7 +26,7 @@ SUBDIRS := acpi
 # The HVM loader is started in 32-bit mode at the address below:
 LOADADDR = 0x100000
 
-CFLAGS += $(CFLAGS_include) -I.
+CFLAGS += $(CFLAGS_include) -I. $(EXTRA_CFLAGS)
 
 SRCS  = hvmloader.c mp_tables.c util.c smbios.c 
 SRCS += 32bitbios_support.c smp.c cacheattr.c xenbus.c

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ioemu-qemu-xen_hw_pass-through.c
$NetBSD: patch-ioemu-qemu-xen_hw_pass-through.c,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/hw/pass-through.c.orig	2012-05-24 16:05:23.000000000 +0200
+++ ioemu-qemu-xen/hw/pass-through.c	2012-05-24 16:06:19.000000000 +0200
@@ -84,8 +84,6 @@
  */
 
 #include "pass-through.h"
-#include "pci/header.h"
-#include "pci/pci.h"
 #include "pt-msi.h"
 #include "qemu-xen.h"
 #include "iomulti.h"

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ioemu-qemu-xen_hw_pass-through.h
$NetBSD: patch-ioemu-qemu-xen_hw_pass-through.h,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/hw/pass-through.h.orig	2012-05-24 15:57:12.000000000 +0200
+++ ioemu-qemu-xen/hw/pass-through.h	2012-05-24 15:58:46.000000000 +0200
@@ -20,8 +20,13 @@
 
 #include "hw.h"
 #include "pci.h"
+#ifdef __NetBSD__
+#include "pciutils/header.h"
+#include "pciutils/pci.h"
+#else
 #include "pci/header.h"
 #include "pci/pci.h"
+#endif
 #include "exec-all.h"
 #include "sys-queue.h"
 #include "qemu-timer.h"

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ioemu-qemu-xen_hw_piix4acpi.c
$NetBSD: patch-ioemu-qemu-xen_hw_piix4acpi.c,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/hw/piix4acpi.c.orig	2012-05-30 10:21:32.000000000 +0200
+++ ioemu-qemu-xen/hw/piix4acpi.c	2012-05-30 10:23:11.000000000 +0200
@@ -41,8 +41,12 @@
 #define PIIX4ACPI_LOG(level, fmt, ...) do { if (level <= PIIX4ACPI_LOGLEVEL) qemu_log(fmt, ## __VA_ARGS__); } while (0)
 
 #ifdef CONFIG_PASSTHROUGH
+#ifdef __NetBSD__
+#include <pciutils/header.h>
+#else
 #include <pci/header.h>
 #endif
+#endif
 
 /* PM1a_CNT bits, as defined in the ACPI specification. */
 #define SCI_EN            (1 <<  0)

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ioemu-qemu-xen_hw_pt-graphics.c
$NetBSD: patch-ioemu-qemu-xen_hw_pt-graphics.c,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/hw/pt-graphics.c.orig	2012-05-24 16:16:49.000000000 +0200
+++ ioemu-qemu-xen/hw/pt-graphics.c	2012-05-24 16:16:55.000000000 +0200
@@ -3,8 +3,6 @@
  */
 
 #include "pass-through.h"
-#include "pci/header.h"
-#include "pci/pci.h"
 
 #include <unistd.h>
 #include <sys/ioctl.h>

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ioemu-qemu-xen_hw_pt-msi.c
$NetBSD: patch-ioemu-qemu-xen_hw_pt-msi.c,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/hw/pt-msi.c.orig	2012-05-24 13:27:50.000000000 +0200
+++ ioemu-qemu-xen/hw/pt-msi.c	2012-05-24 13:28:42.000000000 +0200
@@ -22,6 +22,10 @@
 #include "pt-msi.h"
 #include <sys/mman.h>
 
+#ifdef __NetBSD__
+#define MAP_LOCKED MAP_WIRED
+#endif
+
 void msi_set_enable(struct pt_dev *dev, int en)
 {
     uint16_t val = 0;

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ioemu-qemu-xen_hw_pt-msi.h
$NetBSD: patch-ioemu-qemu-xen_hw_pt-msi.h,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- ioemu-qemu-xen/hw/pt-msi.h.orig	2012-05-24 16:09:24.000000000 +0200
+++ ioemu-qemu-xen/hw/pt-msi.h	2012-05-24 16:15:19.000000000 +0200
@@ -1,7 +1,6 @@
 #ifndef _PT_MSI_H
 #define _PT_MSI_H
 
-#include "pci/pci.h"
 #include "pass-through.h"
 
 #define  PCI_CAP_ID_MSI     0x05    /* Message Signalled Interrupts */

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ioemu-qemu-xen_xen-hooks.mak
$NetBSD: patch-ioemu-qemu-xen_xen-hooks.mak,v 1.1 2016/12/29 23:12:23 wiz Exp $

enable PCI passthrough when pciutils is present

--- ioemu-qemu-xen/xen-hooks.mak.orig	2012-05-24 15:41:11.000000000 +0200
+++ ioemu-qemu-xen/xen-hooks.mak	2012-05-24 15:46:21.000000000 +0200
@@ -55,17 +55,25 @@
 ifdef CONFIG_STUBDOM
 CONFIG_PASSTHROUGH=1
 else
-  ifeq (,$(wildcard /usr/include/pci))
+  ifeq ($(CONFIG_NetBSD), y)
+CONFIG_PASSTHROUGH=1
+  else
+    ifeq (,$(wildcard /usr/include/pci))
 $(warning === pciutils-dev package not found - missing /usr/include/pci)
 $(warning === PCI passthrough capability has been disabled)
-  else
+    else
 CONFIG_PASSTHROUGH=1
+    endif
   endif
 endif
 
 ifdef CONFIG_PASSTHROUGH
 OBJS+= pass-through.o pt-msi.o pt-graphics.o
+ifeq ($(CONFIG_NetBSD), y)
+LIBS += -lpciutils -lpci
+else
 LIBS += -lpci
+endif
 CFLAGS += -DCONFIG_PASSTHROUGH 
 $(info === PCI passthrough capability has been enabled ===)
 endif

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-libfsimage_ufs_ufs.h
$NetBSD: patch-libfsimage_ufs_ufs.h,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- libfsimage/ufs/ufs.h.orig	2013-07-14 19:44:35.000000000 +0000
+++ libfsimage/ufs/ufs.h
@@ -4,7 +4,7 @@
  */
 
 #ifndef _GRUB_UFS_H
-#define _GRUB_UFS_H_
+#define _GRUB_UFS_H
 
 /* ufs specific constants */
 #define UFS_SBLOCK	16

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-libxl_libxl_create.c
$NetBSD: patch-libxl_libxl_create.c,v 1.1 2016/12/29 23:12:23 wiz Exp $

--- libxl/libxl_create.c.orig	2011-10-20 17:05:42.000000000 +0000
+++ libxl/libxl_create.c
@@ -171,7 +171,7 @@ int libxl__domain_build(libxl_ctx *ctx, 
         vments[2] = "image/ostype";
         vments[3] = "hvm";
         vments[4] = "start_time";
-        vments[5] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+        vments[5] = libxl__sprintf(&gc, "%llu.%02d", (unsigned long long)start_time.tv_sec,(int)start_time.tv_usec/10000);
     } else {
         ret = libxl__build_pv(ctx, domid, info, state);
         if (ret)
@@ -184,7 +184,7 @@ int libxl__domain_build(libxl_ctx *ctx, 
         vments[i++] = "image/kernel";
         vments[i++] = (char*) info->kernel.path;
         vments[i++] = "start_time";
-        vments[i++] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+        vments[i++] = libxl__sprintf(&gc, "%llu.%02d", (unsigned long long)start_time.tv_sec,(int)start_time.tv_usec/10000);
         if (info->u.pv.ramdisk.path) {
             vments[i++] = "image/ramdisk";
             vments[i++] = (char*) info->u.pv.ramdisk.path;
@@ -227,7 +227,7 @@ static int domain_restore(libxl_ctx *ctx
         vments[2] = "image/ostype";
         vments[3] = "hvm";
         vments[4] = "start_time";
-        vments[5] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+        vments[5] = libxl__sprintf(&gc, "%llu.%02d", (unsigned long long)start_time.tv_sec,(int)start_time.tv_usec/10000);
     } else {
         vments = libxl__calloc(&gc, 11, sizeof(char *));
         i = 0;
@@ -236,7 +236,7 @@ static int domain_restore(libxl_ctx *ctx
         vments[i++] = "image/kernel";
         vments[i++] = (char*) info->kernel.path;
         vments[i++] = "start_time";
-        vments[i++] = libxl__sprintf(&gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+        vments[i++] = libxl__sprintf(&gc, "%llu.%02d", (unsigned long long)start_time.tv_sec,(int)start_time.tv_usec/10000);
         if (info->u.pv.ramdisk.path) {
             vments[i++] = "image/ramdisk";
             vments[i++] = (char*) info->u.pv.ramdisk.path;

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-libxl_libxl_internal.h
$NetBSD: patch-libxl_libxl_internal.h,v 1.1 2016/12/29 23:12:24 wiz Exp $

--- libxl/libxl_internal.h.orig	2012-05-24 13:31:11.000000000 +0200
+++ libxl/libxl_internal.h	2012-05-24 13:31:14.000000000 +0200
@@ -109,7 +109,11 @@
 #define XC_PCI_BDF             "0x%x, 0x%x, 0x%x, 0x%x"
 #define AUTO_PHP_SLOT          0x100
 #define SYSFS_PCI_DEV          "/sys/bus/pci/devices"
+#ifdef __NetBSD__
+#define SYSFS_PCIBACK_DRIVER   "/kern/xen/pci"
+#else
 #define SYSFS_PCIBACK_DRIVER   "/sys/bus/pci/drivers/pciback"
+#endif
 #define XENSTORE_PID_FILE      "/var/run/xenstored.pid"
 
 #define PROC_PCI_NUM_RESOURCES 7

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-libxl_xl__cmdimpl.c
$NetBSD: patch-libxl_xl__cmdimpl.c,v 1.1 2016/12/29 23:12:24 wiz Exp $

--- libxl/xl_cmdimpl.c.orig	2013-05-05 19:37:21.000000000 +0000
+++ libxl/xl_cmdimpl.c
@@ -922,7 +922,7 @@ skip:
 
             for (p = strtok(buf2, ","); p; p = strtok(NULL, ",")) {
                 char* val;
-                while (isblank(*p))
+                while (isblank((unsigned char)*p))
                     p++;
                 val = strchr(p, '=');
                 if (val == NULL)

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ocaml_Makefile.rules
$NetBSD: patch-ocaml_Makefile.rules,v 1.1 2016/12/29 23:12:24 wiz Exp $

--- ocaml/Makefile.rules.orig	2012-08-10 13:51:28.000000000 +0000
+++ ocaml/Makefile.rules
@@ -65,7 +65,7 @@ define OCAML_LIBRARY_template
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+, $(LIBS_$(1)))
+	$(call mk-caml-lib-stubs,$$@, $$+, -dllpath $(PREFIX)/lib $(LIBS_$(1)))
 endef
 
 define OCAML_NOC_LIBRARY_template

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ocaml_common.make
$NetBSD: patch-ocaml_common.make,v 1.1 2016/12/29 23:12:24 wiz Exp $

--- ocaml/common.make.orig	2013-03-13 09:31:47.000000000 +0000
+++ ocaml/common.make
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 CC ?= gcc
 OCAMLOPT ?= ocamlopt
 OCAMLC ?= ocamlc
-OCAMLMKLIB ?= ocamlmklib
+OCAMLMKLIB ?= ocamlmklib -elfmode
 OCAMLDEP ?= ocamldep
 OCAMLLEX ?= ocamllex
 OCAMLYACC ?= ocamlyacc

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ocaml_libs_xb_xs__ring__stubs.c
$NetBSD: patch-ocaml_libs_xb_xs__ring__stubs.c,v 1.1 2016/12/29 23:12:24 wiz Exp $

--- ocaml/libs/xb/xs_ring_stubs.c.orig	2016-09-30 12:57:34.000000000 +0000
+++ ocaml/libs/xb/xs_ring_stubs.c
@@ -46,8 +46,8 @@ static int xs_ring_read(struct mmap_inte
 	XENSTORE_RING_IDX cons, prod; /* offsets only */
 	int to_read;
 
-	cons = *(volatile uint32*)&intf->req_cons;
-	prod = *(volatile uint32*)&intf->req_prod;
+	cons = *(volatile uint32_t*)&intf->req_cons;
+	prod = *(volatile uint32_t*)&intf->req_prod;
 	xen_mb();
 
 	if ((prod - cons) > XENSTORE_RING_SIZE)
@@ -76,8 +76,8 @@ static int xs_ring_write(struct mmap_int
 	XENSTORE_RING_IDX cons, prod;
 	int can_write;
 
-	cons = *(volatile uint32*)&intf->rsp_cons;
-	prod = *(volatile uint32*)&intf->rsp_prod;
+	cons = *(volatile uint32_t*)&intf->rsp_cons;
+	prod = *(volatile uint32_t*)&intf->rsp_prod;
 	xen_mb();
 	if ( (prod - cons) >= XENSTORE_RING_SIZE )
 		return 0;

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ocaml_xenstored_define.ml
$NetBSD: patch-ocaml_xenstored_define.ml,v 1.1 2016/12/29 23:12:24 wiz Exp $

--- ocaml/xenstored/define.ml.orig	2012-11-24 07:27:21.000000000 +0000
+++ ocaml/xenstored/define.ml	2012-11-24 07:33:59.000000000 +0000
@@ -17,13 +17,13 @@
 let xenstored_major = 1
 let xenstored_minor = 0
 
-let xenstored_proc_kva = "/proc/xen/xsd_kva"
+let xenstored_proc_kva = "@PROCDEV@/xsd_kva"
 let xenstored_proc_port = "/proc/xen/xsd_port"
 
 let xs_daemon_socket = "/var/run/xenstored/socket"
 let xs_daemon_socket_ro = "/var/run/xenstored/socket_ro"
 
-let default_config_dir = "/etc/xensource"
+let default_config_dir = "@XENDCONFDIR@"
 
 let maxwatch = ref (50)
 let maxtransaction = ref (20)

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-ocaml_xenstored_utils.ml
$NetBSD: patch-ocaml_xenstored_utils.ml,v 1.1 2016/12/29 23:12:24 wiz Exp $

--- ocaml/xenstored/utils.ml.orig
+++ ocaml/xenstored/utils.ml
@@ -87,7 +83,7 @@ let read_file_single_integer filename =
 	let buf = String.make 20 (char_of_int 0) in
 	let sz = Unix.read fd buf 0 20 in
 	Unix.close fd;
-	int_of_string (String.sub buf 0 sz)
+	int_of_string (String.trim (String.sub buf 0 sz))
 
 let path_complete path connection_path =
 	if String.get path 0 <> '/' then

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-qemu-phy-devices
$NetBSD: patch-qemu-phy-devices,v 1.1 2016/12/29 23:12:24 wiz Exp $

This does 2 things:
- use the correct way to get the size of a disk device or partition (from
  haad@NetBSD.org)
- if given a block device, use the character device instead.

--- ioemu-qemu-xen/block-raw-posix.c.orig	2011-05-20 16:47:37.000000000 +0200
+++ ioemu-qemu-xen/block-raw-posix.c	2011-05-20 18:06:44.000000000 +0200
@@ -66,6 +66,13 @@
 #include <sys/disklabel.h>
 #include <sys/dkio.h>
 #endif
+#if defined(__NetBSD__)
+#include <sys/ioctl.h>
+#include <sys/disklabel.h>
+#include <sys/dkio.h>
+#define SLIST_ENTRY(x) int /*XXXX !*/
+#include <sys/disk.h>
+#endif
 
 //#define DEBUG_FLOPPY
 
@@ -120,6 +127,33 @@
 {
     BDRVRawState *s = bs->opaque;
     int fd, open_flags, ret;
+#ifdef __NetBSD__
+    struct stat sb;
+    static char namebuf[MAXPATHLEN];
+    const char *dp;
+
+    if (lstat(filename, &sb) < 0) {
+	fprintf(stderr, "%s: stat failed: %s\n", filename, strerror(errno));
+	return -errno;
+    }
+    if (S_ISLNK(sb.st_mode)) {
+	fprintf(stderr, "%s: symolink links not supported by qemu-dm\n",
+	    filename);
+	return -EINVAL;
+    }
+    if (S_ISBLK(sb.st_mode)) {
+	dp = strrchr(filename, '/');
+	if (dp == NULL) {
+		snprintf(namebuf, MAXPATHLEN, "r%s", filename);
+	} else {
+		snprintf(namebuf, MAXPATHLEN, "%.*s/r%s",
+		    (int)(dp - filename), filename, dp + 1);
+	}
+	fprintf(stderr, "%s is a block device", filename);
+	filename = namebuf;
+	fprintf(stderr, ", using %s\n", filename);
+    }
+#endif
 
     posix_aio_init();
 
@@ -749,7 +783,7 @@
     return 0;
 }
 
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__NetBSD__)
 static int64_t raw_getlength(BlockDriverState *bs)
 {
     BDRVRawState *s = bs->opaque;
@@ -759,16 +793,29 @@
     if (fstat(fd, &st))
         return -1;
     if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) {
+#if defined(__OpenBSD__)
         struct disklabel dl;
 
         if (ioctl(fd, DIOCGDINFO, &dl))
             return -1;
         return (uint64_t)dl.d_secsize *
             dl.d_partitions[DISKPART(st.st_rdev)].p_size;
+#else
+	struct dkwedge_info dkw;
+	if (ioctl(fd, DIOCGWEDGEINFO, &dkw) != -1) {
+	    return dkw.dkw_size * 512;
+	}  else {
+		struct disklabel dl;
+		if(ioctl(fd, DIOCGDINFO, &dl))
+			return -1;
+		return (uint64_t)dl.d_secsize *
+			    dl.d_partitions[DISKPART(st.st_rdev)].p_size;
+	}
+#endif
     } else
         return st.st_size;
 }
-#else /* !__OpenBSD__ */
+#else /* !__OpenBSD__ && ! __NetBSD__  */
 static int64_t  raw_getlength(BlockDriverState *bs)
 {
     BDRVRawState *s = bs->opaque;

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-xenstat_libxenstat_Makefile
$NetBSD: patch-xenstat_libxenstat_Makefile,v 1.1 2016/12/29 23:12:24 wiz Exp $

--- xenstat/libxenstat/Makefile.orig	2013-03-25 19:37:42.000000000 +0000
+++ xenstat/libxenstat/Makefile
@@ -40,7 +40,7 @@
 LDFLAGS+=-Lsrc -L$(XEN_XENSTORE)/ -L$(XEN_LIBXC)/
 LDLIBS-y = -lxenstore -lxenctrl
 LDLIBS-$(CONFIG_SunOS) += -lkstat
-ARLIBS-y = $(XEN_XENSTORE)/libxenstore.so $(XEN_LIBXC)/libxenctrl.so
+ARLIBS-y =
 ARLIBS-x86_64 = /usr/lib/amd64/libkstat.so
 ARLIBS-x86_32 = /usr/lib/libkstat.so
 ARLIBS-$(CONFIG_SunOS) += $(ARLIBS-$(XEN_TARGET_ARCH))
@@ -57,13 +57,13 @@
 	    $(OBJECTS-y) $(LDLIBS-y)
 
 src/xenstat.o: src/xenstat.c src/xenstat.h src/xenstat_priv.h
-	$(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $<
+	$(CC) $(WARN_FLAGS) $(CFLAGS) -c -o $@ $<
 
 src/xenstat_linux.o: src/xenstat_linux.c src/xenstat_priv.h
-	$(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $<
+	$(CC) $(WARN_FLAGS) $(CFLAGS) -c -o $@ $<
 
 src/xenstat_solaris.o: src/xenstat_solaris.c src/xenstat_priv.h
-	$(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $<
+	$(CC) $(WARN_FLAGS) $(CFLAGS) -c -o $@ $<
 
 src/libxenstat.so.$(MAJOR): $(LIB)
 	$(MAKE_LINK) $(<F) $@

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-xenstat_xentop_Makefile
$NetBSD: patch-xenstat_xentop_Makefile,v 1.1 2016/12/29 23:12:24 wiz Exp $

--- xenstat/xentop/Makefile.orig	2014-05-14 15:15:54.000000000 +0200
+++ xenstat/xentop/Makefile	2014-05-14 15:15:56.000000000 +0200
@@ -19,8 +19,8 @@
 else
 
 CFLAGS += -DGCC_PRINTF -Wall -Werror -I$(XEN_LIBXENSTAT)
-LDFLAGS += -L$(XEN_LIBXENSTAT)
-LDLIBS += -lxenstat $(CURSES_LIBS) $(SOCKET_LIBS)
+LDFLAGS += -L$(XEN_LIBXENSTAT) -L$(XEN_XENSTORE) -L$(XEN_LIBXC)
+LDLIBS += -lxenstat -lxenstore -lxenctrl $(CURSES_LIBS) $(SOCKET_LIBS)
 CFLAGS += -DHOST_$(XEN_OS)
 
 .PHONY: all

File Added: pkgsrc/sysutils/xenstoretools/patches/Attic/patch-xenstore_Makefile
$NetBSD: patch-xenstore_Makefile,v 1.1 2016/12/29 23:12:24 wiz Exp $

Adds a target to install just the useful bits for the xenstore tools.

Used by sysutils/xenstoretools only, but patch maintained here in xentools41 as
xenstoretools shares the same distinfo.

--- xenstore/Makefile.orig	2011-06-14 17:03:45.000000000 +0100
+++ xenstore/Makefile	2011-10-03 13:16:43.000000000 +0100
@@ -111,6 +111,19 @@
 	$(INSTALL_DATA) xs.h $(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL_DATA) xs_lib.h $(DESTDIR)$(INCLUDEDIR)
 
+.PHONY: install
+installclients: clients
+	$(INSTALL_DIR) $(DESTDIR)$(BINDIR)
+	$(INSTALL_PROG) xenstore-control $(DESTDIR)$(BINDIR)
+	$(INSTALL_PROG) xenstore $(DESTDIR)$(BINDIR)
+	set -e ; for c in $(CLIENTS) ; do \
+		ln -f $(DESTDIR)$(BINDIR)/xenstore $(DESTDIR)$(BINDIR)/$${c} ; \
+	done
+	$(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
+	$(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
+	ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR)
+	ln -sf libxenstore.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenstore.so
+
 -include $(DEPS)
 
 # never delete any intermediate files.