svn commit: r255530 - in projects/bhyve_npt_pmap: contrib/llvm/tools/clang/lib/Driver gnu/lib gnu/usr.bin/cc lib/libc/net release/picobsd/build sbin/camcontrol share/man/man5 share/mk sys/amd64/amd...

Neel Natu neel at FreeBSD.org
Fri Sep 13 21:17:00 UTC 2013


Author: neel
Date: Fri Sep 13 21:16:52 2013
New Revision: 255530
URL: http://svnweb.freebsd.org/changeset/base/255530

Log:
  IFC @255331

Added:
  projects/bhyve_npt_pmap/tools/build/options/WITHOUT_GNUCXX
     - copied unchanged from r255331, head/tools/build/options/WITHOUT_GNUCXX
  projects/bhyve_npt_pmap/tools/build/options/WITH_GCC
     - copied unchanged from r255331, head/tools/build/options/WITH_GCC
  projects/bhyve_npt_pmap/tools/build/options/WITH_GNUCXX
     - copied unchanged from r255331, head/tools/build/options/WITH_GNUCXX
Modified:
  projects/bhyve_npt_pmap/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
  projects/bhyve_npt_pmap/contrib/llvm/tools/clang/lib/Driver/ToolChains.h
  projects/bhyve_npt_pmap/gnu/lib/Makefile
  projects/bhyve_npt_pmap/gnu/usr.bin/cc/Makefile
  projects/bhyve_npt_pmap/lib/libc/net/getaddrinfo.c
  projects/bhyve_npt_pmap/lib/libc/net/if_nametoindex.c
  projects/bhyve_npt_pmap/lib/libc/net/name6.c
  projects/bhyve_npt_pmap/lib/libc/net/nscachedcli.c
  projects/bhyve_npt_pmap/release/picobsd/build/picobsd
  projects/bhyve_npt_pmap/sbin/camcontrol/camcontrol.8
  projects/bhyve_npt_pmap/share/man/man5/src.conf.5
  projects/bhyve_npt_pmap/share/mk/bsd.own.mk
  projects/bhyve_npt_pmap/sys/amd64/amd64/mp_machdep.c
  projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c
  projects/bhyve_npt_pmap/sys/amd64/conf/NOTES
  projects/bhyve_npt_pmap/sys/amd64/include/cpu.h
  projects/bhyve_npt_pmap/sys/amd64/include/cpufunc.h
  projects/bhyve_npt_pmap/sys/amd64/include/pcpu.h
  projects/bhyve_npt_pmap/sys/arm/include/sf_buf.h
  projects/bhyve_npt_pmap/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
  projects/bhyve_npt_pmap/sys/i386/conf/NOTES
  projects/bhyve_npt_pmap/sys/i386/i386/mp_machdep.c
  projects/bhyve_npt_pmap/sys/i386/include/cpu.h
  projects/bhyve_npt_pmap/sys/i386/include/pcpu.h
  projects/bhyve_npt_pmap/sys/i386/include/sf_buf.h
  projects/bhyve_npt_pmap/sys/i386/include/smp.h
  projects/bhyve_npt_pmap/sys/i386/xen/mp_machdep.c
  projects/bhyve_npt_pmap/sys/kern/kern_jail.c
  projects/bhyve_npt_pmap/sys/mips/include/sf_buf.h
  projects/bhyve_npt_pmap/sys/net/netisr.c
  projects/bhyve_npt_pmap/sys/powerpc/include/sf_buf.h
  projects/bhyve_npt_pmap/sys/sparc64/include/sf_buf.h
  projects/bhyve_npt_pmap/sys/sys/param.h
  projects/bhyve_npt_pmap/sys/sys/sf_buf.h
  projects/bhyve_npt_pmap/sys/x86/xen/hvm.c
  projects/bhyve_npt_pmap/sys/x86/xen/xen_intr.c
  projects/bhyve_npt_pmap/sys/xen/xen_intr.h
  projects/bhyve_npt_pmap/tools/build/mk/OptionalObsoleteFiles.inc
  projects/bhyve_npt_pmap/tools/build/options/WITHOUT_GCC
Directory Properties:
  projects/bhyve_npt_pmap/   (props changed)
  projects/bhyve_npt_pmap/contrib/llvm/   (props changed)
  projects/bhyve_npt_pmap/contrib/llvm/tools/clang/   (props changed)
  projects/bhyve_npt_pmap/gnu/lib/   (props changed)
  projects/bhyve_npt_pmap/lib/libc/   (props changed)
  projects/bhyve_npt_pmap/sbin/   (props changed)
  projects/bhyve_npt_pmap/sys/   (props changed)

Modified: projects/bhyve_npt_pmap/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
==============================================================================
--- projects/bhyve_npt_pmap/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp	Fri Sep 13 21:16:52 2013	(r255530)
@@ -1851,6 +1851,38 @@ bool FreeBSD::UseSjLjExceptions() const 
   }
 }
 
+ToolChain::CXXStdlibType
+FreeBSD::GetCXXStdlibType(const ArgList &Args) const {
+  if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
+    StringRef Value = A->getValue();
+    if (Value == "libc++")
+      return ToolChain::CST_Libcxx;
+    if (Value == "libstdc++")
+      return ToolChain::CST_Libstdcxx;
+    getDriver().Diag(diag::err_drv_invalid_stdlib_name)
+      << A->getAsString(Args);
+  }
+
+  return getTriple().getOSMajorVersion() >= 10 ? ToolChain::CST_Libcxx :
+         ToolChain::CST_Libstdcxx;
+}
+
+void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+                                          ArgStringList &CC1Args) const {
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
+      DriverArgs.hasArg(options::OPT_nostdincxx))
+    return;
+
+  if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx)
+    addSystemInclude(DriverArgs, CC1Args,
+                     getDriver().SysRoot + "/usr/include/c++/v1");
+  else
+    addSystemInclude(DriverArgs, CC1Args,
+                     getDriver().SysRoot + "/usr/include/c++/4.2");
+  return;
+
+}
+
 /// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
 
 NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)

