CVS commit: src/tools/compat

2011-09-05 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Mon Sep  5 07:38:52 UTC 2011

Modified Files:
src/tools/compat: compat_defs.h

Log Message:
Add PDP_ENDIAN definition, required for makefs (v7fs).


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/tools/compat/compat_defs.h

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

Modified files:

Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.80 src/tools/compat/compat_defs.h:1.81
--- src/tools/compat/compat_defs.h:1.80	Sat Aug 27 18:33:22 2011
+++ src/tools/compat/compat_defs.h	Mon Sep  5 07:38:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_defs.h,v 1.80 2011/08/27 18:33:22 joerg Exp $	*/
+/*	$NetBSD: compat_defs.h,v 1.81 2011/09/05 07:38:52 jdc Exp $	*/
 
 #ifndef	__NETBSD_COMPAT_DEFS_H__
 #define	__NETBSD_COMPAT_DEFS_H__
@@ -1035,8 +1035,10 @@
 
 #undef BIG_ENDIAN
 #undef LITTLE_ENDIAN
+#undef PDP_ENDIAN
 #define BIG_ENDIAN 4321
 #define LITTLE_ENDIAN 1234
+#define PDP_ENDIAN 3412
 
 #undef BYTE_ORDER
 #if WORDS_BIGENDIAN



CVS commit: src/etc/mtree

2011-09-05 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Mon Sep  5 09:57:02 UTC 2011

Modified Files:
src/etc/mtree: Makefile

Log Message:
Use ${.OBJDIR}/NetBSD.dist.tmp instead of just NetBSD.dist.tmp.
This fixes a problem in which NetBSD.dist.tmp had been created in
the SRCDIR by an earlier build (performed without an OBJDIR), and
the existence of the file in the SRCDIR confused a subsequent build
(performed with an OBJDIR).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/etc/mtree/Makefile

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

Modified files:

Index: src/etc/mtree/Makefile
diff -u src/etc/mtree/Makefile:1.20 src/etc/mtree/Makefile:1.21
--- src/etc/mtree/Makefile:1.20	Tue Feb  1 21:28:43 2011
+++ src/etc/mtree/Makefile	Mon Sep  5 09:57:02 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.20 2011/02/01 21:28:43 jym Exp $
+#	$NetBSD: Makefile,v 1.21 2011/09/05 09:57:02 apb Exp $
 
 .include bsd.own.mk
 
@@ -26,12 +26,13 @@
 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.extsrc
 .endif
 
-NetBSD.dist:	NetBSD.dist.tmp
-	cmp -s NetBSD.dist.tmp NetBSD.dist || { \
+NetBSD.dist.tmp=	${.OBJDIR}/NetBSD.dist.tmp
+NetBSD.dist:	${NetBSD.dist.tmp}
+	cmp -s ${NetBSD.dist.tmp} ${.TARGET} || { \
 		echo Updating NetBSD.dist; \
-		mv NetBSD.dist.tmp NetBSD.dist; \
+		mv ${NetBSD.dist.tmp} ${.TARGET}; \
 	}
-NetBSD.dist.tmp::
+${NetBSD.dist.tmp}::
 	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}  \
 	${.TARGET}
 
@@ -71,6 +72,6 @@
 .endif	# MKUNPRIVED			# }
 .endif	# DISTRIBUTION_DONE		# }
 
-CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
+CLEANFILES+=	NetBSD.dist ${NetBSD.dist.tmp}
 
 .include bsd.prog.mk



CVS commit: src/sys/arch/usermode

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 11:09:38 UTC 2011

Modified Files:
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
Add thunk_sigaddset()


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/usermode/usermode/thunk.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/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.28 src/sys/arch/usermode/include/thunk.h:1.29
--- src/sys/arch/usermode/include/thunk.h:1.28	Sun Sep  4 21:08:18 2011
+++ src/sys/arch/usermode/include/thunk.h	Mon Sep  5 11:09:38 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.28 2011/09/04 21:08:18 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.29 2011/09/05 11:09:38 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -108,6 +108,7 @@
 void	thunk_signal(int, void (*)(int));
 int	thunk_sigblock(int);
 int	thunk_sigunblock(int);
+void	thunk_sigaddset(sigset_t *sa_mask, int sig);
 int	thunk_atexit(void (*function)(void));
 
 int	thunk_aio_read(struct aiocb *);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.32 src/sys/arch/usermode/usermode/thunk.c:1.33
--- src/sys/arch/usermode/usermode/thunk.c:1.32	Sun Sep  4 21:08:18 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Mon Sep  5 11:09:38 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.32 2011/09/04 21:08:18 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.33 2011/09/05 11:09:38 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: thunk.c,v 1.32 2011/09/04 21:08:18 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.33 2011/09/05 11:09:38 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -406,6 +406,17 @@
 	return sigprocmask(SIG_UNBLOCK, set, NULL);
 }
 
