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

2018-03-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sat Mar 17 04:16:09 UTC 2018

Modified Files:
src/sys/arch/arm/include: aout_machdep.h

Log Message:
whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/include/aout_machdep.h

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

Modified files:

Index: src/sys/arch/arm/include/aout_machdep.h
diff -u src/sys/arch/arm/include/aout_machdep.h:1.7 src/sys/arch/arm/include/aout_machdep.h:1.8
--- src/sys/arch/arm/include/aout_machdep.h:1.7	Mon Feb 24 16:57:57 2014
+++ src/sys/arch/arm/include/aout_machdep.h	Sat Mar 17 04:16:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: aout_machdep.h,v 1.7 2014/02/24 16:57:57 christos Exp $	*/
+/*	$NetBSD: aout_machdep.h,v 1.8 2018/03/17 04:16:09 ryo Exp $	*/
 
 /*
  * Copyright (c) 1994-1996 Mark Brinicombe.
@@ -52,7 +52,7 @@ struct relocation_info_arm6 {
 };
 
 #define relocation_info relocation_info_arm6
-   
+
 /* No special executable format */
 #define	cpu_exec_aout_makecmds(a, b)	ENOEXEC
 



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

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 02:56:36 UTC 2018

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

Log Message:
Use two different compat stubs since they have different prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.71.16.4 -r1.71.16.5 src/sys/kern/kern_cpu.c

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

Modified files:

Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.71.16.4 src/sys/kern/kern_cpu.c:1.71.16.5
--- src/sys/kern/kern_cpu.c:1.71.16.4	Sat Mar 17 00:58:01 2018
+++ src/sys/kern/kern_cpu.c	Sat Mar 17 02:56:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.71.16.4 2018/03/17 00:58:01 pgoyette Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.71.16.5 2018/03/17 02:56:36 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.4 2018/03/17 00:58:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.5 2018/03/17 02:56:36 pgoyette Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -135,15 +135,21 @@ static char cpu_model[128];
 /*
  * routine vectors for compat code
  */
-static int stub_compat_6_cpu_ucode(const struct compat6_cpu_ucode *ucode)
+static int stub_compat_6_cpu_ucode_get_version(struct compat6_cpu_ucode *ucode)
+{
+
+	return ENOTTY;
+}
+
+static int stub_compat_6_cpu_ucode_apply(const struct compat6_cpu_ucode *ucode)
 {
 
 	return ENOTTY;
 }
 int (*vec_compat6_cpu_ucode_get_version)(struct compat6_cpu_ucode *) =
-stub_compat_6_cpu_ucode;
+stub_compat_6_cpu_ucode_get_version;
 int (*vec_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *) =
-stub_compat_6_cpu_ucode;
+stub_compat_6_cpu_ucode_apply;
 #endif
 
 /*



CVS commit: src/bin/sh

2018-03-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Mar 17 01:53:06 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Drop "show or set the limit on" legalese from the description of each
and every option to ulimit built-in.  The show-or-set text is already
supplied *both* before and after the list.  Pedantically repeating it
for each option just adds a lot of visual clutter that gets in the way
of actually using this fragment of the manual page as a quick
reference.


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.202 src/bin/sh/sh.1:1.203
--- src/bin/sh/sh.1:1.202	Sat Mar 17 01:40:28 2018
+++ src/bin/sh/sh.1	Sat Mar 17 01:53:06 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.202 2018/03/17 01:40:28 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.203 2018/03/17 01:53:06 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -3283,6 +3283,7 @@ The choice between hard limit (which no 
 violate, and which may not be raised once it has been lowered) and soft
 limit (which causes processes to be signaled but not necessarily killed,
 and which may be raised) is made with these flags:
+.Pp
 .Bl -tag -width Fl
 .It Fl H
 set or inquire about hard limits
@@ -3299,40 +3300,41 @@ If both are specified, the last one wins
 .Pp
 The limit to be interrogated or set, then, is chosen by specifying
 any one of these flags:
+.Pp
 .Bl -tag -width Fl
 .It Fl a
 show all the current limits
 .It Fl b
-show or set the limit on the socket buffer size of a process (in bytes)
+the socket buffer size of a process (bytes)
 .It Fl c
-show or set the limit on the largest core dump size that can be produced
-(in 512-byte blocks)
+the largest core dump size that can be produced
+(512-byte blocks)
 .It Fl d
-show or set the limit on the data segment size of a process (in kilobytes)
+the data segment size of a process (kilobytes)
 .It Fl f
-show or set the limit on the largest file that can be created
-(in 512-byte blocks)
+the largest file that can be created
+(512-byte blocks)
 .It Fl l
-show or set the limit on how much memory a process can lock with
+how much memory a process can lock with
 .Xr mlock 2
-(in kilobytes)
+(kilobytes)
 .It Fl m
-show or set the limit on the total physical memory that can be
-in use by a process (in kilobytes)
+the total physical memory that can be
+in use by a process (kilobytes)
 .It Fl n
-show or set the limit on the number of files a process can have open at once
+the number of files a process can have open at once
 .It Fl p
-show or set the limit on the number of processes this user can
+the number of processes this user can
 have at one time
 .It Fl r
-show or set the limit on the number of threads this user can
+the number of threads this user can
 have at one time
 .It Fl s
-show or set the limit on the stack size of a process (in kilobytes)
+the stack size of a process (kilobytes)
 .It Fl t
-show or set the limit on CPU time (in seconds)
+CPU time (seconds)
 .It Fl v
-show or set the limit on how large a process address space can be
+how large a process address space can be
 .El
 .Pp
 If none of these is specified, it is the limit on file size that is shown



CVS commit: src/bin/sh

2018-03-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Mar 17 01:40:28 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Tweak "ulimit" synopsis.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.201 src/bin/sh/sh.1:1.202
--- src/bin/sh/sh.1:1.201	Sat Mar 17 01:32:42 2018
+++ src/bin/sh/sh.1	Sat Mar 17 01:40:28 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.201 2018/03/17 01:32:42 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.202 2018/03/17 01:40:28 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -3276,7 +3276,7 @@ command, tracked alias and not found.
 For aliases the alias expansion is
 printed; for commands and tracked aliases the complete pathname of the
 command is printed.
-.It Ic ulimit Oo Fl H \*(Ba Fl S Oc Op Fl a \*(Ba Fl btfdscmlrpnv Op Ar value
+.It Ic ulimit Oo Fl H Ns \*(Ba Ns Fl S Oc Op Fl a \*(Ba Fl btfdscmlrpnv Op Ar value
 Inquire about or set the hard or soft limits on processes or set new
 limits.
 The choice between hard limit (which no process is allowed to
@@ -3288,13 +3288,14 @@ and which may be raised) is made with th
 set or inquire about hard limits
 .It Fl S
 set or inquire about soft limits.
+.El
+.Pp
 If neither
 .Fl H
 nor
 .Fl S
 is specified, the soft limit is displayed or both limits are set.
 If both are specified, the last one wins.
-.El
 .Pp
 The limit to be interrogated or set, then, is chosen by specifying
 any one of these flags:



CVS commit: src/bin/sh

2018-03-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Mar 17 01:32:42 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Cleanup markup in the "Command Line Editing" section.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.200 src/bin/sh/sh.1:1.201
--- src/bin/sh/sh.1:1.200	Sat Mar 17 01:03:08 2018
+++ src/bin/sh/sh.1	Sat Mar 17 01:32:42 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.200 2018/03/17 01:03:08 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.201 2018/03/17 01:32:42 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -3648,19 +3648,22 @@ section)
 can be edited using emacs-mode or vi-mode command-line editing.
 The command
 .Ql set -o emacs
+(or
+.Fl E
+option)
 enables emacs-mode editing.
 The command
 .Ql set -o vi
+(or
+.Fl V
+option)
 enables vi-mode editing and places the current shell process into
-.Ar vi
-insert mode.
+vi insert mode.
 (See the
 .Sx Argument List Processing
 section above.)
 .Pp
-The
-.Ar vi
-mode uses commands similar to a subset of those described in the
+The vi-mode uses commands similar to a subset of those described in the
 .Xr vi 1
 man page.
 With vi-mode
@@ -3668,17 +3671,15 @@ enabled,
 .Nm sh
 can be switched between insert mode and command mode.
 It's similar to
-.Xr vi 1 :
+.Ic vi :
 pressing the
 .Aq ESC
-key will throw you into command VI command mode.
+key will throw you into vi command mode.
 Pressing the
 .Aq return
 key while in command mode will pass the line to the shell.
 .Pp
-The
-.Ar emacs
-mode uses commands similar to a subset available in the
+The emacs-mode uses commands similar to a subset available in the
 .Ic emacs
 editor.
 With emacs-mode enabled, special keys can be used to modify the text
@@ -3691,11 +3692,7 @@ library.
 See
 .Xr editline 7
 for a list of the possible command bindings,
-and the default settings in
-.Ar emacs
-and
-.Ar vi
-modes.
+and the default settings in emacs and vi modes.
 Also see
 .Xr editrc 5
 for the commands that can be given to configure
@@ -3729,53 +3726,55 @@ This is done, when needed, by choosing a
 is not needed anywhere in the prompt, including in the mode
 setting sequences, any single character is acceptable,
 and assigning it to the shell parameter
-.Ev PSlit .
+.Dv PSlit .
 Then that character should be used, in pairs, in the
 prompt string.
 Between each pair of
-.Ev PSlit
+.Dv PSlit
 characters are mode setting sequences, which affect the printing
 attributes of the following (normal) characters of the prompt,
 but do not themselves appear visibly, nor change the terminal's
 cursor position.
 .Pp
 Each such sequence, that is
-.Ev PSlit
+.Dv PSlit
 character, mode setting character sequence, and another
-.Ev PSlit
+.Dv PSlit
 character, must currently be followed by at least one following
 normal prompt character, or it will be ignored.
 That is, a
-.Ev PSlit
+.Dv PSlit
 character cannot be the final character of
 .Ev PS1
 or
 .Ev PS2 ,
 nor may two
-.Ev PSlit
+.Dv PSlit
 delimited sequences appear adjacent to each other.
 Each sequence can contain as many mode altering sequences as are
 required however.
 Only the first character from
-.Ev PSlit
+.Dv PSlit
 will be used.
 When set
-.Ev PSlit
+.Dv PSlit
 should usually be set to a string containing just one
 character, then it can simply be embedded in
 .Ev PS1
 (or
 .Ev PS2 )
 as in
-.Dl PS1="${PSlit}mset${PSlit}XYZ${PSlit}mclr${PSlit}ABC"
+.Pp
+.D1 Li PS1=\*q${PSlit} Ns Ar mset\^ Ns Li ${PSlit}XYZ${PSlit} Ns Ar mclr\^ Ns Li ${PSlit}ABC\*q
+.Pp
 The prompt visible will be
 .Dq XYZABC
 with the
 .Dq XYZ
 part shown according as defined by the mode setting characters
-.Dq mset ,
+.Ar mset ,
 and then cleared again by
-.Dq mclr .
+.Ar mclr .
 See
 .Xr tput 1
 for one method to generate appropriate mode sequences.
@@ -3783,7 +3782,7 @@ Note that both parts, XYZ and ABC, must 
 character.
 .Pp
 If
-.Ev PSlit
+.Dv PSlit
 is unset, which is its initial state, or set to a null string,
 no literal character will be defined,
 and all characters of the prompt strings will be assumed
@@ -3795,13 +3794,17 @@ ignored by the terminal if received, as 
 .Xr editline 7
 is not in use, the prompt strings are simply written to the terminal.
 For example, setting:
-.Bd -literal -offset left -compact
+.\" XXX: PS1 line is too long for -offset indent
+.Bd -literal -offset left
   PSlit="$(printf\ '\e1')"
   PS1="${PSlit}$(tput\ bold\ blink)${PSlit}\e$${PSlit}$(tput\ sgr0)${PSlit}\ "
 .Ed
+.Pp
 will arrange for the primary prompt to be a bold blinking dollar sign,
 if supported by the current terminal, followed by an (ordinary) space,
-and, as the SOH (Control-A) character ('\e1') will not normally affect
+and, as the SOH (control-A) character
+.Pq Sq \e1
+will not normally affect
 a terminal, 

CVS commit: src/bin/sh

2018-03-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Mar 17 01:03:08 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Cleanup markup in the "Job Control" section.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.199 src/bin/sh/sh.1:1.200
--- src/bin/sh/sh.1:1.199	Sat Mar 17 00:03:25 2018
+++ src/bin/sh/sh.1	Sat Mar 17 01:03:08 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.199 2018/03/17 00:03:25 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.200 2018/03/17 01:03:08 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -3480,7 +3480,10 @@ is identical to
 wait 100
 .Ed
 .El
+.\"
+.\"
 .Ss Job Control
+.\"
 Each process (or set of processes) started by
 .Nm
 is created as a
@@ -3489,7 +3492,7 @@ and added to the jobs table.
 When enabled by the
 .Fl m
 option
-.Pq aka Fl o Ar monitor
+.Pq aka Fl o Cm monitor
 when the job is created,
 .Nm
 places each job (if run from the top level shell)
@@ -3514,36 +3517,38 @@ built-in command.
 Jobs are identified using either the process identifier
 of the lead process of the job (the value available in
 the special parameter
-.Sq \&$!
+.Dq Dv \&!
 if the job is started in the background), or using percent
 notation.
 Each job is given a
 .Dq job number
 which is a small integer, starting from 1, and can be
 referenced as
-.Sq \&%n
-where n is that number.
+.Dq Li \&% Ns Ar n
+where
+.Ar n
+is that number.
 Note that this applies to jobs both with and without their own process groups.
 Job numbers are shown in the output from the
 .Ic jobs
 command enclosed in brackets
 .Po
-.Sq \&[
+.Sq Li \&[
 and
-.Sq \&]
+.Sq Li \&]
 .Pc .
 Whenever the job table becomes empty, the numbers begin at one again.
 In addition, there is the concept of a current, and a previous job,
 identified by
-.Sq \&%+
+.Dq Li \&%+
 .Po
 or
-.Sq \&%%
+.Dq Li \&%%
 or even just
-.Sq \&%
+.Dq Li \&%
 .Pc ,
 and a previous job, identified by
-.Sq \&%\- .
+.Dq Li \&%\- .
 Whenever a background job is started,
 or a job is resumed in the background,
 it becomes the current job.
@@ -3553,13 +3558,13 @@ becomes the previous job.
 When the current job terminates, the previous job is
 promoted to be the current job.
 In addition the form
-.Dq %string
+.Dq Li \&% Ns Ar string\^
 finds the job for which the command starts with
-.Dq string
+.Ar string
 and the form
-.Dq %?string
+.Dq Li \&%? Ns Ar string\^
 finds the job which contains the
-.Dq string
+.Ar string
 in its command somewhere.
 Both forms require the result to be unambiguous.
 For this purpose the
@@ -3584,7 +3589,8 @@ section above, and
 .Xr kill 1 ,
 for more details of those commands.
 In addition, a job identifier
-.Pq using one of the Sq \&% forms
+(using one of the
+.Dq \&% forms )
 issued as a command, without arguments, is interpreted as
 if it had been given as the argument to the
 .Ic fg
@@ -3597,8 +3603,8 @@ To cause a background process to stop, s
 .Dv STOP
 signal, using the kill command.
 A useful function to define is
-.Bd -literal -compact
-stop() { kill -s STOP "${@:-%%}"; }
+.Bd -literal -offset indent
+stop() { kill -s STOP "${@:-%%}"; }
 .Ed
 .Pp
 The
@@ -3615,16 +3621,22 @@ and the process group identifier, for a 
 Whenever a sub-shell is created, the jobs table becomes invalid
 (the sub-shell has no children.)
 However, to enable uses like
-.Bd -literal -compact
-PID=$(jobid -p %1)
+.Bd -literal -offset indent
+PID=$(jobid -p %1)
 .Ed
+.Pp
 the table is only actually cleared in a sub-shell when needed to
 create the first job there (built-in commands run in the foreground
 do not create jobs.)
 Note that in this environment, there is no useful current job
-(%% actually refers to the sub-shell itself, but is not accessible)
-but the job which is the current job in the parent can be accessed as %\-.
+.Dq ( Li \&%%
+actually refers to the sub-shell itself, but is not accessible)
+but the job which is the current job in the parent can be accessed as
+.Dq Li \&%\- .
+.\"
+.\"
 .Ss Command Line Editing
+.\"
 When
 .Nm
 is being used interactively from a terminal, the current command



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

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:58:01 UTC 2018

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

Log Message:
Typo - add missing (


To generate a diff of this commit:
cvs rdiff -u -r1.71.16.3 -r1.71.16.4 src/sys/kern/kern_cpu.c

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

Modified files:

Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.71.16.3 src/sys/kern/kern_cpu.c:1.71.16.4
--- src/sys/kern/kern_cpu.c:1.71.16.3	Sat Mar 17 00:42:31 2018
+++ src/sys/kern/kern_cpu.c	Sat Mar 17 00:58:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.71.16.3 2018/03/17 00:42:31 pgoyette Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.71.16.4 2018/03/17 00:58:01 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.3 2018/03/17 00:42:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.4 2018/03/17 00:58:01 pgoyette Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -320,7 +320,7 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
 		NULL, NULL, NULL, NULL);
 		if (error != 0)
 			break;
-		error = (*vec_compat6_cpu_ucode_apply)
+		error = (*vec_compat6_cpu_ucode_apply)(
 		(const struct compat6_cpu_ucode *)data);
 		break;
 #endif



CVS commit: [pgoyette-compat] src/sys

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:48:20 UTC 2018

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

Log Message:
Move closer to having a compat_60 module


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/compat/common/compat_60_mod.c
cvs rdiff -u -r1.14.14.1 -r1.14.14.2 src/sys/modules/compat/Makefile
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/modules/compat_60/Makefile

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

Modified files:

Index: src/sys/compat/common/compat_60_mod.c
diff -u src/sys/compat/common/compat_60_mod.c:1.1.2.3 src/sys/compat/common/compat_60_mod.c:1.1.2.4
--- src/sys/compat/common/compat_60_mod.c:1.1.2.3	Fri Mar 16 08:10:26 2018
+++ src/sys/compat/common/compat_60_mod.c	Sat Mar 17 00:48:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_60_mod.c,v 1.1.2.3 2018/03/16 08:10:26 pgoyette Exp $	*/
+/*	$NetBSD: compat_60_mod.c,v 1.1.2.4 2018/03/17 00:48:19 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.3 2018/03/16 08:10:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.4 2018/03/17 00:48:19 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -52,8 +52,8 @@ __KERNEL_RCSID(0, "$NetBSD: compat_60_mo
 #include 
 
 static const struct syscall_package compat_60_syscalls[] = {
-	{ SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60__lwp_park },
-	{ NULL, 0, NULL }
+	{ SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },
+	{ 0, 0, NULL }
 };
 
 #ifdef _MODULE
@@ -62,7 +62,7 @@ static const struct syscall_package comp
 MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60);
 
 #ifdef CPU_UCODE
-int (*orig_compat_6_cpu_ucode)(struct compat6_cpu_ucode *);
+int (*orig_compat_6_cpu_get_version)(struct compat6_cpu_ucode *);
 int (*orig_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *);
 #endif
 
@@ -70,24 +70,10 @@ static const struct syscall_package comp
 { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },  
 NULL, 0, NULL }
 };
-
-static int
-compat_60_modcmd(modcmd_t cmd, void *arg)
-{
-	int error;
-
-	switch (cmd) {
-	case MODULE_CMD_INIT:
-		return compat_60_init();
-	case MODULE_CMD_FINI:
-		return compat_60_init();
-	default:
-		return ENOTTY;
-	}
-}
 #endif	/* _MODULE */
 
-int compat_60_init(void)
+int
+compat_60_init(void)
 {
 	int error;
 
@@ -95,21 +81,41 @@ int compat_60_init(void)
 	if (error != 0)
 		return error;
 #ifdef CPU_UCODE
-	orig_get_version = vec_compat6_cpu_ucode_get_version;
+	orig_compat_6_cpu_get_version = vec_compat6_cpu_ucode_get_version;
 	*vec_compat6_cpu_ucode_get_version = compat6_cpu_ucode_get_version;
-	orig_apply = vec_compat6_cpu_ucode_apply;
+	orig_compat6_cpu_ucode_apply = vec_compat6_cpu_ucode_apply;
 	*vec_compat6_cpu_ucode_apply = compat6_cpu_ucode_apply;
 #endif
 	return 0;
 }
 
-int compat_60_fini(void)
+int
+compat_60_fini(void)
 {
 	int error;
 
-	*vec_compat6_cpu_ucode_get_version = orig_get_version;
-	*vec_compat6_cpu_ucode_apply = orig_apply;
+#ifdef CPU_UCODE
+	*vec_compat6_cpu_ucode_get_version = orig_compat_6_cpu_get_version;
+	*vec_compat6_cpu_ucode_apply = orig_compat6_cpu_ucode_apply;
+#endif
 	error = syscall_disestablish(NULL, compat_60_syscalls);
 
 	return error;
 }
+
+#ifdef _MODULE
+static int
+compat_60_modcmd(modcmd_t cmd, void *arg)
+{
+	int error;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+		return compat_60_init();
+	case MODULE_CMD_FINI:
+		return compat_60_init();
+	default:
+		return ENOTTY;
+	}
+}
+#endif	/* _MODULE */

Index: src/sys/modules/compat/Makefile
diff -u src/sys/modules/compat/Makefile:1.14.14.1 src/sys/modules/compat/Makefile:1.14.14.2
--- src/sys/modules/compat/Makefile:1.14.14.1	Thu Mar  8 09:54:36 2018
+++ src/sys/modules/compat/Makefile	Sat Mar 17 00:48:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.14.14.1 2018/03/08 09:54:36 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.14.14.2 2018/03/17 00:48:20 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -45,4 +45,14 @@ SRCS+=	compat_13_machdep.c
 SRCS+=	compat_16_machdep.c
 .endif
 
+.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
+
+CPPFLAGS+=  -DCPU_UCODE
+
+.PATH:  ${S}/arch/x86/x86
+
+SRCS+=  cpu_ucode.c
+
+.endif
+
 .include 

Index: src/sys/modules/compat_60/Makefile
diff -u src/sys/modules/compat_60/Makefile:1.1.2.3 src/sys/modules/compat_60/Makefile:1.1.2.4
--- src/sys/modules/compat_60/Makefile:1.1.2.3	Fri Mar 16 08:10:27 2018
+++ src/sys/modules/compat_60/Makefile	Sat Mar 17 00:48:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1.2.3 2018/03/16 08:10:27 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.1.2.4 2018/03/17 00:48:20 pgoyette Exp $
 
 .include 

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

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:44:38 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_70_mod.c compat_mod.h

Log Message:
Make all the compat_xx_{init,fini} routines return an int, whether or
not they currently need it.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/compat/common/compat_70_mod.c
cvs rdiff -u -r1.1.42.2 -r1.1.42.3 src/sys/compat/common/compat_mod.h

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

Modified files:

Index: src/sys/compat/common/compat_70_mod.c
diff -u src/sys/compat/common/compat_70_mod.c:1.1.2.4 src/sys/compat/common/compat_70_mod.c:1.1.2.5
--- src/sys/compat/common/compat_70_mod.c:1.1.2.4	Fri Mar 16 08:10:26 2018
+++ src/sys/compat/common/compat_70_mod.c	Sat Mar 17 00:44:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_70_mod.c,v 1.1.2.4 2018/03/16 08:10:26 pgoyette Exp $	*/
+/*	$NetBSD: compat_70_mod.c,v 1.1.2.5 2018/03/17 00:44:38 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_70_mod.c,v 1.1.2.4 2018/03/16 08:10:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_70_mod.c,v 1.1.2.5 2018/03/17 00:44:38 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -54,18 +54,22 @@ __KERNEL_RCSID(0, "$NetBSD: compat_70_mo
 #include 
 #include 
 
-void compat_70_init(void)
+int compat_70_init(void)
 {
 
 	vec_ocreds_valid = true;
 	rtsock_70_init();
+
+	return 0;
 }
 
-void compat_70_fini(void)
+int compat_70_fini(void)
 {
 
 	rtsock_70_fini();
 	vec_ocreds_valid = false;
+
+	return 0;
 }
 
 #ifdef _MODULE
@@ -78,12 +82,10 @@ compat_70_modcmd(modcmd_t cmd, void *arg
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
-		compat_70_init();
-		return 0;
+		return compat_70_init();
 
 	case MODULE_CMD_FINI:
-		compat_70_fini();
-		return 0;
+		return compat_70_fini();
 
 	default:
 		return ENOTTY;

Index: src/sys/compat/common/compat_mod.h
diff -u src/sys/compat/common/compat_mod.h:1.1.42.2 src/sys/compat/common/compat_mod.h:1.1.42.3
--- src/sys/compat/common/compat_mod.h:1.1.42.2	Fri Mar 16 08:10:26 2018
+++ src/sys/compat/common/compat_mod.h	Sat Mar 17 00:44:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.h,v 1.1.42.2 2018/03/16 08:10:26 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.h,v 1.1.42.3 2018/03/17 00:44:38 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,8 +38,8 @@ void compat_sysctl_fini(void);
 void compat_sysctl_time(struct sysctllog **);
 void compat_sysctl_vfs(struct sysctllog **);
 
-void compat_70_init(void);
-void compat_70_fini(void);
+int compat_70_init(void);
+int compat_70_fini(void);
 
 int compat_60_init(void);
 int compat_60_fini(void);



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

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:42:31 UTC 2018

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

Log Message:
Typos - add missing )'s


To generate a diff of this commit:
cvs rdiff -u -r1.71.16.2 -r1.71.16.3 src/sys/kern/kern_cpu.c

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

Modified files:

Index: src/sys/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.71.16.2 src/sys/kern/kern_cpu.c:1.71.16.3
--- src/sys/kern/kern_cpu.c:1.71.16.2	Fri Mar 16 08:10:27 2018
+++ src/sys/kern/kern_cpu.c	Sat Mar 17 00:42:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.71.16.2 2018/03/16 08:10:27 pgoyette Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.71.16.3 2018/03/17 00:42:31 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.2 2018/03/16 08:10:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71.16.3 2018/03/17 00:42:31 pgoyette Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -142,7 +142,7 @@ static int stub_compat_6_cpu_ucode(const
 }
 int (*vec_compat6_cpu_ucode_get_version)(struct compat6_cpu_ucode *) =
 stub_compat_6_cpu_ucode;
-int (*vec_compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *) =
+int (*vec_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *) =
 stub_compat_6_cpu_ucode;
 #endif
 
@@ -320,7 +320,7 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void
 		NULL, NULL, NULL, NULL);
 		if (error != 0)
 			break;
-		error = (*vec_compat6_cpu_ucode_apply(
+		error = (*vec_compat6_cpu_ucode_apply)
 		(const struct compat6_cpu_ucode *)data);
 		break;
 #endif



CVS commit: [pgoyette-compat] src/sys/arch/x86/x86

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:41:33 UTC 2018

Modified Files:
src/sys/arch/x86/x86 [pgoyette-compat]: cpu_ucode.c

Log Message:
Don't try to include opt_*.h files if we're not being built as part
of a kernel (these files only exist for kernel builds).

Don't compile non-compat code if we're not building a module.  (This
file is built for both built-in kernel ucode support and for compat
support.)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.16.1 src/sys/arch/x86/x86/cpu_ucode.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.c
diff -u src/sys/arch/x86/x86/cpu_ucode.c:1.5 src/sys/arch/x86/x86/cpu_ucode.c:1.5.16.1
--- src/sys/arch/x86/x86/cpu_ucode.c:1.5	Wed Jan  7 07:05:48 2015
+++ src/sys/arch/x86/x86/cpu_ucode.c	Sat Mar 17 00:41:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $ */
+/* $NetBSD: cpu_ucode.c,v 1.5.16.1 2018/03/17 00:41:33 pgoyette Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,10 +29,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5 2015/01/07 07:05:48 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,v 1.5.16.1 2018/03/17 00:41:33 pgoyette Exp $");
 
+#if defined(_KERNEL_OPT)
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
+#endif
 
 #include 
 #include 
@@ -47,6 +49,8 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_ucode.c,
 
 static struct cpu_ucode_softc ucode_softc;
 
+#ifndef _MODULE
+
 int
 cpu_ucode_get_version(struct cpu_ucode_version *data)
 {
@@ -62,6 +66,7 @@ cpu_ucode_get_version(struct cpu_ucode_v
 
 	return 0;
 }
+#endif /* ! _MODULE */
 
 #ifdef COMPAT_60
 int
@@ -79,6 +84,7 @@ compat6_cpu_ucode_get_version(struct com
 }
 #endif /* COMPAT60 */
 
