Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Feb 2016 16:01:34 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r295926 - in projects/release-pkg: contrib/binutils/bfd contrib/libarchive/libarchive lib/libc/db/hash sys/arm/arm sys/arm/freescale/imx sys/arm/include sys/arm64/conf sys/boot/fdt/dts/...
Message-ID:  <201602231601.u1NG1YTE044602@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Tue Feb 23 16:01:34 2016
New Revision: 295926
URL: https://svnweb.freebsd.org/changeset/base/295926

Log:
  MFH
  
  Sponsored by:	The FreeBSD Foundation

Added:
  projects/release-pkg/sys/riscv/riscv/stack_machdep.c
     - copied unchanged from r295925, head/sys/riscv/riscv/stack_machdep.c
Modified:
  projects/release-pkg/contrib/binutils/bfd/elf.c
  projects/release-pkg/contrib/libarchive/libarchive/archive_read.c
  projects/release-pkg/lib/libc/db/hash/hash.c
  projects/release-pkg/sys/arm/arm/cpu_asm-v6.S
  projects/release-pkg/sys/arm/arm/trap-v4.c
  projects/release-pkg/sys/arm/freescale/imx/imx6_machdep.c
  projects/release-pkg/sys/arm/include/cpu-v6.h
  projects/release-pkg/sys/arm64/conf/GENERIC
  projects/release-pkg/sys/boot/fdt/dts/riscv/qemu.dts
  projects/release-pkg/sys/boot/fdt/dts/riscv/spike.dts
  projects/release-pkg/sys/boot/uboot/lib/net.c
  projects/release-pkg/sys/compat/cloudabi/cloudabi_mem.c
  projects/release-pkg/sys/conf/files.riscv
  projects/release-pkg/sys/conf/kern.post.mk
  projects/release-pkg/sys/dev/e1000/if_em.c
  projects/release-pkg/sys/dev/e1000/if_em.h
  projects/release-pkg/sys/dev/e1000/if_igb.c
  projects/release-pkg/sys/dev/e1000/if_igb.h
  projects/release-pkg/sys/dev/e1000/if_lem.h
  projects/release-pkg/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  projects/release-pkg/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  projects/release-pkg/sys/dev/uart/uart_cpu_fdt.c
  projects/release-pkg/sys/dev/uart/uart_dev_lpc.c
  projects/release-pkg/sys/dev/usb/usb_hid.c
  projects/release-pkg/sys/dev/usb/usbdevs
  projects/release-pkg/sys/dev/usb/wlan/if_urtwn.c
  projects/release-pkg/sys/powerpc/mpc85xx/mpc85xx.c
  projects/release-pkg/sys/riscv/include/atomic.h
  projects/release-pkg/sys/riscv/riscv/machdep.c
  projects/release-pkg/sys/riscv/riscv/timer.c
  projects/release-pkg/sys/riscv/riscv/trap.c
  projects/release-pkg/usr.sbin/iostat/iostat.c
  projects/release-pkg/usr.sbin/pwd_mkdb/pwd_mkdb.c
Directory Properties:
  projects/release-pkg/   (props changed)
  projects/release-pkg/contrib/binutils/   (props changed)
  projects/release-pkg/contrib/libarchive/   (props changed)
  projects/release-pkg/contrib/libarchive/libarchive/   (props changed)
  projects/release-pkg/lib/libc/   (props changed)
  projects/release-pkg/sys/   (props changed)
  projects/release-pkg/sys/boot/   (props changed)
  projects/release-pkg/sys/conf/   (props changed)
  projects/release-pkg/sys/dev/hyperv/   (props changed)

Modified: projects/release-pkg/contrib/binutils/bfd/elf.c
==============================================================================
--- projects/release-pkg/contrib/binutils/bfd/elf.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/contrib/binutils/bfd/elf.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -8934,14 +8934,14 @@ elf_create_symbuf (bfd_size_type symcoun
 	shndx_count++;
 
   ssymbuf = bfd_malloc ((shndx_count + 1) * sizeof (*ssymbuf)
-			+ (indbufend - indbuf) * sizeof (*ssymbuf));
+			+ (indbufend - indbuf) * sizeof (*ssym));
   if (ssymbuf == NULL)
     {
       free (indbuf);
       return NULL;
     }
 
-  ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count);
+  ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count + 1);
   ssymbuf->ssym = NULL;
   ssymbuf->count = shndx_count;
   ssymbuf->st_shndx = 0;

