CVS commit: [pgoyette-compat] src/doc

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 05:14:26 UTC 2018

Added Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes

Log Message:
Add some notes on what has been done, and what remains


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/doc/COMPAT-branch-notes

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

Added files:

Index: src/doc/COMPAT-branch-notes
diff -u /dev/null src/doc/COMPAT-branch-notes:1.1.2.1
--- /dev/null	Sat Mar 10 05:14:26 2018
+++ src/doc/COMPAT-branch-notes	Sat Mar 10 05:14:26 2018
@@ -0,0 +1,45 @@
+DONE
+
+1. Removed linking of the kernel compat object library into all kernels;
+   using the .o library caused some build breakage, and resulted in the
+   bulk of the compat code being included in every kernel, but without
+   any module linkage.  In turn, this caused failure when loading some
+   modules due to symbols already being defined in the kernel.
+
+2. Reverted some intentional breakage for loading the sysv_ipc module;
+   the breakage was introduced as the fix for the above-mentioned build
+   breakage.  
+
+3. Split the sysv_ipc compat routines into their own compat_sysv module.
+
+4. Resolved some inter-module dependencies.
+
+5. Extracted some net/if.c compat routines into the compat module, and
+   replaced the originals with indirect (vectored) function calls.
+
+
+TODO
+
+1. Audit the entire code base for any remaining embedded #ifdef's for
+   COMPAT_xx.  When found, move the actual compat code into the compat
+   hierarchy and replace originals with indirect (vectored) calls.
+
+   (There are several instances of this in the net routing table code.)
+
+2. Implement a mechanism for modules to include "aliases".  This would
+   allow a single module file to contain multiple module table entries
+   (for example, a single file for the compat module could include
+   compat_80, compat_70, compat_60, ...).  Then, other modules could
+   depend on individual names.  For example, module compat_xyz could
+   depend on compat_70, and the dependency would be met by either the
+   "everything" compat module (with all of its aliases) or by a 7.0-
+   specific module.
+
+   Note that in addition to updating the module code, this would also
+   require changes to syscalls.master files to change the names of the
+   modules associated with module-provided syscalls.
+
+3. In addition to the single, all-encompassing compat module, provide a
+   per-version compat_xx module, each with dependencies on all higher
+   versions.  (Perhaps we would also do this for the sysv ipc module,
+   although the gains are a lot smaller.)



CVS commit: [pgoyette-compat] src/sys

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 05:12:18 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: init_sysent.c syscalls.c
syscalls_autoload.c systrace_args.c
src/sys/rump/include/rump [pgoyette-compat]: rump_syscalls.h
src/sys/rump/librump/rumpkern [pgoyette-compat]: rump_syscalls.c
src/sys/sys [pgoyette-compat]: syscall.h syscallargs.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.319 -r1.319.2.1 src/sys/kern/init_sysent.c
cvs rdiff -u -r1.310 -r1.310.2.1 src/sys/kern/syscalls.c
cvs rdiff -u -r1.27 -r1.27.2.1 src/sys/kern/syscalls_autoload.c
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/kern/systrace_args.c
cvs rdiff -u -r1.108 -r1.108.2.1 src/sys/rump/include/rump/rump_syscalls.h
cvs rdiff -u -r1.137 -r1.137.2.1 \
src/sys/rump/librump/rumpkern/rump_syscalls.c
cvs rdiff -u -r1.304 -r1.304.2.1 src/sys/sys/syscall.h
cvs rdiff -u -r1.288 -r1.288.2.1 src/sys/sys/syscallargs.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/kern/init_sysent.c
diff -u src/sys/kern/init_sysent.c:1.319 src/sys/kern/init_sysent.c:1.319.2.1
--- src/sys/kern/init_sysent.c:1.319	Sat Jan  6 16:41:23 2018
+++ src/sys/kern/init_sysent.c	Sat Mar 10 05:12:17 2018
@@ -1,14 +1,14 @@
-/* $NetBSD: init_sysent.c,v 1.319 2018/01/06 16:41:23 kamil Exp $ */
+/* $NetBSD: init_sysent.c,v 1.319.2.1 2018/03/10 05:12:17 pgoyette Exp $ */
 
 /*
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.288 2017/12/19 08:48:19 kamil Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.1 2018/03/10 05:09:24 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.319 2018/01/06 16:41:23 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.319.2.1 2018/03/10 05:12:17 pgoyette Exp $");
 
 #include "opt_modular.h"
 #include "opt_ntp.h"

Index: src/sys/kern/syscalls.c
diff -u src/sys/kern/syscalls.c:1.310 src/sys/kern/syscalls.c:1.310.2.1
--- src/sys/kern/syscalls.c:1.310	Sat Jan  6 16:41:23 2018
+++ src/sys/kern/syscalls.c	Sat Mar 10 05:12:17 2018
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls.c,v 1.310 2018/01/06 16:41:23 kamil Exp $ */
+/* $NetBSD: syscalls.c,v 1.310.2.1 2018/03/10 05:12:17 pgoyette Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.288 2017/12/19 08:48:19 kamil Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.1 2018/03/10 05:09:24 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.310 2018/01/06 16:41:23 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.310.2.1 2018/03/10 05:12:17 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_modular.h"

Index: src/sys/kern/syscalls_autoload.c
diff -u src/sys/kern/syscalls_autoload.c:1.27 src/sys/kern/syscalls_autoload.c:1.27.2.1
--- src/sys/kern/syscalls_autoload.c:1.27	Sat Jan  6 16:41:23 2018
+++ src/sys/kern/syscalls_autoload.c	Sat Mar 10 05:12:17 2018
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls_autoload.c,v 1.27 2018/01/06 16:41:23 kamil Exp $ */
+/* $NetBSD: syscalls_autoload.c,v 1.27.2.1 2018/03/10 05:12:17 pgoyette Exp $ */
 
 /*
  * System call autoload table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.287 2017/12/08 01:19:29 christos Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.1 2018/03/10 05:09:24 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.27 2018/01/06 16:41:23 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.27.2.1 2018/03/10 05:12:17 pgoyette Exp $");
 
 #include 
 static struct sc_autoload netbsd_syscalls_autoload[] = {
@@ -77,15 +77,15 @@ static struct sc_autoload netbsd_syscall
 	{ SYS_compat_09_osetdomainname, "compat" },
 	{ SYS_compat_09_ouname, "compat" },
 #if !defined(_LP64)
-	{ SYS_compat_10_osemsys, "sysv_ipc" },
+	{ SYS_compat_10_osemsys, "compat_sysv" },
 #else
 #endif
 #if !defined(_LP64)
-	{ SYS_compat_10_omsgsys, "sysv_ipc" },
+	{ SYS_compat_10_omsgsys, "compat_sysv" },
 #else
 #endif
 #if !defined(_LP64)
-	{ SYS_compat_10_oshmsys, "sysv_ipc" },
+	{ SYS_compat_10_oshmsys, "compat_sysv" },
 #else
 #endif
 	{ SYS_lfs_bmapv, "lfs" },
@@ -98,16 +98,16 @@ static struct sc_autoload netbsd_syscall
 	{ SYS_compat_12_getdirentries, "compat" },
 	{ SYS_compat_50_futimes, "compat" },
 	{ SYS_afssys, "openafs" },
-	{ SYS_compat_14___semctl, "sysv_ipc" },
+	{ SYS_compat_14___semctl, "compat_sysv" },
 	{ SYS_semget, "sysv_ipc" },
 	{ SYS_semop, "sysv_ipc" },
 	{ SYS_semconfig, "sysv_ipc" },
-	{ SYS_compat_14_msgctl, "sysv_ipc" },
+	{ SYS_compat_14_msgctl, "compat_sysv" },
 	{ SYS_msgget, "sysv_ipc" },
 	{ SYS_msgsnd, "sysv_ipc" },
 	

CVS commit: [pgoyette-compat] src/sys/kern

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 05:09:24 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Update module name for sysv_ipc compat syscalls.


To generate a diff of this commit:
cvs rdiff -u -r1.291 -r1.291.2.1 src/sys/kern/syscalls.master

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/syscalls.master
diff -u src/sys/kern/syscalls.master:1.291 src/sys/kern/syscalls.master:1.291.2.1
--- src/sys/kern/syscalls.master:1.291	Sat Jan  6 16:41:23 2018
+++ src/sys/kern/syscalls.master	Sat Mar 10 05:09:24 2018
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.291 2018/01/06 16:41:23 kamil Exp $
+	$NetBSD: syscalls.master,v 1.291.2.1 2018/03/10 05:09:24 pgoyette Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -353,7 +353,7 @@
 168	UNIMPL
 ; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
 #if !defined(_LP64)
-169	COMPAT_10 MODULAR sysv_ipc	\
+169	COMPAT_10 MODULAR compat_sysv	\
 		{ int|sys||semsys(int which, int a2, int a3, int a4, \
 			int a5); } osemsys
 #else
@@ -361,7 +361,7 @@
 #endif
 ; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
 #if !defined(_LP64)
-170	COMPAT_10 MODULAR sysv_ipc	\
+170	COMPAT_10 MODULAR compat_sysv	\
 		{ int|sys||msgsys(int which, int a2, int a3, int a4, \
 			int a5, int a6); } omsgsys
 #else
@@ -369,7 +369,7 @@
 #endif
 ; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
 #if !defined(_LP64)
-171	COMPAT_10 MODULAR sysv_ipc	\
+171	COMPAT_10 MODULAR compat_sysv	\
 		{ int|sys||shmsys(int which, int a2, int a3, int a4); } \
 			oshmsys
 #else
@@ -455,7 +455,7 @@
 218	UNIMPL
 219	UNIMPL
 ; System calls 220-300 are reserved for use by NetBSD
-220	COMPAT_14 MODULAR sysv_ipc	\
+220	COMPAT_14 MODULAR compat_sysv	\
 		{ int|sys||__semctl(int semid, int semnum, int cmd, \
 			union __semun *arg); }
 221	STD MODULAR sysv_ipc { int|sys||semget(key_t key, int nsems, \
@@ -463,7 +463,7 @@
 222	STD MODULAR sysv_ipc { int|sys||semop(int semid, struct sembuf *sops, \
 			size_t nsops); }
 223	STD MODULAR sysv_ipc { int|sys||semconfig(int flag); }
-224	COMPAT_14 MODULAR sysv_ipc { int|sys||msgctl(int msqid, int cmd, \
+224	COMPAT_14 MODULAR compat_sysv { int|sys||msgctl(int msqid, int cmd, \
 			struct msqid_ds14 *buf); }
 225	STD MODULAR sysv_ipc { int|sys||msgget(key_t key, int msgflg); }
 226	STD MODULAR sysv_ipc { int|sys||msgsnd(int msqid, const void *msgp, \
@@ -472,7 +472,7 @@
 			size_t msgsz, long msgtyp, int msgflg); }
 228	STD MODULAR sysv_ipc { void *|sys||shmat(int shmid,	\
 			const void *shmaddr, int shmflg); }
-229	COMPAT_14 MODULAR sysv_ipc { int|sys||shmctl(int shmid, int cmd, \
+229	COMPAT_14 MODULAR compat_sysv { int|sys||shmctl(int shmid, int cmd, \
 			struct shmid_ds14 *buf); }
 230	STD MODULAR sysv_ipc { int|sys||shmdt(const void *shmaddr); }
 231	STD MODULAR sysv_ipc { int|sys||shmget(key_t key, size_t size,	\
@@ -611,12 +611,12 @@
 300	COMPAT_20 MODULAR compat	\
 		{ int|sys||fhstatfs(const struct compat_30_fhandle *fhp, \
 			struct statfs12 *buf); }
-301	COMPAT_50 MODULAR sysv_ipc	\
+301	COMPAT_50 MODULAR compat_sysv	\
 		{ int|sys|13|__semctl(int semid, int semnum, int cmd, \
 			... union __semun *arg); }
-302	COMPAT_50 MODULAR sysv_ipc { int|sys|13|msgctl(int msqid, int cmd, \
+302	COMPAT_50 MODULAR compat_sysv { int|sys|13|msgctl(int msqid, int cmd, \
 			struct msqid_ds *buf); }
-303	COMPAT_50 MODULAR sysv_ipc { int|sys|13|shmctl(int shmid, int cmd, \
+303	COMPAT_50 MODULAR compat_sysv { int|sys|13|shmctl(int shmid, int cmd, \
 			struct shmid_ds13 *buf); }
 304	STD 	 RUMP	{ int|sys||lchflags(const char *path, u_long flags); }
 305	NOERR 	RUMP	{ int|sys||issetugid(void); }



CVS commit: [pgoyette-compat] src/sys/compat/netbsd32

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 04:35:15 UTC 2018

Modified Files:
src/sys/compat/netbsd32 [pgoyette-compat]: netbsd32_ipc.c

Log Message:
Update module dependency - it now requires compat_sysvipc


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.16.1 src/sys/compat/netbsd32/netbsd32_ipc.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/compat/netbsd32/netbsd32_ipc.c
diff -u src/sys/compat/netbsd32/netbsd32_ipc.c:1.18 src/sys/compat/netbsd32/netbsd32_ipc.c:1.18.16.1
--- src/sys/compat/netbsd32/netbsd32_ipc.c:1.18	Thu Dec  3 10:38:21 2015
+++ src/sys/compat/netbsd32/netbsd32_ipc.c	Sat Mar 10 04:35:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ipc.c,v 1.18 2015/12/03 10:38:21 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_ipc.c,v 1.18.16.1 2018/03/10 04:35:15 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc.c,v 1.18 2015/12/03 10:38:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc.c,v 1.18.16.1 2018/03/10 04:35:15 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -111,7 +111,8 @@ static const struct syscall_package comp
 	{ 0, 0, NULL }
 };
 
-MODULE(MODULE_CLASS_EXEC, compat_netbsd32_sysvipc, "sysv_ipc,compat_netbsd32");
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_sysvipc,
+"sysv_ipc,compat_netbsd32,compat_sysvipc");
 
 static int
 compat_netbsd32_sysvipc_modcmd(modcmd_t cmd, void *arg)



CVS commit: src/sys/arch/atari/atari

2018-03-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 10 03:44:43 UTC 2018

Modified Files:
src/sys/arch/atari/atari: bus.c

Log Message:
Replace bus_dmamap_sync(9) op with a newer one taken from m68k/bus_dma.c.

This could fix memory corruption issue caused by PREREAD ops with regions
whose boundaries are not aligned at cacheline size.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/atari/atari/bus.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/atari/atari/bus.c
diff -u src/sys/arch/atari/atari/bus.c:1.59 src/sys/arch/atari/atari/bus.c:1.60
--- src/sys/arch/atari/atari/bus.c:1.59	Sat Jan 20 17:37:15 2018
+++ src/sys/arch/atari/atari/bus.c	Sat Mar 10 03:44:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.59 2018/01/20 17:37:15 tsutsui Exp $	*/
+/*	$NetBSD: bus.c,v 1.60 2018/03/10 03:44:43 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.59 2018/01/20 17:37:15 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.60 2018/03/10 03:44:43 tsutsui Exp $");
 
 #include 
 #include 
@@ -548,46 +548,203 @@ _bus_dmamap_unload(bus_dma_tag_t t, bus_
  * by bus-specific DMA map synchronization functions.
  */
 void