Modified: projects/bhyve_npt_pmap/contrib/llvm/tools/clang/lib/Driver/ToolChains.h
==============================================================================
--- projects/bhyve_npt_pmap/contrib/llvm/tools/clang/lib/Driver/ToolChains.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/contrib/llvm/tools/clang/lib/Driver/ToolChains.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -458,9 +458,14 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : 
 public:
   FreeBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args);
 
+  virtual CXXStdlibType GetCXXStdlibType(const ArgList &Args) const;
+
   virtual bool IsMathErrnoDefault() const { return false; }
   virtual bool IsObjCNonFragileABIDefault() const { return true; }
 
+  virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+                                            ArgStringList &CC1Args) const;
+
   virtual bool UseSjLjExceptions() const;
 protected:
   virtual Tool *buildAssembler() const;

Modified: projects/bhyve_npt_pmap/gnu/lib/Makefile
==============================================================================
--- projects/bhyve_npt_pmap/gnu/lib/Makefile	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/gnu/lib/Makefile	Fri Sep 13 21:16:52 2013	(r255530)
@@ -10,7 +10,7 @@ SUBDIR+= libssp
 
 # libsupc++ uses libstdc++ headers, although 'make includes' should
 # have taken care of that already.
-.if ${MK_CXX} != "no"
+.if ${MK_GNUCXX} != "no"
 SUBDIR+= libstdc++ libsupc++
 .endif
 

Modified: projects/bhyve_npt_pmap/gnu/usr.bin/cc/Makefile
==============================================================================
--- projects/bhyve_npt_pmap/gnu/usr.bin/cc/Makefile	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/gnu/usr.bin/cc/Makefile	Fri Sep 13 21:16:52 2013	(r255530)
@@ -12,7 +12,12 @@ SUBDIR+= cpp
 .endif
 
 .if ${MK_CXX} != "no"
-SUBDIR+= cc1plus c++ c++filt
+.if ${MK_GNUCXX} != "no"
+SUBDIR+= cc1plus c++ 
+.endif
+# This should be moved into the above block once c++filt from elftoolchain or
+# similar is provided.
+SUBDIR+= c++filt
 .endif
 
 .if ${MK_GCOV} != "no"

