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

2010-06-04 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Jun  4 20:31:58 UTC 2010

Modified Files:
src/sys/arch/powerpc/include: ofw_bus.h

Log Message:
fix some cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/include/ofw_bus.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/powerpc/include/ofw_bus.h
diff -u src/sys/arch/powerpc/include/ofw_bus.h:1.3 src/sys/arch/powerpc/include/ofw_bus.h:1.4
--- src/sys/arch/powerpc/include/ofw_bus.h:1.3	Mon Apr 28 20:23:32 2008
+++ src/sys/arch/powerpc/include/ofw_bus.h	Fri Jun  4 20:31:58 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_bus.h,v 1.3 2008/04/28 20:23:32 martin Exp $ */
+/* $NetBSD: ofw_bus.h,v 1.4 2010/06/04 20:31:58 chs Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -29,8 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _POWERPC_OWFPPC_BUS_H_
-#define _POWERPC_OWFPPC_BUS_H_
+#ifndef _POWERPC_OFW_BUS_H_
+#define _POWERPC_OFW_BUS_H_
 
 #define RANGE_TYPE_PCI		1
 #define RANGE_TYPE_ISA		2
@@ -52,8 +52,7 @@
 void ofwoea_bus_space_init(void);
 void ofwoea_initppc(u_int, u_int, char *);
 void ofwoea_batinit(void);
-int ofwoea_map_space(int rangetype, int iomem, int node,
-struct powerpc_bus_space *tag, const char *name);
+int ofwoea_map_space(int, int, int, struct powerpc_bus_space *, const char *);
 #endif
 
-#endif /* _POWERPC_PREP_BUS_H_ */
+#endif /* _POWERPC_OFW_BUS_H_ */



CVS commit: src/sys/uvm

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:08:51 UTC 2010

Modified Files:
src/sys/uvm: uvm_stat.h

Log Message:
switch the UVMHIST counters from mutexes to atomic ops
to avoid a bad interaction with DIAGNOSTIC.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/uvm/uvm_stat.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/uvm/uvm_stat.h
diff -u src/sys/uvm/uvm_stat.h:1.46 src/sys/uvm/uvm_stat.h:1.47
--- src/sys/uvm/uvm_stat.h:1.46	Sat Feb  6 12:10:59 2010
+++ src/sys/uvm/uvm_stat.h	Wed Jul  7 01:08:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_stat.h,v 1.46 2010/02/06 12:10:59 uebayasi Exp $	*/
+/*	$NetBSD: uvm_stat.h,v 1.47 2010/07/07 01:08:51 chs Exp $	*/
 
 /*
  *
@@ -70,11 +70,9 @@
 	const char *name;		/* name of this history */
 	size_t namelen;			/* length of name, not including null */
 	LIST_ENTRY(uvm_history) list;	/* link on list of all histories */
-	int n;/* number of entries */
-	int f; /* next free one */
-	int unused;			/* old location of lock */
+	unsigned int n;			/* number of entries */
+	unsigned int f;			/* next free one */
 	struct uvm_history_ent *e;	/* the malloc'd entries */
-	kmutex_t l;			/* lock on this history */
 };
 
 LIST_HEAD(uvm_history_head, uvm_history);
@@ -110,6 +108,7 @@
 #define uvmhist_dump(NAME)
 #else
 #include sys/kernel.h		/* for cold variable */
+#include sys/atomic.h
 
 extern	struct uvm_history_head uvm_histories;
 
@@ -121,7 +120,6 @@
 	(NAME).namelen = strlen(__STRING(NAME)); \
 	(NAME).n = (N); \
 	(NAME).f = 0; \
-	mutex_init((NAME).l, MUTEX_SPIN, IPL_HIGH); \
 	(NAME).e = (struct uvm_history_ent *) \
 		malloc(sizeof(struct uvm_history_ent) * (N), M_TEMP, \
 		M_WAITOK); \
@@ -135,7 +133,6 @@
 	(NAME).namelen = strlen(__STRING(NAME)); \
 	(NAME).n = sizeof(BUF) / sizeof(struct uvm_history_ent); \
 	(NAME).f = 0; \
-	mutex_init((NAME).l, MUTEX_SPIN, IPL_HIGH); \
 	(NAME).e = (struct uvm_history_ent *) (BUF); \
 	memset((NAME).e, 0, sizeof(struct uvm_history_ent) * (NAME).n); \
 	LIST_INSERT_HEAD(uvm_histories, (NAME), list); \
