CVS commit: src/sys/compat/linux/common

2018-07-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul  9 05:43:35 UTC 2018

Modified Files:
src/sys/compat/linux/common: linux_exec_elf32.c

Log Message:
 Fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/compat/linux/common/linux_exec_elf32.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/linux/common/linux_exec_elf32.c
diff -u src/sys/compat/linux/common/linux_exec_elf32.c:1.95 src/sys/compat/linux/common/linux_exec_elf32.c:1.96
--- src/sys/compat/linux/common/linux_exec_elf32.c:1.95	Sun Jul  8 17:58:39 2018
+++ src/sys/compat/linux/common/linux_exec_elf32.c	Mon Jul  9 05:43:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_exec_elf32.c,v 1.95 2018/07/08 17:58:39 christos Exp $	*/
+/*	$NetBSD: linux_exec_elf32.c,v 1.96 2018/07/09 05:43:35 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.95 2018/07/08 17:58:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.96 2018/07/09 05:43:35 msaitoh Exp $");
 
 #ifndef ELFSIZE
 /* XXX should die */
@@ -78,7 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_exec_e
 #ifdef DEBUG_LINUX
 #define DPRINTF(a)	uprintf a
 #else
-#define DPRINTF(a)
+#define DPRINTF(a)	do {} while (0)
 #endif
 
 #ifdef LINUX_ATEXIT_SIGNATURE
@@ -313,7 +313,7 @@ ELFNAME2(linux,go_rt0_signature)(struct 
 		if (error)
 			goto out;
 		if (!memcmp(tbuf, signature, sigsz)) {
-			DPRINTF(("linux_goplcntab_sig=%s\n", tbuf);
+			DPRINTF(("linux_goplcntab_sig=%s\n", tbuf));
 			break;
 		}
 	}



CVS commit: src/lib/libpuffs

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul  9 00:47:48 UTC 2018

Modified Files:
src/lib/libpuffs: callcontext.c

Log Message:
revert previous now that MAP_ALIGNED has been fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libpuffs/callcontext.c

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

Modified files:

Index: src/lib/libpuffs/callcontext.c
diff -u src/lib/libpuffs/callcontext.c:1.29 src/lib/libpuffs/callcontext.c:1.30
--- src/lib/libpuffs/callcontext.c:1.29	Sun Jul  8 12:48:47 2018
+++ src/lib/libpuffs/callcontext.c	Sun Jul  8 20:47:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: callcontext.c,v 1.29 2018/07/08 16:48:47 christos Exp $	*/
+/*	$NetBSD: callcontext.c,v 1.30 2018/07/09 00:47:47 christos Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: callcontext.c,v 1.29 2018/07/08 16:48:47 christos Exp $");
+__RCSID("$NetBSD: callcontext.c,v 1.30 2018/07/09 00:47:47 christos Exp $");
 #endif /* !lint */
 
 #include 
@@ -194,7 +194,7 @@ slowccalloc(struct puffs_usermount *pu)
 		return 
 
 	sp = mmap(NULL, stacksize, PROT_READ|PROT_WRITE,
-	(int)(MAP_ANON|MAP_PRIVATE|MAP_ALIGNED(pu->pu_cc_stackshift)), -1, 0);
+	MAP_ANON|MAP_PRIVATE|MAP_ALIGNED(pu->pu_cc_stackshift), -1, 0);
 	if (sp == MAP_FAILED)
 		return NULL;
 



CVS commit: src/sys/sys

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul  9 00:46:19 UTC 2018

Modified Files:
src/sys/sys: mman.h

Log Message:
cast align result to int, since the flags argument is expected to be an int.
>From Kamil


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/sys/mman.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/sys/mman.h
diff -u src/sys/sys/mman.h:1.54 src/sys/sys/mman.h:1.55
--- src/sys/sys/mman.h:1.54	Tue Jul  3 21:17:32 2018
+++ src/sys/sys/mman.h	Sun Jul  8 20:46:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mman.h,v 1.54 2018/07/04 01:17:32 kamil Exp $	*/
+/*	$NetBSD: mman.h,v 1.55 2018/07/09 00:46:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -106,7 +106,7 @@ typedef	__off_t		off_t;		/* file offset 
  * Alignment (expressed in log2).  Must be >= log2(PAGE_SIZE) and
  * < # bits in a pointer (32 or 64).
  */
-#define	MAP_ALIGNED(n)		((unsigned int)(n) << MAP_ALIGNMENT_SHIFT)
+#define	MAP_ALIGNED(n)	((int)((unsigned int)(n) << MAP_ALIGNMENT_SHIFT))
 #define	MAP_ALIGNMENT_SHIFT	24
 #define	MAP_ALIGNMENT_MASK	MAP_ALIGNED(0xff)
 #define	MAP_ALIGNMENT_64KB	MAP_ALIGNED(16)	/* 2^16 */



CVS commit: src/sys/sys

2018-07-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul  8 21:59:12 UTC 2018

Modified Files:
src/sys/sys: types.h

Log Message:
Revert previous as requested.  Leaving it to dholland@ (who originally
proposed this on IRC) to raise any necessary discussion on tech-kern.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/sys/types.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/sys/types.h
diff -u src/sys/sys/types.h:1.99 src/sys/sys/types.h:1.100
--- src/sys/sys/types.h:1.99	Sun Jul  8 06:21:41 2018
+++ src/sys/sys/types.h	Sun Jul  8 21:59:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.99 2018/07/08 06:21:41 pgoyette Exp $	*/
+/*	$NetBSD: types.h,v 1.100 2018/07/08 21:59:12 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993, 1994
@@ -345,7 +345,7 @@ struct	uio;
 #ifdef _KERNEL
 #define SET(t, f)	((t) |= (f))
 #define	ISSET(t, f)	((t) & (f))
-#define	CLR(t, f)	((t) = ~(~(t) | (f)))
+#define	CLR(t, f)	((t) &= ~(f))
 #endif
 
 #if !defined(_KERNEL) && !defined(_STANDALONE)



CVS commit: src/external/bsd/ppp/usr.sbin/pppd

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 21:01:21 UTC 2018

Modified Files:
src/external/bsd/ppp/usr.sbin/pppd: sys-bsd.c

Log Message:
New arp code needs RTF_LLDATA for DELETE to work!
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c

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

Modified files:

Index: src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c
diff -u src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.4 src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.5
--- src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c:1.4	Sat Aug  6 01:58:20 2016
+++ src/external/bsd/ppp/usr.sbin/pppd/sys-bsd.c	Sun Jul  8 17:01:21 2018
@@ -1679,7 +1679,7 @@ sifproxyarp(int unit, u_int32_t hisaddr)
 }
 
 arpmsg.hdr.rtm_type = RTM_ADD;
-arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC;
+arpmsg.hdr.rtm_flags = RTF_ANNOUNCE | RTF_HOST | RTF_STATIC | RTF_LLDATA;
 arpmsg.hdr.rtm_version = RTM_VERSION;
 arpmsg.hdr.rtm_seq = ++rtm_seq;
 arpmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;



CVS commit: src/share/man/man4

2018-07-08 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sun Jul  8 20:29:08 UTC 2018

Modified Files:
src/share/man/man4: puc.4

Log Message:
mention Oxford Semiconductor OXPCIe954 4-port PCIe serial card


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/share/man/man4/puc.4

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

Modified files:

Index: src/share/man/man4/puc.4
diff -u src/share/man/man4/puc.4:1.40 src/share/man/man4/puc.4:1.41
--- src/share/man/man4/puc.4:1.40	Mon May  4 21:29:38 2015
+++ src/share/man/man4/puc.4	Sun Jul  8 20:29:08 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: puc.4,v 1.40 2015/05/04 21:29:38 wiz Exp $
+.\" $NetBSD: puc.4,v 1.41 2018/07/08 20:29:08 jnemeth Exp $
 .\"
 .\" Copyright (c) 1998 Christopher G. Demetriou
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" <>
 .\"
-.Dd May 4, 2015
+.Dd July 8, 2018
 .Dt PUC 4
 .Os
 .Sh NAME
@@ -130,6 +130,7 @@ The driver currently supports the follow
 .It Tn "Oxford Semiconductor OX16PCI954 (4 port serial)"
 .It Tn "Oxford Semiconductor OX16PCI958 (8 port serial)"
 .It Tn "Oxford Semiconductor OXPCIe952 (2 port serial, legacy mode)"
+.It Tn "Oxford Semiconductor OXPCIe954 (4 port serial)"
 .It Tn "Oxford Semiconductor OXmPCI952 (2 port serial)"
 .It Tn "Perle Systems PCI-RAS 4 modem ports"
 .It Tn "Perle Systems PCI-RAS 8 modem ports"



CVS commit: src/sys/compat/linux/common

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 17:58:39 UTC 2018

Modified Files:
src/sys/compat/linux/common: linux_exec_elf32.c

Log Message:
Enable executing linux go binaries by using a special probe function for them.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/compat/linux/common/linux_exec_elf32.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/linux/common/linux_exec_elf32.c
diff -u src/sys/compat/linux/common/linux_exec_elf32.c:1.94 src/sys/compat/linux/common/linux_exec_elf32.c:1.95
--- src/sys/compat/linux/common/linux_exec_elf32.c:1.94	Mon Feb  6 18:45:49 2017
+++ src/sys/compat/linux/common/linux_exec_elf32.c	Sun Jul  8 13:58:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_exec_elf32.c,v 1.94 2017/02/06 23:45:49 uwe Exp $	*/
+/*	$NetBSD: linux_exec_elf32.c,v 1.95 2018/07/08 17:58:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.94 2017/02/06 23:45:49 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.95 2018/07/08 17:58:39 christos Exp $");
 
 #ifndef ELFSIZE
 /* XXX should die */
@@ -73,6 +73,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_exec_e
 #include 
 #include 
 
+#define LINUX_GO_RT0_SIGNATURE
+
 #ifdef DEBUG_LINUX
 #define DPRINTF(a)	uprintf a
 #else
@@ -264,6 +266,93 @@ out:
 }
 #endif
 
+#ifdef LINUX_GO_RT0_SIGNATURE
+/*
+ * Look for a .gopclntab, specific to go binaries
+ * in it look for a symbol called _rt0__linux
+ */
+static int
+ELFNAME2(linux,go_rt0_signature)(struct lwp *l, struct exec_package *epp, Elf_Ehdr *eh)
+{
+	Elf_Shdr *sh;
+	size_t shsize;
+	u_int shstrndx;
+	size_t i;
+	static const char signature[] = ".gopclntab";
+	const size_t sigsz = sizeof(signature);
+	char tbuf[sizeof(signature)], *tmp = NULL;
+	char mbuf[64];
+	const char *m;
+	int mlen;
+	int error;
+
+	/* Load the section header table. */
+	shsize = eh->e_shnum * sizeof(Elf_Shdr);
+	sh = malloc(shsize, M_TEMP, M_WAITOK);
+	error = exec_read_from(l, epp->ep_vp, eh->e_shoff, sh, shsize);
+	if (error)
+		goto out;
+
+	/* Now let's find the string table. If it does not exist, give up. */
+	shstrndx = eh->e_shstrndx;
+	if (shstrndx == SHN_UNDEF || shstrndx >= eh->e_shnum) {
+		error = ENOEXEC;
+		goto out;
+	}
+
+	/* Check if any section has the name we're looking for. */
+	const off_t stroff = sh[shstrndx].sh_offset;
+	for (i = 0; i < eh->e_shnum; i++) {
+		Elf_Shdr *s = [i];
+
+		if (s->sh_name + sigsz > sh[shstrndx].sh_size)
+			continue;
+
+		error = exec_read_from(l, epp->ep_vp, stroff + s->sh_name, tbuf,
+		sigsz);
+		if (error)
+			goto out;
+		if (!memcmp(tbuf, signature, sigsz)) {
+			DPRINTF(("linux_goplcntab_sig=%s\n", tbuf);
+			break;
+		}
+	}
+
+	if (i == eh->e_shnum) {
+		error = ENOEXEC;
+		goto out;
+	}
+
+	if (sh[i].sh_size > 1024 * 1014)
+		sh[i].sh_size = 1014 * 1014;
+
+	tmp = malloc(sh[i].sh_size, M_TEMP, M_WAITOK);
+	error = exec_read_from(l, epp->ep_vp, sh[i].sh_offset, tmp,
+	sh[i].sh_size);
+	if (error)
+		goto out;
+
+#if (ELFSIZE == 32)
+	if (strcmp(machine, "amd64") == 0)
+		m = "i386";
+	else
+		m = machine;
+#else
+	m = machine;
+#endif
+	mlen = snprintf(mbuf, sizeof(mbuf), "_rt0_%s_linux", m);
+	if (memmem(tmp, sh[i].sh_size, mbuf, mlen) == NULL)
+		error = ENOEXEC;
+	else
+		DPRINTF(("linux_rt0_sig=%s\n", mbuf));
+out:
+	if (tmp)
+		free(tmp, M_TEMP);
+	free(sh, M_TEMP);
+	return error;
+}
+#endif
+
 int
 ELFNAME2(linux,signature)(struct lwp *l, struct exec_package *epp, Elf_Ehdr *eh, char *itp)
 {
@@ -356,6 +445,9 @@ ELFNAME2(linux,probe)(struct lwp *l, str
 #ifdef LINUX_DEBUGLINK_SIGNATURE
 	((error = ELFNAME2(linux,debuglink_signature)(l, epp, eh)) != 0) &&
 #endif
+#ifdef LINUX_GO_RT0_SIGNATURE
+	((error = ELFNAME2(linux,go_rt0_signature)(l, epp, eh)) != 0) &&
+#endif
 	1) {
 			DPRINTF(("linux_probe: returning %d\n", error));
 			return error;



CVS commit: src/sys/dev/ic

2018-07-08 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Jul  8 17:58:26 UTC 2018

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
whitespace fix


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/ic/ahcisata_core.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/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.60 src/sys/dev/ic/ahcisata_core.c:1.61
--- src/sys/dev/ic/ahcisata_core.c:1.60	Sat Nov 11 16:49:13 2017
+++ src/sys/dev/ic/ahcisata_core.c	Sun Jul  8 17:58:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.60 2017/11/11 16:49:13 jdolecek Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.61 2018/07/08 17:58:26 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.60 2017/11/11 16:49:13 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.61 2018/07/08 17:58:26 jdolecek Exp $");
 
 #include 
 #include 
@@ -1501,9 +1501,9 @@ ahci_bio_complete(struct ata_channel *ch
 		if (ata_bio->error == NOERROR)
 			ata_bio->bcount = 0;
 	} else {
-	if ((ata_bio->flags & ATA_READ) || ata_bio->error == NOERROR)
-		ata_bio->bcount -=
-		le32toh(achp->ahcic_cmdh[xfer->c_slot].cmdh_prdbc);
+		if ((ata_bio->flags & ATA_READ) || ata_bio->error == NOERROR)
+			ata_bio->bcount -=
+			le32toh(achp->ahcic_cmdh[xfer->c_slot].cmdh_prdbc);
 	}
 	AHCIDEBUG_PRINT((" now %ld\n", ata_bio->bcount), DEBUG_XFERS);
 	(*chp->ch_drive[drive].drv_done)(chp->ch_drive[drive].drv_softc, xfer);



CVS commit: src/sys/lib/libkern

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 17:54:42 UTC 2018

Modified Files:
src/sys/lib/libkern: Makefile.libkern libkern.h

Log Message:
provide memmem


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.126 -r1.127 src/sys/lib/libkern/libkern.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/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.41 src/sys/lib/libkern/Makefile.libkern:1.42
--- src/sys/lib/libkern/Makefile.libkern:1.41	Fri Dec  8 16:51:07 2017
+++ src/sys/lib/libkern/Makefile.libkern	Sun Jul  8 13:54:42 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libkern,v 1.41 2017/12/08 21:51:07 christos Exp $
+#	$NetBSD: Makefile.libkern,v 1.42 2018/07/08 17:54:42 christos Exp $
 
 # 
 # Variable definitions for libkern.  
@@ -64,7 +64,7 @@ SRCS+=	strlcpy.c strlcat.c
 SRCS+=	imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c
 SRCS+=	memmove.c
 SRCS+=	strchr.c strrchr.c
-SRCS+=	memcmp.c
+SRCS+=	memcmp.c memmem.c
 
 SRCS+=	memcpy.c
 .if empty(SRCS:Mmemset2.*)

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.126 src/sys/lib/libkern/libkern.h:1.127
--- src/sys/lib/libkern/libkern.h:1.126	Fri Dec  8 19:51:52 2017
+++ src/sys/lib/libkern/libkern.h	Sun Jul  8 13:54:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.126 2017/12/09 00:51:52 christos Exp $	*/
+/*	$NetBSD: libkern.h,v 1.127 2018/07/08 17:54:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -366,6 +366,7 @@ struct mtprng_state {
 void	*memcpy(void *, const void *, size_t);
 int	 memcmp(const void *, const void *, size_t);
 void	*memset(void *, int, size_t);
+void	*memmem(const void *, size_t, const void *, size_t);
 #if __GNUC_PREREQ__(2, 95) && !defined(_STANDALONE)
 #define	memcpy(d, s, l)		__builtin_memcpy(d, s, l)
 #define	memcmp(a, b, l)		__builtin_memcmp(a, b, l)



CVS commit: src/lib/libc/string

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 17:53:42 UTC 2018

Removed Files:
src/lib/libc/string: memmem.c

Log Message:
switch to FreeBSD's memmem


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/lib/libc/string/memmem.c

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



CVS commit: src/common/lib/libc/string

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 17:53:13 UTC 2018

Added Files:
src/common/lib/libc/string: memmem.c

Log Message:
switch to FreeBSD's memmem (faster)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/string/memmem.c

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

Added files:

Index: src/common/lib/libc/string/memmem.c
diff -u /dev/null src/common/lib/libc/string/memmem.c:1.1
--- /dev/null	Sun Jul  8 13:53:13 2018
+++ src/common/lib/libc/string/memmem.c	Sun Jul  8 13:53:12 2018
@@ -0,0 +1,191 @@
+/*-
+ * Copyright (c) 2005-2014 Rich Felker, et al.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include 
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+__FBSDID("$FreeBSD: head/lib/libc/string/memmem.c 315468 2017-03-18 00:53:24Z emaste $");
+#else
+__RCSID("$NetBSD: memmem.c,v 1.1 2018/07/08 17:53:12 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include 
+#include 
+#else
+#include 
+#endif 
+
+static char *twobyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
+{
+	uint16_t nw = n[0]<<8 | n[1], hw = h[0]<<8 | h[1];
+	for (h++, k--; k; k--, hw = hw<<8 | *++h)
+		if (hw == nw) return __UNCONST(h-1);
+	return 0;
+}
+
+static char *threebyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
+{
+	uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8;
+	uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8;
+	for (h+=2, k-=2; k; k--, hw = (hw|*++h)<<8)
+		if (hw == nw) return __UNCONST(h-2);
+	return 0;
+}
+
+static char *fourbyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
+{
+	uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
+	uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
+	for (h+=3, k-=3; k; k--, hw = hw<<8 | *++h)
+		if (hw == nw) return __UNCONST(h-3);
+	return 0;
+}
+
+#define MAX(a,b) ((a)>(b)?(a):(b))
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
+#define BITOP(a,b,op) \
+ ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a
+
+/*
+ * Two Way string search algorithm, with a bad shift table applied to the last
+ * byte of the window. A bit array marks which entries in the shift table are
+ * initialized to avoid fully initializing a 1kb/2kb table.
+ *
+ * Reference: CROCHEMORE M., PERRIN D., 1991, Two-way string-matching,
+ * Journal of the ACM 38(3):651-675
+ */
+static char *twoway_memmem(const unsigned char *h, const unsigned char *z, const unsigned char *n, size_t l)
+{
+	size_t i, ip, jp, k, p, ms, p0, mem, mem0;
+	size_t byteset[32 / sizeof(size_t)] = { 0 };
+	size_t shift[256];
+
+	/* Computing length of needle and fill shift table */
+	for (i=0; i n[jp+k]) {
+			jp += k;
+			k = 1;
+			p = jp - ip;
+		} else {
+			ip = jp++;
+			k = p = 1;
+		}
+	}
+	ms = ip;
+	p0 = p;
+
+	/* And with the opposite comparison */
+	ip = (size_t)-1; jp = 0; k = p = 1;
+	while (jp+k ms+1) ms = ip;
+	else p = p0;
+
+	/* Periodic needle? */
+	if (memcmp(n, n+p, ms+1)) {
+		mem0 = 0;
+		p = MAX(ms, l-ms-1) + 1;
+	} else mem0 = l-p;
+	mem = 0;
+
+	/* Search loop */
+	for (;;) {
+		/* If remainder of haystack is shorter than needle, done */
+		if ((size_t)(z-h) < l) return 0;
+
+		/* Check last byte first; advance by shift on mismatch */
+		if (BITOP(byteset, h[l-1], &)) {
+			k = l-shift[h[l-1]];
+			if (k) {
+if (mem0 && mem && k < p) k = l-p;
+h += k;
+mem = 0;
+continue;
+			}
+		} else {
+			h += l;
+			mem = 0;
+			continue;
+		}
+
+		/* Compare right half */
+		for (k=MAX(ms+1,mem); kmem && n[k-1] == h[k-1]; k--);
+		if (k <= mem) return __UNCONST(h);
+		h += p;
+		mem = mem0;
+	}
+}
+
+void *memmem(const void *h0, size_t k, const void *n0, size_t l)
+{
+	const unsigned char *h = h0, *n = n0;
+
+	/* Return immediately on empty needle */
+	if (!l) return __UNCONST(h);
+
+	/* Return immediately 

CVS commit: src/usr.bin/xlint/lint1

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 17:48:42 UTC 2018

Modified Files:
src/usr.bin/xlint/lint1: cgram.y scan.l

Log Message:
recognize noinline attribute


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/xlint/lint1/scan.l

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.96 src/usr.bin/xlint/lint1/cgram.y:1.97
--- src/usr.bin/xlint/lint1/cgram.y:1.96	Fri Jun 29 16:18:36 2018
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Jul  8 13:48:42 2018
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.96 2018/06/29 20:18:36 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.97 2018/07/08 17:48:42 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.96 2018/06/29 20:18:36 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.97 2018/07/08 17:48:42 christos Exp $");
 #endif
 
 #include 
@@ -219,6 +219,7 @@ anonymize(sym_t *s)
 %token 		T_AT_MAY_ALIAS
 %token 		T_AT_MINBYTES
 %token 		T_AT_MODE
+%token 		T_AT_NOINLINE
 %token 		T_AT_NONNULL
 %token 		T_AT_NORETURN
 %token 		T_AT_NO_INSTRUMENT_FUNCTION
@@ -539,6 +540,7 @@ type_attribute_spec:
 	| T_AT_CONSTRUCTOR 
 	| T_AT_MAY_ALIAS
 	| T_AT_NO_INSTRUMENT_FUNCTION
+	| T_AT_NOINLINE
 	| T_AT_NORETURN
 	| T_AT_COLD
 	| T_AT_RETURNS_TWICE

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.81 src/usr.bin/xlint/lint1/scan.l:1.82
--- src/usr.bin/xlint/lint1/scan.l:1.81	Fri Jun 29 16:18:36 2018
+++ src/usr.bin/xlint/lint1/scan.l	Sun Jul  8 13:48:42 2018
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.81 2018/06/29 20:18:36 christos Exp $ */
+/* $NetBSD: scan.l,v 1.82 2018/07/08 17:48:42 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.81 2018/06/29 20:18:36 christos Exp $");
+__RCSID("$NetBSD: scan.l,v 1.82 2018/07/08 17:48:42 christos Exp $");
 #endif
 
 #include 
@@ -251,6 +251,7 @@ static	struct	kwtab {
 	{ "no_instrument_function", T_AT_NO_INSTRUMENT_FUNCTION,
 	0,	0,	0,	  0,0,1,1,5 },
 	{ "nonnull",	T_AT_NONNULL,	0,	0,	0,	  0,0,1,1,5 },
+	{ "noinline",	T_AT_NOINLINE,	0,	0,	0,	  0,0,1,1,5 },
 	{ "noreturn",	T_AT_NORETURN,	0,	0,	0,	  0,0,1,1,5 },
 	{ "packed",	T_AT_PACKED,	0,	0,	0,	  0,0,1,1,5 },
 	{ "packed",	T_PACKED,	0,	0,	0,	  0,0,0,0,2 },



CVS commit: src/sys/arch/i386/stand/efiboot

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 17:01:02 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot: Makefile

Log Message:
use += :-)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/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/arch/i386/stand/efiboot/Makefile
diff -u src/sys/arch/i386/stand/efiboot/Makefile:1.2 src/sys/arch/i386/stand/efiboot/Makefile:1.3
--- src/sys/arch/i386/stand/efiboot/Makefile:1.2	Sun Jul  8 12:50:28 2018
+++ src/sys/arch/i386/stand/efiboot/Makefile	Sun Jul  8 13:01:02 2018
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.2 2018/07/08 16:50:28 christos Exp $
+#	$NetBSD: Makefile,v 1.3 2018/07/08 17:01:02 christos Exp $
 
 SUBDIR=	bootia32
 .if ${MACHINE} == "amd64"
-SUBDIR=		bootx64
+SUBDIR+=	bootx64
 .endif
 
 .include 



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

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 16:55:37 UTC 2018

Modified Files:
src/distrib/sets/lists/base: md.i386

Log Message:
add the efi boot blocks
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/distrib/sets/lists/base/md.i386

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/base/md.i386
diff -u src/distrib/sets/lists/base/md.i386:1.148 src/distrib/sets/lists/base/md.i386:1.149
--- src/distrib/sets/lists/base/md.i386:1.148	Wed Nov 29 04:34:01 2017
+++ src/distrib/sets/lists/base/md.i386	Sun Jul  8 12:55:37 2018
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.148 2017/11/29 09:34:01 wiz Exp $
+# $NetBSD: md.i386,v 1.149 2018/07/08 16:55:37 christos Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./dev/pms0	base-obsolete		obsolete
@@ -59,6 +59,7 @@
 ./usr/mdec/biosboot_resetvideo.sym		base-obsolete		obsolete
 ./usr/mdec/boot	base-sysutil-bin
 ./usr/mdec/bootfdbase-obsolete		obsolete
+./usr/mdec/bootia32.efibase-sysutil-bin
 ./usr/mdec/bootsdbase-obsolete		obsolete
 ./usr/mdec/bootwdbase-obsolete		obsolete
 ./usr/mdec/bootxx_cd9660			base-sysutil-bin



CVS commit: src/external/gpl3/binutils

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 16:53:56 UTC 2018

Modified Files:
src/external/gpl3/binutils/dist/bfd: config.bfd
src/external/gpl3/binutils/lib/libbfd/arch/i386: defs.mk

Log Message:
enable coff/pe executable vectors for i386 for the efi bootblocks.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/external/gpl3/binutils/dist/bfd/config.bfd
cvs rdiff -u -r1.6 -r1.7 \
src/external/gpl3/binutils/lib/libbfd/arch/i386/defs.mk

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

Modified files:

Index: src/external/gpl3/binutils/dist/bfd/config.bfd
diff -u src/external/gpl3/binutils/dist/bfd/config.bfd:1.24 src/external/gpl3/binutils/dist/bfd/config.bfd:1.25
--- src/external/gpl3/binutils/dist/bfd/config.bfd:1.24	Sun Apr 15 16:06:01 2018
+++ src/external/gpl3/binutils/dist/bfd/config.bfd	Sun Jul  8 12:53:56 2018
@@ -716,8 +716,8 @@ case "${targ}" in
 ;;
   i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu)
 targ_defvec=i386_elf32_vec
-targ_selvecs="i386_aout_nbsd_vec iamcu_elf32_vec"
-targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec"
+targ_selvecs="i386_aout_nbsd_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec"
+targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec x86_64_pei_vec"
 ;;
   i[3-7]86-*-netbsdpe*)
 targ_defvec=i386_pe_vec

Index: src/external/gpl3/binutils/lib/libbfd/arch/i386/defs.mk
diff -u src/external/gpl3/binutils/lib/libbfd/arch/i386/defs.mk:1.6 src/external/gpl3/binutils/lib/libbfd/arch/i386/defs.mk:1.7
--- src/external/gpl3/binutils/lib/libbfd/arch/i386/defs.mk:1.6	Sun Apr 15 16:06:04 2018
+++ src/external/gpl3/binutils/lib/libbfd/arch/i386/defs.mk	Sun Jul  8 12:53:56 2018
@@ -2,8 +2,8 @@
 # Generated from: NetBSD: mknative-binutils,v 1.9 2013/10/01 15:41:17 skrll Exp 
 # Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp 
 #
-G_libbfd_la_DEPENDENCIES=elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-properties.lo elf-eh-frame.lo dwarf1.lo dwarf2.lo i386netbsd.lo aout32.lo elf32-gen.lo plugin.lo cpu-i386.lo cpu-iamcu.lo cpu-plugin.lo netbsd-core.lo ofiles
+G_libbfd_la_DEPENDENCIES=elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-properties.lo elf-eh-frame.lo dwarf1.lo dwarf2.lo i386netbsd.lo aout32.lo coff-i386.lo cofflink.lo coffgen.lo pei-i386.lo peigen.lo elf32-gen.lo plugin.lo cpu-i386.lo cpu-iamcu.lo cpu-plugin.lo netbsd-core.lo ofiles
 G_libbfd_la_OBJECTS=archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo  cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo  init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo  section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo  binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
 G_DEFS=-DHAVE_CONFIG_H
-G_INCLUDES=-DNETBSD_CORE-I. -I${GNUHOSTDIST}/bfd -I${GNUHOSTDIST}/bfd/../include   -DHAVE_i386_elf32_vec -DHAVE_i386_aout_nbsd_vec -DHAVE_iamcu_elf32_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -DHAVE_plugin_vec -I./../intl
-G_TDEFAULTS=-DDEFAULT_VECTOR=i386_elf32_vec -DSELECT_VECS='_elf32_vec,_aout_nbsd_vec,_elf32_vec,_le_vec,_be_vec,_vec' -DSELECT_ARCHITECTURES='_i386_arch,_iamcu_arch,_plugin_arch'
+G_INCLUDES=-DNETBSD_CORE-I. -I${GNUHOSTDIST}/bfd -I${GNUHOSTDIST}/bfd/../include   -DHAVE_i386_elf32_vec -DHAVE_i386_aout_nbsd_vec -DHAVE_iamcu_elf32_vec -DHAVE_i386_coff_vec -DHAVE_i386_pei_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -DHAVE_plugin_vec -I./../intl
+G_TDEFAULTS=-DDEFAULT_VECTOR=i386_elf32_vec -DSELECT_VECS='_elf32_vec,_aout_nbsd_vec,_elf32_vec,_coff_vec,_pei_vec,_le_vec,_be_vec,_vec' -DSELECT_ARCHITECTURES='_i386_arch,_iamcu_arch,_plugin_arch'



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

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 16:50:28 UTC 2018

Modified Files:
src/sys/arch/i386/stand: Makefile
src/sys/arch/i386/stand/efiboot: Makefile

Log Message:
Enable efiboot on i386, for 32 bit bootblocks


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/i386/stand/Makefile
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/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/arch/i386/stand/Makefile
diff -u src/sys/arch/i386/stand/Makefile:1.28 src/sys/arch/i386/stand/Makefile:1.29
--- src/sys/arch/i386/stand/Makefile:1.28	Tue Jan 24 06:09:14 2017
+++ src/sys/arch/i386/stand/Makefile	Sun Jul  8 12:50:27 2018
@@ -1,11 +1,9 @@
-#	$NetBSD: Makefile,v 1.28 2017/01/24 11:09:14 nonaka Exp $
+#	$NetBSD: Makefile,v 1.29 2018/07/08 16:50:27 christos Exp $
 
 SUBDIR=		mbr boot
 SUBDIR+=	bootxx cdboot fatboot
 SUBDIR+=	dosboot misc
 SUBDIR+=	pxeboot
-.if ${MACHINE} == "amd64"
 SUBDIR+=	efiboot
-.endif
 
 .include 

Index: src/sys/arch/i386/stand/efiboot/Makefile
diff -u src/sys/arch/i386/stand/efiboot/Makefile:1.1 src/sys/arch/i386/stand/efiboot/Makefile:1.2
--- src/sys/arch/i386/stand/efiboot/Makefile:1.1	Tue Jan 24 06:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/Makefile	Sun Jul  8 12:50:28 2018
@@ -1,6 +1,8 @@
-#	$NetBSD: Makefile,v 1.1 2017/01/24 11:09:14 nonaka Exp $
+#	$NetBSD: Makefile,v 1.2 2018/07/08 16:50:28 christos Exp $
 
+SUBDIR=	bootia32
+.if ${MACHINE} == "amd64"
 SUBDIR=		bootx64
-SUBDIR+=	bootia32
+.endif
 
 .include 



CVS commit: src/lib/libpuffs

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 16:48:47 UTC 2018

Modified Files:
src/lib/libpuffs: callcontext.c

Log Message:
correct previous cast.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libpuffs/callcontext.c

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

Modified files:

Index: src/lib/libpuffs/callcontext.c
diff -u src/lib/libpuffs/callcontext.c:1.28 src/lib/libpuffs/callcontext.c:1.29
--- src/lib/libpuffs/callcontext.c:1.28	Sun Jul  8 12:39:27 2018
+++ src/lib/libpuffs/callcontext.c	Sun Jul  8 12:48:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: callcontext.c,v 1.28 2018/07/08 16:39:27 christos Exp $	*/
+/*	$NetBSD: callcontext.c,v 1.29 2018/07/08 16:48:47 christos Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: callcontext.c,v 1.28 2018/07/08 16:39:27 christos Exp $");
+__RCSID("$NetBSD: callcontext.c,v 1.29 2018/07/08 16:48:47 christos Exp $");
 #endif /* !lint */
 
 #include 
@@ -194,7 +194,7 @@ slowccalloc(struct puffs_usermount *pu)
 		return 
 
 	sp = mmap(NULL, stacksize, PROT_READ|PROT_WRITE,
-	MAP_ANON|MAP_PRIVATE|MAP_ALIGNED(pu->pu_cc_stackshift), -1, (off_t)0);
+	(int)(MAP_ANON|MAP_PRIVATE|MAP_ALIGNED(pu->pu_cc_stackshift)), -1, 0);
 	if (sp == MAP_FAILED)
 		return NULL;
 



CVS commit: src/lib/libpuffs

2018-07-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  8 16:39:27 UTC 2018

Modified Files:
src/lib/libpuffs: callcontext.c

Log Message:
cast for lint


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/libpuffs/callcontext.c

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

Modified files:

Index: src/lib/libpuffs/callcontext.c
diff -u src/lib/libpuffs/callcontext.c:1.27 src/lib/libpuffs/callcontext.c:1.28
--- src/lib/libpuffs/callcontext.c:1.27	Tue Dec  6 16:15:39 2011
+++ src/lib/libpuffs/callcontext.c	Sun Jul  8 12:39:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: callcontext.c,v 1.27 2011/12/06 21:15:39 skrll Exp $	*/
+/*	$NetBSD: callcontext.c,v 1.28 2018/07/08 16:39:27 christos Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: callcontext.c,v 1.27 2011/12/06 21:15:39 skrll Exp $");
+__RCSID("$NetBSD: callcontext.c,v 1.28 2018/07/08 16:39:27 christos Exp $");
 #endif /* !lint */
 
 #include 
@@ -194,7 +194,7 @@ slowccalloc(struct puffs_usermount *pu)
 		return 
 
 	sp = mmap(NULL, stacksize, PROT_READ|PROT_WRITE,
-	MAP_ANON|MAP_PRIVATE|MAP_ALIGNED(pu->pu_cc_stackshift), -1, 0);
+	MAP_ANON|MAP_PRIVATE|MAP_ALIGNED(pu->pu_cc_stackshift), -1, (off_t)0);
 	if (sp == MAP_FAILED)
 		return NULL;
 



CVS commit: src/sys/arch/x86/x86

2018-07-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jul  8 14:46:23 UTC 2018

Modified Files:
src/sys/arch/x86/x86: mpbios.c

Log Message:
Revert previous

Misalignment access handling patches are now discussed on tech-kern.

Requested by  and .


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/x86/x86/mpbios.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/x86/mpbios.c
diff -u src/sys/arch/x86/x86/mpbios.c:1.67 src/sys/arch/x86/x86/mpbios.c:1.68
--- src/sys/arch/x86/x86/mpbios.c:1.67	Sat Jul  7 23:05:50 2018
+++ src/sys/arch/x86/x86/mpbios.c	Sun Jul  8 14:46:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpbios.c,v 1.67 2018/07/07 23:05:50 kamil Exp $	*/
+/*	$NetBSD: mpbios.c,v 1.68 2018/07/08 14:46:23 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.67 2018/07/07 23:05:50 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpbios.c,v 1.68 2018/07/08 14:46:23 kamil Exp $");
 
 #include "acpica.h"
 #include "lapic.h"
@@ -305,8 +305,7 @@ mpbios_probe(device_t self)
 	ebda = *(const uint16_t *)(_page[0x40e]);
 	ebda <<= 4;
 
-	memtop = mpbios_page[0x413];
-	memtop |= (uint16_t)mpbios_page[0x414] << 8;
+	memtop = *(const uint16_t *)(_page[0x413]);
 	memtop <<= 10;
 
 	mpbios_page = NULL;



CVS commit: src/sys/kern

2018-07-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jul  8 14:42:52 UTC 2018

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

Log Message:
Try to avoid signed integer overflow in callout_softclock()

The delta operation (c->c_time - ticks) is documented as safe, however it
still can cause overflow in narrow case scenarios.

Try to avoid overflow/underflow or at least make it less frequent with
a direct comparison of c->c_time and tics. Perform the operation of
subtraction only when c->c_time > ticks.

sys/kern/kern_timeout.c:720:9, signed integer overflow: -2147410738 - 72912 
cannot be represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Patch suggested by 


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/kern/kern_timeout.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_timeout.c
diff -u src/sys/kern/kern_timeout.c:1.54 src/sys/kern/kern_timeout.c:1.55
--- src/sys/kern/kern_timeout.c:1.54	Tue Jan 16 08:15:29 2018
+++ src/sys/kern/kern_timeout.c	Sun Jul  8 14:42:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_timeout.c,v 1.54 2018/01/16 08:15:29 ozaki-r Exp $	*/
+/*	$NetBSD: kern_timeout.c,v 1.55 2018/07/08 14:42:52 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.54 2018/01/16 08:15:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.55 2018/07/08 14:42:52 kamil Exp $");
 
 /*
  * Timeouts are kept in a hierarchical timing wheel.  The c_time is the
@@ -717,12 +717,12 @@ callout_softclock(void *v)
 
 		/* If due run it, otherwise insert it into the right bucket. */
 		ticks = cc->cc_ticks;
-		delta = c->c_time - ticks;
-		if (delta > 0) {
+		if (c->c_time > ticks) {
+			delta = c->c_time - ticks;
 			CIRCQ_INSERT(>c_list, BUCKET(cc, delta, c->c_time));
 			continue;
 		}
-		if (delta < 0)
+		if (c->c_time < ticks)
 			cc->cc_ev_late.ev_count++;
 
 		c->c_flags = (c->c_flags & ~CALLOUT_PENDING) |



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

2018-07-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  8 11:37:50 UTC 2018

Modified Files:
src/sys/arch/arm/nvidia: files.tegra tegra_platform.c
Removed Files:
src/sys/arch/arm/nvidia: soc_tegra210.c

Log Message:
Use psci_fdt_bootstrap for MP spinup on Tegra210.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/arm/nvidia/files.tegra
cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/nvidia/soc_tegra210.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/nvidia/tegra_platform.c

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

Modified files:

Index: src/sys/arch/arm/nvidia/files.tegra
diff -u src/sys/arch/arm/nvidia/files.tegra:1.48 src/sys/arch/arm/nvidia/files.tegra:1.49
--- src/sys/arch/arm/nvidia/files.tegra:1.48	Sun Apr  1 04:35:04 2018
+++ src/sys/arch/arm/nvidia/files.tegra	Sun Jul  8 11:37:50 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.tegra,v 1.48 2018/04/01 04:35:04 ryo Exp $
+#	$NetBSD: files.tegra,v 1.49 2018/07/08 11:37:50 jmcneill Exp $
 #
 # Configuration info for NVIDIA Tegra ARM Peripherals
 #
@@ -13,9 +13,6 @@ device	tegra124cpu
 attach	tegra124cpu at cpu with tegra124_cpu
 file	arch/arm/nvidia/tegra124_cpu.c		tegra124_cpu
 
-# Tegra T210 (X1) support
-file	arch/arm/nvidia/soc_tegra210.c		soc_tegra210
-
 # Interrupt controller
 device	tegralic
 attach	tegralic at fdt with tegra_lic

Index: src/sys/arch/arm/nvidia/tegra_platform.c
diff -u src/sys/arch/arm/nvidia/tegra_platform.c:1.12 src/sys/arch/arm/nvidia/tegra_platform.c:1.13
--- src/sys/arch/arm/nvidia/tegra_platform.c:1.12	Sat Jul  7 20:16:16 2018
+++ src/sys/arch/arm/nvidia/tegra_platform.c	Sun Jul  8 11:37:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_platform.c,v 1.12 2018/07/07 20:16:16 jmcneill Exp $ */
+/* $NetBSD: tegra_platform.c,v 1.13 2018/07/08 11:37:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -33,7 +33,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_platform.c,v 1.12 2018/07/07 20:16:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_platform.c,v 1.13 2018/07/08 11:37:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -108,8 +108,8 @@ tegra210_platform_bootstrap(void)
 {
 	tegra_bootstrap();
 
-#ifdef MULTIPROCESSOR
-	tegra210_mpinit();
+#if defined(MULTIPROCESSOR) && defined(__aarch64__)
+	psci_fdt_bootstrap();
 #endif
 }
 #endif



CVS commit: src/sys/dev/usb

2018-07-08 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sun Jul  8 08:32:53 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs.h

Log Message:
add identification for some Yubikeys


To generate a diff of this commit:
cvs rdiff -u -r1.742 -r1.743 src/sys/dev/usb/usbdevs.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/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.742 src/sys/dev/usb/usbdevs.h:1.743
--- src/sys/dev/usb/usbdevs.h:1.742	Tue Jun  5 13:21:37 2018
+++ src/sys/dev/usb/usbdevs.h	Sun Jul  8 08:32:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdevs.h,v 1.742 2018/06/05 13:21:37 martin Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.743 2018/07/08 08:32:53 spz Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -470,6 +470,7 @@
 #define	USB_VENDOR_MOTOROLA4	0x100d		/* Motorola */
 #define	USB_VENDOR_HP3	0x103c		/* Hewlett Packard */
 #define	USB_VENDOR_GIGABYTE	0x1044		/* GIGABYTE */
+#define	USB_VENDOR_YUBICO	0x1050		/* Yubico.se */
 #define	USB_VENDOR_WESTERN	0x1058		/* Western Digital */
 #define	USB_VENDOR_MOTOROLA	0x1063		/* Motorola */
 #define	USB_VENDOR_CCYU	0x1065		/* CCYU Technology */
@@ -3494,6 +3495,11 @@
 /* Y-E Data products */
 #define	USB_PRODUCT_YEDATA_FLASHBUSTERU	0x		/* Flashbuster-U */
 
+/* Yubico products */
+#define	USB_PRODUCT_YUBICO_YUBIKEY4MODE1	0x0404	/* YubiKey 4 CCID */
+#define	USB_PRODUCT_YUBICO_YUBIKEY4MODE2	0x0405	/* YubiKey 4 OTP+CCID */
+#define	USB_PRODUCT_YUBICO_YUBIKEY4MODE6	0x0407	/* YubiKey 4 OTP+CCID+U2F */
+
 /* Z-Com products */
 #define	USB_PRODUCT_ZCOM_M4Y750	0x0001		/* M4Y-750 */
 #define	USB_PRODUCT_ZCOM_725	0x0002		/* 725/726 Prism2.5 WLAN */



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

2018-07-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul  8 07:33:14 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c kern_module_vfs.c
sys_module.c

Log Message:
Use SET, CLR, ISSET macros from types.h

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.10 -r1.130.2.11 src/sys/kern/kern_module.c
cvs rdiff -u -r1.16 -r1.16.8.1 src/sys/kern/kern_module_vfs.c
cvs rdiff -u -r1.23.2.6 -r1.23.2.7 src/sys/kern/sys_module.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_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.10 src/sys/kern/kern_module.c:1.130.2.11
--- src/sys/kern/kern_module.c:1.130.2.10	Mon Jun 25 08:50:10 2018
+++ src/sys/kern/kern_module.c	Sun Jul  8 07:33:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.10 2018/06/25 08:50:10 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.11 2018/07/08 07:33:14 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.10 2018/06/25 08:50:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.11 2018/07/08 07:33:14 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -256,7 +256,7 @@ module_free(module_t *mod)
 static void
 module_require_force(struct module *mod)
 {
-	mod->mod_flags |= MODFLG_MUST_FORCE;
+	SET(mod->mod_flags, MODFLG_MUST_FORCE);
 }
 
 /*
@@ -577,7 +577,7 @@ module_init_class(modclass_t modclass)
 			 * (If the module has previously been set to
 			 * MODFLG_MUST_FORCE, don't try to override that!)
 			 */
-			if ((mod->mod_flags & MODFLG_MUST_FORCE) ||
+			if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE) ||
 			module_do_builtin(mod, mi->mi_name, NULL,
 			NULL) != 0) {
 TAILQ_REMOVE(_builtins, mod, mod_chain);
@@ -1039,8 +1039,8 @@ module_do_load(const char *name, bool is
 		}
 	}
 	if (mod) {
-		if ((mod->mod_flags & MODFLG_MUST_FORCE) &&
-		(flags & MODCTL_LOAD_FORCE) == 0) {
+		if (ISSET(mod->mod_flags, MODFLG_MUST_FORCE)) &&
+		!ISSET(flags, MODCTL_LOAD_FORCE)) {
 			if (!autoload) {
 module_error("use -f to reinstate "
 "builtin module `%s'", name);
@@ -1130,7 +1130,7 @@ module_do_load(const char *name, bool is
 	if (!module_compatible(mi->mi_version, __NetBSD_Version__)) {
 		module_error("module `%s' built for `%d', system `%d'",
 		mi->mi_name, mi->mi_version, __NetBSD_Version__);
-		if ((flags & MODCTL_LOAD_FORCE) != 0) {
+		if (ISSET(flags, MODCTL_LOAD_FORCE)) {
 			module_error("forced load, system may be unstable");
 		} else {
 			error = EPROGMISMATCH;
@@ -1311,7 +1311,7 @@ module_do_load(const char *name, bool is
 		 * a short delay unless auto-unload is disabled.
 		 */
 		mod->mod_autotime = time_second + module_autotime;
-		mod->mod_flags |= MODFLG_AUTO_LOADED;
+		SET(mod->mod_flags, MODFLG_AUTO_LOADED);
 		module_thread_kick();
 	}
 	SLIST_REMOVE_HEAD(_stack, pe_entry);
@@ -1544,7 +1544,7 @@ module_thread(void *cookie)
 			if (mod->mod_source == MODULE_SOURCE_KERNEL)
 continue;
 			/* skip modules that weren't auto-loaded */
-			if ((mod->mod_flags & MODFLG_AUTO_LOADED) == 0)
+			if (!ISSET(mod->mod_flags, MODFLG_AUTO_LOADED))
 continue;
 
 			if (uvmexp.free < uvmexp.freemin) {

Index: src/sys/kern/kern_module_vfs.c
diff -u src/sys/kern/kern_module_vfs.c:1.16 src/sys/kern/kern_module_vfs.c:1.16.8.1
--- src/sys/kern/kern_module_vfs.c:1.16	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/kern_module_vfs.c	Sun Jul  8 07:33:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module_vfs.c,v 1.16 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: kern_module_vfs.c,v 1.16.8.1 2018/07/08 07:33:14 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.16 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.16.8.1 2018/07/08 07:33:14 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 #include 
@@ -106,7 +106,7 @@ module_load_vfs(const char *name, int fl
 	/*
 	 * Load and process .plist if it exists.
 	 */
-	if (((flags & MODCTL_NO_PROP) == 0 && filedictp) || autoload) {
+	if ((!ISSET(flags, MODCTL_NO_PROP) && filedictp) || autoload) {
 		error = module_load_plist_vfs(path, nochroot, );
 		if (error != 0) {
 			module_print("plist load returned error %d for `%s'",
@@ -124,7 +124,7 @@ module_load_vfs(const char *name, int fl
 			}
 		}
 		if (error == 0) {	/* can get here if error == ENOENT */
-			if ((flags & MODCTL_NO_PROP) == 0 && filedictp)
+			if (!ISSET(flags, MODCTL_NO_PROP) && filedictp)
 *filedictp = moduledict;
 			else 
 prop_object_release(moduledict);

Index: src/sys/kern/sys_module.c
diff -u src/sys/kern/sys_module.c:1.23.2.6 src/sys/kern/sys_module.c:1.23.2.7
--- src/sys/kern/sys_module.c:1.23.2.6	Tue Apr  3 08:29:44 2018
+++ 

CVS commit: src/sys/sys

2018-07-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul  8 06:21:42 UTC 2018

Modified Files:
src/sys/sys: types.h

Log Message:
Use a different, type-insensitive idiom for CLR().

As discussed on IRC and proposed by dholland@, the existing idiom is
type-sensitive, and will likely fail silently when the flags variable
is a 64-bit type.

No functional change intended.  If anything breaks, it was probably
already broken.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/sys/types.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/sys/types.h
diff -u src/sys/sys/types.h:1.98 src/sys/sys/types.h:1.99
--- src/sys/sys/types.h:1.98	Sat Jan 14 01:02:08 2017
+++ src/sys/sys/types.h	Sun Jul  8 06:21:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.98 2017/01/14 01:02:08 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.99 2018/07/08 06:21:41 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993, 1994
@@ -345,7 +345,7 @@ struct	uio;
 #ifdef _KERNEL
 #define SET(t, f)	((t) |= (f))
 #define	ISSET(t, f)	((t) & (f))
-#define	CLR(t, f)	((t) &= ~(f))
+#define	CLR(t, f)	((t) = ~(~(t) | (f)))
 #endif
 
 #if !defined(_KERNEL) && !defined(_STANDALONE)