CVS commit: src/sys/kern

2014-04-13 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Mon Apr 14 05:39:19 UTC 2014

Modified Files:
src/sys/kern: kern_exec.c

Log Message:
copyinargs: Replace a hand-written string copy loop with strlcpy(3).  Carefully
reuse return value of strlcpy(3) to iterate.


To generate a diff of this commit:
cvs rdiff -u -r1.393 -r1.394 src/sys/kern/kern_exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.393 src/sys/kern/kern_exec.c:1.394
--- src/sys/kern/kern_exec.c:1.393	Sun Apr 13 12:11:01 2014
+++ src/sys/kern/kern_exec.c	Mon Apr 14 05:39:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.393 2014/04/13 12:11:01 uebayasi Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.394 2014/04/14 05:39:19 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.393 2014/04/13 12:11:01 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.394 2014/04/14 05:39:19 uebayasi Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -1408,8 +1408,6 @@ copyinargs(struct execve_data * restrict
 
 	dp = *dpp;
 
-	/* XXX -- THE FOLLOWING SECTION NEEDS MAJOR CLEANUP */
-
 	data->ed_argc = 0;
 
 	/* copy the fake args list, if there's one, freeing it as we go */
@@ -1417,14 +1415,17 @@ copyinargs(struct execve_data * restrict
 		struct exec_fakearg	*tmpfap = epp->ep_fa;
 
 		while (tmpfap->fa_arg != NULL) {
-			const char *cp;
+			const size_t maxlen = ARG_MAX - (dp - data->ed_argp);
+			size_t len;
 
-			/* XXX boudary check */
-			cp = tmpfap->fa_arg;
-			while (*cp)
-*dp++ = *cp++;
-			*dp++ = '\0';
-			ktrexecarg(tmpfap->fa_arg, cp - tmpfap->fa_arg);
+			len = strlcpy(dp, tmpfap->fa_arg, maxlen);
+			/* Count NUL into len. */
+			if (len < maxlen)
+len++;
+			else
+len = maxlen;
+			ktrexecarg(tmpfap->fa_arg, len - 1);
+			dp += len;
 
 			kmem_free(tmpfap->fa_arg, tmpfap->fa_len);
 			tmpfap++;
@@ -1487,7 +1488,7 @@ copyinargstrs(struct execve_data * restr
 
 	i = 0;
 	while (1) {
-		const size_t maxlen = data->ed_argp + ARG_MAX - dp;
+		const size_t maxlen = ARG_MAX - (dp - data->ed_argp);
 		size_t len;
 
 		if ((error = (*fetch_element)(strs, i, &sp)) != 0) {



CVS commit: src/sys/dev/acpi

2014-04-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Apr 14 01:56:18 UTC 2014

Modified Files:
src/sys/dev/acpi: acpi_pci_link.c

Log Message:
don't run off the end of the source resource buffer


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/acpi/acpi_pci_link.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_pci_link.c
diff -u src/sys/dev/acpi/acpi_pci_link.c:1.20 src/sys/dev/acpi/acpi_pci_link.c:1.21
--- src/sys/dev/acpi/acpi_pci_link.c:1.20	Wed Oct 16 17:31:28 2013
+++ src/sys/dev/acpi/acpi_pci_link.c	Mon Apr 14 01:56:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_pci_link.c,v 1.20 2013/10/16 17:31:28 christos Exp $	*/
+/*	$NetBSD: acpi_pci_link.c,v 1.21 2014/04/14 01:56:18 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2002 Mitsuru IWASAKI 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.20 2013/10/16 17:31:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.21 2014/04/14 01:56:18 jakllsch Exp $");
 
 #include 
 #include 
@@ -1262,7 +1262,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b
 	}
 
 	/* Insert the new resource. */
-	memcpy(rp, res, res->Length + ACPI_RS_SIZE_NO_DATA);
+	memcpy(rp, res, res->Length);
 
 	/* And add the terminator. */
 	rp = ACPI_NEXT_RESOURCE(rp);



CVS commit: src/tests/lib/libexecinfo

2014-04-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Apr 13 20:58:26 UTC 2014

Modified Files:
src/tests/lib/libexecinfo: t_backtrace.c

Log Message:
Bail out if backtrace(3) failed.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libexecinfo/t_backtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libexecinfo/t_backtrace.c
diff -u src/tests/lib/libexecinfo/t_backtrace.c:1.13 src/tests/lib/libexecinfo/t_backtrace.c:1.14
--- src/tests/lib/libexecinfo/t_backtrace.c:1.13	Tue Mar 11 13:43:23 2014
+++ src/tests/lib/libexecinfo/t_backtrace.c	Sun Apr 13 20:58:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_backtrace.c,v 1.13 2014/03/11 13:43:23 joerg Exp $	*/
+/*	$NetBSD: t_backtrace.c,v 1.14 2014/04/13 20:58:26 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_backtrace.c,v 1.13 2014/03/11 13:43:23 joerg Exp $");
+__RCSID("$NetBSD: t_backtrace.c,v 1.14 2014/04/13 20:58:26 joerg Exp $");
 
 #include 
 #include 
@@ -79,6 +79,7 @@ myfunc3(size_t ncalls)
 		++max_frames;
 	}
 	nptrs = backtrace(buffer, __arraycount(buffer));
+	ATF_REQUIRE(nptrs != (size_t)-1);
 	strings = backtrace_symbols_fmt(buffer, nptrs, "%n");
 
 	ATF_CHECK(strings != NULL);



CVS commit: src/sys/arch/evbarm/conf

2014-04-13 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Apr 13 20:47:20 UTC 2014

Added Files:
src/sys/arch/evbarm/conf: ODROID-U

Log Message:
Split off Odroid-U* kernel from combined config file


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/ODROID-U

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/evbarm/conf/ODROID-U
diff -u /dev/null src/sys/arch/evbarm/conf/ODROID-U:1.1
--- /dev/null	Sun Apr 13 20:47:20 2014
+++ src/sys/arch/evbarm/conf/ODROID-U	Sun Apr 13 20:47:20 2014
@@ -0,0 +1,233 @@
+#
+#	$NetBSD: ODROID-U,v 1.1 2014/04/13 20:47:20 reinoud Exp $
+#
+#	ODROID-U -- ODROID-U series Exynos Kernel
+#
+
+include	"arch/evbarm/conf/std.odroid"
+
+# estimated number of users
+
+maxusers	32
+
+# Standard system options
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+#options 	NTP		# NTP phase/frequency locked loop
+
+# CPU options
+options 	CPU_CORTEX
+options 	CPU_CORTEXA9
+options 	EXYNOS4120
+options 	EXYNOS4212
+options 	EXYNOS4412
+options 	EXYNOS4412P
+#options 	MULTIPROCESSOR
+options 	PMAPCOUNTERS
+options 	BUSDMA_COUNTERS
+options 	EXYNOS_CONSOLE_EARLY
+options		ARM_TRUSTZONE_FIRMWARE
+options 	UVMHIST
+#options 	UVMHIST_PRINT,KERNHIST_DELAY=0
+options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
+options 	PMAP_NEED_ALLOC_POOLPAGE
+
+# Specify the memory size in megabytes (optional).
+#options 	MEMSIZE=2048
+
+# File systems
+file-system	FFS		# UFS
+#file-system	LFS		# log-structured file system
+file-system	MFS		# memory file system
+file-system	NFS		# Network file system
+#file-system 	ADOSFS		# AmigaDOS-compatible file system
+#file-system 	EXT2FS		# second extended file system (linux)
+#file-system	CD9660		# ISO 9660 + Rock Ridge file system
+file-system	MSDOSFS		# MS-DOS file system
+#file-system	FDESC		# /dev/fd
+file-system	KERNFS		# /kern
+#file-system	NULLFS		# loopback file system
+file-system	PROCFS		# /proc
+#file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
+#file-system	UMAPFS		# NULLFS + uid and gid remapping
+#file-system	UNION		# union file system
+file-system	TMPFS		# memory file system
+file-system	PTYFS		# /dev/pts/N support
+
+# File system options
+#options 	QUOTA		# legacy UFS quotas
+#options 	QUOTA2		# new, in-filesystem UFS quotas
+#options 	FFS_EI		# FFS Endian Independent support
+#options 	NFSSERVER
+options 	WAPBL		# File system journaling support
+#options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+
+# Networking options
+
+#options 	GATEWAY		# packet forwarding
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
+#options 	IPSEC		# IP security
+#options 	IPSEC_DEBUG	# debug for IP security
+#options 	MROUTING	# IP multicast routing
+#options 	PIM		# Protocol Independent Multicast
+#options 	NETATALK	# AppleTalk networking
+#options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
+#options 	PPP_DEFLATE	# Deflate compression support for PPP
+#options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
+#options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
+
+options 	NFS_BOOT_BOOTP
+options 	NFS_BOOT_DHCP
+#options		NFS_BOOT_BOOTSTATIC
+#options		NFS_BOOTSTATIC_MYIP="\"192.168.1.4\""
+#options		NFS_BOOTSTATIC_GWIP="\"192.168.1.1\""
+#options		NFS_BOOTSTATIC_MASK="\"255.255.255.0\""
+#options		NFS_BOOTSTATIC_SERVADDR="\"192.168.1.1\""
+#options		NFS_BOOTSTATIC_SERVER="\"192.168.1.1:/nfs/sdp2430\""
+
+options		NFS_BOOT_RWSIZE=1024
+
+# Compatibility options
+
+#options 	COMPAT_43	# 4.3BSD compatibility.
+options 	COMPAT_60	# NetBSD 6.0 compatibility.
+options 	COMPAT_50	# NetBSD 5.0 compatibility.
+options 	COMPAT_40	# NetBSD 4.0 compatibility.
+options 	COMPAT_30	# NetBSD 3.0 compatibility.
+#options 	COMPAT_20	# NetBSD 2.0 compatibility.
+#options 	COMPAT_16	# NetBSD 1.6 compatibility.
+#options 	COMPAT_15	# NetBSD 1.5 compatibility.
+#options 	COMPAT_14	# NetBSD 1.4 compatibility.
+#options 	COMPAT_13	# NetBSD 1.3 compatibility.
+#options 	COMPAT_12	# NetBSD 1.2 compatibility.
+#options 	COMPAT_11	# NetBSD 1.1 compatibility.
+#options 	COMPAT_10	# NetBSD 1.0 compatibility.
+#options 	COMPAT_09	# NetBSD 0.9 compatibility.
+#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
+#options		COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
+
+# Shared memory options
+
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+
+# Device options
+
+#options 	MEMORY_DISK_HOOKS	# boottime setup of ramdisk
+#options 	MEMORY_DISK_ROOT_SIZE=8192	# Size in blocks
+#options 	MEMORY_DISK_DYNAMIC
+#options 	MINIROOTSIZE=1000	# Size in blocks
+#options 	MEMORY_DISK_IS_ROOT	# use memory disk as root
+
+options 	DKWEDGE_AUTODISCOVER
+options 	DKWEDGE_METHOD_GPT
+
+# Miscellaneous kernel options
+options 	KTRACE		# system call tracing, a la ktrace(1)
+#options 	KMEMSTATS	# kern

CVS commit: src/sys/arch/arm/samsung

2014-04-13 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Apr 13 20:52:29 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos_soc.c

Log Message:
Remove unused code snippet


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_soc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.3 src/sys/arch/arm/samsung/exynos_soc.c:1.4
--- src/sys/arch/arm/samsung/exynos_soc.c:1.3	Sun Apr 13 20:49:36 2014
+++ src/sys/arch/arm/samsung/exynos_soc.c	Sun Apr 13 20:52:29 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.3 2014/04/13 20:49:36 reinoud Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.4 2014/04/13 20:52:29 reinoud Exp $	*/
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #define	_ARM32_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.3 2014/04/13 20:49:36 reinoud Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.4 2014/04/13 20:52:29 reinoud Exp $");
 
 #include 
 #include 
@@ -121,16 +121,7 @@ exynos_do_idle(void)
 int
 exynos_set_cpu_boot_addr(int cpu, vaddr_t boot_addr)
 {
-#if 0
 	/* XXX we need to map in iRAM space for this XXX */
-void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c;
-
-if (!soc_is_exynos5420())
-boot_reg += 4 * cpu;
-
-writel_relaxed(boot_addr, boot_reg);
-return 0;
-#endif
 	return 0;
 }
 



CVS commit: src/sys/arch/evbarm/odroid

2014-04-13 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Apr 13 20:53:35 UTC 2014

Modified Files:
src/sys/arch/evbarm/odroid: odroid_machdep.c

Log Message:
Remove old trustzone headerfile inclusion


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/odroid/odroid_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/odroid/odroid_machdep.c
diff -u src/sys/arch/evbarm/odroid/odroid_machdep.c:1.3 src/sys/arch/evbarm/odroid/odroid_machdep.c:1.4
--- src/sys/arch/evbarm/odroid/odroid_machdep.c:1.3	Sun Apr 13 20:45:25 2014
+++ src/sys/arch/evbarm/odroid/odroid_machdep.c	Sun Apr 13 20:53:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: odroid_machdep.c,v 1.3 2014/04/13 20:45:25 reinoud Exp $ */
+/*	$NetBSD: odroid_machdep.c,v 1.4 2014/04/13 20:53:35 reinoud Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.3 2014/04/13 20:45:25 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.4 2014/04/13 20:53:35 reinoud Exp $");
 
 #include "opt_evbarm_boardtype.h"
 #include "opt_exynos.h"
@@ -76,9 +76,6 @@ __KERNEL_RCSID(0, "$NetBSD: odroid_machd
 #include 
 #include 
 #include 
-#ifdef ARM_TRUSTZONE_FIRMWARE
-#include 
-#endif
 #include 
 
 #include 



CVS commit: src/sys/arch/arm/samsung

2014-04-13 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Apr 13 20:49:36 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos_soc.c

Log Message:
Remove old trustzone headerfile inclusion


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_soc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.2 src/sys/arch/arm/samsung/exynos_soc.c:1.3
--- src/sys/arch/arm/samsung/exynos_soc.c:1.2	Sun Apr 13 20:45:25 2014
+++ src/sys/arch/arm/samsung/exynos_soc.c	Sun Apr 13 20:49:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.2 2014/04/13 20:45:25 reinoud Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.3 2014/04/13 20:49:36 reinoud Exp $	*/
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #define	_ARM32_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.2 2014/04/13 20:45:25 reinoud Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.3 2014/04/13 20:49:36 reinoud Exp $");
 
 #include 
 #include 
@@ -49,9 +49,6 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_soc.c
 
 #include 
 #include 
-#ifdef ARM_TRUSTZONE_FIRMWARE
-#include 
-#endif
 
 #include 
 #include 



CVS commit: src/sys/arch

2014-04-13 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Apr 13 20:45:25 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos_soc.c exynos_var.h files.exynos
src/sys/arch/evbarm/odroid: odroid_machdep.c

Log Message:
Remove trustzone firmware indirect calls by explicit calling the exynos
routines in exynos_soc.c

While here, also remove unused variable conaddr


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_soc.c \
src/sys/arch/arm/samsung/files.exynos
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_var.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/odroid/odroid_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.1 src/sys/arch/arm/samsung/exynos_soc.c:1.2
--- src/sys/arch/arm/samsung/exynos_soc.c:1.1	Sun Apr 13 02:26:26 2014
+++ src/sys/arch/arm/samsung/exynos_soc.c	Sun Apr 13 20:45:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.1 2014/04/13 02:26:26 matt Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.2 2014/04/13 20:45:25 reinoud Exp $	*/
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #define	_ARM32_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.1 2014/04/13 02:26:26 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.2 2014/04/13 20:45:25 reinoud Exp $");
 
 #include 
 #include 
@@ -112,7 +112,7 @@ static struct consdev exynos_earlycons =
 
 
 #ifdef ARM_TRUSTZONE_FIRMWARE
-static int
+int
 exynos_do_idle(void)
 {
 exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
@@ -121,10 +121,11 @@ exynos_do_idle(void)
 }
 
 
-static int
+int
 exynos_set_cpu_boot_addr(int cpu, vaddr_t boot_addr)
 {
 #if 0
+	/* XXX we need to map in iRAM space for this XXX */
 void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c;
 
 if (!soc_is_exynos5420())
@@ -137,7 +138,7 @@ exynos_set_cpu_boot_addr(int cpu, vaddr_
 }
 
 
-static int
+int
 exynos_cpu_boot(int cpu)
 {
 	exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
@@ -155,11 +156,11 @@ exynos_cpu_boot(int cpu)
  * Exynos4412, but why?
  */
 
-static int
+int
 exynos_l2cc_init(void)
 {
 	const uint32_t tag_latency  = 0x110;
-	const uint32_t data_latency = IS_EXYNOS4410 ? 0x110 : 0x120;
+	const uint32_t data_latency = IS_EXYNOS4410_P() ? 0x110 : 0x120;
 	const uint32_t prefetch4412   = /* 0111 0001      0111 */
 PREFETCHCTL_DBLLINEF_EN  |
 PREFETCHCTL_INSTRPREF_EN |
@@ -198,7 +199,7 @@ exynos_l2cc_init(void)
 	KASSERT(aux_val == 0x7C470001);
 	KASSERT(aux_keepmask== 0xC200);
 
-	if (IS_EXYNOS4412_R0)
+	if (IS_EXYNOS4412_R0_P())
 		prefetch = prefetch4412_r0;
 	else
 		prefetch = prefetch4412;	/* newer than >= r1_0 */
@@ -213,15 +214,9 @@ exynos_l2cc_init(void)
 
 	return 0;
 }
-
-static struct trustzone_firmware_handlers exynos_firmware_handlers = {
-	.do_idle   = exynos_do_idle,
-	.set_cpu_boot_addr = exynos_set_cpu_boot_addr,
-	.cpu_boot  = exynos_cpu_boot,
-	.l2cc_init = exynos_l2cc_init
-};
 #endif /* ARM_TRUSTZONE_FIRMWARE */
 
+
 void
 exynos_bootstrap(vaddr_t iobase, vaddr_t uartbase)
 {
@@ -242,10 +237,6 @@ exynos_bootstrap(vaddr_t iobase, vaddr_t
 			__func__, error);
 	KASSERT(exynos_core_bsh == iobase);
 #endif
-#ifdef ARM_TRUSTZONE_FIRMWARE
-	/* setup trustzone handlers */
-	trustzone_firmware_handlers = &exynos_firmware_handlers;
-#endif
 }
 
 
Index: src/sys/arch/arm/samsung/files.exynos
diff -u src/sys/arch/arm/samsung/files.exynos:1.1 src/sys/arch/arm/samsung/files.exynos:1.2
--- src/sys/arch/arm/samsung/files.exynos:1.1	Sun Apr 13 02:26:26 2014
+++ src/sys/arch/arm/samsung/files.exynos	Sun Apr 13 20:45:25 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.exynos,v 1.1 2014/04/13 02:26:26 matt Exp $
+#	$NetBSD: files.exynos,v 1.2 2014/04/13 20:45:25 reinoud Exp $
 #
 # Configuration info for Samsung Exynos SoC ARM Peripherals
 #
@@ -17,7 +17,6 @@ file	arch/arm/samsung/exynos_soc.c
 file	arch/arm/samsung/exynos_space.c
 #file	arch/arm/samsung/primecell.c
 file	arch/arm/samsung/exynos_smc.S		arm_trustzone_firmware
-file	arch/arm/trustzone/firmware.c		arm_trustzone_firmware
 
 file	arch/arm/arm/bus_space_a4x.S		exyo
 

Index: src/sys/arch/arm/samsung/exynos_var.h
diff -u src/sys/arch/arm/samsung/exynos_var.h:1.2 src/sys/arch/arm/samsung/exynos_var.h:1.3
--- src/sys/arch/arm/samsung/exynos_var.h:1.2	Sun Apr 13 17:06:02 2014
+++ src/sys/arch/arm/samsung/exynos_var.h	Sun Apr 13 20:45:25 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_var.h,v 1.2 2014/04/13 17:06:02 reinoud Exp $ */
+/* $NetBSD: exynos_var.h,v 1.3 2014/04/13 20:45:25 reinoud Exp $ */
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -102,9 +102,17 @@ extern struct bus_space exynos_bs_tag;
 extern struct bus_space exynos_a4x_bs_tag;
 extern bus_space_handle_t exynos_co

CVS commit: src/sys/lib/libunwind

2014-04-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Apr 13 19:04:02 UTC 2014

Modified Files:
src/sys/lib/libunwind: Registers.hpp libunwind.cxx

Log Message:
Move definition of what the native register layout is into
Registers.hpp.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/lib/libunwind/Registers.hpp
cvs rdiff -u -r1.7 -r1.8 src/sys/lib/libunwind/libunwind.cxx

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.8 src/sys/lib/libunwind/Registers.hpp:1.9
--- src/sys/lib/libunwind/Registers.hpp:1.8	Wed Apr  2 22:34:29 2014
+++ src/sys/lib/libunwind/Registers.hpp	Sun Apr 13 19:04:01 2014
@@ -518,6 +518,21 @@ private:
   uint32_t reg[REGNO_SH3_PR + 1];
 };
 
+#if __i386__
+typedef Registers_x86 NativeUnwindRegisters;
+#elif __x86_64__
+typedef Registers_x86_64 NativeUnwindRegisters;
+#elif __powerpc__
+typedef Registers_ppc32 NativeUnwindRegisters;
+#elif __arm__ && !defined(__ARM_EABI__)
+typedef Registers_arm32 NativeUnwindRegisters;
+#elif __vax__
+typedef Registers_vax NativeUnwindRegisters;
+#elif __m68k__
+typedef Registers_M68K NativeUnwindRegisters;
+#elif __sh3__
+typedef Registers_SH3 NativeUnwindRegisters;
+#endif
 } // namespace _Unwind
 
 #endif // __REGISTERS_HPP__

Index: src/sys/lib/libunwind/libunwind.cxx
diff -u src/sys/lib/libunwind/libunwind.cxx:1.7 src/sys/lib/libunwind/libunwind.cxx:1.8
--- src/sys/lib/libunwind/libunwind.cxx:1.7	Wed Apr  2 22:34:29 2014
+++ src/sys/lib/libunwind/libunwind.cxx	Sun Apr 13 19:04:01 2014
@@ -17,30 +17,12 @@
 
 using namespace _Unwind;
 
-#if __i386__
-typedef Registers_x86 ThisUnwindRegisters;
-#elif __x86_64__
-typedef Registers_x86_64 ThisUnwindRegisters;
-#elif __powerpc__
-typedef Registers_ppc32 ThisUnwindRegisters;
-#elif __arm__ && !defined(__ARM_EABI__)
-typedef Registers_arm32 ThisUnwindRegisters;
-#elif __vax__
-typedef Registers_vax ThisUnwindRegisters;
-#elif __m68k__
-typedef Registers_M68K ThisUnwindRegisters;
-#elif __sh3__
-typedef Registers_SH3 ThisUnwindRegisters;
-#else
-#error Unsupported architecture
-#endif
-
-typedef CFI_Parser MyCFIParser;
+typedef CFI_Parser MyCFIParser;
 
 // Internal object representing the address space of this process.
 static LocalAddressSpace sThisAddressSpace(MyCFIParser::findPCRange);
 
-typedef UnwindCursor ThisUnwindCursor;
+typedef UnwindCursor ThisUnwindCursor;
 
 static _Unwind_Reason_Code unwind_phase1(ThisUnwindCursor &cursor,
  struct _Unwind_Exception *exc) {
@@ -205,7 +187,7 @@ static _Unwind_Reason_Code unwind_phase2
 }
 
 _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *exc) {
-  ThisUnwindRegisters registers;
+  NativeUnwindRegisters registers;
   ThisUnwindCursor cursor1(registers, sThisAddressSpace);
   ThisUnwindCursor cursor2(registers, sThisAddressSpace);
 
@@ -224,7 +206,7 @@ _Unwind_Reason_Code _Unwind_RaiseExcepti
 
 _Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *exc,
  _Unwind_Stop_Fn stop, void *stop_arg) {
-  ThisUnwindRegisters registers;
+  NativeUnwindRegisters registers;
   ThisUnwindCursor cursor(registers, sThisAddressSpace);
 
   // Mark this as forced unwind for _Unwind_Resume().
@@ -235,7 +217,7 @@ _Unwind_Reason_Code _Unwind_ForcedUnwind
 }
 
 void _Unwind_Resume(struct _Unwind_Exception *exc) {
-  ThisUnwindRegisters registers;
+  NativeUnwindRegisters registers;
   ThisUnwindCursor cursor(registers, sThisAddressSpace);
 
   if (exc->private_1 != 0)
@@ -310,7 +292,7 @@ uintptr_t _Unwind_GetLanguageSpecificDat
 }
 
 _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
-  ThisUnwindRegisters registers;
+  NativeUnwindRegisters registers;
   ThisUnwindCursor cursor(registers, sThisAddressSpace);
   cursor.setInfoBasedOnIPRegister();
 
@@ -336,7 +318,7 @@ uintptr_t _Unwind_GetCFA(struct _Unwind_
 }
 
 void *_Unwind_FindEnclosingFunction(void *pc) {
-  ThisUnwindRegisters registers;
+  NativeUnwindRegisters registers;
   ThisUnwindCursor cursor(registers, sThisAddressSpace);
 
   unw_proc_info_t info;



CVS commit: src/distrib/sets/lists/debug

2014-04-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Apr 13 17:13:27 UTC 2014

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
The ctf tools are controlled by MKCTF now. Mark the debug files
accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/distrib/sets/lists/debug/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.56 src/distrib/sets/lists/debug/mi:1.57
--- src/distrib/sets/lists/debug/mi:1.56	Thu Apr 10 00:09:09 2014
+++ src/distrib/sets/lists/debug/mi	Sun Apr 13 17:13:27 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.56 2014/04/10 00:09:09 pooka Exp $
+# $NetBSD: mi,v 1.57 2014/04/13 17:13:27 skrll Exp $
 
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib
@@ -469,9 +469,9 @@
 ./usr/libdata/debug/usr/bin/crunchide.debug	comp-c-debug		debug
 ./usr/libdata/debug/usr/bin/csplit.debug	comp-c-debug		debug
 ./usr/libdata/debug/usr/bin/ctags.debug		comp-c-debug		debug
-./usr/libdata/debug/usr/bin/ctfconvert.debug	comp-util-debug		dtrace,debug
-./usr/libdata/debug/usr/bin/ctfdump.debug	comp-util-debug		dtrace,debug
-./usr/libdata/debug/usr/bin/ctfmerge.debug	comp-util-debug		dtrace,debug
+./usr/libdata/debug/usr/bin/ctfconvert.debug	comp-util-debug		ctf,debug
+./usr/libdata/debug/usr/bin/ctfdump.debug	comp-util-debug		ctf,debug
+./usr/libdata/debug/usr/bin/ctfmerge.debug	comp-util-debug		ctf,debug
 ./usr/libdata/debug/usr/bin/cut.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/cvs.debug		comp-cvs-debug		cvs,debug
 ./usr/libdata/debug/usr/bin/db.debug		comp-util-debug		debug



CVS commit: src/sys/arch/arm/samsung

2014-04-13 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Apr 13 17:06:03 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos_var.h

Log Message:
Redefine IS_EXYNOS4_P() to check for the product family instead of summing up
variants


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/samsung/exynos_var.h
diff -u src/sys/arch/arm/samsung/exynos_var.h:1.1 src/sys/arch/arm/samsung/exynos_var.h:1.2
--- src/sys/arch/arm/samsung/exynos_var.h:1.1	Sun Apr 13 02:26:26 2014
+++ src/sys/arch/arm/samsung/exynos_var.h	Sun Apr 13 17:06:02 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_var.h,v 1.1 2014/04/13 02:26:26 matt Exp $ */
+/* $NetBSD: exynos_var.h,v 1.2 2014/04/13 17:06:02 reinoud Exp $ */
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -58,7 +58,8 @@ extern uint32_t exynos_pop_id;
 #define IS_EXYNOS4412_R0_P() \
 			((EXYNOS_PRODUCT_ID(exynos_soc_id) == 0xe4412) && \
 			 (EXYNOS_PRODUCT_REV(exynos_soc_id) == 0))
-#define IS_EXYNOS4_P()	(IS_EXYNOS4410 || IS_EXYNOS4412)
+
+#define IS_EXYNOS4_P()	(EXYNOS_PRODUCT_FAMILY(exynos_soc_id) == EXYNOS4_PRODUCT_FAMILY)
 
 #define IS_EXYNOS5410_P()	(EXYNOS_PRODUCT_ID(exynos_soc_id) == 0xe5410)
 #define IS_EXYNOS5440_P()	(EXYNOS_PRODUCT_ID(exynos_soc_id) == 0xe5440)



CVS commit: src/sys/arch/hp300/stand

2014-04-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Apr 13 15:45:27 UTC 2014

Modified Files:
src/sys/arch/hp300/stand: Makefile.buildboot
src/sys/arch/hp300/stand/common: ite.c itevar.h
Added Files:
src/sys/arch/hp300/stand/common: ite_sti.c

Log Message:
Add sti(4) at sgc screen console support.  From (the late) OpenBSD/hp300.

Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hp300/stand/common/ite.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/hp300/stand/common/ite_sti.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hp300/stand/common/itevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hp300/stand/Makefile.buildboot
diff -u src/sys/arch/hp300/stand/Makefile.buildboot:1.33 src/sys/arch/hp300/stand/Makefile.buildboot:1.34
--- src/sys/arch/hp300/stand/Makefile.buildboot:1.33	Sun Jan 12 15:26:29 2014
+++ src/sys/arch/hp300/stand/Makefile.buildboot	Sun Apr 13 15:45:26 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.buildboot,v 1.33 2014/01/12 15:26:29 tsutsui Exp $
+#	$NetBSD: Makefile.buildboot,v 1.34 2014/04/13 15:45:26 tsutsui Exp $
 
 # RELOC=FFF0 allows for boot prog up to FF000 (1044480) bytes long
 RELOC=	FFF0
@@ -59,6 +59,7 @@ COMMONSOURCE=		srt0.S autoconf.c clock.c
 DRIVERSOURCE=		apci.c ct.c dca.c dcm.c dnkbd.c fhpib.c hil.c \
 			hpib.c if_le.c ite.c ite_dumb.c ite_dv.c ite_gb.c \
 			ite_hy.c ite_rb.c ite_subr.c ite_tc.c ite_tvrx.c \
+			ite_sti.c \
 			kbd.c kbdconf.c nhpib.c rd.c scsi.c sd.c
 
 .include 

Index: src/sys/arch/hp300/stand/common/ite.c
diff -u src/sys/arch/hp300/stand/common/ite.c:1.16 src/sys/arch/hp300/stand/common/ite.c:1.17
--- src/sys/arch/hp300/stand/common/ite.c:1.16	Sat Feb 12 05:08:40 2011
+++ src/sys/arch/hp300/stand/common/ite.c	Sun Apr 13 15:45:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.16 2011/02/12 05:08:40 tsutsui Exp $	*/
+/*	$NetBSD: ite.c,v 1.17 2014/04/13 15:45:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -49,6 +49,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -60,6 +62,8 @@ static void iteconfig(void);
 static void ite_clrtoeol(struct ite_data *, struct itesw *, int, int);
 static void itecheckwrap(struct ite_data *, struct itesw *);
 
+#define GID_STI		0x100	/* any value which is not a DIO fb, really */
+
 struct itesw itesw[] = {
 	{ GID_TOPCAT,
 	topcat_init,	ite_dio_clear,	ite_dio_putc8bpp,
@@ -104,6 +108,10 @@ struct itesw itesw[] = {
 	{ GID_A147xVGA,
 	dumb_init,	dumb_clear,	dumb_putc,
 	dumb_cursor,	dumb_scroll },
+
+	{ GID_STI,
+	sti_iteinit_sgc, sti_clear,	sti_putc,
+	sti_cursor,	sti_scroll },
 };
 int	nitesw = sizeof(itesw) / sizeof(itesw[0]);
 
@@ -118,7 +126,8 @@ int	ite_scode[NITE] = { 0 };
 static void
 iteconfig(void)
 {
-	int dtype, fboff, i;
+	int dtype, fboff, slotno, i;
+	uint8_t *va;
 	struct hp_hw *hw;
 	struct grfreg *gr;
 	struct ite_data *ip;
@@ -165,6 +174,50 @@ iteconfig(void)
 		ip->alive = 1;
 		i++;
 	}
+
+	/*
+	 * Now probe for SGC frame buffers.
+	 */
+	switch (machineid) {
+	case HP_400:
+	case HP_425:
+	case HP_433:
+		break;
+	default:
+		return;
+	}
+
+	/* SGC frame buffers can only be STI... */
+	for (dtype = 0; dtype < __arraycount(itesw); dtype++) {
+		if (itesw[dtype].ite_hwid == GID_STI)
+			break;
+	}
+	if (dtype == __arraycount(itesw))
+		return;
+
+	for (slotno = 0; slotno < SGC_NSLOTS; slotno++) {
+		va = (uint8_t *)IIOV(SGC_BASE + (slotno * SGC_DEVSIZE));
+
+		/* Check to see if hardware exists. */
+		if (badaddr(va) != 0)
+			continue;
+
+		/* Check hardware. */
+		if (va[3] == STI_DEVTYPE1) {
+			if (i >= NITE)
+break;
+			ip = &ite_data[i];
+			ip->scode = slotno;
+			ip->isw = &itesw[dtype];
+			/* to get CN_MIDPRI */
+			ip->regbase = (uint8_t *)(INTIOBASE + FB_BASE);
+			/* ...and do not need an ite_probe() check */
+			ip->alive = 1;
+			i++;
+			/* we only support one SGC frame buffer at the moment */
+			break;
+		}
+	}
 }
 
 #ifdef CONSDEBUG

Index: src/sys/arch/hp300/stand/common/itevar.h
diff -u src/sys/arch/hp300/stand/common/itevar.h:1.15 src/sys/arch/hp300/stand/common/itevar.h:1.16
--- src/sys/arch/hp300/stand/common/itevar.h:1.15	Sat Feb 12 05:08:41 2011
+++ src/sys/arch/hp300/stand/common/itevar.h	Sun Apr 13 15:45:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: itevar.h,v 1.15 2011/02/12 05:08:41 tsutsui Exp $	*/
+/*	$NetBSD: itevar.h,v 1.16 2014/04/13 15:45:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -55,6 +55,7 @@ typedef	void (*ite_windowmover)(struct i
 
 struct ite_data {
 	int	alive;
+	int	scode;			/* DIO selectcode or SGC slot # */
 	struct  itesw *isw;
 	void 	*regbase, *fbbase;
 	short	curx, cury;
@@ -139,6 +140,13 @@ void rbox_init(struct ite_data *);
 void dvbox_init(

CVS commit: src/sys/rump/dev/lib/libpci

2014-04-13 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Apr 13 15:43:26 UTC 2014

Modified Files:
src/sys/rump/dev/lib/libpci: rumpdev_bus_space.c

Log Message:
add some sort of bus_space_barrier()


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c
diff -u src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c:1.1 src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c:1.2
--- src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c:1.1	Fri Apr  4 12:53:59 2014
+++ src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c	Sun Apr 13 15:43:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpdev_bus_space.c,v 1.1 2014/04/04 12:53:59 pooka Exp $	*/
+/*	$NetBSD: rumpdev_bus_space.c,v 1.2 2014/04/13 15:43:26 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2013 Antti Kantee.  All Rights Reserved.
@@ -26,6 +26,7 @@
  */
 
 #include 
+#include 
 
 #include 
 
@@ -175,3 +176,12 @@ bus_space_unmap(bus_space_tag_t bst, bus
 
 	panic("%s: unimplemented", __func__);
 }
+
+void
+bus_space_barrier(bus_space_tag_t bst, bus_space_handle_t bsh,
+	bus_size_t offset, bus_size_t len, int flags)
+{
+
+	/* weelll ... */
+	membar_sync();
+}



CVS commit: src/sys/dev/sysmon

2014-04-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Apr 13 13:19:50 UTC 2014

Modified Files:
src/sys/dev/sysmon: swwdog.c

Log Message:
If we pmf_register on attach, we should pmf_deregister on detach.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/sysmon/swwdog.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sysmon/swwdog.c
diff -u src/sys/dev/sysmon/swwdog.c:1.12 src/sys/dev/sysmon/swwdog.c:1.13
--- src/sys/dev/sysmon/swwdog.c:1.12	Thu Nov 11 21:55:04 2010
+++ src/sys/dev/sysmon/swwdog.c	Sun Apr 13 13:19:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: swwdog.c,v 1.12 2010/11/11 21:55:04 pooka Exp $	*/
+/*	$NetBSD: swwdog.c,v 1.13 2014/04/13 13:19:50 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2004, 2005 Steven M. Bellovin
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: swwdog.c,v 1.12 2010/11/11 21:55:04 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: swwdog.c,v 1.13 2014/04/13 13:19:50 pgoyette Exp $");
 
 /*
  *
@@ -162,6 +162,7 @@ swwdog_detach(device_t self, int flags)
 {
 	struct swwdog_softc *sc = device_private(self);
 
+	pmf_device_deregister(self);
 	swwdog_disarm(sc);
 	callout_destroy(&sc->sc_c);
 	sysctl_teardown(&swwdog_sysctllog);



CVS commit: src/crypto/external/bsd/openssl/dist/ssl

2014-04-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 13 13:14:15 UTC 2014

Modified Files:
src/crypto/external/bsd/openssl/dist/ssl: s3_pkt.c

Log Message:
Fix use after free:
https://rt.openssl.org/Ticket/Display.html?id=2167&user=guest&pass=guest
https://rt.openssl.org/Ticket/Display.html?id=3265&user=guest&pass=guest


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/crypto/external/bsd/openssl/dist/ssl/s3_pkt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/openssl/dist/ssl/s3_pkt.c
diff -u src/crypto/external/bsd/openssl/dist/ssl/s3_pkt.c:1.13 src/crypto/external/bsd/openssl/dist/ssl/s3_pkt.c:1.14
--- src/crypto/external/bsd/openssl/dist/ssl/s3_pkt.c:1.13	Sat Jan 11 13:34:37 2014
+++ src/crypto/external/bsd/openssl/dist/ssl/s3_pkt.c	Sun Apr 13 09:14:15 2014
@@ -1057,7 +1057,8 @@ start:
 s->rstate=SSL_ST_READ_HEADER;
 rr->off=0;
 if (s->mode & SSL_MODE_RELEASE_BUFFERS)
-	ssl3_release_read_buffer(s);
+	if (s->s3->rbuf.left == 0) /* no read-ahead left? */
+		ssl3_release_read_buffer(s);
 }
 			}
 		return(n);



CVS commit: src/sys/dev/i2c

2014-04-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 13 12:42:47 UTC 2014

Modified Files:
src/sys/dev/i2c: w83795g.c

Log Message:
fix statement with no effect (Dave Tyson)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/w83795g.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/i2c/w83795g.c
diff -u src/sys/dev/i2c/w83795g.c:1.1 src/sys/dev/i2c/w83795g.c:1.2
--- src/sys/dev/i2c/w83795g.c:1.1	Tue Aug  6 11:58:25 2013
+++ src/sys/dev/i2c/w83795g.c	Sun Apr 13 08:42:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: w83795g.c,v 1.1 2013/08/06 15:58:25 soren Exp $	*/
+/*	$NetBSD: w83795g.c,v 1.2 2014/04/13 12:42:47 christos Exp $	*/
 
 /*
  * Copyright (c) 2013 Soren S. Jorvang.  All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: w83795g.c,v 1.1 2013/08/06 15:58:25 soren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: w83795g.c,v 1.2 2014/04/13 12:42:47 christos Exp $");
 
 #include 
 #include 
@@ -339,7 +339,7 @@ w83795g_get_limits(struct sysmon_envsys 
 		index = W83795G_FHL1LSB + (sensor->msb - W83795G_FANIN1) / 2;
 		iic_smbus_read_byte(sc->sc_tag, sc->sc_addr, index, &lsb, 0);
 		if (index % 2)
-			lsb >> 4;
+			lsb >>= 4;
 		else
 			lsb &= 0xf;
 		limits->sel_warnmin = 135 / (msb << 4 | lsb);



CVS commit: src/sys/rump/dev/lib/libpci

2014-04-13 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Apr 13 12:40:00 UTC 2014

Modified Files:
src/sys/rump/dev/lib/libpci: pci_at_mainbus.c

Log Message:
create /dev/pci device nodes


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/dev/lib/libpci/pci_at_mainbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/dev/lib/libpci/pci_at_mainbus.c
diff -u src/sys/rump/dev/lib/libpci/pci_at_mainbus.c:1.1 src/sys/rump/dev/lib/libpci/pci_at_mainbus.c:1.2
--- src/sys/rump/dev/lib/libpci/pci_at_mainbus.c:1.1	Fri Apr  4 12:53:59 2014
+++ src/sys/rump/dev/lib/libpci/pci_at_mainbus.c	Sun Apr 13 12:40:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_at_mainbus.c,v 1.1 2014/04/04 12:53:59 pooka Exp $	*/
+/*	$NetBSD: pci_at_mainbus.c,v 1.2 2014/04/13 12:40:00 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_at_mainbus.c,v 1.1 2014/04/04 12:53:59 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_at_mainbus.c,v 1.2 2014/04/13 12:40:00 pooka Exp $");
 
 #include 
 #include 
@@ -41,12 +41,27 @@ __KERNEL_RCSID(0, "$NetBSD: pci_at_mainb
 #include "ioconf.c"
 
 #include "rump_private.h"
+#include "rump_vfs_private.h"
 
 RUMP_COMPONENT(RUMP_COMPONENT_DEV)
 {
+	extern const struct cdevsw pci_cdevsw;
+	devmajor_t cmaj, bmaj;
+	int error;
 
 	config_init_component(cfdriver_ioconf_pci,
 	cfattach_ioconf_pci, cfdata_ioconf_pci);
+
+	bmaj = cmaj = -1;
+	if ((error = devsw_attach("pci", NULL, &bmaj,
+	&pci_cdevsw, &cmaj)) != 0) {
+		printf("pci: devsw_attach failed: %d\n", error);
+		return;
+	}
+
+	if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/pci", '0',
+	cmaj, 0, 4)) != 0)
+		printf("pci: failed to create /dev/pci nodes: %d", error);
 }
 
 RUMP_COMPONENT(RUMP_COMPONENT_DEV_AFTERMAINBUS)



CVS commit: src/sys/kern

2014-04-13 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sun Apr 13 12:11:01 UTC 2014

Modified Files:
src/sys/kern: kern_exec.c

Log Message:
Revert braces.


To generate a diff of this commit:
cvs rdiff -u -r1.392 -r1.393 src/sys/kern/kern_exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.392 src/sys/kern/kern_exec.c:1.393
--- src/sys/kern/kern_exec.c:1.392	Sun Apr 13 09:19:42 2014
+++ src/sys/kern/kern_exec.c	Sun Apr 13 12:11:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.392 2014/04/13 09:19:42 uebayasi Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.393 2014/04/13 12:11:01 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.392 2014/04/13 09:19:42 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.393 2014/04/13 12:11:01 uebayasi Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -998,7 +998,6 @@ execve_runproc(struct lwp *l, struct exe
 
 	DUMPVMCMDS(epp, 0, 0);
 
-{
 	size_t			i;
 	struct exec_vmcmd	*base_vcp;
 
@@ -1034,9 +1033,7 @@ execve_runproc(struct lwp *l, struct exe
 		DPRINTF(("%s: vmcmd %zu failed: %d\n", __func__, i - 1, error));
 		goto exec_abort;
 	}
-}
 
-{
 	const char		*commandname;
 	size_t			commandlen;
 
@@ -1050,9 +1047,7 @@ execve_runproc(struct lwp *l, struct exe
 	commandlen = min(strlen(commandname), MAXCOMLEN);
 	(void)memcpy(p->p_comm, commandname, commandlen);
 	p->p_comm[commandlen] = '\0';
-}
 
-{
 	char			*path;
 
 	path = PNBUF_GET();
@@ -1087,13 +1082,11 @@ execve_runproc(struct lwp *l, struct exe
 		epp->ep_path = NULL;
 		PNBUF_PUT(path);
 	}
-}
 
 	/* remember information about the process */
 	data->ed_arginfo.ps_nargvstr = data->ed_argc;
 	data->ed_arginfo.ps_nenvstr = data->ed_envc;
 
-{
 	/*
 	 * Allocate the stack address passed to the newly execve()'ed process.
 	 *
@@ -1132,13 +1125,11 @@ execve_runproc(struct lwp *l, struct exe
 		DPRINTF(("%s: copyargs failed %d\n", __func__, error));
 		goto exec_abort;
 	}
-}
 
 	/* fill process ps_strings info */
 	p->p_psstrp = (vaddr_t)STACK_ALLOC(STACK_GROW(vm->vm_minsaddr,
 	STACK_PTHREADSPACE), data->ed_ps_strings_sz);
 
-{
 	struct ps_strings32	arginfo32;
 	void			*aip;
 
@@ -1158,7 +1149,6 @@ execve_runproc(struct lwp *l, struct exe
 		__func__, aip, (void *)p->p_psstrp, data->ed_ps_strings_sz));
 		goto exec_abort;
 	}
-}
 
 	cwdexec(p);
 	fd_closeexec();		/* handle close on exec */
@@ -1223,7 +1213,6 @@ execve_runproc(struct lwp *l, struct exe
 
 	doexechooks(p);
 
-{
 	/*
 	 * Set initial SP at the top of the stack.
 	 *
@@ -1237,7 +1226,6 @@ execve_runproc(struct lwp *l, struct exe
 	(*epp->ep_esch->es_emul->e_setregs)(l, epp, newstack);
 	if (epp->ep_esch->es_setregs)
 		(*epp->ep_esch->es_setregs)(l, epp, newstack);
-}
 
 	/* Provide a consistent LWP private setting */
 	(void)lwp_setprivate(l, NULL);



CVS commit: src/sys/kern

2014-04-13 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sun Apr 13 09:19:43 UTC 2014

Modified Files:
src/sys/kern: kern_exec.c

Log Message:
copyinargs: Refactor.  Share code.


To generate a diff of this commit:
cvs rdiff -u -r1.391 -r1.392 src/sys/kern/kern_exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.391 src/sys/kern/kern_exec.c:1.392
--- src/sys/kern/kern_exec.c:1.391	Sun Apr 13 06:03:49 2014
+++ src/sys/kern/kern_exec.c	Sun Apr 13 09:19:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.391 2014/04/13 06:03:49 uebayasi Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.392 2014/04/13 09:19:42 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.391 2014/04/13 06:03:49 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.392 2014/04/13 09:19:42 uebayasi Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -124,6 +124,8 @@ struct execve_data;
 
 static int copyinargs(struct execve_data * restrict, char * const *,
 char * const *, execve_fetch_element_t, char **);
+static int copyinargstrs(struct execve_data * restrict, char * const *,
+execve_fetch_element_t, char **, size_t *, void (*)(const void *, size_t));
 static int exec_sigcode_map(struct proc *, const struct emul *);
 
 #ifdef DEBUG_EXEC
@@ -1412,7 +1414,7 @@ copyinargs(struct execve_data * restrict
 char * const *envs, execve_fetch_element_t fetch_element, char **dpp)
 {
 	struct exec_package	* const epp = &data->ed_pack;
-	char			*dp, *sp;
+	char			*dp;
 	size_t			i;
 	int			error;
 
@@ -1444,70 +1446,80 @@ copyinargs(struct execve_data * restrict
 		epp->ep_flags &= ~EXEC_HASARGL;
 	}
 
-	/* Now get argv & environment */
+	/*
+	 * Read and count argument strings from user.
+	 */
+
 	if (args == NULL) {
 		DPRINTF(("%s: null args\n", __func__));
 		return EINVAL;
 	}
-	/* 'i' will index the argp/envp element to be retrieved */
-	i = 0;
 	if (epp->ep_flags & EXEC_SKIPARG)
-		i++;
+		args++;
+	i = 0;
+	error = copyinargstrs(data, args, fetch_element, &dp, &i, ktr_execarg);
+	if (error != 0) {
+		DPRINTF(("%s: copyin arg %d\n", __func__, error));
+		return error;
+	}
+	data->ed_argc += i;
 
+	/*
+	 * Read and count environment strings from user.
+	 */
+
+	data->ed_envc = 0;
+	/* environment need not be there */
+	if (envs == NULL)
+		goto done;
+	i = 0;
+	error = copyinargstrs(data, envs, fetch_element, &dp, &i, ktr_execenv);
+	if (error != 0) {
+		DPRINTF(("%s: copyin env %d\n", __func__, error));
+		return error;
+	}
+	data->ed_envc += i;
+
+done:
+	*dpp = dp;
+
+	return 0;
+}
+
+static int
+copyinargstrs(struct execve_data * restrict data, char * const *strs,
+execve_fetch_element_t fetch_element, char **dpp, size_t *ip,
+void (*ktr)(const void *, size_t))
+{
+	char			*dp, *sp;
+	size_t			i;
+	int			error;
+
+	dp = *dpp;
+
+	i = 0;
 	while (1) {
 		const size_t maxlen = data->ed_argp + ARG_MAX - dp;
 		size_t len;
 
-		if ((error = (*fetch_element)(args, i, &sp)) != 0) {
-			DPRINTF(("%s: fetch_element args %d\n",
-			__func__, error));
+		if ((error = (*fetch_element)(strs, i, &sp)) != 0) {
 			return error;
 		}
 		if (!sp)
 			break;
 		if ((error = copyinstr(sp, dp, maxlen, &len)) != 0) {
-			DPRINTF(("%s: copyinstr args %d\n", __func__, error));
 			if (error == ENAMETOOLONG)
 error = E2BIG;
 			return error;
 		}
-		ktrexecarg(dp, len - 1);
+		if (__predict_false(ktrace_on))
+			(*ktr)(dp, len - 1);
 		dp += len;
 		i++;
-		data->ed_argc++;
-	}
-
-	data->ed_envc = 0;
-	/* environment need not be there */
-	if (envs != NULL) {
-		i = 0;
-		while (1) {
-			const size_t maxlen = data->ed_argp + ARG_MAX - dp;
-			size_t len;
-
-			if ((error = (*fetch_element)(envs, i, &sp)) != 0) {
-DPRINTF(("%s: fetch_element env %d\n",
-__func__, error));
-return error;
-			}
-			if (!sp)
-break;
-			if ((error = copyinstr(sp, dp, maxlen, &len)) != 0) {
-DPRINTF(("%s: copyinstr env %d\n",
-__func__, error));
-if (error == ENAMETOOLONG)
-	error = E2BIG;
-return error;
-			}
-
-			ktrexecenv(dp, len - 1);
-			dp += len;
-			i++;
-			data->ed_envc++;
-		}
 	}
 
 	*dpp = dp;
+	*ip = i;
 
 	return 0;
 }