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

2017-04-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Apr  9 00:02:30 UTC 2017

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

Log Message:
speed limit 80


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/linux/common/linux_futex.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_futex.c
diff -u src/sys/compat/linux/common/linux_futex.c:1.35 src/sys/compat/linux/common/linux_futex.c:1.36
--- src/sys/compat/linux/common/linux_futex.c:1.35	Mon Aug 15 09:20:11 2016
+++ src/sys/compat/linux/common/linux_futex.c	Sun Apr  9 00:02:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_futex.c,v 1.35 2016/08/15 09:20:11 maxv Exp $ */
+/*	$NetBSD: linux_futex.c,v 1.36 2017/04/09 00:02:30 dholland Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.35 2016/08/15 09:20:11 maxv Exp $");
+__KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.36 2017/04/09 00:02:30 dholland Exp $");
 
 #include 
 #include 
@@ -112,7 +112,8 @@ static int futex_wake(struct futex *, in
 static int futex_atomic_op(lwp_t *, int, void *);
 
 int
-linux_sys_futex(struct lwp *l, const struct linux_sys_futex_args *uap, register_t *retval)
+linux_sys_futex(struct lwp *l, const struct linux_sys_futex_args *uap,
+	register_t *retval)
 {
 	/* {
 		syscallarg(int *) uaddr;
@@ -138,7 +139,8 @@ linux_sys_futex(struct lwp *l, const str
 }
 
 int
-linux_do_futex(struct lwp *l, const struct linux_sys_futex_args *uap, register_t *retval, struct timespec *ts)
+linux_do_futex(struct lwp *l, const struct linux_sys_futex_args *uap,
+	register_t *retval, struct timespec *ts)
 {
 	/* {
 		syscallarg(int *) uaddr;
@@ -196,12 +198,13 @@ linux_do_futex(struct lwp *l, const stru
 			if (error != ETIMEDOUT)
 return error;
 			/*
-			 * If the user process requests a non null timeout,
-			 * make sure we do not turn it into an infinite
-			 * timeout because tout is 0.
+			 * If the user process requests a non null
+			 * timeout, make sure we do not turn it into
+			 * an infinite timeout because tout is 0.
 			 *
-			 * We use a minimal timeout of 1/hz. Maybe it would make
-			 * sense to just return ETIMEDOUT without sleeping.
+			 * We use a minimal timeout of 1/hz. Maybe it
+			 * would make sense to just return ETIMEDOUT
+			 * without sleeping.
 			 */
 			if (SCARG(uap, timeout) != NULL)
 tout = 1;



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

2017-04-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Apr  9 00:02:30 UTC 2017

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

Log Message:
speed limit 80


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/linux/common/linux_futex.c

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



CVS commit: src/sys/rump/librump/rumpkern

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 23:46:39 UTC 2017

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern

Log Message:
adjust flag.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/rump/librump/rumpkern/Makefile.rumpkern

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

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.168 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.169
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.168	Sat Aug 20 11:50:50 2016
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Sat Apr  8 19:46:39 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.168 2016/08/20 15:50:50 christos Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.169 2017/04/08 23:46:39 christos Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -51,7 +51,7 @@ SRCS+=	locks.c
 vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh \
 		${RUMPTOP}/../sys/param.h ${_NETBSD_VERSION_DEPENDS}
 	${_MKMSG_CREATE} vers.c
-	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n -r
+	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n -R
 SRCS+=		vers.c
 CLEANFILES+=	vers.c version
 



CVS commit: src/sys/rump/librump/rumpkern

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 23:46:39 UTC 2017

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern

Log Message:
adjust flag.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/rump/librump/rumpkern/Makefile.rumpkern

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 20:59:27 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
Fix a possible infinite loop in pmap_kremove()


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/ia64/ia64/pmap.c

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 20:59:27 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: pmap.c

