Import of pkgsrc-2016Q3

This commit is contained in:
2016-10-14 07:49:11 +02:00
committed by Lionel Sambuc
parent 9d819b6d54
commit 1242aa1e36
35952 changed files with 949749 additions and 377083 deletions

View File

@@ -0,0 +1,34 @@
$NetBSD: patch-.._.._ipxe_src_core_settings.c,v 1.1.1.1 2016/07/04 07:30:49 jnemeth Exp $
--- ../../ipxe/src/core/settings.c.orig 2013-03-25 18:48:57.000000000 +0000
+++ ../../ipxe/src/core/settings.c
@@ -284,10 +284,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;
struct {
struct autovivified_settings autovivified;
- 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 */
@@ -295,13 +297,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 );
ref_init ( &new_child->autovivified.refcnt,
autovivified_settings_free );
generic_settings_init ( &new_child->autovivified.generic,

View File

@@ -0,0 +1,42 @@
$NetBSD: patch-.._.._ipxe_src_interface_efi_efi_snp.c,v 1.1.1.1 2016/07/04 07:30:49 jnemeth Exp $
--- ../../ipxe/src/interface/efi/efi_snp.c.orig 2015-01-25 20:37:13.000000000 +0000
+++ ../../ipxe/src/interface/efi/efi_snp.c
@@ -984,15 +984,16 @@ efi_snp_package_list ( struct efi_snp_de
struct efi_snp_formset formset;
union {
EFI_HII_STRING_PACKAGE_HDR strings;
- uint8_t pad[strings_len];
} __attribute__ (( packed )) strings;
- EFI_HII_PACKAGE_HEADER end;
} __attribute__ (( packed )) *package_list;
+ EFI_HII_PACKAGE_HEADER *end;
+ size_t plen = sizeof(*package_list) + strings_len + sizeof(*end);
/* Allocate package list */
- package_list = zalloc ( sizeof ( *package_list ) );
+ package_list = zalloc ( plen );
if ( ! package_list )
return NULL;
+ end = (char *)package_list + plen - sizeof(*end);
/* Create a unique GUID for this package list and formset */
efi_snp_formset.FormSet.FormSet.Guid.Data1++;
@@ -1001,13 +1002,13 @@ efi_snp_package_list ( struct efi_snp_de
memcpy ( &package_list->header.PackageListGuid,
&efi_snp_formset.FormSet.FormSet.Guid,
sizeof ( package_list->header.PackageListGuid ) );
- package_list->header.PackageLength = sizeof ( *package_list );
+ package_list->header.PackageLength = plen;
memcpy ( &package_list->formset, &efi_snp_formset,
sizeof ( package_list->formset ) );
efi_snp_strings ( &package_list->strings.strings,
- sizeof ( package_list->strings ), snpdev );
- package_list->end.Length = sizeof ( package_list->end );
- package_list->end.Type = EFI_HII_PACKAGE_END;
+ strings_len, snpdev );
+ end->Length = sizeof ( *end );
+ end->Type = EFI_HII_PACKAGE_END;
return &package_list->header;
}

View File