+void
+thunk_sigaddset(sigset_t *sa_mask, int sig)
+{
+	int retval;
+	retval = sigaddset(sa_mask, sig);
+	if (retval  0) {
+		perror(%s: bad signal added);
+		abort();
+	}
+}
+
 int
 thunk_atexit(void (*function)(void))
 {



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 11:10:36 UTC 2011

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

Log Message:
Block SIGALRM on memory access and illegal instruction signal


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/usermode/usermode/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/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.23 src/sys/arch/usermode/usermode/trap.c:1.24
--- src/sys/arch/usermode/usermode/trap.c:1.23	Sun Sep  4 21:01:39 2011
+++ src/sys/arch/usermode/usermode/trap.c	Mon Sep  5 11:10:36 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.23 2011/09/04 21:01:39 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.24 2011/09/05 11:10:36 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.23 2011/09/04 21:01:39 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.24 2011/09/05 11:10:36 reinoud Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -73,6 +73,7 @@
 	sigemptyset(sa.sa_mask);
 	sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
 	sa.sa_sigaction = mem_access_handler;
+	thunk_sigaddset(sa.sa_mask, SIGALRM);
 	if (thunk_sigaction(SIGSEGV, sa, NULL) == -1)
 		panic(couldn't register SIGSEGV handler : %d,
 		thunk_geterrno());
@@ -82,6 +83,7 @@
 	sigemptyset(sa.sa_mask);
 	sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
 	sa.sa_sigaction = illegal_instruction_handler;
+	thunk_sigaddset(sa.sa_mask, SIGALRM);
 	if (thunk_sigaction(SIGILL, sa, NULL) == -1)
 		panic(couldn't register SIGILL handler : %d, thunk_geterrno());
 
@@ -113,7 +115,7 @@
 	vm_prot_t atype;
 	vaddr_t va;
 	void *onfault;
-	int kmem, rv;
+	int kmem, lwp_errno, rv;
 
 	recurse++;
 	if (recurse  1)
@@ -125,7 +127,7 @@
 		onfault = pcb-pcb_onfault;
 		vm = p-p_vmspace;
 
-		pcb-pcb_errno = thunk_geterrno();
+		lwp_errno = pcb-pcb_errno = thunk_geterrno();
 #if 0
 		va = (vaddr_t) info-si_addr;
 		printf(mem trap lwp = %p pid = %d lid = %d, va = %p\n,
@@ -216,7 +218,8 @@
 			/* XXX HOWTO see arm/arm/syscall.c illegal instruction signal */
 		}
 
-		thunk_seterrno(pcb-pcb_errno);
+		thunk_seterrno(lwp_errno);
+		pcb-pcb_errno = lwp_errno;
 	}
 	if (recurse  1)
 		printf(leaving trap recursion level %d\n, recurse);



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  5 11:12:51 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: intr.c

Log Message:
make sure splraise doesn't lower spl, and spllower doesn't raise it


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/usermode/intr.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/usermode/usermode/intr.c
diff -u src/sys/arch/usermode/usermode/intr.c:1.1 src/sys/arch/usermode/usermode/intr.c:1.2
--- src/sys/arch/usermode/usermode/intr.c:1.1	Sun Sep  4 21:08:18 2011
+++ src/sys/arch/usermode/usermode/intr.c	Mon Sep  5 11:12:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.1 2011/09/04 21:08:18 jmcneill Exp $ */
+/* $NetBSD: intr.c,v 1.2 2011/09/05 11:12:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.1 2011/09/04 21:08:18 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.2 2011/09/05 11:12:51 jmcneill Exp $);
 
 #include sys/types.h
 
@@ -47,7 +47,8 @@
 		usermode_sigalrm_blocked = true;
 	}
 
-	usermode_x = x;
+	if (x  usermode_x)
+		usermode_x = x;
 
 	return oldx;
 }
@@ -60,5 +61,6 @@
 		usermode_sigalrm_blocked = false;
 	}
 
-	usermode_x = x;
+	if (usermode_x  x)
+		usermode_x = x;
 }



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

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 11:25:29 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: ld_thunkbus.c

Log Message:
Disable SIGALRM from interfering with this signal handler


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c
diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.10 src/sys/arch/usermode/dev/ld_thunkbus.c:1.11
--- src/sys/arch/usermode/dev/ld_thunkbus.c:1.10	Sun Sep  4 20:14:37 2011
+++ src/sys/arch/usermode/dev/ld_thunkbus.c	Mon Sep  5 11:25:29 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.10 2011/09/04 20:14:37 reinoud Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.11 2011/09/05 11:25:29 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.10 2011/09/04 20:14:37 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.11 2011/09/05 11:25:29 reinoud Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -123,6 +123,7 @@
 	sigemptyset(sa.sa_mask);
 	sa.sa_flags = SA_RESTART | SA_SIGINFO;
 	sa.sa_sigaction = ld_thunkbus_sig;
+	thunk_sigaddset(sa.sa_mask, SIGALRM);
 	if (thunk_sigaction(SIGIO, sa, NULL) == -1)
 		panic(couldn't register SIGIO handler: %d, thunk_geterrno());
 



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 11:56:53 UTC 2011

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

Log Message:
Initialise the alternative signal stack before referring to it


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/usermode/usermode/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/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.24 src/sys/arch/usermode/usermode/trap.c:1.25
--- src/sys/arch/usermode/usermode/trap.c:1.24	Mon Sep  5 11:10:36 2011
+++ src/sys/arch/usermode/usermode/trap.c	Mon Sep  5 11:56:52 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.24 2011/09/05 11:10:36 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.25 2011/09/05 11:56:52 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.24 2011/09/05 11:10:36 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.25 2011/09/05 11:56:52 reinoud Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -70,6 +70,14 @@
 {
 	static struct sigaction sa;
 
+	if ((sigstk.ss_sp = thunk_malloc(SIGSTKSZ)) == NULL)
+		panic(can't allocate signal stack space\n);
+	sigstk.ss_size  = SIGSTKSZ;
+	sigstk.ss_flags = 0;
+	if (thunk_sigaltstack(sigstk, 0)  0)
+		panic(can't set alternate stacksize : %d,
+		thunk_geterrno());
+
 	sigemptyset(sa.sa_mask);
 	sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
 	sa.sa_sigaction = mem_access_handler;
@@ -87,14 +95,6 @@
 	if (thunk_sigaction(SIGILL, sa, NULL) == -1)
 		panic(couldn't register SIGILL handler : %d, thunk_geterrno());
 
-	if ((sigstk.ss_sp = thunk_malloc(SIGSTKSZ)) == NULL)
-		panic(can't allocate signal stack space\n);
-	sigstk.ss_size  = SIGSTKSZ;
-	sigstk.ss_flags = 0;
-	if (thunk_sigaltstack(sigstk, 0)  0)
-		panic(can't set alternate stacksize : %d,
-		thunk_geterrno());
-
 //	debug_fh = thunk_open(/usr/sources/debug, O_RDWR | O_TRUNC | O_CREAT, 0666);
 }
 



CVS commit: src/sys/arch/usermode

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 12:04:03 UTC 2011

Modified Files:
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
Implement thunk_sigemptyset()


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/usermode/usermode/thunk.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/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.29 src/sys/arch/usermode/include/thunk.h:1.30
--- src/sys/arch/usermode/include/thunk.h:1.29	Mon Sep  5 11:09:38 2011
+++ src/sys/arch/usermode/include/thunk.h	Mon Sep  5 12:04:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.29 2011/09/05 11:09:38 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.30 2011/09/05 12:04:03 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -108,6 +108,7 @@
 void	thunk_signal(int, void (*)(int));
 int	thunk_sigblock(int);
 int	thunk_sigunblock(int);
+int	thunk_sigemptyset(sigset_t *sa_mask);
 void	thunk_sigaddset(sigset_t *sa_mask, int sig);
 int	thunk_atexit(void (*function)(void));
 

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.33 src/sys/arch/usermode/usermode/thunk.c:1.34
--- src/sys/arch/usermode/usermode/thunk.c:1.33	Mon Sep  5 11:09:38 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Mon Sep  5 12:04:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.33 2011/09/05 11:09:38 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.34 2011/09/05 12:04:03 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: thunk.c,v 1.33 2011/09/05 11:09:38 reinoud Exp $);
+__RCSID($NetBSD: thunk.c,v 1.34 2011/09/05 12:04:03 reinoud Exp $);
 #endif
 
 #include sys/types.h
@@ -406,6 +406,13 @@
 	return sigprocmask(SIG_UNBLOCK, set, NULL);
 }
 
+int
+thunk_sigemptyset(sigset_t *sa_mask)
+{
+	return sigemptyset(sa_mask);
+}
+
+
 void
 thunk_sigaddset(sigset_t *sa_mask, int sig)
 {



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 12:04:40 UTC 2011

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

Log Message:
Use thunk's version of sigemptyset()


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/usermode/usermode/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/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.25 src/sys/arch/usermode/usermode/trap.c:1.26
--- src/sys/arch/usermode/usermode/trap.c:1.25	Mon Sep  5 11:56:52 2011
+++ src/sys/arch/usermode/usermode/trap.c	Mon Sep  5 12:04:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.25 2011/09/05 11:56:52 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.26 2011/09/05 12:04:40 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.25 2011/09/05 11:56:52 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.26 2011/09/05 12:04:40 reinoud Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -78,9 +78,9 @@
 		panic(can't set alternate stacksize : %d,
 		thunk_geterrno());
 
-	sigemptyset(sa.sa_mask);
 	sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
 	sa.sa_sigaction = mem_access_handler;
+	thunk_sigemptyset(sa.sa_mask);
 	thunk_sigaddset(sa.sa_mask, SIGALRM);
 	if (thunk_sigaction(SIGSEGV, sa, NULL) == -1)
 		panic(couldn't register SIGSEGV handler : %d,
@@ -88,9 +88,9 @@
 	if (thunk_sigaction(SIGBUS, sa, NULL) == -1)
 		panic(couldn't register SIGBUS handler : %d, thunk_geterrno());
 
-	sigemptyset(sa.sa_mask);
 	sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
 	sa.sa_sigaction = illegal_instruction_handler;
+	thunk_sigemptyset(sa.sa_mask);
 	thunk_sigaddset(sa.sa_mask, SIGALRM);
 	if (thunk_sigaction(SIGILL, sa, NULL) == -1)
 		panic(couldn't register SIGILL handler : %d, thunk_geterrno());



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 12:19:12 UTC 2011

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

Log Message:
Install signal handlers just after pmap_bootstrap and don't defer it


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.54 src/sys/arch/usermode/usermode/pmap.c:1.55
--- src/sys/arch/usermode/usermode/pmap.c:1.54	Sun Sep  4 21:04:42 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Mon Sep  5 12:19:12 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.54 2011/09/04 21:04:42 jmcneill Exp $ */
+/* $NetBSD: pmap.c,v 1.55 2011/09/05 12:19:12 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.54 2011/09/04 21:04:42 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.55 2011/09/05 12:19:12 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -301,6 +301,8 @@
 		(uint64_t) (free_end - (free_start + fpos))/1024/1024);
 	aprint_debug(\t%PRIu64 MB of kmem left\n,
 		(uint64_t) (kmem_ext_end - kmem_ext_cur_end)/1024/1024);
+
+	setup_signal_handlers();
 }
 
 void
@@ -325,8 +327,6 @@
 	/* create pmap pool */
 	pool_init(pmap_pool, sizeof(struct pmap), 0, 0, 0,
 	pmappool, NULL, IPL_NONE);
-
-	setup_signal_handlers();
 }
 
 pmap_t



CVS commit: src/sys/net

2011-09-05 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Mon Sep  5 12:19:09 UTC 2011

Modified Files:
src/sys/net: if_pppoe.c if_spppsubr.c

Log Message:
Add support for RFC 4638 to pppoe(4).

The change to if_spppsubr.c moves the test for whether LCP should
request a mru change until after the pppoe device has picked up the
mtu of the underlying ethernet device.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/net/if_pppoe.c
cvs rdiff -u -r1.121 -r1.122 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.97 src/sys/net/if_pppoe.c:1.98
--- src/sys/net/if_pppoe.c:1.97	Tue Aug 30 22:23:06 2011
+++ src/sys/net/if_pppoe.c	Mon Sep  5 12:19:09 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.97 2011/08/30 22:23:06 rjs Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.98 2011/09/05 12:19:09 rjs Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_pppoe.c,v 1.97 2011/08/30 22:23:06 rjs Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_pppoe.c,v 1.98 2011/09/05 12:19:09 rjs Exp $);
 
 #include pppoe.h
 #include opt_pfil_hooks.h
@@ -85,6 +85,7 @@
 #define	PPPOE_TAG_ACCOOKIE	0x0104		/* AC cookie */
 #define	PPPOE_TAG_VENDOR	0x0105		/* vendor specific */
 #define	PPPOE_TAG_RELAYSID	0x0110		/* relay session id */
+#define	PPPOE_TAG_MAX_PAYLOAD	0x0120		/* max payload */
 #define	PPPOE_TAG_SNAME_ERR	0x0201		/* service name error */
 #define	PPPOE_TAG_ACSYS_ERR	0x0202		/* AC system error */
 #define	PPPOE_TAG_GENERIC_ERR	0x0203		/* generic error */
@@ -895,7 +896,7 @@
 return ENXIO;
 			}
 
-			if (sc-sc_sppp.pp_if.if_mtu 
+			if (sc-sc_sppp.pp_if.if_mtu !=
 			eth_if-if_mtu - PPPOE_OVERHEAD) {
 sc-sc_sppp.pp_if.if_mtu = eth_if-if_mtu -
 PPPOE_OVERHEAD;
@@ -1041,6 +1042,9 @@
 		l2 = strlen(sc-sc_concentrator_name);
 		len += 2 + 2 + l2;
 	}
+	if (sc-sc_sppp.pp_if.if_mtu  PPPOE_MAXMTU) {
+		len += 2 + 2 + 2;
+	}
 
 	/* allocate a buffer */
 	m0 = pppoe_get_mbuf(len + PPPOE_HEADERLEN);	/* header len + payload len */
@@ -1067,6 +1071,13 @@
 	PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE);
 	PPPOE_ADD_16(p, sizeof(sc));
 	memcpy(p, sc, sizeof sc);
+	p += sizeof(sc);
+
+	if (sc-sc_sppp.pp_if.if_mtu  PPPOE_MAXMTU) {
+		PPPOE_ADD_16(p, PPPOE_TAG_MAX_PAYLOAD);
+		PPPOE_ADD_16(p, 2);
+		PPPOE_ADD_16(p, (uint16_t)sc-sc_sppp.pp_if.if_mtu);
+	}
 
 #ifdef PPPOE_DEBUG
 	p += sizeof sc;
@@ -1283,6 +1294,9 @@
 		len += 2 + 2 + sc-sc_ac_cookie_len;	/* AC cookie */
 	if (sc-sc_relay_sid_len  0)
 		len += 2 + 2 + sc-sc_relay_sid_len;	/* Relay SID */
+	if (sc-sc_sppp.pp_if.if_mtu  PPPOE_MAXMTU) {
+		len += 2 + 2 + 2;
+	}
 	m0 = pppoe_get_mbuf(len + PPPOE_HEADERLEN);
 	if (!m0)
 		return ENOBUFS;
@@ -1311,6 +1325,13 @@
 	PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE);
 	PPPOE_ADD_16(p, sizeof(sc));
 	memcpy(p, sc, sizeof sc);