@@ -156,11 +153,11 @@
 
 #define UVMHIST_LOG(NAME,FMT,A,B,C,D) \
 do { \
-	int _i_; \
-	mutex_enter((NAME).l); \
-	_i_ = (NAME).f; \
-	(NAME).f = (_i_ + 1  (NAME).n) ? _i_ + 1 : 0; \
-	mutex_exit((NAME).l); \
+	unsigned int _i_, _j_; \
+	do { \
+		_i_ = (NAME).f; \
+		_j_ = (_i_ + 1  (NAME).n) ? _i_ + 1 : 0; \
+	} while (atomic_cas_uint((NAME).f, _i_, _j_) != _i_); \
 	if (!cold) \
 		microtime((NAME).e[_i_].tv); \
 	(NAME).e[_i_].cpunum = cpu_number(); \
@@ -178,16 +175,12 @@
 
 #define UVMHIST_CALLED(NAME) \
 do { \
-	{ \
-		mutex_enter((NAME).l); \
-		_uvmhist_call = _uvmhist_cnt++; \
-		mutex_exit((NAME).l); \
-	} \
+	_uvmhist_call = atomic_inc_uint_nv(_uvmhist_cnt); \
 	UVMHIST_LOG(NAME,called!, 0, 0, 0, 0); \
 } while (/*CONSTCOND*/ 0)
 
 #define UVMHIST_FUNC(FNAME) \
-	static int _uvmhist_cnt = 0; \
+	static unsigned int _uvmhist_cnt = 0; \
 	static const char *const _uvmhist_name = FNAME; \
 	int _uvmhist_call;
 



CVS commit: src/sys/conf

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:09:39 UTC 2010

Modified Files:
src/sys/conf: files

Log Message:
COMPAT_LINUX32 requires COMPAT_LINUX.


To generate a diff of this commit:
cvs rdiff -u -r1.991 -r1.992 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.991 src/sys/conf/files:1.992
--- src/sys/conf/files:1.991	Sat Jun 26 15:17:56 2010
+++ src/sys/conf/files	Wed Jul  7 01:09:39 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.991 2010/06/26 15:17:56 kefren Exp $
+#	$NetBSD: files,v 1.992 2010/07/07 01:09:39 chs Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -140,7 +140,7 @@
 defflagCOMPAT_IBCS2
 defflagCOMPAT_IRIX
 defflagCOMPAT_LINUX: COMPAT_16
-defflagCOMPAT_LINUX32
+defflagCOMPAT_LINUX32 : COMPAT_LINUX
 defflagCOMPAT_OSF1
 defflagCOMPAT_SUNOS: COMPAT_30
 defflag	opt_compat_svr4.h	COMPAT_SVR4 COMPAT_SVR4_32 SVR4_COMPAT_SOLARIS2



CVS commit: src/sys/arch

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:14:53 UTC 2010

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S gdt.c genassym.cf locore.S
machdep.c netbsd32_machdep.c vector.S
src/sys/arch/amd64/include: frameasm.h gdt.h pcb.h segments.h
src/sys/arch/x86/include: cpufunc.h sysarch.h
src/sys/arch/x86/x86: pmap.c

Log Message:
add the guts of TLS support on amd64.  based on joerg's patch,
reworked by me to support 32-bit processes as well.
we now keep %fs and %gs loaded with the user values
while in the kernel, which means we don't need to
reload them when returning to user mode.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.145 -r1.146 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amd64/include/frameasm.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amd64/include/gdt.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/pcb.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amd64/include/segments.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/include/cpufunc.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/include/sysarch.h
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.16 src/sys/arch/amd64/amd64/cpufunc.S:1.17
--- src/sys/arch/amd64/amd64/cpufunc.S:1.16	Thu Oct  1 09:13:54 2009
+++ src/sys/arch/amd64/amd64/cpufunc.S	Wed Jul  7 01:14:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.16 2009/10/01 09:13:54 skrll Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.17 2010/07/07 01:14:52 chs Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,6 +34,7 @@
  */
 
 #include machine/asm.h
+#include machine/frameasm.h
 #include machine/specialreg.h
 #include machine/segments.h
 
@@ -513,3 +514,15 @@
 	rep
 	outsl
 	ret
+
+ENTRY(setfs)
+	movw	%di, %fs
+	ret
+
+ENTRY(setusergs)
+	CLI(ax)
+	swapgs
+	movw	%di, %gs
+	swapgs
+	STI(ax)
+	ret

Index: src/sys/arch/amd64/amd64/gdt.c
diff -u src/sys/arch/amd64/amd64/gdt.c:1.23 src/sys/arch/amd64/amd64/gdt.c:1.24
--- src/sys/arch/amd64/amd64/gdt.c:1.23	Sat Nov 21 03:11:01 2009
+++ src/sys/arch/amd64/amd64/gdt.c	Wed Jul  7 01:14:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.23 2009/11/21 03:11:01 rmind Exp $	*/
+/*	$NetBSD: gdt.c,v 1.24 2010/07/07 01:14:52 chs Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -37,10 +37,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gdt.c,v 1.23 2009/11/21 03:11:01 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdt.c,v 1.24 2010/07/07 01:14:52 chs Exp $);
 
 #include opt_multiprocessor.h
 #include opt_xen.h
+#include opt_user_ldt.h
 
 #include sys/param.h
 #include sys/systm.h
@@ -56,7 +57,6 @@
 #include xen/hypervisor.h
 #endif 
 
-
 int gdt_size;		/* size of GDT in bytes */
 int gdt_dyncount;	/* number of dyn. allocated GDT entries in use */
 int gdt_dynavail;
@@ -69,48 +69,45 @@
 void gdt_put_slot(int);
 
 void
-set_mem_gdt(struct mem_segment_descriptor *sd, void *base, size_t limit,
-	int type, int dpl, int gran, int def32, int is64)
+update_descriptor(void *tp, void *ep)
 {
-#if 0
-	CPU_INFO_ITERATOR cii;
-	struct cpu_info *ci;
-	int off;
-#endif
+	uint64_t *table, *entry;
 
-set_mem_segment(sd, base, limit, type, dpl, gran, def32, is64);
-#if 0
-	off = (char *)sd - gdtstore;
-for (CPU_INFO_FOREACH(cii, ci)) {
-if (ci-ci_gdt != NULL)
-			*(struct mem_segment_descriptor *)(ci-ci_gdt + off) =
-			*sd;
-}
+	table = tp;
+	entry = ep;
+
+#ifndef XEN
+	*table = *entry;
+#else
+	paddr_t pa;
+
+	if (!pmap_extract_ma(pmap_kernel(), (vaddr_t)table, pa) ||
+	HYPERVISOR_update_descriptor(pa, *entry))
+		panic(HYPERVISOR_update_descriptor failed\n);
 #endif
 }
 
 void
-set_sys_gdt(struct sys_segment_descriptor *sd, void *base, size_t limit,
+set_sys_gdt(int slot, void *base, size_t limit,
 	int type, int dpl, int gran)
 {
-#if 0
+	union {
+		struct sys_segment_descriptor sd;
+		uint64_t bits[2];
+	} d;
 	CPU_INFO_ITERATOR cii;
 	struct cpu_info *ci;
-	int off;
-#endif
+	int idx;
 
-set_sys_segment(sd, base, limit, type, dpl, gran);
-#if 0
-	off = (char *)sd - gdtstore;
+set_sys_segment(d.sd, base, limit, type, dpl, gran);
+	idx = IDXSEL(GDYNSEL(slot, SEL_KPL));
 for (CPU_INFO_FOREACH(cii, ci)) {
-if (ci-ci_gdt != NULL)
-			*(struct sys_segment_descriptor *)(ci-ci_gdt + off) =
-			*sd;
+

CVS commit: src/sys/arch

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:16:26 UTC 2010

Modified Files:
src/sys/arch/amiga/amiga: trap.c
src/sys/arch/atari/atari: trap.c
src/sys/arch/cesfic/cesfic: trap.c
src/sys/arch/hp300/hp300: trap.c
src/sys/arch/luna68k/luna68k: trap.c
src/sys/arch/m68k/include: m68k.h
src/sys/arch/m68k/m68k: copy.s m68k_machdep.c
src/sys/arch/mac68k/mac68k: trap.c
src/sys/arch/mvme68k/mvme68k: trap.c
src/sys/arch/news68k/news68k: trap.c
src/sys/arch/next68k/next68k: trap.c
src/sys/arch/sun2/sun2: trap.c
src/sys/arch/sun3/sun3: trap.c
src/sys/arch/x68k/x68k: trap.c

Log Message:
implement ucas_* for m68k.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/arch/amiga/amiga/trap.c
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/atari/atari/trap.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/cesfic/cesfic/trap.c
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/hp300/hp300/trap.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/luna68k/luna68k/trap.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/include/m68k.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/m68k/m68k/copy.s
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/m68k/m68k_machdep.c
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/mac68k/mac68k/trap.c
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/mvme68k/mvme68k/trap.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/news68k/news68k/trap.c
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/sun2/sun2/trap.c
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/sun3/sun3/trap.c
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/x68k/x68k/trap.c

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

Modified files:

Index: src/sys/arch/amiga/amiga/trap.c
diff -u src/sys/arch/amiga/amiga/trap.c:1.129 src/sys/arch/amiga/amiga/trap.c:1.130
--- src/sys/arch/amiga/amiga/trap.c:1.129	Sun Jun  6 04:50:05 2010
+++ src/sys/arch/amiga/amiga/trap.c	Wed Jul  7 01:16:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.129 2010/06/06 04:50:05 mrg Exp $	*/
+/*	$NetBSD: trap.c,v 1.130 2010/07/07 01:16:23 chs Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -84,7 +84,7 @@
 #include opt_m68k_arch.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.129 2010/06/06 04:50:05 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.130 2010/07/07 01:16:23 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -428,6 +428,10 @@
 		printf(vmfault %s %lx returned %d\n,
 		map == kernel_map ? kernel : user, va, rv);
 #endif
+	if (map == kernel_map  rv == 0  ucas_ras_check(fp-F_t)) {
+		return;
+	}
+
 #ifdef M68060
 	if ((machineid  AMIGA_68060) == 0  mmutype == MMU_68040) {
 #else

Index: src/sys/arch/atari/atari/trap.c
diff -u src/sys/arch/atari/atari/trap.c:1.107 src/sys/arch/atari/atari/trap.c:1.108
--- src/sys/arch/atari/atari/trap.c:1.107	Sun Jun  6 04:50:06 2010
+++ src/sys/arch/atari/atari/trap.c	Wed Jul  7 01:16:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.107 2010/06/06 04:50:06 mrg Exp $	*/
+/*	$NetBSD: trap.c,v 1.108 2010/07/07 01:16:23 chs Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.107 2010/06/06 04:50:06 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.108 2010/07/07 01:16:23 chs Exp $);
 
 #include opt_ddb.h
 #include opt_execfmt.h
@@ -672,6 +672,9 @@
 uvm_grow(p, va);
 
 			if (type == T_MMUFLT) {
+if (ucas_ras_check(fp-F_t)) {
+	return;
+}
 #ifdef M68040
 if (cputype == CPU_68040)
 	(void) writeback(fp, 1);

Index: src/sys/arch/cesfic/cesfic/trap.c
diff -u src/sys/arch/cesfic/cesfic/trap.c:1.51 src/sys/arch/cesfic/cesfic/trap.c:1.52
--- src/sys/arch/cesfic/cesfic/trap.c:1.51	Sun Jun  6 04:50:06 2010
+++ src/sys/arch/cesfic/cesfic/trap.c	Wed Jul  7 01:16:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.51 2010/06/06 04:50:06 mrg Exp $	*/
+/*	$NetBSD: trap.c,v 1.52 2010/07/07 01:16:24 chs Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.51 2010/06/06 04:50:06 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.52 2010/07/07 01:16:24 chs Exp $);
 
 #include opt_ddb.h
 #include opt_execfmt.h
@@ -628,6 +628,9 @@
 uvm_grow(p, va);
 
 			if (type == T_MMUFLT) {
+if (ucas_ras_check(fp-F_t)) {
+	return;
+}
 #ifdef M68040
 if (cputype == CPU_68040)
 	(void) writeback(fp, 1);

Index: src/sys/arch/hp300/hp300/trap.c
diff -u src/sys/arch/hp300/hp300/trap.c:1.143 src/sys/arch/hp300/hp300/trap.c:1.144
--- src/sys/arch/hp300/hp300/trap.c:1.143	Sun Jun  6 04:50:06 2010
+++ src/sys/arch/hp300/hp300/trap.c	Wed Jul  7 01:16:24 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.143 2010/06/06 04:50:06 mrg Exp $	*/
+/*	

CVS commit: src/sys/arch/alpha/alpha

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:17:49 UTC 2010

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

Log Message:
implement ucas_* for alpha.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/alpha/alpha/locore.s

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

Modified files:

Index: src/sys/arch/alpha/alpha/locore.s
diff -u src/sys/arch/alpha/alpha/locore.s:1.119 src/sys/arch/alpha/alpha/locore.s:1.120
--- src/sys/arch/alpha/alpha/locore.s:1.119	Thu Feb 25 07:14:48 2010
+++ src/sys/arch/alpha/alpha/locore.s	Wed Jul  7 01:17:49 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.119 2010/02/25 07:14:48 skrll Exp $ */
+/* $NetBSD: locore.s,v 1.120 2010/07/07 01:17:49 chs Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include machine/asm.h
 
-__KERNEL_RCSID(0, $NetBSD: locore.s,v 1.119 2010/02/25 07:14:48 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: locore.s,v 1.120 2010/07/07 01:17:49 chs Exp $);
 
 #include assym.h
 
@@ -1276,6 +1276,104 @@
 	RET
 	END(fswberr)
 
+/*
+ * int ucas_32(volatile int32_t *uptr, int32_t old, int32_t new, int32_t *ret);
+ */
+
+NESTED(ucas_32, 4, 16, ra, IM_S0 | IM_RA, 0)
+	LDGP(pv)
+	lda	sp, -16(sp)			/* set up stack frame	 */
+	stq	ra, (16-8)(sp)			/* save ra		 */
+	stq	s0, (16-16)(sp)			/* save s0		 */
+	ldiq	t0, VM_MAX_ADDRESS		/* make sure that src addr   */
+	cmpult	a0, t0, t1			/* is in user space.	 */
+	beq	t1, copyerr_efault		/* if it's not, error out.   */
+	and	a0, 3, t1			/* check if addr is aligned. */
+	bne	t1, copyerr_efault		/* if it's not, error out.   */
+	/* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
+	GET_CURLWP
+	ldq	s0, 0(v0)			/* s0 = curlwp		 */
+	lda	v0, copyerr			/* set up fault handler. */
+	.set noat
+	ldq	at_reg, L_PCB(s0)
+	stq	v0, PCB_ONFAULT(at_reg)
+	.set at
+
+3:
+	ldl_l	t0, 0(a0)			/* t0 = *uptr */
+	cmpeq	t0, a1, t1			/* does t0 = old? */
+	beq	t1, 1f/* if not, skip */
+	mov	a2, t1
+	stl_c	t1, 0(a0)			/* *uptr ~= new */
+	beq	t1, 2f/* did it work? */
+1:
+	stl	t0, 0(a3)			/* *ret = t0 */
+	mov	zero, v0
+
+	.set noat
+	ldq	at_reg, L_PCB(s0)		/* kill the fault handler.   */
+	stq	zero, PCB_ONFAULT(at_reg)
+	.set at
+	ldq	ra, (16-8)(sp)			/* restore ra.		 */
+	ldq	s0, (16-16)(sp)			/* restore s0.		 */
+	lda	sp, 16(sp)			/* kill stack frame.	 */
+	RET	/* v0 left over from copystr */
+
+2:
+	br	3b
+END(ucas_32)
+
+STRONG_ALIAS(ucas_int,ucas_32)
+
+/*
+ * int ucas_64(volatile int64_t *uptr, int64_t old, int64_t new, int64_t *ret);
+ */
+
+NESTED(ucas_64, 4, 16, ra, IM_S0 | IM_RA, 0)
+	LDGP(pv)
+	lda	sp, -16(sp)			/* set up stack frame	 */
+	stq	ra, (16-8)(sp)			/* save ra		 */
+	stq	s0, (16-16)(sp)			/* save s0		 */
+	ldiq	t0, VM_MAX_ADDRESS		/* make sure that src addr   */
+	cmpult	a0, t0, t1			/* is in user space.	 */
+	beq	t1, copyerr_efault		/* if it's not, error out.   */
+	and	a0, 3, t1			/* check if addr is aligned. */
+	bne	t1, copyerr_efault		/* if it's not, error out.   */
+	/* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
+	GET_CURLWP
+	ldq	s0, 0(v0)			/* s0 = curlwp		 */
+	lda	v0, copyerr			/* set up fault handler. */
+	.set noat
+	ldq	at_reg, L_PCB(s0)
+	stq	v0, PCB_ONFAULT(at_reg)
+	.set at
+
+3:
+	ldq_l	t0, 0(a0)			/* t0 = *uptr */
+	cmpeq	t0, a1, t1			/* does t0 = old? */
+	beq	t1, 1f/* if not, skip */
+	mov	a2, t1
+	stq_c	t1, 0(a0)			/* *uptr ~= new */
+	beq	t1, 2f/* did it work? */
+1:
+	stq	t0, 0(a3)			/* *ret = t0 */
+	mov	zero, v0
+
+	.set noat
+	ldq	at_reg, L_PCB(s0)		/* kill the fault handler.   */
+	stq	zero, PCB_ONFAULT(at_reg)
+	.set at
+	ldq	ra, (16-8)(sp)			/* restore ra.		 */
+	ldq	s0, (16-16)(sp)			/* restore s0.		 */
+	lda	sp, 16(sp)			/* kill stack frame.	 */
+	RET	/* v0 left over from copystr */
+
+2:
+	br	3b
+END(ucas_64)
+
+STRONG_ALIAS(ucas_ptr,ucas_64)
+
 /**/
 
 /*



CVS commit: src/sys/arch/powerpc/powerpc

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:19:54 UTC 2010

Modified Files:
src/sys/arch/powerpc/powerpc: locore_subr.S trap.c

Log Message:
implement ucas_* for powerpc/oea.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/powerpc/powerpc/locore_subr.S
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/powerpc/powerpc/trap.c

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

Modified files:

Index: src/sys/arch/powerpc/powerpc/locore_subr.S
diff -u src/sys/arch/powerpc/powerpc/locore_subr.S:1.39 src/sys/arch/powerpc/powerpc/locore_subr.S:1.40
--- src/sys/arch/powerpc/powerpc/locore_subr.S:1.39	Thu Dec 10 05:10:03 2009
+++ src/sys/arch/powerpc/powerpc/locore_subr.S	Wed Jul  7 01:19:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_subr.S,v 1.39 2009/12/10 05:10:03 rmind Exp $	*/
+/*	$NetBSD: locore_subr.S,v 1.40 2010/07/07 01:19:54 chs Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -340,3 +340,19 @@
 	b	_C_LABEL(idle_loop)
 
 #endif /*MULTIPROCESSOR + OEA*/
+
+/*
+ * int do_ucas_32(int32_t *uptr, int32_t old, int32_t new, int32_t *ret);
+ */	
+ENTRY(do_ucas_32)
+1:
+	lwarx	%r10,0,%r3
+	cmpw	%r10, %r4
+	bne	2f
+	stwcx.	%r5,0,%r3
+	bne	1b
+	mr	%r5,%r10
+2:
+	li	%r3,0
+	stw	%r10,0(%r6)
+	blr

Index: src/sys/arch/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.135 src/sys/arch/powerpc/powerpc/trap.c:1.136
--- src/sys/arch/powerpc/powerpc/trap.c:1.135	Fri Apr 23 19:18:10 2010
+++ src/sys/arch/powerpc/powerpc/trap.c	Wed Jul  7 01:19:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.135 2010/04/23 19:18:10 rmind Exp $	*/
+/*	$NetBSD: trap.c,v 1.136 2010/07/07 01:19:54 chs Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.135 2010/04/23 19:18:10 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.136 2010/07/07 01:19:54 chs Exp $);
 
 #include opt_altivec.h
 #include opt_ddb.h
@@ -72,6 +72,9 @@
 static inline vaddr_t setusr(vaddr_t, size_t *);
 static inline void unsetusr(void);
 
+extern int do_ucas_32(volatile int32_t *, int32_t, int32_t, int32_t *);
+int ucas_32(volatile int32_t *, int32_t, int32_t, int32_t *);
+
 void trap(struct trapframe *);	/* Called from locore / trap_subr */
 /* Why are these not defined in a header? */
 int badaddr(void *, size_t);
@@ -623,6 +626,34 @@
 }
 
 int
+ucas_32(volatile int32_t *uptr, int32_t old, int32_t new, int32_t *ret)
+{
+	vaddr_t uva = (vaddr_t)uptr;
+	vaddr_t p;
+	struct faultbuf env;
+	size_t seglen;
+	int rv;
+
+	if (uva  3) {
+		return EFAULT;
+	}
+	if ((rv = setfault(env)) != 0) {
+		unsetusr();
+		goto out;
+	}
+	p = setusr(uva, seglen);
+	KASSERT(seglen = sizeof(*uptr));
+	do_ucas_32((void *)p, old, new, ret);
+	unsetusr();
+
+out:
+	curpcb-pcb_onfault = 0;
+	return rv;
+}
+__strong_alias(ucas_ptr,ucas_32);
+__strong_alias(ucas_int,ucas_32);
+
+int
 badaddr(void *addr, size_t size)
 {
 	return badaddr_read(addr, size, NULL);



CVS commit: src/sys/arch

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:20:50 UTC 2010

Modified Files:
src/sys/arch/alpha/alpha: sys_machdep.c
src/sys/arch/alpha/include: types.h
src/sys/arch/arm/arm32: sys_machdep.c
src/sys/arch/arm/include/arm32: types.h
src/sys/arch/powerpc/include: types.h
src/sys/arch/powerpc/powerpc: sys_machdep.c
src/sys/arch/x86/x86: sys_machdep.c vm_machdep.c

Log Message:
implement cpu_lwp_setprivate() on several platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/alpha/sys_machdep.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/include/types.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/arm32/sys_machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/include/arm32/types.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/include/types.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/powerpc/sys_machdep.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/x86/x86/sys_machdep.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/x86/vm_machdep.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/sys_machdep.c
diff -u src/sys/arch/alpha/alpha/sys_machdep.c:1.18 src/sys/arch/alpha/alpha/sys_machdep.c:1.19
--- src/sys/arch/alpha/alpha/sys_machdep.c:1.18	Mon Apr 28 20:23:10 2008
+++ src/sys/arch/alpha/alpha/sys_machdep.c	Wed Jul  7 01:20:49 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_machdep.c,v 1.18 2008/04/28 20:23:10 martin Exp $ */
+/* $NetBSD: sys_machdep.c,v 1.19 2010/07/07 01:20:49 chs Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -58,12 +58,13 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: sys_machdep.c,v 1.18 2008/04/28 20:23:10 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_machdep.c,v 1.19 2010/07/07 01:20:49 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/device.h
 #include sys/proc.h
+#include sys/cpu.h
 
 #include sys/mount.h
 #include sys/syscallargs.h
@@ -229,3 +230,13 @@
 
 	return (error);
 }
+
+int
+cpu_lwp_setprivate(lwp_t *l, void *addr)
+{
+	struct pcb *pcb;
+
+	pcb = lwp_getpcb(l);
+	pcb-pcb_hw.apcb_unique = (unsigned long)addr;
+	return 0;
+}

Index: src/sys/arch/alpha/include/types.h
diff -u src/sys/arch/alpha/include/types.h:1.42 src/sys/arch/alpha/include/types.h:1.43
--- src/sys/arch/alpha/include/types.h:1.42	Fri Dec 11 05:52:03 2009
+++ src/sys/arch/alpha/include/types.h	Wed Jul  7 01:20:49 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.42 2009/12/11 05:52:03 matt Exp $ */
+/* $NetBSD: types.h,v 1.43 2010/07/07 01:20:49 chs Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -75,6 +75,7 @@
 #define	__HAVE_MINIMAL_EMUL
 #define	__HAVE_AST_PERPROC
 #define	__HAVE_ATOMIC64_OPS
+#define	__HAVE_CPU_LWP_SETPRIVATE
 
 #if defined(_KERNEL)
 #define	__HAVE_RAS

Index: src/sys/arch/arm/arm32/sys_machdep.c
diff -u src/sys/arch/arm/arm32/sys_machdep.c:1.10 src/sys/arch/arm/arm32/sys_machdep.c:1.11
--- src/sys/arch/arm/arm32/sys_machdep.c:1.10	Sun Apr 27 18:58:44 2008
+++ src/sys/arch/arm/arm32/sys_machdep.c	Wed Jul  7 01:20:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_machdep.c,v 1.10 2008/04/27 18:58:44 matt Exp $	*/
+/*	$NetBSD: sys_machdep.c,v 1.11 2010/07/07 01:20:49 chs Exp $	*/
 
 /*
  * Copyright (c) 1995-1997 Mark Brinicombe.
@@ -41,13 +41,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_machdep.c,v 1.10 2008/04/27 18:58:44 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_machdep.c,v 1.11 2010/07/07 01:20:49 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/proc.h
 #include sys/mbuf.h
 #include sys/mount.h
+#include sys/cpu.h
 #include uvm/uvm_extern.h
 #include sys/sysctl.h
 #include sys/syscallargs.h
@@ -110,4 +111,20 @@
 	return (error);
 }
   
-/* End of sys_machdep.c */
+int
+cpu_lwp_setprivate(lwp_t *l, void *addr)
+{
+#ifdef _ARM_ARCH_6
+	struct pcb *pcb;
+
+	pcb = lwp_getpcb(l);
+	kpreempt_disable();
+	pcb-pcb_un.un_32.pcb32_user_pid_ro = (u_int)addr;
+	if (l == curlwp)
+		__asm(mcr p15, 0, %0, c13, c0, 3 : : r (addr));
+	kpreempt_enable();
+	return 0;
+#else
+	return ENOSYS;
+#endif
+}

Index: src/sys/arch/arm/include/arm32/types.h
diff -u src/sys/arch/arm/include/arm32/types.h:1.8 src/sys/arch/arm/include/arm32/types.h:1.9
--- src/sys/arch/arm/include/arm32/types.h:1.8	Wed May 21 18:04:43 2003
+++ src/sys/arch/arm/include/arm32/types.h	Wed Jul  7 01:20:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.8 2003/05/21 18:04:43 thorpej Exp $	*/
+/*	$NetBSD: types.h,v 1.9 2010/07/07 01:20:50 chs Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -48,4 +48,6 @@
 
 #include arm/types.h		/* pull in generic ARM definitions */
 
+#define	__HAVE_CPU_LWP_SETPRIVATE
+
 #endif /* _ARM_ARM32_TYPES_H_ */

Index: src/sys/arch/powerpc/include/types.h
diff -u src/sys/arch/powerpc/include/types.h:1.34 src/sys/arch/powerpc/include/types.h:1.35
--- 

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

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:21:15 UTC 2010

Modified Files:
src/sys/arch/i386/i386: copy.S

Log Message:
return the error from fault handler in ucas_fault
rather than forcing EFAULT.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/i386/copy.S

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

Modified files:

Index: src/sys/arch/i386/i386/copy.S
diff -u src/sys/arch/i386/i386/copy.S:1.21 src/sys/arch/i386/i386/copy.S:1.22
--- src/sys/arch/i386/i386/copy.S:1.21	Fri Nov 27 03:23:10 2009
+++ src/sys/arch/i386/i386/copy.S	Wed Jul  7 01:21:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.21 2009/11/27 03:23:10 rmind Exp $	*/
+/*	$NetBSD: copy.S,v 1.22 2010/07/07 01:21:15 chs Exp $	*/
 /*	NetBSD: locore.S,v 1.34 2005/04/01 11:59:31 yamt Exp $	*/
 
 /*-
@@ -65,7 +65,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: copy.S,v 1.21 2009/11/27 03:23:10 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: copy.S,v 1.22 2010/07/07 01:21:15 chs Exp $);
 
 #include assym.h
 
@@ -98,8 +98,7 @@
  * Label must be before all copy functions.
  */
 	.text
-
-x86_copyfunc_start:	.globl	x86_copyfunc_start
+LABEL(x86_copyfunc_start)
 
 /*
  * Handle deferred pmap switch.  We must re-enable preemption without
@@ -686,7 +685,7 @@
 	movl	12(%esp), %ecx
 	/* Fail if kernel-space */
 	cmpl	$VM_MAXUSER_ADDRESS-4, %edx
-	ja	_C_LABEL(ucas_fault)
+	ja	_C_LABEL(ucas_efault)
 	/* Label for fault handler */
 .Lucas32_start:
 	/* Perform the CAS */
@@ -703,16 +702,14 @@
 	ret
 	DEFERRED_SWITCH_CALL
 
-/*
- * Fault handler for ucas_32().
- * Unset the handler and return the failure.
- */
+NENTRY(ucas_efault)
+	mov	$EFAULT, %eax
 NENTRY(ucas_fault)
-	movl	$EFAULT, %eax
 	ret
 
 /*
  * int	ucas_int(volatile int *uptr, int old, int new, int *ret);
+ * int	ucas_ptr(volatile void **uptr, void *old, void *new, void **ret);
  */
 STRONG_ALIAS(ucas_ptr, ucas_32)
 STRONG_ALIAS(ucas_int, ucas_32)
@@ -782,7 +779,7 @@
 /*
  * Label must be after all copy functions.
  */
-x86_copyfunc_end:	.globl	x86_copyfunc_end
+LABEL(x86_copyfunc_end)
 
 /*
  * Fault table of copy functions for trap().



CVS commit: src/sys/arch/mips/mips

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:21:47 UTC 2010

Modified Files:
src/sys/arch/mips/mips: copy.S

Log Message:
set error return value for user addresses in kernel space.
(this fixes a bug in my previous checkin here.)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/mips/copy.S

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

Modified files:

Index: src/sys/arch/mips/mips/copy.S
diff -u src/sys/arch/mips/mips/copy.S:1.9 src/sys/arch/mips/mips/copy.S:1.10
--- src/sys/arch/mips/mips/copy.S:1.9	Sat Mar 20 23:31:29 2010
+++ src/sys/arch/mips/mips/copy.S	Wed Jul  7 01:21:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: copy.S,v 1.9 2010/03/20 23:31:29 chs Exp $	*/
+/*	$NetBSD: copy.S,v 1.10 2010/07/07 01:21:47 chs Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -100,7 +100,7 @@
 LEAF(copyinstr)
 	PTR_L	v1, L_PCB(MIPS_CURLWP)
 	PTR_LA	v0, _C_LABEL(copystrerr)
-	blt	a0, zero, _C_LABEL(copystrerr)
+	blt	a0, zero, _C_LABEL(copystrefault)
 	 PTR_S	v0, PCB_ONFAULT(v1)
 	move	t0, a2
 	beq	a2, zero, 4f
@@ -134,7 +134,7 @@
 LEAF(copyoutstr)
 	PTR_L	v1, L_PCB(MIPS_CURLWP)
 	PTR_LA	v0, _C_LABEL(copystrerr)
-	blt	a1, zero, _C_LABEL(copystrerr)
+	blt	a1, zero, _C_LABEL(copystrefault)
 	 PTR_S	v0, PCB_ONFAULT(v1)
 	move	t0, a2
 	beq	a2, zero, 4f
@@ -163,6 +163,11 @@
 	 PTR_S	zero, PCB_ONFAULT(v1)
 END(copystrerr)
 
+LEAF(copystrefault)
+	b	copystrerr
+	 li	v0, EFAULT
+END(copystrefault)
+
 /*
  * kcopy(const void *src, void *dst, size_t len);
  *
@@ -216,7 +221,7 @@
 	PTR_SUBU sp, sp, CALLFRAME_SIZ
 	.mask	0x8000, -4
 	REG_S	ra, CALLFRAME_RA(sp)
-	 blt	a0, zero, _C_LABEL(copyerr)
+	 blt	a0, zero, _C_LABEL(copyefault)
 	move	v0, a0# swap a0, a1 for call to memcpy
 	move	a0, a1
 	move	a1, v0
@@ -243,7 +248,7 @@
 	PTR_SUBU sp, sp, CALLFRAME_SIZ
 	.mask	0x8000, -4
 	REG_S	ra, CALLFRAME_RA(sp)
-	blt	a1, zero, _C_LABEL(copyerr)
+	blt	a1, zero, _C_LABEL(copyefault)
 	move	v0, a0# swap a0, a1 for call to memcpy
 	move	a0, a1
 	move	a1, v0
@@ -268,6 +273,11 @@
 	 PTR_S	zero, PCB_ONFAULT(v1)
 END(copyerr)
 
+LEAF(copyefault)
+	b	copyerr
+	 li	v0, EFAULT
+END(copyefault)
+
 /*
  * int fuswintr(void *)
  * Fetches a short word of data from the user-space address.



CVS commit: src/sys/arch/mips/mips

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:22:12 UTC 2010

Modified Files:
src/sys/arch/mips/mips: db_interface.c

Log Message:
fix db_{read,write}_bytes() for unaligned addresses
(just copy a byte at a time, this isn't a performance path).


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/mips/mips/db_interface.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/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.66 src/sys/arch/mips/mips/db_interface.c:1.67
--- src/sys/arch/mips/mips/db_interface.c:1.66	Mon Dec 14 00:46:06 2009
+++ src/sys/arch/mips/mips/db_interface.c	Wed Jul  7 01:22:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.66 2009/12/14 00:46:06 matt Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.67 2010/07/07 01:22:12 chs Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.66 2009/12/14 00:46:06 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_interface.c,v 1.67 2010/07/07 01:22:12 chs Exp $);
 
 #include opt_cputype.h	/* which mips CPUs do we support? */
 #include opt_ddb.h
@@ -72,11 +72,6 @@
 void db_mtcr_cmd(db_expr_t, bool, db_expr_t, const char *);
 #endif
 
-static void	kdbpoke_4(vaddr_t addr, int newval);
-static void	kdbpoke_2(vaddr_t addr, short newval);
-static void	kdbpoke_1(vaddr_t addr, char newval);
-static short	kdbpeek_2(vaddr_t addr);
-static char	kdbpeek_1(vaddr_t addr);
 vaddr_t		MachEmulateBranch(struct frame *, vaddr_t, unsigned, int);
 
 paddr_t kvtophys(vaddr_t);
@@ -92,63 +87,6 @@
 }
 #endif
 
-static short
-kdbpeek_2(vaddr_t addr)
-{
-
-	return *(short *)addr;
-}
-
-static char
-kdbpeek_1(vaddr_t addr)
-{
-
-	return *(char *)addr;
-}
-
-/*
- * kdbpoke -- write a value to a kernel virtual address.
- *XXX should handle KSEG2 addresses and check for unmapped pages.
- *XXX user-space addresess?
- */
-static void
-kdbpoke_4(vaddr_t addr, int newval)
-{
-
-	*(int*) addr = newval;
-	wbflush();
-}
-
-static void
-kdbpoke_2(vaddr_t addr, short newval)
-{
-
-	*(short*) addr = newval;
-	wbflush();
-}
-
-static void
-kdbpoke_1(vaddr_t addr, char newval)
-{
-	*(char*) addr = newval;
-	wbflush();
-}
-
-#if 0 /* UNUSED */
-/*
- * Received keyboard interrupt sequence.
- */
-void
-kdb_kbd_trap(int *tf)
-{
-
-	if (db_active == 0  (boothowto  RB_KDB)) {
-		printf(\n\nkernel: keyboard interrupt\n);
-		ddb_trap(-1, tf);
-	}
-}
-#endif
-
 #ifndef KGDB
 int
 kdb_trap(int type, mips_reg_t /* struct trapframe */ *tfp)
@@ -283,15 +221,10 @@
 void
 db_read_bytes(vaddr_t addr, size_t size, char *data)
 {
-	int *ip;
-	short *sp;
+	char *src = (char *)addr;
 
-	while (size = 4)
-		ip = (int*)data, *ip = kdbpeek(addr), data += 4, addr += 4, size -= 4;
-	while (size = 2)
-		sp = (short *)data, *sp = kdbpeek_2(addr), data += 2, addr += 2, size -= 2;
-	if (size == 1)
-		*data = kdbpeek_1(addr);
+	while (size--)
+		*data++ = *src++;
 }
 
 /*
@@ -300,31 +233,14 @@
 void
 db_write_bytes(vaddr_t addr, size_t size, const char *data)
 {
-	vaddr_t p = addr;
+	char *p = (char *)addr;
 	size_t n = size;
 
-#ifdef DEBUG_DDB
-	printf(db_write_bytes(%lx, %d, %p, val %x)\n, addr, size, data,
-	   	(addr 3 ) == 0? *(u_int*)addr: -1);
-#endif
+	while (n--)
+		*p++ = *data++;
 
-	while (n = 4) {
-		kdbpoke_4(p, *(const int *)data);
-		p += 4;
-		data += 4;
-		n -= 4;
-	}
-	if (n = 2) {
-		kdbpoke_2(p, *(const short *)data);
-		p += 2;
-		data += 2;
-		n -= 2;
-	}
-	if (n == 1) {
-		kdbpoke_1(p, *(const char *)data);
-	}
-
-	mips_icache_sync_range((vaddr_t) addr, size);
+	wbflush();
+	mips_icache_sync_range(addr, size);
 }
 
 #ifndef KGDB



CVS commit: src/sys/arch/mips/mips

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:22:35 UTC 2010

Modified Files:
src/sys/arch/mips/mips: db_trace.c

Log Message:
add trace/a to trace by LWP address.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/mips/mips/db_trace.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/mips/mips/db_trace.c
diff -u src/sys/arch/mips/mips/db_trace.c:1.39 src/sys/arch/mips/mips/db_trace.c:1.40
--- src/sys/arch/mips/mips/db_trace.c:1.39	Thu Jul  1 02:38:27 2010
+++ src/sys/arch/mips/mips/db_trace.c	Wed Jul  7 01:22:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.39 2010/07/01 02:38:27 rmind Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.40 2010/07/07 01:22:35 chs Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_trace.c,v 1.39 2010/07/01 02:38:27 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_trace.c,v 1.40 2010/07/07 01:22:35 chs Exp $);
 
 #include opt_ddb.h
 
@@ -143,6 +143,9 @@
 	struct pcb *pcb;
 	struct proc *p;
 	struct lwp *l;
+	const char *cp = modif;
+	char c;
+	bool lwpaddr = false;
 
 	if (!have_addr) {
 		stacktrace_subr(ddb_regs.f_regs[_R_A0],
@@ -158,14 +161,26 @@
 		return;
 	}
 
-	/* trace/t */
-	(*pr)(pid %d , (int)addr);
-	p = proc_find_raw(addr);
-	if (p == NULL) {
-		(*pr)(not found\n);
-		return;
-	}	
-	l = LIST_FIRST(p-p_lwps); /* XXX NJWLWP */
+	while ((c = *cp++) != 0) {
+		if (c == 'a') {
+			lwpaddr = true;
+		}
+	}
+
+	if (lwpaddr) {
+		l = (struct lwp *)addr;
+		(*pr)(pid %d.%d , l-l_proc-p_pid, l-l_lid);
+	} else {
+		/* trace/t */
+
+		(*pr)(pid %d , (int)addr);
+		p = proc_find_raw(addr);
+		if (p == NULL) {
+			(*pr)(not found\n);
+			return;
+		}	
+		l = LIST_FIRST(p-p_lwps); /* XXX NJWLWP */
+	}
 	pcb = lwp_getpcb(l);
 	(*pr)(at %p\n, pcb);
 



CVS commit: src/sys/arch

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:23:08 UTC 2010

Modified Files:
src/sys/arch/m68k/m68k: switch_subr.s
src/sys/arch/sun3/sun3: genassym.cf
src/sys/arch/sun3/sun3x: genassym.cf

Log Message:
enable usermode RAS for sun[23] also.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/m68k/m68k/switch_subr.s
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sun3/sun3/genassym.cf
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sun3/sun3x/genassym.cf

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/m68k/m68k/switch_subr.s
diff -u src/sys/arch/m68k/m68k/switch_subr.s:1.24 src/sys/arch/m68k/m68k/switch_subr.s:1.25
--- src/sys/arch/m68k/m68k/switch_subr.s:1.24	Sun Jun  6 04:50:07 2010
+++ src/sys/arch/m68k/m68k/switch_subr.s	Wed Jul  7 01:23:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: switch_subr.s,v 1.24 2010/06/06 04:50:07 mrg Exp $	*/
+/*	$NetBSD: switch_subr.s,v 1.25 2010/07/07 01:23:08 chs Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation.
@@ -191,6 +191,7 @@
 	tstl	%a2			| vm == VM_MAP_NULL?
 	jeq	Lcpu_switch_badsw	| panic
 #endif
+	pea	%a0@			| save newlwp
 #if !defined(_SUN3X_) || defined(PMAP_DEBUG)
 	movl	%a2@(VM_PMAP),%...@-	| push vm-vm_map.pmap
 	jbsr	_C_LABEL(_pmap_switch)	| _pmap_switch(pmap)
@@ -220,6 +221,9 @@
 	 */
 	pea	%a0@			| push newlwp
 	jbsr	_C_LABEL(pmap_activate)	| pmap_activate(newlwp)
+	/* Note that newlwp will be popped off the stack later. */
+#endif
+
 	/*
 	 *  Check for restartable atomic sequences (RAS)
 	 */
@@ -237,11 +241,10 @@
 	jeq	1f
 	movl	_C_LABEL(curlwp),%a1
 	movl	%a1@(L_MD_REGS),%a1
-	movel	%a0,%a1@(TF_PC)
+	movl	%a0,%a1@(TF_PC)
 1:
 	movl	%...@+,%d0		| restore newlwp
 	movl	_C_LABEL(curpcb),%a1	| restore pcb
-#endif
 
 	movl	%sp@(4),%d1		| restore oldlwp for a return value
 	lea _ASM_LABEL(tmpstk),%sp	| now goto a tmp stack for NMI
@@ -410,5 +413,3 @@
 	moveml	%...@+,#0x7FFF		| restore most user regs
 	addql	#8,%sp			| toss SP and stack adjust
 	jra	_ASM_LABEL(rei)		| and return
-
-

Index: src/sys/arch/sun3/sun3/genassym.cf
diff -u src/sys/arch/sun3/sun3/genassym.cf:1.12 src/sys/arch/sun3/sun3/genassym.cf:1.13
--- src/sys/arch/sun3/sun3/genassym.cf:1.12	Thu Dec 10 05:10:04 2009
+++ src/sys/arch/sun3/sun3/genassym.cf	Wed Jul  7 01:23:08 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.12 2009/12/10 05:10:04 rmind Exp $
+#	$NetBSD: genassym.cf,v 1.13 2010/07/07 01:23:08 chs Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -162,6 +162,7 @@
 define	L_MD_REGS		offsetof(struct lwp, l_md.md_regs)
 define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
 define	P_FLAG			offsetof(struct proc, p_flag)
+define	P_RASLIST		offsetof(struct proc, p_raslist)
 define	P_VMSPACE		offsetof(struct proc, p_vmspace)
 
 # lwp fields and values
@@ -187,6 +188,9 @@
 define	PCB_FPCTX		offsetof(struct pcb, pcb_fpregs)
 define	SIZEOF_PCB		sizeof(struct pcb)
 
+# frame offsets
+define 	TF_PC			offsetof(struct frame, f_pc)
+
 # exception frame offset/sizes
 define	FR_SP			offsetof(struct trapframe, tf_regs[15])
 define	FR_ADJ			offsetof(struct trapframe, tf_stackadj)

Index: src/sys/arch/sun3/sun3x/genassym.cf
diff -u src/sys/arch/sun3/sun3x/genassym.cf:1.11 src/sys/arch/sun3/sun3x/genassym.cf:1.12
--- src/sys/arch/sun3/sun3x/genassym.cf:1.11	Thu Dec 10 05:10:04 2009
+++ src/sys/arch/sun3/sun3x/genassym.cf	Wed Jul  7 01:23:08 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.11 2009/12/10 05:10:04 rmind Exp $
+#	$NetBSD: genassym.cf,v 1.12 2010/07/07 01:23:08 chs Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -153,6 +153,7 @@
 define	L_MD_REGS		offsetof(struct lwp, l_md.md_regs)
 define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
 define	P_FLAG			offsetof(struct proc, p_flag)
+define	P_RASLIST		offsetof(struct proc, p_raslist)
 define	P_VMSPACE		offsetof(struct proc, p_vmspace)
 
 # lwp fields and values
@@ -177,6 +178,9 @@
 define	PCB_FPCTX		offsetof(struct pcb, pcb_fpregs)
 define	SIZEOF_PCB		sizeof(struct pcb)
 
+# frame offsets
+define 	TF_PC			offsetof(struct frame, f_pc)
+
 # exception frame offset/sizes
 define	FR_SP			offsetof(struct trapframe, tf_regs[15])
 define	FR_ADJ			offsetof(struct trapframe, tf_stackadj)



CVS commit: src/sys/arch/mips

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:23:42 UTC 2010

Modified Files:
src/sys/arch/mips/include: mips_opcode.h
src/sys/arch/mips/mips: mips_emul.c

Log Message:
implement emulation of the rdhwr instruction for mips TLS.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/include/mips_opcode.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/mips/mips_emul.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/mips/include/mips_opcode.h
diff -u src/sys/arch/mips/include/mips_opcode.h:1.13 src/sys/arch/mips/include/mips_opcode.h:1.14
--- src/sys/arch/mips/include/mips_opcode.h:1.13	Thu Aug  6 04:34:50 2009
+++ src/sys/arch/mips/include/mips_opcode.h	Wed Jul  7 01:23:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_opcode.h,v 1.13 2009/08/06 04:34:50 msaitoh Exp $	*/
+/*	$NetBSD: mips_opcode.h,v 1.14 2010/07/07 01:23:42 chs Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -147,6 +147,7 @@
 #define OP_LDR		033		/* MIPS-II, for r4000 port */
 
 #define OP_SPECIAL2	034		/* QED opcodes */
+#define OP_SPECIAL3	037
 
 #define OP_LB		040
 #define OP_LH		041
@@ -257,6 +258,11 @@
 #define OP_MUL		002		/* QED */
 
 /*
+ * Values for the 'func' field when 'op' == OP_SPECIAL3.
+ */
+#define OP_RDHWR	073		/* MIPS32r2 */
+
+/*
  * Values for the 'func' field when 'op' == OP_BCOND.
  */
 #define OP_BLTZ		000

Index: src/sys/arch/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.18 src/sys/arch/mips/mips/mips_emul.c:1.19
--- src/sys/arch/mips/mips/mips_emul.c:1.18	Sun Jun 27 13:44:26 2010
+++ src/sys/arch/mips/mips/mips_emul.c	Wed Jul  7 01:23:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_emul.c,v 1.18 2010/06/27 13:44:26 simonb Exp $ */
+/*	$NetBSD: mips_emul.c,v 1.19 2010/07/07 01:23:42 chs Exp $ */
 
 /*
  * Copyright (c) 1999 Shuichiro URATA.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mips_emul.c,v 1.18 2010/06/27 13:44:26 simonb Exp $);
+__KERNEL_RCSID(0, $NetBSD: mips_emul.c,v 1.19 2010/07/07 01:23:42 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -54,6 +54,7 @@
 void	MachEmulateLWC0(uint32_t, struct frame *, uint32_t);
 void	MachEmulateSWC0(uint32_t, struct frame *, uint32_t);
 void	MachEmulateSpecial(uint32_t, struct frame *, uint32_t);
+void	MachEmulateSpecial3(uint32_t, struct frame *, uint32_t);
 void	MachEmulateLWC1(uint32_t, struct frame *, uint32_t);
 void	MachEmulateLDC1(uint32_t, struct frame *, uint32_t);
 void	MachEmulateSWC1(uint32_t, struct frame *, uint32_t);
@@ -237,6 +238,9 @@
 	case OP_SPECIAL:
 		MachEmulateSpecial(inst, frame, cause);
 		break;
+	case OP_SPECIAL3:
+		MachEmulateSpecial3(inst, frame, cause);
+		break;
 	case OP_COP1:
 		MachEmulateFP(inst, frame, cause);
 		break;
@@ -389,6 +393,7 @@
 MachEmulateSpecial(uint32_t inst, struct frame *frame, uint32_t cause)
 {
 	ksiginfo_t ksi;
+
 	switch (((InstFmt)inst).RType.func) {
 	case OP_SYNC:
 		/* nothing */
@@ -408,6 +413,37 @@
 	update_pc(frame, cause);
 }
 
+void
+MachEmulateSpecial3(uint32_t inst, struct frame *frame, uint32_t cause)
+{
+	ksiginfo_t ksi;
+	InstFmt instfmt = (InstFmt)inst;
+
+	switch (instfmt.RType.func) {
+	case OP_RDHWR:
+		switch (instfmt.RType.rd) {
+		case 29:
+			frame-f_regs[instfmt.RType.rt] =
+(mips_reg_t)curlwp-l_private;
+			goto out;
+		}
+		/* FALLTHROUGH */
+	default:
+		frame-f_regs[_R_CAUSE] = cause;
+		frame-f_regs[_R_BADVADDR] = frame-f_regs[_R_PC];
+		KSI_INIT_TRAP(ksi);
+		ksi.ksi_signo = SIGILL;
+		ksi.ksi_trap = cause;
+		ksi.ksi_code = ILL_ILLOPC;
+		ksi.ksi_addr = (void *)(intptr_t)frame-f_regs[_R_PC];
+		(*curproc-p_emul-e_trapsignal)(curlwp, ksi);
+		break;
+	}
+
+out:
+	update_pc(frame, cause);
+}
+
 #if defined(SOFTFLOAT)
 
 #define LWSWC1_MAXLOOP	12



CVS commit: src/sys/arch

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:24:52 UTC 2010

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

Log Message:
enable DDB_HISTORY_SIZE in a few more configs where DDB is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/arch/hp300/conf/GENERIC
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/pmax/conf/GENERIC
cvs rdiff -u -r1.150 -r1.151 src/sys/arch/sun3/conf/GENERIC

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

Modified files:

Index: src/sys/arch/hp300/conf/GENERIC
diff -u src/sys/arch/hp300/conf/GENERIC:1.155 src/sys/arch/hp300/conf/GENERIC:1.156
--- src/sys/arch/hp300/conf/GENERIC:1.155	Sat May  8 22:16:27 2010
+++ src/sys/arch/hp300/conf/GENERIC	Wed Jul  7 01:24:52 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.155 2010/05/08 22:16:27 mrg Exp $
+# $NetBSD: GENERIC,v 1.156 2010/07/07 01:24:52 chs Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.155 $
+#ident 		GENERIC-$Revision: 1.156 $
 
 maxusers	32		# estimated number of users
 
@@ -67,7 +67,7 @@
 #options 	DEBUG		# Enable misc. kernel debugging code
 #options 	KMEMSTATS	# kernel memory statistics (vmstat -m)
 options 	DDB		# Kernel Dynamic Debugger
-#options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
+options 	DDB_HISTORY_SIZE=512	# Enable history editing in DDB
 #options 	KGDB		# remote debugger
 #makeoptions	DEBUG=-g	# netbsd.gdb with full debugging symbols
 

Index: src/sys/arch/pmax/conf/GENERIC
diff -u src/sys/arch/pmax/conf/GENERIC:1.165 src/sys/arch/pmax/conf/GENERIC:1.166
--- src/sys/arch/pmax/conf/GENERIC:1.165	Sat May  8 22:16:29 2010
+++ src/sys/arch/pmax/conf/GENERIC	Wed Jul  7 01:24:52 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.165 2010/05/08 22:16:29 mrg Exp $
+# $NetBSD: GENERIC,v 1.166 2010/07/07 01:24:52 chs Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		GENERIC-$Revision: 1.165 $
+#ident		GENERIC-$Revision: 1.166 $
 
 maxusers	64
 
@@ -44,7 +44,7 @@
 
 # Standard system options
 options 	DDB			# in-kernel debugger
-#options 	DDB_HISTORY_SIZE=100	# enable history editing in DDB
+options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 options 	DDB_ONPANIC=0		# don't enter debugger on panic
 #options 	DIAGNOSTIC		# extra kernel debugging checks
 #options 	DEBUG			# extra kernel debugging support

Index: src/sys/arch/sun3/conf/GENERIC
diff -u src/sys/arch/sun3/conf/GENERIC:1.150 src/sys/arch/sun3/conf/GENERIC:1.151
--- src/sys/arch/sun3/conf/GENERIC:1.150	Thu Apr 29 22:40:54 2010
+++ src/sys/arch/sun3/conf/GENERIC	Wed Jul  7 01:24:52 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.150 2010/04/29 22:40:54 chs Exp $
+# $NetBSD: GENERIC,v 1.151 2010/07/07 01:24:52 chs Exp $
 #
 # GENERIC machine description file
 # 
@@ -25,7 +25,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		GENERIC-$Revision: 1.150 $
+#ident		GENERIC-$Revision: 1.151 $
 
 makeoptions	COPTS=-Os		# bootloader has size limit (~2MB)
 
@@ -60,7 +60,7 @@
 #options 	KGDB_DEV=0x0C01	# ttya=0C00 ttyb=0C01
 
 # Other debugging options
-#options 	DDB_HISTORY_SIZE=100	# enable history editing in DDB
+options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 #options 	DEBUG		# kernel debugging code
 #options 	DIAGNOSTIC	# extra kernel sanity checking
 #options 	KMEMSTATS	# kernel memory statistics (vmstat -m)



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

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:32:51 UTC 2010

Modified Files:
src/sys/arch/sgimips/conf: GENERIC32_IP2x GENERIC32_IP3x

Log Message:
enable COMPAT_LINUX.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sgimips/conf/GENERIC32_IP2x
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/sgimips/conf/GENERIC32_IP3x

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/sgimips/conf/GENERIC32_IP2x
diff -u src/sys/arch/sgimips/conf/GENERIC32_IP2x:1.82 src/sys/arch/sgimips/conf/GENERIC32_IP2x:1.83
--- src/sys/arch/sgimips/conf/GENERIC32_IP2x:1.82	Fri Apr 16 13:48:35 2010
+++ src/sys/arch/sgimips/conf/GENERIC32_IP2x	Wed Jul  7 01:32:51 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC32_IP2x,v 1.82 2010/04/16 13:48:35 pooka Exp $
+#	$NetBSD: GENERIC32_IP2x,v 1.83 2010/07/07 01:32:51 chs Exp $
 #
 # GENERIC32_IP2x machine description file
 # 
@@ -29,7 +29,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		GENERIC32-IP2x-$Revision: 1.82 $
+#ident		GENERIC32-IP2x-$Revision: 1.83 $
 
 maxusers	32
 
@@ -87,7 +87,7 @@
 #options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
 
 options 	COMPAT_IRIX	# binary compatibility with IRIX
-#options 	COMPAT_LINUX	# binary compatibility with Linux
+options 	COMPAT_LINUX	# binary compatibility with Linux
 #options 	COMPAT_ULTRIX	# binary compatibility with Ultrix 
 options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 

Index: src/sys/arch/sgimips/conf/GENERIC32_IP3x
diff -u src/sys/arch/sgimips/conf/GENERIC32_IP3x:1.84 src/sys/arch/sgimips/conf/GENERIC32_IP3x:1.85
--- src/sys/arch/sgimips/conf/GENERIC32_IP3x:1.84	Fri Apr 16 13:48:35 2010
+++ src/sys/arch/sgimips/conf/GENERIC32_IP3x	Wed Jul  7 01:32:51 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC32_IP3x,v 1.84 2010/04/16 13:48:35 pooka Exp $
+#	$NetBSD: GENERIC32_IP3x,v 1.85 2010/07/07 01:32:51 chs Exp $
 #
 # GENERIC32_IP3x machine description file
 # 
@@ -28,7 +28,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		GENERIC32_IP3x-$Revision: 1.84 $
+#ident		GENERIC32_IP3x-$Revision: 1.85 $
 
 maxusers	32
 
@@ -80,7 +80,7 @@
 #options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
 
 options 	COMPAT_IRIX	# binary compatibility with IRIX
-#options 	COMPAT_LINUX	# binary compatibility with Linux
+options 	COMPAT_LINUX	# binary compatibility with Linux
 #options 	COMPAT_ULTRIX	# binary compatibility with Ultrix 
 options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 



CVS commit: src/sys/sys

2010-07-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jul  7 01:37:35 UTC 2010

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

Log Message:
welcome to 5.99.35 (changes for updated COMPAT_LINUX).


To generate a diff of this commit:
cvs rdiff -u -r1.369 -r1.370 src/sys/sys/param.h

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.369 src/sys/sys/param.h:1.370
--- src/sys/sys/param.h:1.369	Thu Jul  1 13:00:57 2010
+++ src/sys/sys/param.h	Wed Jul  7 01:37:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.369 2010/07/01 13:00:57 hannken Exp $	*/
+/*	$NetBSD: param.h,v 1.370 2010/07/07 01:37:35 chs Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	599003400	/* NetBSD 5.99.34 */
+#define	__NetBSD_Version__	599003500	/* NetBSD 5.99.35 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) = __NetBSD_Version__)



CVS commit: src/doc

2010-07-09 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Jul  9 16:54:05 UTC 2010

Modified Files:
src/doc: CHANGES

Log Message:
note compat_linux update.


To generate a diff of this commit:
cvs rdiff -u -r1.1411 -r1.1412 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1411 src/doc/CHANGES:1.1412
--- src/doc/CHANGES:1.1411	Sun Jul  4 15:25:00 2010
+++ src/doc/CHANGES	Fri Jul  9 16:54:05 2010
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1411 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1412 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -644,3 +644,5 @@
 	upgt(4): Add a driver for Conexant/Intersil PrismGT SoftMAC USB
 		IEEE 802.11b/g WLAN device, ported from OpenBSD by
 		FUKAUMI Naoki. [tsutsui 20100704]
+	compat_linux(8): Update linux emulation to support NPTL.
+		We now claim to be linux kernel version 2.6.18.  [chs 20100706]



CVS commit: src/sys/arch/mips/mips

2010-07-09 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Jul  9 21:47:43 UTC 2010

Modified Files:
src/sys/arch/mips/mips: lock_stubs.S

Log Message:
fix build problems on MIPS32-only configurations:
define ucas{int,ptr}() directly here using the INT_* and PTR_* macros
instead of defining ucas_{32,64}() and aliasing them to the public names.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/mips/lock_stubs.S

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

Modified files:

Index: src/sys/arch/mips/mips/lock_stubs.S
diff -u src/sys/arch/mips/mips/lock_stubs.S:1.12 src/sys/arch/mips/mips/lock_stubs.S:1.13
--- src/sys/arch/mips/mips/lock_stubs.S:1.12	Wed Jul  7 01:19:09 2010
+++ src/sys/arch/mips/mips/lock_stubs.S	Fri Jul  9 21:47:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.S,v 1.12 2010/07/07 01:19:09 chs Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.13 2010/07/09 21:47:43 chs Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -139,18 +139,18 @@
 STRONG_ALIAS(atomic_cas_uint_ni,_atomic_cas_uint)
 
 /*
- * int ucas_32(volatile int32_t *uptr, int32_t old, int32_t new, int32_t *ret);
+ * int ucas_int(volatile int *uptr, int old, int new, int *ret);
  */
-LEAF(ucas_32)
+LEAF(ucas_int)
 	blt	a0, zero, 4f
 	 PTR_L	v1, L_PCB(MIPS_CURLWP)
 	PTR_LA	v0, 3f
 	PTR_S	v0, PCB_ONFAULT(v1)
 1:
-	ll	t0, (a0)
+	INT_LL	t0, (a0)
 	bne	t0, a1, 2f
 	 move	t1, a2
-	sc	t1, (a0)
+	INT_SC	t1, (a0)
 	beq	t1, zero, 1b
 2:
 	 INT_S	t0, (a3)
@@ -161,25 +161,24 @@
 4:
 	b	3b
 	 li	v0, EFAULT
-END(ucas_32)
-STRONG_ALIAS(ucas_int,ucas_32)
+END(ucas_int)
 
 /*
- * int ucas_64(volatile int64_t *uptr, int64_t old, int64_t new, int64_t *ret);
+ * int ucas_ptr(volatile void **uptr, void *old, void *new, void **ret);
  */
-LEAF(ucas_64)
+LEAF(ucas_ptr)
 	blt	a0, zero, 4f
 	 PTR_L	v1, L_PCB(MIPS_CURLWP)
 	PTR_LA	v0, 3f
 	PTR_S	v0, PCB_ONFAULT(v1)
 1:
-	lld	t0, (a0)
+	PTR_LL	t0, (a0)
 	bne	t0, a1, 2f
 	 move	t1, a2
-	scd	t1, (a0)
+	PTR_SC	t1, (a0)
 	beq	t1, zero, 1b
 2:
-	 INT_S	t0, (a3)
+	 PTR_S	t0, (a3)
 	move	v0, zero
 3:
 	j	ra
@@ -187,12 +186,7 @@
 4:
 	b	3b
 	 li	v0, EFAULT
-END(ucas_64)
-#ifdef _LP64
-STRONG_ALIAS(ucas_ptr,ucas_64)
-#else
-STRONG_ALIAS(ucas_ptr,ucas_32)
-#endif
+END(ucas_ptr)
 
 #ifndef LOCKDEBUG
 



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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 16:23:40 UTC 2010

Modified Files:
src/sys/arch/sh3/dev: adc.c

Log Message:
make this compile with DIAGNOSTIC.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sh3/dev/adc.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/sh3/dev/adc.c
diff -u src/sys/arch/sh3/dev/adc.c:1.12 src/sys/arch/sh3/dev/adc.c:1.13
--- src/sys/arch/sh3/dev/adc.c:1.12	Thu Apr 30 05:20:30 2009
+++ src/sys/arch/sh3/dev/adc.c	Sun Aug  8 16:23:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: adc.c,v 1.12 2009/04/30 05:20:30 nonaka Exp $ */
+/*	$NetBSD: adc.c,v 1.13 2010/08/08 16:23:40 chs Exp $ */
 
 /*
  * Copyright (c) 2003 Valeriy E. Ushakov
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: adc.c,v 1.12 2009/04/30 05:20:30 nonaka Exp $);
+__KERNEL_RCSID(0, $NetBSD: adc.c,v 1.13 2010/08/08 16:23:40 chs Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -141,11 +141,11 @@
 	csr = ADC_(CSR);
 	if ((csr  SH7709_ADCSR_ADST) != 0) {
 		/* another conversion is in progress?! */
-	snprintb(bits, sizeof(buts), SH7709_ADCSR_BITS, csr);
+	snprintb(bits, sizeof(bits), SH7709_ADCSR_BITS, csr);
 		printf(adc_sample_channel(%d): CSR=%s, chan, bits);
 		cr = ADC_(CR);
 		cr = ~0x07;	/* three lower bits always read as 1s */
-	snprintb(bits, sizeof(buts), SH7709_ADCR_BITS, cr);
+	snprintb(bits, sizeof(bits), SH7709_ADCR_BITS, cr);
 		printf(, CR=%s\n, bits);
 		return (-1);
 	}



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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 16:25:49 UTC 2010

Modified Files:
src/sys/arch/hpcsh/conf: DEBUG

Log Message:
remove dup options KTRACE.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hpcsh/conf/DEBUG

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/hpcsh/conf/DEBUG
diff -u src/sys/arch/hpcsh/conf/DEBUG:1.4 src/sys/arch/hpcsh/conf/DEBUG:1.5
--- src/sys/arch/hpcsh/conf/DEBUG:1.4	Sun Dec 11 12:17:36 2005
+++ src/sys/arch/hpcsh/conf/DEBUG	Sun Aug  8 16:25:49 2010
@@ -1,7 +1,7 @@
 #
 # kernel config file for debugging.
 #
-# 	$NetBSD: DEBUG,v 1.4 2005/12/11 12:17:36 christos Exp $
+# 	$NetBSD: DEBUG,v 1.5 2010/08/08 16:25:49 chs Exp $
 #
 
 include 	arch/hpcsh/conf/GENERIC
@@ -21,5 +21,4 @@
 #options 	KSTACK_DEBUG
 options 	DIAGNOSTIC		# extra kernel debugging checks
 options 	DEBUG			# extra kernel debugging support
-options 	KTRACE			# system call tracing support
 options 	PCMCIAVERBOSE	# verbose PCMCIA configuration messages



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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 16:27:30 UTC 2010

Modified Files:
src/sys/arch/hpc/include: debug.h

Log Message:
fix build problem.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hpc/include/debug.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/hpc/include/debug.h
diff -u src/sys/arch/hpc/include/debug.h:1.9 src/sys/arch/hpc/include/debug.h:1.10
--- src/sys/arch/hpc/include/debug.h:1.9	Mon Apr 28 20:23:20 2008
+++ src/sys/arch/hpc/include/debug.h	Sun Aug  8 16:27:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.h,v 1.9 2008/04/28 20:23:20 martin Exp $	*/
+/*	$NetBSD: debug.h,v 1.10 2010/08/08 16:27:30 chs Exp $	*/
 
 /*-
  * Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
@@ -114,8 +114,8 @@
 void dbg_banner_line(void);
 #define dbg_banner_function()		\
 {	\
-	const char funcname[] = __func__;\
-	dbg_banner_title(funcname, sizeof funcname);			\
+	const char *funcname = __func__;\
+	dbg_banner_title(funcname, strlen (funcname));			\
 }
 
 /* HPC_DEBUG_LCD */



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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 16:51:34 UTC 2010

Modified Files:
src/sys/arch/hpcsh/dev: psh3tp.c

Log Message:
make this compile with DIAGNOSTIC and PSH3TP_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hpcsh/dev/psh3tp.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/hpcsh/dev/psh3tp.c
diff -u src/sys/arch/hpcsh/dev/psh3tp.c:1.14 src/sys/arch/hpcsh/dev/psh3tp.c:1.15
--- src/sys/arch/hpcsh/dev/psh3tp.c:1.14	Sat Jul 24 15:33:12 2010
+++ src/sys/arch/hpcsh/dev/psh3tp.c	Sun Aug  8 16:51:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: psh3tp.c,v 1.14 2010/07/24 15:33:12 tsutsui Exp $	*/
+/*	$NetBSD: psh3tp.c,v 1.15 2010/08/08 16:51:34 chs Exp $	*/
 /*
  * Copyright (c) 2005 KIYOHARA Takashi
  * All rights reserved.
@@ -213,7 +213,7 @@
 psh3tp_enable(struct psh3tp_softc *sc __unused)
 {
 
-	DPRINTFN(2, (%s: enable\n, sc-sc_dev.dv_xname));
+	DPRINTFN(2, (%s: enable\n, device_xname(sc-sc_dev)));
 	intc_intr_enable(SH7709_INTEVT2_IRQ2);
 }
 
@@ -226,7 +226,7 @@
 psh3tp_disable(struct psh3tp_softc *sc)
 {
 
-	DPRINTFN(2, (%s: disable\n, sc-sc_dev.dv_xname));
+	DPRINTFN(2, (%s: disable\n, device_xname(sc-sc_dev)));
 	intc_intr_disable(SH7709_INTEVT2_IRQ2);
 	callout_stop(sc-sc_touch_ch);
 }
@@ -257,7 +257,7 @@
 {
 	struct psh3tp_softc *sc = (struct psh3tp_softc *)cookie;
 
-	DPRINTFN(1, (%s: wsmouse enable\n, sc-sc_dev.dv_xname));
+	DPRINTFN(1, (%s: wsmouse enable\n, device_xname(sc-sc_dev)));
 	return psh3tp_set_enable(sc, 1, PSH3TP_WSMOUSE_ENABLED);
 }
 
@@ -267,7 +267,7 @@
 {
 	struct psh3tp_softc *sc = (struct psh3tp_softc *)cookie;
 
-	DPRINTFN(1, (%s: wsmouse disable\n, sc-sc_dev.dv_xname));
+	DPRINTFN(1, (%s: wsmouse disable\n, device_xname(sc-sc_dev)));
 	psh3tp_set_enable(sc, 0, PSH3TP_WSMOUSE_ENABLED);
 }
 
@@ -284,13 +284,13 @@
 	irr0 = _reg_read_1(SH7709_IRR0);
 	if ((irr0  IRR0_IRQ2) == 0) {
 #ifdef DIAGNOSTIC
-		printf(%s: irr0 %02x?\n, sc-sc_dev.dv_xname, irr0);
+		printf(%s: irr0 %02x?\n, device_xname(sc-sc_dev), irr0);
 #endif
 		return 0;
 	}
 
 	if (!sc-sc_enabled) {
-		DPRINTFN(1, (%s: intr: !sc_enabled\n, sc-sc_dev.dv_xname));
+		DPRINTFN(1, (%s: intr: !sc_enabled\n, device_xname(sc-sc_dev)));
 		intc_intr_disable(SH7709_INTEVT2_IRQ2);
 		goto served;
 	}
@@ -318,7 +318,8 @@
 		}
 
 		if (--tremor_timeout == 0) {
-			DPRINTF((%s: tremor timeout!\n, sc-sc_dev.dv_xname));
+			DPRINTF((%s: tremor timeout!\n,
+			device_xname(sc-sc_dev)));
 			goto served;
 		}
 	} while (steady  TREMOR_THRESHOLD);
@@ -334,7 +335,7 @@
 		callout_reset(sc-sc_touch_ch,
 		hz/32, psh3tp_start_polling, sc);
 	} else
-		DPRINTFN(1, (%s: tremor\n, sc-sc_dev.dv_xname));
+		DPRINTFN(1, (%s: tremor\n, device_xname(sc-sc_dev)));
 served:
 	/* clear the interrupt */
 	_reg_write_1(SH7709_IRR0, irr0  ~IRR0_IRQ2);
@@ -357,14 +358,14 @@
 	phdr = _reg_read_1(SH7709_PHDR);
 	if ((phdr  PHDR_TP_PEN_UP) == PHDR_TP_PEN_UP) {
 		DPRINTFN(2, (%s: start: pen is not down\n,
-		sc-sc_dev.dv_xname));
+		device_xname(sc-sc_dev)));
 		psh3tp_stop_polling(sc);
 		return;
 	}
 
 	psh3tp_get_raw_xy(rawx, rawy);
 	DPRINTFN(2, (%s: start: %4d %4d - ,
-	sc-sc_dev.dv_xname, rawx, rawy));
+	device_xname(sc-sc_dev), rawx, rawy));
 
 	if (sc-sc_enabled  PSH3TP_WSMOUSE_ENABLED) {
 		DPRINTFN(2, (mouse\n));
@@ -388,7 +389,7 @@
 {
 	uint8_t irr0;
 
-	DPRINTFN(2, (%s: stop\n, sc-sc_dev.dv_xname));
+	DPRINTFN(2, (%s: stop\n, device_xname(sc-sc_dev)));
 
 	/* clear pending interrupt signal before re-enabling the interrupt */
 	irr0 = _reg_read_1(SH7709_IRR0);
@@ -414,7 +415,7 @@
 
 	if (!sc-sc_enabled) {
 		DPRINTFN(1, (%s: wsmouse callout: !sc_enabled\n,
-		sc-sc_dev.dv_xname));
+		device_xname(sc-sc_dev)));
 		splx(s);
 		return;
 	}