@@ -0,0 +1,124 @@
$NetBSD: patch-.._.._ipxe_src_net_fcels.c,v 1.1.1.1 2016/07/04 07:30:50 jnemeth Exp $
--- ../../ipxe/src/net/fcels.c.orig 2015-01-25 20:27:57.000000000 +0000
+++ ../../ipxe/src/net/fcels.c
@@ -946,8 +946,11 @@ int fc_els_prli_tx ( struct fc_els *els,
struct fc_els_prli_descriptor *descriptor, void *param ) {
struct {
struct fc_prli_frame frame;
- uint8_t param[descriptor->param_len];
- } __attribute__ (( packed )) prli;
+ uint8_t param[];
+ } __attribute__ (( packed )) *prli;
+ size_t plen = sizeof(*prli) + descriptor->param_len;
+ uint8_t prli_buf[plen];
+ prli = (void *)prli_buf;
struct fc_ulp *ulp;
int rc;
@@ -960,22 +963,22 @@ int fc_els_prli_tx ( struct fc_els *els,
}
/* Build frame for transmission */
- memset ( &prli, 0, sizeof ( prli ) );
- prli.frame.command = fc_els_tx_command ( els, FC_ELS_PRLI );
- prli.frame.page_len =
- ( sizeof ( prli.frame.page ) + sizeof ( prli.param ) );
- prli.frame.len = htons ( sizeof ( prli ) );
- prli.frame.page.type = descriptor->type;
+ memset ( prli, 0, plen );
+ prli->frame.command = fc_els_tx_command ( els, FC_ELS_PRLI );
+ prli->frame.page_len =
+ ( sizeof ( prli->frame.page ) + descriptor->param_len );
+ prli->frame.len = htons ( plen );
+ prli->frame.page.type = descriptor->type;
if ( fc_els_is_request ( els ) ) {
- prli.frame.page.flags |= htons ( FC_PRLI_ESTABLISH );
+ prli->frame.page.flags |= htons ( FC_PRLI_ESTABLISH );
} else if ( fc_link_ok ( &ulp->link ) ) {
- prli.frame.page.flags |= htons ( FC_PRLI_ESTABLISH |
+ prli->frame.page.flags |= htons ( FC_PRLI_ESTABLISH |
FC_PRLI_RESPONSE_SUCCESS );
}
- memcpy ( &prli.param, param, sizeof ( prli.param ) );
+ memcpy ( &prli->param, param, descriptor->param_len );
/* Transmit frame */
- if ( ( rc = fc_els_tx ( els, &prli, sizeof ( prli ) ) ) != 0 )
+ if ( ( rc = fc_els_tx ( els, prli, plen ) ) != 0 )
goto err_tx;
/* Drop temporary reference to ULP */
@@ -1003,13 +1006,14 @@ int fc_els_prli_rx ( struct fc_els *els,
void *data, size_t len ) {
struct {
struct fc_prli_frame frame;
- uint8_t param[descriptor->param_len];
+ uint8_t param[];
} __attribute__ (( packed )) *prli = data;
+ size_t plen = sizeof(*prli) + descriptor->param_len;
struct fc_ulp *ulp;
int rc;
/* Sanity check */
- if ( len < sizeof ( *prli ) ) {
+ if ( len < plen ) {
DBGC ( els, FCELS_FMT " received underlength frame:\n",
FCELS_ARGS ( els ) );
DBGC_HDA ( els, 0, data, len );
@@ -1018,7 +1022,7 @@ int fc_els_prli_rx ( struct fc_els *els,
}
DBGC ( els, FCELS_FMT " has parameters:\n", FCELS_ARGS ( els ) );
- DBGC_HDA ( els, 0, prli->param, sizeof ( prli->param ) );
+ DBGC_HDA ( els, 0, prli->param, descriptor->param_len );
/* Get ULP */
ulp = fc_ulp_get_port_id_type ( els->port, &els->peer_port_id,
@@ -1039,7 +1043,7 @@ int fc_els_prli_rx ( struct fc_els *els,
/* Log in ULP, if applicable */
if ( prli->frame.page.flags & htons ( FC_PRLI_ESTABLISH ) ) {
if ( ( rc = fc_ulp_login ( ulp, prli->param,
- sizeof ( prli->param ),
+ descriptor->param_len,
fc_els_is_request ( els ) ) ) != 0 ){
DBGC ( els, FCELS_FMT " could not log in ULP: %s\n",
FCELS_ARGS ( els ), strerror ( rc ) );
@@ -1089,15 +1093,16 @@ int fc_els_prli_detect ( struct fc_els *
const void *data, size_t len ) {
const struct {
struct fc_prli_frame frame;
- uint8_t param[descriptor->param_len];
+ uint8_t param[];
} __attribute__ (( packed )) *prli = data;
+ size_t plen = sizeof(*prli) + descriptor->param_len;
/* Check for PRLI */
if ( prli->frame.command != FC_ELS_PRLI )
return -EINVAL;
/* Check for sufficient length to contain service parameter page */
- if ( len < sizeof ( *prli ) )
+ if ( len < plen )
return -EINVAL;
/* Check for upper-layer protocol type */
@@ -1252,15 +1257,16 @@ static int fc_els_echo_rx_request ( stru
size_t len ) {
struct {
struct fc_echo_frame_header echo;
- char payload[ len - sizeof ( struct fc_echo_frame_header ) ];
+ char payload[];
} *echo = data;
+ size_t plen = suzeif(*echo) + len - sizeof ( struct fc_echo_frame_header );
int rc;
DBGC ( els, FCELS_FMT "\n", FCELS_ARGS ( els ) );
/* Transmit response */
echo->echo.command = FC_ELS_LS_ACC;
- if ( ( rc = fc_els_tx ( els, echo, sizeof ( *echo ) ) ) != 0 )
+ if ( ( rc = fc_els_tx ( els, echo, plen ) ) != 0 )
return rc;
/* Nothing to do */

View File

@@ -0,0 +1,70 @@
$NetBSD: patch-.._.._ipxe_src_net_tls.c,v 1.1.1.1 2016/07/04 07:30:50 jnemeth Exp $
--- ../../ipxe/src/net/tls.c.orig 2010-02-02 17:12:44.000000000 +0100
+++ ../../ipxe/src/net/tls.c 2013-05-26 20:05:24.000000000 +0200
@@ -704,18 +704,23 @@ 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;
+ char key_xchg_buf[klen];
+
+ key_xchg = (void *)key_xchg;
+
+ 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" );
@@ -725,14 +730,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 );
}
/**
@@ -856,12 +860,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;

View File

@@ -0,0 +1,22 @@
$NetBSD: patch-.._Config.mk,v 1.1.1.1 2016/07/04 07:30:50 jnemeth Exp $
--- ../Config.mk.orig 2015-01-12 17:53:24.000000000 +0100
+++ ../Config.mk 2015-01-19 13:16:16.000000000 +0100
@@ -38,7 +38,7 @@
# 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 ?= /
@@ -194,6 +194,8 @@
# and is a bit too fierce about unused return values
CFLAGS-$(clang) += -Wno-parentheses -Wno-format -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)

View File

@@ -0,0 +1,29 @@
$NetBSD: patch-.._docs_man_xl.cfg.pod.5,v 1.1.1.1 2016/07/04 07:30:50 jnemeth Exp $
--- ../docs/man/xl.cfg.pod.5.orig 2016-02-09 14:44:19.000000000 +0000
+++ ../docs/man/xl.cfg.pod.5
@@ -4,13 +4,13 @@ xl.cfg - XL Domain Configuration File Sy
=head1 SYNOPSIS
- /etc/xen/xldomain
+ @XENDCONFDIR@/xldomain
=head1 DESCRIPTION
To create a VM (a domain in Xen terminology, sometimes called a guest)
with xl requires the provision of a domain config file. Typically
-these live in `/etc/xen/DOMAIN.cfg` where DOMAIN is the name of the
+these live in `@XENDCONFDIR@/DOMAIN.cfg` where DOMAIN is the name of the
domain.
=head1 SYNTAX
@@ -1854,7 +1854,7 @@ natively or via hardware backwards compa
=head1 FILES
-F</etc/xen/NAME.cfg>
+F<@XENDCONFDIR@/NAME.cfg>
F</var/lib/xen/dump/NAME>
=head1 BUGS

View File

@@ -0,0 +1,30 @@
$NetBSD: patch-.._docs_man_xl.conf.pod.5,v 1.1.1.1 2016/07/04 07:30:50 jnemeth Exp $
--- ../docs/man/xl.conf.pod.5.orig 2015-01-12 17:53:24.000000000 +0100
+++ ../docs/man/xl.conf.pod.5 2015-01-19 13:18:33.000000000 +0100
@@ -1,6 +1,6 @@
=head1 NAME
-/etc/xen/xl.conf - XL Global/Host Configuration
+@XENDCONFDIR@/xl.conf - XL Global/Host Configuration
=head1 DESCRIPTION
@@ -83,7 +83,7 @@
The old B<vifscript> option is deprecated and should not be used.
-Default: C</etc/xen/scripts/vif-bridge>
+Default: C<@XENDCONFDIR@/scripts/vif-bridge>
=item B<vif.default.bridge="NAME">
@@ -109,7 +109,7 @@
Configures the default script used by Remus to setup network buffering.
-Default: C</etc/xen/scripts/remus-netbuf-setup>
+Default: C<@XENDCONFDIR@/scripts/remus-netbuf-setup>
=item B<output_format="json|sxp">

View File

@@ -0,0 +1,44 @@
$NetBSD: patch-.._docs_man_xl.pod.1,v 1.1.1.1 2016/07/04 07:30:50 jnemeth Exp $
--- ../docs/man/xl.pod.1.orig 2015-01-12 17:53:24.000000000 +0100
+++ ../docs/man/xl.pod.1 2015-01-19 13:19:15.000000000 +0100
@@ -33,10 +33,10 @@
=over 4
-=item start the script B</etc/init.d/xencommons> at boot time
+=item start the script B</etc/rc.d/xencommons> at boot time
Most B<xl> operations rely upon B<xenstored> and B<xenconsoled>: make
-sure you start the script B</etc/init.d/xencommons> at boot time to
+sure you start the script B</etc/rc.d/xencommons> at boot time to
initialize all the daemons needed by B<xl>.
=item setup a B<xenbr0> bridge in dom0
@@ -50,7 +50,7 @@
If you specify the amount of memory dom0 has, passing B<dom0_mem> to
Xen, it is highly recommended to disable B<autoballoon>. Edit
-B</etc/xen/xl.conf> and set it to 0.
+B<@XENDCONFDIR@/xl.conf> and set it to 0.
=item run xl as B<root>
@@ -168,7 +168,7 @@
xl create DebianLenny
-This creates a domain with the file /etc/xen/DebianLenny, and returns as
+This creates a domain with the file @XENDCONFDIR@/DebianLenny, and returns as
soon as it is run.
=item I<with extra parameters>
@@ -463,7 +463,7 @@
=item B<-N> I<netbufscript>
Use <netbufscript> to setup network buffering instead of the
-default script (/etc/xen/scripts/remus-netbuf-setup).
+default script (@XENDCONFDIR@/scripts/remus-netbuf-setup).
=item B<-F>

View File

@@ -0,0 +1,28 @@
$NetBSD: patch-.._docs_man_xlcpupool.cfg.pod.5,v 1.1.1.1 2016/07/04 07:30:50 jnemeth Exp $
--- ../docs/man/xlcpupool.cfg.pod.5.orig 2015-01-12 17:53:24.000000000 +0100
+++ ../docs/man/xlcpupool.cfg.pod.5 2015-01-19 13:16:17.000000000 +0100
@@ -4,12 +4,12 @@
=head1 SYNOPSIS
- /etc/xen/xlcpupool
+ @XENDCONFDIR@/xlcpupool
=head1 DESCRIPTION
To create a Cpupool with xl requires the provision of a cpupool config
-file. Typically these live in `/etc/xen/CPUPOOL.cfg` where CPUPOOL is
+file. Typically these live in `@XENDCONFDIR@/CPUPOOL.cfg` where CPUPOOL is
the name of the cpupool.
=head1 SYNTAX
@@ -101,7 +101,7 @@
=head1 FILES
-F</etc/xen/CPUPOOL.cfg>
+F<@XENDCONFDIR@/CPUPOOL.cfg>
=head1 BUGS

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-.._docs_misc_xl-disk-configuration.txt,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- ../docs/misc/xl-disk-configuration.txt.orig 2015-11-03 10:11:18.000000000 +0100
+++ ../docs/misc/xl-disk-configuration.txt 2016-03-29 22:48:24.000000000 +0200
@@ -173,7 +173,7 @@
Specifies that <target> is not a normal host path, but rather
information to be interpreted by the executable program <script>,
-(looked for in /etc/xen/scripts, if it doesn't contain a slash).
+(looked for in @XENDCONFDIR@/scripts, if it doesn't contain a slash).
These scripts are normally called "block-<script>".

View File

@@ -0,0 +1,22 @@
$NetBSD: patch-Makefile,v 1.1.1.1 2016/07/04 07:30:50 jnemeth Exp $
--- Makefile.orig 2016-02-09 14:44:19.000000000 +0000
+++ Makefile
@@ -17,7 +17,7 @@ SUBDIRS-y += xenmon
SUBDIRS-y += xenstat
SUBDIRS-$(CONFIG_Linux) += memshr
SUBDIRS-$(CONFIG_BLKTAP2) += blktap2
-SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
+#XXX SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
SUBDIRS-y += libfsimage
SUBDIRS-$(CONFIG_Linux) += libvchan
@@ -32,7 +32,7 @@ SUBDIRS-y += libxl
SUBDIRS-$(CONFIG_X86) += xenpaging
SUBDIRS-$(CONFIG_X86) += debugger/gdbsx
SUBDIRS-$(CONFIG_X86) += debugger/kdd
-SUBDIRS-$(CONFIG_TESTS) += tests
+#XXX SUBDIRS-$(CONFIG_TESTS) += tests
# These don't cross-compile
ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))

View File

@@ -0,0 +1,51 @@
$NetBSD: patch-Rules.mk,v 1.1.1.1 2016/07/04 07:30:50 jnemeth Exp $
--- Rules.mk.orig 2016-02-09 14:44:19.000000000 +0000
+++ Rules.mk
@@ -36,23 +36,23 @@ endif
CFLAGS_libxenctrl = -I$(XEN_LIBXC)/include $(CFLAGS_xeninclude)
LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl$(libextension)
-SHLIB_libxenctrl = -Wl,-rpath-link=$(XEN_LIBXC)
+SHLIB_libxenctrl = -Wl,-rpath-link,$(XEN_LIBXC)
CFLAGS_libxenguest = -I$(XEN_LIBXC)/include $(CFLAGS_xeninclude)
LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest$(libextension)
-SHLIB_libxenguest = -Wl,-rpath-link=L$(XEN_LIBXC)
+SHLIB_libxenguest = -Wl,-rpath-link,L$(XEN_LIBXC)
CFLAGS_libxenstore = -I$(XEN_XENSTORE)/include $(CFLAGS_xeninclude)
LDLIBS_libxenstore = $(XEN_XENSTORE)/libxenstore$(libextension)
-SHLIB_libxenstore = -Wl,-rpath-link=$(XEN_XENSTORE)
+SHLIB_libxenstore = -Wl,-rpath-link,$(XEN_XENSTORE)
CFLAGS_libxenstat = -I$(XEN_LIBXENSTAT)
LDLIBS_libxenstat = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(XEN_LIBXENSTAT)/libxenstat$(libextension)
-SHLIB_libxenstat = -Wl,-rpath-link=$(XEN_LIBXENSTAT)
+SHLIB_libxenstat = -Wl,-rpath-link,$(XEN_LIBXENSTAT)
CFLAGS_libxenvchan = -I$(XEN_LIBVCHAN)
LDLIBS_libxenvchan = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(XEN_LIBVCHAN)/libxenvchan$(libextension)
-SHLIB_libxenvchan = -Wl,-rpath-link=$(XEN_LIBVCHAN)
+SHLIB_libxenvchan = -Wl,-rpath-link,$(XEN_LIBVCHAN)
ifeq ($(debug),y)
# Disable optimizations and enable debugging information for macros
@@ -66,7 +66,7 @@ LIBXL_BLKTAP ?= $(CONFIG_BLKTAP2)
ifeq ($(LIBXL_BLKTAP),y)
CFLAGS_libblktapctl = -I$(XEN_BLKTAP2)/control -I$(XEN_BLKTAP2)/include $(CFLAGS_xeninclude)
LDLIBS_libblktapctl = $(XEN_BLKTAP2)/control/libblktapctl$(libextension)
-SHLIB_libblktapctl = -Wl,-rpath-link=$(XEN_BLKTAP2)/control
+SHLIB_libblktapctl = -Wl,-rpath-link,$(XEN_BLKTAP2)/control
else
CFLAGS_libblktapctl =
LDLIBS_libblktapctl =
@@ -75,7 +75,7 @@ endif
CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
LDLIBS_libxenlight = $(XEN_XENLIGHT)/libxenlight$(libextension) $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl)
-SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT)
+SHLIB_libxenlight = -Wl,-rpath-link,$(XEN_XENLIGHT)
CFLAGS += -D__XEN_TOOLS__

View File

@@ -0,0 +1,48 @@
$NetBSD: patch-configure,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- configure.orig 2016-02-09 14:44:19.000000000 +0000
+++ configure
@@ -2402,7 +2402,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain libxl/xenlight.pc.in libxl/xlutil.pc.in"
+ac_config_files="$ac_config_files ../config/Tools.mk ../config/Paths.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain libxl/xenlight.pc.in libxl/xlutil.pc.in"
ac_config_headers="$ac_config_headers config.h"
@@ -3838,7 +3838,7 @@ libdir=`eval echo $libdir`
if test "x$sysconfdir" = 'x${prefix}/etc' ; then
case "$host_os" in
- *freebsd*)
+ *freebsd*|*netbsd*)
sysconfdir=$prefix/etc
;;
*solaris*)
@@ -3916,7 +3916,7 @@ XEN_RUN_DIR=$localstatedir/run/xen
XEN_LOG_DIR=$localstatedir/log/xen
-XEN_LIB_STORED=$localstatedir/lib/xenstored
+XEN_LIB_STORED=$localstatedir/run/xenstored
SHAREDIR=$prefix/share
@@ -3936,7 +3936,7 @@ XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
case "$host_os" in
*freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
-*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
+*netbsd*) XEN_LOCK_DIR=$localstatedir/run ;;
*) XEN_LOCK_DIR=$localstatedir/lock ;;
esac
@@ -10033,6 +10033,7 @@ for ac_config_target in $ac_config_targe
do
case $ac_config_target in
"../config/Tools.mk") CONFIG_FILES="$CONFIG_FILES ../config/Tools.mk" ;;
+ "../config/Paths.mk") CONFIG_FILES="$CONFIG_FILES ../config/Paths.mk" ;;
"hotplug/FreeBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xencommons" ;;
"hotplug/FreeBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xendriverdomain" ;;
"hotplug/Linux/init.d/sysconfig.xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/sysconfig.xencommons" ;;

View File

@@ -0,0 +1,22 @@
$NetBSD: patch-console_daemon_utils.c,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- console/daemon/utils.c.orig 2015-06-22 13:41:35.000000000 +0000
+++ console/daemon/utils.c
@@ -113,13 +113,15 @@ bool xen_setup(void)
xs = xs_daemon_open();
if (xs == NULL) {
dolog(LOG_ERR,
- "Failed to contact xenstore (%m). Is it running?");
+ "Failed to contact xenstore (%s). Is it running?",
+ strerror(errno));
goto out;
}
xc = xc_interface_open(0,0,0);
if (!xc) {
- dolog(LOG_ERR, "Failed to contact hypervisor (%m)");
+ dolog(LOG_ERR, "Failed to contact hypervisor (%s)",
+ strerror(errno));
goto out;
}

View File

@@ -0,0 +1,12 @@
$NetBSD: patch-examples_Makefile,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- examples/Makefile.orig 2015-01-12 17:53:24.000000000 +0100
+++ examples/Makefile 2015-01-19 13:37:18.000000000 +0100
@@ -1,6 +1,6 @@
XEN_ROOT = $(CURDIR)/../..
include $(XEN_ROOT)/tools/Rules.mk
-
+XEN_CONFIG_DIR=${XEN_EXAMPLES_DIR}
# Xen configuration dir and configs to go there.
XEN_READMES = README
XEN_READMES += README.incompatibilities

View File

@@ -0,0 +1,26 @@
$NetBSD: patch-firmware_etherboot_Makefile,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- firmware/etherboot/Makefile.orig 2015-01-12 17:53:24.000000000 +0100
+++ firmware/etherboot/Makefile 2015-01-19 13:42:54.000000000 +0100
@@ -27,18 +27,10 @@
%.rom: $D/src/arch/i386/Makefile
$(MAKE) -C $D/src bin/$(*F).rom
-$T:
- if ! $(FETCHER) _$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

View File

@@ -0,0 +1,9 @@
$NetBSD: patch-firmware_etherboot_patches_series,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- firmware/etherboot/patches/series.orig 2015-01-12 17:53:24.000000000 +0100
+++ firmware/etherboot/patches/series 2015-01-19 13:16:37.000000000 +0100
@@ -1,4 +1,3 @@
boot_prompt_option.patch
build_fix_1.patch
build_fix_2.patch
-build_fix_3.patch

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-firmware_hvmloader_Makefile,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- firmware/hvmloader/Makefile.orig 2016-02-09 14:44:19.000000000 +0000
+++ firmware/hvmloader/Makefile
@@ -28,7 +28,7 @@ LOADADDR = 0x100000
# SMBIOS spec requires format mm/dd/yyyy
SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y)
-CFLAGS += $(CFLAGS_xeninclude)
+CFLAGS += $(CFLAGS_xeninclude) $(EXTRA_CFLAGS)
# We mustn't use tools-only public interfaces.
CFLAGS += -U__XEN_TOOLS__ -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__

View File

@@ -0,0 +1,52 @@
$NetBSD: patch-hotplug_NetBSD_Makefile,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- hotplug/NetBSD/Makefile.orig 2016-02-09 14:44:19.000000000 +0000
+++ hotplug/NetBSD/Makefile
@@ -3,12 +3,13 @@ include $(XEN_ROOT)/tools/Rules.mk
# Xen script dir and scripts to go there.
XEN_SCRIPTS =
+XEN_SCRIPTS += locking.sh
XEN_SCRIPTS += block
XEN_SCRIPTS += vif-bridge
XEN_SCRIPTS += vif-ip
XEN_SCRIPT_DATA =
-XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
+#XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
.PHONY: all
all:
@@ -21,10 +22,11 @@ install: install-scripts install-rcd
.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 +35,12 @@ install-scripts:
.PHONY: install-rcd
install-rcd:
- $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
- set -e; for i in $(XEN_RCD_PROG); \
- do \
- $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
- done
- $(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(INITD_DIR)/xen-hotplugpath.sh
+# $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
+# set -e; for i in $(XEN_RCD_PROG); \
+# do \
+# $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
+# done
+# $(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(INITD_DIR)/xen-hotplugpath.sh
.PHONY: clean
clean:

View File

@@ -0,0 +1,37 @@
$NetBSD: patch-hotplug_NetBSD_block,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- hotplug/NetBSD/block.orig 2016-02-09 14:44:19.000000000 +0000
+++ hotplug/NetBSD/block
@@ -6,6 +6,7 @@
DIR=$(dirname "$0")
. "${DIR}/hotplugpath.sh"
+. "${DIR}/locking.sh"
PATH=${bindir}:${sbindir}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
@@ -62,6 +63,7 @@ case $xstatus in
available_disks="$available_disks $disk"
eval $disk=free
done
+ claim_lock block
# Mark the used vnd(4) devices as ``used''.
for disk in `sysctl hw.disknames`; do
case $disk in
@@ -77,6 +79,7 @@ case $xstatus in
break
fi
done
+ release_lock block
if [ x$device = x ] ; then
error "no available vnd device"
fi
@@ -86,7 +89,7 @@ case $xstatus in
device=$xparams
;;
esac
- physical_device=$(stat -f '%r' "$device")
+ physical_device=$(stat -L -f '%r' "$device")
xenstore-write $xpath/physical-device $physical_device
xenstore-write $xpath/hotplug-status connected
exit 0

View File

@@ -0,0 +1,16 @@
$NetBSD: patch-hotplug_NetBSD_vif-bridge,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- hotplug/NetBSD/vif-bridge.orig 2015-01-12 17:53:24.000000000 +0100
+++ hotplug/NetBSD/vif-bridge 2015-01-19 13:16:37.000000000 +0100
@@ -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
ifconfig $iface up
brconfig $xbridge add $iface
xenstore-write $xpath/hotplug-status connected

View File

@@ -0,0 +1,15 @@
$NetBSD: patch-hotplug_NetBSD_vif-ip,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- hotplug/NetBSD/vif-ip.orig 2015-01-12 17:53:24.000000000 +0100
+++ hotplug/NetBSD/vif-ip 2015-01-19 13:16:37.000000000 +0100
@@ -24,6 +24,10 @@
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
ifconfig $iface $xip up
xenstore-write $xpath/hotplug-status connected
exit 0

View File

@@ -0,0 +1,24 @@
$NetBSD: patch-hotplug_common_Makefile,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- hotplug/common/Makefile.orig 2015-01-12 17:53:24.000000000 +0100
+++ hotplug/common/Makefile 2015-01-19 13:16:37.000000000 +0100
@@ -23,15 +23,15 @@
.PHONY: install-scripts
install-scripts: build
- [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
- $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
+ [ -d $(DESTDIR)${XEN_EXAMPLES_DIR}/scripts ] || \
+ $(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 \
- $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
+ $(INSTALL_DATA) $$i $(DESTDIR)${XEN_EXAMPLES_DIR}/scripts; \
done
.PHONY: clean

View File

@@ -0,0 +1,110 @@
$NetBSD: patch-include_xen-sys_NetBSD_gntdev.h,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- include/xen-sys/NetBSD/gntdev.h.orig 2015-01-19 13:16:37.000000000 +0100
+++ include/xen-sys/NetBSD/gntdev.h 2015-01-19 13:16:37.000000000 +0100
@@ -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__ */

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-libfsimage_ufs_ufs.h,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- libfsimage/ufs/ufs.h.orig 2015-01-12 17:53:24.000000000 +0100
+++ libfsimage/ufs/ufs.h 2015-01-19 13:16:38.000000000 +0100
@@ -4,7 +4,7 @@
*/
#ifndef _GRUB_UFS_H
-#define _GRUB_UFS_H_
+#define _GRUB_UFS_H
/* ufs specific constants */
#define UFS_SBLOCK 16

View File

@@ -0,0 +1,251 @@
$NetBSD: patch-libxc_xc__netbsd.c,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- libxc/xc_netbsd.c.orig 2016-02-09 14:44:19.000000000 +0000
+++ libxc/xc_netbsd.c
@@ -17,13 +17,19 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*/
-#include "xc_private.h"
-
-#include <xen/sys/evtchn.h>
-#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/types.h>
#include <fcntl.h>
#include <malloc.h>
-#include <sys/mman.h>
+#include <unistd.h>
+
+#include <xen/memory.h>
+#include <xen/sys/evtchn.h>
+#include <xen/sys/gntdev.h>
+/* #include <xen/sys/gntalloc.h> */
+#include "xc_private.h"
+#include "xenctrl.h"
+#include "xenctrlosdep.h"
static xc_osdep_handle netbsd_privcmd_open(xc_interface *xch)
{
@@ -389,6 +395,210 @@ void *xc_memalign(xc_interface *xch, siz
return valloc(size);
}
+#if 0
+#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 int netbsd_gnttab_set_max_grants(xc_gnttab *xch, xc_osdep_handle h,
+ uint32_t count)
+{
+ int fd = (int)h, rc;
+ struct ioctl_gntdev_set_max_grants max_grants = { .count = count };
+
+ rc = ioctl(fd, IOCTL_GNTDEV_SET_MAX_GRANTS, &max_grants);
+ if (rc) {
+ /*
+ * Newer (e.g. pv-ops) kernels don't implement this IOCTL,
+ * so ignore the resulting specific failure.
+ */
+ if (errno == ENOTTY)
+ rc = 0;
+ else
+ PERROR("netbsd_gnttab_set_max_grants: ioctl SET_MAX_GRANTS failed");
+ }
+ return rc;
+}
+
+static void *netbsd_gnttab_grant_map(xc_gnttab *xch, xc_osdep_handle h,
+ uint32_t count, int flags, int prot,
+ uint32_t *domids, uint32_t *refs,
+ uint32_t notify_offset,
+ evtchn_port_t notify_port)
+{
+ int fd = (int)h;
+ struct ioctl_gntdev_map_grant_ref *map;
+ unsigned int map_size = ROUNDUP((sizeof(*map) + (count - 1) *
+ sizeof(struct ioctl_gntdev_map_grant_ref)),
+ XC_PAGE_SHIFT);
+ void *addr = NULL;
+ int domids_stride = 1;
+ int i;
+
+ if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
+ domids_stride = 0;
+
+ if ( map_size <= XC_PAGE_SIZE )
+ map = alloca(sizeof(*map) +
+ (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
+ else
+ {
+ map = mmap(NULL, map_size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON | MAP_POPULATE, -1, 0);
+ if ( map == MAP_FAILED )
+ {
+ PERROR("netbsd_gnttab_grant_map: mmap of map failed");
+ 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("netbsd_gnttab_grant_map: ioctl MAP_GRANT_REF failed");
+ goto out;
+ }
+
+ retry:
+ addr = mmap(NULL, XC_PAGE_SIZE * count, prot, MAP_SHARED, fd,
+ map->index);
+
+ if (addr == MAP_FAILED && errno == EAGAIN)
+ {
+ /*
+ * The grant hypercall can return EAGAIN if the granted page is
+ * swapped out. Since the paging daemon may be in the same domain, the
+ * hypercall cannot block without causing a deadlock.
+ *
+ * Because there are no notificaitons when the page is swapped in, wait
+ * a bit before retrying, and hope that the page will arrive eventually.
+ */
+ usleep(1000);
+ goto retry;
+ }
+
+ if (addr != MAP_FAILED)
+ {
+ int rv = 0;
+ struct ioctl_gntdev_unmap_notify notify;
+ notify.index = map->index;
+ notify.action = 0;
+ if (notify_offset < XC_PAGE_SIZE * count) {
+ notify.index += notify_offset;
+ notify.action |= UNMAP_NOTIFY_CLEAR_BYTE;
+ }
+ if (notify_port != -1) {
+ notify.event_channel_port = notify_port;
+ notify.action |= UNMAP_NOTIFY_SEND_EVENT;
+ }
+ if (notify.action)
+ rv = ioctl(fd, IOCTL_GNTDEV_SET_UNMAP_NOTIFY, &notify);
+ if (rv) {
+ PERROR("netbsd_gnttab_grant_map: ioctl SET_UNMAP_NOTIFY failed");
+ munmap(addr, count * XC_PAGE_SIZE);
+ addr = MAP_FAILED;
+ }
+ }
+
+ 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:
+ if ( map_size > XC_PAGE_SIZE )
+ munmap(map, map_size);
+
+ return addr;
+}
+
+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 = {
+ .set_max_grants = netbsd_gnttab_set_max_grants,
+ .grant_map = &netbsd_gnttab_grant_map,
+ .munmap = &netbsd_gnttab_munmap,
+ },
+};
+#endif
+
static struct xc_osdep_ops *netbsd_osdep_init(xc_interface *xch, enum xc_osdep_type type)
{
switch ( type )
@@ -397,6 +607,10 @@ static struct xc_osdep_ops *netbsd_osdep
return &netbsd_privcmd_ops;
case XC_OSDEP_EVTCHN:
return &netbsd_evtchn_ops;
+#if 0
+ case XC_OSDEP_GNTTAB:
+ return &netbsd_gnttab_ops;
+#endif
default:
return NULL;
}

View File

@@ -0,0 +1,22 @@
$NetBSD: patch-libxl_Makefile,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- libxl/Makefile.orig 2016-02-09 14:44:19.000000000 +0000
+++ libxl/Makefile
@@ -276,7 +276,7 @@ install: all
$(INSTALL_DIR) $(DESTDIR)$(sbindir)
$(INSTALL_DIR) $(DESTDIR)$(libdir)
$(INSTALL_DIR) $(DESTDIR)$(includedir)
- $(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR)
+ $(INSTALL_DIR) $(DESTDIR)$(XEN_EXAMPLES_DIR)
$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
$(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/pkgconfig
$(INSTALL_PROG) xl $(DESTDIR)$(sbindir)
@@ -291,7 +291,7 @@ install: all
$(SYMLINK_SHLIB) libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(libdir)/libxlutil.so
$(INSTALL_DATA) libxlutil.a $(DESTDIR)$(libdir)
$(INSTALL_DATA) libxl.h libxl_event.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h libxlutil.h $(DESTDIR)$(includedir)
- $(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
+ $(INSTALL_DATA) bash-completion $(DESTDIR)$(XEN_EXAMPLES_DIR)/xl.sh
$(INSTALL_DATA) xenlight.pc $(DESTDIR)$(SHAREDIR)/pkgconfig/
$(INSTALL_DATA) xlutil.pc $(DESTDIR)$(SHAREDIR)/pkgconfig/

View File

@@ -0,0 +1,40 @@
$NetBSD: patch-libxl_libxl__create.c,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- libxl/libxl_create.c.orig 2015-01-12 17:53:24.000000000 +0100
+++ libxl/libxl_create.c 2015-01-19 14:08:19.000000000 +0100
@@ -432,7 +432,7 @@
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, "%jd.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
localents = libxl__calloc(gc, 9, sizeof(char *));
i = 0;
@@ -469,7 +469,7 @@
vments[i++] = "image/kernel";
vments[i++] = (char *) state->pv_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, "%jd.%02d", (intmax_t)start_time.tv_sec, (int)start_time.tv_usec/10000);
if (state->pv_ramdisk.path) {
vments[i++] = "image/ramdisk";
vments[i++] = (char *) state->pv_ramdisk.path;
@@ -1061,7 +1061,7 @@
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, "%jd.%02d", (intmax_t)start_time.tv_sec, (int)start_time.tv_usec/10000);
break;
case LIBXL_DOMAIN_TYPE_PV:
vments = libxl__calloc(gc, 11, sizeof(char *));
@@ -1071,7 +1071,7 @@
vments[i++] = "image/kernel";
vments[i++] = (char *) state->pv_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, "%jd.%02d", (intmax_t)start_time.tv_sec, (int)start_time.tv_usec/10000);
if (state->pv_ramdisk.path) {
vments[i++] = "image/ramdisk";
vments[i++] = (char *) state->pv_ramdisk.path;

View File

@@ -0,0 +1,30 @@
$NetBSD: patch-libxl_libxl__netbsd.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- libxl/libxl_netbsd.c.orig 2016-06-20 12:08:22.000000000 +0000
+++ libxl/libxl_netbsd.c
@@ -68,7 +68,25 @@ int libxl__get_hotplug_script_info(libxl
switch (dev->backend_kind) {
case LIBXL__DEVICE_KIND_VBD:
+ if (num_exec != 0) {
+ LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+ rc = 0;
+ goto out;
+ }
+ rc = libxl__hotplug(gc, dev, args, action);
+ if (!rc) rc = 1;
+ break;
case LIBXL__DEVICE_KIND_VIF:
+ /*
+ * If domain has a stubdom we don't have to execute hotplug scripts
+ * for emulated interfaces
+ */
+ if ((num_exec != 0) ||
+ (libxl_get_stubdom_id(CTX, dev->domid) && num_exec)) {
+ LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+ rc = 0;
+ goto out;
+ }
rc = libxl__hotplug(gc, dev, args, action);
if (!rc) rc = 1;
break;

View File

@@ -0,0 +1,12 @@
$NetBSD: patch-libxl_libxl__save__helper.c,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- libxl/libxl_save_helper.c.orig 2015-01-25 21:04:31.000000000 +0000
+++ libxl/libxl_save_helper.c
@@ -49,6 +49,7 @@
/*----- logger -----*/
+__attribute__((__format__(__printf__, 5, 0)))
static void tellparent_vmessage(xentoollog_logger *logger_in,
xentoollog_level level,
int errnoval,

View File

@@ -0,0 +1,22 @@
$NetBSD: patch-libxl_libxl_uuid.c,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- libxl/libxl_uuid.c.orig 2015-01-19 17:05:02.000000000 +0100
+++ libxl/libxl_uuid.c 2015-01-19 17:18:47.000000000 +0100
@@ -77,7 +77,7 @@
assert(status == uuid_s_ok);
}
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
int libxl_uuid_from_string(libxl_uuid *uuid, const char *in)
{
uint32_t status;
@@ -112,7 +112,7 @@
memset(&uuid->uuid, 0, sizeof(uuid->uuid));
}
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
int libxl_uuid_compare(const libxl_uuid *uuid1, const libxl_uuid *uuid2)
{

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-libxl_xl__cmdtable.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- libxl/xl_cmdtable.c.orig 2015-11-03 09:11:18.000000000 +0000
+++ libxl/xl_cmdtable.c
@@ -507,7 +507,7 @@ struct cmd_spec cmd_table[] = {
"-e Do not wait in the background (on <host>) for the death\n"
" of the domain.\n"
"-N <netbufscript> Use netbufscript to setup network buffering instead of the\n"
- " default script (/etc/xen/scripts/remus-netbuf-setup).\n"
+ " default script (@XENDCONFDIR@/scripts/remus-netbuf-setup).\n"
"-F Enable unsafe configurations [-b|-n|-d flags]. Use this option\n"
" with caution as failover may not work as intended.\n"
"-b Replicate memory checkpoints to /dev/null (blackhole).\n"

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-ocaml_common.make,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- ocaml/common.make.orig 2015-01-12 17:53:24.000000000 +0100
+++ ocaml/common.make 2015-01-19 13:16:38.000000000 +0100
@@ -3,7 +3,7 @@
CC ?= gcc
OCAMLOPT ?= ocamlopt
OCAMLC ?= ocamlc
-OCAMLMKLIB ?= ocamlmklib
+OCAMLMKLIB ?= ocamlmklib -elfmode
OCAMLDEP ?= ocamldep
OCAMLLEX ?= ocamllex
OCAMLYACC ?= ocamlyacc

View File

@@ -0,0 +1,12 @@
$NetBSD: patch-ocaml_xenstored_Makefile,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- ocaml/xenstored/Makefile.orig 2016-02-09 14:44:19.000000000 +0000
+++ ocaml/xenstored/Makefile
@@ -1,6 +1,7 @@
XEN_ROOT = $(CURDIR)/../../..
OCAML_TOPLEVEL = $(CURDIR)/..
include $(OCAML_TOPLEVEL)/common.make
+XEN_CONFIG_DIR=${XEN_EXAMPLES_DIR}
# Include configure output (config.h)
CFLAGS += -include $(XEN_ROOT)/tools/config.h

View File

@@ -0,0 +1,20 @@
$NetBSD: patch-ocaml_xenstored_define.ml,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- ocaml/xenstored/define.ml.orig 2015-01-12 17:53:24.000000000 +0100
+++ ocaml/xenstored/define.ml 2015-01-19 13:16:38.000000000 +0100
@@ -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/xen"
+let default_config_dir = "@XENDCONFDIR@"
let maxwatch = ref (50)
let maxtransaction = ref (20)

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-ocaml_xenstored_utils.ml,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- ocaml/xenstored/utils.ml.orig 2015-01-12 17:53:24.000000000 +0100
+++ ocaml/xenstored/utils.ml 2015-01-19 13:16:38.000000000 +0100
@@ -94,7 +94,7 @@
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

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-pygrub_Makefile,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- pygrub/Makefile.orig 2016-02-09 14:44:19.000000000 +0000
+++ pygrub/Makefile
@@ -17,7 +17,7 @@ install: all
--install-scripts=$(LIBEXEC_BIN) --force
set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
"`readlink -f $(DESTDIR)/$(bindir)`" != \
- "`readlink -f $(LIBEXEC_BIN)`" ]; then \
+ "`readlink -f $(DESTDIR)/$(LIBEXEC_BIN)`" ]; then \
ln -sf $(LIBEXEC_BIN)/pygrub $(DESTDIR)/$(bindir); \
fi

View File

@@ -0,0 +1,84 @@
$NetBSD: patch-qemu-xen-traditional_Makefile,v 1.1.1.1 2016/07/04 07:30:52 jnemeth Exp $
--- qemu-xen-traditional/Makefile.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/Makefile 2015-01-19 14:16:12.000000000 +0100
@@ -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 @@
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_PROG) $(STRIP_OPT) $(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 @@
# documentation
%.html: %.texi
- texi2html -monolithic -number $<
+ texi2html -monolithic -number-sections $<
%.info: %.texi
makeinfo $< -o $@
@@ -284,15 +284,15 @@
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

View File

@@ -0,0 +1,62 @@
$NetBSD: patch-qemu-xen-traditional_block-raw-posix.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
- if given a block device, use the character device instead.
--- qemu-xen-traditional/block-raw-posix.c.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/block-raw-posix.c 2015-01-19 13:16:38.000000000 +0100
@@ -65,6 +65,7 @@
#include <sys/disklabel.h>
#include <sys/dkio.h>
#include <sys/disk.h>
+#include <sys/param.h>
#endif
#ifdef __OpenBSD__
@@ -72,6 +73,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
@@ -1008,6 +1016,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();

View File

@@ -0,0 +1,41 @@
$NetBSD: patch-qemu-xen-traditional_configure,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen-traditional/configure.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/configure 2015-01-20 22:58:07.000000000 +0100
@@ -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"
@@ -1216,6 +1216,8 @@
echo "MAKE=$make" >> $config_mak
echo "INSTALL=$install" >> $config_mak
echo "INSTALL_PROG=$install -m 0755" >> $config_mak
+echo "INSTALL_DATA=$install -m0644" >> $config_mak
+echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
echo "CC=$cc" >> $config_mak
echo "HOST_CC=$host_cc" >> $config_mak
echo "AR=$ar" >> $config_mak
@@ -1493,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

View File

@@ -0,0 +1,34 @@
$NetBSD: patch-qemu-xen-traditional_hw_e1000.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
From sysutils/xentools33/patches/patch-ak.
qemu-0.13.x will include this fix:
http://git.qemu.org/qemu.git/commit/?id=9651ac55e5de0e1534d898316cc851af6ffc4334
--- qemu-xen-traditional/hw/e1000.c.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/hw/e1000.c 2015-01-19 13:16:38.000000000 +0100
@@ -265,16 +265,20 @@
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;

View File

@@ -0,0 +1,37 @@
$NetBSD: patch-qemu-xen-traditional_hw_ide.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen-traditional/hw/ide.c.orig 2014-01-09 13:44:42.000000000 +0100
+++ qemu-xen-traditional/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 */

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-qemu-xen-traditional_hw_pass-through.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen-traditional/hw/pass-through.c.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/hw/pass-through.c 2015-01-19 13:16:38.000000000 +0100
@@ -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"

View File

@@ -0,0 +1,18 @@
$NetBSD: patch-qemu-xen-traditional_hw_pass-through.h,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen-traditional/hw/pass-through.h.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/hw/pass-through.h 2015-01-19 13:16:38.000000000 +0100
@@ -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"

View File

@@ -0,0 +1,17 @@
$NetBSD: patch-qemu-xen-traditional_hw_piix4acpi.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen-traditional/hw/piix4acpi.c.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/hw/piix4acpi.c 2015-01-19 13:16:38.000000000 +0100
@@ -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)

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-qemu-xen-traditional_hw_pt-graphics.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen-traditional/hw/pt-graphics.c.orig 2015-01-19 16:14:46.000000000 +0100
+++ qemu-xen-traditional/hw/pt-graphics.c 2015-01-19 16:14:51.000000000 +0100
@@ -4,8 +4,6 @@
#include "pass-through.h"
#include "pci.h"
-#include "pci/header.h"
-#include "pci/pci.h"
#include <unistd.h>
#include <sys/ioctl.h>

View File

@@ -0,0 +1,15 @@
$NetBSD: patch-qemu-xen-traditional_hw_pt-msi.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen-traditional/hw/pt-msi.c.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/hw/pt-msi.c 2015-01-19 13:16:38.000000000 +0100
@@ -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;

View File

@@ -0,0 +1,12 @@
$NetBSD: patch-qemu-xen-traditional_hw_pt-msi.h,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen-traditional/hw/pt-msi.h.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/hw/pt-msi.h 2015-01-19 13:16:38.000000000 +0100
@@ -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 */

View File

@@ -0,0 +1,12 @@
$NetBSD: patch-qemu-xen-traditional_i386-dm_hookstarget.mak,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen-traditional/i386-dm/hookstarget.mak.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/i386-dm/hookstarget.mak 2015-01-19 13:16:38.000000000 +0100
@@ -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"

View File

@@ -0,0 +1,34 @@
$NetBSD: patch-qemu-xen-traditional_xen-hooks.mak,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
enable PCI passthrough when pciutils is present
--- qemu-xen-traditional/xen-hooks.mak.orig 2014-10-06 17:50:24.000000000 +0200
+++ qemu-xen-traditional/xen-hooks.mak 2015-01-19 13:16:38.000000000 +0100
@@ -59,17 +59,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

View File

@@ -0,0 +1,12 @@
$NetBSD: patch-qemu-xen_audio_audio.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen/audio/audio.c.orig 2014-12-02 11:41:02.000000000 +0100
+++ qemu-xen/audio/audio.c 2015-01-19 13:16:38.000000000 +0100
@@ -1173,6 +1173,7 @@
return 0;
}
+#undef read
bytes = sw->hw->pcm_ops->read (sw, buf, size);
return bytes;
}

View File

@@ -0,0 +1,15 @@
$NetBSD: patch-qemu-xen_qemu-doc.texi,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
Avoid encoding issues in pod2man.
--- qemu-xen/qemu-doc.texi.orig 2014-12-02 11:41:02.000000000 +0100
+++ qemu-xen/qemu-doc.texi 2015-01-19 14:24:23.000000000 +0100
@@ -220,7 +220,7 @@
QEMU uses YM3812 emulation by Tatsuyuki Satoh.
QEMU uses GUS emulation (GUSEMU32 @url{http://www.deinmeister.de/gusemu/})
-by Tibor "TS" Schütz.
+by Tibor "TS" Schuetz.
Note that, by default, GUS shares IRQ(7) with parallel ports and so
QEMU must be told to not have parallel ports to have working GUS.

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-qemu-xen_xen-hvm.c,v 1.1.1.1 2016/07/04 07:30:53 jnemeth Exp $
--- qemu-xen/xen-hvm.c.orig 2016-01-06 16:42:43.000000000 +0000
+++ qemu-xen/xen-hvm.c
@@ -612,7 +612,7 @@ static void xen_sync_dirty_bitmap(XenIOS
for (i = 0; i < ARRAY_SIZE(bitmap); i++) {
unsigned long map = bitmap[i];
while (map != 0) {
- j = ctzl(map);
+ j = __builtin_ctzl(map);
map &= ~(1ul << j);
memory_region_set_dirty(framebuffer,
(i * width + j) * TARGET_PAGE_SIZE,

View File

@@ -0,0 +1,18 @@
$NetBSD: patch-xenpaging_xenpaging.c,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- xenpaging/xenpaging.c.orig 2016-06-20 12:08:22.000000000 +0000
+++ xenpaging/xenpaging.c
@@ -182,10 +182,11 @@ static int xenpaging_get_tot_pages(struc
static void *init_page(void)
{
void *buffer;
+ int rc;
/* Allocated page memory */
- errno = posix_memalign(&buffer, PAGE_SIZE, PAGE_SIZE);
- if ( errno != 0 )
+ rc = posix_memalign(&buffer, PAGE_SIZE, PAGE_SIZE);
+ if ( rc != 0 )
return NULL;
/* Lock buffer in memory so it can't be paged out */

View File

@@ -0,0 +1,18 @@
$NetBSD: patch-xenstore_xc.c,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- xenstore/xs.c.orig 2015-01-19 15:40:00.000000000 +0100
+++ xenstore/xs.c 2015-01-19 15:46:56.000000000 +0100
@@ -725,9 +725,13 @@
#ifdef USE_PTHREAD
#define DEFAULT_THREAD_STACKSIZE (16 * 1024)
+#ifndef PTHREAD_STACK_MIN
+#define READ_THREAD_STACKSIZE DEFAULT_THREAD_STACKSIZE
+#else
#define READ_THREAD_STACKSIZE \
((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ? \
PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
+#endif
/* We dynamically create a reader thread on demand. */
mutex_lock(&h->request_mutex);

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-xentrace_xentrace.c,v 1.1.1.1 2016/07/04 07:30:51 jnemeth Exp $
--- xentrace/xentrace.c.orig 2016-02-09 14:44:19.000000000 +0000
+++ xentrace/xentrace.c
@@ -945,7 +945,7 @@ static int parse_cpumask_range(const cha
{
unsigned int a, b;
int nmaskbits;
- char c;
+ unsigned char c;
int in_range;
const char *s;