Log Message:
Fix a possible infinite loop in pmap_kremove()


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/ia64/ia64/pmap.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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.35 src/sys/arch/ia64/ia64/pmap.c:1.36
--- src/sys/arch/ia64/ia64/pmap.c:1.35	Sat Apr  8 18:08:33 2017
+++ src/sys/arch/ia64/ia64/pmap.c	Sat Apr  8 20:59:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.35 2017/04/08 18:08:33 scole Exp $ */
+/* $NetBSD: pmap.c,v 1.36 2017/04/08 20:59:27 scole Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.35 2017/04/08 18:08:33 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.36 2017/04/08 20:59:27 scole Exp $");
 
 #include 
 #include 
@@ -2110,11 +2110,12 @@ void
 pmap_kremove(vaddr_t va, vsize_t size)
 {
 	struct ia64_lpte *pte;
-
+	vaddr_t eva = va + size;
+	
 	UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
 	UVMHIST_LOG(maphist, "(va=%#lx)", va, 0, 0, 0);
 
-	while (size > 0) {
+	while (va < eva) {
 		pte = pmap_find_kpte(va);
 		if (pmap_present(pte)) {
 			KASSERT(pmap_managed(pte) != 0);
@@ -2123,7 +2124,6 @@ pmap_kremove(vaddr_t va, vsize_t size)
 			pmap_clear_present(pte);
 		}
 		va += PAGE_SIZE;
-		size -= PAGE_SIZE;
 	}
 }
 



CVS commit: src/sys/conf

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 19:53:54 UTC 2017

Modified Files:
src/sys/conf: newvers_stand.sh
Added Files:
src/sys/conf: newvers_stand.mk

Log Message:
Add makefile snippet for vers.c building.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/conf/newvers_stand.mk
cvs rdiff -u -r1.8 -r1.9 src/sys/conf/newvers_stand.sh

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/newvers_stand.sh
diff -u src/sys/conf/newvers_stand.sh:1.8 src/sys/conf/newvers_stand.sh:1.9
--- src/sys/conf/newvers_stand.sh:1.8	Sat Jan 22 14:19:25 2011
+++ src/sys/conf/newvers_stand.sh	Sat Apr  8 15:53:54 2017
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-# $NetBSD: newvers_stand.sh,v 1.8 2011/01/22 19:19:25 joerg Exp $
+# $NetBSD: newvers_stand.sh,v 1.9 2017/04/08 19:53:54 christos Exp $
 #
 # Copyright (c) 2000 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -33,44 +33,48 @@
 # bootblock build on various architectures.
 #
 # Called as:
-#	sh ${S}/conf/newvers_stand.sh [-N] VERSION_FILE ARCH [EXTRA_MSG]
+#	sh ${S}/conf/newvers_stand.sh [-dkn] [-D ] [-m ] VERSION_TEMPLATE [EXTRA_MSG]
 
-cwd=$(dirname $0)
+cwd=$(dirname "$0")
 
-add_name=yes
-add_date=no
-add_kernrev=yes
+add_name=true
+add_date=true
+add_kernrev=true
+machine="unknown"
+dateargs=
 
 # parse command args
-while getopts "DKN?" OPT; do
+while getopts "m:D:dknm:" OPT; do
 	case $OPT in
-	D)	add_date=yes;;
-	K)	add_kernrev=no;;
-	N)	add_name=no;;
-	?)	echo "Syntax: newvers_stand.sh [-NDMK] VERSION_TEMPLATE ARCH EXTRA_COMMENT" >&2
+	D)	dateargs="-r $OPTARG";;
+	d)	add_date=false;;
+	k)	add_kernrev=false;;
+	m)	machine=${OPTARG};;
+	n)	add_name=false;;
+	*)	echo "Usage: newvers_stand.sh [-dkn] [-D ] [-m ] VERSION_TEMPLATE EXTRA_COMMENT" >&2
 		exit 1;;
 	esac
 done
 
-shift `expr $OPTIND - 1`
+shift $(expr $OPTIND - 1)
 
-r=`awk -F: '$1 ~ /^[0-9.]*$/ { it = $1; } END { print it }' $1`
-t=`LC_ALL=C date`
+r=$(awk -F: '$1 ~ /^[0-9.]*$/ { it = $1; } END { print it }' "$1")
+shift
+t=$(LC_ALL=C TZ=UTC date $dateargs)
 
-if [ $add_date = yes ]; then
+if $add_date; then
 	echo "const char bootprog_rev[] = \"${r} (${t})\";" > vers.c
 else
 	echo "const char bootprog_rev[] = \"${r}\";" > vers.c
 fi
 
-if [ $add_name = yes ]; then
-	a="$2"		# architecture name
-	extra=${3:+" $3"}
+if $add_name; then
+	extra=${1:+" $1"}
 
-	echo "const char bootprog_name[] = \"NetBSD/${a}${extra}\";" >> vers.c
+	echo "const char bootprog_name[] = \"NetBSD/${machine}${extra}\";" >> vers.c
 fi
 
-if [ $add_kernrev = yes ]; then
-	osr=$(sh ${cwd}/osrelease.sh)
+if $add_kernrev; then
+	osr=$(sh "${cwd}/osrelease.sh")
 	echo "const char bootprog_kernrev[] = \"${osr}\";" >> vers.c
 fi

Added files:

Index: src/sys/conf/newvers_stand.mk
diff -u /dev/null src/sys/conf/newvers_stand.mk:1.1
--- /dev/null	Sat Apr  8 15:53:54 2017
+++ src/sys/conf/newvers_stand.mk	Sat Apr  8 15:53:54 2017
@@ -0,0 +1,25 @@
+#	$NetBSD: newvers_stand.mk,v 1.1 2017/04/08 19:53:54 christos Exp $
+
+VERSIONFILE?=version
+VERSIONMACHINE?=${MACHINE}
+.if exists(${VERSIONFILE})
+
+.if !make(depend)
+SRCS+=		vers.c
+.endif
+CLEANFILES+=	vers.c
+
+.if ${MKREPRO:Uno} == "yes"
+.	if ${MKREPRO_TIMESTAMP:U0} != 0}
+VERSIONFLAGS+=-D ${MKREPRO_TIMESTAMP}
+.	else
+VERSIONFLAGS+=-d
+.	endif
+.endif
+
+vers.c:	${VERSIONFILE}
+	${_MKTARGET_CREATE}
+	${HOST_SH} ${S}/conf/newvers_stand.sh \
+	-m ${VERSIONMACHINE} ${VERSIONFLAGS} ${.ALLSRC} ${NEWVERSWHAT}
+
+.endif



CVS commit: src/sys/conf

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 19:53:54 UTC 2017

Modified Files:
src/sys/conf: newvers_stand.sh
Added Files:
src/sys/conf: newvers_stand.mk

Log Message:
Add makefile snippet for vers.c building.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/conf/newvers_stand.mk
cvs rdiff -u -r1.8 -r1.9 src/sys/conf/newvers_stand.sh

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



CVS commit: src/sys/arch

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 19:53:23 UTC 2017

Modified Files:
src/sys/arch/acorn26/stand: Makefile.buildboot
src/sys/arch/acorn32/stand: Makefile.buildboot
src/sys/arch/alpha/stand: Makefile.bootprogs
src/sys/arch/amiga/stand/bootblock/boot: Makefile
src/sys/arch/amiga/stand/bootblock/bootxx_ffs: Makefile
src/sys/arch/arc/stand/boot: Makefile
src/sys/arch/bebox/stand/boot: Makefile
src/sys/arch/cobalt/stand/boot: Makefile
src/sys/arch/emips/stand: Makefile.booters
src/sys/arch/epoc32/stand/e32boot/exe: Makefile
src/sys/arch/evbarm/stand/boot2440: Makefile
src/sys/arch/evbarm/stand/gzboot: Makefile.gzboot
src/sys/arch/ews4800mips/stand/boot: Makefile
src/sys/arch/hp300/stand: Makefile.buildboot
src/sys/arch/hpcmips/stand/lcboot: Makefile
src/sys/arch/hppa/stand: Makefile.buildboot
src/sys/arch/i386/stand: Makefile.booters
src/sys/arch/i386/stand/boot: Makefile.boot
src/sys/arch/i386/stand/efiboot: Makefile.efiboot
src/sys/arch/ia64/stand/ia64/efi: Makefile
src/sys/arch/ia64/stand/ia64/ski: Makefile
src/sys/arch/landisk/stand/boot: Makefile.boot
src/sys/arch/luna68k/stand/boot: Makefile
src/sys/arch/macppc/stand/ofwboot: Makefile
src/sys/arch/mipsco/stand: Makefile.booters
src/sys/arch/mmeye/stand/boot: Makefile
src/sys/arch/mvme68k/stand: Makefile.booters
src/sys/arch/mvmeppc/stand: Makefile.booters
src/sys/arch/news68k/stand: Makefile.inc
src/sys/arch/newsmips/stand: Makefile.inc
src/sys/arch/next68k/stand/boot: Makefile
src/sys/arch/ofppc/stand/ofwboot: Makefile
src/sys/arch/pmax/stand: Makefile.booters
src/sys/arch/prep/stand/boot: Makefile
src/sys/arch/rs6000/stand/boot: Makefile
src/sys/arch/sandpoint/stand/altboot: Makefile
src/sys/arch/sbmips/stand: Makefile.bootprogs
src/sys/arch/sgimips/stand: Makefile.booters
src/sys/arch/sgimips/stand/boot64: Makefile
src/sys/arch/shark/stand/ofwboot: Makefile
src/sys/arch/sparc/stand/boot: Makefile
src/sys/arch/sparc/stand/ofwboot: Makefile
src/sys/arch/sun68k/stand/libsa: Makefile.inc
src/sys/arch/vax/boot/boot: Makefile
src/sys/arch/x68k/stand/boot: Makefile
src/sys/arch/x68k/stand/boot_ufs: Makefile
src/sys/arch/x68k/stand/boot_ustar: Makefile
src/sys/arch/x68k/stand/xxboot: Makefile.xxboot
src/sys/arch/zaurus/stand/zboot: Makefile

Log Message:
centralize vers.c building for standalone programs.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/acorn26/stand/Makefile.buildboot
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/acorn32/stand/Makefile.buildboot
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/stand/Makefile.bootprogs
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/amiga/stand/bootblock/boot/Makefile
cvs rdiff -u -r1.23 -r1.24 \
src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arc/stand/boot/Makefile
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/bebox/stand/boot/Makefile
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/cobalt/stand/boot/Makefile
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/emips/stand/Makefile.booters
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/epoc32/stand/e32boot/exe/Makefile
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/stand/boot2440/Makefile
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/stand/gzboot/Makefile.gzboot
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/ews4800mips/stand/boot/Makefile
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hpcmips/stand/lcboot/Makefile
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/stand/Makefile.buildboot
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/i386/stand/Makefile.booters
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/stand/boot/Makefile.boot
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/stand/ia64/efi/Makefile
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/stand/ia64/ski/Makefile
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/landisk/stand/boot/Makefile.boot
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/luna68k/stand/boot/Makefile
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/macppc/stand/ofwboot/Makefile
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mipsco/stand/Makefile.booters
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mmeye/stand/boot/Makefile
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mvme68k/stand/Makefile.booters
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/mvmeppc/stand/Makefile.booters
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/news68k/stand/Makefile.inc
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/newsmips/stand/Makefile.inc
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/stand/boot/Makefile
cvs rdiff -u -r1.31 -r1.32 

CVS commit: src/sys/arch

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 19:53:23 UTC 2017

Modified Files:
src/sys/arch/acorn26/stand: Makefile.buildboot
src/sys/arch/acorn32/stand: Makefile.buildboot
src/sys/arch/alpha/stand: Makefile.bootprogs
src/sys/arch/amiga/stand/bootblock/boot: Makefile
src/sys/arch/amiga/stand/bootblock/bootxx_ffs: Makefile
src/sys/arch/arc/stand/boot: Makefile
src/sys/arch/bebox/stand/boot: Makefile
src/sys/arch/cobalt/stand/boot: Makefile
src/sys/arch/emips/stand: Makefile.booters
src/sys/arch/epoc32/stand/e32boot/exe: Makefile
src/sys/arch/evbarm/stand/boot2440: Makefile
src/sys/arch/evbarm/stand/gzboot: Makefile.gzboot
src/sys/arch/ews4800mips/stand/boot: Makefile
src/sys/arch/hp300/stand: Makefile.buildboot
src/sys/arch/hpcmips/stand/lcboot: Makefile
src/sys/arch/hppa/stand: Makefile.buildboot
src/sys/arch/i386/stand: Makefile.booters
src/sys/arch/i386/stand/boot: Makefile.boot
src/sys/arch/i386/stand/efiboot: Makefile.efiboot
src/sys/arch/ia64/stand/ia64/efi: Makefile
src/sys/arch/ia64/stand/ia64/ski: Makefile
src/sys/arch/landisk/stand/boot: Makefile.boot
src/sys/arch/luna68k/stand/boot: Makefile
src/sys/arch/macppc/stand/ofwboot: Makefile
src/sys/arch/mipsco/stand: Makefile.booters
src/sys/arch/mmeye/stand/boot: Makefile
src/sys/arch/mvme68k/stand: Makefile.booters
src/sys/arch/mvmeppc/stand: Makefile.booters
src/sys/arch/news68k/stand: Makefile.inc
src/sys/arch/newsmips/stand: Makefile.inc
src/sys/arch/next68k/stand/boot: Makefile
src/sys/arch/ofppc/stand/ofwboot: Makefile
src/sys/arch/pmax/stand: Makefile.booters
src/sys/arch/prep/stand/boot: Makefile
src/sys/arch/rs6000/stand/boot: Makefile
src/sys/arch/sandpoint/stand/altboot: Makefile
src/sys/arch/sbmips/stand: Makefile.bootprogs
src/sys/arch/sgimips/stand: Makefile.booters
src/sys/arch/sgimips/stand/boot64: Makefile
src/sys/arch/shark/stand/ofwboot: Makefile
src/sys/arch/sparc/stand/boot: Makefile
src/sys/arch/sparc/stand/ofwboot: Makefile
src/sys/arch/sun68k/stand/libsa: Makefile.inc
src/sys/arch/vax/boot/boot: Makefile
src/sys/arch/x68k/stand/boot: Makefile
src/sys/arch/x68k/stand/boot_ufs: Makefile
src/sys/arch/x68k/stand/boot_ustar: Makefile
src/sys/arch/x68k/stand/xxboot: Makefile.xxboot
src/sys/arch/zaurus/stand/zboot: Makefile

Log Message:
centralize vers.c building for standalone programs.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/acorn26/stand/Makefile.buildboot
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/acorn32/stand/Makefile.buildboot
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/stand/Makefile.bootprogs
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/amiga/stand/bootblock/boot/Makefile
cvs rdiff -u -r1.23 -r1.24 \
src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arc/stand/boot/Makefile
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/bebox/stand/boot/Makefile
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/cobalt/stand/boot/Makefile
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/emips/stand/Makefile.booters
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/epoc32/stand/e32boot/exe/Makefile
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/stand/boot2440/Makefile
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/stand/gzboot/Makefile.gzboot
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/ews4800mips/stand/boot/Makefile
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hpcmips/stand/lcboot/Makefile
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/stand/Makefile.buildboot
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/i386/stand/Makefile.booters
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/i386/stand/boot/Makefile.boot
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/stand/ia64/efi/Makefile
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/stand/ia64/ski/Makefile
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/landisk/stand/boot/Makefile.boot
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/luna68k/stand/boot/Makefile
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/macppc/stand/ofwboot/Makefile
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mipsco/stand/Makefile.booters
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mmeye/stand/boot/Makefile
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mvme68k/stand/Makefile.booters
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/mvmeppc/stand/Makefile.booters
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/news68k/stand/Makefile.inc
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/newsmips/stand/Makefile.inc
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/stand/boot/Makefile
cvs rdiff -u -r1.31 -r1.32 

CVS commit: src/sys/conf

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 18:24:09 UTC 2017

Modified Files:
src/sys/conf: newvers.mk newvers.sh

Log Message:
- modernize: use getopts/usage/true/false variables
- if ${MKREPRO_TIMESTAMP} is used, synthesize all the information, instead
  of eliding it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/conf/newvers.mk
cvs rdiff -u -r1.61 -r1.62 src/sys/conf/newvers.sh

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/newvers.mk
diff -u src/sys/conf/newvers.mk:1.1 src/sys/conf/newvers.mk:1.2
--- src/sys/conf/newvers.mk:1.1	Sun Sep  6 02:13:16 2015
+++ src/sys/conf/newvers.mk	Sat Apr  8 14:24:09 2017
@@ -1,9 +1,13 @@
-# $NetBSD: newvers.mk,v 1.1 2015/09/06 06:13:16 uebayasi Exp $
+# $NetBSD: newvers.mk,v 1.2 2017/04/08 18:24:09 christos Exp $
 
 MKREPRO?=no
 
 .if ${MKREPRO} == "yes"
-_NVFLAGS=${NVFLAGS} -r
+.	if ${MKREPRO_TIMESTAMP:U0} != 0
+_NVFLAGS=${NVFLAGS} -r ${MKREPRO_TIMESTAMP} -i ${KERNEL_BUILD:T} -m ${MACHINE}
+.	else
+_NVFLAGS=${NVFLAGS} -R
+.	endif
 .else
 _NVFLAGS=${NVFLAGS}
 .endif

Index: src/sys/conf/newvers.sh
diff -u src/sys/conf/newvers.sh:1.61 src/sys/conf/newvers.sh:1.62
--- src/sys/conf/newvers.sh:1.61	Sun Aug  3 09:14:59 2014
+++ src/sys/conf/newvers.sh	Sat Apr  8 14:24:09 2017
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: newvers.sh,v 1.61 2014/08/03 13:14:59 justin Exp $
+#	$NetBSD: newvers.sh,v 1.62 2017/04/08 18:24:09 christos Exp $
 #
 # Copyright (c) 1984, 1986, 1990, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -41,13 +41,22 @@
 #
 # Command line options:
 #
-# -rReproducible build: Do not embed directory
+# -RReproducible build: Do not embed directory
 #   names, user names, time stamps, or other dynamic
 #   information into the output file.  This intended
 #   to allow two builds done at different times and
 #   even by different people on different hosts to
 #   produce identical output.
 #
+# -r Reproducible build: Embed fixed information to
+#			the output file.
+#			This intended to allow two builds done at different
+#			times and even by different people on different
+#			hosts to produce identical output.
+#
+# -m   Use the specified string as the value of the
+#   machine variable
+#
 # -iUse the specified string as the value of the
 #   kernel_ident variable
 #
@@ -144,40 +153,44 @@ if [ ! -e version ]; then
 	echo 0 > version
 fi
 
-v=$(cat version)
-t=$(LC_ALL=C date)
-u=${USER-root}
-h=$(hostname)
-d=$(pwd)
-cwd=$(dirname $0)
-copyright="$(cat "${cwd}/copyright")"
-
-while [ $# -gt 0 ]; do
-	case "$1" in
-	-r)
-		# -r: Reproducible build
-		rflag=true
+Rflag=false
+nflag=false
+timestamp=
+pwd=$(pwd)
+
+while getopts "Rr:m:i:n" OPT; do
+	case $OPT in
+	R)
+		# -R: Reproducible build
+		Rflag=true
 		;;
-	-i)
+	r)
+		# -r : timestamp
+		timestamp="$OPTARG"
+		;;
+	m)
+		# -m : machine
+		machine="$OPTARG"
+		;;
+	i)
 		# -i : Use the secified string as the
 		# value of the kernel_ident variable
-		id="$2"
-		shift
+		id="$OPTARG"
 		;;
-	-n)
-		# -n: Do not include a ELF note section
-		# in the output file.
+	n)
+		# -n: Do not include a ELF note section in the output file.
 		nflag=true
 		;;
+	*)	echo "Usage: newvers.sh [-Rn] [-r ] [-m ] [-i ]" >&2
+		exit 1;;
 	esac
-	shift
 done
 
 if [ -z "${id}" ]; then
 	if [ -f ident ]; then
 		id="$(cat ident)"
 	else
-		id=$(basename ${d})
+		id=$(basename "${pwd}")
 	fi
 	# Append ".${BUILDID}" to the default value of .
 	# If the "-i " command line option was used then this
@@ -188,16 +201,35 @@ if [ -z "${id}" ]; then
 	fi
 fi
 
+if ${Rflag}; then
+	reproversion=
+else
+	if [ -z "${timestamp}" ]; then
+		v=$(cat version)
+		t=$(LC_ALL=C date)
+		u=${USER-root}
+		h=$(hostname)
+		d=$(pwd)
+		# Increment the serial number in the version file
+		echo $(expr ${v} + 1) > version
+	else
+		v=0
+		t=$(LC_ALL=C TZ=UTC date -r "${timestamp}")
+		u=mkrepro
+		h=mkrepro.NetBSD.org
+		d="/usr/src/sys/arch/${machine}/compile/${id}"
+	fi
+	reproversion=" #${v}: ${t}\n\t${u}@${h}:${d}"
+fi
+
+cwd=$(dirname "$0")
+copyright="$(cat "${cwd}/copyright")"
 osrelcmd=${cwd}/osrelease.sh
 
 ost="NetBSD"
 osr=$(sh $osrelcmd)
 
-if [ ! -z "${rflag}" ]; then
-	fullversion="${ost} ${osr} (${id})\n"
-else
-	fullversion="${ost} ${osr} (${id}) #${v}: ${t}\n\t${u}@${h}:${d}\n"
-fi
+fullversion="${ost} ${osr} (${id})${reproversion}\n"
 
 # Convert multi-line strings to C source code.
 # Also add an extra blank line to copyright.
@@ -206,9 +238,6 @@ copyright_source="$(printf "%s\n\n" "${c
 fullversion_source="$(printf "%b" "${fullversion}" | source_lines)"
 buildinfo_source="$(printf "%b" "${BUILDINFO}" | source_lines)"
 
-# Increment 

CVS commit: src/sys/conf

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 18:24:09 UTC 2017

Modified Files:
src/sys/conf: newvers.mk newvers.sh

Log Message:
- modernize: use getopts/usage/true/false variables
- if ${MKREPRO_TIMESTAMP} is used, synthesize all the information, instead
  of eliding it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/conf/newvers.mk
cvs rdiff -u -r1.61 -r1.62 src/sys/conf/newvers.sh

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



CVS commit: src

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 18:22:35 UTC 2017

Modified Files:
src: build.sh

Log Message:
- Allow all other targets (like kernel=) to obey mkrepro (-P)
- Print the timestamp in UTC


To generate a diff of this commit:
cvs rdiff -u -r1.315 -r1.316 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.315 src/build.sh:1.316
--- src/build.sh:1.315	Fri Mar 10 12:15:47 2017
+++ src/build.sh	Sat Apr  8 14:22:35 2017
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.315 2017/03/10 17:15:47 sevan Exp $
+#	$NetBSD: build.sh,v 1.316 2017/04/08 18:22:35 christos Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1893,7 +1893,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 18:22:35 UTC 2017

Modified Files:
src: build.sh

Log Message:
- Allow all other targets (like kernel=) to obey mkrepro (-P)
- Print the timestamp in UTC


To generate a diff of this commit:
cvs rdiff -u -r1.315 -r1.316 src/build.sh

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



CVS commit: src/sys/external/bsd/acpica/dist/tables

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:10:43 UTC 2017

Modified Files:
src/sys/external/bsd/acpica/dist/tables: tbxfload.c

Log Message:
Add #ifdef so ski emulator won't crash.  This change probably wouldn't
hurt other archs, but just apply to ia64 to be safe.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/acpica/dist/tables/tbxfload.c

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



CVS commit: src/sys/external/bsd/acpica/dist/tables

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:10:43 UTC 2017

Modified Files:
src/sys/external/bsd/acpica/dist/tables: tbxfload.c

Log Message:
Add #ifdef so ski emulator won't crash.  This change probably wouldn't
hurt other archs, but just apply to ia64 to be safe.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/acpica/dist/tables/tbxfload.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/external/bsd/acpica/dist/tables/tbxfload.c
diff -u src/sys/external/bsd/acpica/dist/tables/tbxfload.c:1.5 src/sys/external/bsd/acpica/dist/tables/tbxfload.c:1.6
--- src/sys/external/bsd/acpica/dist/tables/tbxfload.c:1.5	Wed Jan 25 13:38:22 2017
+++ src/sys/external/bsd/acpica/dist/tables/tbxfload.c	Sat Apr  8 18:10:43 2017
@@ -163,6 +163,17 @@ AcpiTbLoadNamespace (
 
 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
 
+#ifdef __ia64__
+/*
+ * For ia64 ski emulator
+ */
+if (AcpiGbl_DsdtIndex == ACPI_INVALID_TABLE_INDEX)
+{
+Status = AE_NO_ACPI_TABLES;
+goto UnlockAndExit;
+}
+#endif
+
 /*
  * Load the namespace. The DSDT is required, but any SSDT and
  * PSDT tables are optional. Verify the DSDT.



CVS commit: src/sys/arch/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:08:33 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: pmap.c
src/sys/arch/ia64/include: pmap.h

Log Message:
Attempted port over from FreeBSD with suggestions from .  Still
more work needed, but at least now the ski simulator and hardware die
at the same place.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/ia64/ia64/pmap.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/include/pmap.h

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

Modified files:

Index: src/sys/arch/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.34 src/sys/arch/ia64/ia64/pmap.c:1.35
--- src/sys/arch/ia64/ia64/pmap.c:1.34	Fri Dec 23 17:26:43 2016
+++ src/sys/arch/ia64/ia64/pmap.c	Sat Apr  8 18:08:33 2017
@@ -1,5 +1,4 @@
-/* $NetBSD: pmap.c,v 1.34 2016/12/23 17:26:43 scole Exp $ */
-
+/* $NetBSD: pmap.c,v 1.35 2017/04/08 18:08:33 scole Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -80,18 +79,18 @@
 
 /* __FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.172 2005/11/20 06:09:48 alc Exp $"); */
 