+	p += sizeof(sc);
+
+	if (sc-sc_sppp.pp_if.if_mtu  PPPOE_MAXMTU) {
+		PPPOE_ADD_16(p, PPPOE_TAG_MAX_PAYLOAD);
+		PPPOE_ADD_16(p, 2);
+		PPPOE_ADD_16(p, (uint16_t)sc-sc_sppp.pp_if.if_mtu);
+	}
 
 #ifdef PPPOE_DEBUG
 	p += sizeof sc;

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.121 src/sys/net/if_spppsubr.c:1.122
--- src/sys/net/if_spppsubr.c:1.121	Sun Jul 17 20:54:52 2011
+++ src/sys/net/if_spppsubr.c	Mon Sep  5 12:19:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.121 2011/07/17 20:54:52 joerg Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.122 2011/09/05 12:19:09 rjs Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_spppsubr.c,v 1.121 2011/07/17 20:54:52 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_spppsubr.c,v 1.122 2011/09/05 12:19:09 rjs Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_inet.h
@@ -2000,12 +2000,6 @@
 	sp-pp_seq[IDX_LCP] = 0;
 	sp-pp_rseq[IDX_LCP] = 0;
 	sp-lcp.protos = 0;
-	if (sp-pp_if.if_mtu  PP_MTU) {
-		sp-lcp.mru = sp-pp_if.if_mtu;
-		sp-lcp.opts |= (1  LCP_OPT_MRU);
-	} else
-		sp-lcp.mru = PP_MTU;
-	sp-lcp.their_mru = PP_MTU;
 
 	/*
 	 * Initialize counters and timeout values.  Note that we don't
@@ -2090,6 +2084,13 @@
 static void
 sppp_lcp_open(struct sppp *sp)
 {
+	if (sp-pp_if.if_mtu  PP_MTU) {
+		sp-lcp.mru = sp-pp_if.if_mtu;
+		sp-lcp.opts |= (1  LCP_OPT_MRU);
+	} else
+		sp-lcp.mru = PP_MTU;
+	sp-lcp.their_mru = PP_MTU;
+
 	/*
 	 * If we are authenticator, negotiate LCP_AUTH
 	 */



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

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 12:22:19 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: cpu.c

Log Message:
Disable kernel preemption in the critical section of cpu_switchto()


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/usermode/dev/cpu.c

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

Modified files:

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.29 src/sys/arch/usermode/dev/cpu.c:1.30
--- src/sys/arch/usermode/dev/cpu.c:1.29	Sun Sep  4 21:01:39 2011
+++ src/sys/arch/usermode/dev/cpu.c	Mon Sep  5 12:22:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.29 2011/09/04 21:01:39 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.30 2011/09/05 12:22:19 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include opt_cpu.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.29 2011/09/04 21:01:39 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.30 2011/09/05 12:22:19 reinoud Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -184,6 +184,8 @@
 	}
 #endif /* !CPU_DEBUG */
 
+	kpreempt_disable();
+
 	ci-ci_stash = oldlwp;
 	curlwp = newlwp;
 
@@ -197,6 +199,8 @@
 	}
 	thunk_seterrno(newpcb-pcb_errno);
 
+	kpreempt_enable();
+
 #ifdef CPU_DEBUG
 	printf(cpu_switchto: returning %p (was %p)\n, ci-ci_stash, oldlwp);
 #endif



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

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 12:40:38 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: cpu.c

Log Message:
Move kpreempt_enable/disable to splsched()


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/usermode/dev/cpu.c

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

Modified files:

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.30 src/sys/arch/usermode/dev/cpu.c:1.31
--- src/sys/arch/usermode/dev/cpu.c:1.30	Mon Sep  5 12:22:19 2011
+++ src/sys/arch/usermode/dev/cpu.c	Mon Sep  5 12:40:38 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.30 2011/09/05 12:22:19 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.31 2011/09/05 12:40:38 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include opt_cpu.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.30 2011/09/05 12:22:19 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.31 2011/09/05 12:40:38 reinoud Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -159,6 +159,7 @@
 	struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL;
 	struct pcb *newpcb = lwp_getpcb(newlwp);
 	struct cpu_info *ci = curcpu();
+	int s;
 
 #ifdef CPU_DEBUG
 	printf(cpu_switchto [%s,pid=%d,lid=%d] - [%s,pid=%d,lid=%d]\n,
@@ -184,7 +185,7 @@
 	}
 #endif /* !CPU_DEBUG */
 
-	kpreempt_disable();
+	s = splsched();
 
 	ci-ci_stash = oldlwp;
 	curlwp = newlwp;
@@ -199,7 +200,7 @@
 	}
 	thunk_seterrno(newpcb-pcb_errno);
 
-	kpreempt_enable();
+	splx(s);
 
 #ifdef CPU_DEBUG
 	printf(cpu_switchto: returning %p (was %p)\n, ci-ci_stash, oldlwp);



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  5 12:49:34 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: urkelvisor.c

