CVS commit: src/tests/net/route

2017-03-23 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Mar 24 04:06:19 UTC 2017

Modified Files:
src/tests/net/route: t_change.sh

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/net/route/t_change.sh

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

Modified files:

Index: src/tests/net/route/t_change.sh
diff -u src/tests/net/route/t_change.sh:1.10 src/tests/net/route/t_change.sh:1.11
--- src/tests/net/route/t_change.sh:1.10	Wed Mar 22 06:30:00 2017
+++ src/tests/net/route/t_change.sh	Fri Mar 24 04:06:19 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_change.sh,v 1.10 2017/03/22 06:30:00 ozaki-r Exp $
+#	$NetBSD: t_change.sh,v 1.11 2017/03/24 04:06:19 ozaki-r Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -323,7 +323,7 @@ route_change_flags_body()
 	# TODO other flags
 }
 
-route_change_default_flags_cleanup()
+route_change_flags_cleanup()
 {
 
 	env RUMP_SERVER=unix://commsock rump.halt



CVS commit: src/tests/net/route

2017-03-23 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Mar 24 03:47:25 UTC 2017

Modified Files:
src/tests/net/route: t_route.sh

Log Message:
Add test cases for PR kern/52077

>From s-yamaguchi@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/route/t_route.sh

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

Modified files:

Index: src/tests/net/route/t_route.sh
diff -u src/tests/net/route/t_route.sh:1.11 src/tests/net/route/t_route.sh:1.12
--- src/tests/net/route/t_route.sh:1.11	Tue Mar 21 04:03:17 2017
+++ src/tests/net/route/t_route.sh	Fri Mar 24 03:47:25 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_route.sh,v 1.11 2017/03/21 04:03:17 ozaki-r Exp $
+#	$NetBSD: t_route.sh,v 1.12 2017/03/24 03:47:25 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -45,6 +45,8 @@ IP6DSTGW=fc00:0:0:2::1
 IP6DST=fc00:0:0:2::2
 BUS_SRCGW=bus1
 BUS_DSTGW=bus2
+# command_add
+SOCKHOST=unix://commsock1
 
 DEBUG=${DEBUG:-false}
 TIMEOUT=1
@@ -437,6 +439,106 @@ route_default_reject_cleanup()
 	cleanup
 }
 
+atf_test_case route_command_add cleanup
+route_command_add_head()
+{
+
+	atf_set "descr" "tests of route add command"
+	atf_set "require.progs" "rump_server"
+}
+
+route_command_add_body()
+{
+
+	rump_server_start $SOCKHOST
+
+	export RUMP_SERVER=${SOCKHOST}
+	rump_server_add_iface $SOCKHOST shmif0 $BUS
+	atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.1/24
+
+	# Accept the route whose gateway is in a subnet of interface address
+	atf_check -s exit:0 -o ignore rump.route add \
+	-net 10.0.1.0/24 10.0.0.2
+	atf_check -s exit:0 -o ignore rump.route add \
+	-host 10.0.2.1 10.0.0.3
+
+	# Accept the route whose gateway is an interface
+	atf_check -s exit:0 -o ignore rump.route add \
+	-net 10.0.3.0/24 -connected -link -iface shmif0
+
+	# Accept the route whose gateway is reachable and not RTF_GATEWAY
+	atf_check -s exit:0 -o ignore rump.route add \
+	-net 10.0.4.0/24 10.0.3.1
+
+	# Don't accept the route whose destination is reachable and
+	# gateway is unreachable
+	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
+	-net 10.0.1.0/26 10.0.5.1
+
+	# Don't accept the route whose gateway is reachable and RTF_GATEWAY
+	atf_check -s not-exit:0 -o ignore -e ignore rump.route add \
+	-net 10.0.6.0/24 10.0.1.1
+
+	rump_server_destroy_ifaces
+}
+
+route_command_add_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
+atf_test_case route_command_add6 cleanup
+route_command_add6_head()
+{
+
+	atf_set "descr" "tests of route add command (IPv6)"
+	atf_set "require.progs" "rump_server"
+}
+
+route_command_add6_body()
+{
+
+	rump_server_start $SOCKHOST netinet6
+
+	export RUMP_SERVER=${SOCKHOST}
+	rump_server_add_iface $SOCKHOST shmif0 $BUS
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1/64
+
+	# Accept the route whose gateway is in a subnet of interface address
+	atf_check -s exit:0 -o ignore rump.route add -inet6\
+	-net fc00:1::0/64 fc00::2
+	atf_check -s exit:0 -o ignore rump.route add -inet6\
+	-host fc00:2::1 fc00::3
+
+	# Accept the route whose gateway is an interface
+	atf_check -s exit:0 -o ignore rump.route add -inet6\
+	-net fc00:3::0/64 -connected -link -iface shmif0
+
+	# Accept the route whose gateway is reachable and not RTF_GATEWAY
+	atf_check -s exit:0 -o ignore rump.route add -inet6\
+	-net fc00:4::0/64 fc00:3::1
+
+	# Don't accept the route whose destination is reachable and
+	# gateway is unreachable
+	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
+	-inet6 -net fc00::4/128 fc00:5::1
+
+	# Don't accept the route whose gateway is reachable and RTF_GATEWAY
+	atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
+	-inet6 -net fc00:6::0/64 fc00:1::1
+
+	rump_server_destroy_ifaces
+}
+
+route_command_add6_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -444,4 +546,6 @@ atf_init_test_cases()
 	atf_add_test_case route_command_get
 	atf_add_test_case route_command_get6
 	atf_add_test_case route_default_reject
+	atf_add_test_case route_command_add
+	atf_add_test_case route_command_add6
 }



CVS commit: src/sys/net

2017-03-23 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Mar 24 03:45:02 UTC 2017

Modified Files:
src/sys/net: route.c rtsock.c

Log Message:
Forbit installing a route which its gateway is unreachable

This change needs a tweak in route_output_change to unbreak route
change commands (e.g., route change -inet6 default -reject).

