CVS commit: src/sys/net

2019-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 10 05:16:34 UTC 2019

Modified Files:
src/sys/net: if.h

Log Message:
 Modify comment to make the data structure clear. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/sys/net/if.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/net/if.h
diff -u src/sys/net/if.h:1.269 src/sys/net/if.h:1.270
--- src/sys/net/if.h:1.269	Sat Mar 23 09:48:04 2019
+++ src/sys/net/if.h	Fri May 10 05:16:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.269 2019/03/23 09:48:04 pgoyette Exp $	*/
+/*	$NetBSD: if.h,v 1.270 2019/05/10 05:16:34 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -871,14 +871,14 @@ struct ifdatareq {
 };
 
 struct ifmediareq {
-	char	ifm_name[IFNAMSIZ];		/* if name, e.g. "en0" */
-	int	ifm_current;			/* current media options */
-	int	ifm_mask;			/* don't care mask */
-	int	ifm_status;			/* media status */
-	int	ifm_active;			/* active options */
-	int	ifm_count;			/* # entries in ifm_ulist
-		   array */
-	int	*ifm_ulist;			/* media words */
+	char	ifm_name[IFNAMSIZ];	/* if name, e.g. "en0" */
+	int	ifm_current;		/* IFMWD: current media options */
+	int	ifm_mask;		/* IFMWD: don't care mask */
+	int	ifm_status;		/* media status */
+	int	ifm_active;		/* IFMWD: active options */
+	int	ifm_count;		/* # entries in ifm_ulist
+	   array */
+	int	*ifm_ulist;		/* array of ifmedia word */
 };
 
 



CVS commit: src/sys/dev/pci/ixgbe

2019-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 10 02:56:08 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
 Fix typo. This code is not used yet.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/dev/pci/ixgbe/ixgbe.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/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.179 src/sys/dev/pci/ixgbe/ixgbe.c:1.180
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.179	Mon Mar 18 11:38:03 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri May 10 02:56:08 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.179 2019/03/18 11:38:03 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.180 2019/05/10 02:56:08 msaitoh Exp $ */
 
 /**
 
@@ -1445,7 +1445,7 @@ ixgbe_add_media_types(struct adapter *ad
 		ADD(IFM_10G_KR | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
-		ADD(AIFM_10G_KX4 | IFM_FDX, 0);
+		ADD(IFM_10G_KX4 | IFM_FDX, 0);
 	}
 #else
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {



CVS commit: src/share/mk

2019-05-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu May  9 23:34:51 UTC 2019

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

Log Message:
G/C unused code.
gcc -combine is no longer a thing, so this entire block isn't usable.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/share/mk/bsd.kmodule.mk

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

Modified files:

Index: src/share/mk/bsd.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.60 src/share/mk/bsd.kmodule.mk:1.61
--- src/share/mk/bsd.kmodule.mk:1.60	Mon Jan 21 21:11:54 2019
+++ src/share/mk/bsd.kmodule.mk	Thu May  9 23:34:51 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.60 2019/01/21 21:11:54 christos Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.61 2019/05/09 23:34:51 maya Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -105,39 +105,6 @@ PROG?=		${KMOD}.kmod
 # Build rules
 realall:	${PROG}
 
-.if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \
-   && !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE))
-.for f in ${SRCS:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g}
-.if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \
- || ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \
- || ${CXXFLAGS.$f:D5} == "5") \
-|| ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/}))
-XOBJS+=		${f:R:S/$/.o/}
-.else
-XSRCS+=		${f}
-NODPSRCS+=	${f}
-.endif
-.endfor
-
-.if !empty(XOBJS)
-${XOBJS}:	${DPSRCS}
-.endif
-
-.if ${MKLDSCRIPT} == "yes"
-${KMODSCRIPT}: ${KMODSCRIPTSRC} ${XOBJS} $S/conf/mkldscript.sh
-	@rm -f ${.TARGET}
-	@OBJDUMP=${OBJDUMP} ${HOST_SH} $S/conf/mkldscript.sh \
-	-t ${KMODSCRIPTSRC} ${XOBJS} > ${.TARGET}
-.endif
-
-${PROG}: ${XOBJS} ${XSRCS} ${DPSRCS} ${DPADD} ${KMODSCRIPT}
-	${CC} ${LDFLAGS} -nostdlib -MD -combine -r -Wl,-T,${KMODSCRIPT},-d \
-		-Wl,-Map=${.TARGET}.map \
-		-o ${.TARGET} ${CFLAGS} ${CPPFLAGS} ${XOBJS} \
-		${XSRCS:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} && \
-	echo '.-include "${KMOD}.d"' > .depend
-
-.else
 OBJS+=		${SRCS:N*.h:N*.sh:R:S/$/.o/g}
 
 ${OBJS} ${LOBJS}: ${DPSRCS}
@@ -191,7 +158,6 @@ ${PROG}: ${OBJS} ${DPADD} ${KMODSCRIPT}
 		-Wl,-Map=${.TARGET}.map \
 		-o ${.TARGET} ${OBJS}
 .endif
-.endif
 .if defined(CTFMERGE)
 	${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS}
 .endif



CVS commit: src/sys/kern

2019-05-09 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu May  9 20:50:14 UTC 2019

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

Log Message:
Report TRAP_EXEC (for exec()) to a debugger in the PT_SYSCALL mode

Orignally exec() reporting was disabled in the NetBSD version as there
was no support for fine-grained reporting. Meanwhile PT_SYSCALL was broken
for years and there is no software that depends on this behavior.

There is need to catch exec() events in syscall tracers using ptrace(2).
Instead of adding workarounds of guessing that exec() happened, report the
event directly from the kernel.

All ATF ptrace(2) tests pass.


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

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.464 src/sys/kern/kern_exec.c:1.465
--- src/sys/kern/kern_exec.c:1.464	Fri May  3 22:34:21 2019
+++ src/sys/kern/kern_exec.c	Thu May  9 20:50:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.464 2019/05/03 22:34:21 kamil Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.465 2019/05/09 20:50:14 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.464 2019/05/03 22:34:21 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.465 2019/05/09 20:50:14 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -1269,7 +1269,7 @@ execve_runproc(struct lwp *l, struct exe
 
 	mutex_enter(proc_lock);
 
-	if ((p->p_slflag & (PSL_TRACED|PSL_SYSCALL)) == PSL_TRACED) {
+	if (p->p_slflag & PSL_TRACED) {
 		mutex_enter(p->p_lock);
 		eventswitch(TRAP_EXEC);
 		mutex_enter(proc_lock);



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

2019-05-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu May  9 18:53:14 UTC 2019

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

Log Message:
Invalidate the cache before updating the microcode. Some platforms require
this. Seen in Illumos and FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/cpu_ucode_intel.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/cpu_ucode_intel.c
diff -u src/sys/arch/x86/x86/cpu_ucode_intel.c:1.15 src/sys/arch/x86/x86/cpu_ucode_intel.c:1.16
--- src/sys/arch/x86/x86/cpu_ucode_intel.c:1.15	Sun Jan 27 02:08:39 2019
+++ src/sys/arch/x86/x86/cpu_ucode_intel.c	Thu May  9 18:53:14 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode_intel.c,v 1.15 2019/01/27 02:08:39 pgoyette Exp $ */
+/* $NetBSD: cpu_ucode_intel.c,v 1.16 2019/05/09 18:53:14 maxv Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.15 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode_intel.c,v 1.16 2019/05/09 18:53:14 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xen.h"
@@ -213,7 +213,14 @@ cpu_ucode_intel_apply(struct cpu_ucode_s
 		rv = EEXIST; /* ??? */
 		goto out;
 	}
+
+	/*
+	 * Perform update. On some platforms a cache invalidation is
+	 * required.
+	 */
+	wbinvd();
 	wrmsr(MSR_BIOS_UPDT_TRIG, (uintptr_t)uh + 48);
+
 	intel_getcurrentucode(, );
 	cpuid = curcpu()->ci_index;
 



CVS commit: src/sys/arch

2019-05-09 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu May  9 17:09:51 UTC 2019

Modified Files:
src/sys/arch/x86/include: cpufunc.h
src/sys/arch/xen/include: xen.h xenfunc.h
src/sys/arch/xen/x86: hypervisor_machdep.c xen_intr.c
src/sys/arch/xen/xen: evtchn.c

Log Message:
sti/cli are not allowed on Xen, we have to clear/set a bit in the
shared page. Revert x86_disable_intr/x86_enable_intr to plain function
calls on XENPV.
While there, clean up unused functions and macros, and change cli()/sti()
macros to x86_disable_intr/x86_enable_intr.
Makes Xen domU boot again
(http://www-soc.lip6.fr/~bouyer/NetBSD-tests/xen/HEAD/)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x86/include/cpufunc.h
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/xen/include/xen.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/include/xenfunc.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/xen/x86/hypervisor_machdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/xen/xen/evtchn.c

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

Modified files:

Index: src/sys/arch/x86/include/cpufunc.h
diff -u src/sys/arch/x86/include/cpufunc.h:1.27 src/sys/arch/x86/include/cpufunc.h:1.28
--- src/sys/arch/x86/include/cpufunc.h:1.27	Sat May  4 07:20:22 2019
+++ src/sys/arch/x86/include/cpufunc.h	Thu May  9 17:09:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.h,v 1.27 2019/05/04 07:20:22 maxv Exp $	*/
+/*	$NetBSD: cpufunc.h,v 1.28 2019/05/09 17:09:50 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2019 The NetBSD Foundation, Inc.
@@ -43,6 +43,9 @@
 #include 
 
 #ifdef _KERNEL
+#if defined(_KERNEL_OPT)
+#include "opt_xen.h"
+#endif
 
 static inline void
 x86_pause(void)
@@ -291,6 +294,10 @@ void	xsaveopt(union savefpu *, uint64_t)
 
 /* -- */
 
+#ifdef XENPV
+void x86_disable_intr(void);
+void x86_enable_intr(void);
+#else
 static inline void
 x86_disable_intr(void)
 {
@@ -302,6 +309,7 @@ x86_enable_intr(void)
 {
 	asm volatile ("sti");
 }
+#endif /* XENPV */
 
 /* Use read_psl, write_psl when saving and restoring interrupt state. */
 u_long	x86_read_psl(void);

Index: src/sys/arch/xen/include/xen.h
diff -u src/sys/arch/xen/include/xen.h:1.43 src/sys/arch/xen/include/xen.h:1.44
--- src/sys/arch/xen/include/xen.h:1.43	Mon Feb  4 18:14:53 2019
+++ src/sys/arch/xen/include/xen.h	Thu May  9 17:09:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen.h,v 1.43 2019/02/04 18:14:53 cherry Exp $	*/
+/*	$NetBSD: xen.h,v 1.44 2019/05/09 17:09:50 bouyer Exp $	*/
 
 /*
  *
@@ -136,55 +136,6 @@ void xpq_flush_cache(void);
 #define xendomain_is_privileged()	(xen_start_info.flags & SIF_PRIVILEGED)
 
 /*
- * STI/CLI equivalents. These basically set and clear the virtual
- * event_enable flag in the shared_info structure. Note that when
- * the enable bit is set, there may be pending events to be handled.
- * We may therefore call into do_hypervisor_callback() directly.
- */
-
-#define __save_flags(x)			\
-do {	\
-	(x) = curcpu()->ci_vcpu->evtchn_upcall_mask;			\
-} while (0)
-
-#define __restore_flags(x)		\
-do {	\
-	volatile struct vcpu_info *_vci = curcpu()->ci_vcpu;		\
-	__insn_barrier();		\
-	if ((_vci->evtchn_upcall_mask = (x)) == 0) {			\
-		x86_lfence();		\
-		if (__predict_false(_vci->evtchn_upcall_pending))	\
-			hypervisor_force_callback();			\
-	}\
-} while (0)
-
-#define __cli()\
-do {	\
-	curcpu()->ci_vcpu->evtchn_upcall_mask = 1;			\
-	x86_lfence();			\
-} while (0)
-
-#define __sti()\
-do {	\
-	volatile struct vcpu_info *_vci = curcpu()->ci_vcpu;		\
-	__insn_barrier();		\
-	_vci->evtchn_upcall_mask = 0;	\
-	x86_lfence(); /* unmask then check (avoid races) */		\
-	if (__predict_false(_vci->evtchn_upcall_pending))		\
-		hypervisor_force_callback();\
-} while (0)
-
-#define cli()			__cli()
-#define sti()			__sti()
-#define save_flags(x)		__save_flags(x)
-#define restore_flags(x)	__restore_flags(x)
-#define save_and_cli(x)	do {	\
-	__save_flags(x);	\
-	__cli();		\
-} while (/* CONSTCOND */ 0)
-#define save_and_sti(x)		__save_and_sti(x)
-
-/*
  * always assume we're on multiprocessor. We don't know how many CPU the
  * underlying hardware has.
  */

Index: src/sys/arch/xen/include/xenfunc.h
diff -u src/sys/arch/xen/include/xenfunc.h:1.17 src/sys/arch/xen/include/xenfunc.h:1.18
--- src/sys/arch/xen/include/xenfunc.h:1.17	Tue Feb 12 08:04:53 2019
+++ src/sys/arch/xen/include/xenfunc.h	Thu May  9 17:09:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenfunc.h,v 1.17 2019/02/12 08:04:53 cherry Exp $	*/
+/*	$NetBSD: xenfunc.h,v 1.18 2019/05/09 17:09:50 bouyer Exp $	*/
 
 /*
  *
@@ -36,8 +36,6 @@
 #include 
 #include 
 
-void xen_disable_intr(void);
-void xen_enable_intr(void);
 u_long xen_read_psl(void);
 void xen_write_psl(u_long);
 

Index: 

CVS commit: src/sys/arch/sh3/sh3

2019-05-09 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu May  9 16:48:31 UTC 2019

Modified Files:
src/sys/arch/sh3/sh3: db_trace.c

Log Message:
fix backtrace. it was broken.
- use db_read_bytes() to avoid faults.
- quite a few functions do not use frame pointers,
  therefore always detect stack depth without a frame pointer.
  however, since the framepointer(=r14) is used as a trapframe,
  the code to detect the frame pointer is still needed.
- dump the contents of trapframe during backtracing.
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sh3/sh3/db_trace.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/sh3/sh3/db_trace.c
diff -u src/sys/arch/sh3/sh3/db_trace.c:1.25 src/sys/arch/sh3/sh3/db_trace.c:1.26
--- src/sys/arch/sh3/sh3/db_trace.c:1.25	Sat Nov  9 02:23:57 2013
+++ src/sys/arch/sh3/sh3/db_trace.c	Thu May  9 16:48:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.25 2013/11/09 02:23:57 christos Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.26 2019/05/09 16:48:31 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.25 2013/11/09 02:23:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.26 2019/05/09 16:48:31 ryo Exp $");
 
 #include 
 #include 
@@ -37,16 +37,21 @@ __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 volatile int db_trace_debug = 0; /* settabble from ddb */
-#define DPRINTF if (__predict_false(db_trace_debug)) (*print)
-
+#define DPRINTF(level, fmt, args...)	\
+	do {\
+		if (__predict_false(db_trace_debug > (level))) {	\
+			print(fmt, ## args);\
+		}			\
+	} while (0 /* CONSTCOND*/)
 
 extern char start[], etext[];
-static void db_nextframe(db_addr_t, db_addr_t *, db_addr_t *,
-			 void (*)(const char *, ...));
+static bool db_nextframe(db_addr_t, db_addr_t, db_addr_t *, db_addr_t *,
+db_addr_t *, void (*)(const char *, ...) __printflike(1, 2));
 
 const struct db_variable db_regs[] = {
 	{ "r0",   (long *)_regs.tf_r0,   FCN_NULL },
@@ -74,13 +79,28 @@ const struct db_variable db_regs[] = {
 
 const struct db_variable * const db_eregs = db_regs + __arraycount(db_regs);
 
+static void
+dump_trapframe(struct trapframe *tf,
+	void (*print)(const char *, ...) __printflike(1, 2))
+{
+	print("   sr=%08x   gbr=%08xpc=%08x pr=%08x\n",
+	tf->tf_ssr, tf->tf_gbr, tf->tf_spc, tf->tf_pr);
+	print("   r0=%08xr1=%08xr2=%08x r3=%08x\n",
+	tf->tf_r0, tf->tf_r1, tf->tf_r2, tf->tf_r3);
+	print("   r4=%08xr6=%08xr7=%08x r8=%08x\n",
+	tf->tf_r4, tf->tf_r5, tf->tf_r6, tf->tf_r7);
+	print("   r5=%08xr9=%08x   r10=%08xr11=%08x\n",
+	tf->tf_r8, tf->tf_r9, tf->tf_r10, tf->tf_r11);
+	print("  r12=%08x   r13=%08x   r14=%08x sp=r15=%08x\n",
+	tf->tf_r12, tf->tf_r13, tf->tf_r14, tf->tf_r15);
+}
 
 void
 db_stack_trace_print(db_expr_t addr, bool have_addr, db_expr_t count,
-const char *modif, void (*print)(const char *, ...))
+	const char *modif, void (*print)(const char *, ...) __printflike(1, 2))
 {
 	struct trapframe *tf;
-	db_addr_t callpc, frame, lastframe;
+	db_addr_t func, pc, lastpc, pr, sp, fp;
 	uint32_t vbr;
 	bool lwpid = false;
 	bool lwpaddr = false;
@@ -106,17 +126,20 @@ db_stack_trace_print(db_expr_t addr, boo
 		return;
 	}
 
-
 	if (!have_addr) {
 		tf = _regs;
-		frame = tf->tf_r14;
-		callpc = tf->tf_spc;
-		if (callpc == 0) {
-			(*print)("calling through null pointer?\n");
-			callpc = tf->tf_pr;
+		fp = tf->tf_r14;
+		sp = tf->tf_r15;
+		pr = tf->tf_pr;
+		pc = tf->tf_spc;
+		if (pc == 0) {
+			print("calling through null pointer?\n");
+			pc = tf->tf_pr;
 		}
-	}
-	else if (lwpaddr || lwpid) {
+		DPRINTF(1, "# trapframe: pc=%lx pr=%lx fp=%lx sp=%lx\n",
+		pc, pr, fp, sp);
+
+	} else if (lwpaddr || lwpid) {
 		struct proc *p;
 		struct lwp *l;
 		struct pcb *pcb;
@@ -124,121 +147,143 @@ db_stack_trace_print(db_expr_t addr, boo
 		if (lwpaddr) {
 			l = (struct lwp *)addr;
 			p = l->l_proc;
-			(*print)("trace: lwp addr %p pid %d ",
- (void *)addr, p->p_pid);
-		}
-		else {
+			print("trace: lwp addr %p pid %d ",
+			(void *)addr, p->p_pid);
+		} else {
 			pid_t pid = (pid_t)addr;
-			(*print)("trace: pid %d ", pid);
-			p = proc_find_raw(pid);
+			print("trace: pid %d ", pid);
+			p = db_proc_find(pid);
 			if (p == NULL) {
-(*print)("not found\n");
+print("not found\n");
 return;
 			}
 			l = LIST_FIRST(>p_lwps);
 		}
 		KASSERT(l != NULL);
-		(*print)("lid %d ", l->l_lid);
+		print("lid %d", l->l_lid);
 		pcb = lwp_getpcb(l);
 		tf = (struct trapframe *)pcb->pcb_sf.sf_r6_bank;
-		frame = pcb->pcb_sf.sf_r14;
-		callpc = pcb->pcb_sf.sf_pr;
-		(*print)("at %p\n", frame);
-	}
-	else {
-		/* XXX */
-		db_printf("trace by frame address is not supported\n");
-		

CVS commit: src/sys/arch/ia64

2019-05-09 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Thu May  9 15:48:55 UTC 2019

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

Log Message:
Revert -O0 for pmap, avoid RAW dependency compilation warning


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/conf/Makefile.ia64
cvs rdiff -u -r1.37 -r1.38 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/conf/Makefile.ia64
diff -u src/sys/arch/ia64/conf/Makefile.ia64:1.7 src/sys/arch/ia64/conf/Makefile.ia64:1.8
--- src/sys/arch/ia64/conf/Makefile.ia64:1.7	Sat May  4 02:06:59 2019
+++ src/sys/arch/ia64/conf/Makefile.ia64	Thu May  9 15:48:55 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ia64,v 1.7 2019/05/04 02:06:59 scole Exp $
+#	$NetBSD: Makefile.ia64,v 1.8 2019/05/09 15:48:55 scole Exp $
 
 # Makefile for NetBSD
 #
@@ -34,11 +34,6 @@ GENASSYM_CONF=	${IA64}/ia64/genassym.cf
 CPPFLAGS+=	-mconstant-gp -Dia64
 AFLAGS+=	-x assembler-with-cpp -Wa,-x 
 
-# XXX don't optimize pmap.c to get rid of assembler warnings like:
-#   Warning: Use of 'st8' may violate RAW dependency 'RR#' (data)
-# Happening with gcc7 and iirc several years worth of prior gcc versions
-COPTS.pmap.c+=	-O0
-
 ##
 ## (3) libkern and compat
 ##

Index: src/sys/arch/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.37 src/sys/arch/ia64/ia64/pmap.c:1.38
--- src/sys/arch/ia64/ia64/pmap.c:1.37	Fri May 25 06:34:02 2018
+++ src/sys/arch/ia64/ia64/pmap.c	Thu May  9 15:48:55 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.37 2018/05/25 06:34:02 jdolecek Exp $ */
+/* $NetBSD: pmap.c,v 1.38 2019/05/09 15:48:55 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.37 2018/05/25 06:34:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.38 2019/05/09 15:48:55 scole Exp $");
 
 #include 
 #include 
@@ -471,12 +471,13 @@ pmap_bootstrap(void)
 	if (base == 0)
 		panic("Unable to allocate VHPT");
 
-	if (bootverbose)
-		printf("VHPT: address=%#lx, size=%#lx\n", base, size);
-
 	pmap_vhpt_nbuckets = size / sizeof(struct ia64_lpte);
 	pmap_vhpt_bucket = (void *)uvm_pageboot_alloc(pmap_vhpt_nbuckets *
 		  sizeof(struct ia64_bucket));
+	if (bootverbose)
+		printf("VHPT: address=%#lx, size=%#lx, buckets=%ld, address=%lx\n",
+		   base, size, pmap_vhpt_nbuckets, (long unsigned int)_vhpt_bucket[0]);
+
 	for (i = 0; i < pmap_vhpt_nbuckets; i++) {
 		/* Stolen memory is zeroed. */
 		mutex_init(_vhpt_bucket[i].mutex, MUTEX_DEFAULT, IPL_VM);
@@ -2541,6 +2542,8 @@ pmap_switch(pmap_t pm)
 		}
 	}
 
+	/* XXX */
+	ia64_srlz_d();
 	curcpu()->ci_pmap = pm;
 	ia64_srlz_d();
 



CVS commit: src/sys/dev/usb

2019-05-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu May  9 14:50:38 UTC 2019

Modified Files:
src/sys/dev/usb: uplcom.c

Log Message:
Fix USB_DEBUG build


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/usb/uplcom.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/usb/uplcom.c
diff -u src/sys/dev/usb/uplcom.c:1.84 src/sys/dev/usb/uplcom.c:1.85
--- src/sys/dev/usb/uplcom.c:1.84	Thu May  9 02:43:35 2019
+++ src/sys/dev/usb/uplcom.c	Thu May  9 14:50:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uplcom.c,v 1.84 2019/05/09 02:43:35 mrg Exp $	*/
+/*	$NetBSD: uplcom.c,v 1.85 2019/05/09 14:50:38 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.84 2019/05/09 02:43:35 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.85 2019/05/09 14:50:38 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -270,7 +270,7 @@ uplcom_attach(device_t parent, device_t 
 	struct ucom_attach_args ucaa;
 
 	UPLCOMHIST_FUNC(); UPLCOMHIST_CALLED();
-	DPRINTF("sc=%p", sc, 0, 0, 0);
+	DPRINTF("sc=%#jx", (uintptr_t)sc, 0, 0, 0);
 
 	sc->sc_dev = self;
 	sc->sc_dying = false;
@@ -497,7 +497,7 @@ uplcom_detach(device_t self, int flags)
 	int rv = 0;
 
 	UPLCOMHIST_FUNC(); UPLCOMHIST_CALLED();
-	DPRINTF("sc=%p flags=%d", sc, flags, 0, 0);
+	DPRINTF("sc=%#jx flags=%d", (uintptr_t)sc, flags, 0, 0);
 
 	sc->sc_dying = true;
  
@@ -752,7 +752,7 @@ uplcom_param(void *addr, int portno, str
 	usb_cdc_line_state_t ls;
 
 	UPLCOMHIST_FUNC(); UPLCOMHIST_CALLED();
-	DPRINTF("sc=%p", sc, 0, 0, 0);
+	DPRINTF("sc=%#jx", (uintptr_t)sc, 0, 0, 0);
 
 	if (sc->sc_dying)
 		return EIO;
@@ -835,7 +835,7 @@ uplcom_open(void *addr, int portno)
 	usbd_status err = 0;
  
 	UPLCOMHIST_FUNC(); UPLCOMHIST_CALLED();
-	DPRINTF("sc=%p", sc, 0, 0, 0);
+	DPRINTF("sc=%#jx", (uintptr_t)sc, 0, 0, 0);
 
 	if (sc->sc_dying)
 		return EIO;
@@ -870,7 +870,7 @@ uplcom_close(void *addr, int portno)
 	struct uplcom_softc *sc = addr;
 
 	UPLCOMHIST_FUNC(); UPLCOMHIST_CALLED();
-	DPRINTF("sc=%p", sc, 0, 0, 0);
+	DPRINTF("sc=%#jx", (uintptr_t)sc, 0, 0, 0);
 
 	if (sc->sc_dying)
 		return;



CVS commit: src/tests/lib/libc/sys

2019-05-09 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Thu May  9 13:07:35 UTC 2019

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c t_ptrace_x86_wait.h

Log Message:
Add ptrace() tests for reading mm* and xmm* registers


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.120 src/tests/lib/libc/sys/t_ptrace_wait.c:1.121
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.120	Thu May  2 22:52:21 2019
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu May  9 13:07:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.120 2019/05/02 22:52:21 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.121 2019/05/09 13:07:35 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.120 2019/05/02 22:52:21 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.121 2019/05/09 13:07:35 mgorny Exp $");
 
 #include 
 #include 
@@ -58,6 +58,11 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.12
 #include  /* only need for ARM Cortex/Neon hack */
 #endif
 
+#if defined(__i386__) || defined(__x86_64__)
+#include 
+#include 
+#endif
+
 #include 
 
 #include "h_macros.h"

Index: src/tests/lib/libc/sys/t_ptrace_x86_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.9 src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.10
--- src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.9	Sun Feb 10 02:13:45 2019
+++ src/tests/lib/libc/sys/t_ptrace_x86_wait.h	Thu May  9 13:07:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_x86_wait.h,v 1.9 2019/02/10 02:13:45 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_x86_wait.h,v 1.10 2019/05/09 13:07:35 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -2189,6 +2189,287 @@ ATF_TC_BODY(x86_cve_2018_8897, tc)
 	TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, , 0));
 }
 
+ATF_TC(x86_regs_mm_read);
+ATF_TC_HEAD(x86_regs_mm_read, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+		"Set MMX (mm0..mm7) reg values from debugged program and read "
+		"them via PT_GETFPREGS, comparing values against expected.");
+}
+
+__attribute__((target("mmx")))
+static __inline void set_mm_regs(const uint64_t mm[])
+{
+	__asm__ __volatile__(
+		"movq0x00(%0), %%mm0\n\t"
+		"movq0x08(%0), %%mm1\n\t"
+		"movq0x10(%0), %%mm2\n\t"
+		"movq0x18(%0), %%mm3\n\t"
+		"movq0x20(%0), %%mm4\n\t"
+		"movq0x28(%0), %%mm5\n\t"
+		"movq0x30(%0), %%mm6\n\t"
+		"movq0x38(%0), %%mm7\n\t"
+		"int3\n\t"
+		:
+		: "b"(mm)
+		: "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7"
+	);
+}
+
+#if defined(__i386__)
+__CTASSERT(sizeof(struct fpreg) == sizeof(struct save87));
+#endif
+
+ATF_TC_BODY(x86_regs_mm_read, tc)
+{
+	const int exitval = 5;
+	pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+	const int sigval = SIGTRAP;
+	int status;
+#endif
+#if defined(__x86_64__)
+	struct fpreg fpr;
+#else
+	/* TODO: replace this with 'struct fpreg' once it becomes non-opaque */
+	struct save87 fpr;
+#endif
+
+	const uint64_t mm[] = {
+		0x0001020304050607,
+		0x1011121314151617,
+		0x2021222324252627,
+		0x3031323334353637,
+		0x4041424344454647,
+		0x5051525354555657,
+		0x6061626364656667,
+		0x7071727374757677,
+	};
+
+	/* verify whether MMX is supported here */
+	DPRINTF("Before invoking cpuid\n");
+	{
+		unsigned int eax, ebx, ecx, edx;
+		if (!__get_cpuid(1, , , , ))
+			atf_tc_skip("CPUID is not supported by the CPU");
+
+		DPRINTF("cpuid: EDX = %08x\n", edx);
+
+		if (!(edx & bit_MMX))
+			atf_tc_skip("MMX is not supported by the CPU");
+	}
+
+	DPRINTF("Before forking process PID=%d\n", getpid());
+	SYSCALL_REQUIRE((child = fork()) != -1);
+	if (child == 0) {
+		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+		DPRINTF("Before running assembly from child\n");
+		set_mm_regs(mm);
+
+		DPRINTF("Before exiting of the child process\n");
+		_exit(exitval);
+	}
+	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, sigval);
+
+	DPRINTF("Call GETFPREGS for the child process\n");
+	SYSCALL_REQUIRE(ptrace(PT_GETFPREGS, child, , 0) != -1);
+
+#if defined(__x86_64__)
+#define MM_REG(n) fpr.fxstate.fx_87_ac[n].r.f87_mantissa
+#else
+#define MM_REG(n) fpr.s87_ac[n].f87_mantissa
+#endif
+
+	ATF_CHECK_EQ(MM_REG(0), mm[0]);
+	ATF_CHECK_EQ(MM_REG(1), mm[1]);
+	ATF_CHECK_EQ(MM_REG(2), mm[2]);
+	ATF_CHECK_EQ(MM_REG(3), mm[3]);
+	ATF_CHECK_EQ(MM_REG(4), mm[4]);
+	ATF_CHECK_EQ(MM_REG(5), mm[5]);

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

2019-05-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu May  9 10:56:24 UTC 2019

Modified Files:
src/common/lib/libc/gen: rb.c

Log Message:
toolify

PR/54182: Cross-building on Linux fails in rb.c


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/common/lib/libc/gen/rb.c

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

Modified files:

Index: src/common/lib/libc/gen/rb.c
diff -u src/common/lib/libc/gen/rb.c:1.14 src/common/lib/libc/gen/rb.c:1.15
--- src/common/lib/libc/gen/rb.c:1.14	Fri Mar  8 09:14:54 2019
+++ src/common/lib/libc/gen/rb.c	Thu May  9 10:56:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rb.c,v 1.14 2019/03/08 09:14:54 roy Exp $	*/
+/*	$NetBSD: rb.c,v 1.15 2019/05/09 10:56:24 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -29,6 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 #if !defined(_KERNEL) && !defined(_STANDALONE)
 #include 
 #include 
@@ -41,10 +45,10 @@
 #define KASSERT(s)	do { } while (/*CONSTCOND*/ 0)
 #define	__rbt_unused	__unused
 #endif
-__RCSID("$NetBSD: rb.c,v 1.14 2019/03/08 09:14:54 roy Exp $");
+__RCSID("$NetBSD: rb.c,v 1.15 2019/05/09 10:56:24 skrll Exp $");
 #else
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rb.c,v 1.14 2019/03/08 09:14:54 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rb.c,v 1.15 2019/05/09 10:56:24 skrll Exp $");
 #ifndef DIAGNOSTIC
 #define	__rbt_unused	__unused
 #else



CVS commit: src/usr.bin/audio/ctl

2019-05-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu May  9 09:37:11 UTC 2019

Modified Files:
src/usr.bin/audio/ctl: audioctl.1

Log Message:
Sort options (no-argument options before ones demanding arguments).

Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/audio/ctl/audioctl.1

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/audio/ctl/audioctl.1
diff -u src/usr.bin/audio/ctl/audioctl.1:1.22 src/usr.bin/audio/ctl/audioctl.1:1.23
--- src/usr.bin/audio/ctl/audioctl.1:1.22	Wed May  8 14:44:42 2019
+++ src/usr.bin/audio/ctl/audioctl.1	Thu May  9 09:37:11 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: audioctl.1,v 1.22 2019/05/08 14:44:42 isaki Exp $
+.\" $NetBSD: audioctl.1,v 1.23 2019/05/09 09:37:11 wiz Exp $
 .\"
 .\" Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 27, 2002
+.Dd May 8, 2019
 .Dt AUDIOCTL 1
 .Os
 .Sh NAME
@@ -34,16 +34,16 @@
 .Nd control audio device
 .Sh SYNOPSIS
 .Nm
-.Op Fl d Ar device
 .Op Fl n
+.Op Fl d Ar device
 .Fl a
 .Nm
-.Op Fl d Ar device
 .Op Fl n
+.Op Fl d Ar device
 .Ar name ...
 .Nm
-.Op Fl d Ar device
 .Op Fl n
+.Op Fl d Ar device
 .Fl w
 .Ar name=value ...
 .Sh DESCRIPTION



CVS commit: src/usr.bin/audiocfg

2019-05-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu May  9 09:34:58 UTC 2019

Modified Files:
src/usr.bin/audiocfg: audiocfg.1

Log Message:
Improve wording, bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/audiocfg/audiocfg.1

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/audiocfg/audiocfg.1
diff -u src/usr.bin/audiocfg/audiocfg.1:1.4 src/usr.bin/audiocfg/audiocfg.1:1.5
--- src/usr.bin/audiocfg/audiocfg.1:1.4	Wed May  8 14:36:12 2019
+++ src/usr.bin/audiocfg/audiocfg.1	Thu May  9 09:34:58 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audiocfg.1,v 1.4 2019/05/08 14:36:12 isaki Exp $
+.\"	$NetBSD: audiocfg.1,v 1.5 2019/05/09 09:34:58 wiz Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 1, 2010
+.Dd May 8, 2019
 .Dt AUDIOCFG 1
 .Os
 .Sh NAME
@@ -62,18 +62,18 @@ default audio device.
 .Pp
 Run with
 .Dq Cm set ,
-if sets the hardware format.
+it sets the hardware format.
 The
 .Ar direction
-is represented by either of 'p'(playback) or 'r'(record), or both of them,
-indicates direction you want to set to.
+is represented by either of 'p' (playback) or 'r' (record), or both of them.
+This indicates the direction you want to set.
 The remaining parameters
 .Ar encoding ,
 .Ar precision ,
-.Ar channels
+.Ar channels ,
 and
 .Ar sample_rate
-indicate the hardware format you want to set to.
+indicate the hardware format you want to set.
 These parameters must be selected from the candidates displayed by
 .Nm
 .Cm list .



CVS commit: src/share/man/man9

2019-05-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu May  9 09:35:18 UTC 2019

Modified Files:
src/share/man/man9: audio.9

Log Message:
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/share/man/man9/audio.9

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/man9/audio.9
diff -u src/share/man/man9/audio.9:1.53 src/share/man/man9/audio.9:1.54
--- src/share/man/man9/audio.9:1.53	Thu May  9 09:32:26 2019
+++ src/share/man/man9/audio.9	Thu May  9 09:35:18 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.9,v 1.53 2019/05/09 09:32:26 wiz Exp $
+.\"	$NetBSD: audio.9,v 1.54 2019/05/09 09:35:18 wiz Exp $
 .\"
 .\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 15, 2018
+.Dd May 9, 2019
 .Dt AUDIO 9
 .Os
 .Sh NAME



CVS commit: src/share/man/man4

2019-05-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu May  9 09:35:29 UTC 2019

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

Log Message:
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/share/man/man4/audio.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/audio.4
diff -u src/share/man/man4/audio.4:1.89 src/share/man/man4/audio.4:1.90
--- src/share/man/man4/audio.4:1.89	Thu May  9 09:22:13 2019
+++ src/share/man/man4/audio.4	Thu May  9 09:35:29 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.4,v 1.89 2019/05/09 09:22:13 wiz Exp $
+.\"	$NetBSD: audio.4,v 1.90 2019/05/09 09:35:29 wiz Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 15, 2018
+.Dd May 8, 2019
 .Dt AUDIO 4
 .Os
 .Sh NAME



CVS commit: src/share/man/man9

2019-05-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu May  9 09:32:26 UTC 2019

Modified Files:
src/share/man/man9: audio.9

Log Message:
Improve wording, add more formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/share/man/man9/audio.9

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/man9/audio.9
diff -u src/share/man/man9/audio.9:1.52 src/share/man/man9/audio.9:1.53
--- src/share/man/man9/audio.9:1.52	Wed May  8 14:25:39 2019
+++ src/share/man/man9/audio.9	Thu May  9 09:32:26 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.9,v 1.52 2019/05/08 14:25:39 isaki Exp $
+.\"	$NetBSD: audio.9,v 1.53 2019/05/09 09:32:26 wiz Exp $
 .\"
 .\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -147,7 +147,7 @@ if not needed.
 optional, is called when the first device combining playback and recording
 is opened.
 On a full duplex hardware,
-.Dv (FREAD | FWRITE)
+.Dv ( FREAD | FWRITE )
 is passed to flags.
 On a half duplex hardware,
 .Dv FWRITE
@@ -159,16 +159,19 @@ Every successful call to
 is matched by a call to
 .Va close .
 Return 0 on success, otherwise an error code.
-It is called at Closed phase.
+It is called in the Closed phase.
 .It Dv void close(void *hdl)
 optional, is called when the last audio device combining
 playback and recording is closed.
-It is called at Opened phase.
+It is called in the Opened phase.
 .It Dv int query_format(void *hdl, audio_format_query_t *afp)
 is called to enumerate formats supported by the hardware.
-It should fill the audio_format_t structure according to given number
-afp->index.
-If there is no format with given number, return EINVAL.
+It should fill the
+.Vt audio_format_t
+structure according to given number
+.Va afp->index .
+If there is no format with given number, return
+.Er EINVAL .
 It is called at any time.
 .Bd -literal
 typedef struct audio_format_query {
@@ -179,26 +182,41 @@ typedef struct audio_format_query {
 .Pp
 It is also used to determine the default format.
 The upper layer chooses the most preferred one as default format by following:
-.\" XXX I don't know syntax to represent  in html
-1. Higher priority is preferred (normally 0, the highest is 3, the lowest is 0).
-2. AUDIO_ENCODING_SLINEAR_NE:16 is preferred if exists.
-3. AUDIO_ENCODING_SLINEAR_OE:16 is preferred if exists.
-4. More channels is preferred.
+.Bl -enum
+.It
+Higher priority is preferred (normally 0, the highest is 3, the lowest is 0).
+.It
+.Dv AUDIO_ENCODING_SLINEAR_NE:16
+is preferred if exists.
+.It
+.Dv AUDIO_ENCODING_SLINEAR_OE:16
+is preferred if exists.
+.It
+More channels is preferred.
+.El
 .Pp
-If the driver supports SLINEAR_NE:16 and the upper layer chooses it,
+If the driver supports
+.Dv SLINEAR_NE:16
+and the upper layer chooses it,
 the driver does not need to provide conversion function in
 .Va set_format .
-Similarly, if the driver supports SLINEAR_OE:16 and the upper layer chooses it,
-the driver does not need to provide conversion function.
+Similarly, if the driver supports
+.Dv SLINEAR_OE:16
+and the upper layer chooses it,
+the driver does not need to provide a conversion function.
 Because the upper layer only supports conversion between
-SLINEAR_NE:16 and SLINEAR_OE:16 for convenience.
-If the upper layer chooses other format,
-the driver needs to provide conversion function in
+.Dv SLINEAR_NE:16
+and
+.Dv SLINEAR_OE:16
+for convenience.
+If the upper layer chooses another format,
+the driver needs to provide a conversion function in
 .Va set_format .
 See also
 .Va set_format .
-If the driver can not provide the conversion from/to SLINEAR_NE:16,
-set priority to -1.
+If the driver can not provide the conversion from/to
+.Dv SLINEAR_NE:16 ,
+set priority to \-1.
 It means that the hardware supports this format but the driver does not
 (e.g. AC3), and it will never be chosen.
 .It Dv int set_foramt(void *hdl, int setmode,
@@ -239,7 +257,9 @@ conversion information should be filled 
 for playing or
 .Va rfil
 for recording.
-The definition of audio_filter_reg_t and related structure follow:
+The definition of
+.Vt audio_filter_reg_t
+and a related structure follow:
 .Bd -literal
 typedef struct {
 	const void *src;
@@ -259,9 +279,9 @@ typedef struct {
 .Ed
 .Pp
 .Va codec
-is conversion function and
+is a conversion function and
 .Va context
-is optional opaque pointer passed to
+is an optional opaque pointer passed to
 .Va codec .
 .Pp
 When
@@ -271,13 +291,13 @@ is called, all parameters required by
 are contained in
 .Va arg .
 .Va src
-points input buffer block,
+points to the input buffer block,
 .Va srcfmt
-contains input encoding parameter,
+contains the input encoding parameters,
 .Va dst
-points output buffer block and
+points to the output buffer block and
 .Va dstfmt
-contains output encoding parameter.
+contains the output encoding parameters.
 .Va count
 represents the number of 

CVS commit: src/share/man/man4

2019-05-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu May  9 09:22:13 UTC 2019

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

Log Message:
Fix some typos, improve wording and formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/share/man/man4/audio.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/audio.4
diff -u src/share/man/man4/audio.4:1.88 src/share/man/man4/audio.4:1.89
--- src/share/man/man4/audio.4:1.88	Wed May  8 14:25:39 2019
+++ src/share/man/man4/audio.4	Thu May  9 09:22:13 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.4,v 1.88 2019/05/08 14:25:39 isaki Exp $
+.\"	$NetBSD: audio.4,v 1.89 2019/05/09 09:22:13 wiz Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -68,7 +68,6 @@ operations as
 but no other operations.
 It can be opened at any time and can be used to manipulate the
 audio device while it is in use.
-.Pp
 .Sh SAMPLING DEVICES
 When
 .Pa /dev/audio
@@ -116,15 +115,15 @@ frequently enough, it will simply miss s
 The audio driver supports track multiplexing.
 All sampling devices can be opened at any time without interference.
 For playback, all tracks opened simultaneously are mixed,
-even if thier specified format is different.
+even if their specified format is different.
 For recording, recorded data is distributed to all opened tracks,
-even if thier specified format is different.
-To achieve this, the audio driver has an small efficient encoding converter,
-a channel mixer, and a frequency conveter.
+even if their specified format is different.
+To achieve this, the audio driver has a small efficient encoding converter,
+a channel mixer, and a frequency converter.
 The frequency conversion adapts the simplest way
 (interpolation method for upward, and simple thinning method for downward)
 due to restriction in kernel resources and processing time.
-It will work well in most case but don't expect excessively for its quality.
+It will work well in most case but don't expect excessive quality.
 .Pp
 The audio device is normally accessed with
 .Xr read 2
@@ -150,13 +149,13 @@ and
 calls can be used.
 Note that
 .Xr mmap 2
-no longer maps hardware buffer directly.
+no longer maps hardware buffers directly.
 Now it is achieved by emulation so don't expect any improvements excessively
 rather than normal
 .Xr write 2 .
 For historical reasons, only encodings that are not set
 .Dv AUDIO_ENCODINGFLAG_EMULATED
-is able to
+are able to
 .Xr mmap 2 .
 .Pp
 The audio device, like most devices, can be used in
@@ -223,9 +222,9 @@ all the supported encodings, start with 
 continue with successive encodings (1, 2, ...) until the command returns
 an error.
 .It Dv AUDIO_GETFD (int)
-This command is obsoleted.
+This command is obsolete.
 .It Dv AUDIO_SETFD (int)
-This command is obsoleted.
+This command is obsolete.
 .It Dv AUDIO_GETPROPS (int)
 This command gets a bit set of hardware properties.
 If the hardware
@@ -306,9 +305,9 @@ field indicates current operation mode, 
 or
 .Dv AUMODE_RECORD .
 These two flags can not be changed once this descriptor is opened.
-On playback mode, obsoleted
+For playback mode, the obsolete
 .Dv AUMODE_PLAY_ALL
-can be set but has no effect.
+flag can be set but has no effect.
 .Pp
 .Va hiwat
 and
@@ -336,16 +335,16 @@ implementation-required limits.
 Normally the
 .Va blocksize
 is calculated to correspond to 40ms
-(For some hardware, this value may be different due to
+(for some hardware, this value may be different due to
 the hardware restrictions)
 of sound and it is recalculated
-when the encoding parameter changes.
+when the encoding parameters change.
 If the descriptor is opened for read only,
 .Va blocksize
-indicates the blocksize on recording track.
+indicates the blocksize for the recording track.
 Otherwise,
 .Va blocksize
-indicates the blocksize on playback track.
+indicates the blocksize for the playback track.
 .Bd -literal
 struct audio_prinfo {
 	u_int	sample_rate;	/* sample rate in samples/s [track] */
@@ -370,7 +369,7 @@ struct audio_prinfo {
 };
 .Ed
 .Pp
-Note:  many hardware audio drivers require identical playback and
+Note: many hardware audio drivers require identical playback and
 recording sample rates, sample encodings, and channel counts.
 The playing information is always set last and will prevail on such hardware.
 If the hardware can handle different settings the
@@ -403,12 +402,18 @@ unsigned linear encoding with big endian
 Dolby Digital AC3
 .El
 .Pp
-Regardless of format supported by underlying driver,
-audio driver accepts following formats.
-encoding and precision is one of those obtained by
+Regardless of formats supported by underlying driver, the
+.Nm
+driver accepts the following formats.
+.Va encoding
+and
+.Va precision
+are one of the values obtained by
 .Dv AUDIO_GETENC .
-channels ranges from 1 to 12.
-frequency ranges from 1000Hz to 

CVS commit: src/lib/libc/sys

2019-05-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu May  9 09:09:38 UTC 2019

Modified Files:
src/lib/libc/sys: getsockopt.2

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/sys/getsockopt.2

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

Modified files:

Index: src/lib/libc/sys/getsockopt.2
diff -u src/lib/libc/sys/getsockopt.2:1.40 src/lib/libc/sys/getsockopt.2:1.41
--- src/lib/libc/sys/getsockopt.2:1.40	Wed May  8 14:10:42 2019
+++ src/lib/libc/sys/getsockopt.2	Thu May  9 09:09:38 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: getsockopt.2,v 1.40 2019/05/08 14:10:42 christos Exp $
+.\"	$NetBSD: getsockopt.2,v 1.41 2019/05/09 09:09:38 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -105,13 +105,13 @@ size of the buffer pointed to by
 and modified on return to indicate the actual size of
 the value returned.
 If the size of the requested option value to be stored in
-.Fa optval 
+.Fa optval
 is greater than the size indicated in
 .Fa optlen
 then only
 .Fa optlen
 bytes will be stored in
-.Fa optval 
+.Fa optval
 and the result will be silently truncated.
 If no option value is to be supplied or returned,
 .Fa optval



CVS commit: src/distrib/utils/libhack

2019-05-09 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu May  9 08:20:35 UTC 2019

Modified Files:
src/distrib/utils/libhack: Makefile.inc

Log Message:
Fix build with MKYP=no


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/distrib/utils/libhack/Makefile.inc

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

Modified files:

Index: src/distrib/utils/libhack/Makefile.inc
diff -u src/distrib/utils/libhack/Makefile.inc:1.28 src/distrib/utils/libhack/Makefile.inc:1.29
--- src/distrib/utils/libhack/Makefile.inc:1.28	Thu Mar 28 15:04:41 2019
+++ src/distrib/utils/libhack/Makefile.inc	Thu May  9 08:20:35 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.28 2019/03/28 15:04:41 christos Exp $
+# $NetBSD: Makefile.inc,v 1.29 2019/05/09 08:20:35 roy Exp $
 #
 # Include this fragment to build libhack.o
 # It is .o and not .a to make sure these are the
@@ -16,11 +16,17 @@
 #	that only supports /etc/hosts
 #			
 
+.include 
+
 CPPFLAGS+=	-DSMALL
 CPPFLAGS+=	-DLIBHACK
 HACKOBJS+=	getcap.o getgrent.o getnet.o getnetgr.o getpwent.o jemalloc.o \
 		localeconv.o multibyte.o perror.o runetable.o setlocale.o \
-		strerror.o strsignal.o syslog.o utmp.o yplib.o
+		strerror.o strsignal.o syslog.o utmp.o
+
+.if (${USE_YP} != "no")
+HACKOBJS+=	yplib.o
+.endif
 
 CPPFLAGS.runetable.c+= -I${HACKSRC}/../../../lib/libc/citrus \
 			-DALL_80_TO_FF_SW1
@@ -58,5 +64,7 @@ strerror.o:	${HACKSRC}/strerror.c
 strsignal.o:	${HACKSRC}/strsignal.c
 syslog.o:	${HACKSRC}/syslog.c
 utmp.o:		${HACKSRC}/utmp.c
+.if (${USE_YP} != "no")
 yplib.o:	${HACKSRC}/yplib.c
 .endif
+.endif



CVS commit: src/sys

2019-05-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu May  9 08:16:15 UTC 2019

Modified Files:
src/sys/kern: subr_pool.c
src/sys/sys: pool.h
src/sys/uvm: uvm_stat.c

Log Message:
Avoid KASSERT(!cpu_intr_p()) when breaking into ddb and issuing

show uvmexp


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/kern/subr_pool.c
cvs rdiff -u -r1.88 -r1.89 src/sys/sys/pool.h
cvs rdiff -u -r1.39 -r1.40 src/sys/uvm/uvm_stat.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/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.249 src/sys/kern/subr_pool.c:1.250
--- src/sys/kern/subr_pool.c:1.249	Sat Apr 13 08:41:36 2019
+++ src/sys/kern/subr_pool.c	Thu May  9 08:16:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.249 2019/04/13 08:41:36 maxv Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.250 2019/05/09 08:16:14 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.249 2019/04/13 08:41:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.250 2019/05/09 08:16:14 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1635,10 +1635,20 @@ pool_drain(struct pool **ppp)
 int
 pool_totalpages(void)
 {
+
+	mutex_enter(_head_lock);
+	int pages = pool_totalpages_locked();
+	mutex_exit(_head_lock);
+
+	return pages;
+}
+
+int
+pool_totalpages_locked(void)
+{
 	struct pool *pp;
 	uint64_t total = 0;
 
-	mutex_enter(_head_lock);
 	TAILQ_FOREACH(pp, _head, pr_poollist) {
 		uint64_t bytes = pp->pr_npages * pp->pr_alloc->pa_pagesz;
 
@@ -1646,7 +1656,6 @@ pool_totalpages(void)
 			bytes -= (pp->pr_nout * pp->pr_size);
 		total += bytes;
 	}
-	mutex_exit(_head_lock);
 
 	return atop(total);
 }

Index: src/sys/sys/pool.h
diff -u src/sys/sys/pool.h:1.88 src/sys/sys/pool.h:1.89
--- src/sys/sys/pool.h:1.88	Sat Apr 13 08:41:37 2019
+++ src/sys/sys/pool.h	Thu May  9 08:16:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pool.h,v 1.88 2019/04/13 08:41:37 maxv Exp $	*/
+/*	$NetBSD: pool.h,v 1.89 2019/05/09 08:16:15 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2007 The NetBSD Foundation, Inc.
@@ -320,6 +320,7 @@ void		pool_sethiwat(struct pool *, int);
 void		pool_sethardlimit(struct pool *, int, const char *, int);
 bool		pool_drain(struct pool **);
 int		pool_totalpages(void);
+int		pool_totalpages_locked(void);
 
 /*
  * Debugging and diagnostic aides.

Index: src/sys/uvm/uvm_stat.c
diff -u src/sys/uvm/uvm_stat.c:1.39 src/sys/uvm/uvm_stat.c:1.40
--- src/sys/uvm/uvm_stat.c:1.39	Sat Dec  2 08:15:43 2017
+++ src/sys/uvm/uvm_stat.c	Thu May  9 08:16:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_stat.c,v 1.39 2017/12/02 08:15:43 mrg Exp $	 */
+/*	$NetBSD: uvm_stat.c,v 1.40 2019/05/09 08:16:15 skrll Exp $	 */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.39 2017/12/02 08:15:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.40 2019/05/09 08:16:15 skrll Exp $");
 
 #include "opt_readahead.h"
 #include "opt_ddb.h"
@@ -61,7 +61,7 @@ uvmexp_print(void (*pr)(const char *, ..
 	struct cpu_info *ci;
 
 	uvm_estimatepageable(, );
-	poolpages = pool_totalpages();
+	poolpages = pool_totalpages_locked();
 
 	(*pr)("Current UVM status:\n");
 	(*pr)("  pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d, ncolors=%d\n",



CVS commit: src/usr.bin/vmstat

2019-05-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu May  9 08:01:07 UTC 2019

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
when dumping a kernhist history replace "%s" with "%p" so that the
kernhist in kernel can be a little more usable without making the
userland dumping code crash.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/usr.bin/vmstat/vmstat.c

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/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.226 src/usr.bin/vmstat/vmstat.c:1.227
--- src/usr.bin/vmstat/vmstat.c:1.226	Tue Apr 30 23:29:18 2019
+++ src/usr.bin/vmstat/vmstat.c	Thu May  9 08:01:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.226 2019/04/30 23:29:18 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.227 2019/05/09 08:01:07 mrg Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.226 2019/04/30 23:29:18 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.227 2019/05/09 08:01:07 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -2148,15 +2148,13 @@ hist_dodump(struct kern_history *histp)
 		e = [i];
 		if (e->fmt != NULL) {
 			if (fmt == NULL || e->fmtlen > fmtlen) {
-if (fmt != NULL)
-	free(fmt);
+free(fmt);
 fmtlen = e->fmtlen;
 if ((fmt = malloc(fmtlen + 1)) == NULL)
 	err(1, "malloc printf format");
 			}
 			if (fn == NULL || e->fnlen > fnlen) {
-if (fn != NULL)
-	free(fn);
+free(fn);
 fnlen = e->fnlen;
 if ((fn = malloc(fnlen + 1)) == NULL)
 	err(1, "malloc function name");
@@ -2164,6 +2162,10 @@ hist_dodump(struct kern_history *histp)
 
 			deref_kptr(e->fmt, fmt, fmtlen, "printf format");
 			fmt[fmtlen] = '\0';
+			for (unsigned z = 0; z < fmtlen - 1; z++) {
+if (fmt[z] == '%' && fmt[z+1] == 's')
+	fmt[z+1] = 'p';
+			}
 
 			deref_kptr(e->fn, fn, fnlen, "function name");
 			fn[fnlen] = '\0';
@@ -2180,10 +2182,8 @@ hist_dodump(struct kern_history *histp)
 	} while (i != histp->f);
 
 	free(histents);
-	if (fmt != NULL)
-		free(fmt);
-	if (fn != NULL)
-		free(fn);
+	free(fmt);
+	free(fn);
 }
 
 void
@@ -2293,6 +2293,11 @@ hist_dodump_sysctl(int mib[], unsigned i
 		e = >sh_events[i];
 		if (e->she_fmtoffset != 0) {
 			fmt = [e->she_fmtoffset];
+			size_t fmtlen = strlen(fmt);
+			for (unsigned z = 0; z < fmtlen - 1; z++) {
+if (fmt[z] == '%' && fmt[z+1] == 's')
+	fmt[z+1] = 'p';
+			}
 			fn = [e->she_funcoffset];
 			bintime2timeval(>she_bintime, );
 			(void)printf("%06ld.%06ld %s#%"PRIu32"@%"PRIu32": ",



CVS commit: src/sys/gdbscripts

2019-05-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu May  9 07:59:49 UTC 2019

Modified Files:
src/sys/gdbscripts: devs procs

Log Message:
document 'devs' and 'procs' commands.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/gdbscripts/devs
cvs rdiff -u -r1.3 -r1.4 src/sys/gdbscripts/procs

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

Modified files:

Index: src/sys/gdbscripts/devs
diff -u src/sys/gdbscripts/devs:1.1 src/sys/gdbscripts/devs:1.2
--- src/sys/gdbscripts/devs:1.1	Mon May  6 02:41:02 2019
+++ src/sys/gdbscripts/devs	Thu May  9 07:59:49 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: devs,v 1.1 2019/05/06 02:41:02 mrg Exp $
+#	$NetBSD: devs,v 1.2 2019/05/09 07:59:49 mrg Exp $
 
 define devs
 	set $i = 0
@@ -18,3 +18,7 @@ define devs
 		set $i++
 	end
 end
+document devs
+dump a list of all devices known on the system with their name,
+and these pointers: this device, parent device, device private.
+end

Index: src/sys/gdbscripts/procs
diff -u src/sys/gdbscripts/procs:1.3 src/sys/gdbscripts/procs:1.4
--- src/sys/gdbscripts/procs:1.3	Mon May  6 02:41:02 2019
+++ src/sys/gdbscripts/procs	Thu May  9 07:59:49 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: procs,v 1.3 2019/05/06 02:41:02 mrg Exp $
+#	$NetBSD: procs,v 1.4 2019/05/09 07:59:49 mrg Exp $
 
 define procs
 	set $i = 0
@@ -20,3 +20,8 @@ define procs
 		set $i++
 	end
 end
+document procs
+list all processes.
+displays struct proc *, pid, flags, status, nlwps, first lwp addr
+and command name.
+end



CVS commit: src

2019-05-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu May  9 07:38:44 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c
src/sys/arch/arm/include: cputypes.h
src/usr.sbin/cpuctl/arch: aarch64.c

Log Message:
add cortex A-76 detection.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/include/cputypes.h
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/cpuctl/arch/aarch64.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/aarch64/aarch64/cpu.c
diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.16 src/sys/arch/aarch64/aarch64/cpu.c:1.17
--- src/sys/arch/aarch64/aarch64/cpu.c:1.16	Mon Jan 21 08:04:26 2019
+++ src/sys/arch/aarch64/aarch64/cpu.c	Thu May  9 07:38:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.16 2019/01/21 08:04:26 skrll Exp $ */
+/* $NetBSD: cpu.c,v 1.17 2019/05/09 07:38:44 mrg Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.16 2019/01/21 08:04:26 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.17 2019/05/09 07:38:44 mrg Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -190,6 +190,7 @@ const struct cpuidtab cpuids[] = {
 	{ CPU_ID_CORTEXA73R0 & CPU_PARTMASK, "Cortex-A73", "Cortex", "V8-A" },
 	{ CPU_ID_CORTEXA55R1 & CPU_PARTMASK, "Cortex-A55", "Cortex", "V8.2-A" },
 	{ CPU_ID_CORTEXA75R2 & CPU_PARTMASK, "Cortex-A75", "Cortex", "V8.2-A" },
+	{ CPU_ID_CORTEXA76R3 & CPU_PARTMASK, "Cortex-A76", "Cortex", "V8.2-A" },
 	{ CPU_ID_THUNDERXRX, "Cavium ThunderX", "Cavium", "V8-A" },
 	{ CPU_ID_THUNDERX81XXRX, "Cavium ThunderX CN81XX", "Cavium", "V8-A" },
 	{ CPU_ID_THUNDERX83XXRX, "Cavium ThunderX CN83XX", "Cavium", "V8-A" },

Index: src/sys/arch/arm/include/cputypes.h
diff -u src/sys/arch/arm/include/cputypes.h:1.5 src/sys/arch/arm/include/cputypes.h:1.6
--- src/sys/arch/arm/include/cputypes.h:1.5	Thu Jan  3 15:10:37 2019
+++ src/sys/arch/arm/include/cputypes.h	Thu May  9 07:38:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cputypes.h,v 1.5 2019/01/03 15:10:37 jmcneill Exp $	*/
+/*	$NetBSD: cputypes.h,v 1.6 2019/05/09 07:38:44 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Ben Harris
@@ -163,6 +163,7 @@
 #define CPU_ID_CORTEXA72R0	0x410fd080
 #define CPU_ID_CORTEXA73R0	0x410fd090
 #define CPU_ID_CORTEXA75R2	0x412fd0a0
+#define CPU_ID_CORTEXA76R3	0x413fd0b0
 
 #define CPU_ID_CORTEX_P(n)	((n & 0xff0fe000) == 0x410fc000)
 #define CPU_ID_CORTEX_A5_P(n)	((n & 0xff0ff0f0) == 0x410fc050)
@@ -177,6 +178,7 @@
 #define CPU_ID_CORTEX_A72_P(n)	((n & 0xff0ff0f0) == 0x410fd080)
 #define CPU_ID_CORTEX_A73_P(n)	((n & 0xff0ff0f0) == 0x410fd090)
 #define CPU_ID_CORTEX_A75_P(n)	((n & 0xff0ff0f0) == 0x410fd0a0)
+#define CPU_ID_CORTEX_A76_P(n)	((n & 0xff0ff0f0) == 0x410fd0b0)
 
 #define CPU_ID_THUNDERXRX	0x43000a10
 #define CPU_ID_THUNDERXP1d0	0x43000a10

Index: src/usr.sbin/cpuctl/arch/aarch64.c
diff -u src/usr.sbin/cpuctl/arch/aarch64.c:1.6 src/usr.sbin/cpuctl/arch/aarch64.c:1.7
--- src/usr.sbin/cpuctl/arch/aarch64.c:1.6	Wed Jan 23 07:41:54 2019
+++ src/usr.sbin/cpuctl/arch/aarch64.c	Thu May  9 07:38:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarch64.c,v 1.6 2019/01/23 07:41:54 skrll Exp $	*/
+/*	$NetBSD: aarch64.c,v 1.7 2019/05/09 07:38:44 mrg Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: aarch64.c,v 1.6 2019/01/23 07:41:54 skrll Exp $");
+__RCSID("$NetBSD: aarch64.c,v 1.7 2019/05/09 07:38:44 mrg Exp $");
 #endif /* no lint */
 
 #include 
@@ -75,6 +75,7 @@ const struct cpuidtab cpuids[] = {
 	{ CPU_ID_CORTEXA73R0 & CPU_PARTMASK, "Cortex-A73", "Cortex", "V8-A" },
 	{ CPU_ID_CORTEXA55R1 & CPU_PARTMASK, "Cortex-A55", "Cortex", "V8.2-A" },
 	{ CPU_ID_CORTEXA75R2 & CPU_PARTMASK, "Cortex-A75", "Cortex", "V8.2-A" },
+	{ CPU_ID_CORTEXA76R3 & CPU_PARTMASK, "Cortex-A76", "Cortex", "V8.2-A" },
 	{ CPU_ID_THUNDERXRX, "Cavium ThunderX", "Cavium", "V8-A" },
 	{ CPU_ID_THUNDERX81XXRX, "Cavium ThunderX CN81XX", "Cavium", "V8-A" },
 	{ CPU_ID_THUNDERX83XXRX, "Cavium ThunderX CN83XX", "Cavium", "V8-A" },



CVS commit: src/share/man/man4

2019-05-09 Thread Constantine A. Murenin
Module Name:src
Committed By:   cnst
Date:   Thu May  9 07:12:38 UTC 2019

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

Log Message:
bio(4): .In dev/biovar.h in SYNOPSIS; .Xr envsys 4 et al in both DESCR && SEE 
ALSO


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man4/bio.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/bio.4
diff -u src/share/man/man4/bio.4:1.17 src/share/man/man4/bio.4:1.18
--- src/share/man/man4/bio.4:1.17	Wed May  8 19:34:09 2019
+++ src/share/man/man4/bio.4	Thu May  9 07:12:38 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bio.4,v 1.17 2019/05/08 19:34:09 cnst Exp $
+.\"	$NetBSD: bio.4,v 1.18 2019/05/09 07:12:38 cnst Exp $
 .\"	$OpenBSD: bio.4,v 1.19 2006/09/20 22:22:37 jmc Exp $
 .\"
 .\" Copyright (c) 2002 Niklas Hallqvist
@@ -28,7 +28,7 @@
 .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 8, 2019
+.Dd May 9, 2019
 .Dt BIO 4
 .Os
 .Sh NAME
@@ -36,6 +36,8 @@
 .Nd Block IO ioctl tunnel pseudo-device
 .Sh SYNOPSIS
 .Cd "pseudo-device bio"
+.Pp
+.In dev/biovar.h
 .Sh DESCRIPTION
 The
 .Nm
@@ -182,14 +184,36 @@ extension of
 and is supported by
 .Xr arcmsr 4 .
 .El
+.Pp
+The
+.Xr bioctl 8
+utility can be used to perform the above controls from the userland.
+Additionally, since
+.Dv BIOCVOL
+volume status is normally duplicated into
+.Xr sysmon_envsys 9
+sensors of
+.Dv ENVSYS_DRIVE
+type, it is also available through
+.Xr envsys 4 ,
+and can be monitored with
+.Xr envstat 8
+and
+.Xr powerd 8 .
 .Sh FILES
-.Bl -tag -width /dev/bio -compact
+.Bl -tag -width Ds -compact
 .It Pa /dev/bio
 ioctl tunnel device
+.It Pa /etc/powerd/scripts/sensor_drive
+powerd script for drive sensors
 .El
 .Sh SEE ALSO
 .Xr ioctl 2 ,
-.Xr bioctl 8
+.Xr envsys 4 ,
+.Xr bioctl 8 ,
+.Xr envstat 8 ,
+.Xr powerd 8 ,
+.Xr sysmon_envsys 9
 .Sh HISTORY
 The
 .Nm