Log Message:
let env URKELVISOR=0 disable it at runtime


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/usermode/urkelvisor.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/usermode/usermode/urkelvisor.c
diff -u src/sys/arch/usermode/usermode/urkelvisor.c:1.3 src/sys/arch/usermode/usermode/urkelvisor.c:1.4
--- src/sys/arch/usermode/usermode/urkelvisor.c:1.3	Sat Sep  3 15:00:28 2011
+++ src/sys/arch/usermode/usermode/urkelvisor.c	Mon Sep  5 12:49:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: urkelvisor.c,v 1.3 2011/09/03 15:00:28 jmcneill Exp $ */
+/* $NetBSD: urkelvisor.c,v 1.4 2011/09/05 12:49:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: urkelvisor.c,v 1.3 2011/09/03 15:00:28 jmcneill Exp $);
+__RCSID($NetBSD: urkelvisor.c,v 1.4 2011/09/05 12:49:33 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -169,9 +169,17 @@
 void
 urkelvisor_init(void)
 {
+	char *enable;
 	pid_t child_pid;
 	int status;
 
+	/* env URKELVISOR=0 disables the urkelvisor */
+	enable = getenv(URKELVISOR);
+	if (enable  *enable == '0') {
+		fprintf(stderr, %s: disabled\n, __func__);
+		return;
+	}
+
 	child_pid = fork();
 	switch (child_pid) {
 	case -1:



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  5 13:28:17 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: urkelvisor.c

Log Message:
rearrange ptrace_getregs and have the child raise(SIGSTOP) instead of wait()


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/usermode/urkelvisor.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/usermode/usermode/urkelvisor.c
diff -u src/sys/arch/usermode/usermode/urkelvisor.c:1.4 src/sys/arch/usermode/usermode/urkelvisor.c:1.5
--- src/sys/arch/usermode/usermode/urkelvisor.c:1.4	Mon Sep  5 12:49:33 2011
+++ src/sys/arch/usermode/usermode/urkelvisor.c	Mon Sep  5 13:28:17 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: urkelvisor.c,v 1.4 2011/09/05 12:49:33 jmcneill Exp $ */
+/* $NetBSD: urkelvisor.c,v 1.5 2011/09/05 13:28:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -32,13 +32,14 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: urkelvisor.c,v 1.4 2011/09/05 12:49:33 jmcneill Exp $);
+__RCSID($NetBSD: urkelvisor.c,v 1.5 2011/09/05 13:28:17 jmcneill Exp $);
 #endif
 
 #include sys/types.h
 #include sys/param.h
 #include sys/ptrace.h
 #include sys/wait.h
+#include sys/syscall.h
 
 #ifdef __linux__
 #include sys/user.h
@@ -50,6 +51,7 @@
 #include errno.h
 #include stdlib.h
 #include stdio.h
+#include signal.h
 #include unistd.h
 
 #include ../include/urkelvisor.h
@@ -98,27 +100,24 @@
 static void
 ptrace_getregs(pid_t urkel_pid, struct reg_struct *puregs)
 {
+	errno = 0;
 #ifdef __linux__
 	ptrace(PT_GETREGS, urkel_pid, NULL, puregs);
 #else
 	ptrace(PT_GETREGS, urkel_pid, puregs, 0);
 #endif
+	if (errno)
+		err(EXIT_FAILURE, ptrace(PT_GETREGS, %d, uregs, 0) failed,
+		urkel_pid);
 }
 
 static int
-handle_syscall(pid_t urkel_pid)
+handle_syscall(struct reg_struct *puregs, pid_t urkel_pid)
 {
-	struct reg_struct uregs;
 	int sig = 0;
 
-	errno = 0;
-	ptrace_getregs(urkel_pid, uregs);
-	if (errno)
-		err(EXIT_FAILURE, ptrace(PT_GETREGS, %d, uregs, 0) failed,
-		urkel_pid);
-
-	if (R_PC(uregs) = kmem_user_start  R_PC(uregs)  kmem_user_end) {
-		fprintf(stderr, caught syscall %d\n, (int)R_SYSCALL(uregs));
+	if (R_PC(puregs) = kmem_user_start  R_PC(puregs)  kmem_user_end) {
+		fprintf(stderr, caught syscall %d\n, (int)R_SYSCALL(puregs));
 		errno = 0;
 		ptrace(PT_SYSCALLEMU, urkel_pid, NULL, 0);
 		if (errno)
@@ -134,6 +133,7 @@
 static int
 urkelvisor(pid_t urkel_pid)
 {
+	struct reg_struct uregs;
 	int status, insyscall, sig;
 
 	insyscall = 0;
@@ -156,7 +156,8 @@
 		if (WSTOPSIG(status) == SIGTRAP) {
 			insyscall = !insyscall;
 			if (insyscall) {
-sig = handle_syscall(urkel_pid);
+ptrace_getregs(urkel_pid, uregs);
+sig = handle_syscall(uregs, urkel_pid);
 if (sig)
 	insyscall = !insyscall;
 			}
@@ -191,7 +192,7 @@
 		if (errno)
 			err(EXIT_FAILURE,
 			ptrace(PT_TRACE_ME, 0, NULL, 0) failed);
-		wait(status);
+		raise(SIGSTOP);
 		break;
 	default:
 		status = urkelvisor(child_pid);



CVS commit: src/usr.bin/utoppya

2011-09-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Sep  5 18:11:54 UTC 2011

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

Log Message:
Sprinkle const. Use __dead.


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

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

Modified files:

Index: src/usr.bin/utoppya/utoppya.c
diff -u src/usr.bin/utoppya/utoppya.c:1.4 src/usr.bin/utoppya/utoppya.c:1.5
--- src/usr.bin/utoppya/utoppya.c:1.4	Tue Apr 14 06:15:37 2009
+++ src/usr.bin/utoppya/utoppya.c	Mon Sep  5 18:11:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: utoppya.c,v 1.4 2009/04/14 06:15:37 lukem Exp $	*/
+/*	$NetBSD: utoppya.c,v 1.5 2011/09/05 18:11:53 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
 static void cmd_get(int, char **);
 static void cmd_put(int, char **);
 
-static struct toppy_command {
+static const struct toppy_command {
 	const char *tc_cmd;
 	void (*tc_handler)(int, char **);
 } toppy_commands[] = {
@@ -84,7 +84,7 @@
 	{NULL,		NULL}
 };
 
-static void
+__dead static void
 usage(void)
 {
 
@@ -97,7 +97,7 @@
 int
 main(int argc, char *argv[])
 {
-	struct toppy_command *tc;
+	const struct toppy_command *tc;
 	const char *devpath;
 	int ch;
 



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  5 18:16:34 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: urkelvisor.c

Log Message:
check WIFSTOPPED status


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/usermode/urkelvisor.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/usermode/usermode/urkelvisor.c
diff -u src/sys/arch/usermode/usermode/urkelvisor.c:1.5 src/sys/arch/usermode/usermode/urkelvisor.c:1.6
--- src/sys/arch/usermode/usermode/urkelvisor.c:1.5	Mon Sep  5 13:28:17 2011
+++ src/sys/arch/usermode/usermode/urkelvisor.c	Mon Sep  5 18:16:34 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: urkelvisor.c,v 1.5 2011/09/05 13:28:17 jmcneill Exp $ */
+/* $NetBSD: urkelvisor.c,v 1.6 2011/09/05 18:16:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: urkelvisor.c,v 1.5 2011/09/05 13:28:17 jmcneill Exp $);
+__RCSID($NetBSD: urkelvisor.c,v 1.6 2011/09/05 18:16:34 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -153,16 +153,18 @@
 
 		//fprintf(stderr, syscall insyscall=%d status=%x\n,
 		//insyscall, status);
-		if (WSTOPSIG(status) == SIGTRAP) {
-			insyscall = !insyscall;
-			if (insyscall) {
-ptrace_getregs(urkel_pid, uregs);
-sig = handle_syscall(uregs, urkel_pid);
-if (sig)
-	insyscall = !insyscall;
+		if (WIFSTOPPED(status)) {
+			if (WSTOPSIG(status) == SIGTRAP) {
+insyscall = !insyscall;
+if (insyscall) {
+	ptrace_getregs(urkel_pid, uregs);
+	sig = handle_syscall(uregs, urkel_pid);
+	if (sig)
+		insyscall = !insyscall;
+}
+			} else {
+sig = WSTOPSIG(status);
 			}
-		} else {
-			sig = WSTOPSIG(status);
 		}
 	}
 }



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

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  5 18:17:08 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: clock.c ld_thunkbus.c

Log Message:
use sigaltstack


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/dev/clock.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/clock.c
diff -u src/sys/arch/usermode/dev/clock.c:1.12 src/sys/arch/usermode/dev/clock.c:1.13
--- src/sys/arch/usermode/dev/clock.c:1.12	Tue Aug 23 21:56:02 2011
+++ src/sys/arch/usermode/dev/clock.c	Mon Sep  5 18:17:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.12 2011/08/23 21:56:02 jmcneill Exp $ */
+/* $NetBSD: clock.c,v 1.13 2011/09/05 18:17:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.12 2011/08/23 21:56:02 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.13 2011/09/05 18:17:08 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -88,6 +88,8 @@
 {
 	clock_softc_t *sc = device_private(self);
 	struct thunk_itimerval itimer;
+	struct sigaction sa;
+	stack_t ss;
 	long tcres;
 
 	aprint_naive(\n);
@@ -102,7 +104,19 @@
 	sc-sc_todr.todr_gettime = clock_todr_gettime;
 	todr_attach(sc-sc_todr);
 
-	thunk_signal(SIGALRM, clock_signal);
+	ss.ss_sp = thunk_malloc(SIGSTKSZ);
+	if (ss.ss_sp == NULL)
+		panic(%s: couldn't allocate signal stack, __func__);
+	ss.ss_size = SIGSTKSZ;
+	ss.ss_flags = 0;
+	if (thunk_sigaltstack(ss, NULL) == -1)
+		panic(%s: couldn't setup signal stack, __func__);
+
+	memset(sa, 0, sizeof(sa));
+	sigfillset(sa.sa_mask);
+	sa.sa_handler = clock_signal;
+	sa.sa_flags = SA_ONSTACK;
+	thunk_sigaction(SIGALRM, sa, NULL);
 
 	itimer.it_interval.tv_sec = 0;
 	itimer.it_interval.tv_usec = 1;
@@ -118,7 +132,7 @@
 }
 
 static void
-clock_signal(int notused)
+clock_signal(int sig)
 {
 	curcpu()-ci_idepth++;
 

Index: src/sys/arch/usermode/dev/ld_thunkbus.c
diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.11 src/sys/arch/usermode/dev/ld_thunkbus.c:1.12
--- src/sys/arch/usermode/dev/ld_thunkbus.c:1.11	Mon Sep  5 11:25:29 2011
+++ src/sys/arch/usermode/dev/ld_thunkbus.c	Mon Sep  5 18:17:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.11 2011/09/05 11:25:29 reinoud Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.12 2011/09/05 18:17:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.11 2011/09/05 11:25:29 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.12 2011/09/05 18:17:08 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -91,6 +91,7 @@
 	struct thunkbus_attach_args *taa = opaque;
 	const char *path = taa-u.diskimage.path;
 	struct sigaction sa;
+	stack_t ss;
 	ssize_t size, blksize;
 
 	ld-sc_dv = self;
@@ -120,8 +121,16 @@
 	sc-sc_ih = softint_establish(SOFTINT_BIO,
 	ld_thunkbus_complete, sc);
 
+	ss.ss_sp = thunk_malloc(SIGSTKSZ);
+	if (ss.ss_sp == NULL)
+		panic(%s: couldn't allocate signal stack, __func__);
+	ss.ss_size = SIGSTKSZ;
+	ss.ss_flags = 0;
+	if (thunk_sigaltstack(ss, NULL) == -1)
+		panic(%s: couldn't setup signal stack, __func__);
+
 	sigemptyset(sa.sa_mask);
-	sa.sa_flags = SA_RESTART | SA_SIGINFO;
+	sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
 	sa.sa_sigaction = ld_thunkbus_sig;
 	thunk_sigaddset(sa.sa_mask, SIGALRM);
 	if (thunk_sigaction(SIGIO, sa, NULL) == -1)



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  5 18:17:44 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: intr.c

Log Message:
remove thunk_sigblock/thunk_sigunblock calls


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/usermode/intr.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/usermode/usermode/intr.c
diff -u src/sys/arch/usermode/usermode/intr.c:1.2 src/sys/arch/usermode/usermode/intr.c:1.3
--- src/sys/arch/usermode/usermode/intr.c:1.2	Mon Sep  5 11:12:51 2011
+++ src/sys/arch/usermode/usermode/intr.c	Mon Sep  5 18:17:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.2 2011/09/05 11:12:51 jmcneill Exp $ */
+/* $NetBSD: intr.c,v 1.3 2011/09/05 18:17:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.2 2011/09/05 11:12:51 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.3 2011/09/05 18:17:44 jmcneill Exp $);
 
 #include sys/types.h
 
@@ -35,18 +35,12 @@
 #include machine/thunk.h
 
 static int usermode_x = IPL_NONE;
-static bool usermode_sigalrm_blocked = false;
 
 int
 splraise(int x)
 {
 	int oldx = usermode_x;
 
-	if (x  IPL_VM  usermode_sigalrm_blocked == false) {
-		thunk_sigblock(SIGALRM);
-		usermode_sigalrm_blocked = true;
-	}
-
 	if (x  usermode_x)
 		usermode_x = x;
 
@@ -56,11 +50,6 @@
 void
 spllower(int x)
 {
-	if (x = IPL_VM  usermode_sigalrm_blocked == true) {
-		thunk_sigunblock(SIGALRM);
-		usermode_sigalrm_blocked = false;
-	}
-
 	if (usermode_x  x)
 		usermode_x = x;
 }



CVS commit: src/share/man/man9

2011-09-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Sep  5 18:21:29 UTC 2011

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

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/share/man/man9/vmem.9

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

Modified files:

Index: src/share/man/man9/vmem.9
diff -u src/share/man/man9/vmem.9:1.12 src/share/man/man9/vmem.9:1.13
--- src/share/man/man9/vmem.9:1.12	Fri Sep  2 22:07:33 2011
+++ src/share/man/man9/vmem.9	Mon Sep  5 18:21:29 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: vmem.9,v 1.12 2011/09/02 22:07:33 dyoung Exp $
+.\	$NetBSD: vmem.9,v 1.13 2011/09/05 18:21:29 wiz Exp $
 .\
 .\ Copyright (c)2006 YAMAMOTO Takashi,
 .\ All rights reserved.
@@ -266,7 +266,7 @@
 .It Fa addrp
 On success, if
 .Fa addrp
-is not 
+is not
 .Dv NULL ,
 .Fn vmem_xalloc
 overwrites it with the start address of the allocated span.
@@ -329,7 +329,7 @@
 .It Fa addrp
 On success, if
 .Fa addrp
-is not 
+is not
 .Dv NULL ,
 .Fn vmem_alloc
 overwrites it with the start address of the allocated span.



CVS commit: src/usr.bin/yacc

2011-09-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Sep  5 18:25:24 UTC 2011

Removed Files:
src/usr.bin/yacc: ACKNOWLEDGEMENTS Makefile NEW_FEATURES NOTES README
closure.c defs.h error.c lalr.c lr0.c main.c mkpar.c output.c
reader.c skeleton.c symtab.c verbose.c warshall.c yacc.1
src/usr.bin/yacc/test: error.output error.tab.c error.tab.h error.y
ftp.output ftp.tab.c ftp.tab.h ftp.y

Log Message:
Moved to src/external/bsd/byacc.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 src/usr.bin/yacc/ACKNOWLEDGEMENTS \
src/usr.bin/yacc/NEW_FEATURES
cvs rdiff -u -r1.8 -r0 src/usr.bin/yacc/Makefile src/usr.bin/yacc/closure.c \
src/usr.bin/yacc/warshall.c
cvs rdiff -u -r1.3 -r0 src/usr.bin/yacc/NOTES
cvs rdiff -u -r1.2 -r0 src/usr.bin/yacc/README
cvs rdiff -u -r1.17 -r0 src/usr.bin/yacc/defs.h
cvs rdiff -u -r1.11 -r0 src/usr.bin/yacc/error.c src/usr.bin/yacc/lalr.c
cvs rdiff -u -r1.10 -r0 src/usr.bin/yacc/lr0.c src/usr.bin/yacc/verbose.c
cvs rdiff -u -r1.21 -r0 src/usr.bin/yacc/main.c
cvs rdiff -u -r1.12 -r0 src/usr.bin/yacc/mkpar.c src/usr.bin/yacc/symtab.c
cvs rdiff -u -r1.15 -r0 src/usr.bin/yacc/output.c
cvs rdiff -u -r1.18 -r0 src/usr.bin/yacc/reader.c
cvs rdiff -u -r1.29 -r0 src/usr.bin/yacc/skeleton.c
cvs rdiff -u -r1.13 -r0 src/usr.bin/yacc/yacc.1
cvs rdiff -u -r1.1.1.1 -r0 src/usr.bin/yacc/test/error.output \
src/usr.bin/yacc/test/error.y src/usr.bin/yacc/test/ftp.output
cvs rdiff -u -r1.4 -r0 src/usr.bin/yacc/test/error.tab.c
cvs rdiff -u -r1.2 -r0 src/usr.bin/yacc/test/error.tab.h \
src/usr.bin/yacc/test/ftp.tab.h
cvs rdiff -u -r1.7 -r0 src/usr.bin/yacc/test/ftp.tab.c
cvs rdiff -u -r1.6 -r0 src/usr.bin/yacc/test/ftp.y

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



CVS commit: src/lib/libutil

2011-09-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Sep  5 18:25:57 UTC 2011

Modified Files:
src/lib/libutil: getlabelsector.3

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libutil/getlabelsector.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/libutil/getlabelsector.3
diff -u src/lib/libutil/getlabelsector.3:1.6 src/lib/libutil/getlabelsector.3:1.7
--- src/lib/libutil/getlabelsector.3:1.6	Tue Aug 30 12:39:52 2011
+++ src/lib/libutil/getlabelsector.3	Mon Sep  5 18:25:57 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: getlabelsector.3,v 1.6 2011/08/30 12:39:52 bouyer Exp $
+.\	$NetBSD: getlabelsector.3,v 1.7 2011/09/05 18:25:57 wiz Exp $
 .\
 .\
 .\ Copyright 2002 Wasabi Systems, Inc.
@@ -34,7 +34,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd Augoust 25, 2011
+.Dd August 25, 2011
 .Dt GETLABELSECTOR 3
 .Os
 .Sh NAME



CVS commit: src/usr.bin/fstat

2011-09-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Sep  5 18:27:31 UTC 2011

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

Log Message:
Remove duplicate RCS Id and split file system.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/fstat/fstat.1

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

Modified files:

Index: src/usr.bin/fstat/fstat.1
diff -u src/usr.bin/fstat/fstat.1:1.26 src/usr.bin/fstat/fstat.1:1.27
--- src/usr.bin/fstat/fstat.1:1.26	Sat Sep  3 13:22:55 2011
+++ src/usr.bin/fstat/fstat.1	Mon Sep  5 18:27:31 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: fstat.1,v 1.26 2011/09/03 13:22:55 christos Exp $
+.\	$NetBSD: fstat.1,v 1.27 2011/09/05 18:27:31 wiz Exp $
 .\
 .\ Copyright (c) 1987, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -28,7 +28,6 @@
 .\ SUCH DAMAGE.
 .\
 .\ from: @(#)fstat.1	8.3 (Berkeley) 2/25/94
-.\	$NetBSD: fstat.1,v 1.26 2011/09/03 13:22:55 christos Exp $
 .\
 .Dd September 3, 2011
 .Dt FSTAT 1
@@ -57,22 +56,22 @@
 Options:
 .Bl -tag -width Ds
 .It Fl f
-Restrict examination to files open in the same filesystems as
-the named file arguments, or to the filesystem containing the
+Restrict examination to files open in the same file systems as
+the named file arguments, or to the file system containing the
 current directory if there are no additional filename arguments.
-For example, to find all files open in the filesystem where the
+For example, to find all files open in the file system where the
 directory
 .Pa /usr/src
 resides, type
 .Dq Li fstat -f /usr/src .
 Note that this will not list
 .Dv AF_LOCAL
-domain sockets open in the filesystem.
+domain sockets open in the file system.
 To find all the
 .Dv AF_LOCAL
 domain sockets, use
 .Nm
-to list all the sockets, and look for the ones that belong in the filesystem.
+to list all the sockets, and look for the ones that belong in the file system.
 .It Fl M
 Extract values associated with the name list from the specified core
 instead of the default
@@ -82,7 +81,7 @@
 .Pa /netbsd .
 .It Fl n
 Numerical format.
-Print the device number (maj,min) of the filesystem
+Print the device number (maj,min) of the file system
 the file resides in rather than the mount point name; for special
 files, print the
 device number that the special device refers to rather than the filename
@@ -146,7 +145,7 @@
 If the
 .Fl n
 flag wasn't specified, this header is present and is the
-pathname that the filesystem the file resides in is mounted on.
+pathname that the file system the file resides in is mounted on.
 .It Li DEV
 If the
 .Fl n
@@ -185,7 +184,7 @@
 .Dq w
 indicates open for writing.
 This field is useful when trying to find the processes that are
-preventing a filesystem from being downgraded to read-only.
+preventing a file system from being downgraded to read-only.
 .It Li NAME
 If filename arguments are specified and the
 .Fl f



CVS commit: src/distrib/sets/lists/base

2011-09-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Sep  5 18:29:37 UTC 2011

Modified Files:
src/distrib/sets/lists/base: mi

Log Message:
Improve previous: As the comment at the top says, don't remove entries,
but mark them obsolete instead (hi christos!)

Sort while here.


To generate a diff of this commit:
cvs rdiff -u -r1.953 -r1.954 src/distrib/sets/lists/base/mi

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/mi
diff -u src/distrib/sets/lists/base/mi:1.953 src/distrib/sets/lists/base/mi:1.954
--- src/distrib/sets/lists/base/mi:1.953	Sun Sep  4 21:28:02 2011
+++ src/distrib/sets/lists/base/mi	Mon Sep  5 18:29:36 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.953 2011/09/04 21:28:02 christos Exp $
+# $NetBSD: mi,v 1.954 2011/09/05 18:29:36 wiz Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -20,15 +20,14 @@
 ./bin		base-sys-root
 ./bin/[		base-util-root
 ./bin/cat	base-util-root
+./bin/chgrp	base-util-root
 ./bin/chio	base-util-root
 ./bin/chmod	base-util-root
 ./bin/cp	base-util-root
 ./bin/cpio	base-util-root
 ./bin/csh	base-util-root
-./bin/chgrp	base-util-root
 ./bin/date	base-util-root
 ./bin/dd	base-util-root
-./bin/rump.dd	base-util-root
 ./bin/df	base-util-root
 ./bin/domainnamebase-nis-root
 ./bin/echo	base-util-root
@@ -51,6 +50,7 @@
 ./bin/rm	base-util-root
 ./bin/rmail	base-obsolete		obsolete
 ./bin/rmdir	base-util-root
+./bin/rump.dd	base-util-root
 ./bin/sh	base-util-root
 ./bin/sleep	base-util-root
 ./bin/stty	base-util-root
@@ -94,8 +94,8 @@
 ./etc/defaults	base-sys-root
 ./etc/disklabelsbase-obsolete		obsolete
 ./etc/fonts	base-x11-root
-./etc/fonts/conf.dbase-x11-root
 ./etc/fonts/conf.availbase-x11-root
+./etc/fonts/conf.dbase-x11-root
 ./etc/iscsi	base-sysutil-root
 ./etc/kerberosIVbase-obsolete		obsolete
 ./etc/kerberosV	base-krb5-root
@@ -144,11 +144,15 @@
 ./libdata/firmware/if_iwn/LICENSE.iwlwifi-5000-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/LICENSE.iwlwifi-5150-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/LICENSE.iwlwifi-6000-ucode	base-firmware-root
+./libdata/firmware/if_iwn/LICENSE.iwlwifi-6000g2a-ucode	base-firmware-root
+./libdata/firmware/if_iwn/LICENSE.iwlwifi-6050-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/README.iwlwifi-1000-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/README.iwlwifi-4965-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/README.iwlwifi-5000-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/README.iwlwifi-5150-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/README.iwlwifi-6000-ucode	base-firmware-root
+./libdata/firmware/if_iwn/README.iwlwifi-6000g2a-ucode	base-firmware-root
+./libdata/firmware/if_iwn/README.iwlwifi-6050-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-1000-3.ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-4965-1.ucode	base-obsolete		obsolete
 ./libdata/firmware/if_iwn/iwlwifi-4965-2.ucode	base-firmware-root
@@ -156,11 +160,7 @@
 ./libdata/firmware/if_iwn/iwlwifi-5000-2.ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-5150-2.ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-6000-4.ucode	base-firmware-root
-./libdata/firmware/if_iwn/LICENSE.iwlwifi-6000g2a-ucode	base-firmware-root
-./libdata/firmware/if_iwn/README.iwlwifi-6000g2a-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-6000g2a-5.ucode	base-firmware-root
-./libdata/firmware/if_iwn/LICENSE.iwlwifi-6050-ucode	base-firmware-root
-./libdata/firmware/if_iwn/README.iwlwifi-6050-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-6050-5.ucode	base-firmware-root
 ./libdata/firmware/if_otus			base-firmware-root
 ./libdata/firmware/if_otus/otus-init		base-firmware-root
@@ -203,12 +203,12 @@
 ./libexec/dhcpcd-hooks/30-hostname		base-dhcpcd-root
 ./libexec/dhcpcd-hooks/50-ntp.conf		base-dhcpcd-root
 ./libexec/dhcpcd-run-hooks			base-dhcpcd-root
+./libexec/lfs_cleanerdbase-sysutil-bin
 ./libexec/resolvconfbase-resolvconf-root
-./libexec/resolvconf/libc			base-resolvconf-root
 ./libexec/resolvconf/dnsmasq			base-resolvconf-root
+./libexec/resolvconf/libc			base-resolvconf-root
 ./libexec/resolvconf/named			base-resolvconf-root
 ./libexec/resolvconf/unbound			base-resolvconf-root
-./libexec/lfs_cleanerdbase-sysutil-bin
 ./mnt		base-sys-root
 ./rescue	base-sys-root
 ./root		base-sys-root
@@ -222,7 +222,6 @@
 ./sbin/ccdconfigbase-sysutil-root
 ./sbin/cgdconfigbase-sysutil-root	crypto
 ./sbin/chown	base-sysutil-root
-./sbin/rump.cgdconfigbase-sysutil-root	crypto
 ./sbin/clri	base-sysutil-root
 ./sbin/devpubd	base-sysutil-root
 ./sbin/dhclient	base-dhclient-root
@@ -231,8 +230,8 @@
 ./sbin/disklabelbase-sysutil-root
 

CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 18:50:35 UTC 2011

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

Log Message:
Check for NULL pcb!


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/usermode/usermode/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/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.26 src/sys/arch/usermode/usermode/trap.c:1.27
--- src/sys/arch/usermode/usermode/trap.c:1.26	Mon Sep  5 12:04:40 2011
+++ src/sys/arch/usermode/usermode/trap.c	Mon Sep  5 18:50:34 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.26 2011/09/05 12:04:40 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.27 2011/09/05 18:50:34 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.26 2011/09/05 12:04:40 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.27 2011/09/05 18:50:34 reinoud Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -174,6 +174,11 @@
 		if (!pmap_fault(vm_map-pmap, va, atype)) {
 			aprint_debug(pmap fault couldn't handle it! : 
 derived atype %d\n, atype);
+
+			/* extra debug for now */
+			if (pcb == 0)
+panic(NULL pcb!\n);
+
 			pcb-pcb_onfault = NULL;
 			rv = uvm_fault(vm_map, va, atype);
 			pcb-pcb_onfault = onfault;



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

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 18:52:14 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: clock.c

Log Message:
Check SIGALRM handler setup success or failure


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/dev/clock.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/usermode/dev/clock.c
diff -u src/sys/arch/usermode/dev/clock.c:1.13 src/sys/arch/usermode/dev/clock.c:1.14
--- src/sys/arch/usermode/dev/clock.c:1.13	Mon Sep  5 18:17:08 2011
+++ src/sys/arch/usermode/dev/clock.c	Mon Sep  5 18:52:14 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.13 2011/09/05 18:17:08 jmcneill Exp $ */
+/* $NetBSD: clock.c,v 1.14 2011/09/05 18:52:14 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.13 2011/09/05 18:17:08 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.14 2011/09/05 18:52:14 reinoud Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -45,7 +45,7 @@
 static void	clock_attach(device_t, device_t, void *);
 
 static void	clock_softint(void *);
-static void 	clock_signal(int);
+static void	clock_signal(int sig);
 static unsigned int clock_getcounter(struct timecounter *);
 
 static int	clock_todr_gettime(struct todr_chip_handle *, struct timeval *);
@@ -86,9 +86,9 @@
 static void
 clock_attach(device_t parent, device_t self, void *opaque)
 {
+	static struct sigaction sa;
 	clock_softc_t *sc = device_private(self);
 	struct thunk_itimerval itimer;
-	struct sigaction sa;
 	stack_t ss;
 	long tcres;
 
@@ -116,7 +116,9 @@
 	sigfillset(sa.sa_mask);
 	sa.sa_handler = clock_signal;
 	sa.sa_flags = SA_ONSTACK;
-	thunk_sigaction(SIGALRM, sa, NULL);
+	if (thunk_sigaction(SIGALRM, sa, NULL) == -1)
+		panic(couldn't register SIGALRM handler : %d,
+		thunk_geterrno());
 
 	itimer.it_interval.tv_sec = 0;
 	itimer.it_interval.tv_usec = 1;



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

2011-09-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Sep  5 19:28:32 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: cpu.c

Log Message:
Restore errno just before switching to the new context and NOT after it got
back again


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/usermode/dev/cpu.c

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

Modified files:

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.31 src/sys/arch/usermode/dev/cpu.c:1.32
--- src/sys/arch/usermode/dev/cpu.c:1.31	Mon Sep  5 12:40:38 2011
+++ src/sys/arch/usermode/dev/cpu.c	Mon Sep  5 19:28:32 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.31 2011/09/05 12:40:38 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.32 2011/09/05 19:28:32 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include opt_cpu.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.31 2011/09/05 12:40:38 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.32 2011/09/05 19:28:32 reinoud Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -159,7 +159,6 @@
 	struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL;
 	struct pcb *newpcb = lwp_getpcb(newlwp);
 	struct cpu_info *ci = curcpu();
-	int s;
 
 #ifdef CPU_DEBUG
 	printf(cpu_switchto [%s,pid=%d,lid=%d] - [%s,pid=%d,lid=%d]\n,
@@ -185,22 +184,19 @@
 	}
 #endif /* !CPU_DEBUG */
 
-	s = splsched();
-
 	ci-ci_stash = oldlwp;
 	curlwp = newlwp;
 
 	if (oldpcb) {
 		oldpcb-pcb_errno = thunk_geterrno();
+		thunk_seterrno(newpcb-pcb_errno);
 		if (thunk_swapcontext(oldpcb-pcb_ucp, newpcb-pcb_ucp))
 			panic(swapcontext failed);
 	} else {
+		thunk_seterrno(newpcb-pcb_errno);
 		if (thunk_setcontext(newpcb-pcb_ucp))
 			panic(setcontext failed);
 	}
-	thunk_seterrno(newpcb-pcb_errno);
-
-	splx(s);
 
 #ifdef CPU_DEBUG
 	printf(cpu_switchto: returning %p (was %p)\n, ci-ci_stash, oldlwp);



CVS commit: src/sys/arch/usermode

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  5 20:54:48 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: cpu.c
src/sys/arch/usermode/usermode: urkelvisor.c

Log Message:
Have the urkel maintain a 'cpu_lwp_inkernel' variable and read it from the
urkelvisor to determine the origin of a syscall.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/usermode/urkelvisor.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/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.32 src/sys/arch/usermode/dev/cpu.c:1.33
--- src/sys/arch/usermode/dev/cpu.c:1.32	Mon Sep  5 19:28:32 2011
+++ src/sys/arch/usermode/dev/cpu.c	Mon Sep  5 20:54:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.32 2011/09/05 19:28:32 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.33 2011/09/05 20:54:47 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include opt_cpu.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.32 2011/09/05 19:28:32 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.33 2011/09/05 20:54:47 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -58,6 +58,8 @@
 #define cpu_unreachable()	do { thunk_abort(); } while (0)
 #endif
 
+int cpu_lwp_inkernel = 1;
+
 static int	cpu_match(device_t, cfdata_t, void *);
 static void	cpu_attach(device_t, device_t, void *);
 
@@ -186,6 +188,7 @@
 
 	ci-ci_stash = oldlwp;
 	curlwp = newlwp;
+	cpu_lwp_inkernel = curproc-p_vmspace-vm_map.pmap == pmap_kernel();
 
 	if (oldpcb) {
 		oldpcb-pcb_errno = thunk_geterrno();

Index: src/sys/arch/usermode/usermode/urkelvisor.c
diff -u src/sys/arch/usermode/usermode/urkelvisor.c:1.6 src/sys/arch/usermode/usermode/urkelvisor.c:1.7
--- src/sys/arch/usermode/usermode/urkelvisor.c:1.6	Mon Sep  5 18:16:34 2011
+++ src/sys/arch/usermode/usermode/urkelvisor.c	Mon Sep  5 20:54:48 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: urkelvisor.c,v 1.6 2011/09/05 18:16:34 jmcneill Exp $ */
+/* $NetBSD: urkelvisor.c,v 1.7 2011/09/05 20:54:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h
 #ifdef __NetBSD__
-__RCSID($NetBSD: urkelvisor.c,v 1.6 2011/09/05 18:16:34 jmcneill Exp $);
+__RCSID($NetBSD: urkelvisor.c,v 1.7 2011/09/05 20:54:48 jmcneill Exp $);
 #endif
 
 #include sys/types.h
@@ -114,9 +114,20 @@
 static int
 handle_syscall(struct reg_struct *puregs, pid_t urkel_pid)
 {
+	extern int cpu_lwp_inkernel;
 	int sig = 0;
+	int inkernel;
 
-	if (R_PC(puregs) = kmem_user_start  R_PC(puregs)  kmem_user_end) {
+	errno = 0;
+	inkernel = ptrace(PT_READ_D, urkel_pid, cpu_lwp_inkernel, 0);
+	if (errno)
+		err(EXIT_FAILURE, ptrace(PT_READ_D, %d, %p, 0) failed,
+		urkel_pid, cpu_lwp_inkernel);
+
+	//fprintf(stderr, %s: pid=%d pc=%p inkernel=%d\n,
+	//__func__, urkel_pid, (void *)R_PC(puregs), inkernel);
+
+	if (!inkernel) {
 		fprintf(stderr, caught syscall %d\n, (int)R_SYSCALL(puregs));
 		errno = 0;
 		ptrace(PT_SYSCALLEMU, urkel_pid, NULL, 0);



CVS commit: src/sys/arch/usermode/usermode

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep  5 21:38:05 UTC 2011

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

Log Message:
adjust cpu_lwp_inkernel in mem access and illegal insn handlers


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/usermode/usermode/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/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.27 src/sys/arch/usermode/usermode/trap.c:1.28
--- src/sys/arch/usermode/usermode/trap.c:1.27	Mon Sep  5 18:50:34 2011
+++ src/sys/arch/usermode/usermode/trap.c	Mon Sep  5 21:38:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.27 2011/09/05 18:50:34 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.28 2011/09/05 21:38:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.27 2011/09/05 18:50:34 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.28 2011/09/05 21:38:05 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -48,6 +48,7 @@
 //#include machine/instr.h
 //#include machine/userret.h
 
+extern int cpu_lwp_inkernel;
 
 /* forwards and externals */
 void setup_signal_handlers(void);
@@ -117,6 +118,8 @@
 	void *onfault;
 	int kmem, lwp_errno, rv;
 
+	cpu_lwp_inkernel++;
+
 	recurse++;
 	if (recurse  1)
 		printf(enter trap recursion level %d\n, recurse);
@@ -229,6 +232,7 @@
 	if (recurse  1)
 		printf(leaving trap recursion level %d\n, recurse);
 	recurse--;
+	cpu_lwp_inkernel--;
 }
 
 static void
@@ -240,6 +244,7 @@
 	struct pcb *pcb;
 	vaddr_t va;
 
+	cpu_lwp_inkernel++;
 	recurse++;
 	if (recurse  1)
 		printf(enter trap recursion level %d\n, recurse);
@@ -287,4 +292,5 @@
 
 		panic(illegal instruction encountered\n);
 	}
+	cpu_lwp_inkernel--;
 }



CVS commit: src/sys

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Sep  6 01:16:44 UTC 2011

Modified Files:
src/sys/dev: auconv.c audio.c
src/sys/sys: audioio.h

Log Message:
Add AUDIO_ENCODING_AC3 encoding type.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/auconv.c
cvs rdiff -u -r1.252 -r1.253 src/sys/dev/audio.c
cvs rdiff -u -r1.33 -r1.34 src/sys/sys/audioio.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/auconv.c
diff -u src/sys/dev/auconv.c:1.22 src/sys/dev/auconv.c:1.23
--- src/sys/dev/auconv.c:1.22	Sat Jan  3 03:43:21 2009
+++ src/sys/dev/auconv.c	Tue Sep  6 01:16:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: auconv.c,v 1.22 2009/01/03 03:43:21 yamt Exp $	*/
+/*	$NetBSD: auconv.c,v 1.23 2011/09/06 01:16:44 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: auconv.c,v 1.22 2009/01/03 03:43:21 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: auconv.c,v 1.23 2011/09/06 01:16:44 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/audioio.h
@@ -205,7 +205,8 @@
 	AudioEslinear, AudioEulinear,
 	AudioEmpeg_l1_stream, AudioEmpeg_l1_packets,
 	AudioEmpeg_l1_system, AudioEmpeg_l2_stream,
-	AudioEmpeg_l2_packets, AudioEmpeg_l2_system
+	AudioEmpeg_l2_packets, AudioEmpeg_l2_system,
+	AudioEac3
 };
 #endif
 
@@ -825,7 +826,7 @@
 		/**
 		 * XXX	we need encoding-dependent check.
 		 * XXX	Is to check precision/channels meaningful for
-		 *	MPEG encodings?
+		 *	MPEG/AC3 encodings?
 		 */
 		if (formats[i].validbits != param-validbits)
 			continue;
@@ -1036,6 +1037,7 @@
 		case AUDIO_ENCODING_MPEG_L2_STREAM:
 		case AUDIO_ENCODING_MPEG_L2_PACKETS:
 		case AUDIO_ENCODING_MPEG_L2_SYSTEM:
+		case AUDIO_ENCODING_AC3:
 			ADD_ENCODING(formats[i].encoding,
  formats[i].precision, 0);
 			break;
@@ -1075,7 +1077,8 @@
 		AudioEslinear, AudioEulinear,
 		AudioEmpeg_l1_stream, AudioEmpeg_l1_packets,
 		AudioEmpeg_l1_system, AudioEmpeg_l2_stream,
-		AudioEmpeg_l2_packets, AudioEmpeg_l2_system
+		AudioEmpeg_l2_packets, AudioEmpeg_l2_system,
+		AudioEac3
 	};
 	struct audio_encoding_set *set;
 	struct audio_encoding_set *new_buf;

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.252 src/sys/dev/audio.c:1.253
--- src/sys/dev/audio.c:1.252	Sat Nov 20 18:03:49 2010
+++ src/sys/dev/audio.c	Tue Sep  6 01:16:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.252 2010/11/20 18:03:49 tsutsui Exp $	*/
+/*	$NetBSD: audio.c,v 1.253 2011/09/06 01:16:44 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: audio.c,v 1.252 2010/11/20 18:03:49 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: audio.c,v 1.253 2011/09/06 01:16:44 jmcneill Exp $);
 
 #include audio.h
 #if NAUDIO  0
@@ -1845,6 +1845,7 @@
 	case AUDIO_ENCODING_MPEG_L2_STREAM:
 	case AUDIO_ENCODING_MPEG_L2_PACKETS:
 	case AUDIO_ENCODING_MPEG_L2_SYSTEM:
+	case AUDIO_ENCODING_AC3:
 	case AUDIO_ENCODING_ADPCM: /* is this right XXX */
 	case AUDIO_ENCODING_SLINEAR_LE:
 	case AUDIO_ENCODING_SLINEAR_BE:
@@ -2972,6 +2973,7 @@
 	case AUDIO_ENCODING_MPEG_L2_STREAM:
 	case AUDIO_ENCODING_MPEG_L2_PACKETS:
 	case AUDIO_ENCODING_MPEG_L2_SYSTEM:
+	case AUDIO_ENCODING_AC3:
 		break;
 	default:
 		return EINVAL;

Index: src/sys/sys/audioio.h
diff -u src/sys/sys/audioio.h:1.33 src/sys/sys/audioio.h:1.34
--- src/sys/sys/audioio.h:1.33	Tue Sep 29 15:58:54 2009
+++ src/sys/sys/audioio.h	Tue Sep  6 01:16:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: audioio.h,v 1.33 2009/09/29 15:58:54 sborrill Exp $	*/
+/*	$NetBSD: audioio.h,v 1.34 2011/09/06 01:16:43 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -132,6 +132,7 @@
 #define AUDIO_ENCODING_MPEG_L2_STREAM	15
 #define AUDIO_ENCODING_MPEG_L2_PACKETS	16
 #define AUDIO_ENCODING_MPEG_L2_SYSTEM	17
+#define AUDIO_ENCODING_AC3		18
 
 typedef struct audio_encoding {
 	int	index;
@@ -325,6 +326,7 @@
 #define AudioEmpeg_l2_stream	mpeg_l2_stream
 #define AudioEmpeg_l2_packets	mpeg_l2_packets
 #define AudioEmpeg_l2_system	mpeg_l2_system
+#define AudioEac3		ac3
 
 #define AudioCinputs	inputs
 #define AudioCoutputs	outputs



CVS commit: src/share/man/man4

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Sep  6 01:17:48 UTC 2011

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

Log Message:
Document AUDIO_ENCODING_AC3


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/share/man/man4/audio.4

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

Modified files:

Index: src/share/man/man4/audio.4
diff -u src/share/man/man4/audio.4:1.71 src/share/man/man4/audio.4:1.72
--- src/share/man/man4/audio.4:1.71	Sun Sep 19 10:34:33 2010
+++ src/share/man/man4/audio.4	Tue Sep  6 01:17:48 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: audio.4,v 1.71 2010/09/19 10:34:33 mrg Exp $
+.\	$NetBSD: audio.4,v 1.72 2011/09/06 01:17:48 jmcneill Exp $
 .\
 .\ Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd September 29, 2009
+.Dd September 5, 2011
 .Dt AUDIO 4
 .Os
 .Sh NAME
@@ -396,6 +396,8 @@
 unsigned linear encoding with little endian byte order
 .It Dv AUDIO_ENCODING_ULINEAR_BE
 unsigned linear encoding with big endian byte order
+.It Dv AUDIO_ENCODING_AC3
+Dolby Digital AC3
 .El
 .Pp
 The



CVS commit: src/sys/compat/ossaudio

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Sep  6 01:19:34 UTC 2011

Modified Files:
src/sys/compat/ossaudio: ossaudio.c ossaudiovar.h

Log Message:
Add support for AFMT_AC3


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/compat/ossaudio/ossaudio.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/ossaudio/ossaudiovar.h

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

Modified files:

Index: src/sys/compat/ossaudio/ossaudio.c
diff -u src/sys/compat/ossaudio/ossaudio.c:1.65 src/sys/compat/ossaudio/ossaudio.c:1.66
--- src/sys/compat/ossaudio/ossaudio.c:1.65	Sat Aug 22 23:31:16 2009
+++ src/sys/compat/ossaudio/ossaudio.c	Tue Sep  6 01:19:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.65 2009/08/22 23:31:16 christos Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.66 2011/09/06 01:19:34 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ossaudio.c,v 1.65 2009/08/22 23:31:16 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ossaudio.c,v 1.66 2011/09/06 01:19:34 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -352,6 +352,12 @@
 			tmpinfo.play.encoding =
 			tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR_BE;
 			break;
+		case OSS_AFMT_AC3:
+			tmpinfo.play.precision =
+			tmpinfo.record.precision = 16;
+			tmpinfo.play.encoding =
+			tmpinfo.record.encoding = AUDIO_ENCODING_AC3;
+			break;
 		default:
 			DPRINTF((%s: SNDCTL_DSP_SETFMT bad fmt %d\n,
 			 __func__, idat));
@@ -408,6 +414,9 @@
 		case AUDIO_ENCODING_ADPCM:
 			idat = OSS_AFMT_IMA_ADPCM;
 			break;
+		case AUDIO_ENCODING_AC3:
+			idat = OSS_AFMT_AC3;
+			break;
 		default:
 			DPRINTF((%s: SOUND_PCM_READ_BITS bad encoding %d\n,
 			 __func__, tmpinfo.play.encoding));
@@ -583,6 +592,9 @@
 			case AUDIO_ENCODING_ADPCM:
 idat |= OSS_AFMT_IMA_ADPCM;
 break;
+			case AUDIO_ENCODING_AC3:
+idat |= OSS_AFMT_AC3;
+break;
 			default:
 DPRINTF((%s: SNDCTL_DSP_GETFMTS unknown %d\n,
 __func__, tmpenc.encoding));

Index: src/sys/compat/ossaudio/ossaudiovar.h
diff -u src/sys/compat/ossaudio/ossaudiovar.h:1.15 src/sys/compat/ossaudio/ossaudiovar.h:1.16
--- src/sys/compat/ossaudio/ossaudiovar.h:1.15	Mon Apr 28 20:23:45 2008
+++ src/sys/compat/ossaudio/ossaudiovar.h	Tue Sep  6 01:19:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudiovar.h,v 1.15 2008/04/28 20:23:45 martin Exp $	*/
+/*	$NetBSD: ossaudiovar.h,v 1.16 2011/09/06 01:19:34 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -99,6 +99,7 @@
 #define	OSS_AFMT_U16_LE			0x0080	/* Little endian U16 */
 #define	OSS_AFMT_U16_BE			0x0100	/* Big endian U16 */
 #define	OSS_AFMT_MPEG			0x0200	/* MPEG (2) audio */