PR kern/52077 (s-yamaguchi@IIJ and ozaki-r@)


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/net/route.c
cvs rdiff -u -r1.210 -r1.211 src/sys/net/rtsock.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/route.c
diff -u src/sys/net/route.c:1.193 src/sys/net/route.c:1.194
--- src/sys/net/route.c:1.193	Wed Mar 22 07:14:18 2017
+++ src/sys/net/route.c	Fri Mar 24 03:45:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.193 2017/03/22 07:14:18 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.194 2017/03/24 03:45:02 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.193 2017/03/22 07:14:18 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.194 2017/03/24 03:45:02 ozaki-r Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -1026,11 +1026,15 @@ ifa_ifwithroute_psref(int flags, const s
 
 		/* XXX we cannot call rtalloc1 if holding the rt lock */
 		if (RT_LOCKED())
-			rt = rtalloc1_locked(dst, 0, true);
+			rt = rtalloc1_locked(gateway, 0, true);
 		else
-			rt = rtalloc1(dst, 0);
+			rt = rtalloc1(gateway, 0);
 		if (rt == NULL)
 			return NULL;
+		if (rt->rt_flags & RTF_GATEWAY) {
+			rt_unref(rt);
+			return NULL;
+		}
 		/*
 		 * Just in case. May not need to do this workaround.
 		 * Revisit when working on rtentry MP-ification.

Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.210 src/sys/net/rtsock.c:1.211
--- src/sys/net/rtsock.c:1.210	Wed Mar 22 07:14:18 2017
+++ src/sys/net/rtsock.c	Fri Mar 24 03:45:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.210 2017/03/22 07:14:18 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.211 2017/03/24 03:45:02 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.210 2017/03/22 07:14:18 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.211 2017/03/24 03:45:02 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -599,22 +599,29 @@ route_output_change(struct rtentry *rt, 
 struct rt_xmsghdr *rtm)
 {
 	int error = 0;
-	struct ifnet *ifp, *new_ifp;
-	struct ifaddr *ifa, *new_ifa;
+	struct ifnet *ifp = NULL, *new_ifp;
+	struct ifaddr *ifa = NULL, *new_ifa;
 	struct psref psref_ifa, psref_new_ifa, psref_ifp;
+	bool newgw;
 
 	/*
 	 * New gateway could require new ifaddr, ifp;
 	 * flags may also be different; ifp may be specified
 	 * by ll sockaddr when protocol address is ambiguous
 	 */
-	ifp = rt_getifp(info, _ifp);
-	ifa = rt_getifa(info, _ifa);
-	if (ifa == NULL) {
-		error = ENETUNREACH;
-		goto out;
+	newgw = info->rti_info[RTAX_GATEWAY] != NULL &&
+	sockaddr_cmp(info->rti_info[RTAX_GATEWAY], rt->rt_gateway) != 0;
+
+	if (newgw || info->rti_info[RTAX_IFP] != NULL ||
+	info->rti_info[RTAX_IFA] != NULL) {
+		ifp = rt_getifp(info, _ifp);
+		ifa = rt_getifa(info, _ifa);
+		if (ifa == NULL) {
+			error = ENETUNREACH;
+			goto out;
+		}
 	}
-	if (info->rti_info[RTAX_GATEWAY]) {
+	if (newgw) {
 		error = rt_setgate(rt, info->rti_info[RTAX_GATEWAY]);
 		if (error != 0)
 			goto out;



CVS commit: src/sys/arch/i386/stand/efiboot

2017-03-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Mar 24 01:25:36 UTC 2017

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
Don't maximize the text columns and rows. only use 100x31 or 80x25.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.2 src/sys/arch/i386/stand/efiboot/eficons.c:1.3
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.2	Fri Mar 24 01:00:47 2017
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Fri Mar 24 01:25:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.2 2017/03/24 01:00:47 nonaka Exp $	*/
+/*	$NetBSD: eficons.c,v 1.3 2017/03/24 01:25:36 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -499,24 +499,27 @@ static void
 eficons_init_video(void)
 {
 	EFI_STATUS status;
-	UINTN cols, rows, dim = 0;
-	INT32 i, best = -1;
+	UINTN cols, rows;
+	INT32 i, best, mode80x25, mode100x31;
 
 	/*
 	 * Setup text mode
 	 */
 	uefi_call_wrapper(ST->ConOut->Reset, 2, ST->ConOut, TRUE);
 
+	mode80x25 = mode100x31 = -1;
 	for (i = 0; i < ST->ConOut->Mode->MaxMode; i++) {
 		status = uefi_call_wrapper(ST->ConOut->QueryMode, 4,
 		ST->ConOut, i, , );
 		if (EFI_ERROR(status))
 			continue;
-		if (dim < cols * rows) {
-			dim = cols * rows;
-			best = i;
-		}
+
+		if (mode80x25 < 0 && cols == 80 && rows == 25)
+			mode80x25 = i;
+		else if (mode100x31 < 0 && cols == 100 && rows == 31)
+			mode100x31 = i;
 	}
+	best = mode100x31 >= 0 ? mode100x31 : mode80x25 >= 0 ? mode80x25 : -1;
 	if (best >= 0)
 		uefi_call_wrapper(ST->ConOut->SetMode, 2, ST->ConOut, best);
 	uefi_call_wrapper(ST->ConOut->EnableCursor, 2, ST->ConOut, TRUE);



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

2017-03-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar 24 01:14:26 UTC 2017

Modified Files:
src/sys/arch/sparc64/dev: psycho.c

Log Message:
disable BUS_SPACE_MAP_PREFETCHABLE until I figure out which psychos support
partial writes
apparently the only devices which can actually do that are UPA graphics cards


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/sparc64/dev/psycho.c

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

Modified files:

Index: src/sys/arch/sparc64/dev/psycho.c
diff -u src/sys/arch/sparc64/dev/psycho.c:1.124 src/sys/arch/sparc64/dev/psycho.c:1.125
--- src/sys/arch/sparc64/dev/psycho.c:1.124	Tue May 10 19:23:59 2016
+++ src/sys/arch/sparc64/dev/psycho.c	Fri Mar 24 01:14:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: psycho.c,v 1.124 2016/05/10 19:23:59 palle Exp $	*/
+/*	$NetBSD: psycho.c,v 1.125 2017/03/24 01:14:26 macallan Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.124 2016/05/10 19:23:59 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.125 2017/03/24 01:14:26 macallan Exp $");
 
 #include "opt_ddb.h"
 
@@ -1173,6 +1173,8 @@ _psycho_bus_map(bus_space_tag_t t, bus_a
 			__func__, t->type, (unsigned long long)offset,
 			(unsigned long long)size, flags));
 
+	flags &= ~BUS_SPACE_MAP_PREFETCHABLE;
+
 	ss = sparc_pci_childspace(t->type);
 	DPRINTF(PDB_BUSMAP, (" cspace %d", ss));
 
@@ -1200,6 +1202,8 @@ psycho_bus_mmap(bus_space_tag_t t, bus_a
 	struct psycho_ranges *pr;
 	int ss;
 
+	flags &= ~BUS_SPACE_MAP_PREFETCHABLE;
+
 	ss = sparc_pci_childspace(t->type);
 
 	DPRINTF(PDB_BUSMAP, ("%s: prot %x flags %d busaddr %qx\n",



CVS commit: src/sys/arch/i386/stand/efiboot

2017-03-23 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Mar 24 01:00:47 UTC 2017

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
Don't maximize the screen size when gop is not specified.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.1 src/sys/arch/i386/stand/efiboot/eficons.c:1.2
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Fri Mar 24 01:00:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.1 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: eficons.c,v 1.2 2017/03/24 01:00:47 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -209,9 +209,6 @@ bi_framebuffer(void)
 	EFI_STATUS status;
 	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
 	struct btinfo_framebuffer fb;
-	UINT64 res, bestres = 0;
-	UINTN sz;
-	UINT32 i;
 	INT32 bestmode = -1;
 
 	if (efi_gop == NULL) {
@@ -222,7 +219,12 @@ bi_framebuffer(void)
 	if (efi_gop_mode >= 0) {
 		bestmode = efi_gop_mode;
 	} else {
-		/* XXX EDID? EFI_EDID_DISCOVERD_PROTOCOL */
+#if 0
+		UINT64 res, bestres = 0;
+		UINTN sz;
+		UINT32 i;
+
+		/* XXX EDID? EFI_EDID_DISCOVERED_PROTOCOL */
 		for (i = 0; i < efi_gop->Mode->MaxMode; i++) {
 			status = uefi_call_wrapper(efi_gop->QueryMode, 4,
 			efi_gop, i, , );
@@ -237,6 +239,7 @@ bi_framebuffer(void)
 bestres = res;
 			}
 		}
+#endif
 	}
 	if (bestmode >= 0) {
 		status = uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop,



CVS commit: xsrc/external/mit/xf86-video-wsfb/dist/src

2017-03-23 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Mar 24 00:57:33 UTC 2017

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c

Log Message:
support WSFB_VRAM_IS_SPLIT workaround for wildcat boards - use a shadow fb
and copy dirty areas into both framebuffers
now we can use X on Sun XVR-1200
should work on XVR-500 and others as well


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.28 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.29
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.28	Tue Aug 16 06:28:25 2016
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Fri Mar 24 00:57:33 2017
@@ -141,6 +141,7 @@ static Bool WsfbDGAInit(ScrnInfoPtr, Scr
 #endif
 
 static void WsfbShadowUpdateSwap32(ScreenPtr, shadowBufPtr);
+static void WsfbShadowUpdateSplit(ScreenPtr, shadowBufPtr);
 
 static Bool WsfbDriverFunc(ScrnInfoPtr, xorgDriverFuncOp, pointer);
 
@@ -595,7 +596,13 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 			xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
    "Shadow FB option ignored on depth < 8");
 		}
-
+	if (fPtr->fbi.fbi_flags & WSFB_VRAM_IS_SPLIT) {
+		if (!fPtr->shadowFB) {
+			xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+   "Shadow FB forced on for split framebuffer");
+			fPtr->shadowFB = TRUE;
+		}
+	}
 	/* Rotation */
 	fPtr->rotate = WSFB_ROTATE_NONE;
 	if ((s = xf86GetOptValString(fPtr->Options, OPTION_ROTATE))) {
@@ -801,6 +808,7 @@ WsfbCreateScreenResources(ScreenPtr pScr
 	WsfbPtr fPtr = WSFBPTR(pScrn);
 	PixmapPtr pPixmap;
 	Bool ret;
+	void (*shadowproc)(ScreenPtr, shadowBufPtr);
 
 	pScreen->CreateScreenResources = fPtr->CreateScreenResources;
 	ret = pScreen->CreateScreenResources(pScreen);
@@ -810,10 +818,16 @@ WsfbCreateScreenResources(ScreenPtr pScr
 		return FALSE;
 
 	pPixmap = pScreen->GetScreenPixmap(pScreen);
-
-	if (!shadowAdd(pScreen, pPixmap, fPtr->rotate ?
-		shadowUpdateRotatePackedWeak() : (fPtr->useSwap32 ? 
-		WsfbShadowUpdateSwap32 : shadowUpdatePackedWeak()),
+	if (fPtr->fbi.fbi_flags & WSFB_VRAM_IS_SPLIT) {
+		shadowproc = WsfbShadowUpdateSplit;
+	} else if (fPtr->useSwap32) {
+		shadowproc = WsfbShadowUpdateSwap32;
+	} else if (fPtr->rotate) {
+		shadowproc = shadowUpdateRotatePacked;
+	} else
+		shadowproc = shadowUpdatePacked;
+	
+	if (!shadowAdd(pScreen, pPixmap, shadowproc,
 		WsfbWindowLinear, fPtr->rotate, NULL)) {
 		return FALSE;
 	}
@@ -905,6 +919,7 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 			   strerror(errno));
 		return FALSE;
 	}
+	len = max(len, fPtr->fbi.fbi_fbsize);
 	fPtr->fbmem = wsfb_mmap(len, 0, fPtr->fd);
 
 	if (fPtr->fbmem == NULL) {
@@ -957,8 +972,7 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 #endif
 
 	if (fPtr->shadowFB) {
-		fPtr->shadow = calloc(1, pScrn->virtualX * pScrn->virtualY *
-		pScrn->bitsPerPixel/8);
+		fPtr->shadow = calloc(1, fPtr->fbi.fbi_stride * pScrn->virtualY);
 
 		if (!fPtr->shadow) {
 			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -984,7 +998,9 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 		fPtr->shadowFB ? fPtr->shadow : fPtr->fbstart,
 		pScrn->virtualX, pScrn->virtualY,
 		pScrn->xDpi, pScrn->yDpi,
-		pScrn->displayWidth, pScrn->bitsPerPixel);
+		/* apparently fb wants stride in pixels, not bytes */
+		fPtr->fbi.fbi_stride / (pScrn->bitsPerPixel >> 3),
+		pScrn->bitsPerPixel);
 		break;
 	default:
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -1681,3 +1697,77 @@ WsfbShadowUpdateSwap32(ScreenPtr pScreen
 }
 }
 
+void
+WsfbShadowUpdateSplit(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+WsfbPtr 	fPtr = WSFBPTR(pScrn);
+RegionPtr	damage = shadowDamage (pBuf);
+PixmapPtr	pShadow = pBuf->pPixmap;
+int		nbox = RegionNumRects (damage);
+BoxPtr	pbox = RegionRects (damage);
+FbBits	*shaBase, *shaLine, *sha;
+FbStride	shaStride;
+int		scrBase, scrLine, scr;
+int		shaBpp;
+int		shaXoff, shaYoff; /* XXX assumed to be zero */
+int		x, y, w, h, width;
+int i;
+FbBits	*winBase = NULL, *win, *win2;
+unsigned long split = fPtr->fbi.fbi_fbsize / 2; 
+CARD32  winSize;
+
+fbGetDrawable (>drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff);
+while (nbox--)
+{
+	x = pbox->x1 * shaBpp;
+	y = pbox->y1;
+	w = (pbox->x2 - pbox->x1) * shaBpp;
+	h = pbox->y2 - pbox->y1;
+
+	scrLine = (x >> FB_SHIFT);
+	shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
+   
+	x &= FB_MASK;
+	w = (w + x + FB_MASK) >> FB_SHIFT;
+	
+	while (h--)
+	{
+	winSize = 0;
+	scrBase = 0;
+	width = w;
+	scr = scrLine;
+	sha = shaLine;
+	while (width) {
+		/* how much 

CVS commit: src/sys/dev/pci

2017-03-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar 24 00:52:49 UTC 2017

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

Log Message:
missed one line of debug spam...


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/wcfb.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/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.15 src/sys/dev/pci/wcfb.c:1.16
--- src/sys/dev/pci/wcfb.c:1.15	Fri Mar 24 00:51:43 2017
+++ src/sys/dev/pci/wcfb.c	Fri Mar 24 00:52:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wcfb.c,v 1.15 2017/03/24 00:51:43 macallan Exp $ */
+/*	$NetBSD: wcfb.c,v 1.16 2017/03/24 00:52:49 macallan Exp $ */
 
 /*
  * Copyright (c) 2007, 2008, 2009 Miodrag Vallat.
@@ -20,7 +20,7 @@
 /* a driver for (some) 3DLabs Wildcat cards, based on OpenBSD's ifb driver */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.15 2017/03/24 00:51:43 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.16 2017/03/24 00:52:49 macallan Exp $");
 
 #include 
 #include 
@@ -207,7 +207,6 @@ wcfb_attach(device_t parent, device_t se
 	WC_FB8_ADDR1) - sc->sc_fb;
 	sc->sc_fb1 = sc->sc_fbaddr + sc->sc_fb1off;
 	sc->sc_fb8size = 2 * (sc->sc_fb1off - sc->sc_fb0off);
-printf("fb %08x %08x %08x\n", sc->sc_fb0off, sc->sc_fb1off, sc->sc_fb8size);
 
 	sub = pci_conf_read(sc->sc_pc, sc->sc_pcitag, PCI_SUBSYS_ID_REG);
 	aprint_normal("subsys: %08x\n", sub);



CVS commit: src/sys/dev/pci

2017-03-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar 24 00:51:43 UTC 2017

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

Log Message:
- clean up some testing & debugging goop
- 0xff is transparent, so restrict ourself to just 4 bit colour, all we need
  for wscons
- support WSDISPLAYIO_GET_FBINFO etc. for wsfb, allow mmap()ing the fb etc.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/wcfb.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/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.14 src/sys/dev/pci/wcfb.c:1.15
--- src/sys/dev/pci/wcfb.c:1.14	Thu Jul 14 10:19:06 2016
+++ src/sys/dev/pci/wcfb.c	Fri Mar 24 00:51:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wcfb.c,v 1.14 2016/07/14 10:19:06 msaitoh Exp $ */
+/*	$NetBSD: wcfb.c,v 1.15 2017/03/24 00:51:43 macallan Exp $ */
 
 /*
  * Copyright (c) 2007, 2008, 2009 Miodrag Vallat.
@@ -20,7 +20,7 @@
 /* a driver for (some) 3DLabs Wildcat cards, based on OpenBSD's ifb driver */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.14 2016/07/14 10:19:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.15 2017/03/24 00:51:43 macallan Exp $");
 
 #include 
 #include 
@@ -72,10 +72,10 @@ struct wcfb_softc {
 	bus_space_tag_t sc_regt, sc_wtft;
 	bus_space_tag_t sc_iot;
 
-	bus_space_handle_t sc_fbh, sc_wtfh;
+	bus_space_handle_t sc_fbh;
 	bus_space_handle_t sc_regh;
-	bus_addr_t sc_fb, sc_reg, sc_wtf;
-	bus_size_t sc_fbsize, sc_regsize, sc_wtfsize;
+	bus_addr_t sc_fb, sc_reg;
+	bus_size_t sc_fbsize, sc_regsize;
 
 	int sc_width, sc_height, sc_stride;
 	int sc_locked;
@@ -89,7 +89,7 @@ struct wcfb_softc {
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
-	uint32_t sc_fb0off, sc_fb1off;
+	uint32_t sc_fb0off, sc_fb1off, sc_fb8size;
 
 	void (*copycols)(void *, int, int, int, int);
 	void (*erasecols)(void *, int, int, int, long);
@@ -165,7 +165,6 @@ wcfb_attach(device_t parent, device_t se
 	uint32_t		reg;
 	unsigned long		defattr;
 	bool			is_console = 0;
-	void 			*wtf;
 	uint32_t		sub;
 
 	sc->sc_dev = self;
@@ -188,22 +187,17 @@ wcfb_attach(device_t parent, device_t se
 		device_xname(sc->sc_dev));
 	}
 
-	if (pci_mapreg_map(pa, 0x10, PCI_MAPREG_TYPE_MEM, BUS_SPACE_MAP_LINEAR,
+	if (pci_mapreg_map(pa, 0x10, PCI_MAPREG_TYPE_MEM,
+	BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
 	>sc_memt, >sc_fbh, >sc_fb, >sc_fbsize)) {
 		aprint_error("%s: failed to map framebuffer.\n",
 		device_xname(sc->sc_dev));
 	}
 
-	if (pci_mapreg_map(pa, 0x18, PCI_MAPREG_TYPE_MEM, BUS_SPACE_MAP_LINEAR,
-	>sc_wtft, >sc_wtfh, >sc_wtf, >sc_wtfsize)) {
-		aprint_error("%s: failed to map wtf.\n",
-		device_xname(sc->sc_dev));
-	}
-	wtf = bus_space_vaddr(sc->sc_wtft, sc->sc_wtfh);
-	memset(wtf, 0, 0x10);
-
 	sc->sc_fbaddr = bus_space_vaddr(sc->sc_memt, sc->sc_fbh);
-
+#ifdef DEBUG
+	memset(sc->sc_fbaddr, 0, sc->sc_fbsize);
+#endif
 	sc->sc_fb0off =
 	bus_space_read_4(sc->sc_regt, sc->sc_regh,
 	WC_FB8_ADDR0) - sc->sc_fb;
@@ -212,6 +206,8 @@ wcfb_attach(device_t parent, device_t se
 	bus_space_read_4(sc->sc_regt, sc->sc_regh,
 	WC_FB8_ADDR1) - sc->sc_fb;
 	sc->sc_fb1 = sc->sc_fbaddr + sc->sc_fb1off;
+	sc->sc_fb8size = 2 * (sc->sc_fb1off - sc->sc_fb0off);
+printf("fb %08x %08x %08x\n", sc->sc_fb0off, sc->sc_fb1off, sc->sc_fb8size);
 
 	sub = pci_conf_read(sc->sc_pc, sc->sc_pcitag, PCI_SUBSYS_ID_REG);
 	aprint_normal("subsys: %08x\n", sub);
@@ -257,6 +253,18 @@ wcfb_attach(device_t parent, device_t se
 	/* make sure video output is on */
 	bus_space_write_4(sc->sc_regt, sc->sc_regh, WC_DPMS_STATE, WC_DPMS_ON);
 
+#if 0
+	/* testing & debugging voodoo */
+	memset(sc->sc_fb0, 0x01, 0x0010);
+	memset(sc->sc_fb1, 0x00, 0x0010);
+	wcfb_rop_wait(sc);
+	wcfb_rop_jfb(sc, 0, 0, 0, 0, 600, 600, WC_ROP_SET, 0x);
+	wcfb_rop_wait(sc);
+	delay(400);
+	bus_space_write_4(sc->sc_regt, sc->sc_regh, WC_FB8_ADDR1,
+	bus_space_read_4(sc->sc_regt, sc->sc_regh, WC_FB8_ADDR0));
+	delay(800);
+#endif
 	sc->sc_defaultscreen_descr = (struct wsscreen_descr){
 		"default",
 		0, 0,
@@ -336,10 +344,72 @@ wcfb_attach(device_t parent, device_t se
 }
 
 static int
+wcfb_putcmap(struct wcfb_softc *sc, struct wsdisplay_cmap *cm)
+{
+	u_char *r, *g, *b;
+	u_int index = cm->index;
+	u_int count = cm->count;
+	int i, error;
+	u_char rbuf[256], gbuf[256], bbuf[256];
+
+	if (cm->index >= 256 || cm->count > 256 ||
+	(cm->index + cm->count) > 256)
+		return EINVAL;
+	error = copyin(cm->red, [index], count);
+	if (error)
+		return error;
+	error = copyin(cm->green, [index], count);
+	if (error)
+		return error;
+	error = copyin(cm->blue, [index], count);
+	if (error)
+		return error;
+
+	memcpy(>sc_cmap_red[index], [index], count);
+	memcpy(>sc_cmap_green[index], [index], count);
+	memcpy(>sc_cmap_blue[index], [index], count);
+
+	r = >sc_cmap_red[index];
+	g = 

CVS commit: src/sys/dev/wscons

2017-03-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar 24 00:45:27 UTC 2017

Modified Files:
src/sys/dev/wscons: wsconsio.h

Log Message:
add fbinfo flag for wildcat split framebuffer workaround


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/wscons/wsconsio.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/wscons/wsconsio.h
diff -u src/sys/dev/wscons/wsconsio.h:1.116 src/sys/dev/wscons/wsconsio.h:1.117
--- src/sys/dev/wscons/wsconsio.h:1.116	Tue Jan 10 20:08:52 2017
+++ src/sys/dev/wscons/wsconsio.h	Fri Mar 24 00:45:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsconsio.h,v 1.116 2017/01/10 20:08:52 christos Exp $ */
+/* $NetBSD: wsconsio.h,v 1.117 2017/03/24 00:45:27 macallan Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -339,7 +339,7 @@ struct wsmouse_repeat {
 #define	WSDISPLAY_TYPE_MGX	61	/* SSB 4096V-MGX */
 #define	WSDISPLAY_TYPE_MESON	62	/* Amlogic Meson ARM SoC */
 #define	WSDISPLAY_TYPE_TEGRA	63	/* NVIDIA Tegra ARM SoC */
-#define	WSDISPLAY_TYPE_PLATINUM	64	/* Apple onboard video 'platinum' */
+#define	WSDISPLAY_TYPE_PLATINUM	64	/* onboard fb in PowerMac 7200 */
 
 /* Basic display information.  Not applicable to all display types. */
 struct wsdisplay_fbinfo {
@@ -655,7 +655,8 @@ struct wsdisplayio_fbinfo {
 };
 
 /* fbi_flags */
-#define WSFB_VRAM_IS_RAM	1	/* hint for wsfb - don't shadow */
+#define WSFB_VRAM_IS_RAM	0x0001	/* hint for wsfb - don't shadow */
+#define WSFB_VRAM_IS_SPLIT	0x0002	/* workaround for wildcat... */
 
 #define WSDISPLAYIO_GET_FBINFO	_IOWR('W', 104, struct wsdisplayio_fbinfo)
 



CVS commit: src/sys

2017-03-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 23 21:59:55 UTC 2017

Modified Files:
src/sys/kern: kern_sig.c kern_syscall.c sys_process.c
src/sys/sys: ptrace.h

Log Message:
kern/5201{2,8,9}: Fix PT_SYSCALL stopping.
1. Supply the siginfo we expect TRAP_SC{E,X} to process_stoptrace() and set it.
2. Change the second argument of proc_stop from notify, to now meaning that
   we want to stop right now. Wait in process_stoptrace until that has happened.
3. While here, fix the locking order in process_stoptrace().


To generate a diff of this commit:
cvs rdiff -u -r1.332 -r1.333 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/kern_syscall.c
cvs rdiff -u -r1.176 -r1.177 src/sys/kern/sys_process.c
cvs rdiff -u -r1.58 -r1.59 src/sys/sys/ptrace.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/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.332 src/sys/kern/kern_sig.c:1.333
--- src/sys/kern/kern_sig.c:1.332	Fri Jan  6 17:53:17 2017
+++ src/sys/kern/kern_sig.c	Thu Mar 23 17:59:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.332 2017/01/06 22:53:17 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.333 2017/03/23 21:59:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.332 2017/01/06 22:53:17 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.333 2017/03/23 21:59:55 christos Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1535,7 +1535,7 @@ sigswitch(bool ppsig, int ppmask, int si
 	 */
 	if (p->p_stat == SACTIVE && (p->p_sflag & PS_STOPPING) == 0) {
 		KASSERT(signo != 0);
-		proc_stop(p, 1, signo);
+		proc_stop(p, 0, signo);
 		KASSERT(p->p_nrlwps > 0);
 	}
 
@@ -2099,7 +2099,7 @@ sigexit(struct lwp *l, int signo)
  * Put process 'p' into the stopped state and optionally, notify the parent.
  */
 void
-proc_stop(struct proc *p, int notify, int signo)
+proc_stop(struct proc *p, int now, int signo)
 {
 	struct lwp *l;
 
@@ -2110,11 +2110,7 @@ proc_stop(struct proc *p, int notify, in
 	 * LWPs to a halt so they are included in p->p_nrlwps.  We musn't
 	 * unlock between here and the p->p_nrlwps check below.
 	 */
-	p->p_sflag |= PS_STOPPING;
-	if (notify)
-		p->p_sflag |= PS_NOTIFYSTOP;
-	else
-		p->p_sflag &= ~PS_NOTIFYSTOP;
+	p->p_sflag |= PS_STOPPING | PS_NOTIFYSTOP;
 	membar_producer();
 
 	proc_stop_lwps(p);
@@ -2125,7 +2121,7 @@ proc_stop(struct proc *p, int notify, in
 	 * LWP to stop will take care of it.
 	 */
 
-	if (p->p_nrlwps == 0) {
+	if (p->p_nrlwps == 0 || (now && p->p_nrlwps == 1 && p == curproc)) {
 		proc_stop_done(p, true, PS_NOCLDSTOP);
 	} else {
 		/*

Index: src/sys/kern/kern_syscall.c
diff -u src/sys/kern/kern_syscall.c:1.14 src/sys/kern/kern_syscall.c:1.15
--- src/sys/kern/kern_syscall.c:1.14	Mon Nov 30 18:34:47 2015
+++ src/sys/kern/kern_syscall.c	Thu Mar 23 17:59:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_syscall.c,v 1.14 2015/11/30 23:34:47 pgoyette Exp $	*/
+/*	$NetBSD: kern_syscall.c,v 1.15 2017/03/23 21:59:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_syscall.c,v 1.14 2015/11/30 23:34:47 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_syscall.c,v 1.15 2017/03/23 21:59:55 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -248,7 +248,7 @@ trace_enter(register_t code, const struc
 #ifdef PTRACE
 	if ((curlwp->l_proc->p_slflag & (PSL_SYSCALL|PSL_TRACED)) ==
 	(PSL_SYSCALL|PSL_TRACED)) {
-		process_stoptrace();
+		process_stoptrace(TRAP_SCE);
 		if (curlwp->l_proc->p_slflag & PSL_SYSCALLEMU) {
 			/* tracer will emulate syscall for us */
 			error = EJUSTRETURN;
@@ -288,8 +288,9 @@ trace_exit(register_t code, const struct
 	
 #ifdef PTRACE
 	if ((p->p_slflag & (PSL_SYSCALL|PSL_TRACED|PSL_SYSCALLEMU)) ==
-	(PSL_SYSCALL|PSL_TRACED))
-		process_stoptrace();
+	(PSL_SYSCALL|PSL_TRACED)) {
+		process_stoptrace(TRAP_SCX);
+	}
 	CLR(p->p_slflag, PSL_SYSCALLEMU);
 #endif
 }

Index: src/sys/kern/sys_process.c
diff -u src/sys/kern/sys_process.c:1.176 src/sys/kern/sys_process.c:1.177
--- src/sys/kern/sys_process.c:1.176	Wed Mar 22 18:11:47 2017
+++ src/sys/kern/sys_process.c	Thu Mar 23 17:59:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_process.c,v 1.176 2017/03/22 22:11:47 skrll Exp $	*/
+/*	$NetBSD: sys_process.c,v 1.177 2017/03/23 21:59:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.176 2017/03/22 22:11:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.177 2017/03/23 21:59:55 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -187,13 +187,13 @@ process_domem(struct lwp *curl /*tracer*
 }
 
 void
-process_stoptrace(void)

CVS commit: src

2017-03-23 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Mar 23 18:27:29 UTC 2017

Modified Files:
src/lib/libm/arch/ia64: fenv.c
src/sys/arch/ia64/include: fenv.h

Log Message:
expose the BSD/linux fenv extensions in libm on ia64 too.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/arch/ia64/fenv.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/ia64/include/fenv.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/libm/arch/ia64/fenv.c
diff -u src/lib/libm/arch/ia64/fenv.c:1.2 src/lib/libm/arch/ia64/fenv.c:1.3
--- src/lib/libm/arch/ia64/fenv.c:1.2	Wed Mar 22 23:11:08 2017
+++ src/lib/libm/arch/ia64/fenv.c	Thu Mar 23 18:27:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fenv.c,v 1.2 2017/03/22 23:11:08 chs Exp $	*/
+/*	$NetBSD: fenv.c,v 1.3 2017/03/23 18:27:29 chs Exp $	*/
 
 /*-
  * Copyright (c) 2004 David Schultz 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: fenv.c,v 1.2 2017/03/22 23:11:08 chs Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.3 2017/03/23 18:27:29 chs Exp $");
 
 #include "namespace.h"
 
@@ -69,6 +69,9 @@ extern inline int fesetround(int __round
 extern inline int fegetenv(fenv_t *__envp);
 extern inline int feholdexcept(fenv_t *__envp);
 extern inline int fesetenv(const fenv_t *__envp);
+extern inline int feenableexcept(int __excepts);
+extern inline int fedisableexcept(int __excepts);
+extern inline int fegetexcept(void);
 
 /*
  * It doesn't pay to inline feupdateenv() because it includes one of

Index: src/sys/arch/ia64/include/fenv.h
diff -u src/sys/arch/ia64/include/fenv.h:1.1 src/sys/arch/ia64/include/fenv.h:1.2
--- src/sys/arch/ia64/include/fenv.h:1.1	Thu Feb 23 02:03:27 2017
+++ src/sys/arch/ia64/include/fenv.h	Thu Mar 23 18:27:29 2017
@@ -208,9 +208,7 @@ int feupdateenv(const fenv_t *__envp);
 
 #if defined(_NETBSD_SOURCE) || defined(_GNU_SOURCE)
 
-/* We currently provide no external definitions of the functions below. */
-
-static inline int
+__fenv_static inline int
 feenableexcept(int __mask)
 {
 	fenv_t __newfpsr, __oldfpsr;
@@ -221,7 +219,7 @@ feenableexcept(int __mask)
 	return (~__oldfpsr & FE_ALL_EXCEPT);
 }
 
-static inline int
+__fenv_static inline int
 fedisableexcept(int __mask)
 {
 	fenv_t __newfpsr, __oldfpsr;
@@ -232,7 +230,7 @@ fedisableexcept(int __mask)
 	return (~__oldfpsr & FE_ALL_EXCEPT);
 }
 
-static inline int
+__fenv_static inline int
 fegetexcept(void)
 {
 	fenv_t __fpsr;



CVS commit: src/lib/libm

2017-03-23 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Mar 23 18:26:03 UTC 2017

Modified Files:
src/lib/libm: Makefile

Log Message:
sun2 just has to be different, of course.
it doesn't use the libc softfloat and thus doesn't set MKSOFTFLOAT=yes.
enable the fenv functions here explicitly for now.


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/lib/libm/Makefile

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

Modified files:

Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.189 src/lib/libm/Makefile:1.190
--- src/lib/libm/Makefile:1.189	Wed Mar 22 23:11:08 2017
+++ src/lib/libm/Makefile	Thu Mar 23 18:26:03 2017
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.189 2017/03/22 23:11:08 chs Exp $
+#  $NetBSD: Makefile,v 1.190 2017/03/23 18:26:03 chs Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -206,7 +206,7 @@ COPTS+=	-fno-strict-aliasing
 .endif
 CPPFLAGS+=-DLIBM_SCCS
 
-.if ${MKSOFTFLOAT} != "no"
+.if (${MKSOFTFLOAT} != "no" || ${MACHINE_ARCH} == "m68000")
 .PATH:	${.CURDIR}/softfloat
 .include "${.CURDIR}/../libc/libcincludes.mk"
 CPPFLAGS+=	-I${ARCHDIR}/softfloat



CVS commit: src/sys/arch

2017-03-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 23 18:08:06 UTC 2017

Modified Files:
src/sys/arch/i386/i386: machdep.c
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: pmap.c
src/sys/arch/xen/x86: cpu.c xen_pmap.c

Log Message:
Remove PG_k completely.


To generate a diff of this commit:
cvs rdiff -u -r1.780 -r1.781 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.243 -r1.244 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/xen/x86/xen_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/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.780 src/sys/arch/i386/i386/machdep.c:1.781
--- src/sys/arch/i386/i386/machdep.c:1.780	Thu Feb 23 03:34:22 2017
+++ src/sys/arch/i386/i386/machdep.c	Thu Mar 23 18:08:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.780 2017/02/23 03:34:22 kamil Exp $	*/
+/*	$NetBSD: machdep.c,v 1.781 2017/03/23 18:08:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.780 2017/02/23 03:34:22 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.781 2017/03/23 18:08:06 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -1019,7 +1019,7 @@ initgdt(union descriptor *tgdt)
 		pt_entry_t pte;
 
 		pte = pmap_pa2pte((vaddr_t)gdtstore - KERNBASE);
-		pte |= PG_k | PG_RO | xpmap_pg_nx | PG_V;
+		pte |= PG_RO | xpmap_pg_nx | PG_V;
 
 		if (HYPERVISOR_update_va_mapping((vaddr_t)gdtstore, pte,
 		UVMF_INVLPG) < 0) {
@@ -1223,7 +1223,7 @@ init386(paddr_t first_avail)
 		pt_entry_t pte;
 
 		pte = pmap_pa2pte((vaddr_t)tmpgdt - KERNBASE);
-		pte |= PG_k | PG_RW | xpmap_pg_nx | PG_V;
+		pte |= PG_RW | xpmap_pg_nx | PG_V;
 
 		if (HYPERVISOR_update_va_mapping((vaddr_t)tmpgdt, pte, UVMF_INVLPG) < 0) {
 			panic("tmpgdt page relaim RW update failed.\n");

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.63 src/sys/arch/x86/include/pmap.h:1.64
--- src/sys/arch/x86/include/pmap.h:1.63	Sun Mar  5 09:08:18 2017
+++ src/sys/arch/x86/include/pmap.h	Thu Mar 23 18:08:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.63 2017/03/05 09:08:18 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.64 2017/03/23 18:08:06 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -180,8 +180,6 @@ struct pmap {
 	((pmap)->pm_pdirpa[0] + (index) * sizeof(pd_entry_t))
 #endif
 
-#define PG_k 0
-
 /*
  * MD flags that we use for pmap_enter and pmap_kenter_pa:
  */

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.243 src/sys/arch/x86/x86/pmap.c:1.244
--- src/sys/arch/x86/x86/pmap.c:1.243	Wed Mar 15 16:42:18 2017
+++ src/sys/arch/x86/x86/pmap.c	Thu Mar 23 18:08:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.243 2017/03/15 16:42:18 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.244 2017/03/23 18:08:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.243 2017/03/15 16:42:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.244 2017/03/23 18:08:06 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -981,7 +981,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 	} else
 #endif /* DOM0OPS */
 		npte = pmap_pa2pte(pa);
-	npte |= protection_codes[prot] | PG_k | PG_V | pmap_pg_g;
+	npte |= protection_codes[prot] | PG_V | pmap_pg_g;
 	npte |= pmap_pat_flags(flags);
 	opte = pmap_pte_testset(pte, npte); /* zap! */
 #if defined(DIAGNOSTIC)
@@ -1018,7 +1018,7 @@ pmap_emap_enter(vaddr_t va, paddr_t pa, 
 		npte = pmap_pa2pte(pa);
 
 	npte = pmap_pa2pte(pa);
-	npte |= protection_codes[prot] | PG_k | PG_V;
+	npte |= protection_codes[prot] | PG_V;
 	pmap_pte_set(pte, npte);
 }
 
@@ -1354,7 +1354,7 @@ pmap_bootstrap(vaddr_t kva_start)
 	memset((void *)(xen_dummy_user_pgd + KERNBASE), 0, PAGE_SIZE);
 	/* Mark read-only */
 	HYPERVISOR_update_va_mapping(xen_dummy_user_pgd + KERNBASE,
-	pmap_pa2pte(xen_dummy_user_pgd) | PG_k | PG_V | pmap_pg_nx,
+	pmap_pa2pte(xen_dummy_user_pgd) | PG_V | pmap_pg_nx,
 	UVMF_INVLPG);
 	/* Pin as L4 */
 	xpq_queue_pin_l4_table(xpmap_ptom_masked(xen_dummy_user_pgd));
@@ -2109,7 +2109,7 @@ pmap_pdp_ctor(void *arg, void *v, int fl
 	 * This pdir will NEVER be active in kernel mode, so mark
 	 * recursive entry invalid.
 	 */
-	pdir[PDIR_SLOT_PTE] = pmap_pa2pte(pdirpa) | PG_k;
+	pdir[PDIR_SLOT_PTE] = pmap_pa2pte(pdirpa);
 
 	/*
 	 * PDP constructed this way won't be for the kernel, hence we
@@ -3076,8 +3076,7 @@ pmap_zero_page(paddr_t pa)
 	pt_entry_t *zpte;
 	vaddr_t zerova;
 
-	const pd_entry_t pteflags = PG_V | PG_RW | pmap_pg_nx | PG_M | PG_U |
-	PG_k;
+	

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

2017-03-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 23 17:25:51 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: locore.S machdep.c trap.c

Log Message:
Remove this call gate on amd64, it is useless and vulnerable.

Call gates do not modify %rflags, so interrupts are not disabled when
entering the gate. There is a small window where we are in kernel mode and
with a userland %gs, and if an interrupt happens here we will rejump into
the kernel but not switch to the kernel TLS.

Userland can simply perform a gate call in a loop, and hope that at some
point an interrupt will be received in this window - which necessarily will
be the case. With a specially-crafted %gs it is certainly enough to
escalate privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.253 -r1.254 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/amd64/amd64/trap.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.121 src/sys/arch/amd64/amd64/locore.S:1.122
--- src/sys/arch/amd64/amd64/locore.S:1.121	Thu Feb  9 19:30:56 2017
+++ src/sys/arch/amd64/amd64/locore.S	Thu Mar 23 17:25:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.121 2017/02/09 19:30:56 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.122 2017/03/23 17:25:51 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1399,27 +1399,6 @@ NENTRY(lwp_trampoline)
 END(lwp_trampoline)
 
 /*
- * oosyscall()
- *
- * Old call gate entry for syscall. only needed if we're
- * going to support running old i386 NetBSD 1.0 or ibcs2 binaries, etc,
- * on NetBSD/amd64.
- * The 64bit call gate can't request that arguments be copied from the
- * user stack (which the i386 code uses to get a gap for the flags).
- * push/pop are :: cycles.
- */
-IDTVEC(oosyscall)
-	/* Set rflags in trap frame. */
-	pushq	(%rsp)		/* move user's %eip */
-	pushq	16(%rsp)	/* and %cs */
-	popq	8(%rsp)
-	pushfq
-	popq	16(%rsp)
-	pushq	$7		/* size of instruction for restart */
-	jmp	osyscall1
-IDTVEC_END(oosyscall)
-
-/*
  * osyscall()
  *
  * Trap gate entry for int $80 syscall, also used by sigreturn.

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.253 src/sys/arch/amd64/amd64/machdep.c:1.254
--- src/sys/arch/amd64/amd64/machdep.c:1.253	Fri Mar 10 14:54:12 2017
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Mar 23 17:25:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.253 2017/03/10 14:54:12 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.254 2017/03/23 17:25:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.253 2017/03/10 14:54:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.254 2017/03/23 17:25:51 maxv Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1452,7 +1452,6 @@ typedef void (vector)(void);
 extern vector IDTVEC(syscall);
 extern vector IDTVEC(syscall32);
 extern vector IDTVEC(osyscall);
-extern vector IDTVEC(oosyscall);
 extern vector *IDTVEC(exceptions)[];
 
 static void
@@ -1642,11 +1641,8 @@ init_x86_64(paddr_t first_avail)
 #endif
 
 	/*
-	 * Make LDT gates and memory segments.
+	 * Make LDT memory segments.
 	 */
-	setgate((struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	(oosyscall), 0, SDT_SYS386CGT, SEL_UPL,
-	GSEL(GCODE_SEL, SEL_KPL));
 	*(struct mem_segment_descriptor *)(ldtstore + LUCODE_SEL) =
 	*GDT_ADDR_MEM(gdtstore, GUCODE_SEL);
 	*(struct mem_segment_descriptor *)(ldtstore + LUDATA_SEL) =
@@ -1677,16 +1673,6 @@ init_x86_64(paddr_t first_avail)
 	set_mem_segment(ldt_segp, 0, x86_btop(VM_MAXUSER_ADDRESS32) - 1,
 	SDT_MEMRWA, SEL_UPL, 1, 1, 0);
 
-	/*
-	 * Other LDT entries.
-	 */
-	memcpy((struct gate_descriptor *)(ldtstore + LSOL26CALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-	memcpy((struct gate_descriptor *)(ldtstore + LBSDICALLS_SEL),
-	(struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-	sizeof (struct gate_descriptor));
-
 	/* CPU-specific IDT exceptions. */
 	for (x = 0; x < NCPUIDT; x++) {
 #ifndef XEN

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.94 src/sys/arch/amd64/amd64/trap.c:1.95
--- src/sys/arch/amd64/amd64/trap.c:1.94	Sat Mar 18 13:39:23 2017
+++ src/sys/arch/amd64/amd64/trap.c	Thu Mar 23 17:25:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.94 2017/03/18 13:39:23 maxv Exp $	*/
+/*	$NetBSD: trap.c,v 1.95 2017/03/23 17:25:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.94 2017/03/18 13:39:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.95 2017/03/23 17:25:51 maxv Exp $");
 
 #include "opt_ddb.h"
 #include 

CVS commit: src

2017-03-23 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Mar 23 15:50:48 UTC 2017

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/lib/libossaudio: ossaudio.c shlib_version

Log Message:
Calculate GETISPACE/GETOSPACE properly.
Bump version.

Addresses PR kern/51999.


To generate a diff of this commit:
cvs rdiff -u -r1.804 -r1.805 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.32 -r1.33 src/lib/libossaudio/ossaudio.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libossaudio/shlib_version

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/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.804 src/distrib/sets/lists/base/shl.mi:1.805
--- src/distrib/sets/lists/base/shl.mi:1.804	Sat Mar 11 16:36:01 2017
+++ src/distrib/sets/lists/base/shl.mi	Thu Mar 23 15:50:48 2017
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.804 2017/03/11 16:36:01 christos Exp $
+# $NetBSD: shl.mi,v 1.805 2017/03/23 15:50:48 nat Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -417,7 +417,7 @@
 ./usr/lib/libopenpgpsdk.so.0.9			base-obsolete		obsolete
 ./usr/lib/libossaudio.so			base-sys-shlib		compatfile
 ./usr/lib/libossaudio.so.1			base-sys-shlib		compatfile
-./usr/lib/libossaudio.so.1.1			base-sys-shlib		compatfile
+./usr/lib/libossaudio.so.1.2			base-sys-shlib		compatfile
 ./usr/lib/libp2k.sobase-puffs-shlib	compatfile,rump
 ./usr/lib/libp2k.so.2base-puffs-shlib	compatfile,rump
 ./usr/lib/libp2k.so.2.0base-puffs-shlib	compatfile,rump

Index: src/lib/libossaudio/ossaudio.c
diff -u src/lib/libossaudio/ossaudio.c:1.32 src/lib/libossaudio/ossaudio.c:1.33
--- src/lib/libossaudio/ossaudio.c:1.32	Fri Feb 10 08:52:04 2017
+++ src/lib/libossaudio/ossaudio.c	Thu Mar 23 15:50:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.32 2017/02/10 08:52:04 maya Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.33 2017/03/23 15:50:48 nat Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ossaudio.c,v 1.32 2017/02/10 08:52:04 maya Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.33 2017/03/23 15:50:48 nat Exp $");
 
 /*
  * This is an OSS (Linux) sound API emulator.
@@ -411,11 +411,11 @@ audio_ioctl(int fd, unsigned long com, v
 			return retval;
 		setblocksize(fd, );
 		bufinfo.fragsize = tmpinfo.blocksize;
-		bufinfo.fragments = tmpinfo.hiwat - (tmpinfo.play.seek
-		+ tmpinfo.blocksize - 1) / tmpinfo.blocksize;
+		bufinfo.fragments = (tmpinfo.hiwat * tmpinfo.blocksize -
+		(tmpinfo.play.seek + tmpinfo.blocksize -1)) /
+		tmpinfo.blocksize;
 		bufinfo.fragstotal = tmpinfo.hiwat;
-		bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize
-		- tmpinfo.play.seek;
+		bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize;
 		*(struct audio_buf_info *)argp = bufinfo;
 		break;
 	case SNDCTL_DSP_GETISPACE:
@@ -424,11 +424,9 @@ audio_ioctl(int fd, unsigned long com, v
 			return retval;
 		setblocksize(fd, );
 		bufinfo.fragsize = tmpinfo.blocksize;
-		bufinfo.fragments = tmpinfo.hiwat - (tmpinfo.record.seek +
-		tmpinfo.blocksize - 1) / tmpinfo.blocksize;
+		bufinfo.fragments = tmpinfo.record.seek / tmpinfo.blocksize;
 		bufinfo.fragstotal = tmpinfo.hiwat;
-		bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize
-		- tmpinfo.record.seek;
+		bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize;
 		*(struct audio_buf_info *)argp = bufinfo;
 		break;
 	case SNDCTL_DSP_NONBLOCK:

Index: src/lib/libossaudio/shlib_version
diff -u src/lib/libossaudio/shlib_version:1.7 src/lib/libossaudio/shlib_version:1.8
--- src/lib/libossaudio/shlib_version:1.7	Sun May 18 10:38:40 2014
+++ src/lib/libossaudio/shlib_version	Thu Mar 23 15:50:48 2017
@@ -1,5 +1,5 @@
-#	$NetBSD: shlib_version,v 1.7 2014/05/18 10:38:40 nat Exp $
+#	$NetBSD: shlib_version,v 1.8 2017/03/23 15:50:48 nat Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 major=1
-minor=1
+minor=2



CVS commit: src/sys/arch/xen/xenbus

2017-03-23 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Mar 23 14:52:36 UTC 2017

Modified Files:
src/sys/arch/xen/xenbus: xenbus_dev.c

Log Message:
xlwp->mtx will never be used in interrupt context; set to IPL_NONE.
avoids a KASSERT when sleeping for the reply.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/xen/xenbus/xenbus_dev.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/xen/xenbus/xenbus_dev.c
diff -u src/sys/arch/xen/xenbus/xenbus_dev.c:1.12 src/sys/arch/xen/xenbus/xenbus_dev.c:1.13
--- src/sys/arch/xen/xenbus/xenbus_dev.c:1.12	Wed Mar 22 22:33:32 2017
+++ src/sys/arch/xen/xenbus/xenbus_dev.c	Thu Mar 23 14:52:36 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_dev.c,v 1.12 2017/03/22 22:33:32 bouyer Exp $ */
+/* $NetBSD: xenbus_dev.c,v 1.13 2017/03/23 14:52:36 bouyer Exp $ */
 /*
  * xenbus_dev.c
  * 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.12 2017/03/22 22:33:32 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.13 2017/03/23 14:52:36 bouyer Exp $");
 
 #include "opt_xen.h"
 
@@ -374,7 +374,7 @@ xenbus_dev_open(void *v)
 		memset(xlwp, 0, sizeof(*xlwp));
 		xlwp->lwp = curlwp;   
 		SLIST_INIT(>transactions);
-		mutex_init(>mtx, MUTEX_DEFAULT, IPL_VM);
+		mutex_init(>mtx, MUTEX_DEFAULT, IPL_NONE);
 		SLIST_INSERT_HEAD(>lwps,
 		xlwp, lwp_next);  
 	}



CVS commit: src/lib/libc/gen

2017-03-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Mar 23 12:31:57 UTC 2017

Modified Files:
src/lib/libc/gen: syslog.3

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/gen/syslog.3

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/syslog.3
diff -u src/lib/libc/gen/syslog.3:1.31 src/lib/libc/gen/syslog.3:1.32
--- src/lib/libc/gen/syslog.3:1.31	Wed Mar 22 17:52:36 2017
+++ src/lib/libc/gen/syslog.3	Thu Mar 23 12:31:57 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslog.3,v 1.31 2017/03/22 17:52:36 roy Exp $
+.\"	$NetBSD: syslog.3,v 1.32 2017/03/23 12:31:57 wiz Exp $
 .\"	$OpenBSD: syslog.3,v 1.25 2005/07/22 03:16:58 jaredy Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
@@ -307,7 +307,7 @@ instantiations of daemons.
 (This PID is placed within brackets
 between the ident and the message.)
 .It Dv LOG_PTRIM
-Trim anything syslog added to the message before writing to 
+Trim anything syslog added to the message before writing to
 standard error output.
 .El
 .Pp



CVS commit: src/bin/sh

2017-03-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Mar 23 12:10:53 UTC 2017

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

Log Message:
PR bin/14578

Add a reference to editline(7) so we document the "-o vi" and "-o emacs"
bindings (defaults, and what can be set.)


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 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.127 src/bin/sh/sh.1:1.128
--- src/bin/sh/sh.1:1.127	Mon Mar 20 22:17:56 2017
+++ src/bin/sh/sh.1	Thu Mar 23 12:10:53 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.127 2017/03/20 22:17:56 kre Exp $
+.\"	$NetBSD: sh.1,v 1.128 2017/03/23 12:10:53 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -2283,6 +2283,14 @@ in the buffer using the control key.
 uses the
 .Xr editline 3
 library.
+See
+.Xr editline 7
+for a list of the possible command bindings,
+and the default settings in
+.Ar emacs
+and
+.Ar vi
+modes.
 .Sh ENVIRONMENT
 .Bl -tag -width MAILCHECK
 .It Ev CDPATH
@@ -2399,6 +2407,7 @@ argument.
 .\" .Xr profile 4 ,
 .Xr editrc 5 ,
 .Xr passwd 5 ,
+.Xr editline 7 ,
 .Xr environ 7 ,
 .Xr nls 7 ,
 .Xr sysctl 8



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

2017-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar 23 11:00:03 UTC 2017

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

Log Message:
Comment out PAX_MPROTECT options completely, instead of just turning them
off globaly. This will make the automatic tests not even try to enable
mprotect, which can't work for our current PLT format and shared binaries.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/sparc64/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/sparc64/conf/GENERIC
diff -u src/sys/arch/sparc64/conf/GENERIC:1.196 src/sys/arch/sparc64/conf/GENERIC:1.197
--- src/sys/arch/sparc64/conf/GENERIC:1.196	Tue Dec 13 20:42:20 2016
+++ src/sys/arch/sparc64/conf/GENERIC	Thu Mar 23 11:00:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.196 2016/12/13 20:42:20 christos Exp $
+# $NetBSD: GENERIC,v 1.197 2017/03/23 11:00:03 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/sparc64/conf/std.sparc64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.196 $"
+#ident		"GENERIC-$Revision: 1.197 $"
 
 maxusers	64
 
@@ -1024,6 +1024,6 @@ options 	PAX_ASLR_DEBUG=1	# PaX ASLR deb
 options 	PAX_SEGVGUARD=0		# PaX Segmentation fault guard
 # XXX: there is no PLT format for sparc64 that cooperates with
 # MPROTECT, so disable it for now
-options 	PAX_MPROTECT=0		# PaX mprotect(2) restrictions
-options 	PAX_MPROTECT_DEBUG=1	# PaX mprotect debug
+# options 	PAX_MPROTECT=0		# PaX mprotect(2) restrictions
+# options 	PAX_MPROTECT_DEBUG=1	# PaX mprotect debug
 options 	PAX_ASLR=1		# PaX Address Space Layout Randomization



CVS commit: src/tests/lib/libpthread

2017-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar 23 08:31:00 UTC 2017

Modified Files:
src/tests/lib/libpthread: t_mutex.c

Log Message:
Avoid using an uninitialized mutex.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libpthread/t_mutex.c

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

Modified files:

Index: src/tests/lib/libpthread/t_mutex.c
diff -u src/tests/lib/libpthread/t_mutex.c:1.16 src/tests/lib/libpthread/t_mutex.c:1.17
--- src/tests/lib/libpthread/t_mutex.c:1.16	Sun Mar  5 16:08:23 2017
+++ src/tests/lib/libpthread/t_mutex.c	Thu Mar 23 08:31:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mutex.c,v 1.16 2017/03/05 16:08:23 chs Exp $ */
+/* $NetBSD: t_mutex.c,v 1.17 2017/03/23 08:31:00 martin Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_mutex.c,v 1.16 2017/03/05 16:08:23 chs Exp $");
+__RCSID("$NetBSD: t_mutex.c,v 1.17 2017/03/23 08:31:00 martin Exp $");
 
 #include  /* For timespecadd */
 #include  /* For UINT16_MAX */
@@ -371,7 +371,6 @@ ATF_TC_BODY(mutex5, tc)
 	PTHREAD_REQUIRE(pthread_join(child, NULL));
 }
 
-static pthread_mutex_t mutex6;
 static int start = 0;
 static uintmax_t high_cnt = 0, low_cnt = 0, MAX_LOOP = 1;
 
@@ -399,9 +398,9 @@ high_prio(void* arg)
 		high_cnt = 0;
 		sleep(1);
 	}
-	PTHREAD_REQUIRE(mutex_lock(, _lengthy));
+	PTHREAD_REQUIRE(mutex_lock(, _lengthy));
 	if (start == 0) start = 2;
-	PTHREAD_REQUIRE(pthread_mutex_unlock());
+	PTHREAD_REQUIRE(pthread_mutex_unlock());
 
 	return 0;
 }
@@ -431,10 +430,10 @@ low_prio(void* arg)
 		low_cnt = 0;
 		sleep(1);
 	}
-	PTHREAD_REQUIRE(mutex_lock(, _lengthy));
+	PTHREAD_REQUIRE(mutex_lock(, _lengthy));
 	if (start == 0)
 		start = 1;
-	PTHREAD_REQUIRE(pthread_mutex_unlock());
+	PTHREAD_REQUIRE(pthread_mutex_unlock());
 
 	return 0;
 }



CVS commit: src/tests/fs/tmpfs

2017-03-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar 23 08:18:17 UTC 2017

Modified Files:
src/tests/fs/tmpfs: t_vnd.sh

Log Message:
Do not assume anything about the pseudo-disklabel of a completely zeroed
disk image. Use the raw partition and newfs -I instead.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/tmpfs/t_vnd.sh

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

Modified files:

Index: src/tests/fs/tmpfs/t_vnd.sh
diff -u src/tests/fs/tmpfs/t_vnd.sh:1.9 src/tests/fs/tmpfs/t_vnd.sh:1.10
--- src/tests/fs/tmpfs/t_vnd.sh:1.9	Fri Jul 29 05:23:24 2016
+++ src/tests/fs/tmpfs/t_vnd.sh	Thu Mar 23 08:18:17 2017
@@ -1,4 +1,4 @@
-# $NetBSD: t_vnd.sh,v 1.9 2016/07/29 05:23:24 pgoyette Exp $
+# $NetBSD: t_vnd.sh,v 1.10 2017/03/23 08:18:17 martin Exp $
 #
 # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -28,6 +28,10 @@
 # Verifies that vnd works with files stored in tmpfs.
 #
 
+vnddev=vnd3
+rawpart=$( sysctl -n kern.rawpartition | tr '01234' 'abcde' )
+vnd=/dev/${vnddev}${rawpart}
+
 atf_test_case basic cleanup
 basic_head() {
 	atf_set "descr" "Verifies that vnd works with files stored in tmpfs"
@@ -38,12 +42,12 @@ basic_body() {
 
 	atf_check -s eq:0 -o ignore -e ignore \
 	dd if=/dev/zero of=disk.img bs=1m count=10
-	atf_check -s eq:0 -o empty -e empty vndconfig /dev/vnd3 disk.img
+	atf_check -s eq:0 -o empty -e empty vndconfig -c ${vnddev} disk.img
 
-	atf_check -s eq:0 -o ignore -e ignore newfs /dev/rvnd3a
+	atf_check -s eq:0 -o ignore -e ignore newfs -I ${vnd}
 
 	atf_check -s eq:0 -o empty -e empty mkdir mnt
-	atf_check -s eq:0 -o empty -e empty mount /dev/vnd3a mnt
+	atf_check -s eq:0 -o empty -e empty mount ${vnd} mnt
 
 	echo "Creating test files"
 	for f in $(jot -w %u 100 | uniq); do
@@ -58,7 +62,7 @@ basic_body() {
 	done
 
 	atf_check -s eq:0 -o empty -e empty umount mnt
-	atf_check -s eq:0 -o empty -e empty vndconfig -u /dev/vnd3
+	atf_check -s eq:0 -o empty -e empty vndconfig -u ${vnddev}
 
 	test_unmount
 	touch done
@@ -66,7 +70,7 @@ basic_body() {
 basic_cleanup() {
 	if [ ! -f done ]; then
 		umount mnt 2>/dev/null 1>&2
-		vndconfig -u /dev/vnd3 2>/dev/null 1>&2
+		vndconfig -u ${vnddev} 2>/dev/null 1>&2
 	fi
 }