Modified: projects/release-pkg/contrib/libarchive/libarchive/archive_read.c
==============================================================================
--- projects/release-pkg/contrib/libarchive/libarchive/archive_read.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/contrib/libarchive/libarchive/archive_read.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -545,13 +545,13 @@ archive_read_open1(struct archive *_a)
 static int
 choose_filters(struct archive_read *a)
 {
-	int number_bidders, i, bid, best_bid;
+	int number_bidders, i, bid, best_bid, n;
 	struct archive_read_filter_bidder *bidder, *best_bidder;
 	struct archive_read_filter *filter;
 	ssize_t avail;
 	int r;
 
-	for (;;) {
+	for (n = 0; n < 25; ++n) {
 		number_bidders = sizeof(a->bidders) / sizeof(a->bidders[0]);
 
 		best_bid = 0;
@@ -597,6 +597,9 @@ choose_filters(struct archive_read *a)
 			return (ARCHIVE_FATAL);
 		}
 	}
+	archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+	    "Input requires too many filters for decoding");
+	return (ARCHIVE_FATAL);
 }
 
 /*

Modified: projects/release-pkg/lib/libc/db/hash/hash.c
==============================================================================
--- projects/release-pkg/lib/libc/db/hash/hash.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/lib/libc/db/hash/hash.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -422,8 +422,10 @@ hdestroy(HTAB *hashp)
 	if (hashp->tmp_buf)
 		free(hashp->tmp_buf);
 
-	if (hashp->fp != -1)
+	if (hashp->fp != -1) {
+		(void)_fsync(hashp->fp);
 		(void)_close(hashp->fp);
+	}
 
 	free(hashp);
 
@@ -458,6 +460,8 @@ hash_sync(const DB *dbp, u_int32_t flags
 		return (0);
 	if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
 		return (ERROR);
+	if (hashp->fp != -1 && _fsync(hashp->fp) != 0)
+		return (ERROR);
 	hashp->new_file = 0;
 	return (0);
 }

Modified: projects/release-pkg/sys/arm/arm/cpu_asm-v6.S
==============================================================================
--- projects/release-pkg/sys/arm/arm/cpu_asm-v6.S	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/arm/arm/cpu_asm-v6.S	Tue Feb 23 16:01:34 2016	(r295926)
@@ -34,16 +34,9 @@
 #include <machine/armreg.h>
 #include <machine/sysreg.h>
 
-#if __ARM_ARCH >= 6
 #define GET_PCB(tmp) \
-	mrc CP15_TPIDRPRW(tmp); \
-	add   tmp, tmp, #(TD_PCB)
-#else
-.Lcurpcb:
-	.word _C_LABEL(__pcpu) + PC_CURPCB
-#define GET_PCB(tmp) \
-	ldr   tmp, .Lcurpcb
-#endif
+	mrc	CP15_TPIDRPRW(tmp); \
+	add	tmp, tmp, #(TD_PCB)
 
 /*
  * Define cache functions used by startup code, which counts on the fact that

Modified: projects/release-pkg/sys/arm/arm/trap-v4.c
==============================================================================
--- projects/release-pkg/sys/arm/arm/trap-v4.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/arm/arm/trap-v4.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -94,7 +94,6 @@ __FBSDID("$FreeBSD$");
 #include <vm/vm_map.h>
 #include <vm/vm_extern.h>
 
-#include <machine/acle-compat.h>
 #include <machine/cpu.h>
 #include <machine/frame.h>
 #include <machine/machdep.h>
@@ -312,16 +311,13 @@ abort_handler(struct trapframe *tf, int 
 	}
 
 	/*
-	 * We need to know whether the page should be mapped as R or R/W.  On
-	 * armv6 and later the fault status register indicates whether the
-	 * access was a read or write.  Prior to armv6, we know that a
-	 * permission fault can only be the result of a write to a read-only
-	 * location, so we can deal with those quickly.  Otherwise we need to
-	 * disassemble the faulting instruction to determine if it was a write.
+	 * We need to know whether the page should be mapped as R or R/W.
+	 * On armv4, the fault status register does not indicate whether
+	 * the access was a read or write.  We know that a permission fault
+	 * can only be the result of a write to a read-only location, so we
+	 * can deal with those quickly.  Otherwise we need to disassemble
+	 * the faulting instruction to determine if it was a write.
 	 */
-#if __ARM_ARCH >= 6
-	ftype = (fsr & FAULT_WNR) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ;
-#else
 	if (IS_PERMISSION_FAULT(fsr))
 		ftype = VM_PROT_WRITE;
 	else {
@@ -338,7 +334,6 @@ abort_handler(struct trapframe *tf, int 
 				ftype = VM_PROT_READ;
 		}
 	}