@@ -444,7 +445,7 @@
 	tpcalib_trans(sc-sc_tpcalib, rawx, rawy, x, y);
 		
 	DPRINTFN(3, (%s: %4d %4d - %3d %3d\n,
-	 sc-sc_dev.dv_xname, rawx, rawy, x, y));
+	 device_xname(sc-sc_dev), rawx, rawy, x, y));
 
 	wsmouse_input(sc-sc_wsmousedev,
 	1,	/* button */



CVS commit: src/sys/arch

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:13:54 UTC 2010

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c
src/sys/arch/i386/i386: trap.c

Log Message:
Fix several panics that can be caused by applications using
bad segment register values with setcontext() or sigreturn().


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.258 -r1.259 src/sys/arch/i386/i386/trap.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.64 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.65
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.64	Wed Jul  7 01:14:52 2010
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Sun Aug  8 18:13:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.64 2010/07/07 01:14:52 chs Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.65 2010/08/08 18:13:54 chs Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.64 2010/07/07 01:14:52 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.65 2010/08/08 18:13:54 chs Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -961,7 +961,8 @@
 	tf = l-l_md.md_regs;
 	pcb = lwp_getpcb(curlwp);
 
-	if (((scp-sc_eflags ^ tf-tf_rflags)  PSL_USERSTATIC) != 0)
+	if (((scp-sc_eflags ^ tf-tf_rflags)  PSL_USERSTATIC) != 0 ||
+	scp-sc_cs != GSEL(GUCODE32_SEL, SEL_UPL))
 		return EINVAL;
 	if (scp-sc_fs != 0  !VALID_USER_DSEL32(scp-sc_fs) 
 	!(scp-sc_fs == GSEL(GUFS_SEL, SEL_UPL)  pcb-pcb_fs != 0))
@@ -989,7 +990,8 @@
 	tf = l-l_md.md_regs;
 	pcb = lwp_getpcb(l);
 
-	if (((gr[_REG32_EFL] ^ tf-tf_rflags)  PSL_USERSTATIC) != 0)
+	if (((gr[_REG32_EFL] ^ tf-tf_rflags)  PSL_USERSTATIC) != 0 ||
+	gr[_REG32_CS] != GSEL(GUCODE32_SEL, SEL_UPL))
 		return EINVAL;
 	if (gr[_REG32_FS] != 0  !VALID_USER_DSEL32(gr[_REG32_FS]) 
 	!(gr[_REG32_FS] == GSEL(GUFS_SEL, SEL_UPL)  pcb-pcb_fs != 0))

Index: src/sys/arch/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.258 src/sys/arch/i386/i386/trap.c:1.259
--- src/sys/arch/i386/i386/trap.c:1.258	Sun Jul 25 19:19:06 2010
+++ src/sys/arch/i386/i386/trap.c	Sun Aug  8 18:13:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.258 2010/07/25 19:19:06 christos Exp $	*/
+/*	$NetBSD: trap.c,v 1.259 2010/08/08 18:13:54 chs Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.258 2010/07/25 19:19:06 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.259 2010/08/08 18:13:54 chs Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -442,6 +442,7 @@
 		 * returning from a trap, syscall, or interrupt.
 		 */
 
+kernelfault:
 		KSI_INIT_TRAP(ksi);
 		ksi.ksi_signo = SIGSEGV;
 		ksi.ksi_code = SEGV_ACCERR;
@@ -759,7 +760,7 @@
 goto copyfault;
 			printf(uvm_fault(%p, %#lx, %d) - %#x\n,
 			map, va, ftype, error);
-			goto we_re_toast;
+			goto kernelfault;
 		}
 		if (error == ENOMEM) {
 			ksi.ksi_signo = SIGKILL;



CVS commit: src/sys/miscfs/genfs

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:17:12 UTC 2010

Modified Files:
src/sys/miscfs/genfs: genfs_io.c

Log Message:
in genfs_getpages(), mark the vnode dirty (ie. add to syncer worklist
and set VI_WRMAPDIRTY) after we have busied the pages rather than
before.  this prevents other threads calling genfs_do_putpages() from
marking the vnode clean again while we're in the process of creating
new writable mappings, since such threads will wait for the page(s) to
become unbusy before proceeding.
fixes the problem recently reported by hannken@ on tech-kern.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/miscfs/genfs/genfs_io.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/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.37 src/sys/miscfs/genfs/genfs_io.c:1.38
--- src/sys/miscfs/genfs/genfs_io.c:1.37	Thu Jul 29 10:54:50 2010
+++ src/sys/miscfs/genfs/genfs_io.c	Sun Aug  8 18:17:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.37 2010/07/29 10:54:50 hannken Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.38 2010/08/08 18:17:11 chs Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfs_io.c,v 1.37 2010/07/29 10:54:50 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfs_io.c,v 1.38 2010/08/08 18:17:11 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -62,11 +62,12 @@
 
 static int genfs_do_io(struct vnode *, off_t, vaddr_t, size_t, int, enum uio_rw,
 void (*)(struct buf *));
-static inline void genfs_rel_pages(struct vm_page **, int);
+static void genfs_rel_pages(struct vm_page **, int);
+static void genfs_markdirty(struct vnode *);
 
 int genfs_maxdio = MAXPHYS;
 
-static inline void
+static void
 genfs_rel_pages(struct vm_page **pgs, int npages)
 {
 	int i;
@@ -85,6 +86,21 @@
 	mutex_exit(uvm_pageqlock);
 }
 
+static void
+genfs_markdirty(struct vnode *vp)
+{
+	struct genfs_node * const gp = VTOG(vp);
+
+	KASSERT(mutex_owned(vp-v_interlock));
+	gp-g_dirtygen++;
+	if ((vp-v_iflag  VI_ONWORKLST) == 0) {
+		vn_syncer_add_to_worklist(vp, filedelay);
+	}
+	if ((vp-v_iflag  (VI_WRMAP|VI_WRMAPDIRTY)) == VI_WRMAP) {
+		vp-v_iflag |= VI_WRMAPDIRTY;
+	}
+}
+
 /*
  * generic VM getpages routine.
  * Return PG_BUSY pages for the given range,
@@ -186,16 +202,6 @@
 		}
 	}
 
-	if (memwrite) {
-		gp-g_dirtygen++;
-		if ((vp-v_iflag  VI_ONWORKLST) == 0) {
-			vn_syncer_add_to_worklist(vp, filedelay);
-		}
-		if ((vp-v_iflag  (VI_WRMAP|VI_WRMAPDIRTY)) == VI_WRMAP) {
-			vp-v_iflag |= VI_WRMAPDIRTY;
-		}
-	}
-
 	/*
 	 * For PGO_LOCKED requests, just return whatever's in memory.
 	 */
@@ -236,6 +242,9 @@
 			genfs_node_unlock(vp);
 		}
 		error = (ap-a_m[ap-a_centeridx] == NULL ? EBUSY : 0);
+		if (error == 0  memwrite) {
+			genfs_markdirty(vp);
+		}
 		goto out_err;
 	}
 	mutex_exit(uobj-vmobjlock);
@@ -696,6 +705,9 @@
 		}
 	}
 	mutex_exit(uvm_pageqlock);
+	if (memwrite) {
+		genfs_markdirty(vp);
+	}
 	mutex_exit(uobj-vmobjlock);
 	if (ap-a_m != NULL) {
 		memcpy(ap-a_m, pgs[ridx],
@@ -708,7 +720,7 @@
 out_err:
 	if (has_trans)
 		fstrans_done(vp-v_mount);
-	return (error);
+	return error;
 }
 
 /*
@@ -1467,18 +1479,19 @@
 	orignpages = *ap-a_count;
 	pgs = ap-a_m;
 
-	if (memwrite  (vp-v_iflag  VI_ONWORKLST) == 0) {
-		vn_syncer_add_to_worklist(vp, filedelay);
-	}
 	if (ap-a_flags  PGO_LOCKED) {
 		uvn_findpages(uobj, origoffset, ap-a_count, ap-a_m,
 		UFP_NOWAIT|UFP_NOALLOC| (memwrite ? UFP_NORDONLY : 0));
 
-		return (ap-a_m[ap-a_centeridx] == NULL ? EBUSY : 0);
+		error = ap-a_m[ap-a_centeridx] == NULL ? EBUSY : 0;
+		if (error == 0  memwrite) {
+			genfs_markdirty(vp);
+		}
+		return error;
 	}
 	if (origoffset + (ap-a_centeridx  PAGE_SHIFT) = vp-v_size) {
 		mutex_exit(uobj-vmobjlock);
-		return (EINVAL);
+		return EINVAL;
 	}
 	if ((ap-a_flags  PGO_SYNCIO) == 0) {
 		mutex_exit(uobj-vmobjlock);
@@ -1527,8 +1540,11 @@
 		uvm_page_unbusy(pgs, npages);
 	}
 	mutex_exit(uvm_pageqlock);
+	if (error == 0  memwrite) {
+		genfs_markdirty(vp);
+	}
 	mutex_exit(uobj-vmobjlock);
-	return (error);
+	return error;
 }
 
 int



CVS commit: src/sys/arch/ia64/ia64

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:18:58 UTC 2010

Modified Files:
src/sys/arch/ia64/ia64: support.S

Log Message:
fix copy{in,out}{,str}() to return the error returned by uvm_fault().
part of PR 41813 that I missed earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/ia64/support.S

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

Modified files:

Index: src/sys/arch/ia64/ia64/support.S
diff -u src/sys/arch/ia64/ia64/support.S:1.5 src/sys/arch/ia64/ia64/support.S:1.6
--- src/sys/arch/ia64/ia64/support.S:1.5	Fri Nov 27 03:23:10 2009
+++ src/sys/arch/ia64/ia64/support.S	Sun Aug  8 18:18:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: support.S,v 1.5 2009/11/27 03:23:10 rmind Exp $	*/
+/*	$NetBSD: support.S,v 1.6 2010/08/08 18:18:58 chs Exp $	*/
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -57,7 +57,6 @@
 
 #include machine/asm.h
 #include machine/ia64_cpu.h
-#include machine/vmparam.h
 
 #include assym.h
 
@@ -708,7 +707,7 @@
 	;;
 	cmp.geu	p6,p0=in0,loc2			// is in user space.
 	;;
-(p6)	br.cond.spnt.few copyerr		// if it's not, error out.
+(p6)	br.cond.spnt.few copyefault		// if it's not, error out.
 	movl	r14=copyerr			// set up fault handler.
 	add	r15=PC_CURLWP,r13		// find curthread
 	;;
@@ -747,7 +746,7 @@
 	;;
 	cmp.geu	p6,p0=in1,loc2			// is in user space.
 	;;
-(p6)	br.cond.spnt.few copyerr		// if it's not, error out.
+(p6)	br.cond.spnt.few copyefault		// if it's not, error out.
 	movl	r14=copyerr			// set up fault handler.
 	add	r15=PC_CURLWP,r13		// find curthread
 	;;
@@ -898,7 +897,7 @@
 	;;
 	cmp.geu	p6,p0=in0,loc2			// is in user space.
 	;;
-(p6)	br.cond.spnt.few copyerr		// if it's not, error out.
+(p6)	br.cond.spnt.few copyefault		// if it's not, error out.
 	movl	r14=copyerr			// set up fault handler.
 	add	r15=PC_CURLWP,r13		// find curthread
 	;;
@@ -936,7 +935,7 @@
 	;;
 	cmp.geu	p6,p0=in1,loc2			// is in user space.
 	;;
-(p6)	br.cond.spnt.few copyerr		// if it's not, error out.
+(p6)	br.cond.spnt.few copyefault		// if it's not, error out.
 	movl	r14=copyerr			// set up fault handler.
 	add	r15=PC_CURLWP,r13		// find curthread
 	;;
@@ -969,10 +968,21 @@
 	add	r14=PCB_ONFAULT,r14 ;;		// curthread-td_pcb-pcb_onfault
 	st8	[r14]=r0			// reset fault handler
 
-	mov	ret0=EFAULT			// return EFAULT
 	br.ret.sptk.few rp
 END(copyerr)
 
+ENTRY(copyefault, 0)
+	add	r14=PC_CURLWP,r13 ;;		// find curthread
+	ld8	r14=[r14] ;;
+	add	r14=L_PCB,r14 ;;		// curthread-td_addr
+	ld8	r14=[r14] ;;
+	add	r14=PCB_ONFAULT,r14 ;;		// curthread-td_pcb-pcb_onfault
+	st8	[r14]=r0			// reset fault handler
+
+	mov	ret0=EFAULT			// return EFAULT
+	br.ret.sptk.few rp
+END(copyefault)
+
 #if defined(GPROF)
 /*
  * Important registers:



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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:19:26 UTC 2010

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

Log Message:
enable DDB_HISTORY_SIZE since DDB is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/arch/vax/conf/GENERIC

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

Modified files:

Index: src/sys/arch/vax/conf/GENERIC
diff -u src/sys/arch/vax/conf/GENERIC:1.174 src/sys/arch/vax/conf/GENERIC:1.175
--- src/sys/arch/vax/conf/GENERIC:1.174	Thu Jul  1 19:50:11 2010
+++ src/sys/arch/vax/conf/GENERIC	Sun Aug  8 18:19:26 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.174 2010/07/01 19:50:11 ragge Exp $
+# $NetBSD: GENERIC,v 1.175 2010/08/08 18:19:26 chs Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.174 $
+#ident 		GENERIC-$Revision: 1.175 $
 
 # Here are all different supported CPU types listed.
 #options 	VAX8800		# VAX 8500, 8530, 8550, 8700, 8800
@@ -49,7 +49,7 @@
 # Kernel compiled-in symbolic debugger  system call tracer
 makeoptions	DEBUG=-g
 options 	DDB
-#options 	DDB_HISTORY_SIZE=100	# enable history editing in DDB
+options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 options 	KTRACE
 #options 	DIAGNOSTIC
 #options 	DEBUG



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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:19:56 UTC 2010

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

Log Message:
remove some unreachable debug code.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/sparc64/sparc64/trap.c

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.161 src/sys/arch/sparc64/sparc64/trap.c:1.162
--- src/sys/arch/sparc64/sparc64/trap.c:1.161	Sat Mar 20 23:31:30 2010
+++ src/sys/arch/sparc64/sparc64/trap.c	Sun Aug  8 18:19:56 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.161 2010/03/20 23:31:30 chs Exp $ */
+/*	$NetBSD: trap.c,v 1.162 2010/08/08 18:19:56 chs Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.161 2010/03/20 23:31:30 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.162 2010/08/08 18:19:56 chs Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -1000,9 +1000,6 @@
 	vaddr_t onfault;
 	u_quad_t sticks;
 	ksiginfo_t ksi;
-#ifdef DEBUG
-	static int lastdouble;
-#endif
 
 #ifdef DEBUG
 	if (tf-tf_pc == tf-tf_npc) {
@@ -1052,22 +1049,6 @@
 	/* Find the faulting va to give to uvm_fault */
 	va = trunc_page(addr);
 
-#ifdef DEBUG
-	if (lastdouble) {
-		printf(cpu%d: stacked data fault @ %lx (pc %lx);,
-		   cpu_number(), addr, pc);
-		lastdouble = 0;
-		if (curproc == NULL)
-			printf(NULL proc\n);
-		else
-			printf(pid %d(%s); sigmask %x, sigcatch %x\n,
-			   l-l_proc-p_pid, l-l_proc-p_comm,
-/* XXX */
-			   l-l_sigmask.__bits[0], 
-			   l-l_proc-p_sigctx.ps_sigcatch.__bits[0]);
-	}
-#endif
-
 	/* 
 	 * Now munch on protections.
 	 *
@@ -1263,9 +1244,6 @@
 	vaddr_t onfault;
 	u_quad_t sticks;
 	ksiginfo_t ksi;
-#ifdef DEBUG
-	static int lastdouble;
-#endif
 
 #ifdef DEBUG
 	if (tf-tf_pc == tf-tf_npc) {
@@ -1322,22 +1300,6 @@
 		goto out;	/* No fault. Why were we called? */
 	}
 
-#ifdef DEBUG
-	if (lastdouble) {
-		printf(stacked data error @ %lx (pc %lx); sfsr %lx,
-		   sfva, pc, sfsr);
-		lastdouble = 0;
-		if (curproc == NULL)
-			printf(NULL proc\n);
-		else
-			printf(pid %d(%s); sigmask %x, sigcatch %x\n,
-			   curproc-p_pid, curproc-p_comm,
-/* XXX */
-			   curlwp-l_sigmask.__bits[0], 
-			   curproc-p_sigctx.ps_sigcatch.__bits[0]);
-	}
-#endif
-
 	if (tstate  TSTATE_PRIV) {
 		onfault = (vaddr_t)pcb-pcb_onfault;
 		if (!onfault) {
@@ -1539,9 +1501,6 @@
 	vm_prot_t access_type;
 	u_quad_t sticks;
 	ksiginfo_t ksi;
-#ifdef DEBUG
-	static int lastdouble;
-#endif
 	char buf[768];
 	
 #ifdef DEBUG
@@ -1608,19 +1567,6 @@
 
 	va = trunc_page(pc);
 
-#ifdef DEBUG
-	if (lastdouble) {
-		printf(stacked text error @ pc %lx; sfsr %lx, pc, sfsr);
-		lastdouble = 0;
-		if (curproc == NULL)
-			printf(NULL proc\n);
-		else
-			printf(pid %d(%s); sigmask %x, sigcatch %x\n,
-			   curproc-p_pid, curproc-p_comm,
-			   curlwp-l_sigmask.__bits[0], 
-			   curproc-p_sigctx.ps_sigcatch.__bits[0]);
-	}
-#endif
 	/* Now munch on protections... */
 
 	access_type = VM_PROT_EXECUTE;



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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:21:50 UTC 2010

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

Log Message:
update a comment.


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

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

Modified files:

Index: src/sys/arch/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.256 src/sys/arch/sparc/sparc/locore.s:1.257
--- src/sys/arch/sparc/sparc/locore.s:1.256	Sun Mar  7 00:42:08 2010
+++ src/sys/arch/sparc/sparc/locore.s	Sun Aug  8 18:21:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.256 2010/03/07 00:42:08 mrg Exp $	*/
+/*	$NetBSD: locore.s,v 1.257 2010/08/08 18:21:50 chs Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -4797,7 +4797,8 @@
 	jmp	%g7 + 8
 	 clr	%o0			! return 0
 
-! Copyin or copyout fault.  Clear cpcb-pcb_onfault and return EFAULT.
+! Copyin or copyout fault.  Clear cpcb-pcb_onfault.
+! The return value was already put in %o0 by the fault handler.
 ! Note that although we were in bcopy, there is no state to clean up;
 ! the only special thing is that we have to return to [g7 + 8] rather than
 ! [o7 + 8].



CVS commit: src/sys/dev/ofw

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:22:39 UTC 2010

Modified Files:
src/sys/dev/ofw: ofnet.c

Log Message:
remove an unused variable.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ofw/ofnet.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/ofw/ofnet.c
diff -u src/sys/dev/ofw/ofnet.c:1.50 src/sys/dev/ofw/ofnet.c:1.51
--- src/sys/dev/ofw/ofnet.c:1.50	Mon Apr  5 07:20:24 2010
+++ src/sys/dev/ofw/ofnet.c	Sun Aug  8 18:22:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofnet.c,v 1.50 2010/04/05 07:20:24 joerg Exp $	*/
+/*	$NetBSD: ofnet.c,v 1.51 2010/08/08 18:22:39 chs Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofnet.c,v 1.50 2010/04/05 07:20:24 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofnet.c,v 1.51 2010/08/08 18:22:39 chs Exp $);
 
 #include ofnet.h
 #include opt_inet.h
@@ -418,8 +418,6 @@
 static void
 ipkdbofstart(struct ipkdb_if *kip)
 {
-	int unit = kip-unit - 1;
-
 	if (ipkdb_of)
 		ipkdbattach(kip, ipkdb_of-sc_ethercom);
 }



CVS commit: src/sys/dev/isa

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:24:35 UTC 2010

Modified Files:
src/sys/dev/isa: fd.c

Log Message:
move a debug printf to FD_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/isa/fd.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/isa/fd.c
diff -u src/sys/dev/isa/fd.c:1.96 src/sys/dev/isa/fd.c:1.97
--- src/sys/dev/isa/fd.c:1.96	Tue Mar 16 12:53:17 2010
+++ src/sys/dev/isa/fd.c	Sun Aug  8 18:24:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.96 2010/03/16 12:53:17 he Exp $	*/
+/*	$NetBSD: fd.c,v 1.97 2010/08/08 18:24:34 chs Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.96 2010/03/16 12:53:17 he Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.97 2010/08/08 18:24:34 chs Exp $);
 
 #include rnd.h
 #include opt_ddb.h
@@ -1625,7 +1625,7 @@
 	bp-b_bcount = sizeof(struct fd_idfield_data) * finfo-fd_formb_nsecs;
 	bp-b_data = (void *)finfo;
 
-#ifdef DEBUG
+#ifdef FD_DEBUG
 	printf(fdformat: blkno % PRIx64  count %x\n,
 	bp-b_blkno, bp-b_bcount);
 #endif



CVS commit: src/sys/dev/raidframe

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:25:14 UTC 2010

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
only print the boot-time message if we're being verbose.


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.273 src/sys/dev/raidframe/rf_netbsdkintf.c:1.274
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.273	Sun Mar 14 21:11:41 2010
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sun Aug  8 18:25:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.273 2010/03/14 21:11:41 jld Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.274 2010/08/08 18:25:14 chs Exp $	*/
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -139,7 +139,7 @@
  ***/
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rf_netbsdkintf.c,v 1.273 2010/03/14 21:11:41 jld Exp $);
+__KERNEL_RCSID(0, $NetBSD: rf_netbsdkintf.c,v 1.274 2010/08/08 18:25:14 chs Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -385,7 +385,7 @@
 		raidPtrs[i] = NULL;
 	rc = rf_BootRaidframe();
 	if (rc == 0)
-		aprint_normal(Kernelized RAIDframe activated\n);
+		aprint_verbose(Kernelized RAIDframe activated\n);
 	else
 		panic(Serious error booting RAID!!);
 



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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:28:00 UTC 2010

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

Log Message:
add more (commented-out) spdmem instances for HP xw-series workstations.


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 src/sys/arch/amd64/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.283 src/sys/arch/amd64/conf/GENERIC:1.284
--- src/sys/arch/amd64/conf/GENERIC:1.283	Fri Jul 23 00:43:20 2010
+++ src/sys/arch/amd64/conf/GENERIC	Sun Aug  8 18:28:00 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.283 2010/07/23 00:43:20 jakllsch Exp $
+# $NetBSD: GENERIC,v 1.284 2010/08/08 18:28:00 chs Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.283 $
+#ident 		GENERIC-$Revision: 1.284 $
 
 maxusers	64		# estimated number of users
 
@@ -484,6 +484,10 @@
 #spdmem* at iic? addr 0x51
 #spdmem* at iic? addr 0x52
 #spdmem* at iic? addr 0x53
+#spdmem* at iic? addr 0x54
+#spdmem* at iic? addr 0x55
+#spdmem* at iic? addr 0x56
+#spdmem* at iic? addr 0x57
 
 # I2O devices
 iop*	at pci? dev ? function ?	# I/O processor



CVS commit: src/usr.bin/kdump

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:31:50 UTC 2010

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

Log Message:
fix emul state tracking for exit vs exit_group on linux.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/kdump/kdump.c

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

Modified files:

Index: src/usr.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.104 src/usr.bin/kdump/kdump.c:1.105
--- src/usr.bin/kdump/kdump.c:1.104	Mon Apr 13 14:39:23 2009
+++ src/usr.bin/kdump/kdump.c	Sun Aug  8 18:31:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.104 2009/04/13 14:39:23 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.105 2010/08/08 18:31:50 chs Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = @(#)kdump.c	8.4 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: kdump.c,v 1.104 2009/04/13 14:39:23 christos Exp $);
+__RCSID($NetBSD: kdump.c,v 1.105 2010/08/08 18:31:50 chs Exp $);
 #endif
 #endif /* not lint */
 
@@ -532,7 +532,10 @@
 		if (plain) {
 			;
 
-		} else if (strcmp(sys_name, exit) == 0) {
+		} else if (strcmp(sys_name, exit_group) == 0 ||
+			   (strcmp(emul-name, linux) != 0 
+			strcmp(emul-name, linux32) != 0 
+			strcmp(sys_name, exit) == 0)) {
 			ectx_delete();
 
 		} else if (strcmp(sys_name, ioctl) == 0  argcount = 2) {



CVS commit: src/sys/lib/libsa

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:38:31 UTC 2010

Modified Files:
src/sys/lib/libsa: dev_net.c

Log Message:
print the correct error code if nfs_mount() fails.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/lib/libsa/dev_net.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/lib/libsa/dev_net.c
diff -u src/sys/lib/libsa/dev_net.c:1.24 src/sys/lib/libsa/dev_net.c:1.25
--- src/sys/lib/libsa/dev_net.c:1.24	Sat Jan 17 14:00:36 2009
+++ src/sys/lib/libsa/dev_net.c	Sun Aug  8 18:38:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dev_net.c,v 1.24 2009/01/17 14:00:36 tsutsui Exp $	*/
+/*	$NetBSD: dev_net.c,v 1.25 2010/08/08 18:38:31 chs Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
 			/* Get the NFS file handle (mountd). */
 			error = nfs_mount(netdev_sock, rootip, rootpath);
 			if (error) {
-printf(NFS mount error=%d\n, error);
+printf(NFS mount error=%d\n, errno);
 rootip.s_addr = 0;
 			fail:
 netif_close(netdev_sock);



CVS commit: src/sys/arch

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 18:44:16 UTC 2010

Modified Files:
src/sys/arch/sparc/include: fsr.h
src/sys/arch/sparc64/include: fsr.h

Log Message:
merge sparc and sparc64 fsr.h into one file.
add the missing FSR_TT_* definitions.
fix FSR_FTT_MASK.  fix the V9 FCC fields.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc/include/fsr.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/include/fsr.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/sparc/include/fsr.h
diff -u src/sys/arch/sparc/include/fsr.h:1.4 src/sys/arch/sparc/include/fsr.h:1.5
--- src/sys/arch/sparc/include/fsr.h:1.4	Sun Dec 11 12:19:05 2005
+++ src/sys/arch/sparc/include/fsr.h	Sun Aug  8 18:44:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fsr.h,v 1.4 2005/12/11 12:19:05 christos Exp $ */
+/*	$NetBSD: fsr.h,v 1.5 2010/08/08 18:44:15 chs Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,8 +40,8 @@
  *	@(#)fsr.h	8.1 (Berkeley) 6/11/93
  */
 
-#ifndef _MACHINE_FSR_H_
-#define	_MACHINE_FSR_H_
+#ifndef _SPARC_FSR_H_
+#define	_SPARC_FSR_H_
 
 /*
  * Bits in FSR.
@@ -81,8 +81,10 @@
 #define	  FSR_TT_UNIMP	3		/* unimplemented operation */
 #define	  FSR_TT_SEQ	4		/* sequence error */
 #define	  FSR_TT_HWERR	5		/* hardware error (unrecoverable) */
+#define	  FSR_TT_INVR	6		/* invalid fp register */
+#define	  FSR_TT_RESV	7		/* reserved */
 #define	FSR_FTT_SHIFT	14
-#define	FSR_FTT_MASK	0x03
+#define	FSR_FTT_MASK	0x07
 
 #define	FSR_QNE		0x2000	/* queue not empty */
 #define	FSR_PR		0x1000	/* partial result */
@@ -109,4 +111,29 @@
 #define	FSR_DZ	0x02			/* division by zero */
 #define	FSR_NX	0x01			/* inexact result */
 
-#endif /* _MACHINE_FSR_H_ */
+#ifdef __sparc_v9__
+
+/*
+ * The rest of these are only for sparcv9.
+ */
+
+/* These are the 3 new v9 fcc's */
+#define	FSR_FCC3	0x0030ULL	/* FP condition codes */
+#define	FSR_FCC3_SHIFT	36
+
+#define	FSR_FCC2	0x000cULL	/* FP condition codes */
+#define	FSR_FCC2_SHIFT	34
+
+#define	FSR_FCC1	0x0003ULL	/* FP condition codes */
+#define	FSR_FCC1_SHIFT	32
+
+/*
+ * Bits in FPRS.
+ */
+#define FPRS_FEF	0x04		/* Enable FP -- must be set to enable FP regs */
+#define FPRS_DU		0x02		/* Dirty upper -- upper fp regs are dirty */
+#define FPRS_DL		0x01		/* Dirty lower -- lower fp regs are dirty */
+
+#endif /* __sparc_v9__ */
+
+#endif /* _SPARC_FSR_H_ */

Index: src/sys/arch/sparc64/include/fsr.h
diff -u src/sys/arch/sparc64/include/fsr.h:1.3 src/sys/arch/sparc64/include/fsr.h:1.4
--- src/sys/arch/sparc64/include/fsr.h:1.3	Sun Dec 11 12:19:10 2005
+++ src/sys/arch/sparc64/include/fsr.h	Sun Aug  8 18:44:16 2010
@@ -1,131 +1,3 @@
-/*	$NetBSD: fsr.h,v 1.3 2005/12/11 12:19:10 christos Exp $ */
+/*	$NetBSD: fsr.h,v 1.4 2010/08/08 18:44:16 chs Exp $ */
 
-/*
- * Copyright (c) 1992, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Lawrence Berkeley Laboratory.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- *	@(#)fsr.h	8.1 (Berkeley) 6/11/93
- */
-

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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 20:04:25 UTC 2010

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

Log Message:
add more (commented-out) spdmem instances for HP xw-series workstations.


To generate a diff of this commit:
cvs rdiff -u -r1.989 -r1.990 src/sys/arch/i386/conf/GENERIC

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

Modified files:

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.989 src/sys/arch/i386/conf/GENERIC:1.990
--- src/sys/arch/i386/conf/GENERIC:1.989	Sat Jul 24 00:45:54 2010
+++ src/sys/arch/i386/conf/GENERIC	Sun Aug  8 20:04:24 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.989 2010/07/24 00:45:54 jym Exp $
+# $NetBSD: GENERIC,v 1.990 2010/08/08 20:04:24 chs Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.989 $
+#ident 		GENERIC-$Revision: 1.990 $
 
 maxusers	64		# estimated number of users
 
@@ -699,6 +699,10 @@
 #spdmem* at iic? addr 0x51
 #spdmem* at iic? addr 0x52
 #spdmem* at iic? addr 0x53
+#spdmem* at iic? addr 0x54
+#spdmem* at iic? addr 0x55
+#spdmem* at iic? addr 0x56
+#spdmem* at iic? addr 0x57
 
 # I2O devices
 iop*	at pci? dev ? function ?	# I/O processor



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

2010-08-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Aug  8 20:04:54 UTC 2010

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
add more spdmem instances for HP xw-series workstations.
add se (scsi ethernet).


To generate a diff of this commit:
cvs rdiff -u -r1.264 -r1.265 src/sys/arch/i386/conf/ALL

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

Modified files:

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.264 src/sys/arch/i386/conf/ALL:1.265
--- src/sys/arch/i386/conf/ALL:1.264	Sat Aug  7 09:55:59 2010
+++ src/sys/arch/i386/conf/ALL	Sun Aug  8 20:04:54 2010
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.264 2010/08/07 09:55:59 jruoho Exp $
+# $NetBSD: ALL,v 1.265 2010/08/08 20:04:54 chs Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.264 $
+#ident 		ALL-$Revision: 1.265 $
 
 maxusers	64		# estimated number of users
 
@@ -740,6 +740,10 @@
 spdmem* at iic? addr 0x51
 spdmem* at iic? addr 0x52
 spdmem* at iic? addr 0x53
+spdmem* at iic? addr 0x54
+spdmem* at iic? addr 0x55
+spdmem* at iic? addr 0x56
+spdmem* at iic? addr 0x57
 sdtemp* at iic? addr 0x18
 
 # I2O devices
@@ -840,6 +844,7 @@
 ch*	at scsibus? target ? lun ?	# SCSI autochangers
 ses*	at scsibus? target ? lun ?	# SCSI Enclosure Services devices
 ss*	at scsibus? target ? lun ?	# SCSI scanners
+se*	at scsibus? target ? lun ?	# SCSI ethernet adapters
 uk*	at scsibus? target ? lun ?	# SCSI unknown
 
 # SCSI NIC



CVS commit: src/sys

2011-02-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb  7 03:54:46 UTC 2011

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c
src/sys/arch/amd64/include: segments.h
src/sys/compat/linux32/arch/amd64: linux32_machdep.c

Log Message:
move macros for validating fs/gs to segments.h and use them
in the linux32 code as well.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/segments.h
cvs rdiff -u -r1.27 -r1.28 \
src/sys/compat/linux32/arch/amd64/linux32_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.69 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.70
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.69	Wed Jan 26 21:44:31 2011
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Mon Feb  7 03:54:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.69 2011/01/26 21:44:31 njoly Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.70 2011/02/07 03:54:45 chs Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.69 2011/01/26 21:44:31 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_machdep.c,v 1.70 2011/02/07 03:54:45 chs Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -953,11 +953,6 @@
  * These functions perform the needed checks.
  */
 
-#define	VALID_FS32(s) \
-(((s)  0x) == GSEL(GUFS_SEL, SEL_UPL))
-#define	VALID_GS32(s) \
-(((s)  0x) == GSEL(GUGS_SEL, SEL_UPL))
-
 static int
 check_sigcontext32(struct lwp *l, const struct netbsd32_sigcontext *scp)
 {
@@ -971,10 +966,10 @@
 	!VALID_USER_CSEL32(scp-sc_cs))
 		return EINVAL;
 	if (scp-sc_fs != 0  !VALID_USER_DSEL32(scp-sc_fs) 
-	!(VALID_FS32(scp-sc_fs)  pcb-pcb_fs != 0))
+	!(VALID_USER_FSEL32(scp-sc_fs)  pcb-pcb_fs != 0))
 		return EINVAL;
 	if (scp-sc_gs != 0  !VALID_USER_DSEL32(scp-sc_gs) 
-	!(VALID_GS32(scp-sc_gs)  pcb-pcb_gs != 0))
+	!(VALID_USER_GSEL32(scp-sc_gs)  pcb-pcb_gs != 0))
 		return EINVAL;
 	if (scp-sc_es != 0  !VALID_USER_DSEL32(scp-sc_es))
 		return EINVAL;
@@ -1000,10 +995,10 @@
 	!VALID_USER_CSEL32(gr[_REG32_CS]))
 		return EINVAL;
 	if (gr[_REG32_FS] != 0  !VALID_USER_DSEL32(gr[_REG32_FS]) 
-	!(VALID_FS32(gr[_REG32_FS])  pcb-pcb_fs != 0))
+	!(VALID_USER_FSEL32(gr[_REG32_FS])  pcb-pcb_fs != 0))
 		return EINVAL;
 	if (gr[_REG32_GS] != 0  !VALID_USER_DSEL32(gr[_REG32_GS]) 
-	!(VALID_GS32(gr[_REG32_GS])  pcb-pcb_gs != 0))
+	!(VALID_USER_GSEL32(gr[_REG32_GS])  pcb-pcb_gs != 0))
 		return EINVAL;
 	if (gr[_REG32_ES] != 0  !VALID_USER_DSEL32(gr[_REG32_ES]))
 		return EINVAL;

