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

2018-01-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jan  6 07:26:54 UTC 2018

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
support underlines


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.82 src/sys/arch/sparc/dev/cgfourteen.c:1.83
--- src/sys/arch/sparc/dev/cgfourteen.c:1.82	Fri Sep 16 22:39:35 2016
+++ src/sys/arch/sparc/dev/cgfourteen.c	Sat Jan  6 07:26:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.82 2016/09/16 22:39:35 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.83 2018/01/06 07:26:54 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -163,6 +163,7 @@ static int  cg14_do_cursor(struct cgfour
 static void cg14_wait_idle(struct cgfourteen_softc *);
 static void cg14_rectfill(struct cgfourteen_softc *, int, int, int, int,
 uint32_t);
+static void cg14_rectfill_a(void *, int, int, int, int, long);
 static void cg14_invert(struct cgfourteen_softc *, int, int, int, int);
 static void cg14_bitblt(void *, int, int, int, int, int, int, int);
 static void cg14_bitblt_gc(void *, int, int, int, int, int, int, int);
@@ -723,7 +724,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 		0, 0,
 		NULL,
 		8, 16,
-		WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
+		WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE,
 		NULL
 	};
 	cg14_set_depth(sc, 8);
@@ -738,6 +739,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 
 	sc->sc_gc.gc_bitblt = cg14_bitblt_gc;
 	sc->sc_gc.gc_blitcookie = sc;