+#ifndef _MODULE
 int
 cpu_ucode_md_open(firmware_handle_t *fwh, int loader_version, const char *fwname)
 {
@@ -121,6 +127,7 @@ cpu_ucode_apply(const struct cpu_ucode *
 	sc->sc_blobsize = 0;
 	return error;
 }
+#endif /* ! _MODULE */
 
 #ifdef COMPAT_60
 int



CVS commit: src/sys/kern

2018-03-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 17 00:30:50 UTC 2018

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

Log Message:
CID/1427732: Don't dereference NULL execname if there is no emul_arg.
(there always is one in our emulations) from alnsn@


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/kern/exec_elf.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/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.93 src/sys/kern/exec_elf.c:1.94
--- src/sys/kern/exec_elf.c:1.93	Tue Nov  7 14:44:04 2017
+++ src/sys/kern/exec_elf.c	Fri Mar 16 20:30:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.93 2017/11/07 19:44:04 christos Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.94 2018/03/17 00:30:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005, 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.93 2017/11/07 19:44:04 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.94 2018/03/17 00:30:50 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -161,7 +161,6 @@ elf_copyargs(struct lwp *l, struct exec_
 		return error;
 
 	a = ai;
-	execname = NULL;
 
 	memset(ai, 0, sizeof(ai));
 
@@ -231,6 +230,8 @@ elf_copyargs(struct lwp *l, struct exec_
 		a++;
 
 		exec_free_emul_arg(pack);
+	} else {
+		execname = NULL;
 	}
 
 	a->a_type = AT_NULL;
@@ -241,12 +242,16 @@ elf_copyargs(struct lwp *l, struct exec_
 
 	KASSERT(vlen <= sizeof(ai));
 
-	char *path = l->l_proc->p_path;
-	execname->a_v = (uintptr_t)(*stackp + vlen);
-	len = strlen(path) + 1;
-	if ((error = copyout(path, (*stackp + vlen), len)) != 0)
-		return error;
-	len = ALIGN(len);
+	if (execname) {
+		char *path = l->l_proc->p_path;
+		execname->a_v = (uintptr_t)(*stackp + vlen);
+		len = strlen(path) + 1;
+		if ((error = copyout(path, (*stackp + vlen), len)) != 0)
+			return error;
+		len = ALIGN(len);
+	} else {
+		len = 0;
+	}
 
 	if ((error = copyout(ai, *stackp, vlen)) != 0)
 		return error;



CVS commit: src/sys/dev/ic

2018-03-16 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Mar 17 00:28:03 UTC 2018

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

Log Message:
switch handling of passthrough commands to use queue, instead of polling

should fix PR kern/53059 by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/nvme.c

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

Modified files:

Index: src/sys/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.34 src/sys/dev/ic/nvme.c:1.35
--- src/sys/dev/ic/nvme.c:1.34	Fri Mar 16 23:31:19 2018
+++ src/sys/dev/ic/nvme.c	Sat Mar 17 00:28:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.34 2018/03/16 23:31:19 jdolecek Exp $	*/
+/*	$NetBSD: nvme.c,v 1.35 2018/03/17 00:28:03 jdolecek Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.34 2018/03/16 23:31:19 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.35 2018/03/17 00:28:03 jdolecek Exp $");
 
 #include 
 #include 
@@ -929,12 +929,18 @@ nvme_ns_free(struct nvme_softc *sc, uint
 		kmem_free(identify, sizeof(*identify));
 }
 
+struct nvme_pt_state {
+	struct nvme_pt_command *pt;
+	bool finished;
+};
+
 static void
 nvme_pt_fill(struct nvme_queue *q, struct nvme_ccb *ccb, void *slot)
 {
 	struct nvme_softc *sc = q->q_sc;
 	struct nvme_sqe *sqe = slot;
-	struct nvme_pt_command *pt = ccb->ccb_cookie;
+	struct nvme_pt_state *state = ccb->ccb_cookie;
+	struct nvme_pt_command *pt = state->pt;
 	bus_dmamap_t dmap = ccb->ccb_dmamap;
 	int i;
 
@@ -976,7 +982,8 @@ static void
 nvme_pt_done(struct nvme_queue *q, struct nvme_ccb *ccb, struct nvme_cqe *cqe)
 {
 	struct nvme_softc *sc = q->q_sc;
-	struct nvme_pt_command *pt = ccb->ccb_cookie;
+	struct nvme_pt_state *state = ccb->ccb_cookie;
+	struct nvme_pt_command *pt = state->pt;
 	bus_dmamap_t dmap = ccb->ccb_dmamap;
 
 	if (pt->buf != NULL && pt->len > 0) {
@@ -995,6 +1002,18 @@ nvme_pt_done(struct nvme_queue *q, struc
 
 	pt->cpl.cdw0 = lemtoh32(>cdw0);
 	pt->cpl.flags = lemtoh16(>flags) & ~NVME_CQE_PHASE;
+
+	state->finished = true;
+
+	nvme_ccb_put(q, ccb);
+}
+
+static bool
+nvme_pt_finished(void *cookie)
+{
+	struct nvme_pt_state *state = cookie;
+
+	return state->finished;
 }
 
 static int
@@ -1004,6 +1023,7 @@ nvme_command_passthrough(struct nvme_sof
 	struct nvme_queue *q;
 	struct nvme_ccb *ccb;
 	void *buf = NULL;
+	struct nvme_pt_state state;
 	int error;
 
 	/* limit command size to maximum data transfer size */
@@ -1034,24 +1054,30 @@ nvme_command_passthrough(struct nvme_sof
 		pt->is_read ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
 	}
 
+	memset(, 0, sizeof(state));
+	state.pt = pt;
+	state.finished = false;
+
 	ccb->ccb_done = nvme_pt_done;
-	ccb->ccb_cookie = pt;
+	ccb->ccb_cookie = 
 
 	pt->cmd.nsid = nsid;
-	if (nvme_poll(sc, q, ccb, nvme_pt_fill, NVME_TIMO_PT)) {
-		error = EIO;
-		goto out;
-	}
+
+	nvme_q_submit(sc, q, ccb, nvme_pt_fill);
+
+	/* wait for completion */
+	nvme_q_wait_complete(sc, q, nvme_pt_finished, );
+	KASSERT(state.finished);
 
 	error = 0;
-out:
+
 	if (buf != NULL) {
 		if (error == 0 && pt->is_read)
 			error = copyout(buf, pt->buf, pt->len);
 kmem_free:
 		kmem_free(buf, pt->len);
 	}
-	nvme_ccb_put(q, ccb);
+
 	return error;
 }
 



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

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 17 00:11:13 UTC 2018

Modified Files:
src/sys/sys [pgoyette-compat]: cpu.h

Log Message:
Declare the function pointers as external


To generate a diff of this commit:
cvs rdiff -u -r1.42.2.1 -r1.42.2.2 src/sys/sys/cpu.h

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

Modified files:

Index: src/sys/sys/cpu.h
diff -u src/sys/sys/cpu.h:1.42.2.1 src/sys/sys/cpu.h:1.42.2.2
--- src/sys/sys/cpu.h:1.42.2.1	Fri Mar 16 08:10:27 2018
+++ src/sys/sys/cpu.h	Sat Mar 17 00:11:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.42.2.1 2018/03/16 08:10:27 pgoyette Exp $	*/
+/*	$NetBSD: cpu.h,v 1.42.2.2 2018/03/17 00:11:13 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007 YAMAMOTO Takashi,
@@ -130,9 +130,8 @@ struct cpu_ucode_softc {
 int cpu_ucode_get_version(struct cpu_ucode_version *);
 int cpu_ucode_apply(const struct cpu_ucode *);
 
-int (*vec_compat6_cpu_ucode_get_version)(struct compat6_cpu_ucode *);
-int (*vec_compat6_cpu_ucode_apply(const struct compat6_cpu_ucode *);
-stub_compat_6_cpu_ucode;
+extern int (*vec_compat6_cpu_ucode_get_version)(struct compat6_cpu_ucode *);
+extern int (*vec_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *);
 
 #ifdef COMPAT_60
 int compat6_cpu_ucode_get_version(struct compat6_cpu_ucode *);



CVS commit: src/bin/sh

2018-03-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Mar 17 00:03:26 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Use .Dv, not .Ev, to refer to LINENO, it's not an environment variable.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.198 src/bin/sh/sh.1:1.199
--- src/bin/sh/sh.1:1.198	Fri Mar 16 23:56:13 2018
+++ src/bin/sh/sh.1	Sat Mar 17 00:03:25 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.198 2018/03/16 23:56:13 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.199 2018/03/17 00:03:25 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -356,12 +356,12 @@ Force the shell to behave interactively.
 .It Fl L Em local_lineno
 When set, before a function is defined,
 causes the variable
-.Ev LINENO
+.Dv LINENO
 when used within the function,
 to refer to the line number defined such that
 first line of the function is line 1.
 When reset,
-.Ev LINENO
+.Dv LINENO
 in a function refers to the line number within the file
 within which the definition of the function occurs.
 This option defaults to
@@ -2930,7 +2930,7 @@ is an extension not implemented by most 
 See the section
 .Sx LINENO
 below for details of the effects of making the variable
-.Ev LINENO
+.Dv LINENO
 local.
 .It Ic pwd Op Fl \
 Print the current directory.
@@ -3859,7 +3859,7 @@ The string used to specify localization 
 to work with different culture-specific and language conventions.
 See
 .Xr nls 7 .
-.It Ev LINENO
+.It Dv LINENO
 The current line number in the script or function.
 See the section
 .Sx LINENO
@@ -4058,49 +4058,49 @@ that were used when building the shell w
 behaves like any other variable that has the read-only
 and un-exportable attributes set.
 .El
-.Ss Ev LINENO
-.Ev LINENO
+.Ss Dv LINENO
+.Dv LINENO
 is in many respects a normal shell variable, containing an
 integer value. and can be expanded using any of the forms
 mentioned above which can be used for any other variable.
 .Pp
-.Ev LINENO
+.Dv LINENO
 can be exported, made readonly, or unset, as with any other
 variable, with similar effects.
 Note that while being readonly prevents later attempts to
 set, or unset,
-.Ev LINENO ,
+.Dv LINENO ,
 it does not prevent its value changing.
 References to
-.Ev LINENO
+.Dv LINENO
 .Pq "when not unset"
 always obtain the current line number.
 However,
-.Ev LINENO
+.Dv LINENO
 should normally not ever be set or unset.
 In this shell setting
-.Ev LINENO
+.Dv LINENO
 reverses the effect of an earlier
 .Ic unset ,
 but does not otherwise affect the value obtained.
 If unset,
-.Ev LINENO
+.Dv LINENO
 should not normally be set again, doing so is not portable.
 If
-.Ev LINENO
+.Dv LINENO
 is set or unset, different shells act differently.
 The value of
-.Ev LINENO
+.Dv LINENO
 is never imported from the environment when the shell is
 started, though if present there, as with any other variable,
-.Ev LINENO
+.Dv LINENO
 will be exported by this shell.
 .Pp
-.Ev LINENO
+.Dv LINENO
 is set automatically by the shell to be the number of the source
 line on which it occurs.
 When exported,
-.Ev LINENO
+.Dv LINENO
 is exported with its value set to the line number it would have
 had had it been referenced on the command line of the command to
 which it is exported.
@@ -4111,14 +4111,14 @@ the user's terminal, is just another fil
 there as well.
 However note that not all shells count interactive
 lines this way, it is not wise to rely upon
-.Ev LINENO
+.Dv LINENO
 having a useful value, except in a script, or a function.
 .Pp
 The role of
-.Ev LINENO
+.Dv LINENO
 in functions is less clear.
 In some shells,
-.Ev LINENO
+.Dv LINENO
 continues to refer to the line number in the script which defines
 the function,
 in others lines count from one within the function, always (and
@@ -4142,7 +4142,7 @@ flag is not set, the shell counts lines 
 in the same continuous sequence as the lines that surround the
 function definition.
 Further, if
-.Ev LINENO
+.Dv LINENO
 is made local
 (see
 .Sx Built-ins
@@ -4150,52 +4150,52 @@ above)
 inside the function, the function can decide which
 behavior it prefers.
 If
-.Ev LINENO
+.Dv LINENO
 is made local and inherited, and not given a value, as in
-.Dl local Fl I Ev LINENO
+.Dl local Fl I Dv LINENO
 then from that point in the function,
-.Ev LINENO
+.Dv LINENO
 will give the line number as if lines are counted in sequence
 with the lines that surround the function definition (and
 any other function definitions in which this is nested.)
 If
-.Ev LINENO
+.Dv LINENO
 is made local, and in that same command, given a value, as
-.Dl local Oo Fl I Ns | Ns Fl N Oc Ev LINENO Ns = Ns Ar value
+.Dl local Oo Fl I Ns | Ns Fl N Oc Dv LINENO Ns = Ns Ar value
 then
-.Ev LINENO
+.Dv LINENO
 will give the line number as if lines are 

CVS commit: src/bin/sh

2018-03-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Mar 16 23:56:13 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Default values of PS1 and friends have only single space.  Use .Li to
typeset them to make that space more visible in PostScript output.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.197 src/bin/sh/sh.1:1.198
--- src/bin/sh/sh.1:1.197	Fri Mar 16 23:36:13 2018
+++ src/bin/sh/sh.1	Fri Mar 16 23:56:13 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.197 2018/03/16 23:36:13 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.198 2018/03/16 23:56:13 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -466,7 +466,7 @@ is also performed upon
 but not the converse.
 .It Fl x Em xtrace
 Write each command to standard error (preceded by the expanded value of
-.Dq $PS4 )
+.Li $PS4 )
 before it is executed.
 Unless
 .Fl X
@@ -3902,9 +3902,9 @@ This value is set at shell startup, igno
 any value in the environment, and then made readonly.
 .It Ev PS1
 The primary prompt string, which defaults to
-.Dq $ \  ,
+.Dq Li "$ " ,
 unless you are the superuser, in which case it defaults to
-.Dq # \  .
+.Dq Li "# " .
 This string is subject to parameter, arithmetic, and if
 enabled by setting the
 .Ic promptcmds
@@ -3922,7 +3922,7 @@ For other expansion errors, a message wi
 and the unexpanded string will then be used as the prompt.
 .It Ev PS2
 The secondary prompt string, which defaults to
-.Dq > \  .
+.Dq Li "> " .
 After expansion (as for
 .Ev PS1 )
 it is written whenever more input is required to complete the
@@ -3935,7 +3935,7 @@ before each line when execution trace
 is enabled.
 .Ev PS4
 defaults to
-.Dq + \  .
+.Dq Li "+ " .
 .It Ev PSc
 Initialized by the shell, ignoring any value from the environment,
 to a single character string, either



CVS commit: src/bin/sh

2018-03-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Mar 16 23:36:13 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Use .Bd -literal for code example.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.196 src/bin/sh/sh.1:1.197
--- src/bin/sh/sh.1:1.196	Fri Mar 16 12:06:18 2018
+++ src/bin/sh/sh.1	Fri Mar 16 23:36:13 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.196 2018/03/16 12:06:18 kre Exp $
+.\"	$NetBSD: sh.1,v 1.197 2018/03/16 23:36:13 uwe Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -176,18 +176,12 @@ and
 .Dq Ic esac
 below (these commands are described later):
 .Pp
-.Bl -item -compact -offset indent
-.It
-.Li case $- in *i*)
-.Bl -item -compact -offset indent
-.It
-.Li # commands for interactive use only
-.It
-.Li ...
-.El
-.It
-.Li esac
-.El
+.Bd -literal -offset indent
+case $- in *i*)
+# commands for interactive use only
+...
+esac
+.Ed
 .Pp
 If command line arguments besides the options have been specified, and
 neither



CVS commit: src/sys/dev/ic

2018-03-16 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Mar 16 23:31:19 UTC 2018

Modified Files:
src/sys/dev/ic: ld_nvme.c nvme.c nvmevar.h

Log Message:
refactor the locking code around DIOCGCACHE handling to be reusable
for other infrequent commands

it uses single condvar for simplicity, and uses it both when waiting
for ccb or command completion - this is fine, since usually there
will be just one such command qeueued anyway

use this to finally properly implement DIOCCACHESYNC - return only after
the command is confirmed as completed by the controller


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/ld_nvme.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ic/nvme.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/nvmevar.h

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

Modified files:

Index: src/sys/dev/ic/ld_nvme.c
diff -u src/sys/dev/ic/ld_nvme.c:1.18 src/sys/dev/ic/ld_nvme.c:1.19
--- src/sys/dev/ic/ld_nvme.c:1.18	Tue Jan 23 22:42:29 2018
+++ src/sys/dev/ic/ld_nvme.c	Fri Mar 16 23:31:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_nvme.c,v 1.18 2018/01/23 22:42:29 pgoyette Exp $	*/
+/*	$NetBSD: ld_nvme.c,v 1.19 2018/03/16 23:31:19 jdolecek Exp $	*/
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.18 2018/01/23 22:42:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.19 2018/03/16 23:31:19 jdolecek Exp $");
 
 #include 
 #include 
@@ -49,14 +49,6 @@ struct ld_nvme_softc {
 	struct nvme_softc	*sc_nvme;
 
 	uint16_t		sc_nsid;
-
-	/* getcache handling */
-	kmutex_t		sc_getcache_lock;
-	kcondvar_t		sc_getcache_cv;
-	kcondvar_t		sc_getcache_ready_cv;
-	bool			sc_getcache_waiting;
-	bool			sc_getcache_ready;
-	int			sc_getcache_result;
 };
 
 static int	ld_nvme_match(device_t, cfdata_t, void *);
@@ -73,8 +65,6 @@ static int	ld_nvme_getcache(struct ld_so
 static int	ld_nvme_ioctl(struct ld_softc *, u_long, void *, int32_t, bool);
 
 static void	ld_nvme_biodone(void *, struct buf *, uint16_t, uint32_t);
-static void	ld_nvme_syncdone(void *, struct buf *, uint16_t, uint32_t);
-static void	ld_nvme_getcache_done(void *, struct buf *, uint16_t, uint32_t);
 
 static int
 ld_nvme_match(device_t parent, cfdata_t match, void *aux)
@@ -103,10 +93,6 @@ ld_nvme_attach(device_t parent, device_t
 	sc->sc_nvme = nsc;
 	sc->sc_nsid = naa->naa_nsid;
 
-	mutex_init(>sc_getcache_lock, MUTEX_DEFAULT, IPL_SOFTBIO);
-	cv_init(>sc_getcache_cv, "nvmegcq");
-	cv_init(>sc_getcache_ready_cv, "nvmegcr");
-
 	aprint_naive("\n");
 	aprint_normal("\n");
 
@@ -203,116 +189,16 @@ ld_nvme_flush(struct ld_softc *ld, bool 
 {
 	struct ld_nvme_softc *sc = device_private(ld->sc_dv);
 
-	if (!nvme_has_volatile_write_cache(sc->sc_nvme)) {
-		/* cache not present, no value in trying to flush it */
-		return 0;
-	}
-
-	return nvme_ns_sync(sc->sc_nvme, sc->sc_nsid, sc,
-	poll ? NVME_NS_CTX_F_POLL : 0,
-	ld_nvme_syncdone);
-}
-
-static void
-ld_nvme_syncdone(void *xc, struct buf *bp, uint16_t cmd_status, uint32_t cdw0)
-{
-	/* nothing to do */
+	return nvme_ns_sync(sc->sc_nvme, sc->sc_nsid,
+	poll ? NVME_NS_CTX_F_POLL : 0);
 }
 
 static int
 ld_nvme_getcache(struct ld_softc *ld, int *addr)
 {
-	int error;
 	struct ld_nvme_softc *sc = device_private(ld->sc_dv);
 
-	/*
-	 * DPO not supported, Dataset Management (DSM) field doesn't specify
-	 * the same semantics.
-	 */ 
-	*addr = DKCACHE_FUA;
-
-	if (!nvme_has_volatile_write_cache(sc->sc_nvme)) {
-		/* cache simply not present */
-		return 0;
-	}
-
-	/*
-	 * This is admin queue request. The queue is relatively limited in size,
-	 * and this is not performance critical call, so have at most one pending
-	 * cache request at a time to avoid spurious EWOULDBLOCK failures.
-	 */ 
-	mutex_enter(>sc_getcache_lock);
-	while (sc->sc_getcache_waiting) {
-		error = cv_wait_sig(>sc_getcache_cv, >sc_getcache_lock);
-		if (error)
-			goto out;
-	}
-	sc->sc_getcache_waiting = true;
-	sc->sc_getcache_ready = false;
-	mutex_exit(>sc_getcache_lock);
-
-	error = nvme_admin_getcache(sc->sc_nvme, sc, ld_nvme_getcache_done);
-	if (error) {
-		mutex_enter(>sc_getcache_lock);
-		goto out;
-	}
-
-	mutex_enter(>sc_getcache_lock);
-	while (!sc->sc_getcache_ready) {
-		error = cv_wait_sig(>sc_getcache_ready_cv,
-		>sc_getcache_lock);
-		if (error)
-			goto out;
-	}
-
-	KDASSERT(sc->sc_getcache_ready);
-
-	if (sc->sc_getcache_result >= 0)
-		*addr |= sc->sc_getcache_result;
-	else
-		error = EINVAL;
-
-out:
-	sc->sc_getcache_waiting = false;
-
-	/* wake one of eventual waiters */
-	cv_signal(>sc_getcache_cv);
-
-	mutex_exit(>sc_getcache_lock);
-
-	return error;
-}
-
-static void
-ld_nvme_getcache_done(void *xc, struct buf *bp, uint16_t cmd_status, uint32_t cdw0)
-{
-	struct ld_nvme_softc *sc = xc;
-	uint16_t status = NVME_CQE_SC(cmd_status);
-	int result;
-
-	if (status == NVME_CQE_SC_SUCCESS) {
-		result = 0;
-

CVS commit: src/sys/dev/i2c

2018-03-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar 16 22:10:31 UTC 2018

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

Log Message:
get EEPROM data from uni_n instead of poking around in OF


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/adadc.c

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

Modified files:

Index: src/sys/dev/i2c/adadc.c
diff -u src/sys/dev/i2c/adadc.c:1.2 src/sys/dev/i2c/adadc.c:1.3
--- src/sys/dev/i2c/adadc.c:1.2	Fri Mar  9 22:27:15 2018
+++ src/sys/dev/i2c/adadc.c	Fri Mar 16 22:10:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: adadc.c,v 1.2 2018/03/09 22:27:15 macallan Exp $ */
+/* $NetBSD: adadc.c,v 1.3 2018/03/16 22:10:31 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.2 2018/03/09 22:27:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adadc.c,v 1.3 2018/03/16 22:10:31 macallan Exp $");
 
 #include 
 #include 
@@ -126,7 +126,7 @@ adadc_attach(device_t parent, device_t s
 	struct adadc_softc *sc = device_private(self);
 	struct i2c_attach_args *ia = aux;
 	envsys_data_t *s;
-	int error, ch, cpuid;
+	int error, ch;
 	uint32_t eeprom[40];
 	char loc[256];
 	int which_cpu;
@@ -186,11 +186,7 @@ adadc_attach(device_t parent, device_t s
 		ch = OF_peer(ch);
 	}
 	aprint_debug_dev(self, "monitoring CPU %d\n", which_cpu);
-	if (which_cpu == 0) {
-		cpuid = OF_finddevice("/u3/i2c/cpuid@a0");
-	} else
-		cpuid = OF_finddevice("/u3/i2c/cpuid@a2");
-	error = OF_getprop(cpuid, "cpuid", eeprom, sizeof(eeprom));
+	error = get_cpuid(which_cpu, (uint8_t *)eeprom);
 	if (error >= 0) {
 		sc->sc_diode_slope = eeprom[0x11] >> 16;
 		sc->sc_diode_offset = (int16_t)(eeprom[0x11] & 0x) << 12;



CVS commit: src/sys/sys

2018-03-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 16 17:35:13 UTC 2018

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

Log Message:
remove timestamping diff that should have not been committed.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/sys/socketvar.h

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

Modified files:

Index: src/sys/sys/socketvar.h
diff -u src/sys/sys/socketvar.h:1.147 src/sys/sys/socketvar.h:1.148
--- src/sys/sys/socketvar.h:1.147	Fri Mar 16 13:25:04 2018
+++ src/sys/sys/socketvar.h	Fri Mar 16 13:35:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: socketvar.h,v 1.147 2018/03/16 17:25:04 christos Exp $	*/
+/*	$NetBSD: socketvar.h,v 1.148 2018/03/16 17:35:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -253,9 +253,8 @@ enum uio_seg;
 
 struct	mbuf *getsombuf(struct socket *, int);
 
-#define SOOPT_TIMESTAMP(o)\
-((o) & (SO_TIMESTAMP | 0x400 /*SO_OTIMESTAMP*/ |	\
-SO_TIMESTAMPNS | SO_TIMESTAMPING))
+/* 0x400 is SO_OTIMESTAMP */
+#define SOOPT_TIMESTAMP(o) ((o) & (SO_TIMESTAMP | 0x400))
 
 /*
  * File operations on sockets.



CVS commit: src/sys

2018-03-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 16 17:25:04 UTC 2018

Modified Files:
src/sys/compat/common: uipc_syscalls_43.c
src/sys/compat/linux/common: linux_socket.c
src/sys/compat/netbsd32: netbsd32_compat_43.c
src/sys/kern: uipc_syscalls.c
src/sys/nfs: nfs_syscalls.c nfs_vfsops.c
src/sys/sys: param.h socketvar.h

Log Message:
PR/53103: Timo Buhrmester: linux emulation of sendto(2) broken

The sockargs refactoring broke it, because sockargs only works with a user
address. Added an argument to sockargs to indicate where the address is
coming from. Welcome to 8.99.14.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/compat/common/uipc_syscalls_43.c
cvs rdiff -u -r1.139 -r1.140 src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.54 -r1.55 src/sys/compat/netbsd32/netbsd32_compat_43.c
cvs rdiff -u -r1.191 -r1.192 src/sys/kern/uipc_syscalls.c
cvs rdiff -u -r1.159 -r1.160 src/sys/nfs/nfs_syscalls.c
cvs rdiff -u -r1.235 -r1.236 src/sys/nfs/nfs_vfsops.c
cvs rdiff -u -r1.558 -r1.559 src/sys/sys/param.h
cvs rdiff -u -r1.146 -r1.147 src/sys/sys/socketvar.h

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

Modified files:

Index: src/sys/compat/common/uipc_syscalls_43.c
diff -u src/sys/compat/common/uipc_syscalls_43.c:1.47 src/sys/compat/common/uipc_syscalls_43.c:1.48
--- src/sys/compat/common/uipc_syscalls_43.c:1.47	Tue Sep 13 03:01:07 2016
+++ src/sys/compat/common/uipc_syscalls_43.c	Fri Mar 16 13:25:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls_43.c,v 1.47 2016/09/13 07:01:07 martin Exp $	*/
+/*	$NetBSD: uipc_syscalls_43.c,v 1.48 2018/03/16 17:25:04 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.47 2016/09/13 07:01:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.48 2018/03/16 17:25:04 christos Exp $");
 
 #include 
 #include 
@@ -343,7 +343,8 @@ compat_43_sys_sendmsg(struct lwp *l, con
 	msg.msg_iovlen = omsg.msg_iovlen;
 	msg.msg_iov = omsg.msg_iov;
 
-	error = sockargs(, omsg.msg_name, omsg.msg_namelen, MT_SONAME);
+	error = sockargs(, omsg.msg_name, omsg.msg_namelen,
+	UIO_USERSPACE, MT_SONAME);
 	if (error != 0)
 		return (error);
 

Index: src/sys/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.139 src/sys/compat/linux/common/linux_socket.c:1.140
--- src/sys/compat/linux/common/linux_socket.c:1.139	Wed Nov 22 05:19:14 2017
+++ src/sys/compat/linux/common/linux_socket.c	Fri Mar 16 13:25:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.139 2017/11/22 10:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.140 2018/03/16 17:25:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.139 2017/11/22 10:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.140 2018/03/16 17:25:04 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -401,6 +401,7 @@ linux_sys_sendto(struct lwp *l, const st
 	struct msghdr   msg;
 	struct iovecaiov;
 	struct sockaddr_big nam;
+	struct mbuf *m;
 	int bflags;
 	int error;
 
@@ -419,9 +420,13 @@ linux_sys_sendto(struct lwp *l, const st
 		error = linux_get_sa(l, SCARG(uap, s), , SCARG(uap, to),
 		SCARG(uap, tolen));
 		if (error)
-			return (error);
-		msg.msg_name = 
-		msg.msg_namelen = SCARG(uap, tolen);
+			return error;
+		error = sockargs(, , nam.sb_len, UIO_SYSSPACE, MT_SONAME);
+		if (error)
+			return error;
+		msg.msg_flags |= MSG_NAMEMBUF;
+		msg.msg_name = m;
+		msg.msg_namelen = nam.sb_len;
 	}
 
 	msg.msg_iov = 

Index: src/sys/compat/netbsd32/netbsd32_compat_43.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_43.c:1.54 src/sys/compat/netbsd32/netbsd32_compat_43.c:1.55
--- src/sys/compat/netbsd32/netbsd32_compat_43.c:1.54	Tue Sep 13 03:01:07 2016
+++ src/sys/compat/netbsd32/netbsd32_compat_43.c	Fri Mar 16 13:25:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_43.c,v 1.54 2016/09/13 07:01:07 martin Exp $	*/
+/*	$NetBSD: netbsd32_compat_43.c,v 1.55 2018/03/16 17:25:04 christos Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.54 2016/09/13 07:01:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.55 2018/03/16 17:25:04 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_43.h"
@@ -529,7 +529,7 @@ compat_43_netbsd32_osendmsg(struct lwp *
 	msg.msg_flags = MSG_NAMEMBUF;
 
 	error = sockargs(, NETBSD32PTR64(omsg.msg_name), omsg.msg_namelen,
-	MT_SONAME);
+	UIO_USERSPACE, MT_SONAME);
 	if (error != 0)
 		goto out;
 

Index: src/sys/kern/uipc_syscalls.c
diff -u src/sys/kern/uipc_syscalls.c:1.191 

CVS commit: src/sys/net

2018-03-16 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Fri Mar 16 17:12:05 UTC 2018

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

Log Message:
Add packet filtering to tun(4) interfaces.

Calls to pfil_run_hooks() were missing in if_tun.c.  This meant that
filtering configuration could be added to e.g. /etc/npf.conf, but
would be ignored, because the filter never saw the packets.  This
change adds the required calls.

While here, correct the return value from tun_output(): it's been
returning 0 regardless of any error condition present, but will now
correctly propagate such information upward.

Thanks to maxv for guidance!

OK: christos, martin


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/net/if_tun.c

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

Modified files:

Index: src/sys/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.142 src/sys/net/if_tun.c:1.143
--- src/sys/net/if_tun.c:1.142	Wed Dec  6 07:40:16 2017
+++ src/sys/net/if_tun.c	Fri Mar 16 17:12:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.142 2017/12/06 07:40:16 ozaki-r Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.143 2018/03/16 17:12:04 tih Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions 
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.142 2017/12/06 07:40:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.143 2018/03/16 17:12:04 tih Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -555,6 +555,11 @@ tun_output(struct ifnet *ifp, struct mbu
 
 	bpf_mtap_af(ifp, dst->sa_family, m0);
 
+	if ((error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT)) != 0)
+		goto out;
+	if (m0 == NULL)
+		goto out;
+
 	switch(dst->sa_family) {
 #ifdef INET6
 	case AF_INET6:
@@ -624,10 +629,10 @@ tun_output(struct ifnet *ifp, struct mbu
 
 	mutex_exit(>tun_lock);
 out:
-	if (error && m0) {
+	if (error && m0)
 		m_freem(m0);
-	}
-	return 0;
+
+	return error;
 }
 
 static void
@@ -941,6 +946,11 @@ tunwrite(dev_t dev, struct uio *uio, int
 
 	bpf_mtap_af(ifp, dst.sa_family, top);
 
+	if ((error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN)) != 0)
+		goto out0;
+	if (top == NULL)
+		goto out0;
+
 	mutex_enter(>tun_lock);
 	if ((tp->tun_flags & TUN_INITED) == 0) {
 		/* Interface was destroyed */



CVS commit: src/sys/net

2018-03-16 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Fri Mar 16 17:00:35 UTC 2018

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

Log Message:
Fix the handling of the state returned from pfil_run_hooks().

pfil_run_hooks() invokes any registered packet filters on the packet
being handled.  It may return a (non-zero) errno, indicating that a
filter has decided that the packet should be discarded, and has freed
the mbuf.  While a non-error (0) return usually means that the packet
should be processed normally, a filter may still free the mbuf if the
packet is a fragment, and the filter is holding it for reassembly and
future evaluation.  Therefore, there must be separate tests for the
return value and for a possible discarded packet.  (See pfil(9).)

OK: christos, martin


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.124 src/sys/net/if_vlan.c:1.125
--- src/sys/net/if_vlan.c:1.124	Mon Jan 15 16:36:51 2018
+++ src/sys/net/if_vlan.c	Fri Mar 16 17:00:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.124 2018/01/15 16:36:51 maxv Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.125 2018/03/16 17:00:35 tih Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.124 2018/01/15 16:36:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.125 2018/03/16 17:00:35 tih Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1432,12 +1432,10 @@ vlan_transmit(struct ifnet *ifp, struct 
 
 	bpf_mtap(ifp, m);
 
-	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT) != 0) {
-		if (m != NULL)
-			m_freem(m);
-		error = 0;
+	if ((error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT)) != 0)
+		goto out;
+	if (m == NULL)
 		goto out;
-	}
 
 	/*
 	 * If the parent can insert the tag itself, just mark
@@ -1609,11 +1607,10 @@ vlan_input(struct ifnet *ifp, struct mbu
 	m_set_rcvif(m, >ifv_if);
 	ifv->ifv_if.if_ipackets++;
 
-	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN) != 0) {
-		if (m != NULL)
-			m_freem(m);
+	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN) != 0)
+		goto out;
+	if (m == NULL)
 		goto out;
-	}
 
 	m->m_flags &= ~M_PROMISC;
 	if_input(>ifv_if, m);



CVS commit: [netbsd-8] src/doc

2018-03-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 16 13:19:38 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #633 - #635


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.144 -r1.1.2.145 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.144 src/doc/CHANGES-8.0:1.1.2.145
--- src/doc/CHANGES-8.0:1.1.2.144	Thu Mar 15 11:28:24 2018
+++ src/doc/CHANGES-8.0	Fri Mar 16 13:19:38 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.144 2018/03/15 11:28:24 bouyer Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.145 2018/03/16 13:19:38 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -10338,3 +10338,36 @@ sys/netinet6/in6_gif.c1.91
 	Fix potential NULL dereference
 	[knakahara, ticket #632]
 
+sys/arch/x86/include/cacheinfo.h		1.23
+sys/arch/x86/include/specialreg.h		1.106-1.114
+sys/arch/x86/x86/identcpu.c			1.70
+usr.sbin/cpuctl/arch/i386.c			1.79
+
+	Add Intel cpuid 7 IBPB/STIBP Speculation Control bits.
+	Fix swapped comments for EFER LME and LMA.
+	Add Intel Deterministic Address Translation Parameter definitions.
+	[msaitoh, ticket #633]
+
+sys/arch/x86/x86/procfs_machdep.c		1.22
+
+	- Add AMD CPUID leaf 0x8008 ebx's xsaveerptr, ibpb, ibrs, stibp.
+	- Add Intel CPUID leaf 7 ebx's umip, avx512_vbmi2, gfni, vaes,
+	   vpclmulqdq, avx512_vnni and avx512_bitalg.
+	- Add Intel CPUID leaf 7 edx's avx512_4vnniw, avx512_4fmaps and
+	   arch_capabilities.
+	[msaitoh, ticket #634]
+
+sys/arch/amd64/amd64/gdt.c		1.39-1.45 (patch)
+sys/arch/amd64/amd64/amd64/machdep.c	1.284,1.287,1.288 (patch)
+sys/arch/amd64/amd64/include/param.h	1.23 (patch)
+sys/arch/amd64/include/types.h		1.53 (patch)
+sys/arch/x86/include/cpu.h		1.87 (patch)
+sys/arch/x86/include/pmap.h		1.73,1.74 (patch)
+sys/arch/x86/x86/cpu.c			1.142 (patch)
+sys/arch/x86/x86/intr.c			1.117 (partial),1.120 (patch)
+sys/arch/x86/x86/pmap.c			1.276 (patch)
+
+	Initialize ist0 in cpu_init_tss.
+	Backport __HAVE_PCPU_AREA.
+	[maxv, #635]
+



CVS commit: [netbsd-8] src/sys/arch

2018-03-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 16 13:17:56 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: gdt.c machdep.c
src/sys/arch/amd64/include [netbsd-8]: param.h types.h
src/sys/arch/x86/include [netbsd-8]: cpu.h pmap.h
src/sys/arch/x86/x86 [netbsd-8]: cpu.c intr.c pmap.c

Log Message:
Pull up the following revisions (via patch), requested by maxv in #635:

sys/arch/amd64/amd64/gdt.c  1.39-1.45 (patch)
sys/arch/amd64/amd64/amd64/machdep.c1.284,1.287,1.288 (patch)
sys/arch/amd64/amd64/include/param.h1.23 (patch)
sys/arch/amd64/include/types.h  1.53 (patch)
sys/arch/x86/include/cpu.h  1.87 (patch)
sys/arch/x86/include/pmap.h 1.73,1.74 (patch)
sys/arch/x86/x86/cpu.c  1.142 (patch)
sys/arch/x86/x86/intr.c 1.117 (partial),1.120 (patch)
sys/arch/x86/x86/pmap.c 1.276 (patch)

Initialize ist0 in cpu_init_tss.
Backport __HAVE_PCPU_AREA.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.6.1 src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.255.6.4 -r1.255.6.5 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.21 -r1.21.6.1 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.52 -r1.52.6.1 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.71.2.2 -r1.71.2.3 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.64 -r1.64.6.1 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.130.2.3 -r1.130.2.4 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.101.2.2 -r1.101.2.3 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.245.6.4 -r1.245.6.5 src/sys/arch/x86/x86/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/amd64/amd64/gdt.c
diff -u src/sys/arch/amd64/amd64/gdt.c:1.38 src/sys/arch/amd64/amd64/gdt.c:1.38.6.1
--- src/sys/arch/amd64/amd64/gdt.c:1.38	Sat Mar 25 15:05:16 2017
+++ src/sys/arch/amd64/amd64/gdt.c	Fri Mar 16 13:17:56 2018
@@ -1,6 +1,6 @@
-/*	$NetBSD: gdt.c,v 1.38 2017/03/25 15:05:16 maxv Exp $	*/
+/*	$NetBSD: gdt.c,v 1.38.6.1 2018/03/16 13:17:56 martin Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.38 2017/03/25 15:05:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.38.6.1 2018/03/16 13:17:56 martin Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -57,16 +57,24 @@ __KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.38
 #include 
 #endif
 
-#define NDYNSLOTS \
-	((MAXGDTSIZ - DYNSEL_START) / sizeof(struct sys_segment_descriptor))
+#define NSLOTS(sz)	\
+	(((sz) - DYNSEL_START) / sizeof(struct sys_segment_descriptor))
+#define NDYNSLOTS	NSLOTS(MAXGDTSIZ)
 
 typedef struct {
 	bool busy[NDYNSLOTS];
 	size_t nslots;
 } gdt_bitmap_t;
 
-size_t gdt_size;			/* size of GDT in bytes */		
-static gdt_bitmap_t gdt_bitmap;		/* bitmap of busy slots */
+/* size of GDT in bytes */
+#ifdef XEN
+const size_t gdt_size = FIRST_RESERVED_GDT_BYTE;
+#else
+const size_t gdt_size = MAXGDTSIZ;
+#endif
+
+/* bitmap of busy slots */
+static gdt_bitmap_t gdt_bitmap;
 
 #if defined(USER_LDT) || !defined(XEN)
 static void set_sys_gdt(int, void *, size_t, int, int, int);
@@ -124,27 +132,25 @@ void
 gdt_init(void)
 {
 	char *old_gdt;
-	struct vm_page *pg;
-	vaddr_t va;
 	struct cpu_info *ci = _info_primary;
 
 	/* Initialize the global values */
-	gdt_size = MINGDTSIZ;
 	memset(_bitmap.busy, 0, sizeof(gdt_bitmap.busy));
-	gdt_bitmap.nslots =
-	(gdt_size - DYNSEL_START) / sizeof(struct sys_segment_descriptor);
+	gdt_bitmap.nslots = NSLOTS(gdt_size);
 
 	old_gdt = gdtstore;
 
-	/* Allocate MAXGDTSIZ bytes of virtual memory. */
-	gdtstore = (char *)uvm_km_alloc(kernel_map, MAXGDTSIZ, 0,
-	UVM_KMF_VAONLY);
+#ifdef __HAVE_PCPU_AREA
+	/* The GDT is part of the pcpuarea */
+	gdtstore = (char *)>ent[cpu_index(ci)].gdt;
+#else
+	struct vm_page *pg;
+	vaddr_t va;
 
-	/*
-	 * Allocate only MINGDTSIZ bytes of physical memory. We will grow this
-	 * area in gdt_grow at run-time if needed.
-	 */
-	for (va = (vaddr_t)gdtstore; va < (vaddr_t)gdtstore + MINGDTSIZ;
+	/* Allocate gdt_size bytes of memory. */
+	gdtstore = (char *)uvm_km_alloc(kernel_map, gdt_size, 0,
+	UVM_KMF_VAONLY);
+	for (va = (vaddr_t)gdtstore; va < (vaddr_t)gdtstore + gdt_size;
 	va += PAGE_SIZE) {
 		pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO);
 		if (pg == NULL) {
@@ -154,6 +160,7 @@ gdt_init(void)
 		VM_PROT_READ | VM_PROT_WRITE, 0);
 	}
 	pmap_update(pmap_kernel());
+#endif
 
 	/* Copy the initial bootstrap GDT into the new area. */
 	memcpy(gdtstore, old_gdt, DYNSEL_START);
@@ -173,15 +180,15 @@ gdt_init(void)
 void
 gdt_alloc_cpu(struct cpu_info *ci)
 {
-	int max_len = MAXGDTSIZ;
-	int min_len = MINGDTSIZ;
+#ifdef __HAVE_PCPU_AREA
+	ci->ci_gdt = (union descriptor 

CVS commit: [netbsd-8] src/sys/arch/x86/x86

2018-03-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 16 13:08:14 UTC 2018

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: procfs_machdep.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #634):
sys/arch/x86/x86/procfs_machdep.c: revision 1.22
- Add AMD CPUID leaf 0x8008 ebx's xsaveerptr, ibpb, ibrs, stibp.
- Add Intel CPUID leaf 7 ebx's umip, avx512_vbmi2, gfni, vaes, vpclmulqdq,
   avx512_vnni and avx512_bitalg.
- Add Intel CPUID leaf 7 edx's avx512_4vnniw, avx512_4fmaps and
   arch_capabilities.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.3 -r1.15.2.4 src/sys/arch/x86/x86/procfs_machdep.c

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

Modified files:

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.3 src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.4
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15.2.3	Sat Jan 13 21:44:20 2018
+++ src/sys/arch/x86/x86/procfs_machdep.c	Fri Mar 16 13:08:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15.2.3 2018/01/13 21:44:20 snj Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.15.2.4 2018/03/16 13:08:14 martin Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.3 2018/01/13 21:44:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15.2.4 2018/03/16 13:08:14 martin Exp $");
 
 #include 
 #include 
@@ -151,9 +151,9 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
-	{ /* (13) 0x8008 ebx */
-	"clzero", "irperf", NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	{ /* (13) AMD 0x8008 ebx */
+	"clzero", "irperf", "xsaveerptr", NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, "ibpb", NULL, "ibrs", "stibp",
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
@@ -173,8 +173,10 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (16) 0x0007:0 ecx */
-	NULL, "avx512vbmi", NULL, "pku", "ospke", NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, "avx512_vpopcntdq", NULL,
+	NULL, "avx512vbmi", "umip", "pku",
+	"ospke", NULL, "avx512_vbmi2", NULL,
+	"gfni", "vaes", "vpclmulqdq", "avx512_vnni",
+	"avx512_bitalg", NULL, "avx512_vpopcntdq", NULL,
 	"la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 
@@ -183,6 +185,12 @@ static const char * const x86_features[]
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+	{ /* (18) Intel 0x0007 edx */
+	NULL, NULL, "avx512_4vnniw", "avx512_4fmaps", NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, "arch_capabilities", NULL, NULL},
 };
 
 static int	procfs_getonecpu(int, struct cpu_info *, char *, size_t *);
@@ -336,6 +344,14 @@ procfs_getonecpufeatures(struct cpu_info
 		diff = last - *left;
 	}
 
+	if ((cpu_vendor == CPUVENDOR_INTEL)
+	&& (ci->ci_max_cpuid >= 0x0007)) {
+		x86_cpuid(0x0007, descs);
+		procfs_getonefeatreg(descs[3], x86_features[18], p + diff,
+		left);
+		diff = last - *left;
+	}
+
 	return 0; /* XXX */
 }
 



CVS commit: [netbsd-8] src

2018-03-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 16 13:05:32 UTC 2018

Modified Files:
src/sys/arch/x86/include [netbsd-8]: cacheinfo.h specialreg.h
src/sys/arch/x86/x86 [netbsd-8]: identcpu.c
src/usr.sbin/cpuctl/arch [netbsd-8]: i386.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #633):
sys/arch/x86/include/specialreg.h: revision 1.107
sys/arch/x86/include/specialreg.h: revision 1.108
sys/arch/x86/include/specialreg.h: revision 1.109
sys/arch/x86/include/cacheinfo.h: revision 1.23
sys/arch/x86/include/specialreg.h: revision 1.110
sys/arch/x86/include/specialreg.h: revision 1.111
sys/arch/x86/include/specialreg.h: revision 1.112
sys/arch/x86/include/specialreg.h: revision 1.113
sys/arch/x86/include/specialreg.h: revision 1.114
usr.sbin/cpuctl/arch/i386.c: revision 1.79
sys/arch/x86/x86/identcpu.c: revision 1.70
sys/arch/x86/include/specialreg.h: revision 1.106

  Add comment.

  Add Intel cpuid 7 %edx IBRS(IBPB Speculation Control) and
STIBP(STIBP Speculation Control) from OpenBSD.

  Print Intel cpuid 7 %edx.

Example output of cpuctl -v identify 0:
+cpu0: 0007:  27ab  0c00
(snip)
+cpu0: SEF edx 0xc00

fix swapped comments for EFER LME and LMA

- Add Intel cpuid 7 %edx bit 29 IA32_ARCH_CAPABILITIES supported bit.
- Add comment.
  Add MSR_IA32_ARCH_CAPABILITIES definition.

  Add IA32_SPEC_CTRL MSR and IA32_PRED_CMD MSR.

Add Intel Deterministic Address Translation Parameter Leaf(0x18) definitions.

  Sort entries. No functional change.

s/CLFUSH/CLFLUSH/
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.10.1 src/sys/arch/x86/include/cacheinfo.h
cvs rdiff -u -r1.98.2.1 -r1.98.2.2 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.55.2.1 -r1.55.2.2 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.74.6.1 -r1.74.6.2 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/sys/arch/x86/include/cacheinfo.h
diff -u src/sys/arch/x86/include/cacheinfo.h:1.22 src/sys/arch/x86/include/cacheinfo.h:1.22.10.1
--- src/sys/arch/x86/include/cacheinfo.h:1.22	Wed Apr 27 08:47:03 2016
+++ src/sys/arch/x86/include/cacheinfo.h	Fri Mar 16 13:05:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cacheinfo.h,v 1.22 2016/04/27 08:47:03 msaitoh Exp $	*/
+/*	$NetBSD: cacheinfo.h,v 1.22.10.1 2018/03/16 13:05:31 martin Exp $	*/
 
 #ifndef _X86_CACHEINFO_H_
 #define _X86_CACHEINFO_H_
@@ -333,6 +333,7 @@ __CI_TBL(CAI_L3CACHE,  0xeb,   24,18 * 1
 __CI_TBL(CAI_L3CACHE,  0xec,   24,24 * 1024 * 1024, 64, NULL), \
 __CI_TBL(CAI_PREFETCH, 0xf0,0,   0, 64, NULL), \
 __CI_TBL(CAI_PREFETCH, 0xf1,0,   0,128, NULL), \
+/* 0xfe means no TLB information in CPUID leaf 2 (and use leaf 0x18) */ \
 /* 0xff means no cache information in CPUID leaf 2 (and use leaf 4) */ \
 __CI_TBL(0,   0,0,   0,  0, NULL)  \
 }

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.1 src/sys/arch/x86/include/specialreg.h:1.98.2.2
--- src/sys/arch/x86/include/specialreg.h:1.98.2.1	Tue Nov 21 15:03:20 2017
+++ src/sys/arch/x86/include/specialreg.h	Fri Mar 16 13:05:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.1 2017/11/21 15:03:20 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.2 2018/03/16 13:05:31 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -250,7 +250,7 @@
 
 /* CPUID Fn0001 %ebx */
 #define	CPUID_BRAND_INDEX	__BITS(7,0)
-#define	CPUID_CLFUSH_SIZE	__BITS(15,8)
+#define	CPUID_CLFLUSH_SIZE	__BITS(15,8)
 #define	CPUID_HTT_CORES		__BITS(23,16)
 #define	CPUID_LOCAL_APIC_ID	__BITS(31,24)
 
@@ -322,40 +322,41 @@
  *	%eax: The Maximum input value for supported subleaf.
  *	%ebx: Feature bits.
  *	%ecx: Feature bits.
+ *	%edx: Feature bits.
  */
 
 /* %ebx */
-#define CPUID_SEF_FSGSBASE	__BIT(0)
-#define CPUID_SEF_TSC_ADJUST	__BIT(1)
-#define CPUID_SEF_SGX		__BIT(2)
-#define CPUID_SEF_BMI1		__BIT(3)
-#define CPUID_SEF_HLE		__BIT(4)
-#define CPUID_SEF_AVX2		__BIT(5)
-#define CPUID_SEF_FDPEXONLY	__BIT(6)
-#define CPUID_SEF_SMEP		__BIT(7)
-#define CPUID_SEF_BMI2		__BIT(8)
-#define CPUID_SEF_ERMS		__BIT(9)
-#define CPUID_SEF_INVPCID	__BIT(10)
-#define CPUID_SEF_RTM		__BIT(11)
-#define CPUID_SEF_QM		__BIT(12)
-#define CPUID_SEF_FPUCSDS	__BIT(13)
-#define CPUID_SEF_MPX		__BIT(14)
-#define CPUID_SEF_PQE		__BIT(15)
-#define CPUID_SEF_AVX512F	__BIT(16)
-#define CPUID_SEF_AVX512DQ	__BIT(17)
-#define CPUID_SEF_RDSEED	__BIT(18)
-#define CPUID_SEF_ADX		__BIT(19)
-#define CPUID_SEF_SMAP		__BIT(20)
-#define CPUID_SEF_AVX512_IFMA	__BIT(21)
-#define CPUID_SEF_CLFLUSHOPT	__BIT(23)
-#define CPUID_SEF_CLWB		__BIT(24)
-#define CPUID_SEF_PT		__BIT(25)
-#define CPUID_SEF_AVX512PF	

CVS commit: src/sys/arch

2018-03-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 16 12:48:54 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL files.i386
src/sys/arch/i386/i386: i386_trap.S machdep.c vector.S
src/sys/arch/xen/conf: files.xen
Removed Files:
src/sys/arch/i386/i386: i386_trap_ipkdb.S ipkdb_glue.c
src/sys/arch/i386/include: ipkdb.h

Log Message:
Remove ipkdb from i386. Also remove unused references in amd64.

I already talked about doing that six months ago on port-i386@. Back then
it was as general cleanup, but now, with SVS etc, we do actually have
good reasons for simplifying the entry points.

Ok kamil@. (christos@ was in the conversation too)


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.434 -r1.435 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.390 -r1.391 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.2 -r0 src/sys/arch/i386/i386/i386_trap_ipkdb.S
cvs rdiff -u -r1.14 -r0 src/sys/arch/i386/i386/ipkdb_glue.c
cvs rdiff -u -r1.803 -r1.804 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.1 -r0 src/sys/arch/i386/include/ipkdb.h
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/xen/conf/files.xen

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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.82 src/sys/arch/amd64/conf/ALL:1.83
--- src/sys/arch/amd64/conf/ALL:1.82	Sun Feb 25 22:00:22 2018
+++ src/sys/arch/amd64/conf/ALL	Fri Mar 16 12:48:54 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.82 2018/02/25 22:00:22 pgoyette Exp $
+# $NetBSD: ALL,v 1.83 2018/03/16 12:48:54 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.82 $"
+#ident		"ALL-$Revision: 1.83 $"
 
 maxusers	64		# estimated number of users
 
@@ -118,8 +118,6 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 options 	DDB_VERBOSE_HELP
 options 	KGDB		# remote debugger
 options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
-#options 	IPKDB		# IP Kernel Debugger
-#options 	IPKDBKEY="\"Pass_phrase_to_debug_over_network\""
 makeoptions	COPTS="-O2 -fno-omit-frame-pointer"
 makeoptions	DEBUG="-g"	# compile full symbol table
 options 	SYSCALL_STATS	# per syscall counts

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.434 src/sys/arch/i386/conf/ALL:1.435
--- src/sys/arch/i386/conf/ALL:1.434	Sun Feb 25 22:00:22 2018
+++ src/sys/arch/i386/conf/ALL	Fri Mar 16 12:48:54 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.434 2018/02/25 22:00:22 pgoyette Exp $
+# $NetBSD: ALL,v 1.435 2018/03/16 12:48:54 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.434 $"
+#ident		"ALL-$Revision: 1.435 $"
 
 maxusers	64		# estimated number of users
 
@@ -116,8 +116,6 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 options 	DDB_VERBOSE_HELP
 options 	KGDB		# remote debugger
 options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
-options 	IPKDB		# IP Kernel Debugger
-options 	IPKDBKEY="\"Pass_phrase_to_debug_over_network\""
 makeoptions	DEBUG="-g"	# compile full symbol table
 options 	SYSCALL_STATS	# per syscall counts
 options 	SYSCALL_TIMES	# per syscall times

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.390 src/sys/arch/i386/conf/files.i386:1.391
--- src/sys/arch/i386/conf/files.i386:1.390	Mon Jan  8 09:33:53 2018
+++ src/sys/arch/i386/conf/files.i386	Fri Mar 16 12:48:54 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.390 2018/01/08 09:33:53 maxv Exp $
+#	$NetBSD: files.i386,v 1.391 2018/03/16 12:48:54 maxv Exp $
 #
 # new style config file for i386 architecture
 #
@@ -65,7 +65,6 @@ file	kern/subr_disk_mbr.c		disk
 file	kern/subr_spldebug.c		spldebug
 file	arch/i386/i386/gdt.c
 file	arch/i386/i386/i386func.S
-file	arch/i386/i386/ipkdb_glue.c	ipkdb
 file	arch/i386/i386/kobj_machdep.c	modular
 file	arch/i386/i386/machdep.c
 file 	arch/i386/i386/longrun.c

Index: src/sys/arch/i386/i386/i386_trap.S
diff -u src/sys/arch/i386/i386/i386_trap.S:1.12 src/sys/arch/i386/i386/i386_trap.S:1.13
--- src/sys/arch/i386/i386/i386_trap.S:1.12	Wed Aug 30 15:34:57 2017
+++ src/sys/arch/i386/i386/i386_trap.S	Fri Mar 16 12:48:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_trap.S,v 1.12 2017/08/30 15:34:57 maxv Exp $	*/
+/*	$NetBSD: i386_trap.S,v 1.13 2018/03/16 12:48:54 maxv Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 

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

2018-03-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 16 12:21:50 UTC 2018

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

Log Message:
Remove the prototypes for cpu_uarea_*, I removed these functions two
minutes ago.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/amd64/include/cpu.h

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

Modified files:

Index: src/sys/arch/amd64/include/cpu.h
diff -u src/sys/arch/amd64/include/cpu.h:1.61 src/sys/arch/amd64/include/cpu.h:1.62
--- src/sys/arch/amd64/include/cpu.h:1.61	Sun Sep 17 09:41:35 2017
+++ src/sys/arch/amd64/include/cpu.h	Fri Mar 16 12:21:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.61 2017/09/17 09:41:35 maxv Exp $	*/
+/*	$NetBSD: cpu.h,v 1.62 2018/03/16 12:21:50 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -88,9 +88,6 @@ cpu_set_curpri(int pri)
 #define CLKF_INTR(frame)	(curcpu()->ci_idepth > 0)
 #define LWP_PC(l)		((l)->l_md.md_regs->tf_rip)
 
-void	*cpu_uarea_alloc(bool);
-bool	cpu_uarea_free(void *);
-
 #endif	/* _KERNEL */
 
 #else	/*	__x86_64__	*/



CVS commit: src/sys/arch

2018-03-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 16 12:19:35 UTC 2018

Modified Files:
src/sys/arch/amd64/include: types.h
src/sys/arch/x86/x86: vm_machdep.c

Log Message:
Remove the __HAVE_CPU_UAREA_ROUTINES code from x86.

It was available only in amd64, and I disabled it a few months ago in
order to support SVS. Regardless of SVS this option was questionable,
since it made stack overflows more difficult to detect.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/x86/vm_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/include/types.h
diff -u src/sys/arch/amd64/include/types.h:1.54 src/sys/arch/amd64/include/types.h:1.55
--- src/sys/arch/amd64/include/types.h:1.54	Thu Jan 11 09:00:04 2018
+++ src/sys/arch/amd64/include/types.h	Fri Mar 16 12:19:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.54 2018/01/11 09:00:04 maxv Exp $	*/
+/*	$NetBSD: types.h,v 1.55 2018/03/16 12:19:35 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -106,7 +106,6 @@ typedef	unsigned char		__cpu_simple_lock
 #define	__HAVE_DIRECT_MAP 1
 #define	__HAVE_MM_MD_DIRECT_MAPPED_IO
 #define	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
-/* #define	__HAVE_CPU_UAREA_ROUTINES */
 #if !defined(NO_PCI_MSI_MSIX)
 #define	__HAVE_PCI_MSI_MSIX
 #endif

Index: src/sys/arch/x86/x86/vm_machdep.c
diff -u src/sys/arch/x86/x86/vm_machdep.c:1.32 src/sys/arch/x86/x86/vm_machdep.c:1.33
--- src/sys/arch/x86/x86/vm_machdep.c:1.32	Thu Jan 18 07:25:34 2018
+++ src/sys/arch/x86/x86/vm_machdep.c	Fri Mar 16 12:19:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.32 2018/01/18 07:25:34 maxv Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.33 2018/03/16 12:19:35 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.32 2018/01/18 07:25:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.33 2018/03/16 12:19:35 maxv Exp $");
 
 #include "opt_mtrr.h"
 
@@ -367,58 +367,3 @@ vunmapbuf(struct buf *bp, vsize_t len)
 	bp->b_data = bp->b_saveaddr;
 	bp->b_saveaddr = 0;
 }
-
-#ifdef __HAVE_CPU_UAREA_ROUTINES
-void *
-cpu_uarea_alloc(bool system)
-{
-	struct pglist pglist;
-	int error;
-
-	/*
-	 * Allocate a new physically contiguous uarea which can be
-	 * direct-mapped.
-	 */
-	error = uvm_pglistalloc(USPACE, 0, ptoa(physmem), 0, 0, , 1, 1);
-	if (error) {
-		return NULL;
-	}
-
-	/*
-	 * Get the physical address from the first page.
-	 */
-	const struct vm_page * const pg = TAILQ_FIRST();
-	KASSERT(pg != NULL);
-	const paddr_t pa = VM_PAGE_TO_PHYS(pg);
-
-	/*
-	 * We need to return a direct-mapped VA for the pa.
-	 */
-
-	return (void *)PMAP_MAP_POOLPAGE(pa);
-}
-
-/*
- * Return true if we freed it, false if we didn't.
- */
-bool
-cpu_uarea_free(void *vva)
-{
-	vaddr_t va = (vaddr_t) vva;
-
-	if (va < PMAP_DIRECT_BASE || va >= PMAP_DIRECT_END) {
-		return false;
-	}
-
-	/*
-	 * Since the pages are physically contiguous, the vm_page structures
-	 * will be as well.
-	 */
-	struct vm_page *pg = PHYS_TO_VM_PAGE(PMAP_UNMAP_POOLPAGE(va));
-	KASSERT(pg != NULL);
-	for (size_t i = 0; i < UPAGES; i++, pg++) {
-		uvm_pagefree(pg);
-	}
-	return true;
-}
-#endif /* __HAVE_CPU_UAREA_ROUTINES */



CVS commit: src/sys/arch/hpcarm/hpcarm

2018-03-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Mar 16 12:10:16 UTC 2018

Modified Files:
src/sys/arch/hpcarm/hpcarm: hpc_machdep.c

Log Message:
fix compile error with options BOOT_DUMP


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/hpcarm/hpcarm/hpc_machdep.c

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

Modified files:

Index: src/sys/arch/hpcarm/hpcarm/hpc_machdep.c
diff -u src/sys/arch/hpcarm/hpcarm/hpc_machdep.c:1.104 src/sys/arch/hpcarm/hpcarm/hpc_machdep.c:1.105
--- src/sys/arch/hpcarm/hpcarm/hpc_machdep.c:1.104	Sat Sep 13 18:09:50 2014
+++ src/sys/arch/hpcarm/hpcarm/hpc_machdep.c	Fri Mar 16 12:10:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpc_machdep.c,v 1.104 2014/09/13 18:09:50 matt Exp $	*/
+/*	$NetBSD: hpc_machdep.c,v 1.105 2018/03/16 12:10:16 ryo Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpc_machdep.c,v 1.104 2014/09/13 18:09:50 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpc_machdep.c,v 1.105 2018/03/16 12:10:16 ryo Exp $");
 
 #include "opt_cputypes.h"
 #include "opt_kloader.h"
@@ -303,7 +303,7 @@ initarm(int argc, char **argv, struct bo
 }
 
 #ifdef BOOT_DUMP
-static void
+void
 dumppages(char *start, int nbytes)
 {
 	char *p = start;



CVS commit: src/bin/sh

2018-03-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Mar 16 12:06:18 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Markup fixes (partly from uwe@) and change some tabs to spaces, they
seem to work better...


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.195 src/bin/sh/sh.1:1.196
--- src/bin/sh/sh.1:1.195	Fri Mar 16 11:53:57 2018
+++ src/bin/sh/sh.1	Fri Mar 16 12:06:18 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.195 2018/03/16 11:53:57 kre Exp $
+.\"	$NetBSD: sh.1,v 1.196 2018/03/16 12:06:18 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -286,11 +286,11 @@ Read commands from the
 .Ar command_string
 operand instead of, or in addition to, from the standard input.
 Special parameter
-.Dv 0	\" $0
+.Dv 0 \" $0	(comments like this for searching sources only)
 will be set from the
 .Ar command_name
 operand if given, and the positional parameters
-.Li ( 1 , 2 ,
+.Dv ( 1 , 2 ,
 etc.)
 set from the remaining argument operands, if any.
 .Fl c
@@ -1005,7 +1005,7 @@ They each are executed in a different wa
 .Pp
 When a shell function is executed, all of the shell positional parameters
 (note: excluding
-.Li 0 ,	\" $0
+.Li 0 , \" $0
 which is a special, not positional, parameter, and remains unchanged)
 are set to the arguments of the shell function.
 The variables which are explicitly placed in the environment of
@@ -1593,7 +1593,7 @@ Without the braces, a digit following
 .Dq $
 can only refer to one of the first 9 positional parameters,
 or the special parameter
-.Dv 0 .	\" $0
+.Dv 0 . \" $0
 The word
 .Dq Li $10
 is treated identically to
@@ -1618,7 +1618,7 @@ variable, or by a
 if
 .Ev IFS
 is unset.
-.It Dv @	\" $@
+.It Dv @ \" $@
 Expands to the positional parameters, starting from one.
 When the expansion occurs within double quotes, each positional
 parameter expands as a separate argument.
@@ -1667,7 +1667,7 @@ will be unset.
 Once set, the value of
 .Dq Dv \&!
 will be retained until another background command is started.
-.It Dv 0 No (zero)	\" $0
+.It Dv 0 No (zero) \" $0
 Expands to the name of the shell or shell script.
 .El
 .\"
@@ -1684,7 +1684,7 @@ It is only field splitting or pathname e
 create multiple fields from a single word.
 The single exception to this
 rule is the expansion of the special parameter
-.Dv @	\" $@
+.Dv @ \" $@
 within double quotes, as was described above.
 .Pp
 The order of word expansion is:
@@ -1765,7 +1765,7 @@ pathname expansion is not performed on t
 .It
 field splitting is not performed on the results of the
 expansion, with the exception of the special rules for
-.Dv @ .	\" $@
+.Dv @ . \" $@
 .El
 .Pp
 In addition, a parameter expansion where braces are used,
@@ -1839,7 +1839,7 @@ rather than regular expression notation,
 If parameter is
 .Dv *
 or
-.Dv @ ,	\" $@
+.Dv @ , \" $@
 the result of the expansion is unspecified.
 Enclosing the full parameter expansion string in double quotes does not
 cause the following four varieties of pattern characters to be quoted,
@@ -2877,15 +2877,15 @@ command has run, the values and attribut
 be altered, and later, when the function completes, be restored.
 .Pp
 Note that the positional parameters
-.Li 1 ,	\" $1
-.Li 2 ,	\" $2
+.Dv 1 ,  \" $1
+.Dv 2 ,  \" $2
 \&... (see
 .Sx Positional Parameters ) ,
 and the special parameters
-.Li 

CVS commit: src/bin/sh

2018-03-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Mar 16 11:53:57 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Restore some (*roff) comments deleted in previous (partially unshave
the yak) for which the purpose was misunderstood.   But trim one more hair.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.194 src/bin/sh/sh.1:1.195
--- src/bin/sh/sh.1:1.194	Fri Mar 16 11:19:24 2018
+++ src/bin/sh/sh.1	Fri Mar 16 11:53:57 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.194 2018/03/16 11:19:24 kre Exp $
+.\"	$NetBSD: sh.1,v 1.195 2018/03/16 11:53:57 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -286,7 +286,7 @@ Read commands from the
 .Ar command_string
 operand instead of, or in addition to, from the standard input.
 Special parameter
-.Dv 0
+.Dv 0	\" $0
 will be set from the
 .Ar command_name
 operand if given, and the positional parameters
@@ -1005,7 +1005,7 @@ They each are executed in a different wa
 .Pp
 When a shell function is executed, all of the shell positional parameters
 (note: excluding
-.Li 0 ,
+.Li 0 ,	\" $0
 which is a special, not positional, parameter, and remains unchanged)
 are set to the arguments of the shell function.
 The variables which are explicitly placed in the environment of
@@ -1593,7 +1593,7 @@ Without the braces, a digit following
 .Dq $
 can only refer to one of the first 9 positional parameters,
 or the special parameter
-.Dv 0 .
+.Dv 0 .	\" $0
 The word
 .Dq Li $10
 is treated identically to
@@ -1618,13 +1618,13 @@ variable, or by a
 if
 .Ev IFS
 is unset.
-.It Dv @
+.It Dv @	\" $@
 Expands to the positional parameters, starting from one.
 When the expansion occurs within double quotes, each positional
 parameter expands as a separate argument.
 If there are no positional parameters, the
 expansion of @ generates zero arguments, even when
-.Dv @
+.Dv $@
 is double-quoted.
 What this basically means, for example, is
 if
@@ -1667,7 +1667,7 @@ will be unset.
 Once set, the value of
 .Dq Dv \&!
 will be retained until another background command is started.
-.It Dv 0 No (zero)
+.It Dv 0 No (zero)	\" $0
 Expands to the name of the shell or shell script.
 .El
 .\"
@@ -1684,7 +1684,7 @@ It is only field splitting or pathname e
 create multiple fields from a single word.
 The single exception to this
 rule is the expansion of the special parameter
-.Dv @
+.Dv @	\" $@
 within double quotes, as was described above.
 .Pp
 The order of word expansion is:
@@ -1765,7 +1765,7 @@ pathname expansion is not performed on t
 .It
 field splitting is not performed on the results of the
 expansion, with the exception of the special rules for
-.Dv @ .
+.Dv @ .	\" $@
 .El
 .Pp
 In addition, a parameter expansion where braces are used,
@@ -1839,7 +1839,7 @@ rather than regular expression notation,
 If parameter is
 .Dv *
 or
-.Dv @ ,
+.Dv @ ,	\" $@
 the result of the expansion is unspecified.
 Enclosing the full parameter expansion string in double quotes does not
 cause the following four varieties of pattern characters to be quoted,
@@ -2877,15 +2877,15 @@ command has run, the values and attribut
 be altered, and later, when the function completes, be restored.
 .Pp
 Note that the positional parameters
-.Li 1 ,
-.Li 2 ,
+.Li 1 ,	\" $1
+.Li 2 ,	\" $2
 \&... (see
 .Sx Positional Parameters ) ,
 and the special parameters
-.Li 

CVS commit: [pgoyette-compat] src/share/man/man9

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 16 11:52:54 UTC 2018

Modified Files:
src/share/man/man9 [pgoyette-compat]: module.9

Log Message:
Typo - missing 's'


To generate a diff of this commit:
cvs rdiff -u -r1.42.2.5 -r1.42.2.6 src/share/man/man9/module.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/module.9
diff -u src/share/man/man9/module.9:1.42.2.5 src/share/man/man9/module.9:1.42.2.6
--- src/share/man/man9/module.9:1.42.2.5	Thu Mar 15 10:00:47 2018
+++ src/share/man/man9/module.9	Fri Mar 16 11:52:53 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: module.9,v 1.42.2.5 2018/03/15 10:00:47 pgoyette Exp $
+.\"	$NetBSD: module.9,v 1.42.2.6 2018/03/16 11:52:53 pgoyette Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -166,7 +166,7 @@ For example,
 	MODULE_WITH_ALIASES(MODULE_CLASS_MISC, pets, NULL, _pets);
 .Ed
 .Pp
-If there are no required modules or aliases, these argument should be
+If there are no required modules or aliases, these arguments should be
 specified as
 .Dv NULL .
 .Pp



CVS commit: src/bin/sh

2018-03-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Mar 16 11:19:24 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Give the yak a quick trim and shave, and make one or two minor
wording changes (which are, hopefully, improvements).


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.193 src/bin/sh/sh.1:1.194
--- src/bin/sh/sh.1:1.193	Thu Mar 15 01:20:43 2018
+++ src/bin/sh/sh.1	Fri Mar 16 11:19:24 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.193 2018/03/15 01:20:43 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.194 2018/03/16 11:19:24 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -286,11 +286,11 @@ Read commands from the
 .Ar command_string
 operand instead of, or in addition to, from the standard input.
 Special parameter
-.Dv 0 \" $0
+.Dv 0
 will be set from the
 .Ar command_name
 operand if given, and the positional parameters
-.Li ( $1 , $2 ,
+.Li ( 1 , 2 ,
 etc.)
 set from the remaining argument operands, if any.
 .Fl c
@@ -1004,10 +1004,10 @@ in its name is always a normal program.
 They each are executed in a different way.
 .Pp
 When a shell function is executed, all of the shell positional parameters
-(except
-.Li $0 ,
-which remains unchanged) are set to the arguments of the shell
-function.
+(note: excluding
+.Li 0 ,
+which is a special, not positional, parameter, and remains unchanged)
+are set to the arguments of the shell function.
 The variables which are explicitly placed in the environment of
 the command (by placing assignments to them before the function name) are
 made local to the function and are set to the values given,
@@ -1016,7 +1016,8 @@ Then the command given in the function d
 The positional parameters, and local variables, are restored to
 their original values when the command completes.
 This all occurs within the current shell, and the function
-can alter variables, or other settings, of the shell.
+can alter variables, or other settings, of the shell, but
+not the positional parameters nor their related special parameters.
 .Pp
 Shell built-ins are executed internally to the shell, without spawning a
 new process.
@@ -1592,7 +1593,7 @@ Without the braces, a digit following
 .Dq $
 can only refer to one of the first 9 positional parameters,
 or the special parameter
-.Dv 0 . \" $0
+.Dv 0 .
 The word
 .Dq Li $10
 is treated identically to
@@ -1683,7 +1684,7 @@ It is only field splitting or pathname e
 create multiple fields from a single word.
 The single exception to this
 rule is the expansion of the special parameter
-.Dv @ \" $@
+.Dv @
 within double quotes, as was described above.
 .Pp
 The order of word expansion is:
@@ -1764,7 +1765,7 @@ pathname expansion is not performed on t
 .It
 field splitting is not performed on the results of the
 expansion, with the exception of the special rules for
-.Dv @ . \" $@
+.Dv @ .
 .El
 .Pp
 In addition, a parameter expansion where braces are used,
@@ -2875,16 +2876,16 @@ but while the function is active, after 
 command has run, the values and attributes of the variables might
 be altered, and later, when the function completes, be restored.
 .Pp
-Note that the parameters
-.Li $1 ,
-.Li $2 ,
+Note that the positional parameters
+.Li 1 ,
+.Li 2 ,
 \&... (see
 .Sx Positional Parameters ) ,
+and the special parameters
+.Li 

CVS commit: src/share/man/man4

2018-03-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Mar 16 10:42:20 UTC 2018

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

Log Message:
Improve wording. Fix a Cm argument.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/share/man/man4/ddb.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/ddb.4
diff -u src/share/man/man4/ddb.4:1.176 src/share/man/man4/ddb.4:1.177
--- src/share/man/man4/ddb.4:1.176	Fri Mar 16 04:44:51 2018
+++ src/share/man/man4/ddb.4	Fri Mar 16 10:42:20 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ddb.4,v 1.176 2018/03/16 04:44:51 ozaki-r Exp $
+.\"	$NetBSD: ddb.4,v 1.177 2018/03/16 10:42:20 wiz Exp $
 .\"
 .\" Copyright (c) 1997 - 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -250,7 +250,7 @@ is taken to be 1 for printing commands, 
 .Pp
 The syntax:
 .Bd -ragged -offset indent
-.Cm , Ns Ar count
+.Cm \&, Ns Ar count
 .Ed
 .Pp
 repeats the previous command, just as a blank line does, but with
@@ -560,8 +560,8 @@ for more information on callouts.
 Display details information about all active locks.
 If
 .Cm /t
-is specified, stack traces of LWPs holding locks are printed additionally.
-This command is useful only if a kernel is compiled with
+is specified, stack traces of LWPs holding locks are also printed.
+This command is only useful if a kernel is compiled with
 .Cd options LOCKDEBUG .
 .It Ic show all pages
 Display basic information about all physical pages managed by the VM system.
@@ -655,11 +655,11 @@ be displayed.
 .It Ic show lock Ar address
 Display information about a lock at
 .Ar address .
-This command is useful only if a kernel is compiled with
+This command is only useful if a kernel is compiled with
 .Cd options LOCKDEBUG .
 .It Ic show lockstat
-Display information about statistics of locks.
-This command is useful only if a kernel is compiled with
+Display information about lock statistics.
+This command is only useful if a kernel is compiled with
 .Cd options LOCKDEBUG .
 .It Ic show map Ns Oo Cm /f Oc Ar address
 Print the vm_map at



CVS commit: src/sys/arch/sparc/sparc

2018-03-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar 16 09:29:24 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc: locore.s

Log Message:
remove obsolete ovbcopy().  it may be the very slightly bit
faster for larger copies, but slower for smaller ones.
i don't see any major benefit in keeping this code.

this is the final ovbcopy() reference in src.  you're welcome :-)


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/sys/arch/sparc/sparc/locore.s

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

Modified files:

Index: src/sys/arch/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.269 src/sys/arch/sparc/sparc/locore.s:1.270
--- src/sys/arch/sparc/sparc/locore.s:1.269	Sat Nov 25 04:11:37 2017
+++ src/sys/arch/sparc/sparc/locore.s	Fri Mar 16 09:29:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.269 2017/11/25 04:11:37 maya Exp $	*/
+/*	$NetBSD: locore.s,v 1.270 2018/03/16 09:29:24 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -5331,7 +5331,6 @@ ENTRY(qzero)
 
 ENTRY(bcopy)
 	cmp	%o2, BCOPY_SMALL
-Lbcopy_start:
 	bge,a	Lbcopy_fancy	! if >= this many, go be fancy.
 	btst	7, %o0		! (part of being fancy)
 
@@ -5494,164 +5493,6 @@ Lbcopy_done:
 1:
 	retl
 	 stb	%o4,[%o1]
-/*
- * ovbcopy(src, dst, len): like bcopy, but regions may overlap.
- */
-ENTRY(ovbcopy)
-	cmp	%o0, %o1	! src < dst?
-	bgeu	Lbcopy_start	! no, go copy forwards as via bcopy
-	cmp	%o2, BCOPY_SMALL! (check length for doublecopy first)
-
-	/*
-	 * Since src comes before dst, and the regions might overlap,
-	 * we have to do the copy starting at the end and working backwards.
-	 */
-	add	%o2, %o0, %o0	! src += len
-	add	%o2, %o1, %o1	! dst += len
-	bge,a	Lback_fancy	! if len >= BCOPY_SMALL, go be fancy
-	btst	3, %o0
-
-	/*
-	 * Not much to copy, just do it a byte at a time.
-	 */
-	deccc	%o2		! while (--len >= 0)
-	bl	1f
-	 .empty
-0:
-	dec	%o0		!	*--dst = *--src;
-	ldsb	[%o0], %o4
-	dec	%o1
-	deccc	%o2
-	bge	0b
-	stb	%o4, [%o1]
-1:
-	retl
-	nop
-
-	/*
-	 * Plenty to copy, try to be optimal.
-	 * We only bother with word/halfword/byte copies here.
-	 */
-Lback_fancy:
-!	btst	3, %o0		! done already
-	bnz	1f		! if ((src & 3) == 0 &&
-	btst	3, %o1		! (dst & 3) == 0)
-	bz,a	Lback_words	!	goto words;
-	dec	4, %o2		! (done early for word copy)
-
-1:
-	/*
-	 * See if the low bits match.
-	 */
-	xor	%o0, %o1, %o3	! t = src ^ dst;
-	btst	1, %o3
-	bz,a	3f		! if (t & 1) == 0, can do better
-	btst	1, %o0
-
-	/*
-	 * Nope; gotta do byte copy.
-	 */
-2:
-	dec	%o0		! do {
-	ldsb	[%o0], %o4	!	*--dst = *--src;
-	dec	%o1
-	deccc	%o2		! } while (--len != 0);
-	bnz	2b
-	stb	%o4, [%o1]
-	retl
-	nop
-
-3:
-	/*
-	 * Can do halfword or word copy, but might have to copy 1 byte first.
-	 */
-!	btst	1, %o0		! done earlier
-	bz,a	4f		! if (src & 1) {	/* copy 1 byte */
-	btst	2, %o3		! (done early)
-	dec	%o0		!	*--dst = *--src;
-	ldsb	[%o0], %o4
-	dec	%o1
-	stb	%o4, [%o1]
-	dec	%o2		!	len--;
-	btst	2, %o3		! }
-
-4:
-	/*
-	 * See if we can do a word copy ((t&2) == 0).
-	 */
-!	btst	2, %o3		! done earlier
-	bz,a	6f		! if (t & 2) == 0, can do word copy
-	btst	2, %o0		! (src&2, done early)
-
-	/*
-	 * Gotta do halfword copy.
-	 */
-	dec	2, %o2		! len -= 2;
-5:
-	dec	2, %o0		! do {
-	ldsh	[%o0], %o4	!	src -= 2;
-	dec	2, %o1		!	dst -= 2;
-	deccc	2, %o0		!	*(short *)dst = *(short *)src;
-	bge	5b		! } while ((len -= 2) >= 0);
-	sth	%o4, [%o1]
-	b	Lback_mopb	! goto mop_up_byte;
-	btst	1, %o2		! (len&1, done early)
-
-6:
-	/*
-	 * We can do word copies, but we might have to copy
-	 * one halfword first.
-	 */
-!	btst	2, %o0		! done already
-	bz	7f		! if (src & 2) {
-	dec	4, %o2		! (len -= 4, done early)
-	dec	2, %o0		!	src -= 2, dst -= 2;
-	ldsh	[%o0], %o4	!	*(short *)dst = *(short *)src;
-	dec	2, %o1
-	sth	%o4, [%o1]
-	dec	2, %o2		!	len -= 2;
-! }
-
-7:
-Lback_words:
-	/*
-	 * Do word copies (backwards), then mop up trailing halfword
-	 * and byte if any.
-	 */
-!	dec	4, %o2		! len -= 4, done already
-0:! do {
-	dec	4, %o0		!	src -= 4;
-	dec	4, %o1		!	src -= 4;
-	ld	[%o0], %o4	!	*(int *)dst = *(int *)src;
-	deccc	4, %o2		! } while ((len -= 4) >= 0);
-	bge	0b
-	st	%o4, [%o1]
-
-	/*
-	 * Check for trailing shortword.
-	 */
-	btst	2, %o2		! if (len & 2) {
-	bz,a	1f
-	btst	1, %o2		! (len&1, done early)
-	dec	2, %o0		!	src -= 2, dst -= 2;
-	ldsh	[%o0], %o4	!	*(short *)dst = *(short *)src;
-	dec	2, %o1
-	sth	%o4, [%o1]	! }
-	btst	1, %o2
-
-	/*
-	 * Check for trailing byte.
-	 */
-1:
-Lback_mopb:
-!	btst	1, %o2		! (done already)
-	bnz,a	1f		! if (len & 1) {
-	ldsb	[%o0 - 1], %o4	!	b = src[-1];
-	retl
-	nop
-1:
-	retl			!	dst[-1] = b;
-	stb	%o4, [%o1 - 1]	! }
 
 /*
  * kcopy() is exactly like bcopy except that it set pcb_onfault such that



CVS commit: src/sys/arch/amd64/amd64

2018-03-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 16 08:48:34 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: db_machdep.c vector.S

Log Message:
Rename "handle_" -> "Xhandle_", and add the function names (introduced by
SVS) in db_machdep.c.

Should fix the DDB part of PR/53060.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/amd64/db_machdep.c
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/amd64/amd64/vector.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/db_machdep.c
diff -u src/sys/arch/amd64/amd64/db_machdep.c:1.5 src/sys/arch/amd64/amd64/db_machdep.c:1.6
--- src/sys/arch/amd64/amd64/db_machdep.c:1.5	Sun Feb 11 08:27:18 2018
+++ src/sys/arch/amd64/amd64/db_machdep.c	Fri Mar 16 08:48:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.5 2018/02/11 08:27:18 maxv Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.6 2018/03/16 08:48:34 maxv Exp $	*/
 
 /*
  * Mach Operating System
@@ -26,7 +26,7 @@
  * rights to redistribute these changes.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.5 2018/02/11 08:27:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.6 2018/03/16 08:48:34 maxv Exp $");
 
 #include 
 #include 
@@ -213,11 +213,13 @@ db_frame_info(long *frame, db_addr_t cal
 		if (!strcmp(name, "trap")) {
 			*is_trap = TRAP;
 			narg = 0;
-		} else if (!strcmp(name, "syscall")) {
+		} else if (!strcmp(name, "syscall") ||
+		!strcmp(name, "handle_syscall")) {
 			*is_trap = SYSCALL;
 			narg = 0;
 		} else if (name[0] == 'X') {
 			if (!strncmp(name, "Xintr", 5) ||
+			!strncmp(name, "Xhandle", 7) ||
 			!strncmp(name, "Xresume", 7) ||
 			!strncmp(name, "Xstray", 6) ||
 			!strncmp(name, "Xhold", 5) ||

Index: src/sys/arch/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.60 src/sys/arch/amd64/amd64/vector.S:1.61
--- src/sys/arch/amd64/amd64/vector.S:1.60	Sat Feb 17 19:26:20 2018
+++ src/sys/arch/amd64/amd64/vector.S	Fri Mar 16 08:48:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.60 2018/02/17 19:26:20 maxv Exp $	*/
+/*	$NetBSD: vector.S,v 1.61 2018/03/16 08:48:34 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -114,7 +114,7 @@ IDTVEC(recurse_lapic_ipi)
 	INTR_RECURSE_ENTRY
 	jmp	1f
 IDTVEC_END(recurse_lapic_ipi)
-NENTRY(handle_x2apic_ipi)
+IDTVEC(handle_x2apic_ipi)
 	movl	$(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
 	xorl	%eax,%eax
 	xorl	%edx,%edx
@@ -123,15 +123,15 @@ NENTRY(handle_x2apic_ipi)
 	cmpl	$IPL_HIGH,%ebx
 	jae	2f
 	jmp	1f
-END(handle_x2apic_ipi)
-NENTRY(handle_lapic_ipi)
+IDTVEC_END(handle_x2apic_ipi)
+IDTVEC(handle_lapic_ipi)
 	movq	_C_LABEL(local_apic_va),%rbx
 	movl	$0,LAPIC_EOI(%rbx)
 	movl	CPUVAR(ILEVEL),%ebx
 	cmpl	$IPL_HIGH,%ebx
 	jae	2f
 	jmp	1f
-END(handle_lapic_ipi)
+IDTVEC_END(handle_lapic_ipi)
 IDTVEC(resume_lapic_ipi)
 1:
 	incl	CPUVAR(IDEPTH)
@@ -150,18 +150,18 @@ IDTVEC(intr_x2apic_ipi)
 	pushq	$0
 	pushq	$T_ASTFLT
 	INTRENTRY
-	jmp	_C_LABEL(handle_x2apic_ipi)
+	jmp	_C_LABEL(Xhandle_x2apic_ipi)
 IDTVEC_END(intr_x2apic_ipi)
 IDTVEC(intr_lapic_ipi)
 	pushq	$0
 	pushq	$T_ASTFLT
 	INTRENTRY
-	jmp	_C_LABEL(handle_lapic_ipi)
+	jmp	_C_LABEL(Xhandle_lapic_ipi)
 IDTVEC_END(intr_lapic_ipi)
 	TEXT_USER_END
 
 #if defined(DDB)
-NENTRY(handle_intrddbipi)
+IDTVEC(handle_intrddbipi)
 	movl	$0xf,%eax
 	movq	%rax,%cr8
 	movq	_C_LABEL(local_apic_va),%rbx
@@ -171,8 +171,8 @@ NENTRY(handle_intrddbipi)
 	xorl	%eax,%eax
 	movq	%rax,%cr8
 	INTRFASTEXIT
-END(handle_intrddbipi)
-NENTRY(handle_x2apic_intrddbipi)
+IDTVEC_END(handle_intrddbipi)
+IDTVEC(handle_x2apic_intrddbipi)
 	movl	$0xf,%eax
 	movq	%rax,%cr8
 	movl	$(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
@@ -184,20 +184,20 @@ NENTRY(handle_x2apic_intrddbipi)
 	xorl	%eax,%eax
 	movq	%rax,%cr8
 	INTRFASTEXIT
-END(handle_x2apic_intrddbipi)
+IDTVEC_END(handle_x2apic_intrddbipi)
 
 	TEXT_USER_BEGIN
 IDTVEC(intrddbipi)
 	pushq	$0
 	pushq	$T_BPTFLT
 	INTRENTRY
-	jmp	_C_LABEL(handle_intrddbipi)
+	jmp	_C_LABEL(Xhandle_intrddbipi)
 IDTVEC_END(intrddbipi)
 IDTVEC(x2apic_intrddbipi)
 	pushq	$0
 	pushq	$T_BPTFLT
 	INTRENTRY
-	jmp	_C_LABEL(handle_x2apic_intrddbipi)
+	jmp	_C_LABEL(Xhandle_x2apic_intrddbipi)
 IDTVEC_END(x2apic_intrddbipi)
 	TEXT_USER_END
 
@@ -214,7 +214,7 @@ IDTVEC(recurse_lapic_ltimer)
 	INTR_RECURSE_ENTRY
 	jmp	1f
 IDTVEC_END(recurse_lapic_ltimer)
-NENTRY(handle_x2apic_ltimer)
+IDTVEC(handle_x2apic_ltimer)
 	movl	$(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
 	xorl	%eax,%eax
 	xorl	%edx,%edx
@@ -223,15 +223,15 @@ NENTRY(handle_x2apic_ltimer)
 	cmpl	$IPL_CLOCK,%ebx
 	jae	2f
 	jmp	1f
-END(handle_x2apic_ltimer)
-NENTRY(handle_lapic_ltimer)
+IDTVEC_END(handle_x2apic_ltimer)
+IDTVEC(handle_lapic_ltimer)
 	movq	_C_LABEL(local_apic_va),%rbx
 	movl	$0,LAPIC_EOI(%rbx)
 	movl	CPUVAR(ILEVEL),%ebx
 	cmpl	$IPL_CLOCK,%ebx
 	jae	2f
 	jmp	1f
-END(handle_lapic_ltimer)
+IDTVEC_END(handle_lapic_ltimer)
 

CVS commit: src/sys/dev/pci

2018-03-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 16 08:40:06 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Intel 0x15c4 is SFI based and 0x15ce is KR based.


To generate a diff of this commit:
cvs rdiff -u -r1.1319 -r1.1320 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1319 src/sys/dev/pci/pcidevs:1.1320
--- src/sys/dev/pci/pcidevs:1.1319	Sun Mar  4 13:24:17 2018
+++ src/sys/dev/pci/pcidevs	Fri Mar 16 08:40:06 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1319 2018/03/04 13:24:17 jdolecek Exp $
+$NetBSD: pcidevs,v 1.1320 2018/03/16 08:40:06 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3304,12 +3304,12 @@ product INTEL I219_V2		0x15b8	I219-V Eth
 product INTEL I219_LM3		0x15b9	I219-LM Ethernet Connection
 product INTEL C3K_X553_KRKX	0x15c2	C3000 X553 Backplane (KR/KX 10G SKU)
 product INTEL C3K_X553_KX_25G	0x15c3	C3000 X553 Backplane (KX 2.5G)
-product INTEL C3K_X553_SFI_SFP	0x15c4	C3000 X553 10G SFP+
+product INTEL C3K_X553_SFI_SFP	0x15c4	C3000 X553 10G SFP+ (SFI)
 product INTEL C3K_X553_VF	0x15c5	C3000 X553 VF
 product INTEL C3K_X553_SGMII_BP	0x15c6	C3000 X553 1GbE SGMII Backplane (10G SKU)
 product INTEL C3K_X553_SGMII_BP_L 0x15c7 C3000 X553 1GbE SGMII Backplane (non-10G SKU)
 product INTEL C3K_X553_10G_T	0x15c8	C3000 X553 10GBASE-T (X557)
-product INTEL C3K_X553_KR_SFP	0x15ce	C3000 X553 10G SFP+
+product INTEL C3K_X553_KR_SFP	0x15ce	C3000 X553 10G SFP+ (KR)
 product INTEL X550T1	 	0x15d1	X550 10G Ethernet
 product INTEL I219_V5		0x15d6	I219-V Ethernet Connection
 product INTEL I219_LM4		0x15d7	I219-LM Ethernet Connection



CVS commit: src/sys/kern

2018-03-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Mar 16 08:21:45 UTC 2018

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

Log Message:
Get rid of a redundant output


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/kern/subr_lockdebug.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_lockdebug.c
diff -u src/sys/kern/subr_lockdebug.c:1.62 src/sys/kern/subr_lockdebug.c:1.63
--- src/sys/kern/subr_lockdebug.c:1.62	Fri Mar 16 04:44:51 2018
+++ src/sys/kern/subr_lockdebug.c	Fri Mar 16 08:21:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_lockdebug.c,v 1.62 2018/03/16 04:44:51 ozaki-r Exp $	*/
+/*	$NetBSD: subr_lockdebug.c,v 1.63 2018/03/16 08:21:45 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.62 2018/03/16 04:44:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.63 2018/03/16 08:21:45 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -863,7 +863,6 @@ lockdebug_show_all_locks_lwp(void (*pr)(
 ksyms_getname(NULL, ,
 (vaddr_t)ld->ld_initaddr,
 KSYMS_CLOSEST|KSYMS_PROC|KSYMS_ANY);
-(*pr)("Initialized at %s\n", sym);
 (*pr)("Lock %d (initialized at %s)\n", i++, sym);
 lockdebug_dump(ld, pr);
 			}



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

2018-03-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Mar 16 08:21:56 UTC 2018

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

Log Message:
Add one more page for the stack, to compensate for the fact that SVS's
stack switching mechanism consumes approximately one page.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/include/param.h

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

Modified files:

Index: src/sys/arch/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.24 src/sys/arch/amd64/include/param.h:1.25
--- src/sys/arch/amd64/include/param.h:1.24	Mon Feb 19 13:02:47 2018
+++ src/sys/arch/amd64/include/param.h	Fri Mar 16 08:21:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.24 2018/02/19 13:02:47 sborrill Exp $	*/
+/*	$NetBSD: param.h,v 1.25 2018/03/16 08:21:56 maxv Exp $	*/
 
 #ifdef __x86_64__
 
@@ -58,9 +58,9 @@
 #define	SSIZE		1		/* initial stack size/NBPG */
 #define	SINCR		1		/* increment of stack/NBPG */
 #ifdef DIAGNOSTIC
-#define	UPAGES		4		/* pages of u-area (1 for redzone) */
+#define	UPAGES		5		/* pages of u-area (1 for redzone) */
 #else
-#define	UPAGES		3		/* pages of u-area */
+#define	UPAGES		4		/* pages of u-area */
 #endif
 #define	USPACE		(UPAGES * NBPG)	/* total size of u-area */
 



CVS commit: [pgoyette-compat] src/sys

2018-03-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 16 08:10:27 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_60_mod.c
compat_70_mod.c compat_mod.c compat_mod.h files.common kern_sa_60.c
src/sys/compat/net [pgoyette-compat]: route_70.h
src/sys/kern [pgoyette-compat]: kern_cpu.c
src/sys/modules/compat_60 [pgoyette-compat]: Makefile
src/sys/sys [pgoyette-compat]: cpu.h

Log Message:
Move closer to getting a compat_60 module - still needs more work


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/compat/common/compat_60_mod.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/compat/common/compat_70_mod.c
cvs rdiff -u -r1.24.14.12 -r1.24.14.13 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.42.1 -r1.1.42.2 src/sys/compat/common/compat_mod.h \
src/sys/compat/common/kern_sa_60.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/compat/common/files.common
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/compat/net/route_70.h
cvs rdiff -u -r1.71.16.1 -r1.71.16.2 src/sys/kern/kern_cpu.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/modules/compat_60/Makefile
cvs rdiff -u -r1.42 -r1.42.2.1 src/sys/sys/cpu.h

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

Modified files:

Index: src/sys/compat/common/compat_60_mod.c
diff -u src/sys/compat/common/compat_60_mod.c:1.1.2.2 src/sys/compat/common/compat_60_mod.c:1.1.2.3
--- src/sys/compat/common/compat_60_mod.c:1.1.2.2	Fri Mar 16 01:16:29 2018
+++ src/sys/compat/common/compat_60_mod.c	Fri Mar 16 08:10:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_60_mod.c,v 1.1.2.2 2018/03/16 01:16:29 pgoyette Exp $	*/
+/*	$NetBSD: compat_60_mod.c,v 1.1.2.3 2018/03/16 08:10:26 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.2 2018/03/16 01:16:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.3 2018/03/16 08:10:26 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -44,18 +44,20 @@ __KERNEL_RCSID(0, "$NetBSD: compat_60_mo
 #include 
 #include 
 #include 
-
-#include 
-#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
 
 static const struct syscall_package compat_60_syscalls[] = {
-	{ SYS_compat_60_lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },
+	{ SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60__lwp_park },
 	{ NULL, 0, NULL }
 };
 
+#ifdef _MODULE
+
 #define REQUIRED_60 "compat_70"		/* XXX No compat_80 yet */
 MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60);
 
@@ -64,6 +66,11 @@ int (*orig_compat_6_cpu_ucode)(struct co
 int (*orig_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *);
 #endif
 
+static const struct syscall_package compat__60_syscalls[] = {
+{ SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },  
+NULL, 0, NULL }
+};
+
 static int
 compat_60_modcmd(modcmd_t cmd, void *arg)
 {
@@ -71,29 +78,38 @@ compat_60_modcmd(modcmd_t cmd, void *arg
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
-		error = syscall_establish(NULL, compat_60_syscalls);
-		if (error != 0)
-			return error;
-#ifdef CPU_UCODE
-		orig_get_version = vec_compat6_cpu_ucode_get_version;
-		*vec_compat6_cpu_ucode_get_version =
-		compat6_cpu_ucode_get_version;
-		orig_apply = vec_compat6_cpu_ucode_apply;
-		*vec_compat6_cpu_ucode_apply = compat6_cpu_ucode_apply;
-#endif
-		return 0;
-
+		return compat_60_init();
 	case MODULE_CMD_FINI:
-		*vec_compat6_cpu_ucode_get_version = orig_get_version;
-		*vec_compat6_cpu_ucode_apply = orig_apply;
-		error = syscall_disestablish(NULL, compat_60_syscalls);
-		if (error != 0)
-			return error;
-		return 0;
-
+		return compat_60_init();
 	default:
 		return ENOTTY;
 	}
 }
+#endif	/* _MODULE */
 
+int compat_60_init(void)
+{
+	int error;
 
+	error = syscall_establish(NULL, compat_60_syscalls);
+	if (error != 0)
+		return error;
+#ifdef CPU_UCODE
+	orig_get_version = vec_compat6_cpu_ucode_get_version;
+	*vec_compat6_cpu_ucode_get_version = compat6_cpu_ucode_get_version;
+	orig_apply = vec_compat6_cpu_ucode_apply;
+	*vec_compat6_cpu_ucode_apply = compat6_cpu_ucode_apply;
+#endif
+	return 0;
+}
+
+int compat_60_fini(void)
+{
+	int error;
+
+	*vec_compat6_cpu_ucode_get_version = orig_get_version;
+	*vec_compat6_cpu_ucode_apply = orig_apply;
+	error = syscall_disestablish(NULL, compat_60_syscalls);
+
+	return error;
+}

Index: src/sys/compat/common/compat_70_mod.c
diff -u src/sys/compat/common/compat_70_mod.c:1.1.2.3 src/sys/compat/common/compat_70_mod.c:1.1.2.4
--- src/sys/compat/common/compat_70_mod.c:1.1.2.3	Fri Mar 16 01:16:29 2018
+++ src/sys/compat/common/compat_70_mod.c	Fri Mar 16 08:10:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_70_mod.c,v 1.1.2.3 2018/03/16 01:16:29 pgoyette Exp $	*/
+/*	$NetBSD: compat_70_mod.c,v 1.1.2.4 2018/03/16 08:10:26 pgoyette Exp $	*/
 
 /*-
  * Copyright 

CVS commit: src/sys/lib/libkern/arch/aarch64

2018-03-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Mar 16 07:56:50 UTC 2018

Modified Files:
src/sys/lib/libkern/arch/aarch64: Makefile.inc

Log Message:
use memmove.S


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/arch/aarch64/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/sys/lib/libkern/arch/aarch64/Makefile.inc
diff -u src/sys/lib/libkern/arch/aarch64/Makefile.inc:1.1 src/sys/lib/libkern/arch/aarch64/Makefile.inc:1.2
--- src/sys/lib/libkern/arch/aarch64/Makefile.inc:1.1	Sun Aug 10 05:47:38 2014
+++ src/sys/lib/libkern/arch/aarch64/Makefile.inc	Fri Mar 16 07:56:50 2018
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile.inc,v 1.1 2014/08/10 05:47:38 matt Exp $
+# $NetBSD: Makefile.inc,v 1.2 2018/03/16 07:56:50 ryo Exp $
 
 SRCS+=	byte_swap_2.S byte_swap_4.S byte_swap_8.S
 SRCS+=	memcmp.S
 SRCS+=	memcpy.S
+SRCS+=	memmove.S
 SRCS+=	memset.S
-#SRCS+=	memmove.S
 #SRCS+=	strcmp.S
 #SRCS+=	strncmp.S



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

2018-03-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 16 07:54:08 UTC 2018

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

Log Message:
- Check offset correctly in ixgbe_get_oem_prod_version(). Note that this
  function is not used.
- Set PHY correctly in ixgbe_setup_mac_link_sfp_x550a() if a device is a
  C3000 KR SFP+.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/ixgbe/ixgbe_x550.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_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.17 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.18
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.17	Thu Mar 15 06:48:51 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Fri Mar 16 07:54:08 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.17 2018/03/15 06:48:51 msaitoh Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.18 2018/03/16 07:54:08 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -5126,7 +5126,7 @@ void ixgbe_get_oem_prod_version(struct i
 	hw->eeprom.ops.read(hw, NVM_OEM_PROD_VER_PTR, );
 
 	/* Return is offset to OEM Product Version block is invalid */
-	if (offset == 0x0 && offset == NVM_INVALID_PTR)
+	if (offset == 0x0 || offset == NVM_INVALID_PTR)
 		return;
 
 	/* Read product version block */

Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.8 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.9
--- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.8	Thu Mar 15 06:48:51 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c	Fri Mar 16 07:54:08 2018
@@ -2945,9 +2945,9 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struc
  (IXGBE_CS4227_EDC_MODE_SR << 1));
 
 		if (setup_linear)
-			reg_phy_ext = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
+			reg_phy_ext |= (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
 		else
-			reg_phy_ext = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
+			reg_phy_ext |= (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
 		ret_val = hw->phy.ops.write_reg(hw, reg_slice,
 	 IXGBE_MDIO_ZERO_DEV_TYPE, reg_phy_ext);