Index: src/sys/arch/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.21 src/sys/arch/amd64/include/segments.h:1.22
--- src/sys/arch/amd64/include/segments.h:1.21	Sun Sep  5 20:14:40 2010
+++ src/sys/arch/amd64/include/segments.h	Mon Feb  7 03:54:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.21 2010/09/05 20:14:40 chs Exp $	*/
+/*	$NetBSD: segments.h,v 1.22 2011/02/07 03:54:45 chs Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -397,6 +397,10 @@
  ((s)  0x) == LSEL(LUDATA32_SEL, SEL_UPL))
 #define VALID_USER_CSEL32(s) \
 ((s) == GSEL(GUCODE32_SEL, SEL_UPL) || (s) == LSEL(LUCODE32_SEL, SEL_UPL))
+#define VALID_USER_FSEL32(s) \
+(((s)  0x) == GSEL(GUFS_SEL, SEL_UPL))
+#define VALID_USER_GSEL32(s) \
+(((s)  0x) == GSEL(GUGS_SEL, SEL_UPL))
 
 #define VALID_USER_CSEL(s) \
 ((s) == GSEL(GUCODE_SEL, SEL_UPL) || (s) == LSEL(LUCODE_SEL, SEL_UPL))

Index: src/sys/compat/linux32/arch/amd64/linux32_machdep.c
diff -u src/sys/compat/linux32/arch/amd64/linux32_machdep.c:1.27 src/sys/compat/linux32/arch/amd64/linux32_machdep.c:1.28
--- src/sys/compat/linux32/arch/amd64/linux32_machdep.c:1.27	Tue Nov  2 18:14:06 2010
+++ src/sys/compat/linux32/arch/amd64/linux32_machdep.c	Mon Feb  7 03:54:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_machdep.c,v 1.27 2010/11/02 18:14:06 chs Exp $ */
+/*	$NetBSD: linux32_machdep.c,v 1.28 2011/02/07 03:54:45 chs Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -31,7 +31,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: linux32_machdep.c,v 1.27 2010/11/02 18:14:06 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: linux32_machdep.c,v 1.28 2011/02/07 03:54:45 chs Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -433,11 +433,11 @@
 		return EINVAL;
 
 	if (scp-sc_fs != 0  !VALID_USER_DSEL32(scp-sc_fs) 
-	!(scp-sc_fs == GSEL(GUFS_SEL, SEL_UPL)  pcb-pcb_fs != 0))
+	!(VALID_USER_FSEL32(scp-sc_fs)  pcb-pcb_fs != 0))
 		return EINVAL;
 
 	if (scp-sc_gs != 0  

CVS commit: src/sys/arch

2010-03-20 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Mar 21 00:10:15 UTC 2010

Modified Files:
src/sys/arch/arm/arm32: fault.c
src/sys/arch/powerpc/powerpc: trap.c

Log Message:
assert that pcb_onfault is NULL in places where it should be.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/arm/arm32/fault.c
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/powerpc/powerpc/trap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/fault.c
diff -u src/sys/arch/arm/arm32/fault.c:1.75 src/sys/arch/arm/arm32/fault.c:1.76
--- src/sys/arch/arm/arm32/fault.c:1.75	Wed Feb  3 13:51:00 2010
+++ src/sys/arch/arm/arm32/fault.c	Sun Mar 21 00:10:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fault.c,v 1.75 2010/02/03 13:51:00 wiz Exp $	*/
+/*	$NetBSD: fault.c,v 1.76 2010/03/21 00:10:14 chs Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
 #include opt_sa.h
 
 #include sys/types.h
-__KERNEL_RCSID(0, $NetBSD: fault.c,v 1.75 2010/02/03 13:51:00 wiz Exp $);
+__KERNEL_RCSID(0, $NetBSD: fault.c,v 1.76 2010/03/21 00:10:14 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -868,6 +868,7 @@
 	}
 #endif
 
+	KASSERT(pcb-pcb_onfault == NULL);
 	error = uvm_fault(map, va, VM_PROT_READ);
 
 #ifdef KERN_SA

Index: src/sys/arch/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.133 src/sys/arch/powerpc/powerpc/trap.c:1.134
--- src/sys/arch/powerpc/powerpc/trap.c:1.133	Thu Feb 25 23:31:48 2010
+++ src/sys/arch/powerpc/powerpc/trap.c	Sun Mar 21 00:10:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.133 2010/02/25 23:31:48 matt Exp $	*/
+/*	$NetBSD: trap.c,v 1.134 2010/03/21 00:10:14 chs Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.133 2010/02/25 23:31:48 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.134 2010/03/21 00:10:14 chs Exp $);
 
 #include opt_altivec.h
 #include opt_ddb.h
@@ -84,7 +84,6 @@
 	struct proc *p = l ? l-l_proc : NULL;
 	struct pcb *pcb = curpcb;
 	struct vm_map *map;
-	struct faultbuf *onfault;
 	ksiginfo_t ksi;
 	int type = frame-exc;
 	int ftype, rv;
@@ -121,7 +120,9 @@
 	case EXC_DSI: {
 		struct faultbuf *fb;
 		vaddr_t va = frame-dar;
+
 		ci-ci_ev_kdsi.ev_count++;
+		fb = pcb-pcb_onfault;
 
 		/*
 		 * Only query UVM if no interrupts are active.
@@ -169,10 +170,9 @@
 			else
 ftype = VM_PROT_READ;
 
-			onfault = pcb-pcb_onfault;
 			pcb-pcb_onfault = NULL;
 			rv = uvm_fault(map, trunc_page(va), ftype);
-			pcb-pcb_onfault = onfault;
+			pcb-pcb_onfault = fb;
 
 			if (map != kernel_map) {
 /*
@@ -193,7 +193,7 @@
 			 */
 			rv = EFAULT;
 		}
-		if ((fb = pcb-pcb_onfault) != NULL) {
+		if (fb != NULL) {
 			frame-srr0 = fb-fb_pc;
 			frame-fixreg[1] = fb-fb_sp;
 			frame-fixreg[2] = fb-fb_r2;
@@ -241,6 +241,7 @@
 			l-l_savp-savp_faultaddr = (vaddr_t)frame-dar;
 			l-l_pflag |= LP_SA_PAGEFAULT;
 		}
+		KASSERT(pcb-pcb_onfault == NULL);
 		rv = uvm_fault(map, trunc_page(frame-dar), ftype);
 		if (rv == 0) {
 			/*
@@ -311,6 +312,7 @@
 			l-l_pflag |= LP_SA_PAGEFAULT;
 		}
 		ftype = VM_PROT_EXECUTE;
+		KASSERT(pcb-pcb_onfault == NULL);
 		rv = uvm_fault(map, trunc_page(frame-srr0), ftype);
 		if (rv == 0) {
 			l-l_pflag = ~LP_SA_PAGEFAULT;



CVS commit: src/sys/nfs

2010-03-20 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Mar 21 00:10:40 UTC 2010

Modified Files:
src/sys/nfs: nfs_bootparam.c

Log Message:
in nfs_bootparam(), set the corresponding flag for each field that we fill in.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/nfs/nfs_bootparam.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/nfs/nfs_bootparam.c
diff -u src/sys/nfs/nfs_bootparam.c:1.36 src/sys/nfs/nfs_bootparam.c:1.37
--- src/sys/nfs/nfs_bootparam.c:1.36	Tue Mar  2 23:19:09 2010
+++ src/sys/nfs/nfs_bootparam.c	Sun Mar 21 00:10:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_bootparam.c,v 1.36 2010/03/02 23:19:09 pooka Exp $	*/
+/*	$NetBSD: nfs_bootparam.c,v 1.37 2010/03/21 00:10:40 chs Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: nfs_bootparam.c,v 1.36 2010/03/02 23:19:09 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: nfs_bootparam.c,v 1.37 2010/03/21 00:10:40 chs Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_nfs_boot.h
@@ -178,6 +178,7 @@
 		printf(nfs_boot: bootparam whoami, error=%d\n, error);
 		goto delout;
 	}
+	*flags |= NFS_BOOT_HAS_SERVADDR | NFS_BOOT_HAS_SERVER;
 	printf(nfs_boot: server_addr=%s\n, inet_ntoa(sin-sin_addr));
 	printf(nfs_boot: hostname=%s\n, hostname);
 
@@ -190,6 +191,7 @@
 		printf(nfs_boot: bootparam get root: %d\n, error);
 		goto delout;
 	}
+	*flags |= NFS_BOOT_HAS_ROOTPATH;
 
 #ifndef NFS_BOOTPARAM_NOGATEWAY
 	gw_ndm = kmem_alloc(sizeof(*gw_ndm), KM_SLEEP);
@@ -208,6 +210,7 @@
 	printf(nfs_boot: gateway=%s\n, inet_ntoa(sin-sin_addr));
 	/* Just save it.  Caller adds the route. */
 	nd-nd_gwip = sin-sin_addr;
+	*flags |= NFS_BOOT_HAS_GWIP;
 
 	/* Look for a mask string after the colon. */
 	p = strchr(gw_ndm-ndm_host, ':');
@@ -221,6 +224,7 @@
 
 	/* Have a netmask too!  Save it; update the I/F. */
 	nd-nd_mask.s_addr = mask;
+	*flags |= NFS_BOOT_HAS_MASK;
 	printf(nfs_boot: my_mask=%s\n, inet_ntoa(nd-nd_mask));
 	(void)  nfs_boot_deladdress(ifp, lwp, my_ip.s_addr);
 	error = nfs_boot_setaddress(ifp, lwp, my_ip.s_addr,
@@ -248,6 +252,7 @@
 	if (gw_ip.s_addr) {
 		/* Our caller will add the route. */
 		nd-nd_gwip = gw_ip;
+		*flags |= NFS_BOOT_HAS_GWIP;
 	}
 #endif
 



CVS commit: src/sys/compat/linux/arch/i386

2010-04-22 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Apr 23 03:02:16 UTC 2010

Modified Files:
src/sys/compat/linux/arch/i386: syscalls.master

Log Message:
add missing argument to clone().  the symptom of this was that pthread_join()
would sometimes get stuck, such as in our mutex2 regression test.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/compat/linux/arch/i386/syscalls.master

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

Modified files:

Index: src/sys/compat/linux/arch/i386/syscalls.master
diff -u src/sys/compat/linux/arch/i386/syscalls.master:1.101 src/sys/compat/linux/arch/i386/syscalls.master:1.102
--- src/sys/compat/linux/arch/i386/syscalls.master:1.101	Tue Nov 24 10:42:43 2009
+++ src/sys/compat/linux/arch/i386/syscalls.master	Fri Apr 23 03:02:16 2010
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.101 2009/11/24 10:42:43 njoly Exp $
+	$NetBSD: syscalls.master,v 1.102 2010/04/23 03:02:16 chs Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 
@@ -227,7 +227,7 @@
 118	NOARGS		{ int|sys||fsync(int fd); }
 119	STD		{ int|linux_sys||sigreturn(struct linux_sigcontext *scp); }
 120	STD		{ int|linux_sys||clone(int flags, void *stack, \
-			void *parent_tidptr, void *child_tidptr); }
+			void *parent_tidptr, void *tls, void *child_tidptr); }
 121	STD		{ int|linux_sys||setdomainname(char *domainname, \
 			int len); }
 122	STD		{ int|linux_sys||uname(struct linux_utsname *up); }



CVS commit: src/sys/dev/ic

2010-04-28 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Apr 28 22:45:27 UTC 2010

Modified Files:
src/sys/dev/ic: mpt.c mpt.h mpt_debug.c mpt_netbsd.c

Log Message:
add byte-swapping so that this works on BE platforms.
the logic is based on the current freebsd driver.
fixes PR 42870.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/mpt.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/mpt.h src/sys/dev/ic/mpt_debug.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/mpt_netbsd.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/mpt.c
diff -u src/sys/dev/ic/mpt.c:1.13 src/sys/dev/ic/mpt.c:1.14
--- src/sys/dev/ic/mpt.c:1.13	Sat Apr 18 14:58:02 2009
+++ src/sys/dev/ic/mpt.c	Wed Apr 28 22:45:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt.c,v 1.13 2009/04/18 14:58:02 tsutsui Exp $	*/
+/*	$NetBSD: mpt.c,v 1.14 2010/04/28 22:45:27 chs Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 by Greg Ansley
@@ -27,6 +27,75 @@
 /*
  * Additional Copyright (c) 2002 by Matthew Jacob under same license.
  */
+/*-
+ * Copyright (c) 2002, 2006 by Matthew Jacob
+ * All rights reserved.
+ *
+ * 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 at minimum a disclaimer
+ *substantially similar to the NO WARRANTY disclaimer below
+ *(Disclaimer) and any redistribution must be conditioned upon including
+ *a substantially similar Disclaimer requirement for further binary
+ *redistribution.
+ * 3. Neither the names of the above listed copyright holders nor the names
+ *of any contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 THE COPYRIGHT
+ * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Support from Chris Ellsworth in order to make SAS adapters work
+ * is gratefully acknowledged.
+ *
+ *
+ * Support from LSI-Logic has also gone a great deal toward making this a
+ * workable subsystem and is gratefully acknowledged.
+ */
+/*-
+ * Copyright (c) 2004, Avid Technology, Inc. and its contributors.
+ * Copyright (c) 2005, WHEEL Sp. z o.o.
+ * Copyright (c) 2004, 2005 Justin T. Gibbs
+ * All rights reserved.
+ *
+ * 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 at minimum a disclaimer
+ *substantially similar to the NO WARRANTY disclaimer below
+ *(Disclaimer) and any redistribution must be conditioned upon including
+ *a substantially similar Disclaimer requirement for further binary
+ *redistribution.
+ * 3. Neither the names of the above listed copyright holders nor the names
+ *of any contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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 THE COPYRIGHT
+ * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
 
 
 /*
@@ 

CVS commit: src/sys/arch

2010-04-29 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Apr 29 22:40:54 UTC 2010

Modified Files:
src/sys/arch/acorn26/conf: GENERIC
src/sys/arch/acorn32/conf: GENERIC
src/sys/arch/alpha/conf: GENERIC
src/sys/arch/amiga/conf: GENERIC.in
src/sys/arch/atari/conf: GENERIC.in
src/sys/arch/bebox/conf: GENERIC
src/sys/arch/cats/conf: GENERIC
src/sys/arch/cobalt/conf: GENERIC
src/sys/arch/dreamcast/conf: GENERIC
src/sys/arch/ews4800mips/conf: GENERIC
src/sys/arch/hp300/conf: GENERIC
src/sys/arch/hp700/conf: GENERIC
src/sys/arch/hpcmips/conf: GENERIC
src/sys/arch/ia64/conf: GENERIC
src/sys/arch/luna68k/conf: GENERIC
src/sys/arch/mipsco/conf: GENERIC
src/sys/arch/mmeye/conf: GENERIC
src/sys/arch/mvme68k/conf: GENERIC
src/sys/arch/mvmeppc/conf: GENERIC
src/sys/arch/netwinder/conf: GENERIC
src/sys/arch/news68k/conf: GENERIC
src/sys/arch/newsmips/conf: GENERIC
src/sys/arch/next68k/conf: GENERIC
src/sys/arch/ofppc/conf: GENERIC GENERIC.MP
src/sys/arch/pmax/conf: GENERIC GENERIC64
src/sys/arch/prep/conf: GENERIC
src/sys/arch/rs6000/conf: GENERIC
src/sys/arch/sbmips/conf: GENERIC
src/sys/arch/sparc/conf: GENERIC
src/sys/arch/sun2/conf: GENERIC
src/sys/arch/sun3/conf: GENERIC GENERIC3X
src/sys/arch/vax/conf: GENERIC
src/sys/arch/x68k/conf: GENERIC

Log Message:
enable TMPFS in all GENERICs that have MFS enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/acorn26/conf/GENERIC
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/acorn32/conf/GENERIC
cvs rdiff -u -r1.334 -r1.335 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/amiga/conf/GENERIC.in
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/atari/conf/GENERIC.in
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/bebox/conf/GENERIC
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/cats/conf/GENERIC
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/cobalt/conf/GENERIC
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/dreamcast/conf/GENERIC
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/ews4800mips/conf/GENERIC
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/hp300/conf/GENERIC
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/hp700/conf/GENERIC
cvs rdiff -u -r1.209 -r1.210 src/sys/arch/hpcmips/conf/GENERIC
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/ia64/conf/GENERIC
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/mipsco/conf/GENERIC
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/mmeye/conf/GENERIC
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/mvme68k/conf/GENERIC
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mvmeppc/conf/GENERIC
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/netwinder/conf/GENERIC
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/news68k/conf/GENERIC
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/newsmips/conf/GENERIC
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/ofppc/conf/GENERIC
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/ofppc/conf/GENERIC.MP
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/pmax/conf/GENERIC
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/pmax/conf/GENERIC64
cvs rdiff -u -r1.151 -r1.152 src/sys/arch/prep/conf/GENERIC
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/rs6000/conf/GENERIC
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/sbmips/conf/GENERIC
cvs rdiff -u -r1.222 -r1.223 src/sys/arch/sparc/conf/GENERIC
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/sun2/conf/GENERIC
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/sun3/conf/GENERIC
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/sun3/conf/GENERIC3X
cvs rdiff -u -r1.171 -r1.172 src/sys/arch/vax/conf/GENERIC
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/x68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/acorn26/conf/GENERIC
diff -u src/sys/arch/acorn26/conf/GENERIC:1.61 src/sys/arch/acorn26/conf/GENERIC:1.62
--- src/sys/arch/acorn26/conf/GENERIC:1.61	Fri Apr 16 13:48:27 2010
+++ src/sys/arch/acorn26/conf/GENERIC	Thu Apr 29 22:40:48 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.61 2010/04/16 13:48:27 pooka Exp $
+# $NetBSD: GENERIC,v 1.62 2010/04/29 22:40:48 chs Exp $
 #
 # GENERIC machine description file
 # 
@@ -61,7 +61,7 @@
 file-system	KERNFS		# /kern
 file-system	FDESC		# /dev/fd
 file-system	PTYFS		# /dev/pts/N support
-#file-system	TMPFS		# Efficient memory file-system
+file-system	TMPFS		# Efficient memory file-system
 #file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
 
 # File system options

Index: src/sys/arch/acorn32/conf/GENERIC
diff -u src/sys/arch/acorn32/conf/GENERIC:1.95 src/sys/arch/acorn32/conf/GENERIC:1.96
--- src/sys/arch/acorn32/conf/GENERIC:1.95	Fri Apr 16 13:48:27 2010
+++ src/sys/arch/acorn32/conf/GENERIC	Thu Apr 29 22:40:48 2010
@@ -1,4 +1,4 @@
-# 	$NetBSD: GENERIC,v 1.95 

CVS commit: src/sys/arch

2010-04-29 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Apr 29 23:39:47 UTC 2010

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

Log Message:
add mpt.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/sys/arch/macppc/conf/GENERIC
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/sparc64/conf/GENERIC

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

Modified files:

Index: src/sys/arch/macppc/conf/GENERIC
diff -u src/sys/arch/macppc/conf/GENERIC:1.280 src/sys/arch/macppc/conf/GENERIC:1.281
--- src/sys/arch/macppc/conf/GENERIC:1.280	Fri Apr 16 13:48:33 2010
+++ src/sys/arch/macppc/conf/GENERIC	Thu Apr 29 23:39:47 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.280 2010/04/16 13:48:33 pooka Exp $
+# $NetBSD: GENERIC,v 1.281 2010/04/29 23:39:47 chs Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.280 $
+#ident 		GENERIC-$Revision: 1.281 $
 
 maxusers	32
 
@@ -266,6 +266,7 @@
 esiop*	at pci? dev ? function ?	# NCR 53c8xx SCSI (enhanced)
 iha*	at pci? dev ? function ?	# Initio INIC-940/950 SCSI
 isp*	at pci? dev ? function ?	# Qlogic ISP 10x0/2xx0 SCSI/Fibre Chan
+mpt*	at pci? dev ? function ?	# LSILogic 9x9 and 53c1030
 pcscp*	at pci? dev ? function ?	# AMD Am53c974 PCscsi-PCI SCSI
 siop*	at pci? dev ? function ?	# NCR 53c8xx SCSI
 trm*	at pci? dev ? function ?	# Tekram DC-395U/UW/F, DC-315/U SCSI

Index: src/sys/arch/sparc64/conf/GENERIC
diff -u src/sys/arch/sparc64/conf/GENERIC:1.124 src/sys/arch/sparc64/conf/GENERIC:1.125
--- src/sys/arch/sparc64/conf/GENERIC:1.124	Fri Apr 16 13:48:35 2010
+++ src/sys/arch/sparc64/conf/GENERIC	Thu Apr 29 23:39:47 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.124 2010/04/16 13:48:35 pooka Exp $
+# $NetBSD: GENERIC,v 1.125 2010/04/29 23:39:47 chs Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.124 $
+#ident 		GENERIC-$Revision: 1.125 $
 
 maxusers	64
 
@@ -339,6 +339,7 @@
 bha*	at pci? dev ? function ?	# BusLogic 9xx SCSI UT
 dpt*	at pci? dev ? function ?	# DPT SmartCache/SmartRAID UT
 iha*	at pci? dev ? function ?	# Initio INIC-940/950 SCSI
+mpt*	at pci? dev ? function ?	# LSILogic 9x9 and 53c1030
 njs*	at pci? dev ? function ?	# Workbit NinjaSCSI-32
 pcscp*	at pci? dev ? function ?	# AMD 53c974 PCscsi-PCI SCSI
 trm*	at pci? dev ? function ?	# Tekram DC-395U/UW/F, DC-315/U SCSI



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

2010-05-02 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun May  2 17:24:36 UTC 2010

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

Log Message:
add alipm and its iic bus.


To generate a diff of this commit:
cvs rdiff -u -r1.980 -r1.981 src/sys/arch/i386/conf/GENERIC

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

Modified files:

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.980 src/sys/arch/i386/conf/GENERIC:1.981
--- src/sys/arch/i386/conf/GENERIC:1.980	Fri Apr 16 13:48:32 2010
+++ src/sys/arch/i386/conf/GENERIC	Sun May  2 17:24:35 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.980 2010/04/16 13:48:32 pooka Exp $
+# $NetBSD: GENERIC,v 1.981 2010/05/02 17:24:35 chs Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.980 $
+#ident 		GENERIC-$Revision: 1.981 $
 
 maxusers	64		# estimated number of users
 
@@ -614,7 +614,11 @@
 
 # AMD 768 and 8111 power/ACPI controllers
 amdpm*	at pci? dev ? function ?	# RNG and SMBus 1.0 interface
-#iic*	at amdpm?			# sensors below are on this bus
+iic*	at amdpm?
+
+# Acer Labs M7101 SMBus controller
+alipm*	at pci? dev ? function ?
+iic*	at alipm?
 
 # Intel Core's on-die Thermal sensor
 options 	INTEL_CORETEMP



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

2010-05-02 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun May  2 17:27:16 UTC 2010

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
add alipm and its iic bus.


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/arch/i386/conf/ALL

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

Modified files:

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.255 src/sys/arch/i386/conf/ALL:1.256
--- src/sys/arch/i386/conf/ALL:1.255	Fri Apr 16 13:48:32 2010
+++ src/sys/arch/i386/conf/ALL	Sun May  2 17:27:16 2010
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.255 2010/04/16 13:48:32 pooka Exp $
+# $NetBSD: ALL,v 1.256 2010/05/02 17:27:16 chs Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.255 $
+#ident 		ALL-$Revision: 1.256 $
 
 maxusers	64		# estimated number of users
 
@@ -662,6 +662,10 @@
 amdpm*	at pci? dev ? function ?	# RNG and SMBus 1.0 interface
 iic*	at amdpm?			# sensors below are on this bus
 
+# Acer Labs M7101 SMBus controller
+alipm*	at pci? dev ? function ?
+iic*	at alipm?
+
 # Intel Core's on-die Thermal sensor
 options 	INTEL_CORETEMP
 



CVS commit: src/lib/libkvm

2012-01-10 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Jan 10 16:01:16 UTC 2012

Modified Files:
src/lib/libkvm: kvm_x86_64.c

Log Message:
fix handling of large pages.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libkvm/kvm_x86_64.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/libkvm/kvm_x86_64.c
diff -u src/lib/libkvm/kvm_x86_64.c:1.8 src/lib/libkvm/kvm_x86_64.c:1.9
--- src/lib/libkvm/kvm_x86_64.c:1.8	Mon Sep 20 23:23:16 2010
+++ src/lib/libkvm/kvm_x86_64.c	Tue Jan 10 16:01:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kvm_x86_64.c,v 1.8 2010/09/20 23:23:16 jym Exp $	*/
+/*	$NetBSD: kvm_x86_64.c,v 1.9 2012/01/10 16:01:16 chs Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = @(#)kvm_hp300.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: kvm_x86_64.c,v 1.8 2010/09/20 23:23:16 jym Exp $);
+__RCSID($NetBSD: kvm_x86_64.c,v 1.9 2012/01/10 16:01:16 chs Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -105,7 +105,6 @@ _kvm_kvatop(kvm_t *kd, vaddr_t va, paddr
 	}
 
 	cpu_kh = kd-cpu_data;
-	page_off = va  PGOFSET;
 
 	/*
 	 * Find and read all entries to get to the pa.
@@ -138,6 +137,11 @@ _kvm_kvatop(kvm_t *kd, vaddr_t va, paddr
 		_kvm_err(kd, 0, invalid translation (invalid level 3 PDE));
 		goto lose;
 	}
+	if (pde  PG_PS) {
+		page_off = va  (NBPD_L3 - 1);
+		*pa = (pde  PG_1GFRAME) + page_off;
+		return (int)(NBPD_L3 - page_off);
+	}
 
 	/*
 	 * Level 2.
@@ -152,7 +156,11 @@ _kvm_kvatop(kvm_t *kd, vaddr_t va, paddr
 		_kvm_err(kd, 0, invalid translation (invalid level 2 PDE));
 		goto lose;
 	}
-
+	if (pde  PG_PS) {
+		page_off = va  (NBPD_L2 - 1);
+		*pa = (pde  PG_2MFRAME) + page_off;
+		return (int)(NBPD_L2 - page_off);
+	}
 
 	/*
 	 * Level 1.
@@ -170,6 +178,7 @@ _kvm_kvatop(kvm_t *kd, vaddr_t va, paddr
 		_kvm_err(kd, 0, invalid translation (invalid PTE));
 		goto lose;
 	}
+	page_off = va  PGOFSET;
 	*pa = (pte  PG_FRAME) + page_off;
 	return (int)(NBPG - page_off);
 



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

2012-01-10 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Jan 10 16:03:17 UTC 2012

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

Log Message:
reduce VM_MAX_KERNEL_ADDRESS so that it does not include
the direct-map or APTE regions.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amd64/include/vmparam.h

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

Modified files:

Index: src/sys/arch/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.28 src/sys/arch/amd64/include/vmparam.h:1.29
--- src/sys/arch/amd64/include/vmparam.h:1.28	Thu Nov 24 17:08:07 2011
+++ src/sys/arch/amd64/include/vmparam.h	Tue Jan 10 16:03:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.28 2011/11/24 17:08:07 christos Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.29 2012/01/10 16:03:17 chs Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -122,7 +122,7 @@
 #else /* XEN */
 #define VM_MIN_KERNEL_ADDRESS	0xa000
 #endif
-#define VM_MAX_KERNEL_ADDRESS	0xff80
+#define VM_MAX_KERNEL_ADDRESS	0xfe80
 
 #define VM_MAXUSER_ADDRESS32	0xf000
 



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

2012-02-11 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Feb 11 18:59:41 UTC 2012

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

Log Message:
zero out the unused parts of direct-map page-table pages.
these seem to cause problems even though they aren't actually referenced,
probably due to speculative execution.
fixes PR 45892.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 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.163 src/sys/arch/x86/x86/pmap.c:1.164
--- src/sys/arch/x86/x86/pmap.c:1.163	Wed Feb  1 18:55:32 2012
+++ src/sys/arch/x86/x86/pmap.c	Sat Feb 11 18:59:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.163 2012/02/01 18:55:32 cherry Exp $	*/
+/*	$NetBSD: pmap.c,v 1.164 2012/02/11 18:59:41 chs 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.163 2012/02/01 18:55:32 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.164 2012/02/11 18:59:41 chs Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -1188,7 +1188,7 @@ pmap_bootstrap(vaddr_t kva_start)
 #ifdef __HAVE_DIRECT_MAP
 	phys_ram_seg_t *mc;
 	long ndmpdp;
-	paddr_t dmpd, dmpdp, pdp;
+	paddr_t lastpa, dmpd, dmpdp, pdp;
 	vaddr_t tmpva;
 #endif
 
@@ -1331,10 +1331,19 @@ pmap_bootstrap(vaddr_t kva_start)
 	 * otherwise use 2MB pages.
 	 */
 
-	mc = mem_clusters[mem_cluster_cnt - 1];
-	ndmpdp = (mc-start + mc-size + NBPD_L3 - 1)  L3_SHIFT;
+	lastpa = 0;
+	for (i = 0; i  mem_cluster_cnt; i++) {
+		mc = mem_clusters[i];
+		lastpa = MAX(lastpa, mc-start + mc-size);
+	}
+
+	ndmpdp = (lastpa + NBPD_L3 - 1)  L3_SHIFT;
 	dmpdp = avail_start;	avail_start += PAGE_SIZE;
 
+	*pte = dmpdp | PG_V | PG_RW;
+	pmap_update_pg(tmpva);
+	memset((void *)tmpva, 0, PAGE_SIZE);
+
 	if (cpu_feature[2]  CPUID_P1GB) {
 		for (i = 0; i  ndmpdp; i++) {
 			pdp = (paddr_t)(((pd_entry_t *)dmpdp)[i]);
@@ -1348,6 +1357,13 @@ pmap_bootstrap(vaddr_t kva_start)
 	} else {
 		dmpd = avail_start;	avail_start += ndmpdp * PAGE_SIZE;
 
+		for (i = 0; i  ndmpdp; i++) {
+			pdp = dmpd + i * PAGE_SIZE;
+			*pte = (pdp  PG_FRAME) | PG_V | PG_RW;
+			pmap_update_pg(tmpva);
+
+			memset((void *)tmpva, 0, PAGE_SIZE);
+		}
 		for (i = 0; i  NPDPG * ndmpdp; i++) {
 			pdp = (paddr_t)(((pd_entry_t *)dmpd)[i]);
 			*pte = (pdp  PG_FRAME) | PG_V | PG_RW;



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

2012-02-22 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Feb 22 14:12:04 UTC 2012

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

Log Message:
fix stack backtraces through traps.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/amd64/db_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/db_machdep.c
diff -u src/sys/arch/amd64/amd64/db_machdep.c:1.1 src/sys/arch/amd64/amd64/db_machdep.c:1.2
--- src/sys/arch/amd64/amd64/db_machdep.c:1.1	Sun Apr 10 20:36:49 2011
+++ src/sys/arch/amd64/amd64/db_machdep.c	Wed Feb 22 14:12:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.1 2011/04/10 20:36:49 christos Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.2 2012/02/22 14:12:04 chs Exp $	*/
 
 /* 
  * Mach Operating System
@@ -26,7 +26,7 @@
  * rights to redistribute these changes.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_machdep.c,v 1.1 2011/04/10 20:36:49 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_machdep.c,v 1.2 2012/02/22 14:12:04 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -131,7 +131,7 @@ db_nextframe(long **nextframe, long **re
 	default:
 
 		/* The only argument to trap() or syscall() is the trapframe. */
-		tf = *(struct trapframe **)argp;
+		tf = (struct trapframe *)argp;
 		switch (is_trap) {
 		case TRAP:
 			(*pr)(--- trap (number %d) ---\n, tf-tf_trapno);
@@ -141,7 +141,6 @@ db_nextframe(long **nextframe, long **re
 			break;
 		case INTERRUPT:
 			(*pr)(--- interrupt ---\n);
-			tf = (struct trapframe *)argp;
 			break;
 		}
 		*ip = (db_addr_t)tf-tf_rip;



CVS commit: src/sys/arch

2012-02-23 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Feb 23 14:45:55 UTC 2012

Modified Files:
src/sys/arch/amd64/amd64: machdep.c
src/sys/arch/i386/i386: machdep.c
src/sys/arch/x86/x86: identcpu.c

Log Message:
move XEN CPU feature masking into cpu_probe() so that it's applied
to all CPUs, not just the boot CPU.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.719 -r1.720 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x86/x86/identcpu.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.177 src/sys/arch/amd64/amd64/machdep.c:1.178
--- src/sys/arch/amd64/amd64/machdep.c:1.177	Sun Feb 19 23:15:24 2012
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Feb 23 14:45:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.177 2012/02/19 23:15:24 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.178 2012/02/23 14:45:54 chs Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.177 2012/02/19 23:15:24 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.178 2012/02/23 14:45:54 chs Exp $);
 
 /* #define XENDEBUG_LOW  */
 
@@ -1591,8 +1591,6 @@ init_x86_64(paddr_t first_avail)
 	__PRINTK((init_x86_64(0x%lx)\n, first_avail));
 #endif /* XEN */
 
-	cpu_feature[0] = ~CPUID_FEAT_BLACKLIST;
-
 	cpu_init_msrs(cpu_info_primary, true);
 
 	pcb = lwp_getpcb(lwp0);

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.719 src/sys/arch/i386/i386/machdep.c:1.720
--- src/sys/arch/i386/i386/machdep.c:1.719	Wed Feb 22 18:35:26 2012
+++ src/sys/arch/i386/i386/machdep.c	Thu Feb 23 14:45:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.719 2012/02/22 18:35:26 bouyer Exp $	*/
+/*	$NetBSD: machdep.c,v 1.720 2012/02/23 14:45:55 chs 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.719 2012/02/22 18:35:26 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.720 2012/02/23 14:45:55 chs Exp $);
 
 #include opt_beep.h
 #include opt_compat_ibcs2.h
@@ -1284,8 +1284,6 @@ init386(paddr_t first_avail)
 	uvm_lwp_setuarea(lwp0, lwp0uarea);
 	pcb = lwp_getpcb(lwp0);
 
-	cpu_feature[0] = ~CPUID_FEAT_BLACKLIST;
-
 	cpu_init_msrs(cpu_info_primary, true);
 
 #ifdef PAE

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.29 src/sys/arch/x86/x86/identcpu.c:1.30
--- src/sys/arch/x86/x86/identcpu.c:1.29	Fri Feb  3 05:06:51 2012
+++ src/sys/arch/x86/x86/identcpu.c	Thu Feb 23 14:45:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.29 2012/02/03 05:06:51 yamt Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.30 2012/02/23 14:45:55 chs Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: identcpu.c,v 1.29 2012/02/03 05:06:51 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: identcpu.c,v 1.30 2012/02/23 14:45:55 chs Exp $);
 
 #include opt_xen.h
 
@@ -700,6 +700,7 @@ cpu_probe(struct cpu_info *ci)
 		wrmsr(MSR_MISC_ENABLE, rdmsr(MSR_MISC_ENABLE) | (13));
 	}
 
+	ci-ci_feat_val[0] = ~CPUID_FEAT_BLACKLIST;
 	if (ci == cpu_info_primary) {
 		/* If first. Boot Processor is the cpu_feature reference. */
 		for (i = 0; i  __arraycount(cpu_feature); i++) {



CVS commit: src/sys/fs/tmpfs

2012-02-27 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb 27 16:10:56 UTC 2012

Modified Files:
src/sys/fs/tmpfs: tmpfs_vnops.c

Log Message:
in tmpfs_readdir(), skip the . and .. processing on removed directories,
since the latter will crash in this case.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/fs/tmpfs/tmpfs_vnops.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/tmpfs/tmpfs_vnops.c
diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.94 src/sys/fs/tmpfs/tmpfs_vnops.c:1.95
--- src/sys/fs/tmpfs/tmpfs_vnops.c:1.94	Sun Jan 22 03:13:19 2012
+++ src/sys/fs/tmpfs/tmpfs_vnops.c	Mon Feb 27 16:10:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.94 2012/01/22 03:13:19 rmind Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.95 2012/02/27 16:10:56 chs Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tmpfs_vnops.c,v 1.94 2012/01/22 03:13:19 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: tmpfs_vnops.c,v 1.95 2012/02/27 16:10:56 chs Exp $);
 
 #include sys/param.h
 #include sys/dirent.h
@@ -2206,6 +2206,10 @@ tmpfs_readdir(void *v)
 	node = VP_TO_TMPFS_DIR(vp);
 	startoff = uio-uio_offset;
 	cnt = 0;
+	if (node-tn_links == 0) {
+		error = 0;
+		goto out;
+	}
 
 	if (uio-uio_offset == TMPFS_DIRCOOKIE_DOT) {
 		error = tmpfs_dir_getdotdent(node, uio);



CVS commit: src/sys/dev/ic

2013-09-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Sep  7 18:55:29 UTC 2013

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

Log Message:
apply changes from Robert Sprowson in PR 47765 and PR 47788:
 - make sure we wait long enough after resetting the chip.
 - add the necessary delay after changing the FIFO pointer.
 - add a missing interrupt ACK.
 - fix padding of short and odd-length packets.

and a few more changes from me:
 - do 2-byte writes in most places even if SMC91CXX_NO_BYTE_WRITE
   is not defined.  the only ones still conditionalized are
   writing to the interrupt ack/mask registers.
 - the only big-endian front-end of this driver (on mac68k) uses
   a bus_space that does all the byte-swapping in that layer,
   so remove the explicit byte-swapping in the MI part.

tested on mac68k.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/ic/smc91cxx.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/smc91cxx.c
diff -u src/sys/dev/ic/smc91cxx.c:1.84 src/sys/dev/ic/smc91cxx.c:1.85
--- src/sys/dev/ic/smc91cxx.c:1.84	Tue Jun 11 16:57:05 2013
+++ src/sys/dev/ic/smc91cxx.c	Sat Sep  7 18:55:29 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: smc91cxx.c,v 1.84 2013/06/11 16:57:05 msaitoh Exp $	*/
+/*	$NetBSD: smc91cxx.c,v 1.85 2013/09/07 18:55:29 chs Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: smc91cxx.c,v 1.84 2013/06/11 16:57:05 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: smc91cxx.c,v 1.85 2013/09/07 18:55:29 chs Exp $);
 
 #include opt_inet.h
 
@@ -126,7 +126,7 @@ __KERNEL_RCSID(0, $NetBSD: smc91cxx.c,v
 /* XXX Hardware padding doesn't work yet(?) */
 #define	SMC91CXX_SW_PAD
 
-const char *smc91cxx_idstrs[] = {
+static const char *smc91cxx_idstrs[] = {
 	NULL,/* 0 */
 	NULL,/* 1 */
 	NULL,/* 2 */
@@ -146,7 +146,7 @@ const char *smc91cxx_idstrs[] = {
 };
 
 /* Supported media types. */
-const int smc91cxx_media[] = {
+static const int smc91cxx_media[] = {
 	IFM_ETHER|IFM_10_T,
 	IFM_ETHER|IFM_10_5,
 };
@@ -158,7 +158,7 @@ const int smc91cxx_media[] = {
 u_int32_t smc91cxx_mii_bitbang_read(device_t);
 void smc91cxx_mii_bitbang_write(device_t, u_int32_t);
 
-const struct mii_bitbang_ops smc91cxx_mii_bitbang_ops = {
+static const struct mii_bitbang_ops smc91cxx_mii_bitbang_ops = {
 	smc91cxx_mii_bitbang_read,
 	smc91cxx_mii_bitbang_write,
 	{
@@ -208,12 +208,8 @@ smc91cxx_intr_mask_write(bus_space_tag_t
 {
 	KDASSERT((mask  IM_ERCV_INT) == 0);
 #ifdef SMC91CXX_NO_BYTE_WRITE
-#if BYTE_ORDER == LITTLE_ENDIAN
 	bus_space_write_2(bst, bsh, INTR_STAT_REG_B, mask  8);
 #else
-	bus_space_write_2(bst, bsh, INTR_STAT_REG_B, mask);
-#endif
-#else
 	bus_space_write_1(bst, bsh, INTR_MASK_REG_B, mask);
 #endif
 	KDASSERT(!(bus_space_read_1(bst, bsh, INTR_MASK_REG_B)  IM_ERCV_INT));
@@ -221,18 +217,12 @@ smc91cxx_intr_mask_write(bus_space_tag_t
 
 static inline void
 smc91cxx_intr_ack_write(bus_space_tag_t bst, bus_space_handle_t bsh,
-	uint8_t mask)
+	uint8_t ack, uint8_t mask)
 {
 #ifdef SMC91CXX_NO_BYTE_WRITE
-#if BYTE_ORDER == LITTLE_ENDIAN
-	bus_space_write_2(bst, bsh, INTR_ACK_REG_B,
-	mask | (bus_space_read_2(bst, bsh, INTR_ACK_REG_B)  0xff00));
+	bus_space_write_2(bst, bsh, INTR_ACK_REG_B, ack | (mask  8));
 #else
-	bus_space_write_2(bst, bsh, INTR_ACK_REG_B,
-	(mask  8) | (bus_space_read_2(bst, bsh, INTR_ACK_REG_B)  0xff));
-#endif
-#else
-	bus_space_write_1(bst, bsh, INTR_ACK_REG_B, mask);
+	bus_space_write_1(bst, bsh, INTR_ACK_REG_B, ack);
 #endif
 	KDASSERT(!(bus_space_read_1(bst, bsh, INTR_MASK_REG_B)  IM_ERCV_INT));
 }
@@ -254,7 +244,8 @@ smc91cxx_attach(struct smc91cxx_softc *s
 	tmp = bus_space_read_2(bst, bsh, BANK_SELECT_REG_W);
 	/* check magic number */
 	if ((tmp  BSR_DETECT_MASK) != BSR_DETECT_VALUE) {
-		aprint_error_dev(sc-sc_dev, failed to detect chip, bsr=%04x\n, tmp);
+		aprint_error_dev(sc-sc_dev,
+		 failed to detect chip, bsr=%04x\n, tmp);
 		return;
 	}
 
@@ -285,7 +276,8 @@ smc91cxx_attach(struct smc91cxx_softc *s
 		scale = MIR_SCALE_91C111;
 	}
 	memsize = bus_space_read_2(bst, bsh, MEM_INFO_REG_W)  MIR_TOTAL_MASK;
-	if (memsize == 255) memsize++;
+	if (memsize == 255)
+		memsize++;
 	memsize *= scale * mult;
 
 	format_bytes(pbuf, sizeof(pbuf), memsize);
@@ -344,7 +336,8 @@ smc91cxx_attach(struct smc91cxx_softc *s
 		if (tmp  CR_MII_SELECT) {
 			aprint_normal(default media MII);
 			if (sc-sc_chipid == CHIP_91C111) {
-aprint_normal( (%s PHY)\n, (tmp  CR_AUI_SELECT) ?
+aprint_normal( (%s PHY)\n,
+(tmp  CR_AUI_SELECT) ?
 external : internal);
 sc-sc_internal_phy = !(tmp  CR_AUI_SELECT);
 			} else
@@ -373,7 +366,8 @@ smc91cxx_attach(struct smc91cxx_softc *s
 		}
 		/*FALLTHROUGH*/
 	default:
-		aprint_normal(default media %s\n, (aui = (tmp  CR_AUI_SELECT)) ?
+		aprint_normal(default media %s\n,
+		(aui = (tmp  

CVS commit: src/sys/dev/scsipi

2012-04-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Apr  6 17:12:46 UTC 2012

Modified Files:
src/sys/dev/scsipi: atapiconf.c

Log Message:
take the kernel lock during detach of atapibus as well.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/scsipi/atapiconf.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/scsipi/atapiconf.c
diff -u src/sys/dev/scsipi/atapiconf.c:1.83 src/sys/dev/scsipi/atapiconf.c:1.84
--- src/sys/dev/scsipi/atapiconf.c:1.83	Mon Jun  7 01:41:39 2010
+++ src/sys/dev/scsipi/atapiconf.c	Fri Apr  6 17:12:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: atapiconf.c,v 1.83 2010/06/07 01:41:39 pgoyette Exp $	*/
+/*	$NetBSD: atapiconf.c,v 1.84 2012/04/06 17:12:45 chs Exp $	*/
 
 /*
  * Copyright (c) 1996, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: atapiconf.c,v 1.83 2010/06/07 01:41:39 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: atapiconf.c,v 1.84 2012/04/06 17:12:45 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -171,6 +171,9 @@ atapibuschilddet(device_t self, device_t
 	struct scsipi_periph *periph;
 	int target;
 
+	/* XXXSMP scsipi */
+	KERNEL_LOCK(1, curlwp);
+
 	for (target = 0; target  chan-chan_ntargets; target++) {
 		periph = scsipi_lookup_periph(chan, target, 0);
 		if (periph == NULL || periph-periph_dev != child)
@@ -179,6 +182,9 @@ atapibuschilddet(device_t self, device_t
 		free(periph, M_DEVBUF);
 		break;
 	}
+
+	/* XXXSMP scsipi */
+	KERNEL_UNLOCK_ONE(curlwp);
 }
 
 static int



CVS commit: src/sys/uvm

2012-04-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Apr  6 17:16:30 UTC 2012

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

Log Message:
fix uarea_system_poolpage_free() to handle freeing a uarea
that was not allocated by cpu_uarea_alloc() (ie. on plaforms
where cpu_uarea_alloc() failing is not fatal).
fixes PR 46284.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/uvm/uvm_glue.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_glue.c
diff -u src/sys/uvm/uvm_glue.c:1.157 src/sys/uvm/uvm_glue.c:1.158
--- src/sys/uvm/uvm_glue.c:1.157	Mon Feb 20 12:21:23 2012
+++ src/sys/uvm/uvm_glue.c	Fri Apr  6 17:16:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_glue.c,v 1.157 2012/02/20 12:21:23 martin Exp $	*/
+/*	$NetBSD: uvm_glue.c,v 1.158 2012/04/06 17:16:30 chs Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_glue.c,v 1.157 2012/02/20 12:21:23 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_glue.c,v 1.158 2012/04/06 17:16:30 chs Exp $);
 
 #include opt_kgdb.h
 #include opt_kstack.h
@@ -315,8 +315,11 @@ uarea_system_poolpage_alloc(struct pool 
 static void
 uarea_system_poolpage_free(struct pool *pp, void *addr)
 {
-	if (!cpu_uarea_free(addr))
-		panic(%s: failed to free uarea %p, __func__, addr);
+	if (cpu_uarea_free(addr))
+		return;
+
+	uvm_km_free(kernel_map, (vaddr_t)addr, pp-pr_alloc-pa_pagesz,
+	UVM_KMF_WIRED);
 }
 
 static struct pool_allocator uvm_uarea_system_allocator = {



CVS commit: src/sys/arch/x86

2012-04-06 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Apr  6 17:23:40 UTC 2012

Modified Files:
src/sys/arch/x86/include: specialreg.h
src/sys/arch/x86/x86: errata.c

Log Message:
bring in this change from openbsd:
Implement the AMD suggested workaround for family 10h  12h errata 721
Processor May Incorrectly Update Stack Pointer by setting a bit
marked 'reserved' in an MSR that is only documented to exist on 12h.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/x86/errata.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/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.56 src/sys/arch/x86/include/specialreg.h:1.57
--- src/sys/arch/x86/include/specialreg.h:1.56	Fri Mar  2 16:41:00 2012
+++ src/sys/arch/x86/include/specialreg.h	Fri Apr  6 17:23:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.56 2012/03/02 16:41:00 bouyer Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.57 2012/04/06 17:23:39 chs Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -516,6 +516,9 @@
 #define		BU_CFG_WBPFSMCCHKDIS	0x2000ULL
 #define		BU_CFG_WBENHWSBDIS	0x0001ULL
 
+#define MSR_DE_CFG	0xc0011029
+#define		DE_CFG_ERRATA_721	0x0001
+
 /* AMD Family10h MSRs */
 #define	MSR_OSVW_ID_LENGTH		0xc0010140
 #define	MSR_OSVW_STATUS			0xc0010141

Index: src/sys/arch/x86/x86/errata.c
diff -u src/sys/arch/x86/x86/errata.c:1.19 src/sys/arch/x86/x86/errata.c:1.20
--- src/sys/arch/x86/x86/errata.c:1.19	Fri Jul 23 22:31:35 2010
+++ src/sys/arch/x86/x86/errata.c	Fri Apr  6 17:23:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: errata.c,v 1.19 2010/07/23 22:31:35 cegger Exp $	*/
+/*	$NetBSD: errata.c,v 1.20 2012/04/06 17:23:39 chs Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: errata.c,v 1.19 2010/07/23 22:31:35 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: errata.c,v 1.20 2012/04/06 17:23:39 chs Exp $);
 
 #include sys/types.h
 #include sys/systm.h
@@ -69,7 +69,8 @@ typedef struct errata {
 typedef enum cpurev {
 	BH_E4, CH_CG, CH_D0, DH_CG, DH_D0, DH_E3, DH_E6, JH_E1,
 	JH_E6, SH_B0, SH_B3, SH_C0, SH_CG, SH_D0, SH_E4, SH_E5,
-	DR_BA, DR_B2, DR_B3,
+	DR_BA, DR_B2, DR_B3, RB_C2, RB_C3, BL_C2, BL_C3, DA_C2,
+	DA_C3, HY_D0, HY_D1, HY_D1_G34R1,  PH_E0, LN_B0,
 	OINK
 } cpurev_t;
 
@@ -85,6 +86,10 @@ static const u_int cpurevs[] = {
 	SH_D0, 0x0010f40, SH_D0, 0x0010f50, SH_D0, 0x0010f70,
 	SH_E4, 0x0020f51, SH_E4, 0x0020f71, SH_E5, 0x0020f42,
 	DR_BA, 0x0100f2a, DR_B2, 0x0100f22, DR_B3, 0x0100f23,
+	RB_C2, 0x0100f42, RB_C3, 0x0100f43, BL_C2, 0x0100f52,
+	BL_C3, 0x0100f53, DA_C2, 0x0100f62, DA_C3, 0x0100f63,
+	HY_D0, 0x0100f80, HY_D1, 0x0100f81, HY_D1_G34R1, 0x0100f91,
+	PH_E0, 0x0100fa0, LN_B0, 0x0300f10,
 	OINK
 };
 
@@ -132,6 +137,11 @@ static const uint8_t x86_errata_set10[] 
 	DR_BA, DR_B2, DR_B3, OINK
 };
 
+static const uint8_t x86_errata_set11[] = {
+	DR_BA, DR_B2, DR_B3, RB_C2, RB_C3, BL_C2, BL_C3, DA_C2,
+	DA_C3, HY_D0, HY_D1, HY_D1_G34R1,  PH_E0, LN_B0, OINK
+};
+
 static bool x86_errata_setmsr(struct cpu_info *, errata_t *);
 static bool x86_errata_testmsr(struct cpu_info *, errata_t *);
 
@@ -268,6 +278,13 @@ static errata_t errata[] = {
 		309, FALSE, MSR_BU_CFG, x86_errata_set9,
 		x86_errata_testmsr, BU_CFG_ERRATA_309
 	},
+	/*
+	 * 721: Processor May Incorrectly Update Stack Pointer
+	 */
+	{
+		721, FALSE, MSR_DE_CFG, x86_errata_set11,
+		x86_errata_setmsr, DE_CFG_ERRATA_721
+	},
 };
 
 static bool 



CVS commit: src/sys/uvm

2012-04-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Apr  8 20:47:11 UTC 2012

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

Log Message:
initialize amap per-page reference counts before changing the amap's
overall reference count.  this fixes the crashes seen for the last 9 months
with web browers and plugins, which was also the cause of PR 46193.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/uvm/uvm_amap.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_amap.c
diff -u src/sys/uvm/uvm_amap.c:1.106 src/sys/uvm/uvm_amap.c:1.107
--- src/sys/uvm/uvm_amap.c:1.106	Fri Mar 30 02:25:24 2012
+++ src/sys/uvm/uvm_amap.c	Sun Apr  8 20:47:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_amap.c,v 1.106 2012/03/30 02:25:24 chs Exp $	*/
+/*	$NetBSD: uvm_amap.c,v 1.107 2012/04/08 20:47:10 chs Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_amap.c,v 1.106 2012/03/30 02:25:24 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_amap.c,v 1.107 2012/04/08 20:47:10 chs Exp $);
 
 #include opt_uvmhist.h
 
@@ -888,6 +888,7 @@ amap_copy(struct vm_map *map, struct vm_
 			continue;
 		KASSERT(amap-am_anon[lcv]-an_lock == srcamap-am_lock);
 		KASSERT(amap-am_anon[lcv]-an_ref  0);
+		KASSERT(amap-am_nused  amap-am_maxslot);
 		amap-am_anon[lcv]-an_ref++;
 		amap-am_bckptr[lcv] = amap-am_nused;
 		amap-am_slots[amap-am_nused] = lcv;
@@ -1193,6 +1194,7 @@ amap_pp_adjref(struct vm_amap *amap, int
 		}
 		ref += adjval;
 		KASSERT(ref = 0);
+		KASSERT(ref = amap-am_ref);
 		if (lcv == prevlcv + prevlen  ref == prevref) {
 			pp_setreflen(ppref, prevlcv, ref, prevlen + len);
 		} else {
@@ -1490,6 +1492,7 @@ amap_add(struct vm_aref *aref, vaddr_t o
 		}
 	} else {
 		KASSERT(amap-am_anon[slot] == NULL);
+		KASSERT(amap-am_nused  amap-am_maxslot);
 		amap-am_bckptr[slot] = amap-am_nused;
 		amap-am_slots[amap-am_nused] = slot;
 		amap-am_nused++;
@@ -1534,7 +1537,7 @@ amap_unadd(struct vm_aref *aref, vaddr_t
 }
 
 /*
- * amap_adjref_anons: adjust the reference count(s) on anons of the amap.
+ * amap_adjref_anons: adjust the reference count(s) on amap and its anons.
  */
 static void
 amap_adjref_anons(struct vm_amap *amap, vaddr_t offset, vsize_t len,
@@ -1545,9 +1548,19 @@ amap_adjref_anons(struct vm_amap *amap, 
 #ifdef UVM_AMAP_PPREF
 	KASSERT(mutex_owned(amap-am_lock));
 
+	/*
+	 * We must establish the ppref array before changing am_ref
+	 * so that the ppref values match the current amap refcount.
+	 */
+
 	if (amap-am_ppref == NULL  !all  len != amap-am_nslot) {
 		amap_pp_establish(amap, offset);
 	}
+#endif
+
+	amap-am_ref += refv;
+
+#ifdef UVM_AMAP_PPREF
 	if (amap-am_ppref  amap-am_ppref != PPREF_NONE) {
 		if (all) {
 			amap_pp_adjref(amap, 0, amap-am_nslot, refv, tofree);
@@ -1575,7 +1588,6 @@ amap_ref(struct vm_amap *amap, vaddr_t o
 	if (flags  AMAP_SHARED) {
 		amap-am_flags |= AMAP_SHARED;
 	}
-	amap-am_ref++;
 	amap_adjref_anons(amap, offset, len, 1, (flags  AMAP_REFALL) != 0);
 
 	UVMHIST_LOG(maphist,- done!  amap=0x%x, amap, 0, 0, 0);
@@ -1599,10 +1611,12 @@ amap_unref(struct vm_amap *amap, vaddr_t
 	amap, amap-am_ref, amap-am_nused, 0);
 	KASSERT(amap-am_ref  0);
 
-	if (--amap-am_ref == 0) {
+	if (amap-am_ref == 1) {
+
 		/*
 		 * If the last reference - wipeout and destroy the amap.
 		 */
+		amap-am_ref--;
 		amap_wipeout(amap);
 		UVMHIST_LOG(maphist,- done (was last ref)!, 0, 0, 0, 0);
 		return;
@@ -1612,7 +1626,7 @@ amap_unref(struct vm_amap *amap, vaddr_t
 	 * Otherwise, drop the reference count(s) on anons.
 	 */
 
-	if (amap-am_ref == 1  (amap-am_flags  AMAP_SHARED) != 0) {
+	if (amap-am_ref == 2  (amap-am_flags  AMAP_SHARED) != 0) {
 		amap-am_flags = ~AMAP_SHARED;
 	}
 	amap_adjref_anons(amap, offset, len, -1, all);



CVS commit: src/sys

2012-04-29 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Apr 29 22:54:01 UTC 2012

Modified Files:
src/sys/fs/msdosfs: msdosfs_vnops.c
src/sys/fs/ntfs: ntfs_vnops.c
src/sys/fs/sysvbfs: sysvbfs_vnops.c
src/sys/fs/udf: udf_subr.c udf_vnops.c
src/sys/fs/v7fs: v7fs_vnops.c
src/sys/kern: vfs_subr.c
src/sys/miscfs/genfs: genfs_io.c
src/sys/miscfs/specfs: spec_vnops.c
src/sys/ufs/chfs: chfs_vnops.c
src/sys/ufs/ext2fs: ext2fs_readwrite.c ext2fs_vnops.c
src/sys/ufs/ffs: ffs_vfsops.c ffs_vnops.c
src/sys/ufs/ufs: ufs_readwrite.c
src/sys/uvm: uvm_pager.h

Log Message:
change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/fs/msdosfs/msdosfs_vnops.c
cvs rdiff -u -r1.50 -r1.51 src/sys/fs/ntfs/ntfs_vnops.c
cvs rdiff -u -r1.43 -r1.44 src/sys/fs/sysvbfs/sysvbfs_vnops.c
cvs rdiff -u -r1.118 -r1.119 src/sys/fs/udf/udf_subr.c
cvs rdiff -u -r1.70 -r1.71 src/sys/fs/udf/udf_vnops.c
cvs rdiff -u -r1.10 -r1.11 src/sys/fs/v7fs/v7fs_vnops.c
cvs rdiff -u -r1.433 -r1.434 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.53 -r1.54 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.134 -r1.135 src/sys/miscfs/specfs/spec_vnops.c
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/chfs/chfs_vnops.c
cvs rdiff -u -r1.60 -r1.61 src/sys/ufs/ext2fs/ext2fs_readwrite.c
cvs rdiff -u -r1.102 -r1.103 src/sys/ufs/ext2fs/ext2fs_vnops.c
cvs rdiff -u -r1.276 -r1.277 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.120 -r1.121 src/sys/ufs/ffs/ffs_vnops.c
cvs rdiff -u -r1.103 -r1.104 src/sys/ufs/ufs/ufs_readwrite.c
cvs rdiff -u -r1.42 -r1.43 src/sys/uvm/uvm_pager.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/fs/msdosfs/msdosfs_vnops.c
diff -u src/sys/fs/msdosfs/msdosfs_vnops.c:1.82 src/sys/fs/msdosfs/msdosfs_vnops.c:1.83
--- src/sys/fs/msdosfs/msdosfs_vnops.c:1.82	Tue Apr  3 14:58:55 2012
+++ src/sys/fs/msdosfs/msdosfs_vnops.c	Sun Apr 29 22:53:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.82 2012/04/03 14:58:55 njoly Exp $	*/
+/*	$NetBSD: msdosfs_vnops.c,v 1.83 2012/04/29 22:53:59 chs Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.82 2012/04/03 14:58:55 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.83 2012/04/29 22:53:59 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -656,7 +656,8 @@ msdosfs_write(void *v)
 		if (!async  oldoff  16 != uio-uio_offset  16) {
 			mutex_enter(vp-v_interlock);
 			error = VOP_PUTPAGES(vp, (oldoff  16)  16,
-			(uio-uio_offset  16)  16, PGO_CLEANIT);
+			(uio-uio_offset  16)  16,
+			PGO_CLEANIT | PGO_LAZY);
 		}
 	} while (error == 0  uio-uio_resid  0);
 
@@ -1808,7 +1809,7 @@ msdosfs_fsync(void *v)
 
 	fstrans_start(vp-v_mount, FSTRANS_LAZY);
 	wait = (ap-a_flags  FSYNC_WAIT) != 0;
-	error = vflushbuf(vp, wait);
+	error = vflushbuf(vp, ap-a_flags);
 	if (error == 0  (ap-a_flags  FSYNC_DATAONLY) == 0)
 		error = msdosfs_update(vp, NULL, NULL, wait ? UPDATE_WAIT : 0);
 

Index: src/sys/fs/ntfs/ntfs_vnops.c
diff -u src/sys/fs/ntfs/ntfs_vnops.c:1.50 src/sys/fs/ntfs/ntfs_vnops.c:1.51
--- src/sys/fs/ntfs/ntfs_vnops.c:1.50	Tue Mar 13 18:40:49 2012
+++ src/sys/fs/ntfs/ntfs_vnops.c	Sun Apr 29 22:53:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntfs_vnops.c,v 1.50 2012/03/13 18:40:49 elad Exp $	*/
+/*	$NetBSD: ntfs_vnops.c,v 1.51 2012/04/29 22:53:59 chs Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ntfs_vnops.c,v 1.50 2012/03/13 18:40:49 elad Exp $);
+__KERNEL_RCSID(0, $NetBSD: ntfs_vnops.c,v 1.51 2012/04/29 22:53:59 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -748,14 +748,12 @@ ntfs_fsync(void *v)
 		off_t offhi;
 	} */ *ap = v;
 	struct vnode *vp = ap-a_vp;
-	int wait;
 
 	if (ap-a_flags  FSYNC_CACHE) {
 		return EOPNOTSUPP;
 	}
 
-	wait = (ap-a_flags  FSYNC_WAIT) != 0;
-	return vflushbuf(vp, wait);
+	return vflushbuf(vp, ap-a_flags);
 }
 
 /*

Index: src/sys/fs/sysvbfs/sysvbfs_vnops.c
diff -u src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.43 src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.44
--- src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.43	Fri Mar 30 18:27:55 2012
+++ src/sys/fs/sysvbfs/sysvbfs_vnops.c	Sun Apr 29 22:53:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysvbfs_vnops.c,v 1.43 2012/03/30 18:27:55 njoly Exp $	*/
+/*	$NetBSD: sysvbfs_vnops.c,v 1.44 2012/04/29 22:53:59 chs Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sysvbfs_vnops.c,v 1.43 2012/03/30 18:27:55 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: 

CVS commit: src/sys/kern

2012-04-29 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Apr 29 22:55:12 UTC 2012

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

Log Message:
mark all wapbl I/O as BPRIO_TIMECRITICAL.
this is the second part of addressing PR 46325.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/kern/vfs_wapbl.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_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.51 src/sys/kern/vfs_wapbl.c:1.52
--- src/sys/kern/vfs_wapbl.c:1.51	Sat Jan 28 18:02:56 2012
+++ src/sys/kern/vfs_wapbl.c	Sun Apr 29 22:55:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.51 2012/01/28 18:02:56 para Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.52 2012/04/29 22:55:11 chs Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.51 2012/01/28 18:02:56 para Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.52 2012/04/29 22:55:11 chs Exp $);
 
 #include sys/param.h
 #include sys/bitops.h
@@ -752,6 +752,7 @@ wapbl_doio(void *data, size_t len, struc
 	bp-b_data = data;
 	bp-b_bufsize = bp-b_resid = bp-b_bcount = len;
 	bp-b_blkno = pbn;
+	BIO_SETPRIO(bp, BPRIO_TIMECRITICAL);
 
 	WAPBL_PRINTF(WAPBL_PRINT_IO,
 	(wapbl_doio: %s %d bytes at block %PRId64 on dev 0x%PRIx64\n,



CVS commit: src/sys/net

2012-05-10 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri May 11 04:05:54 UTC 2012

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

Log Message:
in ether_ifdetach(), clear if_mowner before releasing what it points to.
fixes PR 42982.


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

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.188 src/sys/net/if_ethersubr.c:1.189
--- src/sys/net/if_ethersubr.c:1.188	Thu Jun 16 19:47:30 2011
+++ src/sys/net/if_ethersubr.c	Fri May 11 04:05:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.188 2011/06/16 19:47:30 kefren Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.189 2012/05/11 04:05:54 chs Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ethersubr.c,v 1.188 2011/06/16 19:47:30 kefren Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ethersubr.c,v 1.189 2012/05/11 04:05:54 chs Exp $);
 
 #include opt_inet.h
 #include opt_atalk.h
@@ -1168,6 +1168,7 @@ ether_ifdetach(struct ifnet *ifp)
 	if_free_sadl(ifp);
 #endif
 
+	ifp-if_mowner = NULL;
 	MOWNER_DETACH(ec-ec_rx_mowner);
 	MOWNER_DETACH(ec-ec_tx_mowner);
 }



CVS commit: src/sys/kern

2012-05-12 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat May 12 18:42:08 UTC 2012

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

Log Message:
remove a bogus optimization introduced in the previous change.
fixes hangs in the rump/rumpvfs/t_etfs test.


To generate a diff of this commit:
cvs rdiff -u -r1.434 -r1.435 src/sys/kern/vfs_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/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.434 src/sys/kern/vfs_subr.c:1.435
--- src/sys/kern/vfs_subr.c:1.434	Sun Apr 29 22:54:00 2012
+++ src/sys/kern/vfs_subr.c	Sat May 12 18:42:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.434 2012/04/29 22:54:00 chs Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.435 2012/05/12 18:42:08 chs Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_subr.c,v 1.434 2012/04/29 22:54:00 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_subr.c,v 1.435 2012/05/12 18:42:08 chs Exp $);
 
 #include opt_ddb.h
 #include opt_compat_netbsd.h
@@ -290,9 +290,6 @@ vflushbuf(struct vnode *vp, int flags)
 	mutex_enter(vp-v_interlock);
 	(void) VOP_PUTPAGES(vp, 0, 0, pflags);
 
-	if (LIST_EMPTY(vp-v_dirtyblkhd) || (flags  FSYNC_DATAONLY))
-		return 0;
-
 loop:
 	mutex_enter(bufcache_lock);
 	for (bp = LIST_FIRST(vp-v_dirtyblkhd); bp; bp = nbp) {



CVS commit: src

2012-06-11 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jun 11 15:18:05 UTC 2012

Modified Files:
src/external/cddl/osnet/dev/dtrace/amd64: dtrace_asm.S dtrace_isa.c
dtrace_subr.c
src/sys/arch/amd64/amd64: genassym.cf
src/sys/arch/amd64/include: Makefile.inc asm.h

Log Message:
make dtrace work on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/include/Makefile.inc
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/include/asm.h

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

Modified files:

Index: src/external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S
diff -u src/external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S:1.3 src/external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S:1.4
--- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S:1.3	Sat Mar 13 22:31:15 2010
+++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_asm.S	Mon Jun 11 15:18:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_asm.S,v 1.3 2010/03/13 22:31:15 christos Exp $	*/
+/*	$NetBSD: dtrace_asm.S,v 1.4 2012/06/11 15:18:05 chs Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -32,7 +32,6 @@
 
 #define _ASM
 
-
 #include sys/cpuvar_defs.h
 #include sys/dtrace.h
 #include machine/asm.h
@@ -65,8 +64,6 @@
 1:	addq	$TF_RIP,%rsp;
 
 
-	.globl	calltrap
-	.type	calltrap,@function
 	ENTRY(dtrace_invop_start)
 
 	/*
@@ -81,7 +78,7 @@
 	pushq	(%rsi)
 	movq	%rsp, %rsi
 	call	dtrace_invop
-//	ALTENTRY(dtrace_invop_callsite)
+	ALTENTRY(dtrace_invop_callsite)
 	addq	$8, %rsp
 	cmpl	$DTRACE_INVOP_PUSHL_EBP, %eax
 	je	bp_push
@@ -147,7 +144,7 @@ bp_nop:
 	/*NOTREACHED*/
 
 bp_ret:
-//	INTR_POP
+	INTR_POP
 	pushq	%rax			/* push temp */
 	movq	32(%rsp), %rax		/* load %rsp */
 	movq	(%rax), %rax		/* load calling RIP */
Index: src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c
diff -u src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c:1.3 src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c:1.4
--- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c:1.3	Sat Mar 13 22:31:15 2010
+++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_isa.c	Mon Jun 11 15:18:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_isa.c,v 1.3 2010/03/13 22:31:15 christos Exp $	*/
+/*	$NetBSD: dtrace_isa.c,v 1.4 2012/06/11 15:18:05 chs Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -52,15 +52,14 @@ uint16_t dtrace_fuword16_nocheck(void *)
 uint32_t dtrace_fuword32_nocheck(void *);
 uint64_t dtrace_fuword64_nocheck(void *);
 
-uintptr_t kernelbase = (uintptr_t)KERNBASE;
-
-#define INKERNEL(va) (((vm_offset_t)(va)) = USRSTACK  \
- ((vm_offset_t)(va))  VM_MAX_KERNEL_ADDRESS)
+uintptr_t kernelbase = (uintptr_t)KERN_BASE;
+
+#define INKERNEL(va) ((intptr_t)(va)  0)
 
 struct amd64_frame { 
 	struct amd64_frame	*f_frame;
-	int			 f_retaddr; 
-	int			 f_arg0;
+	uintptr_t		 f_retaddr; 
+	uintptr_t		 f_arg0;
 };
 
 typedef unsigned long vm_offset_t;

Index: src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.5 src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.6
--- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.5	Wed Aug 31 21:57:16 2011
+++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c	Mon Jun 11 15:18:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.5 2011/08/31 21:57:16 christos Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.6 2012/06/11 15:18:05 chs Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -374,6 +374,18 @@ dtrace_safe_defer_signal(void)
 }
 #endif
 
+#ifdef __NetBSD__
+static __inline uint64_t
+dtrace_rdtsc(void)
+{
+	uint32_t hi, lo;
+
+	__asm volatile(rdtsc : =d (hi), =a (lo));
+	return (((uint64_t)hi  32) | (uint64_t) lo);
+}
+#define rdtsc dtrace_rdtsc
+#endif
+
 #ifdef notyet
 static int64_t	tgt_cpu_tsc;
 static int64_t	hst_cpu_tsc;

Index: src/sys/arch/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.50 src/sys/arch/amd64/amd64/genassym.cf:1.51
--- src/sys/arch/amd64/amd64/genassym.cf:1.50	Fri Apr 20 22:23:24 2012
+++ src/sys/arch/amd64/amd64/genassym.cf	Mon Jun 11 15:18:05 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.50 2012/04/20 22:23:24 rmind Exp $
+#	$NetBSD: genassym.cf,v 1.51 2012/06/11 15:18:05 chs Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -372,3 +372,5 @@ define	PGSHIFT			PGSHIFT
 define	VM_MIN_KERNEL_ADDRESS_HIGH32	(VM_MIN_KERNEL_ADDRESS  32)
 
 define	RESCHED_KPREEMPT	RESCHED_KPREEMPT
+
+define	SEL_RPL_MASK		SEL_RPL

Index: src/sys/arch/amd64/include/Makefile.inc
diff -u src/sys/arch/amd64/include/Makefile.inc:1.3 src/sys/arch/amd64/include/Makefile.inc:1.4
--- src/sys/arch/amd64/include/Makefile.inc:1.3	Fri 

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

2012-06-11 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jun 11 15:18:26 UTC 2012

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

Log Message:
allow more space for modules.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/amd64/include/pmap.h

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

Modified files:

Index: src/sys/arch/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.32 src/sys/arch/amd64/include/pmap.h:1.33
--- src/sys/arch/amd64/include/pmap.h:1.32	Sun Feb 19 10:39:06 2012
+++ src/sys/arch/amd64/include/pmap.h	Mon Jun 11 15:18:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.32 2012/02/19 10:39:06 cherry Exp $	*/
+/*	$NetBSD: pmap.h,v 1.33 2012/06/11 15:18:26 chs Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -188,7 +188,7 @@
 
 #define NKL4_KIMG_ENTRIES	1
 #define NKL3_KIMG_ENTRIES	1
-#define NKL2_KIMG_ENTRIES	10
+#define NKL2_KIMG_ENTRIES	16
 
 /*
  * Since kva space is below the kernel in its entirety, we start off



CVS commit: src/sys/arch

2012-06-16 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Jun 16 17:30:19 UTC 2012

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/i386/i386: locore.S
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/x86: identcpu.c

Log Message:
rename the global variable cpu to cputype to avoid conflicting with
dtrace, which wants to use cpu as a local variable.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/x86/identcpu.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.68 src/sys/arch/amd64/amd64/locore.S:1.69
--- src/sys/arch/amd64/amd64/locore.S:1.68	Thu Apr 19 18:00:34 2012
+++ src/sys/arch/amd64/amd64/locore.S	Sat Jun 16 17:30:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.68 2012/04/19 18:00:34 jym Exp $	*/
+/*	$NetBSD: locore.S,v 1.69 2012/06/16 17:30:19 chs Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -236,9 +236,9 @@ _C_LABEL(lapic_isr):
 	.globl	_C_LABEL(bootinfo),_C_LABEL(atdevbase)
 	.globl	_C_LABEL(PDPpaddr)
 	.globl	_C_LABEL(biosbasemem),_C_LABEL(biosextmem)
-	.globl	_C_LABEL(gdtstore),_C_LABEL(cpu)
+	.globl	_C_LABEL(gdtstore),_C_LABEL(cputype)
 
-_C_LABEL(cpu):		.long	0	# are we 386, 386sx, or 486,
+_C_LABEL(cputype):	.long	0	# are we 386, 386sx, or 486,
 	#   or Pentium, or..
 _C_LABEL(cpu_id):	.long	0	# saved from `cpuid' instruction
 _C_LABEL(cpuid_level):	.long	-1	# max. level accepted by 'cpuid'

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.99 src/sys/arch/i386/i386/locore.S:1.100
--- src/sys/arch/i386/i386/locore.S:1.99	Thu Apr 19 18:07:05 2012
+++ src/sys/arch/i386/i386/locore.S	Sat Jun 16 17:30:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.99 2012/04/19 18:07:05 jym Exp $	*/
+/*	$NetBSD: locore.S,v 1.100 2012/06/16 17:30:19 chs Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -129,7 +129,7 @@
  */
 
 #include machine/asm.h
-__KERNEL_RCSID(0, $NetBSD: locore.S,v 1.99 2012/04/19 18:07:05 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: locore.S,v 1.100 2012/06/16 17:30:19 chs Exp $);
 
 #include opt_compat_oldboot.h
 #include opt_ddb.h
@@ -196,7 +196,7 @@ __KERNEL_RCSID(0, $NetBSD: locore.S,v 1
  */
 	.data
 
-	.globl	_C_LABEL(cpu)
+	.globl	_C_LABEL(cputype)
 	.globl	_C_LABEL(cpuid_level)
 	.globl	_C_LABEL(esym)
 	.globl	_C_LABEL(eblob)
@@ -229,7 +229,7 @@ _C_LABEL(lapic_tpr):
 	.long 0
 #endif
 
-_C_LABEL(cpu):		.long	0	# are we 80486, Pentium, or..
+_C_LABEL(cputype):	.long	0	# are we 80486, Pentium, or..
 _C_LABEL(cpuid_level):	.long	0
 _C_LABEL(atdevbase):	.long	0	# location of start of iomem in virtual
 _C_LABEL(lwp0uarea):	.long	0
@@ -346,11 +346,11 @@ isnx586:
 	 * Don't try cpuid, as Nx586s reportedly don't support the
 	 * PSL_ID bit.
 	 */
-	movl	$CPU_NX586,RELOC(cpu)
+	movl	$CPU_NX586,RELOC(cputype)
 	jmp	2f
 
 is386:
-	movl	$CPU_386,RELOC(cpu)
+	movl	$CPU_386,RELOC(cputype)
 	jmp	2f
 
 try486:	/* Try to toggle identification flag; does not exist on early 486s. */
@@ -369,7 +369,7 @@ try486:	/* Try to toggle identification 
 
 	testl	%eax,%eax
 	jnz	try586
-is486:	movl	$CPU_486,RELOC(cpu)
+is486:	movl	$CPU_486,RELOC(cputype)
 	/*
 	 * Check Cyrix CPU
 	 * Cyrix CPUs do not change the undefined flags following
@@ -387,7 +387,7 @@ is486:	movl	$CPU_486,RELOC(cpu)
 	popfl
 	jmp 2f
 trycyrix486:
-	movl	$CPU_6x86,RELOC(cpu) 	# set CPU type
+	movl	$CPU_6x86,RELOC(cputype)	# set CPU type
 	/*
 	 * Check for Cyrix 486 CPU by seeing if the flags change during a
 	 * divide. This is documented in the Cx486SLC/e SMM Programmer's
@@ -405,7 +405,7 @@ trycyrix486:
 	xorl	%ecx,%eax		# are the flags different?
 	testl	$0x8d5,%eax		# only check C|PF|AF|Z|N|V
 	jne	2f			# yes; must be Cyrix 6x86 CPU
-	movl	$CPU_486DLC,RELOC(cpu) 	# set CPU type
+	movl	$CPU_486DLC,RELOC(cputype) 	# set CPU type
 
 #ifndef CYRIX_CACHE_WORKS
 	/* Disable caching of the ISA hole only. */

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.50 src/sys/arch/x86/include/cpu.h:1.51
--- src/sys/arch/x86/include/cpu.h:1.50	Fri Apr 20 22:23:24 2012
+++ src/sys/arch/x86/include/cpu.h	Sat Jun 16 17:30:18 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.50 2012/04/20 22:23:24 rmind Exp $	*/
+/*	$NetBSD: cpu.h,v 1.51 2012/06/16 17:30:18 chs Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -360,7 +360,7 @@ struct timeval;
 
 extern int biosbasemem;
 extern int biosextmem;
-extern int cpu;
+extern int cputype;
 extern int cpuid_level;
 extern int cpu_class;
 extern char cpu_brand_string[];

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.31 src/sys/arch/x86/x86/identcpu.c:1.32
--- 

CVS commit: src/external/cddl/osnet

2012-06-16 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Jun 16 17:31:47 UTC 2012

Modified Files:
src/external/cddl/osnet/dev/dtrace: dtrace_debug.c
src/external/cddl/osnet/dev/dtrace/amd64: dtrace_subr.c
src/external/cddl/osnet/dev/dtrace/i386: dtrace_subr.c
src/external/cddl/osnet/dev/fbt: fbt.c
src/external/cddl/osnet/dist/uts/common/dtrace: dtrace.c

Log Message:
reduce diff to freebsd:
rename xcpu back to cpu now that the conflicting global variable
has been renamed out of the way.  this also fixes some cases
where references to the local variable cpu had not been renamed
and thus were accidentally referring to the former global cpu.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dev/dtrace/dtrace_debug.c
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/dev/fbt/fbt.c
cvs rdiff -u -r1.19 -r1.20 \
src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c

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

Modified files:

Index: src/external/cddl/osnet/dev/dtrace/dtrace_debug.c
diff -u src/external/cddl/osnet/dev/dtrace/dtrace_debug.c:1.4 src/external/cddl/osnet/dev/dtrace/dtrace_debug.c:1.5
--- src/external/cddl/osnet/dev/dtrace/dtrace_debug.c:1.4	Wed Aug 31 21:57:16 2011
+++ src/external/cddl/osnet/dev/dtrace/dtrace_debug.c	Sat Jun 16 17:31:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_debug.c,v 1.4 2011/08/31 21:57:16 christos Exp $	*/
+/*	$NetBSD: dtrace_debug.c,v 1.5 2012/06/16 17:31:47 chs Exp $	*/
 
 /*-
  * Copyright (C) 2008 John Birrell j...@freebsd.org.
@@ -94,17 +94,17 @@ static char dtrace_debug_bufr[DTRACE_DEB
 static volatile u_long	dtrace_debug_flag[MAXCPUS];
 
 static void
-dtrace_debug_lock(int xcpu)
+dtrace_debug_lock(int cpu)
 {
-	while (dtrace_cmpset_long(dtrace_debug_flag[xcpu], 0, 1) == 0)
+	while (dtrace_cmpset_long(dtrace_debug_flag[cpu], 0, 1) == 0)
 		/* Loop until the lock is obtained. */
 		;
 }
 
 static void
-dtrace_debug_unlock(int xcpu)
+dtrace_debug_unlock(int cpu)
 {
-	dtrace_debug_flag[xcpu] = 0;
+	dtrace_debug_flag[cpu] = 0;
 }
 
 static void

Index: src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.6 src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.7
--- src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c:1.6	Mon Jun 11 15:18:05 2012
+++ src/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c	Sat Jun 16 17:31:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.6 2012/06/11 15:18:05 chs Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.7 2012/06/16 17:31:47 chs Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -129,11 +129,11 @@ xcall_func(void *arg0, void *arg1)
 }
 
 void
-dtrace_xcall(processorid_t xcpu, dtrace_xcall_t func, void *arg)
+dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, void *arg)
 {
 	uint64_t where;
 
-	if (xcpu == DTRACE_CPUALL) {
+	if (cpu == DTRACE_CPUALL) {
 		where = xc_broadcast(0, xcall_func, func, arg);
 	} else {
 		struct cpu_info *cinfo = cpu_lookup(cpu);

Index: src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c
diff -u src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.6 src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.7
--- src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c:1.6	Fri Sep  9 17:48:39 2011
+++ src/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c	Sat Jun 16 17:31:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dtrace_subr.c,v 1.6 2011/09/09 17:48:39 christos Exp $	*/
+/*	$NetBSD: dtrace_subr.c,v 1.7 2012/06/16 17:31:47 chs Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -131,11 +131,11 @@ xcall_func(void *arg0, void *arg1)
 }
 
 void
-dtrace_xcall(processorid_t xcpu, dtrace_xcall_t func, void *arg)
+dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, void *arg)
 {
 	uint64_t where;
 
-	if (xcpu == DTRACE_CPUALL) {
+	if (cpu == DTRACE_CPUALL) {
 		where = xc_broadcast(0, xcall_func, func, arg);
 	} else {
 		struct cpu_info *cinfo = cpu_lookup(cpu);

Index: src/external/cddl/osnet/dev/fbt/fbt.c
diff -u src/external/cddl/osnet/dev/fbt/fbt.c:1.10 src/external/cddl/osnet/dev/fbt/fbt.c:1.11
--- src/external/cddl/osnet/dev/fbt/fbt.c:1.10	Wed Oct 19 10:55:50 2011
+++ src/external/cddl/osnet/dev/fbt/fbt.c	Sat Jun 16 17:31:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fbt.c,v 1.10 2011/10/19 10:55:50 yamt Exp $	*/
+/*	$NetBSD: fbt.c,v 1.11 2012/06/16 17:31:47 chs Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -182,7 +182,7 @@ fbt_doubletrap(void)
 static int
 fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval)
 {
-	solaris_cpu_t *xcpu = solaris_cpu[cpu_number()];
+	solaris_cpu_t *cpu = solaris_cpu[cpu_number()];
 	uintptr_t stack0, stack1, stack2, stack3, stack4;
 	fbt_probe_t *fbt = fbt_probetab[FBT_ADDR2NDX(addr)];
 
@@ -199,7 +199,7 @@ fbt_invop(uintptr_t 

CVS commit: src/sys/external/bsd/drm/dist/bsd-core

2012-06-17 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Jun 17 15:15:34 UTC 2012

Modified Files:
src/sys/external/bsd/drm/dist/bsd-core: drm_bufs.c

Log Message:
when freeing the DRM_SHM kernel memory that can be mapped by a user process,
remove any user mappings before freeing the memory, so that a user process
doesn't have still have access to that physical memory after it's reused.
this really shouldn't be using kernel malloc'd memory at all,
but changing that would be much more involved.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c

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

Modified files:

Index: src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c
diff -u src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.10 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.11
--- src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c:1.10	Sun Jan 29 11:49:02 2012
+++ src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c	Sun Jun 17 15:15:34 2012
@@ -316,6 +316,22 @@ int drm_addmap_ioctl(struct drm_device *
 	return 0;
 }
 
+static void
+drm_rmmap_user(void *addr, size_t size)
+{
+	vaddr_t va, eva;
+	paddr_t pa;
+	struct vm_page *pg;
+
+	va = (vaddr_t)addr;
+	eva = va + size;
+	for (; va  eva; va += PAGE_SIZE) {
+		pmap_extract(pmap_kernel(), va, pa);
+		pg = PHYS_TO_VM_PAGE(pa);
+		pmap_page_protect(pg, VM_PROT_NONE);
+	}
+}
+
 void drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
 {
 	DRM_SPINLOCK_ASSERT(dev-dev_lock);
@@ -338,6 +354,11 @@ void drm_rmmap(struct drm_device *dev, d
 		}
 		break;
 	case _DRM_SHM:
+
+		/*
+		 * Remove any user mappings before we free the kernel memory.
+		 */
+		drm_rmmap_user(map-handle, map-size);
 		free(map-handle, DRM_MEM_MAPS);
 		break;
 	case _DRM_AGP:



CVS commit: src/sys/kern

2013-01-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  7 16:54:54 UTC 2013

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

Log Message:
fix setrlimit(RLIMIT_STACK) for __MACHINE_STACK_GROWS_UP platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/kern/kern_resource.c

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

Modified files:

Index: src/sys/kern/kern_resource.c
diff -u src/sys/kern/kern_resource.c:1.171 src/sys/kern/kern_resource.c:1.172
--- src/sys/kern/kern_resource.c:1.171	Fri Dec 21 19:39:48 2012
+++ src/sys/kern/kern_resource.c	Mon Jan  7 16:54:54 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_resource.c,v 1.171 2012/12/21 19:39:48 njoly Exp $	*/
+/*	$NetBSD: kern_resource.c,v 1.172 2013/01/07 16:54:54 chs Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_resource.c,v 1.171 2012/12/21 19:39:48 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_resource.c,v 1.172 2013/01/07 16:54:54 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -409,20 +409,21 @@ dosetrlimit(struct lwp *l, struct proc *
 			vaddr_t addr;
 			vsize_t size;
 			vm_prot_t prot;
+			char *base, *tmp;
 
+			base = p-p_vmspace-vm_minsaddr;
 			if (limp-rlim_cur  alimp-rlim_cur) {
 prot = VM_PROT_READ | VM_PROT_WRITE;
 size = limp-rlim_cur - alimp-rlim_cur;
-addr = (vaddr_t)p-p_vmspace-vm_minsaddr -
-limp-rlim_cur;
+tmp = STACK_GROW(base, alimp-rlim_cur);
 			} else {
 prot = VM_PROT_NONE;
 size = alimp-rlim_cur - limp-rlim_cur;
-addr = (vaddr_t)p-p_vmspace-vm_minsaddr -
- alimp-rlim_cur;
+tmp = STACK_GROW(base, limp-rlim_cur);
 			}
+			addr = (vaddr_t)STACK_ALLOC(tmp, size);
 			(void) uvm_map_protect(p-p_vmspace-vm_map,
-			addr, addr+size, prot, false);
+			addr, addr + size, prot, false);
 		}
 		break;
 



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

2013-01-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  7 16:57:28 UTC 2013

Modified Files:
src/sys/arch/hppa/include: pmap.h vmparam.h

Log Message:
switch to __USE_TOPDOWN_VM.
move the stack to the top of the user address space so that
the available free space is more contiguous.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/hppa/include/pmap.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hppa/include/vmparam.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/hppa/include/pmap.h
diff -u src/sys/arch/hppa/include/pmap.h:1.36 src/sys/arch/hppa/include/pmap.h:1.37
--- src/sys/arch/hppa/include/pmap.h:1.36	Fri Jan  6 20:55:28 2012
+++ src/sys/arch/hppa/include/pmap.h	Mon Jan  7 16:57:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.36 2012/01/06 20:55:28 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.37 2013/01/07 16:57:28 chs Exp $	*/
 
 /*	$OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $	*/
 
@@ -118,13 +118,23 @@ static inline paddr_t hppa_unmap_poolpag
  * according to the parisc manual aliased va's should be
  * different by high 12 bits only.
  */
-#define	PMAP_PREFER(o,h,s,td)	do {	\
-	vaddr_t pmap_prefer_hint;	\
-	pmap_prefer_hint = (*(h)  HPPA_PGAMASK) | ((o)  HPPA_PGAOFF);	\
-	if (pmap_prefer_hint  *(h))	\
-		pmap_prefer_hint += HPPA_PGALIAS;			\
-	*(h) = pmap_prefer_hint;	\
-} while(0)
+#define	PMAP_PREFER(o,h,s,td)	pmap_prefer((o), (h), (td))
+
+static inline void
+pmap_prefer(vaddr_t fo, vaddr_t *va, int td)
+{
+	vaddr_t newva;
+
+	newva = (*va  HPPA_PGAMASK) | (fo  HPPA_PGAOFF);
+	if (td) {
+		if (newva  *va)
+			newva -= HPPA_PGALIAS;
+	} else {
+		if (newva  *va)
+			newva += HPPA_PGALIAS;
+	}
+	*va = newva;
+}
 
 #define	pmap_sid2pid(s)			(((s) + 1)  1)
 #define	pmap_resident_count(pmap)	((pmap)-pm_stats.resident_count)

Index: src/sys/arch/hppa/include/vmparam.h
diff -u src/sys/arch/hppa/include/vmparam.h:1.19 src/sys/arch/hppa/include/vmparam.h:1.20
--- src/sys/arch/hppa/include/vmparam.h:1.19	Tue Nov 16 09:34:24 2010
+++ src/sys/arch/hppa/include/vmparam.h	Mon Jan  7 16:57:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.19 2010/11/16 09:34:24 uebayasi Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.20 2013/01/07 16:57:28 chs Exp $	*/
 
 /*	$OpenBSD: vmparam.h,v 1.33 2006/06/04 17:21:24 miod Exp $	*/
 
@@ -28,6 +28,8 @@
 #ifndef _HPPA_VMPARAM_H_
 #define _HPPA_VMPARAM_H_
 
+#define __USE_TOPDOWN_VM
+
 /*
  * Machine dependent constants for HP PA
  */
@@ -43,8 +45,8 @@
 /*
  * USRSTACK is the bottom (start) of the user stack.
  */
-#define	USRSTACK	0x7000		/* Start of user stack */
-#define	SYSCALLGATE	0xC000		/* syscall gateway page */
+#define	USRSTACK	(VM_MAXUSER_ADDRESS - MAXSSIZ) /* Start of user stack */
+#define	SYSCALLGATE	0xc000		/* syscall gateway page */
 
 /*
  * Virtual memory related constants, all in bytes



CVS commit: src/sys/arch

2013-01-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  7 16:58:09 UTC 2013

Modified Files:
src/sys/arch/sun2/include: pmap.h vmparam.h
src/sys/arch/sun2/sun2: pmap.c
src/sys/arch/sun3/include: pmap3.h vmparam.h
src/sys/arch/sun3/sun3: pmap.c

Log Message:
switch to __USE_TOPDOWN_VM.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sun2/include/pmap.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sun2/include/vmparam.h
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/sun2/sun2/pmap.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sun3/include/pmap3.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/sun3/include/vmparam.h
cvs rdiff -u -r1.167 -r1.168 src/sys/arch/sun3/sun3/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/sun2/include/pmap.h
diff -u src/sys/arch/sun2/include/pmap.h:1.24 src/sys/arch/sun2/include/pmap.h:1.25
--- src/sys/arch/sun2/include/pmap.h:1.24	Fri Jun  3 17:03:52 2011
+++ src/sys/arch/sun2/include/pmap.h	Mon Jan  7 16:58:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.24 2011/06/03 17:03:52 tsutsui Exp $	*/
+/*	$NetBSD: pmap.h,v 1.25 2013/01/07 16:58:08 chs Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -51,7 +51,7 @@ int _pmap_fault(struct vm_map *, vaddr_t
 
 /* This lets us have some say in choosing VA locations. */
 extern void pmap_prefer(vaddr_t, vaddr_t *);
-#define PMAP_PREFER(fo, ap, sz, td) pmap_prefer((fo), (ap))
+#define PMAP_PREFER(fo, ap, sz, td) pmap_prefer((fo), (ap), (td))
 
 /* This needs to be a macro for kern_sysctl.c */
 extern segsz_t pmap_resident_pages(pmap_t);

Index: src/sys/arch/sun2/include/vmparam.h
diff -u src/sys/arch/sun2/include/vmparam.h:1.14 src/sys/arch/sun2/include/vmparam.h:1.15
--- src/sys/arch/sun2/include/vmparam.h:1.14	Sat Nov  6 15:42:49 2010
+++ src/sys/arch/sun2/include/vmparam.h	Mon Jan  7 16:58:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.14 2010/11/06 15:42:49 uebayasi Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.15 2013/01/07 16:58:08 chs Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -26,6 +26,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define __USE_TOPDOWN_VM
+
 /*
  * Machine dependent constants for Sun2
  *

Index: src/sys/arch/sun2/sun2/pmap.c
diff -u src/sys/arch/sun2/sun2/pmap.c:1.45 src/sys/arch/sun2/sun2/pmap.c:1.46
--- src/sys/arch/sun2/sun2/pmap.c:1.45	Tue Jan 31 22:47:08 2012
+++ src/sys/arch/sun2/sun2/pmap.c	Mon Jan  7 16:58:09 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.45 2012/01/31 22:47:08 para Exp $	*/
+/*	$NetBSD: pmap.c,v 1.46 2013/01/07 16:58:09 chs Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.45 2012/01/31 22:47:08 para Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.46 2013/01/07 16:58:09 chs Exp $);
 
 #include opt_ddb.h
 #include opt_pmap_debug.h
@@ -3683,12 +3683,18 @@ pmap_zero_page(paddr_t pa)
  * (This will just seg-align mappings.)
  */
 void 
-pmap_prefer(vaddr_t fo, vaddr_t *va)
+pmap_prefer(vaddr_t fo, vaddr_t *va, int td)
 {
 	long d;
 
 	d = fo - *va;
 	d = SEGOFSET;
+	if (d == 0) {
+		return;
+	}
+	if (td) {
+		*va -= SEGOFSET + 1;
+	}
 	*va += d;
 }
 

Index: src/sys/arch/sun3/include/pmap3.h
diff -u src/sys/arch/sun3/include/pmap3.h:1.48 src/sys/arch/sun3/include/pmap3.h:1.49
--- src/sys/arch/sun3/include/pmap3.h:1.48	Fri Jun  3 17:03:52 2011
+++ src/sys/arch/sun3/include/pmap3.h	Mon Jan  7 16:58:09 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap3.h,v 1.48 2011/06/03 17:03:52 tsutsui Exp $	*/
+/*	$NetBSD: pmap3.h,v 1.49 2013/01/07 16:58:09 chs Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -50,8 +50,8 @@ struct pmap {
 int _pmap_fault(struct vm_map *, vaddr_t, vm_prot_t);
 
 /* This lets us have some say in choosing VA locations. */
-extern void pmap_prefer(vaddr_t, vaddr_t *);
-#define PMAP_PREFER(fo, ap, sz, td) pmap_prefer((fo), (ap))
+extern void pmap_prefer(vaddr_t, vaddr_t *, int);
+#define PMAP_PREFER(fo, ap, sz, td) pmap_prefer((fo), (ap), (td))
 
 /* This needs to be a macro for kern_sysctl.c */
 extern segsz_t pmap_resident_pages(pmap_t);

Index: src/sys/arch/sun3/include/vmparam.h
diff -u src/sys/arch/sun3/include/vmparam.h:1.36 src/sys/arch/sun3/include/vmparam.h:1.37
--- src/sys/arch/sun3/include/vmparam.h:1.36	Sat Nov  6 15:42:49 2010
+++ src/sys/arch/sun3/include/vmparam.h	Mon Jan  7 16:58:09 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.36 2010/11/06 15:42:49 uebayasi Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.37 2013/01/07 16:58:09 chs Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
 #ifndef _SUN3_VMPARAM_H_
 #define _SUN3_VMPARAM_H_ 1
 
+#define __USE_TOPDOWN_VM
+
 /*
  * We use 8K pages on both the sun3 and sun3x.  Override PAGE_*
  * to be compile-time constants.

Index: src/sys/arch/sun3/sun3/pmap.c
diff -u 

CVS commit: src/sys/arch/sparc

2013-01-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  7 16:59:18 UTC 2013

Modified Files:
src/sys/arch/sparc/include: pmap.h vmparam.h
src/sys/arch/sparc/sparc: pmap.c

Log Message:
switch to __USE_TOPDOWN_VM.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/sparc/include/pmap.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sparc/include/vmparam.h
cvs rdiff -u -r1.349 -r1.350 src/sys/arch/sparc/sparc/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/sparc/include/pmap.h
diff -u src/sys/arch/sparc/include/pmap.h:1.90 src/sys/arch/sparc/include/pmap.h:1.91
--- src/sys/arch/sparc/include/pmap.h:1.90	Mon Feb 14 10:22:19 2011
+++ src/sys/arch/sparc/include/pmap.h	Mon Jan  7 16:59:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.90 2011/02/14 10:22:19 he Exp $ */
+/*	$NetBSD: pmap.h,v 1.91 2013/01/07 16:59:18 chs Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -240,7 +240,7 @@ int	pmap_dumpmmu(int (*)(dev_t, daddr_t,
 #define	pmap_resident_count(pm)	((pm)-pm_stats.resident_count)
 #define	pmap_wired_count(pm)	((pm)-pm_stats.wired_count)
 
-#define PMAP_PREFER(fo, ap, sz, td)	pmap_prefer((fo), (ap))
+#define PMAP_PREFER(fo, ap, sz, td)	pmap_prefer((fo), (ap), (sz), (td))
 
 #define PMAP_EXCLUDE_DECLS	/* tells MI pmap.h *not* to include decls */
 
@@ -249,7 +249,7 @@ int	pmap_dumpmmu(int (*)(dev_t, daddr_t,
 void		pmap_activate(struct lwp *);
 void		pmap_deactivate(struct lwp *);
 void		pmap_bootstrap(int nmmu, int nctx, int nregion);
-void		pmap_prefer(vaddr_t, vaddr_t *);
+void		pmap_prefer(vaddr_t, vaddr_t *, size_t, int);
 int		pmap_pa_exists(paddr_t);
 void		pmap_unwire(pmap_t, vaddr_t);
 void		pmap_copy(pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t);

Index: src/sys/arch/sparc/include/vmparam.h
diff -u src/sys/arch/sparc/include/vmparam.h:1.42 src/sys/arch/sparc/include/vmparam.h:1.43
--- src/sys/arch/sparc/include/vmparam.h:1.42	Sun Nov 14 13:33:23 2010
+++ src/sys/arch/sparc/include/vmparam.h	Mon Jan  7 16:59:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.42 2010/11/14 13:33:23 uebayasi Exp $ */
+/*	$NetBSD: vmparam.h,v 1.43 2013/01/07 16:59:18 chs Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -43,6 +43,8 @@
 #ifndef _SPARC_VMPARAM_H_
 #define _SPARC_VMPARAM_H_
 
+#define __USE_TOPDOWN_VM
+
 /*
  * Machine dependent constants for SPARC
  */

Index: src/sys/arch/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.349 src/sys/arch/sparc/sparc/pmap.c:1.350
--- src/sys/arch/sparc/sparc/pmap.c:1.349	Sun Nov  4 00:32:47 2012
+++ src/sys/arch/sparc/sparc/pmap.c	Mon Jan  7 16:59:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.349 2012/11/04 00:32:47 chs Exp $ */
+/*	$NetBSD: pmap.c,v 1.350 2013/01/07 16:59:18 chs Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.349 2012/11/04 00:32:47 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.350 2013/01/07 16:59:18 chs Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -7408,21 +7408,32 @@ kvm_iocache(char *va, int npages)
  * (This will just seg-align mappings.)
  */
 void
-pmap_prefer(vaddr_t foff, vaddr_t *vap)
+pmap_prefer(vaddr_t foff, vaddr_t *vap, size_t size, int td)
 {
 	vaddr_t va = *vap;
-	long d, m;
-
-	if (VA_INHOLE(va))
-		va = MMU_HOLE_END;
+	long m;
 
 	m = CACHE_ALIAS_DIST;
 	if (m == 0)		/* m=0 = no cache aliasing */
 		return;
 
-	d = foff - va;
-	d = (m - 1);
-	*vap = va + d;
+	if (VA_INHOLE(va)) {
+		if (td)
+			va = MMU_HOLE_START - size;
+		else
+			va = MMU_HOLE_END;
+	}
+
+	va = (va  ~(m - 1)) | (foff  (m - 1));
+
+	if (td) {
+		if (va  *vap)
+			va -= m;
+	} else {
+		if (va  *vap)
+			va += m;
+	}
+	*vap = va;
 }
 
 void



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

2013-01-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  7 17:03:06 UTC 2013

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

Log Message:
rearrange the LDT entries so that (32-bit) COMPAT_10 binaries work again.
in long mode, call gates use two slots, so the first entry (a call gate)
would overlap the second one (the 32-bit user code descriptor).


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

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

Modified files:

Index: src/sys/arch/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.23 src/sys/arch/amd64/include/segments.h:1.24
--- src/sys/arch/amd64/include/segments.h:1.23	Sat Jun 16 20:47:04 2012
+++ src/sys/arch/amd64/include/segments.h	Mon Jan  7 17:03:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.23 2012/06/16 20:47:04 dsl Exp $	*/
+/*	$NetBSD: segments.h,v 1.24 2013/01/07 17:03:06 chs Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -374,12 +374,15 @@ void cpu_fsgs_reload(struct lwp *, int, 
  * Strange order because of syscall/sysret insns
  */
 #define	LSYS5CALLS_SEL	0	/* iBCS system call gate */
-#define LUCODE32_SEL	8	/* 32 bit user code descriptor */
-#define	LUDATA_SEL	16	/* User data descriptor */
-#define	LUCODE_SEL	24	/* User code descriptor */
+/*			8	   second half */
 #define	LSOL26CALLS_SEL	32	/* Solaris 2.6 system call gate */
-#define LUDATA32_SEL	56	/* 32 bit user data descriptor (needed?)*/
+/*			40	   second half */
+#define LUCODE32_SEL	48	/* 32 bit user code descriptor */
+#define	LUDATA_SEL	56	/* User data descriptor */
+#define	LUCODE_SEL	64	/* User code descriptor */
+#define LUDATA32_SEL	72	/* 32 bit user data descriptor (needed?)*/
 #define	LBSDICALLS_SEL	128	/* BSDI system call gate */
+/*			136	   second half */
 
 #define LDT_SIZE	144
 



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

2013-01-12 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Jan 12 16:56:11 UTC 2013

Modified Files:
src/sys/arch/amd64/amd64: machdep.c

Log Message:
enable sparse dumps by default.


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/amd64/amd64/machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.191 src/sys/arch/amd64/amd64/machdep.c:1.192
--- src/sys/arch/amd64/amd64/machdep.c:1.191	Tue Nov 13 14:09:36 2012
+++ src/sys/arch/amd64/amd64/machdep.c	Sat Jan 12 16:56:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.191 2012/11/13 14:09:36 chs Exp $	*/
+/*	$NetBSD: machdep.c,v 1.192 2013/01/12 16:56:11 chs Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.191 2012/11/13 14:09:36 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.192 2013/01/12 16:56:11 chs Exp $);
 
 /* #define XENDEBUG_LOW  */
 
@@ -238,7 +238,7 @@ int	cpu_class;
 int	use_pae;
 
 #ifndef NO_SPARSE_DUMP
-int sparse_dump = 0;
+int sparse_dump = 1;
 
 paddr_t max_paddr = 0;
 unsigned char *sparse_dump_physmap;



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

2013-03-24 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Mar 25 01:34:59 UTC 2013

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

Log Message:
only use db_printf() if we're actually called from DDB.
this prevents the boot-time one from pausing the boot process.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/x86/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/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.74 src/sys/arch/x86/x86/intr.c:1.75
--- src/sys/arch/x86/x86/intr.c:1.74	Fri Jun 15 13:57:59 2012
+++ src/sys/arch/x86/x86/intr.c	Mon Mar 25 01:34:59 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.74 2012/06/15 13:57:59 yamt Exp $	*/
+/*	$NetBSD: intr.c,v 1.75 2013/03/25 01:34:59 chs Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.74 2012/06/15 13:57:59 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.75 2013/03/25 01:34:59 chs Exp $);
 
 #include opt_intrdebug.h
 #include opt_multiprocessor.h
@@ -1063,10 +1063,6 @@ cpu_intr_init(struct cpu_info *ci)
 
 #if defined(INTRDEBUG) || defined(DDB)
 
-#ifdef DDB
-#define printf db_printf
-#endif
-
 void
 intr_printconfig(void)
 {
@@ -1075,30 +1071,45 @@ intr_printconfig(void)
 	struct intrsource *isp;
 	struct cpu_info *ci;
 	CPU_INFO_ITERATOR cii;
+	void (*pr)(const char *, ...);
+
+	pr = printf;
+#ifdef DDB
+	extern int db_active;
+	if (db_active) {
+		pr = db_printf;
+	}
+#endif
 
 	for (CPU_INFO_FOREACH(cii, ci)) {
-		printf(%s: interrupt masks:\n, device_xname(ci-ci_dev));
+		(*pr)(%s: interrupt masks:\n, device_xname(ci-ci_dev));
 		for (i = 0; i  NIPL; i++)
-			printf(IPL %d mask %lx unmask %lx\n, i,
+			(*pr)(IPL %d mask %lx unmask %lx\n, i,
 			(u_long)ci-ci_imask[i], (u_long)ci-ci_iunmask[i]);
 		for (i = 0; i  MAX_INTR_SOURCES; i++) {
 			isp = ci-ci_isources[i];
 			if (isp == NULL)
 continue;
-			printf(%s source %d is pin %d from pic %s maxlevel %d\n,
+			(*pr)(%s source %d is pin %d from pic %s type %d maxlevel %d\n,
 			device_xname(ci-ci_dev), i, isp-is_pin,
-			isp-is_pic-pic_name, isp-is_maxlevel);
+			isp-is_pic-pic_name, isp-is_type, isp-is_maxlevel);
 			for (ih = isp-is_handlers; ih != NULL;
 			 ih = ih-ih_next)
-printf(\thandler %p level %d\n,
+(*pr)(\thandler %p level %d\n,
 ih-ih_fun, ih-ih_level);
+#if NIOAPIC  0
+			if (isp-is_pic-pic_type == PIC_IOAPIC) {
+struct ioapic_softc *sc;
+sc = isp-is_pic-pic_ioapic;
+(*pr)(\tioapic redir 0x%x\n,
+sc-sc_pins[isp-is_pin].ip_map-redir);
+			}
+#endif
 
 		}
 	}
 }
-#ifdef DDB
-#undef printf
-#endif
+
 #endif
 
 void



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

2013-03-31 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Mar 31 19:34:25 UTC 2013

Modified Files:
src/sys/arch/x86/acpi: acpi_machdep.c

Log Message:
yet more fixes for PR 47648 / PR 47016:
when using a temporary mp_intr_map, initialize the flags field
as well as redir since apic_set_redir() uses both.  fix how
the flags field is change when applying an override, the trigger
and polarity sub-fields aren't just one bit like they are in redir.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/acpi/acpi_machdep.c

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

Modified files:

Index: src/sys/arch/x86/acpi/acpi_machdep.c
diff -u src/sys/arch/x86/acpi/acpi_machdep.c:1.5 src/sys/arch/x86/acpi/acpi_machdep.c:1.6
--- src/sys/arch/x86/acpi/acpi_machdep.c:1.5	Mon Mar 25 01:30:37 2013
+++ src/sys/arch/x86/acpi/acpi_machdep.c	Sun Mar 31 19:34:24 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.5 2013/03/25 01:30:37 chs Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.6 2013/03/31 19:34:24 chs Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_machdep.c,v 1.5 2013/03/25 01:30:37 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_machdep.c,v 1.6 2013/03/31 19:34:24 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -163,12 +163,14 @@ acpi_md_OsInstallInterruptHandler(uint32
 		if (polarity == ACPI_MADT_POLARITY_ACTIVE_HIGH ||
 		(!sci  polarity == ACPI_MADT_POLARITY_CONFORMS)) {
 			mpflags = ~MPS_INTPO_ACTLO;
+			mpflags |= MPS_INTPO_ACTHI;
 			redir = ~IOAPIC_REDLO_ACTLO;
 		}
 		if (trigger == ACPI_MADT_TRIGGER_EDGE ||
 		(!sci  trigger == ACPI_MADT_TRIGGER_CONFORMS)) {
 			type = IST_EDGE;
 			mpflags = ~(MPS_INTTR_LEVEL  2);
+			mpflags |= (MPS_INTTR_EDGE  2);
 			redir = ~IOAPIC_REDLO_LEVEL;
 		}
 	}
@@ -200,6 +202,7 @@ acpi_md_OsInstallInterruptHandler(uint32
 			mipp = sc-sc_pins[pin].ip_map;
 			*mipp = tmpmap;
 			tmpmap.redir = redir;
+			tmpmap.flags = mpflags;
 		}
 	} else
 #endif



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

2013-03-31 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Mar 31 19:45:06 UTC 2013

Modified Files:
src/sys/arch/x86/include: mpacpi.h

Log Message:
remove unused variable declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/mpacpi.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/x86/include/mpacpi.h
diff -u src/sys/arch/x86/include/mpacpi.h:1.9 src/sys/arch/x86/include/mpacpi.h:1.10
--- src/sys/arch/x86/include/mpacpi.h:1.9	Fri Apr 17 21:07:58 2009
+++ src/sys/arch/x86/include/mpacpi.h	Sun Mar 31 19:45:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpacpi.h,v 1.9 2009/04/17 21:07:58 dyoung Exp $	*/
+/*	$NetBSD: mpacpi.h,v 1.10 2013/03/31 19:45:06 chs Exp $	*/
 
 #ifndef _X86_MPACPI_H_
 #define _X86_MPACPI_H_
@@ -13,6 +13,4 @@ int mpacpi_pci_attach_hook(device_t, dev
 struct mp_intr_map;
 int mpacpi_findintr_linkdev(struct mp_intr_map *);
 
-extern struct mp_intr_map *mpacpi_sci_override;
-
 #endif /* _X86_MPACPI_H_ */



CVS commit: src

2011-10-17 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Oct 17 14:20:56 UTC 2011

Modified Files:
src/distrib/sets/lists/comp: ad.mips64eb ad.mips64el md.amd64
md.sparc64 mi shl.mi
src/external/gpl3/gcc/lib/libgcc/libgcc: Makefile
src/external/gpl3/gcc/lib/libgcc/libgcc_eh: Makefile
src/gnu/lib/libgcc4/libgcc: Makefile
src/gnu/lib/libgcc4/libgcc_eh: Makefile

Log Message:
do not build profiling versions of libgcc or libgcc_eh.
they are not used, and they don't build on arm with gcc 4.5.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/distrib/sets/lists/comp/ad.mips64eb \
src/distrib/sets/lists/comp/ad.mips64el
cvs rdiff -u -r1.142 -r1.143 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.127 -r1.128 src/distrib/sets/lists/comp/md.sparc64
cvs rdiff -u -r1.1693 -r1.1694 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.197 -r1.198 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gcc/lib/libgcc/libgcc/Makefile
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gcc/lib/libgcc/libgcc_eh/Makefile
cvs rdiff -u -r1.11 -r1.12 src/gnu/lib/libgcc4/libgcc/Makefile
cvs rdiff -u -r1.8 -r1.9 src/gnu/lib/libgcc4/libgcc_eh/Makefile

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

Modified files:

Index: src/distrib/sets/lists/comp/ad.mips64eb
diff -u src/distrib/sets/lists/comp/ad.mips64eb:1.58 src/distrib/sets/lists/comp/ad.mips64eb:1.59
--- src/distrib/sets/lists/comp/ad.mips64eb:1.58	Thu Oct 13 22:08:18 2011
+++ src/distrib/sets/lists/comp/ad.mips64eb	Mon Oct 17 14:20:54 2011
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64eb,v 1.58 2011/10/13 22:08:18 joerg Exp $
+# $NetBSD: ad.mips64eb,v 1.59 2011/10/17 14:20:54 chs Exp $
 ./usr/bin/elf2aoutcomp-obsolete		obsolete
 ./usr/bin/elf2ecoffcomp-sysutil-bin
 ./usr/include/gcc-4.5/loongson.h		comp-c-include		gcccmds,gcc=45
@@ -275,9 +275,9 @@
 ./usr/lib/64/libform_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/64/libgcc.acomp-c-lib		compat
 ./usr/lib/64/libgcc_eh.a			comp-c-lib		compat,pic
-./usr/lib/64/libgcc_eh_p.a			comp-c-proflib		compat,profile,pic
+./usr/lib/64/libgcc_eh_p.a			comp-c-proflib		obsolete
 ./usr/lib/64/libgcc_eh_pic.a			comp-c-piclib		obsolete
-./usr/lib/64/libgcc_p.acomp-c-proflib		compat,profile
+./usr/lib/64/libgcc_p.acomp-c-proflib		obsolete
 ./usr/lib/64/libgcc_pic.a			comp-c-piclib		obsolete
 ./usr/lib/64/libgcc_s.acomp-obsolete		obsolete
 ./usr/lib/64/libgcc_s.so			base-sys-shlib		compat,pic
@@ -856,9 +856,9 @@
 ./usr/lib/o32/libform_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/o32/libgcc.acomp-c-lib		compat
 ./usr/lib/o32/libgcc_eh.a			comp-c-lib		compat,pic
-./usr/lib/o32/libgcc_eh_p.a			comp-c-proflib		compat,profile,pic
+./usr/lib/o32/libgcc_eh_p.a			comp-c-proflib		obsolete
 ./usr/lib/o32/libgcc_eh_pic.a			comp-c-piclib		obsolete
-./usr/lib/o32/libgcc_p.a			comp-c-proflib		compat,profile
+./usr/lib/o32/libgcc_p.a			comp-c-proflib		obsolete
 ./usr/lib/o32/libgcc_pic.a			comp-c-piclib		obsolete
 ./usr/lib/o32/libgcc_s.a			comp-obsolete		obsolete
 ./usr/lib/o32/libgcc_s.so			base-sys-shlib		compat,pic
Index: src/distrib/sets/lists/comp/ad.mips64el
diff -u src/distrib/sets/lists/comp/ad.mips64el:1.58 src/distrib/sets/lists/comp/ad.mips64el:1.59
--- src/distrib/sets/lists/comp/ad.mips64el:1.58	Thu Oct 13 22:08:18 2011
+++ src/distrib/sets/lists/comp/ad.mips64el	Mon Oct 17 14:20:54 2011
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64el,v 1.58 2011/10/13 22:08:18 joerg Exp $
+# $NetBSD: ad.mips64el,v 1.59 2011/10/17 14:20:54 chs Exp $
 ./usr/bin/elf2aoutcomp-obsolete		obsolete
 ./usr/bin/elf2ecoffcomp-sysutil-bin
 ./usr/include/gcc-4.5/loongson.h		comp-c-include		gcccmds,gcc=45
@@ -275,9 +275,9 @@
 ./usr/lib/64/libform_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/64/libgcc.acomp-c-lib		compat
 ./usr/lib/64/libgcc_eh.a			comp-c-lib		compat,pic
-./usr/lib/64/libgcc_eh_p.a			comp-c-proflib		compat,profile,pic
+./usr/lib/64/libgcc_eh_p.a			comp-c-proflib		obsolete
 ./usr/lib/64/libgcc_eh_pic.a			comp-c-piclib		obsolete
-./usr/lib/64/libgcc_p.acomp-c-proflib		compat,profile
+./usr/lib/64/libgcc_p.acomp-c-proflib		obsolete
 ./usr/lib/64/libgcc_pic.a			comp-c-piclib		obsolete
 ./usr/lib/64/libgcc_s.acomp-obsolete		obsolete
 ./usr/lib/64/libgcc_s.so			base-sys-shlib		compat,pic
@@ -856,9 +856,9 @@
 ./usr/lib/o32/libform_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/o32/libgcc.acomp-c-lib		compat
 ./usr/lib/o32/libgcc_eh.a			comp-c-lib		compat,pic
-./usr/lib/o32/libgcc_eh_p.a			comp-c-proflib		compat,profile,pic
+./usr/lib/o32/libgcc_eh_p.a			comp-c-proflib		obsolete
 ./usr/lib/o32/libgcc_eh_pic.a			comp-c-piclib		obsolete
-./usr/lib/o32/libgcc_p.a			comp-c-proflib		compat,profile
+./usr/lib/o32/libgcc_p.a			comp-c-proflib		obsolete
 ./usr/lib/o32/libgcc_pic.a			comp-c-piclib		obsolete
 ./usr/lib/o32/libgcc_s.a			comp-obsolete		obsolete
 ./usr/lib/o32/libgcc_s.so			

CVS commit: src/external/gpl3/gcc/dist/gcc

2011-10-17 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Oct 17 14:27:10 UTC 2011

Modified Files:
src/external/gpl3/gcc/dist/gcc: gcc.c

Log Message:
when linking with -shared and -shared-libgcc, also link against
the static libgcc.a after the shared libgcc_s.so.  this is needed
on hppa and sh to get the millicode, which is not in the shared version.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/gcc/dist/gcc/gcc.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/gcc.c
diff -u src/external/gpl3/gcc/dist/gcc/gcc.c:1.8 src/external/gpl3/gcc/dist/gcc/gcc.c:1.9
--- src/external/gpl3/gcc/dist/gcc/gcc.c:1.8	Tue Oct 11 23:05:48 2011
+++ src/external/gpl3/gcc/dist/gcc/gcc.c	Mon Oct 17 14:27:10 2011
@@ -1760,7 +1760,7 @@ init_gcc_specs (struct obstack *obstack,
 		static_name,  --as-needed , shared_name,  --no-as-needed
 		}
 		%{shared-libgcc:,
-		shared_name, %{!shared: , static_name, }
+		--as-needed , shared_name,  --no-as-needed , static_name,
 		}
 #else
 		%{!shared:



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386

2011-10-21 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Oct 21 15:08:41 UTC 2011

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386: x86cpuid.S

Log Message:
add PIC support.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.1 src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.2
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.1	Tue Jul  5 16:53:58 2011
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S	Fri Oct 21 15:08:41 2011
@@ -1,3 +1,5 @@
+#include machine/asm.h
+
 .file	x86cpuid.s
 .text
 .globl	OPENSSL_ia32_cpuid
@@ -285,7 +287,9 @@ OPENSSL_cleanse:
 .size	OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin
 .comm	OPENSSL_ia32cap_P,4,4
 .section	.init
-	call	OPENSSL_cpuid_setup
+	PIC_PROLOGUE
+	call	PIC_PLT(_C_LABEL(OPENSSL_cpuid_setup))
+	PIC_EPILOGUE
 	jmp	.Linitalign
 .align	16
 .Linitalign:



CVS commit: src/libexec/ld.elf_so/arch/powerpc

2011-10-26 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Oct 26 15:56:58 UTC 2011

Modified Files:
src/libexec/ld.elf_so/arch/powerpc: Makefile.inc

Log Message:
avoid linker warnings with the new binutils by not forcing ld.elf_so
to be soft-float.  the floating-point usage in ld.elf_so is only
because of stdarg functions like printf(), and gcc 4.5 is good
about not actually executing the FP instructions in such functions
unless FP values are passed to them, which ld.elf_so doesn't do.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/libexec/ld.elf_so/arch/powerpc/Makefile.inc

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

Modified files:

Index: src/libexec/ld.elf_so/arch/powerpc/Makefile.inc
diff -u src/libexec/ld.elf_so/arch/powerpc/Makefile.inc:1.11 src/libexec/ld.elf_so/arch/powerpc/Makefile.inc:1.12
--- src/libexec/ld.elf_so/arch/powerpc/Makefile.inc:1.11	Thu Oct 22 21:56:13 2009
+++ src/libexec/ld.elf_so/arch/powerpc/Makefile.inc	Wed Oct 26 15:56:58 2011
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile.inc,v 1.11 2009/10/22 21:56:13 skrll Exp $
+#	$NetBSD: Makefile.inc,v 1.12 2011/10/26 15:56:58 chs Exp $
 
 SRCS+=		rtld_start.S ppc_reloc.c
 
 # XXX Should not be in CPPFLAGS!
-CPPFLAGS+=	-fpic -msoft-float
+CPPFLAGS+=	-fpic
 
 CPPFLAGS+=	-DELFSIZE=32
 



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

2011-10-26 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Oct 26 15:57:27 UTC 2011

Modified Files:
src/sys/arch/powerpc/include: Makefile.inc

Log Message:
avoid linker warnings with the new binutils by not forcing rump modules
to be soft-float.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/powerpc/include/Makefile.inc

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

Modified files:

Index: src/sys/arch/powerpc/include/Makefile.inc
diff -u src/sys/arch/powerpc/include/Makefile.inc:1.1 src/sys/arch/powerpc/include/Makefile.inc:1.2
--- src/sys/arch/powerpc/include/Makefile.inc:1.1	Thu Dec 19 19:36:26 2002
+++ src/sys/arch/powerpc/include/Makefile.inc	Wed Oct 26 15:57:26 2011
@@ -1,8 +1,10 @@
-# $NetBSD: Makefile.inc,v 1.1 2002/12/19 19:36:26 thorpej Exp $
+# $NetBSD: Makefile.inc,v 1.2 2011/10/26 15:57:26 chs Exp $
 
 .if !defined(_POWERPC_MAKEFILE_INC)
 _POWERPC_MAKEFILE_INC=	yes
 
+.if !defined(RUMPKERNEL)
 CFLAGS+= -msoft-float
+.endif
 
 .endif



CVS commit: src/share/mk

2011-10-31 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Oct 31 14:20:12 UTC 2011

Modified Files:
src/share/mk: bsd.own.mk bsd.sys.mk sys.mk

Log Message:
switch everything except vax to gcc 4.5.
switch m68k to -Os since -O2 produces much bigger code
with gcc 4.5 than it did with gcc 4.1.


To generate a diff of this commit:
cvs rdiff -u -r1.688 -r1.689 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.209 -r1.210 src/share/mk/bsd.sys.mk
cvs rdiff -u -r1.106 -r1.107 src/share/mk/sys.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.688 src/share/mk/bsd.own.mk:1.689
--- src/share/mk/bsd.own.mk:1.688	Mon Oct 31 08:14:44 2011
+++ src/share/mk/bsd.own.mk	Mon Oct 31 14:20:11 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.688 2011/10/31 08:14:44 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1.689 2011/10/31 14:20:11 chs Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -49,10 +49,7 @@ TOOLCHAIN_MISSING?=	no
 #
 # Platforms still using GCC 4.1
 #
-.if ${MACHINE_ARCH} == alpha	|| \
-${MACHINE_CPU}  == arm	|| \
-${MACHINE_CPU}  == m68k	|| \
-${MACHINE_CPU}  == vax
+.if ${MACHINE_CPU}  == vax
 HAVE_GCC?=4
 .else
 # Otherwise, default to GCC4.5
@@ -1089,7 +1086,6 @@ X11SRCDIR.xf86-input-${_i}?=	${X11SRCDIR
 	s3 s3virge savage siliconmotion sis suncg14 \
 	suncg6 sunffb sunleo suntcx \
 	tdfx tga trident tseng vesa vga via vmware wsfb
-	
 X11SRCDIR.xf86-video-${_v}?=	${X11SRCDIRMIT}/xf86-video-${_v}/dist
 .endfor
 

Index: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.209 src/share/mk/bsd.sys.mk:1.210
--- src/share/mk/bsd.sys.mk:1.209	Tue Sep 20 09:11:06 2011
+++ src/share/mk/bsd.sys.mk	Mon Oct 31 14:20:12 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.sys.mk,v 1.209 2011/09/20 09:11:06 joerg Exp $
+#	$NetBSD: bsd.sys.mk,v 1.210 2011/10/31 14:20:12 chs Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -66,8 +66,11 @@ CFLAGS+=	-Wsign-compare -Wformat=2
 CFLAGS+=	${${ACTIVE_CC} == clang:? -Wpointer-sign -Wmissing-noreturn :}
 .endif
 .if (defined(HAVE_GCC)  ${HAVE_GCC} == 45 \
-  (${MACHINE_ARCH} == sh3eb || ${MACHINE_ARCH} == sh3el))
-# XXX GCC 4.5 for sh3 (which we compile with -Os) is extra noisy for
+  (${MACHINE_ARCH} == sh3eb || \
+	 ${MACHINE_ARCH} == sh3el || \
+	 ${MACHINE_ARCH} == m68k || \
+	 ${MACHINE_ARCH} == m68000))
+# XXX GCC 4.5 for sh3 and m68k (which we compile with -Os) is extra noisy for
 # cases it should be better with
 CFLAGS+=	-Wno-uninitialized
 .endif

Index: src/share/mk/sys.mk
diff -u src/share/mk/sys.mk:1.106 src/share/mk/sys.mk:1.107
--- src/share/mk/sys.mk:1.106	Fri May 20 14:27:48 2011
+++ src/share/mk/sys.mk	Mon Oct 31 14:20:12 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: sys.mk,v 1.106 2011/05/20 14:27:48 joerg Exp $
+#	$NetBSD: sys.mk,v 1.107 2011/10/31 14:20:12 chs Exp $
 #	@(#)sys.mk	8.2 (Berkeley) 3/21/94
 
 unix?=		We run NetBSD.
@@ -20,29 +20,16 @@ COMPILE.S?=	${CC} ${AFLAGS} ${AFLAGS.${
 LINK.S?=	${CC} ${AFLAGS} ${AFLAGS.${:T}} ${CPPFLAGS} ${LDFLAGS}
 
 CC?=		cc
-.if ${MACHINE_ARCH} == alpha || \
-${MACHINE_ARCH} == arm || \
-${MACHINE_ARCH} == x86_64 || \
-${MACHINE_ARCH} == armeb || \
-${MACHINE_ARCH} == hppa || \
-${MACHINE_ARCH} == i386 || \
-${MACHINE_ARCH} == m68k || \
-${MACHINE_ARCH} == mipsel || ${MACHINE_ARCH} == mipseb || \
-${MACHINE_ARCH} == mips64el || ${MACHINE_ARCH} == mips64eb || \
-${MACHINE_ARCH} == powerpc || \
-${MACHINE_ARCH} == sparc || \
-${MACHINE_ARCH} == sparc64
-DBG?=	-O2
-.elif ${MACHINE_ARCH} == sh3el || ${MACHINE_ARCH} == sh3eb
+.if ${MACHINE_ARCH} == sh3el || ${MACHINE_ARCH} == sh3eb
 # -O2 is too -falign-* zealous for low-memory sh3 machines
 DBG?=	-Os -freorder-blocks
+.elif ${MACHINE_ARCH} == m68k || ${MACHINE_ARCH} == m68000
+# see src/doc/HACKS for details
+DBG?=	-Os
 .elif ${MACHINE_ARCH} == vax
 DBG?=	-O1 -fgcse -fstrength-reduce -fgcse-after-reload
-.elif ${MACHINE_ARCH} == m68000
-# see src/doc/HACKS for details
-DBG?=	-O1
 .else
-DBG?=	-O
+DBG?=	-O2
 .endif
 CFLAGS?=	${DBG}
 LDFLAGS?=



CVS commit: xsrc/xfree/xc

2011-11-01 Thread Chuck Silvers
Module Name:xsrc
Committed By:   chs
Date:   Tue Nov  1 12:52:24 UTC 2011

Modified Files:
xsrc/xfree/xc/lib/X11: imRm.c
xsrc/xfree/xc/lib/Xaw: XawIm.c
xsrc/xfree/xc/lib/Xp: XpNotifyPdm.c
xsrc/xfree/xc/programs/Xserver/Xprint: attributes.c
xsrc/xfree/xc/programs/Xserver/dix: devices.c
xsrc/xfree/xc/programs/xtrap: xtrapin.c xtrapinfo.c xtrapout.c
xtrapproto.c xtrapreset.c xtrapstats.c

Log Message:
use 0 rather than NULL in integer contexts.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 xsrc/xfree/xc/lib/X11/imRm.c
cvs rdiff -u -r1.1.1.5 -r1.2 xsrc/xfree/xc/lib/Xaw/XawIm.c
cvs rdiff -u -r1.1.1.5 -r1.2 xsrc/xfree/xc/lib/Xp/XpNotifyPdm.c
cvs rdiff -u -r1.1.1.7 -r1.2 \
xsrc/xfree/xc/programs/Xserver/Xprint/attributes.c
cvs rdiff -u -r1.1.1.5 -r1.2 xsrc/xfree/xc/programs/Xserver/dix/devices.c
cvs rdiff -u -r1.1.1.2 -r1.2 xsrc/xfree/xc/programs/xtrap/xtrapin.c \
xsrc/xfree/xc/programs/xtrap/xtrapinfo.c \
xsrc/xfree/xc/programs/xtrap/xtrapreset.c \
xsrc/xfree/xc/programs/xtrap/xtrapstats.c
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/xfree/xc/programs/xtrap/xtrapout.c
cvs rdiff -u -r1.1.1.3 -r1.2 xsrc/xfree/xc/programs/xtrap/xtrapproto.c

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

Modified files:

Index: xsrc/xfree/xc/lib/X11/imRm.c
diff -u xsrc/xfree/xc/lib/X11/imRm.c:1.1.1.4 xsrc/xfree/xc/lib/X11/imRm.c:1.2
--- xsrc/xfree/xc/lib/X11/imRm.c:1.1.1.4	Fri Mar  5 14:24:13 2004
+++ xsrc/xfree/xc/lib/X11/imRm.c	Tue Nov  1 12:52:23 2011
@@ -509,7 +509,7 @@ _XimDefaultArea(
 if(XGetGeometry(im-core.display, (Drawable)ic-core.focus_window,
 		root_return, x_return, y_return, width_return,
 		height_return, border_width_return, depth_return)
-		== (Status)NULL) {
+		== (Status)0) {
 	return True;
 }
 area.x	= 0;
@@ -538,7 +538,7 @@ _XimDefaultColormap(
 	return True;
 }
 if(XGetWindowAttributes(im-core.display, ic-core.client_window,
-	win_attr) == (Status)NULL) {
+	win_attr) == (Status)0) {
 	return True;
 }


Index: xsrc/xfree/xc/lib/Xaw/XawIm.c
diff -u xsrc/xfree/xc/lib/Xaw/XawIm.c:1.1.1.5 xsrc/xfree/xc/lib/Xaw/XawIm.c:1.2
--- xsrc/xfree/xc/lib/Xaw/XawIm.c:1.1.1.5	Fri Mar  5 14:24:22 2004
+++ xsrc/xfree/xc/lib/Xaw/XawIm.c	Tue Nov  1 12:52:24 2011
@@ -185,14 +185,14 @@ static VendorShellWidget SearchVendorShe
 return(NULL);
 }
 
-static XContext extContext = (XContext)NULL;
+static XContext extContext = (XContext)0;
 
 static XawVendorShellExtPart *
 SetExtPart(VendorShellWidget w, XawVendorShellExtWidget vew)
 {
 contextDataRec *contextData;
 
-if (extContext == (XContext)NULL) extContext = XUniqueContext();
+if (extContext == (XContext)0) extContext = XUniqueContext();
 
 contextData = XtNew(contextDataRec);
 contextData-parent = (Widget)w;
@@ -297,13 +297,13 @@ ConfigureCB(Widget w, XtPointer closure,
 }
 }
 
-static XContext errContext = (XContext)NULL;
+static XContext errContext = (XContext)0;
 
 static Widget SetErrCnxt(Widget w, XIM xim)
 {
 contextErrDataRec *contextErrData;
 
-if (errContext == (XContext)NULL) errContext = XUniqueContext();
+if (errContext == (XContext)0) errContext = XUniqueContext();
 
 contextErrData = XtNew(contextErrDataRec);
 contextErrData-widget = w;
@@ -1404,12 +1404,12 @@ Destroy(Widget w, XawVendorShellExtPart 
 	return;
 XtFree( (char*) ve-im.resources );
 
-if (extContext != (XContext)NULL  
+if (extContext != (XContext)0  
 	!XFindContext (XtDisplay (w), (Window)w, 
 		   extContext, (XPointer*)contextData))
 XtFree( (char*) contextData );
 
-if (errContext != (XContext)NULL  
+if (errContext != (XContext)0  
 	!XFindContext (XDisplayOfIM( ve-im.xim ), (Window) ve-im.xim, 
 		   errContext, (XPointer*) contextErrData))
 XtFree( (char*) contextErrData );

Index: xsrc/xfree/xc/lib/Xp/XpNotifyPdm.c
diff -u xsrc/xfree/xc/lib/Xp/XpNotifyPdm.c:1.1.1.5 xsrc/xfree/xc/lib/Xp/XpNotifyPdm.c:1.2
--- xsrc/xfree/xc/lib/Xp/XpNotifyPdm.c:1.1.1.5	Fri Mar  5 14:24:27 2004
+++ xsrc/xfree/xc/lib/Xp/XpNotifyPdm.c	Tue Nov  1 12:52:24 2011
@@ -228,7 +228,7 @@ XpGetPdmStartParams (
 	/*
 	 * Error - cannot determine or establish a selection_display.
 	 */
-	return( (Status) NULL );
+	return( (Status) 0 );
 }
 
 /*
@@ -265,7 +265,7 @@ XpGetPdmStartParams (
 	XCloseDisplay( *selection_display );
 	*selection_display = (Display *) NULL;
 	}
-	return( (Status) NULL );
+	return( (Status) 0 );
 }
 
 status = XmbTextListToTextProperty( *selection_display, list, 6,
@@ -280,7 +280,7 @@ XpGetPdmStartParams (
 	XCloseDisplay( *selection_display );
 	*selection_display = (Display *) NULL;
 	}
-	return( (Status) NULL );
+	return( (Status) 0 );
 }
 
 *type  = text_prop.encoding;
@@ -894,4 +894,3 @@ XpNotifyPdm (
 	return( _xpstrdup( cdata ) );
 }
 }
-

Index: 

CVS commit: src/external/gpl3/gcc/dist/gcc/config/vax

2011-11-10 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Nov 10 17:16:30 UTC 2011

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/vax: builtins.md vax.md

Log Message:
include builtins.md in vax.md so that ffs is defined.
update for conditional branch changes in gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md \
src/external/gpl3/gcc/dist/gcc/config/vax/vax.md

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md:1.2
--- src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md:1.1.1.1	Tue Jun 21 01:22:25 2011
+++ src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md	Thu Nov 10 17:16:30 2011
@@ -24,6 +24,12 @@
   ]
 )
 
+(define_expand condjump
+  [(set (pc)
+	(if_then_else (match_operand 0)
+		  (label_ref (match_operand 1))
+		  (pc)))])
+
 (define_expand ffssi2
   [(set (match_operand:SI 0 nonimmediate_operand )
 	(ffs:SI (match_operand:SI 1 general_operand )))]
@@ -32,7 +38,7 @@
 {
   rtx label = gen_label_rtx ();
   emit_insn (gen_ffssi2_internal (operands[0], operands[1]));
-  emit_jump_insn (gen_bne (label));
+  emit_jump_insn (gen_condjump (gen_rtx_NE(VOIDmode, cc0_rtx, const0_rtx), label));
   emit_insn (gen_negsi2 (operands[0], const1_rtx));
   emit_label (label);
   emit_insn (gen_addsi3 (operands[0], operands[0], const1_rtx));
@@ -189,4 +195,3 @@
 	  (const_int 0))])]
   
   jbcci %1,%0,%l2)
-
Index: src/external/gpl3/gcc/dist/gcc/config/vax/vax.md
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax.md:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/vax/vax.md:1.2
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax.md:1.1.1.1	Tue Jun 21 01:22:25 2011
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax.md	Thu Nov 10 17:16:30 2011
@@ -1634,3 +1634,5 @@
   emit_barrier ();
   DONE;
 })
+
+(include builtins.md)



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

2011-11-10 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Nov 10 17:18:22 UTC 2011

Modified Files:
src/distrib/sets/lists/comp: md.vax

Log Message:
add gcc-4.5/tgmath.h


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/distrib/sets/lists/comp/md.vax

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

Modified files:

Index: src/distrib/sets/lists/comp/md.vax
diff -u src/distrib/sets/lists/comp/md.vax:1.36 src/distrib/sets/lists/comp/md.vax:1.37
--- src/distrib/sets/lists/comp/md.vax:1.36	Sun Jul 17 20:54:32 2011
+++ src/distrib/sets/lists/comp/md.vax	Thu Nov 10 17:18:22 2011
@@ -1,5 +1,6 @@
-# $NetBSD: md.vax,v 1.36 2011/07/17 20:54:32 joerg Exp $
+# $NetBSD: md.vax,v 1.37 2011/11/10 17:18:22 chs Exp $
 ./usr/include/ieeefp.hcomp-obsolete		obsolete
+./usr/include/gcc-4.5/tgmath.h			comp-c-include		gcccmds,gcc=45
 ./usr/include/vaxcomp-c-include
 ./usr/include/vax/_G_config.h			comp-obsolete		obsolete
 ./usr/include/vax/ansi.h			comp-c-include



CVS commit: src/lib/libpuffs

2011-11-13 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Nov 14 01:27:42 UTC 2011

Modified Files:
src/lib/libpuffs: puffs.c

Log Message:
fix crashes caused by using the results of getcontext()
after the caller returns.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/lib/libpuffs/puffs.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/libpuffs/puffs.c
diff -u src/lib/libpuffs/puffs.c:1.116 src/lib/libpuffs/puffs.c:1.117
--- src/lib/libpuffs/puffs.c:1.116	Tue May  3 13:16:47 2011
+++ src/lib/libpuffs/puffs.c	Mon Nov 14 01:27:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs.c,v 1.116 2011/05/03 13:16:47 manu Exp $	*/
+/*	$NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: puffs.c,v 1.116 2011/05/03 13:16:47 manu Exp $);
+__RCSID($NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $);
 #endif /* !lint */
 
 #include sys/param.h
@@ -993,9 +993,30 @@ puffs_mainloop(struct puffs_usermount *p
 	if (puffs__cc_create(pu, puffs__theloop, pcc) == -1) {
 		goto out;
 	}
+
+#if 0
 	if (puffs__cc_savemain(pu) == -1) {
 		goto out;
 	}
+#else
+	/*
+	 * XXX
+	 * puffs__cc_savemain() uses getcontext() and then returns.
+	 * the caller (this function) may overwrite the stack frame
+	 * of puffs__cc_savemain(), so when we call setcontext() later and
+	 * return from puffs__cc_savemain() again, the return address or
+	 * saved stack pointer can be garbage.
+	 * avoid this by calling getcontext() directly here.
+	 */
+	extern int puffs_fakecc;
+	if (!puffs_fakecc) {
+		PU_CLRSFLAG(pu, PU_MAINRESTORE);
+		if (getcontext(pu-pu_mainctx) == -1) {
+			goto out;
+		}
+	}
+#endif
+
 	if ((pu-pu_state  PU_MAINRESTORE) == 0)
 		puffs_cc_continue(pcc);
 



CVS commit: src/lib/libc/arch/vax

2011-11-21 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Nov 21 16:17:48 UTC 2011

Modified Files:
src/lib/libc/arch/vax/gen: alloca.S
src/lib/libc/arch/vax/sys: __vfork14.S getcontext.S

Log Message:
gcc 4.5 on vax creates PLT stubs with an entry mask of 0xffc
rather than 0 like gcc 4.1 did, so the sneaky assembly functions
that ret without really returning now clobber their registers.
adjust these functions to avoid this problem.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/vax/gen/alloca.S
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/vax/sys/__vfork14.S
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/vax/sys/getcontext.S

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

Modified files:

Index: src/lib/libc/arch/vax/gen/alloca.S
diff -u src/lib/libc/arch/vax/gen/alloca.S:1.4 src/lib/libc/arch/vax/gen/alloca.S:1.5
--- src/lib/libc/arch/vax/gen/alloca.S:1.4	Tue Jan 25 02:38:15 2011
+++ src/lib/libc/arch/vax/gen/alloca.S	Mon Nov 21 16:17:48 2011
@@ -31,17 +31,17 @@
 
 #if defined(LIBC_SCCS)  !defined(lint)
 	/* .asciz @(#)alloca.s	8.1 (Berkeley) 6/4/93 */
-RCSID($NetBSD: alloca.S,v 1.4 2011/01/25 02:38:15 matt Exp $)
+RCSID($NetBSD: alloca.S,v 1.5 2011/11/21 16:17:48 chs Exp $)
 #endif /* LIBC_SCCS and not lint */
 
 ENTRY(alloca, 0)
 	movl	4(%ap),%r0	# get allocation size
-	movl	16(%fp),%r2	# save return address before we smash it
+	movl	16(%fp),%r1	# save return address before we smash it
 	movab	here,16(%fp)
 	ret
 here:
 	subl2	%r0,%sp		# create stack space
 	bicl2	$3,%sp		# align to longword boundary
 	movl	%sp,%r0
-	jmp	(%r2)
+	jmp	(%r1)
 END(alloca)

Index: src/lib/libc/arch/vax/sys/__vfork14.S
diff -u src/lib/libc/arch/vax/sys/__vfork14.S:1.6 src/lib/libc/arch/vax/sys/__vfork14.S:1.7
--- src/lib/libc/arch/vax/sys/__vfork14.S:1.6	Tue Jan 25 02:38:15 2011
+++ src/lib/libc/arch/vax/sys/__vfork14.S	Mon Nov 21 16:17:48 2011
@@ -31,7 +31,7 @@
 
 #if defined(SYSLIBC_SCCS)  !defined(lint)
 	/* .asciz @(#)Ovfork.s	8.1 (Berkeley) 6/4/93 */
-RCSID($NetBSD: __vfork14.S,v 1.6 2011/01/25 02:38:15 matt Exp $)
+RCSID($NetBSD: __vfork14.S,v 1.7 2011/11/21 16:17:48 chs Exp $)
 #endif /* SYSLIBC_SCCS and not lint */
 
 /*
@@ -51,10 +51,11 @@ RCSID($NetBSD: __vfork14.S,v 1.6 2011/0
  */
 
 ENTRY(__vfork14, 0)
-	movl	16(%fp),%r2	# save return address before we smash it
+	movl	16(%fp),%r0	# save return address before we smash it
 	movab	here,16(%fp)
 	ret
 here:
+	movl	%r0,%r2
 	chmk	$ SYS___vfork14
 	bcs	err		# if failed, set errno and return -1
 	/* this next trick is Chris Torek's fault */

Index: src/lib/libc/arch/vax/sys/getcontext.S
diff -u src/lib/libc/arch/vax/sys/getcontext.S:1.5 src/lib/libc/arch/vax/sys/getcontext.S:1.6
--- src/lib/libc/arch/vax/sys/getcontext.S:1.5	Tue Jan 25 02:38:15 2011
+++ src/lib/libc/arch/vax/sys/getcontext.S	Mon Nov 21 16:17:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: getcontext.S,v 1.5 2011/01/25 02:38:15 matt Exp $	*/
+/*	$NetBSD: getcontext.S,v 1.6 2011/11/21 16:17:48 chs Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include SYS.h
 
 #ifdef SYSLIBC_SCCS
-RCSID($NetBSD: getcontext.S,v 1.5 2011/01/25 02:38:15 matt Exp $)
+RCSID($NetBSD: getcontext.S,v 1.6 2011/11/21 16:17:48 chs Exp $)
 #endif
 
 #ifdef WEAK_ALIAS
@@ -48,8 +48,8 @@ ENTRY(_getcontext, 0)
 	jcc	1f
 	jmp	CERROR+2		/* badness happened */
 
-1:	movl	4(%ap),%r2		/* ptr to ucontext */
-	movl	16(%fp),%r3		/* PC to return to */
+1:	movl	4(%ap),%r0		/* ptr to ucontext */
+	movl	16(%fp),%r1		/* PC to return to */
 	movab	2f,16(%fp)		/* let's return early */
 	ret
 	/*
@@ -59,8 +59,9 @@ ENTRY(_getcontext, 0)
 	 * the callers state but we still have control.
 	 */
 	_ALIGN_TEXT
-2:	movq	%ap,(36+12*4)(%r2)	/* adjust AP + SP */
-	movl	%fp,(36+14*4)(%r2)	/* adjust FP */
-	movl	%r3,(36+15*4)(%r2)	/* adjust PC */
-	jmp	(%r3)			/* and return */
+2:	movq	%ap,(36+12*4)(%r0)	/* adjust AP + SP */
+	movl	%fp,(36+14*4)(%r0)	/* adjust FP */
+	movl	%r3,(36+15*4)(%r0)	/* adjust PC */
+	clrl	%r0
+	jmp	(%r1)			/* and return */
 END(_getcontext)



CVS commit: src/sys/arch

2011-12-04 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Dec  4 16:24:13 UTC 2011

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

Log Message:
map all of physical memory using large pages.
ported from openbsd years ago by Murray Armfield,
updated for changes since then by me.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.171 -r1.172 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.65 src/sys/arch/amd64/amd64/locore.S:1.66
--- src/sys/arch/amd64/amd64/locore.S:1.65	Fri May 20 13:32:35 2011
+++ src/sys/arch/amd64/amd64/locore.S	Sun Dec  4 16:24:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.65 2011/05/20 13:32:35 joerg Exp $	*/
+/*	$NetBSD: locore.S,v 1.66 2011/12/04 16:24:13 chs Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1290,10 +1290,11 @@ iret_return:
 	jmp	.Losyscall_checkast	/* re-check ASTs */
 
 /*
- * void sse2_idlezero_page(void *pg)
+ * bool sse2_idlezero_page(void *pg)
  *
  * Zero a page without polluting the cache.  Preemption must be
  * disabled by the caller. Abort if a preemption is pending.
+ * Returns true if the page is zeroed, false if not.
  */
 ENTRY(sse2_idlezero_page)
 	pushq	%rbp
@@ -1323,3 +1324,27 @@ ENTRY(sse2_idlezero_page)
 	sfence
 	popq	%rbp
 	ret
+
+/*
+ * void pagezero(vaddr_t va)
+ *
+ * Zero a page without polluting the cache.
+ */
+
+ENTRY(pagezero)
+	movq	$-PAGE_SIZE,%rdx
+	subq	%rdx,%rdi
+	xorq	%rax,%rax
+1:
+	movnti	%rax,(%rdi,%rdx)
+	movnti	%rax,8(%rdi,%rdx)
+	movnti	%rax,16(%rdi,%rdx)
+	movnti	%rax,24(%rdi,%rdx)
+	movnti	%rax,32(%rdi,%rdx)
+	movnti	%rax,40(%rdi,%rdx)
+	movnti	%rax,48(%rdi,%rdx)
+	movnti	%rax,56(%rdi,%rdx)
+	addq	$64,%rdx
+	jne	1b
+	sfence
+	ret

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.171 src/sys/arch/amd64/amd64/machdep.c:1.172
--- src/sys/arch/amd64/amd64/machdep.c:1.171	Sun Nov 20 18:42:56 2011
+++ src/sys/arch/amd64/amd64/machdep.c	Sun Dec  4 16:24:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.171 2011/11/20 18:42:56 yamt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.172 2011/12/04 16:24:13 chs Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.171 2011/11/20 18:42:56 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.172 2011/12/04 16:24:13 chs Exp $);
 
 /* #define XENDEBUG_LOW  */
 
@@ -1678,6 +1678,26 @@ init_x86_64(paddr_t first_avail)
 	 * Page 7:	Temporary page map level 4
 	 */
 	avail_start = 8 * PAGE_SIZE;
+
+#if !defined(REALBASEMEM)  !defined(REALEXTMEM)
+
+	/*
+	 * Check to see if we have a memory map from the BIOS (passed
+	 * to us by the boot program.
+	 */
+	bim = lookup_bootinfo(BTINFO_MEMMAP);
+	if (bim != NULL  bim-num  0)
+		initx86_parse_memmap(bim, iomem_ex);
+
+#endif	/* ! REALBASEMEM  ! REALEXTMEM */
+
+	/*
+	 * If the loop above didn't find any valid segment, fall back to
+	 * former code.
+	 */
+	if (mem_cluster_cnt == 0)
+		initx86_fake_memmap(iomem_ex);
+
 #else	/* XEN */
 	/* Parse Xen command line (replace bootinfo */
 	xen_parse_cmdline(XEN_PARSE_BOOTFLAGS, NULL);
@@ -1701,25 +1721,6 @@ init_x86_64(paddr_t first_avail)
 		pmap_prealloc_lowmem_ptps();
 
 #ifndef XEN
-#if !defined(REALBASEMEM)  !defined(REALEXTMEM)
-
-	/*
-	 * Check to see if we have a memory map from the BIOS (passed
-	 * to us by the boot program.
-	 */
-	bim = lookup_bootinfo(BTINFO_MEMMAP);
-	if (bim != NULL  bim-num  0)
-		initx86_parse_memmap(bim, iomem_ex);
-
-#endif	/* ! REALBASEMEM  ! REALEXTMEM */
-
-	/*
-	 * If the loop above didn't find any valid segment, fall back to
-	 * former code.
-	 */
-	if (mem_cluster_cnt == 0)
-		initx86_fake_memmap(iomem_ex);
-
 	initx86_load_memmap(first_avail);
 
 #else	/* XEN */
@@ -2327,3 +2328,24 @@ x86_64_tls_switch(struct lwp *l)
 	}
 }
 #endif
+
+#ifdef __HAVE_DIRECT_MAP
+bool
+mm_md_direct_mapped_io(void *addr, paddr_t *paddr)
+{
+	vaddr_t va = (vaddr_t)addr;
+
+	if (va = PMAP_DIRECT_BASE  va  PMAP_DIRECT_END) {
+		*paddr = PMAP_DIRECT_UNMAP(va);
+		return true;
+	}
+	return false;
+}
+
+bool
+mm_md_direct_mapped_phys(paddr_t paddr, vaddr_t *vaddr)
+{
+	*vaddr = PMAP_DIRECT_MAP(paddr);
+	return true;
+}
+#endif

Index: src/sys/arch/amd64/include/types.h
diff -u src/sys/arch/amd64/include/types.h:1.39 src/sys/arch/amd64/include/types.h:1.40
--- src/sys/arch/amd64/include/types.h:1.39	Wed Jul  6 18:46:04 2011
+++ src/sys/arch/amd64/include/types.h	Sun 

CVS commit: src

2011-12-04 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Dec  4 17:00:10 UTC 2011

Modified Files:
src/sys/arch/x86/include: cacheinfo.h
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
add info on L2 TLBs and 1GB pages.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/include/cacheinfo.h
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/sys/arch/x86/include/cacheinfo.h
diff -u src/sys/arch/x86/include/cacheinfo.h:1.12 src/sys/arch/x86/include/cacheinfo.h:1.13
--- src/sys/arch/x86/include/cacheinfo.h:1.12	Wed May 13 23:26:38 2009
+++ src/sys/arch/x86/include/cacheinfo.h	Sun Dec  4 17:00:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cacheinfo.h,v 1.12 2009/05/13 23:26:38 pgoyette Exp $	*/
+/*	$NetBSD: cacheinfo.h,v 1.13 2011/12/04 17:00:10 chs Exp $	*/
 
 #ifndef _X86_CACHEINFO_H_
 #define _X86_CACHEINFO_H_
@@ -26,8 +26,12 @@ struct x86_cache_info {
 #define	CAI_L1_1GBDTLB	9		/* L1 1GB Page data TLB */
 #define CAI_L2_1GBITLB	10		/* L2 1GB Page instruction TLB */
 #define CAI_L2_1GBDTLB	11		/* L2 1GB Page data TLB */
+#define CAI_L2_ITLB	12		/* L2 Instruction TLB (4K pages) */
+#define CAI_L2_ITLB2	13		/* L2 Instruction TLB (2/4M pages) */
+#define CAI_L2_DTLB	14		/* L2 Data TLB (4K pages) */
+#define CAI_L2_DTLB2	15		/* L2 Data TLB (2/4M pages) */
 
-#define	CAI_COUNT	12
+#define	CAI_COUNT	16
 
 /*
  * AMD Cache Info:

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.25 src/usr.sbin/cpuctl/arch/i386.c:1.26
--- src/usr.sbin/cpuctl/arch/i386.c:1.25	Tue May  3 09:06:22 2011
+++ src/usr.sbin/cpuctl/arch/i386.c	Sun Dec  4 17:00:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.25 2011/05/03 09:06:22 jruoho Exp $	*/
+/*	$NetBSD: i386.c,v 1.26 2011/12/04 17:00:10 chs Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: i386.c,v 1.25 2011/05/03 09:06:22 jruoho Exp $);
+__RCSID($NetBSD: i386.c,v 1.26 2011/12/04 17:00:10 chs Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -182,6 +182,7 @@ static const char * const amd_brand[] = 
 static int cpu_vendor;
 static char cpu_brand_string[49];
 static char amd_brand_name[48];
+static int use_pae, largepagesize;
 
 static void via_cpu_probe(struct cpu_info *);
 static void amd_family6_probe(struct cpu_info *);
@@ -1380,6 +1381,9 @@ identifycpu(const char *cpuname)
 
 	sz = sizeof(ci-ci_tsc_freq);
 	(void)sysctlbyname(machdep.tsc_freq, ci-ci_tsc_freq, sz, NULL, 0);
+	sz = sizeof(use_pae);
+	(void)sysctlbyname(machdep.pae, use_pae, sz, NULL, 0);
+	largepagesize = (use_pae ? 2 * 1024 * 1024 : 4 * 1024 * 1024);
 
 	snprintf(cpu_model, sizeof(cpu_model), %s%s%s%s%s%s%s (%s-class),
 	vendorname,
@@ -1669,12 +1673,12 @@ amd_cpu_cacheinfo(struct cpu_info *ci)
 		cai = ci-ci_cinfo[CAI_ITLB2];
 		cai-cai_totalsize = AMD_L1_EAX_ITLB_ENTRIES(descs[0]);
 		cai-cai_associativity = AMD_L1_EAX_ITLB_ASSOC(descs[0]);
-		cai-cai_linesize = (4 * 1024 * 1024);
+		cai-cai_linesize = largepagesize;
 
 		cai = ci-ci_cinfo[CAI_DTLB2];
 		cai-cai_totalsize = AMD_L1_EAX_DTLB_ENTRIES(descs[0]);
 		cai-cai_associativity = AMD_L1_EAX_DTLB_ASSOC(descs[0]);
-		cai-cai_linesize = (4 * 1024 * 1024);
+		cai-cai_linesize = largepagesize;
 	}
 
 	cai = ci-ci_cinfo[CAI_ITLB];
@@ -1707,6 +1711,50 @@ amd_cpu_cacheinfo(struct cpu_info *ci)
 
 	x86_cpuid(0x8006, descs);
 
+	cai = ci-ci_cinfo[CAI_L2_ITLB];
+	cai-cai_totalsize = AMD_L2_EBX_IUTLB_ENTRIES(descs[1]);
+	cai-cai_associativity = AMD_L2_EBX_IUTLB_ASSOC(descs[1]);
+	cai-cai_linesize = (4 * 1024);
+	cp = cache_info_lookup(amd_cpuid_l2cache_assoc_info,
+	cai-cai_associativity);
+	if (cp != NULL)
+		cai-cai_associativity = cp-cai_associativity;
+	else
+		cai-cai_associativity = 0;	/* XXX Unknown/reserved */
+
+	cai = ci-ci_cinfo[CAI_L2_ITLB2];
+	cai-cai_totalsize = AMD_L2_EAX_IUTLB_ENTRIES(descs[0]);
+	cai-cai_associativity = AMD_L2_EAX_IUTLB_ASSOC(descs[0]);
+	cai-cai_linesize = largepagesize;
+	cp = cache_info_lookup(amd_cpuid_l2cache_assoc_info,
+	cai-cai_associativity);
+	if (cp != NULL)
+		cai-cai_associativity = cp-cai_associativity;
+	else
+		cai-cai_associativity = 0;	/* XXX Unknown/reserved */
+
+	cai = ci-ci_cinfo[CAI_L2_DTLB];
+	cai-cai_totalsize = AMD_L2_EBX_DTLB_ENTRIES(descs[1]);
+	cai-cai_associativity = AMD_L2_EBX_DTLB_ASSOC(descs[1]);
+	cai-cai_linesize = (4 * 1024);
+	cp = cache_info_lookup(amd_cpuid_l2cache_assoc_info,
+	cai-cai_associativity);
+	if (cp != NULL)
+		cai-cai_associativity = cp-cai_associativity;
+	else
+		cai-cai_associativity = 0;	/* XXX Unknown/reserved */
+
+	cai = ci-ci_cinfo[CAI_L2_DTLB2];
+	cai-cai_totalsize = AMD_L2_EAX_DTLB_ENTRIES(descs[0]);
+	cai-cai_associativity = AMD_L2_EAX_DTLB_ASSOC(descs[0]);
+	cai-cai_linesize = largepagesize;
+	cp = 

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

2011-12-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Dec  8 15:35:35 UTC 2011

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

Log Message:
allow building without direct-map support in non-XEN kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 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.144 src/sys/arch/x86/x86/pmap.c:1.145
--- src/sys/arch/x86/x86/pmap.c:1.144	Wed Dec  7 15:47:42 2011
+++ src/sys/arch/x86/x86/pmap.c	Thu Dec  8 15:35:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.144 2011/12/07 15:47:42 cegger Exp $	*/
+/*	$NetBSD: pmap.c,v 1.145 2011/12/08 15:35:34 chs 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.144 2011/12/07 15:47:42 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.145 2011/12/08 15:35:34 chs Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -1598,7 +1598,14 @@ pmap_prealloc_lowmem_ptps(void)
 	for (;;) {
 		newp = avail_start;
 		avail_start += PAGE_SIZE;
+#ifdef __HAVE_DIRECT_MAP
 		memset((void *)PMAP_DIRECT_MAP(newp), 0, PAGE_SIZE);
+#else
+		pmap_pte_set(early_zero_pte, (newp  PG_FRAME) | PG_V | PG_RW);
+		pmap_pte_flush();
+		pmap_update_pg((vaddr_t)early_zerop);
+		memset(early_zerop, 0, PAGE_SIZE);
+#endif
 		pdes[pl_i(0, level)] = (newp  PG_FRAME) | PG_V | PG_RW;
 		level--;
 		if (level = 1)



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

2011-12-09 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Dec  9 17:32:51 UTC 2011

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

Log Message:
only use PG_G on leaf PTEs.
go back to tlbflush(), all the global entries
that we create in pmap_bootstrap() are permanent.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 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.146 src/sys/arch/x86/x86/pmap.c:1.147
--- src/sys/arch/x86/x86/pmap.c:1.146	Thu Dec  8 22:36:42 2011
+++ src/sys/arch/x86/x86/pmap.c	Fri Dec  9 17:32:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.146 2011/12/08 22:36:42 rmind Exp $	*/
+/*	$NetBSD: pmap.c,v 1.147 2011/12/09 17:32:51 chs 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.146 2011/12/08 22:36:42 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.147 2011/12/09 17:32:51 chs Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -1365,13 +1365,13 @@ pmap_bootstrap(vaddr_t kva_start)
 
 			pde = (pd_entry_t *)(tmpva + (pdp  ~PG_FRAME));
 			*pde = (dmpd + (i  PAGE_SHIFT)) |
-PG_RW | PG_V | PG_U | PG_G;
+PG_RW | PG_V | PG_U;
 		}
 	}
 
 	kpm-pm_pdir[PDIR_SLOT_DIRECT] = dmpdp | PG_KW | PG_V | PG_U;
 
-	tlbflushg();
+	tlbflush();
 
 #else
 	if (VM_MIN_KERNEL_ADDRESS != KERNBASE) {



CVS commit: src

2012-01-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Jan  7 16:47:43 UTC 2012

Modified Files:
src/lib/libc/arch/vax/gen: _lwp.c
src/sys/arch/vax/include: mcontext.h
src/sys/arch/vax/vax: machdep.c

Log Message:
define _UC_TLSBASE and use it to pass the TLS pointer to setcontext().
since there is no available space in ucontext_t on vax, pass the
TLS pointer on the stack referenced by the ucontext_t instead.
suggested by joerg.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/vax/gen/_lwp.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/vax/include/mcontext.h
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/vax/vax/machdep.c

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

Modified files:

Index: src/lib/libc/arch/vax/gen/_lwp.c
diff -u src/lib/libc/arch/vax/gen/_lwp.c:1.1 src/lib/libc/arch/vax/gen/_lwp.c:1.2
--- src/lib/libc/arch/vax/gen/_lwp.c:1.1	Wed Jun  3 01:02:28 2009
+++ src/lib/libc/arch/vax/gen/_lwp.c	Sat Jan  7 16:47:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: _lwp.c,v 1.1 2009/06/03 01:02:28 christos Exp $	*/
+/*	$NetBSD: _lwp.c,v 1.2 2012/01/07 16:47:42 chs Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: _lwp.c,v 1.1 2009/06/03 01:02:28 christos Exp $);
+__RCSID($NetBSD: _lwp.c,v 1.2 2012/01/07 16:47:42 chs Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include namespace.h
@@ -76,4 +76,12 @@ _lwp_makecontext(ucontext_t *u, void (*s
 	gr[_REG_SP] = (__greg_t)sp;
 	gr[_REG_FP] = (__greg_t)sp;
 	gr[_REG_PC] = (__greg_t)start + 2;
+
+	/*
+	 * Push the TLS pointer onto the new stack also.
+	 * The _UC_TLSBASE flag tells the kernel to pop it and use it.
+	 */
+	*--sp = (intptr_t)private;
+	gr[_REG_SP] = (__greg_t)sp;
+	u-uc_flags |= _UC_TLSBASE;
 }

Index: src/sys/arch/vax/include/mcontext.h
diff -u src/sys/arch/vax/include/mcontext.h:1.6 src/sys/arch/vax/include/mcontext.h:1.7
--- src/sys/arch/vax/include/mcontext.h:1.6	Tue Apr 12 18:24:28 2011
+++ src/sys/arch/vax/include/mcontext.h	Sat Jan  7 16:47:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.6 2011/04/12 18:24:28 matt Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.7 2012/01/07 16:47:42 chs Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -64,6 +64,9 @@ typedef struct {
 	__gregset_t	__gregs;	/* General Purpose Register set */
 } mcontext_t;
 
+/* Machine-dependent uc_flags */
+#define _UC_TLSBASE	0x0008
+
 #define	_UC_MACHINE_SP(uc)	((uc)-uc_mcontext.__gregs[_REG_SP])
 #define	_UC_MACHINE_PC(uc)	((uc)-uc_mcontext.__gregs[_REG_PC])
 #define	_UC_MACHINE_INTRV(uc)	((uc)-uc_mcontext.__gregs[_REG_R0])

Index: src/sys/arch/vax/vax/machdep.c
diff -u src/sys/arch/vax/vax/machdep.c:1.183 src/sys/arch/vax/vax/machdep.c:1.184
--- src/sys/arch/vax/vax/machdep.c:1.183	Mon Dec 12 19:03:12 2011
+++ src/sys/arch/vax/vax/machdep.c	Sat Jan  7 16:47:42 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.183 2011/12/12 19:03:12 mrg Exp $	 */
+/* $NetBSD: machdep.c,v 1.184 2012/01/07 16:47:42 chs Exp $	 */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.183 2011/12/12 19:03:12 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.184 2012/01/07 16:47:42 chs Exp $);
 
 #include opt_ddb.h
 #include opt_compat_netbsd.h
@@ -719,6 +719,18 @@ cpu_setmcontext(struct lwp *l, const mco
 	tf-tf_sp = gr[_REG_SP];
 	tf-tf_pc = gr[_REG_PC];
 	tf-tf_psl = gr[_REG_PSL];
+
+	if (flags  _UC_TLSBASE) {
+		void *tlsbase;
+		int error;
+
+		error = copyin((void *)tf-tf_sp, tlsbase, sizeof(tlsbase));
+		if (error) {
+			return error;
+		}
+		lwp_setprivate(l, tlsbase);
+		tf-tf_sp += sizeof(tlsbase);
+	}
 	return 0;
 }
 



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

2012-07-01 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jul  2 01:05:49 UTC 2012

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

Log Message:
in cpu_boot_secondary_processors(), wait until all the other CPUs
have registered themselves in kcpuset_running before returning.
recent changes to the TLB invalidation xcall code assume that
any CPU which will receive a broadcast IPI is registered in
kcpuset_running, so ensure that is true by waiting here.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/x86/x86/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/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.99 src/sys/arch/x86/x86/cpu.c:1.100
--- src/sys/arch/x86/x86/cpu.c:1.99	Tue Jun 12 17:14:19 2012
+++ src/sys/arch/x86/x86/cpu.c	Mon Jul  2 01:05:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.99 2012/06/12 17:14:19 yamt Exp $	*/
+/*	$NetBSD: cpu.c,v 1.100 2012/07/02 01:05:48 chs Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.99 2012/06/12 17:14:19 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.100 2012/07/02 01:05:48 chs Exp $);
 
 #include opt_ddb.h
 #include opt_mpbios.h		/* for MPDEBUG */
@@ -589,12 +589,15 @@ void
 cpu_boot_secondary_processors(void)
 {
 	struct cpu_info *ci;
+	kcpuset_t *cpus;
 	u_long i;
 
 	/* Now that we know the number of CPUs, patch the text segment. */
 	x86_patch(false);
 
-	for (i=0; i  maxcpus; i++) {
+	kcpuset_create(cpus, true);
+	kcpuset_set(cpus, cpu_index(curcpu()));
+	for (i = 0; i  maxcpus; i++) {
 		ci = cpu_lookup(i);
 		if (ci == NULL)
 			continue;
@@ -605,7 +608,11 @@ cpu_boot_secondary_processors(void)
 		if (ci-ci_flags  (CPUF_BSP|CPUF_SP|CPUF_PRIMARY))
 			continue;
 		cpu_boot_secondary(ci);
+		kcpuset_set(cpus, cpu_index(ci));
 	}
+	while (!kcpuset_match(cpus, kcpuset_running))
+		;
+	kcpuset_destroy(cpus);
 
 	x86_mp_online = true;
 



CVS commit: src/sys/kern

2012-07-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jul  9 04:35:14 UTC 2012

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

Log Message:
in soreceive(), handle uios larger than 31 bits.
fixes the remaining problem in PR 43240.


To generate a diff of this commit:
cvs rdiff -u -r1.210 -r1.211 src/sys/kern/uipc_socket.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/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.210 src/sys/kern/uipc_socket.c:1.211
--- src/sys/kern/uipc_socket.c:1.210	Fri Mar 16 06:47:37 2012
+++ src/sys/kern/uipc_socket.c	Mon Jul  9 04:35:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.210 2012/03/16 06:47:37 matt Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.211 2012/07/09 04:35:13 chs Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.210 2012/03/16 06:47:37 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.211 2012/07/09 04:35:13 chs Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_sock_counters.h
@@ -1132,7 +1132,8 @@ soreceive(struct socket *so, struct mbuf
 {
 	struct lwp *l = curlwp;
 	struct mbuf	*m, **mp, *mt;
-	int atomic, flags, len, error, s, offset, moff, type, orig_resid;
+	size_t len, offset, moff, orig_resid;
+	int atomic, flags, error, s, type;
 	const struct protosw	*pr;
 	struct mbuf	*nextrecord;
 	int		mbuf_removed = 0;
@@ -1165,7 +1166,7 @@ soreceive(struct socket *so, struct mbuf
 			goto bad;
 		do {
 			error = uiomove(mtod(m, void *),
-			(int) min(uio-uio_resid, m-m_len), uio);
+			MIN(uio-uio_resid, m-m_len), uio);
 			m = m_free(m);
 		} while (uio-uio_resid  0  error == 0  m);
  bad:
@@ -1419,7 +1420,7 @@ soreceive(struct socket *so, struct mbuf
 			SBLASTMBUFCHK(so-so_rcv, soreceive uiomove);
 			sounlock(so);
 			splx(s);
-			error = uiomove(mtod(m, char *) + moff, (int)len, uio);
+			error = uiomove(mtod(m, char *) + moff, len, uio);
 			s = splsoftnet();
 			solock(so);
 			if (error != 0) {



CVS commit: src/sys/arch/evbarm/iq80310

2012-08-14 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Aug 14 15:46:21 UTC 2012

Modified Files:
src/sys/arch/evbarm/iq80310: iq80310_intr.c

Log Message:
move evcnt_attach_dynamic() calls later to avoid assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/evbarm/iq80310/iq80310_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/evbarm/iq80310/iq80310_intr.c
diff -u src/sys/arch/evbarm/iq80310/iq80310_intr.c:1.30 src/sys/arch/evbarm/iq80310/iq80310_intr.c:1.31
--- src/sys/arch/evbarm/iq80310/iq80310_intr.c:1.30	Thu Aug  2 15:56:07 2012
+++ src/sys/arch/evbarm/iq80310/iq80310_intr.c	Tue Aug 14 15:46:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: iq80310_intr.c,v 1.30 2012/08/02 15:56:07 skrll Exp $	*/
+/*	$NetBSD: iq80310_intr.c,v 1.31 2012/08/14 15:46:21 chs Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: iq80310_intr.c,v 1.30 2012/08/02 15:56:07 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: iq80310_intr.c,v 1.31 2012/08/14 15:46:21 chs Exp $);
 
 #ifndef EVBARM_SPL_NOINLINE
 #define	EVBARM_SPL_NOINLINE
@@ -338,8 +338,6 @@ iq80310_intr_init(void)
 		TAILQ_INIT(iq-iq_list);
 
 		sprintf(iq-iq_name, irq %d, i);
-		evcnt_attach_dynamic(iq-iq_ev, EVCNT_TYPE_INTR,
-		NULL, iq80310, iq-iq_name);
 	}
 
 	iq80310_intr_calculate_masks();
@@ -379,6 +377,8 @@ iq80310_intr_establish(int irq, int ipl,
 	oldirqstate = disable_interrupts(I32_bit);
 
 	TAILQ_INSERT_TAIL(iq-iq_list, ih, ih_list);
+	evcnt_attach_dynamic(iq-iq_ev, EVCNT_TYPE_INTR,
+	NULL, iq80310, iq-iq_name);
 
 	iq80310_intr_calculate_masks();
 



CVS commit: src/sys/uvm

2012-08-18 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Aug 18 14:28:05 UTC 2012

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

Log Message:
avoid leaking a uvm_object reference when merging a new map entry
with the entries on both sides.  fixes PR 46807.


To generate a diff of this commit:
cvs rdiff -u -r1.318 -r1.319 src/sys/uvm/uvm_map.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_map.c
diff -u src/sys/uvm/uvm_map.c:1.318 src/sys/uvm/uvm_map.c:1.319
--- src/sys/uvm/uvm_map.c:1.318	Mon Jul 30 23:56:48 2012
+++ src/sys/uvm/uvm_map.c	Sat Aug 18 14:28:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.318 2012/07/30 23:56:48 matt Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.319 2012/08/18 14:28:04 chs Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.318 2012/07/30 23:56:48 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.319 2012/08/18 14:28:04 chs Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -1445,9 +1445,8 @@ forwardmerge:
 		/*
 		 * drop our reference to uobj since we are extending a reference
 		 * that we already have (the ref count can not drop to zero).
-		 * (if merged, we've already detached)
 		 */
-		if (uobj  uobj-pgops-pgo_detach  !merged)
+		if (uobj  uobj-pgops-pgo_detach)
 			uobj-pgops-pgo_detach(uobj);
 
 		if (merged) {



CVS commit: src/sys/nfs

2012-08-27 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Aug 27 11:35:14 UTC 2012

Modified Files:
src/sys/nfs: nfs_serv.c

Log Message:
fix error handling in nfsrv_rename(): when the first nfs_namei() fails,
don't try to free the resources allocated by a successful lookup.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/nfs/nfs_serv.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/nfs/nfs_serv.c
diff -u src/sys/nfs/nfs_serv.c:1.163 src/sys/nfs/nfs_serv.c:1.164
--- src/sys/nfs/nfs_serv.c:1.163	Wed Feb  1 02:27:24 2012
+++ src/sys/nfs/nfs_serv.c	Mon Aug 27 11:35:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_serv.c,v 1.163 2012/02/01 02:27:24 matt Exp $	*/
+/*	$NetBSD: nfs_serv.c,v 1.164 2012/08/27 11:35:13 chs Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: nfs_serv.c,v 1.163 2012/02/01 02:27:24 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: nfs_serv.c,v 1.164 2012/08/27 11:35:13 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1931,6 +1931,7 @@ nfsrv_rename(struct nfsrv_descript *nfsd
 			VOP_UNLOCK(fdirp);
 	}
 	if (error) {
+		fromnd.ni_cnd.cn_nameiop = 0;
 		nfsm_reply(2 * NFSX_WCCDATA(v3));
 		nfsm_srvwcc_data(fdirfor_ret, fdirfor, fdiraft_ret, fdiraft);
 		nfsm_srvwcc_data(tdirfor_ret, tdirfor, tdiraft_ret, tdiraft);



CVS commit: src/sys/arch/ia64/ia64

2012-08-31 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Aug 31 14:31:46 UTC 2012

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

Log Message:
fix some confusion about PG_FAKE.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/ia64/ia64/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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.27 src/sys/arch/ia64/ia64/pmap.c:1.28
--- src/sys/arch/ia64/ia64/pmap.c:1.27	Fri Nov 12 07:59:26 2010
+++ src/sys/arch/ia64/ia64/pmap.c	Fri Aug 31 14:31:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.27 2010/11/12 07:59:26 uebayasi Exp $ */
+/* $NetBSD: pmap.c,v 1.28 2012/08/31 14:31:46 chs Exp $ */
 
 
 /*-
@@ -85,7 +85,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.27 2010/11/12 07:59:26 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.28 2012/08/31 14:31:46 chs Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1239,9 +1239,6 @@ pmap_clear_modify(struct vm_page *pg)
 	pmap_t oldpmap;
 	pv_entry_t pv;
 
-	if (pg-flags  PG_FAKE)
-		return rv;
-
 	TAILQ_FOREACH(pv, md-pv_list, pv_list) {
 		PMAP_LOCK(pv-pv_pmap);
 		oldpmap = pmap_install(pv-pv_pmap);
@@ -1448,7 +1445,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
  * Enter on the PV list if part of our managed memory.
  */
 
-if ((flags  (PG_FAKE)) == 0) {
+if (pg != NULL) {
 pmap_insert_entry(pmap, va, pg);
 managed = true;
 }
@@ -1478,7 +1475,7 @@ validate:
 
 
 /*
- *	Routine:	pmap_page_purge: = was: pmap_remove_all
+ *	Routine:	pmap_page_purge
  *	Function:
  *		Removes this physical page from
  *		all physical maps in which it resides.
@@ -1497,15 +1494,6 @@ pmap_page_purge(struct vm_page *pg)
 	pmap_t oldpmap;
 	pv_entry_t pv;
 
-#if defined(DIAGNOSTIC)
-	/*
-	 * XXX this makes pmap_page_protect(NONE) illegal for non-managed
-	 * pages!
-	 */
-	if (pg-flags  PG_FAKE) {
-		panic(pmap_page_protect: illegal for unmanaged page, va: 0x%lx, VM_PAGE_TO_PHYS(pg));
-	}
-#endif
 	//UVM_LOCK_ASSERT_PAGEQ();
 
 	while ((pv = TAILQ_FIRST(md-pv_list)) != NULL) {



CVS commit: src/sys/ufs/ext2fs

2012-09-01 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Sep  1 15:46:11 UTC 2012

Modified Files:
src/sys/ufs/ext2fs: ext2fs_vfsops.c

Log Message:
when failing a mount due to unsupported features,
print which features are involved.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/ufs/ext2fs/ext2fs_vfsops.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/ufs/ext2fs/ext2fs_vfsops.c
diff -u src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.164 src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.165
--- src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.164	Mon Apr 30 22:51:28 2012
+++ src/sys/ufs/ext2fs/ext2fs_vfsops.c	Sat Sep  1 15:46:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_vfsops.c,v 1.164 2012/04/30 22:51:28 rmind Exp $	*/
+/*	$NetBSD: ext2fs_vfsops.c,v 1.165 2012/09/01 15:46:11 chs Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ext2fs_vfsops.c,v 1.164 2012/04/30 22:51:28 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: ext2fs_vfsops.c,v 1.165 2012/09/01 15:46:11 chs Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -1228,20 +1228,21 @@ ext2fs_cgupdate(struct ufsmount *mp, int
 static int
 ext2fs_checksb(struct ext2fs *fs, int ronly)
 {
+	uint32_t u32;
 
 	if (fs2h16(fs-e2fs_magic) != E2FS_MAGIC) {
 		return (EINVAL);		/* XXX needs translation */
 	}
 	if (fs2h32(fs-e2fs_rev)  E2FS_REV1) {
 #ifdef DIAGNOSTIC
-		printf(Ext2 fs: unsupported revision number: %x\n,
+		printf(ext2fs: unsupported revision number: %x\n,
 		fs2h32(fs-e2fs_rev));
 #endif
 		return (EINVAL);		/* XXX needs translation */
 	}
 	if (fs2h32(fs-e2fs_log_bsize)  2) { /* block size = 1024|2048|4096 */
 #ifdef DIAGNOSTIC
-		printf(Ext2 fs: bad block size: %d 
+		printf(ext2fs: bad block size: %d 
 		(expected = 2 for ext2 fs)\n,
 		fs2h32(fs-e2fs_log_bsize));
 #endif
@@ -1249,16 +1250,19 @@ ext2fs_checksb(struct ext2fs *fs, int ro
 	}
 	if (fs2h32(fs-e2fs_rev)  E2FS_REV0) {
 		if (fs2h32(fs-e2fs_first_ino) != EXT2_FIRSTINO) {
-			printf(Ext2 fs: unsupported first inode position\n);
+			printf(ext2fs: unsupported first inode position\n);
 			return (EINVAL);  /* XXX needs translation */
 		}
-		if (fs2h32(fs-e2fs_features_incompat) 
-		~EXT2F_INCOMPAT_SUPP) {
-			printf(Ext2 fs: unsupported optional feature\n);
+		u32 = fs2h32(fs-e2fs_features_incompat)  ~EXT2F_INCOMPAT_SUPP;
+		if (u32) {
+			printf(ext2fs: unsupported incompat feature 0x%x\n,
+			   u32);
 			return (EINVAL);  /* XXX needs translation */
 		}
-		if (!ronly  fs2h32(fs-e2fs_features_rocompat) 
-		~EXT2F_ROCOMPAT_SUPP) {
+		u32 = fs2h32(fs-e2fs_features_rocompat)  ~EXT2F_ROCOMPAT_SUPP;
+		if (!ronly  u32) {
+			printf(ext2fs: unsupported ro-incompat feature 0x%x\n,
+			   u32);
 			return (EROFS);  /* XXX needs translation */
 		}
 	}



CVS commit: src/sys/dev/acpi

2012-09-22 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Sep 23 00:26:26 UTC 2012

Modified Files:
src/sys/dev/acpi: acpi_pci_link.c

Log Message:
re-enable the code to disable link devices at startup, ie. revert rev 1.3.
this fixes PCI interrupts on some systems (eg. HP XW9400) and we suspect that
the problems which led to the original change were caused by buggy early
implementations of ACPI, which are now ignored by date.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/acpi/acpi_pci_link.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/acpi/acpi_pci_link.c
diff -u src/sys/dev/acpi/acpi_pci_link.c:1.18 src/sys/dev/acpi/acpi_pci_link.c:1.19
--- src/sys/dev/acpi/acpi_pci_link.c:1.18	Fri Apr 23 15:52:26 2010
+++ src/sys/dev/acpi/acpi_pci_link.c	Sun Sep 23 00:26:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_pci_link.c,v 1.18 2010/04/23 15:52:26 jruoho Exp $	*/
+/*	$NetBSD: acpi_pci_link.c,v 1.19 2012/09/23 00:26:25 chs Exp $	*/
 
 /*-
  * Copyright (c) 2002 Mitsuru IWASAKI iwas...@jp.freebsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_pci_link.c,v 1.18 2010/04/23 15:52:26 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_pci_link.c,v 1.19 2012/09/23 00:26:25 chs Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -533,13 +533,11 @@ acpi_pci_link_attach(struct acpi_pci_lin
 	 * run _DIS (i.e., the method doesn't exist), assume the initial
 	 * IRQ was routed by the BIOS.
 	 */
-#if 0	/* XXX causes spontaneaous resets on some systems. Disabled for now. */
 	if (ACPI_SUCCESS(AcpiEvaluateObject(sc-pl_handle, _DIS, NULL,
 	NULL)))
 		for (i = 0; i  sc-pl_num_links; i++)
 			sc-pl_links[i].l_irq = PCI_INVALID_IRQ;
 	else
-#endif
 		for (i = 0; i  sc-pl_num_links; i++)
 			if (PCI_INTERRUPT_VALID(sc-pl_links[i].l_irq))
 sc-pl_links[i].l_routed = TRUE;



  1   2   3   4   5   >