-_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t off,
+_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
 bus_size_t len, int ops)
 {
 #if defined(M68040) || defined(M68060)
-	int	i, pa_off, inc, seglen;
-	u_long	pa, end_pa;
+	bus_addr_t p, e, ps, pe;
+	bus_size_t seglen;
+	bus_dma_segment_t *seg;
+	int i;
+#endif
 
-	pa_off = t->_displacement;
+#if defined(M68020) || defined(M68030)
+#if defined(M68040) || defined(M68060)
+	if (cputype == CPU_68020 || cputype == CPU_68030)
+#endif
+		/* assume no L2 physical cache */
+		return;
+#endif
 
-	/* Flush granularity */
-	inc = (len > 1024) ? PAGE_SIZE : 16;
+#if defined(M68040) || defined(M68060)
+	/* If the whole DMA map is uncached, do nothing. */
+	if ((map->_dm_flags & BUS_DMA_COHERENT) != 0)
+		return;
+
+	/* Short-circuit for unsupported `ops' */
+	if ((ops & (BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE)) == 0)
+		return;
 
-	for (i = 0; i < map->dm_nsegs && len > 0; i++) {
-		if (map->dm_segs[i].ds_len <= off) {
+	/*
+	 * flush/purge the cache.
+	 */
+	for (i = 0; i < map->dm_nsegs && len != 0; i++) {
+		seg = >dm_segs[i];
+		if (seg->ds_len <= offset) {
 			/* Segment irrelevant - before requested offset */
-			off -= map->dm_segs[i].ds_len;
+			offset -= seg->ds_len;
 			continue;
 		}
-		seglen = map->dm_segs[i].ds_len - off;
+
+		/*
+		 * Now at the first segment to sync; nail
+		 * each segment until we have exhausted the
+		 * length.
+		 */
+		seglen = seg->ds_len - offset;
 		if (seglen > len)
 			seglen = len;
-		len -= seglen;
-		pa = map->dm_segs[i].ds_addr + off - pa_off;
-		end_pa = pa + seglen;
 
-		if (inc == 16) {
-			pa &= ~15;
-			while (pa < end_pa) {
-DCFL(pa);
-pa += 16;
+		ps = seg->ds_addr + offset;
+		pe = ps + seglen;
+
+		if (ops & BUS_DMASYNC_PREWRITE) {
+			p = ps & ~CACHELINE_MASK;
+			e = (pe + CACHELINE_MASK) & ~CACHELINE_MASK;
+
+			/* flush cacheline */
+			while ((p < e) && (p & (CACHELINE_SIZE * 8 - 1)) != 0) {
+DCFL(p);
+p += CACHELINE_SIZE;
 			}
-		} else {
-			pa &= ~PGOFSET;
-			while (pa < end_pa) {
-DCFP(pa);
-pa += PAGE_SIZE;
+
+			/* flush cachelines per 128bytes */
+			while ((p < e) && (p & PAGE_MASK) != 0) {
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+			}
+
+			/* flush page */
+			while (p + PAGE_SIZE <= e) {
+DCFP(p);
+p += PAGE_SIZE;
+			}
+
+			/* flush cachelines per 128bytes */
+			while (p + CACHELINE_SIZE * 8 <= e) {
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+DCFL(p);
+p += CACHELINE_SIZE;
+			}
+
+			/* flush cacheline */
+			while (p < e) {
+DCFL(p);
+p += CACHELINE_SIZE;
 			}
 		}
+
+		/*
+		 * Normally, the `PREREAD' flag instructs us to purge the
+		 * cache for the specified offset and length. However, if
+		 * the offset/length is not aligned to a cacheline boundary,
+		 * we may end up purging some legitimate data from the
+		 * start/end of the cache. In such a case, *flush* the
+		 * cachelines at the start and end of the required region.
+		 */
+		else if (ops & BUS_DMASYNC_PREREAD) {
+			/* flush cacheline on start 

CVS commit: [pgoyette-compat] src/sys/kern

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 03:33:27 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_stub.c

Log Message:
Revert changes from rev 1.44

Now that the kernel compat library is no longer being built and
included as a .o file, the original build-break has gone.

Note that reverting 1.44 will also un-break the autoloading of
the sysv_ipc module.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/kern/kern_stub.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_stub.c
diff -u src/sys/kern/kern_stub.c:1.44 src/sys/kern/kern_stub.c:1.44.2.1
--- src/sys/kern/kern_stub.c:1.44	Sat Dec 16 18:42:22 2017
+++ src/sys/kern/kern_stub.c	Sat Mar 10 03:33:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_stub.c,v 1.44 2017/12/16 18:42:22 christos Exp $	*/
+/*	$NetBSD: kern_stub.c,v 1.44.2.1 2018/03/10 03:33:27 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.44 2017/12/16 18:42:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.44.2.1 2018/03/10 03:33:27 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ktrace.h"
@@ -87,19 +87,6 @@ bool default_bus_space_handle_is_equal(b
 bus_space_handle_t);
 
 /*
- * SYSV Semaphores, Shared Memory, Message Queues
- */
-#ifndef SYSVMSG
-__strong_alias(msgctl1,enosys);
-#endif
-#ifndef SYSVSHM
-__strong_alias(shmctl1,enosys);
-#endif
-#ifndef SYSVSEM
-__strong_alias(semctl1,enosys);
-#endif
-
-/*
  * ktrace stubs.  ktruser() goes to enosys as we want to fail the syscall,
  * but not kill the process: utrace() is a debugging feature.
  */



CVS commit: src/sys/arch/atari/atari

2018-03-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 10 02:48:51 UTC 2018

Modified Files:
src/sys/arch/atari/atari: pmap_bootstrap.c

Log Message:
Fix another possible out of bounds.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/atari/atari/pmap_bootstrap.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/atari/atari/pmap_bootstrap.c
diff -u src/sys/arch/atari/atari/pmap_bootstrap.c:1.8 src/sys/arch/atari/atari/pmap_bootstrap.c:1.9
--- src/sys/arch/atari/atari/pmap_bootstrap.c:1.8	Thu Dec 22 14:47:54 2016
+++ src/sys/arch/atari/atari/pmap_bootstrap.c	Sat Mar 10 02:48:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.8 2016/12/22 14:47:54 cherry Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.9 2018/03/10 02:48:51 tsutsui Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -113,11 +113,11 @@ pmap_bootstrap(vaddr_t vstart)
 	/*
 	 * Setup physical address ranges
 	 */
-	for (i = 0; usable_segs[i + 1].start; i++)
-		;
+	for (i = 0; i < NMEM_SEGS && usable_segs[i].start; i++)
+		continue;
 	/* XXX: allow for msgbuf */
-	usable_segs[i].end -= m68k_round_page(MSGBUFSIZE);
-	msgbufpa = usable_segs[i].end;
+	usable_segs[i - 1].end -= m68k_round_page(MSGBUFSIZE);
+	msgbufpa = usable_segs[i - 1].end;
 
 	/*
 	 * Count physical memory
@@ -132,7 +132,7 @@ pmap_bootstrap(vaddr_t vstart)
 	/*
 	 * Announce available memory to the VM-system
 	 */
-	for (i = 0; usable_segs[i].start; i++)
+	for (i = 0; i < NMEM_SEGS && usable_segs[i].start; i++)
 		uvm_page_physload(atop(usable_segs[i].start),
  atop(usable_segs[i].end),
  atop(usable_segs[i].start),



CVS commit: [pgoyette-compat] src/sys/compat/common

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 02:20:13 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: sysv_ipc_50.c sysv_mod.c
sysv_mod.h

Log Message:
Put declaration of the 5.0 sysctl routine in a header file


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.16.1 src/sys/compat/common/sysv_ipc_50.c
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/compat/common/sysv_mod.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/compat/common/sysv_mod.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/compat/common/sysv_ipc_50.c
diff -u src/sys/compat/common/sysv_ipc_50.c:1.4 src/sys/compat/common/sysv_ipc_50.c:1.4.16.1
--- src/sys/compat/common/sysv_ipc_50.c:1.4	Thu Dec  3 00:28:55 2015
+++ src/sys/compat/common/sysv_ipc_50.c	Sat Mar 10 02:20:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_ipc_50.c,v 1.4 2015/12/03 00:28:55 pgoyette Exp $	*/
+/*	$NetBSD: sysv_ipc_50.c,v 1.4.16.1 2018/03/10 02:20:13 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.c,v 1.4 2015/12/03 00:28:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.c,v 1.4.16.1 2018/03/10 02:20:13 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -58,7 +58,6 @@ __KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.
 #include 
 #include 
 
-#ifdef COMPAT_50
 #include 
 #ifdef SYSVMSG
 #include 
@@ -74,8 +73,6 @@ __KERNEL_RCSID(0, "$NetBSD: sysv_ipc_50.
  * Check for ipc permission
  */
 
-int sysctl_kern_sysvipc50(SYSCTLFN_PROTO);
-
 int
 sysctl_kern_sysvipc50(SYSCTLFN_ARGS)
 {
@@ -215,4 +212,3 @@ sysctl_kern_sysvipc50(SYSCTLFN_ARGS)
 		free(bf, M_TEMP);
 	return error;
 }
-#endif /* COMPAT_50 */

Index: src/sys/compat/common/sysv_mod.c
diff -u src/sys/compat/common/sysv_mod.c:1.1.2.6 src/sys/compat/common/sysv_mod.c:1.1.2.7
--- src/sys/compat/common/sysv_mod.c:1.1.2.6	Fri Mar  9 09:37:01 2018
+++ src/sys/compat/common/sysv_mod.c	Sat Mar 10 02:20:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_mod.c,v 1.1.2.6 2018/03/09 09:37:01 pgoyette Exp $	*/
+/*	$NetBSD: sysv_mod.c,v 1.1.2.7 2018/03/10 02:20:13 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_mod.c,v 1.1.2.6 2018/03/09 09:37:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_mod.c,v 1.1.2.7 2018/03/10 02:20:13 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -46,10 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: sysv_mod.c,v
 
 #include 
 
-#ifdef COMPAT_50
-int sysctl_kern_sysvipc50(SYSCTLFN_PROTO);
-#endif
-
 MODULE(MODULE_CLASS_EXEC, compat_sysv, "sysv_ipc");
 
 /* Build the syscall package based on options specified */

Index: src/sys/compat/common/sysv_mod.h
diff -u src/sys/compat/common/sysv_mod.h:1.1.2.2 src/sys/compat/common/sysv_mod.h:1.1.2.3
--- src/sys/compat/common/sysv_mod.h:1.1.2.2	Fri Mar  9 10:41:05 2018
+++ src/sys/compat/common/sysv_mod.h	Sat Mar 10 02:20:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_mod.h,v 1.1.2.2 2018/03/09 10:41:05 pgoyette Exp $	*/
+/*	$NetBSD: sysv_mod.h,v 1.1.2.3 2018/03/10 02:20:13 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -36,4 +36,6 @@
 
 extern int (*vec_sysvipc50_sysctl)(SYSCTLFN_PROTO);
 
+int sysctl_kern_sysvipc50(SYSCTLFN_PROTO);
+
 #endif /* _COMPAT_COMMON_SYSV_IPC_MOD_H_ */



CVS commit: [pgoyette-compat] src/sys/modules/compat_sysv

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 10 02:18:56 UTC 2018

Modified Files:
src/sys/modules/compat_sysv [pgoyette-compat]: Makefile

Log Message:
Include the 5.0 sysctl in the compat_sysv module


To generate a diff of this commit:
cvs rdiff -u -r1.3.10.3 -r1.3.10.4 src/sys/modules/compat_sysv/Makefile

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

Modified files:

Index: src/sys/modules/compat_sysv/Makefile
diff -u src/sys/modules/compat_sysv/Makefile:1.3.10.3 src/sys/modules/compat_sysv/Makefile:1.3.10.4
--- src/sys/modules/compat_sysv/Makefile:1.3.10.3	Fri Mar  9 09:37:01 2018
+++ src/sys/modules/compat_sysv/Makefile	Sat Mar 10 02:18:56 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3.10.3 2018/03/09 09:37:01 pgoyette Exp $
+# $NetBSD: Makefile,v 1.3.10.4 2018/03/10 02:18:56 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -16,7 +16,7 @@ CPPFLAGS+=	-DCOMPAT_14
 CPPFLAGS+=	-DCOMPAT_50
 
 SRCS+=	sysv_mod.c
-SRCS+=	kern_ipc_10.c
+SRCS+=	kern_ipc_10.c sysv_ipc_50.c
 SRCS+=	sysv_msg_14.c sysv_sem_14.c sysv_shm_14.c
 SRCS+=	sysv_msg_50.c sysv_sem_50.c sysv_shm_50.c
 



CVS commit: src/sys/dev/i2c

2018-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  9 22:27:15 UTC 2018

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

Log Message:
remove some unused code, add comments for credits & explanations


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/adadc.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/adadc.c
diff -u src/sys/dev/i2c/adadc.c:1.1 src/sys/dev/i2c/adadc.c:1.2
--- src/sys/dev/i2c/adadc.c:1.1	Fri Mar  9 20:16:54 2018
+++ src/sys/dev/i2c/adadc.c	Fri Mar  9 22:27:15 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: adadc.c,v 1.1 2018/03/09 20:16:54 macallan Exp $ */
+/* $NetBSD: adadc.c,v 1.2 2018/03/09 22:27:15 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -26,10 +26,15 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* a driver for Analog Devices AD7417 temperature sensors / ADCs */
+/*
+ * a driver for Analog Devices AD7417 temperature sensors / ADCs
+ * very much macppc only for now since we need calibaration data to make sense
+ * of the ADC inputs
+ * info on how to get these from FreeBSD and Linux
+ */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.1 2018/03/09 20:16:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.2 2018/03/09 22:27:15 macallan Exp $");
 
 #include 
 #include 
@@ -93,6 +98,7 @@ static const char * dstemp_compats[] = {
 	NULL
 };
 
+/* calibaration table from Darwin via Linux */
 static int slope[5] = {0, 0, 0x0320, 0x00a0, 0x1f40};
 
 static int
@@ -101,7 +107,11 @@ adadc_match(device_t parent, cfdata_t ma
 	struct i2c_attach_args *ia = aux;
 
 	if (ia->ia_name == NULL) {
-		/* no ID registers on this chip */
+		/*
+		 * XXX
+		 * this driver is pretty much useless without OF, should
+		 * probably remove this
+		 */
 		if ((ia->ia_addr & 0x2b) == 0x2b)
 			return 1;
 		return 0;
@@ -118,7 +128,6 @@ adadc_attach(device_t parent, device_t s
 	envsys_data_t *s;
 	int error, ch, cpuid;
 	uint32_t eeprom[40];
-	uint8_t cmd, data;
 	char loc[256];
 	int which_cpu;
 
@@ -129,16 +138,17 @@ adadc_attach(device_t parent, device_t s
 	aprint_naive("\n");
 	aprint_normal(": AD7417\n");
 
-	cmd = ADADC_CONFIG;
-	error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
-	sc->sc_addr, , 1, , 1, 0);
-
 	sc->sc_sme = sysmon_envsys_create();
 	sc->sc_sme->sme_name = device_xname(self);
 	sc->sc_sme->sme_cookie = sc;
 	sc->sc_sme->sme_refresh = adadc_sensors_refresh;
 	sc->sc_nsensors = 0;
 
+	/*
+	 * XXX
+	 * without OpenFirmware telling us how to interpret the ADC inputs we
+	 * should probably just expose the temperature and four ENVSYS_INTEGERs
+	 */
 	which_cpu = 0;
 	ch = OF_child(ia->ia_cookie);
 	while (ch != 0) {
@@ -146,6 +156,10 @@ adadc_attach(device_t parent, device_t s
 			int reg = 0;
 			OF_getprop(ch, "reg", , sizeof(reg));
 			s = >sc_sensors[sc->sc_nsensors];
+			/*
+			 * this setup matches my 2x 2.5GHz PCI-X G5, Linux and
+			 * FreeBSD hardcode these as well so we should be safe
+			 */
 			switch (reg) {
 			case 0:
 if (strstr(loc, "CPU B") != NULL)
@@ -220,6 +234,10 @@ adadc_sensors_refresh(struct sysmon_envs
 			/* 16.16 fixed point */
 			edata->value_cur = (temp >> 12) * 62500 + 27315;
 		} else {
+			/*
+			 * the input is 10bit, so converting to 8.4 fixed point
+			 * is more than enough
+			 */
 			int temp = rdata * slope[edata->private];
 			edata->value_cur = (temp >> 12) * 62500;
 		}
@@ -228,6 +246,7 @@ adadc_sensors_refresh(struct sysmon_envs
 		/* just read the temperature register */
 		error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
 		sc->sc_addr, , 1, , 2, 0);
+		/* 8.2 bit fixed point Celsius -> microkelvin */
 		edata->value_cur = ((data >> 6) * 25) + 27315;
 	}
 	iic_release_bus(sc->sc_i2c, 0);



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips

2018-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar  9 21:49:55 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: aes.inc bn.inc
crypto.inc poly1305.inc sha.inc

Log Message:
match opening ( with closing ) instead of closing }.
fixes mips builds... partly.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc
cvs rdiff -u -r1.5 -r1.6 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc

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/lib/libcrypto/arch/mips/aes.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc:1.4 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc:1.5
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc:1.4	Fri Mar  9 12:40:23 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc	Fri Mar  9 21:49:55 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eb}
+.if empty(MACHINE_ARCH:M*eb)
 .PATH.S: ${.PARSEDIR}
 
 #AES_SRCS = aes-mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.5 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.6
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.5	Fri Mar  9 12:40:23 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc	Fri Mar  9 21:49:55 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eb}
+.if empty(MACHINE_ARCH:M*eb)
 .PATH.S: ${.PARSEDIR}
 
 BN_SRCS = mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S
Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.5 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.6
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.5	Fri Mar  9 12:40:23 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc	Fri Mar  9 21:49:55 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eb}
+.if empty(MACHINE_ARCH:M*eb)
 .PATH.S: ${.PARSEDIR}
 
 CRYPTO_SRCS += mips-mont${"${COPTS:M*-mabi=64*}" == "":?:64}.S
Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc:1.5 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc:1.6
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc:1.5	Fri Mar  9 12:40:23 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc	Fri Mar  9 21:49:55 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eb}
+.if empty(MACHINE_ARCH:M*eb)
 .PATH.S: ${.PARSEDIR}
 
 SHA_SRCS += sha1-mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc:1.3 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc:1.4
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc:1.3	Fri Mar  9 12:40:23 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc	Fri Mar  9 21:49:55 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eb}
+.if empty(MACHINE_ARCH:M*eb)
 .if !empty(MACHINE_ARCH:Mmips64*)
 
 .PATH.S: ${.PARSEDIR}



CVS commit: src

2018-03-09 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Mar  9 20:20:48 UTC 2018

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/lib/csu/common: crt0-common.c
src/tests/lib/csu: Makefile
Added Files:
src/tests/lib/csu: h_ifunc_static.c t_ifunc_static.sh

Log Message:
Add ifunc support for statically linked applications on x86, ppc, sparc
and ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.775 -r1.776 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.14 -r1.15 src/lib/csu/common/crt0-common.c
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/csu/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/csu/h_ifunc_static.c \
src/tests/lib/csu/t_ifunc_static.sh

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.243 src/distrib/sets/lists/debug/mi:1.244
--- src/distrib/sets/lists/debug/mi:1.243	Sat Feb 17 08:07:06 2018
+++ src/distrib/sets/lists/debug/mi	Fri Mar  9 20:20:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.243 2018/02/17 08:07:06 wiz Exp $
+# $NetBSD: mi,v 1.244 2018/03/09 20:20:48 joerg Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1865,6 +1865,7 @@
 ./usr/libdata/debug/usr/tests/kyua-testers/stacktrace_helper.debug	tests-kyua-tests	debug,atf,kyua,compattestfile
 ./usr/libdata/debug/usr/tests/kyua-testers/stacktrace_test.debug	tests-kyua-tests	debug,atf,kyua,compattestfile
 ./usr/libdata/debug/usr/tests/kyua-testers/text_test.debug		tests-kyua-tests	debug,atf,kyua,compattestfile
+./usr/libdata/debug/usr/tests/lib/csu/h_ifunc_static.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/csu/h_initfini.debug			tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/lib/csu/h_initfini1.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/csu/h_initfini2.debug			tests-lib-debug		debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.775 src/distrib/sets/lists/tests/mi:1.776
--- src/distrib/sets/lists/tests/mi:1.775	Thu Feb 22 14:24:03 2018
+++ src/distrib/sets/lists/tests/mi	Fri Mar  9 20:20:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.775 2018/02/22 14:24:03 martin Exp $
+# $NetBSD: mi,v 1.776 2018/03/09 20:20:48 joerg Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2399,11 +2399,13 @@
 ./usr/tests/lib/csutests-lib-tests	compattestfile,atf
 ./usr/tests/lib/csu/Atffile			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/csu/Kyuafile			tests-lib-tests		compattestfile,atf,kyua
+./usr/tests/lib/csu/h_ifunc_static		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/csu/h_initfini			tests-obsolete		obsolete
 ./usr/tests/lib/csu/h_initfini1			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/csu/h_initfini2			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/csu/h_initfini3			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/csu/t_crt0			tests-lib-tests		compattestfile,atf
+./usr/tests/lib/csu/t_ifunc_static		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libbluetooth			tests-lib-tests	compattestfile,atf
 ./usr/tests/lib/libbluetooth/Atffile		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libbluetooth/Kyuafile		tests-lib-tests		compattestfile,atf,kyua

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.14 src/lib/csu/common/crt0-common.c:1.15
--- src/lib/csu/common/crt0-common.c:1.14	Tue Jun  7 12:07:35 2016
+++ src/lib/csu/common/crt0-common.c	Fri Mar  9 20:20:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.14 2016/06/07 12:07:35 joerg Exp $ */
+/* $NetBSD: crt0-common.c,v 1.15 2018/03/09 20:20:47 joerg Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.14 2016/06/07 12:07:35 joerg Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.15 2018/03/09 20:20:47 joerg Exp $");
 
 #include 
 #include 
@@ -127,6 +127,74 @@ _fini(void)
 }
 #endif /* HAVE_INITFINI_ARRAY */
 
+#if defined(__x86_64__) || defined(__powerpc__) || defined(__sparc__)
+#define HAS_IPLTA
+static void fix_iplta(void) __noinline;
+#elif defined(__i386__) || defined(__arm__)
+#define HAS_IPLT
+static void fix_iplt(void) __noinline;
+#endif
+
+
+#ifdef HAS_IPLTA
+#include 
+extern const Elf_Rela __rela_iplt_start[] __dso_hidden __weak;
+extern const Elf_Rela __rela_iplt_end[] __dso_hidden __weak;
+
+static void
+fix_iplta(void)
+{
+	const Elf_Rela *rela, *relalim;
+	uintptr_t relocbase = 0;
+	Elf_Addr *where, target;
+
+	rela = __rela_iplt_start;
+	relalim = __rela_iplt_end;
+#if DEBUG
+	printf("%p - %p\n", rela, relalim);

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

2018-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  9 20:19:25 UTC 2018

Modified Files:
src/sys/arch/macppc/conf: POWERMAC_G5

Log Message:
add adadc driver


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/macppc/conf/POWERMAC_G5

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/macppc/conf/POWERMAC_G5
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.35 src/sys/arch/macppc/conf/POWERMAC_G5:1.36
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.35	Thu Mar  8 23:27:12 2018
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Fri Mar  9 20:19:25 2018
@@ -145,6 +145,7 @@ iic*		at i2cbus?
 admtemp* 	at iic?
 lmtemp* 	at iic?
 dstemp* 	at iic?
+adadc* 		at iic?
 fcu* 		at iic?
 deq* 		at iic?
 



CVS commit: src/libexec/ld.elf_so

2018-03-09 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Mar  9 20:19:11 UTC 2018

Modified Files:
src/libexec/ld.elf_so: rtld.c rtld.h
src/libexec/ld.elf_so/arch/powerpc: ppc_reloc.c

Log Message:
Like Sparc, PowerPC can use IRELATIVE relocations in non-PLT sections.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/libexec/ld.elf_so/rtld.c
cvs rdiff -u -r1.131 -r1.132 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.55 -r1.56 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.190 src/libexec/ld.elf_so/rtld.c:1.191
--- src/libexec/ld.elf_so/rtld.c:1.190	Sun Feb 11 18:58:44 2018
+++ src/libexec/ld.elf_so/rtld.c	Fri Mar  9 20:19:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.190 2018/02/11 18:58:44 jakllsch Exp $	 */
+/*	$NetBSD: rtld.c,v 1.191 2018/03/09 20:19:11 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.190 2018/02/11 18:58:44 jakllsch Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.191 2018/03/09 20:19:11 joerg Exp $");
 #endif /* not lint */
 
 #include 
@@ -263,7 +263,7 @@ static bool
 _rtld_call_ifunc_functions(sigset_t *mask, Obj_Entry *obj, u_int cur_objgen)
 {
 	if (obj->ifunc_remaining
-#ifdef __sparc__
+#if defined(__sparc__) || defined(__powerpc__)
 	|| obj->ifunc_remaining_nonplt
 #endif
 	) {

Index: src/libexec/ld.elf_so/rtld.h
diff -u src/libexec/ld.elf_so/rtld.h:1.131 src/libexec/ld.elf_so/rtld.h:1.132
--- src/libexec/ld.elf_so/rtld.h:1.131	Sat Aug 12 09:03:27 2017
+++ src/libexec/ld.elf_so/rtld.h	Fri Mar  9 20:19:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.h,v 1.131 2017/08/12 09:03:27 joerg Exp $	 */
+/*	$NetBSD: rtld.h,v 1.132 2018/03/09 20:19:11 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -300,7 +300,7 @@ typedef struct Struct_Obj_Entry {
 	size_t		fini_arraysz;	/* # of entries in it */
 	/* IRELATIVE relocations */
 	size_t		ifunc_remaining;
-#ifdef __sparc__
+#if defined(__sparc__) || defined(__powerpc__)
 	/* On SPARC, the PLT variant is called JMP_IREL and counted above. */
 	size_t		ifunc_remaining_nonplt;
 #endif

Index: src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
diff -u src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.55 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.56
--- src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.55	Thu Aug 10 19:03:26 2017
+++ src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c	Fri Mar  9 20:19:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppc_reloc.c,v 1.55 2017/08/10 19:03:26 joerg Exp $	*/
+/*	$NetBSD: ppc_reloc.c,v 1.56 2018/03/09 20:19:11 joerg Exp $	*/
 
 /*-
  * Copyright (C) 1998	Tsubai Masanari
@@ -30,7 +30,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ppc_reloc.c,v 1.55 2017/08/10 19:03:26 joerg Exp $");
+__RCSID("$NetBSD: ppc_reloc.c,v 1.56 2018/03/09 20:19:11 joerg Exp $");
 #endif /* not lint */
 
 #include 
@@ -285,6 +285,14 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			obj->path, (void *)*where, defobj->path));
 			break;
 
+		case R_TYPE(IRELATIVE):
+			/* IFUNC relocations are handled in _rtld_call_ifunc */
+			if (obj->ifunc_remaining_nonplt == 0) {
+obj->ifunc_remaining_nonplt =
+rela - obj->rela + 1;
+			}
+			break;
+
 		default:
 			rdbg(("sym = %lu, type = %lu, offset = %p, "
 			"addend = %p, contents = %p, symbol = %s",
@@ -314,10 +322,9 @@ _rtld_relocate_plt_lazy(Obj_Entry *obj)
 #else
 	Elf_Addr * const pltresolve = obj->pltgot + 8;
 	const Elf_Rela *rela;
-	int reloff;
 
-	rela = obj->pltrelalim;
-	for (reloff = rela - obj->pltrela; rela-- > obj->pltrela; --reloff) {
+	for (rela = obj->pltrelalim; rela-- > obj->pltrela;) {
+		size_t reloff = rela - obj->pltrela;
 		Elf_Word *where = (Elf_Word *)(obj->relocbase + rela->r_offset);
 
 		assert(ELF_R_TYPE(rela->r_info) == R_TYPE(JUMP_SLOT) ||
@@ -383,6 +390,19 @@ _rtld_call_ifunc(Obj_Entry *obj, sigset_
 *where = target;
 		}
 	}
+
+	while (obj->ifunc_remaining_nonplt > 0 && _rtld_objgen == cur_objgen) {
+		rela = obj->relalim - --obj->ifunc_remaining_nonplt;
+		if (ELF_R_TYPE(rela->r_info) != R_TYPE(IRELATIVE))
+			continue;
+		where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
+		target = (Elf_Addr)(obj->relocbase + rela->r_addend);
+		_rtld_exclusive_exit(mask);
+		target = _rtld_resolve_ifunc2(obj, target);
+		_rtld_exclusive_enter(mask);
+		if (*where != target)
+			*where = target;
+	}
 }
 
 static int



CVS commit: src/sys/dev/i2c

2018-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  9 20:16:54 UTC 2018

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: adadc.c

Log Message:
yet another temperature sensor / ADC
this one supports Analog Devices AD7417, found in some G5 macs
depends on OpenFirmware for calibration data


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/adadc.c
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/i2c/files.i2c

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/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.85 src/sys/dev/i2c/files.i2c:1.86
--- src/sys/dev/i2c/files.i2c:1.85	Thu Mar  8 23:25:56 2018
+++ src/sys/dev/i2c/files.i2c	Fri Mar  9 20:16:54 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.85 2018/03/08 23:25:56 macallan Exp $
+#	$NetBSD: files.i2c,v 1.86 2018/03/09 20:16:54 macallan Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -309,6 +309,11 @@ device	fcu: sysmon_envsys
 attach	fcu at iic
 file	dev/i2c/fcu.cfcu
 
+# Analog Devices AD7417 thermometer and ADC
+device	adadc: sysmon_envsys
+attach	adadc at iic
+file	dev/i2c/adadc.cadadc
+
 # HID over i2c
 # HID "bus"
 define  ihidbus {[ reportid = -1 ]}

Added files:

Index: src/sys/dev/i2c/adadc.c
diff -u /dev/null src/sys/dev/i2c/adadc.c:1.1
--- /dev/null	Fri Mar  9 20:16:54 2018
+++ src/sys/dev/i2c/adadc.c	Fri Mar  9 20:16:54 2018
@@ -0,0 +1,240 @@
+/* $NetBSD: adadc.c,v 1.1 2018/03/09 20:16:54 macallan Exp $ */
+
+/*-
+ * Copyright (c) 2018 Michael Lorenz
+ * All rights reserved.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/* a driver for Analog Devices AD7417 temperature sensors / ADCs */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.1 2018/03/09 20:16:54 macallan Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+/* commands */
+#define ADADC_TEMP	0x00	/* temperature, 16bit */
+#define ADADC_CONFIG	0x01	/* 8bit */
+#define ADADC_THYST	0x02	/* 16bit */
+#define ADADC_TOTI	0x03	/* 16bit, temperature threshold */
+#define ADADC_ADC	0x04	/* 16bit, ADC value */
+#define ADADC_CONFIG2	0x05	/* 8bit */
+
+/* 
+ * registers
+ * ADADC_TEMP has signed temperature in C in first byte, left aligned fraction
+ * in 2nd byte.
+ */
+
+#define ADADC_CFG_CHANNEL_0	0x00
+#define ADADC_CFG_CHANNEL_1	0x20
+#define ADADC_CFG_CHANNEL_2	0x40
+#define ADADC_CFG_CHANNEL_3	0x60
+#define ADADC_CFG_CHANNEL_4	0x80
+#define ADADC_CFG_CHANNEL_MASK	0xe0
+#define ADADC_CFG_FAULT_MASK	0x18
+#define ADADC_CFG_OTI_POL	0x04	/* overtemp output polarity */
+#define ADADC_CFG_INTMODE	0x02	/* interrupt mode */
+#define ADADC_CFG_SHUTDOWN	0x01	/* shutdown mode */
+
+
+struct adadc_softc {
+	device_t	sc_dev;
+	i2c_tag_t	sc_i2c;
+	i2c_addr_t	sc_addr;
+
+	struct sysmon_envsys *sc_sme;
+	envsys_data_t	sc_sensors[5];
+	int		sc_nsensors;
+	int		sc_diode_offset, sc_diode_slope;
+};
+
+static int	adadc_match(device_t, cfdata_t, void *);
+static void	adadc_attach(device_t, device_t, void *);
+
+static void	adadc_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
+
+CFATTACH_DECL_NEW(adadc, sizeof(struct adadc_softc),
+adadc_match, adadc_attach, NULL, NULL);
+
+static const char * dstemp_compats[] = {
+	"ad7417",
+	NULL
+};
+
+static int slope[5] = {0, 0, 0x0320, 0x00a0, 0x1f40};
+
+static int
+adadc_match(device_t parent, cfdata_t match, void *aux)
+{
+	struct i2c_attach_args *ia = aux;
+
+	if (ia->ia_name == NULL) {
+		/* no ID registers on this chip */
+		if ((ia->ia_addr & 0x2b) == 0x2b)
+			return 1;
+		return 0;
+	} else {
+		return 

CVS commit: src/tests/libexec/ld.elf_so

2018-03-09 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Mar  9 20:15:03 UTC 2018

Modified Files:
src/tests/libexec/ld.elf_so: h_ifunc.c t_ifunc.c
src/tests/libexec/ld.elf_so/helper_ifunc_dso: h_helper_ifunc.c

Log Message:
Avoid casting fun by switching ifunc helper functions to return
long long. Dead beef is too useful to switch to a different constant.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/libexec/ld.elf_so/h_ifunc.c
cvs rdiff -u -r1.7 -r1.8 src/tests/libexec/ld.elf_so/t_ifunc.c
cvs rdiff -u -r1.6 -r1.7 \
src/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.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/libexec/ld.elf_so/h_ifunc.c
diff -u src/tests/libexec/ld.elf_so/h_ifunc.c:1.1 src/tests/libexec/ld.elf_so/h_ifunc.c:1.2
--- src/tests/libexec/ld.elf_so/h_ifunc.c:1.1	Mon Aug 25 20:40:53 2014
+++ src/tests/libexec/ld.elf_so/h_ifunc.c	Fri Mar  9 20:15:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_ifunc.c,v 1.1 2014/08/25 20:40:53 joerg Exp $	*/
+/*	$NetBSD: h_ifunc.c,v 1.2 2018/03/09 20:15:03 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-extern int ifunc(void);
+extern long long ifunc(void);
 
 int
 main(int argc, char **argv)
@@ -39,5 +39,5 @@ main(int argc, char **argv)
 
 	if (argc != 2)
 		return 1;
-	return ifunc() != atoi(argv[1]);
+	return ifunc() != atoll(argv[1]);
 }

Index: src/tests/libexec/ld.elf_so/t_ifunc.c
diff -u src/tests/libexec/ld.elf_so/t_ifunc.c:1.7 src/tests/libexec/ld.elf_so/t_ifunc.c:1.8
--- src/tests/libexec/ld.elf_so/t_ifunc.c:1.7	Mon Jan  1 06:34:13 2018
+++ src/tests/libexec/ld.elf_so/t_ifunc.c	Fri Mar  9 20:15:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ifunc.c,v 1.7 2018/01/01 06:34:13 maya Exp $	*/
+/*	$NetBSD: t_ifunc.c,v 1.8 2018/03/09 20:15:03 joerg Exp $	*/
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -53,12 +53,12 @@ ATF_TC_BODY(rtld_ifunc, tc)
 	const char *envstr[] = {
 	"0", "1"
 	};
-	int expected_result[] = {
-	0xdeadbeef, 0xbeefdead
+	long long expected_result[] = {
+	0xdeadbeefll, 0xbeefdeadll
 	};
 	void *handle;
-	int (*sym)(void);
-	int result;
+	long long (*sym)(void);
+	long long result;
 	const char *error;
 	size_t i;
 
@@ -86,7 +86,7 @@ ATF_TC_BODY(rtld_ifunc, tc)
 		ATF_CHECK(error == NULL);
 
 		char *command;
-		easprintf(, "%s/h_ifunc %d",
+		easprintf(, "%s/h_ifunc %lld",
 		atf_tc_get_config_var(tc, "srcdir"), expected_result[i]);
 		if (system(command) != EXIT_SUCCESS)
 			atf_tc_fail("Test failed; see output for details");
@@ -106,13 +106,13 @@ ATF_TC_BODY(rtld_hidden_ifunc, tc)
 	const char *envstr[] = {
 	"0", "1"
 	};
-	int expected_result[] = {
-	0xdeadbeef, 0xbeefdead
+	long long expected_result[] = {
+	0xdeadbeefll, 0xbeefdeadll
 	};
 	void *handle;
-	int (*sym)(void);
-	int (*(*sym2)(void))(void);
-	int result;
+	long long (*sym)(void);
+	long long (*(*sym2)(void))(void);
+	long long result;
 	const char *error;
 	size_t i;
 
@@ -149,7 +149,7 @@ ATF_TC_BODY(rtld_hidden_ifunc, tc)
 		ATF_CHECK(error == NULL);
 
 		char *command;
-		easprintf(, "%s/h_ifunc %d",
+		easprintf(, "%s/h_ifunc %lld",
 		atf_tc_get_config_var(tc, "srcdir"), expected_result[i]);
 		if (system(command) != EXIT_SUCCESS)
 			atf_tc_fail("Test failed; see output for details");
@@ -165,26 +165,26 @@ ATF_TC_HEAD(rtld_main_ifunc, tc)
 }
 
 #if LINKER_SUPPORT
-static unsigned int
+static long long
 ifunc_helper(void)
 {
-	return 0xdeadbeef;
+	return 0xdeadbeefll;
 }
 
 static __attribute__((used))
-unsigned int (*resolve_ifunc(void))(void)
+long long (*resolve_ifunc(void))(void)
 {
 	return ifunc_helper;
 }
 __hidden_ifunc(ifunc, resolve_ifunc);
 #endif
-unsigned int ifunc(void);
+long long ifunc(void);
 
 ATF_TC_BODY(rtld_main_ifunc, tc)
 {
 	if (!LINKER_SUPPORT)
 		atf_tc_skip("Missing linker support for ifunc relocations");
-	ATF_CHECK(ifunc() == 0xdeadbeef);
+	ATF_CHECK(ifunc() == 0xdeadbeefll);
 }
 
 ATF_TP_ADD_TCS(tp)

Index: src/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c
diff -u src/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c:1.6 src/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c:1.7
--- src/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c:1.6	Sat Aug 12 09:03:28 2017
+++ src/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c	Fri Mar  9 20:15:03 2018
@@ -30,27 +30,27 @@
 #include 
 #include 
 
-static int
+static long long
 ifunc1(void)
 {
-	return 0xdeadbeef;
+	return 0xdeadbeefll;
 }
 
-static int
+static long long
 ifunc2(void)
 {
-	return 0xbeefdead;
+	return 0xbeefdeadll;
 }
 
 static __attribute__((used))
-int (*resolve_ifunc(void))(void)
+long long (*resolve_ifunc(void))(void)
 {
 	const char *e = getenv("USE_IFUNC2");
 	return e && strcmp(e, "1") == 0 ? ifunc2 : ifunc1;
 }
 
 static __attribute__((used))
-int (*resolve_ifunc2(void))(void)
+long 

CVS commit: [netbsd-7] src/doc

2018-03-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Mar  9 19:51:02 UTC 2018

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
1581


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.76 -r1.1.2.77 src/doc/CHANGES-7.2

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.76 src/doc/CHANGES-7.2:1.1.2.77
--- src/doc/CHANGES-7.2:1.1.2.76	Tue Mar  6 15:06:05 2018
+++ src/doc/CHANGES-7.2	Fri Mar  9 19:51:02 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.76 2018/03/06 15:06:05 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.77 2018/03/09 19:51:02 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -5296,3 +5296,8 @@ sys/arch/mips/mips/cache.c			1.59
 	Add missing call to mips_dcache_compute_align() affecting.
 	[flxd, ticket #1578]
 
+sys/conf/copyright1.16
+
+	Update for 2018 new year
+	[maya, ticket #1581]
+



CVS commit: [netbsd-7] src/sys/conf

2018-03-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Mar  9 19:50:16 UTC 2018

Modified Files:
src/sys/conf [netbsd-7]: copyright

Log Message:
Pull up following revision(s) (requested by maya in ticket #1581):
sys/conf/copyright: 1.16
Update for 2018 new year


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.2 -r1.12.4.3 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.12.4.2 src/sys/conf/copyright:1.12.4.3
--- src/sys/conf/copyright:1.12.4.2	Sat Mar 11 07:46:58 2017
+++ src/sys/conf/copyright	Fri Mar  9 19:50:16 2018
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
-The NetBSD Foundation, Inc.  All rights reserved.
+2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
+2018 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-7-0] src/doc

2018-03-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Mar  9 19:50:24 UTC 2018

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
1581


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.89 -r1.1.2.90 src/doc/CHANGES-7.0.3

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.89 src/doc/CHANGES-7.0.3:1.1.2.90
--- src/doc/CHANGES-7.0.3:1.1.2.89	Sat Mar  3 20:27:09 2018
+++ src/doc/CHANGES-7.0.3	Fri Mar  9 19:50:24 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.89 2018/03/03 20:27:09 snj Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.90 2018/03/09 19:50:24 snj Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5298,3 +5298,8 @@ sys/netipsec/ipsec_input.c			1.57-1.58
 	Fix out-of-bounds read.
 	[maxv, ticket #1577]
 
+sys/conf/copyright1.16
+
+	Update for 2018 new year
+	[maya, ticket #1581]
+



CVS commit: [netbsd-7-1] src/doc

2018-03-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Mar  9 19:50:30 UTC 2018

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.2

Log Message:
1581


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/doc/CHANGES-7.1.2

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

Modified files:

Index: src/doc/CHANGES-7.1.2
diff -u src/doc/CHANGES-7.1.2:1.1.2.19 src/doc/CHANGES-7.1.2:1.1.2.20
--- src/doc/CHANGES-7.1.2:1.1.2.19	Sat Mar  3 20:27:00 2018
+++ src/doc/CHANGES-7.1.2	Fri Mar  9 19:50:30 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.2,v 1.1.2.19 2018/03/03 20:27:00 snj Exp $
+# $NetBSD: CHANGES-7.1.2,v 1.1.2.20 2018/03/09 19:50:30 snj Exp $
 
 A complete list of changes from the NetBSD 7.1.1 release to the NetBSD 7.1.2
 release:
@@ -186,3 +186,8 @@ sys/netipsec/ipsec_input.c			1.57-1.58
 	Fix out-of-bounds read.
 	[maxv, ticket #1577]
 
+sys/conf/copyright1.16
+
+	Update for 2018 new year
+	[maya, ticket #1581]
+



CVS commit: [netbsd-7-0] src/sys/conf

2018-03-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Mar  9 19:50:14 UTC 2018

Modified Files:
src/sys/conf [netbsd-7-0]: copyright

Log Message:
Pull up following revision(s) (requested by maya in ticket #1581):
sys/conf/copyright: 1.16
Update for 2018 new year


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.1.2.1 -r1.12.4.1.2.2 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.12.4.1.2.1 src/sys/conf/copyright:1.12.4.1.2.2
--- src/sys/conf/copyright:1.12.4.1.2.1	Sat Mar 11 07:48:22 2017
+++ src/sys/conf/copyright	Fri Mar  9 19:50:14 2018
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
-The NetBSD Foundation, Inc.  All rights reserved.
+2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
+2018 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-7-1] src/sys/conf

2018-03-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Mar  9 19:50:15 UTC 2018

Modified Files:
src/sys/conf [netbsd-7-1]: copyright

Log Message:
Pull up following revision(s) (requested by maya in ticket #1581):
sys/conf/copyright: 1.16
Update for 2018 new year


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.2 -r1.12.4.2.2.1 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.12.4.2 src/sys/conf/copyright:1.12.4.2.2.1
--- src/sys/conf/copyright:1.12.4.2	Sat Mar 11 07:46:58 2017
+++ src/sys/conf/copyright	Fri Mar  9 19:50:15 2018
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
-The NetBSD Foundation, Inc.  All rights reserved.
+2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
+2018 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: src/etc/namedb

2018-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  9 18:56:02 UTC 2018

Modified Files:
src/etc/namedb: bind.keys

Log Message:
Update the keys file to the latest version from:

https://ftp.isc.org/isc/bind9/keys/9.11/bind.keys.v9_11

This includes the new KSK2017 key which is planned to replace the KSK2010
in October 11th, 2018. It is important to have software that ships with
both before September 11th 2018. Anything that bootstraps after that could
have trouble switching.

XXX: pullup-8, pullup-7, pullup-6


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/namedb/bind.keys

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

Modified files:

Index: src/etc/namedb/bind.keys
diff -u src/etc/namedb/bind.keys:1.1 src/etc/namedb/bind.keys:1.2
--- src/etc/namedb/bind.keys:1.1	Thu Apr 25 13:02:29 2013
+++ src/etc/namedb/bind.keys	Fri Mar  9 13:56:02 2018
@@ -1,5 +1,4 @@
-/*	$NetBSD: bind.keys,v 1.1 2013/04/25 17:02:29 christos Exp $	*/
-/* Id: bind.keys,v 1.7 2011-01-03 23:45:07 each Exp  */
+/*	$NetBSD: bind.keys,v 1.2 2018/03/09 18:56:02 christos Exp $	*/
 # The bind.keys file is used to override the built-in DNSSEC trust anchors
 # which are included as part of BIND 9.  As of the current release, the only
 # trust anchors it contains are those for the DNS root zone ("."), and for
@@ -16,15 +15,18 @@
 #
 # This file is NOT expected to be user-configured.
 #
-# These keys are current as of January 2011.  If any key fails to
+# These keys are current as of February 2017.  If any key fails to
 # initialize correctly, it may have expired.  In that event you should
 # replace this file with a current version.  The latest version of
 # bind.keys can always be obtained from ISC at https://www.isc.org/bind-keys.
 
 managed-keys {
 	# ISC DLV: See https://www.isc.org/solutions/dlv for details.
-# NOTE: This key is activated by setting "dnssec-lookaside auto;"
-# in named.conf.
+	#
+	# NOTE: The ISC DLV zone is being phased out as of February 2017;
+	# the key will remain in place but the zone will be otherwise empty.
+	# Configuring "dnssec-lookaside auto;" to activate this key is
+	# harmless, but is no longer useful and is not recommended.
 	dlv.isc.org. initial-key 257 3 5 "BEPHMu/5onzrEE7z1egmhg/WPO0+juoZrW3euWEn4MxDCE1+lLy2
 		brhQv5rN32RKtMzX6Mj70jdzeND4XknW58dnJNPCxn8+jAGl2FZLK8t+
 		1uq4W+nnA3qO2+DL+k6BD4mewMLbIYFwe0PG73Te9fZ2kJb56dhgMde5
@@ -33,10 +35,16 @@ managed-keys {
 		QKtUdvNXDrYJDSHZws3xiRXF1Rf+al9UmZfSav/4NWLKjHzpT59k/VSt
 		TDN0YUuWrBNh";
 
-	# ROOT KEY: See https://data.iana.org/root-anchors/root-anchors.xml
+	# ROOT KEYS: See https://data.iana.org/root-anchors/root-anchors.xml
 	# for current trust anchor information.
-# NOTE: This key is activated by setting "dnssec-validation auto;"
-# in named.conf.
+	#
+	# These keys are activated by setting "dnssec-validation auto;"
+	# in named.conf.
+	#
+	# This key (19036) is to be phased out starting in 2017. It will
+	# remain in the root zone for some time after its successor key
+	# has been added. It will remain this file until it is removed from
+	# the root zone.
 	. initial-key 257 3 8 "AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF
 		FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX
 		bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD
@@ -44,4 +52,19 @@ managed-keys {
 		W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS
 		Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq
 		QxA+Uk1ihz0=";
+
+	# This key (20326) is to be published in the root zone in 2017.
+	# Servers which were already using the old key (19036) should
+	# roll seamlessly to this new one via RFC 5011 rollover. Servers
+	# being set up for the first time can use the contents of this
+	# file as initializing keys; thereafter, the keys in the
+	# managed key database will be trusted and maintained
+	# automatically.
+	. initial-key 257 3 8 "AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3
+		+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv
+		ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF
+		0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e
+		oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd
+		RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN
+		R1AkUTV74bU=";
 };



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

2018-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  9 17:15:14 UTC 2018

Modified Files:
src/sys/arch/zaurus/conf: files.zaurus

Log Message:
revert previous; this was no typo.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/zaurus/conf/files.zaurus

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/zaurus/conf/files.zaurus
diff -u src/sys/arch/zaurus/conf/files.zaurus:1.14 src/sys/arch/zaurus/conf/files.zaurus:1.15
--- src/sys/arch/zaurus/conf/files.zaurus:1.14	Tue Mar  6 17:21:01 2018
+++ src/sys/arch/zaurus/conf/files.zaurus	Fri Mar  9 12:15:14 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.zaurus,v 1.14 2018/03/06 22:21:01 christos Exp $
+#	$NetBSD: files.zaurus,v 1.15 2018/03/09 17:15:14 christos Exp $
 #
 # Sharp Zaurus specific configuration info
 #
@@ -92,7 +92,7 @@ attach ztp at zssp
 file arch/zaurus/dev/ztp.c		ztp
 
 # WM8750 audio
-device zaudio: audiobus, auconv, mulaw, aurateconv, pxaiic
+device zaudio: audiobus, auconv, mulaw, aurateconv, pxaiis
 attach zaudio at iic
 file arch/zaurus/dev/zaudio.c		zaudio
 file arch/zaurus/dev/wm8731_zaudio.c	zaudio & cpu_xscale_pxa250



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

2018-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  9 17:14:58 UTC 2018

Modified Files:
src/sys/arch/arm/xscale: files.pxa2x0

Log Message:
fix device attributes


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/xscale/files.pxa2x0

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/xscale/files.pxa2x0
diff -u src/sys/arch/arm/xscale/files.pxa2x0:1.19 src/sys/arch/arm/xscale/files.pxa2x0:1.20
--- src/sys/arch/arm/xscale/files.pxa2x0:1.19	Fri Jun 16 18:39:34 2017
+++ src/sys/arch/arm/xscale/files.pxa2x0	Fri Mar  9 12:14:57 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pxa2x0,v 1.19 2017/06/16 22:39:34 pgoyette Exp $
+#	$NetBSD: files.pxa2x0,v 1.20 2018/03/09 17:14:57 christos Exp $
 #
 # Configuration info for Intel PXA2[751]0 CPU support
 #
@@ -78,11 +78,11 @@ device	pxapcic: pcmciabus
 file	arch/arm/xscale/pxa2x0_pcic.c		pxapcic
 
 # Inter-Integrated Circuit controller
-device	pxaiic {}
+device	pxaiic
 file	arch/arm/xscale/pxa2x0_i2c.c		pxaiic
 
 # Inter-IC Sound controller
-device	pxaiis {}
+device	pxaiis
 file	arch/arm/xscale/pxa2x0_i2s.c		pxaiis
 
 # PXA2x0 real time clock



CVS commit: src/share/mk

2018-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  9 12:58:59 UTC 2018

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
everyone switched to openssl-1.1


To generate a diff of this commit:
cvs rdiff -u -r1.1046 -r1.1047 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1046 src/share/mk/bsd.own.mk:1.1047
--- src/share/mk/bsd.own.mk:1.1046	Mon Mar  5 16:14:34 2018
+++ src/share/mk/bsd.own.mk	Fri Mar  9 07:58:59 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1046 2018/03/05 21:14:34 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1047 2018/03/09 12:58:59 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -100,11 +100,7 @@ MKGCCCMDS?=	no
 #
 # What OpenSSL is used?
 # 
-.if ${MACHINE} != "vax"
 HAVE_OPENSSL?=  11
-.else
-HAVE_OPENSSL?=  10
-.endif
 
 .if ${HAVE_OPENSSL} == 11
 EXTERNAL_OPENSSL_SUBDIR=openssl



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips

2018-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  9 12:40:24 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: aes.inc bn.inc
crypto.inc poly1305.inc sha.inc

Log Message:
use the proper match pattern


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc

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/lib/libcrypto/arch/mips/aes.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc:1.3 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc:1.4
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc:1.3	Fri Mar  9 07:39:30 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc	Fri Mar  9 07:40:23 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eh}
+.if empty(MACHINE_ARCH:M*eb}
 .PATH.S: ${.PARSEDIR}
 
 #AES_SRCS = aes-mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.4 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.5
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.4	Fri Mar  9 07:39:30 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc	Fri Mar  9 07:40:23 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eh}
+.if empty(MACHINE_ARCH:M*eb}
 .PATH.S: ${.PARSEDIR}
 
 BN_SRCS = mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S
Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.4 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.5
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.4	Fri Mar  9 07:39:30 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc	Fri Mar  9 07:40:23 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eh}
+.if empty(MACHINE_ARCH:M*eb}
 .PATH.S: ${.PARSEDIR}
 
 CRYPTO_SRCS += mips-mont${"${COPTS:M*-mabi=64*}" == "":?:64}.S
Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc:1.4 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc:1.5
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc:1.4	Fri Mar  9 07:39:30 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc	Fri Mar  9 07:40:23 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eh}
+.if empty(MACHINE_ARCH:M*eb}
 .PATH.S: ${.PARSEDIR}
 
 SHA_SRCS += sha1-mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc:1.2	Fri Mar  9 07:39:30 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc	Fri Mar  9 07:40:23 2018
@@ -1,4 +1,4 @@
-.if empty(MACHINE_ARCH:M*eh}
+.if empty(MACHINE_ARCH:M*eb}
 .if !empty(MACHINE_ARCH:Mmips64*)
 
 .PATH.S: ${.PARSEDIR}



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips

2018-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  9 12:39:30 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: aes.inc bn.inc
crypto.inc poly1305.inc sha.inc

Log Message:
Disable assembly stubs for the big endian variants of mips (could be more
precise? are all of them broken?)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc
cvs rdiff -u -r1.1 -r1.2 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc

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/lib/libcrypto/arch/mips/aes.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc:1.2	Wed Mar  7 14:44:31 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/aes.inc	Fri Mar  9 07:39:30 2018
@@ -1,6 +1,8 @@
+.if empty(MACHINE_ARCH:M*eh}
 .PATH.S: ${.PARSEDIR}
 
 #AES_SRCS = aes-mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S
 #AESCPPFLAGS = -DAES_ASM
+.endif
 
 .include "../../aes.inc"

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.3 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.4
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc:1.3	Wed Mar  7 14:44:31 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/bn.inc	Fri Mar  9 07:39:30 2018
@@ -1,5 +1,7 @@
+.if empty(MACHINE_ARCH:M*eh}
 .PATH.S: ${.PARSEDIR}
 
 BN_SRCS = mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S
+.endif
 
 .include "../../bn.inc"
Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.3 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.4
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.3	Wed Mar  7 14:44:31 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc	Fri Mar  9 07:39:30 2018
@@ -1,6 +1,8 @@
+.if empty(MACHINE_ARCH:M*eh}
 .PATH.S: ${.PARSEDIR}
 
 CRYPTO_SRCS += mips-mont${"${COPTS:M*-mabi=64*}" == "":?:64}.S
+.endif
 CRYPTO_SRCS += libc-memequal.c
 
 .include "../../crypto.inc"
Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc:1.3 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc:1.4
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc:1.3	Wed Mar  7 14:44:31 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/sha.inc	Fri Mar  9 07:39:30 2018
@@ -1,7 +1,9 @@
+.if empty(MACHINE_ARCH:M*eh}
 .PATH.S: ${.PARSEDIR}
 
 SHA_SRCS += sha1-mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S
 SHA_SRCS += sha512-mips${"${COPTS:M*-mabi=64*}" == "":?:64}.S
 
 SHACPPFLAGS = -DSHA1_ASM
+.endif
 .include "../../sha.inc"

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc:1.1 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc:1.2
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc:1.1	Mon Mar  5 11:43:50 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/poly1305.inc	Fri Mar  9 07:39:30 2018
@@ -1,3 +1,4 @@
+.if empty(MACHINE_ARCH:M*eh}
 .if !empty(MACHINE_ARCH:Mmips64*)
 
 .PATH.S: ${.PARSEDIR}
@@ -6,5 +7,6 @@ POLY1305_SRCS = poly1305-mips64.S
 POLY1305_CPPFLAGS+=-DPOLY1305_ASM
 
 .endif
+.endif
 
 .include "../../poly1305.inc"



CVS commit: src/sys

2018-03-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar  9 11:57:38 UTC 2018

Modified Files:
src/sys/kern: uipc_mbuf.c
src/sys/netinet: ip_reass.c
src/sys/netinet6: frag6.c
src/sys/sys: mbuf.h

Log Message:
Remove M_PKTHDR from secondary mbufs when reassembling packets.

This is a real problem, because I found at least one component that relies
on the fact that only the first mbuf has M_PKTHDR: far from here, in
m_splithdr, we don't update m->m_pkthdr.len if M_PKTHDR is found in a
secondary mbuf. (The initial intention there was to avoid updating
m_pkthdr.len twice, the assumption was that if M_PKTHDR is set then we're
dealing with the first mbuf.) Therefore, when handling fragmented IPsec
packets (in particular IPv6, IPv4 is a bit more complicated), we may end
up with an incorrect m_pkthdr.len after authentication or decryption. In
the case of ESP, this can lead to a remote crash on this instruction:

m_copydata(m, m->m_pkthdr.len - 3, 3, lastthree);

m_pkthdr.len is bigger than the actual mbuf chain.

It seems possible to me to trigger this bug even if you don't have the ESP
key, because the fragmentation part is outside of the encrypted ESP
payload.

So if you MITM the target, and intercept an incoming ESP packet (which you
can't decrypt), you should be able to forge a new specially-crafted,
fragmented packet and stuff the ESP payload (still encrypted, as you
intercepted it) into it. The decryption succeeds and the target crashes.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/kern/uipc_mbuf.c
cvs rdiff -u -r1.13 -r1.14 src/sys/netinet/ip_reass.c
cvs rdiff -u -r1.66 -r1.67 src/sys/netinet6/frag6.c
cvs rdiff -u -r1.178 -r1.179 src/sys/sys/mbuf.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/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.181 src/sys/kern/uipc_mbuf.c:1.182
--- src/sys/kern/uipc_mbuf.c:1.181	Mon Jan 22 15:05:27 2018
+++ src/sys/kern/uipc_mbuf.c	Fri Mar  9 11:57:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.181 2018/01/22 15:05:27 maxv Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.182 2018/03/09 11:57:38 maxv Exp $	*/
 
 /*
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.181 2018/01/22 15:05:27 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.182 2018/03/09 11:57:38 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -455,6 +455,16 @@ mb_ctor(void *arg, void *object, int fla
 	return (0);
 }
 
+void
+m_pkthdr_remove(struct mbuf *m)
+{
+	KASSERT(m->m_flags & M_PKTHDR);
+
+	m_tag_delete_chain(m, NULL);
+	m->m_flags &= ~M_PKTHDR;
+	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));
+}
+
 /*
  * Add mbuf to the end of a chain
  */

Index: src/sys/netinet/ip_reass.c
diff -u src/sys/netinet/ip_reass.c:1.13 src/sys/netinet/ip_reass.c:1.14
--- src/sys/netinet/ip_reass.c:1.13	Thu Feb  8 10:03:52 2018
+++ src/sys/netinet/ip_reass.c	Fri Mar  9 11:57:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_reass.c,v 1.13 2018/02/08 10:03:52 maxv Exp $	*/
+/*	$NetBSD: ip_reass.c,v 1.14 2018/03/09 11:57:38 maxv Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.13 2018/02/08 10:03:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.14 2018/03/09 11:57:38 maxv Exp $");
 
 #include 
 #include 
@@ -389,6 +389,7 @@ insert:
 		t = q->ipqe_m;
 		nq = TAILQ_NEXT(q, ipqe_q);
 		pool_cache_put(ipfren_cache, q);
+		m_pkthdr_remove(t);
 		m_cat(m, t);
 	}
 
@@ -406,7 +407,8 @@ insert:
 	m->m_data -= (ip->ip_hl << 2);
 
 	/* Fix up mbuf.  XXX This should be done elsewhere. */
-	if (m->m_flags & M_PKTHDR) {
+	{
+		KASSERT(m->m_flags & M_PKTHDR);
 		int plen = 0;
 		for (t = m; t; t = t->m_next) {
 			plen += t->m_len;

Index: src/sys/netinet6/frag6.c
diff -u src/sys/netinet6/frag6.c:1.66 src/sys/netinet6/frag6.c:1.67
--- src/sys/netinet6/frag6.c:1.66	Wed Feb  7 09:53:08 2018
+++ src/sys/netinet6/frag6.c	Fri Mar  9 11:57:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frag6.c,v 1.66 2018/02/07 09:53:08 maxv Exp $	*/
+/*	$NetBSD: frag6.c,v 1.67 2018/03/09 11:57:38 maxv Exp $	*/
 /*	$KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.66 2018/02/07 09:53:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.67 2018/03/09 11:57:38 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -434,6 +434,7 @@ insert:
 			t = t->m_next;
 		t->m_next = af6->ip6af_m;
 		m_adj(t->m_next, af6->ip6af_offset);
+		m_pkthdr_remove(t->m_next);
 		kmem_intr_free(af6, sizeof(struct ip6asfrag));
 		af6 = af6dwn;
 	}
@@ -472,12 +473,10 @@ insert:
 	kmem_intr_free(q6, sizeof(struct ip6q));
 	frag6_nfragpackets--;
 
-	if (m->m_flags & M_PKTHDR) { /* Isn't it always true? */
+	{
+		

CVS commit: src/sys/arch/macppc/dev

2018-03-09 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Mar  9 11:05:56 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: smu.c

Log Message:
Initialise ret to avoid returning uninitialised value if the if statement is
false. Found when building the POWERMAC_G5 kernel with clang.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/smu.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/macppc/dev/smu.c
diff -u src/sys/arch/macppc/dev/smu.c:1.3 src/sys/arch/macppc/dev/smu.c:1.4
--- src/sys/arch/macppc/dev/smu.c:1.3	Sun Oct  1 05:15:52 2017
+++ src/sys/arch/macppc/dev/smu.c	Fri Mar  9 11:05:56 2018
@@ -710,6 +710,7 @@ static int
 smu_fan_get_rpm(struct smu_fan *fan, int *rpm)
 {
 	int ret;
+	ret = 0;
 
 	if (time_uptime - fan->last_update > 1) {
 		ret = smu_fan_update_rpm(fan);



CVS commit: src/sys/netipsec

2018-03-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar  9 11:05:21 UTC 2018

Modified Files:
src/sys/netipsec: ipsecif.c

Log Message:
Fix ipsec(4) I/F esp_frag support.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/netipsec/ipsecif.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/netipsec/ipsecif.c
diff -u src/sys/netipsec/ipsecif.c:1.3 src/sys/netipsec/ipsecif.c:1.4
--- src/sys/netipsec/ipsecif.c:1.3	Tue Mar  6 10:07:06 2018
+++ src/sys/netipsec/ipsecif.c	Fri Mar  9 11:05:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsecif.c,v 1.3 2018/03/06 10:07:06 knakahara Exp $  */
+/*	$NetBSD: ipsecif.c,v 1.4 2018/03/09 11:05:21 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.3 2018/03/06 10:07:06 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.4 2018/03/09 11:05:21 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -259,7 +259,13 @@ ipsecif4_fragout(struct ipsec_variant *v
 	if (mtag)
 		m_tag_delete(m, mtag);
 
-	error = ip_fragment(m, ifp, mtu);
+	/* consider new IP header prepended in ipsecif4_output() */
+	if (mtu <= sizeof(struct ip)) {
+		m_freem(m);
+		return ENETUNREACH;
+	}
+	m->m_pkthdr.csum_flags |= M_CSUM_IPv4;
+	error = ip_fragment(m, ifp, mtu - sizeof(struct ip));
 	if (error)
 		return error;
 
@@ -396,7 +402,7 @@ ipsecif4_output(struct ipsec_variant *va
 	 * frangmentation is already done in ipsecif4_fragout(),
 	 * so ipsec4_process_packet() must not do fragmentation here.
 	 */
-	KASSERT(error != 0 || sa_mtu == 0);
+	KASSERT(sa_mtu == 0);
 
 done:
 	return error;



CVS commit: src/sys/net

2018-03-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar  9 11:03:26 UTC 2018

Modified Files:
src/sys/net: if_ipsec.c

Log Message:
Functionalize duplicated code. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/net/if_ipsec.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/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.5 src/sys/net/if_ipsec.c:1.6
--- src/sys/net/if_ipsec.c:1.5	Fri Mar  9 11:01:41 2018
+++ src/sys/net/if_ipsec.c	Fri Mar  9 11:03:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.5 2018/03/09 11:01:41 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.6 2018/03/09 11:03:26 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.5 2018/03/09 11:01:41 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.6 2018/03/09 11:03:26 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1321,6 +1321,20 @@ if_ipsec_add_mbuf(struct mbuf *m0, void 
 }
 
 static inline void
+if_ipsec_add_mbuf_addr_port(struct mbuf *m0, struct sockaddr *addr, in_port_t port)
+{
+
+	if (port == 0) {
+		if_ipsec_add_mbuf(m0, addr, addr->sa_len);
+	} else {
+		struct sockaddr addrport;
+
+		if_ipsec_set_addr_port(, addr, port);
+		if_ipsec_add_mbuf(m0, , addrport.sa_len);
+	}
+}
+
+static inline void
 if_ipsec_add_pad(struct mbuf *m0, size_t len)
 {
 	struct mbuf *m;
@@ -1525,27 +1539,13 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	m_copyback(m, 0, sizeof(msg), );
 
 	if_ipsec_add_mbuf(m, , sizeof(xsrc));
-	if (sport == 0) {
-		if_ipsec_add_mbuf(m, src, src->sa_len);
-	} else {
-		struct sockaddr addrport;
-
-		if_ipsec_set_addr_port(, src, sport);
-		if_ipsec_add_mbuf(m, , addrport.sa_len);
-	}
+	if_ipsec_add_mbuf_addr_port(m, src, sport);
 	padlen = PFKEY_UNUNIT64(xsrc.sadb_address_len)
 		- (sizeof(xsrc) + PFKEY_ALIGN8(src->sa_len));
 	if_ipsec_add_pad(m, padlen);
 
 	if_ipsec_add_mbuf(m, , sizeof(xdst));
-	if (dport == 0) {
-		if_ipsec_add_mbuf(m, dst, dst->sa_len);
-	} else {
-		struct sockaddr addrport;
-
-		if_ipsec_set_addr_port(, dst, dport);
-		if_ipsec_add_mbuf(m, , addrport.sa_len);
-	}
+	if_ipsec_add_mbuf_addr_port(m, dst, dport);
 	padlen = PFKEY_UNUNIT64(xdst.sadb_address_len)
 		- (sizeof(xdst) + PFKEY_ALIGN8(dst->sa_len));
 	if_ipsec_add_pad(m, padlen);
@@ -1553,21 +1553,8 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	if_ipsec_add_mbuf(m, , sizeof(xpl));
 	if (policy == IPSEC_POLICY_IPSEC) {
 		if_ipsec_add_mbuf(m, , sizeof(xisr));
-		if (sport == 0) {
-			if_ipsec_add_mbuf(m, src, src->sa_len);
-		} else {
-			struct sockaddr addrport;
-
-			if_ipsec_set_addr_port(, src, sport);
-			if_ipsec_add_mbuf(m, , addrport.sa_len);
-		}
-		if (dport == 0) {
-			if_ipsec_add_mbuf(m, dst, dst->sa_len);
-		} else {
-			struct sockaddr addrport;
-			if_ipsec_set_addr_port(, dst, dport);
-			if_ipsec_add_mbuf(m, , addrport.sa_len);
-		}
+		if_ipsec_add_mbuf_addr_port(m, src, sport);
+		if_ipsec_add_mbuf_addr_port(m, dst, dport);
 	}
 	padlen = PFKEY_UNUNIT64(xpl.sadb_x_policy_len) - sizeof(xpl);
 	if (src != NULL)



CVS commit: src/sys/net

2018-03-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar  9 11:01:41 UTC 2018

Modified Files:
src/sys/net: if_ipsec.c

Log Message:
Fix missing sadb_x_ipsecrequest informations for PF_KEY message.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/net/if_ipsec.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/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.4 src/sys/net/if_ipsec.c:1.5
--- src/sys/net/if_ipsec.c:1.4	Fri Mar  9 10:59:36 2018
+++ src/sys/net/if_ipsec.c	Fri Mar  9 11:01:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.4 2018/03/09 10:59:36 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.5 2018/03/09 11:01:41 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.4 2018/03/09 10:59:36 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.5 2018/03/09 11:01:41 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -109,7 +109,8 @@ static inline size_t if_ipsec_set_sadb_s
 static inline size_t if_ipsec_set_sadb_dst(struct sadb_address *,
 struct sockaddr *, int);
 static inline size_t if_ipsec_set_sadb_x_policy(struct sadb_x_policy *,
-struct sadb_x_ipsecrequest *, uint16_t, uint8_t, uint32_t, uint8_t);
+struct sadb_x_ipsecrequest *, uint16_t, uint8_t, uint32_t, uint8_t,
+struct sockaddr *, struct sockaddr *);
 static inline void if_ipsec_set_sadb_msg(struct sadb_msg *, uint16_t, uint8_t);
 static inline void if_ipsec_set_sadb_msg_add(struct sadb_msg *, uint16_t);
 static inline void if_ipsec_set_sadb_msg_del(struct sadb_msg *, uint16_t);
@@ -1388,7 +1389,7 @@ if_ipsec_set_sadb_dst(struct sadb_addres
 static inline size_t
 if_ipsec_set_sadb_x_policy(struct sadb_x_policy *xpl,
 struct sadb_x_ipsecrequest *xisr, uint16_t policy, uint8_t dir, uint32_t id,
-uint8_t level)
+uint8_t level, struct sockaddr *src, struct sockaddr *dst)
 {
 	size_t size;
 
@@ -1397,6 +1398,10 @@ if_ipsec_set_sadb_x_policy(struct sadb_x
 	size = sizeof(*xpl);
 	if (policy == IPSEC_POLICY_IPSEC) {
 		size += PFKEY_ALIGN8(sizeof(*xisr));
+		if (src != NULL)
+			size += PFKEY_ALIGN8(src->sa_len);
+		if (dst != NULL)
+			size += PFKEY_ALIGN8(dst->sa_len);
 	}
 	xpl->sadb_x_policy_len = PFKEY_UNIT64(size);
 	xpl->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
@@ -1408,6 +1413,10 @@ if_ipsec_set_sadb_x_policy(struct sadb_x
 
 	if (policy == IPSEC_POLICY_IPSEC) {
 		xisr->sadb_x_ipsecrequest_len = PFKEY_ALIGN8(sizeof(*xisr));
+		if (src != NULL)
+			xisr->sadb_x_ipsecrequest_len += PFKEY_ALIGN8(src->sa_len);
+		if (dst != NULL)
+			xisr->sadb_x_ipsecrequest_len += PFKEY_ALIGN8(dst->sa_len);
 		xisr->sadb_x_ipsecrequest_proto = IPPROTO_ESP;
 		xisr->sadb_x_ipsecrequest_mode = IPSEC_MODE_TRANSPORT;
 		xisr->sadb_x_ipsecrequest_level = level;
@@ -1506,7 +1515,7 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	ext_msg_len += PFKEY_UNIT64(size);
 	size = if_ipsec_set_sadb_dst(, dst, proto);
 	ext_msg_len += PFKEY_UNIT64(size);
-	size = if_ipsec_set_sadb_x_policy(, , policy, dir, 0, level);
+	size = if_ipsec_set_sadb_x_policy(, , policy, dir, 0, level, src, dst);
 	ext_msg_len += PFKEY_UNIT64(size);
 	if_ipsec_set_sadb_msg_add(, ext_msg_len);
 
@@ -1542,8 +1551,30 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	if_ipsec_add_pad(m, padlen);
 
 	if_ipsec_add_mbuf(m, , sizeof(xpl));
-	if (policy == IPSEC_POLICY_IPSEC)
+	if (policy == IPSEC_POLICY_IPSEC) {
 		if_ipsec_add_mbuf(m, , sizeof(xisr));
+		if (sport == 0) {
+			if_ipsec_add_mbuf(m, src, src->sa_len);
+		} else {
+			struct sockaddr addrport;
+
+			if_ipsec_set_addr_port(, src, sport);
+			if_ipsec_add_mbuf(m, , addrport.sa_len);
+		}
+		if (dport == 0) {
+			if_ipsec_add_mbuf(m, dst, dst->sa_len);
+		} else {
+			struct sockaddr addrport;
+			if_ipsec_set_addr_port(, dst, dport);
+			if_ipsec_add_mbuf(m, , addrport.sa_len);
+		}
+	}
+	padlen = PFKEY_UNUNIT64(xpl.sadb_x_policy_len) - sizeof(xpl);
+	if (src != NULL)
+		padlen -= PFKEY_ALIGN8(src->sa_len);
+	if (dst != NULL)
+		padlen -= PFKEY_ALIGN8(dst->sa_len);
+	if_ipsec_add_pad(m, padlen);
 
 	/* key_kpi_spdadd() has already done KEY_SP_REF(). */
 	return key_kpi_spdadd(m);
@@ -1636,7 +1667,7 @@ if_ipsec_del_sp0(struct secpolicy *sp)
 
 	MGETHDR(m, M_WAITOK, MT_DATA);
 
-	size = if_ipsec_set_sadb_x_policy(, NULL, 0, 0, sp->id, 0);
+	size = if_ipsec_set_sadb_x_policy(, NULL, 0, 0, sp->id, 0, NULL, NULL);
 	ext_msg_len += PFKEY_UNIT64(size);
 
 	if_ipsec_set_sadb_msg_del(, ext_msg_len);



CVS commit: src/sys/net

2018-03-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar  9 10:59:36 UTC 2018

Modified Files:
src/sys/net: if_ipsec.c

Log Message:
NAT-T src and dst port in ipsec_variant should be network byte order.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/net/if_ipsec.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/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.3 src/sys/net/if_ipsec.c:1.4
--- src/sys/net/if_ipsec.c:1.3	Wed Jan 31 07:33:18 2018
+++ src/sys/net/if_ipsec.c	Fri Mar  9 10:59:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.3 2018/01/31 07:33:18 mrg Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.4 2018/03/09 10:59:36 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3 2018/01/31 07:33:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.4 2018/03/09 10:59:36 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -892,7 +892,7 @@ if_ipsec_set_tunnel(struct ifnet *ifp,
 	switch(nsrc->sa_family) {
 #ifdef INET
 	case AF_INET:
-		nsport = ntohs(satosin(src)->sin_port);
+		nsport = satosin(src)->sin_port;
 		/*
 		 * avoid confuse SP when NAT-T disabled,
 		 * e.g.
@@ -900,15 +900,15 @@ if_ipsec_set_tunnel(struct ifnet *ifp,
 		 * confuse : 10.0.1.2[600] 10.0.1.1[600] 4(ipv4)
 		 */
 		satosin(nsrc)->sin_port = 0;
-		ndport = ntohs(satosin(dst)->sin_port);
+		ndport = satosin(dst)->sin_port;
 		satosin(ndst)->sin_port = 0;
 		break;
 #endif /* INET */
 #ifdef INET6
 	case AF_INET6:
-		nsport = ntohs(satosin6(src)->sin6_port);
+		nsport = satosin6(src)->sin6_port;
 		satosin6(nsrc)->sin6_port = 0;
-		ndport = ntohs(satosin6(dst)->sin6_port);
+		ndport = satosin6(dst)->sin6_port;
 		satosin6(ndst)->sin6_port = 0;
 		break;
 #endif /* INET6 */
@@ -1459,14 +1459,14 @@ if_ipsec_set_addr_port(struct sockaddr *
 #ifdef INET
 	case AF_INET: {
 		struct sockaddr_in *sin = satosin(addrport);
-		sin->sin_port = htons(port);
+		sin->sin_port = port;
 		break;
 	}
 #endif /* INET */
 #ifdef INET6
 	case AF_INET6: {
 		struct sockaddr_in6 *sin6 = satosin6(addrport);
-		sin6->sin6_port = htons(port);
+		sin6->sin6_port = port;
 		break;
 	}
 #endif /* INET6 */



CVS commit: [pgoyette-compat] src/sys

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar  9 10:41:05 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: sysv_mod.h
src/sys/kern [pgoyette-compat]: sysv_ipc.c

Log Message:
Allocate the function vector only once.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/compat/common/sysv_mod.h
cvs rdiff -u -r1.32.16.2 -r1.32.16.3 src/sys/kern/sysv_ipc.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/compat/common/sysv_mod.h
diff -u src/sys/compat/common/sysv_mod.h:1.1.2.1 src/sys/compat/common/sysv_mod.h:1.1.2.2
--- src/sys/compat/common/sysv_mod.h:1.1.2.1	Fri Mar  9 02:02:59 2018
+++ src/sys/compat/common/sysv_mod.h	Fri Mar  9 10:41:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_mod.h,v 1.1.2.1 2018/03/09 02:02:59 pgoyette Exp $	*/
+/*	$NetBSD: sysv_mod.h,v 1.1.2.2 2018/03/09 10:41:05 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,6 +34,6 @@
 
 #include 
 
-int (*vec_sysvipc50_sysctl)(SYSCTLFN_PROTO);
+extern int (*vec_sysvipc50_sysctl)(SYSCTLFN_PROTO);
 
 #endif /* _COMPAT_COMMON_SYSV_IPC_MOD_H_ */

Index: src/sys/kern/sysv_ipc.c
diff -u src/sys/kern/sysv_ipc.c:1.32.16.2 src/sys/kern/sysv_ipc.c:1.32.16.3
--- src/sys/kern/sysv_ipc.c:1.32.16.2	Fri Mar  9 03:58:33 2018
+++ src/sys/kern/sysv_ipc.c	Fri Mar  9 10:41:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_ipc.c,v 1.32.16.2 2018/03/09 03:58:33 pgoyette Exp $	*/
+/*	$NetBSD: sysv_ipc.c,v 1.32.16.3 2018/03/09 10:41:05 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.32.16.2 2018/03/09 03:58:33 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.32.16.3 2018/03/09 10:41:05 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -64,6 +64,8 @@ __KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v
 
 #include 	/* for sysctl routine vector */
 
+int (*vec_sysvipc50_sysctl)(SYSCTLFN_PROTO);
+
 /*
  * Values in support of System V compatible shared memory.	XXX
  * (originally located in sys/conf/param.c)



CVS commit: [pgoyette-compat] src/sys

2018-03-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar  9 09:37:01 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: sysv_mod.c
src/sys/modules/compat_sysv [pgoyette-compat]: Makefile

Log Message:
The last of the rename


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/compat/common/sysv_mod.c
cvs rdiff -u -r1.3.10.2 -r1.3.10.3 src/sys/modules/compat_sysv/Makefile

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

Modified files:

Index: src/sys/compat/common/sysv_mod.c
diff -u src/sys/compat/common/sysv_mod.c:1.1.2.5 src/sys/compat/common/sysv_mod.c:1.1.2.6
--- src/sys/compat/common/sysv_mod.c:1.1.2.5	Fri Mar  9 04:48:42 2018
+++ src/sys/compat/common/sysv_mod.c	Fri Mar  9 09:37:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_mod.c,v 1.1.2.5 2018/03/09 04:48:42 pgoyette Exp $	*/
+/*	$NetBSD: sysv_mod.c,v 1.1.2.6 2018/03/09 09:37:01 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_mod.c,v 1.1.2.5 2018/03/09 04:48:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_mod.c,v 1.1.2.6 2018/03/09 09:37:01 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: sysv_mod.c,v
 int sysctl_kern_sysvipc50(SYSCTLFN_PROTO);
 #endif
 
-MODULE(MODULE_CLASS_EXEC, compat_sysv_ipc, "sysv_ipc");
+MODULE(MODULE_CLASS_EXEC, compat_sysv, "sysv_ipc");
 
 /* Build the syscall package based on options specified */
 
@@ -95,9 +95,9 @@ static const struct syscall_package comp
 };
 
 static int
-compat_sysv_ipc_modcmd(modcmd_t cmd, void *arg)
+compat_sysv_modcmd(modcmd_t cmd, void *arg)
 {
-	static (*orig_sysvipc50_sysctl)(SYSCTLFN_PROTO);
+	static int (*orig_sysvipc50_sysctl)(SYSCTLFN_PROTO);
 
 	int error = 0;
 

Index: src/sys/modules/compat_sysv/Makefile
diff -u src/sys/modules/compat_sysv/Makefile:1.3.10.2 src/sys/modules/compat_sysv/Makefile:1.3.10.3
--- src/sys/modules/compat_sysv/Makefile:1.3.10.2	Fri Mar  9 03:58:33 2018
+++ src/sys/modules/compat_sysv/Makefile	Fri Mar  9 09:37:01 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3.10.2 2018/03/09 03:58:33 pgoyette Exp $
+# $NetBSD: Makefile,v 1.3.10.3 2018/03/09 09:37:01 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -15,7 +15,7 @@ CPPFLAGS+=	-DCOMPAT_13
 CPPFLAGS+=	-DCOMPAT_14
 CPPFLAGS+=	-DCOMPAT_50
 
-SRCS+=	sysv_ipc.c
+SRCS+=	sysv_mod.c
 SRCS+=	kern_ipc_10.c
 SRCS+=	sysv_msg_14.c sysv_sem_14.c sysv_shm_14.c
 SRCS+=	sysv_msg_50.c sysv_sem_50.c sysv_shm_50.c



CVS commit: src

2018-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar  9 08:49:32 UTC 2018

Modified Files:
src/sys/arch/x86/include: cacheinfo.h
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
 Add yet another Shared L2 TLB (2M/4M pages).

XXX need redesign.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/x86/include/cacheinfo.h
cvs rdiff -u -r1.82 -r1.83 src/usr.sbin/cpuctl/arch/i386.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/x86/include/cacheinfo.h
diff -u src/sys/arch/x86/include/cacheinfo.h:1.23 src/sys/arch/x86/include/cacheinfo.h:1.24
--- src/sys/arch/x86/include/cacheinfo.h:1.23	Mon Mar  5 05:44:07 2018
+++ src/sys/arch/x86/include/cacheinfo.h	Fri Mar  9 08:49:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cacheinfo.h,v 1.23 2018/03/05 05:44:07 msaitoh Exp $	*/
+/*	$NetBSD: cacheinfo.h,v 1.24 2018/03/09 08:49:32 msaitoh Exp $	*/
 
 #ifndef _X86_CACHEINFO_H_
 #define _X86_CACHEINFO_H_
@@ -35,9 +35,10 @@ struct x86_cache_info {
 #define CAI_L2_DTLB2	15		/* L2 Data TLB (2/4M pages) */
 #define CAI_L2_STLB	16		/* Shared L2 TLB (4K pages) */
 #define CAI_L2_STLB2	17		/* Shared L2 TLB (4K/2M pages) */
-#define CAI_PREFETCH	18		/* Prefetch */
+#define CAI_L2_STLB3	18		/* Shared L2 TLB (2M/4M pages) */
+#define CAI_PREFETCH	19		/* Prefetch */
 
-#define	CAI_COUNT	19
+#define	CAI_COUNT	20
 
 /*
  * AMD Cache Info:

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.82 src/usr.sbin/cpuctl/arch/i386.c:1.83
--- src/usr.sbin/cpuctl/arch/i386.c:1.82	Mon Mar  5 10:54:05 2018
+++ src/usr.sbin/cpuctl/arch/i386.c	Fri Mar  9 08:49:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.82 2018/03/05 10:54:05 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.83 2018/03/09 08:49:32 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.82 2018/03/05 10:54:05 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.83 2018/03/09 08:49:32 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -1094,6 +1094,7 @@ intel_cpu_cacheinfo(struct cpu_info *ci)
 	x86_cpuid(0x18, descs);
 	iterations = descs[0];
 	for (i = 0; i <= iterations; i++) {
+		uint32_t pgsize;
 		bool full;
 
 		x86_cpuid2(0x18, i, descs);
@@ -1101,13 +1102,48 @@ intel_cpu_cacheinfo(struct cpu_info *ci)
 		if (type == CPUID_DATP_TCTYPE_N)
 			continue;
 		level = __SHIFTOUT(descs[3], CPUID_DATP_TCLEVEL);
+		pgsize = __SHIFTOUT(descs[1], CPUID_DATP_PGSIZE);
 		switch (level) {
 		case 1:
-			if (type == CPUID_DATP_TCTYPE_I)
-caitype = CAI_ITLB; /* XXX or ITLB2? */
-			else if (type == CPUID_DATP_TCTYPE_D)
-caitype = CAI_DTLB;
-			else
+			if (type == CPUID_DATP_TCTYPE_I) {
+switch (pgsize) {
+case CPUID_DATP_PGSIZE_4KB:
+	caitype = CAI_ITLB;
+	break;
+case CPUID_DATP_PGSIZE_2MB
+| CPUID_DATP_PGSIZE_4MB:
+	caitype = CAI_ITLB2;
+	break;
+case CPUID_DATP_PGSIZE_1GB:
+	caitype = CAI_L1_1GBITLB;
+	break;
+default:
+	aprint_error_dev(ci->ci_dev,
+	"error: unknown ITLB size (%d)\n",
+	pgsize);
+	caitype = CAI_ITLB;
+	break;
+}
+			} else if (type == CPUID_DATP_TCTYPE_D) {
+switch (pgsize) {
+case CPUID_DATP_PGSIZE_4KB:
+	caitype = CAI_DTLB;
+	break;
+case CPUID_DATP_PGSIZE_2MB
+| CPUID_DATP_PGSIZE_4MB:
+	caitype = CAI_DTLB2;
+	break;
+case CPUID_DATP_PGSIZE_1GB:
+	caitype = CAI_L1_1GBDTLB;
+	break;
+default:
+	aprint_error_dev(ci->ci_dev,
+	"error: unknown DTLB size (%d)\n",
+	pgsize);
+	caitype = CAI_DTLB;
+	break;
+}
+			} else
 caitype = -1;
 			break;
 		case 2:
@@ -1115,9 +1151,27 @@ intel_cpu_cacheinfo(struct cpu_info *ci)
 caitype = CAI_L2_ITLB;
 			else if (type == CPUID_DATP_TCTYPE_D)
 caitype = CAI_L2_DTLB;
-			else if (type == CPUID_DATP_TCTYPE_U)
-caitype = CAI_L2_STLB;
-			else
+			else if (type == CPUID_DATP_TCTYPE_U) {
+switch (pgsize) {
+case CPUID_DATP_PGSIZE_4KB:
+	caitype = CAI_L2_STLB;
+	break;
+case CPUID_DATP_PGSIZE_4KB
+| CPUID_DATP_PGSIZE_2MB:
+	caitype = CAI_L2_STLB2;
+	break;
+case CPUID_DATP_PGSIZE_2MB
+| CPUID_DATP_PGSIZE_4MB:
+	caitype = CAI_L2_STLB3;
+	break;
+default:
+	aprint_error_dev(ci->ci_dev,
+	"error: unknown L2 STLB size (%d)\n",
+	pgsize);
+	caitype = CAI_DTLB;
+	break;
+}
+			} else
 caitype = -1;
 			break;
 		case 3:
@@ -1134,7 +1188,7 @@ intel_cpu_cacheinfo(struct cpu_info *ci)
 			level, type);
 			continue;
 		}
-		switch (__SHIFTOUT(descs[1], CPUID_DATP_PGSIZE)) {
+		switch (pgsize) {
 		case CPUID_DATP_PGSIZE_4KB:
 			linesize = 4 * 1024;
 			break;
@@ -1165,7 +1219,7 @@ intel_cpu_cacheinfo(struct cpu_info *ci)
 		= ways * sets; /* entries */