-
-/* XXX: This module is a mess. Need to clean up Locking, list traversal. etc... */
-
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.34 2016/12/23 17:26:43 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.35 2017/04/08 18:08:33 scole Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -99,47 +98,158 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
+
+/*
+ *	Manages physical address maps.
+ *
+ *	Since the information managed by this module is
+ *	also stored by the logical address mapping module,
+ *	this module may throw away valid virtual-to-physical
+ *	mappings at almost any time.  However, invalidations
+ *	of virtual-to-physical mappings must be done as
+ *	requested.
+ *
+ *	In order to cope with hardware architectures which
+ *	make virtual-to-physical map invalidates expensive,
+ *	this module may delay invalidate or reduced protection
+ *	operations until such time as they are actually
+ *	necessary.  This module is given full information as
+ *	to which processors are currently using which maps,
+ *	and to when physical maps must be made correct.
+ */
+
+/*
+ * Following the Linux model, region IDs are allocated in groups of
+ * eight so that a single region ID can be used for as many RRs as we
+ * want by encoding the RR number into the low bits of the ID.
+ *
+ * We reserve region ID 0 for the kernel and allocate the remaining
+ * IDs for user pmaps.
+ *
+ * Region 0-3:	User virtually mapped
+ * Region 4:	PBVM and special mappings
+ * Region 5:	Kernel virtual memory
+ * Region 6:	Direct-mapped uncacheable
+ * Region 7:	Direct-mapped cacheable
+ */
+
+#if !defined(DIAGNOSTIC)
+#define PMAP_INLINE __inline
+#else
+#define PMAP_INLINE
+#endif
+
+#ifdef PV_STATS
+#define PV_STAT(x)	do { x ; } while (0)
+#else
+#define PV_STAT(x)	do { } while (0)
+#endif
+
+#define	pmap_accessed(lpte)		((lpte)->pte & PTE_ACCESSED)
+#define	pmap_dirty(lpte)		((lpte)->pte & PTE_DIRTY)
+#define	pmap_exec(lpte)			((lpte)->pte & PTE_AR_RX)
+#define	pmap_managed(lpte)		((lpte)->pte & PTE_MANAGED)
+#define	pmap_ppn(lpte)			((lpte)->pte & PTE_PPN_MASK)
+#define	pmap_present(lpte)		((lpte)->pte & PTE_PRESENT)
+#define	pmap_prot(lpte)			(((lpte)->pte & PTE_PROT_MASK) >> 56)
+#define	pmap_wired(lpte)		((lpte)->pte & PTE_WIRED)
+
+#define	pmap_clear_accessed(lpte)	(lpte)->pte &= ~PTE_ACCESSED
+#define	pmap_clear_dirty(lpte)		(lpte)->pte &= ~PTE_DIRTY
+#define	pmap_clear_present(lpte)	(lpte)->pte &= ~PTE_PRESENT
+#define	pmap_clear_wired(lpte)		(lpte)->pte &= ~PTE_WIRED
+
+#define	pmap_set_wired(lpte)		(lpte)->pte |= PTE_WIRED
+
+/*
+ * Individual PV entries are stored in per-pmap chunks.  This saves
+ * space by eliminating the need to record the pmap within every PV
+ * entry.
+ */
+#if PAGE_SIZE == 8192
+#define	_NPCM	6
+#define	_NPCPV	337
+#define	_NPCS	2
+#elif PAGE_SIZE == 16384
+#define	_NPCM	11
+#define	_NPCPV	677
+#define	_NPCS	1
+#else
+#error "invalid page size"
+#endif
+
+struct pv_chunk {
+	pmap_t			pc_pmap;
+	TAILQ_ENTRY(pv_chunk)	pc_list;
+	u_long			pc_map[_NPCM];	/* bitmap; 1 = free */
+	TAILQ_ENTRY(pv_chunk)	pc_lru;
+	u_long			pc_spare[_NPCS];
+	struct pv_entry		pc_pventry[_NPCPV];
+};
+
+/*
+ * The VHPT bucket head structure.
+ */
+struct ia64_bucket {
+	uint64_t	chain;
+	kmutex_t	mutex;
+	u_int		length;
+};
+
+/*
+ * Statically allocated kernel pmap
+ */
+static struct pmap kernel_pmap_store;/* the kernel's pmap (proc0) */
+struct pmap *const kernel_pmap_ptr = _pmap_store;
 