+	sc->sc_gc.gc_rectfill = cg14_rectfill_a;
 	sc->sc_gc.gc_rop = 0xc;
 	if (is_cons) {
 		vcons_init_screen(>sc_vd, >sc_console_screen, 1,
@@ -1008,7 +1010,7 @@ cg14_init_screen(void *cookie, struct vc
 
 	ri->ri_bits = (char *)sc->sc_fb.fb_pixels;
 #if NSX > 0
-	ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA;
+	ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA | RI_PREFER_ALPHA;
 
 	/*
 	 * unaligned copies with horizontal overlap are slow, so don't bother
@@ -1025,7 +1027,7 @@ cg14_init_screen(void *cookie, struct vc
 	}
 
 	rasops_init(ri, 0, 0);
-	ri->ri_caps = WSSCREEN_WSCOLORS;
+	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE;
 
 	rasops_reconfig(ri,
 	sc->sc_fb.fb_type.fb_height / ri->ri_font->fontheight,
@@ -1209,7 +1211,7 @@ cg14_rectfill(struct cgfourteen_softc *s
 			cnt -= pre;
 		}
 		/* now do the aligned pixels in 32bit chunks */
-		while(cnt > 31) {
+		while(cnt > 3) {
 			words = min(32, cnt >> 2);
 			sta(pptr & ~7, ASI_SX, SX_STS(8, words - 1, pptr & 7));
 			pptr += words << 2;
@@ -1223,6 +1225,16 @@ cg14_rectfill(struct cgfourteen_softc *s
 }
 
 static void
+cg14_rectfill_a(void *cookie, int dstx, int dsty,
+int width, int height, long attr)
+{
+	struct cgfourteen_softc *sc = cookie;
+
+	cg14_rectfill(sc, dstx, dsty, width, height,
+	sc->sc_vd.active->scr_ri.ri_devcmap[(attr >> 24 & 0xf)]);
+}
+
+static void
 cg14_invert(struct cgfourteen_softc *sc, int x, int y, int wi, int he)
 {
 	uint32_t addr, pptr;
@@ -1459,17 +1471,20 @@ cg14_putchar(void *cookie, int row, int 
 
 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
 	fg = ri->ri_devcmap[(attr >> 24) & 0xf];
-	sx_write(sc->sc_sx, SX_QUEUED(8), bg);
-	sx_write(sc->sc_sx, SX_QUEUED(9), fg);
 
 	x = ri->ri_xorigin + col * wi;
 	y = ri->ri_yorigin + row * he;
 
 	if (c == 0x20) {
 		cg14_rectfill(sc, x, y, wi, he, bg);
+		if (attr & 1)
+			cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 		return;
 	}
 
+	sx_write(sc->sc_sx, SX_QUEUED(8), bg);
+	sx_write(sc->sc_sx, SX_QUEUED(9), fg);
+
 	data = WSFONT_GLYPH(c, font);
 	addr = sc->sc_fb_paddr + x + stride * y;
 
@@ -1501,6 +1516,8 @@ cg14_putchar(void *cookie, int row, int 
 			break;
 		}
 	}
+	if (attr & 1)
+		cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 }
 
 static void
@@ -1545,7 +1562,7 @@ cg14_putchar_aa(void *cookie, int row, i
 	struct vcons_screen *scr = ri->ri_hw;
 	struct cgfourteen_softc *sc = scr->scr_cookie;
 	int stride = sc->sc_fb.fb_type.fb_width;
-	uint32_t bg, addr, bg8, fg8, pixel, in, q, next;
+	uint32_t bg, fg, addr, bg8, fg8, pixel, in, q, next;
 	int i, j, x, y, wi, he, r, g, b, aval, cnt, reg;
 	int r1, g1, b1, r0, g0, b0, fgo, bgo, rv;
 	uint8_t *data8;
@@ -1560,10 +1577,13 @@ cg14_putchar_aa(void *cookie, int row, i
 	he = font->fontheight;
 
 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
+	fg = ri->ri_devcmap[(attr >> 24) & 0xf];
 	x = ri->ri_xorigin + col * wi;
 	y = ri->ri_yorigin + row * he;
 	if (c == 0x20) {
 		cg14_rectfill(sc, x, y, wi, he, bg);
+		if (attr & 1)
+			cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 		return;
 	}
 
@@ -1641,7 +1661,9 @@ cg14_putchar_aa(void *cookie, int row, i
 
 	if (rv == GC_ADD) {
 		glyphcache_add(>sc_gc, c, x, y);
-	}
+	} else if (attr & 1)
+		cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
+
 }
 
 static void



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

2018-01-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jan  6 07:26:54 UTC 2018

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
support underlines


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sparc/dev/cgfourteen.c

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



Re: CVS commit: src

2018-01-05 Thread Kamil Rytarowski
On 05.01.2018 22:24, m...@netbsd.org wrote:
>> Register new weak symbol in libc for internal usage: atoi
> 
> Why are we protecting libc from users who override standard C functions?
> I don't think you should be able to provide a wrong implementation of
> them, link to libc, and expect it to work.
> 

I'm incercepting atoi(3) & other functions in sanitizers. I cannot
reliably intercept them within libc internals (e.g. I'm marking certain
data under pointer as initialized, but not inside libc), this change
allows to keep libc as a black-box for those who overwrite atoi() in 3rd
party software and expect libc to still work as is.



signature.asc
Description: OpenPGP digital signature


Re: CVS commit: src

2018-01-05 Thread maya
> Register new weak symbol in libc for internal usage: atoi

Why are we protecting libc from users who override standard C functions?
I don't think you should be able to provide a wrong implementation of
them, link to libc, and expect it to work.


CVS commit: src

2018-01-05 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jan  5 20:51:14 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi
src/lib/libc/stdlib: Makefile.inc

Log Message:
add strfmon_l man page links


To generate a diff of this commit:
cvs rdiff -u -r1.2164 -r1.2165 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.93 -r1.94 src/lib/libc/stdlib/Makefile.inc

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



CVS commit: src

2018-01-05 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jan  5 20:51:14 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi
src/lib/libc/stdlib: Makefile.inc

Log Message:
add strfmon_l man page links


To generate a diff of this commit:
cvs rdiff -u -r1.2164 -r1.2165 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.93 -r1.94 src/lib/libc/stdlib/Makefile.inc

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2164 src/distrib/sets/lists/comp/mi:1.2165
--- src/distrib/sets/lists/comp/mi:1.2164	Wed Dec 20 00:07:55 2017
+++ src/distrib/sets/lists/comp/mi	Fri Jan  5 20:51:13 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2164 2017/12/20 00:07:55 kamil Exp $
+#	$NetBSD: mi,v 1.2165 2018/01/05 20:51:13 snj Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -9416,6 +9416,7 @@
 ./usr/share/man/cat3/strerror_r.0		comp-c-catman		.cat
 ./usr/share/man/cat3/stresep.0			comp-c-catman		.cat
 ./usr/share/man/cat3/strfmon.0			comp-c-catman		.cat
+./usr/share/man/cat3/strfmon_l.0		comp-c-catman		.cat
 ./usr/share/man/cat3/strftime.0			comp-c-catman		.cat
 ./usr/share/man/cat3/strftime_z.0		comp-c-catman		.cat
 ./usr/share/man/cat3/string.0			comp-c-catman		.cat
@@ -16946,6 +16947,7 @@
 ./usr/share/man/html3/strerror_r.html		comp-c-htmlman		html
 ./usr/share/man/html3/stresep.html		comp-c-htmlman		html
 ./usr/share/man/html3/strfmon.html		comp-c-htmlman		html
+./usr/share/man/html3/strfmon_l.html		comp-c-htmlman		html
 ./usr/share/man/html3/strftime.html		comp-c-htmlman		html
 ./usr/share/man/html3/strftime_z.html		comp-c-htmlman		html
 ./usr/share/man/html3/string.html		comp-c-htmlman		html
@@ -24507,6 +24509,7 @@
 ./usr/share/man/man3/strerror_r.3		comp-c-man		.man
 ./usr/share/man/man3/stresep.3			comp-c-man		.man
 ./usr/share/man/man3/strfmon.3			comp-c-man		.man
+./usr/share/man/man3/strfmon_l.3		comp-c-man		.man
 ./usr/share/man/man3/strftime.3			comp-c-man		.man
 ./usr/share/man/man3/strftime_z.3		comp-c-man		.man
 ./usr/share/man/man3/string.3			comp-c-man		.man

Index: src/lib/libc/stdlib/Makefile.inc
diff -u src/lib/libc/stdlib/Makefile.inc:1.93 src/lib/libc/stdlib/Makefile.inc:1.94
--- src/lib/libc/stdlib/Makefile.inc:1.93	Tue Jul 11 15:21:35 2017
+++ src/lib/libc/stdlib/Makefile.inc	Fri Jan  5 20:51:13 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.93 2017/07/11 15:21:35 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.94 2018/01/05 20:51:13 snj Exp $
 #	from: @(#)Makefile.inc	8.3 (Berkeley) 2/4/95
 
 # stdlib sources
@@ -85,6 +85,7 @@ MLINKS+=rand48.3 mrand48.3 rand48.3 nran
 MLINKS+=rand48.3 srand48.3 rand48.3 seed48.3 rand48.3 lcong48.3
 MLINKS+=random.3 initstate.3 random.3 setstate.3 random.3 srandom.3
 MLINKS+=radixsort.3 sradixsort.3
+MLINKS+=strfmon.3 strfmon_l.3
 MLINKS+=strsuftoll.3 strsuftollx.3
 MLINKS+=strtod.3 strtof.3 strtod.3 strtold.3
 MLINKS+=strtol.3 strtoimax.3



CVS commit: src

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 20:30:51 UTC 2018

Modified Files:
src/lib/libc/include: namespace.h
src/lib/libc/stdlib: atoi.c
src/sys/external/bsd/compiler_rt/dist/lib/profile: InstrProfilingFile.c

Log Message:
Register new weak symbol in libc for internal usage: atoi

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

Add atoi to namespace.h.

Register a new __weak_alias() entry for atoi() in atoi.c.

atoi() is used internally in getrpcent(), rresvport_af(), ftok(), err(),
__llvm_profile_write_file(), llvm_gcda_start_file(), citrus_iconv_open(),
getprotoent_r(), __rpc_uaddr2taddr_af(), __res_nopt_rdata() and
servent_parseline().

This revision switches the internal usage to the internal symbol.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/lib/libc/include/namespace.h
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/stdlib/atoi.c
cvs rdiff -u -r1.1.1.4 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c

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

Modified files:

Index: src/lib/libc/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.192 src/lib/libc/include/namespace.h:1.193
--- src/lib/libc/include/namespace.h:1.192	Fri Jan  5 20:01:31 2018
+++ src/lib/libc/include/namespace.h	Fri Jan  5 20:30:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.192 2018/01/05 20:01:31 kamil Exp $	*/
+/*	$NetBSD: namespace.h,v 1.193 2018/01/05 20:30:51 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -217,6 +217,7 @@
 #define asprintf_l		_asprintf_l
 #define asysctl			_asysctl
 #define asysctlbyname		_asysctlbyname
+#define atoi			_atoi
 #define atoll			_atoll
 #define authnone_create		_authnone_create
 #define authunix_create		_authunix_create

Index: src/lib/libc/stdlib/atoi.c
diff -u src/lib/libc/stdlib/atoi.c:1.12 src/lib/libc/stdlib/atoi.c:1.13
--- src/lib/libc/stdlib/atoi.c:1.12	Mon Jun 25 22:32:45 2012
+++ src/lib/libc/stdlib/atoi.c	Fri Jan  5 20:30:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: atoi.c,v 1.12 2012/06/25 22:32:45 abs Exp $	*/
+/*	$NetBSD: atoi.c,v 1.13 2018/01/05 20:30:51 kamil Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,13 +34,19 @@
 #if 0
 static char sccsid[] = "@(#)atoi.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: atoi.c,v 1.12 2012/06/25 22:32:45 abs Exp $");
+__RCSID("$NetBSD: atoi.c,v 1.13 2018/01/05 20:30:51 kamil Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
+
 #include 
 #include 
 
+#ifdef __weak_alias
+__weak_alias(atoi,_atoi)
+#endif
+
 int
 atoi(const char *str)
 {

Index: src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c
diff -u src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c:1.1.1.4 src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c:1.1.1.4	Sat Feb 27 18:59:32 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c	Fri Jan  5 20:30:51 2018
@@ -7,6 +7,10 @@
 |*
 \*===--===*/
 
+#ifdef _LIBC
+#include "namespace.h"
+#endif
+
 #include "InstrProfiling.h"
 #include "InstrProfilingInternal.h"
 #include "InstrProfilingUtil.h"



CVS commit: src

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 20:30:51 UTC 2018

Modified Files:
src/lib/libc/include: namespace.h
src/lib/libc/stdlib: atoi.c
src/sys/external/bsd/compiler_rt/dist/lib/profile: InstrProfilingFile.c

Log Message:
Register new weak symbol in libc for internal usage: atoi

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

Add atoi to namespace.h.

Register a new __weak_alias() entry for atoi() in atoi.c.

atoi() is used internally in getrpcent(), rresvport_af(), ftok(), err(),
__llvm_profile_write_file(), llvm_gcda_start_file(), citrus_iconv_open(),
getprotoent_r(), __rpc_uaddr2taddr_af(), __res_nopt_rdata() and
servent_parseline().

This revision switches the internal usage to the internal symbol.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/lib/libc/include/namespace.h
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/stdlib/atoi.c
cvs rdiff -u -r1.1.1.4 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/profile/InstrProfilingFile.c

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



CVS commit: src/lib/libc

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 20:01:32 UTC 2018

Modified Files:
src/lib/libc/include: namespace.h
src/lib/libc/time: asctime.c

Log Message:
Register new weak symbol in libc for internal usage: asctime

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

Add asctime to namespace.h.

Register a new __weak_alias() entry for asctime() in asctime.c.

acstime() is used internally in ctime and __ctime50. This revision switches
the internal usage to the internal symbol.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/lib/libc/include/namespace.h
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/asctime.c

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

Modified files:

Index: src/lib/libc/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.191 src/lib/libc/include/namespace.h:1.192
--- src/lib/libc/include/namespace.h:1.191	Fri Jan  5 19:29:44 2018
+++ src/lib/libc/include/namespace.h	Fri Jan  5 20:01:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.191 2018/01/05 19:29:44 kamil Exp $	*/
+/*	$NetBSD: namespace.h,v 1.192 2018/01/05 20:01:31 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -211,6 +211,7 @@
 #define arc4random_buf		_arc4random_buf
 #define arc4random_stir		_arc4random_stir
 #define arc4random_uniform	_arc4random_uniform
+#define asctime			_asctime
 #define asctime_r		_asctime_r
 #define asprintf		_asprintf
 #define asprintf_l		_asprintf_l

Index: src/lib/libc/time/asctime.c
diff -u src/lib/libc/time/asctime.c:1.22 src/lib/libc/time/asctime.c:1.23
--- src/lib/libc/time/asctime.c:1.22	Tue Oct 24 17:38:17 2017
+++ src/lib/libc/time/asctime.c	Fri Jan  5 20:01:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: asctime.c,v 1.22 2017/10/24 17:38:17 christos Exp $	*/
+/*	$NetBSD: asctime.c,v 1.23 2018/01/05 20:01:31 kamil Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -16,7 +16,7 @@
 #if 0
 static char	elsieid[] = "@(#)asctime.c	8.5";
 #else
-__RCSID("$NetBSD: asctime.c,v 1.22 2017/10/24 17:38:17 christos Exp $");
+__RCSID("$NetBSD: asctime.c,v 1.23 2018/01/05 20:01:31 kamil Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -27,6 +27,7 @@ __RCSID("$NetBSD: asctime.c,v 1.22 2017/
 #include 
 
 #ifdef __weak_alias
+__weak_alias(asctime,_asctime)
 __weak_alias(asctime_r,_asctime_r)
 #endif
 



CVS commit: src/lib/libc

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 20:01:32 UTC 2018

Modified Files:
src/lib/libc/include: namespace.h
src/lib/libc/time: asctime.c

Log Message:
Register new weak symbol in libc for internal usage: asctime

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

Add asctime to namespace.h.

Register a new __weak_alias() entry for asctime() in asctime.c.

acstime() is used internally in ctime and __ctime50. This revision switches
the internal usage to the internal symbol.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/lib/libc/include/namespace.h
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/asctime.c

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



CVS commit: src/lib/libc

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 19:29:44 UTC 2018

Modified Files:
src/lib/libc/dlfcn: dlfcn_elf.c
src/lib/libc/include: namespace.h

Log Message:
Register dl_iterate_phdr in the libc's namespace.h

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

Stop using the public global name of dl_iterate_phdr in tls/tls.c:
__libc_static_tls_setup().

Follow the approach with other dlopen(3)-like functions with the
namespace.h in the dl_iterate_phdr() case. Use internally a weak symbol:
__dl_iterate_phdr instead of dl_iterate_phdr.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/dlfcn/dlfcn_elf.c
cvs rdiff -u -r1.190 -r1.191 src/lib/libc/include/namespace.h

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



CVS commit: src/lib/libc

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 19:29:44 UTC 2018

Modified Files:
src/lib/libc/dlfcn: dlfcn_elf.c
src/lib/libc/include: namespace.h

Log Message:
Register dl_iterate_phdr in the libc's namespace.h

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

Stop using the public global name of dl_iterate_phdr in tls/tls.c:
__libc_static_tls_setup().

Follow the approach with other dlopen(3)-like functions with the
namespace.h in the dl_iterate_phdr() case. Use internally a weak symbol:
__dl_iterate_phdr instead of dl_iterate_phdr.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/dlfcn/dlfcn_elf.c
cvs rdiff -u -r1.190 -r1.191 src/lib/libc/include/namespace.h

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

Modified files:

Index: src/lib/libc/dlfcn/dlfcn_elf.c
diff -u src/lib/libc/dlfcn/dlfcn_elf.c:1.14 src/lib/libc/dlfcn/dlfcn_elf.c:1.15
--- src/lib/libc/dlfcn/dlfcn_elf.c:1.14	Tue Jul 11 15:21:35 2017
+++ src/lib/libc/dlfcn/dlfcn_elf.c	Fri Jan  5 19:29:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: dlfcn_elf.c,v 1.14 2017/07/11 15:21:35 joerg Exp $	*/
+/*	$NetBSD: dlfcn_elf.c,v 1.15 2018/01/05 19:29:44 kamil Exp $	*/
 
 /*
  * Copyright (c) 2000 Takuya SHIOZAKI
@@ -27,7 +27,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: dlfcn_elf.c,v 1.14 2017/07/11 15:21:35 joerg Exp $");
+__RCSID("$NetBSD: dlfcn_elf.c,v 1.15 2018/01/05 19:29:44 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: dlfcn_elf.c,v 1.14 201
 #include 
 #include 
 
+#undef dl_iterate_phdr
 #undef dlopen
 #undef dlclose
 #undef dlsym

Index: src/lib/libc/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.190 src/lib/libc/include/namespace.h:1.191
--- src/lib/libc/include/namespace.h:1.190	Fri Jan  5 18:57:06 2018
+++ src/lib/libc/include/namespace.h	Fri Jan  5 19:29:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.190 2018/01/05 18:57:06 kamil Exp $	*/
+/*	$NetBSD: namespace.h,v 1.191 2018/01/05 19:29:44 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -926,6 +926,7 @@
 #define yperr_string		_yperr_string
 #define ypprot_err		_ypprot_err
 #define yp_setbindtries		_yp_setbindtries
+#define dl_iterate_phdr		__dl_iterate_phdr
 #define dlopen			__dlopen
 #define dlclose			__dlclose
 #define dlsym			__dlsym



CVS commit: src/lib/libc

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 19:01:36 UTC 2018

Modified Files:
src/lib/libc/gen: closefrom.c exect.c
src/lib/libc/stdio: fopen.c freopen.c

Log Message:
Include namespace.h in a few of libc source files

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

This change finishes elimination of usage of the global name of the
following symbols:
  - close -> _close
  - execve -> _execve
  - fcntl -> _fcntl
  - setcontext -> _setcontext
  - wait6 -> _wait6
  - write -> _write
  - writev -> _writev

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gen/closefrom.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/exect.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/stdio/fopen.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/stdio/freopen.c

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



CVS commit: src/lib/libc

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 19:01:36 UTC 2018

Modified Files:
src/lib/libc/gen: closefrom.c exect.c
src/lib/libc/stdio: fopen.c freopen.c

Log Message:
Include namespace.h in a few of libc source files

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

This change finishes elimination of usage of the global name of the
following symbols:
  - close -> _close
  - execve -> _execve
  - fcntl -> _fcntl
  - setcontext -> _setcontext
  - wait6 -> _wait6
  - write -> _write
  - writev -> _writev

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gen/closefrom.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/exect.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/stdio/fopen.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/stdio/freopen.c

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

Modified files:

Index: src/lib/libc/gen/closefrom.c
diff -u src/lib/libc/gen/closefrom.c:1.2 src/lib/libc/gen/closefrom.c:1.3
--- src/lib/libc/gen/closefrom.c:1.2	Tue Jun 22 13:49:43 2004
+++ src/lib/libc/gen/closefrom.c	Fri Jan  5 19:01:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: closefrom.c,v 1.2 2004/06/22 13:49:43 atatat Exp $	*/
+/*	$NetBSD: closefrom.c,v 1.3 2018/01/05 19:01:36 kamil Exp $	*/
 
 /*
  * Copyright (C) 2004 WIDE Project.
@@ -31,9 +31,10 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: closefrom.c,v 1.2 2004/06/22 13:49:43 atatat Exp $");
+__RCSID("$NetBSD: closefrom.c,v 1.3 2018/01/05 19:01:36 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
 #include 
 #include 
 

Index: src/lib/libc/gen/exect.c
diff -u src/lib/libc/gen/exect.c:1.1 src/lib/libc/gen/exect.c:1.2
--- src/lib/libc/gen/exect.c:1.1	Tue Feb  7 19:29:40 2017
+++ src/lib/libc/gen/exect.c	Fri Jan  5 19:01:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exect.c,v 1.1 2017/02/07 19:29:40 kamil Exp $	*/
+/*	$NetBSD: exect.c,v 1.2 2018/01/05 19:01:36 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -28,9 +28,10 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: exect.c,v 1.1 2017/02/07 19:29:40 kamil Exp $");
+__RCSID("$NetBSD: exect.c,v 1.2 2018/01/05 19:01:36 kamil Exp $");
 #endif
 
+#include "namespace.h"
 #include 
 
 __warn_references(exect,

Index: src/lib/libc/stdio/fopen.c
diff -u src/lib/libc/stdio/fopen.c:1.17 src/lib/libc/stdio/fopen.c:1.18
--- src/lib/libc/stdio/fopen.c:1.17	Thu Nov  9 20:30:02 2017
+++ src/lib/libc/stdio/fopen.c	Fri Jan  5 19:01:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fopen.c,v 1.17 2017/11/09 20:30:02 christos Exp $	*/
+/*	$NetBSD: fopen.c,v 1.18 2018/01/05 19:01:36 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,10 +37,11 @@
 #if 0
 static char sccsid[] = "@(#)fopen.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: fopen.c,v 1.17 2017/11/09 20:30:02 christos Exp $");
+__RCSID("$NetBSD: fopen.c,v 1.18 2018/01/05 19:01:36 kamil Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
 #include 
 #include 
 #include 

Index: src/lib/libc/stdio/freopen.c
diff -u src/lib/libc/stdio/freopen.c:1.20 src/lib/libc/stdio/freopen.c:1.21
--- src/lib/libc/stdio/freopen.c:1.20	Thu Nov  9 20:30:02 2017
+++ src/lib/libc/stdio/freopen.c	Fri Jan  5 19:01:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: freopen.c,v 1.20 2017/11/09 20:30:02 christos Exp $	*/
+/*	$NetBSD: freopen.c,v 1.21 2018/01/05 19:01:36 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,10 +37,11 @@
 #if 0
 static char sccsid[] = "@(#)freopen.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: freopen.c,v 1.20 2017/11/09 20:30:02 christos Exp $");
+__RCSID("$NetBSD: freopen.c,v 1.21 2018/01/05 19:01:36 kamil Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
 #include 
 #include 
 



CVS commit: src/lib/libc/include

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 18:57:06 UTC 2018

Modified Files:
src/lib/libc/include: namespace.h

Log Message:
Register more syscalls in namespace.h (of libc)

Add weak symbols for:
 - fcntl
 - close
 - execve
 - setcontext
 - wait6
 - write
 - writev

These syscalls are already marked as WEAKASM, generating weak references.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/lib/libc/include/namespace.h

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

Modified files:

Index: src/lib/libc/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.189 src/lib/libc/include/namespace.h:1.190
--- src/lib/libc/include/namespace.h:1.189	Thu Nov 30 05:47:24 2017
+++ src/lib/libc/include/namespace.h	Fri Jan  5 18:57:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.189 2017/11/30 05:47:24 riastradh Exp $	*/
+/*	$NetBSD: namespace.h,v 1.190 2018/01/05 18:57:06 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -45,6 +45,7 @@
 #define err		_err
 #define errc		_errc
 #define errx		_errx
+#define fcntl		_fcntl
 #ifdef _REENTRANT
 #define fileno		_fileno
 #endif /* _REENTRANT */
@@ -274,6 +275,7 @@
 #define clock_gettime		_clock_gettime
 #define clock_getres		_clock_getres
 #define clock_settime		_clock_settime
+#define close			_close
 #define closedir		_closedir
 #define closelog		_closelog
 #define closelog_r		_closelog_r
@@ -318,6 +320,7 @@
 #define execlp			_execlp
 #define execlpe			_execlpe
 #define execv			_execv
+#define execve			_execve
 #define execvp			_execvp
 #define execvpe			_execvpe
 #define explicit_memset		_explicit_memset
@@ -617,6 +620,7 @@
 #define seekdir			_seekdir
 #define select			_select
 #define send			_send
+#define setcontext		_setcontext
 #define setdomainname		_setdomainname
 #define setenv			_setenv
 #define setfsent		_setfsent
@@ -794,6 +798,7 @@
 #define wait			_wait
 #define wait3			_wait3
 #define wait4			_wait4
+#define wait6			_wait6
 #define waitid			_waitid
 #define waitpid			_waitpid
 #define wcscasecmp		_wcscasecmp
@@ -811,6 +816,8 @@
 #define wcwidth			_wcwidth
 #define wcwidth_l		_wcwidth_l
 #define wprintf_l		_wprintf_l
+#define write			_write
+#define writev			_writev
 #define wscanf_l		_wscanf_l
 #define xdr_accepted_reply	_xdr_accepted_reply
 #define xdr_array		_xdr_array



CVS commit: src/lib/libc/include

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 18:57:06 UTC 2018

Modified Files:
src/lib/libc/include: namespace.h

Log Message:
Register more syscalls in namespace.h (of libc)

Add weak symbols for:
 - fcntl
 - close
 - execve
 - setcontext
 - wait6
 - write
 - writev

These syscalls are already marked as WEAKASM, generating weak references.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/lib/libc/include/namespace.h

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



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/profile

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 17:54:31 UTC 2018

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/profile: GCDAProfiling.c

Log Message:
Include namespace.h in GCDAProfiling.c (compiler_rt)

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

This change eliminates usage of the global name of the following symbols:
  - fdopen -> _fdopen
  - mmap -> _mmap
  - strdup -> _strdup

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/profile/GCDAProfiling.c

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

Modified files:

Index: src/sys/external/bsd/compiler_rt/dist/lib/profile/GCDAProfiling.c
diff -u src/sys/external/bsd/compiler_rt/dist/lib/profile/GCDAProfiling.c:1.1.1.5 src/sys/external/bsd/compiler_rt/dist/lib/profile/GCDAProfiling.c:1.2
--- src/sys/external/bsd/compiler_rt/dist/lib/profile/GCDAProfiling.c:1.1.1.5	Sat Feb 27 18:59:31 2016
+++ src/sys/external/bsd/compiler_rt/dist/lib/profile/GCDAProfiling.c	Fri Jan  5 17:54:31 2018
@@ -20,6 +20,10 @@
 |*
 \*===--===*/
 
+#ifdef _LIBC
+#include "namespace.h"
+#endif
+
 #include "InstrProfilingUtil.h"
 
 #include 



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/profile

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 17:54:31 UTC 2018

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/profile: GCDAProfiling.c

Log Message:
Include namespace.h in GCDAProfiling.c (compiler_rt)

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

This change eliminates usage of the global name of the following symbols:
  - fdopen -> _fdopen
  - mmap -> _mmap
  - strdup -> _strdup

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.2 \
src/sys/external/bsd/compiler_rt/dist/lib/profile/GCDAProfiling.c

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



CVS commit: src/lib/libc/citrus

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 17:52:06 UTC 2018

Modified Files:
src/lib/libc/citrus: citrus_lc_ctype.c

Log Message:
Include namespace.h in citrus/citrus_lc_ctype.c

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

This change eliminates usage of the global name of the following symbol:
  - strlcpy -> _strlcpy

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/citrus/citrus_lc_ctype.c

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

Modified files:

Index: src/lib/libc/citrus/citrus_lc_ctype.c
diff -u src/lib/libc/citrus/citrus_lc_ctype.c:1.15 src/lib/libc/citrus/citrus_lc_ctype.c:1.16
--- src/lib/libc/citrus/citrus_lc_ctype.c:1.15	Fri Sep 13 13:13:32 2013
+++ src/lib/libc/citrus/citrus_lc_ctype.c	Fri Jan  5 17:52:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_lc_ctype.c,v 1.15 2013/09/13 13:13:32 joerg Exp $ */
+/* $NetBSD: citrus_lc_ctype.c,v 1.16 2018/01/05 17:52:06 kamil Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,9 +28,10 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lc_ctype.c,v 1.15 2013/09/13 13:13:32 joerg Exp $");
+__RCSID("$NetBSD: citrus_lc_ctype.c,v 1.16 2018/01/05 17:52:06 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
 #include "reentrant.h"
 #include 
 #include 



CVS commit: src/lib/libc/citrus

2018-01-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jan  5 17:52:06 UTC 2018

Modified Files:
src/lib/libc/citrus: citrus_lc_ctype.c

Log Message:
Include namespace.h in citrus/citrus_lc_ctype.c

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

This change eliminates usage of the global name of the following symbol:
  - strlcpy -> _strlcpy

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/citrus/citrus_lc_ctype.c

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



CVS commit: src/sys/dev/dm

2018-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  5 14:22:05 UTC 2018

Modified Files:
src/sys/dev/dm: dm_ioctl.c dm_target_linear.c dm_target_snapshot.c

Log Message:
PR/52900: Tomohiro Kusumi: Fix kernel panic when target's ->init() failed
Reliably unbusy the target in the *all* the destroy routines, so ioctl
does not need to do it.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_target_snapshot.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/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.31 src/sys/dev/dm/dm_ioctl.c:1.32
--- src/sys/dev/dm/dm_ioctl.c:1.31	Wed May 31 22:45:09 2017
+++ src/sys/dev/dm/dm_ioctl.c	Fri Jan  5 09:22:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.31 2017/06/01 02:45:09 chs Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.32 2018/01/05 14:22:05 christos Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,6 +28,8 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+#include 
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.32 2018/01/05 14:22:05 christos Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -158,6 +160,7 @@ dm_dbg_print_flags(int flags)
 
 	return 0;
 }
+
 /*
  * Get version ioctl call I do it as default therefore this
  * function is unused now.
@@ -168,6 +171,7 @@ dm_get_version_ioctl(prop_dictionary_t d
 
 	return 0;
 }
+
 /*
  * Get list of all available targets from global
  * target list and sent them back to libdevmapper.
@@ -190,6 +194,7 @@ dm_list_versions_ioctl(prop_dictionary_t
 
 	return 0;
 }
+
 /*
  * Create in-kernel entry for device. Device attributes such as name, uuid are
  * taken from proplib dictionary.
@@ -271,6 +276,7 @@ dm_dev_create_ioctl(prop_dictionary_t dm
 
 	return r;
 }
+
 /*
  * Get list of created device-mapper devices fromglobal list and
  * send it to kernel.
@@ -309,6 +315,7 @@ dm_dev_list_ioctl(prop_dictionary_t dm_d
 
 	return 0;
 }
+
 /*
  * Rename selected devices old name is in struct dm_ioctl.
  * newname is taken from dictionary
@@ -366,6 +373,7 @@ dm_dev_rename_ioctl(prop_dictionary_t dm
 
 	return 0;
 }
+
 /*
  * Remove device from global list I have to remove active
  * and inactive tables first.
@@ -408,6 +416,7 @@ dm_dev_remove_ioctl(prop_dictionary_t dm
 	 */
 	return config_detach(devt, DETACH_QUIET);
 }
+
 /*
  * Return actual state of device to libdevmapper.
  */
@@ -461,6 +470,7 @@ dm_dev_status_ioctl(prop_dictionary_t dm
 
 	return 0;
 }
+
 /*
  * Set only flag to suggest that device is suspended. This call is
  * not supported in NetBSD.
@@ -501,6 +511,7 @@ dm_dev_suspend_ioctl(prop_dictionary_t d
 
 	return 0;
 }
+
 /*
  * Simulate Linux behaviour better and switch tables here and not in
  * dm_table_load_ioctl.
@@ -551,6 +562,7 @@ dm_dev_resume_ioctl(prop_dictionary_t dm
 
 	return 0;
 }
+
 /*
  * Table management routines
  * lvm2tools doens't send name/uuid to kernel with table
@@ -596,6 +608,7 @@ dm_table_clear_ioctl(prop_dictionary_t d
 
 	return 0;
 }
+
 /*
  * Get list of physical devices for active table.
  * Get dev_t from pdev vnode and insert it into cmd_array.
@@ -661,6 +674,7 @@ dm_table_deps_ioctl(prop_dictionary_t dm
 
 	return 0;
 }
+
 /*
  * Load new table/tables to device.
  * Call apropriate target init routine open all physical pdev's and
@@ -788,7 +802,6 @@ dm_table_load_ioctl(prop_dictionary_t dm
 			free(str, M_TEMP);
 
 			dm_dev_unbusy(dmv);
-			dm_target_unbusy(target);
 			prop_object_iterator_release(iter);
 			return ret;
 		}
@@ -804,6 +817,7 @@ dm_table_load_ioctl(prop_dictionary_t dm
 	dm_dev_unbusy(dmv);
 	return 0;
 }
+
 /*
  * Get description of all tables loaded to device from kernel
  * and send it to libdevmapper.
@@ -935,7 +949,6 @@ dm_table_status_ioctl(prop_dictionary_t 
 	return 0;
 }
 
-
 /*
  * For every call I have to set kernel driver version.
  * Because I can have commands supported only in other

Index: src/sys/dev/dm/dm_target_linear.c
diff -u src/sys/dev/dm/dm_target_linear.c:1.16 src/sys/dev/dm/dm_target_linear.c:1.17
--- src/sys/dev/dm/dm_target_linear.c:1.16	Sun Jun  4 04:54:38 2017
+++ src/sys/dev/dm/dm_target_linear.c	Fri Jan  5 09:22:05 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_linear.c,v 1.16 2017/06/04 08:54:38 mbalmer Exp $  */
+/*$NetBSD: dm_target_linear.c,v 1.17 2018/01/05 14:22:05 christos Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,8 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-
+#include 
+__KERNEL_RCSID(0, "$NetBSD: dm_target_linear.c,v 1.17 2018/01/05 14:22:05 christos Exp $");
 
 /*
  * This file 

CVS commit: src/sys/dev/dm

2018-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  5 14:22:27 UTC 2018

Modified Files:
src/sys/dev/dm: dm_dev.c dm_pdev.c dm_table.c dm_target.c
dm_target_error.c dm_target_mirror.c dm_target_stripe.c
dm_target_zero.c

Log Message:
use some size_t, add whitespace between functions, rcsids.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dm/dm_dev.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/dm/dm_pdev.c \
src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_target_zero.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/dm/dm_dev.c
diff -u src/sys/dev/dm/dm_dev.c:1.10 src/sys/dev/dm/dm_dev.c:1.11
--- src/sys/dev/dm/dm_dev.c:1.10	Wed May 31 22:45:09 2017
+++ src/sys/dev/dm/dm_dev.c	Fri Jan  5 09:22:26 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_dev.c,v 1.10 2017/06/01 02:45:09 chs Exp $  */
+/*$NetBSD: dm_dev.c,v 1.11 2018/01/05 14:22:26 christos Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,6 +28,8 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+#include 
+__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.11 2018/01/05 14:22:26 christos Exp $");
 
 #include 
 #include 
@@ -61,6 +63,7 @@ disable_dev(dm_dev_t * dmv)
 		cv_wait(>dev_cv, >dev_mtx);
 	mutex_exit(>dev_mtx);
 }
+
 /*
  * Generic function used to lookup dm_dev_t. Calling with dm_dev_name
  * and dm_dev_uuid NULL is allowed.
@@ -98,7 +101,6 @@ dm_dev_lookup(const char *dm_dev_name, c
 	return NULL;
 }
 
-
 /*
  * Lookup device with its minor number.
  */
@@ -114,6 +116,7 @@ dm_dev_lookup_minor(int dm_dev_minor)
 
 	return NULL;
 }
+
 /*
  * Lookup device with its device name.
  */
@@ -121,8 +124,8 @@ static dm_dev_t *
 dm_dev_lookup_name(const char *dm_dev_name)
 {
 	dm_dev_t *dmv;
-	int dlen;
-	int slen;
+	size_t dlen;
+	size_t slen;
 
 	slen = strlen(dm_dev_name);
 
@@ -142,6 +145,7 @@ dm_dev_lookup_name(const char *dm_dev_na
 
 	return NULL;
 }
+
 /*
  * Lookup device with its device uuid. Used mostly by LVM2tools.
  */
@@ -168,6 +172,7 @@ dm_dev_lookup_uuid(const char *dm_dev_uu
 
 	return NULL;
 }
+
 /*
  * Insert new device to the global list of devices.
  */
@@ -194,6 +199,7 @@ dm_dev_insert(dm_dev_t * dev)
 	mutex_exit(_dev_mutex);
 	return r;
 }
+
 #ifdef notyet
 /*
  * Lookup device with its minor number.
@@ -238,6 +244,7 @@ dm_dev_detach(device_t devt)
 
 	return NULL;
 }
+
 /*
  * Remove device selected with dm_dev from global list of devices.
  */
@@ -269,6 +276,7 @@ dm_dev_rem(const char *dm_dev_name, cons
 
 	return NULL;
 }
+
 /*
  * Destroy all devices created in device-mapper. Remove all tables
  * free all allocated memmory.
@@ -310,6 +318,7 @@ dm_dev_destroy(void)
 	mutex_destroy(_dev_mutex);
 	return 0;
 }
+
 /*
  * Allocate new device entry.
  */
@@ -322,6 +331,7 @@ dm_dev_alloc(void)
 	dmv->diskp = kmem_zalloc(sizeof(struct disk), KM_SLEEP);
 	return dmv;
 }
+
 /*
  * Freed device entry.
  */
@@ -360,6 +370,7 @@ dm_dev_unbusy(dm_dev_t * dmv)
 		cv_broadcast(>dev_cv);
 	mutex_exit(>dev_mtx);
 }
+
 /*
  * Return prop_array of dm_targer_list dictionaries.
  */
@@ -387,6 +398,7 @@ dm_dev_prop_list(void)
 	mutex_exit(_dev_mutex);
 	return dev_array;
 }
+
 /*
  * Initialize global device mutex.
  */

Index: src/sys/dev/dm/dm_pdev.c
diff -u src/sys/dev/dm/dm_pdev.c:1.9 src/sys/dev/dm/dm_pdev.c:1.10
--- src/sys/dev/dm/dm_pdev.c:1.9	Wed May 31 22:45:09 2017
+++ src/sys/dev/dm/dm_pdev.c	Fri Jan  5 09:22:26 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_pdev.c,v 1.9 2017/06/01 02:45:09 chs Exp $  */
+/*$NetBSD: dm_pdev.c,v 1.10 2018/01/05 14:22:26 christos Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,6 +28,8 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+#include 
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.10 2018/01/05 14:22:26 christos Exp $");
 
 #include 
 #include 
@@ -44,21 +46,21 @@
 
 SLIST_HEAD(dm_pdevs, dm_pdev) dm_pdev_list;
 
-	kmutex_t dm_pdev_mutex;
+kmutex_t dm_pdev_mutex;
 
-	static dm_pdev_t *dm_pdev_alloc(const char *);
-	static int dm_pdev_rem(dm_pdev_t *);
-	static dm_pdev_t *dm_pdev_lookup_name(const char *);
+static dm_pdev_t *dm_pdev_alloc(const char *);
+static int dm_pdev_rem(dm_pdev_t *);
+static dm_pdev_t *dm_pdev_lookup_name(const char *);
 
 /*
- * Find used pdev with name == dm_pdev_name.
- */
-	dm_pdev_t *
-	  dm_pdev_lookup_name(const char *dm_pdev_name)
+* Find used pdev with name == dm_pdev_name.
+*/
+dm_pdev_t *
+dm_pdev_lookup_name(const char 

CVS commit: src/sys/dev/dm

2018-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  5 14:22:05 UTC 2018

Modified Files:
src/sys/dev/dm: dm_ioctl.c dm_target_linear.c dm_target_snapshot.c

Log Message:
PR/52900: Tomohiro Kusumi: Fix kernel panic when target's ->init() failed
Reliably unbusy the target in the *all* the destroy routines, so ioctl
does not need to do it.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/dm/dm_ioctl.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_target_linear.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_target_snapshot.c

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



CVS commit: src/sys/dev/dm

2018-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan  5 14:22:27 UTC 2018

Modified Files:
src/sys/dev/dm: dm_dev.c dm_pdev.c dm_table.c dm_target.c
dm_target_error.c dm_target_mirror.c dm_target_stripe.c
dm_target_zero.c

Log Message:
use some size_t, add whitespace between functions, rcsids.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dm/dm_dev.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/dm/dm_pdev.c \
src/sys/dev/dm/dm_target_mirror.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dm/dm_table.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dm/dm_target.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/dm/dm_target_error.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/dm/dm_target_stripe.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dm/dm_target_zero.c

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



CVS commit: src/sys/arch/pmax/conf

2018-01-05 Thread Felix Deichmann
Module Name:src
Committed By:   flxd
Date:   Fri Jan  5 13:20:46 UTC 2018

Modified Files:
src/sys/arch/pmax/conf: GENERIC

Log Message:
Comment out DIAGNOSTIC/DEBUG/LOCKDEBUG from r1.192 slowing down real machines.
OK christos@


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/sys/arch/pmax/conf/GENERIC

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/pmax/conf/GENERIC
diff -u src/sys/arch/pmax/conf/GENERIC:1.194 src/sys/arch/pmax/conf/GENERIC:1.195
--- src/sys/arch/pmax/conf/GENERIC:1.194	Thu Sep 14 07:58:42 2017
+++ src/sys/arch/pmax/conf/GENERIC	Fri Jan  5 13:20:45 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.194 2017/09/14 07:58:42 mrg Exp $
+# $NetBSD: GENERIC,v 1.195 2018/01/05 13:20:45 flxd Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/pmax/conf/std.pmax"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.194 $"
+#ident		"GENERIC-$Revision: 1.195 $"
 
 maxusers	64
 
@@ -47,9 +47,9 @@ makeoptions	DEBUG="-g"
 options 	DDB			# in-kernel debugger
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 options 	DDB_ONPANIC=0		# don't enter debugger on panic
-options 	DIAGNOSTIC		# extra kernel debugging checks
-options 	DEBUG			# extra kernel debugging support
-options		LOCKDEBUG
+#options 	DIAGNOSTIC		# extra kernel debugging checks
+#options 	DEBUG			# extra kernel debugging support
+#options 	LOCKDEBUG
 #options	VMFAULT_TRACE
 #options	PMAP_FAULTINFO
 options 	KTRACE			# system call tracing support



CVS commit: src/sys/arch/pmax/conf

2018-01-05 Thread Felix Deichmann
Module Name:src
Committed By:   flxd
Date:   Fri Jan  5 13:20:46 UTC 2018

Modified Files:
src/sys/arch/pmax/conf: GENERIC

Log Message:
Comment out DIAGNOSTIC/DEBUG/LOCKDEBUG from r1.192 slowing down real machines.
OK christos@


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/sys/arch/pmax/conf/GENERIC

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



CVS commit: src/sys/arch/pmax/ibus

2018-01-05 Thread Felix Deichmann
Module Name:src
Committed By:   flxd
Date:   Fri Jan  5 13:11:32 UTC 2018

Modified Files:
src/sys/arch/pmax/ibus: pm.c

Log Message:
Check presence of VFB01/VFB02 frame buffer option on DEC(station|system) 3100.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/pmax/ibus/pm.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/pmax/ibus/pm.c
diff -u src/sys/arch/pmax/ibus/pm.c:1.13 src/sys/arch/pmax/ibus/pm.c:1.14
--- src/sys/arch/pmax/ibus/pm.c:1.13	Tue Jun 13 19:13:55 2017
+++ src/sys/arch/pmax/ibus/pm.c	Fri Jan  5 13:11:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm.c,v 1.13 2017/06/13 19:13:55 spz Exp $	*/
+/*	$NetBSD: pm.c,v 1.14 2018/01/05 13:11:32 flxd Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.13 2017/06/13 19:13:55 spz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.14 2018/01/05 13:11:32 flxd Exp $");
 
 #include 
 #include 
@@ -90,6 +90,7 @@ struct pm_softc {
 
 int	pm_match(device_t, cfdata_t, void *);
 void	pm_attach(device_t, device_t, void *);
+int	pm_check_vfb(void);
 int	pm_ioctl(void *, void *, u_long, void *, int, struct lwp *);
 paddr_t	pm_mmap(void *, void *, off_t, int);
 int	pm_alloc_screen(void *, const struct wsscreen_descr *,
@@ -174,6 +175,9 @@ pm_attach(device_t parent, device_t self
 	if (console) {
 		sc->sc_nscreens = 1;
 		ri->ri_flg &= ~RI_NO_AUTO;
+	} else if (!pm_check_vfb()) {
+		printf(": VFB01/VFB02 frame buffer option not found\n");
+		return;
 	} else
 		pm_common_init();
 
@@ -192,6 +196,27 @@ pm_attach(device_t parent, device_t self
 	config_found(self, , wsemuldisplaydevprint);
 }
 
+int
+pm_check_vfb(void)
+{
+	int *mem;
+	const int magic = 0xcafebabe;
+
+	mem = (void *)MIPS_PHYS_TO_KSEG1(KN01_PHYS_FBUF_START);
+
+	*mem = magic;
+	wbflush();
+	if (*mem != magic)
+		return 0;
+
+	*mem = ~magic;
+	wbflush();
+	if (*mem != ~magic)
+		return 0;
+
+	return 1;
+}
+
 void
 pm_init_cmap(struct pm_softc *sc)
 {



CVS commit: src/sys/arch/pmax/ibus

2018-01-05 Thread Felix Deichmann
Module Name:src
Committed By:   flxd
Date:   Fri Jan  5 13:11:32 UTC 2018

Modified Files:
src/sys/arch/pmax/ibus: pm.c

Log Message:
Check presence of VFB01/VFB02 frame buffer option on DEC(station|system) 3100.


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

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



CVS commit: src/etc/etc.i386

2018-01-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jan  5 10:04:13 UTC 2018

Modified Files:
src/etc/etc.i386: MAKEDEV.conf

Log Message:
 Add NVMe devices.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/etc/etc.i386/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.i386/MAKEDEV.conf
diff -u src/etc/etc.i386/MAKEDEV.conf:1.25 src/etc/etc.i386/MAKEDEV.conf:1.26
--- src/etc/etc.i386/MAKEDEV.conf:1.25	Sun Sep 23 01:15:17 2012
+++ src/etc/etc.i386/MAKEDEV.conf	Fri Jan  5 10:04:13 2018
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.25 2012/09/23 01:15:17 chs Exp $
+# $NetBSD: MAKEDEV.conf,v 1.26 2018/01/05 10:04:13 msaitoh Exp $
 
 # As of 2005-03-15, the "init" case must not create more than 1024 entries.
 all_md)
@@ -13,6 +13,10 @@ all_md)
 	makedev cgd0 cgd1
 	makedev amr0 iop0 mfi0 mlx0 mly0 dpti0 dpt0 twe0 icp0
 	makedev ed0 ed1
+	makedev nvme0 nvme0ns1 nvme0ns2 nvme0ns3 nvme0ns4
+	makedev nvme1 nvme1ns1 nvme1ns2 nvme1ns3 nvme1ns4
+	makedev nvme2 nvme2ns1 nvme2ns2 nvme2ns3 nvme2ns4
+	makedev nvme3 nvme3ns1 nvme3ns2 nvme3ns3 nvme3ns4
 	makedev raid0 raid1 raid2 raid3
 	makedev ld0 ld1 ld2 ld3
 	makedev xbd0 xbd1 xbd2 xbd3 xen



CVS commit: src/etc/etc.i386

2018-01-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jan  5 10:04:13 UTC 2018

Modified Files:
src/etc/etc.i386: MAKEDEV.conf

Log Message:
 Add NVMe devices.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/etc/etc.i386/MAKEDEV.conf

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



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

2018-01-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan  5 09:13:48 UTC 2018

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

Log Message:
Mark L1e_idx as __diagused, it is only referenced in a KASSERT.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.276 src/sys/arch/x86/x86/pmap.c:1.277
--- src/sys/arch/x86/x86/pmap.c:1.276	Fri Jan  5 08:04:21 2018
+++ src/sys/arch/x86/x86/pmap.c	Fri Jan  5 09:13:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.276 2018/01/05 08:04:21 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.277 2018/01/05 09:13:48 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.276 2018/01/05 08:04:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.277 2018/01/05 09:13:48 martin Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1460,7 +1460,7 @@ pmap_init_pcpu(void)
 {
 	const vaddr_t startva = PMAP_PCPU_BASE;
 	size_t nL4e, nL3e, nL2e, nL1e;
-	size_t L4e_idx, L3e_idx, L2e_idx, L1e_idx;
+	size_t L4e_idx, L3e_idx, L2e_idx, L1e_idx __diagused;
 	paddr_t pa;
 	vaddr_t endva;
 	vaddr_t tmpva;



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

2018-01-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan  5 09:13:48 UTC 2018

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

Log Message:
Mark L1e_idx as __diagused, it is only referenced in a KASSERT.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 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.



CVS commit: src/sys/arch

2018-01-05 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  5 08:04:21 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: gdt.c machdep.c
src/sys/arch/amd64/include: types.h
src/sys/arch/x86/include: cpu.h pmap.h
src/sys/arch/x86/x86: cpu.c pmap.c

Log Message:
Add a __HAVE_PCPU_AREA option, enabled by default on native amd64 but not
Xen.

With this option, the CPU structures that must always be present in the
CPU's page tables are moved on L4 slot 384, which means address
0xc000.

A new pcpu_area structure is defined. It contains shared structures (IDT,
LDT), and then an array of pcpu_entry structures, indexed by cpu_index(ci).
Theoretically the LDT should be in the array, but this will be done later.

During the boot procedure, cpu0 calls pmap_init_pcpu, which creates a
page tree that is able to map the pcpu_area structure entirely. cpu0 then
immediately maps the shared structures. Later, every CPU goes through
cpu_pcpuarea_init, which allocates physical pages and kenters the relevant
pcpu_entry to them. Finally, each pointer is replaced to point to pcpuarea.

The point of this change is to make sure that the structures that must
always be present in the page tables have their own L4 slot. Until now
their L4 slot was that of pmap_kernel, and making a distinction between
what must be mapped and what does not need to be was complicated.

Even in the non-speculative-bug case this change makes some sense: there
are several x86 instructions that leak the addresses of the CPU structures,
and putting these structures inside pmap_kernel actually offered a way to
compute the address of the kernel heap - which would have made ASLR on it
plainly useless, had we implemented that.

Note that, for now, pcpuarea does not contain rsp0.

Unfortunately this change adds many #ifdefs, and makes the code harder to
understand. There is also some duplication, but that will be solved later.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.283 -r1.284 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.275 -r1.276 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.



CVS commit: src/sys/arch

2018-01-05 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan  5 08:04:21 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: gdt.c machdep.c
src/sys/arch/amd64/include: types.h
src/sys/arch/x86/include: cpu.h pmap.h
src/sys/arch/x86/x86: cpu.c pmap.c

Log Message:
Add a __HAVE_PCPU_AREA option, enabled by default on native amd64 but not
Xen.

With this option, the CPU structures that must always be present in the
CPU's page tables are moved on L4 slot 384, which means address
0xc000.

A new pcpu_area structure is defined. It contains shared structures (IDT,
LDT), and then an array of pcpu_entry structures, indexed by cpu_index(ci).
Theoretically the LDT should be in the array, but this will be done later.

During the boot procedure, cpu0 calls pmap_init_pcpu, which creates a
page tree that is able to map the pcpu_area structure entirely. cpu0 then
immediately maps the shared structures. Later, every CPU goes through
cpu_pcpuarea_init, which allocates physical pages and kenters the relevant
pcpu_entry to them. Finally, each pointer is replaced to point to pcpuarea.

The point of this change is to make sure that the structures that must
always be present in the page tables have their own L4 slot. Until now
their L4 slot was that of pmap_kernel, and making a distinction between
what must be mapped and what does not need to be was complicated.

Even in the non-speculative-bug case this change makes some sense: there
are several x86 instructions that leak the addresses of the CPU structures,
and putting these structures inside pmap_kernel actually offered a way to
compute the address of the kernel heap - which would have made ASLR on it
plainly useless, had we implemented that.

Note that, for now, pcpuarea does not contain rsp0.

Unfortunately this change adds many #ifdefs, and makes the code harder to
understand. There is also some duplication, but that will be solved later.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.283 -r1.284 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.275 -r1.276 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.44 src/sys/arch/amd64/amd64/gdt.c:1.45
--- src/sys/arch/amd64/amd64/gdt.c:1.44	Thu Jan  4 20:38:30 2018
+++ src/sys/arch/amd64/amd64/gdt.c	Fri Jan  5 08:04:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.44 2018/01/04 20:38:30 maxv Exp $	*/
+/*	$NetBSD: gdt.c,v 1.45 2018/01/05 08:04:20 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.44 2018/01/04 20:38:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.45 2018/01/05 08:04:20 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -132,8 +132,6 @@ void
 gdt_init(void)
 {
 	char *old_gdt;
-	struct vm_page *pg;
-	vaddr_t va;
 	struct cpu_info *ci = _info_primary;
 
 	/* Initialize the global values */
@@ -142,6 +140,13 @@ gdt_init(void)
 
 	old_gdt = gdtstore;
 
+#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 gdt_size bytes of memory. */
 	gdtstore = (char *)uvm_km_alloc(kernel_map, gdt_size, 0,
 	UVM_KMF_VAONLY);
@@ -155,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);
@@ -174,6 +180,9 @@ gdt_init(void)
 void
 gdt_alloc_cpu(struct cpu_info *ci)
 {
+#ifdef __HAVE_PCPU_AREA
+	ci->ci_gdt = (union descriptor *)>ent[cpu_index(ci)].gdt;
+#else
 	struct vm_page *pg;
 	vaddr_t va;
 
@@ -189,6 +198,7 @@ gdt_alloc_cpu(struct cpu_info *ci)
 		VM_PROT_READ | VM_PROT_WRITE, 0);
 	}
 	pmap_update(pmap_kernel());
+#endif
 
 	memcpy(ci->ci_gdt, gdtstore, gdt_size);
 }

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.283 src/sys/arch/amd64/amd64/machdep.c:1.284
--- src/sys/arch/amd64/amd64/machdep.c:1.283	Thu Jan  4 13:36:30 2018
+++ src/sys/arch/amd64/amd64/machdep.c	Fri Jan  5 08:04:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.283 2018/01/04 13:36:30 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.284 2018/01/05 08:04:20 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.283 2018/01/04 13:36:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: