CVS commit: src/sys/arch/usermode

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 10:31:24 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: clock.c cpu.c
src/sys/arch/usermode/include: cpu.h lock.h
src/sys/arch/usermode/usermode: machdep.c pmap.c

Log Message:
- initialize cpu_info_primary early, before cpu0 attaches
- track idepth in cpu_info struct and use it in cpu_intr_p
- for debug and diagnostic kernels, abort when rebooting
- fill in __cpu_simple_lock_* stubs
- splraise(IPL_HIGH) before calling kernmain
- pmap_extract: only return phys addr if pap is not NULL


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/dev/clock.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/include/cpu.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/include/lock.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.7 -r1.8 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/dev/clock.c
diff -u src/sys/arch/usermode/dev/clock.c:1.6 src/sys/arch/usermode/dev/clock.c:1.7
--- src/sys/arch/usermode/dev/clock.c:1.6	Fri Aug 12 00:57:24 2011
+++ src/sys/arch/usermode/dev/clock.c	Sat Aug 13 10:31:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.6 2011/08/12 00:57:24 jmcneill Exp $ */
+/* $NetBSD: clock.c,v 1.7 2011/08/13 10:31:24 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.6 2011/08/12 00:57:24 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.7 2011/08/13 10:31:24 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -101,13 +101,11 @@
 	extern int usermode_x;
 	struct clockframe cf;
 
-#if notyet
-	/* XXXJDM */
-	if (usermode_x  IPL_SOFTCLOCK)
-		return;
-#endif
+	curcpu()-ci_idepth++;
 
 	hardclock(cf);
+
+	curcpu()-ci_idepth--;
 }
 
 static u_int

Index: src/sys/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.12 src/sys/arch/usermode/dev/cpu.c:1.13
--- src/sys/arch/usermode/dev/cpu.c:1.12	Fri Aug 12 12:59:13 2011
+++ src/sys/arch/usermode/dev/cpu.c	Sat Aug 13 10:31:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.12 2011/08/12 12:59:13 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.13 2011/08/13 10:31:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.12 2011/08/12 12:59:13 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.13 2011/08/13 10:31:24 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -54,7 +54,13 @@
 static int	cpu_match(device_t, cfdata_t, void *);
 static void	cpu_attach(device_t, device_t, void *);
 
-struct cpu_info cpu_info_primary;
+struct cpu_info cpu_info_primary = {
+	.ci_dev = 0,
+	.ci_self = cpu_info_primary,
+	.ci_idepth = -1,
+	.ci_curlwp = lwp0,
+};
+
 char cpu_model[48] = virtual processor;
 
 typedef struct cpu_softc {
@@ -87,9 +93,6 @@
 
 	sc-sc_dev = self;
 	sc-sc_ci = cpu_info_primary;
-	sc-sc_ci-ci_dev = 0;
-	sc-sc_ci-ci_self = cpu_info_primary;
-	sc-sc_ci-ci_curlwp = lwp0;
 
 	if (thunk_getcontext(lwp0pcb))
 		panic(getcontext failed);
@@ -126,6 +129,10 @@
 
 	printf(rebooting...\n);
 
+#if defined(DIAGNOSTIC) || defined(DEBUG)
+	thunk_abort();
+#endif
+
 	usermode_reboot();
 
 	/* NOTREACHED */
@@ -310,6 +317,8 @@
 {
 	char pbuf[9];
 
+	banner();
+
 	printf(%s%s, copyright, version);
 	format_bytes(pbuf, sizeof(pbuf), ptoa(physmem));
 	printf(total memory = %s\n, pbuf);
@@ -335,6 +344,11 @@
 bool
 cpu_intr_p(void)
 {
-	printf(cpu_intr_p\n);
-	return false;
+	int idepth;
+
+	kpreempt_disable();
+	idepth = curcpu()-ci_idepth;
+	kpreempt_enable();
+
+	return (idepth = 0);
 }

Index: src/sys/arch/usermode/include/cpu.h
diff -u src/sys/arch/usermode/include/cpu.h:1.5 src/sys/arch/usermode/include/cpu.h:1.6
--- src/sys/arch/usermode/include/cpu.h:1.5	Fri Aug 12 00:57:24 2011
+++ src/sys/arch/usermode/include/cpu.h	Sat Aug 13 10:31:24 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.5 2011/08/12 00:57:24 jmcneill Exp $ */
+/* $NetBSD: cpu.h,v 1.6 2011/08/13 10:31:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -33,7 +33,6 @@
 #include sys/cpu_data.h
 
 #include machine/intrdefs.h
-#include machine/thunk.h
 
 extern void	cpu_signotify(struct lwp *);
 extern void	cpu_need_proftick(struct lwp *);
@@ -45,6 +44,7 @@
 	struct cpu_data	ci_data;
 	u_int		ci_cpuid;
 	int		ci_want_resched;
+	int		ci_idepth;
 	volatile int	ci_mtx_count;
 	volatile int	ci_mtx_oldspl;
 	lwp_t		*ci_curlwp;
@@ -62,6 +62,7 @@
 __inline static void
 usermode_delay(unsigned int ms)
 {
+	extern int thunk_usleep(unsigned int);
 	thunk_usleep(ms);
 }
 

Index: src/sys/arch/usermode/include/lock.h
diff -u 

CVS commit: src/sys/arch/usermode

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 10:33:52 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: Makefile.usermode
src/sys/arch/usermode/dev: ld_thunkbus.c
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
try to use aio_read/aio_write instead of pread/pwrite


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/usermode/conf/Makefile.usermode
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/ld_thunkbus.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.3 -r1.4 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/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.9 src/sys/arch/usermode/conf/Makefile.usermode:1.10
--- src/sys/arch/usermode/conf/Makefile.usermode:1.9	Fri Aug 12 11:22:11 2011
+++ src/sys/arch/usermode/conf/Makefile.usermode	Sat Aug 13 10:33:52 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.9 2011/08/12 11:22:11 jmcneill Exp $
+# $NetBSD: Makefile.usermode,v 1.10 2011/08/13 10:33:52 jmcneill Exp $
 
 MACHINE_ARCH=			usermode
 USETOOLS?=			no
@@ -14,6 +14,8 @@
 ##
 ## (2) compile settings
 ##
+USERMODE_LIBS=	-lrt
+
 DEFCOPTS=	-O2 -fno-omit-frame-pointer
 CPPFLAGS+=	-Dusermode
 CPPFLAGS.init_main.c+=	-Dmain=kernmain
@@ -38,8 +40,8 @@
 ##
 SYSTEM_LD=	@${_MKSHMSG}link  ${.CURDIR:T}/${.TARGET}; \
 		${_MKSHECHO}\
-		${CC} ${COPTS} -Wl,-Map,$@.map -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o; \
-		${CC} ${COPTS} -Wl,-Map,$@.map -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
+		${CC} ${COPTS} -Wl,-Map,$@.map -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o ${USERMODE_LIBS}; \
+		${CC} ${COPTS} -Wl,-Map,$@.map -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o ${USERMODE_LIBS}
 NVFLAGS=	-n
 
 ##

Index: src/sys/arch/usermode/dev/ld_thunkbus.c
diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.1 src/sys/arch/usermode/dev/ld_thunkbus.c:1.2
--- src/sys/arch/usermode/dev/ld_thunkbus.c:1.1	Fri Aug 12 12:59:13 2011
+++ src/sys/arch/usermode/dev/ld_thunkbus.c	Sat Aug 13 10:33:52 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.1 2011/08/12 12:59:13 jmcneill Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.2 2011/08/13 10:33:52 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.1 2011/08/12 12:59:13 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.2 2011/08/13 10:33:52 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -35,6 +35,7 @@
 #include sys/device.h
 #include sys/buf.h
 #include sys/disk.h
+#include sys/kmem.h
 
 #include dev/ldvar.h
 
@@ -48,6 +49,8 @@
 static int	ld_thunkbus_lddump(struct ld_softc *, void *, int, int);
 static int	ld_thunkbus_ldflush(struct ld_softc *, int);
 
+static void	ld_thunkbus_complete(int, siginfo_t *, void *);
+
 struct ld_thunkbus_softc {
 	struct ld_softc	sc_ld;
 
@@ -55,6 +58,12 @@
 	struct stat	sc_st;
 };
 
+struct ld_thunkbus_transfer {
+	struct ld_thunkbus_softc *tt_sc;
+	struct aiocb	tt_aio;
+	struct buf	*tt_bp;
+};
+
 CFATTACH_DECL_NEW(ld_thunkbus, sizeof(struct ld_thunkbus_softc),
 ld_thunkbus_match, ld_thunkbus_attach, NULL, NULL);
 
@@ -78,6 +87,7 @@
 	struct ld_softc *ld = sc-sc_ld;
 	struct thunkbus_attach_args *taa = opaque;
 	const char *path = taa-u.diskimage.path;
+	struct sigaction sa;
 
 	ld-sc_dv = self;
 
@@ -96,34 +106,90 @@
 
 	ld-sc_flags = LDF_ENABLED;
 	ld-sc_maxxfer = sc-sc_st.st_blksize;
-	ld-sc_secsize = 1;
-	ld-sc_secperunit = sc-sc_st.st_size;
+	ld-sc_secsize = 512;
+	ld-sc_secperunit = sc-sc_st.st_size / 512;
 	ld-sc_maxqueuecnt = 1;
 	ld-sc_start = ld_thunkbus_ldstart;
 	ld-sc_dump = ld_thunkbus_lddump;
 	ld-sc_flush = ld_thunkbus_ldflush;
 
+	sigemptyset(sa.sa_mask);
+	sa.sa_flags = SA_RESTART|SA_SIGINFO;
+	sa.sa_sigaction = ld_thunkbus_complete;
+	if (thunk_sigaction(SIGIO, sa, NULL) == -1)
+		panic(couldn't register SIGIO handler: %d, errno);
+
 	ldattach(ld);
 }
 
+static void
+ld_thunkbus_complete(int sig, siginfo_t *info, void *ctx)
+{
+	struct ld_thunkbus_transfer *tt;
+	struct ld_thunkbus_softc *sc;
+	struct buf *bp;
+
+	curcpu()-ci_idepth++;
+
+	if (info-si_signo == SIGIO) {
+		tt = info-si_value.sival_ptr;
+		sc = tt-tt_sc;
+		bp = tt-tt_bp;
+		if (thunk_aio_error(tt-tt_aio) == 0 
+		thunk_aio_return(tt-tt_aio) != -1) {
+			bp-b_resid = 0;
+		} else {
+			bp-b_error = errno;
+			bp-b_resid = bp-b_bcount;
+		}
+
+		kmem_free(tt, sizeof(*tt));
+
+		if (bp-b_error)
+			printf(errpr!\n);
+
+		lddone(sc-sc_ld, bp);
+	}
+
+	curcpu()-ci_idepth--;
+}
+
 static int
 ld_thunkbus_ldstart(struct ld_softc *ld, struct buf *bp)
 {
 	struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld;
-	ssize_t len;
+	struct ld_thunkbus_transfer *tt;
+	int error;
+
+	tt 

CVS commit: src/sys/fs/union

2011-08-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 13 10:48:14 UTC 2011

Modified Files:
src/sys/fs/union: union_subr.c

Log Message:
Use mutexes to protect the hash lists instead of tsleep/wakeup.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/fs/union/union_subr.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/fs/union/union_subr.c
diff -u src/sys/fs/union/union_subr.c:1.48 src/sys/fs/union/union_subr.c:1.49
--- src/sys/fs/union/union_subr.c:1.48	Fri Aug 12 17:41:17 2011
+++ src/sys/fs/union/union_subr.c	Sat Aug 13 10:48:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_subr.c,v 1.48 2011/08/12 17:41:17 hannken Exp $	*/
+/*	$NetBSD: union_subr.c,v 1.49 2011/08/13 10:48:14 hannken Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -72,7 +72,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: union_subr.c,v 1.48 2011/08/12 17:41:17 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: union_subr.c,v 1.49 2011/08/13 10:48:14 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -103,10 +103,8 @@
 	(unsigned long) (u)) + ((unsigned long) l))  8)  (NHASH-1))
 
 static LIST_HEAD(unhead, union_node) unhead[NHASH];
-static int unvplock[NHASH];
+static kmutex_t unheadlock[NHASH];
 
-static int union_list_lock(int);
-static void union_list_unlock(int);
 void union_updatevp(struct union_node *, struct vnode *, struct vnode *);
 static int union_relookup(struct union_mount *, struct vnode *,
 			   struct vnode **, struct componentname *,
@@ -121,9 +119,10 @@
 {
 	int i;
 
-	for (i = 0; i  NHASH; i++)
+	for (i = 0; i  NHASH; i++) {
 		LIST_INIT(unhead[i]);
-	memset(unvplock, 0, sizeof(unvplock));
+		mutex_init(unheadlock[i], MUTEX_DEFAULT, IPL_NONE);
+	}
 }
 
 /*
@@ -132,38 +131,15 @@
 void
 union_done(void)
 {
+	int i;
+
+	for (i = 0; i  NHASH; i++)
+		mutex_destroy(unheadlock[i]);
 
 	/* Make sure to unset the readdir hook. */
 	vn_union_readdir_hook = NULL;
 }
 
-static int
-union_list_lock(int ix)
-{
-
-	if (unvplock[ix]  UN_LOCKED) {
-		unvplock[ix] |= UN_WANTED;
-		(void) tsleep(unvplock[ix], PINOD, unionlk, 0);
-		return (1);
-	}
-
-	unvplock[ix] |= UN_LOCKED;
-
-	return (0);
-}
-
-static void
-union_list_unlock(int ix)
-{
-
-	unvplock[ix] = ~UN_LOCKED;
-
-	if (unvplock[ix]  UN_WANTED) {
-		unvplock[ix] = ~UN_WANTED;
-		wakeup(unvplock[ix]);
-	}
-}
-
 void
 union_updatevp(struct union_node *un, struct vnode *uppervp,
 	struct vnode *lowervp)
@@ -186,11 +162,9 @@
 	}
 
 	if (lhash != uhash)
-		while (union_list_lock(lhash))
-			continue;
+		mutex_enter(unheadlock[lhash]);
 
-	while (union_list_lock(uhash))
-		continue;
+	mutex_enter(unheadlock[uhash]);
 
 	if (ohash != nhash || !docache) {
 		if (un-un_flags  UN_CACHED) {
@@ -200,7 +174,7 @@
 	}
 
 	if (ohash != nhash)
-		union_list_unlock(ohash);
+		mutex_exit(unheadlock[ohash]);
 
 	if (un-un_lowervp != lowervp) {
 		if (un-un_lowervp) {
@@ -237,7 +211,7 @@
 		un-un_flags |= UN_CACHED;
 	}
 
-	union_list_unlock(nhash);
+	mutex_exit(unheadlock[nhash]);
 }
 
 void
@@ -394,8 +368,7 @@
 			break;
 		}
 
-		while (union_list_lock(hash))
-			continue;
+		mutex_enter(unheadlock[hash]);
 
 		for (un = unhead[hash].lh_first; un != 0;
 	un = un-un_cache.le_next) {
@@ -407,14 +380,14 @@
 vp = UNIONTOV(un);
 mutex_enter(vp-v_interlock);
 if (vget(vp, 0)) {
-	union_list_unlock(hash);
+	mutex_exit(unheadlock[hash]);
 	goto loop;
 }
 break;
 			}
 		}
 
-		union_list_unlock(hash);
+		mutex_exit(unheadlock[hash]);
 
 		if (un)
 			break;
@@ -528,8 +501,7 @@
 	}
 
 	if (docache) {
-		while (union_list_lock(hash))
-			continue;
+		mutex_enter(unheadlock[hash]);
 		LIST_FOREACH(un1, unhead[hash], un_cache) {
 			if (un1-un_lowervp == lowervp 
 			un1-un_uppervp == uppervp 
@@ -538,7 +510,7 @@
  * Another thread beat us, push back freshly
  * allocated vnode and retry.
  */
-union_list_unlock(hash);
+mutex_exit(unheadlock[hash]);
 ungetnewvnode(*vpp);
 goto loop;
 			}
@@ -603,7 +575,7 @@
 
 out:
 	if (docache)
-		union_list_unlock(hash);
+		mutex_exit(unheadlock[hash]);
 
 	return (error);
 }
@@ -616,13 +588,12 @@
 
 	hash = UNION_HASH(un-un_uppervp, un-un_lowervp);
 
-	while (union_list_lock(hash))
-		continue;
+	mutex_enter(unheadlock[hash]);
 	if (un-un_flags  UN_CACHED) {
 		un-un_flags = ~UN_CACHED;
 		LIST_REMOVE(un, un_cache);
 	}
-	union_list_unlock(hash);
+	mutex_exit(unheadlock[hash]);
 
 	if (un-un_pvp != NULLVP)
 		vrele(un-un_pvp);
@@ -1060,13 +1031,12 @@
 
 	hash = UNION_HASH(un-un_uppervp, un-un_lowervp);
 
-	while (union_list_lock(hash))
-		continue;
+	mutex_enter(unheadlock[hash]);
 	if (un-un_flags  UN_CACHED) {
 		un-un_flags = ~UN_CACHED;
 		LIST_REMOVE(un, un_cache);
 	}
-	union_list_unlock(hash);
+	mutex_exit(unheadlock[hash]);
 
 	if (un-un_flags  UN_ULOCK) {
 		un-un_flags = ~UN_ULOCK;



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

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 10:58:32 UTC 2011

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

Log Message:
call lddone from a softint instead of the signal handler, now reading from
disk works:

ld0 at mainbus0: /home/jmcneill/test.fs (33554432)
ld0: 32768 KB, 65 cyl, 16 head, 63 sec, 512 bytes/sect x 65536 sectors
boot device: ld0
root on ld0a dumps on ld0b
root file system type: ffs
WARNING: no TOD clock present
WARNING: using filesystem time
WARNING: CHECK AND RESET THE DATE!


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/sys/arch/usermode/dev/ld_thunkbus.c:1.3
--- src/sys/arch/usermode/dev/ld_thunkbus.c:1.2	Sat Aug 13 10:33:52 2011
+++ src/sys/arch/usermode/dev/ld_thunkbus.c	Sat Aug 13 10:58:32 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.2 2011/08/13 10:33:52 jmcneill Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.3 2011/08/13 10:58:32 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.2 2011/08/13 10:33:52 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.3 2011/08/13 10:58:32 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -49,13 +49,19 @@
 static int	ld_thunkbus_lddump(struct ld_softc *, void *, int, int);
 static int	ld_thunkbus_ldflush(struct ld_softc *, int);
 
-static void	ld_thunkbus_complete(int, siginfo_t *, void *);
+static void	ld_thunkbus_sig(int, siginfo_t *, void *);
+static void	ld_thunkbus_complete(void *);
+
+struct ld_thunkbus_transfer;
 
 struct ld_thunkbus_softc {
 	struct ld_softc	sc_ld;
 
 	int		sc_fd;
 	struct stat	sc_st;
+	void		*sc_ih;
+
+	struct ld_thunkbus_transfer *sc_curtt;
 };
 
 struct ld_thunkbus_transfer {
@@ -113,9 +119,12 @@
 	ld-sc_dump = ld_thunkbus_lddump;
 	ld-sc_flush = ld_thunkbus_ldflush;
 
+	sc-sc_ih = softint_establish(SOFTINT_BIO,
+	ld_thunkbus_complete, sc);
+
 	sigemptyset(sa.sa_mask);
 	sa.sa_flags = SA_RESTART|SA_SIGINFO;
-	sa.sa_sigaction = ld_thunkbus_complete;
+	sa.sa_sigaction = ld_thunkbus_sig;
 	if (thunk_sigaction(SIGIO, sa, NULL) == -1)
 		panic(couldn't register SIGIO handler: %d, errno);
 
@@ -123,35 +132,44 @@
 }
 
 static void
-ld_thunkbus_complete(int sig, siginfo_t *info, void *ctx)
+ld_thunkbus_sig(int sig, siginfo_t *info, void *ctx)
 {
 	struct ld_thunkbus_transfer *tt;
 	struct ld_thunkbus_softc *sc;
-	struct buf *bp;
 
 	curcpu()-ci_idepth++;
 
 	if (info-si_signo == SIGIO) {
 		tt = info-si_value.sival_ptr;
 		sc = tt-tt_sc;
-		bp = tt-tt_bp;
-		if (thunk_aio_error(tt-tt_aio) == 0 
-		thunk_aio_return(tt-tt_aio) != -1) {
-			bp-b_resid = 0;
-		} else {
-			bp-b_error = errno;
-			bp-b_resid = bp-b_bcount;
-		}
-
-		kmem_free(tt, sizeof(*tt));
+		sc-sc_curtt = tt;
+		softint_schedule(sc-sc_ih);
+	}
 
-		if (bp-b_error)
-			printf(errpr!\n);
+	curcpu()-ci_idepth--;
+}
 
-		lddone(sc-sc_ld, bp);
+static void
+ld_thunkbus_complete(void *arg)
+{
+	struct ld_thunkbus_softc *sc = arg;
+	struct ld_thunkbus_transfer *tt = sc-sc_curtt;
+	struct buf *bp = tt-tt_bp;
+
+	if (thunk_aio_error(tt-tt_aio) == 0 
+	thunk_aio_return(tt-tt_aio) != -1) {
+		bp-b_resid = 0;
+	} else {
+		bp-b_error = errno;
+		bp-b_resid = bp-b_bcount;
 	}
 
-	curcpu()-ci_idepth--;
+	kmem_free(tt, sizeof(*tt));
+
+	if (bp-b_error)
+		printf(errpr!\n);
+
+	lddone(sc-sc_ld, bp);
 }
 
 static int



CVS commit: src/lib/librt

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 11:10:31 UTC 2011

Modified Files:
src/lib/librt: aio_return.3

Log Message:
aio_return returns ssize_t not int


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/librt/aio_return.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/librt/aio_return.3
diff -u src/lib/librt/aio_return.3:1.4 src/lib/librt/aio_return.3:1.5
--- src/lib/librt/aio_return.3:1.4	Mon May 17 19:22:31 2010
+++ src/lib/librt/aio_return.3	Sat Aug 13 11:10:31 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: aio_return.3,v 1.4 2010/05/17 19:22:31 jruoho Exp $
+.\ $NetBSD: aio_return.3,v 1.5 2011/08/13 11:10:31 jmcneill Exp $
 .\
 .\ Copyright (c) 1999 Softweyr LLC.
 .\ All rights reserved.
@@ -26,7 +26,7 @@
 .\
 .\ $FreeBSD: /repoman/r/ncvs/src/lib/libc/sys/aio_return.2,v 1.19 2006/10/07 10:49:20 trhodes Exp $
 .\
-.Dd May 17, 2010
+.Dd August 13, 2011
 .Dt AIO_RETURN 3
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Lb librt
 .Sh SYNOPSIS
 .In aio.h
-.Ft int
+.Ft ssize_t
 .Fn aio_return struct aiocb *aiocbp
 .Sh DESCRIPTION
 The



CVS commit: src/sys/arch/xen

2011-08-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Aug 13 11:41:57 UTC 2011

Modified Files:
src/sys/arch/xen/include: xenpmap.h
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
remove unnecessary locking overhead for UP


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/include/xenpmap.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/xen/x86/x86_xpmap.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/include/xenpmap.h
diff -u src/sys/arch/xen/include/xenpmap.h:1.28 src/sys/arch/xen/include/xenpmap.h:1.29
--- src/sys/arch/xen/include/xenpmap.h:1.28	Wed Aug 10 09:50:37 2011
+++ src/sys/arch/xen/include/xenpmap.h	Sat Aug 13 11:41:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenpmap.h,v 1.28 2011/08/10 09:50:37 cherry Exp $	*/
+/*	$NetBSD: xenpmap.h,v 1.29 2011/08/13 11:41:57 cherry Exp $	*/
 
 /*
  *
@@ -36,8 +36,16 @@
 
 #define	INVALID_P2M_ENTRY	(~0UL)
 
+#ifdef MULTIPROCESSOR
 void xpq_queue_lock(void);
 void xpq_queue_unlock(void);
+bool xpq_queue_locked(void);
+#else /* MULTIPROCESSOR */
+#define xpq_queue_lock() do {} while(0) /* nothing */
+#define xpq_queue_unlock() do {} while(0) /* nothing */
+#define xpq_queue_locked() (true) /* Always true for UP */
+#endif /* MULTIPROCESSOR */
+
 void xpq_queue_machphys_update(paddr_t, paddr_t);
 void xpq_queue_invlpg(vaddr_t);
 void xpq_queue_pte_update(paddr_t, pt_entry_t);

Index: src/sys/arch/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.29 src/sys/arch/xen/x86/x86_xpmap.c:1.30
--- src/sys/arch/xen/x86/x86_xpmap.c:1.29	Wed Aug 10 09:50:37 2011
+++ src/sys/arch/xen/x86/x86_xpmap.c	Sat Aug 13 11:41:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.29 2011/08/10 09:50:37 cherry Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.30 2011/08/13 11:41:57 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Mathieu Ropert m...@adviseo.fr
@@ -69,7 +69,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: x86_xpmap.c,v 1.29 2011/08/10 09:50:37 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: x86_xpmap.c,v 1.30 2011/08/13 11:41:57 cherry Exp $);
 
 #include opt_xen.h
 #include opt_ddb.h
@@ -166,6 +166,8 @@
 #define XPQUEUE_SIZE 2048
 static mmu_update_t xpq_queue[XPQUEUE_SIZE];
 static int xpq_idx = 0;
+
+#ifdef MULTIPROCESSOR
 static struct simplelock xpq_lock = SIMPLELOCK_INITIALIZER;
 
 void
@@ -180,13 +182,20 @@
 	simple_unlock(xpq_lock);
 }
 
+bool
+xpq_queue_locked(void)
+{
+	return xpq_queue_locked();
+}
+#endif /* MULTIPROCESSOR */
+
 /* Must be called with xpq_lock held */
 void
 xpq_flush_queue(void)
 {
 	int i, ok, ret;
 
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	XENPRINTK2((flush queue %p entries %d\n, xpq_queue, xpq_idx));
 	for (i = 0; i  xpq_idx; i++)
 		XENPRINTK2((%d: 0x%08 PRIx64  0x%08 PRIx64 \n, i,
@@ -210,7 +219,7 @@
 xpq_increment_idx(void)
 {
 
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	xpq_idx++;
 	if (__predict_false(xpq_idx == XPQUEUE_SIZE))
 		xpq_flush_queue();
@@ -221,7 +230,7 @@
 {
 	XENPRINTK2((xpq_queue_machphys_update ma=0x% PRIx64  pa=0x% PRIx64
 	\n, (int64_t)ma, (int64_t)pa));
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	xpq_queue[xpq_idx].ptr = ma | MMU_MACHPHYS_UPDATE;
 	xpq_queue[xpq_idx].val = (pa - XPMAP_OFFSET)  PAGE_SHIFT;
 	xpq_increment_idx();
@@ -235,7 +244,7 @@
 {
 
 	KASSERT((ptr  3) == 0);
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	xpq_queue[xpq_idx].ptr = (paddr_t)ptr | MMU_NORMAL_PT_UPDATE;
 	xpq_queue[xpq_idx].val = val;
 	xpq_increment_idx();
@@ -248,7 +257,7 @@
 xpq_queue_pt_switch(paddr_t pa)
 {
 	struct mmuext_op op;
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	xpq_flush_queue();
 
 	XENPRINTK2((xpq_queue_pt_switch: 0x% PRIx64  0x% PRIx64 \n,
@@ -264,7 +273,7 @@
 {
 	struct mmuext_op op;
 
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	xpq_flush_queue();
 
 	XENPRINTK2((xpq_queue_pin_l%d_table: %# PRIxPADDR \n,
@@ -282,7 +291,7 @@
 {
 	struct mmuext_op op;
 
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	xpq_flush_queue();
 
 	XENPRINTK2((xpq_queue_unpin_table: %# PRIxPADDR \n, pa));
@@ -297,7 +306,7 @@
 {
 	struct mmuext_op op;
 
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	xpq_flush_queue();
 
 	XENPRINTK2((xpq_queue_set_ldt\n));
@@ -314,7 +323,7 @@
 {
 	struct mmuext_op op;
 
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	xpq_flush_queue();
 
 	XENPRINTK2((xpq_queue_tlb_flush\n));
@@ -345,7 +354,7 @@
 xpq_queue_invlpg(vaddr_t va)
 {
 	struct mmuext_op op;
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 	xpq_flush_queue();
 
 	XENPRINTK2((xpq_queue_invlpg %# PRIxVADDR \n, va));
@@ -360,7 +369,7 @@
 {
 	mmuext_op_t op;
 
-	KASSERT(simple_lock_held(xpq_lock));
+	KASSERT(xpq_queue_locked());
 
 	/* Flush 

CVS commit: src/sys/arch/usermode

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 12:06:24 UTC 2011

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

Log Message:
- replace the gettimeofday timecounter with one based on CLOCK_MONOTONIC
- use gettimeofday for TODR clock


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/dev/clock.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.4 -r1.5 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/dev/clock.c
diff -u src/sys/arch/usermode/dev/clock.c:1.7 src/sys/arch/usermode/dev/clock.c:1.8
--- src/sys/arch/usermode/dev/clock.c:1.7	Sat Aug 13 10:31:24 2011
+++ src/sys/arch/usermode/dev/clock.c	Sat Aug 13 12:06:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.7 2011/08/13 10:31:24 jmcneill Exp $ */
+/* $NetBSD: clock.c,v 1.8 2011/08/13 12:06:22 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.7 2011/08/13 10:31:24 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.8 2011/08/13 12:06:22 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -39,23 +39,28 @@
 #include machine/mainbus.h
 #include machine/thunk.h
 
+#include dev/clock_subr.h
+
 static int	clock_match(device_t, cfdata_t, void *);
 static void	clock_attach(device_t, device_t, void *);
 
 static void 	clock_intr(int);
 static u_int	clock_getcounter(struct timecounter *);
 
+static int	clock_todr_gettime(struct todr_chip_handle *, struct timeval *);
+
 typedef struct clock_softc {
-	device_t	sc_dev;
+	device_t		sc_dev;
+	struct todr_chip_handle	sc_todr;
 } clock_softc_t;
 
 static struct timecounter clock_timecounter = {
 	clock_getcounter,	/* get_timecount */
 	0,			/* no poll_pps */
 	~0u,			/* counter_mask */
-	100,		/* frequency */
-	gettimeofday,		/* name */
-	100,			/* quality */
+	0,			/* frequency */
+	CLOCK_MONOTONIC,	/* name */
+	-100,			/* quality */
 	NULL,			/* prev */
 	NULL,			/* next */
 };
@@ -79,12 +84,16 @@
 {
 	clock_softc_t *sc = device_private(self);
 	struct itimerval itimer;
+	struct timespec res;
 
 	aprint_naive(\n);
 	aprint_normal(\n);
 
 	sc-sc_dev = self;
 
+	sc-sc_todr.todr_gettime = clock_todr_gettime;
+	todr_attach(sc-sc_todr);
+
 	(void)signal(SIGALRM, clock_intr);
 
 	itimer.it_interval.tv_sec = 0;
@@ -92,6 +101,10 @@
 	itimer.it_value = itimer.it_interval;
 	thunk_setitimer(ITIMER_REAL, itimer, NULL);
 
+	if (thunk_clock_getres(CLOCK_MONOTONIC, res) == 0  res.tv_nsec  0) {
+		clock_timecounter.tc_quality = 1000;
+		clock_timecounter.tc_frequency = 10 / res.tv_nsec;
+	}
 	tc_init(clock_timecounter);
 }
 
@@ -111,8 +124,14 @@
 static u_int
 clock_getcounter(struct timecounter *tc)
 {
-	struct timeval tv;
+	struct timespec ts;
 
-	thunk_gettimeofday(tv, NULL);
-	return tv.tv_sec * 100 + tv.tv_usec;
+	thunk_clock_gettime(CLOCK_MONOTONIC, ts);
+	return ts.tv_nsec;
+}
+
+static int
+clock_todr_gettime(struct todr_chip_handle *tch, struct timeval *tv)
+{
+	return thunk_gettimeofday(tv,  NULL);
 }

Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.4 src/sys/arch/usermode/include/thunk.h:1.5
--- src/sys/arch/usermode/include/thunk.h:1.4	Sat Aug 13 10:33:52 2011
+++ src/sys/arch/usermode/include/thunk.h	Sat Aug 13 12:06:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.4 2011/08/13 10:33:52 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.5 2011/08/13 12:06:23 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -39,6 +39,8 @@
 
 int	thunk_setitimer(int, const struct itimerval *, struct itimerval *);
 int	thunk_gettimeofday(struct timeval *, void *);
+int	thunk_clock_gettime(clockid_t, struct timespec *);
+int	thunk_clock_getres(clockid_t, struct timespec *);
 int	thunk_usleep(useconds_t);
 
 void	thunk_exit(int);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.4 src/sys/arch/usermode/usermode/thunk.c:1.5
--- src/sys/arch/usermode/usermode/thunk.c:1.4	Sat Aug 13 10:33:52 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Sat Aug 13 12:06:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.4 2011/08/13 10:33:52 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.5 2011/08/13 12:06:23 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: thunk.c,v 1.4 2011/08/13 10:33:52 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.5 2011/08/13 12:06:23 jmcneill Exp $);
 
 #include machine/thunk.h
 
@@ -55,6 +55,18 @@
 }
 
 int
+thunk_clock_gettime(clockid_t clock_id, struct timespec *tp)
+{
+	return clock_gettime(clock_id, tp);
+}
+
+int

CVS commit: src/sys/arch

2011-08-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Aug 13 12:09:39 UTC 2011

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

Log Message:
Add locking around ops to the hypervisor MMU queue.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amd64/include/pmap.h
cvs rdiff -u -r1.708 -r1.709 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/i386/include/pmap.h
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/xen/x86/x86_xpmap.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/xen/x86/xen_pmap.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/x86/xenfunc.c

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

Modified files:

Index: src/sys/arch/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.24 src/sys/arch/amd64/include/pmap.h:1.25
--- src/sys/arch/amd64/include/pmap.h:1.24	Tue Feb  1 20:09:08 2011
+++ src/sys/arch/amd64/include/pmap.h	Sat Aug 13 12:09:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.24 2011/02/01 20:09:08 chuck Exp $	*/
+/*	$NetBSD: pmap.h,v 1.25 2011/08/13 12:09:38 cherry Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -276,7 +276,9 @@
 pmap_pte_set(pt_entry_t *pte, pt_entry_t npte)
 {
 	int s = splvm();
+	xpq_queue_lock();
 	xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
+	xpq_queue_unlock();
 	splx(s);
 }
 
@@ -284,12 +286,15 @@
 pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n)
 {
 	int s = splvm();
+
+	xpq_queue_lock();
 	pt_entry_t opte = *ptep;
 
 	if (opte == o) {
 		xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n);
 		xpq_flush_queue();
 	}
+	xpq_queue_unlock();
 	splx(s);
 	return opte;
 }
@@ -298,9 +303,11 @@
 pmap_pte_testset(volatile pt_entry_t *pte, pt_entry_t npte)
 {
 	int s = splvm();
+	xpq_queue_lock();
 	pt_entry_t opte = *pte;
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), npte);
 	xpq_flush_queue();
+	xpq_queue_unlock();
 	splx(s);
 	return opte;
 }
@@ -309,8 +316,10 @@
 pmap_pte_setbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {
 	int s = splvm();
+	xpq_queue_lock();
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), (*pte) | bits);
 	xpq_flush_queue();
+	xpq_queue_unlock();
 	splx(s);
 }
 
@@ -318,9 +327,11 @@
 pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {	
 	int s = splvm();
+	xpq_queue_lock();
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
 	(*pte)  ~bits);
 	xpq_flush_queue();
+	xpq_queue_unlock();
 	splx(s);
 }
 
@@ -328,7 +339,9 @@
 pmap_pte_flush(void)
 {
 	int s = splvm();
+	xpq_queue_lock();
 	xpq_flush_queue();
+	xpq_queue_unlock();
 	splx(s);
 }
 #endif

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.708 src/sys/arch/i386/i386/machdep.c:1.709
--- src/sys/arch/i386/i386/machdep.c:1.708	Thu Aug 11 18:11:17 2011
+++ src/sys/arch/i386/i386/machdep.c	Sat Aug 13 12:09:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.708 2011/08/11 18:11:17 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.709 2011/08/13 12:09:38 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.708 2011/08/11 18:11:17 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.709 2011/08/13 12:09:38 cherry Exp $);
 
 #include opt_beep.h
 #include opt_compat_ibcs2.h
@@ -1194,8 +1194,10 @@
 		npte = pmap_pa2pte((vaddr_t)gdt - KERNBASE);
 		npte |= PG_RO | pg_nx | PG_V;
 
+		xpq_queue_lock();
 		xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
 		xpq_flush_queue();
+		xpq_queue_unlock();
 	}
 
 	XENPRINTK((loading gdt %lx, %d entries\n, frames[0]  PAGE_SHIFT,

Index: src/sys/arch/i386/include/pmap.h
diff -u src/sys/arch/i386/include/pmap.h:1.109 src/sys/arch/i386/include/pmap.h:1.110
--- src/sys/arch/i386/include/pmap.h:1.109	Tue Feb  1 20:09:08 2011
+++ src/sys/arch/i386/include/pmap.h	Sat Aug 13 12:09:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.109 2011/02/01 20:09:08 chuck Exp $	*/
+/*	$NetBSD: pmap.h,v 1.110 2011/08/13 12:09:38 cherry Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -369,7 +369,9 @@
 pmap_pte_set(pt_entry_t *pte, pt_entry_t npte)
 {
 	int s = splvm();
+	xpq_queue_lock();
 	xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
+	xpq_queue_unlock();
 	splx(s);
 }
 
@@ -377,12 +379,14 @@
 pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n)
 {
 	int s = splvm();
+	xpq_queue_lock();
 	pt_entry_t opte = *ptep;
 
 	if (opte == o) {
 		xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n);
 		xpq_flush_queue();
 	}
+	xpq_queue_unlock();
 	splx(s);
 	return opte;
 }
@@ -391,10 

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

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 12:18:54 UTC 2011

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

Log Message:
no need to print copyright/version/memory info, just call banner()


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.13 src/sys/arch/usermode/dev/cpu.c:1.14
--- src/sys/arch/usermode/dev/cpu.c:1.13	Sat Aug 13 10:31:24 2011
+++ src/sys/arch/usermode/dev/cpu.c	Sat Aug 13 12:18:54 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.13 2011/08/13 10:31:24 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.14 2011/08/13 12:18:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.13 2011/08/13 10:31:24 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.14 2011/08/13 12:18:54 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -315,16 +315,7 @@
 void
 cpu_startup(void)
 {
-	char pbuf[9];
-
 	banner();
-
-	printf(%s%s, copyright, version);
-	format_bytes(pbuf, sizeof(pbuf), ptoa(physmem));
-	printf(total memory = %s\n, pbuf);
-
-	format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
-	printf(avail memory = %s\n, pbuf);
 }
 
 void



CVS commit: src/sys/arch

2011-08-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Aug 13 12:37:30 UTC 2011

Modified Files:
src/sys/arch/x86/include: cpuvar.h
src/sys/arch/xen/x86: cpu.c
src/sys/arch/xen/xen: hypervisor.c

Log Message:
MP probing and startup code


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/include/cpuvar.h
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/xen/xen/hypervisor.c

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

Modified files:

Index: src/sys/arch/x86/include/cpuvar.h
diff -u src/sys/arch/x86/include/cpuvar.h:1.44 src/sys/arch/x86/include/cpuvar.h:1.45
--- src/sys/arch/x86/include/cpuvar.h:1.44	Sun Jun 12 03:35:50 2011
+++ src/sys/arch/x86/include/cpuvar.h	Sat Aug 13 12:37:30 2011
@@ -1,4 +1,4 @@
-/* 	$NetBSD: cpuvar.h,v 1.44 2011/06/12 03:35:50 rmind Exp $ */
+/* 	$NetBSD: cpuvar.h,v 1.45 2011/08/13 12:37:30 cherry Exp $ */
 
 /*-
  * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -67,7 +67,11 @@
 #define	_X86_CPUVAR_H_
 
 struct cpu_functions {
+#ifndef XEN
 	int (*start)(struct cpu_info *, paddr_t);
+#else /* XEN */
+   	int (*start)(struct cpu_info *, vaddr_t);
+#endif /* XEN */
 	int (*stop)(struct cpu_info *);
 	void (*cleanup)(struct cpu_info *);
 };

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.61 src/sys/arch/xen/x86/cpu.c:1.62
--- src/sys/arch/xen/x86/cpu.c:1.61	Thu Aug 11 18:11:17 2011
+++ src/sys/arch/xen/x86/cpu.c	Sat Aug 13 12:37:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.61 2011/08/11 18:11:17 cherry Exp $	*/
+/*	$NetBSD: cpu.c,v 1.62 2011/08/13 12:37:30 cherry Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.61 2011/08/11 18:11:17 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.62 2011/08/13 12:37:30 cherry Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -85,6 +85,7 @@
 #include sys/cpu.h
 #include sys/atomic.h
 #include sys/reboot.h
+#include sys/idle.h
 
 #include uvm/uvm.h
 
@@ -100,6 +101,14 @@
 #include machine/mtrr.h
 #include machine/pio.h
 
+#ifdef i386
+#include machine/npx.h
+#else
+#include machine/fpu.h
+#endif
+
+#include xen/xen.h
+#include xen/xen3-public/vcpu.h
 #include xen/vcpuvar.h
 
 #if NLAPIC  0
@@ -131,7 +140,7 @@
 	bool sc_wasonline;
 };
 
-int mp_cpu_start(struct cpu_info *, paddr_t);
+int mp_cpu_start(struct cpu_info *, vaddr_t);
 void mp_cpu_start_cleanup(struct cpu_info *);
 const struct cpu_functions mp_cpu_funcs = { mp_cpu_start, NULL,
   mp_cpu_start_cleanup };
@@ -171,8 +180,6 @@
 struct cpu_info *cpu_info_list = cpu_info_primary;
 struct cpu_info *phycpu_info_list = phycpu_info_primary;
 
-static void	cpu_set_tss_gates(struct cpu_info *ci);
-
 uint32_t cpus_attached = 1;
 uint32_t cpus_running = 1;
 
@@ -194,21 +201,6 @@
 void	cpu_hatch(void *);
 static void	cpu_boot_secondary(struct cpu_info *ci);
 static void	cpu_start_secondary(struct cpu_info *ci);
-static void	cpu_copy_trampoline(void);
-
-/*
- * Runs once per boot once multiprocessor goo has been detected and
- * the local APIC on the boot processor has been mapped.
- *
- * Called from lapic_boot_init() (from mpbios_scan()).
- */
-void
-cpu_init_first(void)
-{
-
-	cpu_info_primary.ci_cpuid = lapic_cpu_number();
-	cpu_copy_trampoline();
-}
 #endif	/* MULTIPROCESSOR */
 
 static int
@@ -317,9 +309,23 @@
 vcpu_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct vcpu_attach_args *vcaa = aux;
+	struct vcpu_runstate_info vcr;
+	int error;
+
+	if (strcmp(vcaa-vcaa_name, match-cf_name) == 0) {
+		error = HYPERVISOR_vcpu_op(VCPUOP_get_runstate_info,
+	   vcaa-vcaa_caa.cpu_number,
+	   vcr);
+		switch (error) {
+		case 0:
+			return 1;
+		case -ENOENT:
+			return 0;
+		default:
+			panic(Unknown hypervisor error %d returned on vcpu runstate probe\n, error);
+		}
+	}
 
-	if (strcmp(vcaa-vcaa_name, match-cf_name) == 0)
-		return 1;
 	return 0;
 }
 
@@ -328,9 +334,18 @@
 {
 	struct vcpu_attach_args *vcaa = aux;
 
+	KASSERT(vcaa-vcaa_caa.cpu_func == NULL);
+	vcaa-vcaa_caa.cpu_func = mp_cpu_funcs;
 	cpu_attach_common(parent, self, vcaa-vcaa_caa);
 }
 
+static int
+vcpu_is_up(struct cpu_info *ci)
+{
+	KASSERT(ci != NULL);
+	return HYPERVISOR_vcpu_op(VCPUOP_is_up, ci-ci_cpuid, NULL);
+}
+
 static void
 cpu_vm_init(struct cpu_info *ci)
 {
@@ -395,22 +410,6 @@
 		aprint_naive(: %s Processor\n,
 		caa-cpu_role == CPU_ROLE_SP ? Single : Boot);
 		ci = cpu_info_primary;
-#if NLAPIC  0
-		if (cpunum != lapic_cpu_number()) {
-			/* XXX should be done earlier */
-			uint32_t reg;
-			aprint_verbose(\n);
-			aprint_verbose_dev(self, running CPU at apic %d
-			 instead of at expected %d, lapic_cpu_number(),
-			cpunum);
-			reg = i82489_readreg(LAPIC_ID);
-			i82489_writereg(LAPIC_ID, (reg  ~LAPIC_ID_MASK) |
-			(cpunum  

CVS commit: src/usr.bin/window

2011-08-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Aug 13 14:02:48 UTC 2011

Modified Files:
src/usr.bin/window: main.c window.1

Log Message:
Sort (and synchronize) option list and `SYNOPSIS' section in
manpage, as well as the program's `usage'-line; also some other
minor changes.

From Snader_LB.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/window/main.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/window/window.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/window/main.c
diff -u src/usr.bin/window/main.c:1.15 src/usr.bin/window/main.c:1.16
--- src/usr.bin/window/main.c:1.15	Tue Apr 14 08:50:06 2009
+++ src/usr.bin/window/main.c	Sat Aug 13 14:02:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.15 2009/04/14 08:50:06 lukem Exp $	*/
+/*	$NetBSD: main.c,v 1.16 2011/08/13 14:02:48 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = @(#)main.c	8.2 (Berkeley) 4/2/94;
 #else
-__RCSID($NetBSD: main.c,v 1.15 2009/04/14 08:50:06 lukem Exp $);
+__RCSID($NetBSD: main.c,v 1.16 2011/08/13 14:02:48 jakllsch Exp $);
 #endif
 #endif /* not lint */
 
@@ -194,7 +194,7 @@
 usage(void)
 {
 	(void) fprintf(stderr,
-	usage: %s [-e escape-char] [-c command] [-t] [-f] [-d]\n,
+	usage: %s [-d] [-f] [-t] [-c command] [-e escape-char]\n,
 	getprogname());
 	exit(1);
 }

Index: src/usr.bin/window/window.1
diff -u src/usr.bin/window/window.1:1.21 src/usr.bin/window/window.1:1.22
--- src/usr.bin/window/window.1:1.21	Thu Mar 10 13:23:41 2011
+++ src/usr.bin/window/window.1	Sat Aug 13 14:02:48 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: window.1,v 1.21 2011/03/10 13:23:41 jmmv Exp $
+.\	$NetBSD: window.1,v 1.22 2011/08/13 14:02:48 jakllsch Exp $
 .\
 .\ Copyright (c) 1985, 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\	@(#)window.1	8.2 (Berkeley) 12/30/93
 .\
-.Dd March 10, 2011
+.Dd August 13, 2011
 .Dt WINDOW 1
 .Os
 .Sh NAME
@@ -40,11 +40,11 @@
 .Nd window environment
 .Sh SYNOPSIS
 .Nm
-.Op Fl t
-.Op Fl f
 .Op Fl d
-.Op Fl e Ar escape-char
+.Op Fl f
+.Op Fl t
 .Op Fl c Ar command
+.Op Fl e Ar escape-char
 .Sh DESCRIPTION
 .Nm
 implements a window environment on
@@ -61,9 +61,7 @@
 .Nm .
 Use
 .Xr tmux 1
-instead or install the
-.Sq misc/window
-package from
+instead, or install the misc/window package from
 .Xr pkgsrc 7 .
 .Pp
 A window is a rectangular portion of the physical terminal
@@ -90,20 +88,25 @@
 If it does not exist, two equal sized windows spanning
 the terminal screen are created by default.
 .Pp
-The command line options are
+The command-line options are:
 .Bl -tag -width Fl
-.It Fl t
-Turn on terse mode (see
-.Ic terse
-command below).
-.It Fl f
-Fast.
-Don't perform any startup action.
 .It Fl d
 Ignore
 .Pa .windowrc
 and create the two default
 windows instead.
+.It Fl f
+Fast.
+Don't perform any startup action.
+.It Fl t
+Turn on terse mode (see
+.Ic terse
+command below).
+.It Fl c Ar command
+Execute the string
+.Ar command
+as a long command (see below)
+before doing anything else.
 .It Fl e Ar escape-char
 Set the escape character to
 .Ar escape-char  .
@@ -114,11 +117,6 @@
 .Ar X
 is any character, meaning
 .No control\- Ns Ar X  .
-.It Fl c Ar command
-Execute the string
-.Ar command
-as a long command (see below)
-before doing anything else.
 .El
 .Pp
 Windows can overlap and are framed as necessary.



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

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 14:06:54 UTC 2011

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

Log Message:
lwp0pcb should be struct pcb not ucontext_t, and initialize it in cpu_startup
instead of cpu_attach


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 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.14 src/sys/arch/usermode/dev/cpu.c:1.15
--- src/sys/arch/usermode/dev/cpu.c:1.14	Sat Aug 13 12:18:54 2011
+++ src/sys/arch/usermode/dev/cpu.c	Sat Aug 13 14:06:54 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.14 2011/08/13 12:18:54 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.15 2011/08/13 14:06:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.14 2011/08/13 12:18:54 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.15 2011/08/13 14:06:54 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -68,7 +68,7 @@
 	struct cpu_info	*sc_ci;
 } cpu_softc_t;
 
-static ucontext_t lwp0pcb;
+static struct pcb lwp0pcb;
 
 CFATTACH_DECL_NEW(cpu, sizeof(cpu_softc_t), cpu_match, cpu_attach, NULL, NULL);
 
@@ -93,10 +93,6 @@
 
 	sc-sc_dev = self;
 	sc-sc_ci = cpu_info_primary;
-
-	if (thunk_getcontext(lwp0pcb))
-		panic(getcontext failed);
-	uvm_lwp_setuarea(lwp0, (vaddr_t)lwp0pcb);
 }
 
 void
@@ -316,6 +312,11 @@
 cpu_startup(void)
 {
 	banner();
+
+	memset(lwp0pcb, 0, sizeof(lwp0pcb));
+	if (thunk_getcontext(lwp0pcb.pcb_ucp))
+		panic(getcontext failed);
+	uvm_lwp_setuarea(lwp0, (vaddr_t)lwp0pcb);
 }
 
 void



CVS commit: src/usr.bin/window

2011-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 14:11:16 UTC 2011

Modified Files:
src/usr.bin/window: main.c window.1

Log Message:
Sort options and option descriptions, and sync usage.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/window/main.c
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/window/window.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/window/main.c
diff -u src/usr.bin/window/main.c:1.16 src/usr.bin/window/main.c:1.17
--- src/usr.bin/window/main.c:1.16	Sat Aug 13 14:02:48 2011
+++ src/usr.bin/window/main.c	Sat Aug 13 14:11:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.16 2011/08/13 14:02:48 jakllsch Exp $	*/
+/*	$NetBSD: main.c,v 1.17 2011/08/13 14:11:16 wiz Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = @(#)main.c	8.2 (Berkeley) 4/2/94;
 #else
-__RCSID($NetBSD: main.c,v 1.16 2011/08/13 14:02:48 jakllsch Exp $);
+__RCSID($NetBSD: main.c,v 1.17 2011/08/13 14:11:16 wiz Exp $);
 #endif
 #endif /* not lint */
 
@@ -194,7 +194,7 @@
 usage(void)
 {
 	(void) fprintf(stderr,
-	usage: %s [-d] [-f] [-t] [-c command] [-e escape-char]\n,
+	usage: %s [-dft] [-c command] [-e escape-char]\n,
 	getprogname());
 	exit(1);
 }

Index: src/usr.bin/window/window.1
diff -u src/usr.bin/window/window.1:1.22 src/usr.bin/window/window.1:1.23
--- src/usr.bin/window/window.1:1.22	Sat Aug 13 14:02:48 2011
+++ src/usr.bin/window/window.1	Sat Aug 13 14:11:16 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: window.1,v 1.22 2011/08/13 14:02:48 jakllsch Exp $
+.\	$NetBSD: window.1,v 1.23 2011/08/13 14:11:16 wiz Exp $
 .\
 .\ Copyright (c) 1985, 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -40,9 +40,7 @@
 .Nd window environment
 .Sh SYNOPSIS
 .Nm
-.Op Fl d
-.Op Fl f
-.Op Fl t
+.Op Fl dft
 .Op Fl c Ar command
 .Op Fl e Ar escape-char
 .Sh DESCRIPTION
@@ -61,7 +59,9 @@
 .Nm .
 Use
 .Xr tmux 1
-instead, or install the misc/window package from
+instead, or install the
+.Pa pkgsrc/misc/window
+package from
 .Xr pkgsrc 7 .
 .Pp
 A window is a rectangular portion of the physical terminal
@@ -90,23 +90,16 @@
 .Pp
 The command-line options are:
 .Bl -tag -width Fl
-.It Fl d
-Ignore
-.Pa .windowrc
-and create the two default
-windows instead.
-.It Fl f
-Fast.
-Don't perform any startup action.
-.It Fl t
-Turn on terse mode (see
-.Ic terse
-command below).
 .It Fl c Ar command
 Execute the string
 .Ar command
 as a long command (see below)
 before doing anything else.
+.It Fl d
+Ignore
+.Pa .windowrc
+and create the two default
+windows instead.
 .It Fl e Ar escape-char
 Set the escape character to
 .Ar escape-char  .
@@ -117,6 +110,13 @@
 .Ar X
 is any character, meaning
 .No control\- Ns Ar X  .
+.It Fl f
+Fast.
+Don't perform any startup action.
+.It Fl t
+Turn on terse mode (see
+.Ic terse
+command below).
 .El
 .Pp
 Windows can overlap and are framed as necessary.



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

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 14:51:58 UTC 2011

Modified Files:
src/sys/arch/usermode/include: mcontext.h

Log Message:
make sure mcontext is large enough to store the host mcontext; fixes
strange crashes seen in pool_init


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/include/mcontext.h

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

Modified files:

Index: src/sys/arch/usermode/include/mcontext.h
diff -u src/sys/arch/usermode/include/mcontext.h:1.2 src/sys/arch/usermode/include/mcontext.h:1.3
--- src/sys/arch/usermode/include/mcontext.h:1.2	Wed Oct 21 16:06:59 2009
+++ src/sys/arch/usermode/include/mcontext.h	Sat Aug 13 14:51:58 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.2 2009/10/21 16:06:59 snj Exp $ */
+/* $NetBSD: mcontext.h,v 1.3 2011/08/13 14:51:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -29,10 +29,14 @@
 #ifndef _ARCH_USERMODE_INCLUDE_MCONTEXT_H
 #define _ARCH_USERMODE_INCLUDE_MCONTEXT_H
 
+#include machine/vmparam.h
+
 typedef struct {
+	uint8_t	__unknown[PAGE_SIZE];
 } mcontext_t;
 
 typedef struct {
+	uint8_t	__unknown[PAGE_SIZE];
 } mcontext32_t;
 
 #endif /* !_ARCH_USERMODE_INCLUDE_MCONTEXT_H */



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

2011-08-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Aug 13 15:38:47 UTC 2011

Modified Files:
src/sys/arch/arm/marvell: mvsoc_intr.c mvsocgpp.c

Log Message:
In *find_pending_irqs() return the value of pic_mark_pending_sources() instead
of 1.  Changed to match other ARM PIC code.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/marvell/mvsoc_intr.c \
src/sys/arch/arm/marvell/mvsocgpp.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/arm/marvell/mvsoc_intr.c
diff -u src/sys/arch/arm/marvell/mvsoc_intr.c:1.2 src/sys/arch/arm/marvell/mvsoc_intr.c:1.3
--- src/sys/arch/arm/marvell/mvsoc_intr.c:1.2	Mon Dec 20 00:25:28 2010
+++ src/sys/arch/arm/marvell/mvsoc_intr.c	Sat Aug 13 15:38:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsoc_intr.c,v 1.2 2010/12/20 00:25:28 matt Exp $	*/
+/*	$NetBSD: mvsoc_intr.c,v 1.3 2011/08/13 15:38:47 jakllsch Exp $	*/
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mvsoc_intr.c,v 1.2 2010/12/20 00:25:28 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: mvsoc_intr.c,v 1.3 2011/08/13 15:38:47 jakllsch Exp $);
 
 #define _INTR_PRIVATE
 
@@ -129,10 +129,11 @@
 
 	pending =
 	read_mlmbreg(MVSOC_MLMB_MLMBICR)  read_mlmbreg(MVSOC_MLMB_MLMBIMR);
+
 	if (pending == 0)
 		return 0;
-	pic_mark_pending_sources(pic, 0, pending);
-	return 1;
+
+	return pic_mark_pending_sources(pic, 0, pending);
 }
 
 /* ARGSUSED */
Index: src/sys/arch/arm/marvell/mvsocgpp.c
diff -u src/sys/arch/arm/marvell/mvsocgpp.c:1.2 src/sys/arch/arm/marvell/mvsocgpp.c:1.3
--- src/sys/arch/arm/marvell/mvsocgpp.c:1.2	Mon Jan 24 21:07:28 2011
+++ src/sys/arch/arm/marvell/mvsocgpp.c	Sat Aug 13 15:38:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsocgpp.c,v 1.2 2011/01/24 21:07:28 jakllsch Exp $	*/
+/*	$NetBSD: mvsocgpp.c,v 1.3 2011/08/13 15:38:47 jakllsch Exp $	*/
 /*
  * Copyright (c) 2008, 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mvsocgpp.c,v 1.2 2011/01/24 21:07:28 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: mvsocgpp.c,v 1.3 2011/08/13 15:38:47 jakllsch Exp $);
 
 #include gpio.h
 
@@ -284,10 +284,11 @@
 	pending = (0xff  mvsocgpp_pic-group);
 	pending = (MVSOCGPP_READ(sc, MVSOCGPP_GPIOIM(pin)) |
 		MVSOCGPP_READ(sc, MVSOCGPP_GPIOILM(pin)));
+
 	if (pending == 0)
 		return 0;
-	pic_mark_pending_sources(pic, 0, pending);
-	return 1;
+
+	return pic_mark_pending_sources(pic, 0, pending);
 }
 
 static void



CVS commit: src/sys/dev/ic

2011-08-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Aug 13 16:02:48 UTC 2011

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

Log Message:
It's hard to get a backtrace after calling a NULL function pointer,
add KASSERT before calling.


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 src/sys/dev/ic/wdc.c

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

Modified files:

Index: src/sys/dev/ic/wdc.c
diff -u src/sys/dev/ic/wdc.c:1.261 src/sys/dev/ic/wdc.c:1.262
--- src/sys/dev/ic/wdc.c:1.261	Sun Mar 28 20:46:18 2010
+++ src/sys/dev/ic/wdc.c	Sat Aug 13 16:02:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc.c,v 1.261 2010/03/28 20:46:18 snj Exp $ */
+/*	$NetBSD: wdc.c,v 1.262 2011/08/13 16:02:48 jakllsch Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wdc.c,v 1.261 2010/03/28 20:46:18 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: wdc.c,v 1.262 2011/08/13 16:02:48 jakllsch Exp $);
 
 #include opt_ata.h
 
@@ -880,6 +880,7 @@
 	}
 #endif
 	chp-ch_flags = ~ATACH_IRQ_WAIT;
+	KASSERT(xfer-c_intr != NULL);
 	ret = xfer-c_intr(chp, xfer, 1);
 	if (ret == 0) /* irq was not for us, still waiting for irq */
 		chp-ch_flags |= ATACH_IRQ_WAIT;
@@ -1332,6 +1333,7 @@
 		callout_reset(chp-ch_callout, hz, wdctimeout, chp);
 		xfer-c_flags |= C_TIMEOU;
 		chp-ch_flags = ~ATACH_IRQ_WAIT;
+		KASSERT(xfer-c_intr != NULL);
 		xfer-c_intr(chp, xfer, 1);
 	} else
 		__wdcerror(chp, missing untimeout);



CVS commit: src/sys/dev/pci

2011-08-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Aug 13 16:04:09 UTC 2011

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

Log Message:
Make correct spelling in comments a higher priority.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/jmide.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/jmide.c
diff -u src/sys/dev/pci/jmide.c:1.10 src/sys/dev/pci/jmide.c:1.11
--- src/sys/dev/pci/jmide.c:1.10	Mon Apr  4 20:37:56 2011
+++ src/sys/dev/pci/jmide.c	Sat Aug 13 16:04:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: jmide.c,v 1.10 2011/04/04 20:37:56 dyoung Exp $	*/
+/*	$NetBSD: jmide.c,v 1.11 2011/08/13 16:04:09 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: jmide.c,v 1.10 2011/04/04 20:37:56 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: jmide.c,v 1.11 2011/08/13 16:04:09 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -135,7 +135,7 @@
 
 	if (PCI_VENDOR(pa-pa_id) == PCI_VENDOR_JMICRON) {
 		if (jmide_lookup(pa-pa_id))
-			return (4); /* highter than ahcisata */
+			return (4); /* higher than ahcisata */
 	}
 	return (0);
 }



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

2011-08-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Aug 13 16:08:23 UTC 2011

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

Log Message:
detach childern too


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/hdaudio/hdaudio.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/hdaudio/hdaudio.c
diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.12 src/sys/dev/pci/hdaudio/hdaudio.c:1.13
--- src/sys/dev/pci/hdaudio/hdaudio.c:1.12	Sat Jul  9 16:01:31 2011
+++ src/sys/dev/pci/hdaudio/hdaudio.c	Sat Aug 13 16:08:23 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.12 2011/07/09 16:01:31 riastradh Exp $ */
+/* $NetBSD: hdaudio.c,v 1.13 2011/08/13 16:08:23 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdaudio.c,v 1.12 2011/07/09 16:01:31 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdaudio.c,v 1.13 2011/08/13 16:08:23 jakllsch Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -866,9 +866,17 @@
 int
 hdaudio_detach(struct hdaudio_softc *sc, int flags)
 {
+	int error;
+
 	/* Disable interrupts */
 	hdaudio_intr_disable(sc);
 
+	error = config_detach_children(sc-sc_dev, flags);
+	if (error != 0) {
+		hdaudio_intr_enable(sc);
+		return error;
+	}
+
 	mutex_destroy(sc-sc_corb_mtx);
 	mutex_destroy(sc-sc_stream_mtx);
 



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

2011-08-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Aug 13 16:22:15 UTC 2011

Modified Files:
src/sys/arch/xen/x86: intr.c

Log Message:
Remove spurious header.
Thanks rmind@


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/x86/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/xen/x86/intr.c
diff -u src/sys/arch/xen/x86/intr.c:1.28 src/sys/arch/xen/x86/intr.c:1.29
--- src/sys/arch/xen/x86/intr.c:1.28	Thu Aug 11 17:59:00 2011
+++ src/sys/arch/xen/x86/intr.c	Sat Aug 13 16:22:15 2011
@@ -103,7 +103,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.28 2011/08/11 17:59:00 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.29 2011/08/13 16:22:15 cherry Exp $);
 
 #include opt_multiprocessor.h
 #include opt_xen.h
@@ -119,7 +119,6 @@
 #include sys/proc.h
 #include sys/errno.h
 #include sys/cpu.h
-#include sys/simplelock.h
 
 #include uvm/uvm_extern.h
 



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

2011-08-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Aug 13 17:23:42 UTC 2011

Modified Files:
src/sys/arch/xen/xen: evtchn.c

Log Message:
Use spin mutices correctly.
 - Prune redundant splxx()/splx() pairs.
 - Do not leak a mutex_spin_enter() via conditional return.

Thanks rmind@


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/xen/xen/evtchn.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/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.50 src/sys/arch/xen/xen/evtchn.c:1.51
--- src/sys/arch/xen/xen/evtchn.c:1.50	Thu Aug 11 17:59:00 2011
+++ src/sys/arch/xen/xen/evtchn.c	Sat Aug 13 17:23:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.50 2011/08/11 17:59:00 cherry Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.51 2011/08/13 17:23:42 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: evtchn.c,v 1.50 2011/08/11 17:59:00 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: evtchn.c,v 1.51 2011/08/13 17:23:42 cherry Exp $);
 
 #include opt_xen.h
 #include isa.h
@@ -336,9 +336,7 @@
 {
 	evtchn_op_t op;
 	evtchn_port_t evtchn;
-	int s;
 
-	s = splhigh();
 	mutex_spin_enter(evtchn_lock);
 
 	evtchn = vcpu_ipi_to_evtch[vcpu];
@@ -355,7 +353,6 @@
 	evtch_bindcount[evtchn]++;
 
 	mutex_spin_exit(evtchn_lock);
-	splx(s);
 
 	return evtchn;
 }
@@ -364,9 +361,8 @@
 bind_virq_to_evtch(int virq)
 {
 	evtchn_op_t op;
-	int evtchn, s;
+	int evtchn;
 
-	s = splhigh();
 	mutex_spin_enter(evtchn_lock);
 
 	/* 
@@ -379,6 +375,7 @@
 	struct cpu_info *ci = curcpu();
 
 	if (virq == VIRQ_DEBUG  ci != cpu_info_primary) {
+		mutex_spin_exit(evtchn_lock);
 		return -1;
 	}
 
@@ -402,7 +399,6 @@
 	evtch_bindcount[evtchn]++;
 
 	mutex_spin_exit(evtchn_lock);
-	splx(s);
 
 	return evtchn;
 }
@@ -412,7 +408,6 @@
 {
 	evtchn_op_t op;
 	int evtchn;
-	int s;
 
 	struct cpu_info *ci = curcpu();
 
@@ -427,7 +422,6 @@
 		return -1;
 	}
 
-	s = splhigh();
 	mutex_spin_enter(evtchn_lock);
 
 	evtch_bindcount[evtchn]--;
@@ -441,7 +435,6 @@
 	}
 
 	mutex_spin_exit(evtchn_lock);
-	splx(s);
 
 	return evtchn;
 }
@@ -451,13 +444,12 @@
 bind_pirq_to_evtch(int pirq)
 {
 	evtchn_op_t op;
-	int evtchn, s;
+	int evtchn;
 
 	if (pirq = NR_PIRQS) {
 		panic(pirq %d out of bound, increase NR_PIRQS, pirq);
 	}
 
-	s = splhigh();
 	mutex_spin_enter(evtchn_lock);
 
 	evtchn = pirq_to_evtch[pirq];
@@ -478,7 +470,6 @@
 	evtch_bindcount[evtchn]++;
 
 	mutex_spin_exit(evtchn_lock);
-	splx(s);
 
 	return evtchn;
 }
@@ -488,7 +479,6 @@
 {
 	evtchn_op_t op;
 	int evtchn = pirq_to_evtch[pirq];
-	int s = splhigh();
 
 	mutex_spin_enter(evtchn_lock);
 
@@ -503,7 +493,6 @@
 	}
 
 	mutex_spin_exit(evtchn_lock);
-	splx(s);
 
 	return evtchn;
 }
@@ -650,7 +639,7 @@
 		 * is more explicitly implemented.
 		 */
 		evts-ev_cpu = ci; 
-		mutex_init(evtlock[evtch], MUTEX_DEFAULT, IPL_VM);
+		mutex_init(evtlock[evtch], MUTEX_DEFAULT, IPL_HIGH);
 		evtsource[evtch] = evts;
 		if (evname)
 			strncpy(evts-ev_evname, evname,



CVS commit: src/sys/dev/ic

2011-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 13 18:13:44 UTC 2011

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

Log Message:
simplifying code, unconfuses gcc index calculation.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/dev/ic/tulip.c

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

Modified files:

Index: src/sys/dev/ic/tulip.c
diff -u src/sys/dev/ic/tulip.c:1.177 src/sys/dev/ic/tulip.c:1.178
--- src/sys/dev/ic/tulip.c:1.177	Sat Jul  9 19:18:05 2011
+++ src/sys/dev/ic/tulip.c	Sat Aug 13 14:13:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tulip.c,v 1.177 2011/07/09 23:18:05 christos Exp $	*/
+/*	$NetBSD: tulip.c,v 1.178 2011/08/13 18:13:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tulip.c,v 1.177 2011/07/09 23:18:05 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: tulip.c,v 1.178 2011/08/13 18:13:44 christos Exp $);
 
 
 #include sys/param.h
@@ -667,6 +667,7 @@
 	struct tulip_txsoft *txs, *last_txs = NULL;
 	bus_dmamap_t dmamap;
 	int error, firsttx, nexttx, lasttx = 1, ofree, seg;
+	struct tulip_desc *txd;
 
 	DPRINTF(sc, (%s: tlp_start: sc_flags 0x%08x, if_flags 0x%08x\n,
 	device_xname(sc-sc_dev), sc-sc_flags, ifp-if_flags));
@@ -803,11 +804,12 @@
 			 * yet.  That could cause a race condition.
 			 * We'll do it below.
 			 */
-			sc-sc_txdescs[nexttx].td_status =
+			txd = sc-sc_txdescs[nexttx];
+			txd-td_status =
 			(nexttx == firsttx) ? 0 : htole32(TDSTAT_OWN);
-			sc-sc_txdescs[nexttx].td_bufaddr1 =
+			txd-td_bufaddr1 =
 			htole32(dmamap-dm_segs[seg].ds_addr);
-			sc-sc_txdescs[nexttx].td_ctl =
+			txd-td_ctl =
 			htole32((dmamap-dm_segs[seg].ds_len 
 			TDCTL_SIZE1_SHIFT) | sc-sc_tdctl_ch |
 (nexttx == (TULIP_NTXDESC - 1) ?
@@ -825,15 +827,16 @@
 		if (ifp-if_flags  IFF_DEBUG) {
 			printf( txsoft %p transmit chain:\n, txs);
 			for (seg = sc-sc_txnext;; seg = TULIP_NEXTTX(seg)) {
+txd = sc-sc_txdescs[seg];
 printf( descriptor %d:\n, seg);
 printf(   td_status:   0x%08x\n,
-le32toh(sc-sc_txdescs[seg].td_status));
+le32toh(txd-td_status));
 printf(   td_ctl:  0x%08x\n,
-le32toh(sc-sc_txdescs[seg].td_ctl));
+le32toh(txd-td_ctl));
 printf(   td_bufaddr1: 0x%08x\n,
-le32toh(sc-sc_txdescs[seg].td_bufaddr1));
+le32toh(txd-td_bufaddr1));
 printf(   td_bufaddr2: 0x%08x\n,
-le32toh(sc-sc_txdescs[seg].td_bufaddr2));
+le32toh(txd-td_bufaddr2));
 if (seg == lasttx)
 	break;
 			}
@@ -1431,15 +1434,17 @@
 #ifdef TLP_DEBUG
 		if (ifp-if_flags  IFF_DEBUG) {
 			int i;
+			struct tulip_desc *txd;
 			printf(txsoft %p transmit chain:\n, txs);
 			for (i = txs-txs_firstdesc;; i = TULIP_NEXTTX(i)) {
+txd = sc-sc_txdescs[i];
 printf( descriptor %d:\n, i);
 printf(   td_status:   0x%08x\n,
-le32toh(sc-sc_txdescs[i].td_status));
+le32toh(txd-td_status));
 printf(   td_ctl:  0x%08x\n,
-le32toh(sc-sc_txdescs[i].td_ctl));
+le32toh(txd-td_ctl));
 printf(   td_bufaddr1: 0x%08x\n,
-le32toh(sc-sc_txdescs[i].td_bufaddr1));
+le32toh(txd-td_bufaddr1));
 printf(   td_bufaddr2: 0x%08x\n,
 le32toh(sc-sc_txdescs[i].td_bufaddr2));
 if (i == txs-txs_lastdesc)
@@ -1780,9 +1785,9 @@
 	 */
 	memset(sc-sc_txdescs, 0, sizeof(sc-sc_txdescs));
 	for (i = 0; i  TULIP_NTXDESC; i++) {
-		sc-sc_txdescs[i].td_ctl = htole32(sc-sc_tdctl_ch);
-		sc-sc_txdescs[i].td_bufaddr2 =
-		htole32(TULIP_CDTXADDR(sc, TULIP_NEXTTX(i)));
+		struct tulip_desc *txd = sc-sc_txdescs[i];
+		txd-td_ctl = htole32(sc-sc_tdctl_ch);
+		txd-td_bufaddr2 = htole32(TULIP_CDTXADDR(sc, TULIP_NEXTTX(i)));
 	}
 	sc-sc_txdescs[TULIP_NTXDESC - 1].td_ctl |= htole32(sc-sc_tdctl_er);
 	TULIP_CDTXSYNC(sc, 0, TULIP_NTXDESC,
@@ -2559,6 +2564,7 @@
 	struct ether_multistep step;
 	volatile uint32_t *sp;
 	struct tulip_txsoft *txs;
+	struct tulip_desc *txd;
 	uint8_t enaddr[ETHER_ADDR_LEN];
 	uint32_t hash, hashsize;
 	int cnt, nexttx;
@@ -2756,10 +2762,10 @@
 	txs-txs_mbuf = NULL;
 
 	nexttx = sc-sc_txnext;
-	sc-sc_txdescs[nexttx].td_status = 0;
-	sc-sc_txdescs[nexttx].td_bufaddr1 = htole32(TULIP_CDSPADDR(sc));
-	sc-sc_txdescs[nexttx].td_ctl =
-	htole32((TULIP_SETUP_PACKET_LEN  TDCTL_SIZE1_SHIFT) |
+	txd = sc-sc_txdescs[nexttx];
+	txd-td_status = 0;
+	txd-td_bufaddr1 = htole32(TULIP_CDSPADDR(sc));
+	txd-td_ctl = htole32((TULIP_SETUP_PACKET_LEN  TDCTL_SIZE1_SHIFT) |
 	sc-sc_filtmode | TDCTL_Tx_SET | sc-sc_setup_fsls |
 	TDCTL_Tx_IC | sc-sc_tdctl_ch |
 	(nexttx == (TULIP_NTXDESC - 1) ? sc-sc_tdctl_er : 0));
@@ -2770,18 +2776,16 @@
 	if (ifp-if_flags  IFF_DEBUG) {
 		printf( filter_setup %p transmit chain:\n, txs);
 		printf( descriptor %d:\n, nexttx);
-		printf(   

CVS commit: src/sys/dev/i2c

2011-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 18:31:38 UTC 2011

Modified Files:
src/sys/dev/i2c: files.i2c

Log Message:
lg3303 depends on dtv_math, not xc3028


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/i2c/files.i2c

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

Modified files:

Index: src/sys/dev/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.41 src/sys/dev/i2c/files.i2c:1.42
--- src/sys/dev/i2c/files.i2c:1.41	Tue Aug  9 01:42:24 2011
+++ src/sys/dev/i2c/files.i2c	Sat Aug 13 18:31:38 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.41 2011/08/09 01:42:24 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.42 2011/08/13 18:31:38 jmcneill Exp $
 
 defflag	opt_i2cbus.hI2C_SCAN
 define	i2cbus { }
@@ -18,11 +18,11 @@
 file	dev/i2c/au8522.c			au8522
 
 # LG DT3303 decoder
-define	lg3303: i2cexec
+define	lg3303: i2cexec, dtv_math
 file	dev/i2c/lg3303.c			lg3303
 
 # Xceive XC3028 tuner
-define	xc3028: i2cexec, firmload, dtv_math
+define	xc3028: i2cexec, firmload
 file	dev/i2c/xc3028.c			xc3028
 
 # Xceive XC5000 tuner



CVS commit: src/sys/dev/ic

2011-08-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Aug 13 19:23:35 UTC 2011

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

Log Message:
Fix TLP_DEBUG after previous


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/sys/dev/ic/tulip.c

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

Modified files:

Index: src/sys/dev/ic/tulip.c
diff -u src/sys/dev/ic/tulip.c:1.178 src/sys/dev/ic/tulip.c:1.179
--- src/sys/dev/ic/tulip.c:1.178	Sat Aug 13 18:13:44 2011
+++ src/sys/dev/ic/tulip.c	Sat Aug 13 19:23:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tulip.c,v 1.178 2011/08/13 18:13:44 christos Exp $	*/
+/*	$NetBSD: tulip.c,v 1.179 2011/08/13 19:23:34 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tulip.c,v 1.178 2011/08/13 18:13:44 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: tulip.c,v 1.179 2011/08/13 19:23:34 jakllsch Exp $);
 
 
 #include sys/param.h
@@ -827,7 +827,7 @@
 		if (ifp-if_flags  IFF_DEBUG) {
 			printf( txsoft %p transmit chain:\n, txs);
 			for (seg = sc-sc_txnext;; seg = TULIP_NEXTTX(seg)) {
-txd = sc-sc_txdescs[seg];
+txd = sc-sc_txdescs[seg];
 printf( descriptor %d:\n, seg);
 printf(   td_status:   0x%08x\n,
 le32toh(txd-td_status));
@@ -1437,7 +1437,7 @@
 			struct tulip_desc *txd;
 			printf(txsoft %p transmit chain:\n, txs);
 			for (i = txs-txs_firstdesc;; i = TULIP_NEXTTX(i)) {
-txd = sc-sc_txdescs[i];
+txd = sc-sc_txdescs[i];
 printf( descriptor %d:\n, i);
 printf(   td_status:   0x%08x\n,
 le32toh(txd-td_status));



CVS commit: src/sys/kern

2011-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 13 19:40:02 UTC 2011

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

Log Message:
Handle absolute symlinks to the root.

Fixes panic on `ln -s / foo  cd foo' found by ober by trying to run
wine.

ok dholland


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/kern/vfs_lookup.c

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

Modified files:

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.188 src/sys/kern/vfs_lookup.c:1.189
--- src/sys/kern/vfs_lookup.c:1.188	Wed Aug 10 05:42:32 2011
+++ src/sys/kern/vfs_lookup.c	Sat Aug 13 19:40:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.188 2011/08/10 05:42:32 dholland Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.189 2011/08/13 19:40:02 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_lookup.c,v 1.188 2011/08/10 05:42:32 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_lookup.c,v 1.189 2011/08/13 19:40:02 riastradh Exp $);
 
 #include opt_magiclinks.h
 
@@ -1217,6 +1217,20 @@
 			/* namei_follow unlocks it (ugh) so rele, not put */
 			vrele(foundobj);
 			foundobj = NULL;
+
+			/*
+			 * If we followed a symlink to `/' and there
+			 * are no more components after the symlink,
+			 * we're done with the loop and what we found
+			 * is the searchdir.
+			 */
+			if (cnp-cn_nameptr[0] == '\0') {
+foundobj = searchdir;
+searchdir = NULL;
+cnp-cn_flags |= ISLASTCN;
+break;
+			}
+
 			continue;
 		}
 



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

2011-08-13 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Aug 13 20:24:19 UTC 2011

Modified Files:
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Call the right function
(fix for an egregious error)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/xen/x86/x86_xpmap.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/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.31 src/sys/arch/xen/x86/x86_xpmap.c:1.32
--- src/sys/arch/xen/x86/x86_xpmap.c:1.31	Sat Aug 13 12:09:38 2011
+++ src/sys/arch/xen/x86/x86_xpmap.c	Sat Aug 13 20:24:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.31 2011/08/13 12:09:38 cherry Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.32 2011/08/13 20:24:19 cherry Exp $	*/
 
 /*
  * Copyright (c) 2006 Mathieu Ropert m...@adviseo.fr
@@ -69,7 +69,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: x86_xpmap.c,v 1.31 2011/08/13 12:09:38 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: x86_xpmap.c,v 1.32 2011/08/13 20:24:19 cherry Exp $);
 
 #include opt_xen.h
 #include opt_ddb.h
@@ -185,7 +185,7 @@
 bool
 xpq_queue_locked(void)
 {
-	return xpq_queue_locked();
+	return simple_lock_held(xpq_lock);
 }
 #endif /* MULTIPROCESSOR */
 



CVS commit: src/sys

2011-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 13 21:04:07 UTC 2011

Modified Files:
src/sys/arch/sandpoint/sandpoint: machdep.c
src/sys/arch/x86/x86: x86_machdep.c
src/sys/kern: kern_module.c subr_kobj.c subr_kobj_vfs.c
src/sys/sys: kobj.h kobj_impl.h module.h

Log Message:
Always provide a meaningful short name for the kobj in the error message,
as well as the function name and the linenumber, without extra line feeds.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/sandpoint/sandpoint/machdep.c
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x86/x86/x86_machdep.c
cvs rdiff -u -r1.79 -r1.80 src/sys/kern/kern_module.c
cvs rdiff -u -r1.43 -r1.44 src/sys/kern/subr_kobj.c
cvs rdiff -u -r1.5 -r1.6 src/sys/kern/subr_kobj_vfs.c
cvs rdiff -u -r1.15 -r1.16 src/sys/sys/kobj.h
cvs rdiff -u -r1.2 -r1.3 src/sys/sys/kobj_impl.h
cvs rdiff -u -r1.26 -r1.27 src/sys/sys/module.h

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

Modified files:

Index: src/sys/arch/sandpoint/sandpoint/machdep.c
diff -u src/sys/arch/sandpoint/sandpoint/machdep.c:1.57 src/sys/arch/sandpoint/sandpoint/machdep.c:1.58
--- src/sys/arch/sandpoint/sandpoint/machdep.c:1.57	Mon Jun 20 03:18:07 2011
+++ src/sys/arch/sandpoint/sandpoint/machdep.c	Sat Aug 13 17:04:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.57 2011/06/20 07:18:07 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.58 2011/08/13 21:04:05 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.57 2011/06/20 07:18:07 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.58 2011/08/13 21:04:05 christos Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_ddb.h
@@ -420,7 +420,7 @@
 	while (bi  biend) {
 		printf(module %s at 0x%08x size %x\n, 
 		bi-kmod, bi-base, bi-len);
-		/* module_prime((void *)bi-base, bi-len); */
+		/* module_prime(bi-kmod, (void *)bi-base, bi-len); */
 		bi += 1;
 	}
 }

Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.55 src/sys/arch/x86/x86/x86_machdep.c:1.56
--- src/sys/arch/x86/x86/x86_machdep.c:1.55	Thu Aug 11 14:11:17 2011
+++ src/sys/arch/x86/x86/x86_machdep.c	Sat Aug 13 17:04:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.55 2011/08/11 18:11:17 cherry Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.56 2011/08/13 21:04:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: x86_machdep.c,v 1.55 2011/08/11 18:11:17 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: x86_machdep.c,v 1.56 2011/08/13 21:04:05 christos Exp $);
 
 #include opt_modular.h
 #include opt_physmem.h
@@ -160,7 +160,8 @@
 			aprint_debug(Prep module path=%s len=%d pa=%x\n, 
 			bi-path, bi-len, bi-base);
 			KASSERT(trunc_page(bi-base) == bi-base);
-			module_prime((void *)((uintptr_t)bi-base + KERNBASE),
+			module_prime(bi-path,
+			(void *)((uintptr_t)bi-base + KERNBASE),
 			bi-len);
 			break;
 		case BI_MODULE_IMAGE:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.79 src/sys/kern/kern_module.c:1.80
--- src/sys/kern/kern_module.c:1.79	Sun Jul 17 16:54:52 2011
+++ src/sys/kern/kern_module.c	Sat Aug 13 17:04:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.79 2011/07/17 20:54:52 joerg Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.80 2011/08/13 21:04:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_module.c,v 1.79 2011/07/17 20:54:52 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_module.c,v 1.80 2011/08/13 21:04:06 christos Exp $);
 
 #define _MODULE_INTERNAL
 
@@ -1179,7 +1179,7 @@
  *	list.
  */
 int
-module_prime(void *base, size_t size)
+module_prime(const char *name, void *base, size_t size)
 {
 	module_t *mod;
 	int error;
@@ -1189,7 +1189,7 @@
 		return ENOMEM;
 	}
 
-	error = kobj_load_mem(mod-mod_kobj, base, size);
+	error = kobj_load_mem(mod-mod_kobj, name, base, size);
 	if (error != 0) {
 		kmem_free(mod, sizeof(*mod));
 		module_error(unable to load object pushed by boot loader);

Index: src/sys/kern/subr_kobj.c
diff -u src/sys/kern/subr_kobj.c:1.43 src/sys/kern/subr_kobj.c:1.44
--- src/sys/kern/subr_kobj.c:1.43	Sun Jul 17 16:54:52 2011
+++ src/sys/kern/subr_kobj.c	Sat Aug 13 17:04:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kobj.c,v 1.43 2011/07/17 20:54:52 joerg Exp $	*/
+/*	$NetBSD: subr_kobj.c,v 1.44 2011/08/13 21:04:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_kobj.c,v 1.43 2011/07/17 20:54:52 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_kobj.c,v 1.44 2011/08/13 21:04:06 christos Exp $);
 
 #include opt_modular.h
 
@@ -82,7 +82,8 @@
 
 static int	

CVS commit: src/share/man/man4

2011-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 22:00:35 UTC 2011

Added Files:
src/share/man/man4: cxdtv.4

Log Message:
Add basic man page for cxdtv(4).
Not hooked to the build yet so that the driver authors can verify and
improve it.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/man/man4/cxdtv.4

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

Added files:

Index: src/share/man/man4/cxdtv.4
diff -u /dev/null src/share/man/man4/cxdtv.4:1.1
--- /dev/null	Sat Aug 13 22:00:35 2011
+++ src/share/man/man4/cxdtv.4	Sat Aug 13 22:00:35 2011
@@ -0,0 +1,69 @@
+.\ $NetBSD: cxdtv.4,v 1.1 2011/08/13 22:00:35 wiz Exp $
+.\
+.\ Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Thomas Klausner.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\ POSSIBILITY OF SUCH DAMAGE.
+.\
+.Dd August 13, 2011
+.Dt CXDTV 4
+.Os
+.Sh NAME
+.Nm cxdtv
+.Nd digital video driver for Conexant CX32880 based cards
+.Sh SYNOPSIS
+.Cd cxdtv* at pci? dev ? function ?
+.Cd iic* at cxdtv?
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for digital video cards based on the
+Conexant CX32880 DTV interface chips.
+.Pp
+Supported cards include:
+.Bl -bullet -offset indent
+.It
+ATI HDTV Wonder (digital-only)
+.It
+pcHDTV HD5500
+.El
+.Sh SEE ALSO
+.Xr dtv 4 ,
+.Xr iic 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Nx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Jonathan A. Kollasch
+.Aq jakll...@netbsd.org
+and
+.An Jared D. McNeill
+.Aq jmcne...@netbsd.org .



CVS commit: src/share/man/man4

2011-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 22:08:01 UTC 2011

Added Files:
src/share/man/man4: coram.4

Log Message:
Add basic man page for coram(4).
Not hooked to the build yet so that the driver authors can verify and
improve it.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/man/man4/coram.4

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

Added files:

Index: src/share/man/man4/coram.4
diff -u /dev/null src/share/man/man4/coram.4:1.1
--- /dev/null	Sat Aug 13 22:08:01 2011
+++ src/share/man/man4/coram.4	Sat Aug 13 22:08:01 2011
@@ -0,0 +1,69 @@
+.\ $NetBSD: coram.4,v 1.1 2011/08/13 22:08:01 wiz Exp $
+.\
+.\ Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Thomas Klausner.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\ POSSIBILITY OF SUCH DAMAGE.
+.\
+.Dd August 13, 2011
+.Dt CORAM 4
+.Os
+.Sh NAME
+.Nm coram
+.Nd digital video driver for Conexant CX23885 based cards
+.Sh SYNOPSIS
+.Cd coram* at pci? dev ? function ?
+.Cd iic* at coram?
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for digital video cards based on the
+Conexant CX23885 DTV interface chips.
+.Pp
+Supported cards include:
+.Bl -bullet -offset indent
+.It
+Hauppauge WinTV HVR-1250
+.El
+.Sh SEE ALSO
+.Xr dtv 4 ,
+.Xr iic 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Nx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Jonathan A. Kollasch
+.Aq jakll...@netbsd.org
+and
+.An Jared D. McNeill
+.Aq jmcne...@netbsd.org .
+.Sh BUGS
+Currently only supports ATSC 8VSB reception.



CVS commit: src/share/man/man4

2011-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 22:18:31 UTC 2011

Added Files:
src/share/man/man4: emdtv.4

Log Message:
Add basic man page for emdtv(4).
Not hooked to the build yet so that the driver authors can verify and
improve it.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/man/man4/emdtv.4

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

Added files:

Index: src/share/man/man4/emdtv.4
diff -u /dev/null src/share/man/man4/emdtv.4:1.1
--- /dev/null	Sat Aug 13 22:18:31 2011
+++ src/share/man/man4/emdtv.4	Sat Aug 13 22:18:31 2011
@@ -0,0 +1,72 @@
+.\ $NetBSD: emdtv.4,v 1.1 2011/08/13 22:18:31 wiz Exp $
+.\
+.\ Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Thomas Klausner.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\ POSSIBILITY OF SUCH DAMAGE.
+.\
+.Dd August 13, 2011
+.Dt EMDTV 4
+.Os
+.Sh NAME
+.Nm emdtv
+.Nd digital video driver for Empia Technology EM28xx based cards
+.Sh SYNOPSIS
+.Cd emdtv* at uhub?
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for digital video cards based on the
+Empia Technology EM28xx series of DTV interface chips (in particular,
+the EM2883).
+This chip is used in USB products.
+.Pp
+Supported cards include:
+.Bl -bullet -offset indent
+.It
+ATI/AMD TV Wonder 600 USB
+.\.It
+.\Empia Hybrid XS ATSC
+.It
+Pinnacle PCTV HD Pro Stick (800e)
+.El
+.Sh SEE ALSO
+.Xr dtv 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Nx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Jared D. McNeill
+.Aq jmcne...@netbsd.org
+and
+.An Jonathan A. Kollasch
+.Aq jakll...@netbsd.org .



CVS commit: src/share/man/man4

2011-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 22:21:29 UTC 2011

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

Log Message:
Improvements based on comments by Jared.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/cxdtv.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/cxdtv.4
diff -u src/share/man/man4/cxdtv.4:1.1 src/share/man/man4/cxdtv.4:1.2
--- src/share/man/man4/cxdtv.4:1.1	Sat Aug 13 22:00:35 2011
+++ src/share/man/man4/cxdtv.4	Sat Aug 13 22:21:28 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: cxdtv.4,v 1.1 2011/08/13 22:00:35 wiz Exp $
+.\ $NetBSD: cxdtv.4,v 1.2 2011/08/13 22:21:28 wiz Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -32,7 +32,7 @@
 .Os
 .Sh NAME
 .Nm cxdtv
-.Nd digital video driver for Conexant CX32880 based cards
+.Nd digital video driver for Conexant CX2388x based cards
 .Sh SYNOPSIS
 .Cd cxdtv* at pci? dev ? function ?
 .Cd iic* at cxdtv?
@@ -40,7 +40,7 @@
 The
 .Nm
 driver provides support for digital video cards based on the
-Conexant CX32880 DTV interface chips.
+Conexant CX23881, CX23882, CX23883, and CX23884 multimedia bridges.
 .Pp
 Supported cards include:
 .Bl -bullet -offset indent
@@ -67,3 +67,8 @@
 and
 .An Jared D. McNeill
 .Aq jmcne...@netbsd.org .
+.Sh BUGS
+The
+.Nm
+driver lacks support for analog video capture, analog audio capture,
+FM tuning, and the IR receiver.



CVS commit: src/share/man/man4

2011-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 22:22:00 UTC 2011

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

Log Message:
Remove iic references, also based on comments by Jared.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/cxdtv.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/cxdtv.4
diff -u src/share/man/man4/cxdtv.4:1.2 src/share/man/man4/cxdtv.4:1.3
--- src/share/man/man4/cxdtv.4:1.2	Sat Aug 13 22:21:28 2011
+++ src/share/man/man4/cxdtv.4	Sat Aug 13 22:22:00 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: cxdtv.4,v 1.2 2011/08/13 22:21:28 wiz Exp $
+.\ $NetBSD: cxdtv.4,v 1.3 2011/08/13 22:22:00 wiz Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -35,7 +35,6 @@
 .Nd digital video driver for Conexant CX2388x based cards
 .Sh SYNOPSIS
 .Cd cxdtv* at pci? dev ? function ?
-.Cd iic* at cxdtv?
 .Sh DESCRIPTION
 The
 .Nm
@@ -50,8 +49,7 @@
 pcHDTV HD5500
 .El
 .Sh SEE ALSO
-.Xr dtv 4 ,
-.Xr iic 4
+.Xr dtv 4
 .Sh HISTORY
 The
 .Nm



CVS commit: src/libexec/ld.elf_so

2011-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 13 22:24:24 UTC 2011

Modified Files:
src/libexec/ld.elf_so: rtld.c

Log Message:
disable debugging that makes us core dump


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/libexec/ld.elf_so/rtld.c

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

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.151 src/libexec/ld.elf_so/rtld.c:1.152
--- src/libexec/ld.elf_so/rtld.c:1.151	Sat Jun 25 01:45:12 2011
+++ src/libexec/ld.elf_so/rtld.c	Sat Aug 13 18:24:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.151 2011/06/25 05:45:12 nonaka Exp $	 */
+/*	$NetBSD: rtld.c,v 1.152 2011/08/13 22:24:24 christos Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: rtld.c,v 1.151 2011/06/25 05:45:12 nonaka Exp $);
+__RCSID($NetBSD: rtld.c,v 1.152 2011/08/13 22:24:24 christos Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -403,8 +403,10 @@
 	debug = 1;
 	dbg((sp = %p, argc = %ld, argv = %p %s relocbase %p, sp,
 	(long)sp[2], sp[3], (char *) sp[3], (void *)relocbase));
+#if 0
 	dbg((got is at %p, dynamic is at %p, _GLOBAL_OFFSET_TABLE_,
 	_DYNAMIC));
+#endif
 	dbg((_ctype_ is %p, _ctype_));
 #endif
 



CVS commit: src/libexec/ld.elf_so

2011-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 13 22:24:57 UTC 2011

Modified Files:
src/libexec/ld.elf_so: symbol.c

Log Message:
printing the pathname of the shared object is much more useful than the
object's address.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/libexec/ld.elf_so/symbol.c

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

Modified files:

Index: src/libexec/ld.elf_so/symbol.c
diff -u src/libexec/ld.elf_so/symbol.c:1.57 src/libexec/ld.elf_so/symbol.c:1.58
--- src/libexec/ld.elf_so/symbol.c:1.57	Sat Jun 25 01:45:12 2011
+++ src/libexec/ld.elf_so/symbol.c	Sat Aug 13 18:24:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: symbol.c,v 1.57 2011/06/25 05:45:12 nonaka Exp $	 */
+/*	$NetBSD: symbol.c,v 1.58 2011/08/13 22:24:57 christos Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: symbol.c,v 1.57 2011/06/25 05:45:12 nonaka Exp $);
+__RCSID($NetBSD: symbol.c,v 1.58 2011/08/13 22:24:57 christos Exp $);
 #endif /* not lint */
 
 #include err.h
@@ -255,7 +255,7 @@
 		assert(symnum  obj-nchains);
 		symp = obj-symtab + symnum;
 		strp = obj-strtab + symp-st_name;
-		rdbg((check \%s\ vs \%s\ in %p, name, strp, obj));
+		rdbg((check \%s\ vs \%s\ in %s, name, strp, obj-path));
 		if (name[1] != strp[1] || strcmp(name, strp))
 			continue;
 		if (symp-st_shndx != SHN_UNDEF)



CVS commit: src/libexec/ld.elf_so

2011-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 13 22:25:20 UTC 2011

Modified Files:
src/libexec/ld.elf_so: map_object.c

Log Message:
consistent debugging info for program headers


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/libexec/ld.elf_so/map_object.c

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

Modified files:

Index: src/libexec/ld.elf_so/map_object.c
diff -u src/libexec/ld.elf_so/map_object.c:1.42 src/libexec/ld.elf_so/map_object.c:1.43
--- src/libexec/ld.elf_so/map_object.c:1.42	Wed Mar  9 18:10:07 2011
+++ src/libexec/ld.elf_so/map_object.c	Sat Aug 13 18:25:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: map_object.c,v 1.42 2011/03/09 23:10:07 joerg Exp $	 */
+/*	$NetBSD: map_object.c,v 1.43 2011/08/13 22:25:20 christos Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: map_object.c,v 1.42 2011/03/09 23:10:07 joerg Exp $);
+__RCSID($NetBSD: map_object.c,v 1.43 2011/08/13 22:25:20 christos Exp $);
 #endif /* not lint */
 
 #include errno.h
@@ -185,24 +185,28 @@
 			if (nsegs  2)
 segs[nsegs] = phdr;
 			++nsegs;
-			dbg((%s: PT_LOAD %p, obj-path, phdr));
+			dbg((%s: %s %p phsize %zu, obj-path, PT_LOAD,
+			(void *)(uintptr_t)phdr-p_vaddr, phdr-p_memsz));
 			break;
 
 		case PT_PHDR:
 			phdr_vaddr = phdr-p_vaddr;
 			phdr_memsz = phdr-p_memsz;
-			dbg((%s: PT_PHDR %p phsize %zu, obj-path,
-			(void *)(uintptr_t)phdr_vaddr, phdr_memsz));
+			dbg((%s: %s %p phsize %zu, obj-path, PT_PHDR,
+			(void *)(uintptr_t)phdr-p_vaddr, phdr-p_memsz));
 			break;
 		
 		case PT_DYNAMIC:
 			obj-dynamic = (void *)(uintptr_t)phdr-p_vaddr;
- 			dbg((%s: PT_DYNAMIC %p, obj-path, obj-dynamic));
+			dbg((%s: %s %p phsize %zu, obj-path, PT_DYNAMIC,
+			(void *)(uintptr_t)phdr-p_vaddr, phdr-p_memsz));
 			break;
 
 #if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
 		case PT_TLS:
 			phtls = phdr;
+			dbg((%s: %s %p phsize %zu, obj-path, PT_TLS,
+			(void *)(uintptr_t)phdr-p_vaddr, phdr-p_memsz));
 			break;
 #endif
 		}



CVS commit: src/share/man/man4

2011-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 22:34:14 UTC 2011

Added Files:
src/share/man/man4: irmce.4

Log Message:
Add irmce(4) man page.
Not hooked into the build; waiting for review.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/man/man4/irmce.4

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

Added files:

Index: src/share/man/man4/irmce.4
diff -u /dev/null src/share/man/man4/irmce.4:1.1
--- /dev/null	Sat Aug 13 22:34:14 2011
+++ src/share/man/man4/irmce.4	Sat Aug 13 22:34:14 2011
@@ -0,0 +1,62 @@
+.\ $NetBSD: irmce.4,v 1.1 2011/08/13 22:34:14 wiz Exp $
+.\
+.\ Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Thomas Klausner.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\ POSSIBILITY OF SUCH DAMAGE.
+.\
+.Dd August 13, 2011
+.Dt IRMCE 4
+.Os
+.Sh NAME
+.Nm irmce
+.Nd driver for Windows Media Center IR receivers/transceivers
+.Sh SYNOPSIS
+.Cd irmce* at uhub ? port ?
+.Cd cir* at irmce?
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Windows Media Center Infrared (IR)
+transceivers/receivers.
+.Pp
+Supported cards include:
+.Bl -bullet -offset indent
+.It
+SMK eHome Infrared Transceiver
+.El
+.Sh SEE ALSO
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Nx 6.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Jared D. McNeill
+.Aq jmcne...@netbsd.org .



CVS commit: src/share/man/man4

2011-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 22:35:27 UTC 2011

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

Log Message:
Correct BUGS, from Jared.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/coram.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/coram.4
diff -u src/share/man/man4/coram.4:1.1 src/share/man/man4/coram.4:1.2
--- src/share/man/man4/coram.4:1.1	Sat Aug 13 22:08:01 2011
+++ src/share/man/man4/coram.4	Sat Aug 13 22:35:27 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: coram.4,v 1.1 2011/08/13 22:08:01 wiz Exp $
+.\ $NetBSD: coram.4,v 1.2 2011/08/13 22:35:27 wiz Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -66,4 +66,4 @@
 .An Jared D. McNeill
 .Aq jmcne...@netbsd.org .
 .Sh BUGS
-Currently only supports ATSC 8VSB reception.
+No support for analog capture and for IR receivers.



CVS commit: src/lib/libperfuse

2011-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 13 23:12:15 UTC 2011

Modified Files:
src/lib/libperfuse: Makefile ops.c perfuse.c perfuse_if.h subr.c

Log Message:
- fix warn/err confusiog
- fix debugging printf
- add func arguments to simple formats


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libperfuse/Makefile
cvs rdiff -u -r1.38 -r1.39 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libperfuse/perfuse.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libperfuse/perfuse_if.h
cvs rdiff -u -r1.12 -r1.13 src/lib/libperfuse/subr.c

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

Modified files:

Index: src/lib/libperfuse/Makefile
diff -u src/lib/libperfuse/Makefile:1.6 src/lib/libperfuse/Makefile:1.7
--- src/lib/libperfuse/Makefile:1.6	Tue Jun 28 16:28:48 2011
+++ src/lib/libperfuse/Makefile	Sat Aug 13 19:12:15 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2011/06/28 20:28:48 riz Exp $
+# $NetBSD: Makefile,v 1.7 2011/08/13 23:12:15 christos Exp $
 
 LIB=perfuse
 LIBDPLIBS+= puffs	${.CURDIR}/../libpuffs
@@ -16,4 +16,8 @@
 INCS=   perfuse.h
 INCSDIR=	/usr/include
 
+COPTS.ops.c = -Wno-format-nonliteral
+COPTS.perfuse.c = -Wno-format-nonliteral
+COPTS.subr.c = -Wno-format-nonliteral
+
 .include bsd.lib.mk

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.38 src/lib/libperfuse/ops.c:1.39
--- src/lib/libperfuse/ops.c:1.38	Tue Aug  9 05:06:52 2011
+++ src/lib/libperfuse/ops.c	Sat Aug 13 19:12:15 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.38 2011/08/09 09:06:52 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.39 2011/08/13 23:12:15 christos Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -343,7 +343,7 @@
 
 	namelen = PNPLEN(dpn) + 1 + namelen + 1;
 	if ((path = malloc(namelen)) == NULL)
-		DERR(EX_OSERR, malloc failed);
+		DERR(EX_OSERR, %s: malloc failed, __func__);
 	(void)snprintf(path, namelen, %s/%s, 
 		   perfuse_node_path((puffs_cookie_t)dpn), name);
 
@@ -609,7 +609,7 @@
 	
 			dents = PERFUSE_NODE_DATA(opc)-pnd_dirent;
 			if ((dents = realloc(dents, dents_len)) == NULL)
-DERR(EX_OSERR, malloc failed);
+DERR(EX_OSERR, %s: malloc failed, __func__);
 
 			PERFUSE_NODE_DATA(opc)-pnd_dirent = dents;
 			PERFUSE_NODE_DATA(opc)-pnd_dirent_len = dents_len;
@@ -831,7 +831,7 @@
 	ps = puffs_getspecific(pu);
 	
 if (puffs_mount(pu, ps-ps_target, ps-ps_mountflags, ps-ps_root) != 0)
-DERR(EX_OSERR, puffs_mount failed);
+DERR(EX_OSERR, %s: puffs_mount failed, __func__);
 
 	/*
 	 * Linux 2.6.34.1 sends theses flags:
@@ -2388,7 +2388,7 @@
 		pnd-pnd_all_fd = realloc(pnd-pnd_all_fd, 
 	  pnd-pnd_all_fd_len + fd_len);
 		if (pnd-pnd_all_fd  == NULL)
-			DERR(EX_OSERR, malloc failed);
+			DERR(EX_OSERR, %s: malloc failed, __func__);
 
 		afdp = (char *)(void *)pnd-pnd_all_fd + pnd-pnd_all_fd_len;
 		(void)memcpy(afdp, fd, fd_len);

Index: src/lib/libperfuse/perfuse.c
diff -u src/lib/libperfuse/perfuse.c:1.17 src/lib/libperfuse/perfuse.c:1.18
--- src/lib/libperfuse/perfuse.c:1.17	Tue Aug  9 02:58:33 2011
+++ src/lib/libperfuse/perfuse.c	Sat Aug 13 19:12:15 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse.c,v 1.17 2011/08/09 06:58:33 manu Exp $ */
+/*  $NetBSD: perfuse.c,v 1.18 2011/08/13 23:12:15 christos Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -57,7 +57,7 @@
 	char opts[1024];
 
 	if ((ps = malloc(sizeof(*ps))) == NULL)
-		DERR(EX_OSERR, malloc failed);
+		DERR(EX_OSERR, %s: malloc failed, __func__);
 
 	(void)memset(ps, 0, sizeof(*ps));
 	ps-ps_max_write = UINT_MAX;
@@ -164,7 +164,7 @@
 
 		if ((sv[0] = socket(PF_LOCAL, SOCK_DGRAM, 0)) == -1) {
 #ifdef PERFUSE_DEBUG
-			DWARN(%s:%d socket failed: %s, __func__, __LINE__);
+			DWARN(%s: %d socket failed, __func__, __LINE__);
 #endif
 			return -1;
 		}
@@ -412,7 +412,7 @@
 
 	if (pmi-pmi_source) {
 		if ((ps-ps_source = strdup(pmi-pmi_source)) == NULL)
-			DERR(EX_OSERR, strdup failed);
+			DERR(EX_OSERR, %s: strdup failed, __func__);
 
 		source = ps-ps_source;
 	}
@@ -422,20 +422,20 @@
 
 		ps-ps_filesystemtype = strdup(pmi-pmi_filesystemtype);
 		if (ps-ps_filesystemtype == NULL)
-			DERR(EX_OSERR, strdup failed);
+			DERR(EX_OSERR, %s: strdup failed, __func__);
 
 		len = sizeof(perfuse|) + strlen(ps-ps_filesystemtype) + 1;
 		if ((fstype = malloc(len)) == NULL)
-			DERR(EX_OSERR, malloc failed);
+			DERR(EX_OSERR, %s: malloc failed, __func__);
 
 		(void)sprintf(fstype, perfuse|%s, ps-ps_filesystemtype);
 	} else {
 		if ((fstype = strdup(perfuse)) == NULL)
-			DERR(EX_OSERR, strdup failed);
+			DERR(EX_OSERR, %s: strdup failed, __func__);
 	}
 
 	if ((ps-ps_target = strdup(pmi-pmi_target)) == NULL)
-		DERR(EX_OSERR, strdup failed);
+		DERR(EX_OSERR, %s: strdup failed, __func__);
 
 	ps-ps_mountflags = pmi-pmi_mountflags;
 
@@ -508,7 +508,7 @@
 		puffs_flags |= PUFFS_FLAG_OPDUMP;
 

CVS commit: src/sys/uvm

2011-08-13 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Aug 14 01:20:34 UTC 2011

Modified Files:
src/sys/uvm: uvm_anon.c

Log Message:
uvm_anon_freelst: do not free PG_RELEASED pages (change uvm_anon_dispose()
to indicate them with a return value).


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/uvm/uvm_anon.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/uvm/uvm_anon.c
diff -u src/sys/uvm/uvm_anon.c:1.59 src/sys/uvm/uvm_anon.c:1.60
--- src/sys/uvm/uvm_anon.c:1.59	Sat Aug  6 17:25:03 2011
+++ src/sys/uvm/uvm_anon.c	Sun Aug 14 01:20:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_anon.c,v 1.59 2011/08/06 17:25:03 rmind Exp $	*/
+/*	$NetBSD: uvm_anon.c,v 1.60 2011/08/14 01:20:33 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_anon.c,v 1.59 2011/08/06 17:25:03 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_anon.c,v 1.60 2011/08/14 01:20:33 rmind Exp $);
 
 #include opt_uvmhist.h
 
@@ -99,8 +99,7 @@
  * = anon must be removed from the amap (if anon was in an amap).
  * = amap must be locked; we may drop and re-acquire the lock here.
  */
-
-static void
+static bool
 uvm_anon_dispose(struct vm_anon *anon)
 {
 	struct vm_page *pg = anon-an_page;
@@ -159,7 +158,7 @@
 			if (pg-flags  PG_BUSY) {
 pg-flags |= PG_RELEASED;
 mutex_obj_hold(anon-an_lock);
-return;
+return false;
 			}
 			mutex_enter(uvm_pageqlock);
 			uvm_pagefree(pg);
@@ -186,6 +185,7 @@
 	uvm_anon_dropswap(anon);
 	uvmpdpol_anfree(anon);
 	UVMHIST_LOG(maphist,- done!,0,0,0,0);
+	return true;
 }
 
 /*
@@ -214,13 +214,22 @@
 void
 uvm_anon_freelst(struct vm_amap *amap, struct vm_anon *anonlst)
 {
-	struct vm_anon *anon = anonlst;
+	struct vm_anon *anon = anonlst, *prev = NULL, *next;
 
 	KASSERT(mutex_owned(amap-am_lock));
 
 	while (anon) {
-		uvm_anon_dispose(anon);
-		anon = anon-an_link;
+		next = anon-an_link;
+		if (!uvm_anon_dispose(anon)) {
+			/* Do not free this anon. */
+			if (prev) {
+prev-an_link = next;
+			} else {
+anonlst = next;
+			}
+		}
+		prev = anon;
+		anon = next;
 	}
 	amap_unlock(amap);
 



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

2011-08-13 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Aug 14 02:31:08 UTC 2011

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

Log Message:
Convert few panic() uses to asserts, reduce the scope of variable use.
No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.127 src/sys/arch/x86/x86/pmap.c:1.128
--- src/sys/arch/x86/x86/pmap.c:1.127	Tue Jul  5 14:07:12 2011
+++ src/sys/arch/x86/x86/pmap.c	Sun Aug 14 02:31:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.127 2011/07/05 14:07:12 yamt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.128 2011/08/14 02:31:08 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.127 2011/07/05 14:07:12 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.128 2011/08/14 02:31:08 rmind Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -1966,7 +1966,6 @@
 /*
  * pmap_pdp_ctor: constructor for the PDP cache.
  */
-
 int
 pmap_pdp_ctor(void *arg, void *v, int flags)
 {
@@ -2041,7 +2040,7 @@
 	object = (vaddr_t)v;
 	for (i = 0; i  PDP_SIZE; i++, object += PAGE_SIZE) {
 		(void) pmap_extract(pmap_kernel(), object, pdirpa);
-		/* remap this page RO */
+		/* FIXME: This should use pmap_protect() .. */
 		pmap_kenter_pa(object, pdirpa, VM_PROT_READ, 0);
 		pmap_update(pmap_kernel());
 		/*
@@ -3655,30 +3654,28 @@
 /* see pmap.h */
 
 /*
- * pmap_write_protect: write-protect pages in a pmap
+ * pmap_write_protect: write-protect pages in a pmap.
  */
-
 void
 pmap_write_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
 {
-	int i;
-	pt_entry_t *ptes, *epte;
-	pt_entry_t *spte;
-	pd_entry_t * const *pdes;
-	vaddr_t blockend, va;
-	pt_entry_t opte;
+	pt_entry_t *ptes;
+	pt_entry_t * const *pdes;
 	struct pmap *pmap2;
+	vaddr_t blockend, va;
 
 	KASSERT(curlwp-l_md.md_gc_pmap != pmap);
 
-	kpreempt_disable();
-	pmap_map_ptes(pmap, pmap2, ptes, pdes);	/* locks pmap */
-
-	/* should be ok, but just in case ... */
 	sva = PG_FRAME;
 	eva = PG_FRAME;
 
+	/* Acquire pmap. */
+	kpreempt_disable();
+	pmap_map_ptes(pmap, pmap2, ptes, pdes);
+
 	for (va = sva ; va  eva ; va = blockend) {
+		pt_entry_t *spte, *epte;
+		int i;
 
 		blockend = (va  L2_FRAME) + NBPD_L2;
 		if (blockend  eva)
@@ -3699,21 +3696,17 @@
 continue;
 		}
 
-		/* empty block? */
-		if (!pmap_pdes_valid(va, pdes, NULL))
+		/* Is it a valid block? */
+		if (!pmap_pdes_valid(va, pdes, NULL)) {
 			continue;
-
-#ifdef DIAGNOSTIC
-		if (va = VM_MAXUSER_ADDRESS 
-		va  VM_MAX_ADDRESS)
-			panic(pmap_write_protect: PTE space);
-#endif
+		}
+		KASSERT(va  VM_MAXUSER_ADDRESS || va = VM_MAX_ADDRESS);
 
 		spte = ptes[pl1_i(va)];
 		epte = ptes[pl1_i(blockend)];
 
 		for (/*null */; spte  epte ; spte++) {
-			pt_entry_t npte;
+			pt_entry_t opte, npte;
 
 			do {
 opte = *spte;
@@ -3722,10 +3715,9 @@
 }
 npte = opte  ~PG_RW;
 			} while (pmap_pte_cas(spte, opte, npte) != opte);
-			if ((opte  PG_M) != 0) {
-vaddr_t tva;
 
-tva = x86_ptob(spte - ptes);
+			if ((opte  PG_M) != 0) {
+vaddr_t tva = x86_ptob(spte - ptes);
 pmap_tlb_shootdown(pmap, tva, opte,
 TLBSHOOT_WRITE_PROTECT);
 			}
@@ -3733,57 +3725,47 @@
 		}
 	}
 
-	pmap_unmap_ptes(pmap, pmap2);	/* unlocks pmap */
+	/* Release pmap. */
+	pmap_unmap_ptes(pmap, pmap2);
 	kpreempt_enable();
 }
 
 /*
- * end of protection functions
- */
-
-/*
- * pmap_unwire: clear the wired bit in the PTE
+ * pmap_unwire: clear the wired bit in the PTE.
  *
- * = mapping should already be in map
+ * = Mapping should already be present.
  */
-
 void
 pmap_unwire(struct pmap *pmap, vaddr_t va)
 {
-	pt_entry_t *ptes;
+	pt_entry_t *ptes, *ptep, opte;
 	pd_entry_t * const *pdes;
 	struct pmap *pmap2;
 
+	/* Acquire pmap. */
 	kpreempt_disable();
-	pmap_map_ptes(pmap, pmap2, ptes, pdes);	/* locks pmap */
+	pmap_map_ptes(pmap, pmap2, ptes, pdes);
 
-	if (pmap_pdes_valid(va, pdes, NULL)) {
-		pt_entry_t *ptep = ptes[pl1_i(va)];
-		pt_entry_t opte = *ptep;
+	if (!pmap_pdes_valid(va, pdes, NULL)) {
+		panic(pmap_unwire: invalid PDE);
+	}
 
-#ifdef DIAGNOSTIC
-		if (!pmap_valid_entry(opte))
-			panic(pmap_unwire: invalid (unmapped) va 0x%lx, va);
-#endif
-		if ((opte  PG_W) != 0) {
-			pt_entry_t npte = opte  ~PG_W;
+	ptep = ptes[pl1_i(va)];
+	opte = *ptep;
+	KASSERT(pmap_valid_entry(opte));
 
-			opte = pmap_pte_testset(ptep, npte);
-			pmap_stats_update_bypte(pmap, npte, opte);
-		}
-#ifdef DIAGNOSTIC
-		else {
-			printf(pmap_unwire: wiring for pmap %p va 0x%lx 
-			   didn't change!\n, pmap, va);
-		}
-#endif
-		pmap_unmap_ptes(pmap, pmap2);		/* unlocks map */
-	}
-#ifdef DIAGNOSTIC
-	else {
-		panic(pmap_unwire: invalid PDE);
+	if (opte  PG_W) {
+