Modified: projects/bhyve_npt_pmap/lib/libc/net/getaddrinfo.c
==============================================================================
--- projects/bhyve_npt_pmap/lib/libc/net/getaddrinfo.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/lib/libc/net/getaddrinfo.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -831,7 +831,8 @@ set_source(struct ai_order *aio, struct 
 	get_port(&ai, "1", 0);
 
 	/* open a socket to get the source address for the given dst */
-	if ((s = _socket(ai.ai_family, ai.ai_socktype, ai.ai_protocol)) < 0)
+	if ((s = _socket(ai.ai_family, ai.ai_socktype | SOCK_CLOEXEC,
+	    ai.ai_protocol)) < 0)
 		return;		/* give up */
 	if (_connect(s, ai.ai_addr, ai.ai_addrlen) < 0)
 		goto cleanup;
@@ -1131,7 +1132,7 @@ explore_null(const struct addrinfo *pai,
 	 * filter out AFs that are not supported by the kernel
 	 * XXX errno?
 	 */
-	s = _socket(pai->ai_family, SOCK_DGRAM, 0);
+	s = _socket(pai->ai_family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
 	if (s < 0) {
 		if (errno != EMFILE)
 			return 0;
@@ -1541,18 +1542,19 @@ addrconfig(struct addrinfo *pai)
 	 */
 	af = pai->ai_family;
 	if (af == AF_UNSPEC) {
-		if ((s = _socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+		if ((s = _socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
 			af = AF_INET;
 		else {
 			_close(s);
-			if ((s = _socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+			if ((s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC,
+			    0)) < 0)
 				af = AF_INET6;
 			else
 				_close(s);
 		}
 	}
 	if (af != AF_UNSPEC) {
-		if ((s = _socket(af, SOCK_DGRAM, 0)) < 0)
+		if ((s = _socket(af, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
 			return 0;
 		_close(s);
 	}

Modified: projects/bhyve_npt_pmap/lib/libc/net/if_nametoindex.c
==============================================================================
--- projects/bhyve_npt_pmap/lib/libc/net/if_nametoindex.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/lib/libc/net/if_nametoindex.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -68,7 +68,7 @@ if_nametoindex(const char *ifname)
 	struct ifaddrs *ifaddrs, *ifa;
 	unsigned int ni;
 
-	s = _socket(AF_INET, SOCK_DGRAM, 0);
+	s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
 	if (s != -1) {
 #ifdef PURIFY
 		memset(&ifr, 0, sizeof(ifr));

Modified: projects/bhyve_npt_pmap/lib/libc/net/name6.c
==============================================================================
--- projects/bhyve_npt_pmap/lib/libc/net/name6.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/lib/libc/net/name6.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -235,7 +235,7 @@ getipnodebyname(const char *name, int af
 	if (flags & AI_ADDRCONFIG) {
 		int s;
 
-		if ((s = _socket(af, SOCK_DGRAM, 0)) < 0)
+		if ((s = _socket(af, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
 			return NULL;
 		/*
 		 * TODO:
@@ -868,7 +868,8 @@ set_source(struct hp_order *aio, struct 
 	}
 
 	/* open a socket to get the source address for the given dst */
-	if ((s = _socket(ss.ss_family, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+	if ((s = _socket(ss.ss_family, SOCK_DGRAM | SOCK_CLOEXEC,
+	    IPPROTO_UDP)) < 0)
 		return;		/* give up */
 	if (_connect(s, (struct sockaddr *)&ss, ss.ss_len) < 0)
 		goto cleanup;

Modified: projects/bhyve_npt_pmap/lib/libc/net/nscachedcli.c
==============================================================================
--- projects/bhyve_npt_pmap/lib/libc/net/nscachedcli.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/lib/libc/net/nscachedcli.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -200,7 +200,7 @@ __open_cached_connection(struct cached_c
 
 	assert(params != NULL);
 
-	client_socket = _socket(PF_LOCAL, SOCK_STREAM, 0);
+	client_socket = _socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
 	client_address.sun_family = PF_LOCAL;
 	strncpy(client_address.sun_path, params->socket_path,
 	    sizeof(client_address.sun_path));

Modified: projects/bhyve_npt_pmap/release/picobsd/build/picobsd
==============================================================================
--- projects/bhyve_npt_pmap/release/picobsd/build/picobsd	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/release/picobsd/build/picobsd	Fri Sep 13 21:16:52 2013	(r255530)
@@ -693,17 +693,22 @@ populate_mfs_tree() {
     # rm $a # do not remove!
     ) || fail $? crunch
 
-    if [ -f ${dst}/stand/sshd ] ; then
-	log "Setting up host key for sshd:"
-	if [ -f ${BUILDDIR}/floppy.tree/etc/ssh_host_key.gz ] ; then
-	    log "Using existing host key"
+    log "Setting up host key for sshd:"
+    for K in rsa1 rsa dsa ; do
+	if [ $K = rsa1 ] ; then
+	    i=ssh_host_key
 	else
-	    log "Generating new host key" 
-	    ssh-keygen -t rsa1 -f ${BUILDDIR}/floppy.tree/etc/ssh_host_key \
-		 -N "" -C "root at picobsd"
-	    gzip -9 ${BUILDDIR}/floppy.tree/etc/ssh_host_key* || true
+	    i=ssh_host_${K}_key
 	fi
-    fi
+	if [ -f ${BUILDDIR}/floppy.tree/etc/$i.gz ] ; then
+	    log "Using existing host key $i"
+	else
+	    log "Generating new host key $i" 
+	    ssh-keygen -t $K -f ${BUILDDIR}/floppy.tree/etc/$i \
+		     -N "" -C "root at picobsd"
+	    gzip -9 ${BUILDDIR}/floppy.tree/etc/${i}* || true
+	fi
+    done
 
     log "Copy generic and site-specific MFS tree..."
     for MFS_TREE in ${PICO_TREE}/mfs_tree ${MY_TREE}/mfs_tree ; do
@@ -880,9 +885,11 @@ fill_floppy_image() {
 
     mkdir -p  ${dst}/boot/kernel
     # XXX loader.conf does not work unless we also load the .4th files
-    echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf
-    echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf
-    cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader"
+    # echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf
+    # echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf
+    local blf="loader* *.4th" # loader.rc loader.4th support.4th"
+    (cd /boot; cp -p loader ${dst}/boot) || fail $? no_space "copying bootloader"
+    cp ${MY_TREE}/floppy.tree/boot/loader.conf ${dst}/boot || true
     gzip -c kernel > ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel"
 
     # now transfer the floppy tree. If it is already in mfs, dont bother.
@@ -972,6 +979,8 @@ set_build_parameters() {
 	#-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m`
 	# export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers"
 	eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\""
+	[ "$BINMAKE" = "" ] && \
+	   eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V SUB_MAKE`\""
     fi
 
     if [ "${o_init_src}" != "" ] ; then

Modified: projects/bhyve_npt_pmap/sbin/camcontrol/camcontrol.8
==============================================================================
--- projects/bhyve_npt_pmap/sbin/camcontrol/camcontrol.8	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sbin/camcontrol/camcontrol.8	Fri Sep 13 21:16:52 2013	(r255530)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 24, 2013
+.Dd September 6, 2013
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME

Modified: projects/bhyve_npt_pmap/share/man/man5/src.conf.5
==============================================================================
--- projects/bhyve_npt_pmap/share/man/man5/src.conf.5	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/share/man/man5/src.conf.5	Fri Sep 13 21:16:52 2013	(r255530)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: head/tools/build/options/makeman 253304 2013-07-12 23:08:44Z bapt
 .\" $FreeBSD$
-.Dd August 29, 2013
+.Dd September 6, 2013
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -471,12 +471,17 @@ Set to not build
 .\" from FreeBSD: head/tools/build/options/WITHOUT_GAMES 156932 2006-03-21 07:50:50Z ru
 Set to not build games.
 .It Va WITHOUT_GCC
-.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC 222090 2011-05-19 05:13:25Z imp
-Set to not install gcc and g++.
-.Bf -symbolic
-The option does not generally work for build targets, unless some alternative
-toolchain is enabled.
-.Ef
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC 255326 2013-09-06 20:49:48Z zeising
+Set to not build and install gcc and g++.
+.Pp
+It is a default setting on
+amd64/amd64, arm/arm, arm/armv6 and i386/i386.
+.It Va WITH_GCC
+.\" from FreeBSD: head/tools/build/options/WITH_GCC 255326 2013-09-06 20:49:48Z zeising
+Set to build and install gcc and g++.
+.Pp
+It is a default setting on
+arm/armeb, arm/armv6eb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64.
 .It Va WITHOUT_GCOV
 .\" from FreeBSD: head/tools/build/options/WITHOUT_GCOV 156932 2006-03-21 07:50:50Z ru
 Set to not build the
@@ -500,6 +505,20 @@ When set, it also enforces the following
 .It
 .Va WITHOUT_GNU_SUPPORT
 .El
+.It Va WITHOUT_GNUCXX
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GNUCXX 255321 2013-09-06 20:08:03Z theraven
+Do not build the GNU C++ stack (g++, libstdc++).
+This is the default on platforms where clang is the system compiler.
+.Pp
+It is a default setting on
+amd64/amd64, arm/arm, arm/armv6, i386/i386 and pc98/i386.
+.It Va WITH_GNUCXX
+.\" from FreeBSD: head/tools/build/options/WITH_GNUCXX 255321 2013-09-06 20:08:03Z theraven
+Build the GNU C++ stack (g++, libstdc++).
+This is the default on platforms where gcc is the system compiler.
+.Pp
+It is a default setting on
+arm/armeb, arm/armv6eb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64.
 .It Va WITHOUT_GNU_SUPPORT
 .\" from FreeBSD: head/tools/build/options/WITHOUT_GNU_SUPPORT 156932 2006-03-21 07:50:50Z ru
 Set to build some programs without optional GNU support.

Modified: projects/bhyve_npt_pmap/share/mk/bsd.own.mk
==============================================================================
--- projects/bhyve_npt_pmap/share/mk/bsd.own.mk	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/share/mk/bsd.own.mk	Fri Sep 13 21:16:52 2013	(r255530)
@@ -284,7 +284,6 @@ __DEFAULT_YES_OPTIONS = \
     FP_LIBC \
     FREEBSD_UPDATE \
     GAMES \
-    GCC \
     GCOV \
     GDB \
     GNU \
@@ -400,6 +399,11 @@ __T=${TARGET_ARCH}
 .else
 __T=${MACHINE_ARCH}
 .endif
+.if defined(TARGET)
+__TT=${TARGET}
+.else
+__TT=${MACHINE}
+.endif
 # Clang is only for x86, powerpc and little-endian arm right now, by default.
 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
@@ -414,8 +418,33 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
 .if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \
     ${__T} == "i386"
 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
+# The pc98 bootloader requires gcc to build and so we must leave gcc enabled
+# for pc98 for now.
+.if ${__TT} == "pc98"
+__DEFAULT_NO_OPTIONS+=GNUCXX
+__DEFAULT_YES_OPTIONS+=GCC
+.else
+__DEFAULT_NO_OPTIONS+=GCC GNUCXX
+.endif
+# The libc++ headers use c++11 extensions.  These are normally silenced because
+# they are treated as system headers, but we explicitly disable that warning
+# suppression when building the base system to catch bugs in our headers.
+# Eventually we'll want to start building the base system C++ code as C++11,
+# but not yet.
+_COMPVERSION!= ${CC} --version
+.if ${_COMPVERSION:Mclang}
+CXXFLAGS+=	-Wno-c++11-extensions
+.endif
 .else
+# If clang is not cc, then build gcc by default
 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC
+__DEFAULT_YES_OPTIONS+=GCC
+# And if g++ is c++, build the rest of the GNU C++ stack
+.if defined(WITHOUT_CXX)
+__DEFAULT_NO_OPTIONS+=GNUCXX
+.else
+__DEFAULT_YES_OPTIONS+=GNUCXX
+.endif
 .endif
 # FDT is needed only for arm, mips and powerpc
 .if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*}

Modified: projects/bhyve_npt_pmap/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/amd64/mp_machdep.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/amd64/amd64/mp_machdep.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/smp.h>
 #include <machine/specialreg.h>
 #include <machine/tss.h>
+#include <machine/cpu.h>
 
 #ifdef XENHVM
 #include <xen/hvm.h>
@@ -125,6 +126,11 @@ u_long *ipi_rendezvous_counts[MAXCPU];
 static u_long *ipi_hardclock_counts[MAXCPU];
 #endif
 
+/* Default cpu_ops implementation. */
+struct cpu_ops cpu_ops = {
+	.ipi_vectored = lapic_ipi_vectored
+};
+
 extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32);
 
 extern int pmap_pcid_enabled;
@@ -1125,7 +1131,7 @@ ipi_send_cpu(int cpu, u_int ipi)
 		if (old_pending)
 			return;
 	}
-	lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]);
+	cpu_ops.ipi_vectored(ipi, cpu_apic_ids[cpu]);
 }
 
 /*
@@ -1395,7 +1401,7 @@ ipi_all_but_self(u_int ipi)
 		CPU_OR_ATOMIC(&ipi_nmi_pending, &other_cpus);
 
 	CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi);
-	lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS);
+	cpu_ops.ipi_vectored(ipi, APIC_IPI_DEST_OTHERS);
 }
 
 int

Modified: projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/amd64/amd64/pmap.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -351,30 +351,6 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pcid_enab
     0, "Is TLB Context ID enabled ?");
 int invpcid_works = 0;
 
-/*
- * Perform the guaranteed invalidation of all TLB entries.  This
- * includes the global entries, and entries in all PCIDs, not only the
- * current context.  The function works both on non-PCID CPUs and CPUs
- * with the PCID turned off or on.  See IA-32 SDM Vol. 3a 4.10.4.1
- * Operations that Invalidate TLBs and Paging-Structure Caches.
- */
-static __inline void
-invltlb_globpcid(void)
-{
-	uint64_t cr4;
-
-	cr4 = rcr4();
-	load_cr4(cr4 & ~CR4_PGE);
-	/*
-	 * Although preemption at this point could be detrimental to
-	 * performance, it would not lead to an error.  PG_G is simply
-	 * ignored if CR4.PGE is clear.  Moreover, in case this block
-	 * is re-entered, the load_cr4() either above or below will
-	 * modify CR4.PGE flushing the TLB.
-	 */
-	load_cr4(cr4 | CR4_PGE);
-}
-
 static int
 pmap_pcid_save_cnt_proc(SYSCTL_HANDLER_ARGS)
 {

Modified: projects/bhyve_npt_pmap/sys/amd64/conf/NOTES
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/conf/NOTES	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/amd64/conf/NOTES	Fri Sep 13 21:16:52 2013	(r255530)
@@ -309,6 +309,7 @@ options 	DRM_DEBUG	# Include debug print
 # nfe:	nVidia nForce MCP on-board Ethernet Networking (BSD open source)
 # nve:	nVidia nForce MCP on-board Ethernet Networking
 # sfxge: Solarflare SFC9000 family 10Gb Ethernet adapters
+# vmx:	VMware VMXNET3 Ethernet (BSD open source)
 # wpi:	Intel 3945ABG Wireless LAN controller
 #	Requires the wpi firmware module
 
@@ -325,6 +326,7 @@ device  	mthca		# Mellanox HCA InfiniBan
 device		nfe		# nVidia nForce MCP on-board Ethernet
 device		nve		# nVidia nForce MCP on-board Ethernet Networking
 device		sfxge		# Solarflare SFC9000 10Gb Ethernet
+device		vmx		# VMware VMXNET3 Ethernet
 device		wpi		# Intel 3945ABG wireless NICs.
 
 # IEEE 802.11 adapter firmware modules

Modified: projects/bhyve_npt_pmap/sys/amd64/include/cpu.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/include/cpu.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/amd64/include/cpu.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -54,6 +54,17 @@
 #define	TRAPF_PC(framep)	((framep)->tf_rip)
 
 #ifdef _KERNEL
+/*
+ * Struct containing pointers to CPU management functions whose
+ * implementation is run time selectable.  Selection can be made,
+ * for example, based on detection of a particular CPU variant or
+ * hypervisor environment.
+ */
+struct cpu_ops {
+	void (*ipi_vectored)(u_int, int);
+};
+
+extern struct	cpu_ops cpu_ops;
 extern char	btext[];
 extern char	etext[];
 

Modified: projects/bhyve_npt_pmap/sys/amd64/include/cpufunc.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/include/cpufunc.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/amd64/include/cpufunc.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -461,6 +461,34 @@ invltlb(void)
 	load_cr3(rcr3());
 }
 
+#ifndef CR4_PGE
+#define	CR4_PGE	0x00000080	/* Page global enable */
+#endif
+
+/*
+ * Perform the guaranteed invalidation of all TLB entries.  This
+ * includes the global entries, and entries in all PCIDs, not only the
+ * current context.  The function works both on non-PCID CPUs and CPUs
+ * with the PCID turned off or on.  See IA-32 SDM Vol. 3a 4.10.4.1
+ * Operations that Invalidate TLBs and Paging-Structure Caches.
+ */
+static __inline void
+invltlb_globpcid(void)
+{
+	uint64_t cr4;
+
+	cr4 = rcr4();
+	load_cr4(cr4 & ~CR4_PGE);
+	/*
+	 * Although preemption at this point could be detrimental to
+	 * performance, it would not lead to an error.  PG_G is simply
+	 * ignored if CR4.PGE is clear.  Moreover, in case this block
+	 * is re-entered, the load_cr4() either above or below will
+	 * modify CR4.PGE flushing the TLB.
+	 */
+	load_cr4(cr4 | CR4_PGE);
+}
+
 /*
  * TLB flush for an individual page (even if it has PG_G).
  * Only works on 486+ CPUs (i386 does not have PG_G).

Modified: projects/bhyve_npt_pmap/sys/amd64/include/pcpu.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/include/pcpu.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/amd64/include/pcpu.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -33,15 +33,6 @@
 #error "sys/cdefs.h is a prerequisite for this file"
 #endif
 
-#if defined(XEN) || defined(XENHVM)
-#ifndef NR_VIRQS
-#define	NR_VIRQS	24
-#endif
-#ifndef NR_IPIS
-#define	NR_IPIS		2
-#endif
-#endif
-
 /*
  * The SMP parts are setup in pmap.c and locore.s for the BSP, and
  * mp_machdep.c sets up the data for the AP's to "see" when they awake.

Modified: projects/bhyve_npt_pmap/sys/arm/include/sf_buf.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/arm/include/sf_buf.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/arm/include/sf_buf.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -40,6 +40,8 @@ struct vm_page;
 
 struct sf_buf;
 
+struct sf_buf *	sf_buf_alloc(struct vm_page *m, int flags);
+void sf_buf_free(struct sf_buf *sf);
 
 static __inline vm_offset_t
 sf_buf_kva(struct sf_buf *sf)

Modified: projects/bhyve_npt_pmap/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/dev/hpt27xx/hpt27xx_osm_bsd.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/dev/hpt27xx/hpt27xx_osm_bsd.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -52,7 +52,7 @@ static int hpt_probe(device_t dev)
 				memset(hba, 0, sizeof(HBA));
 				hba->ext_type = EXT_TYPE_HBA;
 				hba->ldm_adapter.him = him;
-				return 0;
+				return (BUS_PROBE_DEFAULT);
 			}
 		}
 	}

Modified: projects/bhyve_npt_pmap/sys/i386/conf/NOTES
==============================================================================
--- projects/bhyve_npt_pmap/sys/i386/conf/NOTES	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/i386/conf/NOTES	Fri Sep 13 21:16:52 2013	(r255530)
@@ -580,6 +580,7 @@ hint.mse.0.irq="5"
 # nfe:	nVidia nForce MCP on-board Ethernet Networking (BSD open source)
 # nve:	nVidia nForce MCP on-board Ethernet Networking
 # sbni: Granch SBNI12-xx ISA and PCI adapters
+# vmx:	VMware VMXNET3 Ethernet (BSD open source)
 # wl:   Lucent Wavelan (ISA card only).
 # wpi:	Intel 3945ABG Wireless LAN controller
 #	Requires the wpi firmware module
@@ -629,6 +630,7 @@ hint.sbni.0.at="isa"
 hint.sbni.0.port="0x210"
 hint.sbni.0.irq="0xefdead"
 hint.sbni.0.flags="0"
+device		vmx		# VMware VMXNET3 Ethernet
 device		wl
 hint.wl.0.at="isa"
 hint.wl.0.port="0x300"

Modified: projects/bhyve_npt_pmap/sys/i386/i386/mp_machdep.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/i386/i386/mp_machdep.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/i386/i386/mp_machdep.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/psl.h>
 #include <machine/smp.h>
 #include <machine/specialreg.h>
+#include <machine/cpu.h>
 
 #ifdef XENHVM
 #include <xen/hvm.h>
@@ -170,6 +171,11 @@ u_long *ipi_lazypmap_counts[MAXCPU];
 static u_long *ipi_hardclock_counts[MAXCPU];
 #endif
 
+/* Default cpu_ops implementation. */
+struct cpu_ops cpu_ops = {
+	.ipi_vectored = lapic_ipi_vectored
+};
+
 /*
  * Local data and functions.
  */
@@ -1209,7 +1215,7 @@ ipi_send_cpu(int cpu, u_int ipi)
 		if (old_pending)
 			return;
 	}
-	lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]);
+	cpu_ops.ipi_vectored(ipi, cpu_apic_ids[cpu]);
 }
 
 /*
@@ -1460,7 +1466,7 @@ ipi_all_but_self(u_int ipi)
 		CPU_OR_ATOMIC(&ipi_nmi_pending, &other_cpus);
 
 	CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi);
-	lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS);
+	cpu_ops.ipi_vectored(ipi, APIC_IPI_DEST_OTHERS);
 }
 
 int

Modified: projects/bhyve_npt_pmap/sys/i386/include/cpu.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/i386/include/cpu.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/i386/include/cpu.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -54,6 +54,17 @@
 #define	TRAPF_PC(framep)	((framep)->tf_eip)
 
 #ifdef _KERNEL
+/*
+ * Struct containing pointers to CPU management functions whose
+ * implementation is run time selectable.  Selection can be made,
+ * for example, based on detection of a particular CPU variant or
+ * hypervisor environment.
+ */
+struct cpu_ops {
+	void (*ipi_vectored)(u_int, int);
+};
+
+extern struct	cpu_ops cpu_ops;
 extern char	btext[];
 extern char	etext[];
 

Modified: projects/bhyve_npt_pmap/sys/i386/include/pcpu.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/i386/include/pcpu.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/i386/include/pcpu.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -44,15 +44,6 @@
  * other processors"
  */
 
-#if defined(XEN) || defined(XENHVM)
-#ifndef NR_VIRQS
-#define	NR_VIRQS	24
-#endif
-#ifndef NR_IPIS
-#define	NR_IPIS		2
-#endif
-#endif
-
 #if defined(XEN)
 
 /* These are peridically updated in shared_info, and then copied here. */

Modified: projects/bhyve_npt_pmap/sys/i386/include/sf_buf.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/i386/include/sf_buf.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/i386/include/sf_buf.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -45,6 +45,9 @@ struct sf_buf {
 #endif
 };
 
+struct sf_buf * sf_buf_alloc(struct vm_page *m, int flags);
+void sf_buf_free(struct sf_buf *sf);
+
 static __inline vm_offset_t
 sf_buf_kva(struct sf_buf *sf)
 {

Modified: projects/bhyve_npt_pmap/sys/i386/include/smp.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/i386/include/smp.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/i386/include/smp.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -84,11 +84,6 @@ void	smp_masked_invltlb(cpuset_t mask);
 
 #ifdef XEN
 void ipi_to_irq_init(void);
-
-#define RESCHEDULE_VECTOR	0
-#define CALL_FUNCTION_VECTOR	1
-#define NR_IPIS			2
-
 #endif
 #endif /* !LOCORE */
 #endif /* SMP */

Modified: projects/bhyve_npt_pmap/sys/i386/xen/mp_machdep.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/i386/xen/mp_machdep.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/i386/xen/mp_machdep.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -99,25 +99,37 @@ extern void failsafe_callback(void);
 extern void pmap_lazyfix_action(void);
 
 /*--------------------------- Forward Declarations ---------------------------*/
-static void	assign_cpu_ids(void);
-static void	set_interrupt_apic_ids(void);
-static int	start_all_aps(void);
-static int	start_ap(int apic_id);
-static void	release_aps(void *dummy);
+static driver_filter_t	smp_reschedule_interrupt;
+static driver_filter_t	smp_call_function_interrupt;
+static void		assign_cpu_ids(void);
+static void		set_interrupt_apic_ids(void);
+static int		start_all_aps(void);
+static int		start_ap(int apic_id);
+static void		release_aps(void *dummy);
+
+/*---------------------------------- Macros ----------------------------------*/
+#define	IPI_TO_IDX(ipi) ((ipi) - APIC_IPI_INTS)
 
 /*-------------------------------- Local Types -------------------------------*/
 typedef void call_data_func_t(uintptr_t , uintptr_t);
 
-/*
- * Store data from cpu_add() until later in the boot when we actually setup
- * the APs.
- */
 struct cpu_info {
 	int	cpu_present:1;
 	int	cpu_bsp:1;
 	int	cpu_disabled:1;
 };
 
+struct xen_ipi_handler
+{
+	driver_filter_t	*filter;
+	const char	*description;
+};
+
+enum {
+	RESCHEDULE_VECTOR,
+	CALL_FUNCTION_VECTOR,
+};
+
 /*-------------------------------- Global Data -------------------------------*/
 static u_int	hyperthreading_cpus;
 static cpuset_t	hyperthreading_cpus_mask;
@@ -161,8 +173,14 @@ static volatile u_int cpu_ipi_pending[MA
 static int cpu_logical;
 static int cpu_cores;
 
+static const struct xen_ipi_handler xen_ipis[] = 
+{
+	[RESCHEDULE_VECTOR]	= { smp_reschedule_interrupt,	"resched"  },
+	[CALL_FUNCTION_VECTOR]	= { smp_call_function_interrupt,"callfunc" }
+};
+
 /*------------------------------- Per-CPU Data -------------------------------*/
-DPCPU_DEFINE(xen_intr_handle_t, ipi_port[NR_IPIS]);
+DPCPU_DEFINE(xen_intr_handle_t, ipi_handle[nitems(xen_ipis)]);
 DPCPU_DEFINE(struct vcpu_info *, vcpu_info);
 
 /*------------------------------ Implementation ------------------------------*/
@@ -362,7 +380,7 @@ iv_lazypmap(uintptr_t a, uintptr_t b)
 /*
  * These start from "IPI offset" APIC_IPI_INTS
  */
-static call_data_func_t *ipi_vectors[] = 
+static call_data_func_t *ipi_vectors[6] = 
 {
 	iv_rendezvous,
 	iv_invltlb,
@@ -427,7 +445,7 @@ smp_call_function_interrupt(void *unused
 	    call_data->func_id > IPI_BITMAP_VECTOR)
 		panic("invalid function id %u", call_data->func_id);
 	
-	func = ipi_vectors[call_data->func_id - APIC_IPI_INTS];
+	func = ipi_vectors[IPI_TO_IDX(call_data->func_id)];
 	/*
 	 * Notify initiating CPU that I've grabbed the data and am
 	 * about to execute the function
@@ -473,44 +491,43 @@ cpu_mp_announce(void)
 static int
 xen_smp_cpu_init(unsigned int cpu)
 {
-	int rc;
-	xen_intr_handle_t irq_handle;
+	xen_intr_handle_t *ipi_handle;
+	const struct xen_ipi_handler *ipi;
+	int idx, rc;
 
-	DPCPU_ID_SET(cpu, ipi_port[RESCHEDULE_VECTOR], NULL);
-	DPCPU_ID_SET(cpu, ipi_port[CALL_FUNCTION_VECTOR], NULL);
+	ipi_handle = DPCPU_ID_GET(cpu, ipi_handle);
+	for (ipi = xen_ipis, idx = 0; idx < nitems(xen_ipis); ipi++, idx++) {
 
-	/*
-	 * The PCPU variable pc_device is not initialized on i386 PV,
-	 * so we have to use the root_bus device in order to setup
-	 * the IPIs.
-	 */
-	rc = xen_intr_bind_ipi(root_bus, RESCHEDULE_VECTOR,
-	    cpu, smp_reschedule_interrupt, INTR_TYPE_TTY, &irq_handle);
-	if (rc < 0)
-		goto fail;
-	xen_intr_describe(irq_handle, "resched%u", cpu);
-	DPCPU_ID_SET(cpu, ipi_port[RESCHEDULE_VECTOR], irq_handle);
-
-	printf("[XEN] IPI cpu=%d port=%d vector=RESCHEDULE_VECTOR (%d)\n",
-	    cpu, xen_intr_port(irq_handle), RESCHEDULE_VECTOR);
-
-	rc = xen_intr_bind_ipi(root_bus, CALL_FUNCTION_VECTOR,
-	    cpu, smp_call_function_interrupt, INTR_TYPE_TTY, &irq_handle);
-	if (rc < 0)
-		goto fail;
-	xen_intr_describe(irq_handle, "callfunc%u", cpu);
-	DPCPU_ID_SET(cpu, ipi_port[CALL_FUNCTION_VECTOR], irq_handle);
+		/*
+		 * The PCPU variable pc_device is not initialized on i386 PV,
+		 * so we have to use the root_bus device in order to setup
+		 * the IPIs.
+		 */
+		rc = xen_intr_alloc_and_bind_ipi(root_bus, cpu,
+		    ipi->filter, INTR_TYPE_TTY, &ipi_handle[idx]);
+		if (rc != 0) {
+			printf("Unable to allocate a XEN IPI port. "
+			    "Error %d\n", rc);
+			break;
+		}
+		xen_intr_describe(ipi_handle[idx], "%s", ipi->description);
+	}
 
-	printf("[XEN] IPI cpu=%d port=%d vector=CALL_FUNCTION_VECTOR (%d)\n",
-	    cpu, xen_intr_port(irq_handle), CALL_FUNCTION_VECTOR);
+	for (;idx < nitems(xen_ipis); idx++)
+		    ipi_handle[idx] = NULL;
 
-	return (0);
+	if (rc == 0)
+		return (0);
+
+	/* Either all are successfully mapped, or none at all. */
+	for (idx = 0; idx < nitems(xen_ipis); idx++) {
+		if (ipi_handle[idx] == NULL)
+			continue;
+
+		xen_intr_unbind(ipi_handle[idx]);
+		ipi_handle[idx] = NULL;
+	}
 
- fail:
-	xen_intr_unbind(DPCPU_ID_GET(cpu, ipi_port[RESCHEDULE_VECTOR]));
-	DPCPU_ID_SET(cpu, ipi_port[RESCHEDULE_VECTOR], NULL);
-	xen_intr_unbind(DPCPU_ID_GET(cpu, ipi_port[CALL_FUNCTION_VECTOR]));
-	DPCPU_ID_SET(cpu, ipi_port[CALL_FUNCTION_VECTOR], NULL);
 	return (rc);
 }
 
@@ -980,8 +997,8 @@ start_ap(int apic_id)
 static void
 ipi_pcpu(int cpu, u_int ipi)
 {
-	KASSERT((ipi <= NR_IPIS), ("invalid IPI"));
-	xen_intr_signal(DPCPU_ID_GET(cpu, ipi_port[ipi]));
+	KASSERT((ipi <= nitems(xen_ipis)), ("invalid IPI"));
+	xen_intr_signal(DPCPU_ID_GET(cpu, ipi_handle[ipi]));
 }
 
 /*

Modified: projects/bhyve_npt_pmap/sys/kern/kern_jail.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/kern/kern_jail.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/kern/kern_jail.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -3885,6 +3885,13 @@ prison_priv_check(struct ucred *cred, in
 	case PRIV_VFS_SETGID:
 	case PRIV_VFS_STAT:
 	case PRIV_VFS_STICKYFILE:
+
+		/*
+		 * As in the non-jail case, non-root users are expected to be
+		 * able to read kernel/phyiscal memory (provided /dev/[k]mem
+		 * exists in the jail and they have permission to access it).
+		 */
+	case PRIV_KMEM_READ:
 		return (0);
 
 		/*

Modified: projects/bhyve_npt_pmap/sys/mips/include/sf_buf.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/mips/include/sf_buf.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/mips/include/sf_buf.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -78,6 +78,9 @@ struct sf_buf {
 	vm_offset_t	kva;		/* va of mapping */
 };
 
+struct sf_buf * sf_buf_alloc(struct vm_page *m, int flags);
+void sf_buf_free(struct sf_buf *sf);
+
 static __inline vm_offset_t
 sf_buf_kva(struct sf_buf *sf)
 {

Modified: projects/bhyve_npt_pmap/sys/net/netisr.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/net/netisr.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/net/netisr.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -154,19 +154,6 @@ SYSCTL_PROC(_net_isr, OID_AUTO, dispatch
     "netisr dispatch policy");
 
 /*
- * These sysctls were used in previous versions to control and export
- * dispatch policy state.  Now, we provide read-only export via them so that
- * older netstat binaries work.  At some point they can be garbage collected.
- */
-static int	netisr_direct_force;
-SYSCTL_INT(_net_isr, OID_AUTO, direct_force, CTLFLAG_RD,
-    &netisr_direct_force, 0, "compat: force direct dispatch");
-
-static int	netisr_direct;
-SYSCTL_INT(_net_isr, OID_AUTO, direct, CTLFLAG_RD, &netisr_direct, 0,
-    "compat: enable direct dispatch");
-
-/*
  * Allow the administrator to limit the number of threads (CPUs) to use for
  * netisr.  We don't check netisr_maxthreads before creating the thread for
  * CPU 0, so in practice we ignore values <= 1.  This must be set at boot.
@@ -338,32 +325,6 @@ netisr_dispatch_policy_from_str(const ch
 	return (EINVAL);
 }
 
-static void
-netisr_dispatch_policy_compat(void)
-{
-
-	switch (netisr_dispatch_policy) {
-	case NETISR_DISPATCH_DEFERRED:
-		netisr_direct_force = 0;
-		netisr_direct = 0;
-		break;
-
-	case NETISR_DISPATCH_HYBRID:
-		netisr_direct_force = 0;
-		netisr_direct = 1;
-		break;
-
-	case NETISR_DISPATCH_DIRECT:
-		netisr_direct_force = 1;
-		netisr_direct = 1;
-		break;
-
-	default:
-		panic("%s: unknown policy %u", __func__,
-		    netisr_dispatch_policy);
-	}
-}
-
 static int
 sysctl_netisr_dispatch_policy(SYSCTL_HANDLER_ARGS)
 {
@@ -379,10 +340,8 @@ sysctl_netisr_dispatch_policy(SYSCTL_HAN
 		    &dispatch_policy);
 		if (error == 0 && dispatch_policy == NETISR_DISPATCH_DEFAULT)
 			error = EINVAL;
-		if (error == 0) {
+		if (error == 0)
 			netisr_dispatch_policy = dispatch_policy;
-			netisr_dispatch_policy_compat();
-		}
 	}
 	return (error);
 }
@@ -1199,10 +1158,9 @@ netisr_init(void *arg)
 		    &dispatch_policy);
 		if (error == 0 && dispatch_policy == NETISR_DISPATCH_DEFAULT)
 			error = EINVAL;
-		if (error == 0) {
+		if (error == 0)
 			netisr_dispatch_policy = dispatch_policy;
-			netisr_dispatch_policy_compat();
-		} else
+		else
 			printf(
 			    "%s: invalid dispatch policy %s, using default\n",
 			    __func__, tmp);

Modified: projects/bhyve_npt_pmap/sys/powerpc/include/sf_buf.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/powerpc/include/sf_buf.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/powerpc/include/sf_buf.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -45,6 +45,9 @@ struct sf_buf {
 	int		ref_count;	/* usage of this mapping */
 };
 
+struct sf_buf * sf_buf_alloc(struct vm_page *m, int flags);
+void sf_buf_free(struct sf_buf *sf);
+
 /*
  * On 32-bit OEA, the only purpose for which sf_buf is used is to implement
  * an opaque pointer required by the machine-independent parts of the kernel.

Modified: projects/bhyve_npt_pmap/sys/sparc64/include/sf_buf.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/sparc64/include/sf_buf.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/sparc64/include/sf_buf.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -39,6 +39,9 @@ struct sf_buf {
 	vm_offset_t	kva;		/* va of mapping */
 };
 
+struct sf_buf * sf_buf_alloc(struct vm_page *m, int flags);
+void sf_buf_free(struct sf_buf *sf);
+
 static __inline vm_offset_t
 sf_buf_kva(struct sf_buf *sf)
 {

Modified: projects/bhyve_npt_pmap/sys/sys/param.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/sys/param.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/sys/param.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1000053	/* Master, propagated to newvers */
+#define __FreeBSD_version 1000054	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

Modified: projects/bhyve_npt_pmap/sys/sys/sf_buf.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/sys/sf_buf.h	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/sys/sf_buf.h	Fri Sep 13 21:16:52 2013	(r255530)
@@ -65,9 +65,6 @@ extern counter_u64_t sfstat[sizeof(struc
 #define	SFSTAT_INC(name)	SFSTAT_ADD(name, 1)
 #endif /* _KERNEL */
 
-struct sf_buf *
-	sf_buf_alloc(struct vm_page *m, int flags);
-void	sf_buf_free(struct sf_buf *sf);
 int	sf_buf_mext(struct mbuf *mb, void *addr, void *args);
 
 #endif /* !_SYS_SF_BUF_H_ */

Modified: projects/bhyve_npt_pmap/sys/x86/xen/hvm.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/x86/xen/hvm.c	Fri Sep 13 20:56:42 2013	(r255529)
+++ projects/bhyve_npt_pmap/sys/x86/xen/hvm.c	Fri Sep 13 21:16:52 2013	(r255530)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 Citrix Systems, Inc.
+ * Copyright (c) 2008, 2013 Citrix Systems, Inc.
  * Copyright (c) 2012 Spectra Logic Corporation
  * All rights reserved.
  *
@@ -33,9 +33,19 @@ __FBSDID("$FreeBSD$");
 #include <sys/kernel.h>

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


More information about the svn-src-projects mailing list