CVS commit: src/usr.bin/make

2019-02-15 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Feb 16 07:41:13 UTC 2019

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

Log Message:
make(1): minor grammar fixes in BUGS section


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/usr.bin/make/make.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/make/make.1
diff -u src/usr.bin/make/make.1:1.273 src/usr.bin/make/make.1:1.274
--- src/usr.bin/make/make.1:1.273	Sun May 27 01:14:51 2018
+++ src/usr.bin/make/make.1	Sat Feb 16 07:41:12 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos Exp $
+.\"	$NetBSD: make.1,v 1.274 2019/02/16 07:41:12 gutteridge Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd May 26, 2018
+.Dd February 16, 2019
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -2403,9 +2403,9 @@ file).
 .Sh BUGS
 The
 .Nm
-syntax is difficult to parse without actually acting of the data.
-For instance finding the end of a variable use should involve scanning each
-the modifiers using the correct terminator for each field.
+syntax is difficult to parse without actually acting on the data.
+For instance, finding the end of a variable's use should involve scanning
+each of the modifiers, using the correct terminator for each field.
 In many places
 .Nm
 just counts {} and () in order to find the end of a variable expansion.



CVS commit: src/share/man/man9

2019-02-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Feb 16 07:00:56 UTC 2019

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

Log Message:
Mark up NULL with Dv.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 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.50 src/share/man/man9/audio.9:1.51
--- src/share/man/man9/audio.9:1.50	Sat Feb 16 06:51:04 2019
+++ src/share/man/man9/audio.9	Sat Feb 16 07:00:56 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.9,v 1.50 2019/02/16 06:51:04 isaki Exp $
+.\"	$NetBSD: audio.9,v 1.51 2019/02/16 07:00:56 wiz Exp $
 .\"
 .\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -133,7 +133,9 @@ recording data will be thrown away.
 The fields of
 .Va audio_hw_if
 are described in some more detail below.
-Some fields are optional and can be set to NULL if not needed.
+Some fields are optional and can be set to
+.Dv NULL
+if not needed.
 .Bl -tag -width indent
 .It Dv int open(void *hdl, int flags)
 optional, is called when the audio device is opened.
@@ -414,7 +416,9 @@ is used instead (with the same arguments
 The reason for using a device dependent routine instead of
 .Xr malloc 9
 is that some buses need special allocation to do DMA.
-Returns the address of the buffer, or NULL on failure.
+Returns the address of the buffer, or
+.Dv NULL
+on failure.
 .It Dv void freem(void *hdl, void *addr, size_t size)
 optional, is called to free memory allocated by
 .Va allocm .



CVS commit: src/share/man/man9

2019-02-15 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 16 06:51:05 UTC 2019

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

Log Message:
Two minor fixes.
- 0 -> NULL.
- avoid K and sync with reality.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 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.49 src/share/man/man9/audio.9:1.50
--- src/share/man/man9/audio.9:1.49	Sun Dec  2 09:22:30 2018
+++ src/share/man/man9/audio.9	Sat Feb 16 06:51:04 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.9,v 1.49 2018/12/02 09:22:30 isaki Exp $
+.\"	$NetBSD: audio.9,v 1.50 2019/02/16 06:51:04 isaki Exp $
 .\"
 .\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -104,11 +104,8 @@ when the latter calls
 .Va audio_attach_mi .
 This call should be
 .Bd -literal
-void
-audio_attach_mi(ahwp, hdl, dev)
-	struct audio_hw_if *ahwp;
-	void *hdl;
-	struct device *dev;
+device_t
+audio_attach_mi(const struct audio_hw_if *ahwp, void *hdl, device_t dev);
 .Ed
 .Pp
 The
@@ -136,7 +133,7 @@ recording data will be thrown away.
 The fields of
 .Va audio_hw_if
 are described in some more detail below.
-Some fields are optional and can be set to 0 if not needed.
+Some fields are optional and can be set to NULL if not needed.
 .Bl -tag -width indent
 .It Dv int open(void *hdl, int flags)
 optional, is called when the audio device is opened.
@@ -417,7 +414,7 @@ is used instead (with the same arguments
 The reason for using a device dependent routine instead of
 .Xr malloc 9
 is that some buses need special allocation to do DMA.
-Returns the address of the buffer, or 0 on failure.
+Returns the address of the buffer, or NULL on failure.
 .It Dv void freem(void *hdl, void *addr, size_t size)
 optional, is called to free memory allocated by
 .Va allocm .



CVS commit: src/share/man/man4

2019-02-15 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 16 06:50:14 UTC 2019

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

Log Message:
Two minor fixes.
- Add missing AUDIO_PERROR (since 1996!)
- Sort AUDIO_GETFD.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 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.86 src/share/man/man4/audio.4:1.87
--- src/share/man/man4/audio.4:1.86	Mon May 28 00:18:05 2018
+++ src/share/man/man4/audio.4	Sat Feb 16 06:50:14 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.4,v 1.86 2018/05/28 00:18:05 nat Exp $
+.\"	$NetBSD: audio.4,v 1.87 2019/02/16 06:50:14 isaki Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -270,9 +270,10 @@ This command will select the audio chann
 This command stops all playback and recording, clears all queued
 buffers, resets error counters, and restarts recording and playback as
 appropriate for the current sampling mode.
+.It Dv AUDIO_PERROR (int)
 .It Dv AUDIO_RERROR (int)
-This command fetches the count of dropped input samples into its integer
-argument.
+This command fetches the count of dropped output (input)
+samples into its integer argument.
 There is no information regarding when in the sample stream
 they were dropped.
 .It Dv AUDIO_WSEEK (u_long)
@@ -292,8 +293,6 @@ typedef struct audio_device {
 char config[MAX_AUDIO_DEV_LEN];
 } audio_device_t;
 .Ed
-.It Dv AUDIO_GETFD (int)
-The command returns the current setting of the full duplex mode.
 .It Dv AUDIO_GETENC (audio_encoding_t)
 This command is used iteratively to fetch sample encoding names and
 format ids into the input/output audio_encoding_t argument.
@@ -312,6 +311,8 @@ To query
 all the supported encodings, start with an index field of 0 and
 continue with successive encodings (1, 2, ...) until the command returns
 an error.
+.It Dv AUDIO_GETFD (int)
+The command returns the current setting of the full duplex mode.
 .It Dv AUDIO_SETFD (int)
 This command sets the device into full-duplex operation if its integer
 argument has a non-zero value, or into half-duplex operation if it



CVS commit: src/lib/libedit

2019-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 15 23:20:35 UTC 2019

Modified Files:
src/lib/libedit: readline.c terminal.c
src/lib/libedit/readline: readline.h

Log Message:
PR/53983: Jonathan Perkins: Fix types for readline compatibility


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/lib/libedit/readline.c
cvs rdiff -u -r1.34 -r1.35 src/lib/libedit/terminal.c
cvs rdiff -u -r1.44 -r1.45 src/lib/libedit/readline/readline.h

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

Modified files:

Index: src/lib/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.150 src/lib/libedit/readline.c:1.151
--- src/lib/libedit/readline.c:1.150	Thu Feb 14 15:09:12 2019
+++ src/lib/libedit/readline.c	Fri Feb 15 18:20:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.150 2019/02/14 20:09:12 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.151 2019/02/15 23:20:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.150 2019/02/14 20:09:12 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.151 2019/02/15 23:20:35 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -72,7 +72,7 @@ static char empty[] = { '\0' };
 static char expand_chars[] = { ' ', '\t', '\n', '=', '(', '\0' };
 static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', '$',
 '>', '<', '=', ';', '|', '&', '{', '(', '\0' };
-char *rl_readline_name = empty;
+const char *rl_readline_name = empty;
 FILE *rl_instream = NULL;
 FILE *rl_outstream = NULL;
 int rl_point = 0;
@@ -105,7 +105,7 @@ char *history_arg_extract(int start, int
 
 int rl_inhibit_completion = 0;
 int rl_attempted_completion_over = 0;
-char *rl_basic_word_break_characters = break_chars;
+const char *rl_basic_word_break_characters = break_chars;
 char *rl_completer_word_break_characters = NULL;
 char *rl_completer_quote_characters = NULL;
 rl_compentry_func_t *rl_completion_entry_function = NULL;
@@ -150,7 +150,7 @@ int rl_completion_query_items = 100;
  * in the parsed text when it is passed to the completion function.
  * Shell uses this to help determine what kind of completing to do.
  */
-char *rl_special_prefixes = NULL;
+const char *rl_special_prefixes = NULL;
 
 /*
  * This is the character appended to the completed words if at the end of
@@ -1885,7 +1885,7 @@ int
 rl_complete(int ignore __attribute__((__unused__)), int invoking_key)
 {
 	static ct_buffer_t wbreak_conv, sprefix_conv;
-	char *breakchars;
+	const char *breakchars;
 
 	if (h == NULL || e == NULL)
 		rl_initialize();
@@ -1971,13 +1971,14 @@ rl_read_key(void)
  * reset the terminal
  */
 /* ARGSUSED */
-void
+int
 rl_reset_terminal(const char *p __attribute__((__unused__)))
 {
 
 	if (h == NULL || e == NULL)
 		rl_initialize();
 	el_reset(e);
+	return 0;
 }
 
 
@@ -2166,7 +2167,7 @@ rl_variable_bind(const char *var, const 
 	return el_set(e, EL_BIND, "", var, value, NULL) == -1 ? 1 : 0;
 }
 
-void
+int
 rl_stuff_char(int c)
 {
 	char buf[2];
@@ -2174,6 +2175,7 @@ rl_stuff_char(int c)
 	buf[0] = (char)c;
 	buf[1] = '\0';
 	el_insertstr(e, buf);
+	return 1;
 }
 
 static int

Index: src/lib/libedit/terminal.c
diff -u src/lib/libedit/terminal.c:1.34 src/lib/libedit/terminal.c:1.35
--- src/lib/libedit/terminal.c:1.34	Sat Nov 24 07:17:35 2018
+++ src/lib/libedit/terminal.c	Fri Feb 15 18:20:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: terminal.c,v 1.34 2018/11/24 12:17:35 christos Exp $	*/
+/*	$NetBSD: terminal.c,v 1.35 2019/02/15 23:20:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)term.c	8.2 (Berkeley) 4/30/95";
 #else
-__RCSID("$NetBSD: terminal.c,v 1.34 2018/11/24 12:17:35 christos Exp $");
+__RCSID("$NetBSD: terminal.c,v 1.35 2019/02/15 23:20:35 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -419,7 +419,7 @@ terminal_rebuffer_display(EditLine *el)
 	return 0;
 }
 
-static wchar_t **
+static wint_t **
 terminal_alloc_buffer(EditLine *el)
 {
 	wint_t **b;

Index: src/lib/libedit/readline/readline.h
diff -u src/lib/libedit/readline/readline.h:1.44 src/lib/libedit/readline/readline.h:1.45
--- src/lib/libedit/readline/readline.h:1.44	Sun Dec  2 11:58:13 2018
+++ src/lib/libedit/readline/readline.h	Fri Feb 15 18:20:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.h,v 1.44 2018/12/02 16:58:13 christos Exp $	*/
+/*	$NetBSD: readline.h,v 1.45 2019/02/15 23:20:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -99,14 +99,14 @@ extern "C" {
 #endif
 extern const char	*rl_library_version;
 extern int		rl_readline_version;
-extern char		*rl_readline_name;
+extern const char	*rl_readline_name;
 extern FILE		*rl_instream;
 extern FILE		*rl_outstream;
 extern char		*rl_line_buffer;
 extern int		 rl_point, rl_end;
 extern int		 history_base, 

CVS commit: src/sys/external/bsd/libnv/dist

2019-02-15 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Feb 15 22:49:24 UTC 2019

Modified Files:
src/sys/external/bsd/libnv/dist: nvpair.c

Log Message:
nvpair_remove_nvlist_array: revert part of the rev 1.4 change (it was applied
by mistake because the libnv upsteam code on Github has deviated from FreeBSD,
i.e. it has a different nvlist_set_array_next() logic).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/libnv/dist/nvpair.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/libnv/dist/nvpair.c
diff -u src/sys/external/bsd/libnv/dist/nvpair.c:1.5 src/sys/external/bsd/libnv/dist/nvpair.c:1.6
--- src/sys/external/bsd/libnv/dist/nvpair.c:1.5	Tue Feb 12 12:52:49 2019
+++ src/sys/external/bsd/libnv/dist/nvpair.c	Fri Feb 15 22:49:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvpair.c,v 1.5 2019/02/12 12:52:49 rmind Exp $	*/
+/*	$NetBSD: nvpair.c,v 1.6 2019/02/15 22:49:24 rmind Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -36,7 +36,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: head/sys/contrib/libnv/nvpair.c 335382 2018-06-19 18:43:02Z lwhsu $");
 #else
-__RCSID("$NetBSD: nvpair.c,v 1.5 2019/02/12 12:52:49 rmind Exp $");
+__RCSID("$NetBSD: nvpair.c,v 1.6 2019/02/15 22:49:24 rmind Exp $");
 #endif
 
 #include 
@@ -251,16 +251,8 @@ nvpair_remove_nvlist_array(nvpair_t *nvp
 	nvlarray = __DECONST(nvlist_t **,
 	nvpair_get_nvlist_array(nvp, ));
 	for (i = 0; i < count; i++) {
-		nvlist_t *nvl;
-		nvpair_t *nnvp;
-
-		nvl = nvlarray[i];
-		nnvp = nvlist_get_array_next_nvpair(nvl);
-		if (nnvp != NULL) {
-			nvpair_free_structure(nnvp);
-		}
-		nvlist_set_array_next(nvl, NULL);
-		nvlist_set_parent(nvl, NULL);
+		nvlist_set_array_next(nvlarray[i], NULL);
+		nvlist_set_parent(nvlarray[i], NULL);
 	}
 }
 



CVS commit: src

2019-02-15 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Fri Feb 15 18:57:15 UTC 2019

Modified Files:
src/sys/kern: tty_pty.c
src/tests/kernel/kqueue/read: t_ttypty.c

Log Message:
Fix reporting EOF via kevent and add a test case

Fix the kernel pty driver to report closed slave via master's kevent
EVFILT_READ.  This behavior matches the behavior for pipes, is
consistent with how FreeBSD implements it and is relied upon by LLDB's
main loop implementation.

Includes feedback by kre and kamil (from tech-kern), commit approved
by kamil.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/kern/tty_pty.c
cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/kqueue/read/t_ttypty.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/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.144 src/sys/kern/tty_pty.c:1.145
--- src/sys/kern/tty_pty.c:1.144	Mon Sep  3 16:29:35 2018
+++ src/sys/kern/tty_pty.c	Fri Feb 15 18:57:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_pty.c,v 1.144 2018/09/03 16:29:35 riastradh Exp $	*/
+/*	$NetBSD: tty_pty.c,v 1.145 2019/02/15 18:57:15 mgorny Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.144 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.145 2019/02/15 18:57:15 mgorny Exp $");
 
 #include "opt_ptm.h"
 
@@ -938,6 +938,10 @@ filt_ptcread(struct knote *kn, long hint
 		((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl))
 			kn->kn_data++;
 	}
+	if (!ISSET(tp->t_state, TS_CARR_ON)) {
+		kn->kn_flags |= EV_EOF;
+		canread = 1;
+	}
 
 	if ((hint & NOTE_SUBMIT) == 0) {
 		mutex_spin_exit(_lock);

Index: src/tests/kernel/kqueue/read/t_ttypty.c
diff -u src/tests/kernel/kqueue/read/t_ttypty.c:1.2 src/tests/kernel/kqueue/read/t_ttypty.c:1.3
--- src/tests/kernel/kqueue/read/t_ttypty.c:1.2	Fri Jan 13 21:30:41 2017
+++ src/tests/kernel/kqueue/read/t_ttypty.c	Fri Feb 15 18:57:15 2019
@@ -1,7 +1,7 @@
-/* $NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
+/* $NetBSD: t_ttypty.c,v 1.3 2019/02/15 18:57:15 mgorny Exp $ */
 
 /*-
- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 2002, 2008, 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,11 +30,12 @@
  */
 
 #include 
-__COPYRIGHT("@(#) Copyright (c) 2008\
+__COPYRIGHT("@(#) Copyright (c) 2008, 2019\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
+__RCSID("$NetBSD: t_ttypty.c,v 1.3 2019/02/15 18:57:15 mgorny Exp $");
 
 #include 
+#include 
 #include 
 
 #include 
@@ -135,10 +136,48 @@ ATF_TC_BODY(slave, tc)
 	h_check(false);
 }
 
+ATF_TC(closed_slave);
+ATF_TC_HEAD(closed_slave, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+		"Checks EVFILT_READ reporting for slave tty being closed");
+}
+ATF_TC_BODY(closed_slave, tc)
+{
+	char slavetty[1024];
+	struct kevent event[1];
+	int amaster, aslave;
+	int kq, n;
+	struct timespec timeout = {5, 0};
+
+	RL(openpty(, , slavetty, NULL, NULL));
+
+	(void)printf("tty: openpty master %d slave %d tty '%s'\n",
+		amaster, aslave, slavetty);
+
+	RL(kq = kqueue());
+
+	EV_SET([0], amaster, EVFILT_READ, EV_ADD|EV_ENABLE, 0, 0, 0);
+	RL(kevent(kq, event, 1, NULL, 0, NULL));
+
+	RL(close(aslave));
+
+	RL(n = kevent(kq, NULL, 0, event, 1, ));
+
+	(void)printf("kevent num %d filt %d flags: %#x, fflags: %#x, "
+	"data: %" PRId64 "\n", n, event[0].filter, event[0].flags,
+	event[0].fflags, event[0].data);
+
+	ATF_REQUIRE_EQ(n, 1);
+	ATF_REQUIRE_EQ(event[0].filter, EVFILT_READ);
+	ATF_REQUIRE_EQ(event[0].flags & EV_EOF, EV_EOF);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, master);
 	ATF_TP_ADD_TC(tp, slave);
+	ATF_TP_ADD_TC(tp, closed_slave);
 
 	return atf_no_error();
 }



CVS commit: src/sys/dev/acpi/acpica

2019-02-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 15 20:48:57 UTC 2019

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c

Log Message:
Avoid UB in OsdHardware.c

UBSan: Undefined Behavior in src/sys/dev/acpi/acpica/OsdHardware.c:265:17,
left shift of 255 by 24 places cannot be represented in type 'int'

This file isn't part of upstream acpica so just fix it locally.

Reported and initial patch by 


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpica/OsdHardware.c

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

Modified files:

Index: src/sys/dev/acpi/acpica/OsdHardware.c
diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.10 src/sys/dev/acpi/acpica/OsdHardware.c:1.11
--- src/sys/dev/acpi/acpica/OsdHardware.c:1.10	Tue Jan 26 22:52:14 2016
+++ src/sys/dev/acpi/acpica/OsdHardware.c	Fri Feb 15 20:48:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $	*/
+/*	$NetBSD: OsdHardware.c,v 1.11 2019/02/15 20:48:57 kamil Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.11 2019/02/15 20:48:57 kamil Exp $");
 
 #include 
 #include 
@@ -262,13 +262,13 @@ AcpiOsWritePciConfiguration(ACPI_PCI_ID 
 	switch (Width) {
 	case 8:
 		tmp = pci_conf_read(pc, tag, Register & ~3);
-		tmp &= ~(0xff << ((Register & 3) * 8));
+		tmp &= ~(0xffu << ((Register & 3) * 8));
 		tmp |= (Value << ((Register & 3) * 8));
 		break;
 
 	case 16:
 		tmp = pci_conf_read(pc, tag, Register & ~3);
-		tmp &= ~(0x << ((Register & 3) * 8));
+		tmp &= ~(0xu << ((Register & 3) * 8));
 		tmp |= (Value << ((Register & 3) * 8));
 		break;
 



CVS commit: src/lib/libnvmm

2019-02-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 15 16:42:27 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm_x86.c

Log Message:
Remove the PSE check in the 32bit-PAE MMU. Setting CR4.PAE automatically
enables PSE regardless of whether CR4.PSE is set or not, so we should just
ignore it.

With this in place I can boot Windows 8.1 on NVMM.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libnvmm/libnvmm_x86.c

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

Modified files:

Index: src/lib/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.22 src/lib/libnvmm/libnvmm_x86.c:1.23
--- src/lib/libnvmm/libnvmm_x86.c:1.22	Thu Feb 14 14:30:20 2019
+++ src/lib/libnvmm/libnvmm_x86.c	Fri Feb 15 16:42:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.22 2019/02/14 14:30:20 maxv Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.23 2019/02/15 16:42:27 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -188,7 +188,7 @@ typedef uint64_t pte_32bit_pae_t;
 
 static int
 x86_gva_to_gpa_32bit_pae(struct nvmm_machine *mach, uint64_t cr3,
-gvaddr_t gva, gpaddr_t *gpa, bool has_pse, nvmm_prot_t *prot)
+gvaddr_t gva, gpaddr_t *gpa, nvmm_prot_t *prot)
 {
 	gpaddr_t L3gpa, L2gpa, L1gpa;
 	uintptr_t L3hva, L2hva, L1hva;
@@ -224,8 +224,6 @@ x86_gva_to_gpa_32bit_pae(struct nvmm_mac
 		*prot &= ~NVMM_PROT_WRITE;
 	if (pte & PG_NX)
 		*prot &= ~NVMM_PROT_EXEC;
-	if ((pte & PG_PS) && !has_pse)
-		return -1;
 	if (pte & PG_PS) {
 		*gpa = (pte & PTE32_PAE_L2_FRAME);
 		*gpa = *gpa + (gva & PTE32_PAE_L1_MASK);
@@ -408,8 +406,7 @@ x86_gva_to_gpa(struct nvmm_machine *mach
 		ret = x86_gva_to_gpa_64bit(mach, cr3, gva, gpa, prot);
 	} else if (is_pae && !is_lng) {
 		/* 32bit PAE */
-		ret = x86_gva_to_gpa_32bit_pae(mach, cr3, gva, gpa, has_pse,
-		prot);
+		ret = x86_gva_to_gpa_32bit_pae(mach, cr3, gva, gpa, prot);
 	} else if (!is_pae && !is_lng) {
 		/* 32bit */
 		ret = x86_gva_to_gpa_32bit(mach, cr3, gva, gpa, has_pse, prot);



CVS commit: src/sys/dev/hyperv

2019-02-15 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 15 16:37:54 UTC 2019

Modified Files:
src/sys/dev/hyperv: vmbus.c

Log Message:
Add __diagused.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/vmbus.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/hyperv/vmbus.c
diff -u src/sys/dev/hyperv/vmbus.c:1.1 src/sys/dev/hyperv/vmbus.c:1.2
--- src/sys/dev/hyperv/vmbus.c:1.1	Fri Feb 15 08:54:01 2019
+++ src/sys/dev/hyperv/vmbus.c	Fri Feb 15 16:37:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.1 2019/02/15 08:54:01 nonaka Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.2 2019/02/15 16:37:54 hannken Exp $	*/
 /*	$OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.1 2019/02/15 08:54:01 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.2 2019/02/15 16:37:54 hannken Exp $");
 
 #include 
 #include 
@@ -1020,7 +1020,7 @@ vmbus_channel_add(struct vmbus_channel *
 {
 	struct vmbus_softc *sc = nch->ch_sc;
 	struct vmbus_channel *ch;
-	u_int refs;
+	u_int refs __diagused;
 
 	if (nch->ch_id == 0) {
 		device_printf(sc->sc_dev, "got channel 0 offer, discard\n");



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-15 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 15 16:36:33 UTC 2019

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

Log Message:
Add /* FALLTHROUGH */ for DEBUG kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.190 src/sys/arch/sparc64/sparc64/trap.c:1.191
--- src/sys/arch/sparc64/sparc64/trap.c:1.190	Thu Feb 14 20:09:40 2019
+++ src/sys/arch/sparc64/sparc64/trap.c	Fri Feb 15 16:36:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.190 2019/02/14 20:09:40 palle Exp $ */
+/*	$NetBSD: trap.c,v 1.191 2019/02/15 16:36:33 hannken Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.190 2019/02/14 20:09:40 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.191 2019/02/15 16:36:33 hannken Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -625,6 +625,7 @@ dopanic:
 		   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm,
 		   pc, type, type < N_TRAP_TYPES ? trap_type[type] : T);
 #endif
+		/* FALLTHROUGH */
 	case T_ILLINST:
 #if defined(DDB) && defined(DEBUG)
 		if (trapdebug & TDB_STOPSIG)



CVS commit: src/sys/netinet

2019-02-15 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Fri Feb 15 14:13:32 UTC 2019

Modified Files:
src/sys/netinet: sctp_usrreq.c

Log Message:
This really was a missing break.

Spotted by Rin Okuyama.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/netinet/sctp_usrreq.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/netinet/sctp_usrreq.c
diff -u src/sys/netinet/sctp_usrreq.c:1.15 src/sys/netinet/sctp_usrreq.c:1.16
--- src/sys/netinet/sctp_usrreq.c:1.15	Tue Feb 12 14:40:38 2019
+++ src/sys/netinet/sctp_usrreq.c	Fri Feb 15 14:13:32 2019
@@ -1,5 +1,5 @@
 /*	$KAME: sctp_usrreq.c,v 1.50 2005/06/16 20:45:29 jinmei Exp $	*/
-/*	$NetBSD: sctp_usrreq.c,v 1.15 2019/02/12 14:40:38 rjs Exp $	*/
+/*	$NetBSD: sctp_usrreq.c,v 1.16 2019/02/15 14:13:32 rjs Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@@ -33,7 +33,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.15 2019/02/12 14:40:38 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.16 2019/02/15 14:13:32 rjs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2289,7 +2289,8 @@ sctp_optsget(struct socket *so, struct s
 		*s_info = stcb->asoc.def_send;
 		SCTP_TCB_UNLOCK(stcb);
 		sopt->sopt_size = sizeof(*s_info);
-	} /* FALLTHROUGH */
+	}
+	break;
 	case SCTP_INITMSG:
 	{
 		struct sctp_initmsg *sinit;



CVS commit: src/sys/dev/nvmm/x86

2019-02-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 15 13:17:05 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c

Log Message:
Initialize the guest TSC to zero at VCPU creation time, and handle guest
writes to MSR_TSC at run time.

This is imprecise, because the hardware does not provide a way to preserve
the TSC during #VMEXITs, but that's fine enough.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/nvmm/x86/nvmm_x86_svm.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/nvmm/x86/nvmm_x86_vmx.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/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.23 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.24
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.23	Thu Feb 14 14:30:20 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Fri Feb 15 13:17:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.23 2019/02/14 14:30:20 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.24 2019/02/15 13:17:05 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.23 2019/02/14 14:30:20 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.24 2019/02/15 13:17:05 maxv Exp $");
 
 #include 
 #include 
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -965,7 +966,14 @@ svm_inkernel_handle_msr(struct nvmm_mach
 cpudata->tlb_want_flush = true;
 			}
 			vmcb->state.efer = exit->u.msr.val | EFER_SVME;
-			vmcb->ctrl.vmcb_clean &= ~VMCB_CTRL_VMCB_CLEAN_CR;
+			svm_vmcb_cache_flush(vmcb, VMCB_CTRL_VMCB_CLEAN_CR);
+			goto handled;
+		}
+		if (exit->u.msr.msr == MSR_TSC) {
+			cpudata->tsc_offset = exit->u.msr.val - cpu_counter();
+			vmcb->ctrl.tsc_offset = cpudata->tsc_offset +
+			curcpu()->ci_data.cpu_cc_skew;
+			svm_vmcb_cache_flush(vmcb, VMCB_CTRL_VMCB_CLEAN_I);
 			goto handled;
 		}
 		for (i = 0; i < __arraycount(msr_ignore_list); i++) {
@@ -1582,8 +1590,8 @@ svm_vcpu_init(struct nvmm_machine *mach,
 	cpudata->gfpu.xsh_xstate_bv = svm_xcr0_mask;
 	cpudata->gfpu.xsh_xcomp_bv = 0;
 
-	/* Bluntly hide the host TSC. */
-	cpudata->tsc_offset = rdtsc();
+	/* Set guest TSC to zero, more or less. */
+	cpudata->tsc_offset = -cpu_counter();
 
 	/* These MSRs are static. */
 	cpudata->star = rdmsr(MSR_STAR);

Index: src/sys/dev/nvmm/x86/nvmm_x86_vmx.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.3 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.4
--- src/sys/dev/nvmm/x86/nvmm_x86_vmx.c:1.3	Thu Feb 14 14:30:20 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_vmx.c	Fri Feb 15 13:17:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_vmx.c,v 1.3 2019/02/14 14:30:20 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_vmx.c,v 1.4 2019/02/15 13:17:05 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.3 2019/02/14 14:30:20 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx.c,v 1.4 2019/02/15 13:17:05 maxv Exp $");
 
 #include 
 #include 
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: nvmm_x86_vmx
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1370,6 +1371,12 @@ vmx_inkernel_handle_msr(struct nvmm_mach
 		}
 		break;
 	case NVMM_EXIT_MSR_WRMSR:
+		if (exit->u.msr.msr == MSR_TSC) {
+			cpudata->tsc_offset = exit->u.msr.val - cpu_counter();
+			vmx_vmwrite(VMCS_TSC_OFFSET, cpudata->tsc_offset +
+			curcpu()->ci_data.cpu_cc_skew);
+			goto handled;
+		}
 		if (exit->u.msr.msr == MSR_CR_PAT) {
 			vmx_vmwrite(VMCS_GUEST_IA32_PAT, exit->u.msr.val);
 			goto handled;
@@ -2009,8 +2016,8 @@ vmx_vcpu_init(struct nvmm_machine *mach,
 	cpudata->gfpu.xsh_xstate_bv = vmx_xcr0_mask;
 	cpudata->gfpu.xsh_xcomp_bv = 0;
 
-	/* Bluntly hide the host TSC. */
-	cpudata->tsc_offset = rdtsc();
+	/* Set guest TSC to zero, more or less. */
+	cpudata->tsc_offset = -cpu_counter();
 
 	/* These MSRs are static. */
 	cpudata->star = rdmsr(MSR_STAR);