+#define	OSS_AFMT_AC3			0x0400	/* Dolby Digital AC3 */
 
 /* Mixer defines */
 #define OSS_SOUND_MIXER_FIRST		0



CVS commit: src/lib/libossaudio

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Sep  6 01:20:18 UTC 2011

Modified Files:
src/lib/libossaudio: ossaudio.c soundcard.h

Log Message:
Add support for AFMT_AC3


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libossaudio/ossaudio.c
cvs rdiff -u -r1.18 -r1.19 src/lib/libossaudio/soundcard.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/libossaudio/ossaudio.c
diff -u src/lib/libossaudio/ossaudio.c:1.24 src/lib/libossaudio/ossaudio.c:1.25
--- src/lib/libossaudio/ossaudio.c:1.24	Mon Apr 28 20:23:01 2008
+++ src/lib/libossaudio/ossaudio.c	Tue Sep  6 01:20:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.24 2008/04/28 20:23:01 martin Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.25 2011/09/06 01:20:18 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: ossaudio.c,v 1.24 2008/04/28 20:23:01 martin Exp $);
+__RCSID($NetBSD: ossaudio.c,v 1.25 2011/09/06 01:20:18 jmcneill Exp $);
 
 /*
  * This is an OSS (Linux) sound API emulator.
@@ -185,6 +185,12 @@
 			tmpinfo.play.encoding =
 			tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR_BE;
 			break;
+		case AFMT_AC3:
+			tmpinfo.play.precision =
+			tmpinfo.record.precision = 16;
+			tmpinfo.play.encoding =
+			tmpinfo.record.encoding = AUDIO_ENCODING_AC3;
+			break;
 		default:
 			return EINVAL;
 		}
@@ -228,6 +234,9 @@
 		case AUDIO_ENCODING_ADPCM:
 			idat = AFMT_IMA_ADPCM;
 			break;
+		case AUDIO_ENCODING_AC3:
+			idat = AFMT_AC3;
+			break;
 		}
 		INTARG = idat;
 		break;
@@ -328,6 +337,9 @@
 			case AUDIO_ENCODING_ADPCM:
 idat |= AFMT_IMA_ADPCM;
 break;
+			case AUDIO_ENCODING_AC3:
+idat |= AFMT_AC3;
+break;
 			default:
 break;
 			}

Index: src/lib/libossaudio/soundcard.h
diff -u src/lib/libossaudio/soundcard.h:1.18 src/lib/libossaudio/soundcard.h:1.19
--- src/lib/libossaudio/soundcard.h:1.18	Mon Apr 28 20:23:01 2008
+++ src/lib/libossaudio/soundcard.h	Tue Sep  6 01:20:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: soundcard.h,v 1.18 2008/04/28 20:23:01 martin Exp $	*/
+/*	$NetBSD: soundcard.h,v 1.19 2011/09/06 01:20:18 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -59,6 +59,7 @@
 #define	 AFMT_U16_LE			0x0080
 #define	 AFMT_U16_BE			0x0100
 #define	 AFMT_MPEG			0x0200
+#define	 AFMT_AC3			0x0400
 #define SNDCTL_DSP_SAMPLESIZE		SNDCTL_DSP_SETFMT
 #define	SOUND_PCM_READ_BITS		_IOR ('P', 5, int)
 #define	SNDCTL_DSP_CHANNELS		_IOWR('P', 6, int)



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

2011-09-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Sep  6 01:51:44 UTC 2011

Modified Files:
src/sys/dev/pci/hdaudio: hdafg.c hdaudioreg.h

Log Message:
Add AC3 passthru support, currently untested.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/hdaudio/hdafg.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdaudioreg.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/pci/hdaudio/hdafg.c
diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.2 src/sys/dev/pci/hdaudio/hdafg.c:1.3
--- src/sys/dev/pci/hdaudio/hdafg.c:1.2	Sat Feb 12 15:15:34 2011
+++ src/sys/dev/pci/hdaudio/hdafg.c	Tue Sep  6 01:51:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.2 2011/02/12 15:15:34 jmcneill Exp $ */
+/* $NetBSD: hdafg.c,v 1.3 2011/09/06 01:51:44 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.2 2011/02/12 15:15:34 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.3 2011/09/06 01:51:44 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -3041,7 +3041,7 @@
 
 	KASSERT(mode == AUMODE_PLAY || mode == AUMODE_RECORD);
 
-	dfmt = COP_DIGITAL_CONVCTRL1_DIGEN;	/* TODO: AC3 */
+	dfmt = COP_DIGITAL_CONVCTRL1_DIGEN;
 
 	if (mode == AUMODE_PLAY)
 		fmt = hdaudio_stream_param(sc-sc_audiodev.ad_playback,
@@ -3216,7 +3216,7 @@
 
 static bool
 hdafg_probe_encoding(struct hdafg_softc *sc,
-u_int validbits, u_int precision, bool force)
+u_int validbits, u_int precision, int encoding, bool force)
 {
 	struct audio_format f;
 	int i;
@@ -3227,7 +3227,7 @@
 	memset(f, 0, sizeof(f));
 	f.driver_data = NULL;
 	f.mode = 0;
-	f.encoding = AUDIO_ENCODING_SLINEAR_LE;
+	f.encoding = encoding;
 	f.validbits = validbits;
 	f.precision = precision;
 	f.channels = 0;
@@ -3271,8 +3271,10 @@
 hdafg_configure_encodings(struct hdafg_softc *sc)
 {
 	struct hdaudio_assoc *as = sc-sc_assocs;
+	struct hdaudio_widget *w;
 	struct audio_format f;
-	int nchan, i;
+	uint32_t stream_format;
+	int nchan, i, nid;
 
 	sc-sc_pchan = sc-sc_rchan = 0;
 
@@ -3295,20 +3297,43 @@
 		hdafg_possible_rates[i]))
 			hda_print1(sc,  %uHz, hdafg_possible_rates[i]);
 
-	if (hdafg_probe_encoding(sc, 8, 16, false))
-		hda_print1(sc,  8/16);
-	if (hdafg_probe_encoding(sc, 16, 16, false))
-		hda_print1(sc,  16/16);
-	if (hdafg_probe_encoding(sc, 20, 32, false))
-		hda_print1(sc,  20/32);
-	if (hdafg_probe_encoding(sc, 24, 32, false))
-		hda_print1(sc,  24/32);
-	if (hdafg_probe_encoding(sc, 32, 32, false))
-		hda_print1(sc,  32/32);
+	stream_format = sc-sc_p.stream_format;
+	for (nid = sc-sc_startnode; nid  sc-sc_endnode; nid++) {
+		w = hdafg_widget_lookup(sc, nid);
+		if (w == NULL)
+			continue;
+		stream_format |= w-w_p.stream_format;
+	}
+	if (stream_format == 0) {
+		hda_print(sc,
+		WARNING: unsupported stream format mask 0x%X, assuming PCM\n,
+		stream_format);
+		stream_format |= COP_STREAM_FORMAT_PCM;
+	}
+
+	if (stream_format  COP_STREAM_FORMAT_PCM) {
+		int e = AUDIO_ENCODING_SLINEAR_LE;
+		if (hdafg_probe_encoding(sc, 8, 16, e, false))
+			hda_print1(sc,  PCM8);
+		if (hdafg_probe_encoding(sc, 16, 16, e, false))
+			hda_print1(sc,  PCM16);
+		if (hdafg_probe_encoding(sc, 20, 32, e, false))
+			hda_print1(sc,  PCM20);
+		if (hdafg_probe_encoding(sc, 24, 32, e, false))
+			hda_print1(sc,  PCM24);
+		if (hdafg_probe_encoding(sc, 32, 32, e, false))
+			hda_print1(sc,  PCM32);
+	}
+
+	if (stream_format  COP_STREAM_FORMAT_AC3) {
+		int e = AUDIO_ENCODING_AC3;
+		if (hdafg_probe_encoding(sc, 16, 16, e, false))
+			hda_print1(sc,  AC3);
+	}
 
 	if (sc-sc_audiodev.ad_nformats == 0) {
-		hdafg_probe_encoding(sc, 16, 16, true);
-		hda_print1(sc,  16/16*);
+		hdafg_probe_encoding(sc, 16, 16, AUDIO_ENCODING_SLINEAR_LE, true);
+		hda_print1(sc,  PCM16*);
 	}
 
 	/*

Index: src/sys/dev/pci/hdaudio/hdaudioreg.h
diff -u src/sys/dev/pci/hdaudio/hdaudioreg.h:1.5 src/sys/dev/pci/hdaudio/hdaudioreg.h:1.6
--- src/sys/dev/pci/hdaudio/hdaudioreg.h:1.5	Sat Feb 12 15:15:34 2011
+++ src/sys/dev/pci/hdaudio/hdaudioreg.h	Tue Sep  6 01:51:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudioreg.h,v 1.5 2011/02/12 15:15:34 jmcneill Exp $ */
+/* $NetBSD: hdaudioreg.h,v 1.6 2011/09/06 01:51:44 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -183,6 +183,9 @@
 #define	   COP_AWCAP_TYPE_VENDOR_DEFINED	   0xf
 #define	 COP_SUPPORTED_PCM_SIZE_RATES		 0x0a
 #define	 COP_SUPPORTED_STREAM_FORMATS		 0x0b
+#define	  COP_STREAM_FORMAT_PCM			  (1  0)
+#define	  COP_STREAM_FORMAT_FLOAT32		  (1  1)
+#define	  COP_STREAM_FORMAT_AC3			  (1  2)
 #define	 COP_PIN_CAPABILITIES			 0x0c
 #define	  COP_PINCAP_IMPEDANCE_SENSE_CAPABLE	  (1  0)
 #define	  COP_PINCAP_TRIGGER_REQD		  (1  1)