svn commit: r256706 - in projects/camlock: . contrib/binutils/gas contrib/bsnmp/lib contrib/libcxxrt contrib/mtree lib/libproc lib/libvmmapi lib/libz release/picobsd/build release/picobsd/floppy.tr...

Alexander Motin mav at FreeBSD.org
Thu Oct 17 20:23:35 UTC 2013


Author: mav
Date: Thu Oct 17 20:23:28 2013
New Revision: 256706
URL: http://svnweb.freebsd.org/changeset/base/256706

Log:
  MFC @ r256705

Added:
  projects/camlock/sys/dev/cxgbe/iw_cxgbe/
     - copied from r256705, head/sys/dev/cxgbe/iw_cxgbe/
  projects/camlock/sys/modules/cxgbe/iw_cxgbe/
     - copied from r256705, head/sys/modules/cxgbe/iw_cxgbe/
Modified:
  projects/camlock/Makefile.inc1
  projects/camlock/contrib/binutils/gas/dwarf2dbg.c
  projects/camlock/contrib/bsnmp/lib/snmp.c
  projects/camlock/contrib/bsnmp/lib/snmp.h
  projects/camlock/contrib/bsnmp/lib/snmpagent.c
  projects/camlock/contrib/libcxxrt/typeinfo.cc
  projects/camlock/contrib/mtree/compare.c
  projects/camlock/contrib/mtree/create.c
  projects/camlock/contrib/mtree/getid.c
  projects/camlock/contrib/mtree/spec.c
  projects/camlock/lib/libproc/_libproc.h
  projects/camlock/lib/libvmmapi/vmmapi.c
  projects/camlock/lib/libz/zopen.c
  projects/camlock/release/picobsd/build/picobsd
  projects/camlock/release/picobsd/floppy.tree/etc/rc1
  projects/camlock/release/picobsd/floppy.tree/etc/ssh/sshd_config
  projects/camlock/sbin/iscontrol/fsm.c
  projects/camlock/sbin/route/keywords
  projects/camlock/sbin/route/route.8
  projects/camlock/sbin/route/route.c
  projects/camlock/share/examples/bhyve/vmrun.sh
  projects/camlock/share/man/man9/rtentry.9
  projects/camlock/sys/amd64/amd64/pmap.c
  projects/camlock/sys/amd64/include/vmm.h   (contents, props changed)
  projects/camlock/sys/amd64/vmm/intel/vmx.c
  projects/camlock/sys/amd64/vmm/intel/vmx.h
  projects/camlock/sys/amd64/vmm/intel/vmx_controls.h
  projects/camlock/sys/amd64/vmm/x86.c
  projects/camlock/sys/arm/arm/busdma_machdep-v6.c
  projects/camlock/sys/arm/arm/cpufunc.c
  projects/camlock/sys/arm/arm/fusu.S
  projects/camlock/sys/arm/arm/identcpu.c
  projects/camlock/sys/arm/arm/locore.S
  projects/camlock/sys/arm/arm/machdep.c
  projects/camlock/sys/arm/arm/pl310.c
  projects/camlock/sys/arm/include/armreg.h
  projects/camlock/sys/dev/ath/if_ath.c
  projects/camlock/sys/dev/ath/if_ath_tx.c
  projects/camlock/sys/dev/isp/isp.c
  projects/camlock/sys/dev/isp/isp_freebsd.c
  projects/camlock/sys/dev/isp/isp_freebsd.h
  projects/camlock/sys/dev/isp/ispvar.h
  projects/camlock/sys/dev/random/ivy.c
  projects/camlock/sys/geom/part/g_part.c
  projects/camlock/sys/geom/part/g_part_apm.c
  projects/camlock/sys/geom/part/g_part_bsd.c
  projects/camlock/sys/geom/part/g_part_ebr.c
  projects/camlock/sys/geom/part/g_part_gpt.c
  projects/camlock/sys/geom/part/g_part_mbr.c
  projects/camlock/sys/geom/part/g_part_pc98.c
  projects/camlock/sys/geom/part/g_part_vtoc8.c
  projects/camlock/sys/kern/makesyscalls.sh
  projects/camlock/sys/mips/atheros/if_arge.c
  projects/camlock/sys/mips/atheros/if_argevar.h
  projects/camlock/sys/modules/cxgbe/Makefile
  projects/camlock/sys/net/ieee8023ad_lacp.c
  projects/camlock/sys/net/radix.c
  projects/camlock/sys/net/radix.h
  projects/camlock/sys/net/route.c
  projects/camlock/sys/ofed/drivers/net/mlx4/en_netdev.c
  projects/camlock/tools/build/mk/OptionalObsoleteFiles.inc
  projects/camlock/usr.sbin/bhyve/bhyverun.c
  projects/camlock/usr.sbin/bhyve/bhyverun.h
  projects/camlock/usr.sbin/bhyve/spinup_ap.c
  projects/camlock/usr.sbin/bhyvectl/bhyvectl.c
  projects/camlock/usr.sbin/bhyveload/bhyveload.8
  projects/camlock/usr.sbin/bhyveload/bhyveload.c
  projects/camlock/usr.sbin/freebsd-update/freebsd-update.sh
  projects/camlock/usr.sbin/kldxref/kldxref.c
Directory Properties:
  projects/camlock/   (props changed)
  projects/camlock/contrib/binutils/   (props changed)
  projects/camlock/contrib/libcxxrt/   (props changed)
  projects/camlock/contrib/mtree/   (props changed)
  projects/camlock/lib/libvmmapi/   (props changed)
  projects/camlock/lib/libz/   (props changed)
  projects/camlock/sbin/   (props changed)
  projects/camlock/sys/   (props changed)
  projects/camlock/sys/amd64/vmm/   (props changed)
  projects/camlock/usr.sbin/bhyve/   (props changed)
  projects/camlock/usr.sbin/bhyvectl/   (props changed)
  projects/camlock/usr.sbin/bhyveload/   (props changed)

Modified: projects/camlock/Makefile.inc1
==============================================================================
--- projects/camlock/Makefile.inc1	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/Makefile.inc1	Thu Oct 17 20:23:28 2013	(r256706)
@@ -1830,7 +1830,7 @@ NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOU
 	CPUTYPE=${XDEV_CPUTYPE}
 
 XDDIR=${XDEV_ARCH}-freebsd
-XDTP=/usr/${XDDIR}
+XDTP=usr/${XDDIR}
 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
 	INSTALL="sh ${.CURDIR}/tools/install.sh"
 CDENV= ${CDBENV} \
@@ -1843,8 +1843,8 @@ CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" 
 
 CDTMP=	${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
-CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
-XDDESTDIR=${DESTDIR}${XDTP}
+CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
+XDDESTDIR=${DESTDIR}/${XDTP}
 .if !defined(OSREL)
 OSREL!= uname -r | sed -e 's/[-(].*//'
 .endif
@@ -1924,6 +1924,7 @@ _xi-libraries:
 
 _xi-links:
 	${_+_}cd ${XDDESTDIR}/usr/bin; \
+       mkdir -p ../../../../usr/bin; \
 		for i in *; do \
 			ln -sf ../../${XDTP}/usr/bin/$$i \
 			    ../../../../usr/bin/${XDDIR}-$$i; \

Modified: projects/camlock/contrib/binutils/gas/dwarf2dbg.c
==============================================================================
--- projects/camlock/contrib/binutils/gas/dwarf2dbg.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/contrib/binutils/gas/dwarf2dbg.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -1271,6 +1271,7 @@ out_debug_line (segT line_seg)
   symbolS *line_end;
   struct line_seg *s;
   enum dwarf2_format d2f;
+  int sizeof_initial_length;
   int sizeof_offset;
 
   subseg_set (line_seg, 0);
@@ -1287,27 +1288,24 @@ out_debug_line (segT line_seg)
   d2f = DWARF2_FORMAT ();
   if (d2f == dwarf2_format_32bit)
     {
-      expr.X_add_number = -4;
-      emit_expr (&expr, 4);
-      sizeof_offset = 4;
+      sizeof_initial_length = sizeof_offset = 4;
     }
   else if (d2f == dwarf2_format_64bit)
     {
-      expr.X_add_number = -12;
-      out_four (-1);
-      emit_expr (&expr, 8);
+      sizeof_initial_length = 12;
       sizeof_offset = 8;
+      out_four (-1);
     }
   else if (d2f == dwarf2_format_64bit_irix)
     {
-      expr.X_add_number = -8;
-      emit_expr (&expr, 8);
-      sizeof_offset = 8;
+      sizeof_initial_length = sizeof_offset = 8;
     }
   else
     {
       as_fatal (_("internal error: unknown dwarf2 format"));
     }
+  expr.X_add_number = -sizeof_initial_length;
+  emit_expr (&expr, sizeof_offset);
 
   /* Version.  */
   out_two (2);
@@ -1316,7 +1314,7 @@ out_debug_line (segT line_seg)
   expr.X_op = O_subtract;
   expr.X_add_symbol = prologue_end;
   expr.X_op_symbol = line_start;
-  expr.X_add_number = - (4 + 2 + 4);
+  expr.X_add_number = - (sizeof_initial_length + 2 + sizeof_offset);
   emit_expr (&expr, sizeof_offset);
 
   /* Parameters of the state machine.  */

Modified: projects/camlock/contrib/bsnmp/lib/snmp.c
==============================================================================
--- projects/camlock/contrib/bsnmp/lib/snmp.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/contrib/bsnmp/lib/snmp.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -288,11 +288,13 @@ parse_secparams(struct asn_buf *b, struc
 	memset(buf, 0, 256);
 	tb.asn_ptr = buf;
 	tb.asn_len = 256;
+	u_int len;
 
-	if (asn_get_octetstring(b, buf, &tb.asn_len) != ASN_ERR_OK) {
+	if (asn_get_octetstring(b, buf, &len) != ASN_ERR_OK) {
 		snmp_error("cannot parse usm header");
 		return (ASN_ERR_FAILED);
 	}
+	tb.asn_len = len;
 
 	if (asn_get_sequence(&tb, &octs_len) != ASN_ERR_OK) {
 		snmp_error("cannot decode usm header");
@@ -864,7 +866,7 @@ snmp_fix_encoding(struct asn_buf *b, str
 			return (SNMP_CODE_FAILED);
 
 		pdu->scoped_len = b->asn_ptr - pdu->scoped_ptr;
-		if ((code = snmp_pdu_fix_padd(b, pdu))!= ASN_ERR_OK)
+		if (snmp_pdu_fix_padd(b, pdu) != ASN_ERR_OK)
 			return (SNMP_CODE_FAILED);
 
 		if (pdu->security_model != SNMP_SECMODEL_USM)
@@ -997,7 +999,7 @@ snmp_pdu_encode(struct snmp_pdu *pdu, st
 	if ((err = snmp_pdu_encode_header(resp_b, pdu)) != SNMP_CODE_OK)
 		return (err);
 	for (idx = 0; idx < pdu->nbindings; idx++)
-		if ((err = snmp_binding_encode(resp_b, &pdu->bindings[idx]))
+		if (snmp_binding_encode(resp_b, &pdu->bindings[idx])
 		    != ASN_ERR_OK)
 			return (SNMP_CODE_FAILED);
 

Modified: projects/camlock/contrib/bsnmp/lib/snmp.h
==============================================================================
--- projects/camlock/contrib/bsnmp/lib/snmp.h	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/contrib/bsnmp/lib/snmp.h	Thu Oct 17 20:23:28 2013	(r256706)
@@ -182,7 +182,7 @@ struct snmp_pdu {
 
 	/* fixes for encoding */
 	size_t			outer_len;
-	size_t			scoped_len;
+	asn_len_t		scoped_len;
 	u_char			*outer_ptr;
 	u_char			*digest_ptr;
 	u_char			*encrypted_ptr;

Modified: projects/camlock/contrib/bsnmp/lib/snmpagent.c
==============================================================================
--- projects/camlock/contrib/bsnmp/lib/snmpagent.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/contrib/bsnmp/lib/snmpagent.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -166,7 +166,7 @@ find_subnode(const struct snmp_value *va
 }
 
 static void
-snmp_pdu_create_response(struct snmp_pdu *pdu, struct snmp_pdu *resp)
+snmp_pdu_create_response(const struct snmp_pdu *pdu, struct snmp_pdu *resp)
 {
 	memset(resp, 0, sizeof(*resp));
 	strcpy(resp->community, pdu->community);
@@ -276,7 +276,12 @@ snmp_get(struct snmp_pdu *pdu, struct as
 		}
 	}
 
-	return (snmp_fix_encoding(resp_b, resp));
+	if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) {
+		snmp_debug("get: failed to encode PDU");
+		return (SNMP_RET_ERR);
+	}
+
+	return (SNMP_RET_OK);
 }
 
 static struct snmp_node *
@@ -438,7 +443,13 @@ snmp_getnext(struct snmp_pdu *pdu, struc
 			return (SNMP_RET_ERR);
 		}
 	}
-	return (snmp_fix_encoding(resp_b, resp));
+
+	if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) {
+		snmp_debug("getnext: failed to encode PDU");
+		return (SNMP_RET_ERR);
+	}
+
+	return (SNMP_RET_OK);
 }
 
 enum snmp_ret
@@ -537,7 +548,12 @@ snmp_getbulk(struct snmp_pdu *pdu, struc
 	}
 
   done:
-	return (snmp_fix_encoding(resp_b, resp));
+	if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) {
+		snmp_debug("getnext: failed to encode PDU");
+		return (SNMP_RET_ERR);
+	}
+
+	return (SNMP_RET_OK);
 }
 
 /*
@@ -952,18 +968,57 @@ enum snmp_ret
 snmp_make_errresp(const struct snmp_pdu *pdu, struct asn_buf *pdu_b,
     struct asn_buf *resp_b)
 {
+	u_char type;
 	asn_len_t len;
 	struct snmp_pdu resp;
 	enum asn_err err;
 	enum snmp_code code;
 
-	memset(&resp, 0, sizeof(resp));
+	snmp_pdu_create_response(pdu, &resp);
+
 	if ((code = snmp_pdu_decode_header(pdu_b, &resp)) != SNMP_CODE_OK)
 		return (SNMP_RET_IGN);
 
-	if (pdu_b->asn_len < len)
+	if (pdu->version == SNMP_V3) {
+		if (resp.user.priv_proto != SNMP_PRIV_NOPRIV &&
+		   (asn_get_header(pdu_b, &type, &resp.scoped_len) != ASN_ERR_OK
+		   || type != ASN_TYPE_OCTETSTRING)) {
+			snmp_error("cannot decode encrypted pdu");
+			return (SNMP_RET_IGN);
+		}
+
+		if (asn_get_sequence(pdu_b, &len) != ASN_ERR_OK) {
+			snmp_error("cannot decode scoped pdu header");
+			return (SNMP_RET_IGN);
+		}
+
+		len = SNMP_ENGINE_ID_SIZ;
+		if (asn_get_octetstring(pdu_b, (u_char *)resp.context_engine,
+		    &len) != ASN_ERR_OK) {
+			snmp_error("cannot decode msg context engine");
+			return (SNMP_RET_IGN);
+		}
+		resp.context_engine_len = len;
+		len = SNMP_CONTEXT_NAME_SIZ;
+		if (asn_get_octetstring(pdu_b, (u_char *)resp.context_name,
+		    &len) != ASN_ERR_OK) {
+			snmp_error("cannot decode msg context name");
+			return (SNMP_RET_IGN);
+		}
+		resp.context_name[len] = '\0';
+	}
+
+
+	if (asn_get_header(pdu_b, &type, &len) != ASN_ERR_OK) {
+		snmp_error("cannot get pdu header");
 		return (SNMP_RET_IGN);
-	pdu_b->asn_len = len;
+	}
+
+	if ((type & ~ASN_TYPE_MASK) !=
+	    (ASN_TYPE_CONSTRUCTED | ASN_CLASS_CONTEXT)) {
+		snmp_error("bad pdu header tag");
+		return (SNMP_RET_IGN);
+	}
 
 	err = snmp_parse_pdus_hdr(pdu_b, &resp, &len);
 	if (ASN_ERR_STOPPED(err))

Modified: projects/camlock/contrib/libcxxrt/typeinfo.cc
==============================================================================
--- projects/camlock/contrib/libcxxrt/typeinfo.cc	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/contrib/libcxxrt/typeinfo.cc	Thu Oct 17 20:23:28 2013	(r256706)
@@ -35,15 +35,23 @@ type_info::~type_info() {}
 
 bool type_info::operator==(const type_info &other) const
 {
+#ifdef LIBCXXRT_MERGED_TYPEINFO	
 	return __type_name == other.__type_name;
+#else
+	return __type_name == other.__type_name || strcmp(__type_name, other.__type_name) == 0;
+#endif
 }
 bool type_info::operator!=(const type_info &other) const
 {
-	return __type_name != other.__type_name;
+	return !operator==(other);
 }
 bool type_info::before(const type_info &other) const
 {
+#ifdef LIBCXXRT_MERGED_TYPEINFO
 	return __type_name < other.__type_name;
+#else
+	return strcmp(__type_name, other.__type_name) < 0;
+#endif
 }
 const char* type_info::name() const
 {

Modified: projects/camlock/contrib/mtree/compare.c
==============================================================================
--- projects/camlock/contrib/mtree/compare.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/contrib/mtree/compare.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -1,4 +1,4 @@
-/*	$NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $	*/
+/*	$NetBSD: compare.c,v 1.56 2013/09/09 23:27:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)compare.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $");
+__RCSID("$NetBSD: compare.c,v 1.56 2013/09/09 23:27:43 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -47,6 +47,7 @@ __RCSID("$NetBSD: compare.c,v 1.55 2012/
 
 #include <errno.h>
 #include <fcntl.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -192,9 +193,9 @@ typeerr:		LABEL;
 	    (s->type == F_BLOCK || s->type == F_CHAR) &&
 	    s->st_rdev != p->fts_statp->st_rdev) {
 		LABEL;
-		printf("%sdevice (%#llx, %#llx",
-		    tab, (long long)s->st_rdev,
-		    (long long)p->fts_statp->st_rdev);
+		printf("%sdevice (%#jx, %#jx",
+		    tab, (uintmax_t)s->st_rdev,
+		    (uintmax_t)p->fts_statp->st_rdev);
 		if (uflag) {
 			if ((unlink(p->fts_accpath) == -1) ||
 			    (mknod(p->fts_accpath,
@@ -283,9 +284,9 @@ typeerr:		LABEL;
 	}
 	if (s->flags & F_SIZE && s->st_size != p->fts_statp->st_size) {
 		LABEL;
-		printf("%ssize (%lld, %lld)\n",
-		    tab, (long long)s->st_size,
-		    (long long)p->fts_statp->st_size);
+		printf("%ssize (%ju, %ju)\n",
+		    tab, (uintmax_t)s->st_size,
+		    (uintmax_t)p->fts_statp->st_size);
 		tab = "\t";
 	}
 	/*

Modified: projects/camlock/contrib/mtree/create.c
==============================================================================
--- projects/camlock/contrib/mtree/create.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/contrib/mtree/create.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -1,4 +1,4 @@
-/*	$NetBSD: create.c,v 1.69 2013/02/03 19:15:17 christos Exp $	*/
+/*	$NetBSD: create.c,v 1.71 2013/10/16 17:24:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)create.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: create.c,v 1.69 2013/02/03 19:15:17 christos Exp $");
+__RCSID("$NetBSD: create.c,v 1.71 2013/10/16 17:24:20 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -53,6 +53,7 @@ __RCSID("$NetBSD: create.c,v 1.69 2013/0
 #include <fcntl.h>
 #include <grp.h>
 #include <pwd.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
@@ -216,22 +217,22 @@ statf(int indent, FTSENT *p)
 		    p->fts_statp->st_mode & MBITS);
 	if (keys & F_DEV &&
 	    (S_ISBLK(p->fts_statp->st_mode) || S_ISCHR(p->fts_statp->st_mode)))
-		output(indent, &offset, "device=%#llx",
-		    (long long)p->fts_statp->st_rdev);
+		output(indent, &offset, "device=%#jx",
+		    (uintmax_t)p->fts_statp->st_rdev);
 	if (keys & F_NLINK && p->fts_statp->st_nlink != 1)
 		output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink);
 	if (keys & F_SIZE &&
-	    (flavor != F_NETBSD6 || S_ISREG(p->fts_statp->st_mode)))
-		output(indent, &offset, "size=%lld",
-		    (long long)p->fts_statp->st_size);
+	    (flavor == F_FREEBSD9 || S_ISREG(p->fts_statp->st_mode)))
+		output(indent, &offset, "size=%ju",
+		    (uintmax_t)p->fts_statp->st_size);
 	if (keys & F_TIME)
 #if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H)
-		output(indent, &offset, "time=%ld.%09ld",
-		    (long)p->fts_statp->st_mtimespec.tv_sec,
+		output(indent, &offset, "time=%jd.%09ld",
+		    (intmax_t)p->fts_statp->st_mtimespec.tv_sec,
 		    p->fts_statp->st_mtimespec.tv_nsec);
 #else
-		output(indent, &offset, "time=%ld.%09ld",
-		    (long)p->fts_statp->st_mtime, (long)0);
+		output(indent, &offset, "time=%jd.%09ld",
+		    (intmax_t)p->fts_statp->st_mtime, (long)0);
 #endif
 	if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
 		if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 ||

Modified: projects/camlock/contrib/mtree/getid.c
==============================================================================
--- projects/camlock/contrib/mtree/getid.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/contrib/mtree/getid.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -1,4 +1,4 @@
-/*	$NetBSD: getid.c,v 1.7 2008/04/28 20:24:17 martin Exp $	*/
+/*	$NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $	*/
 /*	from: NetBSD: getpwent.c,v 1.48 2000/10/03 03:22:26 enami Exp */
 /*	from: NetBSD: getgrent.c,v 1.41 2002/01/12 23:51:30 lukem Exp */
 
@@ -65,7 +65,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: getid.c,v 1.7 2008/04/28 20:24:17 martin Exp $");
+__RCSID("$NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $");
 
 #include <sys/param.h>
 
@@ -230,6 +230,9 @@ grscan(int search, gid_t gid, const char
 				;
 			continue;
 		}
+		/* skip comments */
+		if (pwline[0] == '#')
+			continue;
 		if (grmatchline(search, gid, name))
 			return 1;
 	}
@@ -371,6 +374,9 @@ pwscan(int search, uid_t uid, const char
 				;
 			continue;
 		}
+		/* skip comments */
+		if (pwline[0] == '#')
+			continue;
 		if (pwmatchline(search, uid, name))
 			return 1;
 	}

Modified: projects/camlock/contrib/mtree/spec.c
==============================================================================
--- projects/camlock/contrib/mtree/spec.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/contrib/mtree/spec.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -1,4 +1,4 @@
-/*	$NetBSD: spec.c,v 1.85 2012/12/20 16:43:16 christos Exp $	*/
+/*	$NetBSD: spec.c,v 1.87 2013/10/16 17:26:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -67,7 +67,7 @@
 #if 0
 static char sccsid[] = "@(#)spec.c	8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: spec.c,v 1.85 2012/12/20 16:43:16 christos Exp $");
+__RCSID("$NetBSD: spec.c,v 1.87 2013/10/16 17:26:14 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -80,6 +80,7 @@ __RCSID("$NetBSD: spec.c,v 1.85 2012/12/
 #include <grp.h>
 #include <pwd.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -217,6 +218,12 @@ noparent:		mtree_err("no parent node");
 				/*
 				 * empty tree
 				 */
+			/*
+			 * Allow a bare "." root node by forcing it to
+			 * type=dir for compatibility with FreeBSD.
+			 */
+			if (strcmp(centry->name, ".") == 0 && centry->type == 0)
+				centry->type = F_DIR;
 			if (strcmp(centry->name, ".") != 0 ||
 			    centry->type != F_DIR)
 				mtree_err(
@@ -350,16 +357,18 @@ dump_nodes(const char *dir, NODE *root, 
 			appendfield(pathlast, "mode=%#o", cur->st_mode);
 		if (MATCHFLAG(F_DEV) &&
 		    (cur->type == F_BLOCK || cur->type == F_CHAR))
-			appendfield(pathlast, "device=%#llx", (long long)cur->st_rdev);
+			appendfield(pathlast, "device=%#jx",
+			    (uintmax_t)cur->st_rdev);
 		if (MATCHFLAG(F_NLINK))
 			appendfield(pathlast, "nlink=%d", cur->st_nlink);
 		if (MATCHFLAG(F_SLINK))
 			appendfield(pathlast, "link=%s", vispath(cur->slink));
 		if (MATCHFLAG(F_SIZE))
-			appendfield(pathlast, "size=%lld", (long long)cur->st_size);
+			appendfield(pathlast, "size=%ju",
+			    (uintmax_t)cur->st_size);
 		if (MATCHFLAG(F_TIME))
-			appendfield(pathlast, "time=%lld.%09ld",
-			    (long long)cur->st_mtimespec.tv_sec,
+			appendfield(pathlast, "time=%jd.%09ld",
+			    (intmax_t)cur->st_mtimespec.tv_sec,
 			    cur->st_mtimespec.tv_nsec);
 		if (MATCHFLAG(F_CKSUM))
 			appendfield(pathlast, "cksum=%lu", cur->cksum);

Modified: projects/camlock/lib/libproc/_libproc.h
==============================================================================
--- projects/camlock/lib/libproc/_libproc.h	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/lib/libproc/_libproc.h	Thu Oct 17 20:23:28 2013	(r256706)
@@ -49,7 +49,7 @@ struct proc_handle {
 };
 
 #ifdef DEBUG
-#define DPRINTF(fmt, ...) 	warn(fmt, __VA_ARGS__)
+#define DPRINTF(...) 	warn(__VA_ARGS__)
 #else
-#define DPRINTF(fmt, ...)
+#define DPRINTF(...)
 #endif

Modified: projects/camlock/lib/libvmmapi/vmmapi.c
==============================================================================
--- projects/camlock/lib/libvmmapi/vmmapi.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/lib/libvmmapi/vmmapi.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -415,6 +415,7 @@ static struct {
 	{ "mtrap_exit",		VM_CAP_MTRAP_EXIT },
 	{ "pause_exit",		VM_CAP_PAUSE_EXIT },
 	{ "unrestricted_guest",	VM_CAP_UNRESTRICTED_GUEST },
+	{ "enable_invpcid",	VM_CAP_ENABLE_INVPCID },
 	{ 0 }
 };
 

Modified: projects/camlock/lib/libz/zopen.c
==============================================================================
--- projects/camlock/lib/libz/zopen.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/lib/libz/zopen.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -29,6 +29,12 @@ xgzclose(void *cookie)
     return gzclose(cookie);
 }
 
+static fpos_t
+xgzseek(void *cookie,  fpos_t offset, int whence)
+{
+	return gzseek(cookie, (z_off_t)offset, whence);
+}
+
 FILE *
 zopen(const char *fname, const char *mode)
 {
@@ -37,7 +43,7 @@ zopen(const char *fname, const char *mod
 	return NULL;
 
     if(*mode == 'r')
-	return (funopen(gz, xgzread, NULL, NULL, xgzclose));
+	return (funopen(gz, xgzread, NULL, xgzseek, xgzclose));
     else
-	return (funopen(gz, NULL, xgzwrite, NULL, xgzclose));
+	return (funopen(gz, NULL, xgzwrite, xgzseek, xgzclose));
 }

Modified: projects/camlock/release/picobsd/build/picobsd
==============================================================================
--- projects/camlock/release/picobsd/build/picobsd	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/release/picobsd/build/picobsd	Thu Oct 17 20:23:28 2013	(r256706)
@@ -166,7 +166,13 @@ create_includes_and_libraries2() { # opt
     log "create_includes_and_libraries2() for ${SRC} $1"
     if [ ${OSVERSION} -ge 600000 ] ; then
 	no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1"
-	no="$no -DWITHOUT_CLANG -DMALLOC_PRODUCTION"
+	#no="$no -DWITHOUT_CLANG -DMALLOC_PRODUCTION"
+	# XXX 20131001 see if clang fixes the build
+	export WITHOUT_CLANG=YES
+	export WITHOUT_ICONV=YES
+	export WITH_GCC=YES
+	export WITH_GNUCXX=YES
+	no="$no -DMALLOC_PRODUCTION"
     else
 	no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R"
     fi
@@ -974,7 +980,13 @@ set_build_parameters() {
     if [ ${OSVERSION} -ge 500035 ] ; then
 	export MAKEOBJDIRPREFIX=${l_objtree}
 	export TARGET_ARCH=${o_arch} TARGET=${o_arch}
-	export WITHOUT_CLANG_IS_CC=1
+	# XXX 20131001 see if CLANG fixes the build
+	# XXX export WITHOUT_CLANG_IS_CC=1
+	export WITHOUT_CLANG=YES
+	export WITHOUT_ICONV=YES
+	export WITH_GCC=YES
+	export WITH_GNUCXX=YES
+
 	# XXX why change machine_arch ?
 	#-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m`
 	# export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers"

Modified: projects/camlock/release/picobsd/floppy.tree/etc/rc1
==============================================================================
--- projects/camlock/release/picobsd/floppy.tree/etc/rc1	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/release/picobsd/floppy.tree/etc/rc1	Thu Oct 17 20:23:28 2013	(r256706)
@@ -52,8 +52,11 @@ pwd_mkdb -p ./master.passwd
 [ "${inetd_enable}" = "YES" -a -f /stand/inetd ] && \
 	{ echo "Starting inetd."; inetd ${inetd_flags} ; }
 
-[ "${sshd_enable}" = "YES" -a -f /stand/sshd ] && \
-	{ echo "Starting sshd..." ; sshd -f /etc/sshd_config ; }
+if [ "${sshd_enable}" = "YES" -a -f /usr/sbin/sshd ] ; then
+	echo "Starting sshd..."
+	chmod 600 /etc/ssh_host*key
+	/usr/sbin/sshd -f /etc/sshd_config
+fi
 
 echo ''
 cat /etc/motd

Modified: projects/camlock/release/picobsd/floppy.tree/etc/ssh/sshd_config
==============================================================================
--- projects/camlock/release/picobsd/floppy.tree/etc/ssh/sshd_config	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/release/picobsd/floppy.tree/etc/ssh/sshd_config	Thu Oct 17 20:23:28 2013	(r256706)
@@ -1,24 +1,23 @@
+# $FreeBSD$
+# minimal config for sshd on picobsd
 Port 22
 ListenAddress 0.0.0.0
 HostKey  /etc/ssh_host_key
-RandomSeed /etc/ssh_random_seed
+#RandomSeed /etc/ssh_random_seed
 ServerKeyBits 768
 LoginGraceTime 600
 KeyRegenerationInterval 3600
 PermitRootLogin yes
 IgnoreRhosts no
 StrictModes yes
-QuietMode no
 X11Forwarding no
 X11DisplayOffset 10
-FascistLogging no
 PrintMotd yes
 KeepAlive yes
 SyslogFacility AUTH
-RhostsAuthentication no
 RhostsRSAAuthentication yes
 RSAAuthentication yes
-PasswordAuthentication no
+PasswordAuthentication yes
 PermitEmptyPasswords no
 UseLogin no
 # CheckMail no

Modified: projects/camlock/sbin/iscontrol/fsm.c
==============================================================================
--- projects/camlock/sbin/iscontrol/fsm.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sbin/iscontrol/fsm.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -199,6 +199,7 @@ tcpConnect(isess_t *sess)
      perror("connect");
      switch(sv_errno) {
      case ECONNREFUSED:
+     case EHOSTUNREACH:
      case ENETUNREACH:
      case ETIMEDOUT:
 	  if((sess->flags & SESS_REDIRECT) == 0) {

Modified: projects/camlock/sbin/route/keywords
==============================================================================
--- projects/camlock/sbin/route/keywords	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sbin/route/keywords	Thu Oct 17 20:23:28 2013	(r256706)
@@ -39,6 +39,7 @@ osi
 prefixlen
 proto1
 proto2
+proto3
 proxy
 recvpipe
 reject

Modified: projects/camlock/sbin/route/route.8
==============================================================================
--- projects/camlock/sbin/route/route.8	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sbin/route/route.8	Thu Oct 17 20:23:28 2013	(r256706)
@@ -28,7 +28,7 @@
 .\"     @(#)route.8	8.3 (Berkeley) 3/19/94
 .\" $FreeBSD$
 .\"
-.Dd November 17, 2012
+.Dd October 17, 2013
 .Dt ROUTE 8
 .Os
 .Sh NAME
@@ -301,6 +301,7 @@ by indicating the following correspondin
 -blackhole RTF_BLACKHOLE  - silently discard pkts (during updates)
 -proto1    RTF_PROTO1     - set protocol specific routing flag #1
 -proto2    RTF_PROTO2     - set protocol specific routing flag #2
+-proto3    RTF_PROTO3     - set protocol specific routing flag #3
 .Ed
 .Pp
 The optional modifiers
@@ -324,6 +325,17 @@ specify that all ensuing metrics may be 
 .Fl lockrest
 meta-modifier.
 .Pp
+Note that
+.Fl expire
+accepts expiration time of the route as the number of seconds since the
+Epoch
+.Pq see Xr time 3 .
+When the first character of the number is
+.Dq +
+or
+.Dq - ,
+it is interpreted as a value relative to the current time.
+.Pp
 The optional modifier
 .Fl fib Ar number
 specifies that the command will be applied to a non-default FIB.

Modified: projects/camlock/sbin/route/route.c
==============================================================================
--- projects/camlock/sbin/route/route.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sbin/route/route.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
 #include <stdlib.h>
 #include <string.h>
 #include <sysexits.h>
+#include <time.h>
 #include <unistd.h>
 #include <ifaddrs.h>
 
@@ -723,6 +724,7 @@ static void
 set_metric(char *value, int key)
 {
 	int flag = 0;
+	char *endptr;
 	u_long noval, *valp = &noval;
 
 	switch (key) {
@@ -742,7 +744,18 @@ set_metric(char *value, int key)
 		rt_metrics.rmx_locks |= flag;
 	if (locking)
 		locking = 0;
-	*valp = atoi(value);
+	errno = 0;
+	*valp = strtol(value, &endptr, 0);
+	if (errno == 0 && *endptr != '\0')
+		errno = EINVAL;
+	if (errno)
+		err(EX_USAGE, "%s", value);
+	if (flag & RTV_EXPIRE && (value[0] == '+' || value[0] == '-')) {
+		struct timespec ts;
+
+		clock_gettime(CLOCK_REALTIME_FAST, &ts);
+		*valp += ts.tv_sec;
+	}
 }
 
 #define	F_ISHOST	0x01
@@ -827,6 +840,9 @@ newroute(int argc, char **argv)
 			case K_PROTO2:
 				flags |= RTF_PROTO2;
 				break;
+			case K_PROTO3:
+				flags |= RTF_PROTO3;
+				break;
 			case K_PROXY:
 				nrflags |= F_PROXY;
 				break;
@@ -1681,6 +1697,7 @@ static void
 print_getmsg(struct rt_msghdr *rtm, int msglen, int fib)
 {
 	struct sockaddr *sp[RTAX_MAX];
+	struct timespec ts;
 	char *cp;
 	int i;
 
@@ -1733,15 +1750,17 @@ print_getmsg(struct rt_msghdr *rtm, int 
 #define msec(u)	(((u) + 500) / 1000)		/* usec to msec */
 	printf("\n%9s %9s %9s %9s %9s %10s %9s\n", "recvpipe",
 	    "sendpipe", "ssthresh", "rtt,msec", "mtu   ", "weight", "expire");
-	printf("%8ld%c ", rtm->rtm_rmx.rmx_recvpipe, lock(RPIPE));
-	printf("%8ld%c ", rtm->rtm_rmx.rmx_sendpipe, lock(SPIPE));
-	printf("%8ld%c ", rtm->rtm_rmx.rmx_ssthresh, lock(SSTHRESH));
-	printf("%8ld%c ", msec(rtm->rtm_rmx.rmx_rtt), lock(RTT));
-	printf("%8ld%c ", rtm->rtm_rmx.rmx_mtu, lock(MTU));
-	printf("%8ld%c ", rtm->rtm_rmx.rmx_weight, lock(WEIGHT));
-	if (rtm->rtm_rmx.rmx_expire)
-		rtm->rtm_rmx.rmx_expire -= time(0);
-	printf("%8ld%c\n", rtm->rtm_rmx.rmx_expire, lock(EXPIRE));
+	printf("%8lu%c ", rtm->rtm_rmx.rmx_recvpipe, lock(RPIPE));
+	printf("%8lu%c ", rtm->rtm_rmx.rmx_sendpipe, lock(SPIPE));
+	printf("%8lu%c ", rtm->rtm_rmx.rmx_ssthresh, lock(SSTHRESH));
+	printf("%8lu%c ", msec(rtm->rtm_rmx.rmx_rtt), lock(RTT));
+	printf("%8lu%c ", rtm->rtm_rmx.rmx_mtu, lock(MTU));
+	printf("%8lu%c ", rtm->rtm_rmx.rmx_weight, lock(WEIGHT));
+	if (rtm->rtm_rmx.rmx_expire > 0)
+		clock_gettime(CLOCK_REALTIME_FAST, &ts);
+	else
+		ts.tv_sec = 0;
+	printf("%8ld%c\n", rtm->rtm_rmx.rmx_expire - ts.tv_sec, lock(EXPIRE));
 #undef lock
 #undef msec
 #define	RTA_IGN	(RTA_DST|RTA_GATEWAY|RTA_NETMASK|RTA_IFP|RTA_IFA|RTA_BRD)

Modified: projects/camlock/share/examples/bhyve/vmrun.sh
==============================================================================
--- projects/camlock/share/examples/bhyve/vmrun.sh	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/share/examples/bhyve/vmrun.sh	Thu Oct 17 20:23:28 2013	(r256706)
@@ -39,11 +39,12 @@ DEFAULT_VIRTIO_DISK="./diskdev"
 DEFAULT_ISOFILE="./release.iso"
 
 usage() {
-	echo "Usage: vmrun.sh [-hai][-g <gdbport>][-m <memsize>][-d <disk file>][-I <location of installation iso>][-t <tapdev>] <vmname>"
+	echo "Usage: vmrun.sh [-hai][-g <gdbport>][-m <memsize>][-d <disk file>][-e <name=value>][-I <location of installation iso>][-t <tapdev>] <vmname>"
 	echo "       -h: display this help message"
 	echo "       -a: force memory mapped local apic access"
 	echo "       -c: number of virtual cpus (default is ${DEFAULT_CPUS})"
 	echo "       -d: virtio diskdev file (default is ${DEFAULT_VIRTIO_DISK})"
+	echo "       -e: set FreeBSD loader environment variable"
 	echo "       -g: listen for connection from kgdb at <gdbport>"
 	echo "       -i: force boot of the Installation CDROM image"
 	echo "       -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})"
@@ -73,8 +74,9 @@ virtio_diskdev=${DEFAULT_VIRTIO_DISK}
 tapdev=${DEFAULT_TAPDEV}
 apic_opt=""
 gdbport=0
+env_opt=""
 
-while getopts haic:g:I:m:d:t: c ; do
+while getopts haic:e:g:I:m:d:t: c ; do
 	case $c in
 	h)
 		usage
@@ -85,6 +87,9 @@ while getopts haic:g:I:m:d:t: c ; do
 	d)
 		virtio_diskdev=${OPTARG}
 		;;
+	e)
+		env_opt="${env_opt} -e ${OPTARG}"
+		;;
 	g)	gdbport=${OPTARG}
 		;;
 	i)
@@ -163,7 +168,7 @@ while [ 1 ]; do
 		installer_opt=""
 	fi
 
-	${LOADER} -m ${memsize} -d ${BOOTDISK} ${vmname}
+	${LOADER} -m ${memsize} -d ${BOOTDISK} ${env_opt} ${vmname}
 	if [ $? -ne 0 ]; then
 		break
 	fi

Modified: projects/camlock/share/man/man9/rtentry.9
==============================================================================
--- projects/camlock/share/man/man9/rtentry.9	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/share/man/man9/rtentry.9	Thu Oct 17 20:23:28 2013	(r256706)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 11, 2008
+.Dd October 16, 2013
 .Dt RTENTRY 9
 .Os
 .Sh NAME
@@ -154,8 +154,7 @@ Protocol-specific.
 .It Dv RTF_PRCLONING
 This flag is obsolete and simply ignored by facility.
 .It Dv RTF_PINNED
-(Reserved for future use to indicate routes which are not to be
-modified by a routing protocol.)
+Indicates that this route is immutable to a routing protocol.
 .It Dv RTF_LOCAL
 Indicates that the destination of this route is an address configured
 as belonging to this system.

Modified: projects/camlock/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/camlock/sys/amd64/amd64/pmap.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sys/amd64/amd64/pmap.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -371,6 +371,8 @@ int pmap_pcid_enabled = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, pcid_enabled, CTLFLAG_RDTUN, &pmap_pcid_enabled,
     0, "Is TLB Context ID enabled ?");
 int invpcid_works = 0;
+SYSCTL_INT(_vm_pmap, OID_AUTO, invpcid_works, CTLFLAG_RD, &invpcid_works, 0,
+    "Is the invpcid instruction available ?");
 
 static int
 pmap_pcid_save_cnt_proc(SYSCTL_HANDLER_ARGS)

Modified: projects/camlock/sys/amd64/include/vmm.h
==============================================================================
--- projects/camlock/sys/amd64/include/vmm.h	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sys/amd64/include/vmm.h	Thu Oct 17 20:23:28 2013	(r256706)
@@ -223,6 +223,7 @@ enum vm_cap_type {
 	VM_CAP_MTRAP_EXIT,
 	VM_CAP_PAUSE_EXIT,
 	VM_CAP_UNRESTRICTED_GUEST,
+	VM_CAP_ENABLE_INVPCID,
 	VM_CAP_MAX
 };
 

Modified: projects/camlock/sys/amd64/vmm/intel/vmx.c
==============================================================================
--- projects/camlock/sys/amd64/vmm/intel/vmx.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sys/amd64/vmm/intel/vmx.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -164,6 +164,7 @@ static int cap_halt_exit;
 static int cap_pause_exit;
 static int cap_unrestricted_guest;
 static int cap_monitor_trap;
+static int cap_invpcid;
  
 static struct unrhdr *vpid_unr;
 static u_int vpid_alloc_failed;
@@ -660,6 +661,11 @@ vmx_init(void)
 					PROCBASED2_UNRESTRICTED_GUEST, 0,
 				        &tmp) == 0);
 
+	cap_invpcid = (vmx_set_ctlreg(MSR_VMX_PROCBASED_CTLS2,
+	    MSR_VMX_PROCBASED_CTLS2, PROCBASED2_ENABLE_INVPCID, 0,
+	    &tmp) == 0);
+
+
 	/* Initialize EPT */
 	error = ept_init();
 	if (error) {
@@ -828,6 +834,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap)
 
 		vmx->cap[i].set = 0;
 		vmx->cap[i].proc_ctls = procbased_ctls;
+		vmx->cap[i].proc_ctls2 = procbased_ctls2;
 
 		vmx->state[i].lastcpu = -1;
 		vmx->state[i].vpid = vpid[i];
@@ -1932,6 +1939,10 @@ vmx_getcap(void *arg, int vcpu, int type
 		if (cap_unrestricted_guest)
 			ret = 0;
 		break;
+	case VM_CAP_ENABLE_INVPCID:
+		if (cap_invpcid)
+			ret = 0;
+		break;
 	default:
 		break;
 	}
@@ -1988,11 +1999,21 @@ vmx_setcap(void *arg, int vcpu, int type
 	case VM_CAP_UNRESTRICTED_GUEST:
 		if (cap_unrestricted_guest) {
 			retval = 0;
-			baseval = procbased_ctls2;
+			pptr = &vmx->cap[vcpu].proc_ctls2;
+			baseval = *pptr;
 			flag = PROCBASED2_UNRESTRICTED_GUEST;
 			reg = VMCS_SEC_PROC_BASED_CTLS;
 		}
 		break;
+	case VM_CAP_ENABLE_INVPCID:
+		if (cap_invpcid) {
+			retval = 0;
+			pptr = &vmx->cap[vcpu].proc_ctls2;
+			baseval = *pptr;
+			flag = PROCBASED2_ENABLE_INVPCID;
+			reg = VMCS_SEC_PROC_BASED_CTLS;
+		}
+		break;
 	default:
 		break;
 	}

Modified: projects/camlock/sys/amd64/vmm/intel/vmx.h
==============================================================================
--- projects/camlock/sys/amd64/vmm/intel/vmx.h	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sys/amd64/vmm/intel/vmx.h	Thu Oct 17 20:23:28 2013	(r256706)
@@ -84,6 +84,7 @@ struct vmxctx {
 struct vmxcap {
 	int	set;
 	uint32_t proc_ctls;
+	uint32_t proc_ctls2;
 };
 
 struct vmxstate {

Modified: projects/camlock/sys/amd64/vmm/intel/vmx_controls.h
==============================================================================
--- projects/camlock/sys/amd64/vmm/intel/vmx_controls.h	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sys/amd64/vmm/intel/vmx_controls.h	Thu Oct 17 20:23:28 2013	(r256706)
@@ -68,6 +68,7 @@
 #define	PROCBASED2_WBINVD_EXITING	(1 << 6)
 #define	PROCBASED2_UNRESTRICTED_GUEST	(1 << 7)
 #define	PROCBASED2_PAUSE_LOOP_EXITING	(1 << 10)
+#define	PROCBASED2_ENABLE_INVPCID	(1 << 12)
 
 /* VM Exit Controls */
 #define	VM_EXIT_SAVE_DEBUG_CONTROLS	(1 << 2)

Modified: projects/camlock/sys/amd64/vmm/x86.c
==============================================================================
--- projects/camlock/sys/amd64/vmm/x86.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sys/amd64/vmm/x86.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -53,7 +53,7 @@ int
 x86_emulate_cpuid(struct vm *vm, int vcpu_id,
 		  uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
 {
-	int error;
+	int error, enable_invpcid;
 	unsigned int 	func, regs[4];
 	enum x2apic_state x2apic_state;
 
@@ -202,8 +202,22 @@ x86_emulate_cpuid(struct vm *vm, int vcp
 			regs[0] |= 0x04008000;
 			break;
 
-		case CPUID_0000_0006:
 		case CPUID_0000_0007:
+			regs[0] = 0;
+			regs[1] = 0;
+			regs[2] = 0;
+			regs[3] = 0;
+
+			/* leaf 0 */
+			if (*ecx == 0) {
+				error = vm_get_capability(vm, vcpu_id,
+				    VM_CAP_ENABLE_INVPCID, &enable_invpcid);
+				if (error == 0 && enable_invpcid)
+					regs[1] |= CPUID_STDEXT_INVPCID;
+			}
+			break;
+
+		case CPUID_0000_0006:
 		case CPUID_0000_000A:
 		case CPUID_0000_000D:
 			/*

Modified: projects/camlock/sys/arm/arm/busdma_machdep-v6.c
==============================================================================
--- projects/camlock/sys/arm/arm/busdma_machdep-v6.c	Thu Oct 17 20:19:15 2013	(r256705)
+++ projects/camlock/sys/arm/arm/busdma_machdep-v6.c	Thu Oct 17 20:23:28 2013	(r256706)
@@ -425,14 +425,21 @@ bus_dma_tag_create(bus_dma_tag_t parent,
 	if (_bus_dma_can_bounce(newtag->lowaddr, newtag->highaddr)
 	 || newtag->alignment > 1)
 		newtag->flags |= BUS_DMA_COULD_BOUNCE;
-	else
-		maxsize = 2; /* Need at most 2 bounce pages for unaligned access on cache line boundaries */
 
+	/*
+	 * Any request can auto-bounce due to cacheline alignment, in addition
+	 * to any alignment or boundary specifications in the tag, so if the
+	 * ALLOCNOW flag is set, there's always work to do.
+	 */
 	if ((flags & BUS_DMA_ALLOCNOW) != 0) {
 		struct bounce_zone *bz;
-
-		/* Must bounce */
-
+		/*
+		 * Round size up to a full page, and add one more page because
+		 * there can always be one more boundary crossing than the
+		 * number of pages in a transfer.
+		 */
+		maxsize = roundup2(maxsize, PAGE_SIZE) + PAGE_SIZE;
+		
 		if ((error = alloc_bounce_zone(newtag)) != 0) {
 			free(newtag, M_DEVBUF);
 			return (error);
@@ -518,20 +525,22 @@ static int allocate_bz_and_pages(bus_dma
 	STAILQ_INIT(&(mapp->bpages));
 
 	/*
-	 * Attempt to add pages to our pool on a per-instance
-	 * basis up to a sane limit.
+	 * Attempt to add pages to our pool on a per-instance basis up to a sane
+	 * limit.  Even if the tag isn't flagged as COULD_BOUNCE due to
+	 * alignment and boundary constraints, it could still auto-bounce due to
+	 * cacheline alignment, which requires at most two bounce pages.
 	 */
 	if (dmat->flags & BUS_DMA_COULD_BOUNCE)
 		maxpages = MAX_BPAGES;
 	else
-		maxpages = 2 * bz->map_count; /* Only need at most 2 pages for buffers unaligned on cache line boundaries */
+		maxpages = 2 * bz->map_count;
 	if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0
 	    || (bz->map_count > 0 && bz->total_bpages < maxpages)) {
 		int pages;
 		
-		pages = MAX(atop(dmat->maxsize), 1);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list