-#endif
 
 	/*
 	 * See if the fault is as a result of ref/mod emulation,

Modified: projects/release-pkg/sys/arm/freescale/imx/imx6_machdep.c
==============================================================================
--- projects/release-pkg/sys/arm/freescale/imx/imx6_machdep.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/arm/freescale/imx/imx6_machdep.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -94,6 +94,74 @@ fdt_pic_decode_t fdt_pic_table[] = {
 };
 #endif
 
+/*
+ * Fix FDT data related to interrupts.
+ *
+ * Driven by the needs of linux and its drivers (as always), the published FDT
+ * data for imx6 now sets the interrupt parent for most devices to the GPC
+ * interrupt controller, which is for use when the chip is in deep-sleep mode.
+ * We don't support deep sleep or have a GPC-PIC driver; we need all interrupts
+ * to be handled by the GIC.
+ *
+ * Luckily, the change to the FDT data was to assign the GPC as the interrupt
+ * parent for the soc node and letting that get inherited by all other devices
+ * (except a few that directly name GIC as their interrupt parent).  So we can
+ * set the world right by just changing the interrupt-parent property of the soc
+ * node to refer to GIC instead of GPC.  This will get us by until we write our
+ * own GPC driver (or until linux changes its mind and the FDT data again).
+ *
+ * We validate that we have data that looks like we expect before changing it:
+ *  - SOC node exists and has GPC as its interrupt parent.
+ *  - GPC node exists and has GIC as its interrupt parent.
+ *  - GIC node exists and is its own interrupt parent.
+ *
+ * This applies to all models of imx6.  Luckily all of them have the devices
+ * involved at the same addresses on the same busses, so we don't need any
+ * per-soc logic.  We handle this at platform attach time rather than via the
+ * fdt_fixup_table, because the latter requires matching on the FDT "model"
+ * property, and this applies to all boards including those not yet invented.
+ */
+static void
+fix_fdt_interrupt_data(void)
+{
+	phandle_t gicipar, gicnode, gicxref;
+	phandle_t gpcipar, gpcnode, gpcxref;
+	phandle_t socipar, socnode;
+	int result;
+
+	socnode = OF_finddevice("/soc");
+	if (socnode == -1)
+	    return;
+	result = OF_getencprop(socnode, "interrupt-parent", &socipar,
+	    sizeof(socipar));
+	if (result <= 0)
+		return;
+
+	gicnode = OF_finddevice("/soc/interrupt-controller@00a01000");
+	if (gicnode == -1)
+		return;
+	result = OF_getencprop(gicnode, "interrupt-parent", &gicipar,
+	    sizeof(gicipar));
+	if (result <= 0)
+		return;
+	gicxref = OF_xref_from_node(gicnode);
+
+	gpcnode = OF_finddevice("/soc/aips-bus@02000000/gpc@020dc000");
+	if (gpcnode == -1)
+		return;
+	result = OF_getencprop(gpcnode, "interrupt-parent", &gpcipar,
+	    sizeof(gpcipar));
+	if (result <= 0)
+		return;
+	gpcxref = OF_xref_from_node(gpcnode);
+
+	if (socipar != gpcxref || gpcipar != gicxref || gicipar != gicxref)
+		return;
+
+	gicxref = cpu_to_fdt32(gicxref);
+	OF_setprop(socnode, "interrupt-parent", &gicxref, sizeof(gicxref));
+}
+
 static vm_offset_t
 imx6_lastaddr(platform_t plat)
 {
@@ -104,6 +172,10 @@ imx6_lastaddr(platform_t plat)
 static int
 imx6_attach(platform_t plat)
 {
+
+	/* Fix soc interrupt-parent property. */
+	fix_fdt_interrupt_data();
+
 	/* Inform the MPCore timer driver that its clock is variable. */
 	arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES);
 

Modified: projects/release-pkg/sys/arm/include/cpu-v6.h
==============================================================================
--- projects/release-pkg/sys/arm/include/cpu-v6.h	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/arm/include/cpu-v6.h	Tue Feb 23 16:01:34 2016	(r295926)
@@ -177,15 +177,12 @@ _RF0(cp15_dfar_get, CP15_DFAR(%0))
 _RF0(cp15_ifar_get, CP15_IFAR(%0))
 _RF0(cp15_l2ctlr_get, CP15_L2CTLR(%0))
 #endif
-/* ARMv6+ and XScale */
 _RF0(cp15_actlr_get, CP15_ACTLR(%0))
 _WF1(cp15_actlr_set, CP15_ACTLR(%0))
-#if __ARM_ARCH >= 6
 _WF1(cp15_ats1cpr_set, CP15_ATS1CPR(%0))
 _WF1(cp15_ats1cpw_set, CP15_ATS1CPW(%0))
 _RF0(cp15_par_get, CP15_PAR(%0))
 _RF0(cp15_sctlr_get, CP15_SCTLR(%0))
-#endif
 
 /*CPU id registers */
 _RF0(cp15_midr_get, CP15_MIDR(%0))

Modified: projects/release-pkg/sys/arm64/conf/GENERIC
==============================================================================
--- projects/release-pkg/sys/arm64/conf/GENERIC	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/arm64/conf/GENERIC	Tue Feb 23 16:01:34 2016	(r295926)
@@ -103,6 +103,7 @@ device		mii
 device		miibus		# MII bus support
 device		em		# Intel PRO/1000 Gigabit Ethernet Family
 device		igb		# Intel PRO/1000 PCIE Server Gigabit Family
+device		ix		# Intel 10Gb Ethernet Family
 device		msk		# Marvell/SysKonnect Yukon II Gigabit Ethernet
 device		vnic		# Cavium ThunderX NIC
 

Modified: projects/release-pkg/sys/boot/fdt/dts/riscv/qemu.dts
==============================================================================
--- projects/release-pkg/sys/boot/fdt/dts/riscv/qemu.dts	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/boot/fdt/dts/riscv/qemu.dts	Tue Feb 23 16:01:34 2016	(r295926)
@@ -49,7 +49,7 @@
 
 	memory {
 		device_type = "memory";
-		reg = <0x0 0x8000000>; /* 128MB at 0x0 */
+		reg = <0x0 0x40000000>; /* 1GB at 0x0 */
 	};
 
 	soc {

Modified: projects/release-pkg/sys/boot/fdt/dts/riscv/spike.dts
==============================================================================
--- projects/release-pkg/sys/boot/fdt/dts/riscv/spike.dts	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/boot/fdt/dts/riscv/spike.dts	Tue Feb 23 16:01:34 2016	(r295926)
@@ -49,7 +49,7 @@
 
 	memory {
 		device_type = "memory";
-		reg = <0x0 0x8000000>; /* 128MB at 0x0 */
+		reg = <0x0 0x40000000>; /* 1GB at 0x0 */
 	};
 
 	soc {

Modified: projects/release-pkg/sys/boot/uboot/lib/net.c
==============================================================================
--- projects/release-pkg/sys/boot/uboot/lib/net.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/boot/uboot/lib/net.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -108,9 +108,19 @@ get_env_net_params()
 	char *envstr;
 	in_addr_t rootaddr, serveraddr;
 
-	/* Silently get out right away if we don't have rootpath. */
-	if (ub_env_get("rootpath") == NULL)
+	/*
+	 * Silently get out right away if we don't have rootpath, because none
+	 * of the other info we obtain below is sufficient to boot without it.
+	 *
+	 * If we do have rootpath, copy it into the global var and also set
+	 * dhcp.root-path in the env.  If we don't get all the other info from
+	 * the u-boot env below, we will still try dhcp/bootp, but the server-
+	 * provided path will not replace the user-provided value we set here.
+	 */
+	if ((envstr = ub_env_get("rootpath")) == NULL)
 		return;
+	strlcpy(rootpath, envstr, sizeof(rootpath));
+	setenv("dhcp.root-path", rootpath, 0);
 
 	/*
 	 * Our own IP address must be valid.  Silently get out if it's not set,
@@ -154,9 +164,6 @@ get_env_net_params()
 	 * There must be a rootpath.  It may be ip:/path or it may be just the
 	 * path in which case the ip needs to be in serverip.
 	 */
-	if ((envstr = ub_env_get("rootpath")) == NULL)
-		return;
-	strncpy(rootpath, envstr, sizeof(rootpath) - 1);
 	rootaddr = net_parse_rootpath();
 	if (rootaddr == INADDR_NONE)
 		rootaddr = serveraddr;

Modified: projects/release-pkg/sys/compat/cloudabi/cloudabi_mem.c
==============================================================================
--- projects/release-pkg/sys/compat/cloudabi/cloudabi_mem.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/compat/cloudabi/cloudabi_mem.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -35,18 +35,26 @@ __FBSDID("$FreeBSD$");
 
 /* Converts CloudABI's memory protection flags to FreeBSD's. */
 static int
-convert_mprot(cloudabi_mprot_t in)
+convert_mprot(cloudabi_mprot_t in, int *out)
 {
-	int out;
 
-	out = 0;
+	/* Unknown protection flags. */
+	if ((in & ~(CLOUDABI_PROT_EXEC | CLOUDABI_PROT_WRITE |
+	    CLOUDABI_PROT_READ)) != 0)
+		return (ENOTSUP);
+	/* W^X: Write and exec cannot be enabled at the same time. */
+	if ((in & (CLOUDABI_PROT_EXEC | CLOUDABI_PROT_WRITE)) ==
+	    (CLOUDABI_PROT_EXEC | CLOUDABI_PROT_WRITE))
+		return (ENOTSUP);
+
+	*out = 0;
 	if (in & CLOUDABI_PROT_EXEC)
-		out |= PROT_EXEC;
+		*out |= PROT_EXEC;
 	if (in & CLOUDABI_PROT_WRITE)
-		out |= PROT_WRITE;
+		*out |= PROT_WRITE;
 	if (in & CLOUDABI_PROT_READ)
-		out |= PROT_READ;
-	return (out);
+		*out |= PROT_READ;
+	return (0);
 }
 
 int
@@ -98,10 +106,10 @@ cloudabi_sys_mem_map(struct thread *td, 
 	struct mmap_args mmap_args = {
 		.addr	= uap->addr,
 		.len	= uap->len,
-		.prot	= convert_mprot(uap->prot),
 		.fd	= uap->fd,
 		.pos	= uap->off
 	};
+	int error;
 
 	/* Translate flags. */
 	if (uap->flags & CLOUDABI_MAP_ANON)
@@ -113,6 +121,11 @@ cloudabi_sys_mem_map(struct thread *td, 
 	if (uap->flags & CLOUDABI_MAP_SHARED)
 		mmap_args.flags |= MAP_SHARED;
 
+	/* Translate protection. */
+	error = convert_mprot(uap->prot, &mmap_args.prot);
+	if (error != 0)
+		return (error);
+
 	return (sys_mmap(td, &mmap_args));
 }
 
@@ -123,8 +136,13 @@ cloudabi_sys_mem_protect(struct thread *
 	struct mprotect_args mprotect_args = {
 		.addr	= uap->addr,
 		.len	= uap->len,
-		.prot	= convert_mprot(uap->prot),
 	};
+	int error;
+
+	/* Translate protection. */
+	error = convert_mprot(uap->prot, &mprotect_args.prot);
+	if (error != 0)
+		return (error);
 
 	return (sys_mprotect(td, &mprotect_args));
 }

Modified: projects/release-pkg/sys/conf/files.riscv
==============================================================================
--- projects/release-pkg/sys/conf/files.riscv	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/conf/files.riscv	Tue Feb 23 16:01:34 2016	(r295926)
@@ -34,9 +34,10 @@ riscv/riscv/machdep.c		standard
 riscv/riscv/mem.c		standard
 riscv/riscv/nexus.c		standard
 riscv/riscv/pmap.c		standard
-riscv/riscv/sys_machdep.c	standard
+riscv/riscv/stack_machdep.c	optional	ddb | stack
 riscv/riscv/support.S		standard
 riscv/riscv/swtch.S		standard
+riscv/riscv/sys_machdep.c	standard
 riscv/riscv/trap.c		standard
 riscv/riscv/timer.c		standard
 riscv/riscv/uio_machdep.c	standard

Modified: projects/release-pkg/sys/conf/kern.post.mk
==============================================================================
--- projects/release-pkg/sys/conf/kern.post.mk	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/conf/kern.post.mk	Tue Feb 23 16:01:34 2016	(r295926)
@@ -222,10 +222,9 @@ _MKDEPCC:= ${CC:N${CCACHE_BIN}}
 SRCS=	assym.s vnode_if.h ${BEFORE_DEPEND} ${CFILES} \
 	${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
 	${MFILES:T:S/.m$/.h/}
-DEPENDFILES=	.depend
+DEPENDFILES=	.depend .depend.*
 .if ${MK_FAST_DEPEND} == "yes" && \
     (${.MAKE.MODE:Unormal:Mmeta} == "" || ${.MAKE.MODE:Unormal:Mnofilemon} != "")
-DEPENDFILES+=	.depend.*
 DEPEND_CFLAGS+=	-MD -MP -MF.depend.${.TARGET}
 DEPEND_CFLAGS+=	-MT${.TARGET}
 .if defined(.PARSEDIR)

Modified: projects/release-pkg/sys/dev/e1000/if_em.c
==============================================================================
--- projects/release-pkg/sys/dev/e1000/if_em.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/e1000/if_em.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -3193,9 +3193,11 @@ em_setup_interface(device_t dev, struct 
 	if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
 	if_setioctlfn(ifp, em_ioctl);
 	if_setgetcounterfn(ifp, em_get_counter);
+
 	/* TSO parameters */
 	ifp->if_hw_tsomax = IP_MAXPACKET;
-	ifp->if_hw_tsomaxsegcount = EM_MAX_SCATTER;
+	/* Take m_pullup(9)'s in em_xmit() w/ TSO into acount. */
+	ifp->if_hw_tsomaxsegcount = EM_MAX_SCATTER - 5;
 	ifp->if_hw_tsomaxsegsize = EM_TSO_SEG_SIZE;
 
 #ifdef EM_MULTIQUEUE

Modified: projects/release-pkg/sys/dev/e1000/if_em.h
==============================================================================
--- projects/release-pkg/sys/dev/e1000/if_em.h	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/e1000/if_em.h	Tue Feb 23 16:01:34 2016	(r295926)
@@ -269,7 +269,7 @@
 #define HW_DEBUGOUT1(S, A)          if (DEBUG_HW) printf(S "\n", A)
 #define HW_DEBUGOUT2(S, A, B)       if (DEBUG_HW) printf(S "\n", A, B)
 
-#define EM_MAX_SCATTER		64
+#define EM_MAX_SCATTER		40
 #define EM_VFTA_SIZE		128
 #define EM_TSO_SIZE		(65535 + sizeof(struct ether_vlan_header))
 #define EM_TSO_SEG_SIZE		4096	/* Max dma segment size */

Modified: projects/release-pkg/sys/dev/e1000/if_igb.c
==============================================================================
--- projects/release-pkg/sys/dev/e1000/if_igb.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/e1000/if_igb.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -3139,6 +3139,12 @@ igb_setup_interface(device_t dev, struct
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = igb_ioctl;
 	ifp->if_get_counter = igb_get_counter;
+
+	/* TSO parameters */
+	ifp->if_hw_tsomax = IP_MAXPACKET;
+	ifp->if_hw_tsomaxsegcount = IGB_MAX_SCATTER;
+	ifp->if_hw_tsomaxsegsize = IGB_TSO_SEG_SIZE;
+
 #ifndef IGB_LEGACY_TX
 	ifp->if_transmit = igb_mq_start;
 	ifp->if_qflush = igb_qflush;

Modified: projects/release-pkg/sys/dev/e1000/if_igb.h
==============================================================================
--- projects/release-pkg/sys/dev/e1000/if_igb.h	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/e1000/if_igb.h	Tue Feb 23 16:01:34 2016	(r295926)
@@ -278,7 +278,7 @@
 #define HW_DEBUGOUT1(S, A)          if (DEBUG_HW) printf(S "\n", A)
 #define HW_DEBUGOUT2(S, A, B)       if (DEBUG_HW) printf(S "\n", A, B)
 
-#define IGB_MAX_SCATTER		64
+#define IGB_MAX_SCATTER		40
 #define IGB_VFTA_SIZE		128
 #define IGB_BR_SIZE		4096	/* ring buf size */
 #define IGB_TSO_SIZE		(65535 + sizeof(struct ether_vlan_header))

Modified: projects/release-pkg/sys/dev/e1000/if_lem.h
==============================================================================
--- projects/release-pkg/sys/dev/e1000/if_lem.h	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/e1000/if_lem.h	Tue Feb 23 16:01:34 2016	(r295926)
@@ -236,10 +236,8 @@
 #define HW_DEBUGOUT1(S, A)          if (DEBUG_HW) printf(S "\n", A)
 #define HW_DEBUGOUT2(S, A, B)       if (DEBUG_HW) printf(S "\n", A, B)
 
-#define EM_MAX_SCATTER		64
+#define EM_MAX_SCATTER		40
 #define EM_VFTA_SIZE		128
-#define EM_TSO_SIZE		(65535 + sizeof(struct ether_vlan_header))
-#define EM_TSO_SEG_SIZE		4096	/* Max dma segment size */
 #define EM_MSIX_MASK		0x01F00000 /* For 82574 use */
 #define ETH_ZLEN		60
 #define ETH_ADDR_LEN		6

Modified: projects/release-pkg/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- projects/release-pkg/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -905,6 +905,68 @@ done:
 }
 
 /*
+ * NOTE:
+ * If this function fails, then txd will be freed, but the mbuf
+ * associated w/ the txd will _not_ be freed.
+ */
+static int
+hn_send_pkt(struct ifnet *ifp, struct hv_device *device_ctx,
+    struct hn_tx_ring *txr, struct hn_txdesc *txd)
+{
+	int error, send_failed = 0;
+
+again:
+	/*
+	 * Make sure that txd is not freed before ETHER_BPF_MTAP.
+	 */
+	hn_txdesc_hold(txd);
+	error = hv_nv_on_send(device_ctx, &txd->netvsc_pkt);
+	if (!error) {
+		ETHER_BPF_MTAP(ifp, txd->m);
+		if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
+	}
+	hn_txdesc_put(txr, txd);
+
+	if (__predict_false(error)) {
+		int freed;
+
+		/*
+		 * This should "really rarely" happen.
+		 *
+		 * XXX Too many RX to be acked or too many sideband
+		 * commands to run?  Ask netvsc_channel_rollup()
+		 * to kick start later.
+		 */
+		txr->hn_has_txeof = 1;
+		if (!send_failed) {
+			txr->hn_send_failed++;
+			send_failed = 1;
+			/*
+			 * Try sending again after set hn_has_txeof;
+			 * in case that we missed the last
+			 * netvsc_channel_rollup().
+			 */
+			goto again;
+		}
+		if_printf(ifp, "send failed\n");
+
+		/*
+		 * Caller will perform further processing on the
+		 * associated mbuf, so don't free it in hn_txdesc_put();
+		 * only unload it from the DMA map in hn_txdesc_put(),
+		 * if it was loaded.
+		 */
+		txd->m = NULL;
+		freed = hn_txdesc_put(txr, txd);
+		KASSERT(freed != 0,
+		    ("fail to free txd upon send error"));
+
+		txr->hn_send_failed++;
+	}
+	return error;
+}
+
+/*
  * Start a transmit of one or more packets
  */
 static int
@@ -922,9 +984,9 @@ hn_start_locked(struct hn_tx_ring *txr, 
 		return 0;
 
 	while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
-		int error, send_failed = 0;
 		struct hn_txdesc *txd;
 		struct mbuf *m_head;
+		int error;
 
 		IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
 		if (m_head == NULL)
@@ -936,14 +998,14 @@ hn_start_locked(struct hn_tx_ring *txr, 
 			 * dispatch this packet sending (and sending of any
 			 * following up packets) to tx taskqueue.
 			 */
-			IF_PREPEND(&ifp->if_snd, m_head);
+			IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
 			return 1;
 		}
 
 		txd = hn_txdesc_get(txr);
 		if (txd == NULL) {
 			txr->hn_no_txdescs++;
-			IF_PREPEND(&ifp->if_snd, m_head);
+			IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
 			atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE);
 			break;
 		}
@@ -953,53 +1015,11 @@ hn_start_locked(struct hn_tx_ring *txr, 
 			/* Both txd and m_head are freed */
 			continue;
 		}
-again:
-		/*
-		 * Make sure that txd is not freed before ETHER_BPF_MTAP.
-		 */
-		hn_txdesc_hold(txd);
-		error = hv_nv_on_send(device_ctx, &txd->netvsc_pkt);
-		if (!error) {
-			ETHER_BPF_MTAP(ifp, m_head);
-			if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
-		}
-		hn_txdesc_put(txr, txd);
 
+		error = hn_send_pkt(ifp, device_ctx, txr, txd);
 		if (__predict_false(error)) {
-			int freed;
-
-			/*
-			 * This should "really rarely" happen.
-			 *
-			 * XXX Too many RX to be acked or too many sideband
-			 * commands to run?  Ask netvsc_channel_rollup()
-			 * to kick start later.
-			 */
-			txr->hn_has_txeof = 1;
-			if (!send_failed) {
-				txr->hn_send_failed++;
-				send_failed = 1;
-				/*
-				 * Try sending again after set hn_has_txeof;
-				 * in case that we missed the last
-				 * netvsc_channel_rollup().
-				 */
-				goto again;
-			}
-			if_printf(ifp, "send failed\n");
-
-			/*
-			 * This mbuf will be prepended, don't free it
-			 * in hn_txdesc_put(); only unload it from the
-			 * DMA map in hn_txdesc_put(), if it was loaded.
-			 */
-			txd->m = NULL;
-			freed = hn_txdesc_put(txr, txd);
-			KASSERT(freed != 0,
-			    ("fail to free txd upon send error"));
-
-			txr->hn_send_failed++;
-			IF_PREPEND(&ifp->if_snd, m_head);
+			/* txd is freed, but m_head is not */
+			IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
 			atomic_set_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE);
 			break;
 		}

Modified: projects/release-pkg/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- projects/release-pkg/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -810,8 +810,8 @@ hv_storvsc_rescan_target(struct storvsc_
 
 	if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid, targetid,
 	    CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
-		printf("unable to create path for rescan, pathid: %d,"
-		    "targetid: %d\n", pathid, targetid);
+		printf("unable to create path for rescan, pathid: %u,"
+		    "targetid: %u\n", pathid, targetid);
 		xpt_free_ccb(ccb);
 		return;
 	}

Modified: projects/release-pkg/sys/dev/uart/uart_cpu_fdt.c
==============================================================================
--- projects/release-pkg/sys/dev/uart/uart_cpu_fdt.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/uart/uart_cpu_fdt.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -54,10 +54,6 @@ __FBSDID("$FreeBSD$");
 #include <dev/uart/uart_cpu.h>
 #include <dev/uart/uart_cpu_fdt.h>
 
-#ifdef __aarch64__
-extern bus_space_tag_t fdtbus_bs_tag;
-#endif
-
 /*
  * UART console routines.
  */
@@ -136,9 +132,6 @@ uart_cpu_getdev(int devtype, struct uart
 	char *cp;
 	int err;
 
-	uart_bus_space_mem = fdtbus_bs_tag;
-	uart_bus_space_io = NULL;
-
 	/* Allow overriding the FDT using the environment. */
 	class = &uart_ns8250_class;
 	err = uart_getenv(devtype, di, class);
@@ -195,10 +188,8 @@ uart_cpu_getdev(int devtype, struct uart
 	if (uart_fdt_get_shift(node, &shift) != 0)
 		shift = uart_getregshift(class);
 
-	if (OF_getprop(node, "current-speed", &br, sizeof(br)) <= 0)
+	if (OF_getencprop(node, "current-speed", &br, sizeof(br)) <= 0)
 		br = 0;
-	else
-		br = fdt32_to_cpu(br);
 
 	/*
 	 * Finalize configuration.
@@ -212,5 +203,9 @@ uart_cpu_getdev(int devtype, struct uart
 	di->stopbits = 1;
 	di->parity = UART_PARITY_NONE;
 
-	return (OF_decode_addr(node, 0, &di->bas.bst, &di->bas.bsh, NULL));
+	err = OF_decode_addr(node, 0, &di->bas.bst, &di->bas.bsh, NULL);
+	uart_bus_space_mem = di->bas.bst;
+	uart_bus_space_io = NULL;
+
+	return (err);
 }

Modified: projects/release-pkg/sys/dev/uart/uart_dev_lpc.c
==============================================================================
--- projects/release-pkg/sys/dev/uart/uart_dev_lpc.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/uart/uart_dev_lpc.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 #include <sys/conf.h>
 #include <machine/bus.h>
-#include <machine/fdt.h>
 
 #include <dev/uart/uart.h>
 #include <dev/uart/uart_cpu.h>
@@ -49,9 +48,9 @@ __FBSDID("$FreeBSD$");
 static bus_space_handle_t bsh_clkpwr;
 
 #define	lpc_ns8250_get_clkreg(_bas, _reg)	\
-    bus_space_read_4(fdtbus_bs_tag, bsh_clkpwr, (_reg))
+    bus_space_read_4((_bas)->bst, bsh_clkpwr, (_reg))
 #define	lpc_ns8250_set_clkreg(_bas, _reg, _val)	\
-    bus_space_write_4(fdtbus_bs_tag, bsh_clkpwr, (_reg), (_val))
+    bus_space_write_4((_bas)->bst, bsh_clkpwr, (_reg), (_val))
 
 /*
  * Clear pending interrupts. THRE is cleared by reading IIR. Data
@@ -292,7 +291,7 @@ lpc_ns8250_init(struct uart_bas *bas, in
 	u_long	clkmode;
 	
 	/* Enable UART clock */
-	bus_space_map(fdtbus_bs_tag, LPC_CLKPWR_PHYS_BASE, LPC_CLKPWR_SIZE, 0,
+	bus_space_map(bas->bst, LPC_CLKPWR_PHYS_BASE, LPC_CLKPWR_SIZE, 0,
 	    &bsh_clkpwr);
 	clkmode = lpc_ns8250_get_clkreg(bas, LPC_UART_CLKMODE);
 	lpc_ns8250_set_clkreg(bas, LPC_UART_CLKMODE, clkmode | 

Modified: projects/release-pkg/sys/dev/usb/usb_hid.c
==============================================================================
--- projects/release-pkg/sys/dev/usb/usb_hid.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/usb/usb_hid.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -354,7 +354,8 @@ hid_get_item(struct hid_data *s, struct 
 					/* range check usage count */
 					if (c->loc.count > 255) {
 						DPRINTFN(0, "Number of "
-						    "items truncated to 255\n");
+						    "items(%u) truncated to 255\n",
+						    (unsigned)(c->loc.count));
 						s->ncount = 255;
 					} else
 						s->ncount = c->loc.count;

Modified: projects/release-pkg/sys/dev/usb/usbdevs
==============================================================================
--- projects/release-pkg/sys/dev/usb/usbdevs	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/usb/usbdevs	Tue Feb 23 16:01:34 2016	(r295926)
@@ -835,6 +835,7 @@ product ABOCOM RT2573_4		0xb21e	RT2573
 product ABOCOM RTL8188CU_1	0x8188  RTL8188CU
 product ABOCOM RTL8188CU_2	0x8189  RTL8188CU
 product ABOCOM RTL8192CU	0x8178  RTL8192CU
+product ABOCOM RTL8188EU	0x8179  RTL8188EU
 product ABOCOM WUG2700		0xb21f	WUG2700
 
 /* Acton Research Corp. */

Modified: projects/release-pkg/sys/dev/usb/wlan/if_urtwn.c
==============================================================================
--- projects/release-pkg/sys/dev/usb/wlan/if_urtwn.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/dev/usb/wlan/if_urtwn.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -176,6 +176,7 @@ static const STRUCT_USB_HOST_ID urtwn_de
 	URTWN_DEV(TRENDNET,	RTL8192CU),
 	URTWN_DEV(ZYXEL,	RTL8192CU),
 	/* URTWN_RTL8188E */
+	URTWN_RTL8188E_DEV(ABOCOM,	RTL8188EU),
 	URTWN_RTL8188E_DEV(DLINK,	DWA123D1),
 	URTWN_RTL8188E_DEV(DLINK,	DWA125D1),
 	URTWN_RTL8188E_DEV(ELECOM,	WDC150SU2M),

Modified: projects/release-pkg/sys/powerpc/mpc85xx/mpc85xx.c
==============================================================================
--- projects/release-pkg/sys/powerpc/mpc85xx/mpc85xx.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/powerpc/mpc85xx/mpc85xx.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -157,7 +157,8 @@ law_find_free(void)
 	return (i);
 }
 
-#define	_LAW_SR(trgt,size)	(0x80000000 | (trgt << 20) | (ffsl(size) - 2))
+#define	_LAW_SR(trgt,size)	(0x80000000 | (trgt << 20) | \
+				(flsl(size + (size - 1)) - 2))
 
 int
 law_enable(int trgt, uint64_t bar, uint32_t size)

Modified: projects/release-pkg/sys/riscv/include/atomic.h
==============================================================================
--- projects/release-pkg/sys/riscv/include/atomic.h	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/riscv/include/atomic.h	Tue Feb 23 16:01:34 2016	(r295926)
@@ -399,10 +399,6 @@ atomic_store_rel_64(volatile uint64_t *p
 	*p = val;
 }
 
-#define	atomic_add_acq_int	atomic_add_acq_32
-#define	atomic_clear_acq_int	atomic_clear_acq_32
-#define	atomic_cmpset_acq_int	atomic_cmpset_acq_32
-
 #define	atomic_add_acq_long		atomic_add_acq_64
 #define	atomic_clear_acq_long		atomic_add_acq_64
 #define	atomic_cmpset_acq_long		atomic_cmpset_acq_64

Modified: projects/release-pkg/sys/riscv/riscv/machdep.c
==============================================================================
--- projects/release-pkg/sys/riscv/riscv/machdep.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/riscv/riscv/machdep.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -555,7 +555,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 		tf->tf_ra = (register_t)(sysent->sv_psstrings -
 		    *(sysent->sv_szsigcode));
 
-	CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td, tf->tf_elr,
+	CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td, tf->tf_sepc,
 	    tf->tf_sp);
 
 	PROC_LOCK(p);
@@ -729,9 +729,13 @@ fake_preload_metadata(struct riscv_bootp
 void
 initriscv(struct riscv_bootparams *rvbp)
 {
+	struct mem_region mem_regions[FDT_MEM_REGIONS];
 	vm_offset_t lastaddr;
+	int mem_regions_sz;
 	vm_size_t kernlen;
+	uint32_t memsize;
 	caddr_t kmdp;
+	int i;
 
 	/* Set the module data location */
 	lastaddr = fake_preload_metadata(rvbp);
@@ -752,11 +756,12 @@ initriscv(struct riscv_bootparams *rvbp)
 	/* Load the physical memory ranges */
 	physmap_idx = 0;
 
-	/*
-	 * RISCVTODO: figure out whether platform provides ranges,
-	 * or grab from FDT.
-	 */
-	add_physmap_entry(0, 0x8000000, physmap, &physmap_idx);
+	/* Grab physical memory regions information from device tree. */
+	if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, &memsize) != 0)
+		panic("Cannot get physical memory regions");
+	for (i = 0; i < mem_regions_sz; i++)
+		add_physmap_entry(mem_regions[i].mr_start,
+		    mem_regions[i].mr_size, physmap, &physmap_idx);
 
 	/* Set the pcpu data, this is needed by pmap_bootstrap */
 	pcpup = &__pcpu[0];

Copied: projects/release-pkg/sys/riscv/riscv/stack_machdep.c (from r295925, head/sys/riscv/riscv/stack_machdep.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/release-pkg/sys/riscv/riscv/stack_machdep.c	Tue Feb 23 16:01:34 2016	(r295926, copy of r295925, head/sys/riscv/riscv/stack_machdep.c)
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 2016 Ruslan Bukin <br@bsdpad.com>
+ * All rights reserved.
+ *
+ * Portions of this software were developed by SRI International and the
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
+ * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Portions of this software were developed by the University of Cambridge
+ * Computer Laboratory as part of the CTSRD Project, with support from the
+ * UK Higher Education Innovation Fund (HEIF).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/stack.h>
+
+#include <machine/vmparam.h>
+#include <machine/pcb.h>
+
+void
+stack_save_td(struct stack *st, struct thread *td)
+{
+
+}
+
+int
+stack_save_td_running(struct stack *st, struct thread *td)
+{
+
+	return (EOPNOTSUPP);
+}
+
+void
+stack_save(struct stack *st)
+{
+
+}

Modified: projects/release-pkg/sys/riscv/riscv/timer.c
==============================================================================
--- projects/release-pkg/sys/riscv/riscv/timer.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/riscv/riscv/timer.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -145,8 +145,9 @@ riscv_tmr_intr(void *arg)
 
 	/*
 	 * Clear interrupt pending bit.
-	 * Note sip register is unimplemented in Spike simulator,
-	 * so use machine command to clear in mip.
+	 * Note: SIP_STIP bit is not implemented in sip register
+	 * in Spike simulator, so use machine command to clear
+	 * interrupt pending bit in mip.
 	 */
 	machine_command(ECALL_CLEAR_PENDING, 0);
 

Modified: projects/release-pkg/sys/riscv/riscv/trap.c
==============================================================================
--- projects/release-pkg/sys/riscv/riscv/trap.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/sys/riscv/riscv/trap.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -270,6 +270,17 @@ do_trap_supervisor(struct trapframe *fra
 	case EXCP_INSTR_ACCESS_FAULT:
 		data_abort(frame, 0);
 		break;
+	case EXCP_INSTR_BREAKPOINT:
+#ifdef KDB
+		kdb_trap(exception, 0, frame);
+#else
+		dump_regs(frame);
+		panic("No debugger in kernel.\n");
+#endif
+	case EXCP_INSTR_ILLEGAL:
+		dump_regs(frame);
+		panic("Illegal instruction at %x\n", frame->tf_sepc);
+		break;
 	default:
 		dump_regs(frame);
 		panic("Unknown kernel exception %x badaddr %lx\n",
@@ -281,6 +292,10 @@ void
 do_trap_user(struct trapframe *frame)
 {
 	uint64_t exception;
+	struct thread *td;
+
+	td = curthread;
+	td->td_frame = frame;
 
 	exception = (frame->tf_scause & EXCP_MASK);
 	if (frame->tf_scause & EXCP_INTR) {
@@ -302,6 +317,14 @@ do_trap_user(struct trapframe *frame)
 		frame->tf_sepc += 4;	/* Next instruction */
 		svc_handler(frame);
 		break;
+	case EXCP_INSTR_ILLEGAL:
+		call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)frame->tf_sepc);
+		userret(td, frame);
+		break;
+	case EXCP_INSTR_BREAKPOINT:
+		call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_sepc);
+		userret(td, frame);
+		break;
 	default:
 		dump_regs(frame);
 		panic("Unknown userland exception %x badaddr %lx\n",

Modified: projects/release-pkg/usr.sbin/iostat/iostat.c
==============================================================================
--- projects/release-pkg/usr.sbin/iostat/iostat.c	Tue Feb 23 15:28:13 2016	(r295925)
+++ projects/release-pkg/usr.sbin/iostat/iostat.c	Tue Feb 23 16:01:34 2016	(r295926)
@@ -797,7 +797,7 @@ devstats(int perf_select, long double et
 	long double total_mb, blocks_per_second, total_duration;
 	long double ms_per_other, ms_per_read, ms_per_write, ms_per_transaction;
 	int firstline = 1;
-	char *devname;
+	char *devicename;
 
 	if (xflag > 0) {
 		printf("                        extended device statistics  ");
@@ -871,7 +871,7 @@ devstats(int perf_select, long double et
 		}
 
 		if (xflag > 0) {
-			if (asprintf(&devname, "%s%d",
+			if (asprintf(&devicename, "%s%d",
 			    cur.dinfo->devices[di].device_name,
 			    cur.dinfo->devices[di].unit_number) == -1)
 				err(1, "asprintf");
@@ -887,7 +887,7 @@ devstats(int perf_select, long double et
 					printf("%-8.8s %5d %5d %8.1Lf "
 					    "%8.1Lf %5d %5d %5d %5d "
 					    "%4" PRIu64 " %3.0Lf ",
-					    devname,
+					    devicename,
 					    (int)transfers_per_second_read,
 					    (int)transfers_per_second_write,
 					    mb_per_second_read * 1024,
@@ -900,7 +900,7 @@ devstats(int perf_select, long double et
 					printf("%-8.8s %11.1Lf %11.1Lf "
 					    "%12.1Lf %12.1Lf %4" PRIu64
 					    " %10.1Lf %9.1Lf ",
-					    devname,
+					    devicename,
 					    (long double)total_transfers_read,
 					    (long double)total_transfers_write,
 					    (long double)
@@ -925,7 +925,7 @@ devstats(int perf_select, long double et
 				}
 				printf("\n");
 			}
-			free(devname);
+			free(devicename);
 		} else if (oflag > 0) {
 			int msdig = (ms_per_transaction < 100.0) ? 1 : 0;
 
@@ -979,15 +979,15 @@ static void
 cpustats(void)
 {
 	int state;
-	double time;
+	double cptime;
 
-	time = 0.0;

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602231601.u1NG1YTE044602>