+vaddr_t virtual_avail;	/* VA of first avail page (after kernel bss) */
+vaddr_t virtual_end;	/* VA of last avail page (end of kernel AS) */
+
+/* XXX freebsd, needs to be sorted out */

CVS commit: src/sys/arch/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:08:33 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: pmap.c
src/sys/arch/ia64/include: pmap.h

Log Message:
Attempted port over from FreeBSD with suggestions from .  Still
more work needed, but at least now the ski simulator and hardware die
at the same place.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/ia64/ia64/pmap.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/include/pmap.h

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



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:05:36 UTC 2017

Modified Files:
src/sys/arch/ia64/include: vmparam.h

Log Message:
Add VM_INIT_KERNEL_ADDRESS from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/ia64/include/vmparam.h

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

Modified files:

Index: src/sys/arch/ia64/include/vmparam.h
diff -u src/sys/arch/ia64/include/vmparam.h:1.9 src/sys/arch/ia64/include/vmparam.h:1.10
--- src/sys/arch/ia64/include/vmparam.h:1.9	Sat Aug  6 21:13:30 2016
+++ src/sys/arch/ia64/include/vmparam.h	Sat Apr  8 18:05:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.9 2016/08/06 21:13:30 martin Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.10 2017/04/08 18:05:36 scole Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -131,6 +131,9 @@
 #define	IA64_ID_PAGE_SIZE	(1 << IA64_ID_PAGE_SHIFT)
 #define	IA64_ID_PAGE_MASK	(IA64_ID_PAGE_SIZE-1)
 
+/* XXX freebsd uses
+#define IA64_BACKINGSTORE   (USRSTACK - (2 * MAXSSIZ) - PAGE_SIZE)
+*/
 #define	IA64_BACKINGSTORE	IA64_RR_BASE(4)
 
 #define	PAGE_SHIFT	14		/* 16K pages by default. */
@@ -143,6 +146,7 @@
 #define	VM_GATEWAY_SIZE		PAGE_SIZE
 #define	VM_MAXUSER_ADDRESS	(VM_MAX_ADDRESS + VM_GATEWAY_SIZE)
 #define	VM_MIN_KERNEL_ADDRESS	VM_MAXUSER_ADDRESS
+#define VM_INIT_KERNEL_ADDRESS  IA64_RR_BASE(IA64_VM_MINKERN_REGION + 1)
 #define VM_MAX_KERNEL_ADDRESS	((vaddr_t) (IA64_RR_BASE(6) - 1))
 
 #define VM_PHYSSEG_MAX		16		/* XXX: */



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:04:35 UTC 2017

Modified Files:
src/sys/arch/ia64/include: pcb.h

Log Message:
Make restorectx() and swapctx() match original FreeBSD defs


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/ia64/include/pcb.h

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



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:04:35 UTC 2017

Modified Files:
src/sys/arch/ia64/include: pcb.h

Log Message:
Make restorectx() and swapctx() match original FreeBSD defs


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/ia64/include/pcb.h

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

Modified files:

Index: src/sys/arch/ia64/include/pcb.h
diff -u src/sys/arch/ia64/include/pcb.h:1.2 src/sys/arch/ia64/include/pcb.h:1.3
--- src/sys/arch/ia64/include/pcb.h:1.2	Thu Mar 20 09:09:20 2008
+++ src/sys/arch/ia64/include/pcb.h	Sat Apr  8 18:04:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcb.h,v 1.2 2008/03/20 09:09:20 kochi Exp $	*/
+/*	$NetBSD: pcb.h,v 1.3 2017/04/08 18:04:34 scole Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -67,8 +67,9 @@ struct pcb {
 struct trapframe;
 
 void makectx(struct trapframe *, struct pcb *);
-/*void restorectx(struct pcb *) __dead2;*/
-int swapctx(struct pcb *old, struct pcb *new);
+/* XXX not sure about the attributes, for now use equivalent to freebsd */
+void restorectx(struct pcb *) __attribute__ ((__noreturn__)); /* same as __dead2? */
+int swapctx(struct pcb *old, struct pcb *new) __returns_twice;
 
 void ia32_restorectx(struct pcb *);
 void ia32_savectx(struct pcb *);



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:03:33 UTC 2017

Modified Files:
src/sys/arch/ia64/include: param.h

Log Message:
Add more defs from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/include/param.h

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



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:03:33 UTC 2017

Modified Files:
src/sys/arch/ia64/include: param.h

Log Message:
Add more defs from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/include/param.h

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

Modified files:

Index: src/sys/arch/ia64/include/param.h
diff -u src/sys/arch/ia64/include/param.h:1.8 src/sys/arch/ia64/include/param.h:1.9
--- src/sys/arch/ia64/include/param.h:1.8	Fri Feb 10 17:35:49 2012
+++ src/sys/arch/ia64/include/param.h	Sat Apr  8 18:03:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.8 2012/02/10 17:35:49 para Exp $	*/
+/*	$NetBSD: param.h,v 1.9 2017/04/08 18:03:33 scole Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -80,6 +80,9 @@
 #define ALIGNBYTES32		(sizeof(int) - 1)
 #define ALIGN32(p)		(((u_long)(p) + ALIGNBYTES32) &~ALIGNBYTES32)
 
+#ifndef LOG2_PAGE_SIZE
+#define LOG2_PAGE_SIZE  14  /* 16K pages by default. */
+#endif
 #define	PGSHIFT		14		/* LOG2(NBPG) */
 #define	NBPG		(1 << PGSHIFT)	/* bytes/page */
 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
@@ -108,6 +111,11 @@
 #define	NKMEMPAGES_MIN_DEFAULT	((32 * 1024 * 1024) >> PAGE_SHIFT)
 #define	NKMEMPAGES_MAX_UNLIMITED 1
 
+/* The default size of identity mappings in region 6 & 7. */
+#ifndef LOG2_ID_PAGE_SIZE
+#define LOG2_ID_PAGE_SIZE   16
+#endif
+
 /*
  * Mach derived conversion macros
  */



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:02:55 UTC 2017

Modified Files:
src/sys/arch/ia64/include: md_var.h

Log Message:
Add more funcs from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/ia64/include/md_var.h

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

Modified files:

Index: src/sys/arch/ia64/include/md_var.h
diff -u src/sys/arch/ia64/include/md_var.h:1.1 src/sys/arch/ia64/include/md_var.h:1.2
--- src/sys/arch/ia64/include/md_var.h:1.1	Fri Apr  7 14:21:18 2006
+++ src/sys/arch/ia64/include/md_var.h	Sat Apr  8 18:02:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: md_var.h,v 1.1 2006/04/07 14:21:18 cherry Exp $	*/
+/*	$NetBSD: md_var.h,v 1.2 2017/04/08 18:02:55 scole Exp $	*/
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -83,13 +83,14 @@ void	ia64_probe_sapics(void);
 int	interrupt(uint64_t, struct trapframe *);
 void	map_gateway_page(void);
 void	map_pal_code(void);
+void	map_vhpt(uintptr_t);
 void	os_boot_rendez(void);
 void	os_mca(void);
 int	syscall(struct trapframe *);
 void	trap(int, struct trapframe *);
 void	trap_panic(int, struct trapframe *);
 int	unaligned_fixup(struct trapframe *, struct thread *);
-
+void	ia64_sync_icache(vaddr_t, vaddr_t);
 #endif	/* _KERNEL */
 
 #endif /* !_IA64_MD_VAR_H_ */



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:02:55 UTC 2017

Modified Files:
src/sys/arch/ia64/include: md_var.h

Log Message:
Add more funcs from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/ia64/include/md_var.h

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



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:02:21 UTC 2017

Modified Files:
src/sys/arch/ia64/include: intr.h

Log Message:
Add ia64_handle_intr() declaration


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/include/intr.h

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



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:02:21 UTC 2017

Modified Files:
src/sys/arch/ia64/include: intr.h

Log Message:
Add ia64_handle_intr() declaration


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/include/intr.h

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

Modified files:

Index: src/sys/arch/ia64/include/intr.h
diff -u src/sys/arch/ia64/include/intr.h:1.5 src/sys/arch/ia64/include/intr.h:1.6
--- src/sys/arch/ia64/include/intr.h:1.5	Mon Jul 20 06:14:15 2009
+++ src/sys/arch/ia64/include/intr.h	Sat Apr  8 18:02:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.5 2009/07/20 06:14:15 kiyohara Exp $	*/
+/*	$NetBSD: intr.h,v 1.6 2017/04/08 18:02:21 scole Exp $	*/
 
 /* XXX: cherry: To Be fixed when we switch on interrupts. */
 
@@ -69,5 +69,6 @@ extern uint64_t ia64_lapic_address;
 
 void *intr_establish(int, int, int, int (*)(void *), void *);
 void intr_disestablish(void *);
+void ia64_handle_intr(void *);
 
 #endif /* ! _IA64_INTR_H_ */



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:01:22 UTC 2017

Modified Files:
src/sys/arch/ia64/include: cpu.h

Log Message:
Add ci_vhpt to cpu_info


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/ia64/include/cpu.h

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

Modified files:

Index: src/sys/arch/ia64/include/cpu.h
diff -u src/sys/arch/ia64/include/cpu.h:1.15 src/sys/arch/ia64/include/cpu.h:1.16
--- src/sys/arch/ia64/include/cpu.h:1.15	Wed Feb  8 18:01:12 2017
+++ src/sys/arch/ia64/include/cpu.h	Sat Apr  8 18:01:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.15 2017/02/08 18:01:12 christos Exp $	*/
+/*	$NetBSD: cpu.h,v 1.16 2017/04/08 18:01:22 scole Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -102,7 +102,7 @@ struct cpu_info {
 	cpuid_t ci_cpuid;		/* our CPU ID */
 	uint32_t ci_acpiid;		/* our ACPI/MADT ID */
 	uint32_t ci_initapicid;		/* our intitial APIC ID */
-	struct pmap *ci_pmap;		/* current pmap */
+	struct pmap *ci_pmap;		/* current pmap */ /* XXX FreeBSD has *pcb_current_pmap in pcb ? */
 	struct lwp *ci_fpcurlwp;	/* current owner of the FPU */
 	paddr_t ci_curpcb;		/* PA of current HW PCB */
 	struct pcb *ci_idle_pcb;	/* our idle PCB */
@@ -111,6 +111,7 @@ struct cpu_info {
 	struct trapframe *ci_db_regs;	/* registers for debuggers */
 	uint64_t ci_clock;		/* clock counter */
 	uint64_t ci_clockadj;		/* clock adjust */
+	uint64_t ci_vhpt;		/* address of vhpt */
 };
 
 



CVS commit: src/sys/arch/ia64/include

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 18:01:22 UTC 2017

Modified Files:
src/sys/arch/ia64/include: cpu.h

Log Message:
Add ci_vhpt to cpu_info


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/ia64/include/cpu.h

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:47:14 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: trap.c

Log Message:
Add include and panic in startlwp()


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/ia64/ia64/trap.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/ia64/ia64/trap.c
diff -u src/sys/arch/ia64/ia64/trap.c:1.13 src/sys/arch/ia64/ia64/trap.c:1.14
--- src/sys/arch/ia64/ia64/trap.c:1.13	Mon Mar 10 13:47:45 2014
+++ src/sys/arch/ia64/ia64/trap.c	Sat Apr  8 17:47:14 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.13 2014/03/10 13:47:45 martin Exp $ */
+/* $NetBSD: trap.c,v 1.14 2017/04/08 17:47:14 scole Exp $ */
 
 /*-
  * Copyright (c) 2005 Marcel Moolenaar
@@ -61,7 +61,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.13 2014/03/10 13:47:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.14 2017/04/08 17:47:14 scole Exp $");
 
 #include 
 #include 
@@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #ifdef DDB
@@ -319,8 +320,7 @@ trap_decode_break(struct trapframe *tf)
 void
 startlwp(void *arg)
 {
-printf("%s: not yet\n", __func__);
-	return;
+	panic("XXX %s implement", __func__);
 }
 
 #ifdef DDB



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:47:14 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: trap.c

Log Message:
Add include and panic in startlwp()


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/ia64/ia64/trap.c

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:46:30 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: syscall_stubs.S

Log Message:
Add vmparam.h include


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/ia64/ia64/syscall_stubs.S

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/ia64/ia64/syscall_stubs.S
diff -u src/sys/arch/ia64/ia64/syscall_stubs.S:1.3 src/sys/arch/ia64/ia64/syscall_stubs.S:1.4
--- src/sys/arch/ia64/ia64/syscall_stubs.S:1.3	Mon Jul 20 04:41:37 2009
+++ src/sys/arch/ia64/ia64/syscall_stubs.S	Sat Apr  8 17:46:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall_stubs.S,v 1.3 2009/07/20 04:41:37 kiyohara Exp $	*/
+/*	$NetBSD: syscall_stubs.S,v 1.4 2017/04/08 17:46:30 scole Exp $	*/
 
 	/*-
  * Copyright (c) 2002, 2003 Marcel Moolenaar
@@ -33,7 +33,6 @@
 
 
 #include 
-#include 
 #undef VM_MAX_ADDRESS
 
 #include "assym.h"



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:46:30 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: syscall_stubs.S

Log Message:
Add vmparam.h include


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/ia64/ia64/syscall_stubs.S

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:46:01 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
Add more from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/ia64/ia64/machdep.c

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:46:01 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: machdep.c

Log Message:
Add more from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/ia64/ia64/machdep.c

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

Modified files:

Index: src/sys/arch/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.37 src/sys/arch/ia64/ia64/machdep.c:1.38
--- src/sys/arch/ia64/ia64/machdep.c:1.37	Fri Dec 23 07:15:27 2016
+++ src/sys/arch/ia64/ia64/machdep.c	Sat Apr  8 17:46:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.37 2016/12/23 07:15:27 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.38 2017/04/08 17:46:01 scole Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -142,8 +142,10 @@ uint64_t processor_frequency;
 uint64_t bus_frequency;
 uint64_t itc_frequency;
 uint64_t ia64_pal_base;
+uint64_t ia64_pal_size;
 uint64_t ia64_port_base;
 
+int ia64_sync_icache_needed = 0;
 
 extern uint64_t ia64_gateway_page[];
 
@@ -254,6 +256,30 @@ cpu_dumpconf(void)
 }
 
 void
+map_vhpt(uintptr_t vhpt)
+{
+pt_entry_t pte;
+uint64_t psr;
+
+pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY |
+		PTE_PL_KERN | PTE_AR_RW;
+pte |= vhpt & PTE_PPN_MASK;
+
+__asm __volatile("ptr.d %0,%1" :: "r"(vhpt),
+			 "r"(pmap_vhpt_log2size << 2));
+
+__asm __volatile("mov   %0=psr" : "=r"(psr));
+__asm __volatile("rsm   psr.ic|psr.i");
+ia64_srlz_i();
+ia64_set_ifa(vhpt);
+ia64_set_itir(pmap_vhpt_log2size << 2);
+ia64_srlz_d();
+__asm __volatile("itr.d dtr[%0]=%1" :: "r"(3), "r"(pte));
+__asm __volatile("mov   psr.l=%0" :: "r" (psr));
+ia64_srlz_i();
+}
+
+void
 map_pal_code(void)
 {
 	pt_entry_t pte;
@@ -368,6 +394,15 @@ ia64_init(void)
 
 	ia64_set_fpsr(IA64_FPSR_DEFAULT);
 
+	/*
+	 * Region 6 is direct mapped UC and region 7 is direct mapped
+	 * WC. The details of this is controlled by the Alt {I,D}TLB
+	 * handlers. Here we just make sure that they have the largest
+	 * possible page size to minimise TLB usage.
+	 */
+	ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (LOG2_ID_PAGE_SIZE << 2));
+	ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (LOG2_ID_PAGE_SIZE << 2));
+	ia64_srlz_d();
 
 	/*
 	 * TODO: Get critical system information (if possible, from the
@@ -793,3 +828,37 @@ mm_md_physacc(paddr_t pa, vm_prot_t prot
 
 	return 0; /* TODO: Implement. */
 }
+
+void
+ia64_sync_icache(vaddr_t va, vsize_t sz)
+{
+	vaddr_t lim;
+
+if (!ia64_sync_icache_needed)
+return;
+
+lim = va + sz;
+while (va < lim) {
+ia64_fc_i(va);
+va += 32;   /* XXX */
+}
+
+ia64_sync_i();
+ia64_srlz_i();
+}
+
+/*
+ * Construct a PCB from a trapframe. This is called from kdb_trap() where
+ * we want to start a backtrace from the function that caused us to enter
+ * the debugger. We have the context in the trapframe, but base the trace
+ * on the PCB. The PCB doesn't have to be perfect, as long as it contains
+ * enough for a backtrace.
+ */
+void
+makectx(struct trapframe *tf, struct pcb *pcb)
+{
+pcb->pcb_special = tf->tf_special;
+pcb->pcb_special.__spare = ~0UL;/* XXX see unwind.c */
+save_callee_saved(>pcb_preserved);
+save_callee_saved_fp(>pcb_preserved_fp);
+}



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:45:22 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: locore.S

Log Message:
Add kstack_top variable


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/ia64/locore.S

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/ia64/ia64/locore.S
diff -u src/sys/arch/ia64/ia64/locore.S:1.6 src/sys/arch/ia64/ia64/locore.S:1.7
--- src/sys/arch/ia64/ia64/locore.S:1.6	Fri Jun 20 12:41:34 2014
+++ src/sys/arch/ia64/ia64/locore.S	Sat Apr  8 17:45:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.6 2014/06/20 12:41:34 joerg Exp $	*/
+/*	$NetBSD: locore.S,v 1.7 2017/04/08 17:45:22 scole Exp $	*/
 	
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -31,18 +31,18 @@
 #include "opt_multiprocessor.h"
 
 #include 
-#include 
-#include 
 #include 
 #include 
 
 #include "assym.h"
 
 	.section .data.proc0,"aw"
-	.global	kstack
 	.align	PAGE_SIZE
+	.global	kstack
 kstack:	.space KSTACK_PAGES * PAGE_SIZE
-
+	.global kstack_top
+kstack_top:
+	
 	.text
 
 /*



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:45:22 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: locore.S

Log Message:
Add kstack_top variable


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/ia64/locore.S

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:44:27 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: interrupt.c

Log Message:
Add ia64_handle_intr() stub


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/ia64/interrupt.c

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:44:27 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: interrupt.c

Log Message:
Add ia64_handle_intr() stub


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/ia64/interrupt.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/ia64/ia64/interrupt.c
diff -u src/sys/arch/ia64/ia64/interrupt.c:1.6 src/sys/arch/ia64/ia64/interrupt.c:1.7
--- src/sys/arch/ia64/ia64/interrupt.c:1.6	Sat Oct  1 15:59:28 2011
+++ src/sys/arch/ia64/ia64/interrupt.c	Sat Apr  8 17:44:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.6 2011/10/01 15:59:28 chs Exp $ */
+/* $NetBSD: interrupt.c,v 1.7 2017/04/08 17:44:27 scole Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -33,7 +33,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.6 2011/10/01 15:59:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.7 2017/04/08 17:44:27 scole Exp $");
 
 #include "opt_ddb.h"
 
@@ -363,6 +363,12 @@ ia64_dispatch_intr(void *frame, u_int ve
 	return handled;
 }
 
+void
+ia64_handle_intr(void *tf)
+{
+	panic("XXX %s not implemented", __func__);
+}
+
 #ifdef DDB
 void
 db_print_vector(u_int vector, int always)



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:43:42 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: genassym.cf

Log Message:
Add more PTE and IA64 mem region variables


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ia64/ia64/genassym.cf

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/ia64/ia64/genassym.cf
diff -u src/sys/arch/ia64/ia64/genassym.cf:1.10 src/sys/arch/ia64/ia64/genassym.cf:1.11
--- src/sys/arch/ia64/ia64/genassym.cf:1.10	Sat Oct  1 15:59:28 2011
+++ src/sys/arch/ia64/ia64/genassym.cf	Sat Apr  8 17:43:41 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.10 2011/10/01 15:59:28 chs Exp $
+#	$NetBSD: genassym.cf,v 1.11 2017/04/08 17:43:41 scole Exp $
 
 #
 # Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -87,6 +87,7 @@ include 
 
 include 
 include 
+include 
 include 
 include 
 include 
@@ -113,6 +114,21 @@ define	PAGE_SIZE		PAGE_SIZE
 define	PAGE_SHIFT		PAGE_SHIFT
 define	KSTACK_PAGES		KSTACK_PAGES
 
+define	IA64_VM_MINKERN_REGION	IA64_VM_MINKERN_REGION
+define	IA64_PBVM_RR		IA64_PBVM_RR
+define  IA64_PBVM_PAGE_SHIFT	IA64_PBVM_PAGE_SHIFT
+define	IA64_PSR_DFH		IA64_PSR_DFH
+define	IA64_PBVM_BASE		IA64_PBVM_BASE
+define	IA64_PBVM_PGTBL		IA64_PBVM_PGTBL
+
+define	PTE_PRESENT		PTE_PRESENT
+define	PTE_ACCESSED		PTE_ACCESSED
+define	PTE_DIRTY		PTE_DIRTY
+define	PTE_PL_KERN		PTE_PL_KERN
+define	PTE_AR_RWX		PTE_AR_RWX
+define	PTE_MA_WB		PTE_MA_WB
+define	PTE_MA_UC		PTE_MA_UC
+
 define	DT_NULL			DT_NULL
 define	DT_RELA			DT_RELA
 define	DT_RELAENT		DT_RELAENT



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:43:42 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: genassym.cf

Log Message:
Add more PTE and IA64 mem region variables


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/ia64/ia64/genassym.cf

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:42:47 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: exception.S

Log Message:
Updates from FreeBSD, mostly compile-tested


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/ia64/exception.S

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/ia64/ia64/exception.S
diff -u src/sys/arch/ia64/ia64/exception.S:1.5 src/sys/arch/ia64/ia64/exception.S:1.6
--- src/sys/arch/ia64/ia64/exception.S:1.5	Sat Oct  1 15:59:27 2011
+++ src/sys/arch/ia64/ia64/exception.S	Sat Apr  8 17:42:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception.S,v 1.5 2011/10/01 15:59:27 chs Exp $ */
+/*	$NetBSD: exception.S,v 1.6 2017/04/08 17:42:47 scole Exp $ */
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -28,18 +28,206 @@
  */
 
 #include 
-#include 
+/* __FBSDID("$FreeBSD: releng/10.1/sys/ia64/ia64/exception.S 268200 2014-07-02 23:47:43Z marcel $"); */
 
 #include "assym.h"
 	
 /*
+ * Nested TLB restart tokens. These are used by the
+ * nested TLB handler for jumping back to the code
+ * where the nested TLB was caused.
+ */
+#define	NTLBRT_SAVE	0x12c12c
+#define	NTLBRT_RESTORE  0x12c12d
+
+/*
  * ar.k7 = kernel memory stack
  * ar.k6 = kernel register stack
  * ar.k5 = EPC gateway page
  * ar.k4 = PCPU data
  */
 
-	.text
+	.section .ivt.data, "aw"
+
+	.align	8
+	.global ia64_kptdir
+	.size	ia64_kptdir, 8
+ia64_kptdir:	data8	0
+
+	
+#ifdef XTRACE
+
+	.align	8
+	.global	ia64_xtrace_mask
+	.size	ia64_xtrace_mask, 8
+ia64_xtrace_mask:	data8	0
+
+	.align	4
+	.global	ia64_xtrace_enabled
+	.size	ia64_xtrace_enabled, 4
+ia64_xtrace_enabled:	data4	0
+
+#define	XTRACE_HOOK(offset)			\
+{	.mii ;	\
+	nop		0 ;			\
+	mov		r31 = b7 ;		\
+	mov		r28 = pr ;		\
+} ;		\
+{	.mib ;	\
+	nop		0 ;			\
+	mov		r25 = ip ;		\
+	br.sptk		ia64_xtrace_write ;;	\
+} ;		\
+{	.mii ;	\
+	nop		0 ;			\
+	mov		b7 = r31 ;		\
+	mov		pr = r28, 0x1 ;;	\
+}
+
+	.section .ivt.text, "ax"
+
+// We can only use r25, r26 & r27
+ENTRY_NOPROFILE(ia64_xtrace_write, 0)
+{	.mlx
+	add	r25 = 16, r25
+	movl	r26 = ia64_xtrace_enabled
+	;;
+}
+{	.mmi
+	mov	r27 = ar.k3
+	ld4	r26 = [r26]
+	mov	b7 = r25
+	;;
+}
+{	.mib
+	add	r25 = -32, r25
+	cmp.eq	p15,p0 = r0, r26
+(p15)	br.dptk.few	b7
+	;;
+}
+{	.mib
+	nop	0
+	cmp.eq	p15,p0 = r0, r27
+(p15)	br.dptk.few	b7
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x00 IVT
+	mov	r26 = ar.itc
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x08 ITC
+	mov	r25 = cr.iip
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x10 IIP
+	mov	r26 = cr.ifa
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x18 IFA
+	mov	r25 = cr.isr
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x20 ISR
+	mov	r26 = cr.ipsr
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x28 IPSR
+	mov	r25 = cr.itir
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x30 ITIR
+	mov	r26 = cr.iipa
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x38 IIPA
+	mov	r25 = cr.ifs
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x40 IFS
+	mov	r26 = cr.iim
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x48 IIM
+	mov	r25 = cr.iha
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x50 IHA
+	mov	r26 = ar.unat
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x58 UNAT
+	mov	r25 = ar.rsc
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x60 RSC
+	mov	r26 = ar.bsp
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r26, 8		// 0x68 BSP
+	mov	r25 = r13
+	nop	0
+	;;
+}
+{	.mmi
+	st8	[r27] = r25, 8		// 0x70 PCPU/TLS
+	mov	r26 = r12
+	nop	0
+	;;
+}
+{	.mlx
+	st8	[r27] = r26, 8		// 0x78 SP
+	movl	r25 = ia64_xtrace_mask
+	;;
+}
+{	.mmi
+	ld8	r26 = [r25]
+	;;
+	and	r25 = r27, r26
+	nop	0
+	;;
+}
+{	.mib
+	mov	ar.k3 = r25
+	nop	0
+	br.sptk	b7
+	;;
+}
+END(ia64_xtrace_write)
+
+#else /* XTRACE */
+
+#define	XTRACE_HOOK(offset)
+
+	.section .ivt.text, "ax"
+
+#endif /* XTRACE */
 
 /*
  * exception_save: save interrupted state
@@ -67,7 +255,7 @@ ENTRY_NOPROFILE(exception_save, 0)
 	;;
 }
 {	.mmi
-	cmp.le		p14,p15=5,r31
+	cmp.le		p14,p15=IA64_VM_MINKERN_REGION,r31
 	;;
 (p15)	mov		r23=ar.k7		// kernel memory stack
 (p14)	mov		r23=sp
@@ -82,42 +270,57 @@ ENTRY_NOPROFILE(exception_save, 0)
 }
 {	.mmi
 	mov		ar.rsc=0
-	sub		r19=r23,r30
-	add		r31=8,r30
-	;;
-}
-{	.mlx
 	mov		r22=cr.iip
-	movl		r26=exception_save_restart
+	addl		r29=NTLBRT_SAVE,r0	// 22-bit restart token.
 	;;
 }
 
 	/*
-	 * We have a 1KB aligned trapframe, pointed to by sp. If we write
-	 * to the trapframe, we may trigger a data nested TLB fault. By
-	 * aligning the trapframe on a 1KB boundary, we guarantee that if
-	 * we get a data nested TLB fault, it will be on the very first
-	 * write. Since the data nested TLB fault does not preserve any
-	 * state, we have to be careful what we clobber. Consequently, we
-	 * have to be careful what we use here. Below a list of registers
-	 * that are currently alive:
+	 * We have a 1KB aligned trapframe, 

CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:42:47 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: exception.S

Log Message:
Updates from FreeBSD, mostly compile-tested


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/ia64/exception.S

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:40:50 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: cpu.c

Log Message:
Add more cpus to identify, from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/ia64/ia64/cpu.c

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



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:40:50 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: cpu.c

Log Message:
Add more cpus to identify, from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/ia64/ia64/cpu.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/ia64/ia64/cpu.c
diff -u src/sys/arch/ia64/ia64/cpu.c:1.14 src/sys/arch/ia64/ia64/cpu.c:1.15
--- src/sys/arch/ia64/ia64/cpu.c:1.14	Thu Apr  3 17:04:46 2014
+++ src/sys/arch/ia64/ia64/cpu.c	Sat Apr  8 17:40:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.14 2014/04/03 17:04:46 martin Exp $	*/
+/*	$NetBSD: cpu.c,v 1.15 2017/04/08 17:40:50 scole Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.14 2014/04/03 17:04:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.15 2017/04/08 17:40:50 scole Exp $");
 
 #include 
 #include 
@@ -45,6 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.14
 #define MHz	100L
 #define GHz	(1000L * MHz)
 
+extern int ia64_sync_icache_needed;
+
 struct cpu_info cpu_info_primary __aligned(CACHE_LINE_SIZE);
 struct cpu_info *cpu_info_list = _info_primary;
 
@@ -165,6 +167,19 @@ identifycpu(struct cpu_softc *sc)
 			break;
 		}
 		break;
+	case 0x20:
+		ia64_sync_icache_needed = 1;
+
+		family_name = "Itanium 2";
+		switch (model) {
+		case 0x00:
+			model_name = "Montecito";
+			break;
+		case 0x01:
+			model_name = "Montvale";
+			break;
+		}
+		break;
 	}
 	cpu_setmodel("%s", model_name);
 



CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:38:44 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: context.S vm_machdep.c

Log Message:
Convert cpu_switchto() from assembly to C code.  Remove comment about
possible cpu_switchto() bug.  Actual issue appears to be new processes
using lwp0 instead of own memory, which is still not fixed.

Thanks to  for figuring this out.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/ia64/context.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/ia64/ia64/vm_machdep.c

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

Modified files:

Index: src/sys/arch/ia64/ia64/context.S
diff -u src/sys/arch/ia64/ia64/context.S:1.7 src/sys/arch/ia64/ia64/context.S:1.8
--- src/sys/arch/ia64/ia64/context.S:1.7	Mon Dec 26 19:46:59 2016
+++ src/sys/arch/ia64/ia64/context.S	Sat Apr  8 17:38:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: context.S,v 1.7 2016/12/26 19:46:59 scole Exp $	*/
+/*	$NetBSD: context.S,v 1.8 2017/04/08 17:38:43 scole Exp $	*/
 
 /*
  * Copyright (c) 2003 Marcel Moolenaar
@@ -806,93 +806,9 @@ ENTRY(restore_high_fp, 1)
 END(restore_high_fp)
 
 /*
- * lwp_t *
- * cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning)
- *
- * Switch to the specified next LWP
- *   in0 is oldlwp
- *   in1 is newlwp
- */
-ENTRY(cpu_switchto, 3)
-{	.mmi
-	alloc		loc0=ar.pfs,3,2,2,0
-
-	/*
-	 * Save old context, unless the LWP is exiting.
-	 */
-	cmp.eq		p6,p0=r0,in0		// p6 = (in0 == 0)
-	add		r14=PC_CURLWP,r13	// r14 = >ci_curlwp
-	;;
-}
-{	.mii
-	add		r2=L_PCB,in0		// r2 = lwp_getpcb()
-	add		r3=L_PCB,in1		// r3 = lwp_getpcb()
-	mov		loc1=rp			// save rp (loc1 = rp)
-	;;
-}
-{	.mmi
-	st8		[r14]=in1		// ci->ci_curlwp = newlwp
-	mov		r9=in0			// r9 = oldlwp
-	nop		0
-	;;
-}
-{	.mmb
-	nop		0
-	/*
-	 * Switch to new context, if p6 == true.
-	 * We assume to return to restorectx_return_here for swapped context.
-	 */
-(p6)	ld8		out0=[r3]		// out0 = pcb of 
-(p6)	br.call.sptk.many rp=restorectx		// if (p6) restorectx(out0)
-	;;
-}
-{	.mmb
-	/*
-	 * Swap to new context.
-	 */
-	ld8		out0=[r2]
-	ld8		out1=[r3]
-	br.call.sptk.many rp=swapctx
-	;;
-}
-	/*
-	 * XXX seems to be a bug here...
-	 *
-	 * swapctx() and restorectx() (which is called by swapctx())
-	 * both adjust the bspstore (and hence bsp) registers.  When
-	 * returning to "restorectx_return_here:" the bspstore can
-	 * be greater than bsp, a state known as an "Incomplete Register Frame".
-	 *
-	 * That is not necessarily fatal in itself, but apparently the RSE
-	 * engine sets bsp=bspstore to adjust, which re-syncs the stacked
-	 * registers (r32-r127).  This clobbers our local registers below
-	 * (loc0 and loc1) on the br return from swapctx(), and you get all
-	 * kind of mysterious exceptions depeding on what gets restored from
-	 * the backing store.
-	 *
-	 * Not sure of a proper fix is yet or how cpu_switchto should/can
-	 * be interacting with restorectx()/swapctx()
-	 * 
-	 */
-restorectx_return_here:
-{	.mib
-	mov		r8=r9			// r8(ret0) = oldlwp
-	mov		rp=loc1
-	nop		0
-	;;
-}
-{	.mib
-	nop		0
-	mov		ar.pfs=loc0
-	br.ret.sptk.many rp
-	;;
-}
-END(cpu_switchto)
-
-/*
  * lwp_trampoline()
  *
- * Arrange for a function to be invoked neatly, after a cpu_switch().
+ * Arrange for a function to be invoked neatly, after a cpu_switchto().
  *
  * Invokes fork_exit() passing in three arguments: a callout function, an
  * argument to the callout, and a trapframe pointer.  For child processes

Index: src/sys/arch/ia64/ia64/vm_machdep.c
diff -u src/sys/arch/ia64/ia64/vm_machdep.c:1.12 src/sys/arch/ia64/ia64/vm_machdep.c:1.13
--- src/sys/arch/ia64/ia64/vm_machdep.c:1.12	Fri Aug 12 02:08:20 2016
+++ src/sys/arch/ia64/ia64/vm_machdep.c	Sat Apr  8 17:38:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.12 2016/08/12 02:08:20 scole Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.13 2017/04/08 17:38:43 scole Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -62,11 +63,44 @@ cpu_lwp_free2(struct lwp *l)
 }
 
 /*
+ * The cpu_switchto() function saves the context of the LWP which is
+ * currently running on the processor, and restores the context of the LWP
+ * specified by newlwp.  man cpu_switchto(9)
+ */
+lwp_t *
+cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning)
+{
+	const struct lwp *l = curlwp;
+	struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL;
+	struct pcb *newpcb = lwp_getpcb(newlwp);
+	struct cpu_info *ci = curcpu();
+	register uint64_t reg9 __asm("r9");
+
+	KASSERT(newlwp != NULL);
+	
+	ci->ci_curlwp = newlwp;
+	
+	/* required for lwp_startup, copy oldlwp into r9, "mov r9=in0" */
+	__asm __volatile("mov %0=%1" : "=r"(reg9) : "r"(oldlwp));
+	
+	/* XXX handle RAS eventually */
+	
+	if (oldlwp == NULL) {
+		restorectx(newpcb);
+	} else {
+		KASSERT(oldlwp == l);
+		swapctx(oldpcb, newpcb);
+	}
+	
+	return 

CVS commit: src/sys/arch/ia64/ia64

2017-04-08 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat Apr  8 17:38:44 UTC 2017

Modified Files:
src/sys/arch/ia64/ia64: context.S vm_machdep.c

Log Message:
Convert cpu_switchto() from assembly to C code.  Remove comment about
possible cpu_switchto() bug.  Actual issue appears to be new processes
using lwp0 instead of own memory, which is still not fixed.

Thanks to  for figuring this out.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/ia64/context.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/ia64/ia64/vm_machdep.c

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



CVS commit: src/sys

2017-04-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Apr  8 17:04:56 UTC 2017

Modified Files:
src/sys/arch/hp300/dev: dnkbd.c
src/sys/dev/hil: hilkbd.c

Log Message:
Remove auto-repeat key functions in WSKBD_RAW mode.

Pulled from OpenBSD:
 
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/hp300/dev/Attic/dnkbd.c#rev1.18
 http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/hil/hilkbd.c#rev1.15
> WSKBD_RAW mode used in X, but X independently implements auto-repeat keys.

Tested with Xorg server on HP425t with topcat.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hp300/dev/dnkbd.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hil/hilkbd.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/hp300/dev/dnkbd.c
diff -u src/sys/arch/hp300/dev/dnkbd.c:1.9 src/sys/arch/hp300/dev/dnkbd.c:1.10
--- src/sys/arch/hp300/dev/dnkbd.c:1.9	Sat Mar 25 22:08:27 2017
+++ src/sys/arch/hp300/dev/dnkbd.c	Sat Apr  8 17:04:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dnkbd.c,v 1.9 2017/03/25 22:08:27 tsutsui Exp $	*/
+/*	$NetBSD: dnkbd.c,v 1.10 2017/04/08 17:04:56 tsutsui Exp $	*/
 /*	$OpenBSD: dnkbd.c,v 1.17 2009/07/23 21:05:56 blambert Exp $	*/
 
 /*
@@ -188,11 +188,6 @@ struct dnkbd_softc {
 
 #ifdef WSDISPLAY_COMPAT_RAWKBD
 	int		sc_rawkbd;
-	int		sc_nrep;
-	char		sc_rep[2];	/* at most, one key */
-	struct callout	sc_rawrepeat_ch;
-#define	REP_DELAY1	400
-#define	REP_DELAYN	100
 #endif
 };
 
@@ -259,9 +254,6 @@ static int	dnkbd_intr(void *);
 static int	dnkbd_pollin(struct dnkbd_softc *, u_int);
 static int	dnkbd_pollout(struct dnkbd_softc *, int);
 static int	dnkbd_probe(struct dnkbd_softc *);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-static void	dnkbd_rawrepeat(void *);
-#endif
 static int	dnkbd_send(struct dnkbd_softc *, const uint8_t *, size_t);
 static void	dnkbd_break(struct dnkbd_softc *, int);
 
@@ -300,10 +292,6 @@ dnkbd_attach(device_t parent, device_t s
 
 	callout_init(>sc_bellstop_tmo, 0);
 	callout_setfunc(>sc_bellstop_tmo, dnkbd_bellstop, sc);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-	callout_init(>sc_rawrepeat_ch, 0);
-	callout_setfunc(>sc_rawrepeat_ch, dnkbd_rawrepeat, sc);
-#endif
 
 	/* reset the port */
 	dnkbd_init(sc, 1200, LCR_8BITS | LCR_PEVEN | LCR_PENAB);
@@ -706,9 +694,9 @@ dnevent_kbd_internal(struct dnkbd_softc 
 #ifdef WSDISPLAY_COMPAT_RAWKBD
 	if (sc->sc_rawkbd) {
 		u_char cbuf[2];
-		int c, j, npress;
+		int c, j;
 
-		npress = j = 0;
+		j = 0;
 		c = dnkbd_raw[key];
 		if (c != 0) {
 			/* fake extended scancode if necessary */
@@ -717,12 +705,6 @@ dnevent_kbd_internal(struct dnkbd_softc 
 			cbuf[j] = c & 0x7f;
 			if (type == WSCONS_EVENT_KEY_UP)
 cbuf[j] |= 0x80;
-			else {
-/* remember pressed key for autorepeat */
-if (c & 0x80)
-	sc->sc_rep[npress++] = 0xe0;
-sc->sc_rep[npress++] = c & 0x7f;
-			}
 			j++;
 		}
 
@@ -730,12 +712,6 @@ dnevent_kbd_internal(struct dnkbd_softc 
 			s = spltty();
 			wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
 			splx(s);
-			callout_stop(>sc_rawrepeat_ch);
-			sc->sc_nrep = npress;
-			if (npress != 0) {
-callout_schedule(>sc_rawrepeat_ch,
-mstohz(REP_DELAY1));
-			}
 		}
 	} else
 #endif
@@ -746,21 +722,6 @@ dnevent_kbd_internal(struct dnkbd_softc 
 	}
 }
 
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-void
-dnkbd_rawrepeat(void *v)
-{
-	struct dnkbd_softc *sc = v;
-	int s;
-
-	s = spltty();
-	wskbd_rawinput(sc->sc_wskbddev, sc->sc_rep, sc->sc_nrep);
-	splx(s);
-
-	callout_schedule(>sc_rawrepeat_ch, mstohz(REP_DELAYN));
-}
-#endif
-
 #if NWSMOUSE > 0
 void
 dnevent_mouse(struct dnkbd_softc *sc, uint8_t *dat)
@@ -1040,7 +1001,6 @@ dnkbd_ioctl(void *v, u_long cmd, void *d
 #ifdef WSDISPLAY_COMPAT_RAWKBD
 	case WSKBDIO_SETMODE:
 		sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
-		callout_stop(>sc_rawrepeat_ch);
 		return 0;
 #endif
 	}

Index: src/sys/dev/hil/hilkbd.c
diff -u src/sys/dev/hil/hilkbd.c:1.3 src/sys/dev/hil/hilkbd.c:1.4
--- src/sys/dev/hil/hilkbd.c:1.3	Mon Feb 21 12:33:05 2011
+++ src/sys/dev/hil/hilkbd.c	Sat Apr  8 17:04:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hilkbd.c,v 1.3 2011/02/21 12:33:05 he Exp $	*/
+/*	$NetBSD: hilkbd.c,v 1.4 2017/04/08 17:04:56 tsutsui Exp $	*/
 /*	$OpenBSD: hilkbd.c,v 1.14 2009/01/21 21:53:59 grange Exp $	*/
 /*
  * Copyright (c) 2003, Miodrag Vallat.
@@ -64,11 +64,6 @@ struct hilkbd_softc {
 
 #ifdef WSDISPLAY_COMPAT_RAWKBD
 	int		sc_rawkbd;
-	int		sc_nrep;
-	char		sc_rep[HILBUFSIZE * 2];
-	struct callout	sc_rawrepeat_ch;
-#define	REP_DELAY1	400
-#define	REP_DELAYN	100
 #endif
 };
 
@@ -122,9 +117,6 @@ static void	hilkbd_callback(struct hilde
 static void	hilkbd_decode(struct hilkbd_softc *, uint8_t, u_int *, int *,
 		int);
 static int	hilkbd_is_console(int);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-static void	hilkbd_rawrepeat(void *);
-#endif
 
 static int	seen_hilkbd_console;
 
@@ -195,11 +187,6 @@ hilkbdattach(device_t parent, device_t s
 	 */
 	ps2 = (sc->sc_numleds != 0);
 

CVS commit: src/sys

2017-04-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Apr  8 17:04:56 UTC 2017

Modified Files:
src/sys/arch/hp300/dev: dnkbd.c
src/sys/dev/hil: hilkbd.c

Log Message:
Remove auto-repeat key functions in WSKBD_RAW mode.

Pulled from OpenBSD:
 
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/hp300/dev/Attic/dnkbd.c#rev1.18
 http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/hil/hilkbd.c#rev1.15
> WSKBD_RAW mode used in X, but X independently implements auto-repeat keys.

Tested with Xorg server on HP425t with topcat.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hp300/dev/dnkbd.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hil/hilkbd.c

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



CVS commit: [netbsd-7] src/sys/arch/evbmips/loongson

2017-04-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Apr  8 16:15:09 UTC 2017

Modified Files:
src/sys/arch/evbmips/loongson [netbsd-7]: gdium_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1399):
sys/arch/evbmips/loongson/gdium_machdep.c: 1.8
Adapt to netbsd-7-nhusb.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.12.1 src/sys/arch/evbmips/loongson/gdium_machdep.c

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

Modified files:

Index: src/sys/arch/evbmips/loongson/gdium_machdep.c
diff -u src/sys/arch/evbmips/loongson/gdium_machdep.c:1.6 src/sys/arch/evbmips/loongson/gdium_machdep.c:1.6.12.1
--- src/sys/arch/evbmips/loongson/gdium_machdep.c:1.6	Wed Mar 13 21:18:35 2013
+++ src/sys/arch/evbmips/loongson/gdium_machdep.c	Sat Apr  8 16:15:09 2017
@@ -284,7 +284,7 @@ gdium_device_register(device_t dev, void
 	case 5:	/* umass at uhub port 3 */
 		if (device_is_a(dev, "umass")) {
 			struct usb_attach_arg *uaa = aux;
-			if (uaa->port == 3)
+			if (uaa->uaa_port == 3)
 goto advance;
 		}
 		break;



CVS commit: [netbsd-7] src/sys/arch/evbmips/loongson

2017-04-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Apr  8 16:15:09 UTC 2017

Modified Files:
src/sys/arch/evbmips/loongson [netbsd-7]: gdium_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1399):
sys/arch/evbmips/loongson/gdium_machdep.c: 1.8
Adapt to netbsd-7-nhusb.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.12.1 src/sys/arch/evbmips/loongson/gdium_machdep.c

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



CVS commit: [netbsd-7] src/doc

2017-04-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Apr  8 16:16:25 UTC 2017

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

Log Message:
139[89]


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 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.6 src/doc/CHANGES-7.2:1.1.2.7
--- src/doc/CHANGES-7.2:1.1.2.6	Wed Apr  5 19:58:37 2017
+++ src/doc/CHANGES-7.2	Sat Apr  8 16:16:25 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.6 2017/04/05 19:58:37 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.7 2017/04/08 16:16:25 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -546,3 +546,13 @@ usr.sbin/usbdevs/usbdevs.c			netbsd-7-nh
 	- Various improvements to dwc2(4)
 	[skrll, ticket #1395]
 
+sys/arch/macppc/dev/pbms.c			1.14
+
+	Adapt to netbsd-7-nhusb.
+	[skrll, ticket #1398]
+
+sys/arch/evbmips/loongson/gdium_machdep.c	1.8
+
+	Adapt to netbsd-7-nhusb.
+	[skrll, ticket #1399]
+



CVS commit: [netbsd-7] src/doc

2017-04-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Apr  8 16:16:25 UTC 2017

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

Log Message:
139[89]


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

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



CVS commit: [netbsd-7] src/sys/arch/macppc/dev

2017-04-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Apr  8 16:12:22 UTC 2017

Modified Files:
src/sys/arch/macppc/dev [netbsd-7]: pbms.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1398):
sys/arch/macppc/dev/pbms.c: revision 1.14
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.12.1 src/sys/arch/macppc/dev/pbms.c

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



CVS commit: [netbsd-7] src/sys/arch/macppc/dev

2017-04-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Apr  8 16:12:22 UTC 2017

Modified Files:
src/sys/arch/macppc/dev [netbsd-7]: pbms.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1398):
sys/arch/macppc/dev/pbms.c: revision 1.14
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.12.1 src/sys/arch/macppc/dev/pbms.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/pbms.c
diff -u src/sys/arch/macppc/dev/pbms.c:1.13 src/sys/arch/macppc/dev/pbms.c:1.13.12.1
--- src/sys/arch/macppc/dev/pbms.c:1.13	Sat Oct 27 17:18:00 2012
+++ src/sys/arch/macppc/dev/pbms.c	Sat Apr  8 16:12:22 2017
@@ -1,4 +1,4 @@
-/* $Id: pbms.c,v 1.13 2012/10/27 17:18:00 chs Exp $ */
+/* $Id: pbms.c,v 1.13.12.1 2017/04/08 16:12:22 snj Exp $ */
 
 /*
  * Copyright (c) 2005, Johan Wallén
@@ -306,7 +306,7 @@ pbms_match(device_t parent, cfdata_t mat
 	 * We just check if the vendor and product IDs have the magic numbers
 	 * we expect. 
 	 */
-	if (uha->uaa->proto == UIPROTO_MOUSE &&
+	if (uha->uiaa->uiaa_proto == UIPROTO_MOUSE &&
 	(udd = usbd_get_device_descriptor(uha->parent->sc_udev)) != NULL) {
 		vendor = UGETW(udd->idVendor);
 		product = UGETW(udd->idProduct);



CVS commit: src/sys/dev/scsipi

2017-04-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Apr  8 13:50:23 UTC 2017

Modified Files:
src/sys/dev/scsipi: cd.c

Log Message:
ignore a failed scspi_prevent when accessing the RAW_PART as before.


To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 src/sys/dev/scsipi/cd.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/scsipi/cd.c
diff -u src/sys/dev/scsipi/cd.c:1.339 src/sys/dev/scsipi/cd.c:1.340
--- src/sys/dev/scsipi/cd.c:1.339	Thu Jan  5 16:35:33 2017
+++ src/sys/dev/scsipi/cd.c	Sat Apr  8 13:50:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd.c,v 1.339 2017/01/05 16:35:33 mlelstv Exp $	*/
+/*	$NetBSD: cd.c,v 1.340 2017/04/08 13:50:23 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.339 2017/01/05 16:35:33 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.340 2017/04/08 13:50:23 mlelstv Exp $");
 
 #include 
 #include 
@@ -428,8 +428,11 @@ cd_firstopen(device_t self, dev_t dev, i
 	XS_CTL_IGNORE_MEDIA_CHANGE);
 	SC_DEBUG(periph, SCSIPI_DB1,
 	("cdopen: scsipi_prevent, error=%d\n", error));
-	if (error)
+	if (error) {
+		if (part == RAW_PART)
+			goto out;
 		goto bad;
+	}
 
 	if ((periph->periph_flags & PERIPH_MEDIA_LOADED) == 0) {
 		int param_error;
@@ -448,6 +451,8 @@ cd_firstopen(device_t self, dev_t dev, i
 	}
 
 	periph->periph_flags |= PERIPH_OPEN;
+
+out:
 	return 0;
 
 bad2:
@@ -459,7 +464,6 @@ bad2:
 bad:
 	scsipi_adapter_delref(adapt);
 	return error;
-
 }
 
 /*



CVS commit: src/sys/dev/scsipi

2017-04-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Apr  8 13:50:23 UTC 2017

Modified Files:
src/sys/dev/scsipi: cd.c

Log Message:
ignore a failed scspi_prevent when accessing the RAW_PART as before.


To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 src/sys/dev/scsipi/cd.c

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



CVS commit: src/sys/fs/v7fs

2017-04-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr  8 08:51:02 UTC 2017

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
Update mtime when updating file size.

PR kern/51762 (mtime not updated by open(O_TRUNC))


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/fs/v7fs/v7fs_vnops.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/fs/v7fs/v7fs_vnops.c
diff -u src/sys/fs/v7fs/v7fs_vnops.c:1.22 src/sys/fs/v7fs/v7fs_vnops.c:1.23
--- src/sys/fs/v7fs/v7fs_vnops.c:1.22	Sat Aug 20 12:37:08 2016
+++ src/sys/fs/v7fs/v7fs_vnops.c	Sat Apr  8 08:51:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: v7fs_vnops.c,v 1.22 2016/08/20 12:37:08 hannken Exp $	*/
+/*	$NetBSD: v7fs_vnops.c,v 1.23 2017/04/08 08:51:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.22 2016/08/20 12:37:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_vnops.c,v 1.23 2017/04/08 08:51:02 hannken Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -499,8 +499,11 @@ v7fs_setattr(void *v)
 	/* File size change. */
 	if ((vap->va_size != VNOVAL) && (vp->v_type == VREG)) {
 		error = v7fs_datablock_size_change(fs, vap->va_size, inode);
-		if (error == 0)
+		if (error == 0) {
 			uvm_vnp_setsize(vp, vap->va_size);
+			v7node->update_mtime = true;
+			v7node->update_ctime = true;
+		}
 	}
 	uid_t uid = inode->uid;
 	gid_t gid = inode->gid;



CVS commit: src/sys/fs/v7fs

2017-04-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr  8 08:51:02 UTC 2017

Modified Files:
src/sys/fs/v7fs: v7fs_vnops.c

Log Message:
Update mtime when updating file size.

PR kern/51762 (mtime not updated by open(O_TRUNC))


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/fs/v7fs/v7fs_vnops.c

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



CVS commit: src/sys/fs/puffs

2017-04-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr  8 08:49:44 UTC 2017

Modified Files:
src/sys/fs/puffs: puffs_vnops.c

Log Message:
Update mtime when updating file size.

PR kern/51762 (mtime not updated by open(O_TRUNC))


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/sys/fs/puffs/puffs_vnops.c

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



CVS commit: src/sys/fs/puffs

2017-04-08 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr  8 08:49:44 UTC 2017

Modified Files:
src/sys/fs/puffs: puffs_vnops.c

Log Message:
Update mtime when updating file size.

PR kern/51762 (mtime not updated by open(O_TRUNC))


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/sys/fs/puffs/puffs_vnops.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/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.207 src/sys/fs/puffs/puffs_vnops.c:1.208
--- src/sys/fs/puffs/puffs_vnops.c:1.207	Thu Apr  6 00:02:19 2017
+++ src/sys/fs/puffs/puffs_vnops.c	Sat Apr  8 08:49:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_vnops.c,v 1.207 2017/04/06 00:02:19 christos Exp $	*/
+/*	$NetBSD: puffs_vnops.c,v 1.208 2017/04/08 08:49:44 hannken Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.207 2017/04/06 00:02:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.208 2017/04/08 08:49:44 hannken Exp $");
 
 #include 
 #include 
@@ -1252,6 +1252,7 @@ dosetattr(struct vnode *vp, struct vattr
 		pn->pn_serversize = vap->va_size;
 		if (flags & SETATTR_CHSIZE)
 			uvm_vnp_setsize(vp, vap->va_size);
+		puffs_updatenode(pn, PUFFS_UPDATECTIME | PUFFS_UPDATEMTIME, 0);
 	}
 
 	return 0;